diff --git a/backend/.env.example b/backend/.env.example new file mode 100644 index 0000000..527ff91 --- /dev/null +++ b/backend/.env.example @@ -0,0 +1,46 @@ +# ─── Servidor ──────────────────────────────────────────────────────────────── +PORT=4001 +NODE_ENV=production +APP_URL=https://seudominio.com.br + +# ─── PostgreSQL ─────────────────────────────────────────────────────────────── +PG_HOST=localhost +PG_PORT=5432 +PG_DATABASE=alemao +PG_USER=seu_usuario +PG_PASSWORD=sua_senha_segura + +# ─── JWT ───────────────────────────────────────────────────────────────────── +# Secret para tokens de admin (cloud_token) +JWT_SECRET=gere_com_openssl_rand_base64_32 +# Secret para tokens de super admin (super_token) — deve ser diferente do JWT_SECRET +SUPER_ADMIN_JWT_SECRET=gere_com_openssl_rand_base64_32_diferente +# Credenciais do super admin padrão (criado na primeira inicialização) +SUPER_ADMIN_EMAIL=super@admin.local +SUPER_ADMIN_PASSWORD=troque_antes_de_ir_para_producao + +# ─── Redis (BullMQ) ─────────────────────────────────────────────────────────── +REDIS_HOST=127.0.0.1 +REDIS_PORT=6379 + +# ─── NewWhats — Motor WhatsApp ──────────────────────────────────────────────── +# URL do motor NewWhats (usado pelo worker de envio e pelo proxy REST/WS) +# Deve ser a mesma URL configurada em plugin_configs.newwhats_url no banco. +NEWWHATS_API_URL=http://newwhats.local:8008 +# Token Bearer exigido pela API do motor +NEWWHATS_API_TOKEN=troque_pelo_token_real_do_motor +# Nº de mensagens processadas em paralelo pelo worker (1 = mais seguro, 2-3 = mais rápido) +WHATSAPP_WORKER_CONCURRENCY=1 + +# ─── Asaas ──────────────────────────────────────────────────────────────────── +# Chave global usada como fallback quando o tenant não tem asaas_key em tenant_config +ASAAS_API_KEY=$aact_SuaChaveAqui + +# ─── Configurações adicionais do plugin NewWhats (salvas no banco via admin) ── +# Os valores abaixo devem ser inseridos pelo admin em: +# PUT /api/plugins/newwhats/config +# { +# "integration_key": "", +# "newwhats_url": "http://newwhats.local:8008", +# "webhook_secret": "" +# } diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 0000000..b363878 --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1,15 @@ +# Variáveis de ambiente e segredos +.env +.env.local +.env.*.local + +# Dependências +node_modules/ + +# Logs +*.log +logs/ + +# Build/cache +.cache/ +dist/ diff --git a/frontend/customer/.gitignore b/frontend/customer/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/frontend/customer/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/frontend/sistema-nuvem/public/admin-v2/assets/index-7uQBmuvh.css b/frontend/sistema-nuvem/public/admin-v2/assets/index-7uQBmuvh.css new file mode 100644 index 0000000..f65b6c5 --- /dev/null +++ b/frontend/sistema-nuvem/public/admin-v2/assets/index-7uQBmuvh.css @@ -0,0 +1 @@ +*,: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: 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%}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.-bottom-0\.5{bottom:-.125rem}.-bottom-24{bottom:-6rem}.-right-0\.5{right:-.125rem}.-right-1{right:-.25rem}.-right-24{right:-6rem}.-top-0\.5{top:-.125rem}.-top-1{top:-.25rem}.bottom-0{bottom:0}.bottom-0\.5{bottom:.125rem}.bottom-3{bottom:.75rem}.bottom-4{bottom:1rem}.bottom-\[76px\]{bottom:76px}.bottom-full{bottom:100%}.left-0{left:0}.left-1\/2{left:50%}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-5{left:1.25rem}.left-full{left:100%}.right-0{right:0}.right-0\.5{right:.125rem}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\/2{top:50%}.top-12{top:3rem}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[10000\]{z-index:10000}.z-\[1000\]{z-index:1000}.z-\[1001\]{z-index:1001}.z-\[100\]{z-index:100}.z-\[60\]{z-index:60}.z-\[9999\]{z-index:9999}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.col-span-3{grid-column:span 3 / span 3}.col-span-full{grid-column:1 / -1}.m-3{margin:.75rem}.m-4{margin:1rem}.m-auto{margin:auto}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.-ml-1{margin-left:-.25rem}.-ml-2{margin-left:-.5rem}.mb-0{margin-bottom:0}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-10{margin-bottom:2.5rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mb-\[2px\]{margin-bottom:2px}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-5{margin-left:1.25rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-36{height:9rem}.h-4{height:1rem}.h-40{height:10rem}.h-44{height:11rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-52{height:13rem}.h-56{height:14rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-72{height:18rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[12px\]{height:12px}.h-\[14px\]{height:14px}.h-\[15px\]{height:15px}.h-\[18px\]{height:18px}.h-\[220px\]{height:220px}.h-\[35px\]{height:35px}.h-\[49px\]{height:49px}.h-\[600px\]{height:600px}.h-\[60px\]{height:60px}.h-\[72px\]{height:72px}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-40{max-height:10rem}.max-h-52{max-height:13rem}.max-h-64{max-height:16rem}.max-h-96{max-height:24rem}.max-h-\[180px\]{max-height:180px}.max-h-\[300px\]{max-height:300px}.max-h-\[320px\]{max-height:320px}.max-h-\[380px\]{max-height:380px}.max-h-\[70vh\]{max-height:70vh}.max-h-\[75vh\]{max-height:75vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[92vh\]{max-height:92vh}.min-h-0{min-height:0px}.min-h-\[20px\]{min-height:20px}.min-h-\[40px\]{min-height:40px}.min-h-\[62px\]{min-height:62px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-44{width:11rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-52{width:13rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-60{width:15rem}.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-\[220px\]{width:220px}.w-\[340px\]{width:340px}.w-\[380px\]{width:380px}.w-\[400px\]{width:400px}.w-\[49px\]{width:49px}.w-\[600px\]{width:600px}.w-\[60px\]{width:60px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-28{min-width:7rem}.min-w-48{min-width:12rem}.min-w-\[15px\]{min-width:15px}.min-w-\[160px\]{min-width:160px}.min-w-\[16px\]{min-width:16px}.min-w-\[18px\]{min-width:18px}.min-w-\[200px\]{min-width:200px}.min-w-\[20px\]{min-width:20px}.min-w-\[220px\]{min-width:220px}.min-w-\[260px\]{min-width:260px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-48{max-width:12rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[180px\]{max-width:180px}.max-w-\[320px\]{max-width:320px}.max-w-\[360px\]{max-width:360px}.max-w-\[75\%\]{max-width:75%}.max-w-\[82\%\]{max-width:82%}.max-w-\[85\%\]{max-width:85%}.max-w-\[88\%\]{max-width:88%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-\[2\]{flex:2}.flex-shrink-0,.shrink-0{flex-shrink:0}.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-full{--tw-translate-x: -100%;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-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))}.translate-x-0\.5{--tw-translate-x: .125rem;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-4{--tw-translate-x: 1rem;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-5{--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))}.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))}.scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;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))}.scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;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-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-\[3px\]{gap:3px}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-0\.5{row-gap:.125rem}.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))}.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-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * 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))}.divide-slate-800>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 41 59 / var(--tw-divide-opacity, 1))}.divide-slate-800\/50>:not([hidden])~:not([hidden]){border-color:#1e293b80}.divide-slate-800\/60>:not([hidden])~:not([hidden]){border-color:#1e293b99}.divide-white\/5>:not([hidden])~:not([hidden]){border-color:#ffffff0d}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.self-center{align-self:center}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl,.rounded-\[1\.5rem\]{border-radius:1.5rem}.rounded-\[2\.5rem\]{border-radius:2.5rem}.rounded-\[2rem\]{border-radius:2rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-b-xl{border-bottom-right-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-t-3xl{border-top-left-radius:1.5rem;border-top-right-radius:1.5rem}.rounded-t-sm{border-top-left-radius:.125rem;border-top-right-radius:.125rem}.rounded-bl-sm{border-bottom-left-radius:.125rem}.rounded-br-sm{border-bottom-right-radius:.125rem}.rounded-tl-none{border-top-left-radius:0}.rounded-tl-sm{border-top-left-radius:.125rem}.rounded-tr-none{border-top-right-radius:0}.rounded-tr-sm{border-top-right-radius:.125rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-\[3px\]{border-width:3px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\[\#008f72\]{--tw-border-opacity: 1;border-color:rgb(0 143 114 / var(--tw-border-opacity, 1))}.border-\[\#00a884\]{--tw-border-opacity: 1;border-color:rgb(0 168 132 / var(--tw-border-opacity, 1))}.border-\[\#00a884\]\/20{border-color:#00a88433}.border-\[\#00a884\]\/25{border-color:#00a88440}.border-\[\#00a884\]\/30{border-color:#00a8844d}.border-\[\#00a884\]\/40{border-color:#00a88466}.border-\[\#3b4a50\]{--tw-border-opacity: 1;border-color:rgb(59 74 80 / var(--tw-border-opacity, 1))}.border-\[\#c8d0d4\]{--tw-border-opacity: 1;border-color:rgb(200 208 212 / var(--tw-border-opacity, 1))}.border-\[\#cde9f4\]\/60{border-color:#cde9f499}.border-\[\#d1d7db\]{--tw-border-opacity: 1;border-color:rgb(209 215 219 / var(--tw-border-opacity, 1))}.border-\[\#e9edef\]{--tw-border-opacity: 1;border-color:rgb(233 237 239 / var(--tw-border-opacity, 1))}.border-\[\#ef4444\]{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-\[\#f0f2f5\]{--tw-border-opacity: 1;border-color:rgb(240 242 245 / var(--tw-border-opacity, 1))}.border-\[\#f5f6f6\]{--tw-border-opacity: 1;border-color:rgb(245 246 246 / var(--tw-border-opacity, 1))}.border-\[\#ffe69c\]{--tw-border-opacity: 1;border-color:rgb(255 230 156 / var(--tw-border-opacity, 1))}.border-amber-100{--tw-border-opacity: 1;border-color:rgb(254 243 199 / var(--tw-border-opacity, 1))}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-400\/30{border-color:#fbbf244d}.border-amber-400\/60{border-color:#fbbf2499}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/25{border-color:#f59e0b40}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/40{border-color:#f59e0b66}.border-amber-600{--tw-border-opacity: 1;border-color:rgb(217 119 6 / var(--tw-border-opacity, 1))}.border-black\/5{border-color:#0000000d}.border-blue-100{--tw-border-opacity: 1;border-color:rgb(219 234 254 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-400\/20{border-color:#60a5fa33}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-blue-500\/40{border-color:#3b82f666}.border-current{border-color:currentColor}.border-cyan-100{--tw-border-opacity: 1;border-color:rgb(207 250 254 / var(--tw-border-opacity, 1))}.border-cyan-400{--tw-border-opacity: 1;border-color:rgb(34 211 238 / var(--tw-border-opacity, 1))}.border-cyan-400\/20{border-color:#22d3ee33}.border-cyan-500{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-cyan-500\/20{border-color:#06b6d433}.border-cyan-500\/30{border-color:#06b6d44d}.border-cyan-500\/40{border-color:#06b6d466}.border-cyan-600{--tw-border-opacity: 1;border-color:rgb(8 145 178 / var(--tw-border-opacity, 1))}.border-emerald-300{--tw-border-opacity: 1;border-color:rgb(110 231 183 / var(--tw-border-opacity, 1))}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-500{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-500\/60{border-color:#10b98199}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-green-100{--tw-border-opacity: 1;border-color:rgb(220 252 231 / var(--tw-border-opacity, 1))}.border-green-500\/30{border-color:#22c55e4d}.border-green-500\/40{border-color:#22c55e66}.border-indigo-100{--tw-border-opacity: 1;border-color:rgb(224 231 255 / var(--tw-border-opacity, 1))}.border-orange-100{--tw-border-opacity: 1;border-color:rgb(255 237 213 / var(--tw-border-opacity, 1))}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-400\/20{border-color:#fb923c33}.border-orange-500\/20{border-color:#f9731633}.border-orange-500\/30{border-color:#f973164d}.border-pink-200{--tw-border-opacity: 1;border-color:rgb(251 207 232 / var(--tw-border-opacity, 1))}.border-purple-200{--tw-border-opacity: 1;border-color:rgb(233 213 255 / var(--tw-border-opacity, 1))}.border-purple-400\/10{border-color:#c084fc1a}.border-purple-400\/20{border-color:#c084fc33}.border-purple-500\/30{border-color:#a855f74d}.border-red-100{--tw-border-opacity: 1;border-color:rgb(254 226 226 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.border-red-500\/30{border-color:#ef44444d}.border-red-600{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.border-red-600\/30{border-color:#dc26264d}.border-rose-400\/20{border-color:#fb718533}.border-rose-500\/10{border-color:#f43f5e1a}.border-rose-500\/20{border-color:#f43f5e33}.border-rose-500\/30{border-color:#f43f5e4d}.border-rose-500\/40{border-color:#f43f5e66}.border-slate-100{--tw-border-opacity: 1;border-color:rgb(241 245 249 / var(--tw-border-opacity, 1))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-400\/40{border-color:#94a3b866}.border-slate-500\/20{border-color:#64748b33}.border-slate-500\/30{border-color:#64748b4d}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-slate-800\/40{border-color:#1e293b66}.border-slate-800\/50{border-color:#1e293b80}.border-slate-900{--tw-border-opacity: 1;border-color:rgb(15 23 42 / var(--tw-border-opacity, 1))}.border-teal-400\/20{border-color:#2dd4bf33}.border-teal-500\/30{border-color:#14b8a64d}.border-transparent{border-color:transparent}.border-violet-500\/20{border-color:#8b5cf633}.border-violet-500\/30{border-color:#8b5cf64d}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-white\/10{border-color:#ffffff1a}.border-white\/40{border-color:#fff6}.border-white\/5{border-color:#ffffff0d}.border-yellow-400\/20{border-color:#facc1533}.border-yellow-500\/20{border-color:#eab30833}.border-yellow-500\/30{border-color:#eab3084d}.border-l-\[\#00a884\]{--tw-border-opacity: 1;border-left-color:rgb(0 168 132 / var(--tw-border-opacity, 1))}.border-t-\[\#00a884\]{--tw-border-opacity: 1;border-top-color:rgb(0 168 132 / var(--tw-border-opacity, 1))}.border-t-gray-500{--tw-border-opacity: 1;border-top-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.bg-\[\#00a884\]{--tw-bg-opacity: 1;background-color:rgb(0 168 132 / var(--tw-bg-opacity, 1))}.bg-\[\#00a884\]\/10{background-color:#00a8841a}.bg-\[\#00a884\]\/5{background-color:#00a8840d}.bg-\[\#10b981\]{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-\[\#111b21\]{--tw-bg-opacity: 1;background-color:rgb(17 27 33 / var(--tw-bg-opacity, 1))}.bg-\[\#25d366\]{--tw-bg-opacity: 1;background-color:rgb(37 211 102 / var(--tw-bg-opacity, 1))}.bg-\[\#25d366\]\/10{background-color:#25d3661a}.bg-\[\#54656f\]{--tw-bg-opacity: 1;background-color:rgb(84 101 111 / var(--tw-bg-opacity, 1))}.bg-\[\#7c3aed\]{--tw-bg-opacity: 1;background-color:rgb(124 58 237 / var(--tw-bg-opacity, 1))}.bg-\[\#8696a0\]{--tw-bg-opacity: 1;background-color:rgb(134 150 160 / var(--tw-bg-opacity, 1))}.bg-\[\#8b5cf6\]{--tw-bg-opacity: 1;background-color:rgb(139 92 246 / var(--tw-bg-opacity, 1))}.bg-\[\#d1d7db\]{--tw-bg-opacity: 1;background-color:rgb(209 215 219 / var(--tw-bg-opacity, 1))}.bg-\[\#d9dbdf\]{--tw-bg-opacity: 1;background-color:rgb(217 219 223 / var(--tw-bg-opacity, 1))}.bg-\[\#d9fdd3\]{--tw-bg-opacity: 1;background-color:rgb(217 253 211 / var(--tw-bg-opacity, 1))}.bg-\[\#dfe5e7\]{--tw-bg-opacity: 1;background-color:rgb(223 229 231 / var(--tw-bg-opacity, 1))}.bg-\[\#dfe5e7\]\/50{background-color:#dfe5e780}.bg-\[\#e0f2fe\]{--tw-bg-opacity: 1;background-color:rgb(224 242 254 / var(--tw-bg-opacity, 1))}.bg-\[\#e1f3fb\]{--tw-bg-opacity: 1;background-color:rgb(225 243 251 / var(--tw-bg-opacity, 1))}.bg-\[\#e7f5ff\]{--tw-bg-opacity: 1;background-color:rgb(231 245 255 / var(--tw-bg-opacity, 1))}.bg-\[\#e7f8f2\]{--tw-bg-opacity: 1;background-color:rgb(231 248 242 / var(--tw-bg-opacity, 1))}.bg-\[\#e9edef\]{--tw-bg-opacity: 1;background-color:rgb(233 237 239 / var(--tw-bg-opacity, 1))}.bg-\[\#f0f2f5\]{--tw-bg-opacity: 1;background-color:rgb(240 242 245 / var(--tw-bg-opacity, 1))}.bg-\[\#f0fdf4\]{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-\[\#f8f9fa\]{--tw-bg-opacity: 1;background-color:rgb(248 249 250 / var(--tw-bg-opacity, 1))}.bg-\[\#f9fafb\]{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-\[\#fee2e2\]{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-\[\#fef3c7\]{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-\[\#fff3cd\]{--tw-bg-opacity: 1;background-color:rgb(255 243 205 / var(--tw-bg-opacity, 1))}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-200{--tw-bg-opacity: 1;background-color:rgb(253 230 138 / var(--tw-bg-opacity, 1))}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-50\/50{background-color:#fffbeb80}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/10{background-color:#0000001a}.bg-black\/20{background-color:#0003}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/5{background-color:#0000000d}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-400\/10{background-color:#60a5fa1a}.bg-blue-400\/5{background-color:#60a5fa0d}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-cyan-400{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity, 1))}.bg-cyan-400\/10{background-color:#22d3ee1a}.bg-cyan-400\/20{background-color:#22d3ee33}.bg-cyan-400\/5{background-color:#22d3ee0d}.bg-cyan-50{--tw-bg-opacity: 1;background-color:rgb(236 254 255 / var(--tw-bg-opacity, 1))}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-cyan-500\/20{background-color:#06b6d433}.bg-cyan-500\/5{background-color:#06b6d40d}.bg-cyan-600{--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity, 1))}.bg-cyan-600\/20{background-color:#0891b233}.bg-cyan-900\/30{background-color:#164e634d}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-400\/5{background-color:#34d3990d}.bg-emerald-50{--tw-bg-opacity: 1;background-color:rgb(236 253 245 / var(--tw-bg-opacity, 1))}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-700{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / 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-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-indigo-400{--tw-bg-opacity: 1;background-color:rgb(129 140 248 / var(--tw-bg-opacity, 1))}.bg-indigo-50{--tw-bg-opacity: 1;background-color:rgb(238 242 255 / var(--tw-bg-opacity, 1))}.bg-orange-100{--tw-bg-opacity: 1;background-color:rgb(255 237 213 / var(--tw-bg-opacity, 1))}.bg-orange-400\/10{background-color:#fb923c1a}.bg-orange-400\/5{background-color:#fb923c0d}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-500\/5{background-color:#f973160d}.bg-pink-100{--tw-bg-opacity: 1;background-color:rgb(252 231 243 / var(--tw-bg-opacity, 1))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-400\/10{background-color:#c084fc1a}.bg-purple-400\/5{background-color:#c084fc0d}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600\/20{background-color:#dc262633}.bg-rose-400\/10{background-color:#fb71851a}.bg-rose-400\/5{background-color:#fb71850d}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.bg-rose-500\/10{background-color:#f43f5e1a}.bg-rose-500\/20{background-color:#f43f5e33}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-300\/40{background-color:#cbd5e166}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.bg-slate-50\/50{background-color:#f8fafc80}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/10{background-color:#64748b1a}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-700\/40{background-color:#33415566}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/10{background-color:#1e293b1a}.bg-slate-800\/20{background-color:#1e293b33}.bg-slate-800\/30{background-color:#1e293b4d}.bg-slate-800\/40{background-color:#1e293b66}.bg-slate-800\/5{background-color:#1e293b0d}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-slate-900\/60{background-color:#0f172a99}.bg-slate-900\/80{background-color:#0f172acc}.bg-slate-900\/90{background-color:#0f172ae6}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-slate-950\/50{background-color:#02061780}.bg-slate-950\/60{background-color:#02061799}.bg-slate-950\/80{background-color:#020617cc}.bg-slate-950\/95{background-color:#020617f2}.bg-teal-400\/10{background-color:#2dd4bf1a}.bg-teal-400\/5{background-color:#2dd4bf0d}.bg-teal-500\/10{background-color:#14b8a61a}.bg-teal-500\/20{background-color:#14b8a633}.bg-transparent{background-color:transparent}.bg-violet-400\/10{background-color:#a78bfa1a}.bg-violet-500{--tw-bg-opacity: 1;background-color:rgb(139 92 246 / var(--tw-bg-opacity, 1))}.bg-violet-500\/10{background-color:#8b5cf61a}.bg-violet-500\/20{background-color:#8b5cf633}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/20{background-color:#fff3}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-400\/10{background-color:#facc151a}.bg-yellow-400\/5{background-color:#facc150d}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-\[url\(\'https\:\/\/www\.transparenttextures\.com\/patterns\/carbon-fibre\.png\'\)\]{background-image:url(https://www.transparenttextures.com/patterns/carbon-fibre.png)}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[\#00a884\]{--tw-gradient-from: #00a884 var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 168 132 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#25d366\]{--tw-gradient-from: #25d366 var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 211 102 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-amber-500{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-600{--tw-gradient-from: #2563eb var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-cyan-400{--tw-gradient-from: #22d3ee var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 211 238 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-cyan-500{--tw-gradient-from: #06b6d4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-cyan-500\/20{--tw-gradient-from: rgb(6 182 212 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-cyan-500\/5{--tw-gradient-from: rgb(6 182 212 / .05) var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-cyan-600{--tw-gradient-from: #0891b2 var(--tw-gradient-from-position);--tw-gradient-to: rgb(8 145 178 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-500\/20{--tw-gradient-from: rgb(16 185 129 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(16 185 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-emerald-600{--tw-gradient-from: #059669 var(--tw-gradient-from-position);--tw-gradient-to: rgb(5 150 105 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500\/20{--tw-gradient-from: rgb(249 115 22 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-rose-500\/20{--tw-gradient-from: rgb(244 63 94 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(244 63 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-600{--tw-gradient-from: #475569 var(--tw-gradient-from-position);--tw-gradient-to: rgb(71 85 105 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-700{--tw-gradient-from: #334155 var(--tw-gradient-from-position);--tw-gradient-to: rgb(51 65 85 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-900{--tw-gradient-from: #0f172a var(--tw-gradient-from-position);--tw-gradient-to: rgb(15 23 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-violet-500{--tw-gradient-from: #8b5cf6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(139 92 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-violet-500\/20{--tw-gradient-from: rgb(139 92 246 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(139 92 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-violet-600{--tw-gradient-from: #7c3aed var(--tw-gradient-from-position);--tw-gradient-to: rgb(124 58 237 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-\[\#008f72\]{--tw-gradient-to: #008f72 var(--tw-gradient-to-position)}.to-\[\#128c7e\]{--tw-gradient-to: #128c7e var(--tw-gradient-to-position)}.to-amber-500\/10{--tw-gradient-to: rgb(245 158 11 / .1) var(--tw-gradient-to-position)}.to-blue-500\/10{--tw-gradient-to: rgb(59 130 246 / .1) var(--tw-gradient-to-position)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-blue-600\/20{--tw-gradient-to: rgb(37 99 235 / .2) var(--tw-gradient-to-position)}.to-blue-800{--tw-gradient-to: #1e40af var(--tw-gradient-to-position)}.to-cyan-400{--tw-gradient-to: #22d3ee var(--tw-gradient-to-position)}.to-cyan-700{--tw-gradient-to: #0e7490 var(--tw-gradient-to-position)}.to-green-500\/10{--tw-gradient-to: rgb(34 197 94 / .1) var(--tw-gradient-to-position)}.to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.to-indigo-700{--tw-gradient-to: #4338ca var(--tw-gradient-to-position)}.to-orange-600{--tw-gradient-to: #ea580c var(--tw-gradient-to-position)}.to-pink-500\/10{--tw-gradient-to: rgb(236 72 153 / .1) var(--tw-gradient-to-position)}.to-purple-500\/10{--tw-gradient-to: rgb(168 85 247 / .1) var(--tw-gradient-to-position)}.to-rose-500{--tw-gradient-to: #f43f5e var(--tw-gradient-to-position)}.to-rose-600{--tw-gradient-to: #e11d48 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-teal-700{--tw-gradient-to: #0f766e var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.bg-\[right_12px_center\]{background-position:right 12px center}.bg-no-repeat{background-repeat:no-repeat}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-10{padding:2.5rem}.p-16{padding:4rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.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-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\[10px\]{padding-top:10px;padding-bottom:10px}.py-\[3px\]{padding-top:3px;padding-bottom:3px}.py-\[8px\]{padding-top:8px;padding-bottom:8px}.py-\[9px\]{padding-top:9px;padding-bottom:9px}.pb-0{padding-bottom:0}.pb-0\.5{padding-bottom:.125rem}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pb-\[7px\]{padding-bottom:7px}.pl-1{padding-left:.25rem}.pl-14{padding-left:3.5rem}.pl-4{padding-left:1rem}.pl-7{padding-left:1.75rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-0\.5{padding-right:.125rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-bottom{vertical-align:bottom}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.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-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12\.5px\]{font-size:12.5px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14\.2px\]{font-size:14.2px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[18px\]{font-size:18px}.text-\[20px\]{font-size:20px}.text-\[22px\]{font-size:22px}.text-\[28px\]{font-size:28px}.text-\[32px\]{font-size:32px}.text-\[9px\]{font-size:9px}.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-black{font-weight:900}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.normal-case{text-transform:none}.italic{font-style:italic}.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-5{line-height:1.25rem}.leading-\[1\.4\]{line-height:1.4}.leading-\[1\.5\]{line-height:1.5}.leading-\[1\.6\]{line-height:1.6}.leading-\[14px\]{line-height:14px}.leading-\[21px\]{line-height:21px}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-\[0\.4em\]{letter-spacing:.4em}.tracking-normal{letter-spacing:0em}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#00a884\]{--tw-text-opacity: 1;color:rgb(0 168 132 / var(--tw-text-opacity, 1))}.text-\[\#0ea5e9\]{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-\[\#10b981\]{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-\[\#111b21\]{--tw-text-opacity: 1;color:rgb(17 27 33 / var(--tw-text-opacity, 1))}.text-\[\#25d366\]{--tw-text-opacity: 1;color:rgb(37 211 102 / var(--tw-text-opacity, 1))}.text-\[\#25d366\]\/80{color:#25d366cc}.text-\[\#3b4a50\]{--tw-text-opacity: 1;color:rgb(59 74 80 / var(--tw-text-opacity, 1))}.text-\[\#3b4a54\]{--tw-text-opacity: 1;color:rgb(59 74 84 / var(--tw-text-opacity, 1))}.text-\[\#41525d\]{--tw-text-opacity: 1;color:rgb(65 82 93 / var(--tw-text-opacity, 1))}.text-\[\#53bdeb\]{--tw-text-opacity: 1;color:rgb(83 189 235 / var(--tw-text-opacity, 1))}.text-\[\#54656f\]{--tw-text-opacity: 1;color:rgb(84 101 111 / var(--tw-text-opacity, 1))}.text-\[\#664d03\]{--tw-text-opacity: 1;color:rgb(102 77 3 / var(--tw-text-opacity, 1))}.text-\[\#667781\]{--tw-text-opacity: 1;color:rgb(102 119 129 / var(--tw-text-opacity, 1))}.text-\[\#8696a0\]{--tw-text-opacity: 1;color:rgb(134 150 160 / var(--tw-text-opacity, 1))}.text-\[\#8b5cf6\]{--tw-text-opacity: 1;color:rgb(139 92 246 / var(--tw-text-opacity, 1))}.text-\[\#ef4444\]{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-\[\#f59e0b\]{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.text-amber-200\/80{color:#fde68acc}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/60{color:#fbbf2499}.text-amber-400\/70{color:#fbbf24b3}.text-amber-400\/80{color:#fbbf24cc}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity, 1))}.text-cyan-700{--tw-text-opacity: 1;color:rgb(14 116 144 / var(--tw-text-opacity, 1))}.text-emerald-200{--tw-text-opacity: 1;color:rgb(167 243 208 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-500\/40{color:#10b98166}.text-emerald-600{--tw-text-opacity: 1;color:rgb(5 150 105 / var(--tw-text-opacity, 1))}.text-emerald-700{--tw-text-opacity: 1;color:rgb(4 120 87 / var(--tw-text-opacity, 1))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity, 1))}.text-indigo-700{--tw-text-opacity: 1;color:rgb(67 56 202 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-700{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.text-pink-700{--tw-text-opacity: 1;color:rgb(190 24 93 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-rose-200{--tw-text-opacity: 1;color:rgb(254 205 211 / var(--tw-text-opacity, 1))}.text-rose-300{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-rose-500{--tw-text-opacity: 1;color:rgb(244 63 94 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.text-slate-950{--tw-text-opacity: 1;color:rgb(2 6 23 / var(--tw-text-opacity, 1))}.text-teal-300{--tw-text-opacity: 1;color:rgb(94 234 212 / var(--tw-text-opacity, 1))}.text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity, 1))}.text-violet-300{--tw-text-opacity: 1;color:rgb(196 181 253 / var(--tw-text-opacity, 1))}.text-violet-400{--tw-text-opacity: 1;color:rgb(167 139 250 / var(--tw-text-opacity, 1))}.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-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.placeholder-\[\#8696a0\]::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(134 150 160 / var(--tw-placeholder-opacity, 1))}.placeholder-\[\#8696a0\]::placeholder{--tw-placeholder-opacity: 1;color:rgb(134 150 160 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.accent-\[\#00a884\]{accent-color:#00a884}.accent-amber-500{accent-color:#f59e0b}.accent-cyan-500{accent-color:#06b6d4}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-\[0\.03\]{opacity:.03}.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)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px 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-\[0_0_8px_rgba\(34\,211\,238\,0\.4\)\]{--tw-shadow: 0 0 8px rgba(34,211,238,.4);--tw-shadow-colored: 0 0 8px 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-\[0_1px_0\.5px_rgba\(11\,20\,26\,0\.13\)\]{--tw-shadow: 0 1px .5px rgba(11,20,26,.13);--tw-shadow-colored: 0 1px .5px 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-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)}.shadow-black\/60{--tw-shadow-color: rgb(0 0 0 / .6);--tw-shadow: var(--tw-shadow-colored)}.shadow-cyan-500\/20{--tw-shadow-color: rgb(6 182 212 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/20{--tw-shadow-color: rgb(16 185 129 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-orange-500\/20{--tw-shadow-color: rgb(249 115 22 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-500\/20{--tw-shadow-color: rgb(244 63 94 / .2);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--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(3px + 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-cyan-500{--tw-ring-opacity: 1;--tw-ring-color: rgb(6 182 212 / var(--tw-ring-opacity, 1))}.ring-emerald-500{--tw-ring-opacity: 1;--tw-ring-color: rgb(16 185 129 / var(--tw-ring-opacity, 1))}.ring-slate-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(30 41 59 / var(--tw-ring-opacity, 1))}.ring-slate-900{--tw-ring-opacity: 1;--tw-ring-color: rgb(15 23 42 / var(--tw-ring-opacity, 1))}.blur-3xl{--tw-blur: blur(64px);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)}.grayscale{--tw-grayscale: grayscale(100%);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-md{--tw-backdrop-blur: blur(12px);-webkit-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);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)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-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);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)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-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);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-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-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}body{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(248 250 252 / var(--tw-text-opacity, 1));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif}input,textarea,select,option{color:#111b21}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:#0f172a1a;border-radius:10px}::-webkit-scrollbar-thumb{background:#47556980;border-radius:10px;-webkit-transition:all .2s ease;transition:all .2s ease}::-webkit-scrollbar-thumb:hover{background:#22d3ee80}.scrollbar-hide::-webkit-scrollbar{display:none}.scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.custom-scrollbar::-webkit-scrollbar-thumb{background:#22d3ee33}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#22d3ee80}.selection\:bg-cyan-500\/30 *::-moz-selection{background-color:#06b6d44d}.selection\:bg-cyan-500\/30 *::selection{background-color:#06b6d44d}.selection\:text-cyan-200 *::-moz-selection{--tw-text-opacity: 1;color:rgb(165 243 252 / var(--tw-text-opacity, 1))}.selection\:text-cyan-200 *::selection{--tw-text-opacity: 1;color:rgb(165 243 252 / var(--tw-text-opacity, 1))}.selection\:bg-cyan-500\/30::-moz-selection{background-color:#06b6d44d}.selection\:bg-cyan-500\/30::selection{background-color:#06b6d44d}.selection\:text-cyan-200::-moz-selection{--tw-text-opacity: 1;color:rgb(165 243 252 / var(--tw-text-opacity, 1))}.selection\:text-cyan-200::selection{--tw-text-opacity: 1;color:rgb(165 243 252 / var(--tw-text-opacity, 1))}.placeholder\:text-\[\#8696a0\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(134 150 160 / var(--tw-text-opacity, 1))}.placeholder\:text-\[\#8696a0\]::placeholder{--tw-text-opacity: 1;color:rgb(134 150 160 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::-moz-placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-700::-moz-placeholder{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-700::placeholder{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.last\:border-0:last-child{border-width:0px}.last\:border-none:last-child{border-style:none}.hover\:animate-none:hover{animation:none}.hover\:border-\[\#00a884\]:hover{--tw-border-opacity: 1;border-color:rgb(0 168 132 / var(--tw-border-opacity, 1))}.hover\:border-\[\#c0c8cf\]:hover{--tw-border-opacity: 1;border-color:rgb(192 200 207 / var(--tw-border-opacity, 1))}.hover\:border-\[\#d1d7db\]:hover{--tw-border-opacity: 1;border-color:rgb(209 215 219 / var(--tw-border-opacity, 1))}.hover\:border-amber-400:hover{--tw-border-opacity: 1;border-color:rgb(251 191 36 / var(--tw-border-opacity, 1))}.hover\:border-amber-500\/30:hover{border-color:#f59e0b4d}.hover\:border-amber-500\/40:hover{border-color:#f59e0b66}.hover\:border-cyan-500\/20:hover{border-color:#06b6d433}.hover\:border-cyan-500\/30:hover{border-color:#06b6d44d}.hover\:border-emerald-500:hover{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.hover\:border-emerald-500\/30:hover{border-color:#10b9814d}.hover\:border-emerald-500\/50:hover{border-color:#10b98180}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-slate-500:hover{--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.hover\:border-slate-600:hover{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.hover\:border-slate-700:hover{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.hover\:border-white\/20:hover{border-color:#fff3}.hover\:bg-\[\#008f6e\]:hover{--tw-bg-opacity: 1;background-color:rgb(0 143 110 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#008f72\]:hover{--tw-bg-opacity: 1;background-color:rgb(0 143 114 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#00a884\]\/5:hover{background-color:#00a8840d}.hover\:bg-\[\#017f67\]:hover{--tw-bg-opacity: 1;background-color:rgb(1 127 103 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#6d28d9\]:hover{--tw-bg-opacity: 1;background-color:rgb(109 40 217 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#8696a0\]:hover{--tw-bg-opacity: 1;background-color:rgb(134 150 160 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#d97706\]:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#d9dbdf\]\/60:hover{background-color:#d9dbdf99}.hover\:bg-\[\#e0f2fe\]:hover{--tw-bg-opacity: 1;background-color:rgb(224 242 254 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#e9edef\]:hover{--tw-bg-opacity: 1;background-color:rgb(233 237 239 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#ede9fe\]:hover{--tw-bg-opacity: 1;background-color:rgb(237 233 254 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#f0f2f5\]:hover{--tw-bg-opacity: 1;background-color:rgb(240 242 245 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#f5f6f6\]:hover{--tw-bg-opacity: 1;background-color:rgb(245 246 246 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-400:hover{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-500\/5:hover{background-color:#f59e0b0d}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-black\/40:hover{background-color:#0006}.hover\:bg-black\/5:hover{background-color:#0000000d}.hover\:bg-cyan-400:hover{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity, 1))}.hover\:bg-cyan-500:hover{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.hover\:bg-cyan-500\/20:hover{background-color:#06b6d433}.hover\:bg-cyan-500\/30:hover{background-color:#06b6d44d}.hover\:bg-cyan-500\/5:hover{background-color:#06b6d40d}.hover\:bg-cyan-500\/\[0\.02\]:hover{background-color:#06b6d405}.hover\:bg-cyan-700:hover{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-400:hover{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/20:hover{background-color:#10b98133}.hover\:bg-emerald-500\/30:hover{background-color:#10b9814d}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-green-500\/10:hover{background-color:#22c55e1a}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600\/40:hover{background-color:#dc262666}.hover\:bg-rose-500:hover{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.hover\:bg-rose-500\/10:hover{background-color:#f43f5e1a}.hover\:bg-rose-500\/20:hover{background-color:#f43f5e33}.hover\:bg-rose-500\/30:hover{background-color:#f43f5e4d}.hover\:bg-slate-300\/60:hover{background-color:#cbd5e199}.hover\:bg-slate-500:hover{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/20:hover{background-color:#1e293b33}.hover\:bg-slate-800\/30:hover{background-color:#1e293b4d}.hover\:bg-slate-800\/40:hover{background-color:#1e293b66}.hover\:bg-slate-800\/60:hover{background-color:#1e293b99}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/30:hover{background-color:#ffffff4d}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:from-orange-400:hover{--tw-gradient-from: #fb923c var(--tw-gradient-from-position);--tw-gradient-to: rgb(251 146 60 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-rose-400:hover{--tw-gradient-to: #fb7185 var(--tw-gradient-to-position)}.hover\:to-rose-500:hover{--tw-gradient-to: #f43f5e var(--tw-gradient-to-position)}.hover\:text-\[\#00a884\]:hover{--tw-text-opacity: 1;color:rgb(0 168 132 / var(--tw-text-opacity, 1))}.hover\:text-\[\#111b21\]:hover{--tw-text-opacity: 1;color:rgb(17 27 33 / var(--tw-text-opacity, 1))}.hover\:text-\[\#54656f\]:hover{--tw-text-opacity: 1;color:rgb(84 101 111 / var(--tw-text-opacity, 1))}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-cyan-300:hover{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.hover\:text-cyan-400:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-emerald-300:hover{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.hover\:text-emerald-400:hover{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:text-rose-400:hover{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-slate-400:hover{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:text-yellow-400:hover{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-md:hover{--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)}.hover\:shadow-sm:hover{--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)}.focus\:border-\[\#00a884\]:focus{--tw-border-opacity: 1;border-color:rgb(0 168 132 / var(--tw-border-opacity, 1))}.focus\:border-\[\#00a884\]\/30:focus{border-color:#00a8844d}.focus\:border-amber-400:focus{--tw-border-opacity: 1;border-color:rgb(251 191 36 / var(--tw-border-opacity, 1))}.focus\:border-amber-500\/40:focus{border-color:#f59e0b66}.focus\:border-amber-500\/50:focus{border-color:#f59e0b80}.focus\:border-cyan-500:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:border-emerald-500:focus{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.focus\:border-orange-500:focus{--tw-border-opacity: 1;border-color:rgb(249 115 22 / var(--tw-border-opacity, 1))}.focus\:border-orange-500\/50:focus{border-color:#f9731680}.focus\:border-purple-500:focus{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.focus\:border-slate-500:focus{--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.focus\:border-teal-500:focus{--tw-border-opacity: 1;border-color:rgb(20 184 166 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-0: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(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)}.focus\:ring-1: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(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\: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-\[\#00a884\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(0 168 132 / var(--tw-ring-opacity, 1))}.focus\:ring-\[\#00a884\]\/10:focus{--tw-ring-color: rgb(0 168 132 / .1)}.focus\:ring-\[\#00a884\]\/30:focus{--tw-ring-color: rgb(0 168 132 / .3)}.focus\:ring-\[\#0ea5e9\]\/30:focus{--tw-ring-color: rgb(14 165 233 / .3)}.focus\:ring-\[\#8b5cf6\]\/30:focus{--tw-ring-color: rgb(139 92 246 / .3)}.focus\:ring-\[\#f59e0b\]\/30:focus{--tw-ring-color: rgb(245 158 11 / .3)}.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-\[\#00a884\]\/40:focus-visible{--tw-ring-color: rgb(0 168 132 / .4)}.active\:rotate-180:active{--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))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;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))}.active\:scale-\[\.98\]:active{--tw-scale-x: .98;--tw-scale-y: .98;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))}.active\:scale-\[0\.99\]:active{--tw-scale-x: .99;--tw-scale-y: .99;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))}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-20:disabled{opacity:.2}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group:focus-within .group-focus-within\:text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:block{display:block}.group\/item:hover .group-hover\/item\:translate-x-1{--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))}.group:hover .group-hover\:-translate-x-0\.5{--tw-translate-x: -.125rem;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:hover .group-hover\:-translate-y-0\.5{--tw-translate-y: -.125rem;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:hover .group-hover\: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:hover .group-hover\:translate-x-0\.5{--tw-translate-x: .125rem;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:hover .group-hover\:scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;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:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;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:hover .group-hover\:bg-slate-800\/40{background-color:#1e293b66}.group\/item:hover .group-hover\/item\:text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-\[\#00a884\]{--tw-text-opacity: 1;color:rgb(0 168 132 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:block{display:block}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:items-center{align-items:center}.sm\:p-8{padding:2rem}}@media (min-width: 768px){.md\:sticky{position:sticky}.md\:col-span-1{grid-column:span 1 / span 1}.md\:flex{display:flex}.md\:table-cell{display:table-cell}.md\:hidden{display:none}.md\: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))}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:items-center{align-items:center}.md\:rounded-3xl{border-radius:1.5rem}.md\:p-10{padding:2.5rem}.md\:p-16{padding:4rem}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:flex{display:flex}.lg\:table-cell{display:table-cell}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1280px){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media print{.print\:hidden{display:none}} diff --git a/frontend/sistema-nuvem/public/admin-v2/assets/index-n43auBDg.js b/frontend/sistema-nuvem/public/admin-v2/assets/index-n43auBDg.js new file mode 100644 index 0000000..a63694c --- /dev/null +++ b/frontend/sistema-nuvem/public/admin-v2/assets/index-n43auBDg.js @@ -0,0 +1,1067 @@ +function N8(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Ld=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function De(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u_={exports:{}},Qh={},d_={exports:{}},Pe={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ud=Symbol.for("react.element"),S8=Symbol.for("react.portal"),k8=Symbol.for("react.fragment"),C8=Symbol.for("react.strict_mode"),_8=Symbol.for("react.profiler"),A8=Symbol.for("react.provider"),P8=Symbol.for("react.context"),E8=Symbol.for("react.forward_ref"),O8=Symbol.for("react.suspense"),T8=Symbol.for("react.memo"),$8=Symbol.for("react.lazy"),Cw=Symbol.iterator;function M8(e){return e===null||typeof e!="object"?null:(e=Cw&&e[Cw]||e["@@iterator"],typeof e=="function"?e:null)}var f_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p_=Object.assign,h_={};function Cl(e,t,n){this.props=e,this.context=t,this.refs=h_,this.updater=n||f_}Cl.prototype.isReactComponent={};Cl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Cl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function m_(){}m_.prototype=Cl.prototype;function hb(e,t,n){this.props=e,this.context=t,this.refs=h_,this.updater=n||f_}var mb=hb.prototype=new m_;mb.constructor=hb;p_(mb,Cl.prototype);mb.isPureReactComponent=!0;var _w=Array.isArray,x_=Object.prototype.hasOwnProperty,xb={current:null},g_={key:!0,ref:!0,__self:!0,__source:!0};function v_(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)x_.call(t,r)&&!g_.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1>>1,L=T[U];if(0>>1;Us(se,X))xes(H,se)?(T[U]=H,T[xe]=X,U=xe):(T[U]=se,T[ae]=X,U=ae);else if(xes(H,X))T[U]=H,T[xe]=X,U=xe;else break e}}return V}function s(T,V){var X=T.sortIndex-V.sortIndex;return X!==0?X:T.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,p=3,h=!1,m=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(T){for(var V=n(u);V!==null;){if(V.callback===null)r(u);else if(V.startTime<=T)r(u),V.sortIndex=V.expirationTime,t(c,V);else break;V=n(u)}}function N(T){if(v=!1,j(T),!m)if(n(c)!==null)m=!0,M(w);else{var V=n(u);V!==null&&W(N,V.startTime-T)}}function w(T,V){m=!1,v&&(v=!1,y(C),C=-1),h=!0;var X=p;try{for(j(V),f=n(c);f!==null&&(!(f.expirationTime>V)||T&&!E());){var U=f.callback;if(typeof U=="function"){f.callback=null,p=f.priorityLevel;var L=U(f.expirationTime<=V);V=e.unstable_now(),typeof L=="function"?f.callback=L:f===n(c)&&r(c),j(V)}else r(c);f=n(c)}if(f!==null)var B=!0;else{var ae=n(u);ae!==null&&W(N,ae.startTime-V),B=!1}return B}finally{f=null,p=X,h=!1}}var S=!1,k=null,C=-1,_=5,A=-1;function E(){return!(e.unstable_now()-A<_)}function P(){if(k!==null){var T=e.unstable_now();A=T;var V=!0;try{V=k(!0,T)}finally{V?D():(S=!1,k=null)}}else S=!1}var D;if(typeof g=="function")D=function(){g(P)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,R=I.port2;I.port1.onmessage=P,D=function(){R.postMessage(null)}}else D=function(){x(P,0)};function M(T){k=T,S||(S=!0,D())}function W(T,V){C=x(function(){T(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(T){T.callback=null},e.unstable_continueExecution=function(){m||h||(m=!0,M(w))},e.unstable_forceFrameRate=function(T){0>T||125U?(T.sortIndex=X,t(u,T),n(c)===null&&T===n(u)&&(v?(y(C),C=-1):v=!0,W(N,X-U))):(T.sortIndex=L,t(c,T),m||h||(m=!0,M(w))),T},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(T){var V=p;return function(){var X=p;p=V;try{return T.apply(this,arguments)}finally{p=X}}}})(N_);w_.exports=N_;var H8=w_.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var K8=b,Fn=H8;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sg=Object.prototype.hasOwnProperty,G8=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Pw={},Ew={};function X8(e){return sg.call(Ew,e)?!0:sg.call(Pw,e)?!1:G8.test(e)?Ew[e]=!0:(Pw[e]=!0,!1)}function Y8(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Q8(e,t,n,r){if(t===null||typeof t>"u"||Y8(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function xn(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Ht={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ht[e]=new xn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ht[t]=new xn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ht[e]=new xn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ht[e]=new xn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ht[e]=new xn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ht[e]=new xn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ht[e]=new xn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ht[e]=new xn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ht[e]=new xn(e,5,!1,e.toLowerCase(),null,!1,!1)});var vb=/[\-:]([a-z])/g;function yb(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(vb,yb);Ht[t]=new xn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vb,yb);Ht[t]=new xn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vb,yb);Ht[t]=new xn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ht[e]=new xn(e,1,!1,e.toLowerCase(),null,!1,!1)});Ht.xlinkHref=new xn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ht[e]=new xn(e,1,!1,e.toLowerCase(),null,!0,!0)});function bb(e,t,n,r){var s=Ht.hasOwnProperty(t)?Ht[t]:null;(s!==null?s.type!==0:r||!(2l||s[o]!==i[l]){var c=` +`+s[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{_x=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Nc(e):""}function J8(e){switch(e.tag){case 5:return Nc(e.type);case 16:return Nc("Lazy");case 13:return Nc("Suspense");case 19:return Nc("SuspenseList");case 0:case 2:case 15:return e=Ax(e.type,!1),e;case 11:return e=Ax(e.type.render,!1),e;case 1:return e=Ax(e.type,!0),e;default:return""}}function cg(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case oo:return"Fragment";case io:return"Portal";case ig:return"Profiler";case jb:return"StrictMode";case og:return"Suspense";case lg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case C_:return(e.displayName||"Context")+".Consumer";case k_:return(e._context.displayName||"Context")+".Provider";case wb:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Nb:return t=e.displayName||null,t!==null?t:cg(e.type)||"Memo";case Ha:t=e._payload,e=e._init;try{return cg(e(t))}catch{}}return null}function Z8(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return cg(t);case 8:return t===jb?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function gs(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function A_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function eM(e){var t=A_(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Fd(e){e._valueTracker||(e._valueTracker=eM(e))}function P_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=A_(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function sp(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ug(e,t){var n=t.checked;return lt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Tw(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=gs(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function E_(e,t){t=t.checked,t!=null&&bb(e,"checked",t,!1)}function dg(e,t){E_(e,t);var n=gs(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?fg(e,t.type,n):t.hasOwnProperty("defaultValue")&&fg(e,t.type,gs(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $w(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function fg(e,t,n){(t!=="number"||sp(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Sc=Array.isArray;function Ao(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Vd.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function tu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ec={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tM=["Webkit","ms","Moz","O"];Object.keys(Ec).forEach(function(e){tM.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ec[t]=Ec[e]})});function M_(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ec.hasOwnProperty(e)&&Ec[e]?(""+t).trim():t+"px"}function R_(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=M_(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var nM=lt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function mg(e,t){if(t){if(nM[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function xg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gg=null;function Sb(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vg=null,Po=null,Eo=null;function Dw(e){if(e=pd(e)){if(typeof vg!="function")throw Error(te(280));var t=e.stateNode;t&&(t=nm(t),vg(e.stateNode,e.type,t))}}function D_(e){Po?Eo?Eo.push(e):Eo=[e]:Po=e}function I_(){if(Po){var e=Po,t=Eo;if(Eo=Po=null,Dw(e),t)for(e=0;e>>=0,e===0?32:31-(pM(e)/hM|0)|0}var Ud=64,Wd=4194304;function kc(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function cp(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=kc(l):(i&=o,i!==0&&(r=kc(i)))}else o=n&~s,o!==0?r=kc(o):i!==0&&(r=kc(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function dd(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Cr(t),e[t]=n}function vM(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Tc),qw=" ",Hw=!1;function rA(e,t){switch(e){case"keyup":return HM.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function aA(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var lo=!1;function GM(e,t){switch(e){case"compositionend":return aA(t);case"keypress":return t.which!==32?null:(Hw=!0,qw);case"textInput":return e=t.data,e===qw&&Hw?null:e;default:return null}}function XM(e,t){if(lo)return e==="compositionend"||!Tb&&rA(e,t)?(e=tA(),$f=Pb=es=null,lo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Yw(n)}}function lA(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?lA(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function cA(){for(var e=window,t=sp();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=sp(e.document)}return t}function $b(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function aR(e){var t=cA(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&lA(n.ownerDocument.documentElement,n)){if(r!==null&&$b(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=Qw(n,i);var o=Qw(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,co=null,Sg=null,Mc=null,kg=!1;function Jw(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kg||co==null||co!==sp(r)||(r=co,"selectionStart"in r&&$b(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mc&&ou(Mc,r)||(Mc=r,r=fp(Sg,"onSelect"),0po||(e.current=Og[po],Og[po]=null,po--)}function Ke(e,t){po++,Og[po]=e.current,e.current=t}var vs={},an=Es(vs),kn=Es(!1),Ni=vs;function Vo(e,t){var n=e.type.contextTypes;if(!n)return vs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Cn(e){return e=e.childContextTypes,e!=null}function hp(){Ze(kn),Ze(an)}function s2(e,t,n){if(an.current!==vs)throw Error(te(168));Ke(an,t),Ke(kn,n)}function vA(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(te(108,Z8(e)||"Unknown",s));return lt({},n,r)}function mp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vs,Ni=an.current,Ke(an,e),Ke(kn,kn.current),!0}function i2(e,t,n){var r=e.stateNode;if(!r)throw Error(te(169));n?(e=vA(e,t,Ni),r.__reactInternalMemoizedMergedChildContext=e,Ze(kn),Ze(an),Ke(an,e)):Ze(kn),Ke(kn,n)}var ma=null,rm=!1,Vx=!1;function yA(e){ma===null?ma=[e]:ma.push(e)}function xR(e){rm=!0,yA(e)}function Os(){if(!Vx&&ma!==null){Vx=!0;var e=0,t=Ie;try{var n=ma;for(Ie=1;e>=o,s-=o,xa=1<<32-Cr(t)+s|n<C?(_=k,k=null):_=k.sibling;var A=p(y,k,j[C],N);if(A===null){k===null&&(k=_);break}e&&k&&A.alternate===null&&t(y,k),g=i(A,g,C),S===null?w=A:S.sibling=A,S=A,k=_}if(C===j.length)return n(y,k),nt&&Ks(y,C),w;if(k===null){for(;CC?(_=k,k=null):_=k.sibling;var E=p(y,k,A.value,N);if(E===null){k===null&&(k=_);break}e&&k&&E.alternate===null&&t(y,k),g=i(E,g,C),S===null?w=E:S.sibling=E,S=E,k=_}if(A.done)return n(y,k),nt&&Ks(y,C),w;if(k===null){for(;!A.done;C++,A=j.next())A=f(y,A.value,N),A!==null&&(g=i(A,g,C),S===null?w=A:S.sibling=A,S=A);return nt&&Ks(y,C),w}for(k=r(y,k);!A.done;C++,A=j.next())A=h(k,y,C,A.value,N),A!==null&&(e&&A.alternate!==null&&k.delete(A.key===null?C:A.key),g=i(A,g,C),S===null?w=A:S.sibling=A,S=A);return e&&k.forEach(function(P){return t(y,P)}),nt&&Ks(y,C),w}function x(y,g,j,N){if(typeof j=="object"&&j!==null&&j.type===oo&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case Bd:e:{for(var w=j.key,S=g;S!==null;){if(S.key===w){if(w=j.type,w===oo){if(S.tag===7){n(y,S.sibling),g=s(S,j.props.children),g.return=y,y=g;break e}}else if(S.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Ha&&c2(w)===S.type){n(y,S.sibling),g=s(S,j.props),g.ref=ic(y,S,j),g.return=y,y=g;break e}n(y,S);break}else t(y,S);S=S.sibling}j.type===oo?(g=xi(j.props.children,y.mode,N,j.key),g.return=y,y=g):(N=Ff(j.type,j.key,j.props,null,y.mode,N),N.ref=ic(y,g,j),N.return=y,y=N)}return o(y);case io:e:{for(S=j.key;g!==null;){if(g.key===S)if(g.tag===4&&g.stateNode.containerInfo===j.containerInfo&&g.stateNode.implementation===j.implementation){n(y,g.sibling),g=s(g,j.children||[]),g.return=y,y=g;break e}else{n(y,g);break}else t(y,g);g=g.sibling}g=Yx(j,y.mode,N),g.return=y,y=g}return o(y);case Ha:return S=j._init,x(y,g,S(j._payload),N)}if(Sc(j))return m(y,g,j,N);if(tc(j))return v(y,g,j,N);Qd(y,j)}return typeof j=="string"&&j!==""||typeof j=="number"?(j=""+j,g!==null&&g.tag===6?(n(y,g.sibling),g=s(g,j),g.return=y,y=g):(n(y,g),g=Xx(j,y.mode,N),g.return=y,y=g),o(y)):n(y,g)}return x}var Wo=NA(!0),SA=NA(!1),vp=Es(null),yp=null,xo=null,Ib=null;function Lb(){Ib=xo=yp=null}function zb(e){var t=vp.current;Ze(vp),e._currentValue=t}function Mg(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function To(e,t){yp=e,Ib=xo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Nn=!0),e.firstContext=null)}function cr(e){var t=e._currentValue;if(Ib!==e)if(e={context:e,memoizedValue:t,next:null},xo===null){if(yp===null)throw Error(te(308));xo=e,yp.dependencies={lanes:0,firstContext:e}}else xo=xo.next=e;return t}var ai=null;function Bb(e){ai===null?ai=[e]:ai.push(e)}function kA(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Bb(t)):(n.next=s.next,s.next=n),t.interleaved=n,_a(e,r)}function _a(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ka=!1;function Fb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function CA(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function us(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$e&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,_a(e,n)}return s=r.interleaved,s===null?(t.next=t,Bb(r)):(t.next=s.next,s.next=t),r.interleaved=t,_a(e,n)}function Rf(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Cb(e,n)}}function u2(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function bp(e,t,n,r){var s=e.updateQueue;Ka=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,l=i;do{var p=l.lane,h=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,v=l;switch(p=t,h=n,v.tag){case 1:if(m=v.payload,typeof m=="function"){f=m.call(h,f,p);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=v.payload,p=typeof m=="function"?m.call(h,f,p):m,p==null)break e;f=lt({},f,p);break e;case 2:Ka=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Ci|=o,e.lanes=o,e.memoizedState=f}}function d2(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Wx.transition;Wx.transition={};try{e(!1),t()}finally{Ie=n,Wx.transition=r}}function UA(){return ur().memoizedState}function bR(e,t,n){var r=fs(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},WA(e))qA(t,n);else if(n=kA(e,t,n,r),n!==null){var s=pn();_r(n,e,r,s),HA(n,t,r)}}function jR(e,t,n){var r=fs(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(WA(e))qA(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Mr(l,o)){var c=t.interleaved;c===null?(s.next=s,Bb(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=kA(e,t,s,r),n!==null&&(s=pn(),_r(n,e,r,s),HA(n,t,r))}}function WA(e){var t=e.alternate;return e===ot||t!==null&&t===ot}function qA(e,t){Rc=wp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function HA(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Cb(e,n)}}var Np={readContext:cr,useCallback:Gt,useContext:Gt,useEffect:Gt,useImperativeHandle:Gt,useInsertionEffect:Gt,useLayoutEffect:Gt,useMemo:Gt,useReducer:Gt,useRef:Gt,useState:Gt,useDebugValue:Gt,useDeferredValue:Gt,useTransition:Gt,useMutableSource:Gt,useSyncExternalStore:Gt,useId:Gt,unstable_isNewReconciler:!1},wR={readContext:cr,useCallback:function(e,t){return Fr().memoizedState=[e,t===void 0?null:t],e},useContext:cr,useEffect:p2,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,If(4194308,4,LA.bind(null,t,e),n)},useLayoutEffect:function(e,t){return If(4194308,4,e,t)},useInsertionEffect:function(e,t){return If(4,2,e,t)},useMemo:function(e,t){var n=Fr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Fr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=bR.bind(null,ot,e),[r.memoizedState,e]},useRef:function(e){var t=Fr();return e={current:e},t.memoizedState=e},useState:f2,useDebugValue:Xb,useDeferredValue:function(e){return Fr().memoizedState=e},useTransition:function(){var e=f2(!1),t=e[0];return e=yR.bind(null,e[1]),Fr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ot,s=Fr();if(nt){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),Lt===null)throw Error(te(349));ki&30||EA(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,p2(TA.bind(null,r,i,e),[e]),r.flags|=2048,mu(9,OA.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Fr(),t=Lt.identifierPrefix;if(nt){var n=ga,r=xa;n=(r&~(1<<32-Cr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=pu++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[qr]=t,e[uu]=r,nP(e,t,!1,!1),t.stateNode=e;e:{switch(o=xg(n,r),n){case"dialog":Xe("cancel",e),Xe("close",e),s=r;break;case"iframe":case"object":case"embed":Xe("load",e),s=r;break;case"video":case"audio":for(s=0;sKo&&(t.flags|=128,r=!0,oc(i,!1),t.lanes=4194304)}else{if(!r)if(e=jp(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!nt)return Xt(t),null}else 2*ht()-i.renderingStartTime>Ko&&n!==1073741824&&(t.flags|=128,r=!0,oc(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ht(),t.sibling=null,n=it.current,Ke(it,r?n&1|2:n&1),t):(Xt(t),null);case 22:case 23:return t1(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?$n&1073741824&&(Xt(t),t.subtreeFlags&6&&(t.flags|=8192)):Xt(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function ER(e,t){switch(Rb(t),t.tag){case 1:return Cn(t.type)&&hp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qo(),Ze(kn),Ze(an),Wb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ub(t),null;case 13:if(Ze(it),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));Uo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ze(it),null;case 4:return qo(),null;case 10:return zb(t.type._context),null;case 22:case 23:return t1(),null;case 24:return null;default:return null}}var Zd=!1,Zt=!1,OR=typeof WeakSet=="function"?WeakSet:Set,de=null;function go(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ut(e,t,r)}else n.current=null}function Ug(e,t,n){try{n()}catch(r){ut(e,t,r)}}var S2=!1;function TR(e,t){if(Cg=up,e=cA(),$b(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===s&&(l=o),p===i&&++d===r&&(c=o),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(_g={focusedElem:e,selectionRange:n},up=!1,de=t;de!==null;)if(t=de,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,de=e;else for(;de!==null;){t=de;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,x=m.memoizedState,y=t.stateNode,g=y.getSnapshotBeforeUpdate(t.elementType===t.type?v:br(t.type,v),x);y.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var j=t.stateNode.containerInfo;j.nodeType===1?j.textContent="":j.nodeType===9&&j.documentElement&&j.removeChild(j.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(N){ut(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return m=S2,S2=!1,m}function Dc(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Ug(t,n,i)}s=s.next}while(s!==r)}}function im(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Wg(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function sP(e){var t=e.alternate;t!==null&&(e.alternate=null,sP(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qr],delete t[uu],delete t[Eg],delete t[hR],delete t[mR])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function iP(e){return e.tag===5||e.tag===3||e.tag===4}function k2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||iP(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=pp));else if(r!==4&&(e=e.child,e!==null))for(qg(e,t,n),e=e.sibling;e!==null;)qg(e,t,n),e=e.sibling}function Hg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Hg(e,t,n),e=e.sibling;e!==null;)Hg(e,t,n),e=e.sibling}var Ft=null,jr=!1;function Va(e,t,n){for(n=n.child;n!==null;)oP(e,t,n),n=n.sibling}function oP(e,t,n){if(Yr&&typeof Yr.onCommitFiberUnmount=="function")try{Yr.onCommitFiberUnmount(Jh,n)}catch{}switch(n.tag){case 5:Zt||go(n,t);case 6:var r=Ft,s=jr;Ft=null,Va(e,t,n),Ft=r,jr=s,Ft!==null&&(jr?(e=Ft,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ft.removeChild(n.stateNode));break;case 18:Ft!==null&&(jr?(e=Ft,n=n.stateNode,e.nodeType===8?Fx(e.parentNode,n):e.nodeType===1&&Fx(e,n),su(e)):Fx(Ft,n.stateNode));break;case 4:r=Ft,s=jr,Ft=n.stateNode.containerInfo,jr=!0,Va(e,t,n),Ft=r,jr=s;break;case 0:case 11:case 14:case 15:if(!Zt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Ug(n,t,o),s=s.next}while(s!==r)}Va(e,t,n);break;case 1:if(!Zt&&(go(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ut(n,t,l)}Va(e,t,n);break;case 21:Va(e,t,n);break;case 22:n.mode&1?(Zt=(r=Zt)||n.memoizedState!==null,Va(e,t,n),Zt=r):Va(e,t,n);break;default:Va(e,t,n)}}function C2(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new OR),t.forEach(function(r){var s=FR.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function mr(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=ht()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*MR(r/1960))-r,10e?16:e,ts===null)var r=!1;else{if(e=ts,ts=null,Cp=0,$e&6)throw Error(te(331));var s=$e;for($e|=4,de=e.current;de!==null;){var i=de,o=i.child;if(de.flags&16){var l=i.deletions;if(l!==null){for(var c=0;cht()-Zb?mi(e,0):Jb|=n),_n(e,t)}function mP(e,t){t===0&&(e.mode&1?(t=Wd,Wd<<=1,!(Wd&130023424)&&(Wd=4194304)):t=1);var n=pn();e=_a(e,t),e!==null&&(dd(e,t,n),_n(e,n))}function BR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),mP(e,n)}function FR(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(te(314))}r!==null&&r.delete(t),mP(e,n)}var xP;xP=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||kn.current)Nn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Nn=!1,AR(e,t,n);Nn=!!(e.flags&131072)}else Nn=!1,nt&&t.flags&1048576&&bA(t,gp,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Lf(e,t),e=t.pendingProps;var s=Vo(t,an.current);To(t,n),s=Hb(null,t,r,e,s,n);var i=Kb();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Cn(r)?(i=!0,mp(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Fb(t),s.updater=sm,t.stateNode=s,s._reactInternals=t,Dg(t,r,e,n),t=zg(null,t,r,!0,i,n)):(t.tag=0,nt&&i&&Mb(t),sn(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Lf(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=UR(r),e=br(r,e),s){case 0:t=Lg(null,t,r,e,n);break e;case 1:t=j2(null,t,r,e,n);break e;case 11:t=y2(null,t,r,e,n);break e;case 14:t=b2(null,t,r,br(r.type,e),n);break e}throw Error(te(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:br(r,s),Lg(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:br(r,s),j2(e,t,r,s,n);case 3:e:{if(ZA(t),e===null)throw Error(te(387));r=t.pendingProps,i=t.memoizedState,s=i.element,CA(e,t),bp(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Ho(Error(te(423)),t),t=w2(e,t,r,n,s);break e}else if(r!==s){s=Ho(Error(te(424)),t),t=w2(e,t,r,n,s);break e}else for(Dn=cs(t.stateNode.containerInfo.firstChild),In=t,nt=!0,Sr=null,n=SA(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Uo(),r===s){t=Aa(e,t,n);break e}sn(e,t,r,n)}t=t.child}return t;case 5:return _A(t),e===null&&$g(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Ag(r,s)?o=null:i!==null&&Ag(r,i)&&(t.flags|=32),JA(e,t),sn(e,t,o,n),t.child;case 6:return e===null&&$g(t),null;case 13:return eP(e,t,n);case 4:return Vb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Wo(t,null,r,n):sn(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:br(r,s),y2(e,t,r,s,n);case 7:return sn(e,t,t.pendingProps,n),t.child;case 8:return sn(e,t,t.pendingProps.children,n),t.child;case 12:return sn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,Ke(vp,r._currentValue),r._currentValue=o,i!==null)if(Mr(i.value,o)){if(i.children===s.children&&!kn.current){t=Aa(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=wa(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Mg(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(te(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Mg(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}sn(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,To(t,n),s=cr(s),r=r(s),t.flags|=1,sn(e,t,r,n),t.child;case 14:return r=t.type,s=br(r,t.pendingProps),s=br(r.type,s),b2(e,t,r,s,n);case 15:return YA(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:br(r,s),Lf(e,t),t.tag=1,Cn(r)?(e=!0,mp(t)):e=!1,To(t,n),KA(t,r,s),Dg(t,r,s,n),zg(null,t,r,!0,e,n);case 19:return tP(e,t,n);case 22:return QA(e,t,n)}throw Error(te(156,t.tag))};function gP(e,t){return W_(e,t)}function VR(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rr(e,t,n,r){return new VR(e,t,n,r)}function r1(e){return e=e.prototype,!(!e||!e.isReactComponent)}function UR(e){if(typeof e=="function")return r1(e)?1:0;if(e!=null){if(e=e.$$typeof,e===wb)return 11;if(e===Nb)return 14}return 2}function ps(e,t){var n=e.alternate;return n===null?(n=rr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ff(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")r1(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case oo:return xi(n.children,s,i,t);case jb:o=8,s|=8;break;case ig:return e=rr(12,n,t,s|2),e.elementType=ig,e.lanes=i,e;case og:return e=rr(13,n,t,s),e.elementType=og,e.lanes=i,e;case lg:return e=rr(19,n,t,s),e.elementType=lg,e.lanes=i,e;case __:return lm(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case k_:o=10;break e;case C_:o=9;break e;case wb:o=11;break e;case Nb:o=14;break e;case Ha:o=16,r=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=rr(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function xi(e,t,n,r){return e=rr(7,e,r,t),e.lanes=n,e}function lm(e,t,n,r){return e=rr(22,e,r,t),e.elementType=__,e.lanes=n,e.stateNode={isHidden:!1},e}function Xx(e,t,n){return e=rr(6,e,null,t),e.lanes=n,e}function Yx(e,t,n){return t=rr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function WR(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ex(0),this.expirationTimes=Ex(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ex(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function a1(e,t,n,r,s,i,o,l,c){return e=new WR(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=rr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fb(i),e}function qR(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(jP)}catch(e){console.error(e)}}jP(),j_.exports=Vn;var Bi=j_.exports;const YR=De(Bi);var M2=Bi;ag.createRoot=M2.createRoot,ag.hydrateRoot=M2.hydrateRoot;/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function gu(){return gu=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function l1(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function JR(){return Math.random().toString(36).substr(2,8)}function D2(e,t){return{usr:e.state,key:e.key,idx:t}}function Qg(e,t,n,r){return n===void 0&&(n=null),gu({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Pl(t):t,{state:n,key:t&&t.key||r||JR()})}function Pp(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Pl(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function ZR(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l=ns.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(gu({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=ns.Pop;let x=d(),y=x==null?null:x-u;u=x,c&&c({action:l,location:v.location,delta:y})}function p(x,y){l=ns.Push;let g=Qg(v.location,x,y);u=d()+1;let j=D2(g,u),N=v.createHref(g);try{o.pushState(j,"",N)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;s.location.assign(N)}i&&c&&c({action:l,location:v.location,delta:1})}function h(x,y){l=ns.Replace;let g=Qg(v.location,x,y);u=d();let j=D2(g,u),N=v.createHref(g);o.replaceState(j,"",N),i&&c&&c({action:l,location:v.location,delta:0})}function m(x){let y=s.location.origin!=="null"?s.location.origin:s.location.href,g=typeof x=="string"?x:Pp(x);return g=g.replace(/ $/,"%20"),wt(y,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,y)}let v={get action(){return l},get location(){return e(s,o)},listen(x){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(R2,f),c=x,()=>{s.removeEventListener(R2,f),c=null}},createHref(x){return t(s,x)},createURL:m,encodeLocation(x){let y=m(x);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:p,replace:h,go(x){return o.go(x)}};return v}var I2;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(I2||(I2={}));function eD(e,t,n){return n===void 0&&(n="/"),tD(e,t,n)}function tD(e,t,n,r){let s=typeof t=="string"?Pl(t):t,i=c1(s.pathname||"/",n);if(i==null)return null;let o=wP(e);nD(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(wt(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=hs([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(wt(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),wP(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:cD(u,i.index),routesMeta:d})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let c of NP(i.path))s(i,o,c)}),t}function NP(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=NP(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function nD(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:uD(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const rD=/^:[\w-]+$/,aD=3,sD=2,iD=1,oD=10,lD=-2,L2=e=>e==="*";function cD(e,t){let n=e.split("/"),r=n.length;return n.some(L2)&&(r+=lD),t&&(r+=sD),n.filter(s=>!L2(s)).reduce((s,i)=>s+(rD.test(i)?aD:i===""?iD:oD),r)}function uD(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function dD(e,t,n){let{routesMeta:r}=e,s={},i="/",o=[];for(let l=0;l{let{paramName:p,isOptional:h}=d;if(p==="*"){let v=l[f]||"";o=i.slice(0,i.length-v.length).replace(/(.)\/+$/,"$1")}const m=l[f];return h&&!m?u[p]=void 0:u[p]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function pD(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),l1(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function hD(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return l1(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function c1(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const mD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xD=e=>mD.test(e);function gD(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Pl(e):e,i;if(n)if(xD(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),l1(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=z2(n.substring(1),"/"):i=z2(n,t)}else i=t;return{pathname:i,search:bD(r),hash:jD(s)}}function z2(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Qx(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function vD(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function SP(e,t){let n=vD(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function kP(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Pl(e):(s=gu({},e),wt(!s.pathname||!s.pathname.includes("?"),Qx("?","pathname","search",s)),wt(!s.pathname||!s.pathname.includes("#"),Qx("#","pathname","hash",s)),wt(!s.search||!s.search.includes("#"),Qx("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;s.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=gD(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const hs=e=>e.join("/").replace(/\/\/+/g,"/"),yD=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),bD=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,jD=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function wD(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const CP=["post","put","patch","delete"];new Set(CP);const ND=["get",...CP];new Set(ND);/** + * React Router v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function vu(){return vu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),b.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=kP(u,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:hs([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,i,e])}function PP(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=b.useContext(Fi),{matches:s}=b.useContext(Vi),{pathname:i}=El(),o=JSON.stringify(SP(s,r.v7_relativeSplatPath));return b.useMemo(()=>kP(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function _D(e,t){return AD(e,t)}function AD(e,t,n,r){md()||wt(!1);let{navigator:s}=b.useContext(Fi),{matches:i}=b.useContext(Vi),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=El(),d;if(t){var f;let x=typeof t=="string"?Pl(t):t;c==="/"||(f=x.pathname)!=null&&f.startsWith(c)||wt(!1),d=x}else d=u;let p=d.pathname||"/",h=p;if(c!=="/"){let x=c.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(x.length).join("/")}let m=eD(e,{pathname:h}),v=$D(m&&m.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:hs([c,s.encodeLocation?s.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:hs([c,s.encodeLocation?s.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),i,n,r);return t&&v?b.createElement(pm.Provider,{value:{location:vu({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ns.Pop}},v):v}function PD(){let e=ID(),t=wD(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:s},n):null,null)}const ED=b.createElement(PD,null);class OD extends b.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?b.createElement(Vi.Provider,{value:this.props.routeContext},b.createElement(_P.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function TD(e){let{routeContext:t,match:n,children:r}=e,s=b.useContext(u1);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(Vi.Provider,{value:t},r)}function $D(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(s=n)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||wt(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,p)=>{let h,m=!1,v=null,x=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,v=f.route.errorElement||ED,c&&(u<0&&p===0?(zD("route-fallback"),m=!0,x=null):u===p&&(m=!0,x=f.route.hydrateFallbackElement||null)));let y=t.concat(o.slice(0,p+1)),g=()=>{let j;return h?j=v:m?j=x:f.route.Component?j=b.createElement(f.route.Component,null):f.route.element?j=f.route.element:j=d,b.createElement(TD,{match:f,routeContext:{outlet:d,matches:y,isDataRoute:n!=null},children:j})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?b.createElement(OD,{location:n.location,revalidation:n.revalidation,component:v,error:h,children:g(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):g()},null)}var EP=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(EP||{}),OP=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(OP||{});function MD(e){let t=b.useContext(u1);return t||wt(!1),t}function RD(e){let t=b.useContext(SD);return t||wt(!1),t}function DD(e){let t=b.useContext(Vi);return t||wt(!1),t}function TP(e){let t=DD(),n=t.matches[t.matches.length-1];return n.route.id||wt(!1),n.route.id}function ID(){var e;let t=b.useContext(_P),n=RD(),r=TP();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function LD(){let{router:e}=MD(EP.UseNavigateStable),t=TP(OP.UseNavigateStable),n=b.useRef(!1);return AP(()=>{n.current=!0}),b.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,vu({fromRouteId:t},i)))},[e,t])}const B2={};function zD(e,t,n){B2[e]||(B2[e]=!0)}function BD(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function st(e){wt(!1)}function FD(e){let{basename:t="/",children:n=null,location:r,navigationType:s=ns.Pop,navigator:i,static:o=!1,future:l}=e;md()&&wt(!1);let c=t.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:c,navigator:i,static:o,future:vu({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof r=="string"&&(r=Pl(r));let{pathname:d="/",search:f="",hash:p="",state:h=null,key:m="default"}=r,v=b.useMemo(()=>{let x=c1(d,c);return x==null?null:{location:{pathname:x,search:f,hash:p,state:h,key:m},navigationType:s}},[c,d,f,p,h,m,s]);return v==null?null:b.createElement(Fi.Provider,{value:u},b.createElement(pm.Provider,{children:n,value:v}))}function VD(e){let{children:t,location:n}=e;return _D(Jg(t),n)}new Promise(()=>{});function Jg(e,t){t===void 0&&(t=[]);let n=[];return b.Children.forEach(e,(r,s)=>{if(!b.isValidElement(r))return;let i=[...t,s];if(r.type===b.Fragment){n.push.apply(n,Jg(r.props.children,i));return}r.type!==st&&wt(!1),!r.props.index||!r.props.children||wt(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Jg(r.props.children,i)),n.push(o)}),n}/** + * React Router DOM v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Zg(){return Zg=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function WD(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function qD(e,t){return e.button===0&&(!t||t==="_self")&&!WD(e)}const HD=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],KD="6";try{window.__reactRouterVersion=KD}catch{}const GD="startTransition",F2=z8[GD];function XD(e){let{basename:t,children:n,future:r,window:s}=e,i=b.useRef();i.current==null&&(i.current=QR({window:s,v5Compat:!0}));let o=i.current,[l,c]=b.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=b.useCallback(f=>{u&&F2?F2(()=>c(f)):c(f)},[c,u]);return b.useLayoutEffect(()=>o.listen(d),[o,d]),b.useEffect(()=>BD(r),[r]),b.createElement(FD,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const YD=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",QD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$P=b.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,p=UD(t,HD),{basename:h}=b.useContext(Fi),m,v=!1;if(typeof u=="string"&&QD.test(u)&&(m=u,YD))try{let j=new URL(window.location.href),N=u.startsWith("//")?new URL(j.protocol+u):new URL(u),w=c1(N.pathname,h);N.origin===j.origin&&w!=null?u=w+N.search+N.hash:v=!0}catch{}let x=kD(u,{relative:s}),y=JD(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:f});function g(j){r&&r(j),j.defaultPrevented||y(j)}return b.createElement("a",Zg({},p,{href:m||x,onClick:v||i?r:g,ref:n,target:c}))});var V2;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(V2||(V2={}));var U2;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(U2||(U2={}));function JD(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=hm(),u=El(),d=PP(e,{relative:o});return b.useCallback(f=>{if(qD(f,n)){f.preventDefault();let p=r!==void 0?r:Pp(u)===Pp(d);c(e,{replace:p,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,d,r,s,n,e,i,o,l])}/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),MP=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var eI={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tI=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>b.createElement("svg",{ref:c,...eI,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:MP("lucide",s),...l},[...o.map(([u,d])=>b.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y=(e,t)=>{const n=b.forwardRef(({className:r,...s},i)=>b.createElement(tI,{ref:i,iconNode:t,className:MP(`lucide-${ZD(e)}`,r),...s}));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nI=Y("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rI=Y("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aI=Y("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ui=Y("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RP=Y("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sI=Y("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iI=Y("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ys=Y("BarChart2",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yu=Y("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oI=Y("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vf=Y("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ep=Y("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lI=Y("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ra=Y("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d1=Y("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mm=Y("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f1=Y("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DP=Y("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Op=Y("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W2=Y("CameraOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q2=Y("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tp=Y("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jt=Y("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aa=Y("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xd=Y("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Pa=Y("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const p1=Y("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ar=Y("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h1=Y("CircleArrowRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ts=Y("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nn=Y("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ol=Y("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IP=Y("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Jx=Y("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ai=Y("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bu=Y("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hn=Y("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cI=Y("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xm=Y("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const m1=Y("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uI=Y("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LP=Y("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $p=Y("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Hr=Y("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dI=Y("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ev=Y("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fI=Y("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zP=Y("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pI=Y("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hI=Y("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mI=Y("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xI=Y("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BP=Y("ImagePlus",[["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"31hg93"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["line",{x1:"19",x2:"19",y1:"2",y2:"8",key:"1gkr8c"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FP=Y("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Pr=Y("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gI=Y("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vI=Y("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yI=Y("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tv=Y("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bI=Y("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nv=Y("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VP=Y("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jI=Y("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nf=Y("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Go=Y("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UP=Y("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WP=Y("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vr=Y("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wI=Y("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NI=Y("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SI=Y("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kI=Y("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gm=Y("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ju=Y("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CI=Y("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const x1=Y("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rn=Y("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _I=Y("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4c0-1.1.9-2 2-2h8a2 2 0 0 1 2 2z",key:"jj09z8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const g1=Y("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qP=Y("MousePointerClick",[["path",{d:"m9 9 5 12 1.8-5.2L21 14Z",key:"1b76lo"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AI=Y("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PI=Y("Package2",[["path",{d:"M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z",key:"1ront0"}],["path",{d:"m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9",key:"19h2x1"}],["path",{d:"M12 3v6",key:"1holv5"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mp=Y("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bs=Y("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EI=Y("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OI=Y("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vm=Y("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Er=Y("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HP=Y("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wu=Y("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TI=Y("PinOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["line",{x1:"12",x2:"12",y1:"17",y2:"22",key:"1jrz49"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h12",key:"13x2n8"}],["path",{d:"M15 9.34V6h1a2 2 0 0 0 0-4H7.89",key:"reo3ki"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H2=Y("Pin",[["line",{x1:"12",x2:"12",y1:"17",y2:"22",key:"1jrz49"}],["path",{d:"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z",key:"13yl11"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Oe=Y("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $I=Y("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KP=Y("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GP=Y("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XP=Y("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const js=Y("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ke=Y("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MI=Y("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const or=Y("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ir=Y("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Rr=Y("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RI=Y("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v1=Y("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YP=Y("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Pi=Y("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ws=Y("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QP=Y("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JP=Y("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DI=Y("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y1=Y("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const II=Y("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rv=Y("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LI=Y("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",key:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gd=Y("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zI=Y("Stethoscope",[["path",{d:"M4.8 2.3A.3.3 0 1 0 5 2H4a2 2 0 0 0-2 2v5a6 6 0 0 0 6 6v0a6 6 0 0 0 6-6V4a2 2 0 0 0-2-2h-1a.2.2 0 1 0 .3.3",key:"1jd90r"}],["path",{d:"M8 15v1a6 6 0 0 0 6 6v0a6 6 0 0 0 6-6v-4",key:"126ukv"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Xo=Y("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BI=Y("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const av=Y("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZP=Y("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ns=Y("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ss=Y("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Te=Y("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FI=Y("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wi=Y("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kt=Y("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ym=Y("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Nu=Y("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eE=Y("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Uf=Y("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tl=Y("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VI=Y("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UI=Y("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ks=Y("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WI=Y("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const et=Y("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tE=Y("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sv=Y("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K2=Y("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nE=Y("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ce=Y("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.380.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mo=Y("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function rE(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t-1}var U9=V9,W9=jm;function q9(e,t){var n=this.__data__,r=W9(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var H9=q9,K9=P9,G9=I9,X9=B9,Y9=U9,Q9=H9;function Dl(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0?1:-1},ii=function(t){return Ei(t)&&t.indexOf("%")===t.length-1},ee=function(t){return g7(t)&&!Ll(t)},j7=function(t){return je(t)},Et=function(t){return ee(t)||Ei(t)},w7=0,Hi=function(t){var n=++w7;return"".concat(t||"").concat(n)},cn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ee(t)&&!Ei(t))return r;var i;if(ii(t)){var o=t.indexOf("%");i=n*parseFloat(t.slice(0,o))/100}else i=+t;return Ll(i)&&(i=r),s&&i>n&&(i=n),i},Za=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},N7=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function E7(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ov(e){"@babel/helpers - typeof";return ov=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ov(e)}var sN={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Na=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},iN=null,t0=null,O1=function e(t){if(t===iN&&Array.isArray(t0))return t0;var n=[];return b.Children.forEach(t,function(r){je(r)||(f7.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),t0=n,iN=t,n};function zn(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(s){return Na(s)}):r=[Na(t)],O1(e).forEach(function(s){var i=Ln(s,"type.displayName")||Ln(s,"type.name");r.indexOf(i)!==-1&&n.push(s)}),n}function Mn(e,t){var n=zn(e,t);return n&&n[0]}var oN=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,s=n.height;return!(!ee(r)||r<=0||!ee(s)||s<=0)},O7=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],T7=function(t){return t&&t.type&&Ei(t.type)&&O7.indexOf(t.type)>=0},xE=function(t){return t&&ov(t)==="object"&&"clipDot"in t},$7=function(t,n,r,s){var i,o=(i=e0==null?void 0:e0[s])!==null&&i!==void 0?i:[];return n.startsWith("data-")||!ve(t)&&(s&&o.includes(n)||C7.includes(n))||r&&E1.includes(n)},me=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(b.isValidElement(t)&&(s=t.props),!Ml(s))return null;var i={};return Object.keys(s).forEach(function(o){var l;$7((l=s)===null||l===void 0?void 0:l[o],o,n,r)&&(i[o]=s[o])}),i},lv=function e(t,n){if(t===n)return!0;var r=b.Children.count(t);if(r!==b.Children.count(n))return!1;if(r===0)return!0;if(r===1)return lN(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function L7(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function uv(e){var t=e.children,n=e.width,r=e.height,s=e.viewBox,i=e.className,o=e.style,l=e.title,c=e.desc,u=I7(e,D7),d=s||{width:n,height:r,x:0,y:0},f=Ne("recharts-surface",i);return O.createElement("svg",cv({},me(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),O.createElement("title",null,l),O.createElement("desc",null,c),t)}var z7=["children","className"];function dv(){return dv=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function F7(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Ae=O.forwardRef(function(e,t){var n=e.children,r=e.className,s=B7(e,z7),i=Ne("recharts-layer",r);return O.createElement("g",dv({className:i},me(s,!0),{ref:t}),n)}),Or=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;is?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(s);++r=r?e:W7(e,t,n)}var H7=q7,K7="\\ud800-\\udfff",G7="\\u0300-\\u036f",X7="\\ufe20-\\ufe2f",Y7="\\u20d0-\\u20ff",Q7=G7+X7+Y7,J7="\\ufe0e\\ufe0f",Z7="\\u200d",eB=RegExp("["+Z7+K7+Q7+J7+"]");function tB(e){return eB.test(e)}var gE=tB;function nB(e){return e.split("")}var rB=nB,vE="\\ud800-\\udfff",aB="\\u0300-\\u036f",sB="\\ufe20-\\ufe2f",iB="\\u20d0-\\u20ff",oB=aB+sB+iB,lB="\\ufe0e\\ufe0f",cB="["+vE+"]",fv="["+oB+"]",pv="\\ud83c[\\udffb-\\udfff]",uB="(?:"+fv+"|"+pv+")",yE="[^"+vE+"]",bE="(?:\\ud83c[\\udde6-\\uddff]){2}",jE="[\\ud800-\\udbff][\\udc00-\\udfff]",dB="\\u200d",wE=uB+"?",NE="["+lB+"]?",fB="(?:"+dB+"(?:"+[yE,bE,jE].join("|")+")"+NE+wE+")*",pB=NE+wE+fB,hB="(?:"+[yE+fv+"?",fv,bE,jE,cB].join("|")+")",mB=RegExp(pv+"(?="+pv+")|"+hB+pB,"g");function xB(e){return e.match(mB)||[]}var gB=xB,vB=rB,yB=gE,bB=gB;function jB(e){return yB(e)?bB(e):vB(e)}var wB=jB,NB=H7,SB=gE,kB=wB,CB=uE;function _B(e){return function(t){t=CB(t);var n=SB(t)?kB(t):void 0,r=n?n[0]:t.charAt(0),s=n?NB(n,1).join(""):t.slice(1);return r[e]()+s}}var AB=_B,PB=AB,EB=PB("toUpperCase"),OB=EB;const Rm=De(OB);function He(e){return function(){return e}}const SE=Math.cos,Ip=Math.sin,Lr=Math.sqrt,Lp=Math.PI,Dm=2*Lp,hv=Math.PI,mv=2*hv,Xs=1e-6,TB=mv-Xs;function kE(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return kE;const n=10**t;return function(r){this._+=r[0];for(let s=1,i=r.length;sXs)if(!(Math.abs(f*c-u*d)>Xs)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,m=s-l,v=c*c+u*u,x=h*h+m*m,y=Math.sqrt(v),g=Math.sqrt(p),j=i*Math.tan((hv-Math.acos((v+p-x)/(2*y*g)))/2),N=j/g,w=j/y;Math.abs(N-1)>Xs&&this._append`L${t+N*d},${n+N*f}`,this._append`A${i},${i},0,0,${+(f*h>d*m)},${this._x1=t+w*c},${this._y1=n+w*u}`}}arc(t,n,r,s,i,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(s),c=r*Math.sin(s),u=t+l,d=n+c,f=1^o,p=o?s-i:i-s;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Xs||Math.abs(this._y1-d)>Xs)&&this._append`L${u},${d}`,r&&(p<0&&(p=p%mv+mv),p>TB?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:p>Xs&&this._append`A${r},${r},0,${+(p>=hv)},${f},${this._x1=t+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(t,n,r,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+s}h${-r}Z`}toString(){return this._}}function T1(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new MB(t)}function $1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function CE(e){this._context=e}CE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Im(e){return new CE(e)}function _E(e){return e[0]}function AE(e){return e[1]}function PE(e,t){var n=He(!0),r=null,s=Im,i=null,o=T1(l);e=typeof e=="function"?e:e===void 0?_E:He(e),t=typeof t=="function"?t:t===void 0?AE:He(t);function l(c){var u,d=(c=$1(c)).length,f,p=!1,h;for(r==null&&(i=s(h=o())),u=0;u<=d;++u)!(u=h;--m)l.point(j[m],N[m]);l.lineEnd(),l.areaEnd()}y&&(j[p]=+e(x,p,f),N[p]=+t(x,p,f),l.point(r?+r(x,p,f):j[p],n?+n(x,p,f):N[p]))}if(g)return l=null,g+""||null}function d(){return PE().defined(s).curve(o).context(i)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:He(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:He(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:He(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:He(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:He(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:He(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(s=typeof f=="function"?f:He(!!f),u):s},u.curve=function(f){return arguments.length?(o=f,i!=null&&(l=o(i)),u):o},u.context=function(f){return arguments.length?(f==null?i=l=null:l=o(i=f),u):i},u}class EE{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function RB(e){return new EE(e,!0)}function DB(e){return new EE(e,!1)}const M1={draw(e,t){const n=Lr(t/Lp);e.moveTo(n,0),e.arc(0,0,n,0,Dm)}},IB={draw(e,t){const n=Lr(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},OE=Lr(1/3),LB=OE*2,zB={draw(e,t){const n=Lr(t/LB),r=n*OE;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},BB={draw(e,t){const n=Lr(t),r=-n/2;e.rect(r,r,n,n)}},FB=.8908130915292852,TE=Ip(Lp/10)/Ip(7*Lp/10),VB=Ip(Dm/10)*TE,UB=-SE(Dm/10)*TE,WB={draw(e,t){const n=Lr(t*FB),r=VB*n,s=UB*n;e.moveTo(0,-n),e.lineTo(r,s);for(let i=1;i<5;++i){const o=Dm*i/5,l=SE(o),c=Ip(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*s,c*r+l*s)}e.closePath()}},n0=Lr(3),qB={draw(e,t){const n=-Lr(t/(n0*3));e.moveTo(0,n*2),e.lineTo(-n0*n,-n),e.lineTo(n0*n,-n),e.closePath()}},qn=-.5,Hn=Lr(3)/2,xv=1/Lr(12),HB=(xv/2+1)*3,KB={draw(e,t){const n=Lr(t/HB),r=n/2,s=n*xv,i=r,o=n*xv+n,l=-i,c=o;e.moveTo(r,s),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(qn*r-Hn*s,Hn*r+qn*s),e.lineTo(qn*i-Hn*o,Hn*i+qn*o),e.lineTo(qn*l-Hn*c,Hn*l+qn*c),e.lineTo(qn*r+Hn*s,qn*s-Hn*r),e.lineTo(qn*i+Hn*o,qn*o-Hn*i),e.lineTo(qn*l+Hn*c,qn*c-Hn*l),e.closePath()}};function GB(e,t){let n=null,r=T1(s);e=typeof e=="function"?e:He(e||M1),t=typeof t=="function"?t:He(t===void 0?64:+t);function s(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return s.type=function(i){return arguments.length?(e=typeof i=="function"?i:He(i),s):e},s.size=function(i){return arguments.length?(t=typeof i=="function"?i:He(+i),s):t},s.context=function(i){return arguments.length?(n=i??null,s):n},s}function zp(){}function Bp(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function $E(e){this._context=e}$E.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Bp(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Bp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function XB(e){return new $E(e)}function ME(e){this._context=e}ME.prototype={areaStart:zp,areaEnd:zp,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Bp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function YB(e){return new ME(e)}function RE(e){this._context=e}RE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Bp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function QB(e){return new RE(e)}function DE(e){this._context=e}DE.prototype={areaStart:zp,areaEnd:zp,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function JB(e){return new DE(e)}function uN(e){return e<0?-1:1}function dN(e,t,n){var r=e._x1-e._x0,s=t-e._x1,i=(e._y1-e._y0)/(r||s<0&&-0),o=(n-e._y1)/(s||r<0&&-0),l=(i*s+o*r)/(r+s);return(uN(i)+uN(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function fN(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function r0(e,t,n){var r=e._x0,s=e._y0,i=e._x1,o=e._y1,l=(i-r)/3;e._context.bezierCurveTo(r+l,s+l*t,i-l,o-l*n,i,o)}function Fp(e){this._context=e}Fp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:r0(this,this._t0,fN(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,r0(this,fN(this,n=dN(this,e,t)),n);break;default:r0(this,this._t0,n=dN(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function IE(e){this._context=new LE(e)}(IE.prototype=Object.create(Fp.prototype)).point=function(e,t){Fp.prototype.point.call(this,t,e)};function LE(e){this._context=e}LE.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,s,i){this._context.bezierCurveTo(t,e,r,n,i,s)}};function ZB(e){return new Fp(e)}function eF(e){return new IE(e)}function zE(e){this._context=e}zE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=pN(e),s=pN(t),i=0,o=1;o=0;--t)s[t]=(o[t]-s[t+1])/i[t];for(i[n-1]=(e[n]+s[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function nF(e){return new Lm(e,.5)}function rF(e){return new Lm(e,0)}function aF(e){return new Lm(e,1)}function Yo(e,t){if((o=e.length)>1)for(var n=1,r,s,i=e[t[0]],o,l=i.length;n=0;)n[t]=t;return n}function sF(e,t){return e[t]}function iF(e){const t=[];return t.key=e,t}function oF(){var e=He([]),t=gv,n=Yo,r=sF;function s(i){var o=Array.from(e.apply(this,arguments),iF),l,c=o.length,u=-1,d;for(const f of i)for(l=0,++u;l0){for(var n,r,s=0,i=e[0].length,o;s0){for(var n=0,r=e[t[0]],s,i=r.length;n0)||!((i=(s=e[t[0]]).length)>0))){for(var n=0,r=1,s,i,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xF(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var BE={symbolCircle:M1,symbolCross:IB,symbolDiamond:zB,symbolSquare:BB,symbolStar:WB,symbolTriangle:qB,symbolWye:KB},gF=Math.PI/180,vF=function(t){var n="symbol".concat(Rm(t));return BE[n]||M1},yF=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var s=18*gF;return 1.25*t*t*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},bF=function(t,n){BE["symbol".concat(Rm(t))]=n},R1=function(t){var n=t.type,r=n===void 0?"circle":n,s=t.size,i=s===void 0?64:s,o=t.sizeType,l=o===void 0?"area":o,c=mF(t,dF),u=mN(mN({},c),{},{type:r,size:i,sizeType:l}),d=function(){var x=vF(r),y=GB().type(x).size(yF(i,l,r));return y()},f=u.className,p=u.cx,h=u.cy,m=me(u,!0);return p===+p&&h===+h&&i===+i?O.createElement("path",vv({},m,{className:Ne("recharts-symbols",f),transform:"translate(".concat(p,", ").concat(h,")"),d:d()})):null};R1.registerSymbol=bF;function Qo(e){"@babel/helpers - typeof";return Qo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qo(e)}function yv(){return yv=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var g=h.inactive?u:h.color;return O.createElement("li",yv({className:x,style:f,key:"legend-item-".concat(m)},Oi(r.props,h,m)),O.createElement(uv,{width:o,height:o,viewBox:d,style:p},r.renderIcon(h)),O.createElement("span",{className:"recharts-legend-item-text",style:{color:g}},v?v(y,h,m):y))})}},{key:"render",value:function(){var r=this.props,s=r.payload,i=r.layout,o=r.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return O.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(b.PureComponent);ku(D1,"displayName","Legend");ku(D1,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var EF=wm;function OF(){this.__data__=new EF,this.size=0}var TF=OF;function $F(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var MF=$F;function RF(e){return this.__data__.get(e)}var DF=RF;function IF(e){return this.__data__.has(e)}var LF=IF,zF=wm,BF=N1,FF=S1,VF=200;function UF(e,t){var n=this.__data__;if(n instanceof zF){var r=n.__data__;if(!BF||r.lengthl))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var f=-1,p=!0,h=n&dV?new oV:void 0;for(i.set(e,t),i.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=mU}var B1=xU,gU=Ra,vU=B1,yU=Da,bU="[object Arguments]",jU="[object Array]",wU="[object Boolean]",NU="[object Date]",SU="[object Error]",kU="[object Function]",CU="[object Map]",_U="[object Number]",AU="[object Object]",PU="[object RegExp]",EU="[object Set]",OU="[object String]",TU="[object WeakMap]",$U="[object ArrayBuffer]",MU="[object DataView]",RU="[object Float32Array]",DU="[object Float64Array]",IU="[object Int8Array]",LU="[object Int16Array]",zU="[object Int32Array]",BU="[object Uint8Array]",FU="[object Uint8ClampedArray]",VU="[object Uint16Array]",UU="[object Uint32Array]",Ye={};Ye[RU]=Ye[DU]=Ye[IU]=Ye[LU]=Ye[zU]=Ye[BU]=Ye[FU]=Ye[VU]=Ye[UU]=!0;Ye[bU]=Ye[jU]=Ye[$U]=Ye[wU]=Ye[MU]=Ye[NU]=Ye[SU]=Ye[kU]=Ye[CU]=Ye[_U]=Ye[AU]=Ye[PU]=Ye[EU]=Ye[OU]=Ye[TU]=!1;function WU(e){return yU(e)&&vU(e.length)&&!!Ye[gU(e)]}var qU=WU;function HU(e){return function(t){return e(t)}}var QE=HU,qp={exports:{}};qp.exports;(function(e,t){var n=aE,r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===r,o=i&&n.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(qp,qp.exports);var KU=qp.exports,GU=qU,XU=QE,wN=KU,NN=wN&&wN.isTypedArray,YU=NN?XU(NN):GU,JE=YU,QU=eU,JU=L1,ZU=En,eW=YE,tW=z1,nW=JE,rW=Object.prototype,aW=rW.hasOwnProperty;function sW(e,t){var n=ZU(e),r=!n&&JU(e),s=!n&&!r&&eW(e),i=!n&&!r&&!s&&nW(e),o=n||r||s||i,l=o?QU(e.length,String):[],c=l.length;for(var u in e)(t||aW.call(e,u))&&!(o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||tW(u,c)))&&l.push(u);return l}var iW=sW,oW=Object.prototype;function lW(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||oW;return e===n}var cW=lW;function uW(e,t){return function(n){return e(t(n))}}var ZE=uW,dW=ZE,fW=dW(Object.keys,Object),pW=fW,hW=cW,mW=pW,xW=Object.prototype,gW=xW.hasOwnProperty;function vW(e){if(!hW(e))return mW(e);var t=[];for(var n in Object(e))gW.call(e,n)&&n!="constructor"&&t.push(n);return t}var yW=vW,bW=j1,jW=B1;function wW(e){return e!=null&&jW(e.length)&&!bW(e)}var yd=wW,NW=iW,SW=yW,kW=yd;function CW(e){return kW(e)?NW(e):SW(e)}var zm=CW,_W=VV,AW=JV,PW=zm;function EW(e){return _W(e,PW,AW)}var OW=EW,SN=OW,TW=1,$W=Object.prototype,MW=$W.hasOwnProperty;function RW(e,t,n,r,s,i){var o=n&TW,l=SN(e),c=l.length,u=SN(t),d=u.length;if(c!=d&&!o)return!1;for(var f=c;f--;){var p=l[f];if(!(o?p in t:MW.call(t,p)))return!1}var h=i.get(e),m=i.get(t);if(h&&m)return h==t&&m==e;var v=!0;i.set(e,t),i.set(t,e);for(var x=o;++f-1}var $H=TH;function MH(e,t,n){for(var r=-1,s=e==null?0:e.length;++r=XH){var u=t?null:KH(e);if(u)return GH(u);o=!1,s=HH,c=new UH}else c=t?[]:l;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dK(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function fK(e){return e.value}function pK(e,t){if(O.isValidElement(e))return O.cloneElement(e,t);if(typeof e=="function")return O.createElement(e,t);t.ref;var n=uK(t,nK);return O.createElement(D1,n)}var BN=1,ms=function(e){function t(){var n;rK(this,t);for(var r=arguments.length,s=new Array(r),i=0;iBN||Math.abs(s.height-this.lastBoundingBox.height)>BN)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,r&&r(s)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?fa({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var s=this.props,i=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,u=s.chartWidth,d=s.chartHeight,f,p;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&i==="vertical"){var h=this.getBBoxSnapshot();f={left:((u||0)-h.width)/2}}else f=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var m=this.getBBoxSnapshot();p={top:((d||0)-m.height)/2}}else p=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return fa(fa({},f),p)}},{key:"render",value:function(){var r=this,s=this.props,i=s.content,o=s.width,l=s.height,c=s.wrapperStyle,u=s.payloadUniqBy,d=s.payload,f=fa(fa({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return O.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(h){r.wrapperNode=h}},pK(i,fa(fa({},this.props),{},{payload:iO(d,u,fK)})))}}],[{key:"getWithHeight",value:function(r,s){var i=fa(fa({},this.defaultProps),r.props),o=i.layout;return o==="vertical"&&ee(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||s}:null}}])}(b.PureComponent);Bm(ms,"displayName","Legend");Bm(ms,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var FN=vd,hK=L1,mK=En,VN=FN?FN.isConcatSpreadable:void 0;function xK(e){return mK(e)||hK(e)||!!(VN&&e&&e[VN])}var gK=xK,vK=GE,yK=gK;function cO(e,t,n,r,s){var i=-1,o=e.length;for(n||(n=yK),s||(s=[]);++i0&&n(l)?t>1?cO(l,t-1,n,r,s):vK(s,l):r||(s[s.length]=l)}return s}var uO=cO;function bK(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),l=o.length;l--;){var c=o[e?l:++s];if(n(i[c],c,i)===!1)break}return t}}var jK=bK,wK=jK,NK=wK(),SK=NK,kK=SK,CK=zm;function _K(e,t){return e&&kK(e,t,CK)}var dO=_K,AK=yd;function PK(e,t){return function(n,r){if(n==null)return n;if(!AK(n))return e(n,r);for(var s=n.length,i=t?s:-1,o=Object(n);(t?i--:++it||i&&o&&c&&!l&&!u||r&&o&&c||!n&&c||!s)return 1;if(!r&&!i&&!u&&e=l)return c;var u=n[r];return c*(u=="desc"?-1:1)}}return e.index-t.index}var UK=VK,o0=C1,WK=_1,qK=ua,HK=fO,KK=LK,GK=QE,XK=UK,YK=Fl,QK=En;function JK(e,t,n){t.length?t=o0(t,function(i){return QK(i)?function(o){return WK(o,i.length===1?i[0]:i)}:i}):t=[YK];var r=-1;t=o0(t,GK(qK));var s=HK(e,function(i,o,l){var c=o0(t,function(u){return u(i)});return{criteria:c,index:++r,value:i}});return KK(s,function(i,o){return XK(i,o,n)})}var ZK=JK;function eG(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var tG=eG,nG=tG,WN=Math.max;function rG(e,t,n){return t=WN(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=WN(r.length-t,0),o=Array(i);++s0){if(++t>=pG)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var gG=xG,vG=fG,yG=gG,bG=yG(vG),jG=bG,wG=Fl,NG=aG,SG=jG;function kG(e,t){return SG(NG(e,t,wG),e+"")}var CG=kG,_G=w1,AG=yd,PG=z1,EG=$s;function OG(e,t,n){if(!EG(n))return!1;var r=typeof t;return(r=="number"?AG(n)&&PG(t,n.length):r=="string"&&t in n)?_G(n[t],e):!1}var Fm=OG,TG=uO,$G=ZK,MG=CG,HN=Fm,RG=MG(function(e,t){if(e==null)return[];var n=t.length;return n>1&&HN(e,t[0],t[1])?t=[]:n>2&&HN(t[0],t[1],t[2])&&(t=[t[0]]),$G(e,TG(t,1),[])}),DG=RG;const U1=De(DG);function Cu(e){"@babel/helpers - typeof";return Cu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cu(e)}function _v(){return _v=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t.x),"".concat(uc,"-left"),ee(n)&&t&&ee(t.x)&&n=t.y),"".concat(uc,"-top"),ee(r)&&t&&ee(t.y)&&rv?Math.max(d,c[r]):Math.max(f,c[r])}function QG(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function JG(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,s=e.position,i=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return o.height>0&&o.width>0&&n?(d=XN({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=XN({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=QG({translateX:d,translateY:f,useTranslate3d:l})):u=XG,{cssProperties:u,cssClasses:YG({translateX:d,translateY:f,coordinate:n})}}function Zo(e){"@babel/helpers - typeof";return Zo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zo(e)}function YN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function QN(e){for(var t=1;tJN||Math.abs(r.height-this.state.lastBoundingBox.height)>JN)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.children,d=s.coordinate,f=s.hasPayload,p=s.isAnimationActive,h=s.offset,m=s.position,v=s.reverseDirection,x=s.useTranslate3d,y=s.viewBox,g=s.wrapperStyle,j=JG({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:h,position:m,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:y}),N=j.cssClasses,w=j.cssProperties,S=QN(QN({transition:p&&i?"transform ".concat(l,"ms ").concat(c):void 0},w),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&f?"visible":"hidden",position:"absolute",top:0,left:0},g);return O.createElement("div",{tabIndex:-1,className:N,style:S,ref:function(C){r.wrapperNode=C}},u)}}])}(b.PureComponent),lX=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Ms={isSsr:lX()};function el(e){"@babel/helpers - typeof";return el=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},el(e)}function ZN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function eS(e){for(var t=1;t0;return O.createElement(oX,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:p,active:i,coordinate:d,hasPayload:S,offset:h,position:x,reverseDirection:y,useTranslate3d:g,viewBox:j,wrapperStyle:N},vX(u,eS(eS({},this.props),{},{payload:w})))}}])}(b.PureComponent);W1(on,"displayName","Tooltip");W1(on,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Ms.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var yX=ca,bX=function(){return yX.Date.now()},jX=bX,wX=/\s/;function NX(e){for(var t=e.length;t--&&wX.test(e.charAt(t)););return t}var SX=NX,kX=SX,CX=/^\s+/;function _X(e){return e&&e.slice(0,kX(e)+1).replace(CX,"")}var AX=_X,PX=AX,tS=$s,EX=$l,nS=NaN,OX=/^[-+]0x[0-9a-f]+$/i,TX=/^0b[01]+$/i,$X=/^0o[0-7]+$/i,MX=parseInt;function RX(e){if(typeof e=="number")return e;if(EX(e))return nS;if(tS(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=tS(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=PX(e);var n=TX.test(e);return n||$X.test(e)?MX(e.slice(2),n?2:8):OX.test(e)?nS:+e}var vO=RX,DX=$s,c0=jX,rS=vO,IX="Expected a function",LX=Math.max,zX=Math.min;function BX(e,t,n){var r,s,i,o,l,c,u=0,d=!1,f=!1,p=!0;if(typeof e!="function")throw new TypeError(IX);t=rS(t)||0,DX(n)&&(d=!!n.leading,f="maxWait"in n,i=f?LX(rS(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(S){var k=r,C=s;return r=s=void 0,u=S,o=e.apply(C,k),o}function m(S){return u=S,l=setTimeout(y,t),d?h(S):o}function v(S){var k=S-c,C=S-u,_=t-k;return f?zX(_,i-C):_}function x(S){var k=S-c,C=S-u;return c===void 0||k>=t||k<0||f&&C>=i}function y(){var S=c0();if(x(S))return g(S);l=setTimeout(y,v(S))}function g(S){return l=void 0,p&&r?h(S):(r=s=void 0,o)}function j(){l!==void 0&&clearTimeout(l),u=0,r=c=s=l=void 0}function N(){return l===void 0?o:g(c0())}function w(){var S=c0(),k=x(S);if(r=arguments,s=this,c=S,k){if(l===void 0)return m(c);if(f)return clearTimeout(l),l=setTimeout(y,t),h(c)}return l===void 0&&(l=setTimeout(y,t)),o}return w.cancel=j,w.flush=N,w}var FX=BX,VX=FX,UX=$s,WX="Expected a function";function qX(e,t,n){var r=!0,s=!0;if(typeof e!="function")throw new TypeError(WX);return UX(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),VX(e,t,{leading:r,maxWait:t,trailing:s})}var HX=qX;const yO=De(HX);function Au(e){"@babel/helpers - typeof";return Au=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Au(e)}function aS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function of(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(D=yO(D,v,{trailing:!0,leading:!1}));var I=new ResizeObserver(D),R=w.current.getBoundingClientRect(),M=R.width,W=R.height;return E(M,W),I.observe(w.current),function(){I.disconnect()}},[E,v]);var P=b.useMemo(function(){var D=_.containerWidth,I=_.containerHeight;if(D<0||I<0)return null;Or(ii(o)||ii(c),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,o,c),Or(!n||n>0,"The aspect(%s) must be greater than zero.",n);var R=ii(o)?D:o,M=ii(c)?I:c;n&&n>0&&(R?M=R/n:M&&(R=M*n),p&&M>p&&(M=p)),Or(R>0||M>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,R,M,o,c,d,f,n);var W=!Array.isArray(h)&&Na(h.type).endsWith("Chart");return O.Children.map(h,function(T){return O.isValidElement(T)?b.cloneElement(T,of({width:R,height:M},W?{style:of({height:"100%",width:"100%",maxHeight:M,maxWidth:R},T.props.style)}:{})):T})},[n,h,c,p,f,d,_,o]);return O.createElement("div",{id:x?"".concat(x):void 0,className:Ne("recharts-responsive-container",y),style:of(of({},N),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:p}),ref:w},P)}),Vm=function(t){return null};Vm.displayName="Cell";function Pu(e){"@babel/helpers - typeof";return Pu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pu(e)}function iS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ov(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Ms.isSsr)return{width:0,height:0};var r=iY(n),s=JSON.stringify({text:t,copyStyle:r});if(Zi.widthCache[s])return Zi.widthCache[s];try{var i=document.getElementById(oS);i||(i=document.createElement("span"),i.setAttribute("id",oS),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=Ov(Ov({},sY),r);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return Zi.widthCache[s]=c,++Zi.cacheCount>aY&&(Zi.cacheCount=0,Zi.widthCache={}),c}catch{return{width:0,height:0}}},oY=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Eu(e){"@babel/helpers - typeof";return Eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eu(e)}function Xp(e,t){return dY(e)||uY(e,t)||cY(e,t)||lY()}function lY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cY(e,t){if(e){if(typeof e=="string")return lS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lS(e,t)}}function lS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kY(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hS(e,t){return PY(e)||AY(e,t)||_Y(e,t)||CY()}function CY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Y(e,t){if(e){if(typeof e=="string")return mS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mS(e,t)}}function mS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return R.reduce(function(M,W){var T=W.word,V=W.width,X=M[M.length-1];if(X&&(s==null||i||X.width+V+rW.width?M:W})};if(!d)return h;for(var v="…",x=function(R){var M=f.slice(0,R),W=NO({breakAll:u,style:c,children:M+v}).wordsWithComputedWidth,T=p(W),V=T.length>o||m(T).width>Number(s);return[V,T]},y=0,g=f.length-1,j=0,N;y<=g&&j<=f.length-1;){var w=Math.floor((y+g)/2),S=w-1,k=x(S),C=hS(k,2),_=C[0],A=C[1],E=x(w),P=hS(E,1),D=P[0];if(!_&&!D&&(y=w+1),_&&D&&(g=w-1),!_&&D){N=A;break}j++}return N||h},xS=function(t){var n=je(t)?[]:t.toString().split(wO);return[{words:n}]},OY=function(t){var n=t.width,r=t.scaleToFit,s=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((n||r)&&!Ms.isSsr){var c,u,d=NO({breakAll:o,children:s,style:i});if(d){var f=d.wordsWithComputedWidth,p=d.spaceWidth;c=f,u=p}else return xS(s);return EY({breakAll:o,children:s,maxLines:l,style:i},c,u,n,r)}return xS(s)},gS="#808080",Ti=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,i=s===void 0?0:s,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,p=t.textAnchor,h=p===void 0?"start":p,m=t.verticalAnchor,v=m===void 0?"end":m,x=t.fill,y=x===void 0?gS:x,g=pS(t,NY),j=b.useMemo(function(){return OY({breakAll:g.breakAll,children:g.children,maxLines:g.maxLines,scaleToFit:f,style:g.style,width:g.width})},[g.breakAll,g.children,g.maxLines,f,g.style,g.width]),N=g.dx,w=g.dy,S=g.angle,k=g.className,C=g.breakAll,_=pS(g,SY);if(!Et(r)||!Et(i))return null;var A=r+(ee(N)?N:0),E=i+(ee(w)?w:0),P;switch(v){case"start":P=u0("calc(".concat(u,")"));break;case"middle":P=u0("calc(".concat((j.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:P=u0("calc(".concat(j.length-1," * -").concat(l,")"));break}var D=[];if(f){var I=j[0].width,R=g.width;D.push("scale(".concat((ee(R)?R/I:1)/I,")"))}return S&&D.push("rotate(".concat(S,", ").concat(A,", ").concat(E,")")),D.length&&(_.transform=D.join(" ")),O.createElement("text",Tv({},me(_,!0),{x:A,y:E,className:Ne("recharts-text",k),textAnchor:h,fill:y.includes("url")?gS:y}),j.map(function(M,W){var T=M.words.join(C?"":" ");return O.createElement("tspan",{x:A,dy:W===0?P:l,key:"".concat(T,"-").concat(W)},T)}))};function xs(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function TY(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function q1(e){let t,n,r;e.length!==2?(t=xs,n=(l,c)=>xs(e(l),c),r=(l,c)=>e(l)-c):(t=e===xs||e===TY?e:$Y,n=e,r=e);function s(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:s,center:o,right:i}}function $Y(){return 0}function SO(e){return e===null?NaN:+e}function*MY(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const RY=q1(xs),bd=RY.right;q1(SO).center;class vS extends Map{constructor(t,n=LY){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,s]of t)this.set(r,s)}get(t){return super.get(yS(this,t))}has(t){return super.has(yS(this,t))}set(t,n){return super.set(DY(this,t),n)}delete(t){return super.delete(IY(this,t))}}function yS({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function DY({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function IY({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function LY(e){return e!==null&&typeof e=="object"?e.valueOf():e}function zY(e=xs){if(e===xs)return kO;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function kO(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const BY=Math.sqrt(50),FY=Math.sqrt(10),VY=Math.sqrt(2);function Yp(e,t,n){const r=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(r)),i=r/Math.pow(10,s),o=i>=BY?10:i>=FY?5:i>=VY?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,s)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=s))return[];const l=i-s+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function jS(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function CO(e,t,n=0,r=1/0,s){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(s=s===void 0?kO:zY(s);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),p=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(n,Math.floor(t-u*f/c+p)),m=Math.min(r,Math.floor(t+(c-u)*f/c+p));CO(e,t,h,m,s)}const i=e[t];let o=n,l=r;for(dc(e,n,t),s(e[r],i)>0&&dc(e,n,r);o0;)--l}s(e[n],i)===0?dc(e,n,l):(++l,dc(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function dc(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function UY(e,t,n){if(e=Float64Array.from(MY(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return jS(e);if(t>=1)return bS(e);var r,s=(r-1)*t,i=Math.floor(s),o=bS(CO(e,i).subarray(0,i+1)),l=jS(e.subarray(i+1));return o+(l-o)*(s-i)}}function WY(e,t,n=SO){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,s=(r-1)*t,i=Math.floor(s),o=+n(e[i],i,e),l=+n(e[i+1],i+1,e);return o+(l-o)*(s-i)}}function qY(e,t,n){e=+e,t=+t,n=(s=arguments.length)<2?(t=e,e=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(s);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?cf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?cf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=KY.exec(e))?new Sn(t[1],t[2],t[3],1):(t=GY.exec(e))?new Sn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=XY.exec(e))?cf(t[1],t[2],t[3],t[4]):(t=YY.exec(e))?cf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=QY.exec(e))?AS(t[1],t[2]/100,t[3]/100,1):(t=JY.exec(e))?AS(t[1],t[2]/100,t[3]/100,t[4]):wS.hasOwnProperty(e)?kS(wS[e]):e==="transparent"?new Sn(NaN,NaN,NaN,0):null}function kS(e){return new Sn(e>>16&255,e>>8&255,e&255,1)}function cf(e,t,n,r){return r<=0&&(e=t=n=NaN),new Sn(e,t,n,r)}function tQ(e){return e instanceof jd||(e=Mu(e)),e?(e=e.rgb(),new Sn(e.r,e.g,e.b,e.opacity)):new Sn}function Iv(e,t,n,r){return arguments.length===1?tQ(e):new Sn(e,t,n,r??1)}function Sn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}K1(Sn,Iv,AO(jd,{brighter(e){return e=e==null?Qp:Math.pow(Qp,e),new Sn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Tu:Math.pow(Tu,e),new Sn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Sn(gi(this.r),gi(this.g),gi(this.b),Jp(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:CS,formatHex:CS,formatHex8:nQ,formatRgb:_S,toString:_S}));function CS(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}`}function nQ(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}${oi((isNaN(this.opacity)?1:this.opacity)*255)}`}function _S(){const e=Jp(this.opacity);return`${e===1?"rgb(":"rgba("}${gi(this.r)}, ${gi(this.g)}, ${gi(this.b)}${e===1?")":`, ${e})`}`}function Jp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function oi(e){return e=gi(e),(e<16?"0":"")+e.toString(16)}function AS(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new kr(e,t,n,r)}function PO(e){if(e instanceof kr)return new kr(e.h,e.s,e.l,e.opacity);if(e instanceof jd||(e=Mu(e)),!e)return new kr;if(e instanceof kr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(n-r)/l+(n0&&c<1?0:o,new kr(o,l,c,e.opacity)}function rQ(e,t,n,r){return arguments.length===1?PO(e):new kr(e,t,n,r??1)}function kr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}K1(kr,rQ,AO(jd,{brighter(e){return e=e==null?Qp:Math.pow(Qp,e),new kr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Tu:Math.pow(Tu,e),new kr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new Sn(d0(e>=240?e-240:e+120,s,r),d0(e,s,r),d0(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new kr(PS(this.h),uf(this.s),uf(this.l),Jp(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Jp(this.opacity);return`${e===1?"hsl(":"hsla("}${PS(this.h)}, ${uf(this.s)*100}%, ${uf(this.l)*100}%${e===1?")":`, ${e})`}`}}));function PS(e){return e=(e||0)%360,e<0?e+360:e}function uf(e){return Math.max(0,Math.min(1,e||0))}function d0(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const G1=e=>()=>e;function aQ(e,t){return function(n){return e+n*t}}function sQ(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function iQ(e){return(e=+e)==1?EO:function(t,n){return n-t?sQ(t,n,e):G1(isNaN(t)?n:t)}}function EO(e,t){var n=t-e;return n?aQ(e,n):G1(isNaN(e)?t:e)}const ES=function e(t){var n=iQ(t);function r(s,i){var o=n((s=Iv(s)).r,(i=Iv(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=EO(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function oQ(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;sn&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:Zp(r,s)})),n=f0.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function vQ(e,t,n){var r=e[0],s=e[1],i=t[0],o=t[1];return s2?yQ:vQ,c=u=null,f}function f(p){return p==null||isNaN(p=+p)?i:(c||(c=l(e.map(r),t,n)))(r(o(p)))}return f.invert=function(p){return o(s((u||(u=l(t,e.map(r),Zp)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,eh),d()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),d()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),n=X1,d()},f.clamp=function(p){return arguments.length?(o=p?!0:un,d()):o!==un},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(i=p,f):i},function(p,h){return r=p,s=h,d()}}function Y1(){return Um()(un,un)}function bQ(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function th(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function tl(e){return e=th(Math.abs(e)),e?e[1]:NaN}function jQ(e,t){return function(n,r){for(var s=n.length,i=[],o=0,l=e[0],c=0;s>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),i.push(n.substring(s-=l,s+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function wQ(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var NQ=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ru(e){if(!(t=NQ.exec(e)))throw new Error("invalid format: "+e);var t;return new Q1({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Ru.prototype=Q1.prototype;function Q1(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Q1.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function SQ(e){e:for(var t=e.length,n=1,r=-1,s;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(s+1):e}var nh;function kQ(e,t){var n=th(e,t);if(!n)return nh=void 0,e.toPrecision(t);var r=n[0],s=n[1],i=s-(nh=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+th(e,Math.max(0,t+i-1))[0]}function TS(e,t){var n=th(e,t);if(!n)return e+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const $S={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:bQ,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>TS(e*100,t),r:TS,s:kQ,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function MS(e){return e}var RS=Array.prototype.map,DS=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function CQ(e){var t=e.grouping===void 0||e.thousands===void 0?MS:jQ(RS.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?MS:wQ(RS.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,p){f=Ru(f);var h=f.fill,m=f.align,v=f.sign,x=f.symbol,y=f.zero,g=f.width,j=f.comma,N=f.precision,w=f.trim,S=f.type;S==="n"?(j=!0,S="g"):$S[S]||(N===void 0&&(N=12),w=!0,S="g"),(y||h==="0"&&m==="=")&&(y=!0,h="0",m="=");var k=(p&&p.prefix!==void 0?p.prefix:"")+(x==="$"?n:x==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),C=(x==="$"?r:/[%p]/.test(S)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),_=$S[S],A=/[defgprs%]/.test(S);N=N===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,N)):Math.max(0,Math.min(20,N));function E(P){var D=k,I=C,R,M,W;if(S==="c")I=_(P)+I,P="";else{P=+P;var T=P<0||1/P<0;if(P=isNaN(P)?c:_(Math.abs(P),N),w&&(P=SQ(P)),T&&+P==0&&v!=="+"&&(T=!1),D=(T?v==="("?v:l:v==="-"||v==="("?"":v)+D,I=(S==="s"&&!isNaN(P)&&nh!==void 0?DS[8+nh/3]:"")+I+(T&&v==="("?")":""),A){for(R=-1,M=P.length;++RW||W>57){I=(W===46?s+P.slice(R+1):P.slice(R))+I,P=P.slice(0,R);break}}}j&&!y&&(P=t(P,1/0));var V=D.length+P.length+I.length,X=V>1)+D+P+I+X.slice(V);break;default:P=X+D+P+I;break}return i(P)}return E.toString=function(){return f+""},E}function d(f,p){var h=Math.max(-8,Math.min(8,Math.floor(tl(p)/3)))*3,m=Math.pow(10,-h),v=u((f=Ru(f),f.type="f",f),{suffix:DS[8+h/3]});return function(x){return v(m*x)}}return{format:u,formatPrefix:d}}var df,J1,OO;_Q({thousands:",",grouping:[3],currency:["$",""]});function _Q(e){return df=CQ(e),J1=df.format,OO=df.formatPrefix,df}function AQ(e){return Math.max(0,-tl(Math.abs(e)))}function PQ(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(tl(t)/3)))*3-tl(Math.abs(e)))}function EQ(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,tl(t)-tl(e))+1}function TO(e,t,n,r){var s=Rv(e,t,n),i;switch(r=Ru(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(i=PQ(s,o))&&(r.precision=i),OO(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=EQ(s,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=AQ(s))&&(r.precision=i-(r.type==="%")*2);break}}return J1(r)}function Rs(e){var t=e.domain;return e.ticks=function(n){var r=t();return $v(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var s=t();return TO(s[0],s[s.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),s=0,i=r.length-1,o=r[s],l=r[i],c,u,d=10;for(l0;){if(u=Mv(o,l,n),u===c)return r[s]=o,r[i]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function rh(){var e=Y1();return e.copy=function(){return wd(e,rh())},pr.apply(e,arguments),Rs(e)}function $O(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,eh),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return $O(e).unknown(t)},e=arguments.length?Array.from(e,eh):[0,1],Rs(n)}function MO(e,t){e=e.slice();var n=0,r=e.length-1,s=e[n],i=e[r],o;return iMath.pow(e,t)}function RQ(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function zS(e){return(t,n)=>-e(-t,n)}function Z1(e){const t=e(IS,LS),n=t.domain;let r=10,s,i;function o(){return s=RQ(r),i=MQ(r),n()[0]<0?(s=zS(s),i=zS(i),e(OQ,TQ)):e(IS,LS),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;p<=h;++p)for(m=1;md)break;y.push(v)}}else for(;p<=h;++p)for(m=r-1;m>=1;--m)if(v=p>0?m/i(-p):m*i(p),!(vd)break;y.push(v)}y.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Ru(c)).precision==null&&(c.trim=!0),c=J1(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/i(Math.round(s(d)));return f*rn(MO(n(),{floor:l=>i(Math.floor(s(l))),ceil:l=>i(Math.ceil(s(l)))})),t}function RO(){const e=Z1(Um()).domain([1,10]);return e.copy=()=>wd(e,RO()).base(e.base()),pr.apply(e,arguments),e}function BS(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function FS(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function ej(e){var t=1,n=e(BS(t),FS(t));return n.constant=function(r){return arguments.length?e(BS(t=+r),FS(t)):t},Rs(n)}function DO(){var e=ej(Um());return e.copy=function(){return wd(e,DO()).constant(e.constant())},pr.apply(e,arguments)}function VS(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function DQ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function IQ(e){return e<0?-e*e:e*e}function tj(e){var t=e(un,un),n=1;function r(){return n===1?e(un,un):n===.5?e(DQ,IQ):e(VS(n),VS(1/n))}return t.exponent=function(s){return arguments.length?(n=+s,r()):n},Rs(t)}function nj(){var e=tj(Um());return e.copy=function(){return wd(e,nj()).exponent(e.exponent())},pr.apply(e,arguments),e}function LQ(){return nj.apply(null,arguments).exponent(.5)}function US(e){return Math.sign(e)*e*e}function zQ(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function IO(){var e=Y1(),t=[0,1],n=!1,r;function s(i){var o=zQ(e(i));return isNaN(o)?r:n?Math.round(o):o}return s.invert=function(i){return e.invert(US(i))},s.domain=function(i){return arguments.length?(e.domain(i),s):e.domain()},s.range=function(i){return arguments.length?(e.range((t=Array.from(i,eh)).map(US)),s):t.slice()},s.rangeRound=function(i){return s.range(i).round(!0)},s.round=function(i){return arguments.length?(n=!!i,s):n},s.clamp=function(i){return arguments.length?(e.clamp(i),s):e.clamp()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return IO(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},pr.apply(s,arguments),Rs(s)}function LO(){var e=[],t=[],n=[],r;function s(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return zO().domain([e,t]).range(s).unknown(i)},pr.apply(Rs(o),arguments)}function BO(){var e=[.5],t=[0,1],n,r=1;function s(i){return i!=null&&i<=i?t[bd(e,i,0,r)]:n}return s.domain=function(i){return arguments.length?(e=Array.from(i),r=Math.min(e.length,t.length-1),s):e.slice()},s.range=function(i){return arguments.length?(t=Array.from(i),r=Math.min(e.length,t.length-1),s):t.slice()},s.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return BO().domain(e).range(t).unknown(n)},pr.apply(s,arguments)}const p0=new Date,h0=new Date;function Ot(e,t,n,r){function s(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(e(i=new Date(+i)),i),s.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),s.round=i=>{const o=s(i),l=s.ceil(i);return i-o(t(i=new Date(+i),o==null?1:Math.floor(o)),i),s.range=(i,o,l)=>{const c=[];if(i=s.ceil(i),l=l==null?1:Math.floor(l),!(i0))return c;let u;do c.push(u=new Date(+i)),t(i,l),e(i);while(uOt(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!i(o););else for(;--l>=0;)for(;t(o,1),!i(o););}),n&&(s.count=(i,o)=>(p0.setTime(+i),h0.setTime(+o),e(p0),e(h0),Math.floor(n(p0,h0))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(r?o=>r(o)%i===0:o=>s.count(0,o)%i===0):s)),s}const ah=Ot(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ah.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Ot(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):ah);ah.range;const va=1e3,ar=va*60,ya=ar*60,Ea=ya*24,rj=Ea*7,WS=Ea*30,m0=Ea*365,li=Ot(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*va)},(e,t)=>(t-e)/va,e=>e.getUTCSeconds());li.range;const aj=Ot(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*va)},(e,t)=>{e.setTime(+e+t*ar)},(e,t)=>(t-e)/ar,e=>e.getMinutes());aj.range;const sj=Ot(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*ar)},(e,t)=>(t-e)/ar,e=>e.getUTCMinutes());sj.range;const ij=Ot(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*va-e.getMinutes()*ar)},(e,t)=>{e.setTime(+e+t*ya)},(e,t)=>(t-e)/ya,e=>e.getHours());ij.range;const oj=Ot(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ya)},(e,t)=>(t-e)/ya,e=>e.getUTCHours());oj.range;const Nd=Ot(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*ar)/Ea,e=>e.getDate()-1);Nd.range;const Wm=Ot(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ea,e=>e.getUTCDate()-1);Wm.range;const FO=Ot(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ea,e=>Math.floor(e/Ea));FO.range;function Ki(e){return Ot(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ar)/rj)}const qm=Ki(0),sh=Ki(1),BQ=Ki(2),FQ=Ki(3),nl=Ki(4),VQ=Ki(5),UQ=Ki(6);qm.range;sh.range;BQ.range;FQ.range;nl.range;VQ.range;UQ.range;function Gi(e){return Ot(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/rj)}const Hm=Gi(0),ih=Gi(1),WQ=Gi(2),qQ=Gi(3),rl=Gi(4),HQ=Gi(5),KQ=Gi(6);Hm.range;ih.range;WQ.range;qQ.range;rl.range;HQ.range;KQ.range;const lj=Ot(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());lj.range;const cj=Ot(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());cj.range;const Oa=Ot(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Oa.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ot(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Oa.range;const Ta=Ot(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Ta.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ot(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Ta.range;function VO(e,t,n,r,s,i){const o=[[li,1,va],[li,5,5*va],[li,15,15*va],[li,30,30*va],[i,1,ar],[i,5,5*ar],[i,15,15*ar],[i,30,30*ar],[s,1,ya],[s,3,3*ya],[s,6,6*ya],[s,12,12*ya],[r,1,Ea],[r,2,2*Ea],[n,1,rj],[t,1,WS],[t,3,3*WS],[e,1,m0]];function l(u,d,f){const p=dx).right(o,p);if(h===o.length)return e.every(Rv(u/m0,d/m0,f));if(h===0)return ah.every(Math.max(Rv(u,d,f),1));const[m,v]=o[p/o[h-1][2]53)return null;"w"in q||(q.w=1),"Z"in q?(oe=g0(fc(q.y,0,1)),we=oe.getUTCDay(),oe=we>4||we===0?ih.ceil(oe):ih(oe),oe=Wm.offset(oe,(q.V-1)*7),q.y=oe.getUTCFullYear(),q.m=oe.getUTCMonth(),q.d=oe.getUTCDate()+(q.w+6)%7):(oe=x0(fc(q.y,0,1)),we=oe.getDay(),oe=we>4||we===0?sh.ceil(oe):sh(oe),oe=Nd.offset(oe,(q.V-1)*7),q.y=oe.getFullYear(),q.m=oe.getMonth(),q.d=oe.getDate()+(q.w+6)%7)}else("W"in q||"U"in q)&&("w"in q||(q.w="u"in q?q.u%7:"W"in q?1:0),we="Z"in q?g0(fc(q.y,0,1)).getUTCDay():x0(fc(q.y,0,1)).getDay(),q.m=0,q.d="W"in q?(q.w+6)%7+q.W*7-(we+5)%7:q.w+q.U*7-(we+6)%7);return"Z"in q?(q.H+=q.Z/100|0,q.M+=q.Z%100,g0(q)):x0(q)}}function C(Z,F,z,q){for(var ie=0,oe=F.length,we=z.length,Ee,ze;ie=we)return-1;if(Ee=F.charCodeAt(ie++),Ee===37){if(Ee=F.charAt(ie++),ze=w[Ee in qS?F.charAt(ie++):Ee],!ze||(q=ze(Z,z,q))<0)return-1}else if(Ee!=z.charCodeAt(q++))return-1}return q}function _(Z,F,z){var q=u.exec(F.slice(z));return q?(Z.p=d.get(q[0].toLowerCase()),z+q[0].length):-1}function A(Z,F,z){var q=h.exec(F.slice(z));return q?(Z.w=m.get(q[0].toLowerCase()),z+q[0].length):-1}function E(Z,F,z){var q=f.exec(F.slice(z));return q?(Z.w=p.get(q[0].toLowerCase()),z+q[0].length):-1}function P(Z,F,z){var q=y.exec(F.slice(z));return q?(Z.m=g.get(q[0].toLowerCase()),z+q[0].length):-1}function D(Z,F,z){var q=v.exec(F.slice(z));return q?(Z.m=x.get(q[0].toLowerCase()),z+q[0].length):-1}function I(Z,F,z){return C(Z,t,F,z)}function R(Z,F,z){return C(Z,n,F,z)}function M(Z,F,z){return C(Z,r,F,z)}function W(Z){return o[Z.getDay()]}function T(Z){return i[Z.getDay()]}function V(Z){return c[Z.getMonth()]}function X(Z){return l[Z.getMonth()]}function U(Z){return s[+(Z.getHours()>=12)]}function L(Z){return 1+~~(Z.getMonth()/3)}function B(Z){return o[Z.getUTCDay()]}function ae(Z){return i[Z.getUTCDay()]}function se(Z){return c[Z.getUTCMonth()]}function xe(Z){return l[Z.getUTCMonth()]}function H(Z){return s[+(Z.getUTCHours()>=12)]}function le(Z){return 1+~~(Z.getUTCMonth()/3)}return{format:function(Z){var F=S(Z+="",j);return F.toString=function(){return Z},F},parse:function(Z){var F=k(Z+="",!1);return F.toString=function(){return Z},F},utcFormat:function(Z){var F=S(Z+="",N);return F.toString=function(){return Z},F},utcParse:function(Z){var F=k(Z+="",!0);return F.toString=function(){return Z},F}}}var qS={"-":"",_:" ",0:"0"},zt=/^\s*\d+/,ZQ=/^%/,eJ=/[\\^$*+?|[\]().{}]/g;function Me(e,t,n){var r=e<0?"-":"",s=(r?-e:e)+"",i=s.length;return r+(i[t.toLowerCase(),n]))}function nJ(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function rJ(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function aJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function sJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function iJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function HS(e,t,n){var r=zt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function KS(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function oJ(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function lJ(e,t,n){var r=zt.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function cJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function GS(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function uJ(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function XS(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function dJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function fJ(e,t,n){var r=zt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function pJ(e,t,n){var r=zt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function hJ(e,t,n){var r=zt.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function mJ(e,t,n){var r=ZQ.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function xJ(e,t,n){var r=zt.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function gJ(e,t,n){var r=zt.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function YS(e,t){return Me(e.getDate(),t,2)}function vJ(e,t){return Me(e.getHours(),t,2)}function yJ(e,t){return Me(e.getHours()%12||12,t,2)}function bJ(e,t){return Me(1+Nd.count(Oa(e),e),t,3)}function UO(e,t){return Me(e.getMilliseconds(),t,3)}function jJ(e,t){return UO(e,t)+"000"}function wJ(e,t){return Me(e.getMonth()+1,t,2)}function NJ(e,t){return Me(e.getMinutes(),t,2)}function SJ(e,t){return Me(e.getSeconds(),t,2)}function kJ(e){var t=e.getDay();return t===0?7:t}function CJ(e,t){return Me(qm.count(Oa(e)-1,e),t,2)}function WO(e){var t=e.getDay();return t>=4||t===0?nl(e):nl.ceil(e)}function _J(e,t){return e=WO(e),Me(nl.count(Oa(e),e)+(Oa(e).getDay()===4),t,2)}function AJ(e){return e.getDay()}function PJ(e,t){return Me(sh.count(Oa(e)-1,e),t,2)}function EJ(e,t){return Me(e.getFullYear()%100,t,2)}function OJ(e,t){return e=WO(e),Me(e.getFullYear()%100,t,2)}function TJ(e,t){return Me(e.getFullYear()%1e4,t,4)}function $J(e,t){var n=e.getDay();return e=n>=4||n===0?nl(e):nl.ceil(e),Me(e.getFullYear()%1e4,t,4)}function MJ(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Me(t/60|0,"0",2)+Me(t%60,"0",2)}function QS(e,t){return Me(e.getUTCDate(),t,2)}function RJ(e,t){return Me(e.getUTCHours(),t,2)}function DJ(e,t){return Me(e.getUTCHours()%12||12,t,2)}function IJ(e,t){return Me(1+Wm.count(Ta(e),e),t,3)}function qO(e,t){return Me(e.getUTCMilliseconds(),t,3)}function LJ(e,t){return qO(e,t)+"000"}function zJ(e,t){return Me(e.getUTCMonth()+1,t,2)}function BJ(e,t){return Me(e.getUTCMinutes(),t,2)}function FJ(e,t){return Me(e.getUTCSeconds(),t,2)}function VJ(e){var t=e.getUTCDay();return t===0?7:t}function UJ(e,t){return Me(Hm.count(Ta(e)-1,e),t,2)}function HO(e){var t=e.getUTCDay();return t>=4||t===0?rl(e):rl.ceil(e)}function WJ(e,t){return e=HO(e),Me(rl.count(Ta(e),e)+(Ta(e).getUTCDay()===4),t,2)}function qJ(e){return e.getUTCDay()}function HJ(e,t){return Me(ih.count(Ta(e)-1,e),t,2)}function KJ(e,t){return Me(e.getUTCFullYear()%100,t,2)}function GJ(e,t){return e=HO(e),Me(e.getUTCFullYear()%100,t,2)}function XJ(e,t){return Me(e.getUTCFullYear()%1e4,t,4)}function YJ(e,t){var n=e.getUTCDay();return e=n>=4||n===0?rl(e):rl.ceil(e),Me(e.getUTCFullYear()%1e4,t,4)}function QJ(){return"+0000"}function JS(){return"%"}function ZS(e){return+e}function ek(e){return Math.floor(+e/1e3)}var eo,KO,GO;JJ({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function JJ(e){return eo=JQ(e),KO=eo.format,eo.parse,GO=eo.utcFormat,eo.utcParse,eo}function ZJ(e){return new Date(e)}function eZ(e){return e instanceof Date?+e:+new Date(+e)}function uj(e,t,n,r,s,i,o,l,c,u){var d=Y1(),f=d.invert,p=d.domain,h=u(".%L"),m=u(":%S"),v=u("%I:%M"),x=u("%I %p"),y=u("%a %d"),g=u("%b %d"),j=u("%B"),N=u("%Y");function w(S){return(c(S)t(s/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,i)=>UY(e,i/r))},n.copy=function(){return JO(t).domain(e)},Ia.apply(n,arguments)}function Gm(){var e=0,t=.5,n=1,r=1,s,i,o,l,c,u=un,d,f=!1,p;function h(v){return isNaN(v=+v)?p:(v=.5+((v=+d(v))-i)*(r*vt}var n3=oZ,lZ=Xm,cZ=n3,uZ=Fl;function dZ(e){return e&&e.length?lZ(e,uZ,cZ):void 0}var fZ=dZ;const rs=De(fZ);function pZ(e,t){return ee.e^i.s<0?1:-1;for(r=i.d.length,s=e.d.length,t=0,n=re.d[t]^i.s<0?1:-1;return r===s?0:r>s^i.s<0?1:-1};fe.decimalPlaces=fe.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*Qe;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};fe.dividedBy=fe.div=function(e){return Sa(this,new this.constructor(e))};fe.dividedToIntegerBy=fe.idiv=function(e){var t=this,n=t.constructor;return Ve(Sa(t,new n(e),0,1),n.precision)};fe.equals=fe.eq=function(e){return!this.cmp(e)};fe.exponent=function(){return Nt(this)};fe.greaterThan=fe.gt=function(e){return this.cmp(e)>0};fe.greaterThanOrEqualTo=fe.gte=function(e){return this.cmp(e)>=0};fe.isInteger=fe.isint=function(){return this.e>this.d.length-2};fe.isNegative=fe.isneg=function(){return this.s<0};fe.isPositive=fe.ispos=function(){return this.s>0};fe.isZero=function(){return this.s===0};fe.lessThan=fe.lt=function(e){return this.cmp(e)<0};fe.lessThanOrEqualTo=fe.lte=function(e){return this.cmp(e)<1};fe.logarithm=fe.log=function(e){var t,n=this,r=n.constructor,s=r.precision,i=s+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Rn))throw Error(dr+"NaN");if(n.s<1)throw Error(dr+(n.s?"NaN":"-Infinity"));return n.eq(Rn)?new r(0):(rt=!1,t=Sa(Du(n,i),Du(e,i),i),rt=!0,Ve(t,s))};fe.minus=fe.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?o3(t,e):s3(t,(e.s=-e.s,e))};fe.modulo=fe.mod=function(e){var t,n=this,r=n.constructor,s=r.precision;if(e=new r(e),!e.s)throw Error(dr+"NaN");return n.s?(rt=!1,t=Sa(n,e,0,1).times(e),rt=!0,n.minus(t)):Ve(new r(n),s)};fe.naturalExponential=fe.exp=function(){return i3(this)};fe.naturalLogarithm=fe.ln=function(){return Du(this)};fe.negated=fe.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};fe.plus=fe.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?s3(t,e):o3(t,(e.s=-e.s,e))};fe.precision=fe.sd=function(e){var t,n,r,s=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(vi+e);if(t=Nt(s)+1,r=s.d.length-1,n=r*Qe+1,r=s.d[r],r){for(;r%10==0;r/=10)n--;for(r=s.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};fe.squareRoot=fe.sqrt=function(){var e,t,n,r,s,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(dr+"NaN")}for(e=Nt(l),rt=!1,s=Math.sqrt(+l),s==0||s==1/0?(t=Kr(l.d),(t.length+e)%2==0&&(t+="0"),s=Math.sqrt(t),e=Wl((e+1)/2)-(e<0||e%2),s==1/0?t="5e"+e:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(s.toString()),n=c.precision,s=o=n+3;;)if(i=r,r=i.plus(Sa(l,i,o+2)).times(.5),Kr(i.d).slice(0,o)===(t=Kr(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),s==o&&t=="4999"){if(Ve(i,n+1,0),i.times(i).eq(l)){r=i;break}}else if(t!="9999")break;o+=4}return rt=!0,Ve(r,n)};fe.times=fe.mul=function(e){var t,n,r,s,i,o,l,c,u,d=this,f=d.constructor,p=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=p.length,u=h.length,c=0;){for(t=0,s=c+r;s>r;)l=i[s]+h[r]*p[s-r-1]+t,i[s--]=l%Rt|0,t=l/Rt|0;i[s]=(i[s]+t)%Rt|0}for(;!i[--o];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,rt?Ve(e,f.precision):e};fe.toDecimalPlaces=fe.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(sa(e,0,Ul),t===void 0?t=r.rounding:sa(t,0,8),Ve(n,e+Nt(n)+1,t))};fe.toExponential=function(e,t){var n,r=this,s=r.constructor;return e===void 0?n=Mi(r,!0):(sa(e,0,Ul),t===void 0?t=s.rounding:sa(t,0,8),r=Ve(new s(r),e+1,t),n=Mi(r,!0,e+1)),n};fe.toFixed=function(e,t){var n,r,s=this,i=s.constructor;return e===void 0?Mi(s):(sa(e,0,Ul),t===void 0?t=i.rounding:sa(t,0,8),r=Ve(new i(s),e+Nt(s)+1,t),n=Mi(r.abs(),!1,e+Nt(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};fe.toInteger=fe.toint=function(){var e=this,t=e.constructor;return Ve(new t(e),Nt(e)+1,t.rounding)};fe.toNumber=function(){return+this};fe.toPower=fe.pow=function(e){var t,n,r,s,i,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(Rn);if(l=new c(l),!l.s){if(e.s<1)throw Error(dr+"Infinity");return l}if(l.eq(Rn))return l;if(r=c.precision,e.eq(Rn))return Ve(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,i=l.s,o){if((n=d<0?-d:d)<=a3){for(s=new c(Rn),t=Math.ceil(r/Qe+4),rt=!1;n%2&&(s=s.times(l),rk(s.d,t)),n=Wl(n/2),n!==0;)l=l.times(l),rk(l.d,t);return rt=!0,e.s<0?new c(Rn).div(s):Ve(s,r)}}else if(i<0)throw Error(dr+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,rt=!1,s=e.times(Du(l,r+u)),rt=!0,s=i3(s),s.s=i,s};fe.toPrecision=function(e,t){var n,r,s=this,i=s.constructor;return e===void 0?(n=Nt(s),r=Mi(s,n<=i.toExpNeg||n>=i.toExpPos)):(sa(e,1,Ul),t===void 0?t=i.rounding:sa(t,0,8),s=Ve(new i(s),e,t),n=Nt(s),r=Mi(s,e<=n||n<=i.toExpNeg,e)),r};fe.toSignificantDigits=fe.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(sa(e,1,Ul),t===void 0?t=r.rounding:sa(t,0,8)),Ve(new r(n),e,t)};fe.toString=fe.valueOf=fe.val=fe.toJSON=fe[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Nt(e),n=e.constructor;return Mi(e,t<=n.toExpNeg||t>=n.toExpPos)};function s3(e,t){var n,r,s,i,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),rt?Ve(t,f):t;if(c=e.d,u=t.d,o=e.e,s=t.e,c=c.slice(),i=o-s,i){for(i<0?(r=c,i=-i,l=u.length):(r=u,s=o,l=c.length),o=Math.ceil(f/Qe),l=o>l?o+1:l+1,i>l&&(i=l,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(l=c.length,i=u.length,l-i<0&&(i=l,r=u,u=c,c=r),n=0;i;)n=(c[--i]=c[i]+u[i]+n)/Rt|0,c[i]%=Rt;for(n&&(c.unshift(n),++s),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=s,rt?Ve(t,f):t}function sa(e,t,n){if(e!==~~e||en)throw Error(vi+e)}function Kr(e){var t,n,r,s=e.length-1,i="",o=e[0];if(s>0){for(i+=o,t=1;to?1:-1;else for(l=c=0;ls[l]?1:-1;break}return c}function n(r,s,i){for(var o=0;i--;)r[i]-=o,o=r[i]1;)r.shift()}return function(r,s,i,o){var l,c,u,d,f,p,h,m,v,x,y,g,j,N,w,S,k,C,_=r.constructor,A=r.s==s.s?1:-1,E=r.d,P=s.d;if(!r.s)return new _(r);if(!s.s)throw Error(dr+"Division by zero");for(c=r.e-s.e,k=P.length,w=E.length,h=new _(A),m=h.d=[],u=0;P[u]==(E[u]||0);)++u;if(P[u]>(E[u]||0)&&--c,i==null?g=i=_.precision:o?g=i+(Nt(r)-Nt(s))+1:g=i,g<0)return new _(0);if(g=g/Qe+2|0,u=0,k==1)for(d=0,P=P[0],g++;(u1&&(P=e(P,d),E=e(E,d),k=P.length,w=E.length),N=k,v=E.slice(0,k),x=v.length;x=Rt/2&&++S;do d=0,l=t(P,v,k,x),l<0?(y=v[0],k!=x&&(y=y*Rt+(v[1]||0)),d=y/S|0,d>1?(d>=Rt&&(d=Rt-1),f=e(P,d),p=f.length,x=v.length,l=t(f,v,p,x),l==1&&(d--,n(f,k16)throw Error(pj+Nt(e));if(!e.s)return new d(Rn);for(rt=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Qs(2,u))/Math.LN10*2+5|0,l+=r,n=s=i=new d(Rn),d.precision=l;;){if(s=Ve(s.times(e),l),n=n.times(++c),o=i.plus(Sa(s,n,l)),Kr(o.d).slice(0,l)===Kr(i.d).slice(0,l)){for(;u--;)i=Ve(i.times(i),l);return d.precision=f,t==null?(rt=!0,Ve(i,f)):i}i=o}}function Nt(e){for(var t=e.e*Qe,n=e.d[0];n>=10;n/=10)t++;return t}function v0(e,t,n){if(t>e.LN10.sd())throw rt=!0,n&&(e.precision=n),Error(dr+"LN10 precision limit exceeded");return Ve(new e(e.LN10),t)}function Ga(e){for(var t="";e--;)t+="0";return t}function Du(e,t){var n,r,s,i,o,l,c,u,d,f=1,p=10,h=e,m=h.d,v=h.constructor,x=v.precision;if(h.s<1)throw Error(dr+(h.s?"NaN":"-Infinity"));if(h.eq(Rn))return new v(0);if(t==null?(rt=!1,u=x):u=t,h.eq(10))return t==null&&(rt=!0),v0(v,u);if(u+=p,v.precision=u,n=Kr(m),r=n.charAt(0),i=Nt(h),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)h=h.times(e),n=Kr(h.d),r=n.charAt(0),f++;i=Nt(h),r>1?(h=new v("0."+n),i++):h=new v(r+"."+n.slice(1))}else return c=v0(v,u+2,x).times(i+""),h=Du(new v(r+"."+n.slice(1)),u-p).plus(c),v.precision=x,t==null?(rt=!0,Ve(h,x)):h;for(l=o=h=Sa(h.minus(Rn),h.plus(Rn),u),d=Ve(h.times(h),u),s=3;;){if(o=Ve(o.times(d),u),c=l.plus(Sa(o,new v(s),u)),Kr(c.d).slice(0,u)===Kr(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(v0(v,u+2,x).times(i+""))),l=Sa(l,new v(f),u),v.precision=x,t==null?(rt=!0,Ve(l,x)):l;l=c,s+=2}}function nk(e,t){var n,r,s;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(s=t.length;t.charCodeAt(s-1)===48;)--s;if(t=t.slice(r,s),t){if(s-=r,n=n-r-1,e.e=Wl(n/Qe),e.d=[],r=(n+1)%Qe,n<0&&(r+=Qe),roh||e.e<-oh))throw Error(pj+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ve(e,t,n){var r,s,i,o,l,c,u,d,f=e.d;for(o=1,i=f[0];i>=10;i/=10)o++;if(r=t-o,r<0)r+=Qe,s=t,u=f[d=0];else{if(d=Math.ceil((r+1)/Qe),i=f.length,d>=i)return e;for(u=i=f[d],o=1;i>=10;i/=10)o++;r%=Qe,s=r-Qe+o}if(n!==void 0&&(i=Qs(10,o-s-1),l=u/i%10|0,c=t<0||f[d+1]!==void 0||u%i,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?s>0?u/Qs(10,o-s):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(i=Nt(e),f.length=1,t=t-i-1,f[0]=Qs(10,(Qe-t%Qe)%Qe),e.e=Wl(-t/Qe)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,i=1,d--):(f.length=d+1,i=Qs(10,Qe-r),f[d]=s>0?(u/Qs(10,o-s)%Qs(10,s)|0)*i:0),c)for(;;)if(d==0){(f[0]+=i)==Rt&&(f[0]=1,++e.e);break}else{if(f[d]+=i,f[d]!=Rt)break;f[d--]=0,i=1}for(r=f.length;f[--r]===0;)f.pop();if(rt&&(e.e>oh||e.e<-oh))throw Error(pj+Nt(e));return e}function o3(e,t){var n,r,s,i,o,l,c,u,d,f,p=e.constructor,h=p.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new p(e),rt?Ve(t,h):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),s=Math.max(Math.ceil(h/Qe),l)+2,o>s&&(o=s,n.length=1),n.reverse(),s=o;s--;)n.push(0);n.reverse()}else{for(s=c.length,l=f.length,d=s0;--s)c[l++]=0;for(s=f.length;s>o;){if(c[--s]0?i=i.charAt(0)+"."+i.slice(1)+Ga(r):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s<0?"e":"e+")+s):s<0?(i="0."+Ga(-s-1)+i,n&&(r=n-o)>0&&(i+=Ga(r))):s>=o?(i+=Ga(s+1-o),n&&(r=n-s-1)>0&&(i=i+"."+Ga(r))):((r=s+1)0&&(s+1===o&&(i+="."),i+=Ga(r))),e.s<0?"-"+i:i}function rk(e,t){if(e.length>t)return e.length=t,!0}function l3(e){var t,n,r;function s(i){var o=this;if(!(o instanceof s))return new s(i);if(o.constructor=s,i instanceof s){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(vi+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return nk(o,i.toString())}else if(typeof i!="string")throw Error(vi+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,MZ.test(i))nk(o,i);else throw Error(vi+i)}if(s.prototype=fe,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=l3,s.config=s.set=RZ,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=s[t+1]&&r<=s[t+2])this[n]=r;else throw Error(vi+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(vi+n+": "+r);return this}var hj=l3($Z);Rn=new hj(1);const Be=hj;function DZ(e){return BZ(e)||zZ(e)||LZ(e)||IZ()}function IZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LZ(e,t){if(e){if(typeof e=="string")return Bv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bv(e,t)}}function zZ(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function BZ(e){if(Array.isArray(e))return Bv(e)}function Bv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t?n.apply(void 0,s):e(t-o,ak(function(){for(var l=arguments.length,c=new Array(l),u=0;ue.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,s=!1,i=void 0;try{for(var o=e[Symbol.iterator](),l;!(r=(l=o.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(c){s=!0,i=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(s)throw i}}return n}}function tee(e){if(Array.isArray(e))return e}function p3(e){var t=Iu(e,2),n=t[0],r=t[1],s=n,i=r;return n>r&&(s=r,i=n),[s,i]}function h3(e,t,n){if(e.lte(0))return new Be(0);var r=Jm.getDigitCount(e.toNumber()),s=new Be(10).pow(r),i=e.div(s),o=r!==1?.05:.1,l=new Be(Math.ceil(i.div(o).toNumber())).add(n).mul(o),c=l.mul(s);return t?c:new Be(Math.ceil(c))}function nee(e,t,n){var r=1,s=new Be(e);if(!s.isint()&&n){var i=Math.abs(e);i<1?(r=new Be(10).pow(Jm.getDigitCount(e)-1),s=new Be(Math.floor(s.div(r).toNumber())).mul(r)):i>1&&(s=new Be(Math.floor(e)))}else e===0?s=new Be(Math.floor((t-1)/2)):n||(s=new Be(Math.floor(e)));var o=Math.floor((t-1)/2),l=WZ(UZ(function(c){return s.add(new Be(c-o).mul(r)).toNumber()}),Fv);return l(0,t)}function m3(e,t,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Be(0),tickMin:new Be(0),tickMax:new Be(0)};var i=h3(new Be(t).sub(e).div(n-1),r,s),o;e<=0&&t>=0?o=new Be(0):(o=new Be(e).add(t).div(2),o=o.sub(new Be(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new Be(t).sub(o).div(i).toNumber()),u=l+c+1;return u>n?m3(e,t,n,r,s+1):(u0?c+(n-u):c,l=t>0?l:l+(n-u)),{step:i,tickMin:o.sub(new Be(l).mul(i)),tickMax:o.add(new Be(c).mul(i))})}function ree(e){var t=Iu(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(s,2),l=p3([n,r]),c=Iu(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(Uv(Fv(0,s-1).map(function(){return 1/0}))):[].concat(Uv(Fv(0,s-1).map(function(){return-1/0})),[d]);return n>r?Vv(f):f}if(u===d)return nee(u,s,i);var p=m3(u,d,o,i),h=p.step,m=p.tickMin,v=p.tickMax,x=Jm.rangeStep(m,v.add(new Be(.1).mul(h)),h);return n>r?Vv(x):x}function aee(e,t){var n=Iu(e,2),r=n[0],s=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=p3([r,s]),l=Iu(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[r,s];if(c===u)return[c];var d=Math.max(t,2),f=h3(new Be(u).sub(c).div(d-1),i,0),p=[].concat(Uv(Jm.rangeStep(new Be(c),new Be(u).sub(new Be(.99).mul(f)),f)),[u]);return r>s?Vv(p):p}var see=d3(ree),iee=d3(aee),oee="Invariant failed";function Ri(e,t){throw new Error(oee)}var lee=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function al(e){"@babel/helpers - typeof";return al=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},al(e)}function lh(){return lh=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mee(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function xee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gee(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,u=0;u0?s[u-1].coordinate:s[l-1].coordinate,f=s[u].coordinate,p=u>=l-1?s[0].coordinate:s[u+1].coordinate,h=void 0;if(ln(f-d)!==ln(p-f)){var m=[];if(ln(p-f)===ln(c[1]-c[0])){h=p;var v=f+c[1]-c[0];m[0]=Math.min(v,(v+d)/2),m[1]=Math.max(v,(v+d)/2)}else{h=d;var x=p+c[1]-c[0];m[0]=Math.min(f,(x+f)/2),m[1]=Math.max(f,(x+f)/2)}var y=[Math.min(f,(h+f)/2),Math.max(f,(h+f)/2)];if(t>y[0]&&t<=y[1]||t>=m[0]&&t<=m[1]){o=s[u].index;break}}else{var g=Math.min(d,p),j=Math.max(d,p);if(t>(g+f)/2&&t<=(j+f)/2){o=s[u].index;break}}}else for(var N=0;N0&&N(r[N].coordinate+r[N-1].coordinate)/2&&t<=(r[N].coordinate+r[N+1].coordinate)/2||N===l-1&&t>(r[N].coordinate+r[N-1].coordinate)/2){o=r[N].index;break}return o},mj=function(t){var n,r=t,s=r.type.displayName,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?dt(dt({},t.type.defaultProps),t.props):t.props,o=i.stroke,l=i.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},Mee=function(t){var n=t.barSize,r=t.totalSize,s=t.stackGroups,i=s===void 0?{}:s;if(!i)return{};for(var o={},l=Object.keys(i),c=0,u=l.length;c=0});if(y&&y.length){var g=y[0].type.defaultProps,j=g!==void 0?dt(dt({},g),y[0].props):y[0].props,N=j.barSize,w=j[x];o[w]||(o[w]=[]);var S=je(N)?n:N;o[w].push({item:y[0],stackList:y.slice(1),barSize:je(S)?void 0:cn(S,r,0)})}}return o},Ree=function(t){var n=t.barGap,r=t.barCategoryGap,s=t.bandSize,i=t.sizeList,o=i===void 0?[]:i,l=t.maxBarSize,c=o.length;if(c<1)return null;var u=cn(n,s,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var p=!1,h=s/c,m=o.reduce(function(N,w){return N+w.barSize||0},0);m+=(c-1)*u,m>=s&&(m-=(c-1)*u,u=0),m>=s&&h>0&&(p=!0,h*=.9,m=c*h);var v=(s-m)/2>>0,x={offset:v-u,size:0};d=o.reduce(function(N,w){var S={item:w.item,position:{offset:x.offset+x.size+u,size:p?h:w.barSize}},k=[].concat(ok(N),[S]);return x=k[k.length-1].position,w.stackList&&w.stackList.length&&w.stackList.forEach(function(C){k.push({item:C,position:x})}),k},f)}else{var y=cn(r,s,0,!0);s-2*y-(c-1)*u<=0&&(u=0);var g=(s-2*y-(c-1)*u)/c;g>1&&(g>>=0);var j=l===+l?Math.min(g,l):g;d=o.reduce(function(N,w,S){var k=[].concat(ok(N),[{item:w.item,position:{offset:y+(g+u)*S+(g-j)/2,size:j}}]);return w.stackList&&w.stackList.length&&w.stackList.forEach(function(C){k.push({item:C,position:k[k.length-1].position})}),k},f)}return d},Dee=function(t,n,r,s){var i=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),u=y3({children:i,legendWidth:c});if(u){var d=s||{},f=d.width,p=d.height,h=u.align,m=u.verticalAlign,v=u.layout;if((v==="vertical"||v==="horizontal"&&m==="middle")&&h!=="center"&&ee(t[h]))return dt(dt({},t),{},Lo({},h,t[h]+(f||0)));if((v==="horizontal"||v==="vertical"&&h==="center")&&m!=="middle"&&ee(t[m]))return dt(dt({},t),{},Lo({},m,t[m]+(p||0)))}return t},Iee=function(t,n,r){return je(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},b3=function(t,n,r,s,i){var o=n.props.children,l=zn(o,Sd).filter(function(u){return Iee(s,i,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=mt(d,r);if(je(f))return u;var p=Array.isArray(f)?[Ym(f),rs(f)]:[f,f],h=c.reduce(function(m,v){var x=mt(d,v,0),y=p[0]-Math.abs(Array.isArray(x)?x[0]:x),g=p[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(y,m[0]),Math.max(g,m[1])]},[1/0,-1/0]);return[Math.min(h[0],u[0]),Math.max(h[1],u[1])]},[1/0,-1/0])}return null},Lee=function(t,n,r,s,i){var o=n.map(function(l){return b3(t,l,r,i,s)}).filter(function(l){return!je(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},j3=function(t,n,r,s,i){var o=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&b3(t,c,u,s)||Fc(t,u,r,i)});if(r==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,f=u.length;d=2?ln(l[0]-l[1])*2*u:u,n&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var p=i?i.indexOf(f):f;return{coordinate:s(p)+u,value:f,offset:u}});return d.filter(function(f){return!Ll(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,p){return{coordinate:s(f)+u,value:f,index:p,offset:u}}):s.ticks&&!r?s.ticks(t.tickCount).map(function(f){return{coordinate:s(f)+u,value:f,offset:u}}):s.domain().map(function(f,p){return{coordinate:s(f)+u,value:i?i[f]:f,index:p,offset:u}})},y0=new WeakMap,ff=function(t,n){if(typeof n!="function")return t;y0.has(t)||y0.set(t,new WeakMap);var r=y0.get(t);if(r.has(n))return r.get(n);var s=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,s),s},S3=function(t,n,r){var s=t.scale,i=t.type,o=t.layout,l=t.axisType;if(s==="auto")return o==="radial"&&l==="radiusAxis"?{scale:Ou(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:rh(),realScaleType:"linear"}:i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:Bc(),realScaleType:"point"}:i==="category"?{scale:Ou(),realScaleType:"band"}:{scale:rh(),realScaleType:"linear"};if(Ei(s)){var c="scale".concat(Rm(s));return{scale:(tk[c]||Bc)(),realScaleType:tk[c]?c:"point"}}return ve(s)?{scale:s}:{scale:Bc(),realScaleType:"point"}},ck=1e-4,k3=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,s=t.range(),i=Math.min(s[0],s[1])-ck,o=Math.max(s[0],s[1])+ck,l=t(n[0]),c=t(n[r-1]);(lo||co)&&t.domain([n[0],n[r-1]])}},zee=function(t,n){if(!t)return null;for(var r=0,s=t.length;rs)&&(i[1]=s),i[0]>s&&(i[0]=s),i[1]=0?(t[l][r][0]=i,t[l][r][1]=i+c,i=t[l][r][1]):(t[l][r][0]=o,t[l][r][1]=o+c,o=t[l][r][1])}},Vee=function(t){var n=t.length;if(!(n<=0))for(var r=0,s=t[0].length;r=0?(t[o][r][0]=i,t[o][r][1]=i+l,i=t[o][r][1]):(t[o][r][0]=0,t[o][r][1]=0)}},Uee={sign:Fee,expand:lF,none:Yo,silhouette:cF,wiggle:uF,positive:Vee},Wee=function(t,n,r){var s=n.map(function(l){return l.props.dataKey}),i=Uee[r],o=oF().keys(s).value(function(l,c){return+mt(l,c,0)}).order(gv).offset(i);return o(t)},qee=function(t,n,r,s,i,o){if(!t)return null;var l=o?n.reverse():n,c={},u=l.reduce(function(f,p){var h,m=(h=p.type)!==null&&h!==void 0&&h.defaultProps?dt(dt({},p.type.defaultProps),p.props):p.props,v=m.stackId,x=m.hide;if(x)return f;var y=m[r],g=f[y]||{hasStack:!1,stackGroups:{}};if(Et(v)){var j=g.stackGroups[v]||{numericAxisId:r,cateAxisId:s,items:[]};j.items.push(p),g.hasStack=!0,g.stackGroups[v]=j}else g.stackGroups[Hi("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[p]};return dt(dt({},f),{},Lo({},y,g))},c),d={};return Object.keys(u).reduce(function(f,p){var h=u[p];if(h.hasStack){var m={};h.stackGroups=Object.keys(h.stackGroups).reduce(function(v,x){var y=h.stackGroups[x];return dt(dt({},v),{},Lo({},x,{numericAxisId:r,cateAxisId:s,items:y.items,stackedData:Wee(t,y.items,i)}))},m)}return dt(dt({},f),{},Lo({},p,h))},d)},C3=function(t,n){var r=n.realScaleType,s=n.type,i=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&s==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=see(u,i,l);return t.domain([Ym(d),rs(d)]),{niceTicks:d}}if(i&&s==="number"){var f=t.domain(),p=iee(f,i,l);return{niceTicks:p}}return null};function uh(e){var t=e.axis,n=e.ticks,r=e.bandSize,s=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!je(s[t.dataKey])){var l=Rp(n,"value",s[t.dataKey]);if(l)return l.coordinate+r/2}return n[i]?n[i].coordinate+r/2:null}var c=mt(s,je(o)?t.dataKey:o);return je(c)?null:t.scale(c)}var uk=function(t){var n=t.axis,r=t.ticks,s=t.offset,i=t.bandSize,o=t.entry,l=t.index;if(n.type==="category")return r[l]?r[l].coordinate+s:null;var c=mt(o,n.dataKey,n.domain[l]);return je(c)?null:n.scale(c)-i/2+s},Hee=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var s=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return s<=0&&i>=0?0:i<0?i:s}return r[0]},Kee=function(t,n){var r,s=(r=t.type)!==null&&r!==void 0&&r.defaultProps?dt(dt({},t.type.defaultProps),t.props):t.props,i=s.stackId;if(Et(i)){var o=n[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},Gee=function(t){return t.reduce(function(n,r){return[Ym(r.concat([n[0]]).filter(ee)),rs(r.concat([n[1]]).filter(ee))]},[1/0,-1/0])},_3=function(t,n,r){return Object.keys(t).reduce(function(s,i){var o=t[i],l=o.stackedData,c=l.reduce(function(u,d){var f=Gee(d.slice(n,r+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},dk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,fk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Kv=function(t,n,r){if(ve(t))return t(n,r);if(!Array.isArray(t))return n;var s=[];if(ee(t[0]))s[0]=r?t[0]:Math.min(t[0],n[0]);else if(dk.test(t[0])){var i=+dk.exec(t[0])[1];s[0]=n[0]-i}else ve(t[0])?s[0]=t[0](n[0]):s[0]=n[0];if(ee(t[1]))s[1]=r?t[1]:Math.max(t[1],n[1]);else if(fk.test(t[1])){var o=+fk.exec(t[1])[1];s[1]=n[1]+o}else ve(t[1])?s[1]=t[1](n[1]):s[1]=n[1];return s},dh=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var s=t.scale.bandwidth();if(!r||s>0)return s}if(t&&n&&n.length>=2){for(var i=U1(n,function(f){return f.coordinate}),o=1/0,l=1,c=i.length;le.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},rte=function(t,n,r,s,i){var o=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=cn(t.cx,o,o/2),f=cn(t.cy,l,l/2),p=E3(o,l,r),h=cn(t.innerRadius,p,0),m=cn(t.outerRadius,p,p*.8),v=Object.keys(n);return v.reduce(function(x,y){var g=n[y],j=g.domain,N=g.reversed,w;if(je(g.range))s==="angleAxis"?w=[c,u]:s==="radiusAxis"&&(w=[h,m]),N&&(w=[w[1],w[0]]);else{w=g.range;var S=w,k=Qee(S,2);c=k[0],u=k[1]}var C=S3(g,i),_=C.realScaleType,A=C.scale;A.domain(j).range(w),k3(A);var E=C3(A,ha(ha({},g),{},{realScaleType:_})),P=ha(ha(ha({},g),E),{},{range:w,radius:m,realScaleType:_,scale:A,cx:d,cy:f,innerRadius:h,outerRadius:m,startAngle:c,endAngle:u});return ha(ha({},x),{},P3({},y,P))},{})},ate=function(t,n){var r=t.x,s=t.y,i=n.x,o=n.y;return Math.sqrt(Math.pow(r-i,2)+Math.pow(s-o,2))},ste=function(t,n){var r=t.x,s=t.y,i=n.cx,o=n.cy,l=ate({x:r,y:s},{x:i,y:o});if(l<=0)return{radius:l};var c=(r-i)/l,u=Math.acos(c);return s>o&&(u=2*Math.PI-u),{radius:l,angle:nte(u),angleInRadian:u}},ite=function(t){var n=t.startAngle,r=t.endAngle,s=Math.floor(n/360),i=Math.floor(r/360),o=Math.min(s,i);return{startAngle:n-o*360,endAngle:r-o*360}},ote=function(t,n){var r=n.startAngle,s=n.endAngle,i=Math.floor(r/360),o=Math.floor(s/360),l=Math.min(i,o);return t+l*360},xk=function(t,n){var r=t.x,s=t.y,i=ste({x:r,y:s},n),o=i.radius,l=i.angle,c=n.innerRadius,u=n.outerRadius;if(ou)return!1;if(o===0)return!0;var d=ite(n),f=d.startAngle,p=d.endAngle,h=l,m;if(f<=p){for(;h>p;)h-=360;for(;h=f&&h<=p}else{for(;h>f;)h-=360;for(;h=p&&h<=f}return m?ha(ha({},n),{},{radius:o,angle:ote(h,n)}):null},O3=function(t){return!b.isValidElement(t)&&!ve(t)&&typeof t!="boolean"?t.className:""};function Fu(e){"@babel/helpers - typeof";return Fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fu(e)}var lte=["offset"];function cte(e){return pte(e)||fte(e)||dte(e)||ute()}function ute(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dte(e,t){if(e){if(typeof e=="string")return Gv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gv(e,t)}}function fte(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pte(e){if(Array.isArray(e))return Gv(e)}function Gv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mte(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function gk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function kt(e){for(var t=1;t=0?1:-1,j,N;s==="insideStart"?(j=h+g*o,N=v):s==="insideEnd"?(j=m-g*o,N=!v):s==="end"&&(j=m+g*o,N=v),N=y<=0?N:!N;var w=Ge(u,d,x,j),S=Ge(u,d,x,j+(N?1:-1)*359),k="M".concat(w.x,",").concat(w.y,` + A`).concat(x,",").concat(x,",0,1,").concat(N?0:1,`, + `).concat(S.x,",").concat(S.y),C=je(t.id)?Hi("recharts-radial-line-"):t.id;return O.createElement("text",Vu({},r,{dominantBaseline:"central",className:Ne("recharts-radial-bar-label",l)}),O.createElement("defs",null,O.createElement("path",{id:C,d:k})),O.createElement("textPath",{xlinkHref:"#".concat(C)},n))},wte=function(t){var n=t.viewBox,r=t.offset,s=t.position,i=n,o=i.cx,l=i.cy,c=i.innerRadius,u=i.outerRadius,d=i.startAngle,f=i.endAngle,p=(d+f)/2;if(s==="outside"){var h=Ge(o,l,u+r,p),m=h.x,v=h.y;return{x:m,y:v,textAnchor:m>=o?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var x=(c+u)/2,y=Ge(o,l,x,p),g=y.x,j=y.y;return{x:g,y:j,textAnchor:"middle",verticalAnchor:"middle"}},Nte=function(t){var n=t.viewBox,r=t.parentViewBox,s=t.offset,i=t.position,o=n,l=o.x,c=o.y,u=o.width,d=o.height,f=d>=0?1:-1,p=f*s,h=f>0?"end":"start",m=f>0?"start":"end",v=u>=0?1:-1,x=v*s,y=v>0?"end":"start",g=v>0?"start":"end";if(i==="top"){var j={x:l+u/2,y:c-f*s,textAnchor:"middle",verticalAnchor:h};return kt(kt({},j),r?{height:Math.max(c-r.y,0),width:u}:{})}if(i==="bottom"){var N={x:l+u/2,y:c+d+p,textAnchor:"middle",verticalAnchor:m};return kt(kt({},N),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(i==="left"){var w={x:l-x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"};return kt(kt({},w),r?{width:Math.max(w.x-r.x,0),height:d}:{})}if(i==="right"){var S={x:l+u+x,y:c+d/2,textAnchor:g,verticalAnchor:"middle"};return kt(kt({},S),r?{width:Math.max(r.x+r.width-S.x,0),height:d}:{})}var k=r?{width:u,height:d}:{};return i==="insideLeft"?kt({x:l+x,y:c+d/2,textAnchor:g,verticalAnchor:"middle"},k):i==="insideRight"?kt({x:l+u-x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"},k):i==="insideTop"?kt({x:l+u/2,y:c+p,textAnchor:"middle",verticalAnchor:m},k):i==="insideBottom"?kt({x:l+u/2,y:c+d-p,textAnchor:"middle",verticalAnchor:h},k):i==="insideTopLeft"?kt({x:l+x,y:c+p,textAnchor:g,verticalAnchor:m},k):i==="insideTopRight"?kt({x:l+u-x,y:c+p,textAnchor:y,verticalAnchor:m},k):i==="insideBottomLeft"?kt({x:l+x,y:c+d-p,textAnchor:g,verticalAnchor:h},k):i==="insideBottomRight"?kt({x:l+u-x,y:c+d-p,textAnchor:y,verticalAnchor:h},k):Ml(i)&&(ee(i.x)||ii(i.x))&&(ee(i.y)||ii(i.y))?kt({x:l+cn(i.x,u),y:c+cn(i.y,d),textAnchor:"end",verticalAnchor:"end"},k):kt({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},k)},Ste=function(t){return"cx"in t&&ee(t.cx)};function It(e){var t=e.offset,n=t===void 0?5:t,r=hte(e,lte),s=kt({offset:n},r),i=s.viewBox,o=s.position,l=s.value,c=s.children,u=s.content,d=s.className,f=d===void 0?"":d,p=s.textBreakAll;if(!i||je(l)&&je(c)&&!b.isValidElement(u)&&!ve(u))return null;if(b.isValidElement(u))return b.cloneElement(u,s);var h;if(ve(u)){if(h=b.createElement(u,s),b.isValidElement(h))return h}else h=yte(s);var m=Ste(i),v=me(s,!0);if(m&&(o==="insideStart"||o==="insideEnd"||o==="end"))return jte(s,h,v);var x=m?wte(s):Nte(s);return O.createElement(Ti,Vu({className:Ne("recharts-label",f)},v,x,{breakAll:p}),h)}It.displayName="Label";var T3=function(t){var n=t.cx,r=t.cy,s=t.angle,i=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,p=t.y,h=t.top,m=t.left,v=t.width,x=t.height,y=t.clockWise,g=t.labelViewBox;if(g)return g;if(ee(v)&&ee(x)){if(ee(f)&&ee(p))return{x:f,y:p,width:v,height:x};if(ee(h)&&ee(m))return{x:h,y:m,width:v,height:x}}return ee(f)&&ee(p)?{x:f,y:p,width:0,height:0}:ee(n)&&ee(r)?{cx:n,cy:r,startAngle:i||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:y}:t.viewBox?t.viewBox:{}},kte=function(t,n){return t?t===!0?O.createElement(It,{key:"label-implicit",viewBox:n}):Et(t)?O.createElement(It,{key:"label-implicit",viewBox:n,value:t}):b.isValidElement(t)?t.type===It?b.cloneElement(t,{key:"label-implicit",viewBox:n}):O.createElement(It,{key:"label-implicit",content:t,viewBox:n}):ve(t)?O.createElement(It,{key:"label-implicit",content:t,viewBox:n}):Ml(t)?O.createElement(It,Vu({viewBox:n},t,{key:"label-implicit"})):null:null},Cte=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var s=t.children,i=T3(t),o=zn(s,It).map(function(c,u){return b.cloneElement(c,{viewBox:n||i,key:"label-".concat(u)})});if(!r)return o;var l=kte(t.label,n||i);return[l].concat(cte(o))};It.parseViewBox=T3;It.renderCallByParent=Cte;function _te(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Ate=_te;const Pte=De(Ate);function Uu(e){"@babel/helpers - typeof";return Uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uu(e)}var Ete=["valueAccessor"],Ote=["data","dataKey","clockWise","id","textBreakAll"];function Tte(e){return Dte(e)||Rte(e)||Mte(e)||$te()}function $te(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mte(e,t){if(e){if(typeof e=="string")return Xv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xv(e,t)}}function Rte(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Dte(e){if(Array.isArray(e))return Xv(e)}function Xv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Bte(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Fte=function(t){return Array.isArray(t.value)?Pte(t.value):t.value};function Zr(e){var t=e.valueAccessor,n=t===void 0?Fte:t,r=bk(e,Ete),s=r.data,i=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=bk(r,Ote);return!s||!s.length?null:O.createElement(Ae,{className:"recharts-label-list"},s.map(function(d,f){var p=je(i)?n(d,f):mt(d&&d.payload,i),h=je(l)?{}:{id:"".concat(l,"-").concat(f)};return O.createElement(It,ph({},me(d,!0),u,h,{parentViewBox:d.parentViewBox,value:p,textBreakAll:c,viewBox:It.parseViewBox(je(o)?d:yk(yk({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}Zr.displayName="LabelList";function Vte(e,t){return e?e===!0?O.createElement(Zr,{key:"labelList-implicit",data:t}):O.isValidElement(e)||ve(e)?O.createElement(Zr,{key:"labelList-implicit",data:t,content:e}):Ml(e)?O.createElement(Zr,ph({data:t},e,{key:"labelList-implicit"})):null:null}function Ute(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,s=zn(r,Zr).map(function(o,l){return b.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!n)return s;var i=Vte(e.label,t);return[i].concat(Tte(s))}Zr.renderCallByParent=Ute;function Wu(e){"@babel/helpers - typeof";return Wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wu(e)}function Yv(){return Yv=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>u),`, + `).concat(f.x,",").concat(f.y,` + `);if(s>0){var h=Ge(n,r,s,o),m=Ge(n,r,s,u);p+="L ".concat(m.x,",").concat(m.y,` + A `).concat(s,",").concat(s,`,0, + `).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`, + `).concat(h.x,",").concat(h.y," Z")}else p+="L ".concat(n,",").concat(r," Z");return p},Gte=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=ln(d-u),p=pf({cx:n,cy:r,radius:i,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),h=p.circleTangency,m=p.lineTangency,v=p.theta,x=pf({cx:n,cy:r,radius:i,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),y=x.circleTangency,g=x.lineTangency,j=x.theta,N=c?Math.abs(u-d):Math.abs(u-d)-v-j;if(N<0)return l?"M ".concat(m.x,",").concat(m.y,` + a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 + a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 + `):$3({cx:n,cy:r,innerRadius:s,outerRadius:i,startAngle:u,endAngle:d});var w="M ".concat(m.x,",").concat(m.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(h.x,",").concat(h.y,` + A`).concat(i,",").concat(i,",0,").concat(+(N>180),",").concat(+(f<0),",").concat(y.x,",").concat(y.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(g.x,",").concat(g.y,` + `);if(s>0){var S=pf({cx:n,cy:r,radius:s,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),k=S.circleTangency,C=S.lineTangency,_=S.theta,A=pf({cx:n,cy:r,radius:s,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),E=A.circleTangency,P=A.lineTangency,D=A.theta,I=c?Math.abs(u-d):Math.abs(u-d)-_-D;if(I<0&&o===0)return"".concat(w,"L").concat(n,",").concat(r,"Z");w+="L".concat(P.x,",").concat(P.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(E.x,",").concat(E.y,` + A`).concat(s,",").concat(s,",0,").concat(+(I>180),",").concat(+(f>0),",").concat(k.x,",").concat(k.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(C.x,",").concat(C.y,"Z")}else w+="L".concat(n,",").concat(r,"Z");return w},Xte={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},M3=function(t){var n=wk(wk({},Xte),t),r=n.cx,s=n.cy,i=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,p=n.className;if(o0&&Math.abs(d-f)<360?x=Gte({cx:r,cy:s,innerRadius:i,outerRadius:o,cornerRadius:Math.min(v,m/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):x=$3({cx:r,cy:s,innerRadius:i,outerRadius:o,startAngle:d,endAngle:f}),O.createElement("path",Yv({},me(n,!0),{className:h,d:x,role:"img"}))};function qu(e){"@babel/helpers - typeof";return qu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qu(e)}function Qv(){return Qv=Object.assign?Object.assign.bind():function(e){for(var t=1;tlne.call(e,t));function Xi(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const dne="__v",fne="__o",pne="_owner",{getOwnPropertyDescriptor:_k,keys:Ak}=Object;function hne(e,t){return e.byteLength===t.byteLength&&hh(new Uint8Array(e),new Uint8Array(t))}function mne(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function xne(e,t){return e.byteLength===t.byteLength&&hh(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function gne(e,t){return Xi(e.getTime(),t.getTime())}function vne(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function yne(e,t){return e===t}function Pk(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const s=new Array(r),i=e.entries();let o,l,c=0;for(;(o=i.next())&&!o.done;){const u=t.entries();let d=!1,f=0;for(;(l=u.next())&&!l.done;){if(s[f]){f++;continue}const p=o.value,h=l.value;if(n.equals(p[0],h[0],c,f,e,t,n)&&n.equals(p[1],h[1],p[0],h[0],e,t,n)){d=s[f]=!0;break}f++}if(!d)return!1;c++}return!0}const bne=Xi;function jne(e,t,n){const r=Ak(e);let s=r.length;if(Ak(t).length!==s)return!1;for(;s-- >0;)if(!L3(e,t,n,r[s]))return!1;return!0}function gc(e,t,n){const r=Ck(e);let s=r.length;if(Ck(t).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=r[s],!L3(e,t,n,i)||(o=_k(e,i),l=_k(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function wne(e,t){return Xi(e.valueOf(),t.valueOf())}function Nne(e,t){return e.source===t.source&&e.flags===t.flags}function Ek(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const s=new Array(r),i=e.values();let o,l;for(;(o=i.next())&&!o.done;){const c=t.values();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(!s[d]&&n.equals(o.value,l.value,o.value,l.value,e,t,n)){u=s[d]=!0;break}d++}if(!u)return!1}return!0}function hh(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Sne(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function L3(e,t,n,r){return(r===pne||r===fne||r===dne)&&(e.$$typeof||t.$$typeof)?!0:une(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const kne="[object ArrayBuffer]",Cne="[object Arguments]",_ne="[object Boolean]",Ane="[object DataView]",Pne="[object Date]",Ene="[object Error]",One="[object Map]",Tne="[object Number]",$ne="[object Object]",Mne="[object RegExp]",Rne="[object Set]",Dne="[object String]",Ine={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Lne="[object URL]",zne=Object.prototype.toString;function Bne({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:d,areSetsEqual:f,areTypedArraysEqual:p,areUrlsEqual:h,unknownTagComparators:m}){return function(x,y,g){if(x===y)return!0;if(x==null||y==null)return!1;const j=typeof x;if(j!==typeof y)return!1;if(j!=="object")return j==="number"?l(x,y,g):j==="function"?i(x,y,g):!1;const N=x.constructor;if(N!==y.constructor)return!1;if(N===Object)return c(x,y,g);if(Array.isArray(x))return t(x,y,g);if(N===Date)return r(x,y,g);if(N===RegExp)return d(x,y,g);if(N===Map)return o(x,y,g);if(N===Set)return f(x,y,g);const w=zne.call(x);if(w===Pne)return r(x,y,g);if(w===Mne)return d(x,y,g);if(w===One)return o(x,y,g);if(w===Rne)return f(x,y,g);if(w===$ne)return typeof x.then!="function"&&typeof y.then!="function"&&c(x,y,g);if(w===Lne)return h(x,y,g);if(w===Ene)return s(x,y,g);if(w===Cne)return c(x,y,g);if(Ine[w])return p(x,y,g);if(w===kne)return e(x,y,g);if(w===Ane)return n(x,y,g);if(w===_ne||w===Tne||w===Dne)return u(x,y,g);if(m){let S=m[w];if(!S){const k=cne(x);k&&(S=m[k])}if(S)return S(x,y,g)}return!1}}function Fne({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:hne,areArraysEqual:n?gc:mne,areDataViewsEqual:xne,areDatesEqual:gne,areErrorsEqual:vne,areFunctionsEqual:yne,areMapsEqual:n?b0(Pk,gc):Pk,areNumbersEqual:bne,areObjectsEqual:n?gc:jne,arePrimitiveWrappersEqual:wne,areRegExpsEqual:Nne,areSetsEqual:n?b0(Ek,gc):Ek,areTypedArraysEqual:n?b0(hh,gc):hh,areUrlsEqual:Sne,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const s=mf(r.areArraysEqual),i=mf(r.areMapsEqual),o=mf(r.areObjectsEqual),l=mf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function Vne(e){return function(t,n,r,s,i,o,l){return e(t,n,l)}}function Une({circular:e,comparator:t,createState:n,equals:r,strict:s}){if(n)return function(l,c){const{cache:u=e?new WeakMap:void 0,meta:d}=n();return t(l,c,{cache:u,equals:r,meta:d,strict:s})};if(e)return function(l,c){return t(l,c,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,c){return t(l,c,i)}}const Wne=Is();Is({strict:!0});Is({circular:!0});Is({circular:!0,strict:!0});Is({createInternalComparator:()=>Xi});Is({strict:!0,createInternalComparator:()=>Xi});Is({circular:!0,createInternalComparator:()=>Xi});Is({circular:!0,createInternalComparator:()=>Xi,strict:!0});function Is(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:s=!1}=e,i=Fne(e),o=Bne(i),l=n?n(o):Vne(o);return Une({circular:t,comparator:o,createState:r,equals:l,strict:s})}function qne(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function Ok(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function s(i){n<0&&(n=i),i-n>t?(e(i),n=-1):qne(s)};requestAnimationFrame(r)}function Jv(e){"@babel/helpers - typeof";return Jv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jv(e)}function Hne(e){return Yne(e)||Xne(e)||Gne(e)||Kne()}function Kne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gne(e,t){if(e){if(typeof e=="string")return Tk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Tk(e,t)}}function Tk(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?1:y<0?0:y},v=function(y){for(var g=y>1?1:y,j=g,N=0;N<8;++N){var w=f(j)-g,S=h(j);if(Math.abs(w-g)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,s=t.damping,i=s===void 0?8:s,o=t.dt,l=o===void 0?17:o,c=function(d,f,p){var h=-(d-f)*r,m=p*i,v=p+(h-m)*l/1e3,x=p*l/1e3+d;return Math.abs(x-f)e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _re(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}function j0(e){return Ore(e)||Ere(e)||Pre(e)||Are()}function Are(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pre(e,t){if(e){if(typeof e=="string")return ry(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ry(e,t)}}function Ere(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ore(e){if(Array.isArray(e))return ry(e)}function ry(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function gh(e){return gh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},gh(e)}var Dr=function(e){Dre(n,e);var t=Ire(n);function n(r,s){var i;Tre(this,n),i=t.call(this,r,s);var o=i.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,f=o.steps,p=o.children,h=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(iy(i)),i.changeStyle=i.changeStyle.bind(iy(i)),!l||h<=0)return i.state={style:{}},typeof p=="function"&&(i.state={style:d}),sy(i);if(f&&f.length)i.state={style:f[0].style};else if(u){if(typeof p=="function")return i.state={style:u},sy(i);i.state={style:c?_c({},c,u):u}}else i.state={style:{}};return i}return Mre(n,[{key:"componentDidMount",value:function(){var s=this.props,i=s.isActive,o=s.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,u=i.shouldReAnimate,d=i.to,f=i.from,p=this.state.style;if(l){if(!o){var h={style:c?_c({},c,d):d};this.state&&p&&(c&&p[c]!==d||!c&&p!==d)&&this.setState(h);return}if(!(Wne(s.to,d)&&s.canBegin&&s.isActive)){var m=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=m||u?f:s.to;if(this.state&&p){var x={style:c?_c({},c,v):v};(c&&p[c]!==v||!c&&p!==v)&&this.setState(x)}this.runAnimation(xr(xr({},this.props),{},{from:v,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var i=this,o=s.from,l=s.to,c=s.duration,u=s.easing,d=s.begin,f=s.onAnimationEnd,p=s.onAnimationStart,h=Sre(o,l,pre(u),c,this.changeStyle),m=function(){i.stopJSAnimation=h()};this.manager.start([p,d,m,c,f])}},{key:"runStepAnimation",value:function(s){var i=this,o=s.steps,l=s.begin,c=s.onAnimationStart,u=o[0],d=u.style,f=u.duration,p=f===void 0?0:f,h=function(v,x,y){if(y===0)return v;var g=x.duration,j=x.easing,N=j===void 0?"ease":j,w=x.style,S=x.properties,k=x.onAnimationEnd,C=y>0?o[y-1]:x,_=S||Object.keys(w);if(typeof N=="function"||N==="spring")return[].concat(j0(v),[i.runJSAnimation.bind(i,{from:C.style,to:w,duration:g,easing:N}),g]);var A=Rk(_,g,N),E=xr(xr(xr({},C.style),w),{},{transition:A});return[].concat(j0(v),[E,g,k]).filter(tre)};return this.manager.start([c].concat(j0(o.reduce(h,[d,Math.max(p,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=Qne());var i=s.begin,o=s.duration,l=s.attributeName,c=s.to,u=s.easing,d=s.onAnimationStart,f=s.onAnimationEnd,p=s.steps,h=s.children,m=this.manager;if(this.unSubscribe=m.subscribe(this.handleStyleChange),typeof u=="function"||typeof h=="function"||u==="spring"){this.runJSAnimation(s);return}if(p.length>1){this.runStepAnimation(s);return}var v=l?_c({},l,c):c,x=Rk(Object.keys(v),o,u);m.start([d,i,xr(xr({},v),{},{transition:x}),o,f])}},{key:"render",value:function(){var s=this.props,i=s.children;s.begin;var o=s.duration;s.attributeName,s.easing;var l=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var c=Cre(s,kre),u=b.Children.count(i),d=this.state.style;if(typeof i=="function")return i(d);if(!l||u===0||o<=0)return i;var f=function(h){var m=h.props,v=m.style,x=v===void 0?{}:v,y=m.className,g=b.cloneElement(h,xr(xr({},c),{},{style:xr(xr({},x),d),className:y}));return g};return u===1?f(b.Children.only(i)):O.createElement("div",null,b.Children.map(i,function(p){return f(p)}))}}]),n}(b.PureComponent);Dr.displayName="Animate";Dr.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Dr.propTypes={from:Re.oneOfType([Re.object,Re.string]),to:Re.oneOfType([Re.object,Re.string]),attributeName:Re.string,duration:Re.number,begin:Re.number,easing:Re.oneOfType([Re.string,Re.func]),steps:Re.arrayOf(Re.shape({duration:Re.number.isRequired,style:Re.object.isRequired,easing:Re.oneOfType([Re.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Re.func]),properties:Re.arrayOf("string"),onAnimationEnd:Re.func})),children:Re.oneOfType([Re.node,Re.func]),isActive:Re.bool,canBegin:Re.bool,onAnimationEnd:Re.func,shouldReAnimate:Re.bool,onAnimationStart:Re.func,onAnimationReStart:Re.func};function Gu(e){"@babel/helpers - typeof";return Gu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gu(e)}function vh(){return vh=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?1:-1,c=r>=0?1:-1,u=s>=0&&r>=0||s<0&&r<0?1:0,d;if(o>0&&i instanceof Array){for(var f=[0,0,0,0],p=0,h=4;po?o:i[p];d="M".concat(t,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(n)),d+="L ".concat(t+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, + `).concat(t+r,",").concat(n+l*f[1])),d+="L ".concat(t+r,",").concat(n+s-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, + `).concat(t+r-c*f[2],",").concat(n+s)),d+="L ".concat(t+c*f[3],",").concat(n+s),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, + `).concat(t,",").concat(n+s-l*f[3])),d+="Z"}else if(o>0&&i===+i&&i>0){var m=Math.min(o,i);d="M ".concat(t,",").concat(n+l*m,` + A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t+c*m,",").concat(n,` + L `).concat(t+r-c*m,",").concat(n,` + A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t+r,",").concat(n+l*m,` + L `).concat(t+r,",").concat(n+s-l*m,` + A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t+r-c*m,",").concat(n+s,` + L `).concat(t+c*m,",").concat(n+s,` + A `).concat(m,",").concat(m,",0,0,").concat(u,",").concat(t,",").concat(n+s-l*m," Z")}else d="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(s," h ").concat(-r," Z");return d},Kre=function(t,n){if(!t||!n)return!1;var r=t.x,s=t.y,i=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(i,i+l),d=Math.max(i,i+l),f=Math.min(o,o+c),p=Math.max(o,o+c);return r>=u&&r<=d&&s>=f&&s<=p}return!1},Gre={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},xj=function(t){var n=Uk(Uk({},Gre),t),r=b.useRef(),s=b.useState(-1),i=zre(s,2),o=i[0],l=i[1];b.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var N=r.current.getTotalLength();N&&l(N)}catch{}},[]);var c=n.x,u=n.y,d=n.width,f=n.height,p=n.radius,h=n.className,m=n.animationEasing,v=n.animationDuration,x=n.animationBegin,y=n.isAnimationActive,g=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var j=Ne("recharts-rectangle",h);return g?O.createElement(Dr,{canBegin:o>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:v,animationEasing:m,isActive:g},function(N){var w=N.width,S=N.height,k=N.x,C=N.y;return O.createElement(Dr,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:v,isActive:y,easing:m},O.createElement("path",vh({},me(n,!0),{className:j,d:Wk(k,C,w,S,p),ref:r})))}):O.createElement("path",vh({},me(n,!0),{className:j,d:Wk(c,u,d,f,p)}))},Xre=["points","className","baseLinePoints","connectNulls"];function bo(){return bo=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Qre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function qk(e){return tae(e)||eae(e)||Zre(e)||Jre()}function Jre(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zre(e,t){if(e){if(typeof e=="string")return oy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oy(e,t)}}function eae(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tae(e){if(Array.isArray(e))return oy(e)}function oy(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){Hk(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),Hk(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Uc=function(t,n){var r=nae(t);n&&(r=[r.reduce(function(i,o){return[].concat(qk(i),qk(o))},[])]);var s=r.map(function(i){return i.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(s,"Z"):s},rae=function(t,n,r){var s=Uc(t,r);return"".concat(s.slice(-1)==="Z"?s.slice(0,-1):s,"L").concat(Uc(n.reverse(),r).slice(1))},aae=function(t){var n=t.points,r=t.className,s=t.baseLinePoints,i=t.connectNulls,o=Yre(t,Xre);if(!n||!n.length)return null;var l=Ne("recharts-polygon",r);if(s&&s.length){var c=o.stroke&&o.stroke!=="none",u=rae(n,s,i);return O.createElement("g",{className:l},O.createElement("path",bo({},me(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?O.createElement("path",bo({},me(o,!0),{fill:"none",d:Uc(n,i)})):null,c?O.createElement("path",bo({},me(o,!0),{fill:"none",d:Uc(s,i)})):null)}var d=Uc(n,i);return O.createElement("path",bo({},me(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:l,d}))};function ly(){return ly=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var fae=function(t,n,r,s,i,o){return"M".concat(t,",").concat(i,"v").concat(s,"M").concat(o,",").concat(n,"h").concat(r)},pae=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,i=s===void 0?0:s,o=t.top,l=o===void 0?0:o,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,p=t.height,h=p===void 0?0:p,m=t.className,v=uae(t,sae),x=iae({x:r,y:i,top:l,left:u,width:f,height:h},v);return!ee(r)||!ee(i)||!ee(f)||!ee(h)||!ee(l)||!ee(u)?null:O.createElement("path",cy({},me(x,!0),{className:Ne("recharts-cross",m),d:fae(r,i,f,h,l,u)}))},hae=Xm,mae=n3,xae=ua;function gae(e,t){return e&&e.length?hae(e,xae(t),mae):void 0}var vae=gae;const yae=De(vae);var bae=Xm,jae=ua,wae=r3;function Nae(e,t){return e&&e.length?bae(e,jae(t),wae):void 0}var Sae=Nae;const kae=De(Sae);var Cae=["cx","cy","angle","ticks","axisLine"],_ae=["ticks","tick","angle","tickFormatter","stroke"];function il(e){"@babel/helpers - typeof";return il=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},il(e)}function Wc(){return Wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Aae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Pae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yk(e,t){for(var n=0;nZk?o=s==="outer"?"start":"end":i<-Zk?o=s==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,i=r.cy,o=r.radius,l=r.axisLine,c=r.axisLineType,u=Ws(Ws({},me(this.props,!1)),{},{fill:"none"},me(l,!1));if(c==="circle")return O.createElement(kd,ni({className:"recharts-polar-angle-axis-line"},u,{cx:s,cy:i,r:o}));var d=this.props.ticks,f=d.map(function(p){return Ge(s,i,o,p.coordinate)});return O.createElement(aae,ni({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,s=this.props,i=s.ticks,o=s.tick,l=s.tickLine,c=s.tickFormatter,u=s.stroke,d=me(this.props,!1),f=me(o,!1),p=Ws(Ws({},d),{},{fill:"none"},me(l,!1)),h=i.map(function(m,v){var x=r.getTickLineCoord(m),y=r.getTickTextAnchor(m),g=Ws(Ws(Ws({textAnchor:y},d),{},{stroke:"none",fill:u},f),{},{index:v,payload:m,x:x.x2,y:x.y2});return O.createElement(Ae,ni({className:Ne("recharts-polar-angle-axis-tick",O3(o)),key:"tick-".concat(m.coordinate)},Oi(r.props,m,v)),l&&O.createElement("line",ni({className:"recharts-polar-angle-axis-tick-line"},p,x)),o&&t.renderTickItem(o,g,c?c(m.value,v):m.value))});return O.createElement(Ae,{className:"recharts-polar-angle-axis-ticks"},h)}},{key:"render",value:function(){var r=this.props,s=r.ticks,i=r.radius,o=r.axisLine;return i<=0||!s||!s.length?null:O.createElement(Ae,{className:Ne("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,s,i){var o;return O.isValidElement(r)?o=O.cloneElement(r,s):ve(r)?o=r(s):o=O.createElement(Ti,ni({},s,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(b.PureComponent);tx(nx,"displayName","PolarAngleAxis");tx(nx,"axisType","angleAxis");tx(nx,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var Wae=ZE,qae=Wae(Object.getPrototypeOf,Object),Hae=qae,Kae=Ra,Gae=Hae,Xae=Da,Yae="[object Object]",Qae=Function.prototype,Jae=Object.prototype,X3=Qae.toString,Zae=Jae.hasOwnProperty,ese=X3.call(Object);function tse(e){if(!Xae(e)||Kae(e)!=Yae)return!1;var t=Gae(e);if(t===null)return!0;var n=Zae.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&X3.call(n)==ese}var nse=tse;const rse=De(nse);var ase=Ra,sse=Da,ise="[object Boolean]";function ose(e){return e===!0||e===!1||sse(e)&&ase(e)==ise}var lse=ose;const cse=De(lse);function Yu(e){"@babel/helpers - typeof";return Yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yu(e)}function jh(){return jh=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:p,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:p,x:c,y:u},duration:v,animationEasing:m,isActive:y},function(j){var N=j.upperWidth,w=j.lowerWidth,S=j.height,k=j.x,C=j.y;return O.createElement(Dr,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:v,easing:m},O.createElement("path",jh({},me(n,!0),{className:g,d:r5(k,C,N,w,S),ref:r})))}):O.createElement("g",null,O.createElement("path",jh({},me(n,!0),{className:g,d:r5(c,u,d,f,p)})))},bse=["option","shapeType","propTransformer","activeClassName","isActive"];function Qu(e){"@babel/helpers - typeof";return Qu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qu(e)}function jse(e,t){if(e==null)return{};var n=wse(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wse(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function a5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function wh(e){for(var t=1;t0?Ln(j,"paddingAngle",0):0;if(w){var k=At(w.endAngle-w.startAngle,j.endAngle-j.startAngle),C=qe(qe({},j),{},{startAngle:g+S,endAngle:g+k(v)+S});x.push(C),g=C.endAngle}else{var _=j.endAngle,A=j.startAngle,E=At(0,_-A),P=E(v),D=qe(qe({},j),{},{startAngle:g+S,endAngle:g+P+S});x.push(D),g=D.endAngle}}),O.createElement(Ae,null,r.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(r){var s=this;r.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var o=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[o].focus(),s.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[l].focus(),s.setState({sectorToFocus:l});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,s=r.sectors,i=r.isAnimationActive,o=this.state.prevSectors;return i&&s&&s.length&&(!o||!$i(o,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,s=this.props,i=s.hide,o=s.sectors,l=s.className,c=s.label,u=s.cx,d=s.cy,f=s.innerRadius,p=s.outerRadius,h=s.isAnimationActive,m=this.state.isAnimationFinished;if(i||!o||!o.length||!ee(u)||!ee(d)||!ee(f)||!ee(p))return null;var v=Ne("recharts-pie",l);return O.createElement(Ae,{tabIndex:this.props.rootTabIndex,className:v,ref:function(y){r.pieRef=y}},this.renderSectors(),c&&this.renderLabels(o),It.renderCallByParent(this.props,null,!1),(!h||m)&&Zr.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return s.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:r.sectors!==s.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,s){return r>s?"start":r=360?g:g-1)*c,N=x-g*h-j,w=s.reduce(function(C,_){var A=mt(_,y,0);return C+(ee(A)?A:0)},0),S;if(w>0){var k;S=s.map(function(C,_){var A=mt(C,y,0),E=mt(C,d,_),P=(ee(A)?A:0)/w,D;_?D=k.endAngle+ln(v)*c*(A!==0?1:0):D=o;var I=D+ln(v)*((A!==0?h:0)+P*N),R=(D+I)/2,M=(m.innerRadius+m.outerRadius)/2,W=[{name:E,value:A,payload:C,dataKey:y,type:p}],T=Ge(m.cx,m.cy,M,R);return k=qe(qe(qe({percent:P,cornerRadius:i,name:E,tooltipPayload:W,midAngle:R,middleRadius:M,tooltipPosition:T},C),m),{},{value:mt(C,y),startAngle:D,endAngle:I,payload:C,paddingAngle:ln(v)*c}),k})}return qe(qe({},m),{},{sectors:S,data:s})});var Use=Math.ceil,Wse=Math.max;function qse(e,t,n,r){for(var s=-1,i=Wse(Use((t-e)/(n||1)),0),o=Array(i);i--;)o[r?i:++s]=e,e+=n;return o}var Hse=qse,Kse=vO,l5=1/0,Gse=17976931348623157e292;function Xse(e){if(!e)return e===0?e:0;if(e=Kse(e),e===l5||e===-l5){var t=e<0?-1:1;return t*Gse}return e===e?e:0}var Z3=Xse,Yse=Hse,Qse=Fm,w0=Z3;function Jse(e){return function(t,n,r){return r&&typeof r!="number"&&Qse(t,n,r)&&(n=r=void 0),t=w0(t),n===void 0?(n=t,t=0):n=w0(n),r=r===void 0?t0&&r.handleDrag(s.changedTouches[0])}),Tn(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=r.props,i=s.endIndex,o=s.onDragEnd,l=s.startIndex;o==null||o({endIndex:i,startIndex:l})}),r.detachDragEndListener()}),Tn(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Tn(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Tn(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Tn(r,"handleSlideDragStart",function(s){var i=p5(s)?s.changedTouches[0]:s;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return fie(t,e),lie(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var s=r.startX,i=r.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(s,i),p=Math.max(s,i),h=t.getIndexInRange(o,f),m=t.getIndexInRange(o,p);return{startIndex:h-h%c,endIndex:m===d?d:m-m%c}}},{key:"getTextOfTick",value:function(r){var s=this.props,i=s.data,o=s.tickFormatter,l=s.dataKey,c=mt(i[r],l,r);return ve(o)?o(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var s=this.state,i=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,p=c.startIndex,h=c.endIndex,m=c.onChange,v=r.pageX-i;v>0?v=Math.min(v,u+d-f-l,u+d-f-o):v<0&&(v=Math.max(v,u-o,u-l));var x=this.getIndex({startX:o+v,endX:l+v});(x.startIndex!==p||x.endIndex!==h)&&m&&m(x),this.setState({startX:o+v,endX:l+v,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,s){var i=p5(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var s=this.state,i=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,u=this.state[o],d=this.props,f=d.x,p=d.width,h=d.travellerWidth,m=d.onChange,v=d.gap,x=d.data,y={startX:this.state.startX,endX:this.state.endX},g=r.pageX-i;g>0?g=Math.min(g,f+p-h-u):g<0&&(g=Math.max(g,f-u)),y[o]=u+g;var j=this.getIndex(y),N=j.startIndex,w=j.endIndex,S=function(){var C=x.length-1;return o==="startX"&&(l>c?N%v===0:w%v===0)||lc?w%v===0:N%v===0)||l>c&&w===C};this.setState(Tn(Tn({},o,u+g),"brushMoveStartX",r.pageX),function(){m&&S()&&m(j)})}},{key:"handleTravellerMoveKeyboard",value:function(r,s){var i=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[s],f=l.indexOf(d);if(f!==-1){var p=f+r;if(!(p===-1||p>=l.length)){var h=l[p];s==="startX"&&h>=u||s==="endX"&&h<=c||this.setState(Tn({},s,h),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.fill,u=r.stroke;return O.createElement("rect",{stroke:u,fill:c,x:s,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=b.Children.only(u);return f?O.cloneElement(f,{x:s,y:i,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,s){var i,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,p=c.traveller,h=c.ariaLabel,m=c.data,v=c.startIndex,x=c.endIndex,y=Math.max(r,this.props.x),g=N0(N0({},me(this.props,!1)),{},{x:y,y:u,width:d,height:f}),j=h||"Min value: ".concat((i=m[v])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=m[x])===null||o===void 0?void 0:o.name);return O.createElement(Ae,{tabIndex:0,role:"slider","aria-label":j,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(w){["ArrowLeft","ArrowRight"].includes(w.key)&&(w.preventDefault(),w.stopPropagation(),l.handleTravellerMoveKeyboard(w.key==="ArrowRight"?1:-1,s))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(p,g))}},{key:"renderSlide",value:function(r,s){var i=this.props,o=i.y,l=i.height,c=i.stroke,u=i.travellerWidth,d=Math.min(r,s)+u,f=Math.max(Math.abs(s-r)-u,0);return O.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,s=r.startIndex,i=r.endIndex,o=r.y,l=r.height,c=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,p=d.endX,h=5,m={pointerEvents:"none",fill:u};return O.createElement(Ae,{className:"recharts-brush-texts"},O.createElement(Ti,kh({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,p)-h,y:o+l/2},m),this.getTextOfTick(s)),O.createElement(Ti,kh({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,p)+c+h,y:o+l/2},m),this.getTextOfTick(i)))}},{key:"render",value:function(){var r=this.props,s=r.data,i=r.className,o=r.children,l=r.x,c=r.y,u=r.width,d=r.height,f=r.alwaysShowText,p=this.state,h=p.startX,m=p.endX,v=p.isTextActive,x=p.isSlideMoving,y=p.isTravellerMoving,g=p.isTravellerFocused;if(!s||!s.length||!ee(l)||!ee(c)||!ee(u)||!ee(d)||u<=0||d<=0)return null;var j=Ne("recharts-brush",i),N=O.Children.count(o)===1,w=iie("userSelect","none");return O.createElement(Ae,{className:j,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:w},this.renderBackground(),N&&this.renderPanorama(),this.renderSlide(h,m),this.renderTravellerLayer(h,"startX"),this.renderTravellerLayer(m,"endX"),(v||x||y||g||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var s=r.x,i=r.y,o=r.width,l=r.height,c=r.stroke,u=Math.floor(i+l/2)-1;return O.createElement(O.Fragment,null,O.createElement("rect",{x:s,y:i,width:o,height:l,fill:c,stroke:"none"}),O.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),O.createElement("line",{x1:s+1,y1:u+2,x2:s+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,s){var i;return O.isValidElement(r)?i=O.cloneElement(r,s):ve(r)?i=r(s):i=t.renderDefaultTraveller(s),i}},{key:"getDerivedStateFromProps",value:function(r,s){var i=r.data,o=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(i!==s.prevData||u!==s.prevUpdateId)return N0({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},i&&i.length?hie({data:i,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(s.scale&&(o!==s.prevWidth||l!==s.prevX||c!==s.prevTravellerWidth)){s.scale.range([l,l+o-c]);var p=s.scale.domain().map(function(h){return s.scale(h)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:s.scale(r.startIndex),endX:s.scale(r.endIndex),scaleValues:p}}return null}},{key:"getIndexInRange",value:function(r,s){for(var i=r.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);r[c]>s?l=c:o=c}return s>=r[l]?l:o}}])}(b.PureComponent);Tn(ul,"displayName","Brush");Tn(ul,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var mie=V1;function xie(e,t){var n;return mie(e,function(r,s,i){return n=t(r,s,i),!n}),!!n}var gie=xie,vie=qE,yie=ua,bie=gie,jie=En,wie=Fm;function Nie(e,t,n){var r=jie(e)?vie:bie;return n&&wie(e,t,n)&&(t=void 0),r(e,yie(t))}var Sie=Nie;const kie=De(Sie);var ea=function(t,n){var r=t.alwaysShow,s=t.ifOverflow;return r&&(s="extendDomain"),s===n},h5=pO;function Cie(e,t,n){t=="__proto__"&&h5?h5(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var _ie=Cie,Aie=_ie,Pie=dO,Eie=ua;function Oie(e,t){var n={};return t=Eie(t),Pie(e,function(r,s,i){Aie(n,s,t(r,s,i))}),n}var Tie=Oie;const $ie=De(Tie);function Mie(e,t){for(var n=-1,r=e==null?0:e.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Qie(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Jie(e,t){var n=e.x,r=e.y,s=Yie(e,Hie),i="".concat(n),o=parseInt(i,10),l="".concat(r),c=parseInt(l,10),u="".concat(t.height||s.height),d=parseInt(u,10),f="".concat(t.width||s.width),p=parseInt(f,10);return vc(vc(vc(vc(vc({},t),s),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:p,name:t.name,radius:t.radius})}function x5(e){return O.createElement(Y3,hy({shapeType:"rectangle",propTransformer:Jie,activeClassName:"recharts-active-bar"},e))}var Zie=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,s){if(typeof t=="number")return t;var i=ee(r)||j7(r);return i?t(r,s):(i||Ri(),n)}},eoe=["value","background"],aT;function dl(e){"@babel/helpers - typeof";return dl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dl(e)}function toe(e,t){if(e==null)return{};var n=noe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function noe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function _h(){return _h=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(R)0&&Math.abs(I)0&&(D=Math.min((ae||0)-(I[se-1]||0),D))}),Number.isFinite(D)){var R=D/P,M=v.layout==="vertical"?r.height:r.width;if(v.padding==="gap"&&(k=R*M/2),v.padding==="no-gap"){var W=cn(t.barCategoryGap,R*M),T=R*M/2;k=T-W-(T-W)/M*W}}}s==="xAxis"?C=[r.left+(j.left||0)+(k||0),r.left+r.width-(j.right||0)-(k||0)]:s==="yAxis"?C=c==="horizontal"?[r.top+r.height-(j.bottom||0),r.top+(j.top||0)]:[r.top+(j.top||0)+(k||0),r.top+r.height-(j.bottom||0)-(k||0)]:C=v.range,w&&(C=[C[1],C[0]]);var V=S3(v,i,p),X=V.scale,U=V.realScaleType;X.domain(y).range(C),k3(X);var L=C3(X,wr(wr({},v),{},{realScaleType:U}));s==="xAxis"?(E=x==="top"&&!N||x==="bottom"&&N,_=r.left,A=f[S]-E*v.height):s==="yAxis"&&(E=x==="left"&&!N||x==="right"&&N,_=f[S]-E*v.width,A=r.top);var B=wr(wr(wr({},v),L),{},{realScaleType:U,x:_,y:A,scale:X,width:s==="xAxis"?r.width:v.width,height:s==="yAxis"?r.height:v.height});return B.bandSize=dh(B,L),!v.hide&&s==="xAxis"?f[S]+=(E?-1:1)*B.height:v.hide||(f[S]+=(E?-1:1)*B.width),wr(wr({},h),{},sx({},m,B))},{})},lT=function(t,n){var r=t.x,s=t.y,i=n.x,o=n.y;return{x:Math.min(r,i),y:Math.min(s,o),width:Math.abs(i-r),height:Math.abs(o-s)}},poe=function(t){var n=t.x1,r=t.y1,s=t.x2,i=t.y2;return lT({x:n,y:r},{x:s,y:i})},cT=function(){function e(t){uoe(this,e),this.scale=t}return doe(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.bandAware,i=r.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(s){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),s=r[0],i=r[r.length-1];return s<=i?n>=s&&n<=i:n>=i&&n<=s}}],[{key:"create",value:function(n){return new e(n)}}])}();sx(cT,"EPS",1e-4);var vj=function(t){var n=Object.keys(t).reduce(function(r,s){return wr(wr({},r),{},sx({},s,cT.create(t[s])))},{});return wr(wr({},n),{},{apply:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return $ie(s,function(c,u){return n[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return rT(s,function(i,o){return n[o].isInRange(i)})}})};function hoe(e){return(e%180+180)%180}var moe=function(t){var n=t.width,r=t.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=hoe(s),o=i*Math.PI/180,l=Math.atan(r/n),c=o>l&&o-1?s[i?t[o]:o]:void 0}}var boe=yoe,joe=Z3;function woe(e){var t=joe(e),n=t%1;return t===t?n?t-n:t:0}var Noe=woe,Soe=sO,koe=ua,Coe=Noe,_oe=Math.max;function Aoe(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:Coe(n);return s<0&&(s=_oe(r+s,0)),Soe(e,koe(t),s)}var Poe=Aoe,Eoe=boe,Ooe=Poe,Toe=Eoe(Ooe),$oe=Toe;const Moe=De($oe);var Roe=_z(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),yj=b.createContext(void 0),bj=b.createContext(void 0),uT=b.createContext(void 0),dT=b.createContext({}),fT=b.createContext(void 0),pT=b.createContext(0),hT=b.createContext(0),j5=function(t){var n=t.state,r=n.xAxisMap,s=n.yAxisMap,i=n.offset,o=t.clipPathId,l=t.children,c=t.width,u=t.height,d=Roe(i);return O.createElement(yj.Provider,{value:r},O.createElement(bj.Provider,{value:s},O.createElement(dT.Provider,{value:i},O.createElement(uT.Provider,{value:d},O.createElement(fT.Provider,{value:o},O.createElement(pT.Provider,{value:u},O.createElement(hT.Provider,{value:c},l)))))))},Doe=function(){return b.useContext(fT)},mT=function(t){var n=b.useContext(yj);n==null&&Ri();var r=n[t];return r==null&&Ri(),r},Ioe=function(){var t=b.useContext(yj);return Za(t)},Loe=function(){var t=b.useContext(bj),n=Moe(t,function(r){return rT(r.domain,Number.isFinite)});return n||Za(t)},xT=function(t){var n=b.useContext(bj);n==null&&Ri();var r=n[t];return r==null&&Ri(),r},zoe=function(){var t=b.useContext(uT);return t},Boe=function(){return b.useContext(dT)},jj=function(){return b.useContext(hT)},wj=function(){return b.useContext(pT)};function fl(e){"@babel/helpers - typeof";return fl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fl(e)}function Foe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Voe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne*s)return!1;var i=n();return e*(t-e*i/2-r)>=0&&e*(t+e*i/2-s)<=0}function Nle(e,t){return NT(e,t+1)}function Sle(e,t,n,r,s){for(var i=(r||[]).slice(),o=t.start,l=t.end,c=0,u=1,d=o,f=function(){var m=r==null?void 0:r[c];if(m===void 0)return{v:NT(r,u)};var v=c,x,y=function(){return x===void 0&&(x=n(m,v)),x},g=m.coordinate,j=c===0||Th(e,g,y,d,l);j||(c=0,d=o,u+=1),j&&(d=g+e*(y()/2+s),c+=u)},p;u<=i.length;)if(p=f(),p)return p.v;return[]}function nd(e){"@babel/helpers - typeof";return nd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nd(e)}function P5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Jt(e){for(var t=1;t0?h.coordinate-x*e:h.coordinate})}else i[p]=h=Jt(Jt({},h),{},{tickCoord:h.coordinate});var y=Th(e,h.tickCoord,v,l,c);y&&(c=h.tickCoord-e*(v()/2+s),i[p]=Jt(Jt({},h),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return i}function Ple(e,t,n,r,s,i){var o=(r||[]).slice(),l=o.length,c=t.start,u=t.end;if(i){var d=r[l-1],f=n(d,l-1),p=e*(d.coordinate+e*f/2-u);o[l-1]=d=Jt(Jt({},d),{},{tickCoord:p>0?d.coordinate-p*e:d.coordinate});var h=Th(e,d.tickCoord,function(){return f},c,u);h&&(u=d.tickCoord-e*(f/2+s),o[l-1]=Jt(Jt({},d),{},{isShow:!0}))}for(var m=i?l-1:l,v=function(g){var j=o[g],N,w=function(){return N===void 0&&(N=n(j,g)),N};if(g===0){var S=e*(j.coordinate-e*w()/2-c);o[g]=j=Jt(Jt({},j),{},{tickCoord:S<0?j.coordinate-S*e:j.coordinate})}else o[g]=j=Jt(Jt({},j),{},{tickCoord:j.coordinate});var k=Th(e,j.tickCoord,w,c,u);k&&(c=j.tickCoord+e*(w()/2+s),o[g]=Jt(Jt({},j),{},{isShow:!0}))},x=0;x=2?ln(s[1].coordinate-s[0].coordinate):1,y=wle(i,x,h);return c==="equidistantPreserveStart"?Sle(x,y,v,s,o):(c==="preserveStart"||c==="preserveStartEnd"?p=Ple(x,y,v,s,o,c==="preserveStartEnd"):p=Ale(x,y,v,s,o),p.filter(function(g){return g.isShow}))}var Ele=["viewBox"],Ole=["viewBox"],Tle=["ticks"];function ml(e){"@babel/helpers - typeof";return ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ml(e)}function wo(){return wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $le(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Mle(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O5(e,t){for(var n=0;n0?c(this.props):c(h)),o<=0||l<=0||!m||!m.length?null:O.createElement(Ae,{className:Ne("recharts-cartesian-axis",u),ref:function(x){r.layerReference=x}},i&&this.renderAxisLine(),this.renderTicks(m,this.state.fontSize,this.state.letterSpacing),It.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,s,i){var o,l=Ne(s.className,"recharts-cartesian-axis-tick-value");return O.isValidElement(r)?o=O.cloneElement(r,St(St({},s),{},{className:l})):ve(r)?o=r(St(St({},s),{},{className:l})):o=O.createElement(Ti,wo({},s,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(b.Component);Cj(ql,"displayName","CartesianAxis");Cj(ql,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var Fle=["x1","y1","x2","y2","key"],Vle=["offset"];function Di(e){"@babel/helpers - typeof";return Di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Di(e)}function T5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function en(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Hle(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Kle=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,s=t.x,i=t.y,o=t.width,l=t.height,c=t.ry;return O.createElement("rect",{x:s,y:i,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function CT(e,t){var n;if(O.isValidElement(e))n=O.cloneElement(e,t);else if(ve(e))n=e(t);else{var r=t.x1,s=t.y1,i=t.x2,o=t.y2,l=t.key,c=$5(t,Fle),u=me(c,!1);u.offset;var d=$5(u,Vle);n=O.createElement("line",ci({},d,{x1:r,y1:s,x2:i,y2:o,fill:"none",key:l}))}return n}function Gle(e){var t=e.x,n=e.width,r=e.horizontal,s=r===void 0?!0:r,i=e.horizontalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var u=en(en({},e),{},{x1:t,y1:l,x2:t+n,y2:l,key:"line-".concat(c),index:c});return CT(s,u)});return O.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Xle(e){var t=e.y,n=e.height,r=e.vertical,s=r===void 0?!0:r,i=e.verticalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var u=en(en({},e),{},{x1:l,y1:t,x2:l,y2:t+n,key:"line-".concat(c),index:c});return CT(s,u)});return O.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Yle(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,s=e.y,i=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(p){return Math.round(p+s-s)}).sort(function(p,h){return p-h});s!==d[0]&&d.unshift(0);var f=d.map(function(p,h){var m=!d[h+1],v=m?s+o-p:d[h+1]-p;if(v<=0)return null;var x=h%t.length;return O.createElement("rect",{key:"react-".concat(h),y:p,x:r,height:v,width:i,stroke:"none",fill:t[x],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return O.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Qle(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,s=e.fillOpacity,i=e.x,o=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(p){return Math.round(p+i-i)}).sort(function(p,h){return p-h});i!==d[0]&&d.unshift(0);var f=d.map(function(p,h){var m=!d[h+1],v=m?i+l-p:d[h+1]-p;if(v<=0)return null;var x=h%r.length;return O.createElement("rect",{key:"react-".concat(h),x:p,y:o,width:v,height:c,stroke:"none",fill:r[x],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return O.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Jle=function(t,n){var r=t.xAxis,s=t.width,i=t.height,o=t.offset;return N3(kj(en(en(en({},ql.defaultProps),r),{},{ticks:ba(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.left,o.left+o.width,n)},Zle=function(t,n){var r=t.yAxis,s=t.width,i=t.height,o=t.offset;return N3(kj(en(en(en({},ql.defaultProps),r),{},{ticks:ba(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.top,o.top+o.height,n)},to={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function xl(e){var t,n,r,s,i,o,l=jj(),c=wj(),u=Boe(),d=en(en({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:to.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:to.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:to.horizontal,horizontalFill:(s=e.horizontalFill)!==null&&s!==void 0?s:to.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:to.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:to.verticalFill,x:ee(e.x)?e.x:u.left,y:ee(e.y)?e.y:u.top,width:ee(e.width)?e.width:u.width,height:ee(e.height)?e.height:u.height}),f=d.x,p=d.y,h=d.width,m=d.height,v=d.syncWithTicks,x=d.horizontalValues,y=d.verticalValues,g=Ioe(),j=Loe();if(!ee(h)||h<=0||!ee(m)||m<=0||!ee(f)||f!==+f||!ee(p)||p!==+p)return null;var N=d.verticalCoordinatesGenerator||Jle,w=d.horizontalCoordinatesGenerator||Zle,S=d.horizontalPoints,k=d.verticalPoints;if((!S||!S.length)&&ve(w)){var C=x&&x.length,_=w({yAxis:j?en(en({},j),{},{ticks:C?x:j.ticks}):void 0,width:l,height:c,offset:u},C?!0:v);Or(Array.isArray(_),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Di(_),"]")),Array.isArray(_)&&(S=_)}if((!k||!k.length)&&ve(N)){var A=y&&y.length,E=N({xAxis:g?en(en({},g),{},{ticks:A?y:g.ticks}):void 0,width:l,height:c,offset:u},A?!0:v);Or(Array.isArray(E),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Di(E),"]")),Array.isArray(E)&&(k=E)}return O.createElement("g",{className:"recharts-cartesian-grid"},O.createElement(Kle,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),O.createElement(Gle,ci({},d,{offset:u,horizontalPoints:S,xAxis:g,yAxis:j})),O.createElement(Xle,ci({},d,{offset:u,verticalPoints:k,xAxis:g,yAxis:j})),O.createElement(Yle,ci({},d,{horizontalPoints:S})),O.createElement(Qle,ci({},d,{verticalPoints:k})))}xl.displayName="CartesianGrid";var ece=["type","layout","connectNulls","ref"],tce=["key"];function gl(e){"@babel/helpers - typeof";return gl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gl(e)}function M5(e,t){if(e==null)return{};var n=nce(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function nce(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function qc(){return qc=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);nf){h=[].concat(no(c.slice(0,m)),[f-v]);break}var x=h.length%2===0?[0,p]:[p];return[].concat(no(t.repeat(c,d)),no(h),x).map(function(y){return"".concat(y,"px")}).join(", ")}),Nr(n,"id",Hi("recharts-line-")),Nr(n,"pathRef",function(o){n.mainCurve=o}),Nr(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),Nr(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return fce(t,e),lce(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.points,l=i.xAxis,c=i.yAxis,u=i.layout,d=i.children,f=zn(d,Sd);if(!f)return null;var p=function(v,x){return{x:v.x,y:v.y,value:v.value,errorVal:mt(v.payload,x)}},h={clipPath:r?"url(#clipPath-".concat(s,")"):null};return O.createElement(Ae,h,f.map(function(m){return O.cloneElement(m,{key:"bar-".concat(m.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,dataPointFormatter:p})}))}},{key:"renderDots",value:function(r,s,i){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,u=l.points,d=l.dataKey,f=me(this.props,!1),p=me(c,!0),h=u.map(function(v,x){var y=On(On(On({key:"dot-".concat(x),r:3},f),p),{},{index:x,cx:v.x,cy:v.y,value:v.value,dataKey:d,payload:v.payload,points:u});return t.renderDotItem(c,y)}),m={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(i,")"):null};return O.createElement(Ae,qc({className:"recharts-line-dots",key:"dots"},m),h)}},{key:"renderCurveStatically",value:function(r,s,i,o){var l=this.props,c=l.type,u=l.layout,d=l.connectNulls;l.ref;var f=M5(l,ece),p=On(On(On({},me(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(i,")"):null,points:r},o),{},{type:c,layout:u,connectNulls:d});return O.createElement(yi,qc({},p,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,s){var i=this,o=this.props,l=o.points,c=o.strokeDasharray,u=o.isAnimationActive,d=o.animationBegin,f=o.animationDuration,p=o.animationEasing,h=o.animationId,m=o.animateNewValues,v=o.width,x=o.height,y=this.state,g=y.prevPoints,j=y.totalLength;return O.createElement(Dr,{begin:d,duration:f,isActive:u,easing:p,from:{t:0},to:{t:1},key:"line-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var w=N.t;if(g){var S=g.length/l.length,k=l.map(function(P,D){var I=Math.floor(D*S);if(g[I]){var R=g[I],M=At(R.x,P.x),W=At(R.y,P.y);return On(On({},P),{},{x:M(w),y:W(w)})}if(m){var T=At(v*2,P.x),V=At(x/2,P.y);return On(On({},P),{},{x:T(w),y:V(w)})}return On(On({},P),{},{x:P.x,y:P.y})});return i.renderCurveStatically(k,r,s)}var C=At(0,j),_=C(w),A;if(c){var E="".concat(c).split(/[,\s]+/gim).map(function(P){return parseFloat(P)});A=i.getStrokeDasharray(_,j,E)}else A=i.generateSimpleStrokeDasharray(j,_);return i.renderCurveStatically(l,r,s,{strokeDasharray:A})})}},{key:"renderCurve",value:function(r,s){var i=this.props,o=i.points,l=i.isAnimationActive,c=this.state,u=c.prevPoints,d=c.totalLength;return l&&o&&o.length&&(!u&&d>0||!$i(u,o))?this.renderCurveWithAnimation(r,s):this.renderCurveStatically(o,r,s)}},{key:"render",value:function(){var r,s=this.props,i=s.hide,o=s.dot,l=s.points,c=s.className,u=s.xAxis,d=s.yAxis,f=s.top,p=s.left,h=s.width,m=s.height,v=s.isAnimationActive,x=s.id;if(i||!l||!l.length)return null;var y=this.state.isAnimationFinished,g=l.length===1,j=Ne("recharts-line",c),N=u&&u.allowDataOverflow,w=d&&d.allowDataOverflow,S=N||w,k=je(x)?this.id:x,C=(r=me(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},_=C.r,A=_===void 0?3:_,E=C.strokeWidth,P=E===void 0?2:E,D=xE(o)?o:{},I=D.clipDot,R=I===void 0?!0:I,M=A*2+P;return O.createElement(Ae,{className:j},N||w?O.createElement("defs",null,O.createElement("clipPath",{id:"clipPath-".concat(k)},O.createElement("rect",{x:N?p:p-h/2,y:w?f:f-m/2,width:N?h:h*2,height:w?m:m*2})),!R&&O.createElement("clipPath",{id:"clipPath-dots-".concat(k)},O.createElement("rect",{x:p-M/2,y:f-M/2,width:h+M,height:m+M}))):null,!g&&this.renderCurve(S,k),this.renderErrorBar(S,k),(g||o)&&this.renderDots(S,R,k),(!v||y)&&Zr.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,s){for(var i=r.length%2!==0?[].concat(no(r),[0]):r,o=[],l=0;l=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xce(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ui(){return ui=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!$i(d,o)||!$i(f,l))?this.renderAreaWithAnimation(r,s):this.renderAreaStatically(o,l,r,s)}},{key:"render",value:function(){var r,s=this.props,i=s.hide,o=s.dot,l=s.points,c=s.className,u=s.top,d=s.left,f=s.xAxis,p=s.yAxis,h=s.width,m=s.height,v=s.isAnimationActive,x=s.id;if(i||!l||!l.length)return null;var y=this.state.isAnimationFinished,g=l.length===1,j=Ne("recharts-area",c),N=f&&f.allowDataOverflow,w=p&&p.allowDataOverflow,S=N||w,k=je(x)?this.id:x,C=(r=me(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},_=C.r,A=_===void 0?3:_,E=C.strokeWidth,P=E===void 0?2:E,D=xE(o)?o:{},I=D.clipDot,R=I===void 0?!0:I,M=A*2+P;return O.createElement(Ae,{className:j},N||w?O.createElement("defs",null,O.createElement("clipPath",{id:"clipPath-".concat(k)},O.createElement("rect",{x:N?d:d-h/2,y:w?u:u-m/2,width:N?h:h*2,height:w?m:m*2})),!R&&O.createElement("clipPath",{id:"clipPath-dots-".concat(k)},O.createElement("rect",{x:d-M/2,y:u-M/2,width:h+M,height:m+M}))):null,g?null:this.renderArea(S,k),(o||g)&&this.renderDots(S,R,k),(!v||y)&&Zr.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:s.curPoints,prevBaseLine:s.curBaseLine}:r.points!==s.curPoints||r.baseLine!==s.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(b.PureComponent);PT=za;Gr(za,"displayName","Area");Gr(za,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Ms.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Gr(za,"getBaseValue",function(e,t,n,r){var s=e.layout,i=e.baseValue,o=t.props.baseValue,l=o??i;if(ee(l)&&typeof l=="number")return l;var c=s==="horizontal"?r:n,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});Gr(za,"getComposedData",function(e){var t=e.props,n=e.item,r=e.xAxis,s=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,l=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,p=e.offset,h=t.layout,m=u&&u.length,v=PT.getBaseValue(t,n,r,s),x=h==="horizontal",y=!1,g=f.map(function(N,w){var S;m?S=u[d+w]:(S=mt(N,c),Array.isArray(S)?y=!0:S=[v,S]);var k=S[1]==null||m&&mt(N,c)==null;return x?{x:uh({axis:r,ticks:i,bandSize:l,entry:N,index:w}),y:k?null:s.scale(S[1]),value:S,payload:N}:{x:k?null:r.scale(S[1]),y:uh({axis:s,ticks:o,bandSize:l,entry:N,index:w}),value:S,payload:N}}),j;return m||y?j=g.map(function(N){var w=Array.isArray(N.value)?N.value[0]:null;return x?{x:N.x,y:w!=null&&N.y!=null?s.scale(w):null}:{x:w!=null?r.scale(w):null,y:N.y}}):j=x?s.scale(v):r.scale(v),Ua({points:g,baseLine:j,layout:h,isRange:y},p)});Gr(za,"renderDotItem",function(e,t){var n;if(O.isValidElement(e))n=O.cloneElement(e,t);else if(ve(e))n=e(t);else{var r=Ne("recharts-area-dot",typeof e!="boolean"?e.className:""),s=t.key,i=ET(t,mce);n=O.createElement(kd,ui({},i,{key:s,className:r}))}return n});function yl(e){"@babel/helpers - typeof";return yl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yl(e)}function Sce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kce(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function due(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function fue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pue(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?o:t&&t.length&&ee(s)&&ee(i)?t.slice(s,i+1):[]};function HT(e){return e==="number"?[0,"auto"]:void 0}var My=function(t,n,r,s){var i=t.graphicalItems,o=t.tooltipAxis,l=ux(n,t);return r<0||!i||!i.length||r>=l.length?null:i.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var p;if(o.dataKey&&!o.allowDuplicatedCategory){var h=f===void 0?l:f;p=Rp(h,o.dataKey,s)}else p=f&&f[r]||l[r];return p?[].concat(wl(c),[A3(u,p)]):c},[])},W5=function(t,n,r,s){var i=s||{x:t.chartX,y:t.chartY},o=kue(i,r),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=$ee(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,p=My(t,n,d,f),h=Cue(r,l,d,i);return{activeTooltipIndex:d,activeLabel:f,activePayload:p,activeCoordinate:h}}return null},_ue=function(t,n){var r=n.axes,s=n.graphicalItems,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,p=t.stackOffset,h=w3(d,i);return r.reduce(function(m,v){var x,y=v.type.defaultProps!==void 0?J(J({},v.type.defaultProps),v.props):v.props,g=y.type,j=y.dataKey,N=y.allowDataOverflow,w=y.allowDuplicatedCategory,S=y.scale,k=y.ticks,C=y.includeHidden,_=y[o];if(m[_])return m;var A=ux(t.data,{graphicalItems:s.filter(function(L){var B,ae=o in L.props?L.props[o]:(B=L.type.defaultProps)===null||B===void 0?void 0:B[o];return ae===_}),dataStartIndex:c,dataEndIndex:u}),E=A.length,P,D,I;Zce(y.domain,N,g)&&(P=Kv(y.domain,null,N),h&&(g==="number"||S!=="auto")&&(I=Fc(A,j,"category")));var R=HT(g);if(!P||P.length===0){var M,W=(M=y.domain)!==null&&M!==void 0?M:R;if(j){if(P=Fc(A,j,g),g==="category"&&h){var T=N7(P);w&&T?(D=P,P=Sh(0,E)):w||(P=pk(W,P,v).reduce(function(L,B){return L.indexOf(B)>=0?L:[].concat(wl(L),[B])},[]))}else if(g==="category")w?P=P.filter(function(L){return L!==""&&!je(L)}):P=pk(W,P,v).reduce(function(L,B){return L.indexOf(B)>=0||B===""||je(B)?L:[].concat(wl(L),[B])},[]);else if(g==="number"){var V=Lee(A,s.filter(function(L){var B,ae,se=o in L.props?L.props[o]:(B=L.type.defaultProps)===null||B===void 0?void 0:B[o],xe="hide"in L.props?L.props.hide:(ae=L.type.defaultProps)===null||ae===void 0?void 0:ae.hide;return se===_&&(C||!xe)}),j,i,d);V&&(P=V)}h&&(g==="number"||S!=="auto")&&(I=Fc(A,j,"category"))}else h?P=Sh(0,E):l&&l[_]&&l[_].hasStack&&g==="number"?P=p==="expand"?[0,1]:_3(l[_].stackGroups,c,u):P=j3(A,s.filter(function(L){var B=o in L.props?L.props[o]:L.type.defaultProps[o],ae="hide"in L.props?L.props.hide:L.type.defaultProps.hide;return B===_&&(C||!ae)}),g,d,!0);if(g==="number")P=Oy(f,P,_,i,k),W&&(P=Kv(W,P,N));else if(g==="category"&&W){var X=W,U=P.every(function(L){return X.indexOf(L)>=0});U&&(P=X)}}return J(J({},m),{},ge({},_,J(J({},y),{},{axisType:i,domain:P,categoricalDomain:I,duplicateDomain:D,originalDomain:(x=y.domain)!==null&&x!==void 0?x:R,isCategorical:h,layout:d})))},{})},Aue=function(t,n){var r=n.graphicalItems,s=n.Axis,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,p=ux(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),h=p.length,m=w3(d,i),v=-1;return r.reduce(function(x,y){var g=y.type.defaultProps!==void 0?J(J({},y.type.defaultProps),y.props):y.props,j=g[o],N=HT("number");if(!x[j]){v++;var w;return m?w=Sh(0,h):l&&l[j]&&l[j].hasStack?(w=_3(l[j].stackGroups,c,u),w=Oy(f,w,j,i)):(w=Kv(N,j3(p,r.filter(function(S){var k,C,_=o in S.props?S.props[o]:(k=S.type.defaultProps)===null||k===void 0?void 0:k[o],A="hide"in S.props?S.props.hide:(C=S.type.defaultProps)===null||C===void 0?void 0:C.hide;return _===j&&!A}),"number",d),s.defaultProps.allowDataOverflow),w=Oy(f,w,j,i)),J(J({},x),{},ge({},j,J(J({axisType:i},s.defaultProps),{},{hide:!0,orientation:Ln(Nue,"".concat(i,".").concat(v%2),null),domain:w,originalDomain:N,isCategorical:m,layout:d})))}return x},{})},Pue=function(t,n){var r=n.axisType,s=r===void 0?"xAxis":r,i=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.children,f="".concat(s,"Id"),p=zn(d,i),h={};return p&&p.length?h=_ue(t,{axes:p,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(h=Aue(t,{Axis:i,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),h},Eue=function(t){var n=Za(t),r=ba(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:U1(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:dh(n,r)}},q5=function(t){var n=t.children,r=t.defaultShowTooltip,s=Mn(n,ul),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(i=s.props.startIndex),s.props.endIndex>=0&&(o=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},Oue=function(t){return!t||!t.length?!1:t.some(function(n){var r=Na(n&&n.type);return r&&r.indexOf("Bar")>=0})},H5=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Tue=function(t,n){var r=t.props,s=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,p=r.margin||{},h=Mn(f,ul),m=Mn(f,ms),v=Object.keys(c).reduce(function(w,S){var k=c[S],C=k.orientation;return!k.mirror&&!k.hide?J(J({},w),{},ge({},C,w[C]+k.width)):w},{left:p.left||0,right:p.right||0}),x=Object.keys(o).reduce(function(w,S){var k=o[S],C=k.orientation;return!k.mirror&&!k.hide?J(J({},w),{},ge({},C,Ln(w,"".concat(C))+k.height)):w},{top:p.top||0,bottom:p.bottom||0}),y=J(J({},x),v),g=y.bottom;h&&(y.bottom+=h.props.height||ul.defaultProps.height),m&&n&&(y=Dee(y,s,r,n));var j=u-y.left-y.right,N=d-y.top-y.bottom;return J(J({brushBottom:g},y),{},{width:Math.max(j,0),height:Math.max(N,0)})},$ue=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},dx=function(t){var n=t.chartName,r=t.GraphicalChild,s=t.defaultTooltipEventType,i=s===void 0?"axis":s,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,p=function(y,g){var j=g.graphicalItems,N=g.stackGroups,w=g.offset,S=g.updateId,k=g.dataStartIndex,C=g.dataEndIndex,_=y.barSize,A=y.layout,E=y.barGap,P=y.barCategoryGap,D=y.maxBarSize,I=H5(A),R=I.numericAxisName,M=I.cateAxisName,W=Oue(j),T=[];return j.forEach(function(V,X){var U=ux(y.data,{graphicalItems:[V],dataStartIndex:k,dataEndIndex:C}),L=V.type.defaultProps!==void 0?J(J({},V.type.defaultProps),V.props):V.props,B=L.dataKey,ae=L.maxBarSize,se=L["".concat(R,"Id")],xe=L["".concat(M,"Id")],H={},le=c.reduce(function(bn,jn){var Wn=g["".concat(jn.axisType,"Map")],ne=L["".concat(jn.axisType,"Id")];Wn&&Wn[ne]||jn.axisType==="zAxis"||Ri();var Se=Wn[ne];return J(J({},bn),{},ge(ge({},jn.axisType,Se),"".concat(jn.axisType,"Ticks"),ba(Se)))},H),Z=le[M],F=le["".concat(M,"Ticks")],z=N&&N[se]&&N[se].hasStack&&Kee(V,N[se].stackGroups),q=Na(V.type).indexOf("Bar")>=0,ie=dh(Z,F),oe=[],we=W&&Mee({barSize:_,stackGroups:N,totalSize:$ue(le,M)});if(q){var Ee,ze,gn=je(ae)?D:ae,vn=(Ee=(ze=dh(Z,F,!0))!==null&&ze!==void 0?ze:gn)!==null&&Ee!==void 0?Ee:0;oe=Ree({barGap:E,barCategoryGap:P,bandSize:vn!==ie?vn:ie,sizeList:we[xe],maxBarSize:gn}),vn!==ie&&(oe=oe.map(function(bn){return J(J({},bn),{},{position:J(J({},bn.position),{},{offset:bn.position.offset-vn/2})})}))}var yn=V&&V.type&&V.type.getComposedData;yn&&T.push({props:J(J({},yn(J(J({},le),{},{displayedData:U,props:y,dataKey:B,item:V,bandSize:ie,barPosition:oe,offset:w,stackedData:z,layout:A,dataStartIndex:k,dataEndIndex:C}))),{},ge(ge(ge({key:V.key||"item-".concat(X)},R,le[R]),M,le[M]),"animationId",S)),childIndex:R7(V,y.children),item:V})}),T},h=function(y,g){var j=y.props,N=y.dataStartIndex,w=y.dataEndIndex,S=y.updateId;if(!oN({props:j}))return null;var k=j.children,C=j.layout,_=j.stackOffset,A=j.data,E=j.reverseStackOrder,P=H5(C),D=P.numericAxisName,I=P.cateAxisName,R=zn(k,r),M=qee(A,R,"".concat(D,"Id"),"".concat(I,"Id"),_,E),W=c.reduce(function(L,B){var ae="".concat(B.axisType,"Map");return J(J({},L),{},ge({},ae,Pue(j,J(J({},B),{},{graphicalItems:R,stackGroups:B.axisType===D&&M,dataStartIndex:N,dataEndIndex:w}))))},{}),T=Tue(J(J({},W),{},{props:j,graphicalItems:R}),g==null?void 0:g.legendBBox);Object.keys(W).forEach(function(L){W[L]=d(j,W[L],T,L.replace("Map",""),n)});var V=W["".concat(I,"Map")],X=Eue(V),U=p(j,J(J({},W),{},{dataStartIndex:N,dataEndIndex:w,updateId:S,graphicalItems:R,stackGroups:M,offset:T}));return J(J({formattedGraphicalItems:U,graphicalItems:R,offset:T,stackGroups:M},X),W)},m=function(x){function y(g){var j,N,w;return fue(this,y),w=mue(this,y,[g]),ge(w,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ge(w,"accessibilityManager",new Jce),ge(w,"handleLegendBBoxUpdate",function(S){if(S){var k=w.state,C=k.dataStartIndex,_=k.dataEndIndex,A=k.updateId;w.setState(J({legendBBox:S},h({props:w.props,dataStartIndex:C,dataEndIndex:_,updateId:A},J(J({},w.state),{},{legendBBox:S}))))}}),ge(w,"handleReceiveSyncEvent",function(S,k,C){if(w.props.syncId===S){if(C===w.eventEmitterSymbol&&typeof w.props.syncMethod!="function")return;w.applySyncEvent(k)}}),ge(w,"handleBrushChange",function(S){var k=S.startIndex,C=S.endIndex;if(k!==w.state.dataStartIndex||C!==w.state.dataEndIndex){var _=w.state.updateId;w.setState(function(){return J({dataStartIndex:k,dataEndIndex:C},h({props:w.props,dataStartIndex:k,dataEndIndex:C,updateId:_},w.state))}),w.triggerSyncEvent({dataStartIndex:k,dataEndIndex:C})}}),ge(w,"handleMouseEnter",function(S){var k=w.getMouseInfo(S);if(k){var C=J(J({},k),{},{isTooltipActive:!0});w.setState(C),w.triggerSyncEvent(C);var _=w.props.onMouseEnter;ve(_)&&_(C,S)}}),ge(w,"triggeredAfterMouseMove",function(S){var k=w.getMouseInfo(S),C=k?J(J({},k),{},{isTooltipActive:!0}):{isTooltipActive:!1};w.setState(C),w.triggerSyncEvent(C);var _=w.props.onMouseMove;ve(_)&&_(C,S)}),ge(w,"handleItemMouseEnter",function(S){w.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),ge(w,"handleItemMouseLeave",function(){w.setState(function(){return{isTooltipActive:!1}})}),ge(w,"handleMouseMove",function(S){S.persist(),w.throttleTriggeredAfterMouseMove(S)}),ge(w,"handleMouseLeave",function(S){w.throttleTriggeredAfterMouseMove.cancel();var k={isTooltipActive:!1};w.setState(k),w.triggerSyncEvent(k);var C=w.props.onMouseLeave;ve(C)&&C(k,S)}),ge(w,"handleOuterEvent",function(S){var k=M7(S),C=Ln(w.props,"".concat(k));if(k&&ve(C)){var _,A;/.*touch.*/i.test(k)?A=w.getMouseInfo(S.changedTouches[0]):A=w.getMouseInfo(S),C((_=A)!==null&&_!==void 0?_:{},S)}}),ge(w,"handleClick",function(S){var k=w.getMouseInfo(S);if(k){var C=J(J({},k),{},{isTooltipActive:!0});w.setState(C),w.triggerSyncEvent(C);var _=w.props.onClick;ve(_)&&_(C,S)}}),ge(w,"handleMouseDown",function(S){var k=w.props.onMouseDown;if(ve(k)){var C=w.getMouseInfo(S);k(C,S)}}),ge(w,"handleMouseUp",function(S){var k=w.props.onMouseUp;if(ve(k)){var C=w.getMouseInfo(S);k(C,S)}}),ge(w,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&w.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),ge(w,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&w.handleMouseDown(S.changedTouches[0])}),ge(w,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&w.handleMouseUp(S.changedTouches[0])}),ge(w,"handleDoubleClick",function(S){var k=w.props.onDoubleClick;if(ve(k)){var C=w.getMouseInfo(S);k(C,S)}}),ge(w,"handleContextMenu",function(S){var k=w.props.onContextMenu;if(ve(k)){var C=w.getMouseInfo(S);k(C,S)}}),ge(w,"triggerSyncEvent",function(S){w.props.syncId!==void 0&&k0.emit(C0,w.props.syncId,S,w.eventEmitterSymbol)}),ge(w,"applySyncEvent",function(S){var k=w.props,C=k.layout,_=k.syncMethod,A=w.state.updateId,E=S.dataStartIndex,P=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)w.setState(J({dataStartIndex:E,dataEndIndex:P},h({props:w.props,dataStartIndex:E,dataEndIndex:P,updateId:A},w.state)));else if(S.activeTooltipIndex!==void 0){var D=S.chartX,I=S.chartY,R=S.activeTooltipIndex,M=w.state,W=M.offset,T=M.tooltipTicks;if(!W)return;if(typeof _=="function")R=_(T,S);else if(_==="value"){R=-1;for(var V=0;V=0){var z,q;if(D.dataKey&&!D.allowDuplicatedCategory){var ie=typeof D.dataKey=="function"?F:"payload.".concat(D.dataKey.toString());z=Rp(V,ie,R),q=X&&U&&Rp(U,ie,R)}else z=V==null?void 0:V[I],q=X&&U&&U[I];if(xe||se){var oe=S.props.activeIndex!==void 0?S.props.activeIndex:I;return[b.cloneElement(S,J(J(J({},_.props),le),{},{activeIndex:oe})),null,null]}if(!je(z))return[Z].concat(wl(w.renderActivePoints({item:_,activePoint:z,basePoint:q,childIndex:I,isRange:X})))}else{var we,Ee=(we=w.getItemByXY(w.state.activeCoordinate))!==null&&we!==void 0?we:{graphicalItem:Z},ze=Ee.graphicalItem,gn=ze.item,vn=gn===void 0?S:gn,yn=ze.childIndex,bn=J(J(J({},_.props),le),{},{activeIndex:yn});return[b.cloneElement(vn,bn),null,null]}return X?[Z,null,null]:[Z,null]}),ge(w,"renderCustomized",function(S,k,C){return b.cloneElement(S,J(J({key:"recharts-customized-".concat(C)},w.props),w.state))}),ge(w,"renderMap",{CartesianGrid:{handler:gf,once:!0},ReferenceArea:{handler:w.renderReferenceElement},ReferenceLine:{handler:gf},ReferenceDot:{handler:w.renderReferenceElement},XAxis:{handler:gf},YAxis:{handler:gf},Brush:{handler:w.renderBrush,once:!0},Bar:{handler:w.renderGraphicChild},Line:{handler:w.renderGraphicChild},Area:{handler:w.renderGraphicChild},Radar:{handler:w.renderGraphicChild},RadialBar:{handler:w.renderGraphicChild},Scatter:{handler:w.renderGraphicChild},Pie:{handler:w.renderGraphicChild},Funnel:{handler:w.renderGraphicChild},Tooltip:{handler:w.renderCursor,once:!0},PolarGrid:{handler:w.renderPolarGrid,once:!0},PolarAngleAxis:{handler:w.renderPolarAxis},PolarRadiusAxis:{handler:w.renderPolarAxis},Customized:{handler:w.renderCustomized}}),w.clipPathId="".concat((j=g.id)!==null&&j!==void 0?j:Hi("recharts"),"-clip"),w.throttleTriggeredAfterMouseMove=yO(w.triggeredAfterMouseMove,(N=g.throttleDelay)!==null&&N!==void 0?N:1e3/60),w.state={},w}return vue(y,x),hue(y,[{key:"componentDidMount",value:function(){var j,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var j=this.props,N=j.children,w=j.data,S=j.height,k=j.layout,C=Mn(N,on);if(C){var _=C.props.defaultIndex;if(!(typeof _!="number"||_<0||_>this.state.tooltipTicks.length-1)){var A=this.state.tooltipTicks[_]&&this.state.tooltipTicks[_].value,E=My(this.state,w,_,A),P=this.state.tooltipTicks[_].coordinate,D=(this.state.offset.top+S)/2,I=k==="horizontal",R=I?{x:P,y:D}:{y:P,x:D},M=this.state.formattedGraphicalItems.find(function(T){var V=T.item;return V.type.name==="Scatter"});M&&(R=J(J({},R),M.props.points[_].tooltipPosition),E=M.props.points[_].tooltipPayload);var W={activeTooltipIndex:_,isTooltipActive:!0,activeLabel:A,activePayload:E,activeCoordinate:R};this.setState(W),this.renderCursor(C),this.accessibilityManager.setIndex(_)}}}},{key:"getSnapshotBeforeUpdate",value:function(j,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==j.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==j.margin){var w,S;this.accessibilityManager.setDetails({offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(j){lv([Mn(j.children,on)],[Mn(this.props.children,on)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var j=Mn(this.props.children,on);if(j&&typeof j.props.shared=="boolean"){var N=j.props.shared?"axis":"item";return l.indexOf(N)>=0?N:i}return i}},{key:"getMouseInfo",value:function(j){if(!this.container)return null;var N=this.container,w=N.getBoundingClientRect(),S=oY(w),k={chartX:Math.round(j.pageX-S.left),chartY:Math.round(j.pageY-S.top)},C=w.width/N.offsetWidth||1,_=this.inRange(k.chartX,k.chartY,C);if(!_)return null;var A=this.state,E=A.xAxisMap,P=A.yAxisMap,D=this.getTooltipEventType(),I=W5(this.state,this.props.data,this.props.layout,_);if(D!=="axis"&&E&&P){var R=Za(E).scale,M=Za(P).scale,W=R&&R.invert?R.invert(k.chartX):null,T=M&&M.invert?M.invert(k.chartY):null;return J(J({},k),{},{xValue:W,yValue:T},I)}return I?J(J({},k),I):null}},{key:"inRange",value:function(j,N){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,k=j/w,C=N/w;if(S==="horizontal"||S==="vertical"){var _=this.state.offset,A=k>=_.left&&k<=_.left+_.width&&C>=_.top&&C<=_.top+_.height;return A?{x:k,y:C}:null}var E=this.state,P=E.angleAxisMap,D=E.radiusAxisMap;if(P&&D){var I=Za(P);return xk({x:k,y:C},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var j=this.props.children,N=this.getTooltipEventType(),w=Mn(j,on),S={};w&&N==="axis"&&(w.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var k=Dp(this.props,this.handleOuterEvent);return J(J({},k),S)}},{key:"addListener",value:function(){k0.on(C0,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){k0.removeListener(C0,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(j,N,w){for(var S=this.state.formattedGraphicalItems,k=0,C=S.length;kt=>{const n=Due.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),zr=e=>(e=e.toLowerCase(),t=>px(t)===e),hx=e=>t=>typeof t===e,{isArray:Hl}=Array,Nl=hx("undefined");function _d(e){return e!==null&&!Nl(e)&&e.constructor!==null&&!Nl(e.constructor)&&An(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const QT=zr("ArrayBuffer");function Iue(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&QT(e.buffer),t}const Lue=hx("string"),An=hx("function"),JT=hx("number"),Ad=e=>e!==null&&typeof e=="object",zue=e=>e===!0||e===!1,qf=e=>{if(px(e)!=="object")return!1;const t=_j(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(YT in e)&&!(fx in e)},Bue=e=>{if(!Ad(e)||_d(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Fue=zr("Date"),Vue=zr("File"),Uue=e=>!!(e&&typeof e.uri<"u"),Wue=e=>e&&typeof e.getParts<"u",que=zr("Blob"),Hue=zr("FileList"),Kue=e=>Ad(e)&&An(e.pipe);function Gue(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const K5=Gue(),G5=typeof K5.FormData<"u"?K5.FormData:void 0,Xue=e=>{let t;return e&&(G5&&e instanceof G5||An(e.append)&&((t=px(e))==="formdata"||t==="object"&&An(e.toString)&&e.toString()==="[object FormData]"))},Yue=zr("URLSearchParams"),[Que,Jue,Zue,ede]=["ReadableStream","Request","Response","Headers"].map(zr),tde=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Pd(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Hl(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const di=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,e6=e=>!Nl(e)&&e!==di;function Ry(){const{caseless:e,skipUndefined:t}=e6(this)&&this||{},n={},r=(s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=e&&ZT(n,i)||i;qf(n[o])&&qf(s)?n[o]=Ry(n[o],s):qf(s)?n[o]=Ry({},s):Hl(s)?n[o]=s.slice():(!t||!Nl(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s(Pd(t,(s,i)=>{n&&An(s)?Object.defineProperty(e,i,{value:XT(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),rde=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ade=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},sde=(e,t,n,r)=>{let s,i,o;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&_j(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},ide=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},ode=e=>{if(!e)return null;if(Hl(e))return e;let t=e.length;if(!JT(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},lde=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&_j(Uint8Array)),cde=(e,t)=>{const r=(e&&e[fx]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},ude=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},dde=zr("HTMLFormElement"),fde=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),X5=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),pde=zr("RegExp"),t6=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Pd(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},hde=e=>{t6(e,(t,n)=>{if(An(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(An(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},mde=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Hl(e)?r(e):r(String(e).split(t)),n},xde=()=>{},gde=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function vde(e){return!!(e&&An(e.append)&&e[YT]==="FormData"&&e[fx])}const yde=e=>{const t=new Array(10),n=(r,s)=>{if(Ad(r)){if(t.indexOf(r)>=0)return;if(_d(r))return r;if(!("toJSON"in r)){t[s]=r;const i=Hl(r)?[]:{};return Pd(r,(o,l)=>{const c=n(o,s+1);!Nl(c)&&(i[l]=c)}),t[s]=void 0,i}}return r};return n(e,0)},bde=zr("AsyncFunction"),jde=e=>e&&(Ad(e)||An(e))&&An(e.then)&&An(e.catch),n6=((e,t)=>e?setImmediate:t?((n,r)=>(di.addEventListener("message",({source:s,data:i})=>{s===di&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),di.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",An(di.postMessage)),wde=typeof queueMicrotask<"u"?queueMicrotask.bind(di):typeof process<"u"&&process.nextTick||n6,Nde=e=>e!=null&&An(e[fx]),G={isArray:Hl,isArrayBuffer:QT,isBuffer:_d,isFormData:Xue,isArrayBufferView:Iue,isString:Lue,isNumber:JT,isBoolean:zue,isObject:Ad,isPlainObject:qf,isEmptyObject:Bue,isReadableStream:Que,isRequest:Jue,isResponse:Zue,isHeaders:ede,isUndefined:Nl,isDate:Fue,isFile:Vue,isReactNativeBlob:Uue,isReactNative:Wue,isBlob:que,isRegExp:pde,isFunction:An,isStream:Kue,isURLSearchParams:Yue,isTypedArray:lde,isFileList:Hue,forEach:Pd,merge:Ry,extend:nde,trim:tde,stripBOM:rde,inherits:ade,toFlatObject:sde,kindOf:px,kindOfTest:zr,endsWith:ide,toArray:ode,forEachEntry:cde,matchAll:ude,isHTMLForm:dde,hasOwnProperty:X5,hasOwnProp:X5,reduceDescriptors:t6,freezeMethods:hde,toObjectSet:mde,toCamelCase:fde,noop:xde,toFiniteNumber:gde,findKey:ZT,global:di,isContextDefined:e6,isSpecCompliantForm:vde,toJSONObject:yde,isAsyncFn:bde,isThenable:jde,setImmediate:n6,asap:wde,isIterable:Nde};let be=class r6 extends Error{static from(t,n,r,s,i,o){const l=new r6(t.message,n||t.code,r,s,i);return l.cause=t,l.name=t.name,t.status!=null&&l.status==null&&(l.status=t.status),o&&Object.assign(l,o),l}constructor(t,n,r,s,i){super(t),Object.defineProperty(this,"message",{value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:G.toJSONObject(this.config),code:this.code,status:this.status}}};be.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";be.ERR_BAD_OPTION="ERR_BAD_OPTION";be.ECONNABORTED="ECONNABORTED";be.ETIMEDOUT="ETIMEDOUT";be.ERR_NETWORK="ERR_NETWORK";be.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";be.ERR_DEPRECATED="ERR_DEPRECATED";be.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";be.ERR_BAD_REQUEST="ERR_BAD_REQUEST";be.ERR_CANCELED="ERR_CANCELED";be.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";be.ERR_INVALID_URL="ERR_INVALID_URL";const Sde=null;function Dy(e){return G.isPlainObject(e)||G.isArray(e)}function a6(e){return G.endsWith(e,"[]")?e.slice(0,-2):e}function A0(e,t,n){return e?e.concat(t).map(function(s,i){return s=a6(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function kde(e){return G.isArray(e)&&!e.some(Dy)}const Cde=G.toFlatObject(G,{},null,function(t){return/^is[A-Z]/.test(t)});function mx(e,t,n){if(!G.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=G.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,x){return!G.isUndefined(x[v])});const r=n.metaTokens,s=n.visitor||d,i=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&G.isSpecCompliantForm(t);if(!G.isFunction(s))throw new TypeError("visitor must be a function");function u(m){if(m===null)return"";if(G.isDate(m))return m.toISOString();if(G.isBoolean(m))return m.toString();if(!c&&G.isBlob(m))throw new be("Blob is not supported. Use a Buffer instead.");return G.isArrayBuffer(m)||G.isTypedArray(m)?c&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function d(m,v,x){let y=m;if(G.isReactNative(t)&&G.isReactNativeBlob(m))return t.append(A0(x,v,i),u(m)),!1;if(m&&!x&&typeof m=="object"){if(G.endsWith(v,"{}"))v=r?v:v.slice(0,-2),m=JSON.stringify(m);else if(G.isArray(m)&&kde(m)||(G.isFileList(m)||G.endsWith(v,"[]"))&&(y=G.toArray(m)))return v=a6(v),y.forEach(function(j,N){!(G.isUndefined(j)||j===null)&&t.append(o===!0?A0([v],N,i):o===null?v:v+"[]",u(j))}),!1}return Dy(m)?!0:(t.append(A0(x,v,i),u(m)),!1)}const f=[],p=Object.assign(Cde,{defaultVisitor:d,convertValue:u,isVisitable:Dy});function h(m,v){if(!G.isUndefined(m)){if(f.indexOf(m)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(m),G.forEach(m,function(y,g){(!(G.isUndefined(y)||y===null)&&s.call(t,y,G.isString(g)?g.trim():g,v,p))===!0&&h(y,v?v.concat(g):[g])}),f.pop()}}if(!G.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Y5(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Aj(e,t){this._pairs=[],e&&mx(e,this,t)}const s6=Aj.prototype;s6.append=function(t,n){this._pairs.push([t,n])};s6.toString=function(t){const n=t?function(r){return t.call(this,r,Y5)}:Y5;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function _de(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function i6(e,t,n){if(!t)return e;const r=n&&n.encode||_de,s=G.isFunction(n)?{serialize:n}:n,i=s&&s.serialize;let o;if(i?o=i(t,s):o=G.isURLSearchParams(t)?t.toString():new Aj(t,s).toString(r),o){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Q5{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){G.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Pj={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ade=typeof URLSearchParams<"u"?URLSearchParams:Aj,Pde=typeof FormData<"u"?FormData:null,Ede=typeof Blob<"u"?Blob:null,Ode={isBrowser:!0,classes:{URLSearchParams:Ade,FormData:Pde,Blob:Ede},protocols:["http","https","file","blob","url","data"]},Ej=typeof window<"u"&&typeof document<"u",Iy=typeof navigator=="object"&&navigator||void 0,Tde=Ej&&(!Iy||["ReactNative","NativeScript","NS"].indexOf(Iy.product)<0),$de=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Mde=Ej&&window.location.href||"http://localhost",Rde=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ej,hasStandardBrowserEnv:Tde,hasStandardBrowserWebWorkerEnv:$de,navigator:Iy,origin:Mde},Symbol.toStringTag,{value:"Module"})),tn={...Rde,...Ode};function Dde(e,t){return mx(e,new tn.classes.URLSearchParams,{visitor:function(n,r,s,i){return tn.isNode&&G.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Ide(e){return G.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Lde(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r=n.length;return o=!o&&G.isArray(s)?s.length:o,c?(G.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!G.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&G.isArray(s[o])&&(s[o]=Lde(s[o])),!l)}if(G.isFormData(e)&&G.isFunction(e.entries)){const n={};return G.forEachEntry(e,(r,s)=>{t(Ide(r),s,n,0)}),n}return null}function zde(e,t,n){if(G.isString(e))try{return(t||JSON.parse)(e),G.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Ed={transitional:Pj,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=G.isObject(t);if(i&&G.isHTMLForm(t)&&(t=new FormData(t)),G.isFormData(t))return s?JSON.stringify(o6(t)):t;if(G.isArrayBuffer(t)||G.isBuffer(t)||G.isStream(t)||G.isFile(t)||G.isBlob(t)||G.isReadableStream(t))return t;if(G.isArrayBufferView(t))return t.buffer;if(G.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Dde(t,this.formSerializer).toString();if((l=G.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return mx(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),zde(t)):t}],transformResponse:[function(t){const n=this.transitional||Ed.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(G.isResponse(t)||G.isReadableStream(t))return t;if(t&&G.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?be.from(l,be.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:tn.classes.FormData,Blob:tn.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};G.forEach(["delete","get","head","post","put","patch"],e=>{Ed.headers[e]={}});const Bde=G.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Fde=e=>{const t={};let n,r,s;return e&&e.split(` +`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Bde[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},J5=Symbol("internals"),Vde=e=>!/[\r\n]/.test(e);function l6(e,t){if(!(e===!1||e==null)){if(G.isArray(e)){e.forEach(n=>l6(n,t));return}if(!Vde(String(e)))throw new Error(`Invalid character in header content ["${t}"]`)}}function yc(e){return e&&String(e).trim().toLowerCase()}function Ude(e){let t=e.length;for(;t>0;){const n=e.charCodeAt(t-1);if(n!==10&&n!==13)break;t-=1}return t===e.length?e:e.slice(0,t)}function Hf(e){return e===!1||e==null?e:G.isArray(e)?e.map(Hf):Ude(String(e))}function Wde(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const qde=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function P0(e,t,n,r,s){if(G.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!G.isString(t)){if(G.isString(r))return t.indexOf(r)!==-1;if(G.isRegExp(r))return r.test(t)}}function Hde(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Kde(e,t){const n=G.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let Pn=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(l,c,u){const d=yc(c);if(!d)throw new Error("header name must be a non-empty string");const f=G.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(l6(l,c),s[f||c]=Hf(l))}const o=(l,c)=>G.forEach(l,(u,d)=>i(u,d,c));if(G.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(G.isString(t)&&(t=t.trim())&&!qde(t))o(Fde(t),n);else if(G.isObject(t)&&G.isIterable(t)){let l={},c,u;for(const d of t){if(!G.isArray(d))throw TypeError("Object iterator must return a key-value pair");l[u=d[0]]=(c=l[u])?G.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}o(l,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=yc(t),t){const r=G.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Wde(s);if(G.isFunction(n))return n.call(this,s,r);if(G.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=yc(t),t){const r=G.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||P0(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=yc(o),o){const l=G.findKey(r,o);l&&(!n||P0(r,r[l],l,n))&&(delete r[l],s=!0)}}return G.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||P0(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return G.forEach(this,(s,i)=>{const o=G.findKey(r,i);if(o){n[o]=Hf(s),delete n[i];return}const l=t?Hde(i):String(i).trim();l!==i&&delete n[i],n[l]=Hf(s),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return G.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&G.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[J5]=this[J5]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=yc(o);r[l]||(Kde(s,o),r[l]=!0)}return G.isArray(t)?t.forEach(i):i(t),this}};Pn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);G.reduceDescriptors(Pn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});G.freezeMethods(Pn);function E0(e,t){const n=this||Ed,r=t||n,s=Pn.from(r.headers);let i=r.data;return G.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function c6(e){return!!(e&&e.__CANCEL__)}let Od=class extends be{constructor(t,n,r){super(t??"canceled",be.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function u6(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new be("Request failed with status code "+n.status,[be.ERR_BAD_REQUEST,be.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Gde(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Xde(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[i];o||(o=u),n[s]=c,r[s]=u;let f=i,p=0;for(;f!==s;)p+=n[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o{n=d,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?o(u,d):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const zh=(e,t,n=3)=>{let r=0;const s=Xde(50,250);return Yde(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,c=o-r,u=s(c),d=o<=l;r=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},Z5=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},e4=e=>(...t)=>G.asap(()=>e(...t)),Qde=tn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,tn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(tn.origin),tn.navigator&&/(msie|trident)/i.test(tn.navigator.userAgent)):()=>!0,Jde=tn.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];G.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),G.isString(r)&&l.push(`path=${r}`),G.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),G.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Zde(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function efe(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function d6(e,t,n){let r=!Zde(t);return e&&(r||n==!1)?efe(e,t):t}const t4=e=>e instanceof Pn?{...e}:e;function Ii(e,t){t=t||{};const n={};function r(u,d,f,p){return G.isPlainObject(u)&&G.isPlainObject(d)?G.merge.call({caseless:p},u,d):G.isPlainObject(d)?G.merge({},d):G.isArray(d)?d.slice():d}function s(u,d,f,p){if(G.isUndefined(d)){if(!G.isUndefined(u))return r(void 0,u,f,p)}else return r(u,d,f,p)}function i(u,d){if(!G.isUndefined(d))return r(void 0,d)}function o(u,d){if(G.isUndefined(d)){if(!G.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,d,f)=>s(t4(u),t4(d),f,!0)};return G.forEach(Object.keys({...e,...t}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const f=G.hasOwnProp(c,d)?c[d]:s,p=f(e[d],t[d],d);G.isUndefined(p)&&f!==l||(n[d]=p)}),n}const f6=e=>{const t=Ii({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=Pn.from(o),t.url=i6(d6(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),G.isFormData(n)){if(tn.hasStandardBrowserEnv||tn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(G.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([d,f])=>{u.includes(d.toLowerCase())&&o.set(d,f)})}}if(tn.hasStandardBrowserEnv&&(r&&G.isFunction(r)&&(r=r(t)),r||r!==!1&&Qde(t.url))){const c=s&&i&&Jde.read(i);c&&o.set(s,c)}return t},tfe=typeof XMLHttpRequest<"u",nfe=tfe&&function(e){return new Promise(function(n,r){const s=f6(e);let i=s.data;const o=Pn.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=s,d,f,p,h,m;function v(){h&&h(),m&&m(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let x=new XMLHttpRequest;x.open(s.method.toUpperCase(),s.url,!0),x.timeout=s.timeout;function y(){if(!x)return;const j=Pn.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),w={data:!l||l==="text"||l==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:j,config:e,request:x};u6(function(k){n(k),v()},function(k){r(k),v()},w),x=null}"onloadend"in x?x.onloadend=y:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(y)},x.onabort=function(){x&&(r(new be("Request aborted",be.ECONNABORTED,e,x)),x=null)},x.onerror=function(N){const w=N&&N.message?N.message:"Network Error",S=new be(w,be.ERR_NETWORK,e,x);S.event=N||null,r(S),x=null},x.ontimeout=function(){let N=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const w=s.transitional||Pj;s.timeoutErrorMessage&&(N=s.timeoutErrorMessage),r(new be(N,w.clarifyTimeoutError?be.ETIMEDOUT:be.ECONNABORTED,e,x)),x=null},i===void 0&&o.setContentType(null),"setRequestHeader"in x&&G.forEach(o.toJSON(),function(N,w){x.setRequestHeader(w,N)}),G.isUndefined(s.withCredentials)||(x.withCredentials=!!s.withCredentials),l&&l!=="json"&&(x.responseType=s.responseType),u&&([p,m]=zh(u,!0),x.addEventListener("progress",p)),c&&x.upload&&([f,h]=zh(c),x.upload.addEventListener("progress",f),x.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(d=j=>{x&&(r(!j||j.type?new Od(null,e,x):j),x.abort(),x=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const g=Gde(s.url);if(g&&tn.protocols.indexOf(g)===-1){r(new be("Unsupported protocol "+g+":",be.ERR_BAD_REQUEST,e));return}x.send(i||null)})},rfe=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof be?d:new Od(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,i(new be(`timeout of ${t}ms exceeded`,be.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>G.asap(l),c}},afe=function*(e,t){let n=e.byteLength;if(n{const s=sfe(e,t);let i=0,o,l=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let p=i+=f;n(p)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},r4=64*1024,{isFunction:vf}=G,ofe=(({Request:e,Response:t})=>({Request:e,Response:t}))(G.global),{ReadableStream:a4,TextEncoder:s4}=G.global,i4=(e,...t)=>{try{return!!e(...t)}catch{return!1}},lfe=e=>{e=G.merge.call({skipUndefined:!0},ofe,e);const{fetch:t,Request:n,Response:r}=e,s=t?vf(t):typeof fetch=="function",i=vf(n),o=vf(r);if(!s)return!1;const l=s&&vf(a4),c=s&&(typeof s4=="function"?(m=>v=>m.encode(v))(new s4):async m=>new Uint8Array(await new n(m).arrayBuffer())),u=i&&l&&i4(()=>{let m=!1;const v=new a4,x=new n(tn.origin,{body:v,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return v.cancel(),m&&!x}),d=o&&l&&i4(()=>G.isReadableStream(new r("").body)),f={stream:d&&(m=>m.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!f[m]&&(f[m]=(v,x)=>{let y=v&&v[m];if(y)return y.call(v);throw new be(`Response type '${m}' is not supported`,be.ERR_NOT_SUPPORT,x)})});const p=async m=>{if(m==null)return 0;if(G.isBlob(m))return m.size;if(G.isSpecCompliantForm(m))return(await new n(tn.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(G.isArrayBufferView(m)||G.isArrayBuffer(m))return m.byteLength;if(G.isURLSearchParams(m)&&(m=m+""),G.isString(m))return(await c(m)).byteLength},h=async(m,v)=>{const x=G.toFiniteNumber(m.getContentLength());return x??p(v)};return async m=>{let{url:v,method:x,data:y,signal:g,cancelToken:j,timeout:N,onDownloadProgress:w,onUploadProgress:S,responseType:k,headers:C,withCredentials:_="same-origin",fetchOptions:A}=f6(m),E=t||fetch;k=k?(k+"").toLowerCase():"text";let P=rfe([g,j&&j.toAbortSignal()],N),D=null;const I=P&&P.unsubscribe&&(()=>{P.unsubscribe()});let R;try{if(S&&u&&x!=="get"&&x!=="head"&&(R=await h(C,y))!==0){let U=new n(v,{method:"POST",body:y,duplex:"half"}),L;if(G.isFormData(y)&&(L=U.headers.get("content-type"))&&C.setContentType(L),U.body){const[B,ae]=Z5(R,zh(e4(S)));y=n4(U.body,r4,B,ae)}}G.isString(_)||(_=_?"include":"omit");const M=i&&"credentials"in n.prototype,W={...A,signal:P,method:x.toUpperCase(),headers:C.normalize().toJSON(),body:y,duplex:"half",credentials:M?_:void 0};D=i&&new n(v,W);let T=await(i?E(D,A):E(v,W));const V=d&&(k==="stream"||k==="response");if(d&&(w||V&&I)){const U={};["status","statusText","headers"].forEach(se=>{U[se]=T[se]});const L=G.toFiniteNumber(T.headers.get("content-length")),[B,ae]=w&&Z5(L,zh(e4(w),!0))||[];T=new r(n4(T.body,r4,B,()=>{ae&&ae(),I&&I()}),U)}k=k||"text";let X=await f[G.findKey(f,k)||"text"](T,m);return!V&&I&&I(),await new Promise((U,L)=>{u6(U,L,{data:X,headers:Pn.from(T.headers),status:T.status,statusText:T.statusText,config:m,request:D})})}catch(M){throw I&&I(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new be("Network Error",be.ERR_NETWORK,m,D,M&&M.response),{cause:M.cause||M}):be.from(M,M&&M.code,m,D,M&&M.response)}}},cfe=new Map,p6=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,l=o,c,u,d=cfe;for(;l--;)c=i[l],u=d.get(c),u===void 0&&d.set(c,u=l?new Map:lfe(t)),d=u;return u};p6();const Oj={http:Sde,xhr:nfe,fetch:{get:p6}};G.forEach(Oj,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const o4=e=>`- ${e}`,ufe=e=>G.isFunction(e)||e===null||e===!1;function dfe(e,t){e=G.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since : +`+o.map(o4).join(` +`):" "+o4(o[0]):"as no adapter specified";throw new be("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const h6={getAdapter:dfe,adapters:Oj};function O0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Od(null,e)}function l4(e){return O0(e),e.headers=Pn.from(e.headers),e.data=E0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),h6.getAdapter(e.adapter||Ed.adapter,e)(e).then(function(r){return O0(e),r.data=E0.call(e,e.transformResponse,r),r.headers=Pn.from(r.headers),r},function(r){return c6(r)||(O0(e),r&&r.response&&(r.response.data=E0.call(e,e.transformResponse,r.response),r.response.headers=Pn.from(r.response.headers))),Promise.reject(r)})}const m6="1.15.0",xx={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{xx[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const c4={};xx.transitional=function(t,n,r){function s(i,o){return"[Axios v"+m6+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(t===!1)throw new be(s(o," has been removed"+(n?" in "+n:"")),be.ERR_DEPRECATED);return n&&!c4[o]&&(c4[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};xx.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function ffe(e,t,n){if(typeof e!="object")throw new be("options must be an object",be.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const l=e[i],c=l===void 0||o(l,i,e);if(c!==!0)throw new be("option "+i+" must be "+c,be.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new be("Unknown option "+i,be.ERR_BAD_OPTION)}}const Kf={assertOptions:ffe,validators:xx},Gn=Kf.validators;let bi=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Q5,response:new Q5}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(` +`);return o===-1?"":s.stack.slice(o+1)})();try{if(!r.stack)r.stack=i;else if(i){const o=i.indexOf(` +`),l=o===-1?-1:i.indexOf(` +`,o+1),c=l===-1?"":i.slice(l+1);String(r.stack).endsWith(c)||(r.stack+=` +`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ii(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Kf.assertOptions(r,{silentJSONParsing:Gn.transitional(Gn.boolean),forcedJSONParsing:Gn.transitional(Gn.boolean),clarifyTimeoutError:Gn.transitional(Gn.boolean),legacyInterceptorReqResOrdering:Gn.transitional(Gn.boolean)},!1),s!=null&&(G.isFunction(s)?n.paramsSerializer={serialize:s}:Kf.assertOptions(s,{encode:Gn.function,serialize:Gn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Kf.assertOptions(n,{baseUrl:Gn.spelling("baseURL"),withXsrfToken:Gn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&G.merge(i.common,i[n.method]);i&&G.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=Pn.concat(o,i);const l=[];let c=!0;this.interceptors.request.forEach(function(v){if(typeof v.runWhen=="function"&&v.runWhen(n)===!1)return;c=c&&v.synchronous;const x=n.transitional||Pj;x&&x.legacyInterceptorReqResOrdering?l.unshift(v.fulfilled,v.rejected):l.push(v.fulfilled,v.rejected)});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,f=0,p;if(!c){const m=[l4.bind(this),void 0];for(m.unshift(...l),m.push(...u),p=m.length,d=Promise.resolve(n);f{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new Od(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new x6(function(s){t=s}),cancel:t}}};function hfe(e){return function(n){return e.apply(null,n)}}function mfe(e){return G.isObject(e)&&e.isAxiosError===!0}const Ly={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ly).forEach(([e,t])=>{Ly[t]=e});function g6(e){const t=new bi(e),n=XT(bi.prototype.request,t);return G.extend(n,bi.prototype,t,{allOwnKeys:!0}),G.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return g6(Ii(e,s))},n}const xt=g6(Ed);xt.Axios=bi;xt.CanceledError=Od;xt.CancelToken=pfe;xt.isCancel=c6;xt.VERSION=m6;xt.toFormData=mx;xt.AxiosError=be;xt.Cancel=xt.CanceledError;xt.all=function(t){return Promise.all(t)};xt.spread=hfe;xt.isAxiosError=mfe;xt.mergeConfig=Ii;xt.AxiosHeaders=Pn;xt.formToJSON=e=>o6(G.isHTMLForm(e)?new FormData(e):e);xt.getAdapter=h6.getAdapter;xt.HttpStatusCode=Ly;xt.default=xt;const{Axios:Cye,AxiosError:_ye,CanceledError:Aye,isCancel:Pye,CancelToken:Eye,VERSION:Oye,all:Tye,Cancel:$ye,isAxiosError:Mye,spread:Rye,toFormData:Dye,AxiosHeaders:Iye,HttpStatusCode:Lye,formToJSON:zye,getAdapter:Bye,mergeConfig:Fye}=xt,$=xt.create({baseURL:"/api",withCredentials:!0});$.interceptors.response.use(e=>e,e=>{var t;return((t=e.response)==null?void 0:t.status)===401&&window.dispatchEvent(new CustomEvent("auth:logout")),Promise.reject(e)});const xfe={getDashboard:()=>$.get("/analytics/dashboard").then(e=>e.data)},gr={list:()=>$.get("/raffle").then(e=>e.data),getDetail:e=>$.get(`/raffle/${e}`).then(t=>t.data),draw:e=>$.post(`/raffle/${e}/draw`).then(t=>t.data),create:e=>$.post("/raffle",e).then(t=>t.data),update:(e,t)=>$.put(`/raffle/${e}`,t).then(n=>n.data),delete:e=>$.delete(`/raffle/${e}`).then(t=>t.data),getDiscounts:e=>$.get(`/raffle/${e}/discounts`).then(t=>t.data),saveDiscounts:(e,t)=>$.post(`/raffle/${e}/discounts`,{tiers:t}).then(n=>n.data),getFlashPromo:e=>$.get(`/raffle/${e}/flash-promo`).then(t=>t.data),createFlashPromo:(e,t)=>$.post(`/raffle/${e}/flash-promo`,t).then(n=>n.data),cancelFlashPromo:(e,t)=>$.delete(`/raffle/${e}/flash-promo/${t}`).then(n=>n.data)},yf={list:()=>$.get("/promotions/all").then(e=>e.data),create:e=>$.post("/promotions",e).then(t=>t.data),update:(e,t)=>$.put(`/promotions/${e}`,t).then(n=>n.data),delete:e=>$.delete(`/promotions/${e}`).then(t=>t.data)},T0={list:()=>$.get("/users").then(e=>e.data),update:(e,t)=>$.put(`/users/${e}`,t).then(n=>n.data),delete:e=>$.delete(`/users/${e}`).then(t=>t.data)},u4={getAsaasKey:()=>$.get("/settings/asaas").then(e=>e.data),saveAsaasKey:e=>$.post("/settings/asaas",{key:e}).then(t=>t.data)},qs={list:()=>$.get("/plugins").then(e=>e.data),activate:e=>$.post(`/plugins/${e}/activate`).then(t=>t.data),deactivate:e=>$.post(`/plugins/${e}/deactivate`).then(t=>t.data),getConfig:e=>$.get(`/plugins/${e}/config`).then(t=>t.data),setConfig:(e,t)=>$.put(`/plugins/${e}/config`,t).then(n=>n.data)},gfe={list:e=>$.get("/orders",{params:e}).then(t=>t.data)},d4={list:e=>$.get("/claims",{params:e?{status:e}:{}}).then(t=>t.data),updateStatus:(e,t)=>$.patch(`/claims/${e}`,{status:t}).then(n=>n.data)},f4={get:()=>$.get("/admin/club/reports").then(e=>e.data),exportCsv:e=>$.get("/admin/club/members",{params:{...e,limit:9999}}).then(t=>t.data)},Ut={listMembers:(e,t)=>$.get("/admin/club/members",{params:{club_id:e,...t}}).then(n=>n.data),updateMemberStatus:(e,t)=>$.patch(`/admin/club/members/${e}`,{status:t}).then(n=>n.data),listPartners:e=>$.get("/admin/club/partners",{params:{club_id:e}}).then(t=>t.data),createPartner:e=>$.post("/admin/club/partners",e).then(t=>t.data),updatePartner:(e,t)=>$.put(`/admin/club/partners/${e}`,t).then(n=>n.data),deletePartner:e=>$.delete(`/admin/club/partners/${e}`).then(t=>t.data),listPlans:e=>$.get("/admin/club/plans",{params:{club_id:e}}).then(t=>t.data),createPlan:e=>$.post("/admin/club/plans",e).then(t=>t.data),updatePlan:(e,t)=>$.put(`/admin/club/plans/${e}`,t).then(n=>n.data),deletePlan:e=>$.delete(`/admin/club/plans/${e}`).then(t=>t.data),saveContent:(e,t)=>$.put(`/admin/club/${e}/content`,t).then(n=>n.data),listFaqs:e=>$.get("/admin/club/faqs",{params:{club_id:e}}).then(t=>t.data),createFaq:e=>$.post("/admin/club/faqs",e).then(t=>t.data),updateFaq:(e,t)=>$.put(`/admin/club/faqs/${e}`,t).then(n=>n.data),deleteFaq:e=>$.delete(`/admin/club/faqs/${e}`).then(t=>t.data)},Xr={kpi:()=>$.get("/admin/jobs/kpi").then(e=>e.data),list:e=>$.get("/admin/jobs",{params:e}).then(t=>t.data),create:e=>$.post("/admin/jobs",e).then(t=>t.data),update:(e,t)=>$.put(`/admin/jobs/${e}`,t).then(n=>n.data),toggle:e=>$.patch(`/admin/jobs/${e}/toggle`).then(t=>t.data),remove:e=>$.delete(`/admin/jobs/${e}`).then(t=>t.data),getApplications:(e,t)=>$.get(`/admin/jobs/${e}/applications`,{params:t}).then(n=>n.data),getApplication:e=>$.get(`/admin/applications/${e}`).then(t=>t.data),updateApplication:(e,t)=>$.patch(`/admin/applications/${e}`,t).then(n=>n.data),searchResumes:e=>$.get("/admin/resumes",{params:e}).then(t=>t.data),getResume:e=>$.get(`/admin/resumes/${e}`).then(t=>t.data)},Hc={get:()=>$.get("/admin/me").then(e=>e.data),linkAccount:e=>$.patch("/admin/me/account",{account_id:e}).then(t=>t.data)},bf={list:()=>$.get("/admins").then(e=>e.data),create:e=>$.post("/admins",e).then(t=>t.data),update:(e,t)=>$.put(`/admins/${e}`,t).then(n=>n.data),delete:e=>$.delete(`/admins/${e}`).then(t=>t.data)},p4={request:async(e,t)=>{const n=await fetch("/api/pair/proxy/request",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:e,nwUrl:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Erro ao solicitar código");return r},confirm:async(e,t,n)=>{const r=await fetch("/api/pair/proxy/confirm",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:e,code:t,nwUrl:n})}),s=await r.json();if(!r.ok)throw new Error(s.error||"Código inválido");return s}},he={getSessions:()=>$.get("/nw/v1/sessions").then(e=>e.data),getQr:e=>$.get(`/nw/v1/sessions/${e}/qr`).then(t=>t.data),getInbox:(e,t,n=50)=>$.get("/nw/v1/inbox",{params:{session:e,search:t,limit:n}}).then(r=>r.data),getMessages:(e,t=50,n)=>$.get(`/nw/v1/inbox/${e}/messages`,{params:{limit:t,before:n}}).then(r=>r.data),send:(e,t)=>$.post(`/nw/v1/inbox/${e}/send`,{text:t}).then(n=>n.data),markRead:e=>$.post(`/nw/v1/inbox/${e}/read`).then(t=>t.data),archive:(e,t)=>$.patch(`/nw/v1/inbox/${e}/archive`,{archived:t}).then(n=>n.data),pin:(e,t)=>$.patch(`/nw/v1/inbox/${e}/pin`,{pinned:t}).then(n=>n.data),deleteChat:e=>$.delete(`/nw/v1/inbox/${e}`).then(t=>t.data),getWebhooks:()=>$.get("/nw/v1/webhooks").then(e=>e.data),createWebhook:e=>$.post("/nw/v1/webhooks",e).then(t=>t.data),deleteWebhook:e=>$.delete(`/nw/v1/webhooks/${e}`).then(t=>t.data),toggleWebhook:(e,t)=>$.patch(`/nw/v1/webhooks/${e}`,{active:t}).then(n=>n.data),secretariaAsk:(e,t,n)=>$.post("/nw/v1/secretaria/ask",{chatId:e,message:t,contactName:n}).then(r=>r.data),startConversation:(e,t,n)=>$.post("/nw/v1/conversations",{sessionId:e,phone:t,text:n}).then(r=>r.data),createSession:e=>$.post("/nw/v1/sessions",{name:e}).then(t=>t.data),deleteSession:e=>$.delete(`/nw/v1/sessions/${e}`).then(t=>t.data),getNumbers:()=>$.get("/nw/v1/secretaria/numbers").then(e=>e.data),saveNumber:e=>$.post("/nw/v1/secretaria/numbers",e).then(t=>t.data),updateNumber:(e,t)=>$.put(`/nw/v1/secretaria/numbers/${e}`,t).then(n=>n.data),deleteNumber:e=>$.delete(`/nw/v1/secretaria/numbers/${e}`).then(t=>t.data),getMetrics:e=>$.get("/admin/nw/metrics",{params:{period:e??"7d"}}).then(t=>t.data),getAutoReplyMode:()=>$.get("/admin/nw/auto-reply-mode").then(e=>e.data),setAutoReplyMode:e=>$.put("/admin/nw/auto-reply-mode",{mode:e}).then(t=>t.data),syncKnowledge:()=>$.post("/admin/nw/sync-knowledge").then(e=>e.data),secGetAgent:()=>$.get("/nw/v1/sec/agent").then(e=>e.data),secCreateAgent:e=>$.post("/nw/v1/sec/agent",e).then(t=>t.data),secUpdateAgent:(e,t)=>$.put(`/nw/v1/sec/agent/${e}`,t).then(n=>n.data),secGetNodes:()=>$.get("/nw/v1/sec/nodes").then(e=>e.data),secCreateNode:e=>$.post("/nw/v1/sec/nodes",e).then(t=>t.data),secUpdateNode:(e,t)=>$.put(`/nw/v1/sec/nodes/${e}`,t).then(n=>n.data),secDeleteNode:e=>$.delete(`/nw/v1/sec/nodes/${e}`).then(t=>t.data),secGetSlots:()=>$.get("/nw/v1/sec/slots").then(e=>e.data),secCreateSlot:e=>$.post("/nw/v1/sec/slots",e).then(t=>t.data),secDeleteSlot:e=>$.delete(`/nw/v1/sec/slots/${e}`).then(t=>t.data),secGetConversations:()=>$.get("/nw/v1/sec/conversations").then(e=>e.data),secGetConvMessages:e=>$.get(`/nw/v1/sec/conversations/${e}/messages`).then(t=>t.data),secFinalizeConv:e=>$.post(`/nw/v1/sec/conversations/${e}/finalize`).then(t=>t.data),secTestAsk:(e,t)=>$.post("/nw/v1/secretaria/ask",{chatId:`test-panel-${e}`,message:t,contactName:"Teste Admin"}).then(n=>n.data),secGetKeys:()=>$.get("/nw/v1/sec/keys").then(e=>e.data),secSaveKeys:e=>$.put("/nw/v1/sec/keys",e).then(t=>t.data),getHandoffMode:e=>$.get(`/nw/handoff/${encodeURIComponent(e)}`).then(t=>t.data),setHandoffMode:(e,t)=>$.patch(`/nw/handoff/${encodeURIComponent(e)}`,{mode:t}).then(n=>n.data),sendRich:(e,t)=>$.post(`/nw/v1/inbox/${e}/send`,t).then(n=>n.data),listTemplates:e=>$.get("/nw/v1/templates",{params:e}).then(t=>t.data),createTemplate:e=>$.post("/nw/v1/templates",e).then(t=>t.data),deleteTemplate:e=>$.delete(`/nw/v1/templates/${e}`).then(t=>t.data),markTemplateUsed:e=>$.post(`/nw/v1/templates/${e}/use`).then(t=>t.data),listScheduled:()=>$.get("/nw/v1/scheduled").then(e=>e.data),createScheduled:e=>$.post("/nw/v1/scheduled",e).then(t=>t.data),deleteScheduled:e=>$.delete(`/nw/v1/scheduled/${e}`).then(t=>t.data),pauseScheduled:e=>$.post(`/nw/v1/scheduled/${e}/pause`).then(t=>t.data),resumeScheduled:e=>$.post(`/nw/v1/scheduled/${e}/resume`).then(t=>t.data)},v6={assume:e=>$.post("/admin/escalation/assume",e).then(t=>t.data),transfer:e=>$.post("/admin/protocol/transfer",e).then(t=>t.data)},vfe={answer:(e,t)=>$.post(`/human-api/answer/${e}`,{answer:t}).then(n=>n.data)},h4={close:e=>$.post("/admin/protocol/close",e).then(t=>t.data),flag:e=>$.post("/admin/protocol/flag",e).then(t=>t.data)},m4={save:e=>$.post("/admin/knowledge/save",e).then(t=>t.data),promote:e=>$.post(`/admin/knowledge/promote/${e}`).then(t=>t.data),list:(e=!1)=>$.get(`/admin/knowledge${e?"":"?promoted=false"}`).then(t=>t.data)},Ac={send:(e,t)=>$.post("/admin/inbox/direct-message",{to_account:e,content:t}).then(n=>n.data),getConversation:(e,t=50)=>$.get(`/admin/inbox/direct/${e}?limit=${t}`).then(n=>n.data),getLastMessages:()=>$.get("/admin/inbox/direct-messages").then(e=>e.data),getColleagues:()=>$.get("/admin/inbox/colleagues").then(e=>e.data),markAsRead:e=>$.patch(`/admin/inbox/direct/${e}/read`).then(t=>t.data)},Kc={list:()=>$.get("/admin/inbox/groups").then(e=>e.data),getMessages:(e,t=50,n)=>{const r=new URLSearchParams({limit:String(t)});return n&&r.set("before",n),$.get(`/admin/inbox/groups/${e}/messages?${r}`).then(s=>s.data)},sendMessage:(e,t)=>$.post(`/admin/inbox/groups/${e}/message`,{content:t}).then(n=>n.data),getMembers:e=>$.get(`/admin/inbox/groups/${e}/members`).then(t=>t.data),markRead:e=>$.post(`/admin/inbox/groups/${e}/read`).then(t=>t.data)},Gf={send:e=>$.post("/admin/inbox/broadcast",{content:e}).then(t=>t.data),list:()=>$.get("/admin/inbox/broadcasts").then(e=>e.data),markSeen:()=>$.post("/admin/inbox/broadcasts/seen").then(e=>e.data)},Zn={list:e=>$.get("/admin/accounts",{params:e}).then(t=>t.data),get:e=>$.get(`/admin/accounts/${e}`).then(t=>t.data),create:e=>$.post("/admin/accounts",e).then(t=>t.data),update:(e,t)=>$.put(`/admin/accounts/${e}`,t).then(n=>n.data),remove:e=>$.delete(`/admin/accounts/${e}`).then(t=>t.data)},er={list:()=>$.get("/admin/sectors").then(e=>e.data),get:e=>$.get(`/admin/sectors/${e}`).then(t=>t.data),create:e=>$.post("/admin/sectors",e).then(t=>t.data),update:(e,t)=>$.put(`/admin/sectors/${e}`,t).then(n=>n.data),remove:e=>$.delete(`/admin/sectors/${e}`).then(t=>t.data),getBrain:e=>$.get(`/admin/sectors/${e}/brain`).then(t=>t.data),createBrain:(e,t)=>$.post(`/admin/sectors/${e}/brain`,t).then(n=>n.data),updateBrain:(e,t)=>$.put(`/admin/sectors/brain/${e}`,t).then(n=>n.data),deleteBrain:e=>$.delete(`/admin/sectors/brain/${e}`).then(t=>t.data)},Js={list:e=>$.get("/admin/team-members",{params:e}).then(t=>t.data),add:e=>$.post("/admin/team-members",e).then(t=>t.data),update:(e,t)=>$.put(`/admin/team-members/${e}`,t).then(n=>n.data),remove:e=>$.delete(`/admin/team-members/${e}`).then(t=>t.data)},Gc={listThreads:e=>$.get("/admin/inbox/threads",{params:{account_id:e}}).then(t=>t.data),getThread:e=>$.get(`/admin/inbox/threads/${e}`).then(t=>t.data),postMessage:e=>$.post("/admin/inbox/messages",e).then(t=>t.data),markRead:(e,t)=>$.post(`/admin/inbox/threads/${e}/read`,{account_id:t}).then(n=>n.data),unreadCount:e=>$.get("/admin/inbox/unread",{params:{account_id:e}}).then(t=>t.data)},Qt={list:e=>$.get("/clientes",{params:e}).then(t=>t.data),get:e=>$.get(`/clientes/${e}`).then(t=>t.data),create:e=>$.post("/clientes",e).then(t=>t.data),update:(e,t)=>$.put(`/clientes/${e}`,t).then(n=>n.data),delete:e=>$.delete(`/clientes/${e}`).then(t=>t.data),listEnderecos:e=>$.get(`/clientes/${e}/enderecos`).then(t=>t.data),addEndereco:(e,t)=>$.post(`/clientes/${e}/enderecos`,t).then(n=>n.data),updateEndereco:(e,t,n)=>$.put(`/clientes/${e}/enderecos/${t}`,n).then(r=>r.data),deleteEndereco:(e,t)=>$.delete(`/clientes/${e}/enderecos/${t}`).then(n=>n.data),listTelefones:e=>$.get(`/clientes/${e}/telefones`).then(t=>t.data),addTelefone:(e,t)=>$.post(`/clientes/${e}/telefones`,t).then(n=>n.data),updateTelefone:(e,t,n)=>$.put(`/clientes/${e}/telefones/${t}`,n).then(r=>r.data),deleteTelefone:(e,t)=>$.delete(`/clientes/${e}/telefones/${t}`).then(n=>n.data),listResponsaveis:e=>$.get(`/clientes/${e}/responsaveis`).then(t=>t.data),addResponsavel:(e,t)=>$.post(`/clientes/${e}/responsaveis`,t).then(n=>n.data),updateResponsavel:(e,t,n)=>$.put(`/clientes/${e}/responsaveis/${t}`,n).then(r=>r.data),deleteResponsavel:(e,t)=>$.delete(`/clientes/${e}/responsaveis/${t}`).then(n=>n.data)},zo={list:e=>$.get("/produtos/admin/all",{params:e}).then(t=>t.data),listPublic:e=>$.get("/produtos",{params:e}).then(t=>t.data),categorias:()=>$.get("/produtos/categorias").then(e=>e.data),get:e=>$.get(`/produtos/${e}`).then(t=>t.data),create:e=>$.post("/produtos",e).then(t=>t.data),update:(e,t)=>$.put(`/produtos/${e}`,t).then(n=>n.data),updateEstoque:(e,t)=>$.patch(`/produtos/${e}/estoque`,{estoque:t}).then(n=>n.data),updatePreco:(e,t)=>$.patch(`/produtos/${e}/preco`,{preco:t}).then(n=>n.data),updatePromo:(e,t)=>$.patch(`/produtos/${e}/preco`,{preco_promocional:t}).then(n=>n.data),delete:e=>$.delete(`/produtos/${e}`).then(t=>t.data),importar:e=>$.post("/produtos/importar",{produtos:e}).then(t=>t.data)},pt={listPedidos:e=>$.get("/cotacoes/admin/pedidos",{params:e}).then(t=>t.data),getPedido:e=>$.get(`/cotacoes/admin/pedidos/${e}`).then(t=>t.data),contadores:()=>$.get("/cotacoes/admin/pedidos/contadores").then(e=>e.data),listFinanceiro:()=>$.get("/cotacoes/admin/financeiro").then(e=>e.data),financeiroDecisao:(e,t,n)=>$.patch(`/cotacoes/admin/financeiro/${e}`,{acao:t,obs:n}).then(r=>r.data),wppSemResposta:(e=5)=>$.get(`/cotacoes/admin/whatsapp/sem-resposta?limiar=${e}`).then(t=>t.data),notificacoes:e=>$.get("/cotacoes/admin/pedidos/notificacoes",{params:{minutes:e}}).then(t=>t.data),updateStatus:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/status`,{status:t}).then(n=>n.data),atribuirEquipe:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/equipe`,{equipe_id:t}).then(n=>n.data),marcarSeparado:(e,t)=>$.patch(`/cotacoes/admin/pedidos/itens/${e}/separado`,{separado:t}).then(n=>n.data),marcarEntregue:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/status`,{status:"entregue",responsavel_entrega:t}).then(n=>n.data),marcarEmbalado:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/embalagem`,{embalador:t}).then(n=>n.data),marcarEmbaladoPorId:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/embalagem`,{embalador_id:t}).then(n=>n.data),marcarEntreguePorId:(e,t)=>$.patch(`/cotacoes/admin/pedidos/${e}/status`,{status:"entregue",expedidor_id:t}).then(n=>n.data),setResponsavel:(e,t,n)=>$.patch(`/cotacoes/admin/pedidos/${e}/responsavel/${t}`,{account_id:n}).then(r=>r.data),registrarCupom:(e,t)=>$.post(`/cotacoes/admin/pedidos/${e}/cupom`,t).then(n=>n.data),listColaboradores:e=>$.get("/cotacoes/admin/colaboradores/disponiveis",{params:{funcao:e}}).then(t=>t.data)},So={contadores:()=>$.get("/cotacoes/admin/inbox/contadores").then(e=>e.data),listBySetor:(e,t)=>$.get(`/cotacoes/admin/inbox/setor/${e}`,{params:{nao_lidas:t}}).then(n=>n.data),listByPedido:e=>$.get(`/cotacoes/admin/inbox/pedido/${e}`).then(t=>t.data),enviar:e=>$.post("/cotacoes/admin/inbox",e).then(t=>t.data),marcarLida:e=>$.patch(`/cotacoes/admin/inbox/${e}/lida`).then(t=>t.data),marcarTodasPedido:e=>$.patch(`/cotacoes/admin/inbox/pedido/${e}/lidas`).then(t=>t.data),marcarTodasSetor:e=>$.patch(`/cotacoes/admin/inbox/setor/${e}/lidas`).then(t=>t.data)},yfe={list:()=>$.get("/admin/nw-teams").then(e=>e.data)};function Cs({isOpen:e,onClose:t,title:n,children:r}){return e?a.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm animate-in fade-in duration-300",onClick:t}),a.jsxs("div",{className:"relative bg-slate-900 border border-slate-800 w-full max-w-lg rounded-[2rem] shadow-2xl animate-in zoom-in-95 fade-in duration-300 overflow-hidden",children:[a.jsxs("div",{className:"p-8 border-b border-slate-800 flex justify-between items-center bg-slate-800/20",children:[a.jsx("h3",{className:"text-xl font-black text-white tracking-tight italic uppercase",children:n}),a.jsx("button",{onClick:t,className:"p-2 hover:bg-slate-800 text-slate-500 hover:text-white rounded-xl transition-all",children:a.jsx(Ce,{size:24})})]}),a.jsx("div",{className:"p-8 max-h-[70vh] overflow-y-auto custom-scrollbar",children:r})]})]}):null}function bfe(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(""),[o,l]=b.useState(!1),[c,u]=b.useState(null),[d,f]=b.useState({nome:"",email:"",cpf:"",telefone:"",source:""}),p=async()=>{r(!0);const g=await T0.list();t(g),r(!1)};b.useEffect(()=>{p()},[]);const h=b.useMemo(()=>e.filter(g=>{var j,N,w,S;return((j=g.nome)==null?void 0:j.toLowerCase().includes(s.toLowerCase()))||((N=g.cpf)==null?void 0:N.includes(s))||((w=g.telefone)==null?void 0:w.includes(s))||((S=g.email)==null?void 0:S.toLowerCase().includes(s.toLowerCase()))}),[e,s]),m=()=>{const g=["ID","Nome","Email","CPF","Telefone","IP","Fonte","Data Cadastro"],j=h.map(k=>[k.id,k.nome,k.email||"",k.cpf||"",k.telefone||"",k.ip||"",k.source||"",new Date(k.timestamp||k.created_at).toLocaleString("pt-BR")]),N=[g.join(","),...j.map(k=>k.map(C=>`"${C}"`).join(","))].join(` +`),w=new Blob([N],{type:"text/csv;charset=utf-8;"}),S=document.createElement("a");S.href=URL.createObjectURL(w),S.download=`leads_alemao_${new Date().toISOString().split("T")[0]}.csv`,S.click()},v=g=>{u(g),f({nome:g.nome,email:g.email||"",cpf:g.cpf||"",telefone:g.telefone||"",source:g.source||"hotspot"}),l(!0)},x=async g=>{g.preventDefault();try{await T0.update(c.id,d),l(!1),p()}catch{alert("Erro ao atualizar usuário")}},y=async g=>{if(confirm("Tem certeza que deseja remover este cliente da base?"))try{await T0.delete(g),p()}catch{alert("Erro ao excluir")}};return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-end",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-black text-white tracking-tighter uppercase italic",children:"Clientes WiFi & Web"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Gestão de leads captados pelo ecossistema."})]}),a.jsxs("button",{onClick:m,className:"flex items-center gap-2 px-6 py-3 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-2xl border border-slate-700 transition-all font-bold uppercase italic text-[10px] tracking-widest active:scale-95",children:[a.jsx(m1,{size:18}),"Exportar Leads (CSV)"]})]}),a.jsxs("div",{className:"bg-slate-900/40 backdrop-blur-md border border-slate-800 rounded-[2.5rem] overflow-hidden",children:[a.jsxs("div",{className:"p-8 border-b border-slate-800 flex items-center gap-6",children:[a.jsxs("div",{className:"flex-1 relative group",children:[a.jsx(Ir,{size:20,className:"absolute left-5 top-1/2 -translate-y-1/2 text-slate-500 group-focus-within:text-cyan-400 transition-colors"}),a.jsx("input",{type:"text",value:s,onChange:g=>i(g.target.value),placeholder:"Filtrar por nome, telefone, CPF ou e-mail...",className:"w-full bg-slate-800/50 border border-slate-700 rounded-2xl pl-14 pr-6 py-4 text-sm text-white placeholder:text-slate-600 focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsx("div",{className:"hidden lg:flex items-center gap-4 px-6 py-3 bg-slate-800/20 border border-slate-800 rounded-2xl",children:a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-[10px] text-slate-500 font-black uppercase tracking-widest",children:"Total na Base"}),a.jsx("span",{className:"text-white font-black tabular-nums",children:e.length})]})})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-slate-800/30 text-slate-500 text-[10px] uppercase tracking-widest font-black",children:[a.jsx("th",{className:"px-8 py-5",children:"Perfil do Cliente"}),a.jsx("th",{className:"px-8 py-5",children:"Identificação"}),a.jsx("th",{className:"px-8 py-5",children:"Origem / IP"}),a.jsx("th",{className:"px-8 py-5 text-right",children:"Ações"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-800/50",children:n?[1,2,3,4,5].map(g=>a.jsx("tr",{className:"animate-pulse",children:a.jsx("td",{colSpan:4,className:"px-8 py-8 bg-slate-800/5"})},g)):h.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"px-8 py-20 text-center text-slate-500 font-medium italic",children:"Nenhum cliente encontrado para sua busca."})}):h.map(g=>a.jsxs("tr",{className:"hover:bg-cyan-500/[0.02] transition-colors group",children:[a.jsx("td",{className:"px-8 py-6",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-br from-slate-700 to-slate-800 flex items-center justify-center text-slate-500 border border-white/5 relative group-hover:scale-110 transition-transform",children:[a.jsx(et,{size:24}),g.source==="hotspot"&&a.jsx("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-cyan-500 rounded-full border-2 border-slate-900 flex items-center justify-center",children:a.jsx(pI,{size:8,className:"text-white"})})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-black text-sm uppercase tracking-tight",children:g.nome}),a.jsx("div",{className:"text-slate-500 text-[11px] font-bold",children:g.email||"SEM E-MAIL"})]})]})}),a.jsx("td",{className:"px-8 py-6",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-xs text-slate-300 font-bold flex items-center gap-2",children:[a.jsx(ws,{size:12,className:"text-slate-600"}),g.cpf||"CPF NÃO INFO"]}),a.jsx("div",{className:"text-xs text-cyan-400 font-black tabular-nums",children:g.telefone||"SEM TELEFONE"})]})}),a.jsx("td",{className:"px-8 py-6",children:a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:`text-[10px] font-black uppercase tracking-widest ${g.source==="web"?"text-purple-400":"text-cyan-500"}`,children:g.source||"hotspot"}),a.jsxs("div",{className:"text-[10px] text-slate-500 font-bold tabular-nums",children:["IP: ",g.ip||"---"]})]})}),a.jsx("td",{className:"px-8 py-6 text-right",children:a.jsxs("div",{className:"flex justify-end gap-3 translate-x-4 opacity-0 group-hover:opacity-100 group-hover:translate-x-0 transition-all",children:[a.jsx("button",{onClick:()=>v(g),className:"p-3 bg-slate-800 text-slate-400 hover:text-white hover:bg-slate-700 rounded-xl transition-all border border-slate-700",children:a.jsx(vm,{size:16})}),a.jsx("button",{onClick:()=>y(g.id),className:"p-3 bg-rose-500/10 text-rose-500 hover:bg-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/10",children:a.jsx(Te,{size:16})})]})})]},g.id))})]})})]}),a.jsx(Cs,{isOpen:o,onClose:()=>l(!1),title:"Editar Perfil do Cliente",children:a.jsxs("form",{onSubmit:x,className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Nome Completo"}),a.jsx("input",{required:!0,type:"text",value:d.nome,onChange:g=>f({...d,nome:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"CPF"}),a.jsx("input",{type:"text",value:d.cpf,onChange:g=>f({...d,cpf:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Telefone"}),a.jsx("input",{type:"text",value:d.telefone,onChange:g=>f({...d,telefone:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"E-mail"}),a.jsx("input",{type:"email",value:d.email,onChange:g=>f({...d,email:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Origem do Cadastro"}),a.jsxs("select",{value:d.source,onChange:g=>f({...d,source:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all appearance-none",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"hotspot",children:"WiFi Hotspot (Loja)"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"web",children:"Web (Site)"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"manual",children:"Manual (Balcão)"})]})]}),a.jsxs("button",{type:"submit",className:"w-full bg-cyan-500 hover:bg-cyan-400 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm",children:[a.jsx(or,{size:20}),"Salvar Alterações"]})]})})]})}function x4({icon:e,title:t,subtitle:n,children:r}){return a.jsxs("div",{className:"bg-slate-900/50 border border-slate-800 rounded-3xl p-8 relative overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[a.jsx("div",{className:"p-3 bg-cyan-500/10 text-cyan-400 rounded-2xl",children:a.jsx(e,{size:28})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold text-white",children:t}),a.jsx("p",{className:"text-sm text-slate-500",children:n})]})]}),r,a.jsx("div",{className:"absolute -bottom-24 -right-24 w-64 h-64 bg-cyan-500/5 rounded-full blur-3xl pointer-events-none"})]})}function g4({saved:e}){return e?a.jsx("span",{className:"text-emerald-400 font-medium text-sm animate-in fade-in slide-in-from-left-4",children:"✅ Salvo com sucesso!"}):null}function jfe(){const[e,t]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[o,l]=b.useState({primary_color:"#f59e0b",secondary_color:"#10b981",logo_url:"",favicon_url:"",contact_email:"",contact_phone:"",app_url:""}),[c,u]=b.useState(!1),[d,f]=b.useState(!1);b.useEffect(()=>{u4.getAsaasKey().then(x=>t(x.key||"")),$.get("/tenant/config").then(x=>{const y=x.data;l({primary_color:y.primary_color||"#f59e0b",secondary_color:y.secondary_color||"#10b981",logo_url:y.logo_url||"",favicon_url:y.favicon_url||"",contact_email:y.contact_email||"",contact_phone:y.contact_phone||"",app_url:y.app_url||""})}).catch(()=>{})},[]);const p=async x=>{x.preventDefault(),i(!0);try{await u4.saveAsaasKey(e),r(!0),setTimeout(()=>r(!1),3e3)}catch{alert("Erro ao salvar a chave Asaas")}finally{i(!1)}},h=async x=>{x.preventDefault(),u(!0);try{await $.put("/tenant/config",o),f(!0),setTimeout(()=>f(!1),3e3)}catch{alert("Erro ao salvar identidade visual")}finally{u(!1)}},m="w-full bg-slate-800 border border-slate-700 rounded-xl px-4 py-3 text-white placeholder:text-slate-600 focus:outline-none focus:ring-2 ring-cyan-500 transition-all",v="block text-sm font-semibold text-slate-400 mb-2";return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{children:[a.jsx("h2",{className:"text-3xl font-bold text-white",children:"Configurações"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Gerencie integrações, pagamentos e identidade visual do tenant."})]}),a.jsxs("div",{className:"max-w-2xl space-y-8",children:[a.jsx(x4,{icon:EI,title:"Identidade Visual",subtitle:"Cores e dados de exibição do tenant",children:a.jsxs("form",{onSubmit:h,className:"space-y-5",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:v,children:"Cor Primária"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"color",value:o.primary_color,onChange:x=>l(y=>({...y,primary_color:x.target.value})),className:"w-12 h-12 rounded-xl cursor-pointer bg-slate-800 border border-slate-700 p-1"}),a.jsx("input",{type:"text",value:o.primary_color,onChange:x=>l(y=>({...y,primary_color:x.target.value})),className:m+" font-mono"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:"Cor Secundária"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"color",value:o.secondary_color,onChange:x=>l(y=>({...y,secondary_color:x.target.value})),className:"w-12 h-12 rounded-xl cursor-pointer bg-slate-800 border border-slate-700 p-1"}),a.jsx("input",{type:"text",value:o.secondary_color,onChange:x=>l(y=>({...y,secondary_color:x.target.value})),className:m+" font-mono"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:"URL do Logo"}),a.jsx("input",{type:"text",value:o.logo_url,placeholder:"https://...",onChange:x=>l(y=>({...y,logo_url:x.target.value})),className:m})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:"URL do Favicon"}),a.jsx("input",{type:"text",value:o.favicon_url,placeholder:"https://...",onChange:x=>l(y=>({...y,favicon_url:x.target.value})),className:m})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:v,children:"E-mail de Contato"}),a.jsx("input",{type:"email",value:o.contact_email,placeholder:"contato@empresa.com",onChange:x=>l(y=>({...y,contact_email:x.target.value})),className:m})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:"Telefone de Contato"}),a.jsx("input",{type:"text",value:o.contact_phone,placeholder:"(00) 00000-0000",onChange:x=>l(y=>({...y,contact_phone:x.target.value})),className:m})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:v,children:"URL Pública do App"}),a.jsx("input",{type:"text",value:o.app_url,placeholder:"https://alemaoconveniencias.com.br",onChange:x=>l(y=>({...y,app_url:x.target.value})),className:m}),a.jsxs("p",{className:"mt-2 text-xs text-slate-500 flex items-center gap-1.5",children:[a.jsx(Ar,{size:14}),"Usada nos links enviados por WhatsApp e e-mail."]})]}),a.jsxs("div",{className:"rounded-2xl border border-slate-700 p-4 flex items-center gap-4",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-white font-bold text-lg shrink-0",style:{background:o.primary_color},children:o.logo_url?a.jsx("img",{src:o.logo_url,className:"w-full h-full object-contain rounded-xl",alt:"logo"}):"A"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-bold text-white",children:"Preview do Branding"}),a.jsxs("div",{className:"flex gap-2 mt-1",children:[a.jsx("span",{className:"w-4 h-4 rounded-full inline-block",style:{background:o.primary_color}}),a.jsx("span",{className:"w-4 h-4 rounded-full inline-block",style:{background:o.secondary_color}}),a.jsxs("span",{className:"text-xs text-slate-500",children:[o.primary_color," / ",o.secondary_color]})]})]})]}),a.jsxs("div",{className:"pt-2 flex items-center gap-4",children:[a.jsxs("button",{disabled:c,type:"submit",className:"bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-bold px-6 py-3 rounded-xl flex items-center gap-2 transition-all shadow-lg shadow-cyan-500/20",children:[a.jsx(or,{size:18}),c?"Salvando...":"Salvar Identidade Visual"]}),a.jsx(g4,{saved:d})]})]})}),a.jsx(x4,{icon:Pi,title:"Gateway de Pagamento (Asaas)",subtitle:"Configuração de Cobranças PIX Automatizadas",children:a.jsxs("form",{onSubmit:p,className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:v,children:"ASAAS API KEY"}),a.jsx("input",{type:"password",value:e,onChange:x=>t(x.target.value),placeholder:"Ex: $aact_...",className:m}),a.jsxs("p",{className:"mt-2 text-xs text-slate-500 flex items-center gap-1.5",children:[a.jsx(Ar,{size:14}),"Use ",a.jsx("b",{children:"sandbox_local"})," para testar sem cobrar dinheiro real."]})]}),a.jsxs("div",{className:"pt-2 flex items-center gap-4",children:[a.jsxs("button",{disabled:s,type:"submit",className:"bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-bold px-6 py-3 rounded-xl flex items-center gap-2 transition-all shadow-lg shadow-cyan-500/20",children:[a.jsx(or,{size:18}),s?"Salvando...":"Salvar Alterações"]}),a.jsx(g4,{saved:n})]})]})})]})]})}function wfe(){var F;const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[o,l]=b.useState(!1),[c,u]=b.useState(null),[d,f]=b.useState(null),[p,h]=b.useState(!1),[m,v]=b.useState([]),[x,y]=b.useState(!1),[g,j]=b.useState(null),[N,w]=b.useState({discount_pct:15,duration_minutes:30,label:"Promoção Relâmpago"}),[S,k]=b.useState(!1),[C,_]=b.useState(Date.now()),[A,E]=b.useState(!1),[P,D]=b.useState(()=>{try{return JSON.parse(localStorage.getItem("raffle_type_suggestions")||"{}")}catch{return{}}}),[I,R]=b.useState(null),M=(z,q)=>{const ie={...P,[z]:q};D(ie),localStorage.setItem("raffle_type_suggestions",JSON.stringify(ie))},W=[{id:"tier_flash",icon:Mo,color:"orange",gradient:"from-orange-500/20 to-amber-500/10",border:"border-orange-500/30",iconBg:"bg-orange-500/20 text-orange-400",badge:"RECOMENDADO",badgeColor:"bg-orange-500/20 text-orange-400 border-orange-500/30",title:"Sorteio Relâmpago por Faixa",subtitle:"Prêmios proporcionais à quantidade comprada",description:"Cada faixa de compra (nível = quantos números a pessoa comprou) concorre a um sorteio separado com prêmio proporcional. Quem comprou 1 número disputa R$20, quem comprou 3 disputa R$40, quem comprou 5 disputa R$75 — e assim por diante. Os sorteios disparam quando a faixa acumula receita suficiente ou em horário agendado.",tiers:[{qty:"1 nº",prize:"R$ 20",ratio:"4x o valor investido"},{qty:"3 nºs",prize:"R$ 40",ratio:"2,7x o valor investido"},{qty:"5 nºs",prize:"R$ 75",ratio:"3x o valor investido"},{qty:"10 nºs",prize:"R$150",ratio:"3x o valor investido"},{qty:"20 nºs",prize:"R$300",ratio:"3x o valor investido"}],pros:["Incentiva quem comprou pouco a continuar participando","Aumenta o valor médio de compra sem forçar desconto","Cria múltiplos momentos de emoção por rifa","Processo automático já existe — baixo esforço técnico","Prêmio em crédito é juridicamente mais seguro que dinheiro"],cons:["Custos de prêmio se multiplicam — exige controle financeiro",'Pode confundir clientes sobre "em qual sorteio estou"',"Aviso no WhatsApp precisa ser claro e separado por faixa","Sorteios frequentes podem tirar a emoção do prêmio principal"]},{id:"multiplier",icon:Wi,color:"cyan",gradient:"from-cyan-500/20 to-blue-500/10",border:"border-cyan-500/30",iconBg:"bg-cyan-500/20 text-cyan-400",badge:"SIMPLES",badgeColor:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",title:"Multiplicador de Sorte",subtitle:"Mais chances no sorteio principal conforme compra",description:'Um único sorteio principal, mas quem compra mais bilhetes entra mais vezes na lista de participantes. 1 número = 1 entrada, 3 números = 4 entradas, 5 números = 8 entradas. A mensagem é simples: "compre 5 e tenha 8x mais chances de ganhar!"',tiers:[{qty:"1 nº",prize:"1 entrada",ratio:"1x"},{qty:"3 nºs",prize:"4 entradas",ratio:"1,3x por número"},{qty:"5 nºs",prize:"8 entradas",ratio:"1,6x por número"},{qty:"10 nºs",prize:"20 entradas",ratio:"2x por número"},{qty:"20 nºs",prize:"50 entradas",ratio:"2,5x por número"}],pros:['Conceito simples: "mais números = mais chances"',"Um único sorteio — fácil de comunicar e gerenciar","Sem custo extra de prêmios adicionais",'"5x mais chances!" é uma mensagem que converte bem'],cons:["O código matemático do sorteio (SHA256) precisa ser reescrito do zero","Menos transparente — clientes podem questionar a imparcialidade","Não recompensa quem comprou pouco (pode desmotivar)","Quem compra 1 número sente desvantagem clara"]},{id:"scheduled_tiers",icon:BI,color:"violet",gradient:"from-violet-500/20 to-purple-500/10",border:"border-violet-500/30",iconBg:"bg-violet-500/20 text-violet-400",badge:"AGENDADO",badgeColor:"bg-violet-500/20 text-violet-400 border-violet-500/30",title:"Sorteio Escalonado Agendado",subtitle:"Datas e horários fixos por faixa de compra",description:'Cada faixa de compra (nível de quantidade) tem seu próprio sorteio em data e hora anunciados com antecedência. "Quem comprou 1 número: segunda às 20h. Quem comprou 10 ou mais (VIP): sexta às 21h." Cria expectativa e motiva acompanhar as transmissões ao vivo.',tiers:[{qty:"1 nº",prize:"Seg 20h",ratio:"Sorteio Fiel"},{qty:"3 nºs",prize:"Qua 20h",ratio:"Sorteio Bronze"},{qty:"5 nºs",prize:"Sex 20h",ratio:"Sorteio Prata"},{qty:"10 nºs",prize:"Sáb 20h",ratio:"Sorteio Ouro"},{qty:"20 nºs",prize:"Dom 21h",ratio:"Sorteio VIP"}],pros:["Cria expectativa semanal recorrente","Fácil de comunicar no WhatsApp com dia/hora fixos","Clientes podem planejar quando acompanhar",'Sensação de "clube" com sorteios exclusivos por faixa'],cons:["Exige pontualidade — não pode atrasar nem cancelar","Se poucos compraram naquela faixa, o sorteio parece vazio","Gerenciar 5 datas diferentes por semana é trabalhoso","Prêmio fixo pode parecer pouco atrativo em semanas de baixa venda"]},{id:"revenue_trigger",icon:ys,color:"emerald",gradient:"from-emerald-500/20 to-green-500/10",border:"border-emerald-500/30",iconBg:"bg-emerald-500/20 text-emerald-400",badge:"INTELIGENTE",badgeColor:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",title:"Gatilho por Meta de Arrecadação",subtitle:"Sorteio dispara quando a faixa acumula receita suficiente",description:'Cada faixa de compra define uma meta de arrecadação. Quando o gráfico mostra que a faixa "1 número" acumulou R$200, o sorteio de R$20 dispara sozinho. Saudável financeiramente: o prêmio é sempre cerca de 10% do que foi arrecadado naquela faixa.',tiers:[{qty:"1 nº",prize:"Meta: R$200 → R$20",ratio:"10% do arrecadado"},{qty:"3 nºs",prize:"Meta: R$400 → R$40",ratio:"10% do arrecadado"},{qty:"5 nºs",prize:"Meta: R$750 → R$75",ratio:"10% do arrecadado"},{qty:"10 nºs",prize:"Meta: R$1500 → R$150",ratio:"10% do arrecadado"},{qty:"20 nºs",prize:"Meta: R$3000 → R$300",ratio:"10% do arrecadado"}],pros:["Financeiramente saudável — prêmio nunca supera a receita","O gráfico de arrecadação vira ferramenta de decisão real","Sorteios acontecem quando há volume suficiente de participantes","Processo automático verifica as metas a cada minuto","Cresce junto com as vendas — quanto mais vende, maior o prêmio"],cons:['Menos previsível para o cliente — "quando vai sortear?"','Exige comunicação ativa: "Faltam R$80 para o próximo sorteio!"',"Pode demorar muito em rifas com poucos compradores","Precisa de barra de progresso visível para manter interesse"]},{id:"badges",icon:iI,color:"rose",gradient:"from-rose-500/20 to-pink-500/10",border:"border-rose-500/30",iconBg:"bg-rose-500/20 text-rose-400",badge:"FIDELIZAÇÃO",badgeColor:"bg-rose-500/20 text-rose-400 border-rose-500/30",title:"Medalhas de Participação",subtitle:"Sistema de conquistas e recompensas por histórico de compras",description:'Selos (medalhas virtuais) acumulados ao longo de múltiplas rifas. Participante, Frequente, VIP, Diamante — cada medalha desbloqueia benefícios reais como desconto na próxima rifa, bilhete bônus ou sorteio exclusivo. Funciona como um "programa de pontos", mas sem precisar pagar dinheiro de volta.',tiers:[{qty:"Participante",prize:"1ª rifa",ratio:"Sem benefício extra"},{qty:"Frequente",prize:"5 rifas",ratio:"+5% desconto"},{qty:"VIP",prize:"10 nºs numa rifa",ratio:"+1 bilhete bônus"},{qty:"Diamante",prize:"Todas do mês",ratio:"Sorteio exclusivo"},{qty:"Lendário",prize:"3 meses seguidos",ratio:"Frete grátis + bônus"}],pros:['Cria identidade e pertencimento ("sou VIP aqui!")',"Incentiva o cliente a voltar sem precisar dar prêmio imediato","Clientes compartilham suas medalhas nas redes — divulgação gratuita","Programa de fidelidade sem precisar devolver dinheiro","Diferencial único frente a rifas concorrentes"],cons:["É o mais complexo de construir — exige novo sistema de medalhas","O valor que o cliente enxerga depende do tamanho da base de clientes","Medalha sem benefício concreto é ignorada rapidamente","Precisa de design visual cuidadoso no aplicativo do cliente","As regras podem ficar complexas demais com o tempo"]}],[T,V]=b.useState({titulo:"",descricao:"",preco_numero:"",total_numeros:"",start_at:"",end_at:"",status:"active"}),X=async()=>{r(!0);const z=await gr.list();t(z),r(!1)};b.useEffect(()=>{X()},[]);const U=z=>{var q,ie,oe;z?(u(z),V({titulo:z.name||z.titulo,descricao:z.description||z.descricao||"",preco_numero:((q=z.price_default)==null?void 0:q.toString())||((ie=z.preco_numero)==null?void 0:ie.toString())||"5.00",total_numeros:((oe=z.total_numeros)==null?void 0:oe.toString())||"500",start_at:z.start_at?new Date(z.start_at).toISOString().split("T")[0]:"",end_at:z.end_at?new Date(z.end_at).toISOString().split("T")[0]:"",status:z.status})):(u(null),V({titulo:"",descricao:"",preco_numero:"5.00",total_numeros:"500",start_at:new Date().toISOString().split("T")[0],end_at:new Date(Date.now()+7*24*60*60*1e3).toISOString().split("T")[0],status:"active"})),i(!0)};b.useEffect(()=>{if(!o||!g)return;const z=setInterval(()=>_(Date.now()),1e3);return()=>clearInterval(z)},[o,g]);const L=async z=>{r(!0);try{const[q,ie,oe]=await Promise.all([gr.getDetail(z),gr.getDiscounts(z).catch(()=>[]),gr.getFlashPromo(z).catch(()=>null)]);f(q),v(ie.map(we=>({min_qty:we.min_qty,discount_pct:Number(we.discount_pct)}))),j(oe),l(!0)}catch{alert("Erro ao carregar detalhes")}finally{r(!1)}},B=async()=>{if(d){y(!0);try{await gr.saveDiscounts(d.id,m),alert("Descontos salvos!")}catch{alert("Erro ao salvar descontos")}finally{y(!1)}}},ae=async()=>{if(d){k(!0);try{const z=await gr.createFlashPromo(d.id,N);j(z.promo),_(Date.now())}catch{alert("Erro ao ativar promoção relâmpago")}finally{k(!1)}}},se=async()=>{if(!(!d||!g))try{await gr.cancelFlashPromo(d.id,g.id),j(null)}catch{alert("Erro ao cancelar promoção")}};function xe(z){const q=Math.max(0,new Date(z).getTime()-C),ie=Math.floor(q/36e5),oe=Math.floor(q%36e5/6e4),we=Math.floor(q%6e4/1e3);return ie>0?`${ie}h ${String(oe).padStart(2,"0")}m ${String(we).padStart(2,"0")}s`:`${String(oe).padStart(2,"0")}:${String(we).padStart(2,"0")}`}const H=async z=>{var q,ie;if(confirm("Deseja executar o sorteio agora? O ganhador será selecionado aleatoriamente via SHA256 entre os bilhetes pagos.")){h(!0);try{const oe=await gr.draw(z);alert(`Sorteio realizado! Ganhador: ${oe.result.winner_name} (Bilhete #${oe.result.ticket_number})`),l(!1),X()}catch(oe){alert(((ie=(q=oe.response)==null?void 0:q.data)==null?void 0:ie.error)||"Erro ao realizar sorteio")}finally{h(!1)}}},le=async z=>{z.preventDefault();try{c?await gr.update(c.id,T):await gr.create(T),i(!1),X()}catch{alert("Erro ao salvar sorteio")}},Z=async z=>{if(confirm("Excluir este sorteio?"))try{await gr.delete(z),X()}catch{alert("Erro ao excluir")}};return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-black text-white tracking-tighter uppercase italic",children:"Sorteios Digitais"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Gestão de prêmios, bilhetes e sorteio SHA256."})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{onClick:()=>E(!0),className:"bg-slate-800 hover:bg-slate-700 text-slate-300 hover:text-white border border-slate-700 hover:border-slate-600 font-black px-6 py-4 rounded-2xl flex items-center gap-2 transition-all active:scale-95 italic uppercase text-xs",children:[a.jsx(bI,{size:16,strokeWidth:2.5}),"Tipos de Sorteios"]}),a.jsxs("button",{onClick:()=>U(),className:"bg-cyan-500 hover:bg-cyan-400 text-slate-950 font-black px-8 py-4 rounded-2xl flex items-center gap-2 transition-all shadow-lg shadow-cyan-500/20 active:scale-95 italic uppercase text-xs",children:[a.jsx(Oe,{size:18,strokeWidth:3}),"Novo Sorteio"]})]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:n&&!o?[1,2,3].map(z=>a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 h-72 rounded-[2rem] animate-pulse"},z)):e.map(z=>a.jsxs("div",{className:"bg-slate-900/40 backdrop-blur-md border border-slate-800 rounded-[2rem] overflow-hidden hover:border-cyan-500/30 transition-all group flex flex-col relative",children:[a.jsxs("div",{className:"p-8",children:[a.jsxs("div",{className:"flex justify-between items-start mb-6",children:[a.jsx("div",{className:`px-3 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest border ${z.status==="active"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-slate-800 text-slate-500 border-slate-700"}`,children:z.status}),a.jsxs("span",{className:"text-cyan-400 font-black text-2xl tabular-nums italic tracking-tighter",children:["R$ ",parseFloat(z.price_default||z.preco_numero).toFixed(2)]})]}),a.jsx("h3",{className:"text-xl font-black text-white mb-2 group-hover:text-cyan-400 transition-colors uppercase italic tracking-tight truncate",children:z.name||z.titulo}),a.jsx("div",{className:"flex items-center gap-4 mt-6 p-4 bg-slate-800/20 rounded-2xl border border-slate-800",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex justify-between text-[10px] font-black text-slate-500 uppercase mb-2",children:[a.jsx("span",{children:"Vendas"}),a.jsxs("span",{children:[z.vendas_count||0,"/",z.total_numeros]})]}),a.jsx("div",{className:"h-1.5 w-full bg-slate-800 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-gradient-to-r from-cyan-600 to-cyan-400 shadow-[0_0_8px_rgba(34,211,238,0.4)]",style:{width:`${Math.min(100,(z.vendas_count||0)/z.total_numeros*100)}%`}})})]})})]}),a.jsxs("div",{className:"mt-auto p-6 bg-slate-800/20 border-t border-slate-800 flex items-center justify-between group-hover:bg-slate-800/40 transition-all",children:[a.jsxs("button",{onClick:()=>L(z.id),className:"text-[10px] font-black text-cyan-500 hover:text-cyan-300 uppercase tracking-widest flex items-center gap-2",children:[a.jsx(yu,{size:14}),"Auditagem"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>U(z),className:"p-3 bg-slate-800 text-slate-400 hover:text-white rounded-xl transition-all border border-slate-700",children:a.jsx(vm,{size:16})}),a.jsx("button",{onClick:()=>Z(z.id),className:"p-3 bg-rose-500/10 text-rose-500 hover:bg-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/10",children:a.jsx(Te,{size:16})})]})]})]},z.id))}),a.jsx(Cs,{isOpen:o,onClose:()=>l(!1),title:"Auditagem & Sorteio Digital",children:d&&a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"p-6 bg-slate-800/30 rounded-3xl border border-slate-800",children:[a.jsx("span",{className:"text-[10px] font-black text-slate-500 uppercase block mb-1",children:"Números Vendidos"}),a.jsx("span",{className:"text-3xl font-black text-white italic",children:d.totalSold})]}),a.jsxs("div",{className:"p-6 bg-slate-800/30 rounded-3xl border border-slate-800",children:[a.jsx("span",{className:"text-[10px] font-black text-slate-500 uppercase block mb-1",children:"Disponíveis"}),a.jsx("span",{className:"text-3xl font-black text-cyan-400 italic",children:d.totalDisponivel})]})]}),a.jsxs("div",{className:"bg-slate-950 p-6 rounded-3xl border border-slate-800",children:[a.jsxs("h4",{className:"text-[10px] font-black text-slate-500 uppercase mb-4 flex items-center gap-2",children:[a.jsx(et,{size:14,className:"text-cyan-500"}),"Compradores Recentes"]}),a.jsx("div",{className:"max-h-40 overflow-y-auto space-y-2 pr-2 custom-scrollbar",children:((F=d.soldNumbers)==null?void 0:F.length)>0?d.soldNumbers.slice(0,10).map((z,q)=>a.jsxs("div",{className:"flex justify-between items-center text-xs p-3 bg-slate-900 rounded-xl border border-white/5",children:[a.jsxs("span",{className:"font-bold text-slate-300",children:["#",z.numero.toString().padStart(3,"0")]}),a.jsx("span",{className:"text-slate-500",children:z.usuario_nome||"Cliente"})]},q)):a.jsx("p",{className:"text-slate-600 text-xs italic",children:"Nenhum bilhete vendido ainda."})})]}),a.jsxs("div",{className:`p-6 rounded-3xl border ${g?"bg-orange-500/5 border-orange-500/20":"bg-slate-950 border-slate-800"}`,children:[a.jsxs("h4",{className:"text-[10px] font-black text-slate-500 uppercase mb-4 flex items-center gap-2",children:[a.jsx(ZP,{size:14,className:g?"text-orange-400":"text-cyan-500"}),"Promoção Relâmpago",g&&a.jsxs("span",{className:"ml-auto text-orange-400 font-black text-xs animate-pulse",children:["⚡ ",xe(g.ends_at)]})]}),g?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between bg-orange-500/10 border border-orange-500/20 rounded-2xl px-4 py-3",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-orange-300 font-black text-lg",children:[Number(g.discount_pct).toFixed(0),"% OFF"]}),a.jsx("p",{className:"text-slate-400 text-xs",children:g.label})]}),a.jsx("p",{className:"text-orange-400 font-black tabular-nums text-sm",children:xe(g.ends_at)})]}),a.jsxs("button",{onClick:se,className:"w-full py-2 rounded-xl bg-rose-500/10 hover:bg-rose-500/20 text-rose-400 text-xs font-black border border-rose-500/20 transition-all flex items-center justify-center gap-1.5",children:[a.jsx(Te,{size:12})," Cancelar Promoção"]})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-black text-slate-500 uppercase block mb-1",children:"Desconto %"}),a.jsx("input",{type:"number",min:1,max:100,step:1,value:N.discount_pct,onChange:z=>w(q=>({...q,discount_pct:Number(z.target.value)})),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-3 py-2 text-white text-sm font-black outline-none focus:border-orange-500/50"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-black text-slate-500 uppercase block mb-1",children:"Duração"}),a.jsxs("select",{value:N.duration_minutes,onChange:z=>w(q=>({...q,duration_minutes:Number(z.target.value)})),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-3 py-2 text-white text-sm font-black outline-none focus:border-orange-500/50",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:10,children:"10 minutos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:15,children:"15 minutos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:30,children:"30 minutos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:60,children:"1 hora"}),a.jsx("option",{className:"bg-slate-900 text-white",value:120,children:"2 horas"}),a.jsx("option",{className:"bg-slate-900 text-white",value:240,children:"4 horas"}),a.jsx("option",{className:"bg-slate-900 text-white",value:360,children:"6 horas"}),a.jsx("option",{className:"bg-slate-900 text-white",value:720,children:"12 horas"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] font-black text-slate-500 uppercase block mb-1",children:"Título"}),a.jsx("input",{type:"text",value:N.label,onChange:z=>w(q=>({...q,label:z.target.value})),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-3 py-2 text-white text-sm outline-none focus:border-orange-500/50",placeholder:"Ex: Oferta de fim de semana!"})]}),a.jsxs("button",{disabled:S,onClick:ae,className:"w-full py-2.5 rounded-xl bg-gradient-to-r from-orange-500 to-rose-500 hover:from-orange-400 hover:to-rose-400 disabled:opacity-50 text-white text-xs font-black flex items-center justify-center gap-1.5 transition-all shadow-lg shadow-orange-500/20",children:[a.jsx(Mo,{size:12})," ",S?"Ativando…":"Ativar Promoção Relâmpago"]})]})]}),a.jsxs("div",{className:"bg-slate-950 p-6 rounded-3xl border border-slate-800",children:[a.jsxs("h4",{className:"text-[10px] font-black text-slate-500 uppercase mb-4 flex items-center gap-2",children:[a.jsx(Xo,{size:14,className:"text-cyan-500"}),"Descontos por Quantidade"]}),a.jsxs("div",{className:"space-y-2 mb-3",children:[m.length===0&&a.jsx("p",{className:"text-slate-600 text-xs italic",children:"Nenhuma faixa configurada."}),m.map((z,q)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-slate-900 border border-slate-800 rounded-xl px-3 py-2",children:[a.jsx("span",{className:"text-[10px] text-slate-500 uppercase font-black shrink-0",children:"Min."}),a.jsx("input",{type:"number",min:2,value:z.min_qty,onChange:ie=>v(oe=>oe.map((we,Ee)=>Ee===q?{...we,min_qty:parseInt(ie.target.value)||2}:we)),className:"w-12 bg-transparent text-white text-sm font-black outline-none"}),a.jsx("span",{className:"text-[10px] text-slate-500 uppercase font-black shrink-0 ml-2",children:"%"}),a.jsx("input",{type:"number",min:1,max:100,step:.5,value:z.discount_pct,onChange:ie=>v(oe=>oe.map((we,Ee)=>Ee===q?{...we,discount_pct:parseFloat(ie.target.value)||0}:we)),className:"w-14 bg-transparent text-cyan-400 text-sm font-black outline-none"})]}),a.jsx("button",{onClick:()=>v(ie=>ie.filter((oe,we)=>we!==q)),className:"p-2 text-rose-500 hover:text-white hover:bg-rose-500/20 rounded-xl transition-all",children:a.jsx(Te,{size:14})})]},q))]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>v(z=>[...z,{min_qty:3,discount_pct:10}]),className:"flex-1 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-black flex items-center justify-center gap-1.5 transition-all border border-slate-700",children:[a.jsx(Oe,{size:12})," Faixa"]}),a.jsxs("button",{disabled:x,onClick:B,className:"flex-1 py-2 rounded-xl bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 text-xs font-black flex items-center justify-center gap-1.5 transition-all",children:[a.jsx(or,{size:12})," ",x?"Salvando…":"Salvar"]})]})]}),d.winner_id?a.jsxs("div",{className:"p-8 bg-emerald-500/10 border border-emerald-500/20 rounded-3xl text-center",children:[a.jsx(ym,{size:48,className:"text-yellow-400 mx-auto mb-4"}),a.jsx("h5",{className:"text-emerald-400 font-black uppercase italic tracking-tighter text-xl",children:"Sorteio Concluído!"}),a.jsx("p",{className:"text-slate-400 text-sm mt-2",children:"Este prêmio já possui um ganhador auditado."})]}):a.jsxs("button",{disabled:p||d.totalSold===0,onClick:()=>H(d.id),className:"w-full bg-gradient-to-r from-orange-500 to-rose-600 hover:from-orange-400 hover:to-rose-500 disabled:opacity-50 text-white font-black py-5 rounded-2xl flex items-center justify-center gap-3 transition-all shadow-xl shadow-rose-500/20 uppercase italic",children:[a.jsx(Mo,{size:20,className:p?"animate-spin":""}),p?"Processando SHA256...":"Executar Sorteio Digital"]})]})}),A&&Bi.createPortal(a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"fixed inset-0 z-[9999] bg-slate-950/95 backdrop-blur-xl flex flex-col animate-in fade-in duration-200",children:[a.jsxs("div",{className:"flex items-center justify-between px-8 py-6 border-b border-slate-800 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"p-3 bg-slate-800 rounded-2xl border border-slate-700",children:a.jsx(nf,{size:22,className:"text-amber-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-black text-white uppercase italic tracking-tighter",children:"Tipos de Sorteios"}),a.jsx("p",{className:"text-slate-500 text-sm font-medium mt-0.5",children:"Estratégias de gamificação — estude, anote e implemente um por vez"})]})]}),a.jsx("button",{onClick:()=>E(!1),className:"p-3 bg-slate-800 hover:bg-slate-700 text-slate-400 hover:text-white rounded-2xl border border-slate-700 transition-all active:scale-95",children:a.jsx(Ce,{size:20})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-8",children:[a.jsx("div",{className:"max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:W.map(z=>{const q=z.icon;return a.jsxs("div",{className:`bg-gradient-to-br ${z.gradient} border ${z.border} rounded-3xl flex flex-col overflow-hidden`,children:[a.jsxs("div",{className:"p-6 pb-4",children:[a.jsxs("div",{className:"flex items-start justify-between mb-4",children:[a.jsx("div",{className:`p-3 rounded-2xl ${z.iconBg}`,children:a.jsx(q,{size:22,strokeWidth:2})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`px-2.5 py-1 rounded-lg text-[9px] font-black uppercase tracking-widest border ${z.badgeColor}`,children:z.badge}),a.jsx("button",{onClick:()=>R(z.id),title:"Modo leitura A4",className:"p-2 rounded-xl bg-slate-800/60 hover:bg-white/10 text-slate-500 hover:text-white border border-slate-700/50 hover:border-white/20 transition-all active:scale-95",children:a.jsx(Ep,{size:14,strokeWidth:2})})]})]}),a.jsx("h3",{className:"text-lg font-black text-white uppercase italic tracking-tight leading-tight",children:z.title}),a.jsx("p",{className:"text-slate-400 text-xs font-medium mt-1",children:z.subtitle}),a.jsx("p",{className:"text-slate-500 text-xs mt-3 leading-relaxed",children:z.description})]}),a.jsxs("div",{className:"mx-6 mb-4 bg-slate-900/60 rounded-2xl border border-slate-800 overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-3 px-3 py-2 border-b border-slate-800",children:[a.jsx("span",{className:"text-[9px] font-black text-slate-600 uppercase",children:"Faixa"}),a.jsx("span",{className:"text-[9px] font-black text-slate-600 uppercase",children:"Prêmio / Hora"}),a.jsx("span",{className:"text-[9px] font-black text-slate-600 uppercase text-right",children:"Retorno"})]}),z.tiers.map((ie,oe)=>a.jsxs("div",{className:`grid grid-cols-3 px-3 py-2 ${oea.jsxs("li",{className:"text-[10px] text-slate-400 leading-tight flex gap-1.5",children:[a.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),ie]},oe))})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-[9px] font-black text-rose-500 uppercase tracking-widest mb-2 flex items-center gap-1",children:[a.jsx(Ai,{size:10})," Desvantagens"]}),a.jsx("ul",{className:"space-y-1.5",children:z.cons.map((ie,oe)=>a.jsxs("li",{className:"text-[10px] text-slate-400 leading-tight flex gap-1.5",children:[a.jsx("span",{className:"text-rose-500 mt-0.5 shrink-0",children:"−"}),ie]},oe))})]})]}),a.jsxs("div",{className:"px-6 pb-6 mt-auto",children:[a.jsxs("label",{className:"text-[9px] font-black text-slate-600 uppercase tracking-widest mb-2 flex items-center gap-1",children:[a.jsx(nf,{size:9,className:"text-amber-500"}),"Minhas anotações / sugestões de melhoria"]}),a.jsx("textarea",{value:P[z.id]||"",onChange:ie=>M(z.id,ie.target.value),placeholder:"Ex: Usar crédito em vez de dinheiro para evitar lei 5768. Notificar via WhatsApp 1h antes do sorteio...",className:"w-full bg-slate-900/80 border border-slate-700 focus:border-amber-500/50 rounded-2xl px-4 py-3 text-white text-[11px] outline-none transition-all resize-none h-24 placeholder:text-slate-700 font-mono leading-relaxed"}),P[z.id]&&a.jsxs("p",{className:"text-[9px] text-slate-600 mt-1.5 flex items-center gap-1",children:[a.jsx(nn,{size:9,className:"text-emerald-600"}),"Salvo automaticamente"]})]})]},z.id)})}),a.jsxs("div",{className:"max-w-7xl mx-auto mt-8 p-6 bg-slate-900/40 border border-slate-800 rounded-3xl flex items-start gap-4",children:[a.jsx("div",{className:"p-3 bg-amber-500/10 rounded-2xl shrink-0",children:a.jsx(nf,{size:20,className:"text-amber-400"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-black text-sm uppercase italic",children:"Como usar este painel"}),a.jsxs("p",{className:"text-slate-400 text-xs mt-1 leading-relaxed max-w-3xl",children:["Estude cada tipo, anote suas ideias no campo abaixo de cada card — as anotações são salvas automaticamente no navegador. Quando decidir qual estratégia implementar, abra uma conversa e mencione o tipo escolhido. A implementação de cada tipo leva de 1 a 5 dias dependendo da complexidade.",a.jsx("span",{className:"text-amber-400 font-black",children:' Recomendação: comece pelo "Sorteio Relâmpago por Tier" — tem o maior impacto com o menor esforço técnico.'})]})]})]})]})]}),I&&(()=>{const z=W.find(ie=>ie.id===I),q=z.icon;return a.jsxs("div",{className:"fixed inset-0 z-[10000] bg-slate-900/90 backdrop-blur-sm flex flex-col animate-in fade-in duration-150",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 bg-slate-950/80 border-b border-slate-800 shrink-0 print:hidden",children:[a.jsxs("button",{onClick:()=>R(null),className:"flex items-center gap-2 text-slate-400 hover:text-white transition-colors text-sm font-bold",children:[a.jsx(Ui,{size:16}),"Voltar aos cards"]}),a.jsx("span",{className:"text-slate-500 text-xs font-black uppercase tracking-widest",children:"Modo Leitura"}),a.jsxs("button",{onClick:()=>window.print(),className:"flex items-center gap-2 text-slate-400 hover:text-white transition-colors text-sm font-bold print:hidden",children:[a.jsx(GP,{size:15}),"Imprimir / PDF"]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto py-10 px-4 bg-slate-800/20",children:a.jsxs("div",{className:"mx-auto bg-white text-slate-900 shadow-2xl shadow-black/60",style:{width:"210mm",minHeight:"297mm",padding:"20mm 22mm"},children:[a.jsxs("div",{className:"flex items-start justify-between pb-6 border-b-2 border-slate-200 mb-8",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[9px] font-black uppercase tracking-[0.2em] text-slate-400 mb-2",children:"Alemão Conveniências — Estratégia de Sorteios"}),a.jsx("h1",{className:"text-3xl font-black text-slate-900 leading-tight uppercase",children:z.title}),a.jsx("p",{className:"text-slate-500 text-sm font-medium mt-1",children:z.subtitle})]}),a.jsx("div",{className:`p-4 rounded-2xl shrink-0 ml-6 ${z.iconBg.replace("text-","text-").replace("/20","/15")}`,style:{background:"color-mix(in srgb, currentColor 8%, transparent)"},children:a.jsx(q,{size:32,className:z.iconBg.split(" ")[1],strokeWidth:1.5})})]}),a.jsx("div",{className:"flex items-center gap-3 mb-6",children:a.jsx("span",{className:"inline-block px-3 py-1 rounded-md text-[10px] font-black uppercase tracking-widest bg-slate-100 text-slate-600 border border-slate-200",children:z.badge})}),a.jsxs("section",{className:"mb-8",children:[a.jsx("h2",{className:"text-[10px] font-black uppercase tracking-[0.15em] text-slate-400 mb-3 border-b border-slate-100 pb-2",children:"Descrição"}),a.jsx("p",{className:"text-slate-700 text-sm leading-relaxed",children:z.description})]}),a.jsxs("section",{className:"mb-8",children:[a.jsx("h2",{className:"text-[10px] font-black uppercase tracking-[0.15em] text-slate-400 mb-3 border-b border-slate-100 pb-2",children:"Faixas de Compra (níveis por quantidade)"}),a.jsxs("table",{className:"w-full text-sm border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-slate-50",children:[a.jsx("th",{className:"text-left py-2.5 px-3 text-[10px] font-black uppercase tracking-wider text-slate-500 border border-slate-200",children:"Faixa / Qtd. comprada"}),a.jsx("th",{className:"text-left py-2.5 px-3 text-[10px] font-black uppercase tracking-wider text-slate-500 border border-slate-200",children:"Prêmio / Horário"}),a.jsx("th",{className:"text-left py-2.5 px-3 text-[10px] font-black uppercase tracking-wider text-slate-500 border border-slate-200",children:"Retorno / Categoria"})]})}),a.jsx("tbody",{children:z.tiers.map((ie,oe)=>a.jsxs("tr",{className:oe%2===0?"bg-white":"bg-slate-50/50",children:[a.jsx("td",{className:"py-2.5 px-3 font-black text-slate-800 border border-slate-200",children:ie.qty}),a.jsx("td",{className:"py-2.5 px-3 font-semibold text-slate-700 border border-slate-200",children:ie.prize}),a.jsx("td",{className:"py-2.5 px-3 text-slate-500 border border-slate-200 text-xs",children:ie.ratio})]},oe))})]})]}),a.jsxs("section",{className:"mb-8",children:[a.jsx("h2",{className:"text-[10px] font-black uppercase tracking-[0.15em] text-slate-400 mb-4 border-b border-slate-100 pb-2",children:"Análise de Viabilidade"}),a.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-[10px] font-black uppercase tracking-wider text-emerald-600 mb-3 flex items-center gap-1.5",children:[a.jsx(nn,{size:11})," Vantagens"]}),a.jsx("ul",{className:"space-y-2.5",children:z.pros.map((ie,oe)=>a.jsxs("li",{className:"flex gap-2 text-xs text-slate-700 leading-snug",children:[a.jsx("span",{className:"text-emerald-500 font-black shrink-0 mt-0.5",children:"+"}),ie]},oe))})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-[10px] font-black uppercase tracking-wider text-rose-500 mb-3 flex items-center gap-1.5",children:[a.jsx(Ai,{size:11})," Desvantagens"]}),a.jsx("ul",{className:"space-y-2.5",children:z.cons.map((ie,oe)=>a.jsxs("li",{className:"flex gap-2 text-xs text-slate-700 leading-snug",children:[a.jsx("span",{className:"text-rose-500 font-black shrink-0 mt-0.5",children:"−"}),ie]},oe))})]})]})]}),a.jsxs("section",{children:[a.jsxs("h2",{className:"text-[10px] font-black uppercase tracking-[0.15em] text-slate-400 mb-3 border-b border-slate-100 pb-2 flex items-center gap-1.5",children:[a.jsx(nf,{size:11,className:"text-amber-500"}),"Minhas Anotações"]}),P[z.id]?a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 text-xs text-slate-700 font-mono leading-relaxed whitespace-pre-wrap",children:P[z.id]}):a.jsx("p",{className:"text-slate-400 text-xs italic",children:"Nenhuma anotação registrada. Volte aos cards para adicionar sugestões."})]}),a.jsxs("div",{className:"mt-12 pt-4 border-t border-slate-200 flex items-center justify-between",children:[a.jsx("p",{className:"text-[9px] text-slate-400 uppercase tracking-widest",children:"alemaoconveniencias.local — Documento interno"}),a.jsxs("p",{className:"text-[9px] text-slate-400",children:["Gerado em ",new Date().toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"})]})]})]})})]})})()]}),document.body),a.jsx(Cs,{isOpen:s,onClose:()=>i(!1),title:c?"Editar Sorteio":"Novo Sorteio",children:a.jsxs("form",{onSubmit:le,className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Prêmio / Nome do Sorteio"}),a.jsx("input",{required:!0,type:"text",value:T.titulo,onChange:z=>V({...T,titulo:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Descrição / Regras"}),a.jsx("textarea",{value:T.descricao,onChange:z=>V({...T,descricao:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all h-24 resize-none",placeholder:"Descrição detalhada..."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Preço por Bilhete"}),a.jsx("input",{required:!0,type:"number",step:"0.01",value:T.preco_numero,onChange:z=>V({...T,preco_numero:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Total de Cotas"}),a.jsx("input",{required:!0,type:"number",value:T.total_numeros,onChange:z=>V({...T,total_numeros:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Data de Início"}),a.jsx("input",{required:!0,type:"date",value:T.start_at,onChange:z=>V({...T,start_at:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Data de Término"}),a.jsx("input",{required:!0,type:"date",value:T.end_at,onChange:z=>V({...T,end_at:z.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white"})]})]}),a.jsxs("button",{type:"submit",className:"w-full bg-cyan-500 hover:bg-cyan-400 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm",children:[a.jsx(or,{size:20}),c?"Salvar Alterações":"Criar Sorteio"]})]})})]})}function Nfe(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[o,l]=b.useState(null),[c,u]=b.useState(!1),d=b.useRef(null),[f,p]=b.useState({nome:"",descricao:"",preco_original:"",preco_promocional:"",imagem:"",ativo:!0}),h=async()=>{r(!0);const g=await yf.list();t(g),r(!1)};b.useEffect(()=>{h()},[]);const m=g=>{var j;g?(l(g),p({nome:g.nome,descricao:g.descricao||"",preco_original:((j=g.preco_original)==null?void 0:j.toString())||"",preco_promocional:g.preco_promocional.toString(),imagem:g.imagem||"",ativo:g.ativo!==!1})):(l(null),p({nome:"",descricao:"",preco_original:"",preco_promocional:"",imagem:"",ativo:!0})),i(!0)},v=async g=>{g.preventDefault();try{o?await yf.update(o.id,f):await yf.create(f),i(!1),h()}catch{alert("Erro ao salvar promoção")}},x=async g=>{var N;const j=(N=g.target.files)==null?void 0:N[0];if(j){u(!0);try{const w=new FormData;w.append("image",j);const S=await fetch("/api/promotions/upload",{method:"POST",credentials:"include",body:w}),k=await S.json();if(!S.ok)throw new Error(k.error||"Erro no upload");p(C=>({...C,imagem:k.path}))}catch(w){alert(w.message)}finally{u(!1)}}},y=async g=>{if(confirm("Tem certeza que deseja excluir esta promoção?"))try{await yf.delete(g),h()}catch{alert("Erro ao excluir")}};return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-bold text-white tracking-tighter uppercase italic",children:"Promoções"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Produtos em oferta na landing page do Alemão."})]}),a.jsxs("button",{onClick:()=>m(),className:"bg-emerald-500 hover:bg-emerald-400 text-slate-950 font-black px-8 py-4 rounded-2xl flex items-center gap-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95 italic uppercase text-xs",children:[a.jsx(Oe,{size:18,strokeWidth:3}),"Nova Oferta"]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:n?[1,2,3].map(g=>a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 h-64 rounded-[2rem] animate-pulse"},g)):e.map(g=>a.jsxs("div",{className:"bg-slate-900/40 backdrop-blur-md border border-slate-800 rounded-[2rem] overflow-hidden hover:border-emerald-500/30 transition-all group flex flex-col relative",children:[g.imagem?a.jsxs("div",{className:"h-40 w-full overflow-hidden relative",children:[a.jsx("img",{src:g.imagem,alt:g.nome,className:"w-full h-full object-cover opacity-60 group-hover:opacity-100 group-hover:scale-110 transition-all duration-700"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-slate-900 to-transparent"})]}):a.jsx("div",{className:"p-8",children:a.jsx("div",{className:"p-4 bg-emerald-500/10 text-emerald-400 rounded-2xl w-fit border border-emerald-500/20",children:a.jsx(Xo,{size:24})})}),a.jsxs("div",{className:"p-8 flex-1 flex flex-col",children:[a.jsx("h3",{className:"text-xl font-black text-white mb-2 group-hover:text-emerald-400 transition-colors uppercase italic tracking-tight",children:g.nome}),a.jsx("p",{className:"text-slate-500 text-sm line-clamp-2 mb-8 font-medium italic",children:g.descricao||"Produto em destaque na vitrine."}),a.jsxs("div",{className:"mt-auto pt-8 border-t border-slate-800/50 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] text-slate-500 font-black uppercase tracking-[0.2em] block mb-1",children:"OFFER UNIT"}),a.jsxs("div",{className:"flex items-center gap-3",children:[g.preco_original&&a.jsxs("span",{className:"text-slate-600 line-through text-xs font-bold tabular-nums",children:["R$ ",parseFloat(g.preco_original).toFixed(2)]}),a.jsxs("span",{className:"text-emerald-400 font-black text-2xl tabular-nums italic tracking-tighter",children:["R$ ",parseFloat(g.preco_promocional).toFixed(2)]})]})]}),a.jsxs("div",{className:"flex gap-3 relative z-10",children:[a.jsx("button",{onClick:()=>m(g),className:"p-3 bg-slate-800 text-slate-400 hover:text-white hover:bg-slate-700 rounded-xl transition-all border border-slate-700",children:a.jsx(vm,{size:18})}),a.jsx("button",{onClick:()=>y(g.id),className:"p-3 bg-rose-500/10 text-rose-500 hover:bg-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/10",children:a.jsx(Te,{size:18})})]})]})]})]},g.id))}),a.jsx(Cs,{isOpen:s,onClose:()=>i(!1),title:o?"Editar Promoção":"Nova Promoção",children:a.jsxs("form",{onSubmit:v,className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Nome do Produto"}),a.jsx("input",{required:!0,type:"text",value:f.nome,onChange:g=>p({...f,nome:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-emerald-500 outline-none transition-all",placeholder:"Ex: Coca-Cola 2L"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Descrição"}),a.jsx("textarea",{value:f.descricao,onChange:g=>p({...f,descricao:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-emerald-500 outline-none transition-all h-24 resize-none",placeholder:"Breve descrição do produto..."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Preço Original"}),a.jsx("input",{type:"number",step:"0.01",value:f.preco_original,onChange:g=>p({...f,preco_original:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-emerald-500 outline-none transition-all",placeholder:"0.00"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Preço Promo (Oferta)"}),a.jsx("input",{required:!0,type:"number",step:"0.01",value:f.preco_promocional,onChange:g=>p({...f,preco_promocional:g.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-emerald-500 outline-none transition-all",placeholder:"0.00"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Foto do Produto"}),a.jsx("input",{ref:d,type:"file",accept:"image/*",onChange:x,className:"hidden"}),f.imagem?a.jsxs("div",{className:"relative rounded-xl overflow-hidden border border-slate-700 h-40",children:[a.jsx("img",{src:f.imagem,alt:"preview",className:"w-full h-full object-cover"}),a.jsx("button",{type:"button",onClick:()=>p(g=>({...g,imagem:""})),className:"absolute top-2 right-2 p-1.5 bg-black/70 text-white rounded-lg hover:bg-rose-500 transition-all",children:a.jsx(Ce,{size:14})})]}):a.jsxs("button",{type:"button",onClick:()=>{var g;return(g=d.current)==null?void 0:g.click()},disabled:c,className:"w-full h-32 border-2 border-dashed border-slate-700 hover:border-emerald-500/50 rounded-xl flex flex-col items-center justify-center gap-2 text-slate-500 hover:text-emerald-400 transition-all disabled:opacity-50",children:[a.jsx(BP,{size:28}),a.jsx("span",{className:"text-[11px] font-black uppercase tracking-widest",children:c?"Enviando...":"Clique para carregar foto"})]})]})]}),a.jsxs("button",{type:"submit",className:"w-full bg-emerald-500 hover:bg-emerald-400 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-emerald-500/20 uppercase italic text-sm",children:[a.jsx(or,{size:20}),o?"Salvar Alterações":"Criar Promoção"]})]})})]})}const Sfe=[{value:"",label:"Todos"},{value:"purchase_confirmed",label:"Compra"},{value:"purchase_pending",label:"Pendente"},{value:"winner",label:"Ganhador"},{value:"welcome",label:"Boas-vindas"},{value:"security_login",label:"Segurança"},{value:"price_drop",label:"Preço"},{value:"last_hours",label:"Últ. Horas"},{value:"reservation_expiring",label:"Reserva"},{value:"club_welcome",label:"Clube: Boas-vindas"},{value:"club_payment_confirmed",label:"Clube: Pagamento"},{value:"club_payment_overdue",label:"Clube: Atraso"},{value:"club_payment_reminder",label:"Clube: Lembrete"},{value:"club_suspended",label:"Clube: Suspenso"},{value:"club_canceled",label:"Clube: Cancelado"}];function Tj(e){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"})}function kfe(e){return e==="sent"?a.jsx(nn,{size:15,className:"text-emerald-400"}):e==="failed"?a.jsx(Ai,{size:15,className:"text-rose-400"}):a.jsx(hn,{size:15,className:"text-slate-500"})}function Cfe(e){return e==="sent"?"text-emerald-400":e==="failed"?"text-rose-400":"text-slate-500"}function _fe(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(""),o=async()=>{r(!0);try{const u=await $.get("/analytics/whatsapp-logs");t(u.data)}catch{}finally{r(!1)}};b.useEffect(()=>{o()},[]);const l=e.reduce((u,d)=>(u[d.status]=(u[d.status]||0)+1,u),{}),c=s?e.filter(u=>u.type===s):e;return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex gap-3 flex-wrap",children:[{key:"sent",label:"Enviados",color:"emerald"},{key:"retrying",label:"Tentando",color:"amber"},{key:"failed",label:"Falhas",color:"rose"},{key:"processing",label:"Processando",color:"cyan"}].map(u=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl px-5 py-3 flex items-center gap-3",children:[a.jsx("span",{className:`text-2xl font-black tabular-nums text-${u.color}-400`,children:l[u.key]??0}),a.jsx("span",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest",children:u.label})]},u.key))}),a.jsx("div",{className:"flex gap-1.5 flex-wrap",children:Sfe.map(u=>{const d=u.value?e.filter(f=>f.type===u.value).length:e.length;return a.jsxs("button",{onClick:()=>i(u.value),className:`px-3 py-1.5 rounded-xl text-xs font-bold transition-all border ${s===u.value?"text-cyan-400 bg-cyan-400/10 border-cyan-500/30":"text-slate-500 bg-slate-900 border-slate-800 hover:border-slate-700 hover:text-slate-300"}`,children:[u.label,d>0&&a.jsx("span",{className:"ml-1.5 text-[9px] bg-slate-700 text-slate-400 px-1.5 py-0.5 rounded-full",children:d})]},u.value)})}),a.jsx($j,{loading:n,empty:c.length===0,head:["Status","Telefone","Tipo","Payload","Data"],emptyMsg:"Nenhuma notificação registrada.",children:c.map(u=>{var d;return a.jsxs("tr",{className:"hover:bg-slate-800/20 transition-colors",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-2",children:[kfe(u.status),a.jsx("span",{className:`text-[10px] font-black uppercase tracking-widest ${Cfe(u.status)}`,children:u.status})]})}),a.jsx("td",{className:"px-6 py-4 text-sm text-slate-300 font-mono",children:u.phone??"—"}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"bg-slate-800 text-slate-400 px-2 py-1 rounded text-[10px] font-bold uppercase tracking-tight",children:(d=u.type)==null?void 0:d.replace(/_/g," ")})}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-500 font-mono max-w-xs truncate",children:JSON.stringify(u.payload)}),a.jsx("td",{className:"px-6 py-4 text-[11px] text-slate-500 whitespace-nowrap",children:Tj(u.created_at)})]},u.id)})})]})}function Afe(){const[e,t]=b.useState({rows:[],total:0}),[n,r]=b.useState(!0),[s,i]=b.useState(""),o=async()=>{r(!0);try{const l=await $.get("/admin/notification-errors",{params:{phone:s||void 0,limit:100}});t(l.data)}catch{}finally{r(!1)}};return b.useEffect(()=>{o()},[]),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex gap-3 items-center",children:[a.jsxs("div",{className:"bg-rose-500/10 border border-rose-500/20 rounded-2xl px-5 py-3 flex items-center gap-3",children:[a.jsx("span",{className:"text-2xl font-black text-rose-400",children:e.total}),a.jsx("span",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest",children:"falhas definitivas"})]}),a.jsx("input",{value:s,onChange:l=>i(l.target.value),onKeyDown:l=>l.key==="Enter"&&o(),placeholder:"Filtrar por telefone…",className:"bg-slate-900 border border-slate-700 rounded-xl px-4 py-2.5 text-sm text-slate-300 focus:outline-none focus:border-slate-500 w-56"})]}),a.jsx($j,{loading:n,empty:e.rows.length===0,head:["Telefone","Erro","Payload","Job ID","Data"],emptyMsg:"Nenhuma falha definitiva registrada. ✅",children:e.rows.map(l=>a.jsxs("tr",{className:"hover:bg-slate-800/20 transition-colors",children:[a.jsx("td",{className:"px-6 py-4 text-sm text-rose-300 font-mono",children:l.phone??"—"}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-400 max-w-xs",children:l.error_message}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-500 font-mono max-w-xs truncate",children:JSON.stringify(l.payload)}),a.jsx("td",{className:"px-6 py-4 text-[10px] text-slate-600 font-mono",children:l.job_id}),a.jsx("td",{className:"px-6 py-4 text-[11px] text-slate-500 whitespace-nowrap",children:Tj(l.created_at)})]},l.id))})]})}function Pfe(){const[e,t]=b.useState({rows:[],total:0}),[n,r]=b.useState(!0),[s,i]=b.useState(""),[o,l]=b.useState(""),c=async()=>{r(!0);try{const d=await $.get("/admin/nw-events",{params:{event:s||void 0,direction:o||void 0,limit:100}});t(d.data)}catch{}finally{r(!1)}};b.useEffect(()=>{c()},[]);const u=d=>d==="in"?a.jsx(aI,{size:13,className:"text-emerald-400"}):a.jsx(sI,{size:13,className:"text-cyan-400"});return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap items-center",children:[a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl px-5 py-3 flex items-center gap-3",children:[a.jsx("span",{className:"text-2xl font-black text-slate-300",children:e.total}),a.jsx("span",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest",children:"eventos"})]}),["","message.new","session.status"].map(d=>a.jsx("button",{onClick:()=>{i(d)},className:`px-3 py-1.5 rounded-xl text-xs font-bold border transition-all ${s===d?"text-cyan-400 bg-cyan-400/10 border-cyan-500/30":"text-slate-500 bg-slate-900 border-slate-800 hover:text-slate-300"}`,children:d||"Todos"},d)),["","in","out"].map(d=>a.jsx("button",{onClick:()=>l(d),className:`px-3 py-1.5 rounded-xl text-xs font-bold border transition-all ${o===d?"text-violet-400 bg-violet-400/10 border-violet-500/30":"text-slate-500 bg-slate-900 border-slate-800 hover:text-slate-300"}`,children:d===""?"Todos":d==="in"?"↙ Recebidos":"↗ Enviados"},d)),a.jsx("button",{onClick:c,className:"p-2 bg-slate-800 rounded-xl border border-slate-700 hover:bg-slate-700 transition-all",children:a.jsx(ke,{size:14,className:"text-slate-400"})})]}),a.jsx($j,{loading:n,empty:e.rows.length===0,head:["Direção","Evento","Instância","Chat ID","Tipo msg","Payload","Data"],emptyMsg:"Nenhum evento recebido ainda.",children:e.rows.map(d=>a.jsxs("tr",{className:"hover:bg-slate-800/20 transition-colors",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[u(d.direction),a.jsx("span",{className:`text-[10px] font-black uppercase ${d.direction==="in"?"text-emerald-400":"text-cyan-400"}`,children:d.direction})]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"bg-slate-800 text-slate-400 px-2 py-1 rounded text-[10px] font-bold",children:d.event})}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-400 font-mono",children:d.instance_id||"—"}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-500 font-mono max-w-[120px] truncate",children:d.chat_id||"—"}),a.jsx("td",{className:"px-6 py-4 text-[10px] text-slate-600 uppercase",children:d.msg_type||"—"}),a.jsx("td",{className:"px-6 py-4 text-xs text-slate-500 font-mono max-w-xs truncate",children:JSON.stringify(d.payload)}),a.jsx("td",{className:"px-6 py-4 text-[11px] text-slate-500 whitespace-nowrap",children:Tj(d.created_at)})]},d.id))})]})}function $j({loading:e,empty:t,head:n,emptyMsg:r,children:s}){return a.jsx("div",{className:"bg-slate-900/50 border border-slate-800 rounded-3xl overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsx("tr",{className:"bg-slate-800/30 text-slate-500 text-[10px] uppercase tracking-widest font-bold",children:n.map(i=>a.jsx("th",{className:"px-6 py-4",children:i},i))})}),a.jsx("tbody",{className:"divide-y divide-slate-800",children:e?[1,2,3].map(i=>a.jsx("tr",{className:"animate-pulse",children:a.jsx("td",{colSpan:n.length,className:"px-6 py-6 bg-slate-800/10"})},i)):t?a.jsx("tr",{children:a.jsx("td",{colSpan:n.length,className:"px-6 py-20 text-center text-slate-500",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(rn,{size:36,className:"text-slate-800"}),a.jsx("p",{className:"text-sm",children:r})]})})}):s})]})})})}const Efe=[{key:"logs",label:"Logs de Saída",icon:a.jsx(rn,{size:14})},{key:"errors",label:"Falhas Definitivas",icon:a.jsx(Kt,{size:14})},{key:"inbox",label:"Inbox Recebidos",icon:a.jsx(Pr,{size:14})}];function Ofe(){const[e,t]=b.useState("logs"),[,n]=b.useState(0);return a.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-black text-white tracking-tighter uppercase italic",children:"Auditoria WhatsApp"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Logs de envio, falhas definitivas e mensagens recebidas."})]}),a.jsx("button",{onClick:()=>n(r=>r+1),className:"p-3 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-xl transition-all border border-slate-700",children:a.jsx(ke,{size:18})})]}),a.jsx("div",{className:"flex gap-1 bg-slate-900/60 border border-slate-800 rounded-2xl p-1 w-fit",children:Efe.map(r=>a.jsxs("button",{onClick:()=>t(r.key),className:`flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-black uppercase tracking-wider transition-all ${e===r.key?"bg-slate-700 text-white":"text-slate-500 hover:text-slate-300"}`,children:[r.icon,r.label]},r.key))}),e==="logs"&&a.jsx(_fe,{},"logs"),e==="errors"&&a.jsx(Afe,{},"errors"),e==="inbox"&&a.jsx(Pfe,{},"inbox")]})}const Mj=b.createContext({});function Rj(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const Tfe=typeof window<"u",y6=Tfe?b.useLayoutEffect:b.useEffect,gx=b.createContext(null);function Dj(e,t){e.indexOf(t)===-1&&e.push(t)}function Bh(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const la=(e,t,n)=>n>t?t:n{};const _s={},b6=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function j6(e){return typeof e=="object"&&e!==null}const w6=e=>/^0[^.\s]+$/u.test(e);function N6(e){let t;return()=>(t===void 0&&(t=e()),t)}const lr=e=>e,$fe=(e,t)=>n=>t(e(n)),Td=(...e)=>e.reduce($fe),sd=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Lj{constructor(){this.subscriptions=[]}add(t){return Dj(this.subscriptions,t),()=>Bh(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;ie*1e3,sr=e=>e/1e3;function S6(e,t){return t?e*(1e3/t):0}const k6=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Mfe=1e-7,Rfe=12;function Dfe(e,t,n,r,s){let i,o,l=0;do o=t+(n-t)/2,i=k6(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>Mfe&&++lDfe(i,0,1,e,n);return i=>i===0||i===1?i:k6(s(i),t,r)}const C6=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,_6=e=>t=>1-e(1-t),A6=$d(.33,1.53,.69,.99),zj=_6(A6),P6=C6(zj),E6=e=>e>=1?1:(e*=2)<1?.5*zj(e):.5*(2-Math.pow(2,-10*(e-1))),Bj=e=>1-Math.sin(Math.acos(e)),O6=_6(Bj),T6=C6(Bj),Ife=$d(.42,0,1,1),Lfe=$d(0,0,.58,1),$6=$d(.42,0,.58,1),zfe=e=>Array.isArray(e)&&typeof e[0]!="number",M6=e=>Array.isArray(e)&&typeof e[0]=="number",Bfe={linear:lr,easeIn:Ife,easeInOut:$6,easeOut:Lfe,circIn:Bj,circInOut:T6,circOut:O6,backIn:zj,backInOut:P6,backOut:A6,anticipate:E6},Ffe=e=>typeof e=="string",v4=e=>{if(M6(e)){Ij(e.length===4);const[t,n,r,s]=e;return $d(t,n,r,s)}else if(Ffe(e))return Bfe[e];return e},jf=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Vfe(e,t){let n=new Set,r=new Set,s=!1,i=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(u.schedule(d),e()),d(l)}const u={schedule:(d,f=!1,p=!1)=>{const m=p&&s?n:r;return f&&o.add(d),m.add(d),d},cancel:d=>{r.delete(d),o.delete(d)},process:d=>{if(l=d,s){i=!0;return}s=!0;const f=n;n=r,r=f,n.forEach(c),n.clear(),s=!1,i&&(i=!1,u.process(d))}};return u}const Ufe=40;function R6(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=jf.reduce((j,N)=>(j[N]=Vfe(i),j),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:p,render:h,postRender:m}=o,v=()=>{const j=_s.useManualTiming,N=j?s.timestamp:performance.now();n=!1,j||(s.delta=r?1e3/60:Math.max(Math.min(N-s.timestamp,Ufe),1)),s.timestamp=N,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),p.process(s),h.process(s),m.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(v))},x=()=>{n=!0,r=!0,s.isProcessing||e(v)};return{schedule:jf.reduce((j,N)=>{const w=o[N];return j[N]=(S,k=!1,C=!1)=>(n||x(),w.schedule(S,k,C)),j},{}),cancel:j=>{for(let N=0;N(Xf===void 0&&dn.set(Vt.isProcessing||_s.useManualTiming?Vt.timestamp:performance.now()),Xf),set:e=>{Xf=e,queueMicrotask(Wfe)}},D6=e=>t=>typeof t=="string"&&t.startsWith(e),I6=D6("--"),qfe=D6("var(--"),Fj=e=>qfe(e)?Hfe.test(e.split("/*")[0].trim()):!1,Hfe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function y4(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Kl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},id={...Kl,transform:e=>la(0,1,e)},wf={...Kl,default:1},Xc=e=>Math.round(e*1e5)/1e5,Vj=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Kfe(e){return e==null}const Gfe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Uj=(e,t)=>n=>!!(typeof n=="string"&&Gfe.test(n)&&n.startsWith(e)||t&&!Kfe(n)&&Object.prototype.hasOwnProperty.call(n,t)),L6=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(Vj);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},Xfe=e=>la(0,255,e),M0={...Kl,transform:e=>Math.round(Xfe(e))},fi={test:Uj("rgb","red"),parse:L6("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+M0.transform(e)+", "+M0.transform(t)+", "+M0.transform(n)+", "+Xc(id.transform(r))+")"};function Yfe(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const zy={test:Uj("#"),parse:Yfe,transform:fi.transform},Md=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Wa=Md("deg"),ta=Md("%"),pe=Md("px"),Qfe=Md("vh"),Jfe=Md("vw"),b4={...ta,parse:e=>ta.parse(e)/100,transform:e=>ta.transform(e*100)},ko={test:Uj("hsl","hue"),parse:L6("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+ta.transform(Xc(t))+", "+ta.transform(Xc(n))+", "+Xc(id.transform(r))+")"},yt={test:e=>fi.test(e)||zy.test(e)||ko.test(e),parse:e=>fi.test(e)?fi.parse(e):ko.test(e)?ko.parse(e):zy.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?fi.transform(e):ko.transform(e),getAnimatableNone:e=>{const t=yt.parse(e);return t.alpha=0,yt.transform(t)}},Zfe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function epe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Vj))==null?void 0:t.length)||0)+(((n=e.match(Zfe))==null?void 0:n.length)||0)>0}const z6="number",B6="color",tpe="var",npe="var(",j4="${}",rpe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Sl(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=t.replace(rpe,c=>(yt.test(c)?(r.color.push(i),s.push(B6),n.push(yt.parse(c))):c.startsWith(npe)?(r.var.push(i),s.push(tpe),n.push(c)):(r.number.push(i),s.push(z6),n.push(parseFloat(c))),++i,j4)).split(j4);return{values:n,split:l,indexes:r,types:s}}function ape(e){return Sl(e).values}function F6({split:e,types:t}){const n=e.length;return r=>{let s="";for(let i=0;itypeof e=="number"?0:yt.test(e)?yt.getAnimatableNone(e):e,ope=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:ipe(e);function lpe(e){const t=Sl(e);return F6(t)(t.values.map((r,s)=>ope(r,t.split[s])))}const Tr={test:epe,parse:ape,createTransformer:spe,getAnimatableNone:lpe};function R0(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function cpe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=R0(c,l,e+1/3),i=R0(c,l,e),o=R0(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Fh(e,t){return n=>n>0?t:e}const Je=(e,t,n)=>e+(t-e)*n,D0=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},upe=[zy,fi,ko],dpe=e=>upe.find(t=>t.test(e));function w4(e){const t=dpe(e);if(!t)return!1;let n=t.parse(e);return t===ko&&(n=cpe(n)),n}const N4=(e,t)=>{const n=w4(e),r=w4(t);if(!n||!r)return Fh(e,t);const s={...n};return i=>(s.red=D0(n.red,r.red,i),s.green=D0(n.green,r.green,i),s.blue=D0(n.blue,r.blue,i),s.alpha=Je(n.alpha,r.alpha,i),fi.transform(s))},By=new Set(["none","hidden"]);function fpe(e,t){return By.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function ppe(e,t){return n=>Je(e,t,n)}function Wj(e){return typeof e=="number"?ppe:typeof e=="string"?Fj(e)?Fh:yt.test(e)?N4:xpe:Array.isArray(e)?V6:typeof e=="object"?yt.test(e)?N4:hpe:Fh}function V6(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>Wj(i)(i,t[o]));return i=>{for(let o=0;o{for(const i in r)n[i]=r[i](s);return n}}function mpe(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s{const n=Tr.createTransformer(t),r=Sl(e),s=Sl(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?By.has(e)&&!s.values.length||By.has(t)&&!r.values.length?fpe(e,t):Td(V6(mpe(r,s),s.values),n):Fh(e,t)};function U6(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Je(e,t,n):Wj(e)(e,t)}const gpe=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Ue.update(t,n),stop:()=>As(t),now:()=>Vt.isProcessing?Vt.timestamp:dn.now()}},W6=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i=Vh?1/0:t}function vpe(e,t=100,n){const r=n({...e,keyframes:[0,t]}),s=Math.min(qj(r),Vh);return{type:"keyframes",ease:i=>r.next(s*i).value/t,duration:sr(s)}}const ct={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Fy(e,t){return e*Math.sqrt(1-t*t)}const ype=12;function bpe(e,t,n){let r=n;for(let s=1;s{const d=u*o,f=d*e,p=d-n,h=Fy(u,o),m=Math.exp(-f);return I0-p/h*m},i=u=>{const f=u*o*e,p=f*n+n,h=Math.pow(o,2)*Math.pow(u,2)*e,m=Math.exp(-f),v=Fy(Math.pow(u,2),o);return(-s(u)+I0>0?-1:1)*((p-h)*m)/v}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-I0+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=bpe(s,i,l);if(e=Bn(e),isNaN(c))return{stiffness:ct.stiffness,damping:ct.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const wpe=["duration","bounce"],Npe=["stiffness","damping","mass"];function S4(e,t){return t.some(n=>e[n]!==void 0)}function Spe(e){let t={velocity:ct.velocity,stiffness:ct.stiffness,damping:ct.damping,mass:ct.mass,isResolvedFromDuration:!1,...e};if(!S4(e,Npe)&&S4(e,wpe))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*la(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:ct.mass,stiffness:s,damping:i}}else{const n=jpe({...e,velocity:0});t={...t,...n,mass:ct.mass},t.isResolvedFromDuration=!0}return t}function Uh(e=ct.visualDuration,t=ct.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:f,velocity:p,isResolvedFromDuration:h}=Spe({...n,velocity:-sr(n.velocity||0)}),m=p||0,v=u/(2*Math.sqrt(c*d)),x=o-i,y=sr(Math.sqrt(c/d)),g=Math.abs(x)<5;r||(r=g?ct.restSpeed.granular:ct.restSpeed.default),s||(s=g?ct.restDelta.granular:ct.restDelta.default);let j,N,w,S,k,C;if(v<1)w=Fy(y,v),S=(m+v*y*x)/w,j=A=>{const E=Math.exp(-v*y*A);return o-E*(S*Math.sin(w*A)+x*Math.cos(w*A))},k=v*y*S+x*w,C=v*y*x-S*w,N=A=>Math.exp(-v*y*A)*(k*Math.sin(w*A)+C*Math.cos(w*A));else if(v===1){j=E=>o-Math.exp(-y*E)*(x+(m+y*x)*E);const A=m+y*x;N=E=>Math.exp(-y*E)*(y*A*E-m)}else{const A=y*Math.sqrt(v*v-1);j=I=>{const R=Math.exp(-v*y*I),M=Math.min(A*I,300);return o-R*((m+v*y*x)*Math.sinh(M)+A*x*Math.cosh(M))/A};const E=(m+v*y*x)/A,P=v*y*E-x*A,D=v*y*x-E*A;N=I=>{const R=Math.exp(-v*y*I),M=Math.min(A*I,300);return R*(P*Math.sinh(M)+D*Math.cosh(M))}}const _={calculatedDuration:h&&f||null,velocity:A=>Bn(N(A)),next:A=>{if(!h&&v<1){const P=Math.exp(-v*y*A),D=Math.sin(w*A),I=Math.cos(w*A),R=o-P*(S*D+x*I),M=Bn(P*(k*D+C*I));return l.done=Math.abs(M)<=r&&Math.abs(o-R)<=s,l.value=l.done?o:R,l}const E=j(A);if(h)l.done=A>=f;else{const P=Bn(N(A));l.done=Math.abs(P)<=r&&Math.abs(o-E)<=s}return l.value=l.done?o:E,l},toString:()=>{const A=Math.min(qj(_),Vh),E=W6(P=>_.next(A*P).value,A,30);return A+"ms "+E},toTransition:()=>{}};return _}Uh.applyToOptions=e=>{const t=vpe(e,100,Uh);return e.ease=t.ease,e.duration=Bn(t.duration),e.type="keyframes",e};const kpe=5;function q6(e,t,n){const r=Math.max(t-kpe,0);return S6(n-e(r),t-r)}function Vy({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],p={done:!1,value:f},h=C=>l!==void 0&&Cc,m=C=>l===void 0?c:c===void 0||Math.abs(l-C)-v*Math.exp(-C/r),j=C=>y+g(C),N=C=>{const _=g(C),A=j(C);p.done=Math.abs(_)<=u,p.value=p.done?y:A};let w,S;const k=C=>{h(p.value)&&(w=C,S=Uh({keyframes:[p.value,m(p.value)],velocity:q6(j,C,p.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:C=>{let _=!1;return!S&&w===void 0&&(_=!0,N(C),k(C)),w!==void 0&&C>=w?S.next(C-w):(!_&&N(C),p)}}}function Cpe(e,t,n){const r=[],s=n||_s.mix||U6,i=e.length-1;for(let o=0;ot[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=Cpe(t,r,s),c=l.length,u=d=>{if(o&&d1)for(;fu(la(e[0],e[i-1],d)):u}function Ape(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=sd(0,t,r);e.push(Je(n,1,s))}}function Ppe(e){const t=[0];return Ape(t,e.length-1),t}function Epe(e,t){return e.map(n=>n*t)}function Ope(e,t){return e.map(()=>t||$6).splice(0,e.length-1)}function Yc({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=zfe(r)?r.map(v4):v4(r),i={done:!1,value:t[0]},o=Epe(n&&n.length===t.length?n:Ppe(t),e),l=_pe(o,t,{ease:Array.isArray(s)?s:Ope(t,s)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const Tpe=e=>e!==null;function vx(e,{repeat:t,repeatType:n="loop"},r,s=1){const i=e.filter(Tpe),l=s<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!l||r===void 0?i[l]:r}const $pe={decay:Vy,inertia:Vy,tween:Yc,keyframes:Yc,spring:Uh};function H6(e){typeof e.type=="string"&&(e.type=$pe[e.type])}class Hj{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const Mpe=e=>e/100;class Wh extends Hj{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==dn.now()&&this.tick(dn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;H6(t);const{type:n=Yc,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=t;let{keyframes:l}=t;const c=n||Yc;c!==Yc&&typeof l[0]!="number"&&(this.mixKeyframes=Td(Mpe,U6(l[0],l[1])),l=[0,100]);const u=c({...t,keyframes:l});i==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...l].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=qj(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=u}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:p,repeatDelay:h,type:m,onUpdate:v,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?y<0:y>s;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let j=this.currentTime,N=r;if(f){const C=Math.min(this.currentTime,s)/l;let _=Math.floor(C),A=C%1;!A&&C>=1&&(A=1),A===1&&_--,_=Math.min(_,f+1),!!(_%2)&&(p==="reverse"?(A=1-A,h&&(A-=h/l)):p==="mirror"&&(N=o)),j=la(0,1,A)*l}let w;g?(this.delayState.value=d[0],w=this.delayState):w=N.next(j),i&&!g&&(w.value=i(w.value));let{done:S}=w;!g&&c!==null&&(S=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return k&&m!==Vy&&(w.value=vx(d,this.options,x,this.speed)),v&&v(w.value),k&&this.finish(),w}then(t,n){return this.finished.then(t,n)}get duration(){return sr(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+sr(t)}get time(){return sr(this.currentTime)}set time(t){t=Bn(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return q6(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(dn.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=sr(this.currentTime))}play(){var s,i;if(this.isStopped)return;const{driver:t=gpe,startTime:n}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(i=(s=this.options).onPlay)==null||i.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(dn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function Rpe(e){for(let t=1;te*180/Math.PI,Uy=e=>{const t=pi(Math.atan2(e[1],e[0]));return Wy(t)},Dpe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Uy,rotateZ:Uy,skewX:e=>pi(Math.atan(e[1])),skewY:e=>pi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Wy=e=>(e=e%360,e<0&&(e+=360),e),k4=Uy,C4=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),_4=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Ipe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:C4,scaleY:_4,scale:e=>(C4(e)+_4(e))/2,rotateX:e=>Wy(pi(Math.atan2(e[6],e[5]))),rotateY:e=>Wy(pi(Math.atan2(-e[2],e[0]))),rotateZ:k4,rotate:k4,skewX:e=>pi(Math.atan(e[4])),skewY:e=>pi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function qy(e){return e.includes("scale")?1:0}function Hy(e,t){if(!e||e==="none")return qy(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=Ipe,s=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Dpe,s=l}if(!s)return qy(t);const i=r[t],o=s[1].split(",").map(zpe);return typeof i=="function"?i(o):o[i]}const Lpe=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Hy(n,t)};function zpe(e){return parseFloat(e.trim())}const Gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xl=new Set(Gl),A4=e=>e===Kl||e===pe,Bpe=new Set(["x","y","z"]),Fpe=Gl.filter(e=>!Bpe.has(e));function Vpe(e){const t=[];return Fpe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const ss={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const s=e.max-e.min;return r==="border-box"?s:s-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const s=e.max-e.min;return r==="border-box"?s:s-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Hy(t,"x"),y:(e,{transform:t})=>Hy(t,"y")};ss.translateX=ss.x;ss.translateY=ss.y;const ji=new Set;let Ky=!1,Gy=!1,Xy=!1;function K6(){if(Gy){const e=Array.from(ji).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=Vpe(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))==null||l.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Gy=!1,Ky=!1,ji.forEach(e=>e.complete(Xy)),ji.clear()}function G6(){ji.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Gy=!0)})}function Upe(){Xy=!0,G6(),K6(),Xy=!1}class Kj{constructor(t,n,r,s,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(ji.add(this),Ky||(Ky=!0,Ue.read(G6),Ue.resolveKeyframes(K6))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;if(t[0]===null){const i=s==null?void 0:s.get(),o=t[t.length-1];if(i!==void 0)t[0]=i;else if(r&&n){const l=r.readValue(n,o);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=o),s&&i===void 0&&s.set(t[0])}Rpe(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ji.delete(this)}cancel(){this.state==="scheduled"&&(ji.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Wpe=e=>e.startsWith("--");function X6(e,t,n){Wpe(t)?e.style.setProperty(t,n):e.style[t]=n}const qpe={};function Y6(e,t){const n=N6(e);return()=>qpe[t]??n()}const Hpe=Y6(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Q6=Y6(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Pc=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,P4={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Pc([0,.65,.55,1]),circOut:Pc([.55,0,1,.45]),backIn:Pc([.31,.01,.66,-.59]),backOut:Pc([.33,1.53,.69,.99])};function J6(e,t){if(e)return typeof e=="function"?Q6()?W6(e,t):"ease-out":M6(e)?Pc(e):Array.isArray(e)?e.map(n=>J6(n,t)||P4.easeOut):P4[e]}function Kpe(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[t]:n};c&&(d.offset=c);const f=J6(l,s);Array.isArray(f)&&(d.easing=f);const p={delay:r,duration:s,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return u&&(p.pseudoElement=u),e.animate(d,p)}function Z6(e){return typeof e=="function"&&"applyToOptions"in e}function Gpe({type:e,...t}){return Z6(e)&&Q6()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class e$ extends Hj{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=t;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=t,Ij(typeof t.type!="string");const u=Gpe(t);this.animation=Kpe(n,r,s,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=vx(s,this.options,l,this.speed);this.updateMotionValue&&this.updateMotionValue(d),X6(n,r,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,s;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((s=(r=this.animation).commitStyles)==null||s.call(r))}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return sr(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+sr(t)}get time(){return sr(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Bn(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:s}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&Hpe()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),lr):s(this)}}const t$={anticipate:E6,backInOut:P6,circInOut:T6};function Xpe(e){return e in t$}function Ype(e){typeof e.ease=="string"&&Xpe(e.ease)&&(e.ease=t$[e.ease])}const L0=10;class Qpe extends e${constructor(t){Ype(t),H6(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...o}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const l=new Wh({...o,autoplay:!1}),c=Math.max(L0,dn.now()-this.startTime),u=la(0,L0,c-L0),d=l.sample(c).value,{name:f}=this.options;i&&f&&X6(i,f,d),n.setWithVelocity(l.sample(Math.max(0,c-u)).value,d,u),l.stop()}}const E4=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Tr.test(e)||e==="0")&&!e.startsWith("url("));function Jpe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,"animate"));function ahe(e){var f;const{motionValue:t,name:n,repeatDelay:r,repeatType:s,damping:i,type:o,keyframes:l}=e;if(!(((f=t==null?void 0:t.owner)==null?void 0:f.current)instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=t.owner.getProps();return rhe()&&n&&(n$.has(n)||nhe.has(n)&&the(l))&&(n!=="transform"||!d)&&!u&&!r&&s!=="mirror"&&i!==0&&o!=="inertia"}const she=40;class ihe extends Hj{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",keyframes:l,name:c,motionValue:u,element:d,...f}){var m;super(),this.stop=()=>{var v,x;this._animation&&(this._animation.stop(),(v=this.stopTimeline)==null||v.call(this)),(x=this.keyframeResolver)==null||x.cancel()},this.createdAt=dn.now();const p={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,name:c,motionValue:u,element:d,...f},h=(d==null?void 0:d.KeyframeResolver)||Kj;this.keyframeResolver=new h(l,(v,x,y)=>this.onKeyframesResolved(v,x,p,!y),c,u,d),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(t,n,r,s){var y,g;this.keyframeResolver=void 0;const{name:i,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=r;this.resolvedAt=dn.now();let f=!0;Zpe(t,i,o,l)||(f=!1,(_s.instantAnimations||!c)&&(d==null||d(vx(t,r,n))),t[0]=t[t.length-1],Yy(r),r.repeat=0);const h={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>she?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},m=f&&!u&&ahe(h),v=(g=(y=h.motionValue)==null?void 0:y.owner)==null?void 0:g.current;let x;if(m)try{x=new Qpe({...h,element:v})}catch{x=new Wh(h)}else x=new Wh(h);x.finished.then(()=>{this.notifyFinished()}).catch(lr),this.pendingTimeline&&(this.stopTimeline=x.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=x}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Upe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function r$(e,t,n,r=0,s=1){const i=Array.from(e).sort((u,d)=>u.sortNodePosition(d)).indexOf(t),o=e.size,l=(o-1)*r;return typeof n=="function"?n(i,o):s===1?i*r:l-i*r}const ohe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function lhe(e){const t=ohe.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function a$(e,t,n=1){const[r,s]=lhe(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return b6(o)?parseFloat(o):o}return Fj(s)?a$(s,t,n+1):s}const che={type:"spring",stiffness:500,damping:25,restSpeed:10},uhe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),dhe={type:"keyframes",duration:.8},fhe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},phe=(e,{keyframes:t})=>t.length>2?dhe:Xl.has(e)?e.startsWith("scale")?uhe(t[1]):che:fhe;function s$(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Gj(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?s$(n,e):n}const hhe=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function mhe(e){for(const t in e)if(!hhe.has(t))return!0;return!1}const Xj=(e,t,n,r={},s,i)=>o=>{const l=Gj(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Bn(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:p=>{t.set(p),l.onUpdate&&l.onUpdate(p)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:i?void 0:s};mhe(l)||Object.assign(d,phe(e,d)),d.duration&&(d.duration=Bn(d.duration)),d.repeatDelay&&(d.repeatDelay=Bn(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(Yy(d),d.delay===0&&(f=!0)),(_s.instantAnimations||_s.skipAnimations||s!=null&&s.shouldSkipAnimations)&&(f=!0,Yy(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!i&&t.get()!==void 0){const p=vx(d.keyframes,l);if(p!==void 0){Ue.update(()=>{d.onUpdate(p),d.onComplete()});return}}return l.isSync?new Wh(d):new ihe(d)};function O4(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Yj(e,t,n,r){if(typeof t=="function"){const[s,i]=O4(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=O4(r);t=t(n!==void 0?n:e.custom,s,i)}return t}function wi(e,t,n){const r=e.getProps();return Yj(r,t,n!==void 0?n:r.custom,e)}const i$=new Set(["width","height","top","left","right","bottom",...Gl]),T4=30,xhe=e=>!isNaN(parseFloat(e));class ghe{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var i;const s=dn.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=dn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=xhe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Lj);const r=this.events[t].add(n);return t==="change"?()=>{r(),Ue.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=dn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>T4)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,T4);return S6(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function kl(e,t){return new ghe(e,t)}const Qy=e=>Array.isArray(e);function vhe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,kl(n))}function yhe(e){return Qy(e)?e[e.length-1]||0:e}function bhe(e,t){const n=wi(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=yhe(i[o]);vhe(e,o,l)}}const Wt=e=>!!(e&&e.getVelocity);function jhe(e){return!!(Wt(e)&&e.add)}function Jy(e,t){const n=e.getValue("willChange");if(jhe(n))return n.add(t);if(!n&&_s.WillChange){const r=new _s.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Qj(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const whe="framerAppearId",o$="data-"+Qj(whe);function l$(e){return e.props[o$]}function Nhe({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function c$(e,t,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i,transitionEnd:o,...l}=t;const c=e.getDefaultTransition();i=i?s$(i,c):c;const u=i==null?void 0:i.reduceMotion;r&&(i=r);const d=[],f=s&&e.animationState&&e.animationState.getState()[s];for(const p in l){const h=e.getValue(p,e.latestValues[p]??null),m=l[p];if(m===void 0||f&&Nhe(f,p))continue;const v={delay:n,...Gj(i||{},p)},x=h.get();if(x!==void 0&&!h.isAnimating()&&!Array.isArray(m)&&m===x&&!v.velocity){Ue.update(()=>h.set(m));continue}let y=!1;if(window.MotionHandoffAnimation){const N=l$(e);if(N){const w=window.MotionHandoffAnimation(N,p,Ue);w!==null&&(v.startTime=w,y=!0)}}Jy(e,p);const g=u??e.shouldReduceMotion;h.start(Xj(p,h,m,g&&i$.has(p)?{type:!1}:v,e,y));const j=h.animation;j&&d.push(j)}if(o){const p=()=>Ue.update(()=>{o&&bhe(e,o)});d.length?Promise.all(d).then(p):p()}return d}function Zy(e,t,n={}){var c;const r=wi(e,t,n.type==="exit"?(c=e.presenceContext)==null?void 0:c.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(c$(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:p}=s;return She(e,t,u,d,f,p,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,d]=l==="beforeChildren"?[i,o]:[o,i];return u().then(()=>d())}else return Promise.all([i(),o(n.delay)])}function She(e,t,n=0,r=0,s=0,i=1,o){const l=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),l.push(Zy(c,t,{...o,delay:n+(typeof r=="function"?0:r)+r$(e.variantChildren,c,r,s,i)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(l)}function khe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>Zy(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=Zy(e,t,n);else{const s=typeof t=="function"?wi(e,t,n.custom):t;r=Promise.all(c$(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const Che={test:e=>e==="auto",parse:e=>e},u$=e=>t=>t.test(e),d$=[Kl,pe,ta,Wa,Jfe,Qfe,Che],$4=e=>d$.find(u$(e));function _he(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||w6(e):!0}const Ahe=new Set(["brightness","contrast","saturate","opacity"]);function Phe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Vj)||[];if(!r)return e;const s=n.replace(r,"");let i=Ahe.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const Ehe=/\b([a-z-]*)\(.*?\)/gu,eb={...Tr,getAnimatableNone:e=>{const t=e.match(Ehe);return t?t.map(Phe).join(" "):e}},tb={...Tr,getAnimatableNone:e=>{const t=Tr.parse(e);return Tr.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},M4={...Kl,transform:Math.round},Ohe={rotate:Wa,rotateX:Wa,rotateY:Wa,rotateZ:Wa,scale:wf,scaleX:wf,scaleY:wf,scaleZ:wf,skew:Wa,skewX:Wa,skewY:Wa,distance:pe,translateX:pe,translateY:pe,translateZ:pe,x:pe,y:pe,z:pe,perspective:pe,transformPerspective:pe,opacity:id,originX:b4,originY:b4,originZ:pe},Jj={borderWidth:pe,borderTopWidth:pe,borderRightWidth:pe,borderBottomWidth:pe,borderLeftWidth:pe,borderRadius:pe,borderTopLeftRadius:pe,borderTopRightRadius:pe,borderBottomRightRadius:pe,borderBottomLeftRadius:pe,width:pe,maxWidth:pe,height:pe,maxHeight:pe,top:pe,right:pe,bottom:pe,left:pe,inset:pe,insetBlock:pe,insetBlockStart:pe,insetBlockEnd:pe,insetInline:pe,insetInlineStart:pe,insetInlineEnd:pe,padding:pe,paddingTop:pe,paddingRight:pe,paddingBottom:pe,paddingLeft:pe,paddingBlock:pe,paddingBlockStart:pe,paddingBlockEnd:pe,paddingInline:pe,paddingInlineStart:pe,paddingInlineEnd:pe,margin:pe,marginTop:pe,marginRight:pe,marginBottom:pe,marginLeft:pe,marginBlock:pe,marginBlockStart:pe,marginBlockEnd:pe,marginInline:pe,marginInlineStart:pe,marginInlineEnd:pe,fontSize:pe,backgroundPositionX:pe,backgroundPositionY:pe,...Ohe,zIndex:M4,fillOpacity:id,strokeOpacity:id,numOctaves:M4},The={...Jj,color:yt,backgroundColor:yt,outlineColor:yt,fill:yt,stroke:yt,borderColor:yt,borderTopColor:yt,borderRightColor:yt,borderBottomColor:yt,borderLeftColor:yt,filter:eb,WebkitFilter:eb,mask:tb,WebkitMask:tb},f$=e=>The[e],$he=new Set([eb,tb]);function p$(e,t){let n=f$(e);return $he.has(n)||(n=Tr),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Mhe=new Set(["auto","none","0"]);function Rhe(e,t,n){let r=0,s;for(;r{t.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function h$(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const s=(n==null?void 0:n[e])??r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(r=>r!=null)}const m$=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Yf(e){return j6(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Zj}=R6(queueMicrotask,!1),yr={x:!1,y:!1};function x$(){return yr.x||yr.y}function Ihe(e){return e==="x"||e==="y"?yr[e]?null:(yr[e]=!0,()=>{yr[e]=!1}):yr.x||yr.y?null:(yr.x=yr.y=!0,()=>{yr.x=yr.y=!1})}function g$(e,t){const n=h$(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function Lhe(e){return!(e.pointerType==="touch"||x$())}function zhe(e,t,n={}){const[r,s,i]=g$(e,n);return r.forEach(o=>{let l=!1,c=!1,u;const d=()=>{o.removeEventListener("pointerleave",m)},f=x=>{u&&(u(x),u=void 0),d()},p=x=>{l=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),c&&(c=!1,f(x))},h=()=>{l=!0,window.addEventListener("pointerup",p,s),window.addEventListener("pointercancel",p,s)},m=x=>{if(x.pointerType!=="touch"){if(l){c=!0;return}f(x)}},v=x=>{if(!Lhe(x))return;c=!1;const y=t(o,x);typeof y=="function"&&(u=y,o.addEventListener("pointerleave",m,s))};o.addEventListener("pointerenter",v,s),o.addEventListener("pointerdown",h,s)}),i}const v$=(e,t)=>t?e===t?!0:v$(e,t.parentElement):!1,ew=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Bhe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Fhe(e){return Bhe.has(e.tagName)||e.isContentEditable===!0}const Vhe=new Set(["INPUT","SELECT","TEXTAREA"]);function Uhe(e){return Vhe.has(e.tagName)||e.isContentEditable===!0}const Qf=new WeakSet;function R4(e){return t=>{t.key==="Enter"&&e(t)}}function z0(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Whe=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=R4(()=>{if(Qf.has(n))return;z0(n,"down");const s=R4(()=>{z0(n,"up")}),i=()=>z0(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function D4(e){return ew(e)&&!x$()}const I4=new WeakSet;function qhe(e,t,n={}){const[r,s,i]=g$(e,n),o=l=>{const c=l.currentTarget;if(!D4(l)||I4.has(l))return;Qf.add(c),n.stopPropagation&&I4.add(l);const u=t(c,l),d=(h,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",p),Qf.has(c)&&Qf.delete(c),D4(h)&&typeof u=="function"&&u(h,{success:m})},f=h=>{d(h,c===window||c===document||n.useGlobalTarget||v$(c,h.target))},p=h=>{d(h,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",p,s)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),Yf(l)&&(l.addEventListener("focus",u=>Whe(u,s)),!Fhe(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}function tw(e){return j6(e)&&"ownerSVGElement"in e}const Jf=new WeakMap;let qa;const y$=(e,t,n)=>(r,s)=>s&&s[0]?s[0][e+"Size"]:tw(r)&&"getBBox"in r?r.getBBox()[t]:r[n],Hhe=y$("inline","width","offsetWidth"),Khe=y$("block","height","offsetHeight");function Ghe({target:e,borderBoxSize:t}){var n;(n=Jf.get(e))==null||n.forEach(r=>{r(e,{get width(){return Hhe(e,t)},get height(){return Khe(e,t)}})})}function Xhe(e){e.forEach(Ghe)}function Yhe(){typeof ResizeObserver>"u"||(qa=new ResizeObserver(Xhe))}function Qhe(e,t){qa||Yhe();const n=h$(e);return n.forEach(r=>{let s=Jf.get(r);s||(s=new Set,Jf.set(r,s)),s.add(t),qa==null||qa.observe(r)}),()=>{n.forEach(r=>{const s=Jf.get(r);s==null||s.delete(t),s!=null&&s.size||qa==null||qa.unobserve(r)})}}const Zf=new Set;let Co;function Jhe(){Co=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Zf.forEach(t=>t(e))},window.addEventListener("resize",Co)}function Zhe(e){return Zf.add(e),Co||Jhe(),()=>{Zf.delete(e),!Zf.size&&typeof Co=="function"&&(window.removeEventListener("resize",Co),Co=void 0)}}function L4(e,t){return typeof e=="function"?Zhe(e):Qhe(e,t)}function eme(e){return tw(e)&&e.tagName==="svg"}const tme=[...d$,yt,Tr],nme=e=>tme.find(u$(e)),z4=()=>({translate:0,scale:1,origin:0,originPoint:0}),_o=()=>({x:z4(),y:z4()}),B4=()=>({min:0,max:0}),Ct=()=>({x:B4(),y:B4()}),rme=new WeakMap;function yx(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function od(e){return typeof e=="string"||Array.isArray(e)}const nw=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],rw=["initial",...nw];function bx(e){return yx(e.animate)||rw.some(t=>od(e[t]))}function b$(e){return!!(bx(e)||e.variants)}function ame(e,t,n){for(const r in t){const s=t[r],i=n[r];if(Wt(s))e.addValue(r,s);else if(Wt(i))e.addValue(r,kl(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,kl(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const nb={current:null},j$={current:!1},sme=typeof window<"u";function ime(){if(j$.current=!0,!!sme)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>nb.current=e.matches;e.addEventListener("change",t),t()}else nb.current=!1}const F4=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let qh={};function w$(e){qh=e}function ome(){return qh}class lme{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:o,visualState:l},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Kj,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=dn.now();this.renderScheduledAtthis.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(j$.current||ime(),this.shouldReduceMotion=nb.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),As(this.notifyUpdate),As(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&n$.has(t)&&this.current instanceof HTMLElement){const{factory:o,keyframes:l,times:c,ease:u,duration:d}=n.accelerate,f=new e$({element:this.current,name:t,keyframes:l,times:c,ease:u,duration:Bn(d)}),p=o(f);this.valueSubscriptions.set(t,()=>{p(),f.cancel()});return}const r=Xl.has(t);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&Ue.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i&&i(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in qh){const n=qh[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ct()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=kl(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(b6(r)||w6(r))?r=parseFloat(r):!nme(r)&&Tr.test(n)&&(r=p$(t,n)),this.setBaseTarget(t,Wt(r)?r.get():r)),Wt(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var i;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=Yj(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);o&&(r=o[t])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Wt(s)?s:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Lj),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Zj.render(this.render)}}class N$ extends lme{constructor(){super(...arguments),this.KeyframeResolver=Dhe}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Wt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Ls{constructor(t){this.isMounted=!1,this.node=t}update(){}}function S$({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function cme({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ume(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function B0(e){return e===void 0||e===1}function rb({scale:e,scaleX:t,scaleY:n}){return!B0(e)||!B0(t)||!B0(n)}function Zs(e){return rb(e)||k$(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function k$(e){return V4(e.x)||V4(e.y)}function V4(e){return e&&e!=="0%"}function Hh(e,t,n){const r=e-n,s=t*r;return n+s}function U4(e,t,n,r,s){return s!==void 0&&(e=Hh(e,s,r)),Hh(e,n,r)+t}function ab(e,t=0,n=1,r,s){e.min=U4(e.min,t,n,r,s),e.max=U4(e.max,t,n,r,s)}function C$(e,{x:t,y:n}){ab(e.x,t.translate,t.scale,t.originPoint),ab(e.y,n.translate,n.scale,n.originPoint)}const W4=.999999999999,q4=1.0000000000001;function dme(e,t,n,r=!1){var l;const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let c=0;cW4&&(t.x=1),t.yW4&&(t.y=1)}function Wr(e,t){e.min+=t,e.max+=t}function H4(e,t,n,r,s=.5){const i=Je(e.min,e.max,s);ab(e,t,n,i,r)}function K4(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function ep(e,t,n){const r=n??e;H4(e.x,K4(t.x,r.x),t.scaleX,t.scale,t.originX),H4(e.y,K4(t.y,r.y),t.scaleY,t.scale,t.originY)}function _$(e,t){return S$(ume(e.getBoundingClientRect(),t))}function fme(e,t,n){const r=_$(e,n),{scroll:s}=t;return s&&(Wr(r.x,s.offset.x),Wr(r.y,s.offset.y)),r}const pme={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hme=Gl.length;function mme(e,t,n){let r="",s=!0;for(let i=0;i{if(!t.target)return e;if(typeof e=="string")if(pe.test(e))e=parseFloat(e);else return e;const n=G4(e,t.target.x),r=G4(e,t.target.y);return`${n}% ${r}%`}},xme={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Tr.parse(e);if(s.length>5)return r;const i=Tr.createTransformer(e),o=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+o]/=l,s[1+o]/=c;const u=Je(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}},sb={borderRadius:{...bc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:bc,borderTopRightRadius:bc,borderBottomLeftRadius:bc,borderBottomRightRadius:bc,boxShadow:xme};function P$(e,{layout:t,layoutId:n}){return Xl.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!sb[e]||e==="opacity")}function sw(e,t,n){var o;const r=e.style,s=t==null?void 0:t.style,i={};if(!r)return i;for(const l in r)(Wt(r[l])||s&&Wt(s[l])||P$(l,e)||((o=n==null?void 0:n.getValue(l))==null?void 0:o.liveStyle)!==void 0)&&(i[l]=r[l]);return i}function gme(e){return window.getComputedStyle(e)}class vme extends N${constructor(){super(...arguments),this.type="html",this.renderInstance=A$}readValueFromInstance(t,n){var r;if(Xl.has(n))return(r=this.projection)!=null&&r.isProjecting?qy(n):Lpe(t,n);{const s=gme(t),i=(I6(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return _$(t,n)}build(t,n,r){aw(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return sw(t,n,r)}}const yme={offset:"stroke-dashoffset",array:"stroke-dasharray"},bme={offset:"strokeDashoffset",array:"strokeDasharray"};function jme(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?yme:bme;e[i.offset]=`${-r}`,e[i.array]=`${t} ${n}`}const wme=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function E$(e,{attrX:t,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:o=0,...l},c,u,d){if(aw(e,l,u),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:p}=e;f.transform&&(p.transform=f.transform,delete f.transform),(p.transform||f.transformOrigin)&&(p.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),p.transform&&(p.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete f.transformBox);for(const h of wme)f[h]!==void 0&&(p[h]=f[h],delete f[h]);t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),s!==void 0&&jme(f,s,i,o,!1)}const O$=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),T$=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Nme(e,t,n,r){A$(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(O$.has(s)?s:Qj(s),t.attrs[s])}function $$(e,t,n){const r=sw(e,t,n);for(const s in e)if(Wt(e[s])||Wt(t[s])){const i=Gl.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}class Sme extends N${constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ct}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Xl.has(n)){const r=f$(n);return r&&r.default||0}return n=O$.has(n)?n:Qj(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return $$(t,n,r)}build(t,n,r){E$(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,s){Nme(t,n,r,s)}mount(t){this.isSVGTag=T$(t.tagName),super.mount(t)}}const kme=rw.length;function M$(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?M$(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>khe(e,n,r)))}function Pme(e){let t=Ame(e),n=X4(),r=!0,s=!1;const i=u=>(d,f)=>{var h;const p=wi(e,f,u==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);if(p){const{transition:m,transitionEnd:v,...x}=p;d={...d,...x,...v}}return d};function o(u){t=u(e)}function l(u){const{props:d}=e,f=M$(e.parent)||{},p=[],h=new Set;let m={},v=1/0;for(let y=0;y<_me;y++){const g=Cme[y],j=n[g],N=d[g]!==void 0?d[g]:f[g],w=od(N),S=g===u?j.isActive:null;S===!1&&(v=y);let k=N===f[g]&&N!==d[g]&&w;if(k&&(r||s)&&e.manuallyAnimateOnMount&&(k=!1),j.protectedKeys={...m},!j.isActive&&S===null||!N&&!j.prevProp||yx(N)||typeof N=="boolean")continue;if(g==="exit"&&j.isActive&&S!==!0){j.prevResolvedValues&&(m={...m,...j.prevResolvedValues});continue}const C=Eme(j.prevProp,N);let _=C||g===u&&j.isActive&&!k&&w||y>v&&w,A=!1;const E=Array.isArray(N)?N:[N];let P=E.reduce(i(g),{});S===!1&&(P={});const{prevResolvedValues:D={}}=j,I={...D,...P},R=T=>{_=!0,h.has(T)&&(A=!0,h.delete(T)),j.needsAnimating[T]=!0;const V=e.getValue(T);V&&(V.liveStyle=!1)};for(const T in I){const V=P[T],X=D[T];if(m.hasOwnProperty(T))continue;let U=!1;Qy(V)&&Qy(X)?U=!R$(V,X):U=V!==X,U?V!=null?R(T):h.add(T):V!==void 0&&h.has(T)?R(T):j.protectedKeys[T]=!0}j.prevProp=N,j.prevResolvedValues=P,j.isActive&&(m={...m,...P}),(r||s)&&e.blockInitialAnimation&&(_=!1);const M=k&&C;_&&(!M||A)&&p.push(...E.map(T=>{const V={type:g};if(typeof T=="string"&&(r||s)&&!M&&e.manuallyAnimateOnMount&&e.parent){const{parent:X}=e,U=wi(X,T);if(X.enteringChildren&&U){const{delayChildren:L}=U.transition||{};V.delay=r$(X.enteringChildren,e,L)}}return{animation:T,options:V}}))}if(h.size){const y={};if(typeof d.initial!="boolean"){const g=wi(e,Array.isArray(d.initial)?d.initial[0]:d.initial);g&&g.transition&&(y.transition=g.transition)}h.forEach(g=>{const j=e.getBaseTarget(g),N=e.getValue(g);N&&(N.liveStyle=!0),y[g]=j??null}),p.push({animation:y})}let x=!!p.length;return r&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(x=!1),r=!1,s=!1,x?t(p):Promise.resolve()}function c(u,d){var p;if(n[u].isActive===d)return Promise.resolve();(p=e.variantChildren)==null||p.forEach(h=>{var m;return(m=h.animationState)==null?void 0:m.setActive(u,d)}),n[u].isActive=d;const f=l(u);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:l,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=X4(),s=!0}}}function Eme(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!R$(t,e):!1}function Hs(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function X4(){return{animate:Hs(!0),whileInView:Hs(),whileHover:Hs(),whileTap:Hs(),whileDrag:Hs(),whileFocus:Hs(),exit:Hs()}}function ib(e,t){e.min=t.min,e.max=t.max}function vr(e,t){ib(e.x,t.x),ib(e.y,t.y)}function Y4(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const D$=1e-4,Ome=1-D$,Tme=1+D$,I$=.01,$me=0-I$,Mme=0+I$;function fn(e){return e.max-e.min}function Rme(e,t,n){return Math.abs(e-t)<=n}function Q4(e,t,n,r=.5){e.origin=r,e.originPoint=Je(t.min,t.max,e.origin),e.scale=fn(n)/fn(t),e.translate=Je(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Ome&&e.scale<=Tme||isNaN(e.scale))&&(e.scale=1),(e.translate>=$me&&e.translate<=Mme||isNaN(e.translate))&&(e.translate=0)}function Qc(e,t,n,r){Q4(e.x,t.x,n.x,r?r.originX:void 0),Q4(e.y,t.y,n.y,r?r.originY:void 0)}function J4(e,t,n,r=0){const s=r?Je(n.min,n.max,r):n.min;e.min=s+t.min,e.max=e.min+fn(t)}function Dme(e,t,n,r){J4(e.x,t.x,n.x,r==null?void 0:r.x),J4(e.y,t.y,n.y,r==null?void 0:r.y)}function Z4(e,t,n,r=0){const s=r?Je(n.min,n.max,r):n.min;e.min=t.min-s,e.max=e.min+fn(t)}function Kh(e,t,n,r){Z4(e.x,t.x,n.x,r==null?void 0:r.x),Z4(e.y,t.y,n.y,r==null?void 0:r.y)}function eC(e,t,n,r,s){return e-=t,e=Hh(e,1/n,r),s!==void 0&&(e=Hh(e,1/s,r)),e}function Ime(e,t=0,n=1,r=.5,s,i=e,o=e){if(ta.test(t)&&(t=parseFloat(t),t=Je(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Je(i.min,i.max,r);e===i&&(l-=t),e.min=eC(e.min,t,n,l,s),e.max=eC(e.max,t,n,l,s)}function tC(e,t,[n,r,s],i,o){Ime(e,t[n],t[r],t[s],t.scale,i,o)}const Lme=["x","scaleX","originX"],zme=["y","scaleY","originY"];function nC(e,t,n,r){tC(e.x,t,Lme,n?n.x:void 0,r?r.x:void 0),tC(e.y,t,zme,n?n.y:void 0,r?r.y:void 0)}function rC(e){return e.translate===0&&e.scale===1}function L$(e){return rC(e.x)&&rC(e.y)}function aC(e,t){return e.min===t.min&&e.max===t.max}function Bme(e,t){return aC(e.x,t.x)&&aC(e.y,t.y)}function sC(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function z$(e,t){return sC(e.x,t.x)&&sC(e.y,t.y)}function iC(e){return fn(e.x)/fn(e.y)}function oC(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Ur(e){return[e("x"),e("y")]}function Fme(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:p,skewX:h,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),p&&(r+=`rotateY(${p}deg) `),h&&(r+=`skewX(${h}deg) `),m&&(r+=`skewY(${m}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const B$=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],Vme=B$.length,lC=e=>typeof e=="string"?parseFloat(e):e,cC=e=>typeof e=="number"||pe.test(e);function Ume(e,t,n,r,s,i){s?(e.opacity=Je(0,n.opacity??1,Wme(r)),e.opacityExit=Je(t.opacity??1,0,qme(r))):i&&(e.opacity=Je(t.opacity??1,n.opacity??1,r));for(let o=0;ort?1:n(sd(e,t,r))}function Hme(e,t,n){const r=Wt(e)?e:kl(e);return r.start(Xj("",r,t,n)),r.animation}function ld(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Kme=(e,t)=>e.depth-t.depth;class Gme{constructor(){this.children=[],this.isDirty=!1}add(t){Dj(this.children,t),this.isDirty=!0}remove(t){Bh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Kme),this.isDirty=!1,this.children.forEach(t)}}function Xme(e,t){const n=dn.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(As(r),e(i-t))};return Ue.setup(r,!0),()=>As(r)}function tp(e){return Wt(e)?e.get():e}class Yme{constructor(){this.members=[]}add(t){Dj(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const s=r.instance;(!s||s.isConnected===!1)&&!r.snapshot&&(Bh(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(Bh(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let r=this.members.indexOf(t)-1;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1&&((n=s.instance)==null?void 0:n.isConnected)!==!1)return this.promote(s),!0}return!1}promote(t,n){var s;const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:i}=r.options,{layoutDependency:o}=t.options;(i===void 0||i!==o)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),(s=t.root)!=null&&s.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,r,s,i,o;(r=(n=t.options).onExitComplete)==null||r.call(n),(o=(s=t.resumingFrom)==null?void 0:(i=s.options).onExitComplete)==null||o.call(i)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const np={hasAnimatedSinceResize:!0,hasEverUpdated:!1},F0=["","X","Y","Z"],Qme=1e3;let Jme=0;function V0(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function V$(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=l$(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ue,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&V$(r)}function U$({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=t==null?void 0:t()){this.id=Jme++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(txe),this.nodes.forEach(oxe),this.nodes.forEach(lxe),this.nodes.forEach(nxe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;Ue.read(()=>{f=window.innerWidth}),e(o,()=>{const h=window.innerWidth;h!==f&&(f=h,this.root.updateBlockedByResize=!0,d&&d(),d=Xme(p,250),np.hasAnimatedSinceResize&&(np.hasAnimatedSinceResize=!1,this.nodes.forEach(pC)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeLayoutChanged:p,layout:h})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||u.getDefaultTransition()||pxe,{onLayoutAnimationStart:v,onLayoutAnimationComplete:x}=u.getProps(),y=!this.targetLayout||!z$(this.targetLayout,h),g=!f&&p;if(this.options.layoutRoot||this.resumeFrom||g||f&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const j={...Gj(m,"layout"),onPlay:v,onComplete:x};(u.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j),this.setAnimationOrigin(d,g)}else f||pC(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=h})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),As(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(cxe),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&V$(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!fn(this.snapshot.measuredBox.x)&&!fn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const w=N/1e3;hC(f.x,o.x,w),hC(f.y,o.y,w),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Kh(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),dxe(this.relativeTarget,this.relativeTargetOrigin,p,w),j&&Bme(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=Ct()),vr(j,this.relativeTarget)),v&&(this.animationValues=d,Ume(d,u,this.latestValues,w,g,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=w},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(As(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ue.update(()=>{np.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=kl(0)),this.motionValue.jump(0,!1),this.currentAnimation=Hme(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Qme),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&W$(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Ct();const f=fn(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const p=fn(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+p}vr(l,c),ep(l,d),Qc(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Yme),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&V0("z",o,u,this.animationValues);for(let d=0;d{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(dC),this.root.sharedNodes.clear()}}}function Zme(e){e.updateLayout()}function exe(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,o=t.source!==e.layout.source;if(i==="size")Ur(f=>{const p=o?t.measuredBox[f]:t.layoutBox[f],h=fn(p);p.min=r[f].min,p.max=p.min+h});else if(i==="x"||i==="y"){const f=i==="x"?"y":"x";ib(o?t.measuredBox[f]:t.layoutBox[f],r[f])}else W$(i,t.layoutBox,r)&&Ur(f=>{const p=o?t.measuredBox[f]:t.layoutBox[f],h=fn(r[f]);p.max=p.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+h)});const l=_o();Qc(l,r,t.layoutBox);const c=_o();o?Qc(c,e.applyTransform(s,!0),t.measuredBox):Qc(c,r,t.layoutBox);const u=!L$(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:p,layout:h}=f;if(p&&h){const m=e.options.layoutAnchor||void 0,v=Ct();Kh(v,t.layoutBox,p.layoutBox,m);const x=Ct();Kh(x,r,h.layoutBox,m),z$(v,x)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=v,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function txe(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function nxe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function rxe(e){e.clearSnapshot()}function dC(e){e.clearMeasurements()}function axe(e){e.isLayoutDirty=!0,e.updateLayout()}function fC(e){e.isLayoutDirty=!1}function sxe(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function ixe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function pC(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function oxe(e){e.resolveTargetDelta()}function lxe(e){e.calcProjection()}function cxe(e){e.resetSkewAndRotation()}function uxe(e){e.removeLeadSnapshot()}function hC(e,t,n){e.translate=Je(t.translate,0,n),e.scale=Je(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function mC(e,t,n,r){e.min=Je(t.min,n.min,r),e.max=Je(t.max,n.max,r)}function dxe(e,t,n,r){mC(e.x,t.x,n.x,r),mC(e.y,t.y,n.y,r)}function fxe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const pxe={duration:.45,ease:[.4,0,.1,1]},xC=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),gC=xC("applewebkit/")&&!xC("chrome/")?Math.round:lr;function vC(e){e.min=gC(e.min),e.max=gC(e.max)}function hxe(e){vC(e.x),vC(e.y)}function W$(e,t,n){return e==="position"||e==="preserve-aspect"&&!Rme(iC(t),iC(n),.2)}function mxe(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const xxe=U$({attachResizeListener:(e,t)=>ld(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),U0={current:void 0},q$=U$({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!U0.current){const e=new xxe({});e.mount(window),e.setOptions({layoutScroll:!0}),U0.current=e}return U0.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),iw=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function yC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gxe(...e){return t=>{let n=!1;const r=e.map(s=>{const i=yC(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s{const{width:h,height:m,top:v,left:x,right:y,bottom:g}=c.current;if(t||i===!1||!l.current||!h||!m)return;const j=n==="left"?`left: ${x}`:`right: ${y}`,N=r==="bottom"?`bottom: ${g}`:`top: ${v}`;l.current.dataset.motionPopId=o;const w=document.createElement("style");u&&(w.nonce=u);const S=s??document.head;return S.appendChild(w),w.sheet&&w.sheet.insertRule(` + [data-motion-pop-id="${o}"] { + position: absolute !important; + width: ${h}px !important; + height: ${m}px !important; + ${j}px !important; + ${N}px !important; + } + `),()=>{var k;(k=l.current)==null||k.removeAttribute("data-motion-pop-id"),S.contains(w)&&S.removeChild(w)}},[t]),a.jsx(yxe,{isPresent:t,childRef:l,sizeRef:c,pop:i,children:i===!1?e:b.cloneElement(e,{ref:f})})}const jxe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o,anchorX:l,anchorY:c,root:u})=>{const d=Rj(wxe),f=b.useId();let p=!0,h=b.useMemo(()=>(p=!1,{id:f,initial:t,isPresent:n,custom:s,onExitComplete:m=>{d.set(m,!0);for(const v of d.values())if(!v)return;r&&r()},register:m=>(d.set(m,!1),()=>d.delete(m))}),[n,d,r]);return i&&p&&(h={...h}),b.useMemo(()=>{d.forEach((m,v)=>d.set(v,!1))},[n]),b.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),e=a.jsx(bxe,{pop:o==="popLayout",isPresent:n,anchorX:l,anchorY:c,root:u,children:e}),a.jsx(gx.Provider,{value:h,children:e})};function wxe(){return new Map}function H$(e=!0){const t=b.useContext(gx);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=b.useId();b.useEffect(()=>{if(e)return s(i)},[e]);const o=b.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const Nf=e=>e.key||"";function bC(e){const t=[];return b.Children.forEach(e,n=>{b.isValidElement(n)&&t.push(n)}),t}const cd=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1,anchorX:l="left",anchorY:c="top",root:u})=>{const[d,f]=H$(o),p=b.useMemo(()=>bC(e),[e]),h=o&&!d?[]:p.map(Nf),m=b.useRef(!0),v=b.useRef(p),x=Rj(()=>new Map),y=b.useRef(new Set),[g,j]=b.useState(p),[N,w]=b.useState(p);y6(()=>{m.current=!1,v.current=p;for(let C=0;C{const _=Nf(C),A=o&&!d?!1:p===N||h.includes(_),E=()=>{if(y.current.has(_))return;if(x.has(_))y.current.add(_),x.set(_,!0);else return;let P=!0;x.forEach(D=>{D||(P=!1)}),P&&(k==null||k(),w(v.current),o&&(f==null||f()),r&&r())};return a.jsx(jxe,{isPresent:A,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:s,mode:i,root:u,onExitComplete:A?void 0:E,anchorX:l,anchorY:c,children:C},_)})})},K$=b.createContext({strict:!1}),jC={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let wC=!1;function Nxe(){if(wC)return;const e={};for(const t in jC)e[t]={isEnabled:n=>jC[t].some(r=>!!n[r])};w$(e),wC=!0}function G$(){return Nxe(),ome()}function Sxe(e){const t=G$();for(const n in e)t[n]={...t[n],...e[n]};w$(t)}const kxe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Gh(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||kxe.has(e)}let X$=e=>!Gh(e);function Cxe(e){typeof e=="function"&&(X$=t=>t.startsWith("on")?!Gh(t):e(t))}try{Cxe(require("@emotion/is-prop-valid").default)}catch{}function _xe(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||Wt(e[s])||(X$(s)||n===!0&&Gh(s)||!t&&!Gh(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}const jx=b.createContext({});function Axe(e,t){if(bx(e)){const{initial:n,animate:r}=e;return{initial:n===!1||od(n)?n:void 0,animate:od(r)?r:void 0}}return e.inherit!==!1?t:{}}function Pxe(e){const{initial:t,animate:n}=Axe(e,b.useContext(jx));return b.useMemo(()=>({initial:t,animate:n}),[NC(t),NC(n)])}function NC(e){return Array.isArray(e)?e.join(" "):e}const ow=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Y$(e,t,n){for(const r in t)!Wt(t[r])&&!P$(r,n)&&(e[r]=t[r])}function Exe({transformTemplate:e},t){return b.useMemo(()=>{const n=ow();return aw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Oxe(e,t){const n=e.style||{},r={};return Y$(r,n,e),Object.assign(r,Exe(e,t)),r}function Txe(e,t){const n={},r=Oxe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const Q$=()=>({...ow(),attrs:{}});function $xe(e,t,n,r){const s=b.useMemo(()=>{const i=Q$();return E$(i,t,T$(r),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Y$(i,e.style,e),s.style={...i,...s.style}}return s}const Mxe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function lw(e){return typeof e!="string"||e.includes("-")?!1:!!(Mxe.indexOf(e)>-1||/[A-Z]/u.test(e))}function Rxe(e,t,n,{latestValues:r},s,i=!1,o){const c=(o??lw(e)?$xe:Txe)(t,r,s,e),u=_xe(t,typeof e=="string",i),d=e!==b.Fragment?{...u,...c,ref:n}:{},{children:f}=t,p=b.useMemo(()=>Wt(f)?f.get():f,[f]);return b.createElement(e,{...d,children:p})}function Dxe({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:Ixe(n,r,s,e),renderState:t()}}function Ixe(e,t,n,r){const s={},i=r(e,{});for(const p in i)s[p]=tp(i[p]);let{initial:o,animate:l}=e;const c=bx(e),u=b$(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const f=d?l:o;if(f&&typeof f!="boolean"&&!yx(f)){const p=Array.isArray(f)?f:[f];for(let h=0;h(t,n)=>{const r=b.useContext(jx),s=b.useContext(gx),i=()=>Dxe(e,t,r,s);return n?i():Rj(i)},Lxe=J$({scrapeMotionValuesFromProps:sw,createRenderState:ow}),zxe=J$({scrapeMotionValuesFromProps:$$,createRenderState:Q$}),Bxe=Symbol.for("motionComponentSymbol");function Fxe(e,t,n){const r=b.useRef(n);b.useInsertionEffect(()=>{r.current=n});const s=b.useRef(null);return b.useCallback(i=>{var l;i&&((l=e.onMount)==null||l.call(e,i));const o=r.current;if(typeof o=="function")if(i){const c=o(i);typeof c=="function"&&(s.current=c)}else s.current?(s.current(),s.current=null):o(i);else o&&(o.current=i);t&&(i?t.mount(i):t.unmount())},[t])}const Z$=b.createContext({});function ao(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Vxe(e,t,n,r,s,i){var j,N;const{visualElement:o}=b.useContext(jx),l=b.useContext(K$),c=b.useContext(gx),u=b.useContext(iw),d=u.reducedMotion,f=u.skipAnimations,p=b.useRef(null),h=b.useRef(!1);r=r||l.renderer,!p.current&&r&&(p.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d,skipAnimations:f,isSVG:i}),h.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const m=p.current,v=b.useContext(Z$);m&&!m.projection&&s&&(m.type==="html"||m.type==="svg")&&Uxe(p.current,n,s,v);const x=b.useRef(!1);b.useInsertionEffect(()=>{m&&x.current&&m.update(n,c)});const y=n[o$],g=b.useRef(!!y&&typeof window<"u"&&!((j=window.MotionHandoffIsComplete)!=null&&j.call(window,y))&&((N=window.MotionHasOptimisedAnimation)==null?void 0:N.call(window,y)));return y6(()=>{h.current=!0,m&&(x.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),g.current&&m.animationState&&m.animationState.animateChanges())}),b.useEffect(()=>{m&&(!g.current&&m.animationState&&m.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{var w;(w=window.MotionHandoffMarkAsComplete)==null||w.call(window,y)}),g.current=!1),m.enteringChildren=void 0)}),m}function Uxe(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutAnchor:d,layoutCrossfade:f}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:e8(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&ao(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:f,layoutScroll:c,layoutRoot:u,layoutAnchor:d})}function e8(e){if(e)return e.options.allowProjection!==!1?e.projection:e8(e.parent)}function W0(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&Sxe(r);const i=n?n==="svg":lw(e),o=i?zxe:Lxe;function l(u,d){let f;const p={...b.useContext(iw),...u,layoutId:Wxe(u)},{isStatic:h}=p,m=Pxe(u),v=o(u,h);if(!h&&typeof window<"u"){qxe();const x=Hxe(p);f=x.MeasureLayout,m.visualElement=Vxe(e,v,p,s,x.ProjectionNode,i)}return a.jsxs(jx.Provider,{value:m,children:[f&&m.visualElement?a.jsx(f,{visualElement:m.visualElement,...p}):null,Rxe(e,u,Fxe(v,m.visualElement,d),v,h,t,i)]})}l.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const c=b.forwardRef(l);return c[Bxe]=e,c}function Wxe({layoutId:e}){const t=b.useContext(Mj).id;return t&&e!==void 0?t+"-"+e:e}function qxe(e,t){b.useContext(K$).strict}function Hxe(e){const t=G$(),{drag:n,layout:r}=t;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function Kxe(e,t){if(typeof Proxy>"u")return W0;const n=new Map,r=(i,o)=>W0(i,o,e,t),s=(i,o)=>r(i,o);return new Proxy(s,{get:(i,o)=>o==="create"?r:(n.has(o)||n.set(o,W0(o,void 0,e,t)),n.get(o))})}const Gxe=(e,t)=>t.isSVG??lw(e)?new Sme(t):new vme(t,{allowProjection:e!==b.Fragment});class Xxe extends Ls{constructor(t){super(t),t.animationState||(t.animationState=Pme(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();yx(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let Yxe=0;class Qxe extends Ls{constructor(){super(...arguments),this.id=Yxe++,this.isExitComplete=!1}update(){var i;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:o,custom:l}=this.node.getProps();if(typeof o=="string"){const c=wi(this.node,o,l);if(c){const{transition:u,transitionEnd:d,...f}=c;for(const p in f)(i=this.node.getValue(p))==null||i.jump(f[p])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Jxe={animation:{Feature:Xxe},exit:{Feature:Qxe}};function Rd(e){return{point:{x:e.pageX,y:e.pageY}}}const Zxe=e=>t=>ew(t)&&e(t,Rd(t));function Jc(e,t,n,r){return ld(e,t,Zxe(n),r)}const t8=({current:e})=>e?e.ownerDocument.defaultView:null,SC=(e,t)=>Math.abs(e-t);function e0e(e,t){const n=SC(e.x,t.x),r=SC(e.y,t.y);return Math.sqrt(n**2+r**2)}const kC=new Set(["auto","scroll"]);class n8{constructor(t,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=h=>{this.handleScroll(h.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Sf(this.lastRawMoveEventInfo,this.transformPagePoint));const h=q0(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,v=e0e(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!m&&!v)return;const{point:x}=h,{timestamp:y}=Vt;this.history.push({...x,timestamp:y});const{onStart:g,onMove:j}=this.handlers;m||(g&&g(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),j&&j(this.lastMoveEvent,h)},this.handlePointerMove=(h,m)=>{this.lastMoveEvent=h,this.lastRawMoveEventInfo=m,this.lastMoveEventInfo=Sf(m,this.transformPagePoint),Ue.update(this.updatePoint,!0)},this.handlePointerUp=(h,m)=>{this.end();const{onEnd:v,onSessionEnd:x,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=q0(h.type==="pointercancel"?this.lastMoveEventInfo:Sf(m,this.transformPagePoint),this.history);this.startEvent&&v&&v(h,g),x&&x(h,g)},!ew(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const c=Rd(t),u=Sf(c,this.transformPagePoint),{point:d}=u,{timestamp:f}=Vt;this.history=[{...d,timestamp:f}];const{onSessionStart:p}=n;p&&p(t,q0(u,this.history)),this.removeListeners=Td(Jc(this.contextWindow,"pointermove",this.handlePointerMove),Jc(this.contextWindow,"pointerup",this.handlePointerUp),Jc(this.contextWindow,"pointercancel",this.handlePointerUp)),l&&this.startScrollTracking(l)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(kC.has(r.overflowX)||kC.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},i={x:s.x-n.x,y:s.y-n.y};i.x===0&&i.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(t,s),Ue.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),As(this.updatePoint)}}function Sf(e,t){return t?{point:t(e.point)}:e}function CC(e,t){return{x:e.x-t.x,y:e.y-t.y}}function q0({point:e},t){return{point:e,delta:CC(e,r8(t)),offset:CC(e,t0e(t)),velocity:n0e(t,.1)}}function t0e(e){return e[0]}function r8(e){return e[e.length-1]}function n0e(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=r8(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Bn(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&s.timestamp-r.timestamp>Bn(t)*2&&(r=e[1]);const i=sr(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function r0e(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Je(n,e,r.max):Math.min(e,n)),e}function _C(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function a0e(e,{top:t,left:n,bottom:r,right:s}){return{x:_C(e.x,n,s),y:_C(e.y,t,r)}}function AC(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=sd(t.min,t.max-r,e.min):r>s&&(n=sd(e.min,e.max-s,t.min)),la(0,1,n)}function o0e(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ob=.35;function l0e(e=ob){return e===!1?e=0:e===!0&&(e=ob),{x:PC(e,"left","right"),y:PC(e,"top","bottom")}}function PC(e,t,n){return{min:EC(e,t),max:EC(e,n)}}function EC(e,t){return typeof e=="number"?e:e[t]||0}const c0e=new WeakMap;class u0e{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ct(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=f=>{n&&this.snapToCursor(Rd(f).point),this.stopAnimation()},o=(f,p)=>{const{drag:h,dragPropagation:m,onDragStart:v}=this.getProps();if(h&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ihe(h),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ur(y=>{let g=this.getAxisMotionValue(y).get()||0;if(ta.test(g)){const{projection:j}=this.visualElement;if(j&&j.layout){const N=j.layout.layoutBox[y];N&&(g=fn(N)*(parseFloat(g)/100))}}this.originPoint[y]=g}),v&&Ue.update(()=>v(f,p),!1,!0),Jy(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},l=(f,p)=>{this.latestPointerEvent=f,this.latestPanInfo=p;const{dragPropagation:h,dragDirectionLock:m,onDirectionLock:v,onDrag:x}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:y}=p;if(m&&this.currentDirection===null){this.currentDirection=f0e(y),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",p.point,y),this.updateAxis("y",p.point,y),this.visualElement.render(),x&&Ue.update(()=>x(f,p),!1,!0)},c=(f,p)=>{this.latestPointerEvent=f,this.latestPanInfo=p,this.stop(f,p),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:f}=this.getProps();(f||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new n8(t,{onSessionStart:i,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:t8(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,s=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Ue.postRender(()=>l(r,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!kf(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=r0e(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,s=this.constraints;t&&ao(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=a0e(r.layoutBox,t):this.constraints=!1,this.elastic=l0e(n),s!==this.constraints&&!ao(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Ur(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=o0e(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ao(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=fme(r,s.root,this.visualElement.getTransformPagePoint());let o=s0e(s.layout.layoutBox,i);if(n){const l=n(cme(o));this.hasMutatedConstraints=!!l,l&&(o=S$(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Ur(d=>{if(!kf(d,n,this.currentDirection))return;let f=c&&c[d]||{};(o===!0||o===d)&&(f={min:0,max:0});const p=s?200:1e6,h=s?40:1e7,m={type:"inertia",velocity:r?t[d]:0,bounceStiffness:p,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Jy(this.visualElement,t),r.start(Xj(t,r,0,n,this.visualElement,!1))}stopAnimation(){Ur(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ur(n=>{const{drag:r}=this.getProps();if(!kf(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n],c=i.get()||0;i.set(t[n]-Je(o,l,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!ao(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ur(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=i0e({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Ur(o=>{if(!kf(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Je(c,u,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;c0e.set(this.visualElement,this);const t=this.visualElement.current,n=Jc(t,"pointerdown",u=>{const{drag:d,dragListener:f=!0}=this.getProps(),p=u.target,h=p!==t&&Uhe(p);d&&f&&!h&&this.start(u)});let r;const s=()=>{const{dragConstraints:u}=this.getProps();ao(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=d0e(t,u.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,o=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Ue.read(s);const l=ld(window,"resize",()=>this.scalePositionWithinConstraints()),c=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(Ur(f=>{const p=this.getAxisMotionValue(f);p&&(this.originPoint[f]+=u[f].translate,p.set(p.get()+u[f].translate))}),this.visualElement.render())});return()=>{l(),n(),o(),c&&c(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=ob,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function OC(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function d0e(e,t,n){const r=L4(e,OC(n)),s=L4(t,OC(n));return()=>{r(),s()}}function kf(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function f0e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class p0e extends Ls{constructor(t){super(t),this.removeGroupControls=lr,this.removeListeners=lr,this.controls=new u0e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||lr}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const H0=e=>(t,n)=>{e&&Ue.update(()=>e(t,n),!1,!0)};class h0e extends Ls{constructor(){super(...arguments),this.removePointerDownListener=lr}onPointerDown(t){this.session=new n8(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:t8(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:H0(t),onStart:H0(n),onMove:H0(r),onEnd:(i,o)=>{delete this.session,s&&Ue.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Jc(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let K0=!1;class m0e extends b.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),K0&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),np.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,{projection:o}=r;return o&&(o.isPresent=i,t.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),K0=!0,s||t.layoutDependency!==n||n===void 0||t.isPresent!==i?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||Ue.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),Zj.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;K0=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function a8(e){const[t,n]=H$(),r=b.useContext(Mj);return a.jsx(m0e,{...e,layoutGroup:r,switchLayoutGroup:b.useContext(Z$),isPresent:t,safeToRemove:n})}const x0e={pan:{Feature:h0e},drag:{Feature:p0e,ProjectionNode:q$,MeasureLayout:a8}};function TC(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Ue.postRender(()=>i(t,Rd(t)))}class g0e extends Ls{mount(){const{current:t}=this.node;t&&(this.unmount=zhe(t,(n,r)=>(TC(this.node,r,"Start"),s=>TC(this.node,s,"End"))))}unmount(){}}class v0e extends Ls{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Td(ld(this.node.current,"focus",()=>this.onFocus()),ld(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function $C(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Ue.postRender(()=>i(t,Rd(t)))}class y0e extends Ls{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=qhe(t,(s,i)=>($C(this.node,i,"Start"),(o,{success:l})=>$C(this.node,o,l?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const lb=new WeakMap,G0=new WeakMap,b0e=e=>{const t=lb.get(e.target);t&&t(e)},j0e=e=>{e.forEach(b0e)};function w0e({root:e,...t}){const n=e||document;G0.has(n)||G0.set(n,{});const r=G0.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(j0e,{root:e,...t})),r[s]}function N0e(e,t,n){const r=w0e(t);return lb.set(e,n),r.observe(e),()=>{lb.delete(e),r.unobserve(e)}}const S0e={some:0,all:1};class k0e extends Ls{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var c;(c=this.stopObserver)==null||c.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:S0e[s]},l=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:f,onViewportLeave:p}=this.node.getProps(),h=d?f:p;h&&h(u)};this.stopObserver=N0e(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(C0e(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function C0e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const _0e={inView:{Feature:k0e},tap:{Feature:y0e},focus:{Feature:v0e},hover:{Feature:g0e}},A0e={layout:{ProjectionNode:q$,MeasureLayout:a8}},P0e={...Jxe,..._0e,...x0e,...A0e},na=Kxe(P0e,Gxe),cw={owner:{label:"Dono",color:"bg-yellow-500/20 text-yellow-300 border-yellow-500/30",Icon:gd},manager:{label:"Gerente",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",Icon:ws},supervisor:{label:"Supervisor",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",Icon:$p},secretary:{label:"Secretária",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",Icon:bu},agent:{label:"Atendente",color:"bg-green-500/20 text-green-300 border-green-500/30",Icon:mI},viewer:{label:"Visualizador",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",Icon:$p}},s8={online:"bg-green-400",busy:"bg-yellow-400",offline:"bg-slate-500"},X0={knowledge:"Conhecimento",rules:"Regras",escalation:"Escalação",persona:"Persona"},E0e={knowledge:"text-cyan-400 bg-cyan-500/10",rules:"text-yellow-400 bg-yellow-500/10",escalation:"text-red-400 bg-red-500/10",persona:"text-purple-400 bg-purple-500/10"};function i8({role:e}){const t=cw[e]||{label:e,color:"bg-slate-500/20 text-slate-300 border-slate-500/30",Icon:et},{Icon:n}=t;return a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.color}`,children:[a.jsx(n,{size:10}),t.label]})}function uw({title:e,onClose:t,children:n}){return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",children:a.jsxs("div",{className:"bg-slate-800 border border-slate-700 rounded-xl shadow-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-700",children:[a.jsx("h2",{className:"font-semibold text-white",children:e}),a.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white",children:a.jsx(Ce,{size:18})})]}),a.jsx("div",{className:"p-5",children:n})]})})}function nr({label:e,children:t}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:e}),t]})}function hi({...e}){return a.jsx("input",{...e,className:"w-full bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-500"})}function cb({...e}){return a.jsx("select",{...e,className:"w-full bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})}function O0e({...e}){return a.jsx("textarea",{...e,className:"w-full bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-500 resize-none"})}function $r({onClick:e,variant:t="primary",children:n,disabled:r,className:s=""}){const i="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition disabled:opacity-50 disabled:cursor-not-allowed",o={primary:"bg-cyan-600 hover:bg-cyan-500 text-white",ghost:"bg-slate-700 hover:bg-slate-600 text-slate-200",danger:"bg-red-600/20 hover:bg-red-600/40 text-red-400 border border-red-600/30"};return a.jsx("button",{onClick:e,disabled:r,className:`${i} ${o[t]} ${s}`,children:n})}function T0e(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState({name:"",email:"",password:"",role:"agent",phone:""}),[d,f]=b.useState(!1),p=b.useCallback(async()=>{r(!0);try{t(await Zn.list())}finally{r(!1)}},[]);b.useEffect(()=>{p()},[p]);function h(){u({name:"",email:"",password:"",role:"agent",phone:""}),l(null),i("create")}function m(j){u({name:j.name,email:j.email||"",password:"",role:j.role,phone:j.phone||""}),l(j),i("edit")}async function v(){var j,N;f(!0);try{const w={name:c.name,email:c.email||void 0,role:c.role,phone:c.phone||void 0};c.password&&(w.password=c.password),o?await Zn.update(o.id,w):await Zn.create(w),i(null),p()}catch(w){alert(((N=(j=w.response)==null?void 0:j.data)==null?void 0:N.error)||"Erro ao salvar")}finally{f(!1)}}async function x(j){await Zn.update(j.id,{active:!j.active}),p()}async function y(j){const N=j.availability==="online"?"offline":"online";await Zn.update(j.id,{availability:N}),p()}async function g(j){confirm(`Excluir "${j.name}"?`)&&(await Zn.remove(j.id),p())}return n?a.jsx("div",{className:"flex items-center justify-center h-40 text-slate-400 text-sm",children:"Carregando..."}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-slate-400",children:[e.length," colaborador(es)"]}),a.jsxs($r,{onClick:h,children:[a.jsx(Oe,{size:14})," Nova Conta"]})]}),a.jsxs("div",{className:"grid gap-3",children:[e.map(j=>a.jsxs("div",{className:`flex items-center gap-3 p-3 rounded-xl border ${j.active?"bg-slate-800/60 border-slate-700":"bg-slate-900/40 border-slate-800 opacity-60"}`,children:[a.jsxs("div",{className:"relative flex-shrink-0",children:[j.avatar_url?a.jsx("img",{src:j.avatar_url,className:"w-10 h-10 rounded-full object-cover"}):a.jsx("div",{className:"w-10 h-10 rounded-full bg-slate-700 flex items-center justify-center text-slate-300 font-semibold text-sm",children:j.name.charAt(0).toUpperCase()}),a.jsx("span",{className:`absolute bottom-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-slate-800 ${s8[j.availability]||"bg-slate-500"}`})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"text-sm font-medium text-white truncate",children:j.name}),a.jsx(i8,{role:j.role}),j.phone_connected&&a.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-green-400",children:[a.jsx(nE,{size:10}),"WA"]})]}),j.email&&a.jsx("p",{className:"text-xs text-slate-500 truncate",children:j.email}),j.sectors.length>0&&a.jsx("p",{className:"text-xs text-slate-500 truncate",children:j.sectors.map(N=>N.sector_name).join(", ")})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:()=>y(j),title:j.availability==="online"?"Online":"Offline",className:`p-1.5 rounded-lg transition ${j.availability==="online"?"text-green-400 hover:bg-green-500/10":"text-slate-500 hover:bg-slate-700"}`,children:j.availability==="online"?a.jsx(Ss,{size:16}):a.jsx(Ns,{size:16})}),a.jsx("button",{onClick:()=>m(j),className:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>x(j),className:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition",title:j.active?"Suspender":"Ativar",children:j.active?a.jsx(jt,{size:14,className:"text-green-400"}):a.jsx(Ce,{size:14,className:"text-red-400"})}),a.jsx("button",{onClick:()=>g(j),className:"p-1.5 rounded-lg text-slate-400 hover:text-red-400 hover:bg-red-500/10 transition",children:a.jsx(Te,{size:14})})]})]},j.id)),e.length===0&&a.jsxs("div",{className:"text-center py-12 text-slate-500 text-sm",children:["Nenhum colaborador cadastrado.",a.jsx("br",{}),a.jsx("button",{onClick:h,className:"mt-2 text-cyan-400 hover:underline",children:"Criar primeiro"})]})]}),s&&a.jsx(uw,{title:s==="create"?"Nova Conta":"Editar Conta",onClose:()=>i(null),children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(nr,{label:"Nome *",children:a.jsx(hi,{value:c.name,onChange:j=>u(N=>({...N,name:j.target.value})),placeholder:"Nome completo"})}),a.jsx(nr,{label:"E-mail (login)",children:a.jsx(hi,{type:"email",value:c.email,onChange:j=>u(N=>({...N,email:j.target.value})),placeholder:"email@empresa.com"})}),a.jsx(nr,{label:s==="edit"?"Nova senha (deixe em branco para manter)":"Senha",children:a.jsx(hi,{type:"password",value:c.password,onChange:j=>u(N=>({...N,password:j.target.value})),placeholder:"••••••••"})}),a.jsx(nr,{label:"WhatsApp pessoal",children:a.jsx(hi,{value:c.phone,onChange:j=>u(N=>({...N,phone:j.target.value})),placeholder:"5511999990000"})}),a.jsx(nr,{label:"Cargo",children:a.jsx(cb,{value:c.role,onChange:j=>u(N=>({...N,role:j.target.value})),children:Object.entries(cw).map(([j,N])=>a.jsx("option",{className:"bg-slate-900 text-white",value:j,children:N.label},j))})}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx($r,{variant:"ghost",onClick:()=>i(null),children:"Cancelar"}),a.jsx($r,{onClick:v,disabled:d||!c.name,children:d?"Salvando...":"Salvar"})]})]})})]})}const $0e=["#6366f1","#06b6d4","#10b981","#f59e0b","#ef4444","#ec4899","#8b5cf6","#f97316"];function M0e(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState({name:"",description:"",icon:"Briefcase",color:"#6366f1",sla_minutes:60}),[d,f]=b.useState(!1),p=b.useCallback(async()=>{r(!0);try{t(await er.list())}finally{r(!1)}},[]);b.useEffect(()=>{p()},[p]);function h(){u({name:"",description:"",icon:"Briefcase",color:"#6366f1",sla_minutes:60}),l(null),i("create")}function m(y){u({name:y.name,description:y.description||"",icon:y.icon,color:y.color,sla_minutes:y.sla_minutes}),l(y),i("edit")}async function v(){var y,g;f(!0);try{o?await er.update(o.id,c):await er.create(c),i(null),p()}catch(j){alert(((g=(y=j.response)==null?void 0:y.data)==null?void 0:g.error)||"Erro ao salvar")}finally{f(!1)}}async function x(y){var g,j;if(confirm(`Excluir setor "${y.name}"? Membros vinculados serão desvinculados.`))try{await er.remove(y.id),p()}catch(N){alert(((j=(g=N.response)==null?void 0:g.data)==null?void 0:j.error)||"Erro ao excluir")}}return n?a.jsx("div",{className:"flex items-center justify-center h-40 text-slate-400 text-sm",children:"Carregando..."}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-slate-400",children:[e.length," setor(es)"]}),a.jsxs($r,{onClick:h,children:[a.jsx(Oe,{size:14})," Novo Setor"]})]}),a.jsxs("div",{className:"grid gap-3",children:[e.map(y=>a.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border bg-slate-800/60 border-slate-700",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:y.color+"33"},children:a.jsx(mm,{size:18,style:{color:y.color}})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm font-medium text-white",children:y.name}),a.jsxs("span",{className:"text-xs text-slate-500",children:["SLA: ",y.sla_minutes," min"]})]}),y.description&&a.jsx("p",{className:"text-xs text-slate-500 line-clamp-2",children:y.description}),a.jsxs("p",{className:"text-xs text-slate-600",children:[y.member_count," membro(s)"]})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:()=>m(y),className:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>x(y),className:"p-1.5 rounded-lg text-slate-400 hover:text-red-400 hover:bg-red-500/10 transition",children:a.jsx(Te,{size:14})})]})]},y.id)),e.length===0&&a.jsxs("div",{className:"text-center py-12 text-slate-500 text-sm",children:["Nenhum setor cadastrado.",a.jsx("br",{}),a.jsx("button",{onClick:h,className:"mt-2 text-cyan-400 hover:underline",children:"Criar primeiro"})]})]}),s&&a.jsx(uw,{title:s==="create"?"Novo Setor":"Editar Setor",onClose:()=>i(null),children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(nr,{label:"Nome *",children:a.jsx(hi,{value:c.name,onChange:y=>u(g=>({...g,name:y.target.value})),placeholder:"Ex: Financeiro"})}),a.jsx(nr,{label:"Descrição",children:a.jsx(O0e,{value:c.description,onChange:y=>u(g=>({...g,description:y.target.value})),rows:2,placeholder:"O que este setor atende..."})}),a.jsx(nr,{label:"SLA (minutos)",children:a.jsx(hi,{type:"number",value:c.sla_minutes,onChange:y=>u(g=>({...g,sla_minutes:Number(y.target.value)})),min:5})}),a.jsx(nr,{label:"Cor",children:a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[$0e.map(y=>a.jsx("button",{onClick:()=>u(g=>({...g,color:y})),className:`w-7 h-7 rounded-full border-2 transition ${c.color===y?"border-white scale-110":"border-transparent"}`,style:{background:y}},y)),a.jsx("input",{type:"color",value:c.color,onChange:y=>u(g=>({...g,color:y.target.value})),className:"w-7 h-7 rounded-full border-0 cursor-pointer bg-transparent"})]})}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx($r,{variant:"ghost",onClick:()=>i(null),children:"Cancelar"}),a.jsx($r,{onClick:v,disabled:d||!c.name,children:d?"Salvando...":"Salvar"})]})]})})]})}function R0e(){const[e,t]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState(""),[d,f]=b.useState(!1),[p,h]=b.useState({account_id:"",sector_id:"",function:"",is_primary:!1}),[m,v]=b.useState(!1),x=b.useCallback(async()=>{l(!0);try{const[S,k,C]=await Promise.all([Js.list(c?{sector_id:Number(c)}:void 0),Zn.list(),er.list()]);t(S),r(k),i(C)}finally{l(!1)}},[c]);b.useEffect(()=>{x()},[x]);async function y(){var S,k;if(!(!p.account_id||!p.sector_id)){v(!0);try{await Js.add({account_id:Number(p.account_id),sector_id:Number(p.sector_id),function:p.function||void 0,is_primary:p.is_primary}),f(!1),x()}catch(C){alert(((k=(S=C.response)==null?void 0:S.data)==null?void 0:k.error)||"Erro ao vincular")}finally{v(!1)}}}async function g(S){await Js.update(S.id,{on_duty:!S.on_duty}),x()}async function j(S){await Js.update(S.id,{notify_escalation:!S.notify_escalation}),x()}async function N(S){await Js.update(S.id,{notify_human_api:!S.notify_human_api}),x()}async function w(S){confirm(`Desvincular ${S.account_name} do setor ${S.sector_name}?`)&&(await Js.remove(S.id),x())}return o?a.jsx("div",{className:"flex items-center justify-center h-40 text-slate-400 text-sm",children:"Carregando..."}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[a.jsxs("select",{value:c,onChange:S=>u(S.target.value),className:"bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-sm text-white focus:outline-none",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Todos os setores"}),s.map(S=>a.jsx("option",{className:"bg-slate-900 text-white",value:S.id,children:S.name},S.id))]}),a.jsx("div",{className:"ml-auto",children:a.jsxs($r,{onClick:()=>f(!0),children:[a.jsx(Oe,{size:14})," Vincular Membro"]})})]}),a.jsx("div",{className:"overflow-x-auto rounded-xl border border-slate-700",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-slate-700 text-slate-400 text-xs",children:[a.jsx("th",{className:"text-left px-4 py-2.5",children:"Colaborador"}),a.jsx("th",{className:"text-left px-4 py-2.5",children:"Setor"}),a.jsx("th",{className:"text-left px-4 py-2.5",children:"Função"}),a.jsx("th",{className:"text-center px-3 py-2.5",children:"Turno"}),a.jsx("th",{className:"text-center px-3 py-2.5",children:"Escal."}),a.jsx("th",{className:"text-center px-3 py-2.5",children:"H.API"}),a.jsx("th",{className:"px-3 py-2.5"})]})}),a.jsxs("tbody",{children:[e.map(S=>a.jsxs("tr",{className:"border-b border-slate-800 hover:bg-slate-800/30 transition",children:[a.jsx("td",{className:"px-4 py-2.5",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-7 h-7 rounded-full bg-slate-700 flex items-center justify-center text-xs font-medium text-slate-300",children:S.account_name.charAt(0).toUpperCase()}),a.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2 h-2 rounded-full border border-slate-900 ${s8[S.availability]||"bg-slate-500"}`})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium leading-tight",children:S.account_name}),a.jsx(i8,{role:S.account_role})]})]})}),a.jsx("td",{className:"px-4 py-2.5",children:a.jsxs("span",{className:"inline-flex items-center gap-1 text-slate-300",children:[a.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:S.sector_color}}),S.sector_name]})}),a.jsx("td",{className:"px-4 py-2.5 text-slate-400",children:S.function||"—"}),a.jsx("td",{className:"px-3 py-2.5 text-center",children:a.jsx("button",{onClick:()=>g(S),className:`text-xs px-2 py-0.5 rounded-full border transition ${S.on_duty?"border-green-500/40 text-green-400 bg-green-500/10":"border-slate-600 text-slate-500 bg-transparent"}`,children:S.on_duty?"On":"Off"})}),a.jsx("td",{className:"px-3 py-2.5 text-center",children:a.jsx("button",{onClick:()=>j(S),className:`transition ${S.notify_escalation?"text-yellow-400":"text-slate-600 hover:text-slate-400"}`,children:S.notify_escalation?a.jsx(Ss,{size:16}):a.jsx(Ns,{size:16})})}),a.jsx("td",{className:"px-3 py-2.5 text-center",children:a.jsx("button",{onClick:()=>N(S),className:`transition ${S.notify_human_api?"text-cyan-400":"text-slate-600 hover:text-slate-400"}`,children:S.notify_human_api?a.jsx(Ss,{size:16}):a.jsx(Ns,{size:16})})}),a.jsx("td",{className:"px-3 py-2.5",children:a.jsx("button",{onClick:()=>w(S),className:"p-1 rounded text-slate-500 hover:text-red-400 transition",children:a.jsx(Te,{size:13})})})]},S.id)),e.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"text-center py-10 text-slate-500",children:"Nenhum membro vinculado"})})]})]})}),d&&a.jsx(uw,{title:"Vincular Membro",onClose:()=>f(!1),children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(nr,{label:"Colaborador *",children:a.jsxs(cb,{value:p.account_id,onChange:S=>h(k=>({...k,account_id:S.target.value})),children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Selecione..."}),n.map(S=>{var k;return a.jsxs("option",{className:"bg-slate-900 text-white",value:S.id,children:[S.name," — ",(k=cw[S.role])==null?void 0:k.label]},S.id)})]})}),a.jsx(nr,{label:"Setor *",children:a.jsxs(cb,{value:p.sector_id,onChange:S=>h(k=>({...k,sector_id:S.target.value})),children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Selecione..."}),s.map(S=>a.jsx("option",{className:"bg-slate-900 text-white",value:S.id,children:S.name},S.id))]})}),a.jsx(nr,{label:"Função no setor",children:a.jsx(hi,{value:p.function,onChange:S=>h(k=>({...k,function:S.target.value})),placeholder:"Ex: Encarregado, Especialista..."})}),a.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-300 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:p.is_primary,onChange:S=>h(k=>({...k,is_primary:S.target.checked})),className:"rounded"}),"Setor principal deste colaborador"]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx($r,{variant:"ghost",onClick:()=>f(!1),children:"Cancelar"}),a.jsx($r,{onClick:y,disabled:m||!p.account_id||!p.sector_id,children:m?"Vinculando...":"Vincular"})]})]})})]})}function D0e(){const[e,t]=b.useState([]),[n,r]=b.useState(null),[s,i]=b.useState([]),[o,l]=b.useState(!1),[c,u]=b.useState({type:"knowledge",content:""}),[d,f]=b.useState(null),[p,h]=b.useState(!1);b.useEffect(()=>{er.list().then(j=>{t(j),j.length>0&&!n&&r(j[0].id)})},[]),b.useEffect(()=>{n&&(l(!0),er.getBrain(n).then(j=>{i(j),l(!1)}))},[n]);async function m(){if(!(!n||!c.content.trim())){h(!0);try{const j=await er.createBrain(n,{type:c.type,content:c.content});i(N=>[...N,j]),u({type:"knowledge",content:""})}finally{h(!1)}}}async function v(){if(d){h(!0);try{const j=await er.updateBrain(d.id,{type:d.type,content:d.content,active:d.active});i(N=>N.map(w=>w.id===j.id?j:w)),f(null)}finally{h(!1)}}}async function x(j){const N=await er.updateBrain(j.id,{active:!j.active});i(w=>w.map(S=>S.id===N.id?N:S))}async function y(j){confirm("Excluir este node?")&&(await er.deleteBrain(j.id),i(N=>N.filter(w=>w.id!==j.id)))}const g=e.find(j=>j.id===n);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.map(j=>a.jsxs("button",{onClick:()=>r(j.id),className:`px-3 py-1.5 rounded-lg text-sm font-medium border transition ${n===j.id?"border-cyan-500 text-cyan-400 bg-cyan-500/10":"border-slate-700 text-slate-400 hover:text-white hover:border-slate-600"}`,children:[a.jsx("span",{className:"inline-block w-2 h-2 rounded-full mr-1.5",style:{background:j.color}}),j.name,a.jsx("span",{className:"ml-1.5 text-xs opacity-60",children:j.member_count})]},j.id)),e.length===0&&a.jsx("p",{className:"text-sm text-slate-500",children:'Crie setores primeiro na aba "Setores"'})]}),n&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs text-slate-400 font-medium",children:["Adicionar conhecimento ao setor ",a.jsx("span",{className:"text-white",children:g==null?void 0:g.name})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("select",{value:c.type,onChange:j=>u(N=>({...N,type:j.target.value})),className:"bg-slate-900 border border-slate-600 rounded-lg px-2 py-1.5 text-xs text-white focus:outline-none focus:border-cyan-500 flex-shrink-0",children:Object.entries(X0).map(([j,N])=>a.jsx("option",{className:"bg-slate-900 text-white",value:j,children:N},j))}),a.jsx("textarea",{value:c.content,onChange:j=>u(N=>({...N,content:j.target.value})),rows:2,placeholder:"Descreva o conhecimento, regra ou instrução...",className:"flex-1 bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-cyan-500 resize-none"}),a.jsx("button",{onClick:m,disabled:p||!c.content.trim(),className:"px-3 py-1.5 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 text-white rounded-lg text-sm font-medium transition flex-shrink-0",children:a.jsx(Oe,{size:16})})]})]}),o?a.jsx("div",{className:"text-center py-8 text-slate-400 text-sm",children:"Carregando..."}):a.jsxs("div",{className:"space-y-2",children:[s.map(j=>a.jsx("div",{className:`rounded-xl border p-3 transition ${j.active?"bg-slate-800/60 border-slate-700":"bg-slate-900/40 border-slate-800 opacity-50"}`,children:(d==null?void 0:d.id)===j.id?a.jsxs("div",{className:"space-y-2",children:[a.jsx("select",{value:d.type,onChange:N=>f(w=>w&&{...w,type:N.target.value}),className:"bg-slate-900 border border-slate-600 rounded px-2 py-1 text-xs text-white focus:outline-none",children:Object.entries(X0).map(([N,w])=>a.jsx("option",{className:"bg-slate-900 text-white",value:N,children:w},N))}),a.jsx("textarea",{value:d.content,onChange:N=>f(w=>w&&{...w,content:N.target.value}),rows:3,className:"w-full bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 resize-none"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs($r,{onClick:v,disabled:p,children:[a.jsx(jt,{size:13})," Salvar"]}),a.jsxs($r,{variant:"ghost",onClick:()=>f(null),children:[a.jsx(Ce,{size:13})," Cancelar"]})]})]}):a.jsxs("div",{className:"flex gap-3",children:[a.jsx("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full self-start flex-shrink-0 ${E0e[j.type]}`,children:X0[j.type]||j.type}),a.jsx("p",{className:"text-sm text-slate-300 flex-1 leading-relaxed whitespace-pre-wrap",children:j.content}),a.jsxs("div",{className:"flex items-start gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:()=>f(j),className:"p-1 text-slate-500 hover:text-white transition",children:a.jsx(Er,{size:13})}),a.jsx("button",{onClick:()=>x(j),className:"p-1 text-slate-500 hover:text-yellow-400 transition",title:j.active?"Desativar":"Ativar",children:j.active?a.jsx(Ss,{size:13,className:"text-green-400"}):a.jsx(Ns,{size:13})}),a.jsx("button",{onClick:()=>y(j),className:"p-1 text-slate-500 hover:text-red-400 transition",children:a.jsx(Te,{size:13})})]})]})},j.id)),s.length===0&&a.jsxs("div",{className:"text-center py-8 text-slate-500 text-sm",children:["Nenhum conhecimento cadastrado para este setor.",a.jsx("br",{}),"Adicione acima."]})]})]})]})}function I0e(){return a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center gap-3",children:[a.jsx(ys,{size:40,className:"text-slate-600"}),a.jsx("p",{className:"text-slate-400 text-sm font-medium",children:"Performance"}),a.jsx("p",{className:"text-slate-600 text-xs max-w-xs",children:"Métricas de tempo de resposta, taxa de resolução e satisfação serão exibidas aqui após a Human API entrar em operação."})]})}function L0e(){const[e,t]=b.useState([]),[n,r]=b.useState(null),[s,i]=b.useState(""),[o,l]=b.useState(!1),[c,u]=b.useState(!1);b.useEffect(()=>{Promise.all([Zn.list(),Hc.get()]).then(([f,p])=>{t(Array.isArray(f)?f:[]),p.linkedAccount&&(r(p.linkedAccount),i(String(p.linkedAccount.id)))}).catch(()=>{})},[]);async function d(){l(!0);try{await Hc.linkAccount(s?Number(s):null);const f=await Hc.get();r(f.linkedAccount??null),u(!0),setTimeout(()=>u(!1),2500)}catch{}finally{l(!1)}}return a.jsxs("div",{className:"max-w-md space-y-5",children:[a.jsxs("div",{className:"bg-slate-800 rounded-xl p-4 border border-slate-700",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(Go,{size:14,className:"text-cyan-400"}),a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Identidade na Inbox Interna"})]}),a.jsx("p",{className:"text-xs text-slate-400 mb-4",children:"Vincule seu perfil de admin a uma conta de colaborador para receber e enviar mensagens na Inbox Interna sem fazer login duplo."}),n&&a.jsxs("div",{className:"flex items-center gap-2 mb-3 px-3 py-2 bg-cyan-900/30 border border-cyan-500/30 rounded-lg",children:[a.jsx(jt,{size:13,className:"text-cyan-400 flex-shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-cyan-300",children:n.name}),a.jsxs("p",{className:"text-[11px] text-slate-400",children:[n.email," · ",n.role]})]})]}),a.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:"Selecionar conta de colaborador"}),a.jsxs("select",{value:s,onChange:f=>i(f.target.value),className:"w-full bg-slate-900 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white mb-3 outline-none focus:border-cyan-500",children:[a.jsx("option",{value:"",className:"bg-slate-900 text-white",children:"— Nenhum (desvinculado) —"}),e.map(f=>a.jsxs("option",{value:f.id,className:"bg-slate-900 text-white",children:[f.name," (",f.email,")"]},f.id))]}),a.jsxs("button",{onClick:d,disabled:o,className:"flex items-center gap-2 px-4 py-2 bg-cyan-600 hover:bg-cyan-700 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition",children:[c?a.jsx(jt,{size:13}):a.jsx(Go,{size:13}),c?"Vinculado!":o?"Salvando...":"Salvar vínculo"]})]}),a.jsx("p",{className:"text-[11px] text-slate-500",children:"Após salvar, atualize a página. A Inbox Interna passará a usar sua identidade de colaborador automaticamente."})]})}const z0e=[{id:"contas",label:"Contas",Icon:et},{id:"setores",label:"Setores",Icon:AI},{id:"membros",label:"Membros",Icon:Tl},{id:"cerebros",label:"Cérebros",Icon:d1},{id:"performance",label:"Performance",Icon:ys},{id:"meu-perfil",label:"Meu Perfil",Icon:Go}];function B0e(){const[e,t]=b.useState("contas");return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex-shrink-0 px-4 pt-4 pb-3 border-b border-slate-800",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(et,{size:16,className:"text-cyan-400"}),a.jsx("h2",{className:"text-sm font-semibold text-white",children:"Equipe"})]}),a.jsx("div",{className:"flex gap-1 overflow-x-auto pb-0.5",children:z0e.map(n=>a.jsxs("button",{onClick:()=>t(n.id),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium whitespace-nowrap transition flex-shrink-0 + ${e===n.id?"bg-cyan-600/20 text-cyan-400 border border-cyan-500/30":"text-slate-400 hover:text-white hover:bg-slate-800"}`,children:[a.jsx(n.Icon,{size:12}),n.label]},n.id))})]}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:[e==="contas"&&a.jsx(T0e,{}),e==="setores"&&a.jsx(M0e,{}),e==="membros"&&a.jsx(R0e,{}),e==="cerebros"&&a.jsx(D0e,{}),e==="performance"&&a.jsx(I0e,{}),e==="meu-perfil"&&a.jsx(L0e,{})]})]})}function Dd(e={}){const{url:t="/api/sse",onConnected:n,onReconnecting:r}=e,s=b.useRef(null),i=b.useRef(new Map),o=b.useRef(1e3),l=b.useRef(null),c=b.useRef(!0),u=b.useCallback((h,m)=>{var v;(v=i.current.get(h))==null||v.forEach(x=>{try{x(m)}catch{}})},[]),d=b.useCallback(()=>{if(!c.current)return;s.current&&(s.current.close(),s.current=null);const h=new EventSource(t,{withCredentials:!0});s.current=h,h.addEventListener("connected",()=>{o.current=1e3,n==null||n()});const m=x=>{try{const y=JSON.parse(x.data);u(x.type,y)}catch{u(x.type,x.data)}};["dm.new","presence.change","human_api.new","human_api.timeout","human_api.answered","handoff.expired","sla.breach","thread.new"].forEach(x=>h.addEventListener(x,m)),h.onerror=()=>{if(h.close(),s.current=null,!c.current)return;r==null||r();const x=Math.min(o.current,3e4);o.current=Math.min(o.current*2,3e4),l.current=setTimeout(d,x)}},[t,n,r,u]);b.useEffect(()=>(c.current=!0,d(),()=>{var h;c.current=!1,l.current&&clearTimeout(l.current),(h=s.current)==null||h.close(),s.current=null}),[d]);const f=b.useCallback((h,m)=>{i.current.has(h)||i.current.set(h,new Set),i.current.get(h).add(m)},[]),p=b.useCallback((h,m)=>{var v;(v=i.current.get(h))==null||v.delete(m)},[]);return{addEventListener:f,removeEventListener:p}}const F0e={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-slate-300"},V0e={online:"Online",busy:"Ocupado",offline:"Offline"};function U0e({selected:e,onSelect:t,onStartDM:n,onNewDM:r}){const[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState(!1),[d,f]=b.useState(""),p=b.useRef([]);b.useEffect(()=>{p.current=s},[s]);const h=b.useCallback(async(g=!1)=>{g?u(!0):l(!0);try{const j=await Ac.getColleagues();i(Array.isArray(j)?j:[])}catch(j){console.error("Erro ao carregar colaboradores:",j)}finally{l(!1),u(!1)}},[]);b.useEffect(()=>{h()},[h]);const{addEventListener:m,removeEventListener:v}=Dd();b.useEffect(()=>{const g=N=>{const{accountId:w,availability:S}=N;i(k=>k.map(C=>C.id===Number(w)?{...C,availability:S}:C))},j=N=>{const{from:w}=N;i(S=>S.map(k=>k.id===w?{...k,unread_count:k.unread_count+1}:k)),r==null||r(w)};return m("presence.change",g),m("dm.new",j),()=>{v("presence.change",g),v("dm.new",j)}},[m,v,r]);const y=[...s.filter(g=>g.name.toLowerCase().includes(d.toLowerCase())||g.email.toLowerCase().includes(d.toLowerCase()))].sort((g,j)=>{const N={online:0,busy:1,offline:2},w=(N[g.availability]??2)-(N[j.availability]??2);return w!==0?w:g.name.localeCompare(j.name,"pt-BR")});return a.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white",children:[a.jsxs("div",{className:"flex-shrink-0 px-3 pt-3 pb-2 bg-[#f0f2f5] border-b border-[#e9edef]",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h3",{className:"text-xs font-semibold text-[#667781] uppercase tracking-wide",children:"Colaboradores"}),a.jsx("button",{onClick:()=>h(!0),disabled:c,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#8696a0] disabled:opacity-40",title:"Atualizar lista",children:a.jsx(ke,{size:11,className:c?"animate-spin":""})})]}),a.jsxs("div",{className:"relative",children:[a.jsx(Ir,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-[#8696a0] pointer-events-none"}),a.jsx("input",{type:"text",placeholder:"Buscar...",value:d,onChange:g=>f(g.target.value),className:"w-full bg-white border border-[#d1d7db] rounded-lg pl-8 pr-2.5 py-1.5 text-[12px] text-[#111b21] placeholder:text-[#8696a0] focus:outline-none focus:ring-1 focus:ring-[#00a884]"})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:o?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-[12px]",children:"Carregando..."}):y.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-[12px]",children:d?"Nenhum colaborador encontrado":"Nenhum colaborador"}):y.map(g=>a.jsxs("button",{onClick:()=>t(g),className:`w-full text-left flex items-center gap-2.5 px-3 py-2.5 border-b border-[#f0f2f5] hover:bg-[#f5f6f6] transition-colors + ${e===g.id?"bg-[#e7f5ff] border-l-4 border-l-[#00a884]":""}`,children:[a.jsxs("div",{className:"relative flex-shrink-0",children:[g.avatar_url?a.jsx("img",{src:g.avatar_url,alt:g.name,className:"w-9 h-9 rounded-full object-cover"}):a.jsx("div",{className:"w-9 h-9 rounded-full bg-[#dfe5e7] flex items-center justify-center text-[#54656f] text-[12px] font-semibold",children:g.name.charAt(0).toUpperCase()}),a.jsx("span",{className:`absolute bottom-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-white ${F0e[g.availability]??"bg-slate-300"}`})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-1",children:[a.jsx("span",{className:"text-[13px] font-medium text-[#111b21] truncate leading-tight",children:g.name}),g.unread_count>0&&a.jsx("span",{className:"flex-shrink-0 bg-[#25d366] text-white text-[9px] font-bold min-w-[16px] h-4 px-0.5 rounded-full flex items-center justify-center",children:g.unread_count>9?"9+":g.unread_count})]}),a.jsx("p",{className:`text-[11px] truncate leading-tight ${g.availability==="online"?"text-green-600":g.availability==="busy"?"text-yellow-600":"text-[#8696a0]"}`,children:V0e[g.availability]})]}),a.jsx("button",{onClick:j=>{j.stopPropagation(),n(g)},className:"flex-shrink-0 p-1.5 rounded-lg text-[#8696a0] hover:bg-[#e9edef] hover:text-[#00a884] transition",title:"Enviar mensagem",children:a.jsx(rn,{size:13})})]},g.id))})]})}const W0e={online:"Online",busy:"Ocupado",away:"Ausente",offline:"Offline"};function MC({name:e,url:t,size:n=8}){const r=`w-${n} h-${n}`;if(t)return a.jsx("img",{src:t,className:`${r} rounded-full object-cover flex-shrink-0`});const s=e?e.charAt(0).toUpperCase():"?";return a.jsx("div",{className:`${r} rounded-full bg-[#dfe5e7] flex items-center justify-center text-[#54656f] text-xs font-semibold flex-shrink-0`,children:s})}function q0e(e){const t=new Date(e),r=(new Date().getTime()-t.getTime())/1e3;return r<60?"agora":r<3600?`${Math.floor(r/60)}m`:r<86400?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"})}function H0e({colleague:e,accountId:t,onBack:n}){const[r,s]=b.useState([]),[i,o]=b.useState(!0),[l,c]=b.useState(""),[u,d]=b.useState(!1),f=b.useRef(null),{addEventListener:p,removeEventListener:h}=Dd(),m=b.useCallback(async()=>{o(!0);try{const x=await Ac.getConversation(e.id,50);if(s(x),x.length>0){const y=x.filter(g=>g.to_account===t&&!g.read_at);for(const g of y)await Ac.markAsRead(g.id)}}finally{o(!1)}},[e.id,t]);b.useEffect(()=>{m()},[]),b.useEffect(()=>{const x=y=>{const{id:g,from:j,to:N,content:w,created_at:S}=y;if(j!==e.id)return;const k={id:g,from_account:j,to_account:N,content:w,read_at:new Date().toISOString(),created_at:S};s(C=>[...C,k]),Ac.markAsRead(g).catch(()=>{})};return p("dm.new",x),()=>h("dm.new",x)},[p,h,e.id]),b.useEffect(()=>{var x;(x=f.current)==null||x.scrollIntoView({behavior:"smooth"})},[r]);async function v(){if(!l.trim())return;d(!0);const x=l.trim();c("");try{const y=await Ac.send(e.id,x);s(g=>[...g,y])}catch{c(x)}finally{d(!1)}}return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5]",children:[a.jsxs("div",{className:"flex-shrink-0 px-3 py-3 bg-white border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx("button",{onClick:n,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#54656f]",children:a.jsx(Ui,{size:18})}),a.jsx(MC,{name:e.name,url:e.avatar_url,size:8}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-[#111b21] truncate",children:e.name}),a.jsx("p",{className:"text-[11px] text-[#8696a0]",children:W0e[e.availability]})]}),a.jsx("button",{onClick:m,className:"p-1.5 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(ke,{size:13,className:i?"animate-spin":""})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[i&&r.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Carregando conversa..."}):r.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Nenhuma mensagem ainda. Comece uma conversa!"}):r.map(x=>{const y=x.from_account===t;return a.jsxs("div",{className:`flex gap-2 ${y?"flex-row-reverse":""}`,children:[!y&&a.jsx(MC,{name:e.name,url:e.avatar_url,size:7}),a.jsxs("div",{className:`max-w-[82%] flex flex-col gap-0.5 ${y?"items-end":"items-start"}`,children:[a.jsx("div",{className:`px-3 py-2 rounded-2xl text-[13px] leading-relaxed whitespace-pre-wrap shadow-sm + ${y?"bg-[#d9fdd3] text-[#111b21] rounded-tr-sm":"bg-white text-[#111b21] rounded-tl-sm"}`,children:x.content}),a.jsx("p",{className:"text-[10px] text-[#8696a0] px-1",children:q0e(x.created_at)})]})]},x.id)}),a.jsx("div",{ref:f})]}),a.jsx("div",{className:"flex-shrink-0 px-3 py-2 bg-white border-t border-[#e9edef]",children:a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx("textarea",{value:l,onChange:x=>c(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),v())},rows:1,placeholder:"Digite uma mensagem",className:"flex-1 bg-[#f0f2f5] border-0 rounded-xl px-3 py-2.5 text-[13px] text-[#111b21] placeholder-[#8696a0] focus:outline-none resize-none",style:{minHeight:40,maxHeight:100}}),a.jsx("button",{onClick:v,disabled:u||!l.trim(),className:"p-2.5 bg-[#00a884] hover:bg-[#008f72] disabled:opacity-40 text-white rounded-full transition flex-shrink-0",children:a.jsx(Rr,{size:15})})]})})]})}function RC({name:e,url:t,size:n=7}){const r=`w-${n} h-${n}`;if(t)return a.jsx("img",{src:t,className:`${r} rounded-full object-cover flex-shrink-0`});const s=e?e.charAt(0).toUpperCase():"?";return a.jsx("div",{className:`${r} rounded-full bg-[#dfe5e7] flex items-center justify-center text-[#54656f] text-xs font-semibold flex-shrink-0`,children:s})}function K0e(e){const t=new Date(e),r=(new Date().getTime()-t.getTime())/1e3;return r<60?"agora":r<3600?`${Math.floor(r/60)}m`:r<86400?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"})}function G0e({group:e,accountId:t,onBack:n}){const[r,s]=b.useState([]),[i,o]=b.useState(!0),[l,c]=b.useState(""),[u,d]=b.useState(!1),[f,p]=b.useState(!1),[h,m]=b.useState([]),v=b.useRef(null),{addEventListener:x,removeEventListener:y}=Dd(),g=b.useCallback(async()=>{o(!0);try{const S=await Kc.getMessages(e.id,50);s(S)}finally{o(!1)}},[e.id]);b.useEffect(()=>{g()},[g]),b.useEffect(()=>{const S=k=>{const C=k;if(C.group_chat_id!==e.id||C.from===t)return;const _={id:C.id,from_account:C.from,content:C.content,created_at:C.created_at,sender_name:null,sender_avatar:null};s(A=>[...A,_])};return x("group_message.new",S),()=>y("group_message.new",S)},[x,y,e.id,t]),b.useEffect(()=>{var S;(S=v.current)==null||S.scrollIntoView({behavior:"smooth"})},[r]);async function j(){if(!l.trim())return;d(!0);const S=l.trim();c("");try{const k=await Kc.sendMessage(e.id,S);s(C=>[...C,k])}catch{c(S)}finally{d(!1)}}async function N(){if(!f&&h.length===0){const S=await Kc.getMembers(e.id);m(S)}p(S=>!S)}const w={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-slate-300"};return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5]",children:[a.jsxs("div",{className:"flex-shrink-0 px-3 py-3 bg-white border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx("button",{onClick:n,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#54656f]",children:a.jsx(Ui,{size:18})}),a.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-bold flex-shrink-0",style:{backgroundColor:e.color},children:e.name.charAt(0).toUpperCase()}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-[#111b21] truncate",children:e.name}),a.jsx("p",{className:"text-[11px] text-[#8696a0]",children:"Grupo · setor"})]}),a.jsx("button",{onClick:N,className:`p-1.5 rounded-full transition ${f?"bg-[#e9edef] text-[#00a884]":"hover:bg-[#e9edef] text-[#8696a0]"}`,title:"Ver membros",children:a.jsx(et,{size:15})})]}),f&&a.jsxs("div",{className:"flex-shrink-0 bg-white border-b border-[#e9edef] px-3 py-2",children:[a.jsx("p",{className:"text-[11px] font-semibold text-[#667781] uppercase mb-1.5",children:"Membros"}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.map(S=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs("div",{className:"relative",children:[a.jsx(RC,{name:S.name,url:S.avatar_url,size:6}),a.jsx("span",{className:`absolute bottom-0 right-0 w-2 h-2 rounded-full border border-white ${w[S.availability]??"bg-slate-300"}`})]}),a.jsx("span",{className:"text-[12px] text-[#111b21]",children:S.name})]},S.id)),h.length===0&&a.jsx("span",{className:"text-[12px] text-[#8696a0]",children:"Nenhum membro"})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[i&&r.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Carregando mensagens..."}):r.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Nenhuma mensagem ainda. Inicie a conversa do setor!"}):r.map(S=>{const k=S.from_account===t;return a.jsxs("div",{className:`flex gap-2 ${k?"flex-row-reverse":""}`,children:[!k&&a.jsx(RC,{name:S.sender_name,url:S.sender_avatar,size:7}),a.jsxs("div",{className:`max-w-[82%] flex flex-col gap-0.5 ${k?"items-end":"items-start"}`,children:[!k&&S.sender_name&&a.jsx("p",{className:"text-[11px] font-semibold text-[#54656f] px-1",children:S.sender_name}),a.jsx("div",{className:`px-3 py-2 rounded-2xl text-[13px] leading-relaxed whitespace-pre-wrap shadow-sm + ${k?"bg-[#d9fdd3] text-[#111b21] rounded-tr-sm":"bg-white text-[#111b21] rounded-tl-sm"}`,children:S.content}),a.jsx("p",{className:"text-[10px] text-[#8696a0] px-1",children:K0e(S.created_at)})]})]},S.id)}),a.jsx("div",{ref:v})]}),a.jsx("div",{className:"flex-shrink-0 px-3 py-2 bg-white border-t border-[#e9edef]",children:a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx("textarea",{value:l,onChange:S=>c(S.target.value),onKeyDown:S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),j())},rows:1,placeholder:`Mensagem para ${e.name}`,className:"flex-1 bg-[#f0f2f5] border-0 rounded-xl px-3 py-2.5 text-[13px] text-[#111b21] placeholder-[#8696a0] focus:outline-none resize-none",style:{minHeight:40,maxHeight:100}}),a.jsx("button",{onClick:j,disabled:u||!l.trim(),className:"p-2.5 bg-[#00a884] hover:bg-[#008f72] disabled:opacity-40 text-white rounded-full transition flex-shrink-0",children:a.jsx(Rr,{size:15})})]})})]})}function X0e(e){const t=new Date(e),r=(new Date().getTime()-t.getTime())/1e3;return r<60?"agora":r<3600?`${Math.floor(r/60)}m atrás`:r<86400?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit"})}function Y0e({name:e,url:t}){if(t)return a.jsx("img",{src:t,className:"w-7 h-7 rounded-full object-cover flex-shrink-0"});const n=e?e.charAt(0).toUpperCase():"?";return a.jsx("div",{className:"w-7 h-7 rounded-full bg-amber-100 flex items-center justify-center text-amber-700 text-xs font-semibold flex-shrink-0",children:n})}function Q0e({accountId:e,role:t,onNewBroadcast:n,onSeen:r}){const[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState(""),[d,f]=b.useState(!1),[p,h]=b.useState(!1),m=b.useRef(null),{addEventListener:v,removeEventListener:x}=Dd(),y=t==="owner"||t==="manager";b.useEffect(()=>{r==null||r()},[]);const g=b.useCallback(async()=>{l(!0);try{const{items:N}=await Gf.list();i([...N].reverse()),Gf.markSeen().catch(()=>{})}finally{l(!1)}},[]);b.useEffect(()=>{g()},[g]),b.useEffect(()=>{var N;(N=m.current)==null||N.scrollIntoView({behavior:"smooth"})},[s]),b.useEffect(()=>{const N=w=>{const S=w;if(S.from===e)return;const k={id:S.id,from_account:S.from,content:S.content,created_at:S.created_at,sender_name:null,sender_avatar:null};i(C=>[...C,k]),n==null||n(S.content)};return v("broadcast.sent",N),()=>x("broadcast.sent",N)},[v,x,e,n]);async function j(){if(!c.trim()||!y)return;f(!0);const N=c.trim();u(""),h(!1);try{const w=await Gf.send(N);i(S=>[...S,w])}catch{u(N)}finally{f(!1)}}return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5]",children:[a.jsxs("div",{className:"flex-shrink-0 px-4 py-3 bg-white border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-100 flex items-center justify-center flex-shrink-0",children:a.jsx(ju,{size:16,className:"text-amber-600"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-[#111b21]",children:"Broadcast"}),a.jsx("p",{className:"text-[11px] text-[#8696a0]",children:"Avisos para toda a equipe"})]}),a.jsx("button",{onClick:g,className:"p-1.5 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(ke,{size:13,className:o?"animate-spin":""})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[o&&s.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Carregando..."}):s.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-[#8696a0] gap-2",children:[a.jsx(ju,{size:28,className:"opacity-30"}),a.jsx("p",{className:"text-[13px]",children:"Nenhum aviso ainda."}),y&&a.jsx("p",{className:"text-[11px]",children:"Use o campo abaixo para enviar um aviso para toda a equipe."})]}):s.map(N=>a.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-amber-100 px-4 py-3 flex gap-3",children:[a.jsx(Y0e,{name:N.sender_name,url:N.sender_avatar}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 mb-0.5",children:[a.jsx("p",{className:"text-[12px] font-semibold text-amber-700",children:N.sender_name??"Sistema"}),a.jsx("span",{className:"text-[10px] text-[#8696a0] flex-shrink-0",children:X0e(N.created_at)})]}),a.jsx("p",{className:"text-[13px] text-[#111b21] leading-relaxed whitespace-pre-wrap",children:N.content})]})]},N.id)),a.jsx("div",{ref:m})]}),y&&a.jsxs("div",{className:"flex-shrink-0 bg-white border-t border-[#e9edef] px-4 py-3 space-y-2",children:[p&&a.jsxs("div",{className:"flex items-center gap-2 bg-amber-50 border border-amber-200 rounded-lg px-3 py-2",children:[a.jsx(Kt,{size:13,className:"text-amber-600 flex-shrink-0"}),a.jsxs("p",{className:"text-[12px] text-amber-700 flex-1",children:["Isso enviará um aviso para ",a.jsx("strong",{children:"todos os colaboradores"}),". Confirmar?"]}),a.jsx("button",{onClick:j,disabled:d,className:"px-3 py-1 bg-amber-500 hover:bg-amber-600 disabled:opacity-40 text-white text-[11px] font-semibold rounded-lg transition",children:d?"Enviando...":"Enviar"}),a.jsx("button",{onClick:()=>h(!1),className:"px-2 py-1 text-[11px] text-[#54656f] hover:bg-[#e9edef] rounded-lg transition",children:"Cancelar"})]}),a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx("textarea",{value:c,onChange:N=>u(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),c.trim()&&h(!0))},rows:1,placeholder:"Aviso para toda a equipe...",className:"flex-1 bg-[#f0f2f5] border-0 rounded-xl px-3 py-2.5 text-[13px] text-[#111b21] placeholder-[#8696a0] focus:outline-none resize-none",style:{minHeight:40,maxHeight:100}}),a.jsx("button",{onClick:()=>{c.trim()&&h(!0)},disabled:d||!c.trim(),className:"p-2.5 bg-amber-500 hover:bg-amber-600 disabled:opacity-40 text-white rounded-full transition flex-shrink-0",children:a.jsx(Rr,{size:15})})]})]})]})}const DC=[{id:"overview",icon:a.jsx(Pr,{size:28}),color:"from-[#00a884] to-[#008f72]",title:"Inbox Interna",subtitle:"Central de comunicação da equipe",content:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-[14px] text-[#3b4a50] leading-relaxed",children:["O ",a.jsx("strong",{children:"Inbox Interna"})," centraliza toda a comunicação operacional da equipe em um único lugar — sem precisar sair do sistema."]}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{icon:a.jsx(Pr,{size:16}),label:"Inbox",desc:"Escalações e pedidos de ajuda da IA",color:"bg-cyan-50 text-cyan-700 border-cyan-100"},{icon:a.jsx(et,{size:16}),label:"Equipe",desc:"Mensagens diretas entre colaboradores",color:"bg-green-50 text-green-700 border-green-100"},{icon:a.jsx(rn,{size:16}),label:"Grupos",desc:"Chat por setor operacional",color:"bg-indigo-50 text-indigo-700 border-indigo-100"},{icon:a.jsx(ju,{size:16}),label:"Avisos",desc:"Comunicados para toda a equipe",color:"bg-amber-50 text-amber-700 border-amber-100"}].map(e=>a.jsxs("div",{className:`flex flex-col gap-1.5 p-3 rounded-xl border ${e.color}`,children:[a.jsxs("div",{className:"flex items-center gap-2 font-semibold text-[13px]",children:[e.icon,e.label]}),a.jsx("p",{className:"text-[11px] opacity-80 leading-snug",children:e.desc})]},e.label))}),a.jsxs("div",{className:"flex items-start gap-2 bg-[#f0fdf4] border border-green-100 rounded-xl px-3 py-2.5",children:[a.jsx(Mo,{size:14,className:"text-green-600 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-[12px] text-green-800",children:"Tudo em tempo real — mensagens chegam instantaneamente sem precisar recarregar a página."})]})]})},{id:"inbox",icon:a.jsx(ra,{size:28}),color:"from-cyan-500 to-cyan-700",title:"Aba Inbox",subtitle:"Escalações e pedidos da IA",content:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-[14px] text-[#3b4a50] leading-relaxed",children:"O Inbox reúne situações que precisam de atenção humana — geradas automaticamente pela IA ou pelos próprios colaboradores."}),a.jsx("div",{className:"space-y-2.5",children:[{icon:a.jsx(Kt,{size:15,className:"text-amber-500"}),type:"Escalação",desc:"Cliente pediu para falar com um humano no WhatsApp. A IA pausa e aguarda você responder.",bg:"bg-amber-50 border-amber-100"},{icon:a.jsx(ra,{size:15,className:"text-cyan-500"}),type:"Human API",desc:"A IA não soube responder e pediu ajuda. Você responde aqui e ela continua a conversa com o cliente.",bg:"bg-cyan-50 border-cyan-100"},{icon:a.jsx(Ol,{size:15,className:"text-orange-500"}),type:"Pedido de Ajuda",desc:"Um colaborador abriu uma dúvida interna sobre um procedimento ou pedido.",bg:"bg-orange-50 border-orange-100"},{icon:a.jsx(x1,{size:15,className:"text-slate-500"}),type:"Mensagem / Sistema",desc:"Anotações de contexto sobre protocolos e avisos automáticos do sistema.",bg:"bg-slate-50 border-slate-100"}].map(e=>a.jsxs("div",{className:`flex gap-3 p-3 rounded-xl border ${e.bg}`,children:[a.jsx("div",{className:"mt-0.5 flex-shrink-0",children:e.icon}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[12px] font-semibold text-[#111b21]",children:e.type}),a.jsx("p",{className:"text-[11px] text-[#54656f] leading-snug mt-0.5",children:e.desc})]})]},e.type))})]})},{id:"equipe",icon:a.jsx(et,{size:28}),color:"from-[#25d366] to-[#128c7e]",title:"Aba Equipe",subtitle:"Mensagens diretas entre colaboradores",content:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-[14px] text-[#3b4a50] leading-relaxed",children:"Converse diretamente com qualquer colega — como um WhatsApp interno. As mensagens chegam em tempo real com badge de não lidas."}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"bg-[#f0f2f5] rounded-2xl p-3 space-y-2",children:[a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-full bg-indigo-400 flex items-center justify-center text-white text-[10px] font-bold flex-shrink-0",children:"M"}),a.jsx("div",{className:"bg-white rounded-2xl rounded-bl-sm px-3 py-1.5 text-[12px] text-[#111b21] shadow-sm max-w-[75%]",children:"Monique, o pedido #456 está separado?"})]}),a.jsxs("div",{className:"flex items-end justify-end gap-2",children:[a.jsx("div",{className:"bg-[#d9fdd3] rounded-2xl rounded-br-sm px-3 py-1.5 text-[12px] text-[#111b21] shadow-sm max-w-[75%]",children:"Sim! Já encaminhei para embalagem 👍"}),a.jsx("div",{className:"w-6 h-6 rounded-full bg-[#00a884] flex items-center justify-center text-white text-[10px] font-bold flex-shrink-0",children:"V"})]})]}),a.jsx("div",{className:"space-y-2",children:["Clique em um colaborador na coluna esquerda para abrir o chat","Badge verde mostra quantas mensagens não foram lidas","Indicador de presença: verde = online, amarelo = ocupado"].map((e,t)=>a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(Ts,{size:13,className:"text-[#00a884] flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-[12px] text-[#3b4a50]",children:e})]},t))})]})]})},{id:"grupos",icon:a.jsx(rn,{size:28}),color:"from-indigo-500 to-indigo-700",title:"Aba Grupos",subtitle:"Canal de comunicação por setor",content:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-[14px] text-[#3b4a50] leading-relaxed",children:"Cada setor operacional tem um grupo dedicado — criado automaticamente. É o canal do turno: dúvidas, alinhamentos e avisos do setor."}),a.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-xl p-3 space-y-2",children:[a.jsx("p",{className:"text-[11px] font-semibold text-indigo-700 uppercase tracking-wide",children:"Grupos criados automaticamente"}),a.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:["Cotação","Separação","Embalagem","Auditoria","Fiscal","Expedição"].map((e,t)=>{const n=["#6366f1","#f59e0b","#10b981","#ef4444","#8b5cf6","#3b82f6"];return a.jsxs("div",{className:"flex items-center gap-1.5 bg-white rounded-lg px-2 py-1.5 border border-indigo-100",children:[a.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-bold flex-shrink-0",style:{backgroundColor:n[t]},children:e[0]}),a.jsx("span",{className:"text-[11px] text-[#111b21] font-medium truncate",children:e})]},e)})})]}),a.jsxs("div",{className:"flex items-start gap-2 bg-slate-50 border border-slate-100 rounded-xl px-3 py-2.5",children:[a.jsx(RP,{size:13,className:"text-indigo-500 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-[12px] text-[#3b4a50]",children:"Você só vê os grupos dos setores em que está cadastrado. Owners e managers veem todos."})]})]})},{id:"avisos",icon:a.jsx(ju,{size:28}),color:"from-amber-500 to-orange-600",title:"Aba Avisos",subtitle:"Comunicados para toda a equipe",content:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-[14px] text-[#3b4a50] leading-relaxed",children:["Avisos chegam para ",a.jsx("strong",{children:"todos os colaboradores"})," do sistema ao mesmo tempo — ideal para comunicados urgentes e alinhamentos gerais."]}),a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("div",{className:"w-6 h-6 rounded-full bg-amber-200 flex items-center justify-center text-amber-700 text-[10px] font-bold",children:"G"}),a.jsx("span",{className:"text-[11px] font-semibold text-amber-700",children:"Gerente · agora"})]}),a.jsx("p",{className:"text-[13px] text-[#111b21]",children:"Sistema entra em manutenção em 10 minutos. Finalizem os pedidos em andamento."})]}),a.jsx("div",{className:"space-y-2",children:[{label:"Quem pode enviar",desc:"Apenas Owner e Manager",icon:"🔒"},{label:"Quem recebe",desc:"Todos os colaboradores conectados",icon:"📡"},{label:"Confirmação",desc:"Sistema pede confirmação antes de enviar",icon:"✅"}].map(e=>a.jsxs("div",{className:"flex items-center gap-3 bg-white border border-[#e9edef] rounded-xl px-3 py-2",children:[a.jsx("span",{className:"text-[16px]",children:e.icon}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[12px] font-semibold text-[#111b21]",children:e.label}),a.jsx("p",{className:"text-[11px] text-[#8696a0]",children:e.desc})]})]},e.label))})]})]})},{id:"diferenca",icon:a.jsx(YP,{size:28}),color:"from-violet-500 to-indigo-600",title:"Inbox Interna vs Inbox Interno",subtitle:"Quando usar cada um?",content:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"text-[13px] text-[#3b4a50] leading-relaxed",children:["Existem ",a.jsx("strong",{children:"duas inboxes"})," diferentes no sistema. Cada uma tem um propósito distinto:"]}),a.jsxs("div",{className:"bg-[#f0fdf4] border border-[#00a884]/30 rounded-xl p-3 space-y-1.5",children:[a.jsxs("p",{className:"text-[12px] font-bold text-[#00a884] flex items-center gap-1.5",children:[a.jsx(rn,{size:13})," Inbox Interna (você está aqui)"]}),a.jsxs("p",{className:"text-[11px] text-[#3b4a50] leading-snug",children:["Para ",a.jsx("strong",{children:"atendimento ao cliente via WhatsApp"})," e comunicação entre atendentes."]}),a.jsx("div",{className:"space-y-1 mt-1",children:['🤖 "IA escalou — cliente quer falar com um humano"','💬 "Ei, você pode assumir o protocolo #884?"','📣 "Gerente: turno da tarde começa às 14h hoje"'].map((e,t)=>a.jsx("p",{className:"text-[11px] text-[#00a884] bg-[#00a884]/5 rounded-lg px-2.5 py-1.5 leading-snug",children:e},t))})]}),a.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-3 space-y-1.5",children:[a.jsxs("p",{className:"text-[12px] font-bold text-amber-700 flex items-center gap-1.5",children:[a.jsx(bs,{size:13})," Inbox Interno → menu lateral"]}),a.jsxs("p",{className:"text-[11px] text-[#3b4a50] leading-snug",children:["Para comunicação sobre o ",a.jsx("strong",{children:"fluxo de pedidos"})," entre setores operacionais."]}),a.jsx("div",{className:"space-y-1 mt-1",children:['📦 "Pedido #1055 com item faltando — verificar estoque"','🧾 "NF do pedido #1098 com divergência de CFOP"','🚚 "Carga do turno pronta para expedição"'].map((e,t)=>a.jsx("p",{className:"text-[11px] text-amber-700 bg-amber-500/5 rounded-lg px-2.5 py-1.5 leading-snug",children:e},t))})]}),a.jsx("p",{className:"text-[11px] text-[#8696a0] text-center",children:"Regra rápida: cliente/atendente → aqui · pedido/setor → Inbox Interno"})]})}];function J0e({total:e,current:t,onGo:n}){return a.jsx("div",{className:"flex items-center gap-1.5",children:Array.from({length:e}).map((r,s)=>a.jsx("button",{onClick:()=>n(s),className:`rounded-full transition-all duration-200 ${s===t?"w-5 h-2 bg-[#00a884]":"w-2 h-2 bg-[#d1d7db] hover:bg-[#8696a0]"}`},s))})}function Z0e({onClose:e}){const[t,n]=b.useState(0),r=DC.length,s=DC[t],i=b.useCallback(()=>n(l=>Math.min(l+1,r-1)),[r]),o=b.useCallback(()=>n(l=>Math.max(l-1,0)),[]);return b.useEffect(()=>{const l=c=>{c.key==="Escape"&&e(),c.key==="ArrowRight"&&i(),c.key==="ArrowLeft"&&o()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,i,o]),a.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/40 backdrop-blur-sm p-4",onClick:l=>{l.target===l.currentTarget&&e()},children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden flex flex-col",style:{maxHeight:"90vh"},children:[a.jsxs("div",{className:`bg-gradient-to-br ${s.color} px-6 pt-6 pb-5 relative flex-shrink-0`,children:[a.jsx("button",{onClick:e,className:"absolute top-4 right-4 p-1.5 rounded-full bg-white/20 hover:bg-white/30 text-white transition",children:a.jsx(Ce,{size:14})}),a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-2xl bg-white/20 flex items-center justify-center text-white flex-shrink-0",children:s.icon}),a.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[a.jsxs("p",{className:"text-white/70 text-[11px] font-medium uppercase tracking-widest",children:[t+1," de ",r]}),a.jsx("h2",{className:"text-white text-[18px] font-bold leading-tight mt-0.5",children:s.title}),a.jsx("p",{className:"text-white/80 text-[12px] mt-0.5",children:s.subtitle})]})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5 min-h-0",children:s.content}),a.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-t border-[#e9edef] bg-[#f8f9fa]",children:[a.jsxs("button",{onClick:o,disabled:t===0,className:"flex items-center gap-1.5 px-4 py-2 rounded-xl text-[12px] font-medium text-[#54656f] hover:bg-[#e9edef] disabled:opacity-30 disabled:cursor-not-allowed transition",children:[a.jsx(xd,{size:15}),"Anterior"]}),a.jsx(J0e,{total:r,current:t,onGo:n}),t{const l=o.current;l&&(l.style.transition="none",l.style.width="100%",l.offsetWidth,l.style.transition=`width ${LC}ms linear`,l.style.width="0%")},[]),b.useEffect(()=>{const l=setTimeout(t,LC);return()=>clearTimeout(l)},[t]),a.jsxs("div",{className:`relative flex items-start gap-3 w-80 bg-white rounded-xl shadow-xl border ${i} overflow-hidden`,style:{borderLeftWidth:4},children:[a.jsx("div",{ref:o,className:`absolute bottom-0 left-0 h-0.5 ${s}`,style:{width:"100%"}}),a.jsx("div",{className:`flex-shrink-0 flex items-center justify-center w-9 h-9 rounded-lg ${s} text-white ml-3 mt-3`,children:a.jsx(r,{size:16})}),a.jsxs("div",{className:"flex-1 min-w-0 py-3 pr-2",children:[a.jsx("p",{className:"text-[13px] font-semibold text-[#111b21] truncate",children:e.title}),a.jsx("p",{className:"text-[12px] text-[#667781] mt-0.5 line-clamp-2",children:e.body})]}),a.jsx("button",{onClick:t,className:"flex-shrink-0 p-1.5 mt-2 mr-2 text-[#8696a0] hover:text-[#111b21] hover:bg-[#f0f2f5] rounded-lg transition",children:a.jsx(Ce,{size:13})})]})}function tge({notifications:e,onDismiss:t}){return e.length===0?null:a.jsx("div",{className:"fixed bottom-4 right-4 z-[9999] flex flex-col gap-2 items-end",children:e.map(n=>a.jsx(ege,{notif:n,onDismiss:()=>t(n.id)},n.id))})}function nge(){const[e,t]=b.useState([]),n=b.useCallback(s=>{const i=`${Date.now()}-${Math.random().toString(36).slice(2,7)}`;t(o=>[...o.slice(-4),{...s,id:i,at:Date.now()}])},[]),r=b.useCallback(s=>{t(i=>i.filter(o=>o.id!==s))},[]);return{notifications:e,push:n,dismiss:r}}const Zc={human_api:{label:"Human API",Icon:ra,color:"text-cyan-500"},escalation:{label:"Escalação",Icon:Kt,color:"text-amber-500"},help_request:{label:"Ajuda",Icon:Ol,color:"text-orange-500"},collaboration:{label:"Mensagem",Icon:rn,color:"text-[#54656f]"},system:{label:"Sistema",Icon:v1,color:"text-[#8696a0]"}};function ub(e){const t=new Date(e),r=(new Date().getTime()-t.getTime())/1e3;return r<60?"agora":r<3600?`${Math.floor(r/60)}m`:r<86400?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"})}function rge({name:e,url:t,size:n=8}){const r=`w-${n} h-${n}`;if(t)return a.jsx("img",{src:t,className:`${r} rounded-full object-cover flex-shrink-0`});const s=e?e.charAt(0).toUpperCase():"?";return a.jsx("div",{className:`${r} rounded-full bg-[#dfe5e7] flex items-center justify-center text-[#54656f] text-xs font-semibold flex-shrink-0`,children:s})}function age({thread:e,onClose:t,onDone:n}){const[r,s]=b.useState([]),[i,o]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState(!1);b.useEffect(()=>{fetch("/api/admin/accounts",{credentials:"include"}).then(p=>p.json()).then(p=>s(Array.isArray(p)?p:p.accounts||[])).catch(()=>{})},[]);async function f(){if(i){d(!0);try{await v6.transfer({threadId:e.thread_id,toAccountId:Number(i),protocolNumber:e.ref_id||void 0,message:l.trim()||void 0}),n(),t()}catch{d(!1)}}}return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-[340px] p-6 flex flex-col gap-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-[14px] font-bold text-[#111b21]",children:"Transferir protocolo"}),a.jsx("button",{onClick:t,className:"text-[#8696a0] hover:text-[#111b21] transition",children:a.jsx(Ce,{size:16})})]}),e.ref_id&&a.jsxs("p",{className:"text-[12px] text-[#667781]",children:["Protocolo: ",a.jsxs("span",{className:"font-mono font-bold",children:["#",e.ref_id]})]}),a.jsxs("select",{value:i,onChange:p=>o(Number(p.target.value)),className:"w-full border border-[#d1d7db] rounded-xl px-3 py-2.5 text-[13px] text-[#111b21] outline-none focus:border-[#00a884]",children:[a.jsx("option",{value:"",children:"Selecione o atendente..."}),r.map(p=>a.jsxs("option",{value:p.id,children:[p.name," — ",p.email]},p.id))]}),a.jsx("textarea",{value:l,onChange:p=>c(p.target.value),placeholder:"Mensagem de contexto (opcional)",rows:3,className:"w-full border border-[#d1d7db] rounded-xl px-3 py-2 text-[13px] text-[#111b21] placeholder-[#8696a0] outline-none focus:border-[#00a884] resize-none"}),a.jsxs("button",{onClick:f,disabled:!i||u,className:"bg-[#00a884] hover:bg-[#008f72] disabled:opacity-40 text-white rounded-xl py-2.5 text-[13px] font-bold transition flex items-center justify-center gap-2",children:[a.jsx(h1,{size:15}),u?"Transferindo...":"Transferir"]})]})})}function sge({thread:e,accountId:t,onBack:n,onRefresh:r}){const[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState(""),[d,f]=b.useState(!1),[p,h]=b.useState(!1),[m,v]=b.useState(!1),[x,y]=b.useState(""),[g,j]=b.useState(!1),[N,w]=b.useState(!1),[S,k]=b.useState(!1),C=b.useRef(null),_=b.useCallback(async()=>{l(!0);try{const R=await Gc.getThread(e.thread_id);i(R),t&&await Gc.markRead(e.thread_id,t)}finally{l(!1)}},[e.thread_id,t]);b.useEffect(()=>{_()},[_]),b.useEffect(()=>{var R;(R=C.current)==null||R.scrollIntoView({behavior:"smooth"})},[s]);async function A(){if(c.trim()){f(!0);try{e.type==="human_api"&&e.ref_id?await vfe.answer(Number(e.ref_id),c.trim()):await Gc.postMessage({thread_id:e.thread_id,from_account:t||void 0,sector_id:e.sector_id||void 0,type:e.type,content:c.trim(),ref_id:e.ref_id||void 0}),u(""),_(),r()}finally{f(!1)}}}async function E(R){j(!0);try{await h4.flag({threadId:e.thread_id,type:R,note:x.trim()||void 0}),v(!1),y(""),_(),r()}finally{j(!1)}}async function P(R){if(R){w(!0);try{await h4.close({threadId:e.thread_id,chatId:R,protocolNumber:e.ref_id||void 0}),_(),r()}finally{w(!1)}}}async function D(){var W,T;const R=(W=s.find(V=>!V.from_account))==null?void 0:W.content,M=(T=s.filter(V=>V.from_account).pop())==null?void 0:T.content;if(M){k(!0);try{const V=await m4.save({question:R||e.ref_id||"Consulta",answer:M,sectorId:e.sector_id||void 0});window.confirm("Resposta salva! Promover para Base de Conhecimento do setor agora?")&&await m4.promote(V.id)}finally{k(!1)}}}const I=Zc[e.type]||Zc.collaboration;return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5]",children:[a.jsxs("div",{className:"flex-shrink-0 px-3 py-3 bg-[#f0f2f5] border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx("button",{onClick:n,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#54656f]",children:a.jsx(Ui,{size:18})}),a.jsx(I.Icon,{size:15,className:I.color}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-sm font-medium text-[#111b21] truncate",children:[I.label,e.sector_name&&a.jsxs("span",{className:"text-[#8696a0]",children:[" · ",e.sector_name]})]}),e.ref_id&&a.jsxs("p",{className:"text-[10px] text-[#8696a0]",children:["#",e.ref_id]})]}),e.type==="human_api"&&a.jsx("button",{onClick:D,disabled:S,title:"Salvar resposta no Brain",className:"p-1.5 rounded-full hover:bg-[#e9edef] transition text-cyan-500 disabled:opacity-40",children:a.jsx(d1,{size:15})}),a.jsx("button",{onClick:()=>v(R=>!R),title:"Registrar flag",className:`p-1.5 rounded-full hover:bg-[#e9edef] transition ${m?"text-amber-500":"text-[#8696a0]"}`,children:a.jsx(ev,{size:15})}),a.jsx("button",{onClick:()=>h(!0),title:"Transferir protocolo",className:"p-1.5 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(h1,{size:15})}),a.jsx("button",{onClick:_,className:"p-1.5 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(ke,{size:13,className:o?"animate-spin":""})})]}),p&&a.jsx(age,{thread:e,onClose:()=>h(!1),onDone:()=>{_(),r()}}),m&&a.jsxs("div",{className:"flex-shrink-0 px-3 py-2 bg-amber-50 border-b border-amber-200",children:[a.jsxs("p",{className:"text-[11px] font-semibold text-amber-700 mb-1.5 flex items-center gap-1",children:[a.jsx(ev,{size:10})," Registrar flag neste protocolo"]}),a.jsx("input",{value:x,onChange:R=>y(R.target.value),placeholder:"Observação (opcional)",className:"w-full border border-amber-200 rounded-lg px-2.5 py-1.5 text-[12px] mb-1.5 outline-none focus:border-amber-400 bg-white"}),a.jsx("div",{className:"flex gap-1.5",children:[["complaint","🔴 Reclamação"],["suggestion","💡 Sugestão"],["compliment","⭐ Elogio"]].map(([R,M])=>a.jsx("button",{onClick:()=>E(R),disabled:g,className:"flex-1 text-[11px] font-medium py-1 rounded-lg border border-amber-200 bg-white hover:bg-amber-100 text-amber-800 disabled:opacity-40 transition",children:M},R))})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[o&&s.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Carregando..."}):s.map(R=>{const M=t&&R.from_account===t,W=!R.from_account;return a.jsxs("div",{className:`flex gap-2 ${M?"flex-row-reverse":""}`,children:[!M&&a.jsx(rge,{name:R.from_name,url:R.from_avatar,size:7}),a.jsxs("div",{className:`max-w-[82%] flex flex-col gap-0.5 ${M?"items-end":"items-start"}`,children:[!M&&!W&&a.jsx("p",{className:"text-[10px] text-[#8696a0] px-1",children:R.from_name||"Sistema"}),a.jsx("div",{className:`px-3 py-2 rounded-2xl text-[13px] leading-relaxed whitespace-pre-wrap shadow-sm + ${W?"bg-[#fff3cd] border border-[#ffe69c] text-[#664d03] italic text-xs rounded-xl":M?"bg-[#d9fdd3] text-[#111b21] rounded-tr-sm":"bg-white text-[#111b21] rounded-tl-sm"}`,children:R.content}),a.jsx("p",{className:"text-[10px] text-[#8696a0] px-1",children:ub(R.created_at)})]})]},R.id)}),a.jsx("div",{ref:C})]}),a.jsxs("div",{className:"flex-shrink-0 px-3 py-2 bg-[#f0f2f5] border-t border-[#e9edef]",children:[e.type==="human_api"&&a.jsxs("p",{className:"text-[11px] text-cyan-600 mb-1.5 flex items-center gap-1",children:[a.jsx(ra,{size:11})," Sua resposta será entregue à IA para continuar o atendimento"]}),a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx("textarea",{value:c,onChange:R=>u(R.target.value),onKeyDown:R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),A())},rows:1,placeholder:"Digite uma mensagem",className:"flex-1 bg-white border-0 rounded-xl px-3 py-2.5 text-[13px] text-[#111b21] placeholder-[#8696a0] focus:outline-none resize-none shadow-sm",style:{minHeight:40,maxHeight:100}}),a.jsx("button",{onClick:A,disabled:d||!c.trim(),className:"p-2.5 bg-[#00a884] hover:bg-[#008f72] disabled:opacity-40 text-white rounded-full transition flex-shrink-0",children:a.jsx(Rr,{size:15})})]}),e.type==="escalation"&&e.ref_id&&e.chat_id&&a.jsx("div",{className:"mt-1.5 flex justify-end",children:a.jsxs("button",{onClick:()=>P(e.chat_id),disabled:N,className:"flex items-center gap-1.5 px-3 py-1 text-[11px] font-medium text-[#54656f] hover:text-red-600 hover:bg-red-50 rounded-lg transition disabled:opacity-40",children:[a.jsx(Ts,{size:12}),N?"Encerrando...":"Encerrar protocolo"]})})]})]})}function ige({accountId:e,role:t="agent"}){const[n,r]=b.useState([]),[s,i]=b.useState(null),[o,l]=b.useState(null),[c,u]=b.useState([]),[d,f]=b.useState(null),[p,h]=b.useState(!1),[m,v]=b.useState(0),[x,y]=b.useState(!0),[g,j]=b.useState(""),[N,w]=b.useState("inbox"),[S,k]=b.useState(!1),{notifications:C,push:_,dismiss:A}=nge(),{addEventListener:E,removeEventListener:P}=Dd(),D=b.useRef(null),I=b.useRef(null),R=b.useRef(N);b.useEffect(()=>{D.current=o},[o]),b.useEffect(()=>{I.current=d},[d]),b.useEffect(()=>{R.current=N},[N]);const M=b.useCallback(async()=>{if(e){y(!0);try{const L=await Gc.listThreads(e);r(L)}finally{y(!1)}}},[e]),W=b.useCallback(async()=>{if(e){h(!0);try{const L=await Kc.list();u(L)}finally{h(!1)}}},[e]),T=b.useCallback(async()=>{if(e)try{const{unread_count:L}=await Gf.list();v(L)}catch{}},[e]);b.useEffect(()=>{M()},[M]),b.useEffect(()=>{W()},[W]),b.useEffect(()=>{T()},[T]),b.useEffect(()=>{const L=Z=>{var q;const{from:F,content:z}=Z;R.current==="colleagues"&&((q=D.current)==null?void 0:q.id)===F||_({type:"dm.new",title:"Nova mensagem",body:z})},B=Z=>{const{question:F}=Z;M(),_({type:"human_api.new",title:"IA precisa de ajuda",body:F||"Clique para responder"})},ae=()=>{_({type:"human_api.timeout",title:"Tempo esgotado",body:"IA retomou sem resposta humana"})},se=Z=>{const F=Z;_({type:"sla.breach",title:"SLA em risco!",body:F.protocol?`Protocolo #${F.protocol}`:"Protocolo urgente"})},xe=()=>{M(),_({type:"handoff.expired",title:"Handoff expirado",body:"Atendimento retornou para a IA"})},H=Z=>{const F=Z;F.from!==e&&R.current!=="broadcast"&&(v(z=>z+1),_({type:"dm.new",title:"Aviso da equipe",body:F.content}))},le=Z=>{var q;const F=Z,z=R.current==="groups"&&((q=I.current)==null?void 0:q.id)===F.group_chat_id;u(ie=>ie.map(oe=>oe.id===F.group_chat_id?{...oe,last_message:F.content,last_message_at:new Date().toISOString(),unread_count:z?oe.unread_count:(oe.unread_count??0)+1}:oe)),z||_({type:"dm.new",title:`Grupo: ${F.group_name}`,body:F.content})};return E("dm.new",L),E("human_api.new",B),E("human_api.timeout",ae),E("sla.breach",se),E("handoff.expired",xe),E("group_message.new",le),E("broadcast.sent",H),()=>{P("dm.new",L),P("human_api.new",B),P("human_api.timeout",ae),P("sla.breach",se),P("handoff.expired",xe),P("group_message.new",le),P("broadcast.sent",H)}},[E,P,M,_]);const V=g?n.filter(L=>L.type===g):n,X=n.reduce((L,B)=>L+B.unread,0),U=c.reduce((L,B)=>L+(B.unread_count??0),0);return e?a.jsxs("div",{className:"flex h-full bg-white",children:[a.jsx(tge,{notifications:C,onDismiss:A}),a.jsxs("div",{className:`flex flex-col h-full min-h-0 bg-white border-r border-[#d1d7db] ${o||s||d?"w-80 flex-shrink-0":"flex-1"} ${N==="broadcast"?"flex-1":""}`,children:[a.jsx("div",{className:"flex-shrink-0 px-3 pt-3 pb-0 bg-white border-b border-[#e9edef]",children:a.jsxs("div",{className:"flex gap-0 mb-0 overflow-x-auto",children:[a.jsxs("button",{onClick:()=>{w("inbox"),l(null),f(null)},className:`relative flex items-center gap-1 px-3 py-2 text-[12px] font-medium border-b-2 transition flex-shrink-0 ${N==="inbox"?"border-[#00a884] text-[#00a884]":"border-transparent text-[#8696a0] hover:text-[#54656f]"}`,children:[a.jsx(Pr,{size:13}),"Inbox",X>0&&a.jsx("span",{className:"bg-[#25d366] text-white text-[9px] font-bold min-w-[15px] h-[15px] px-0.5 rounded-full flex items-center justify-center",children:X>9?"9+":X})]}),a.jsxs("button",{onClick:()=>{w("colleagues"),i(null),f(null)},className:`relative flex items-center gap-1 px-3 py-2 text-[12px] font-medium border-b-2 transition flex-shrink-0 ${N==="colleagues"?"border-[#00a884] text-[#00a884]":"border-transparent text-[#8696a0] hover:text-[#54656f]"}`,children:[a.jsx(et,{size:13}),"Equipe"]}),a.jsxs("button",{onClick:()=>{w("groups"),i(null),l(null)},className:`relative flex items-center gap-1 px-3 py-2 text-[12px] font-medium border-b-2 transition flex-shrink-0 ${N==="groups"?"border-[#00a884] text-[#00a884]":"border-transparent text-[#8696a0] hover:text-[#54656f]"}`,children:[a.jsx(rn,{size:13}),"Grupos",U>0&&a.jsx("span",{className:"bg-[#25d366] text-white text-[9px] font-bold min-w-[15px] h-[15px] px-0.5 rounded-full flex items-center justify-center",children:U>9?"9+":U})]}),a.jsxs("button",{onClick:()=>{w("broadcast"),i(null),l(null),f(null)},className:`relative flex items-center gap-1 px-3 py-2 text-[12px] font-medium border-b-2 transition flex-shrink-0 ${N==="broadcast"?"border-amber-500 text-amber-600":"border-transparent text-[#8696a0] hover:text-[#54656f]"}`,children:[a.jsx(ju,{size:13}),"Avisos",m>0&&a.jsx("span",{className:"bg-amber-500 text-white text-[9px] font-bold min-w-[15px] h-[15px] px-0.5 rounded-full flex items-center justify-center",children:m>9?"9+":m})]}),a.jsx("button",{onClick:()=>k(!0),title:"Ajuda sobre o Inbox Interna",className:"ml-auto flex-shrink-0 self-center p-1.5 rounded-full text-[#8696a0] hover:text-[#00a884] hover:bg-[#e9edef] transition",children:a.jsx(gI,{size:14})})]})}),S&&a.jsx(Z0e,{onClose:()=>k(!1)}),N==="inbox"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex-shrink-0 px-4 pt-3 pb-2 bg-[#f0f2f5] border-b border-[#e9edef]",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("h3",{className:"text-xs font-semibold text-[#667781] uppercase tracking-wide",children:"Mensagens"}),X>0&&a.jsx("span",{className:"ml-auto bg-[#25d366] text-white text-[10px] font-bold px-1.5 py-0.5 rounded-full",children:X}),a.jsx("button",{onClick:M,className:`${X>0?"":"ml-auto"} p-1 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]`,children:a.jsx(ke,{size:13,className:x?"animate-spin":""})})]}),a.jsxs("div",{className:"flex gap-1 overflow-x-auto pb-0.5 -mx-1 px-1",children:[a.jsx("button",{onClick:()=>j(""),className:`px-2.5 py-0.5 rounded-full text-[11px] font-medium transition whitespace-nowrap + ${g?"text-[#54656f] hover:bg-[#e9edef]":"bg-[#00a884] text-white"}`,children:"Todos"}),Object.entries(Zc).map(([L,B])=>a.jsxs("button",{onClick:()=>j(L),className:`flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-medium transition whitespace-nowrap + ${g===L?"bg-[#00a884] text-white":"text-[#54656f] hover:bg-[#e9edef]"}`,children:[a.jsx(B.Icon,{size:9}),B.label]},L))]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:x?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-sm",children:"Carregando..."}):V.length===0?a.jsxs("div",{className:"text-center py-12 text-[#8696a0] text-xs px-4",children:[a.jsx(Pr,{size:28,className:"mx-auto mb-3 opacity-30 text-[#54656f]"}),"Nenhuma mensagem ainda.",a.jsx("br",{}),"Você receberá aqui consultas da IA e mensagens da equipe."]}):V.map(L=>{const B=Zc[L.type]||Zc.collaboration;return a.jsxs("button",{onClick:()=>i(L),className:`w-full text-left flex items-start gap-3 px-4 py-3 border-b border-[#e9edef] hover:bg-[#f5f6f6] transition-colors + ${(s==null?void 0:s.thread_id)===L.thread_id?"bg-[#e7f5ff] border-l-4 border-l-[#00a884]":""}`,children:[a.jsx("div",{className:`mt-0.5 flex-shrink-0 ${B.color}`,children:a.jsx(B.Icon,{size:16})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-1",children:[a.jsxs("span",{className:"text-[13px] font-medium text-[#111b21]",children:[B.label,L.sector_name&&a.jsxs("span",{className:"text-[#8696a0] font-normal",children:[" · ",L.sector_name]})]}),a.jsx("span",{className:`text-[11px] flex-shrink-0 ${L.unread>0?"text-[#25d366] font-medium":"text-[#8696a0]"}`,children:ub(L.last_at)})]}),a.jsx("p",{className:"text-[12px] text-[#667781] truncate mt-0.5",children:L.last_message}),L.ref_id&&a.jsxs("p",{className:"text-[11px] text-[#8696a0]",children:["#",L.ref_id]})]}),L.unread>0&&a.jsx("span",{className:"mt-1 flex-shrink-0 bg-[#25d366] text-white text-[10px] font-bold min-w-[18px] h-[18px] px-1 rounded-full flex items-center justify-center",children:L.unread})]},L.thread_id)})}),a.jsx("div",{className:"flex-shrink-0 p-3 border-t border-[#e9edef] bg-[#f0f2f5]",children:a.jsxs("button",{onClick:async()=>{const L=prompt("Descreva do que você precisa de ajuda:");if(!L)return;const B=await Gc.postMessage({from_account:e,type:"help_request",content:L});await M();const ae=n.find(se=>se.thread_id===B.thread_id)||{thread_id:B.thread_id,type:"help_request",sector_id:null,sector_name:null,last_message:L,last_at:B.created_at,ref_id:null,chat_id:null,unread:0};i(ae)},className:"w-full flex items-center justify-center gap-2 px-3 py-2 border border-dashed border-[#c8d0d4] rounded-xl text-[12px] text-[#54656f] hover:bg-[#e9edef] transition",children:[a.jsx(Ol,{size:13}),"Preciso de ajuda"]})})]}),N==="colleagues"&&a.jsx(U0e,{selected:(o==null?void 0:o.id)??null,onSelect:L=>l(L),onStartDM:L=>l(L),onNewDM:L=>{(o==null?void 0:o.id)!==L&&_({type:"dm.new",title:"Nova mensagem",body:"Clique em Equipe para ver"})}}),N==="groups"&&a.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[a.jsxs("div",{className:"flex-shrink-0 px-3 pt-3 pb-2 bg-[#f0f2f5] border-b border-[#e9edef] flex items-center justify-between",children:[a.jsx("h3",{className:"text-xs font-semibold text-[#667781] uppercase tracking-wide",children:"Grupos por Setor"}),a.jsx("button",{onClick:W,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(ke,{size:11,className:p?"animate-spin":""})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:p?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-[12px]",children:"Carregando..."}):c.length===0?a.jsx("div",{className:"text-center py-8 text-[#8696a0] text-[12px]",children:"Nenhum grupo encontrado"}):c.map(L=>{const B=(L.unread_count??0)>0;return a.jsxs("button",{onClick:()=>{f(L),u(ae=>ae.map(se=>se.id===L.id?{...se,unread_count:0}:se)),Kc.markRead(L.id).catch(()=>{})},className:`w-full text-left flex items-center gap-2.5 px-3 py-2.5 border-b border-[#f0f2f5] hover:bg-[#f5f6f6] transition-colors + ${(d==null?void 0:d.id)===L.id?"bg-[#e7f5ff] border-l-4 border-l-[#00a884]":""} + ${B?"bg-white":""}`,children:[a.jsx("div",{className:"w-9 h-9 rounded-full flex items-center justify-center text-white text-sm font-bold flex-shrink-0",style:{backgroundColor:L.color},children:L.name.charAt(0).toUpperCase()}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`text-[13px] truncate ${B?"font-semibold text-[#111b21]":"font-medium text-[#111b21]"}`,children:L.name}),L.last_message&&a.jsx("p",{className:`text-[11px] truncate ${B?"text-[#111b21] font-medium":"text-[#8696a0]"}`,children:L.last_message})]}),a.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[L.last_message_at&&a.jsx("span",{className:`text-[10px] ${B?"text-[#25d366] font-medium":"text-[#8696a0]"}`,children:ub(L.last_message_at)}),B&&a.jsx("span",{className:"bg-[#25d366] text-white text-[9px] font-bold min-w-[18px] h-[18px] px-1 rounded-full flex items-center justify-center",children:L.unread_count>9?"9+":L.unread_count})]})]},L.id)})})]}),N==="broadcast"&&e&&a.jsx(Q0e,{accountId:e,role:t,onNewBroadcast:L=>_({type:"dm.new",title:"Aviso da equipe",body:L}),onSeen:()=>v(0)})]}),(s||o||d)&&a.jsx("div",{className:"flex-1 flex flex-col",children:s&&!o&&!d?a.jsx(sge,{thread:s,accountId:e??null,onBack:()=>i(null),onRefresh:M}):o?a.jsx(H0e,{colleague:o,accountId:e,onBack:()=>l(null)}):d?a.jsx(G0e,{group:d,accountId:e,onBack:()=>f(null)}):null})]}):a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-[#8696a0] px-6 text-center",children:[a.jsx(Pr,{size:32,className:"opacity-30"}),a.jsx("p",{className:"text-[13px]",children:"Inbox Interna disponível apenas para membros da equipe."}),a.jsx("p",{className:"text-[11px]",children:"Faça login como colaborador para acessar."})]})}function oge(){const[e,t]=b.useState([]),[n,r]=b.useState(0),[s,i]=b.useState(0),[o,l]=b.useState(""),[c,u]=b.useState(!1),d=15,f=b.useCallback(async(x,y)=>{u(!0);try{const g=new URLSearchParams({limit:String(d),offset:String(x*d)});y!==""&&g.set("rating",String(y));const N=await(await fetch(`/api/admin/metrics/ratings-history?${g}`,{credentials:"include"})).json();t(N.rows??[]),r(N.total??0)}catch{}finally{u(!1)}},[]);b.useEffect(()=>{f(s,o)},[s,o,f]);function p(x){return new Date(x).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})}const h=x=>x?"★".repeat(x)+"☆".repeat(5-x):"—",m=x=>x?x>=4?"text-[#25d366]":x>=3?"text-amber-400":"text-red-400":"text-[#8696a0]",v=Math.ceil(n/d);return a.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-[#e9edef] overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-2.5 border-b border-[#e9edef] flex items-center gap-2 flex-wrap",children:[a.jsx(gd,{size:13,className:"text-amber-400 shrink-0"}),a.jsx("h3",{className:"text-[12px] font-semibold text-[#111b21] flex-1",children:"Histórico de Avaliações"}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{onClick:()=>{l(""),i(0)},className:`px-2 py-0.5 rounded-full text-[10px] font-medium transition ${o===""?"bg-[#00a884] text-white":"text-[#8696a0] hover:bg-[#f0f2f5]"}`,children:"Todas"}),[5,4,3,2,1].map(x=>a.jsx("button",{onClick:()=>{l(x),i(0)},className:`px-2 py-0.5 rounded-full text-[10px] font-medium transition ${o===x?"bg-amber-400 text-white":"text-[#8696a0] hover:bg-[#f0f2f5]"}`,children:"★".repeat(x)},x))]})]}),c?a.jsxs("div",{className:"flex items-center justify-center py-8 text-[#8696a0] gap-2 text-[12px]",children:[a.jsx(ke,{size:12,className:"animate-spin"})," Carregando…"]}):e.length===0?a.jsx("p",{className:"text-center py-8 text-[#8696a0] text-[12px]",children:"Nenhuma avaliação encontrada"}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-[11px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-[#e9edef] text-[#8696a0] text-[10px] uppercase",children:[a.jsx("th",{className:"text-left px-4 py-2",children:"Chat"}),a.jsx("th",{className:"text-left px-3 py-2",children:"Atendente"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Nota"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Status"}),a.jsx("th",{className:"text-right px-4 py-2",children:"Enviado"})]})}),a.jsx("tbody",{children:e.map(x=>a.jsxs("tr",{className:"border-b border-[#f5f6f6] hover:bg-[#f5f6f6] transition",children:[a.jsx("td",{className:"px-4 py-2 font-mono text-[10px] text-[#54656f] max-w-[100px] truncate",children:x.chat_id.replace("@s.whatsapp.net","")}),a.jsx("td",{className:"px-3 py-2 text-[#111b21] max-w-[100px] truncate",children:x.account_name||"—"}),a.jsx("td",{className:`px-3 py-2 text-center font-bold text-[13px] ${m(x.rating)}`,children:h(x.rating)}),a.jsx("td",{className:"px-3 py-2 text-center",children:a.jsx("span",{className:`px-1.5 py-0.5 rounded-full text-[9px] font-bold ${x.status==="rated"?"bg-[#25d366]/10 text-[#25d366]":x.status==="expired"?"bg-slate-100 text-slate-400":"bg-amber-50 text-amber-500"}`,children:x.status==="rated"?"Avaliado":x.status==="expired"?"Expirado":"Pendente"})}),a.jsx("td",{className:"px-4 py-2 text-right text-[#8696a0]",children:p(x.sent_at)})]},x.id))})]})}),v>1&&a.jsxs("div",{className:"px-4 py-2 flex items-center justify-between text-[11px] text-[#8696a0] border-t border-[#f0f2f5]",children:[a.jsxs("span",{children:[n," avaliações"]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>i(x=>Math.max(0,x-1)),disabled:s===0,className:"p-1 rounded hover:bg-[#e9edef] disabled:opacity-30 transition",children:a.jsx(xd,{size:13})}),a.jsxs("span",{children:[s+1," / ",v]}),a.jsx("button",{onClick:()=>i(x=>Math.min(v-1,x+1)),disabled:s>=v-1,className:"p-1 rounded hover:bg-[#e9edef] disabled:opacity-30 transition",children:a.jsx(Pa,{size:13})})]})]})]})]})}function lge({data:e}){if(!e.length)return a.jsx("p",{className:"text-center py-6 text-[#8696a0] text-[12px]",children:"Sem escalações no período"});const t=Math.max(...e.map(n=>parseInt(n.count)));return a.jsx("div",{className:"flex items-end gap-1.5 h-[72px] px-2 pb-1",children:e.map(n=>{const r=t>0?Math.max(4,Math.round(parseInt(n.count)/t*64)):4;return a.jsxs("div",{className:"flex flex-col items-center gap-0.5 flex-1 min-w-0",children:[a.jsx("span",{className:"text-[9px] text-[#8696a0] font-medium",children:n.count}),a.jsx("div",{className:"w-full rounded-t-sm bg-[#00a884]",style:{height:r}}),a.jsx("span",{className:"text-[9px] text-[#8696a0] truncate w-full text-center",children:n.day})]},n.day)})})}function ro(e){return parseInt(e??"0",10)||0}function zC(e){return e?parseFloat(e).toFixed(1):"—"}function Cf({icon:e,label:t,value:n,sub:r,color:s="text-[#00a884]"}){return a.jsxs("div",{className:"bg-white rounded-2xl p-4 shadow-sm border border-[#e9edef] flex flex-col gap-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[#8696a0] text-[11px] font-medium uppercase tracking-wide",children:[a.jsx(e,{size:12,className:s}),t]}),a.jsx("p",{className:`text-[28px] font-bold leading-none ${s}`,children:n}),r&&a.jsx("p",{className:"text-[11px] text-[#8696a0]",children:r})]})}function cge(){var d,f,p;const[e,t]=b.useState(null),[n,r]=b.useState("7d"),[s,i]=b.useState(!0),[o,l]=b.useState(null),c=b.useCallback(async()=>{i(!0),l(null);try{const h=await fetch(`/api/admin/metrics/attendance?period=${n}`,{credentials:"include"});if(!h.ok)throw new Error(`HTTP ${h.status}`);t(await h.json())}catch(h){l(h.message)}finally{i(!1)}},[n]);b.useEffect(()=>{c()},[c]);const u=[["today","Hoje"],["7d","7 dias"],["30d","30 dias"]];return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5] overflow-y-auto",children:[a.jsxs("div",{className:"flex-shrink-0 px-4 pt-3 pb-2 bg-[#f0f2f5] border-b border-[#e9edef]",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(yu,{size:15,className:"text-[#54656f]"}),a.jsx("h2",{className:"text-sm font-semibold text-[#111b21] flex-1",children:"Métricas de Atendimento"}),a.jsx("button",{onClick:c,className:"p-1 rounded-full hover:bg-[#e9edef] transition text-[#8696a0]",children:a.jsx(ke,{size:13,className:s?"animate-spin":""})})]}),a.jsx("div",{className:"flex gap-1",children:u.map(([h,m])=>a.jsx("button",{onClick:()=>r(h),className:`px-3 py-1 rounded-full text-[11px] font-medium transition + ${n===h?"bg-[#00a884] text-white":"text-[#54656f] hover:bg-[#e9edef]"}`,children:m},h))})]}),o&&a.jsx("div",{className:"m-4 p-3 bg-red-50 border border-red-200 text-red-700 text-[12px] rounded-xl",children:o}),e&&a.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Cf,{icon:et,label:"Escalações assumidas",value:e.by_account.reduce((h,m)=>h+ro(m.escalations_assumed),0),sub:`nos últimos ${(d=u.find(h=>h[0]===n))==null?void 0:d[1]}`,color:"text-[#00a884]"}),a.jsx(Cf,{icon:ra,label:"Respostas IA",value:`${e.auto_replies.rate_pct}%`,sub:`${e.auto_replies.total_replied} de ${e.auto_replies.total_in} msgs`,color:"text-cyan-500"}),a.jsx(Cf,{icon:Ts,label:"Human API respondidas",value:`${e.human_api.rate_pct}%`,sub:`${e.human_api.answered} de ${e.human_api.total} pedidos`,color:"text-[#25d366]"}),a.jsx(Cf,{icon:Kt,label:"Timeouts Human API",value:e.human_api.timeout,sub:e.human_api.ignored>0?`+ ${e.human_api.ignored} ignorados`:"sem pedidos ignorados",color:"text-amber-500"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"bg-white rounded-2xl p-4 shadow-sm border border-[#e9edef] flex flex-col gap-1.5",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[#8696a0] text-[11px] font-medium uppercase tracking-wide",children:[a.jsx(ev,{size:12,className:"text-amber-500"})," Flags do período"]}),a.jsxs("div",{className:"flex gap-3 mt-0.5",children:[a.jsxs("span",{className:"text-[12px]",children:[a.jsx("span",{className:"font-bold text-red-500",children:e.flags.complaints})," ",a.jsx("span",{className:"text-[#8696a0]",children:"reclam."})]}),a.jsxs("span",{className:"text-[12px]",children:[a.jsx("span",{className:"font-bold text-cyan-500",children:e.flags.suggestions})," ",a.jsx("span",{className:"text-[#8696a0]",children:"sugest."})]}),a.jsxs("span",{className:"text-[12px]",children:[a.jsx("span",{className:"font-bold text-[#25d366]",children:e.flags.compliments})," ",a.jsx("span",{className:"text-[#8696a0]",children:"elogios"})]})]})]}),a.jsxs("div",{className:"bg-white rounded-2xl p-4 shadow-sm border border-[#e9edef] flex flex-col gap-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[#8696a0] text-[11px] font-medium uppercase tracking-wide",children:[a.jsx(gd,{size:12,className:"text-amber-400"})," Satisfação"]}),a.jsx("p",{className:"text-[28px] font-bold leading-none text-amber-400",children:e.ratings.avg_rating?`${e.ratings.avg_rating.toFixed(1)}★`:"—"}),a.jsxs("p",{className:"text-[11px] text-[#8696a0]",children:[e.ratings.total_rated," de ",e.ratings.total_sent," avaliaram"]})]}),a.jsxs("div",{className:"col-span-2 bg-white rounded-2xl p-4 shadow-sm border border-[#e9edef] flex items-center gap-4",children:[a.jsx("div",{className:"p-2.5 rounded-xl bg-[#00a884]/10 text-[#00a884]",children:a.jsx(ZP,{size:18})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-[11px] font-medium text-[#8696a0] uppercase tracking-wide",children:"Tempo médio de resolução"}),a.jsx("p",{className:"text-[22px] font-bold text-[#111b21] leading-tight",children:((f=e.resolution)==null?void 0:f.avg_minutes)!=null?e.resolution.avg_minutes>=60?`${(e.resolution.avg_minutes/60).toFixed(1)}h`:`${e.resolution.avg_minutes.toFixed(0)} min`:"—"})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-[10px] text-[#8696a0]",children:"protocolos encerrados"}),a.jsx("p",{className:"text-[18px] font-bold text-[#54656f]",children:((p=e.resolution)==null?void 0:p.total_resolved)??0})]})]})]}),a.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-[#e9edef] overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-2.5 border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx(yu,{size:13,className:"text-[#54656f]"}),a.jsx("h3",{className:"text-[12px] font-semibold text-[#111b21]",children:"Escalações por dia"})]}),a.jsx("div",{className:"px-2 py-2",children:a.jsx(lge,{data:e.daily_escalations})})]}),a.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-[#e9edef] overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-2.5 border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx(et,{size:13,className:"text-[#54656f]"}),a.jsx("h3",{className:"text-[12px] font-semibold text-[#111b21]",children:"Por Colaborador"})]}),e.by_account.length===0?a.jsx("p",{className:"text-center py-6 text-[#8696a0] text-[12px]",children:"Sem dados"}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-[#e9edef] text-[#8696a0] text-[10px] uppercase",children:[a.jsx("th",{className:"text-left px-4 py-2",children:"Colaborador"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Escalações"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Msgs"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Human API"}),a.jsx("th",{className:"text-center px-3 py-2",children:a.jsxs("span",{className:"flex items-center justify-center gap-1",children:[a.jsx(hn,{size:9}),"1ª resp."]})})]})}),a.jsx("tbody",{children:e.by_account.map(h=>a.jsxs("tr",{className:"border-b border-[#f5f6f6] hover:bg-[#f5f6f6] transition",children:[a.jsxs("td",{className:"px-4 py-2.5",children:[a.jsx("p",{className:"font-medium text-[#111b21] truncate max-w-[120px]",children:h.name}),a.jsx("p",{className:"text-[10px] text-[#8696a0] truncate max-w-[120px]",children:h.email})]}),a.jsx("td",{className:"text-center px-3 py-2 font-bold text-[#00a884]",children:ro(h.escalations_assumed)}),a.jsx("td",{className:"text-center px-3 py-2 text-[#54656f]",children:ro(h.messages_sent)}),a.jsx("td",{className:"text-center px-3 py-2 text-cyan-600",children:ro(h.human_api_answered)}),a.jsx("td",{className:"text-center px-3 py-2 text-[#8696a0]",children:h.avg_first_response_min?`${zC(h.avg_first_response_min)}m`:"—"})]},h.account_id))})]})})]}),a.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-[#e9edef] overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-2.5 border-b border-[#e9edef] flex items-center gap-2",children:[a.jsx(Wi,{size:13,className:"text-[#54656f]"}),a.jsx("h3",{className:"text-[12px] font-semibold text-[#111b21]",children:"Por Setor"})]}),e.by_sector.length===0?a.jsx("p",{className:"text-center py-6 text-[#8696a0] text-[12px]",children:"Sem dados"}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-[#e9edef] text-[#8696a0] text-[10px] uppercase",children:[a.jsx("th",{className:"text-left px-4 py-2",children:"Setor"}),a.jsx("th",{className:"text-center px-3 py-2",children:"Escalações"}),a.jsx("th",{className:"text-center px-3 py-2",children:a.jsxs("span",{className:"flex items-center justify-center gap-1",children:[a.jsx(Ai,{size:9}),"SLA breach"]})}),a.jsx("th",{className:"text-center px-3 py-2",children:"SLA (min)"}),a.jsx("th",{className:"text-center px-3 py-2",children:a.jsxs("span",{className:"flex items-center justify-center gap-1",children:[a.jsx(hn,{size:9}),"Resp. média"]})})]})}),a.jsx("tbody",{children:e.by_sector.map(h=>{const m=ro(h.escalations_total),v=ro(h.sla_breaches),x=m>0&&v===0;return a.jsxs("tr",{className:"border-b border-[#f5f6f6] hover:bg-[#f5f6f6] transition",children:[a.jsxs("td",{className:"px-4 py-2.5 flex items-center gap-2",children:[a.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:h.color||"#6366f1"}}),a.jsx("span",{className:"font-medium text-[#111b21]",children:h.name})]}),a.jsx("td",{className:"text-center px-3 py-2 font-bold text-[#00a884]",children:m}),a.jsx("td",{className:"text-center px-3 py-2",children:v>0?a.jsx("span",{className:"text-red-500 font-bold",children:v}):a.jsx("span",{className:m>0?"text-[#25d366]":"text-[#8696a0]",children:x?"✓":"—"})}),a.jsx("td",{className:"text-center px-3 py-2 text-[#8696a0]",children:h.sla_minutes??"—"}),a.jsx("td",{className:"text-center px-3 py-2 text-[#8696a0]",children:h.avg_response_min?`${zC(h.avg_response_min)}m`:"—"})]},h.sector_id)})})]})})]}),a.jsx(oge,{}),a.jsxs("p",{className:"text-center text-[10px] text-[#8696a0] pb-2",children:["Dados calculados em tempo real · ",new Date().toLocaleTimeString("pt-BR")]})]}),s&&!e&&a.jsxs("div",{className:"flex-1 flex items-center justify-center text-[#8696a0] text-sm gap-2",children:[a.jsx(ke,{size:14,className:"animate-spin"})," Carregando métricas..."]})]})}const Y0={text:"",btnText:"",btnFooter:"",buttons:[{id:"btn1",text:""}],ctaText:"",ctaFooter:"",ctaButtons:[{type:"url",text:"",extra:""}],listText:"",listButtonText:"Ver opções",listFooter:"",listSections:[{title:"Seção 1",rows:[{id:"r1",title:"",description:""}]}],pollName:"",pollSelectable:1,pollOptions:["",""],carouselText:"",carouselFooter:"",cards:[{title:"",body:"",footer:"",imageUrl:"",buttons:[{id:"cb1",text:""}]}]},BC=[{type:"TEXT",label:"Texto",icon:a.jsx(eE,{className:"w-4 h-4"}),color:"#667781"},{type:"BUTTONS",label:"Botões",icon:a.jsx(qP,{className:"w-4 h-4"}),color:"#0ea5e9"},{type:"INTERACTIVE",label:"CTA",icon:a.jsx(UP,{className:"w-4 h-4"}),color:"#8b5cf6"},{type:"LIST",label:"Lista",icon:a.jsx(WP,{className:"w-4 h-4"}),color:"#f59e0b"},{type:"POLL",label:"Enquete",icon:a.jsx(ys,{className:"w-4 h-4"}),color:"#10b981"},{type:"CAROUSEL",label:"Carrossel",icon:a.jsx(VP,{className:"w-4 h-4"}),color:"#ef4444"}];function ja(){return`id_${Date.now()}_${Math.random().toString(36).slice(2,7)}`}function uge(e,t){switch(e){case"TEXT":return{text:t.text??""};case"BUTTONS":{const n=t.nativeButtons??[];return{btnText:t.text??"",btnFooter:t.footer??"",buttons:n.length?n.map(r=>({id:r.id??ja(),text:r.text??""})):[{id:"btn1",text:""}]}}case"INTERACTIVE":{const n=t.nativeButtons??[];return{ctaText:t.text??"",ctaFooter:t.footer??"",ctaButtons:n.length?n.map(r=>({type:r.type==="copy"||r.type==="call"?r.type:"url",text:r.text??"",extra:r.url??r.copyText??r.phoneNumber??""})):[{type:"url",text:"",extra:""}]}}case"LIST":{const n=t.nativeList??{};return{listText:t.text??"",listFooter:t.footer??"",listButtonText:n.buttonText??"Ver opções",listSections:(n.sections??[]).length?n.sections.map(r=>({title:r.title??"",rows:(r.rows??[]).map(s=>({id:s.id??ja(),title:s.title??"",description:s.description??""}))})):[{title:"Seção 1",rows:[{id:"r1",title:"",description:""}]}]}}case"POLL":{const n=t.poll??{};return{pollName:n.name??"",pollOptions:(n.values??[]).length>=2?n.values:["",""],pollSelectable:n.selectableCount??1}}case"CAROUSEL":{const n=t.nativeCarousel??{};return{carouselText:t.text??"",carouselFooter:t.footer??"",cards:(n.cards??[]).length?n.cards.map(r=>{var s;return{title:r.title??"",body:r.body??"",footer:r.footer??"",imageUrl:((s=r.image)==null?void 0:s.url)??"",buttons:(r.buttons??[]).length?r.buttons.map(i=>({id:i.id??ja(),text:i.text??""})):[{id:ja(),text:""}]}}):[{title:"",body:"",footer:"",imageUrl:"",buttons:[{id:"cb1",text:""}]}]}}default:return{}}}function Q0(e,t){switch(e){case"TEXT":return{text:t.text};case"BUTTONS":return{text:t.btnText||void 0,footer:t.btnFooter||void 0,nativeButtons:t.buttons.filter(n=>n.id&&n.text).map(n=>({type:"reply",id:n.id,text:n.text}))};case"INTERACTIVE":return{text:t.ctaText||void 0,footer:t.ctaFooter||void 0,nativeButtons:t.ctaButtons.filter(n=>n.text&&n.extra).map(n=>n.type==="url"?{type:"url",text:n.text,url:n.extra}:n.type==="copy"?{type:"copy",text:n.text,copyText:n.extra}:{type:"call",text:n.text,phoneNumber:n.extra})};case"LIST":{const n=t.listSections.map(r=>({title:r.title,rows:r.rows.filter(s=>s.id&&s.title)})).filter(r=>r.rows.length>0);return{text:t.listText||void 0,footer:t.listFooter||void 0,nativeList:{buttonText:t.listButtonText||"Ver opções",sections:n}}}case"POLL":return{poll:{name:t.pollName||"Enquete",values:t.pollOptions.filter(Boolean),selectableCount:t.pollSelectable}};case"CAROUSEL":{const n=t.cards.map(r=>({title:r.title||void 0,body:r.body||void 0,footer:r.footer||void 0,image:r.imageUrl?{url:r.imageUrl}:void 0,buttons:r.buttons.filter(s=>s.id&&s.text).map(s=>({type:"reply",id:s.id,text:s.text}))}));return{text:t.carouselText||void 0,footer:t.carouselFooter||void 0,nativeCarousel:{cards:n}}}}}function dge({form:e,set:t}){return a.jsxs("div",{className:"space-y-3",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Mensagem"}),a.jsx("textarea",{rows:5,className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#00a884]/30 resize-none",placeholder:"Digite o texto da mensagem...",value:e.text,onChange:n=>t({text:n.target.value})})]})}function fge({form:e,set:t}){const n=()=>{e.buttons.length>=3||t({buttons:[...e.buttons,{id:ja(),text:""}]})},r=i=>t({buttons:e.buttons.filter((o,l)=>l!==i)}),s=(i,o,l)=>{const c=[...e.buttons];c[i]={...c[i],[o]:l},t({buttons:c})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Texto"}),a.jsx("textarea",{rows:2,className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none resize-none",placeholder:"Corpo da mensagem",value:e.btnText,onChange:i=>t({btnText:i.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Botões (máx. 3)"}),e.buttons.map((i,o)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:"flex-1 rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"ID do botão",value:i.id,onChange:l=>s(o,"id",l.target.value)}),a.jsx("input",{className:"flex-[2] rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"Texto visível",value:i.text,onChange:l=>s(o,"text",l.target.value)}),a.jsx("button",{onClick:()=>r(o),disabled:e.buttons.length<=1,className:"p-2 rounded-full hover:bg-red-50 text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-4 h-4"})})]},i.id)),e.buttons.length<3&&a.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-[#0ea5e9] hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar botão"]})]})]})}function pge({form:e,set:t}){const n=()=>{e.ctaButtons.length>=3||t({ctaButtons:[...e.ctaButtons,{type:"url",text:"",extra:""}]})},r=l=>t({ctaButtons:e.ctaButtons.filter((c,u)=>u!==l)}),s=(l,c,u)=>{const d=[...e.ctaButtons];d[l]={...d[l],[c]:u},t({ctaButtons:d})},i={url:"https://...",copy:"Código do cupom",call:"5511999999999"},o={url:"URL",copy:"Código a copiar",call:"Número de telefone"};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Texto"}),a.jsx("textarea",{rows:2,className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none resize-none",placeholder:"Corpo da mensagem",value:e.ctaText,onChange:l=>t({ctaText:l.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Botões CTA (máx. 3)"}),e.ctaButtons.map((l,c)=>a.jsxs("div",{className:"rounded-xl border border-gray-200 bg-[#f8f9fa] p-3 space-y-2",children:[a.jsxs("div",{className:"flex gap-2 items-start",children:[a.jsxs("select",{value:l.type,onChange:u=>s(c,"type",u.target.value),className:"rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",children:[a.jsx("option",{value:"url",children:"🌐 URL"}),a.jsx("option",{value:"copy",children:"📋 Copiar"}),a.jsx("option",{value:"call",children:"📞 Ligar"})]}),a.jsx("input",{className:"flex-1 rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"Texto do botão",value:l.text,onChange:u=>s(c,"text",u.target.value)}),a.jsx("button",{onClick:()=>r(c),disabled:e.ctaButtons.length<=1,className:"p-1.5 rounded-full hover:bg-red-50 text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-3.5 h-3.5"})})]}),a.jsx("input",{className:"w-full rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:i[l.type],value:l.extra,onChange:u=>s(c,"extra",u.target.value)}),a.jsx("span",{className:"text-[10px] text-gray-400",children:o[l.type]})]},c)),e.ctaButtons.length<3&&a.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-[#8b5cf6] hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar botão CTA"]})]})]})}function hge({form:e,set:t}){const n=()=>t({listSections:[...e.listSections,{title:`Seção ${e.listSections.length+1}`,rows:[{id:ja(),title:"",description:""}]}]}),r=c=>t({listSections:e.listSections.filter((u,d)=>d!==c)}),s=(c,u)=>{const d=[...e.listSections];d[c]={...d[c],title:u},t({listSections:d})},i=c=>{const u=[...e.listSections];u[c]={...u[c],rows:[...u[c].rows,{id:ja(),title:"",description:""}]},t({listSections:u})},o=(c,u)=>{const d=[...e.listSections];d[c]={...d[c],rows:d[c].rows.filter((f,p)=>p!==u)},t({listSections:d})},l=(c,u,d,f)=>{const p=[...e.listSections],h=[...p[c].rows];h[u]={...h[u],[d]:f},p[c]={...p[c],rows:h},t({listSections:p})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Texto"}),a.jsx("textarea",{rows:2,className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none resize-none",placeholder:"Corpo da mensagem",value:e.listText,onChange:c=>t({listText:c.target.value})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Texto do Botão"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"Ver opções",value:e.listButtonText,onChange:c=>t({listButtonText:c.target.value})})]})]}),a.jsxs("div",{className:"space-y-3",children:[e.listSections.map((c,u)=>a.jsxs("div",{className:"rounded-xl border border-amber-100 bg-amber-50/50 p-3 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{className:"flex-1 rounded-lg border border-amber-200 bg-white px-2 py-1.5 text-xs font-medium focus:outline-none",placeholder:"Título da seção",value:c.title,onChange:d=>s(u,d.target.value)}),a.jsx("button",{onClick:()=>r(u),disabled:e.listSections.length<=1,className:"p-1 rounded text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-3.5 h-3.5"})})]}),c.rows.map((d,f)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:"w-20 rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"ID",value:d.id,onChange:p=>l(u,f,"id",p.target.value)}),a.jsx("input",{className:"flex-1 rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"Título",value:d.title,onChange:p=>l(u,f,"title",p.target.value)}),a.jsx("input",{className:"flex-[2] rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"Descrição",value:d.description,onChange:p=>l(u,f,"description",p.target.value)}),a.jsx("button",{onClick:()=>o(u,f),disabled:c.rows.length<=1,className:"p-1 rounded text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-3 h-3"})})]},f)),a.jsxs("button",{onClick:()=>i(u),className:"flex items-center gap-1 text-xs text-amber-600 hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3 h-3"})," Adicionar item"]})]},u)),a.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-amber-600 hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar seção"]})]})]})}function mge({form:e,set:t}){const n=()=>t({pollOptions:[...e.pollOptions,""]}),r=i=>{e.pollOptions.length<=2||t({pollOptions:e.pollOptions.filter((o,l)=>l!==i)})},s=(i,o)=>{const l=[...e.pollOptions];l[i]=o,t({pollOptions:l})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Pergunta"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"Qual a sua preferência?",value:e.pollName,onChange:i=>t({pollName:i.target.value})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Máx. seleções"}),a.jsx("input",{type:"number",min:1,max:e.pollOptions.filter(Boolean).length||1,className:"w-24 rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",value:e.pollSelectable,onChange:i=>t({pollSelectable:parseInt(i.target.value)||1})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Opções (mín. 2)"}),e.pollOptions.map((i,o)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{className:"flex-1 rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:`Opção ${o+1}`,value:i,onChange:l=>s(o,l.target.value)}),a.jsx("button",{onClick:()=>r(o),disabled:e.pollOptions.length<=2,className:"p-2 rounded-full hover:bg-red-50 text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-4 h-4"})})]},o)),e.pollOptions.length<12&&a.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-[#10b981] hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar opção"]})]})]})}function xge({form:e,set:t}){const n=()=>{e.cards.length>=10||t({cards:[...e.cards,{title:"",body:"",footer:"",imageUrl:"",buttons:[{id:ja(),text:""}]}]})},r=f=>t({cards:e.cards.filter((p,h)=>h!==f)}),s=(f,p,h)=>{const m=[...e.cards];m[f]={...m[f],[p]:h},t({cards:m})},i=f=>{const p=[...e.cards];p[f].buttons.push({id:ja(),text:""}),t({cards:p})},o=(f,p)=>{const h=[...e.cards];h[f].buttons=h[f].buttons.filter((m,v)=>v!==p),t({cards:h})},l=(f,p,h,m)=>{const v=[...e.cards];v[f].buttons[p]={...v[f].buttons[p],[h]:m},t({cards:v})},[c,u]=b.useState([0]),d=f=>u(p=>p.includes(f)?p.filter(h=>h!==f):[...p,f]);return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Texto acima"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"Ofertas especiais",value:e.carouselText,onChange:f=>t({carouselText:f.target.value})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Rodapé"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",placeholder:"Rodapé geral",value:e.carouselFooter,onChange:f=>t({carouselFooter:f.target.value})})]})]}),a.jsx("div",{className:"space-y-2 max-h-[320px] overflow-y-auto pr-1",children:e.cards.map((f,p)=>a.jsxs("div",{className:"rounded-xl border border-gray-200 bg-[#f8f9fa] overflow-hidden",children:[a.jsxs("button",{onClick:()=>d(p),className:"w-full flex items-center justify-between px-3 py-2.5 text-sm font-medium text-[#111b21] hover:bg-gray-100 transition-colors",children:[a.jsxs("span",{children:["Card ",p+1,f.title?` — ${f.title}`:""]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e.cards.length>1&&a.jsx("button",{onClick:h=>{h.stopPropagation(),r(p)},className:"p-1 rounded-full hover:bg-red-50 text-gray-400 hover:text-red-500",children:a.jsx(Te,{className:"w-3.5 h-3.5"})}),c.includes(p)?a.jsx(p1,{className:"w-4 h-4 text-gray-400"}):a.jsx(aa,{className:"w-4 h-4 text-gray-400"})]})]}),c.includes(p)&&a.jsxs("div",{className:"px-3 pb-3 space-y-2 border-t border-gray-100 pt-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("input",{className:"rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"Título",value:f.title,onChange:h=>s(p,"title",h.target.value)}),a.jsx("input",{className:"rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"Rodapé",value:f.footer,onChange:h=>s(p,"footer",h.target.value)})]}),a.jsx("textarea",{rows:2,className:"w-full rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none resize-none",placeholder:"Descrição/corpo",value:f.body,onChange:h=>s(p,"body",h.target.value)}),a.jsx("input",{className:"w-full rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none",placeholder:"URL da imagem (opcional)",value:f.imageUrl,onChange:h=>s(p,"imageUrl",h.target.value)}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("span",{className:"text-[10px] font-semibold text-gray-400 uppercase",children:"Botões do card"}),f.buttons.map((h,m)=>a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{className:"w-20 rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] focus:outline-none",placeholder:"ID",value:h.id,onChange:v=>l(p,m,"id",v.target.value)}),a.jsx("input",{className:"flex-1 rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] focus:outline-none",placeholder:"Texto",value:h.text,onChange:v=>l(p,m,"text",v.target.value)}),a.jsx("button",{onClick:()=>o(p,m),disabled:f.buttons.length<=1,className:"p-1 rounded text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-3 h-3"})})]},m)),a.jsxs("button",{onClick:()=>i(p),className:"flex items-center gap-1 text-[11px] text-red-500 hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3 h-3"})," Botão no card"]})]})]})]},p))}),e.cards.length<10&&a.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-[#ef4444] hover:underline font-medium",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar card"]})]})}function gge({isOpen:e,onClose:t,chatId:n,onSent:r,onSchedule:s,initialPayload:i,initialType:o="TEXT"}){const[l,c]=b.useState(o),[u,d]=b.useState(Y0),[f,p]=b.useState(!1),[h,m]=b.useState(null),[v,x]=b.useState(!1),[y,g]=b.useState(""),[j,N]=b.useState(!1),w=b.useCallback(A=>d(E=>({...E,...A})),[]);b.useEffect(()=>{if(e&&i){const A=o??"TEXT";c(A),d({...Y0,...uge(A,i)})}else e&&!i&&(c(o??"TEXT"),d(Y0))},[e,i,o]);const S=async()=>{var A,E;if(n){m(null),p(!0);try{const P=Q0(l,u);await he.sendRich(n,P),r==null||r(),t()}catch(P){m(((E=(A=P==null?void 0:P.response)==null?void 0:A.data)==null?void 0:E.error)??(P==null?void 0:P.message)??"Erro ao enviar")}finally{p(!1)}}},k=async()=>{if(!y.trim()){N(!0);return}x(!0);try{const A=Q0(l,u);await he.createTemplate({name:y.trim(),type:l,payload:A,tags:[]}),N(!1),g("")}finally{x(!1)}},C=()=>{const A=Q0(l,u);s==null||s(l,A)},_=BC.find(A=>A.type===l);return Bi.createPortal(a.jsx(cd,{children:e&&a.jsx(na.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-end sm:items-center justify-center p-4",onClick:A=>{A.target===A.currentTarget&&t()},children:a.jsxs(na.div,{initial:{opacity:0,y:40,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:40,scale:.97},transition:{type:"spring",stiffness:300,damping:30},className:"bg-white rounded-2xl shadow-2xl w-full max-w-xl max-h-[92vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100 shrink-0",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-base font-semibold text-[#111b21]",children:"Mensagem Rica"}),a.jsx("p",{className:"text-xs text-[#667781] mt-0.5",children:"Compose um tipo avançado de mensagem WhatsApp"})]}),a.jsx("button",{onClick:t,className:"p-2 rounded-full hover:bg-gray-100 text-gray-400",children:a.jsx(Ce,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"px-5 pt-3 pb-2 shrink-0",children:a.jsx("div",{className:"flex gap-1 bg-[#f0f2f5] rounded-xl p-1",children:BC.map(A=>a.jsxs("button",{onClick:()=>c(A.type),className:`flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-lg text-[11px] font-semibold transition-all ${l===A.type?"bg-white shadow-sm":"text-[#667781] hover:text-[#111b21]"}`,style:l===A.type?{color:A.color}:{},children:[A.icon,a.jsx("span",{className:"hidden sm:block",children:A.label})]},A.type))})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-3",children:[l==="TEXT"&&a.jsx(dge,{form:u,set:w}),l==="BUTTONS"&&a.jsx(fge,{form:u,set:w}),l==="INTERACTIVE"&&a.jsx(pge,{form:u,set:w}),l==="LIST"&&a.jsx(hge,{form:u,set:w}),l==="POLL"&&a.jsx(mge,{form:u,set:w}),l==="CAROUSEL"&&a.jsx(xge,{form:u,set:w})]}),a.jsx(cd,{children:j&&a.jsx(na.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"px-5 py-2 border-t border-gray-100 bg-[#f8f9fa] overflow-hidden shrink-0",children:a.jsxs("div",{className:"flex gap-2 items-center",children:[a.jsx("input",{autoFocus:!0,className:"flex-1 rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[#00a884]/30",placeholder:"Nome do template...",value:y,onChange:A=>g(A.target.value),onKeyDown:A=>{A.key==="Enter"&&k(),A.key==="Escape"&&N(!1)}}),a.jsx("button",{onClick:k,disabled:!y.trim()||v,className:"px-3 py-2 bg-[#00a884] text-white rounded-xl text-sm font-medium disabled:opacity-50 hover:bg-[#008f72]",children:v?"...":"Salvar"}),a.jsx("button",{onClick:()=>N(!1),className:"p-2 rounded-full hover:bg-gray-200 text-gray-400",children:a.jsx(Ce,{className:"w-4 h-4"})})]})})}),h&&a.jsx("div",{className:"mx-5 mb-2 px-3 py-2 bg-red-50 border border-red-200 rounded-xl text-xs text-red-600",children:h}),a.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 flex items-center justify-between shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{onClick:()=>N(!j),title:"Salvar como template",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl text-xs font-medium text-[#667781] hover:bg-gray-100",children:[a.jsx(lI,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:block",children:"Salvar template"})]}),s&&a.jsxs("button",{onClick:C,title:"Agendar envio",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl text-xs font-medium text-[#667781] hover:bg-gray-100",children:[a.jsx(Op,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:block",children:"Agendar"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 rounded-xl text-sm font-medium text-[#667781] hover:bg-gray-100",children:"Cancelar"}),a.jsxs("button",{onClick:S,disabled:f||!n,className:"flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-semibold text-white disabled:opacity-50 transition-all active:scale-95",style:{backgroundColor:_.color},children:[f?a.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):a.jsx(Rr,{className:"w-4 h-4"}),"Enviar"]})]})]})]})})}),document.body)}const o8={TEXT:{label:"Texto",icon:a.jsx(eE,{className:"w-3.5 h-3.5"}),color:"#667781",bg:"#f0f2f5"},BUTTONS:{label:"Botões",icon:a.jsx(qP,{className:"w-3.5 h-3.5"}),color:"#0ea5e9",bg:"#e0f2fe"},INTERACTIVE:{label:"CTA",icon:a.jsx(UP,{className:"w-3.5 h-3.5"}),color:"#8b5cf6",bg:"#ede9fe"},LIST:{label:"Lista",icon:a.jsx(WP,{className:"w-3.5 h-3.5"}),color:"#f59e0b",bg:"#fef3c7"},POLL:{label:"Enquete",icon:a.jsx(ys,{className:"w-3.5 h-3.5"}),color:"#10b981",bg:"#d1fae5"},CAROUSEL:{label:"Carrossel",icon:a.jsx(VP,{className:"w-3.5 h-3.5"}),color:"#ef4444",bg:"#fee2e2"}};function vge({type:e}){const t=o8[e];return a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold",style:{color:t.color,backgroundColor:t.bg},children:[t.icon,t.label]})}function yge({template:e}){var n,r,s,i;const t=e.payload;return e.type==="TEXT"?a.jsx("span",{className:"line-clamp-2",children:t.text||"—"}):e.type==="BUTTONS"?a.jsxs("span",{className:"line-clamp-1",children:[t.text||""," [",(t.nativeButtons??[]).length," botões]"]}):e.type==="INTERACTIVE"?a.jsxs("span",{className:"line-clamp-1",children:[t.text||""," [",(t.nativeButtons??[]).length," CTAs]"]}):e.type==="LIST"?a.jsxs("span",{className:"line-clamp-1",children:[t.text||""," — ",(n=t.nativeList)==null?void 0:n.buttonText]}):e.type==="POLL"?a.jsxs("span",{className:"line-clamp-1",children:["📊 ",(r=t.poll)==null?void 0:r.name," (",(((s=t.poll)==null?void 0:s.values)??[]).length," opções)"]}):e.type==="CAROUSEL"?a.jsxs("span",{className:"line-clamp-1",children:["🎠 ",(((i=t.nativeCarousel)==null?void 0:i.cards)??[]).length," cards"]}):null}const J0="ALL";function bge({isOpen:e,onClose:t,onSelect:n}){const[r,s]=b.useState([]),[i,o]=b.useState(!1),[l,c]=b.useState(""),[u,d]=b.useState(J0),[f,p]=b.useState(null),[h,m]=b.useState(null),v=b.useCallback(async()=>{o(!0);try{const j=await he.listTemplates({...u!==J0?{type:u}:{},...l?{search:l}:{}});s(j)}finally{o(!1)}},[u,l]);b.useEffect(()=>{e&&v()},[e,v]);const x=async(j,N)=>{if(j.stopPropagation(),!!confirm("Remover este template?")){p(N);try{await he.deleteTemplate(N),s(w=>w.filter(S=>S.id!==N))}finally{p(null)}}},y=j=>{m(j.id),he.markTemplateUsed(j.id).catch(()=>{}),setTimeout(()=>{n(j),m(null),t()},200)},g=[{key:J0,label:"Todos"},...Object.entries(o8).map(([j,N])=>({key:j,label:N.label}))];return Bi.createPortal(a.jsx(cd,{children:e&&a.jsx(na.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:j=>{j.target===j.currentTarget&&t()},children:a.jsxs(na.div,{initial:{opacity:0,y:30,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:30,scale:.97},transition:{type:"spring",stiffness:300,damping:30},className:"bg-white rounded-2xl shadow-2xl w-full max-w-2xl max-h-[85vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-xl bg-[#e0f2fe] flex items-center justify-center",children:a.jsx(Ep,{className:"w-5 h-5 text-[#0ea5e9]"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-base font-semibold text-[#111b21]",children:"Biblioteca de Templates"}),a.jsxs("p",{className:"text-xs text-[#667781]",children:[r.length," template",r.length!==1?"s":""," salvos"]})]})]}),a.jsx("button",{onClick:t,className:"p-2 rounded-full hover:bg-gray-100 text-gray-400",children:a.jsx(Ce,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"px-5 py-3 border-b border-gray-100 shrink-0",children:a.jsxs("div",{className:"relative",children:[a.jsx(Ir,{className:"absolute left-3 top-2.5 w-4 h-4 text-gray-400"}),a.jsx("input",{className:"w-full pl-9 pr-4 py-2 rounded-xl bg-[#f0f2f5] border-none text-sm focus:outline-none focus:ring-2 focus:ring-[#00a884]/30",placeholder:"Pesquisar templates...",value:l,onChange:j=>c(j.target.value)})]})}),a.jsx("div",{className:"px-5 py-2 flex gap-1.5 overflow-x-auto shrink-0 border-b border-gray-100 pb-2",children:g.map(j=>a.jsx("button",{onClick:()=>d(j.key),className:`px-3 py-1.5 rounded-full text-xs font-semibold whitespace-nowrap transition-all ${u===j.key?"bg-[#111b21] text-white":"bg-[#f0f2f5] text-[#667781] hover:bg-gray-200"}`,children:j.label},j.key))}),a.jsx("div",{className:"flex-1 overflow-y-auto p-5",children:i?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx("span",{className:"w-6 h-6 border-2 border-gray-200 border-t-[#00a884] rounded-full animate-spin"})}):r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx(Ep,{className:"w-12 h-12 text-gray-200 mb-3"}),a.jsx("p",{className:"text-sm font-medium text-[#667781]",children:"Nenhum template encontrado"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Crie um template no compositor de mensagens"})]}):a.jsx("div",{className:"space-y-2",children:r.map(j=>a.jsx(na.button,{layout:!0,onClick:()=>y(j),className:`w-full text-left rounded-xl border p-4 transition-all hover:shadow-md active:scale-[0.99] group ${h===j.id?"border-[#00a884] bg-[#e7f8f2]":"border-gray-200 hover:border-gray-300 bg-white"}`,children:a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx(vge,{type:j.type}),j.usageCount>0&&a.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-gray-400",children:[a.jsx(hn,{className:"w-3 h-3"}),j.usageCount,"x usado"]})]}),a.jsx("p",{className:"text-sm font-semibold text-[#111b21] truncate",children:j.name}),j.description&&a.jsx("p",{className:"text-xs text-[#667781] mt-0.5 line-clamp-1",children:j.description}),a.jsx("p",{className:"text-xs text-gray-400 mt-1.5 line-clamp-2",children:a.jsx(yge,{template:j})}),j.tags.length>0&&a.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:j.tags.map(N=>a.jsxs("span",{className:"px-1.5 py-0.5 bg-gray-100 text-[10px] text-gray-500 rounded",children:["#",N]},N))})]}),a.jsx("div",{className:"flex items-center gap-1 shrink-0",children:h===j.id?a.jsx(nn,{className:"w-5 h-5 text-[#00a884]"}):a.jsx("button",{onClick:N=>x(N,j.id),disabled:f===j.id,className:"p-1.5 rounded-full opacity-0 group-hover:opacity-100 hover:bg-red-50 text-gray-400 hover:text-red-500 transition-all",children:f===j.id?a.jsx("span",{className:"w-3.5 h-3.5 border border-gray-300 border-t-gray-500 rounded-full animate-spin block"}):a.jsx(Te,{className:"w-3.5 h-3.5"})})})]})},j.id))})})]})})}),document.body)}const jge=[{label:"Diariamente às 8h",expr:"0 8 * * *"},{label:"Seg a Sex às 9h",expr:"0 9 * * 1-5"},{label:"Toda segunda às 10h",expr:"0 10 * * 1"},{label:"Quinzenal (1/15)",expr:"0 9 1,15 * *"},{label:"Mensal (dia 1)",expr:"0 9 1 * *"},{label:"Semanal dom 11h",expr:"0 11 * * 0"}];function FC(){return`k_${Date.now()}_${Math.random().toString(36).slice(2,6)}`}function wge({isOpen:e,onClose:t,payload:n,messageType:r,onSaved:s}){const[i,o]=b.useState(1),[l,c]=b.useState("ONCE"),[u,d]=b.useState(""),[f,p]=b.useState("0 9 * * 1-5"),[h,m]=b.useState("BIRTHDAY"),[v,x]=b.useState("30"),[y,g]=b.useState(""),[j,N]=b.useState(""),[w,S]=b.useState([]),[k,C]=b.useState([{_key:FC(),jid:"",name:"",birthday:"",anniversary:"",signupDate:""}]),[_,A]=b.useState(!1),[E,P]=b.useState(null),[D,I]=b.useState(!1);b.useEffect(()=>{e&&he.getSessions().then(B=>S(B)).catch(()=>{})},[e]);const R=()=>C(B=>[...B,{_key:FC(),jid:"",name:"",birthday:"",anniversary:"",signupDate:""}]),M=B=>C(ae=>ae.filter(se=>se._key!==B)),W=(B,ae,se)=>C(xe=>xe.map(H=>H._key===B?{...H,[ae]:se}:H)),T=()=>!(!y.trim()||!j||l==="ONCE"&&!u||l==="RECURRING"&&!f.trim()),V=k.filter(B=>B.jid.trim()),X=async()=>{var B,ae;A(!0),P(null);try{await he.createScheduled({instanceId:j,name:y.trim(),payload:n,recipients:V.map(({_key:se,...xe})=>({...xe,jid:xe.jid.includes("@")?xe.jid:`${xe.jid.replace(/\D/g,"")}@s.whatsapp.net`})),scheduleType:l,scheduledAt:l==="ONCE"?u:void 0,cronExpr:l==="RECURRING"?f:l==="EVENT"&&h==="SIGNUP_DAYS"?v:void 0,eventType:l==="EVENT"?h:void 0,timezone:"America/Sao_Paulo"}),I(!0),s==null||s(),setTimeout(()=>{I(!1),t(),o(1)},2e3)}catch(se){P(((ae=(B=se==null?void 0:se.response)==null?void 0:B.data)==null?void 0:ae.error)??(se==null?void 0:se.message)??"Erro ao salvar")}finally{A(!1)}},U={TEXT:"Texto",BUTTONS:"Botões",INTERACTIVE:"CTA",LIST:"Lista",POLL:"Enquete",CAROUSEL:"Carrossel"},L=new Date(Date.now()+6e4).toISOString().slice(0,16);return Bi.createPortal(a.jsx(cd,{children:e&&a.jsx(na.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[60] flex items-center justify-center p-4",onClick:B=>{B.target===B.currentTarget&&t()},children:a.jsxs(na.div,{initial:{opacity:0,y:30,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:30,scale:.97},transition:{type:"spring",stiffness:300,damping:30},className:"bg-white rounded-2xl shadow-2xl w-full max-w-lg max-h-[90vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-xl bg-[#fef3c7] flex items-center justify-center",children:a.jsx(Op,{className:"w-5 h-5 text-[#f59e0b]"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-base font-semibold text-[#111b21]",children:"Agendar Mensagem"}),a.jsxs("p",{className:"text-xs text-[#667781]",children:["Tipo: ",U[r]]})]})]}),a.jsx("button",{onClick:t,className:"p-2 rounded-full hover:bg-gray-100 text-gray-400",children:a.jsx(Ce,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"px-5 py-3 flex items-center gap-2 shrink-0 border-b border-gray-100",children:[[1,2,3].map(B=>a.jsxs(O.Fragment,{children:[a.jsx("button",{onClick:()=>BB?"bg-[#10b981] text-white":"bg-gray-100 text-gray-400"}`,children:i>B?a.jsx(nn,{className:"w-4 h-4"}):B}),B<3&&a.jsx(Pa,{className:"w-4 h-4 text-gray-300"})]},B)),a.jsx("span",{className:"ml-2 text-xs text-[#667781]",children:i===1?"Configurar disparo":i===2?"Destinatários":"Confirmar"})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:[i===1&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Nome do agendamento"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#f59e0b]/30",placeholder:"Ex: Aniversários de Abril",value:y,onChange:B=>g(B.target.value)})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Instância WhatsApp"}),a.jsxs("select",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#f59e0b]/30",value:j,onChange:B=>N(B.target.value),children:[a.jsx("option",{value:"",children:"Selecionar instância..."}),w.map(B=>a.jsxs("option",{value:B.id,disabled:B.status!=="CONNECTED",children:[B.name," ",B.status!=="CONNECTED"?"(desconectada)":""]},B.id))]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Tipo de agendamento"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{type:"ONCE",label:"Uma vez",icon:a.jsx(hn,{className:"w-4 h-4"}),color:"#0ea5e9"},{type:"RECURRING",label:"Recorrente",icon:a.jsx(MI,{className:"w-4 h-4"}),color:"#8b5cf6"},{type:"EVENT",label:"Evento",icon:a.jsx(zP,{className:"w-4 h-4"}),color:"#ef4444"}].map(B=>a.jsxs("button",{onClick:()=>c(B.type),className:`flex flex-col items-center gap-1.5 p-3 rounded-xl border-2 transition-all text-sm font-semibold ${l===B.type?"border-current shadow-sm":"border-gray-200 text-gray-400 hover:border-gray-300"}`,style:l===B.type?{borderColor:B.color,color:B.color,backgroundColor:B.color+"10"}:{},children:[B.icon,B.label]},B.type))})]}),l==="ONCE"&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Data e hora"}),a.jsx("input",{type:"datetime-local",min:L,className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#0ea5e9]/30",value:u,onChange:B=>d(B.target.value)})]}),l==="RECURRING"&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{className:"block text-xs font-semibold text-[#667781] uppercase tracking-wider",children:"Expressão Cron"}),a.jsx("input",{className:"w-full rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2.5 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-[#8b5cf6]/30",placeholder:"0 9 * * 1-5",value:f,onChange:B=>p(B.target.value)})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:jge.map(B=>a.jsx("button",{onClick:()=>p(B.expr),className:`px-2.5 py-1 rounded-lg text-xs font-medium transition-all ${f===B.expr?"bg-[#8b5cf6] text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:B.label},B.expr))})]}),l==="EVENT"&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{type:"BIRTHDAY",label:"🎂 Aniversário"},{type:"ANNIVERSARY",label:"💍 Data Esp."},{type:"SIGNUP_DAYS",label:"📅 X dias"}].map(B=>a.jsx("button",{onClick:()=>m(B.type),className:`py-2.5 px-2 rounded-xl border-2 text-xs font-semibold transition-all ${h===B.type?"border-[#ef4444] bg-[#fee2e2] text-[#ef4444]":"border-gray-200 text-gray-500 hover:border-gray-300"}`,children:B.label},B.type))}),h==="SIGNUP_DAYS"&&a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("label",{className:"text-xs font-semibold text-[#667781] uppercase tracking-wider whitespace-nowrap",children:"Dias após cadastro"}),a.jsx("input",{type:"number",min:"1",max:"365",className:"w-24 rounded-xl border border-gray-200 bg-[#f8f9fa] px-3 py-2 text-sm focus:outline-none",value:v,onChange:B=>x(B.target.value)})]}),a.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-200 px-3 py-2.5 text-xs text-amber-700",children:[a.jsx("strong",{children:"Variáveis disponíveis:"})," ","{{name}}, {{birthday}}, {{anniversary}}",a.jsx("br",{}),"São substituídas automaticamente por contato no envio."]})]})]}),i===2&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(et,{className:"w-4 h-4 text-[#667781]"}),a.jsx("span",{className:"text-sm font-semibold text-[#111b21]",children:"Destinatários"}),a.jsxs("span",{className:"text-xs text-[#667781]",children:["(",V.length," válido",V.length!==1?"s":"",")"]})]}),a.jsxs("button",{onClick:R,className:"flex items-center gap-1 text-xs text-[#00a884] font-medium hover:underline",children:[a.jsx(Oe,{className:"w-3.5 h-3.5"})," Adicionar"]})]}),a.jsx("div",{className:"space-y-3 max-h-[380px] overflow-y-auto pr-1",children:k.map(B=>a.jsxs("div",{className:"rounded-xl border border-gray-200 bg-[#f8f9fa] p-3 space-y-2",children:[a.jsxs("div",{className:"flex gap-2 items-start",children:[a.jsx("input",{className:"flex-[2] rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-[#00a884]",placeholder:"Número ex: 5511999999999",value:B.jid,onChange:ae=>W(B._key,"jid",ae.target.value)}),a.jsx("input",{className:"flex-1 rounded-lg border border-gray-200 bg-white px-2 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-[#00a884]",placeholder:"Nome ({{name}})",value:B.name,onChange:ae=>W(B._key,"name",ae.target.value)}),a.jsx("button",{onClick:()=>M(B._key),disabled:k.length<=1,className:"p-1.5 rounded-full hover:bg-red-50 text-gray-400 hover:text-red-500 disabled:opacity-30",children:a.jsx(Te,{className:"w-3.5 h-3.5"})})]}),l==="EVENT"&&a.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[h==="BIRTHDAY"&&a.jsx("input",{type:"date",className:"rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] focus:outline-none",placeholder:"Aniversário",value:B.birthday,onChange:ae=>W(B._key,"birthday",ae.target.value)}),h==="ANNIVERSARY"&&a.jsx("input",{type:"date",className:"rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] focus:outline-none",placeholder:"Data esp.",value:B.anniversary,onChange:ae=>W(B._key,"anniversary",ae.target.value)}),h==="SIGNUP_DAYS"&&a.jsx("input",{type:"date",className:"rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] focus:outline-none",placeholder:"Data cadastro",value:B.signupDate,onChange:ae=>W(B._key,"signupDate",ae.target.value)})]})]},B._key))})]}),i===3&&a.jsx("div",{className:"space-y-4",children:D?a.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[a.jsx(nn,{className:"w-12 h-12 text-[#10b981]"}),a.jsx("p",{className:"text-base font-semibold text-[#111b21]",children:"Agendamento criado!"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"rounded-xl bg-[#f8f9fa] border border-gray-200 p-4 space-y-3",children:[a.jsx("p",{className:"text-sm font-semibold text-[#111b21]",children:y}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs text-[#667781]",children:[a.jsxs("span",{children:["Tipo: ",a.jsx("strong",{className:"text-[#111b21]",children:U[r]})]}),a.jsxs("span",{children:["Disparo: ",a.jsx("strong",{className:"text-[#111b21]",children:l==="ONCE"?"Uma vez":l==="RECURRING"?"Recorrente":"Evento"})]}),a.jsxs("span",{children:["Destinatários: ",a.jsx("strong",{className:"text-[#111b21]",children:V.length})]}),l==="ONCE"&&u&&a.jsxs("span",{children:["Em: ",a.jsx("strong",{className:"text-[#111b21]",children:new Date(u).toLocaleString("pt-BR")})]}),l==="RECURRING"&&a.jsxs("span",{children:["Cron: ",a.jsx("strong",{className:"text-[#111b21] font-mono",children:f})]})]})]}),E&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 bg-red-50 border border-red-200 rounded-xl text-xs text-red-600",children:[a.jsx(Kt,{className:"w-4 h-4 shrink-0 mt-0.5"}),E]})]})})]}),a.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 flex items-center justify-between shrink-0",children:[a.jsx("button",{onClick:()=>i>1?o(B=>B-1):t(),className:"px-4 py-2 rounded-xl text-sm font-medium text-[#667781] hover:bg-gray-100",children:i===1?"Cancelar":"Voltar"}),i<3?a.jsxs("button",{onClick:()=>o(B=>B+1),disabled:i===1&&!T(),className:"flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-semibold bg-[#f59e0b] text-white disabled:opacity-50 hover:bg-[#d97706] transition-colors",children:["Próximo ",a.jsx(Pa,{className:"w-4 h-4"})]}):!D&&a.jsxs("button",{onClick:X,disabled:_||V.length===0,className:"flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-semibold bg-[#00a884] text-white disabled:opacity-50 hover:bg-[#008f72] transition-colors",children:[_?a.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):a.jsx(Op,{className:"w-4 h-4"}),"Agendar"]})]})]})})}),document.body)}const VC=["#00a884","#25d366","#128c7e","#34b7f1","#7b68ee","#ff6b6b","#f59e0b","#10b981"];function Nge(e){let t=0;for(let n=0;n=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.trim().charAt(0).toUpperCase()}function kge(e){if(!e)return"";const t=new Date(e);if(isNaN(t.getTime()))return"";const n=new Date;n.setHours(0,0,0,0);const r=new Date(t);r.setHours(0,0,0,0);const s=Math.round((n.getTime()-r.getTime())/864e5);return s===0?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):s===1?"Ontem":s<7?t.toLocaleDateString("pt-BR",{weekday:"short"}).replace(".","").replace(/^\w/,i=>i.toUpperCase()):t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit"})}function Cge(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?"":t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}function _ge(e){const t=new Date(e);if(isNaN(t.getTime()))return"";const n=new Date;n.setHours(0,0,0,0);const r=new Date(t);r.setHours(0,0,0,0);const s=Math.round((n.getTime()-r.getTime())/864e5);return s===0?"Hoje":s===1?"Ontem":t.toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"})}function Age(e,t){const n=new Date(e),r=new Date(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function Bo({src:e,name:t,size:n=40,className:r=""}){const[s,i]=b.useState(!1);b.useEffect(()=>i(!1),[e]);const o=Nge(t||"?"),l=Sge(t);return a.jsx("div",{className:`rounded-full overflow-hidden flex-shrink-0 flex items-center justify-center border border-black/5 ${r}`,style:{width:n,height:n,backgroundColor:s||!e?o:"transparent"},children:e&&!s?a.jsx("img",{src:e,alt:t??"",className:"w-full h-full object-cover",onError:()=>i(!0)}):a.jsx("span",{className:"font-semibold text-white select-none",style:{fontSize:n*.38},children:l})})}const Xh={CONNECTED:{label:"Conectado",bg:"bg-[#00a884]/10 text-[#00a884] border-[#00a884]/20",dot:"bg-[#00a884] animate-pulse"},QR_PENDING:{label:"Aguard. QR",bg:"bg-amber-500/10 text-amber-600 border-amber-500/20",dot:"bg-amber-500 animate-pulse"},CONNECTING:{label:"Conectando",bg:"bg-blue-500/10 text-blue-600 border-blue-500/20",dot:"bg-blue-500 animate-pulse"},DISCONNECTED:{label:"Desconect.",bg:"bg-[#f0f2f5] text-[#667781] border-[#d1d7db]",dot:"bg-[#8696a0]"},BANNED:{label:"Banido",bg:"bg-red-50 text-red-600 border-red-200",dot:"bg-red-500"}};function l8({status:e}){const{label:t,bg:n,dot:r}=Xh[e]??Xh.DISCONNECTED;return a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold border ${n}`,children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r}`}),t]})}function c8({status:e,size:t=14}){return e==="READ"?a.jsx(Tp,{size:t,className:"text-[#53bdeb] flex-shrink-0"}):e==="DELIVERED"?a.jsx(Tp,{size:t,className:"text-[#8696a0] flex-shrink-0"}):e==="SENT"?a.jsx(jt,{size:t,className:"text-[#8696a0] flex-shrink-0"}):e==="PENDING"?a.jsx(hn,{size:t,className:"text-[#8696a0] flex-shrink-0"}):e==="FAILED"?a.jsx(Ar,{size:t,className:"text-red-500 flex-shrink-0"}):null}function Pge({chat:e}){const t=e.lastMessage;if(!t)return a.jsx("span",{className:"italic",children:"Sem mensagens"});const n=(()=>{var i;const s=(i=t.type)==null?void 0:i.toUpperCase();return s==="IMAGE"||s==="STICKER"?a.jsx(FP,{size:13,className:"text-[#8696a0] flex-shrink-0"}):s==="VIDEO"?a.jsx(tE,{size:13,className:"text-[#8696a0] flex-shrink-0"}):s==="AUDIO"||s==="PTT"?a.jsx(g1,{size:13,className:"text-[#8696a0] flex-shrink-0"}):s==="DOCUMENT"?a.jsx(Hr,{size:13,className:"text-[#8696a0] flex-shrink-0"}):null})(),r=t.body||(t.type!=="TEXT"?t.type:"");return a.jsxs("span",{className:"flex items-center gap-1 truncate",children:[n,r||a.jsx("span",{className:"italic text-[#8696a0]",children:"[mídia]"})]})}const UC=244,jc=224;function Ege({chat:e,isActive:t,onSelect:n,onArchive:r,onPin:s,onMarkRead:i,onDelete:o}){var x;const l=e.displayName??e.phone,[c,u]=b.useState(null),[d,f]=b.useState(!1),p=b.useRef(null),h=(y,g,j)=>{const N=j??g,S=window.innerHeight-N>=UC+8?N+4:g-UC,k=Math.min(y,window.innerWidth-jc-8);u({top:Math.max(8,S),left:Math.max(8,k)})},m=[{key:"favorite",label:d?"Remover favorito":"Favoritar",icon:d?a.jsx(LI,{size:15}):a.jsx(gd,{size:15})},{key:"archive",label:e.isArchived?"Desarquivar":"Arquivar",icon:e.isArchived?a.jsx(nI,{size:15}):a.jsx(rI,{size:15})},{key:"pin",label:e.isPinned?"Desafixar":"Fixar conversa",icon:e.isPinned?a.jsx(TI,{size:15}):a.jsx(H2,{size:15})},{key:"read",label:"Marcar como lida",icon:a.jsx(SI,{size:15})},{key:"delete",label:"Apagar conversa",icon:a.jsx(Te,{size:15}),danger:!0}],v=y=>{u(null),y==="favorite"&&f(g=>!g),y==="archive"&&r(!e.isArchived),y==="pin"&&s(!e.isPinned),y==="read"&&i(),y==="delete"&&o()};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:y=>(y.key==="Enter"||y.key===" ")&&n(),onContextMenu:y=>{y.preventDefault();const j=window.innerWidth-y.clientX>=jc+8?y.clientX:y.clientX-jc;h(Math.max(8,j),y.clientY,y.clientY)},className:`w-full flex items-center gap-3 px-3 py-2.5 transition-all cursor-pointer select-none group + border-b border-[#f0f2f5] last:border-none focus:outline-none focus-visible:ring-2 focus-visible:ring-[#00a884]/40 + ${t?"bg-[#f0f2f5]":"hover:bg-[#f5f6f6]"}`,children:[a.jsx(Bo,{src:e.avatar,name:l,size:49}),a.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center py-0.5 pr-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-[16px] leading-[21px] font-normal text-[#111b21] truncate",children:l}),a.jsx("span",{className:`text-[12px] leading-[14px] flex-shrink-0 ml-2 ${e.unreadCount>0?"text-[#00a884] font-medium":"text-[#667781]"}`,children:kge(e.lastMessageAt)})]}),a.jsxs("div",{className:"flex items-center justify-between mt-1 h-5",children:[a.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-[13px] leading-5 text-[#667781] truncate",children:[((x=e.lastMessage)==null?void 0:x.fromMe)&&a.jsx(c8,{status:e.lastMessage.status,size:13}),a.jsx("span",{className:"truncate",children:a.jsx(Pge,{chat:e})})]}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0 ml-1",children:[e.isPinned&&a.jsx(H2,{size:14,className:"text-[#8696a0]"}),e.unreadCount>0&&a.jsx("span",{className:"bg-[#00a884] text-white text-[12px] font-bold px-1.5 min-w-[20px] h-5 rounded-full flex items-center justify-center",children:e.unreadCount>99?"99+":e.unreadCount}),a.jsx("div",{className:"hidden group-hover:block",children:a.jsx("button",{ref:p,onClick:y=>{var j;y.stopPropagation();const g=(j=p.current)==null?void 0:j.getBoundingClientRect();g&&h(g.right-jc,g.top,g.bottom)},className:"p-1 rounded-full hover:bg-black/5",title:"Opções",children:a.jsx(aa,{size:16,className:"text-[#8696a0]"})})})]})]})]})]}),c&&typeof window<"u"&&YR.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[1000]",onClick:()=>u(null)}),a.jsx("div",{className:"fixed bg-white py-1.5 rounded-lg shadow-xl border border-gray-100 z-[1001] flex flex-col",style:{top:c.top,left:c.left,width:jc},onClick:y=>y.stopPropagation(),children:m.map(y=>a.jsxs("button",{onClick:()=>v(y.key),className:`flex items-center gap-3 px-4 py-2.5 text-sm transition-colors text-left + ${y.danger?"text-red-600 hover:bg-red-50":"text-[#3b4a54] hover:bg-[#f5f6f6]"}`,children:[a.jsx("span",{className:y.danger?"text-red-500":"text-[#8696a0]",children:y.icon}),y.label]},y.key))})]}),document.body)]})}function u8(e){return e.mediaUrl?`/api/nw/v1/media/${e.id}`:null}function Oge({msg:e,TimeEl:t,TimeRow:n,Spacer:r}){const[s,i]=b.useState(!1),[o,l]=b.useState(!1),c=u8(e);return!c||o?a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-center w-48 h-32 bg-black/5 rounded-lg",children:a.jsx(FP,{size:28,className:"text-[#8696a0]"})}),n]}):a.jsxs("div",{className:"rounded-lg overflow-hidden",children:[!s&&a.jsx("div",{className:"w-48 h-32 bg-black/5 animate-pulse rounded-lg"}),a.jsx("img",{src:c,alt:"Imagem",loading:"lazy",className:`max-w-full max-h-[300px] object-cover block cursor-pointer ${s?"":"hidden"}`,onLoad:()=>i(!0),onError:()=>l(!0),onClick:()=>window.open(c,"_blank")}),e.caption&&s&&a.jsxs("div",{className:"relative px-1 pt-1.5 pb-0.5",children:[a.jsxs("p",{className:"text-[14.2px] break-words whitespace-pre-wrap leading-[1.6] text-[#111b21]",children:[e.caption,r]}),a.jsx("div",{className:"absolute bottom-0.5 right-1",children:t})]}),!e.caption&&s&&a.jsx("div",{className:"px-1 pb-0.5",children:n})]})}function Tge({msg:e,showTail:t,showSender:n,senderName:r}){const s=e.fromMe,i=Cge(e.timestamp),o=s?62:42,l=a.jsx("span",{className:"inline-block pointer-events-none select-none opacity-0 align-bottom",style:{width:o,height:14},"aria-hidden":!0}),c=a.jsxs("span",{className:"inline-flex items-center gap-[3px] text-[11px] text-[#667781] leading-none select-none flex-shrink-0",children:[i,s&&a.jsx(c8,{status:e.status,size:12})]}),u=a.jsx("div",{className:"flex items-center justify-end gap-[3px] mt-1 pr-0.5",children:c}),d=()=>{var m,v,x;const f=(m=e.type)==null?void 0:m.toUpperCase(),p=u8(e);if(f==="IMAGE")return a.jsx(Oge,{msg:e,TimeEl:c,TimeRow:u,Spacer:l});if(f==="VIDEO")return a.jsxs("div",{children:[p?a.jsx("video",{src:p,controls:!0,preload:"metadata",className:"max-w-full max-h-[300px] rounded-lg block bg-black/10",style:{minWidth:240}}):a.jsx("div",{className:"flex items-center justify-center w-60 h-36 bg-black/10 rounded-lg",children:a.jsx(tE,{size:28,className:"text-[#8696a0]"})}),u]});if(f==="AUDIO"||f==="PTT")return a.jsxs("div",{className:"min-w-[220px]",children:[p?a.jsx("audio",{controls:!0,preload:"metadata",className:"w-full h-10 rounded-lg",children:a.jsx("source",{src:p,type:e.mimeType||"audio/ogg"})}):a.jsxs("div",{className:"flex items-center gap-2 text-[#667781] italic text-[13px]",children:[a.jsx(g1,{size:14})," Áudio indisponível"]}),u]});if(f==="DOCUMENT"){const y=((x=(v=e.mimeType)==null?void 0:v.split("/")[1])==null?void 0:x.toUpperCase())||"FILE";return a.jsxs("div",{children:[a.jsxs("a",{href:p??"#",download:e.fileName??"arquivo",target:"_blank",rel:"noreferrer",className:"flex items-center gap-3 bg-[#f0f2f5] p-3 rounded-xl border border-black/5 hover:bg-gray-200 transition-all no-underline",children:[a.jsx("div",{className:"w-10 h-10 bg-[#00a884]/10 rounded-lg flex items-center justify-center text-[#00a884] flex-shrink-0",children:a.jsx(Hr,{size:22})}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("span",{className:"text-[14px] font-normal truncate text-[#111b21]",children:e.fileName||e.body||"Documento"}),a.jsx("span",{className:"text-[11px] text-[#667781] uppercase mt-0.5",children:y})]})]}),u]})}if(f==="STICKER")return a.jsxs("div",{children:[p?a.jsx("img",{src:p,alt:"Sticker",loading:"lazy",className:"max-w-[180px] max-h-[180px]"}):a.jsxs("div",{className:"flex items-center gap-2 text-[13px] text-[#667781] italic",children:[a.jsx(gd,{size:14})," Figurinha"]}),u]});const h=e.body||e.caption;return h?a.jsxs("p",{className:"text-[14.2px] break-words whitespace-pre-wrap leading-[1.6] text-[#111b21]",children:[h,a.jsx("span",{style:{float:"right",marginLeft:6,position:"relative",bottom:-3},children:c})]}):a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-[#8696a0] italic",children:[a.jsx(Ar,{size:12})," Mensagem não disponível"]}),u]})};return a.jsx("div",{className:`flex w-full mb-[2px] ${s?"justify-end pr-4":"justify-start pl-4"}`,children:a.jsxs("div",{className:"flex flex-col max-w-[75%] relative",children:[n&&r&&!s&&a.jsx("span",{className:"text-[11px] font-bold text-[#00a884] mb-1 ml-2 truncate",children:r}),a.jsxs("div",{className:`px-2 py-1.5 rounded-lg shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] relative overflow-visible + ${s?`bg-[#d9fdd3] ${t?"rounded-tr-none":""}`:`bg-white ${t?"rounded-tl-none":""}`}`,children:[t&&a.jsx("div",{className:"absolute top-0 pointer-events-none",style:{[s?"right":"left"]:-8,width:10,height:14,backgroundColor:s?"#d9fdd3":"#ffffff",clipPath:s?"polygon(0 0, 100% 0, 0 100%)":"polygon(100% 0, 0 0, 100% 100%)"}}),d()]})]})})}function $ge({label:e}){return a.jsx("div",{className:"flex items-center justify-center my-3",children:a.jsx("span",{className:"bg-[#e1f3fb] text-[#54656f] text-[12.5px] px-3 py-[3px] rounded-full shadow-sm border border-[#cde9f4]/60 select-none",children:e})})}function Mge(e){const t=e.replace(/\D/g,"");return t.startsWith("55")&&(t.length===12||t.length===13)?t:t.length===10||t.length===11?"55"+t:t}function Rge({sessionId:e,onClose:t,onSent:n}){const[r,s]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1),[u,d]=b.useState(!1),[f,p]=b.useState(""),h=b.useRef(null),m=b.useRef(null);b.useEffect(()=>{setTimeout(()=>{var x;return(x=h.current)==null?void 0:x.focus()},80)},[]);const v=async()=>{var y,g,j,N;const x=Mge(r);if(x.length<10){p("Número inválido. Ex: 67 99913-8794"),(y=h.current)==null||y.focus();return}if(!i.trim()){p("Escreva uma mensagem para iniciar"),(g=m.current)==null||g.focus();return}c(!0),p("");try{await he.startConversation(e,x,i.trim()),d(!0),setTimeout(()=>{n(),t()},1200)}catch(w){p(((N=(j=w==null?void 0:w.response)==null?void 0:j.data)==null?void 0:N.error)??w.message??"Erro ao enviar"),c(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm p-4",onClick:l?void 0:t,children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-sm overflow-hidden",onClick:x=>x.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-[#00a884]/10 flex items-center justify-center",children:a.jsx(rn,{size:14,className:"text-[#00a884]"})}),a.jsx("h3",{className:"text-[15px] font-bold text-[#111b21]",children:"Nova Conversa"})]}),a.jsx("button",{onClick:t,disabled:l,className:"p-1.5 hover:bg-gray-100 rounded-full transition-colors",children:a.jsx(Ce,{size:18,className:"text-[#667781]"})})]}),a.jsxs("div",{className:"p-5 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Número do WhatsApp"}),a.jsx("input",{ref:h,type:"text",value:r,onChange:x=>{s(x.target.value.replace(/[^\d\s\-()+]/g,"")),p("")},onKeyDown:x=>{var y;return x.key==="Enter"&&((y=m.current)==null?void 0:y.focus())},placeholder:"Ex: 67 99913-8794",disabled:l||u,className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] focus:ring-2 focus:ring-[#00a884]/10 transition-all disabled:opacity-50"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Primeira mensagem"}),a.jsx("textarea",{ref:m,value:i,onChange:x=>{o(x.target.value),p("")},onKeyDown:x=>{x.key==="Enter"&&(x.ctrlKey||x.metaKey)&&(x.preventDefault(),v())},rows:3,placeholder:"Olá! Tudo bem?",disabled:l||u,className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] focus:ring-2 focus:ring-[#00a884]/10 resize-none transition-all disabled:opacity-50"}),a.jsx("p",{className:"text-[11px] text-[#8696a0] mt-1",children:"Ctrl+Enter para enviar"})]}),f&&a.jsx("p",{className:"text-red-500 text-[13px] font-medium",children:f})]}),a.jsx("div",{className:"px-5 pb-5",children:a.jsx("button",{onClick:v,disabled:!r.trim()||!i.trim()||l||u,className:"w-full py-2.5 rounded-xl font-semibold text-[14px] transition-all bg-[#00a884] text-white hover:bg-[#008f6e] disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:u?a.jsxs(a.Fragment,{children:[a.jsx(jt,{size:16})," Enviado!"]}):l?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"})," Enviando…"]}):a.jsxs(a.Fragment,{children:[a.jsx(Rr,{size:15})," Iniciar Conversa"]})})})]})})}const dw={notificacoes:"Notificações",entregas:"Entregas",suporte:"Suporte",marketing:"Marketing",geral:"Geral"},WC={notificacoes:"bg-blue-100 text-blue-700 border-blue-200",entregas:"bg-orange-100 text-orange-700 border-orange-200",suporte:"bg-purple-100 text-purple-700 border-purple-200",marketing:"bg-pink-100 text-pink-700 border-pink-200",geral:"bg-gray-100 text-gray-600 border-gray-200"},fw={1:"Principal",2:"Fallback",3:"Terciário",4:"4º",5:"5º"};function Dge({role:e,priority:t}){const n=WC[e]??WC.geral,r=dw[e]??e,s=fw[t]??`P${t}`;return a.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded border ${n}`,children:r}),a.jsx("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded border bg-slate-100 text-slate-600 border-slate-200",children:s})]})}function Ige({onClose:e,onCreated:t}){const[n,r]=b.useState("form"),[s,i]=b.useState(""),[o,l]=b.useState("geral"),[c,u]=b.useState(""),[d,f]=b.useState(1),[p,h]=b.useState(""),[m,v]=b.useState(!1),[x,y]=b.useState(""),[g,j]=b.useState(""),[N,w]=b.useState(!1),S=async()=>{var C,_;if(!s.trim()){y("Informe um nome/apelido para o número.");return}v(!0),y("");try{const A=await he.createSession(s.trim());await he.saveNumber({instance_id:A.id,label:s.trim(),role:o,area:c.trim()||null,priority:d,notes:p.trim()||null}),r("qr"),w(!0);let E=0;const P=setInterval(async()=>{E++;try{const D=await he.getQr(A.id);j(D.qrBase64),clearInterval(P),w(!1)}catch{E>=15&&(clearInterval(P),w(!1))}},2e3)}catch(A){y(((_=(C=A==null?void 0:A.response)==null?void 0:C.data)==null?void 0:_.error)??A.message??"Erro ao criar sessão")}finally{v(!1)}},k=()=>{t(),e()};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm p-4",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-[#00a884]/10 flex items-center justify-center",children:n==="form"?a.jsx(Oe,{size:16,className:"text-[#00a884]"}):a.jsx(js,{size:16,className:"text-[#00a884]"})}),a.jsx("h3",{className:"text-[15px] font-bold text-[#111b21]",children:n==="form"?"Novo Número WhatsApp":"Escanear QR Code"})]}),a.jsx("button",{onClick:e,className:"p-1.5 hover:bg-gray-100 rounded-full transition-colors",children:a.jsx(Ce,{size:18,className:"text-[#667781]"})})]}),n==="form"?a.jsxs("div",{className:"p-5 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Apelido / Nome"}),a.jsx("input",{type:"text",value:s,onChange:C=>i(C.target.value),placeholder:"Ex: Atendimento Principal, Entregas, Marketing…",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] focus:ring-2 focus:ring-[#00a884]/10 transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Função"}),a.jsx("select",{value:o,onChange:C=>l(C.target.value),className:"w-full px-3 py-2.5 pr-8 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] bg-white bg-[url('data:image/svg+xml;utf8,')] bg-no-repeat bg-[right_12px_center] appearance-none cursor-pointer",children:Object.entries(dw).map(([C,_])=>a.jsx("option",{value:C,children:_},C))})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Prioridade"}),a.jsx("select",{value:d,onChange:C=>f(Number(C.target.value)),className:"w-full px-3 py-2.5 pr-8 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] bg-white bg-[url('data:image/svg+xml;utf8,')] bg-no-repeat bg-[right_12px_center] appearance-none cursor-pointer",children:[1,2,3,4,5].map(C=>a.jsx("option",{value:C,children:fw[C]??`P${C}`},C))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Área (opcional)"}),a.jsx("input",{type:"text",value:c,onChange:C=>u(C.target.value),placeholder:"Ex: Campo Grande",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] transition-all"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Observações (opcional)"}),a.jsx("textarea",{value:p,onChange:C=>h(C.target.value),rows:2,placeholder:"Ex: Fallback quando o principal cair",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] resize-none transition-all"})]}),x&&a.jsx("p",{className:"text-red-500 text-[13px] font-medium",children:x}),a.jsxs("button",{onClick:S,disabled:m||!s.trim(),className:"w-full py-3 bg-[#00a884] hover:bg-[#017f67] disabled:opacity-50 text-white font-bold rounded-xl transition-all text-[14px] flex items-center justify-center gap-2",children:[m?a.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):a.jsx(js,{size:16}),m?"Criando sessão…":"Criar e gerar QR Code"]})]}):a.jsxs("div",{className:"p-5 flex flex-col items-center gap-4",children:[a.jsx("p",{className:"text-[13px] text-[#667781] text-center",children:"Abra o WhatsApp no celular → Menu → Aparelhos conectados → Conectar aparelho"}),N&&!g?a.jsxs("div",{className:"w-52 h-52 rounded-2xl bg-[#f0f2f5] flex flex-col items-center justify-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 border-2 border-[#00a884] border-t-transparent rounded-full animate-spin"}),a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Aguardando QR…"})]}):g?a.jsx("img",{src:g,alt:"QR Code",className:"w-52 h-52 rounded-2xl border-2 border-[#00a884]/20 bg-white p-2"}):a.jsx("div",{className:"w-52 h-52 rounded-2xl bg-[#f0f2f5] flex items-center justify-center text-[#667781] text-[13px] italic text-center px-4",children:"QR não disponível. Verifique a aba Sessões."}),a.jsx("p",{className:"text-[11px] text-[#8696a0] text-center",children:"O QR expira em 60 s. Após conectar, feche este modal."}),a.jsx("button",{onClick:k,className:"w-full py-2.5 bg-[#00a884] hover:bg-[#017f67] text-white font-bold rounded-xl transition-all text-[14px]",children:"Concluído"})]})]})})}function Lge({num:e,session:t,onClose:n,onSaved:r}){const[s,i]=b.useState((e==null?void 0:e.label)??(t==null?void 0:t.name)??""),[o,l]=b.useState((e==null?void 0:e.role)??"geral"),[c,u]=b.useState((e==null?void 0:e.area)??""),[d,f]=b.useState((e==null?void 0:e.priority)??1),[p,h]=b.useState((e==null?void 0:e.notes)??""),[m,v]=b.useState((e==null?void 0:e.active)??!0),[x,y]=b.useState(!1),[g,j]=b.useState(""),[N,w]=b.useState(!1),[S,k]=b.useState((t!=null&&t.id,"")),[C,_]=b.useState(!1),[A,E]=b.useState("");b.useEffect(()=>{(t==null?void 0:t.status)==="QR_PENDING"&&t.id&&P(t.id)},[]);async function P(M){_(!0),E("");let W=0;const T=setInterval(async()=>{W++;try{const V=await he.getQr(M);k(V.qrBase64),clearInterval(T),_(!1)}catch{W>=15&&(clearInterval(T),_(!1),E("QR não disponível. Tente novamente."))}},2e3)}const D=async()=>{t!=null&&t.id&&(k(""),E(""),await P(t.id))},I=async()=>{var M,W;if(!s.trim()){j("Apelido obrigatório.");return}y(!0),j("");try{if(e)await he.updateNumber(e.id,{label:s.trim(),role:o,area:c.trim()||null,priority:d,notes:p.trim()||null,active:m});else{if(!(t!=null&&t.id))throw new Error("Sessão não identificada");await he.saveNumber({instance_id:t.id,label:s.trim(),role:o,area:c.trim()||null,priority:d,notes:p.trim()||null})}w(!0),r(),setTimeout(()=>w(!1),2e3)}catch(T){j(((W=(M=T==null?void 0:T.response)==null?void 0:M.data)==null?void 0:W.error)??T.message??"Erro ao salvar")}finally{y(!1)}},R=t&&t.status!=="CONNECTED";return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm p-4",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden max-h-[90vh] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-[#00a884]/10 flex items-center justify-center",children:a.jsx(y1,{size:14,className:"text-[#00a884]"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-[15px] font-bold text-[#111b21] leading-tight",children:"Atualizar Número"}),t&&a.jsx("p",{className:"text-[11px] text-[#8696a0] leading-tight font-mono",children:t.phone??t.id})]})]}),a.jsx("button",{onClick:n,className:"p-1.5 hover:bg-gray-100 rounded-full transition-colors",children:a.jsx(Ce,{size:18,className:"text-[#667781]"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Apelido / Nome"}),a.jsx("input",{type:"text",value:s,onChange:M=>i(M.target.value),placeholder:"Ex: Atendimento Principal, Entregas, Marketing…",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] focus:ring-2 focus:ring-[#00a884]/10 transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Função"}),a.jsx("select",{value:o,onChange:M=>l(M.target.value),className:"w-full px-3 py-2.5 pr-8 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] bg-white bg-[url('data:image/svg+xml;utf8,')] bg-no-repeat bg-[right_12px_center] appearance-none cursor-pointer",children:Object.entries(dw).map(([M,W])=>a.jsx("option",{value:M,children:W},M))})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Prioridade"}),a.jsx("select",{value:d,onChange:M=>f(Number(M.target.value)),className:"w-full px-3 py-2.5 pr-8 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] bg-white bg-[url('data:image/svg+xml;utf8,')] bg-no-repeat bg-[right_12px_center] appearance-none cursor-pointer",children:[1,2,3,4,5].map(M=>a.jsx("option",{value:M,children:fw[M]??`P${M}`},M))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Área (opcional)"}),a.jsx("input",{type:"text",value:c,onChange:M=>u(M.target.value),placeholder:"Ex: Campo Grande",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] transition-all"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] mb-1.5 uppercase tracking-wide",children:"Observações (opcional)"}),a.jsx("textarea",{value:p,onChange:M=>h(M.target.value),rows:2,placeholder:"Ex: Fallback quando o principal cair",className:"w-full px-3 py-2.5 text-[14px] text-[#111b21] border border-gray-200 rounded-xl outline-none focus:border-[#00a884] resize-none transition-all"})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[a.jsx("div",{onClick:()=>v(M=>!M),className:`relative w-10 h-5 rounded-full transition-colors ${m?"bg-[#00a884]":"bg-gray-300"}`,children:a.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full shadow transition-transform ${m?"translate-x-5":"translate-x-0.5"}`})}),a.jsx("span",{className:"text-[13px] text-[#111b21]",children:m?"Ativo":"Inativo"})]}),g&&a.jsx("p",{className:"text-red-500 text-[13px] font-medium",children:g}),t&&a.jsxs("div",{className:`rounded-2xl border p-4 space-y-3 ${R?"border-amber-200 bg-amber-50":"border-gray-100 bg-[#f9fafb]"}`,children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(js,{size:15,className:R?"text-amber-500":"text-[#8696a0]"}),a.jsx("span",{className:"text-[13px] font-semibold text-[#111b21]",children:"Reconectar número"})]}),t.status&&a.jsx(l8,{status:t.status})]}),C?a.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[a.jsx("div",{className:"w-7 h-7 border-2 border-[#00a884] border-t-transparent rounded-full animate-spin"}),a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Gerando QR Code…"})]}):S?a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("img",{src:S,alt:"QR Code",className:"w-44 h-44 rounded-xl border-2 border-[#00a884]/20 bg-white p-2 mx-auto"}),a.jsx("p",{className:"text-[11px] text-[#8696a0] text-center",children:"Abra o WhatsApp → Menu → Aparelhos conectados → Conectar aparelho"}),a.jsx("p",{className:"text-[10px] text-amber-600 text-center font-semibold",children:'QR expira em ~60s — clique em "Novo QR" se expirar'})]}):A?a.jsx("p",{className:"text-[12px] text-red-500 text-center",children:A}):a.jsx("p",{className:"text-[12px] text-[#8696a0] text-center",children:R?"Sessão desconectada. Gere um QR para reconectar.":"Sessão conectada. Gere um novo QR só se precisar reconectar em outro celular."}),a.jsxs("button",{onClick:D,disabled:C,className:"w-full py-2 border border-[#00a884] text-[#00a884] hover:bg-[#00a884]/5 disabled:opacity-50 font-semibold rounded-xl transition-all text-[13px] flex items-center justify-center gap-2",children:[C?a.jsx("span",{className:"w-3.5 h-3.5 border border-[#00a884] border-t-transparent rounded-full animate-spin"}):a.jsx(js,{size:14}),S?"Novo QR":"Gerar QR Code"]})]})]}),a.jsx("div",{className:"px-5 pb-5 pt-3 border-t border-gray-100 flex-shrink-0",children:a.jsxs("button",{onClick:I,disabled:x||!s.trim(),className:`w-full py-3 font-bold rounded-xl transition-all text-[14px] flex items-center justify-center gap-2 + ${N?"bg-emerald-500 text-white":"bg-[#00a884] hover:bg-[#017f67] disabled:opacity-50 text-white"}`,children:[x?a.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):N?a.jsx(Pi,{size:16}):a.jsx(Pi,{size:16}),x?"Salvando…":N?"Salvo ✓":"Salvar alterações"]})})]})})}const zge=[{id:"agente",Icon:ks,label:"Agente"},{id:"cerebro",Icon:d1,label:"Cérebro"},{id:"agenda",Icon:DP,label:"Agenda"},{id:"conversas",Icon:_I,label:"Conversas"},{id:"testar",Icon:fI,label:"Testar"},{id:"config",Icon:vI,label:"Config"}],Bge=["persona","knowledge","rules","calendar","escalation"],Fge={persona:"bg-purple-100 text-purple-700",knowledge:"bg-blue-100 text-blue-700",rules:"bg-yellow-100 text-yellow-700",calendar:"bg-green-100 text-green-700",escalation:"bg-red-100 text-red-700"};function Vge(){const[e,t]=b.useState("agente"),[n,r]=b.useState(null),[s,i]=b.useState({name:"",model:"gpt-4o-mini",provider:"openai",temperature:.7,context_window:10}),[o,l]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState([]),[p,h]=b.useState({type:"persona",title:"",content:""}),[m,v]=b.useState(null),[x,y]=b.useState(!1),[g,j]=b.useState([]),[N,w]=b.useState({date:"",time_start:"",time_end:"",attendee:"",notes:""}),[S,k]=b.useState(!1),[C,_]=b.useState([]),[A,E]=b.useState("all"),[P,D]=b.useState(!1),[I,R]=b.useState(null),[M,W]=b.useState([]),[T,V]=b.useState(!1),[X,U]=b.useState(!1),L=b.useRef(`test-${Date.now()}`),[B,ae]=b.useState(""),[se,xe]=b.useState([]),[H,le]=b.useState(!1),Z=b.useRef(null),[F,z]=b.useState({openai_key:"",gemini_key:"",anthropic_key:"",ollama_url:"",admin_notify_phone:""}),[q,ie]=b.useState("off"),[oe,we]=b.useState(!1),[Ee,ze]=b.useState(!1);b.useEffect(()=>{e==="agente"&&gn(),e==="cerebro"&&vn(),e==="agenda"&&yn(),e==="conversas"&&bn(),e==="config"&&jn()},[e]),b.useEffect(()=>{var Q;(Q=Z.current)==null||Q.scrollIntoView({behavior:"smooth"})},[se]);async function gn(){try{const Q=await he.secGetAgent();r(Q),Q&&i({name:Q.name,model:Q.model,provider:Q.provider,temperature:Q.temperature,context_window:Q.context_window})}catch{}}async function vn(){try{f(await he.secGetNodes())}catch{}}async function yn(){try{j(await he.secGetSlots())}catch{}}async function bn(){D(!0);try{_(await he.secGetConversations())}catch{}finally{D(!1)}}async function jn(){try{const[Q,ue]=await Promise.all([he.secGetKeys(),he.getAutoReplyMode()]);z(Q),ie(ue.mode)}catch{}}async function Wn(Q){R(Q),W([]),V(!0);try{W(await he.secGetConvMessages(Q.id))}catch{}finally{V(!1)}}async function ne(){if(I){U(!0);try{await he.secFinalizeConv(I.id),_(Q=>Q.map(ue=>ue.id===I.id?{...ue,status:"closed"}:ue)),R(null)}catch{}finally{U(!1)}}}async function Se(Q){Q==null||Q.preventDefault();const ue=B.trim();if(!(!ue||H)){ae(""),xe(We=>[...We,{role:"user",text:ue}]),le(!0);try{const hr=(await he.secTestAsk(L.current,ue)).reply??"(sem resposta)";xe(Bs=>[...Bs,{role:"ai",text:hr}])}catch(We){xe(hr=>[...hr,{role:"ai",text:`Erro: ${(We==null?void 0:We.message)??"falha"}`}])}finally{le(!1)}}}async function ft(Q){Q.preventDefault(),l(!0);try{const ue=n?await he.secUpdateAgent(n.id,s):await he.secCreateAgent(s);r(ue),u(!0),setTimeout(()=>u(!1),2e3)}catch{}finally{l(!1)}}async function Tt(Q){Q.preventDefault(),y(!0);try{if(m){const ue=await he.secUpdateNode(m.id,{type:m.type,title:m.title??"",content:m.content});f(We=>We.map(hr=>hr.id===ue.id?ue:hr))}else{const ue=await he.secCreateNode({type:p.type,title:p.title,content:p.content});f(We=>[...We,ue])}h({type:"persona",title:"",content:""}),v(null)}catch{}finally{y(!1)}}async function gt(Q){try{await he.secDeleteNode(Q),f(ue=>ue.filter(We=>We.id!==Q))}catch{}}async function Ba(Q){Q.preventDefault(),k(!0);try{const ue=await he.secCreateSlot(N);j(We=>[...We,ue]),w({date:"",time_start:"",time_end:"",attendee:"",notes:""})}catch{}finally{k(!1)}}async function Yl(Q){try{await he.secDeleteSlot(Q),j(ue=>ue.filter(We=>We.id!==Q))}catch{}}async function Fa(Q){Q.preventDefault(),we(!0);try{await he.secSaveKeys(F),ze(!0),setTimeout(()=>ze(!1),2e3)}catch{}finally{we(!1)}}async function Ql(){const Q=q==="off"?"automatico":"off";try{await he.setAutoReplyMode(Q),ie(Q)}catch{}}const $t="w-full border border-[#d1d7db] rounded-lg px-3 py-2 text-[13px] text-[#111b21] focus:outline-none focus:border-[#00a884] bg-white",Mt="block text-[11px] font-semibold text-[#667781] uppercase tracking-wide mb-1",zs="flex items-center gap-1.5 px-4 py-2 bg-[#00a884] text-white rounded-lg text-[13px] font-semibold hover:bg-[#008f72] transition-colors disabled:opacity-60";return a.jsxs("div",{className:"flex flex-col h-full bg-[#f0f2f5]",children:[a.jsxs("div",{className:"h-[60px] px-4 flex items-center gap-3 bg-[#f0f2f5] border-b border-[#d1d7db] flex-shrink-0",children:[a.jsx(ra,{size:22,className:"text-[#00a884]"}),a.jsx("h2",{className:"text-[16px] font-bold text-[#111b21]",children:"Secretária Virtual"})]}),a.jsx("div",{className:"flex bg-white border-b border-[#d1d7db] flex-shrink-0 overflow-x-auto",children:zge.map(({id:Q,Icon:ue,label:We})=>a.jsxs("button",{onClick:()=>t(Q),className:`flex items-center gap-1.5 px-4 py-3 text-[13px] font-medium whitespace-nowrap border-b-2 transition-colors + ${e===Q?"border-[#00a884] text-[#00a884]":"border-transparent text-[#667781] hover:text-[#111b21] hover:bg-[#f5f6f6]"}`,children:[a.jsx(ue,{size:15})," ",We]},Q))}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[e==="agente"&&a.jsxs("form",{onSubmit:ft,className:"flex flex-col gap-4",children:[a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Configure a identidade e o modelo de IA da secretária."}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Nome do agente"}),a.jsx("input",{className:$t,value:s.name,onChange:Q=>i(ue=>({...ue,name:Q.target.value})),placeholder:"Ex: Secretária Alemão",required:!0})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Provider"}),a.jsxs("select",{className:$t,value:s.provider,onChange:Q=>i(ue=>({...ue,provider:Q.target.value})),children:[a.jsx("option",{value:"openai",children:"OpenAI"}),a.jsx("option",{value:"gemini",children:"Gemini"}),a.jsx("option",{value:"anthropic",children:"Anthropic"}),a.jsx("option",{value:"ollama",children:"Ollama"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Modelo"}),a.jsx("input",{className:$t,value:s.model,onChange:Q=>i(ue=>({...ue,model:Q.target.value})),placeholder:"gpt-4o-mini"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsxs("label",{className:Mt,children:["Temperatura (",s.temperature,")"]}),a.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.temperature,onChange:Q=>i(ue=>({...ue,temperature:parseFloat(Q.target.value)})),className:"w-full accent-[#00a884]"})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Janela de contexto"}),a.jsx("input",{type:"number",min:"5",max:"50",className:$t,value:s.context_window,onChange:Q=>i(ue=>({...ue,context_window:parseInt(Q.target.value)}))})]})]}),a.jsxs("button",{type:"submit",className:zs,disabled:o,children:[o?a.jsx(Vr,{size:14,className:"animate-spin"}):a.jsx(or,{size:14}),c?"Salvo ✓":"Salvar agente"]})]}),e==="cerebro"&&a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Nodes de conhecimento que moldam as respostas da secretária."}),a.jsxs("form",{onSubmit:Tt,className:"bg-white rounded-xl border border-[#d1d7db] p-4 flex flex-col gap-3",children:[a.jsx("div",{className:"flex gap-2",children:a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:Mt,children:"Tipo"}),a.jsx("select",{className:$t,value:m?m.type:p.type,onChange:Q=>m?v(ue=>({...ue,type:Q.target.value})):h(ue=>({...ue,type:Q.target.value})),children:Bge.map(Q=>a.jsx("option",{value:Q,children:Q},Q))})]})}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Título"}),a.jsx("input",{type:"text",className:$t,value:m?m.title??"":p.title,onChange:Q=>m?v(ue=>({...ue,title:Q.target.value})):h(ue=>({...ue,title:Q.target.value})),placeholder:"Ex: Política de Troca, Horário de Funcionamento...",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Conteúdo"}),a.jsx("textarea",{rows:4,className:`${$t} resize-none`,value:m?m.content:p.content,onChange:Q=>m?v(ue=>({...ue,content:Q.target.value})):h(ue=>({...ue,content:Q.target.value})),placeholder:"Descreva o comportamento, conhecimento ou regra...",required:!0})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{type:"submit",className:zs,disabled:x,children:[x?a.jsx(Vr,{size:14,className:"animate-spin"}):a.jsx(or,{size:14}),m?"Atualizar":"Adicionar node"]}),m&&a.jsx("button",{type:"button",onClick:()=>{v(null),h({type:"persona",title:"",content:""})},className:"px-4 py-2 border border-[#d1d7db] rounded-lg text-[13px] text-[#667781] hover:bg-[#f5f6f6]",children:"Cancelar"})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[d.length===0&&a.jsx("p",{className:"text-[12px] text-[#667781] text-center py-4",children:"Nenhum node configurado."}),d.map(Q=>a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] p-3 flex gap-3",children:[a.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full self-start mt-0.5 ${Fge[Q.type]??"bg-gray-100 text-gray-600"}`,children:Q.type}),a.jsx("p",{className:"flex-1 text-[13px] text-[#111b21] whitespace-pre-wrap line-clamp-3",children:Q.content}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("button",{onClick:()=>{v({...Q})},className:"p-1 hover:bg-[#f0f2f5] rounded",children:a.jsx(Er,{size:13,className:"text-[#667781]"})}),a.jsx("button",{onClick:()=>gt(Q.id),className:"p-1 hover:bg-red-50 rounded",children:a.jsx(Te,{size:13,className:"text-red-500"})})]})]},Q.id))]})]}),e==="agenda"&&a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Slots de atendimento disponíveis para agendamento."}),a.jsxs("form",{onSubmit:Ba,className:"bg-white rounded-xl border border-[#d1d7db] p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Data"}),a.jsx("input",{type:"date",className:$t,value:N.date,onChange:Q=>w(ue=>({...ue,date:Q.target.value})),required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Responsável"}),a.jsx("input",{className:$t,value:N.attendee,onChange:Q=>w(ue=>({...ue,attendee:Q.target.value})),placeholder:"Nome ou setor"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Início"}),a.jsx("input",{type:"time",className:$t,value:N.time_start,onChange:Q=>w(ue=>({...ue,time_start:Q.target.value})),required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Fim"}),a.jsx("input",{type:"time",className:$t,value:N.time_end,onChange:Q=>w(ue=>({...ue,time_end:Q.target.value})),required:!0})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:Mt,children:"Observações"}),a.jsx("input",{className:$t,value:N.notes,onChange:Q=>w(ue=>({...ue,notes:Q.target.value})),placeholder:"Opcional"})]}),a.jsxs("button",{type:"submit",className:zs,disabled:S,children:[S?a.jsx(Vr,{size:14,className:"animate-spin"}):a.jsx(Oe,{size:14}),"Adicionar slot"]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[g.length===0&&a.jsx("p",{className:"text-[12px] text-[#667781] text-center py-4",children:"Nenhum slot cadastrado."}),g.map(Q=>a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] px-4 py-3 flex items-center gap-3",children:[a.jsx(DP,{size:18,className:"text-[#00a884] flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-[13px] font-semibold text-[#111b21]",children:[Q.date," · ",Q.time_start,"–",Q.time_end]}),Q.attendee&&a.jsx("p",{className:"text-[12px] text-[#667781] truncate",children:Q.attendee})]}),a.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full ${Q.status==="booked"?"bg-red-100 text-red-600":"bg-green-100 text-green-700"}`,children:Q.status==="booked"?"Ocupado":"Livre"}),a.jsx("button",{onClick:()=>Yl(Q.id),className:"p-1 hover:bg-red-50 rounded",children:a.jsx(Te,{size:13,className:"text-red-500"})})]},Q.id))]})]}),e==="conversas"&&a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsxs("div",{className:"flex gap-2",children:[["all","active","closed"].map(Q=>a.jsx("button",{onClick:()=>E(Q),className:`px-3 py-1.5 rounded-full text-[12px] font-medium transition-colors + ${A===Q?"bg-[#00a884] text-white":"bg-white border border-[#d1d7db] text-[#667781] hover:bg-[#f5f6f6]"}`,children:Q==="all"?"Todas":Q==="active"?"Ativas":"Encerradas"},Q)),a.jsx("button",{onClick:bn,className:"ml-auto p-1.5 hover:bg-[#f0f2f5] rounded-full transition-colors",children:a.jsx(ke,{size:14,className:`text-[#667781] ${P?"animate-spin":""}`})})]}),P&&a.jsx("div",{className:"flex justify-center py-8",children:a.jsx(Vr,{size:24,className:"animate-spin text-[#00a884]"})}),!P&&C.length===0&&a.jsx("p",{className:"text-[12px] text-[#667781] text-center py-8",children:"Nenhuma conversa registrada."}),a.jsx("div",{className:"flex flex-col gap-2",children:C.filter(Q=>A==="all"||Q.status===(A==="active"?"active":"closed")).map(Q=>a.jsxs("button",{onClick:()=>Wn(Q),className:"bg-white rounded-xl border border-[#d1d7db] px-4 py-3 text-left hover:border-[#00a884] hover:shadow-sm transition-all",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1 gap-2 flex-wrap",children:[a.jsx("span",{className:"text-[12px] font-bold text-[#667781] font-mono",children:Q.protocol_number??Q.id}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[Q.handoff_mode==="humano"&&a.jsxs("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-orange-100 text-orange-600 flex items-center gap-1",children:[a.jsx(Tl,{size:9})," Humano"]}),Q.status==="escalated"&&a.jsxs("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-red-100 text-red-600 flex items-center gap-1",children:[a.jsx(Kt,{size:9})," Escalada"]}),a.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full ${Q.status==="active"?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:Q.status==="active"?"Ativa":"Encerrada"})]})]}),Q.summary&&a.jsx("p",{className:"text-[12px] text-[#111b21] line-clamp-2",children:Q.summary}),Q.created_at&&a.jsx("p",{className:"text-[11px] text-[#8696a0] mt-1",children:new Date(Q.created_at).toLocaleString("pt-BR")})]},Q.id))})]}),e==="testar"&&a.jsxs("div",{className:"flex flex-col h-full gap-0",style:{minHeight:"400px"},children:[a.jsx("p",{className:"text-[12px] text-[#667781] mb-3",children:"Teste a secretária sem precisar de celular conectado. Cada sessão é isolada."}),a.jsxs("div",{className:"flex-1 bg-white rounded-xl border border-[#d1d7db] p-3 overflow-y-auto flex flex-col gap-2 mb-3",style:{minHeight:"280px",maxHeight:"380px"},children:[se.length===0&&a.jsx("p",{className:"text-[12px] text-[#8696a0] text-center m-auto",children:"Digite uma mensagem para começar o teste."}),se.map((Q,ue)=>a.jsx("div",{className:`flex ${Q.role==="user"?"justify-end":"justify-start"}`,children:a.jsx("div",{className:`max-w-[85%] px-3 py-2 rounded-xl text-[13px] whitespace-pre-wrap leading-[1.4] + ${Q.role==="user"?"bg-[#d9fdd3] text-[#111b21]":"bg-white border border-[#d1d7db] text-[#111b21]"}`,children:Q.text})},ue)),H&&a.jsx("div",{className:"flex justify-start",children:a.jsxs("div",{className:"px-4 py-2 bg-white border border-[#d1d7db] rounded-xl flex items-center gap-1.5",children:[a.jsx(Vr,{size:12,className:"animate-spin text-[#00a884]"}),a.jsx("span",{className:"text-[12px] text-[#667781]",children:"Secretária digitando…"})]})}),a.jsx("div",{ref:Z})]}),a.jsxs("form",{onSubmit:Se,className:"flex gap-2",children:[a.jsx("input",{className:"flex-1 border border-[#d1d7db] rounded-lg px-3 py-2 text-[13px] text-[#111b21] focus:outline-none focus:border-[#00a884] bg-white",value:B,onChange:Q=>ae(Q.target.value),placeholder:"Mensagem de teste...",disabled:H}),a.jsx("button",{type:"submit",disabled:H||!B.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-[#00a884] text-white rounded-lg text-[13px] font-semibold hover:bg-[#008f72] transition-colors disabled:opacity-60",children:a.jsx(Rr,{size:14})}),a.jsx("button",{type:"button",onClick:()=>{xe([]),L.current=`test-${Date.now()}`},className:"px-3 py-2 border border-[#d1d7db] rounded-lg text-[12px] text-[#667781] hover:bg-[#f5f6f6] transition-colors",title:"Reiniciar sessão",children:a.jsx(ke,{size:14})})]})]}),e==="config"&&a.jsxs("form",{onSubmit:Fa,className:"flex flex-col gap-4",children:[a.jsx("p",{className:"text-[12px] text-[#667781]",children:"Chaves de API e modo de resposta automática."}),a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] p-4 flex flex-col gap-3",children:[a.jsx("p",{className:"text-[12px] font-semibold text-[#111b21]",children:"Provedores de IA"}),[["openai_key","OpenAI API Key","sk-..."],["gemini_key","Gemini API Key","AIza..."],["anthropic_key","Anthropic API Key","sk-ant-..."],["ollama_url","Ollama URL","http://localhost:11434"]].map(([Q,ue,We])=>{const hr=F[Q],Bs=hr.endsWith("****");return a.jsxs("div",{children:[a.jsxs("label",{className:Mt,children:[ue,Bs&&a.jsx("span",{className:"ml-2 text-[10px] font-normal text-green-600 normal-case tracking-normal",children:"já configurado"})]}),a.jsx("input",{type:Q==="ollama_url"?"url":"password",className:$t,value:Bs?"":hr,placeholder:Bs?"•••••••• (deixe em branco para manter)":We,onChange:Yi=>z(Id=>({...Id,[Q]:Yi.target.value}))})]},Q)})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] p-4 flex flex-col gap-3",children:[a.jsx("p",{className:"text-[12px] font-semibold text-[#111b21]",children:"Notificação de escalação"}),a.jsxs("div",{children:[a.jsxs("label",{className:Mt,children:["WhatsApp do administrador ",a.jsx("span",{className:"normal-case text-[#667781] font-normal",children:"(sem +55, ex: 67999001122)"})]}),a.jsx("input",{type:"tel",className:$t,value:F.admin_notify_phone,placeholder:"67999001122",onChange:Q=>z(ue=>({...ue,admin_notify_phone:Q.target.value.replace(/\D/g,"")}))}),a.jsx("p",{className:"text-[11px] text-[#8696a0] mt-1",children:"Quando a IA escalar um cliente, este número receberá uma mensagem WA de alerta."})]})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] p-4 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[13px] font-semibold text-[#111b21]",children:"Resposta automática"}),a.jsx("p",{className:"text-[11px] text-[#667781]",children:"Secretária responde automaticamente às mensagens recebidas"})]}),a.jsx("button",{type:"button",onClick:Ql,className:"flex-shrink-0 ml-4",children:q==="automatico"?a.jsx(Ss,{size:36,className:"text-[#00a884]"}):a.jsx(Ns,{size:36,className:"text-[#8696a0]"})})]}),a.jsxs("button",{type:"submit",className:zs,disabled:oe,children:[oe?a.jsx(Vr,{size:14,className:"animate-spin"}):a.jsx(or,{size:14}),Ee?"Salvo ✓":"Salvar configurações"]})]})]}),I&&a.jsxs("div",{className:"absolute inset-0 z-40 flex",children:[a.jsx("div",{className:"flex-1 bg-black/30",onClick:()=>R(null)}),a.jsxs("div",{className:"w-[380px] max-w-full h-full bg-white flex flex-col shadow-2xl",children:[a.jsxs("div",{className:"h-[60px] px-4 flex items-center gap-3 border-b border-[#d1d7db] flex-shrink-0",children:[a.jsx("button",{onClick:()=>R(null),className:"p-1.5 hover:bg-[#f0f2f5] rounded-full transition-colors",children:a.jsx(Ce,{size:18,className:"text-[#54656f]"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-[13px] font-bold text-[#111b21] font-mono truncate",children:I.protocol_number??I.id}),a.jsx("p",{className:"text-[11px] text-[#667781]",children:new Date(I.created_at).toLocaleString("pt-BR")})]}),I.status==="active"&&a.jsxs("button",{onClick:ne,disabled:X,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500 text-white rounded-lg text-[12px] font-semibold hover:bg-red-600 transition-colors disabled:opacity-60",children:[X?a.jsx(Vr,{size:12,className:"animate-spin"}):a.jsx(Ce,{size:12}),"Finalizar"]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col gap-3",children:[T&&a.jsx("div",{className:"flex justify-center py-8",children:a.jsx(Vr,{size:24,className:"animate-spin text-[#00a884]"})}),!T&&M.length===0&&a.jsx("p",{className:"text-[12px] text-[#8696a0] text-center py-8",children:"Nenhuma mensagem neste protocolo."}),M.map((Q,ue)=>a.jsxs("div",{className:`flex flex-col gap-0.5 ${Q.role==="user"?"items-start":"items-end"}`,children:[a.jsx("span",{className:"text-[10px] text-[#8696a0] px-1",children:Q.role==="user"?"Cliente":"Secretária"}),a.jsx("div",{className:`max-w-[88%] px-3 py-2 rounded-xl text-[13px] leading-[1.4] whitespace-pre-wrap + ${Q.role==="user"?"bg-[#f0f2f5] text-[#111b21]":"bg-[#d9fdd3] text-[#111b21]"}`,children:Q.content}),Q.created_at&&a.jsx("span",{className:"text-[10px] text-[#8696a0] px-1",children:new Date(Q.created_at).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})})]},Q.id??ue))]})]})]})]})}function Uge({activeTab:e,setActiveTab:t,session:n,inboxUnread:r,teamAccount:s,onTeamLogout:i}){const o=(n==null?void 0:n.status)==="CONNECTED",l=(s==null?void 0:s.role)||"owner",[c,u]=b.useState(null),[d,f]=b.useState(!1);b.useEffect(()=>{s&&fetch("/api/team/me",{credentials:"include"}).then(v=>v.json()).then(v=>{var g;const y=(((g=v==null?void 0:v.account)==null?void 0:g.sectors)||[]).find(j=>j.on_duty!=null);y&&u(y.on_duty)}).catch(()=>{})},[s==null?void 0:s.id]);async function p(){if(!(c===null||d)){f(!0);try{const v=!c;await fetch("/api/team/me/duty",{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({on_duty:v})}),u(v)}catch{}finally{f(!1)}}}const m=[["chats",x1,"Conversas"],["sessions",y1,"Sessões"],["secretaria",ra,"Secretária Virtual"],["equipe",et,"Equipe"],["inbox-interna",Pr,"Inbox Interna"],["metricas",yu,"Métricas"]].filter(([v])=>v==="sessions"?!s:v==="secretaria"?!s||["owner","manager","supervisor"].includes(l):v==="equipe"?!s||Kge.has(l):v==="metricas"?!s||["owner","manager","supervisor"].includes(l):!0);return a.jsxs("div",{className:"w-[60px] h-full bg-[#f0f2f5] border-r border-[#d1d7db] flex flex-col items-center py-4 flex-shrink-0 z-30",children:[a.jsx("div",{className:"flex-1 w-full flex flex-col items-center gap-1",children:m.map(([v,x,y])=>a.jsxs("button",{title:y,onClick:()=>t(v),className:`relative w-10 h-10 rounded-full flex items-center justify-center transition-colors + ${e===v?"bg-[#d9dbdf]":"hover:bg-[#d9dbdf]/60"}`,children:[a.jsx(x,{size:22,className:e===v?"text-[#111b21]":"text-[#54656f]",fill:e===v?"currentColor":"none"}),v==="inbox-interna"&&r&&r>0?a.jsx("span",{className:"absolute top-0.5 right-0.5 bg-red-500 text-white text-[9px] font-bold w-4 h-4 rounded-full flex items-center justify-center",children:r>9?"9+":r}):null]},v))}),a.jsx("div",{className:"w-full flex flex-col items-center gap-1 pb-1",children:s?a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c!==null&&a.jsx("button",{onClick:p,disabled:d,title:c?"De plantão — clique para sair":"Fora de plantão — clique para entrar",className:`w-8 h-8 rounded-full flex items-center justify-center transition-colors border-2 ${c?"bg-emerald-500/20 border-emerald-500/60 text-emerald-500 hover:bg-emerald-500/30":"bg-slate-300/40 border-slate-400/40 text-slate-500 hover:bg-slate-300/60"} ${d?"opacity-50 cursor-wait":""}`,children:c?a.jsx(Ss,{size:16}):a.jsx(Ns,{size:16})}),a.jsx("div",{className:"w-9 h-9 rounded-full bg-purple-600 flex items-center justify-center text-white text-sm font-bold cursor-default",title:`${s.name} (${s.role})`,children:s.name.charAt(0).toUpperCase()}),i&&a.jsx("button",{onClick:i,title:"Sair",className:"w-8 h-8 rounded-full flex items-center justify-center hover:bg-red-100 text-red-400 transition-colors",children:a.jsx(Ce,{size:14})})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{title:"Configurações",className:"w-10 h-10 rounded-full flex items-center justify-center hover:bg-[#d9dbdf]/60 transition-colors",children:a.jsx(v1,{size:22,className:"text-[#54656f]",fill:"none"})}),a.jsxs("div",{className:"relative mt-1 p-1 cursor-pointer",children:[a.jsx(Bo,{src:n==null?void 0:n.avatar,name:n==null?void 0:n.name,size:32}),a.jsx("div",{className:`absolute bottom-0.5 right-0.5 w-3 h-3 rounded-full border-2 border-[#f0f2f5] + ${o?"bg-emerald-500":"bg-red-500"}`,title:o?"Conectado":"Desconectado"})]})]})})]})}function Wge({chat:e,onBack:t,isMobile:n,onArchive:r}){const[s,i]=b.useState(!1),o=b.useRef(null);return b.useEffect(()=>{const l=c=>{o.current&&!o.current.contains(c.target)&&i(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[]),a.jsxs("header",{className:"h-[60px] px-4 bg-[#f0f2f5] flex items-center justify-between border-b border-[#d1d7db] shrink-0 z-20",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[n&&a.jsx("button",{onClick:t,className:"p-1 -ml-1 mr-1 hover:bg-black/5 rounded-full transition-colors",children:a.jsx(Ui,{size:24,className:"text-[#54656f]"})}),a.jsxs("div",{className:"flex items-center gap-3 min-w-0 cursor-pointer group hover:bg-black/5 px-2 py-1 -ml-2 rounded-md transition-all",children:[a.jsx(Bo,{src:e.avatar,name:e.displayName??e.phone,size:40}),a.jsxs("div",{className:"flex flex-col min-w-0",children:[a.jsx("h3",{className:"text-[16px] leading-[21px] font-bold text-[#111b21] truncate group-hover:text-[#00a884] transition-colors",children:e.displayName??e.phone}),a.jsxs("span",{className:"text-[12.5px] text-[#667781] truncate flex items-center gap-1 font-normal",children:[a.jsx(wu,{size:10}),e.phone]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-1",ref:o,children:[a.jsx("button",{className:"p-2 hover:bg-black/5 rounded-full transition-all text-[#54656f]",children:a.jsx(Ir,{size:20})}),a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>i(l=>!l),className:`p-2 rounded-full transition-all ${s?"bg-black/10 text-[#111b21]":"hover:bg-black/5 text-[#54656f]"}`,children:a.jsx(uI,{size:20})}),s&&a.jsx("div",{className:"absolute right-0 top-12 w-56 bg-white rounded-lg shadow-2xl border border-gray-100 py-2 z-50",children:a.jsxs("button",{className:"w-full flex items-center gap-3 px-4 py-2.5 text-[14px] text-[#111b21] hover:bg-[#f5f6f6] transition-colors",onClick:()=>{i(!1),r()},children:[a.jsx(ke,{size:15})," Arquivar conversa"]})})]})]})]})}function qge({chat:e,autoReplyGlobal:t,refreshKey:n=0}){const[r,s]=b.useState("ia"),[i,o]=b.useState(null),[l,c]=b.useState(!1),[u,d]=b.useState(0);if(b.useEffect(()=>{let m=!1;return he.getHandoffMode(e.id).then(v=>{m||(s(v.mode),o(v.handoffHumanAt?new Date(v.handoffHumanAt):null))}).catch(()=>{}),()=>{m=!0}},[e.id,n]),b.useEffect(()=>{if(r!=="humano"||!i){d(0);return}const m=()=>{const x=Math.max(0,Math.floor((i.getTime()-Date.now())/1e3));d(x)};m();const v=setInterval(m,1e3);return()=>clearInterval(v)},[r,i]),t==="off")return null;async function f(){c(!0);const m=r==="ia"?"humano":"ia";try{await he.setHandoffMode(e.id,m),s(m),o(m==="humano"?new Date:null)}catch{}finally{c(!1)}}const p=m=>`${String(Math.floor(m/60)).padStart(2,"0")}:${String(m%60).padStart(2,"0")}`,h=r==="humano";return a.jsxs("button",{onClick:f,disabled:l,title:h?`Devolver à IA (${p(u)} restantes)`:"Assumir atendimento manualmente",className:`absolute bottom-[76px] right-4 z-20 flex items-center gap-2 px-3 py-2 rounded-full shadow-lg text-[12px] font-semibold transition-all select-none + ${h?"bg-orange-500 text-white animate-pulse hover:animate-none hover:bg-orange-600":"bg-[#00a884] text-white hover:bg-[#008f72]"} + ${l?"opacity-60 cursor-wait":"cursor-pointer"}`,children:[h?a.jsx(Tl,{size:14}):a.jsx(ra,{size:14}),h?u>0?`Você (${p(u)})`:"Você":"IA"]})}function Hge({value:e,onChange:t,onSend:n,sending:r,onAskAi:s,askingAi:i,chatId:o}){const l=b.useRef(null),c=b.useRef(null),u=b.useRef(null),[d,f]=b.useState(!1),[p,h]=b.useState(!1),[m,v]=b.useState(!1),[x,y]=b.useState(!1),[g,j]=b.useState({}),[N,w]=b.useState("TEXT"),[S,k]=b.useState(),[C,_]=b.useState("TEXT"),A=()=>{const D=l.current;D&&(D.style.height="auto",D.style.height=Math.min(D.scrollHeight,150)+"px")};b.useEffect(()=>{const D=I=>{u.current&&!u.current.contains(I.target)&&f(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);const E=D=>{k(D.payload),_(D.type),v(!1),h(!0)},P=(D,I)=>{w(D),j(I),h(!1),y(!0)};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"min-h-[62px] px-4 py-[8px] bg-[#f0f2f5] border-t border-[#d1d7db] flex items-end gap-3",children:[a.jsx("div",{className:"pb-[7px]",children:a.jsx("button",{className:"p-2 hover:bg-black/5 rounded-full transition-colors text-[#54656f]",title:"Emoji",children:a.jsx(II,{size:24})})}),a.jsxs("div",{ref:u,className:"relative pb-[7px]",children:[a.jsx(na.button,{onClick:()=>f(D=>!D),className:"p-2 hover:bg-black/5 rounded-full transition-colors text-[#54656f]",title:"Mais opções",animate:{rotate:d?45:0},transition:{duration:.2},children:a.jsx(Oe,{size:22})}),a.jsx(cd,{children:d&&a.jsxs(na.div,{initial:{opacity:0,y:8,scale:.92},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.92},transition:{type:"spring",stiffness:400,damping:28},className:"absolute bottom-full left-0 mb-2 flex flex-col gap-1 bg-white rounded-2xl shadow-xl border border-gray-100 p-2 z-30",children:[a.jsxs("div",{className:"group relative flex items-center",children:[a.jsx("button",{onClick:()=>{var D;(D=c.current)==null||D.click(),f(!1)},className:"p-2.5 rounded-xl hover:bg-[#f0f2f5] text-[#54656f] transition-colors",title:"Anexar arquivo",children:a.jsx(OI,{size:20})}),a.jsx("span",{className:"absolute left-full ml-2 px-2 py-1 text-[11px] font-medium bg-[#111b21] text-white rounded-lg opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none",children:"Anexar arquivo"})]}),a.jsxs("div",{className:"group relative flex items-center",children:[a.jsx("button",{onClick:()=>{v(!0),f(!1)},className:"p-2.5 rounded-xl hover:bg-[#e0f2fe] text-[#0ea5e9] transition-colors",title:"Biblioteca de templates",children:a.jsx(Ep,{size:20})}),a.jsx("span",{className:"absolute left-full ml-2 px-2 py-1 text-[11px] font-medium bg-[#111b21] text-white rounded-lg opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none",children:"Templates salvos"})]}),a.jsxs("div",{className:"group relative flex items-center",children:[a.jsx("button",{onClick:()=>{k(void 0),_("TEXT"),h(!0),f(!1)},className:"p-2.5 rounded-xl hover:bg-[#ede9fe] text-[#8b5cf6] transition-colors",title:"Mensagem rica",children:a.jsx(jI,{size:20})}),a.jsx("span",{className:"absolute left-full ml-2 px-2 py-1 text-[11px] font-medium bg-[#111b21] text-white rounded-lg opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none",children:"Mensagem rica"})]})]})}),a.jsx("input",{type:"file",ref:c,className:"hidden"})]}),a.jsx("div",{className:"flex-1 bg-white rounded-lg shadow-sm overflow-hidden",children:a.jsx("textarea",{ref:l,value:e,onChange:D=>{t(D.target.value),A()},onKeyDown:D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),n())},placeholder:"Mensagem",rows:1,className:"w-full px-4 py-[9px] text-[15px] text-[#111b21] placeholder:text-[#8696a0] outline-none resize-none bg-transparent leading-[1.5]",style:{minHeight:42,maxHeight:150}})}),a.jsxs("div",{className:"pb-[7px] flex items-center gap-2",children:[e.trim()&&a.jsx("button",{onClick:s,disabled:i||r,title:"Gerar resposta com Secretária IA",className:"w-10 h-10 bg-[#7c3aed] hover:bg-[#6d28d9] disabled:opacity-50 text-white rounded-full flex items-center justify-center transition-all active:scale-95 shadow-md",children:i?a.jsx("span",{className:"w-4 h-4 border-2 border-white/40 border-t-white rounded-full animate-spin"}):a.jsx(rv,{size:16})}),e.trim()?a.jsx("button",{onClick:n,disabled:r,className:"w-10 h-10 bg-[#00a884] hover:bg-[#017f67] disabled:opacity-50 text-white rounded-full flex items-center justify-center transition-all active:scale-95 shadow-md",children:a.jsx(Rr,{size:18})}):a.jsx("button",{className:"w-10 h-10 text-[#54656f] hover:bg-black/5 rounded-full flex items-center justify-center transition-colors",children:a.jsx(g1,{size:24})})]})]}),a.jsx(gge,{isOpen:p,onClose:()=>h(!1),chatId:o,initialPayload:S,initialType:C,onSchedule:P}),a.jsx(bge,{isOpen:m,onClose:()=>v(!1),onSelect:E}),a.jsx(wge,{isOpen:x,onClose:()=>y(!1),payload:g,messageType:N})]})}const Kge=new Set(["owner","manager","supervisor"]);function qC({teamAccount:e,onTeamLogout:t}={}){var gw;const[n,r]=b.useState([]),[s,i]=b.useState(null),[o,l]=b.useState({}),[c,u]=b.useState([]),[d,f]=b.useState(null),[p,h]=b.useState([]),[m,v]=b.useState(""),[x,y]=b.useState(""),[g,j]=b.useState(!1),[N,w]=b.useState(!1),[S,k]=b.useState(!0),[C,_]=b.useState(!1),[A,E]=b.useState(!1),[P,D]=b.useState(!1),[I,R]=b.useState(!1),[M,W]=b.useState("connecting"),[T,V]=b.useState("chats"),[X,U]=b.useState(!1),[L,B]=b.useState(!1),[ae,se]=b.useState(null);b.useEffect(()=>{e||Hc.get().then(K=>se(K.linkedAccount??null)).catch(()=>{})},[e]);const xe=(e==null?void 0:e.id)??(ae==null?void 0:ae.id)??void 0,[H,le]=b.useState(0);b.useEffect(()=>{if(!xe)return;const K=()=>{fetch("/api/cotacoes/admin/inbox/contadores",{credentials:"include"}).then(ce=>ce.ok?ce.json():null).then(ce=>{(ce==null?void 0:ce.total)!=null&&le(Number(ce.total))}).catch(()=>{})};K();const re=setInterval(K,3e4);return()=>clearInterval(re)},[xe]);const[Z,F]=b.useState("off"),[z,q]=b.useState(0),[ie,oe]=b.useState([]),we=b.useRef(0),Ee=b.useCallback(K=>oe(re=>re.filter(ce=>ce.id!==K)),[]),ze=b.useCallback((K,re="info",ce)=>{const ye=++we.current;oe(Fe=>[...Fe,{id:ye,msg:K,type:re,action:ce}]),ce||setTimeout(()=>Ee(ye),6e3)},[Ee]),[gn,vn]=b.useState(!1),[yn,bn]=b.useState([]),[jn,Wn]=b.useState(!1),[ne,Se]=b.useState(null),[ft,Tt]=b.useState(null),[gt,Ba]=b.useState(!1),[Yl,Fa]=b.useState(!1),Ql=b.useRef(null),$t=b.useRef(null),Mt=b.useRef(null),zs=b.useRef(null),Q=b.useRef(null);b.useEffect(()=>{const K=()=>B(window.innerWidth<768);return window.addEventListener("resize",K),K(),()=>window.removeEventListener("resize",K)},[]),b.useEffect(()=>{const K=re=>{Q.current&&!Q.current.contains(re.target)&&U(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const ue=b.useCallback(async()=>{k(!0);try{const K=await he.getSessions();if(r(K),!s&&K.length>0){const re=localStorage.getItem("wa_selected_session"),ce=re?K.find(ye=>ye.id===re):null;i(ce??K[0])}}catch{}finally{k(!1)}},[s]),We=b.useCallback(async()=>{try{const K=await he.getNumbers();bn(K)}catch{}},[]);b.useEffect(()=>{ue(),We(),he.getAutoReplyMode().then(K=>F(K.mode)).catch(()=>{})},[]),b.useEffect(()=>{const K=new EventSource("/api/sse",{withCredentials:!0});return K.addEventListener("handoff.expired",re=>{try{const{chatId:ce}=JSON.parse(re.data);f(ye=>((ye==null?void 0:ye.id)===ce&&(ze("IA retomou o atendimento automaticamente (15 min sem resposta)","info"),q(Fe=>Fe+1)),ye))}catch{}}),K.addEventListener("human_api.new",re=>{try{const{question:ce,sectorName:ye}=JSON.parse(re.data),Fe=ye?`[${ye}]`:"";ze(`🤖 IA precisa de ajuda ${Fe}: "${String(ce).slice(0,60)}"`,"warning",{label:"Ver Inbox",onClick:()=>V("inbox-interna")})}catch{}}),K.addEventListener("sla.breach",re=>{try{const{sectorName:ce,elapsedMins:ye,slaMins:Fe}=JSON.parse(re.data);ze(`⚠ SLA estourado — ${ce}: ${ye}min (limite ${Fe}min)`,"warning",{label:"Ver Inbox",onClick:()=>V("inbox-interna")})}catch{}}),K.addEventListener("human_api.answered",()=>{}),()=>K.close()},[ze]);const hr=b.useCallback(async K=>{if(window.confirm("Remover este número? A sessão será desconectada e os dados apagados.")){Tt(K);try{const re=yn.find(ce=>ce.instance_id===K);await he.deleteSession(K),re&&await he.deleteNumber(re.id).catch(()=>{}),(s==null?void 0:s.id)===K&&i(null),await ue(),await We()}catch{alert("Erro ao remover sessão.")}finally{Tt(null)}}},[yn,s,ue,We]),Bs=b.useCallback(async()=>{Ba(!0),Fa(!1);try{await fetch("/api/admin/nw/sync-knowledge",{method:"POST",credentials:"include"}),Fa(!0),setTimeout(()=>Fa(!1),3e3)}catch{alert("Erro ao sincronizar base de conhecimento.")}finally{Ba(!1)}},[]);b.useEffect(()=>{!s||s.status!=="QR_PENDING"||he.getQr(s.id).then(K=>l(re=>({...re,[s.id]:K.qrBase64}))).catch(()=>{})},[s==null?void 0:s.id,s==null?void 0:s.status]),b.useEffect(()=>{if(!s||s.status!=="CONNECTED"){u([]);return}_(!0),he.getInbox(s.id,void 0,60).then(u).catch(()=>{}).finally(()=>_(!1))},[s==null?void 0:s.id,s==null?void 0:s.status]);const Yi=50;b.useEffect(()=>{if(!d){h([]),R(!1);return}E(!0),he.getMessages(d.id,Yi).then(K=>{h(K),R(K.length===Yi)}).catch(()=>{}).finally(()=>E(!1))},[d==null?void 0:d.id]);const Id=b.useCallback(async()=>{if(!d||P||!I||p.length===0)return;const K=p[0].timestamp;D(!0);try{const re=await he.getMessages(d.id,Yi,K);if(re.length===0){R(!1);return}R(re.length===Yi);const ce=zs.current,ye=(ce==null?void 0:ce.scrollHeight)??0;h(Fe=>[...re,...Fe]),requestAnimationFrame(()=>{ce&&(ce.scrollTop=ce.scrollHeight-ye)})}catch{}finally{D(!1)}},[d,P,I,p]),pw=b.useRef(null);b.useEffect(()=>{var K,re;d&&(pw.current!==d.id?(pw.current=d.id,(K=$t.current)==null||K.scrollIntoView({behavior:"instant"})):(re=$t.current)==null||re.scrollIntoView({behavior:"smooth"}))},[p]),b.useEffect(()=>{const K=Mt.current;if(!K)return;const re=new IntersectionObserver(ce=>{ce[0].isIntersecting&&Id()},{threshold:.1});return re.observe(K),()=>re.disconnect()},[Id]),b.useEffect(()=>{const K=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/api/nw/v1/stream`;let re,ce,ye=!1,Fe=3e3;function Fs(){ye||(re=new WebSocket(K),Ql.current=re,W("connecting"),re.onopen=()=>{Fe=3e3,W("open")},re.onmessage=Sx=>{let vw;try{vw=JSON.parse(Sx.data)}catch{return}const{event:Qi,data:_e}=vw;if(Qi==="session.qr"&&(l(at=>({...at,[_e.instanceId]:_e.qrBase64})),r(at=>at.map(tt=>tt.id===_e.instanceId?{...tt,status:"QR_PENDING"}:tt)),i(at=>(at==null?void 0:at.id)===_e.instanceId?{...at,status:"QR_PENDING"}:at)),Qi==="session.status"){const at=_e.status==="connected"?"CONNECTED":"DISCONNECTED";r(tt=>tt.map(da=>da.id===_e.instanceId?{...da,status:at}:da)),i(tt=>(tt==null?void 0:tt.id)===_e.instanceId?{...tt,status:at}:tt),_e.status==="connected"&&he.getInbox(_e.instanceId,void 0,60).then(u).catch(()=>{})}if(Qi==="message.update"&&h(at=>at.map(tt=>tt.messageId===_e.messageId?{...tt,status:_e.status}:tt)),Qi==="conversation.handoff"&&_e.mode==="ia"&&_e.reason==="timeout"&&ze("Secretária retomou o atendimento automaticamente (15 min sem resposta)","info"),Qi==="conversation.escalated"){const at=_e.protocolNumber?` #${_e.protocolNumber}`:"",tt=_e.motivo?` — ${_e.motivo}`:"";ze(`Escalação${at}${tt}: cliente aguarda atendimento humano`,"warning",{label:"Assumir",onClick:async()=>{try{await v6.assume({chatId:_e.chatId||"",protocolNumber:_e.protocolNumber,chatName:_e.chatName}),V("inbox-interna")}catch{}}})}Qi==="message.new"&&(u(at=>at.map(tt=>{var da,Jl,Zl,ec;return tt.id===_e.chatId?{...tt,unreadCount:tt.unreadCount+((da=_e.message)!=null&&da.fromMe?0:1),lastMessageAt:new Date().toISOString(),lastMessage:{body:(Jl=_e.message)==null?void 0:Jl.body,type:((Zl=_e.message)==null?void 0:Zl.type)||"TEXT",fromMe:!!((ec=_e.message)!=null&&ec.fromMe),status:"SENT",timestamp:new Date().toISOString()}}:tt})),f(at=>((at==null?void 0:at.id)===_e.chatId&&h(tt=>{var da,Jl,Zl,ec,yw,bw,jw,ww,Nw,Sw,kw;return[...tt,{id:((da=_e.message)==null?void 0:da.id)||`tmp-${Date.now()}`,messageId:((Jl=_e.message)==null?void 0:Jl.messageId)||"",fromMe:((Zl=_e.message)==null?void 0:Zl.fromMe)??!1,type:((ec=_e.message)==null?void 0:ec.type)||"TEXT",body:((yw=_e.message)==null?void 0:yw.body)??null,caption:((bw=_e.message)==null?void 0:bw.caption)??null,mediaUrl:((jw=_e.message)==null?void 0:jw.mediaUrl)??null,mimeType:((ww=_e.message)==null?void 0:ww.mimeType)??null,fileName:((Nw=_e.message)==null?void 0:Nw.fileName)??null,status:"DELIVERED",timestamp:new Date().toISOString(),pushName:((Sw=_e.message)==null?void 0:Sw.pushName)??null,senderJid:((kw=_e.message)==null?void 0:kw.senderJid)??null}]}),at)))},re.onclose=()=>{W("closed"),ye||(ce=setTimeout(Fs,Fe),Fe=Math.min(Fe*2,6e4))},re.onerror=()=>{re.close()})}return Fs(),()=>{ye=!0,clearTimeout(ce),re==null||re.close()}},[]);const g8=b.useCallback(async()=>{if(d)try{await he.archive(d.id,!0),u(K=>K.filter(re=>re.id!==d.id)),f(null)}catch{}},[d]),v8=async()=>{if(!d||!x.trim()||g)return;const K=x.trim(),re=e!=null&&e.name?`*${e.name}:* +${K}`:K;y(""),j(!0);const ce={id:`opt-${Date.now()}`,messageId:"",fromMe:!0,type:"TEXT",body:re,caption:null,mediaUrl:null,mimeType:null,fileName:null,status:"PENDING",timestamp:new Date().toISOString(),pushName:null,senderJid:null};h(ye=>[...ye,ce]);try{await he.send(d.id,re),Z==="automatico"&&(await he.setHandoffMode(d.id,"humano").catch(()=>{}),q(ye=>ye+1))}catch{h(ye=>ye.filter(Fe=>Fe.id!==ce.id)),y(K)}finally{j(!1)}},y8=async()=>{var re,ce;if(!d||!x.trim()||N)return;const K=x.trim();w(!0);try{const ye=d.displayName??d.phone,Fe=await he.secretariaAsk(d.id,K,ye);y(Fe.reply)}catch(ye){alert(`Erro ao consultar Secretária IA: ${((ce=(re=ye==null?void 0:ye.response)==null?void 0:re.data)==null?void 0:ce.error)??ye.message}`)}finally{w(!1)}},hw=b.useMemo(()=>{if(!m)return c;const K=m.toLowerCase();return c.filter(re=>(re.displayName??re.phone).toLowerCase().includes(K))},[c,m]),Nx=b.useMemo(()=>c.reduce((K,re)=>K+re.unreadCount,0),[c]),mw=b.useMemo(()=>{var K;return((K=d==null?void 0:d.jid)==null?void 0:K.endsWith("@g.us"))??!1},[d]),b8=b.useMemo(()=>p.map((K,re)=>{const ce=p[re-1],ye=!ce||ce.fromMe!==K.fromMe,Fe=!ce||!Age(ce.timestamp,K.timestamp),Fs=Fe?_ge(K.timestamp):"",Sx=mw&&!K.fromMe&&(ye||(ce==null?void 0:ce.senderJid)!==K.senderJid);return{msg:K,showTail:ye,showSeparator:Fe,separatorLabel:Fs,showSender:Sx}}),[p,mw]),xw=T==="secretaria"||T==="equipe"||T==="inbox-interna"||T==="metricas",j8=!L||!d,w8=!xw&&(!L||!!d);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:ie.map(K=>a.jsxs("div",{className:`flex flex-col gap-2 px-4 py-3 rounded-xl shadow-xl text-[13px] font-medium max-w-[360px] pointer-events-auto + ${K.type==="warning"?"bg-orange-500 text-white":"bg-[#111b21] text-white"}`,children:[a.jsxs("div",{className:"flex items-start gap-2",children:[K.type==="warning"&&a.jsx(DI,{size:15,className:"flex-shrink-0 mt-0.5 animate-pulse"}),a.jsx("span",{className:"flex-1",children:K.msg}),a.jsx("button",{onClick:()=>Ee(K.id),className:"ml-1 opacity-70 hover:opacity-100 flex-shrink-0",children:a.jsx(Ce,{size:13})})]}),K.action&&a.jsxs("button",{onClick:()=>{K.action.onClick(),Ee(K.id)},className:"self-end px-3 py-1 bg-white/20 hover:bg-white/30 rounded-lg text-[12px] font-bold transition-colors flex items-center gap-1.5",children:[a.jsx(h1,{size:12}),K.action.label]})]},K.id))}),a.jsxs("div",{className:"flex h-screen w-full bg-[#f0f2f5] overflow-hidden select-none font-sans text-[#111b21]",children:[a.jsx(Uge,{activeTab:T,setActiveTab:K=>{K==="inbox-interna"&&le(0),V(K)},session:s,inboxUnread:H,teamAccount:e,onTeamLogout:t}),j8&&a.jsxs("div",{className:`${xw?"flex-1":L?"w-full":"w-[400px]"} flex flex-col bg-white border-r border-[#d1d7db] flex-shrink-0 z-20`,children:[T==="sessions"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-3 py-2 bg-[#f0f2f5] border-b border-[#d1d7db] flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-[16px] font-bold text-[#111b21]",children:"Sessões WhatsApp"}),a.jsxs("div",{className:"flex items-center gap-1",children:[M==="open"?a.jsx(nE,{size:13,className:"text-[#00a884]"}):a.jsx(K2,{size:13,className:"text-red-500"}),a.jsx("button",{onClick:ue,className:"p-1.5 hover:bg-black/5 rounded-full transition-colors",title:"Atualizar",children:a.jsx(ke,{size:14,className:`text-[#54656f] ${S?"animate-spin":""}`})})]})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsxs("button",{onClick:()=>Wn(!0),className:"flex-1 flex items-center justify-center gap-1.5 py-1.5 bg-[#00a884] hover:bg-[#017f67] text-white text-[12px] font-semibold rounded-lg transition-all",children:[a.jsx(Oe,{size:13})," Novo Número"]}),a.jsx("button",{onClick:Bs,disabled:gt,title:"Sincronizar base de conhecimento da IA com dados do banco",className:`flex-1 flex items-center justify-center gap-1.5 py-1.5 text-[12px] font-semibold rounded-lg border transition-all + ${Yl?"bg-emerald-50 border-emerald-300 text-emerald-700":"bg-white border-[#d1d7db] text-[#54656f] hover:border-[#00a884] hover:text-[#00a884]"} disabled:opacity-50`,children:gt?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3 h-3 border border-current border-t-transparent rounded-full animate-spin"})," Sincronizando…"]}):Yl?a.jsxs(a.Fragment,{children:[a.jsx(rv,{size:13})," IA Atualizada ✓"]}):a.jsxs(a.Fragment,{children:[a.jsx(rv,{size:13})," Sincronizar IA"]})})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:S?[1,2].map(K=>a.jsx("div",{className:"m-3 h-28 rounded-2xl bg-[#f0f2f5] animate-pulse"},K)):n.length===0?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-16 px-6 text-center",children:[a.jsx("div",{className:"w-14 h-14 rounded-full bg-[#f0f2f5] flex items-center justify-center",children:a.jsx(y1,{size:24,className:"text-[#8696a0]"})}),a.jsx("p",{className:"text-[#667781] text-sm",children:"Nenhum número cadastrado."}),a.jsxs("button",{onClick:()=>Wn(!0),className:"text-[#00a884] text-sm font-semibold hover:underline flex items-center gap-1",children:[a.jsx(Oe,{size:14})," Adicionar primeiro número"]})]}):n.slice().sort((K,re)=>{const ce=yn.find(Fe=>Fe.instance_id===K.id),ye=yn.find(Fe=>Fe.instance_id===re.id);return((ce==null?void 0:ce.priority)??99)-((ye==null?void 0:ye.priority)??99)}).map(K=>{const re=yn.find(ce=>ce.instance_id===K.id);return a.jsxs("div",{className:`m-3 p-4 rounded-2xl border transition-all + ${(s==null?void 0:s.id)===K.id?"bg-[#00a884]/5 border-[#00a884]/30":"bg-white border-[#d1d7db] hover:border-[#c0c8cf]"}`,children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"cursor-pointer flex-1 flex items-center gap-3 min-w-0",onClick:()=>{i(K),localStorage.setItem("wa_selected_session",K.id),V("chats")},children:[a.jsx(Bo,{src:K.avatar,name:K.name,size:42}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-[15px] font-semibold text-[#111b21] truncate",children:K.name}),a.jsx("p",{className:"text-[12px] text-[#667781] font-mono",children:K.phone??"—"}),(re==null?void 0:re.area)&&a.jsx("p",{className:"text-[11px] text-[#8696a0] truncate",children:re.area})]})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:ce=>{ce.stopPropagation(),Se({num:re??null,session:K})},className:"p-1.5 hover:bg-black/5 rounded-full transition-colors text-[#8696a0] hover:text-[#54656f]",title:"Editar / Reconectar",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:ce=>{ce.stopPropagation(),hr(K.id)},disabled:ft===K.id,className:"p-1.5 hover:bg-red-50 rounded-full transition-colors text-[#8696a0] hover:text-red-500 disabled:opacity-40",title:"Remover número",children:ft===K.id?a.jsx("span",{className:"w-3.5 h-3.5 border border-red-400 border-t-transparent rounded-full animate-spin block"}):a.jsx(Te,{size:14})})]})]}),a.jsxs("div",{className:"mt-3 flex items-center gap-2 flex-wrap",children:[a.jsx(l8,{status:K.status}),re&&a.jsx(Dge,{role:re.role,priority:re.priority}),!re&&a.jsx("span",{className:"text-[10px] text-[#8696a0] italic",children:"sem categoria"})]}),(re==null?void 0:re.notes)&&a.jsx("p",{className:"mt-2 text-[11px] text-[#8696a0] italic truncate",children:re.notes}),K.status==="QR_PENDING"&&o[K.id]&&a.jsxs("div",{className:"mt-3 flex flex-col items-center gap-2",children:[a.jsx("img",{src:o[K.id],alt:"QR Code",className:"w-44 h-44 rounded-xl border-2 border-amber-400/30 bg-white p-1.5"}),a.jsx("p",{className:"text-[11px] text-amber-600 font-bold uppercase tracking-wide text-center",children:"Escaneie com o WhatsApp"})]}),K.status==="QR_PENDING"&&!o[K.id]&&a.jsxs("div",{className:"mt-3 flex items-center justify-center gap-2 py-3 bg-amber-50 rounded-xl border border-amber-200",children:[a.jsx(js,{size:15,className:"text-amber-500 animate-pulse"}),a.jsx("span",{className:"text-[11px] text-amber-600 font-semibold",children:"Aguardando QR..."})]})]},K.id)})})]}),T==="chats"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"h-[60px] px-4 flex items-center justify-between bg-[#f0f2f5] border-b border-[#d1d7db] flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[L&&d&&a.jsx("button",{onClick:()=>f(null),className:"p-2 hover:bg-black/5 rounded-full",children:a.jsx(Ui,{size:20,className:"text-[#54656f]"})}),a.jsxs("div",{className:"relative",ref:Q,children:[a.jsxs("div",{onClick:()=>n.length>1&&U(K=>!K),className:`flex items-center gap-2 p-1 rounded-md transition-all ${n.length>1?"cursor-pointer hover:bg-black/5":""}`,children:[a.jsx(Bo,{src:s==null?void 0:s.avatar,name:s==null?void 0:s.name,size:38}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[15px] font-semibold text-[#111b21] truncate max-w-[120px] leading-tight",children:(s==null?void 0:s.name)??"Instância"}),s&&a.jsx("p",{className:"text-[11px] text-[#667781] leading-tight",children:((gw=Xh[s.status])==null?void 0:gw.label)??s.status})]}),n.length>1&&a.jsx(aa,{size:16,className:`text-[#54656f] transition-transform ${X?"rotate-180":""}`})]}),X&&a.jsx("div",{className:"absolute left-0 top-full mt-1 bg-white shadow-2xl rounded-xl border border-gray-100 w-72 z-50 py-2",children:n.map(K=>{var re;return a.jsxs("button",{onClick:()=>{i(K),localStorage.setItem("wa_selected_session",K.id),f(null),U(!1)},className:"w-full px-4 py-3 hover:bg-[#f5f6f6] flex items-center gap-3 transition-colors",children:[a.jsx(Bo,{src:K.avatar,name:K.name,size:34}),a.jsxs("div",{className:"text-left flex-1 min-w-0",children:[a.jsx("p",{className:"text-[14px] font-semibold text-[#111b21] truncate",children:K.name}),a.jsx("p",{className:`text-[12px] ${K.status==="CONNECTED"?"text-[#00a884]":"text-[#667781]"}`,children:((re=Xh[K.status])==null?void 0:re.label)??K.status})]})]},K.id)})})]})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[Nx>0&&a.jsx("span",{className:"bg-[#00a884] text-white text-[11px] font-bold px-1.5 py-0.5 rounded-full min-w-[20px] h-5 flex items-center justify-center",children:Nx>99?"99+":Nx}),(s==null?void 0:s.status)==="CONNECTED"&&a.jsx("button",{onClick:()=>vn(!0),className:"p-2 hover:bg-black/5 rounded-full transition-colors",title:"Nova conversa",children:a.jsx(Er,{size:16,className:"text-[#54656f]"})}),a.jsx("button",{onClick:()=>{s&&(_(!0),he.getInbox(s.id,void 0,60).then(u).catch(()=>{}).finally(()=>_(!1)))},className:"p-2 hover:bg-black/5 rounded-full transition-colors",title:"Atualizar chats",children:a.jsx(ke,{size:16,className:`text-[#54656f] ${C?"animate-spin":""}`})})]})]}),a.jsx("div",{className:"px-4 py-2 bg-white",children:a.jsxs("div",{className:"relative",children:[a.jsx(Ir,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#8696a0]"}),a.jsx("input",{type:"text",value:m,onChange:K=>v(K.target.value),placeholder:"Pesquisar ou começar nova conversa",className:"w-full bg-[#f0f2f5] h-[35px] pl-9 pr-3 rounded-lg text-[14px] text-[#111b21] placeholder:text-[#8696a0] border-none focus:ring-0 outline-none"}),m&&a.jsx("button",{onClick:()=>v(""),className:"absolute right-2 top-1/2 -translate-y-1/2",children:a.jsx(Ce,{size:14,className:"text-[#8696a0]"})})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:s?s.status!=="CONNECTED"?a.jsx("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-[#667781]",children:s.status==="QR_PENDING"?a.jsxs(a.Fragment,{children:[a.jsx(js,{size:36,className:"opacity-40"}),a.jsx("p",{className:"text-sm italic text-center px-8",children:"Escaneie o QR na aba Sessões para conectar"}),a.jsx("button",{onClick:()=>V("sessions"),className:"text-[#00a884] text-sm font-semibold hover:underline",children:"Ver sessões"})]}):a.jsxs(a.Fragment,{children:[a.jsx(K2,{size:36,className:"opacity-40"}),a.jsx("p",{className:"text-sm italic",children:"Sessão desconectada"})]})}):C?Array.from({length:8}).map((K,re)=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-[10px] border-b border-[#f0f2f5] animate-pulse",children:[a.jsx("div",{className:"w-[49px] h-[49px] rounded-full bg-[#f0f2f5] flex-shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("div",{className:"h-[14px] bg-[#f0f2f5] rounded w-3/4"}),a.jsx("div",{className:"h-[12px] bg-[#f0f2f5] rounded w-1/2"})]})]},re)):hw.length===0?a.jsx("p",{className:"text-[#667781] text-sm italic text-center py-16 px-6",children:m?"Nenhuma conversa encontrada.":"Nenhuma conversa ainda."}):hw.map(K=>a.jsx(Ege,{chat:K,isActive:(d==null?void 0:d.id)===K.id,onSelect:()=>{f(K),K.unreadCount>0&&(he.markRead(K.id).catch(()=>{}),u(re=>re.map(ce=>ce.id===K.id?{...ce,unreadCount:0}:ce)))},onPin:re=>{he.pin(K.id,re).catch(()=>{}),u(ce=>ce.map(ye=>ye.id===K.id?{...ye,isPinned:re}:ye))},onArchive:re=>{he.archive(K.id,re).catch(()=>{}),u(ce=>ce.filter(ye=>ye.id!==K.id)),(d==null?void 0:d.id)===K.id&&f(null)},onMarkRead:()=>{he.markRead(K.id).catch(()=>{}),u(re=>re.map(ce=>ce.id===K.id?{...ce,unreadCount:0}:ce))},onDelete:()=>{he.deleteChat(K.id).catch(()=>{}),u(re=>re.filter(ce=>ce.id!==K.id)),(d==null?void 0:d.id)===K.id&&f(null)}},K.id)):a.jsx("p",{className:"text-[#667781] text-sm italic text-center py-16 px-6",children:"Selecione uma sessão"})})]}),T==="secretaria"&&a.jsx(Vge,{}),T==="equipe"&&a.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-slate-900 flex flex-col",children:a.jsx(B0e,{})}),T==="inbox-interna"&&a.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-slate-900 flex flex-col",children:a.jsx(ige,{accountId:xe,role:(e==null?void 0:e.role)??(ae==null?void 0:ae.role)??"agent"})}),T==="metricas"&&a.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:a.jsx(cge,{})})]}),w8&&a.jsx("div",{className:"flex-1 flex h-full min-w-0 overflow-hidden relative",children:d?a.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden",children:[a.jsx(Wge,{chat:d,isMobile:L,onBack:()=>f(null),onArchive:g8}),a.jsxs("div",{ref:zs,className:"flex-1 overflow-y-auto pt-3 pb-2",style:{backgroundColor:"#efeae2"},children:[A?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"w-7 h-7 border-[3px] border-[#00a884] border-t-transparent rounded-full animate-spin"})}):p.length===0?a.jsx("p",{className:"text-[#667781] text-sm italic text-center py-16",children:"Nenhuma mensagem."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:Mt,className:"h-px"}),P&&a.jsx("div",{className:"flex justify-center py-2",children:a.jsx("div",{className:"w-5 h-5 border-2 border-[#00a884] border-t-transparent rounded-full animate-spin"})}),b8.map(({msg:K,showTail:re,showSeparator:ce,separatorLabel:ye,showSender:Fe})=>{var Fs;return a.jsxs("div",{children:[ce&&a.jsx($ge,{label:ye}),a.jsx(Tge,{msg:K,showTail:re,showSender:Fe,senderName:K.pushName??((Fs=K.senderJid)==null?void 0:Fs.split("@")[0])??void 0})]},K.id)})]}),a.jsx("div",{ref:$t})]}),a.jsx(qge,{chat:d,autoReplyGlobal:Z,refreshKey:z}),a.jsx(Hge,{value:x,onChange:y,onSend:v8,sending:g,onAskAi:y8,askingAi:N,chatId:(d==null?void 0:d.id)??null})]}):a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-6",style:{backgroundColor:"#f0f2f5"},children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 text-[#41525d]",children:[a.jsx("div",{className:"w-[220px] h-[220px] rounded-full bg-[#dfe5e7]/50 flex items-center justify-center",children:a.jsx(rn,{size:80,className:"opacity-20"})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-[32px] font-light text-[#41525d] mb-3",children:"WhatsApp Inbox"}),a.jsx("p",{className:"text-[15px] text-[#667781] max-w-[320px] leading-relaxed",children:"Envie e receba mensagens sem manter o celular conectado. Use o WhatsApp no computador."})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-[#8696a0]",children:[a.jsx("div",{className:"w-1 h-1 rounded-full bg-[#8696a0]"}),"Suas mensagens pessoais são protegidas com a criptografia de ponta a ponta",a.jsx("div",{className:"w-1 h-1 rounded-full bg-[#8696a0]"})]})]})})]}),jn&&a.jsx(Ige,{onClose:()=>Wn(!1),onCreated:async()=>{await ue(),await We()}}),ne&&a.jsx(Lge,{num:ne.num,session:ne.session,onClose:()=>Se(null),onSaved:async()=>{await We()}}),gn&&s&&a.jsx(Rge,{sessionId:s.id,onClose:()=>vn(!1),onSent:()=>{vn(!1),s&&he.getInbox(s.id,void 0,60).then(u).catch(()=>{})}})]})}const Gge=[{id:"message.new",label:"Nova mensagem",desc:"Disparado a cada mensagem recebida ou enviada"},{id:"session.status",label:"Status da sessão",desc:"Disparado quando uma instância conecta ou desconecta"}];function Xge(e){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"})}function HC({text:e}){const[t,n]=b.useState(!1),r=()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})};return a.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-black/5 transition-colors text-[#8696a0] hover:text-[#54656f]",title:"Copiar",children:t?a.jsx(jt,{size:13,className:"text-[#00a884]"}):a.jsx(cI,{size:13})})}function Yge({event:e}){const t={"message.new":"bg-[#00a884]/10 text-[#00a884] border-[#00a884]/20","session.status":"bg-blue-500/10 text-blue-600 border-blue-500/20"},n={"message.new":"message.new","session.status":"session.status"};return a.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[11px] font-semibold border ${t[e]??"bg-gray-100 text-gray-600 border-gray-200"}`,children:n[e]??e})}function Qge({hook:e,onDelete:t,onToggle:n}){const[r,s]=b.useState(!1),[i,o]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(!1),f=async()=>{if(!u){d(!0),setTimeout(()=>d(!1),3e3);return}o(!0);try{await he.deleteWebhook(e.id),t(e.id)}catch{}finally{o(!1)}},p=async()=>{c(!0);try{await he.toggleWebhook(e.id,!e.active),n(e.id,!e.active)}catch{}finally{c(!1)}};return a.jsxs("div",{className:`bg-white rounded-xl border transition-all ${e.active?"border-[#d1d7db]":"border-[#d1d7db] opacity-60"}`,children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[a.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${e.active?"bg-[#00a884] animate-pulse":"bg-[#8696a0]"}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-[14px] font-mono text-[#111b21] truncate",children:e.url}),a.jsx(HC,{text:e.url})]}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-1 flex-wrap",children:[e.events.map(h=>a.jsx(Yge,{event:h},h)),a.jsx("span",{className:"text-[11px] text-[#8696a0] ml-1",children:Xge(e.createdAt)})]})]}),a.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[a.jsx("button",{onClick:p,disabled:l,title:e.active?"Desativar":"Ativar",className:"p-2 rounded-full hover:bg-black/5 transition-colors disabled:opacity-40",children:e.active?a.jsx(KP,{size:16,className:"text-[#00a884]"}):a.jsx($I,{size:16,className:"text-[#8696a0]"})}),a.jsx("button",{onClick:f,disabled:i,title:u?"Clique novamente para confirmar":"Remover",className:`p-2 rounded-full transition-colors disabled:opacity-40 ${u?"bg-red-50 text-red-500":"hover:bg-black/5 text-[#8696a0] hover:text-red-500"}`,children:a.jsx(Te,{size:16})}),a.jsx("button",{onClick:()=>s(h=>!h),className:"p-2 rounded-full hover:bg-black/5 transition-colors text-[#8696a0]",children:r?a.jsx(p1,{size:16}):a.jsx(aa,{size:16})})]})]}),r&&a.jsxs("div",{className:"border-t border-[#f0f2f5] px-4 py-3 bg-[#f9fafb] rounded-b-xl space-y-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-semibold text-[#667781] uppercase tracking-wide mb-1",children:"Como validar a assinatura"}),a.jsx("pre",{className:"text-[12px] bg-white border border-[#d1d7db] rounded-lg p-3 overflow-x-auto text-[#111b21] leading-relaxed whitespace-pre-wrap",children:`// Node.js +const crypto = require('crypto'); +const sig = req.headers['x-nw-signature']; +const expected = 'sha256=' + crypto + .createHmac('sha256', '') + .update(JSON.stringify(req.body)) + .digest('hex'); +if (sig !== expected) return res.status(401).end();`})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] font-semibold text-[#667781] uppercase tracking-wide mb-1",children:"ID do webhook"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"text-[12px] text-[#54656f] font-mono",children:e.id}),a.jsx(HC,{text:e.id})]})]})]})]})}function Jge({onCreated:e}){const[t,n]=b.useState(""),[r,s]=b.useState(""),[i,o]=b.useState(["message.new"]),[l,c]=b.useState(!1),[u,d]=b.useState(null),f=m=>o(v=>v.includes(m)?v.filter(x=>x!==m):[...v,m]),p=()=>{const m=new Uint8Array(24);crypto.getRandomValues(m),s(Array.from(m).map(v=>v.toString(16).padStart(2,"0")).join(""))},h=async m=>{var v,x;m.preventDefault(),d(null),c(!0);try{const y=await he.createWebhook({url:t,events:i,secret:r});e(y),n(""),s(""),o(["message.new"])}catch(y){d(((x=(v=y.response)==null?void 0:v.data)==null?void 0:x.error)??"Erro ao criar webhook")}finally{c(!1)}};return a.jsxs("form",{onSubmit:h,className:"bg-white rounded-xl border border-[#d1d7db] p-5 space-y-4",children:[a.jsxs("h3",{className:"text-[15px] font-semibold text-[#111b21] flex items-center gap-2",children:[a.jsx(Oe,{size:16,className:"text-[#00a884]"})," Novo webhook"]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] uppercase tracking-wide mb-1",children:"URL de destino"}),a.jsx("input",{type:"url",value:t,onChange:m=>n(m.target.value),placeholder:"https://meu-sistema.com/webhook/whatsapp",required:!0,className:"w-full bg-[#f0f2f5] rounded-lg px-3 py-2 text-[14px] text-[#111b21] placeholder:text-[#8696a0] outline-none focus:ring-2 focus:ring-[#00a884]/30 border border-transparent focus:border-[#00a884]/30"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[12px] font-semibold text-[#667781] uppercase tracking-wide mb-2",children:"Eventos"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Gge.map(m=>a.jsxs("button",{type:"button",onClick:()=>f(m.id),className:`flex flex-col items-start px-3 py-2 rounded-lg border text-left transition-all ${i.includes(m.id)?"bg-[#00a884]/5 border-[#00a884]/40 text-[#00a884]":"bg-[#f0f2f5] border-transparent text-[#54656f] hover:border-[#d1d7db]"}`,children:[a.jsx("span",{className:"text-[13px] font-semibold font-mono",children:m.id}),a.jsx("span",{className:"text-[11px] opacity-80 mt-0.5",children:m.desc})]},m.id))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-[12px] font-semibold text-[#667781] uppercase tracking-wide mb-1",children:["Secret ",a.jsx("span",{className:"font-normal normal-case",children:"(mínimo 16 caracteres)"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:r,onChange:m=>s(m.target.value),placeholder:"sua-chave-secreta-hmac",required:!0,minLength:16,className:"flex-1 bg-[#f0f2f5] rounded-lg px-3 py-2 text-[14px] font-mono text-[#111b21] placeholder:text-[#8696a0] outline-none focus:ring-2 focus:ring-[#00a884]/30 border border-transparent focus:border-[#00a884]/30"}),a.jsxs("button",{type:"button",onClick:p,className:"px-3 py-2 bg-[#f0f2f5] rounded-lg text-[13px] text-[#54656f] hover:bg-[#e9edef] transition-colors flex items-center gap-1.5 font-medium flex-shrink-0",children:[a.jsx(ws,{size:13})," Gerar"]})]}),a.jsxs("p",{className:"text-[11px] text-[#8696a0] mt-1 flex items-center gap-1",children:[a.jsx(ws,{size:10})," Guarde este secret — ele não será exibido novamente após a criação."]})]}),u&&a.jsxs("div",{className:"flex items-center gap-2 text-red-600 text-[13px] bg-red-50 px-3 py-2 rounded-lg border border-red-100",children:[a.jsx(Ar,{size:14})," ",u]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{type:"submit",disabled:l||i.length===0,className:"px-5 py-2 bg-[#00a884] hover:bg-[#017f67] disabled:opacity-50 text-white text-[14px] font-semibold rounded-lg transition-colors flex items-center gap-2",children:[l?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(Oe,{size:14}),"Registrar webhook"]})})]})}function Zge(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),o=b.useCallback(async()=>{r(!0);try{t(await he.getWebhooks())}catch{}finally{r(!1)}},[]);b.useEffect(()=>{o()},[o]);const l=d=>{t(f=>[d,...f]),i(!1)},c=d=>t(f=>f.filter(p=>p.id!==d)),u=(d,f)=>t(p=>p.map(h=>h.id===d?{...h,active:f}:h));return a.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-8 space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 bg-[#00a884]/10 rounded-xl flex items-center justify-center",children:a.jsx(sv,{size:20,className:"text-[#00a884]"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-[20px] font-bold text-[#111b21]",children:"Webhooks"}),a.jsx("p",{className:"text-[13px] text-[#667781]",children:"Push de eventos WhatsApp para sistemas externos"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:o,className:"p-2 hover:bg-black/5 rounded-full transition-colors",title:"Atualizar",children:a.jsx(ke,{size:16,className:`text-[#54656f] ${n?"animate-spin":""}`})}),a.jsxs("button",{onClick:()=>i(d=>!d),className:"flex items-center gap-2 px-4 py-2 bg-[#00a884] hover:bg-[#017f67] text-white text-[14px] font-semibold rounded-lg transition-colors",children:[a.jsx(Oe,{size:16})," Novo webhook"]})]})]}),s&&a.jsx(Jge,{onCreated:l}),n?a.jsx("div",{className:"space-y-3",children:[1,2].map(d=>a.jsx("div",{className:"h-16 bg-white rounded-xl border border-[#d1d7db] animate-pulse"},d))}):e.length===0?a.jsxs("div",{className:"bg-white rounded-xl border border-[#d1d7db] py-16 flex flex-col items-center gap-4 text-[#8696a0]",children:[a.jsx(sv,{size:40,className:"opacity-30"}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-[15px] font-medium text-[#54656f]",children:"Nenhum webhook registrado"}),a.jsx("p",{className:"text-[13px] mt-1",children:'Clique em "Novo webhook" para começar.'})]})]}):a.jsx("div",{className:"space-y-3",children:e.map(d=>a.jsx(Qge,{hook:d,onDelete:c,onToggle:u},d.id))}),a.jsxs("div",{className:"bg-blue-50 border border-blue-100 rounded-xl p-4 text-[13px] text-blue-700 space-y-1",children:[a.jsxs("p",{className:"font-semibold flex items-center gap-1.5",children:[a.jsx(ws,{size:13})," Assinatura HMAC-SHA256"]}),a.jsxs("p",{children:["Cada requisição inclui o header ",a.jsx("code",{className:"bg-blue-100 px-1 rounded font-mono text-[12px]",children:"x-nw-signature: sha256="}),"."]}),a.jsxs("p",{children:["Valide com ",a.jsx("code",{className:"bg-blue-100 px-1 rounded font-mono text-[12px]",children:"HMAC-SHA256(secret, JSON.stringify(body))"})," antes de processar o payload."]})]})]})}function eve(){var X;const e=hm(),[t,n]=b.useState([]),[r,s]=b.useState(!0),[i,o]=b.useState(!1),[l,c]=b.useState(null),[u,d]=b.useState({}),[f,p]=b.useState(!1),[h,m]=b.useState(!1),[v,x]=b.useState(1),[y,g]=b.useState(""),[j,N]=b.useState(""),[w,S]=b.useState(""),[k,C]=b.useState(!1),[_,A]=b.useState(""),[E,P]=b.useState(""),D=async()=>{s(!0);try{const U=await qs.list();n(U)}catch{}finally{s(!1)}};b.useEffect(()=>{D()},[]);const I=async U=>{var B,ae;const L=U.active?"Desativar":"Ativar";if(confirm(`Deseja ${L} o plugin ${U.name}?`))try{U.active?await qs.deactivate(U.id):await qs.activate(U.id),D()}catch(se){alert(((ae=(B=se.response)==null?void 0:B.data)==null?void 0:ae.error)||`Erro ao ${L} plugin`)}},R=async U=>{c(U);try{const L=await qs.getConfig(U.id);d(L||{}),o(!0)}catch{alert("Erro ao carregar configurações")}},M=async U=>{var L,B;if(U.preventDefault(),!!l){p(!0);try{await qs.setConfig(l.id,u),o(!1),alert("Configuração salva com sucesso!")}catch(ae){alert(((B=(L=ae.response)==null?void 0:L.data)==null?void 0:B.error)||"Erro ao salvar")}finally{p(!1)}}},W=async U=>{x(1),g(""),S(""),A(""),P("");try{const L=await qs.getConfig(U.id);N((L==null?void 0:L.newwhats_url)||(L==null?void 0:L.motor_url)||"")}catch{N("")}m(!0)},T=async()=>{if(!y||!j){A("Preencha a URL e o e-mail.");return}C(!0),A("");try{const U=await p4.request(y,j.replace(/\/$/,""));U.dev_code&&(S(U.dev_code),P(U.dev_code)),x(2)}catch(U){A(U.message)}finally{C(!1)}},V=async()=>{if(w.length!==6){A("Digite o código de 6 dígitos.");return}C(!0),A("");try{const U=await p4.confirm(y,w,j.replace(/\/$/,""));await qs.setConfig("newwhats",{integration_key:U.integration_key,newwhats_url:j}),x(3),D()}catch(U){A(U.message)}finally{C(!1)}};return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{children:[a.jsx("h2",{className:"text-3xl font-black text-white tracking-tighter uppercase italic",children:"Integrações & Plugins"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Gerencie conexões do sistema, como Automação IA no WhatsApp."})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:r?[1,2].map(U=>a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 h-64 rounded-[2rem] animate-pulse"},U)):t.length===0?a.jsx("div",{className:"col-span-full py-20 text-center text-slate-500 italic bg-slate-900/40 rounded-[2rem] border border-slate-800",children:"Nenhum plugin instalado no servidor."}):t.map(U=>{var L;return a.jsxs("div",{className:`bg-slate-900/40 backdrop-blur-md border rounded-[2rem] overflow-hidden transition-all group flex flex-col relative ${U.active?"border-cyan-500/30":"border-slate-800"}`,children:[a.jsxs("div",{className:"p-8 flex flex-col gap-5",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsx("div",{className:`p-4 rounded-2xl flex items-center justify-center border transition-all ${U.active?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":"bg-slate-800/50 text-slate-500 border-white/5 grayscale"}`,children:a.jsx(XP,{size:32})}),a.jsx("div",{className:`px-3 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest border ${U.active?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-slate-800 text-slate-500 border-slate-700"}`,children:U.active?"Ativo":"Desativado"})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-black text-white group-hover:text-cyan-400 transition-colors tracking-tight",children:U.name}),a.jsxs("span",{className:"text-[11px] text-slate-600 font-bold",children:["v",U.version]})]}),a.jsx("p",{className:"text-slate-500 text-sm line-clamp-2 font-medium italic leading-relaxed",children:U.description}),((L=U.features)==null?void 0:L.length)>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5",children:U.features.map(B=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-lg text-[10px] font-semibold bg-slate-800 text-slate-400 border border-slate-700",children:[a.jsx(Mo,{size:9,className:"text-cyan-500"}),B]},B))}),a.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[U.ui_path&&U.active&&a.jsxs("button",{onClick:()=>e(U.ui_path),className:"w-full py-3 px-4 rounded-xl font-black text-xs uppercase tracking-widest border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20 transition-all flex items-center justify-center gap-2",children:[a.jsx(LP,{size:14}),"Abrir Inbox"]}),U.id==="newwhats"&&a.jsxs("button",{onClick:()=>W(U),className:"w-full py-3 px-4 rounded-xl font-black text-xs uppercase tracking-widest border border-cyan-500/30 bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 transition-all flex items-center justify-center gap-2",children:[a.jsx(Go,{size:14}),"Parear com NewWhats"]})]})]}),a.jsxs("div",{className:"mt-auto p-6 bg-slate-800/20 border-t border-slate-800 flex items-center gap-3 group-hover:bg-slate-800/40 transition-all",children:[a.jsxs("button",{onClick:()=>I(U),className:`flex-1 py-3 px-4 rounded-xl font-black text-xs uppercase tracking-widest transition-all flex items-center justify-center gap-2 ${U.active?"bg-rose-500/10 text-rose-500 hover:bg-rose-500 hover:text-white border border-rose-500/20":"bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500 hover:text-white border border-emerald-500/20"}`,children:[a.jsx(KP,{size:14}),U.active?"Desativar":"Ativar"]}),a.jsx("button",{onClick:()=>R(U),className:"p-3 bg-slate-800 text-slate-400 hover:text-white hover:bg-slate-700 rounded-xl transition-all border border-slate-700",title:"Configurações",children:a.jsx(RI,{size:16})})]})]},U.id)})}),a.jsx(Cs,{isOpen:i,onClose:()=>o(!1),title:`Setup: ${l==null?void 0:l.name}`,children:a.jsxs("form",{onSubmit:M,className:"space-y-6",children:[a.jsx("p",{className:"text-sm text-slate-400 font-medium italic mb-6",children:"Preencha os campos de acordo com a documentação da integração."}),(X=l==null?void 0:l.config_schema)==null?void 0:X.map(U=>a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-400",children:[U.label," ",U.required&&a.jsx("span",{className:"text-rose-500",children:"*"})]}),a.jsx("input",{required:U.required,type:U.type==="password"?"password":"text",value:u[U.key]||"",onChange:L=>d({...u,[U.key]:L.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"}),U.help&&a.jsx("p",{className:"text-[11px] text-slate-500 italic",children:U.help})]},U.key)),a.jsxs("button",{type:"submit",disabled:f,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm mt-8",children:[a.jsx(or,{size:20}),f?"Salvando...":"Salvar Chaves"]})]})}),a.jsx(Cs,{isOpen:h,onClose:()=>m(!1),title:"Parear com NewWhats",children:a.jsxs("div",{className:"space-y-6",children:[v===1&&a.jsxs("div",{className:"space-y-5",children:[a.jsx("p",{className:"text-sm text-slate-400 font-medium",children:"Informe o servidor NewWhats e o e-mail da sua conta. Um código de confirmação será enviado."}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"URL do servidor NewWhats"}),a.jsx("input",{type:"text",value:j,onChange:U=>N(U.target.value),placeholder:"http://newwhats.local:8008",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"E-mail da conta NewWhats"}),a.jsx("input",{type:"email",value:y,onChange:U=>g(U.target.value),placeholder:"seu@email.com",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),_&&a.jsx("p",{className:"text-rose-400 text-sm font-medium",children:_}),a.jsx("button",{onClick:T,disabled:k,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm",children:k?"Enviando...":"Enviar Código →"})]}),v===2&&a.jsxs("div",{className:"space-y-5",children:[E?a.jsxs("div",{className:"flex items-start gap-3 p-4 bg-amber-500/10 border border-amber-500/20 rounded-xl",children:[a.jsx(Kt,{size:18,className:"text-amber-400 shrink-0 mt-0.5"}),a.jsxs("p",{className:"text-amber-400 text-sm font-medium",children:["SMTP não configurado — código gerado localmente e preenchido automaticamente. Clique em ",a.jsx("strong",{children:"Confirmar"})," para continuar."]})]}):a.jsxs("p",{className:"text-sm text-slate-400 font-medium",children:["Código enviado para ",a.jsx("strong",{className:"text-white",children:y}),". Digite abaixo:"]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Código de Confirmação"}),a.jsx("input",{type:"text",value:w,onChange:U=>S(U.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"000000",maxLength:6,className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-4 text-white focus:ring-1 ring-cyan-500 outline-none transition-all text-center text-2xl font-black tracking-[0.4em]"})]}),_&&a.jsx("p",{className:"text-rose-400 text-sm font-medium",children:_}),a.jsx("button",{onClick:V,disabled:k,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm",children:k?"Confirmando...":"Confirmar ✓"})]}),v===3&&a.jsxs("div",{className:"text-center space-y-4 py-4",children:[a.jsx("div",{className:"w-16 h-16 bg-emerald-500/10 border border-emerald-500/20 rounded-2xl flex items-center justify-center mx-auto",children:a.jsx(nn,{size:40,className:"text-emerald-400"})}),a.jsx("h3",{className:"text-xl font-black text-white",children:"Pareamento Concluído!"}),a.jsx("p",{className:"text-slate-400 text-sm",children:"A chave de integração foi salva automaticamente no plugin."}),a.jsx("button",{onClick:()=>m(!1),className:"mx-auto px-8 py-3 bg-slate-800 hover:bg-slate-700 text-white font-black rounded-xl transition-all text-sm uppercase tracking-widest",children:"Fechar"})]})]})})]})}function tve(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[o,l]=b.useState(!1),[c,u]=b.useState(null),[d,f]=b.useState({username:"",password:"",passwordConfirm:""}),[p,h]=b.useState({username:"",nome:"",email:"",telefone:"",password:"",passwordConfirm:""}),[m,v]=b.useState(!1),[x,y]=b.useState(""),[g,j]=b.useState(""),N=async()=>{r(!0);try{const _=await bf.list();t(_)}catch{}finally{r(!1)}};b.useEffect(()=>{N()},[]);const w=async _=>{var A,E;if(_.preventDefault(),y(""),d.password!==d.passwordConfirm){y("As senhas não coincidem");return}if(d.password.length<4){y("Senha deve ter no mínimo 4 caracteres");return}v(!0);try{await bf.create({username:d.username,password:d.password}),i(!1),f({username:"",password:"",passwordConfirm:""}),N()}catch(P){y(((E=(A=P.response)==null?void 0:A.data)==null?void 0:E.error)||"Erro ao criar administrador")}finally{v(!1)}},S=_=>{u(_),h({username:_.username,nome:_.nome||"",email:_.email||"",telefone:_.telefone||"",password:"",passwordConfirm:""}),j(""),l(!0)},k=async _=>{var A,E;if(_.preventDefault(),j(""),p.password&&p.password!==p.passwordConfirm){j("As senhas não coincidem");return}if(p.password&&p.password.length<4){j("Senha deve ter no mínimo 4 caracteres");return}if(c){v(!0);try{const P={username:p.username,nome:p.nome,email:p.email,telefone:p.telefone};p.password&&(P.password=p.password),await bf.update(c.id,P),l(!1),N()}catch(P){j(((E=(A=P.response)==null?void 0:A.data)==null?void 0:E.error)||"Erro ao atualizar")}finally{v(!1)}}},C=async _=>{var A,E;if(confirm(`Remover o administrador "${_.username}"?`))try{await bf.delete(_.id),N()}catch(P){alert(((E=(A=P.response)==null?void 0:A.data)==null?void 0:E.error)||"Erro ao remover")}};return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-end",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-black text-white tracking-tighter uppercase italic",children:"Administradores"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Usuários com acesso ao painel administrativo."})]}),a.jsxs("button",{onClick:()=>{y(""),f({username:"",password:"",passwordConfirm:""}),i(!0)},className:"flex items-center gap-2 px-6 py-3 bg-cyan-500 hover:bg-cyan-400 text-slate-950 font-black rounded-2xl transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-xs active:scale-95",children:[a.jsx(UI,{size:18}),"Novo Admin"]})]}),a.jsx("div",{className:"bg-slate-900/40 backdrop-blur-md border border-slate-800 rounded-[2.5rem] overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-slate-800/30 text-slate-500 text-[10px] uppercase tracking-widest font-black",children:[a.jsx("th",{className:"px-8 py-5",children:"Administrador"}),a.jsx("th",{className:"px-8 py-5",children:"Contato"}),a.jsx("th",{className:"px-8 py-5",children:"Status"}),a.jsx("th",{className:"px-8 py-5 text-right",children:"Ações"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-800/50",children:n?[1,2,3].map(_=>a.jsx("tr",{className:"animate-pulse",children:a.jsx("td",{colSpan:4,className:"px-8 py-8 bg-slate-800/5"})},_)):e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"px-8 py-20 text-center text-slate-500 font-medium italic",children:"Nenhum administrador encontrado."})}):e.map(_=>a.jsxs("tr",{className:"hover:bg-cyan-500/[0.02] transition-colors group",children:[a.jsx("td",{className:"px-8 py-6",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-br from-cyan-500/20 to-blue-600/20 border border-cyan-500/20 flex items-center justify-center text-cyan-400 font-black text-lg group-hover:scale-110 transition-transform",children:(_.nome||_.username).charAt(0).toUpperCase()}),a.jsxs("div",{children:[a.jsx("div",{className:"text-white font-black text-sm uppercase tracking-tight",children:_.nome||_.username}),a.jsxs("div",{className:"text-slate-500 text-[11px] font-bold",children:["@",_.username]})]})]})}),a.jsx("td",{className:"px-8 py-6",children:a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs text-slate-300 font-bold",children:_.email||"—"}),a.jsx("div",{className:"text-xs text-slate-500 font-medium",children:_.telefone||"—"})]})}),a.jsx("td",{className:"px-8 py-6",children:a.jsx("span",{className:"px-3 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:"Ativo"})}),a.jsx("td",{className:"px-8 py-6 text-right",children:a.jsxs("div",{className:"flex justify-end gap-3 translate-x-4 opacity-0 group-hover:opacity-100 group-hover:translate-x-0 transition-all",children:[a.jsx("button",{onClick:()=>S(_),className:"p-3 bg-slate-800 text-slate-400 hover:text-white hover:bg-slate-700 rounded-xl transition-all border border-slate-700",children:a.jsx(vm,{size:16})}),a.jsx("button",{onClick:()=>C(_),className:"p-3 bg-rose-500/10 text-rose-500 hover:bg-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/10",children:a.jsx(Te,{size:16})})]})})]},_.id))})]})})}),a.jsx(Cs,{isOpen:s,onClose:()=>i(!1),title:"Novo Administrador",children:a.jsxs("form",{onSubmit:w,className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Usuário *"}),a.jsx("input",{required:!0,minLength:3,type:"text",value:d.username,onChange:_=>f({...d,username:_.target.value}),placeholder:"Ex: joao123",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Senha *"}),a.jsx("input",{required:!0,minLength:4,type:"password",value:d.password,onChange:_=>f({...d,password:_.target.value}),placeholder:"Mínimo 4 caracteres",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Confirmar Senha *"}),a.jsx("input",{required:!0,type:"password",value:d.passwordConfirm,onChange:_=>f({...d,passwordConfirm:_.target.value}),placeholder:"Repita a senha",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),x&&a.jsx("p",{className:"text-rose-400 text-sm font-medium",children:x}),a.jsxs("button",{type:"submit",disabled:m,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm mt-4",children:[a.jsx(or,{size:20}),m?"Criando...":"Criar Administrador"]})]})}),a.jsx(Cs,{isOpen:o,onClose:()=>l(!1),title:"Editar Administrador",children:a.jsxs("form",{onSubmit:k,className:"space-y-5",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Usuário *"}),a.jsx("input",{required:!0,type:"text",value:p.username,onChange:_=>h({...p,username:_.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Nome"}),a.jsx("input",{type:"text",value:p.nome,onChange:_=>h({...p,nome:_.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"E-mail"}),a.jsx("input",{type:"email",value:p.email,onChange:_=>h({...p,email:_.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Telefone"}),a.jsx("input",{type:"text",value:p.telefone,onChange:_=>h({...p,telefone:_.target.value}),className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]})]}),a.jsxs("div",{className:"border-t border-slate-800 pt-5",children:[a.jsxs("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500 mb-4 flex items-center gap-2",children:[a.jsx(yI,{size:12})," Alterar Senha (opcional)"]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Nova Senha"}),a.jsx("input",{type:"password",value:p.password,onChange:_=>h({...p,password:_.target.value}),placeholder:"Deixe vazio para manter",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Confirmar"}),a.jsx("input",{type:"password",value:p.passwordConfirm,onChange:_=>h({...p,passwordConfirm:_.target.value}),placeholder:"Repita a nova senha",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white focus:ring-1 ring-cyan-500 outline-none transition-all"})]})]})]}),g&&a.jsx("p",{className:"text-rose-400 text-sm font-medium",children:g}),a.jsxs("button",{type:"submit",disabled:m,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase italic text-sm mt-2",children:[a.jsx(or,{size:20}),m?"Salvando...":"Salvar Alterações"]})]})})]})}function nve({onLogin:e}){const[t,n]=b.useState(""),[r,s]=b.useState(""),[i,o]=b.useState(!1),[l,c]=b.useState(""),u=t.includes("@"),d=async f=>{f.preventDefault(),o(!0),c("");try{if(u){const p=await fetch("/api/team/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:t,password:r})}),h=await p.json();p.ok?e("team",h.account):c(h.error||"Credenciais inválidas")}else{const h=await(await fetch("/admin/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:t,password:r})})).json();h.success?e("admin"):c(h.error||"Credenciais inválidas")}}catch{c("Erro de conexão com o servidor")}finally{o(!1)}};return a.jsxs("div",{className:"min-h-screen bg-black flex items-center justify-center p-4 relative",children:[a.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] bg-cyan-500/5 rounded-full blur-3xl pointer-events-none"}),a.jsx("div",{className:"relative w-full max-w-md animate-in fade-in slide-in-from-bottom-4 duration-500",children:a.jsxs("div",{className:"bg-slate-900/80 backdrop-blur-xl border border-slate-800 rounded-[2rem] p-10 shadow-2xl",children:[a.jsxs("div",{className:"flex flex-col items-center mb-10",children:[a.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-cyan-400 to-blue-600 rounded-2xl flex items-center justify-center shadow-lg shadow-cyan-500/20 mb-4",children:a.jsx(nv,{className:"text-white",size:32})}),a.jsx("h1",{className:"text-2xl font-black text-white tracking-tighter",children:"ALEMÃO"}),a.jsx("p",{className:"text-[11px] text-cyan-500 font-black uppercase tracking-widest mt-1",children:"Admin Cloud v2"})]}),t&&a.jsx("div",{className:`flex items-center justify-center gap-1.5 text-[11px] font-medium mb-4 px-3 py-1.5 rounded-full border w-fit mx-auto transition-all + ${u?"text-purple-400 border-purple-500/30 bg-purple-500/10":"text-cyan-400 border-cyan-500/30 bg-cyan-500/10"}`,children:u?a.jsxs(a.Fragment,{children:[a.jsx(et,{size:11})," Acesso de funcionário"]}):a.jsxs(a.Fragment,{children:[a.jsx(ws,{size:11})," Acesso administrativo"]})}),a.jsxs("form",{onSubmit:d,className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:u?"E-mail":"Usuário ou e-mail"}),a.jsx("input",{required:!0,type:"text",value:t,onChange:f=>n(f.target.value),placeholder:"admin ou seu@email.com",autoComplete:"username",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white placeholder:text-slate-600 focus:ring-1 ring-cyan-500 outline-none transition-all"}),a.jsx("p",{className:"text-[10px] text-slate-600 mt-1 pl-1",children:"Admin: use seu nome de usuário  ·  Funcionário: use seu e-mail"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black uppercase tracking-widest text-slate-500 mb-2",children:"Senha"}),a.jsx("input",{required:!0,type:"password",value:r,onChange:f=>s(f.target.value),placeholder:"••••••••",autoComplete:"current-password",className:"w-full bg-slate-800/50 border border-slate-700 rounded-xl px-4 py-3 text-white placeholder:text-slate-600 focus:ring-1 ring-cyan-500 outline-none transition-all"})]}),l&&a.jsxs("div",{className:"flex items-center gap-2 p-4 bg-rose-500/10 border border-rose-500/20 rounded-xl text-rose-400 text-sm font-medium animate-in fade-in slide-in-from-top-2",children:[a.jsx(Ar,{size:16,className:"shrink-0"}),l]}),a.jsxs("button",{type:"submit",disabled:i,className:"w-full bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 text-slate-950 font-black py-4 rounded-2xl flex items-center justify-center gap-2 transition-all shadow-lg shadow-cyan-500/20 uppercase tracking-widest text-xs mt-2 active:scale-95",children:[a.jsx(wI,{size:18}),i?"Entrando...":"Entrar"]})]})]})})]})}const db=[{value:"",label:"Todos",color:"text-slate-400",bg:"bg-slate-800"},{value:"pending",label:"Pendente",color:"text-yellow-400",bg:"bg-yellow-400/10"},{value:"paid",label:"Pago",color:"text-emerald-400",bg:"bg-emerald-400/10"},{value:"canceled",label:"Cancelado",color:"text-rose-400",bg:"bg-rose-400/10"},{value:"expired",label:"Expirado",color:"text-slate-500",bg:"bg-slate-700/40"}];function rve({status:e}){const t=db.find(r=>r.value===e)??db[0],n={pending:a.jsx(hn,{size:12}),paid:a.jsx(nn,{size:12}),canceled:a.jsx(Ai,{size:12}),expired:a.jsx(Ar,{size:12})};return a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest ${t.color} ${t.bg}`,children:[n[e]??null,t.label]})}function ave(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(""),[o,l]=b.useState(""),[c,u]=b.useState(""),d=async()=>{r(!0);try{const p={};s&&(p.status=s),o&&(p.from=o),c&&(p.to=c);const h=await gfe.list(p);t(h)}catch(p){console.error(p)}finally{r(!1)}};b.useEffect(()=>{d()},[s,o,c]);const f=e.reduce((p,h)=>(p[h.status]=(p[h.status]||0)+1,h.status==="paid"&&(p.revenue+=parseFloat(h.total_amount||0)),p),{pending:0,paid:0,canceled:0,expired:0,revenue:0});return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-bold text-white",children:"Pedidos & Pagamentos"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Histórico de transações e status de pagamentos."})]}),a.jsx("button",{onClick:d,className:"p-3 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-xl transition-all border border-slate-700 active:rotate-180 duration-500",children:a.jsx(ke,{size:20})})]}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{label:"Receita (pago)",value:`R$ ${f.revenue.toFixed(2)}`,color:"emerald"},{label:"Pendentes",value:f.pending,color:"yellow"},{label:"Cancelados",value:f.canceled,color:"rose"},{label:"Expirados",value:f.expired,color:"slate"}].map(p=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-5",children:[a.jsx("p",{className:"text-slate-500 text-[10px] font-bold uppercase tracking-widest mb-1",children:p.label}),a.jsx("p",{className:`text-2xl font-black tabular-nums text-${p.color}-400`,children:p.value})]},p.label))}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx("div",{className:"flex gap-2 flex-wrap",children:db.map(p=>a.jsx("button",{onClick:()=>i(p.value),className:`px-4 py-2 rounded-xl text-xs font-bold uppercase tracking-wide transition-all border ${s===p.value?`${p.color} ${p.bg} border-current`:"text-slate-500 bg-slate-900 border-slate-800 hover:border-slate-700"}`,children:p.label},p.value))}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx("input",{type:"date",value:o,onChange:p=>l(p.target.value),className:"bg-slate-900 border border-slate-800 text-slate-300 text-xs rounded-xl px-3 py-2 focus:outline-none focus:border-cyan-500"}),a.jsx("span",{className:"text-slate-600",children:"→"}),a.jsx("input",{type:"date",value:c,onChange:p=>u(p.target.value),className:"bg-slate-900 border border-slate-800 text-slate-300 text-xs rounded-xl px-3 py-2 focus:outline-none focus:border-cyan-500"})]})]}),a.jsx("div",{className:"bg-slate-900/50 border border-slate-800 rounded-3xl overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-left",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"bg-slate-800/30 text-slate-500 text-[10px] uppercase tracking-widest font-bold",children:[a.jsx("th",{className:"px-6 py-4",children:"Referência"}),a.jsx("th",{className:"px-6 py-4",children:"Status"}),a.jsx("th",{className:"px-6 py-4",children:"Cliente"}),a.jsx("th",{className:"px-6 py-4",children:"Tickets"}),a.jsx("th",{className:"px-6 py-4",children:"Valor"}),a.jsx("th",{className:"px-6 py-4",children:"Pagamento"}),a.jsx("th",{className:"px-6 py-4",children:"Data"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-800",children:n?[1,2,3,4].map(p=>a.jsx("tr",{className:"animate-pulse",children:a.jsx("td",{colSpan:7,className:"px-6 py-5 bg-slate-800/10"})},p)):e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-6 py-20 text-center text-slate-500",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(JP,{size:40,className:"text-slate-800"}),a.jsx("p",{children:"Nenhum pedido encontrado."})]})})}):e.map(p=>a.jsxs("tr",{className:"hover:bg-slate-800/20 transition-colors",children:[a.jsx("td",{className:"px-6 py-4",title:`ID completo: ${p.id}`,children:a.jsxs("span",{className:"font-mono text-sm font-black text-white tracking-widest",children:["#",p.id.slice(-6).toUpperCase()]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx(rve,{status:p.status})}),a.jsxs("td",{className:"px-6 py-4",children:[a.jsx("div",{className:"text-sm font-bold text-white",children:p.user_nome||"—"}),a.jsx("div",{className:"text-[10px] text-slate-500 font-mono",children:p.user_cpf})]}),a.jsx("td",{className:"px-6 py-4 text-sm text-slate-300 tabular-nums font-bold",children:p.ticket_count??0}),a.jsxs("td",{className:"px-6 py-4 text-sm font-black text-emerald-400 tabular-nums",children:["R$ ",parseFloat(p.total_amount||0).toFixed(2)]}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-widest font-bold",children:p.payment_method||"PIX"})}),a.jsx("td",{className:"px-6 py-4 text-[11px] text-slate-500 font-medium whitespace-nowrap tabular-nums",children:new Date(p.created_at).toLocaleString("pt-BR")})]},p.id))})]})})})]})}const KC=[{key:"pending",label:"Pendente",color:"text-yellow-400",border:"border-yellow-500/20",badge:"bg-yellow-400/10 text-yellow-400"},{key:"approved",label:"Aprovado",color:"text-cyan-400",border:"border-cyan-500/20",badge:"bg-cyan-400/10 text-cyan-400"},{key:"delivered",label:"Entregue",color:"text-emerald-400",border:"border-emerald-500/20",badge:"bg-emerald-400/10 text-emerald-400"}];function sve({claim:e,onDragStart:t}){return a.jsxs("div",{draggable:!0,onDragStart:n=>t(n,e.id),className:"bg-slate-900 border border-slate-800 rounded-2xl p-4 cursor-grab active:cursor-grabbing hover:border-slate-700 transition-all select-none",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(ym,{size:14,className:"text-yellow-400 shrink-0"}),a.jsx("span",{className:"text-xs font-black text-white truncate",children:e.raffle_titulo})]}),a.jsxs("span",{className:"text-[10px] font-bold text-slate-500 tabular-nums shrink-0",children:["#",e.ticket_numero]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-slate-400",children:[a.jsx(ks,{size:11,className:"shrink-0"}),a.jsx("span",{className:"truncate",children:e.user_nome||"—"})]}),e.user_telefone&&a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-slate-500",children:[a.jsx(wu,{size:11,className:"shrink-0"}),a.jsx("span",{className:"font-mono",children:e.user_telefone})]}),e.delivery_address&&a.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-slate-500",children:[a.jsx(bs,{size:11,className:"shrink-0 mt-0.5"}),a.jsx("span",{className:"line-clamp-2",children:e.delivery_address})]})]}),a.jsx("div",{className:"mt-3 pt-3 border-t border-slate-800 text-[10px] text-slate-600 tabular-nums",children:new Date(e.claimed_at).toLocaleString("pt-BR")})]})}function ive({col:e,claims:t,onDragStart:n,onDrop:r,onDragOver:s}){const[i,o]=b.useState(!1);return a.jsxs("div",{onDragOver:l=>{s(l),o(!0)},onDragLeave:()=>o(!1),onDrop:l=>{r(l,e.key),o(!1)},className:`flex-1 min-w-[260px] bg-slate-950/60 border rounded-3xl p-5 transition-all ${i?`${e.border} shadow-lg`:"border-slate-900"}`,children:[a.jsxs("div",{className:"flex items-center justify-between mb-5",children:[a.jsx("h3",{className:`text-sm font-black uppercase tracking-widest ${e.color}`,children:e.label}),a.jsx("span",{className:`text-[10px] font-black px-2 py-1 rounded-lg ${e.badge}`,children:t.length})]}),a.jsx("div",{className:"space-y-3 min-h-[80px]",children:t.length===0?a.jsx("div",{className:"flex items-center justify-center h-20 text-slate-700 text-xs italic border border-dashed border-slate-800 rounded-xl",children:"Arraste para cá"}):t.map(l=>a.jsx(sve,{claim:l,onDragStart:n},l.id))})]})}function ove(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),s=b.useRef(null),i=async()=>{r(!0);try{const d=await d4.list();t(d)}catch(d){console.error(d)}finally{r(!1)}};b.useEffect(()=>{i()},[]);const o=(d,f)=>{s.current=f,d.dataTransfer.effectAllowed="move"},l=d=>{d.preventDefault(),d.dataTransfer.dropEffect="move"},c=async(d,f)=>{d.preventDefault();const p=s.current;if(p===null)return;const h=e.find(m=>m.id===p);if(!(!h||h.status===f)){t(m=>m.map(v=>v.id===p?{...v,status:f}:v));try{await d4.updateStatus(p,f)}catch{t(m=>m.map(v=>v.id===p?{...v,status:h.status}:v)),alert("Erro ao atualizar status. Tente novamente.")}s.current=null}},u=d=>e.filter(f=>f.status===d);return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl font-bold text-white",children:"Resgates de Prêmios"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Gerencie os resgates dos ganhadores. Arraste os cards entre colunas para atualizar o status."})]}),a.jsx("button",{onClick:i,className:"p-3 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-xl transition-all border border-slate-700 active:rotate-180 duration-500",children:a.jsx(ke,{size:20})})]}),n?a.jsx("div",{className:"flex gap-6",children:KC.map(d=>a.jsxs("div",{className:"flex-1 min-w-[260px] bg-slate-950/60 border border-slate-900 rounded-3xl p-5 animate-pulse",children:[a.jsx("div",{className:"h-4 bg-slate-800 rounded w-24 mb-5"}),[1,2].map(f=>a.jsx("div",{className:"h-32 bg-slate-800/40 rounded-2xl mb-3"},f))]},d.key))}):a.jsx("div",{className:"flex gap-6 overflow-x-auto pb-4",children:KC.map(d=>a.jsx(ive,{col:d,claims:u(d.key),onDragStart:o,onDrop:c,onDragOver:l},d.key))})]})}const d8={active:"Ativo",suspended:"Suspenso",canceled:"Cancelado",pending_payment:"Aguard. Pgto"},lve={active:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",suspended:"bg-amber-500/10 text-amber-400 border-amber-500/20",canceled:"bg-rose-500/10 text-rose-400 border-rose-500/20",pending_payment:"bg-slate-500/10 text-slate-400 border-slate-500/20"};function cve({status:e}){return a.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded border ${lve[e]||"bg-slate-700 text-slate-400"}`,children:d8[e]||e})}function GC(e){return`R$ ${Number(e).toFixed(2).replace(".",",")}`}function XC(e){return e?new Date(e).toLocaleDateString("pt-BR"):"—"}function uve(e){return e.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/,"$1.$2.$3-$4")}function dve({clubId:e,partner:t,onClose:n,onSaved:r}){const[s,i]=b.useState({name:(t==null?void 0:t.name)||"",specialty:(t==null?void 0:t.specialty)||"",phone:(t==null?void 0:t.phone)||"",address:(t==null?void 0:t.address)||"",discount_percent:(t==null?void 0:t.discount_percent)??0,notes:(t==null?void 0:t.notes)||"",active:(t==null?void 0:t.active)??!0}),[o,l]=b.useState(!1);async function c(u){u.preventDefault(),l(!0);try{t?await Ut.updatePartner(t.id,s):await Ut.createPartner({...s,club_id:e}),r(),n()}catch{alert("Erro ao salvar parceiro")}finally{l(!1)}}return a.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-md",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:t?"Editar Parceiro":"Novo Parceiro"}),a.jsx("button",{onClick:n,className:"text-slate-500 hover:text-white transition-colors",children:a.jsx(Ce,{size:20})})]}),a.jsxs("form",{onSubmit:c,className:"p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Nome *"}),a.jsx("input",{required:!0,value:s.name,onChange:u=>i(d=>({...d,name:u.target.value})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Especialidade"}),a.jsx("input",{value:s.specialty,onChange:u=>i(d=>({...d,specialty:u.target.value})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Desconto %"}),a.jsx("input",{type:"number",min:0,max:100,value:s.discount_percent,onChange:u=>i(d=>({...d,discount_percent:Number(u.target.value)})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Telefone"}),a.jsx("input",{value:s.phone,onChange:u=>i(d=>({...d,phone:u.target.value})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Endereço"}),a.jsx("input",{value:s.address,onChange:u=>i(d=>({...d,address:u.target.value})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Observações"}),a.jsx("textarea",{value:s.notes,rows:2,onChange:u=>i(d=>({...d,notes:u.target.value})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 resize-none"})]}),t&&a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:s.active,onChange:u=>i(d=>({...d,active:u.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Parceiro ativo"})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:n,className:"flex-1 py-2.5 rounded-xl border border-slate-700 text-slate-400 hover:text-white text-sm font-bold transition-colors",children:"Cancelar"}),a.jsx("button",{type:"submit",disabled:o,className:"flex-1 py-2.5 rounded-xl bg-cyan-500 hover:bg-cyan-400 text-black text-sm font-black transition-colors disabled:opacity-50",children:o?"Salvando…":"Salvar"})]})]})]})})}function fve({clubId:e,plan:t,onClose:n,onSaved:r}){const[s,i]=b.useState({name:(t==null?void 0:t.name)||"",description:(t==null?void 0:t.description)||"",price_monthly:(t==null?void 0:t.price_monthly)??0,max_dependents:(t==null?void 0:t.max_dependents)??0,features:t!=null&&t.features?[...t.features]:[""],active:(t==null?void 0:t.active)??!0}),[o,l]=b.useState(!1);function c(){i(p=>({...p,features:[...p.features,""]}))}function u(p){i(h=>({...h,features:h.features.filter((m,v)=>v!==p)}))}function d(p,h){i(m=>{const v=[...m.features];return v[p]=h,{...m,features:v}})}async function f(p){p.preventDefault(),l(!0);try{const h={...s,club_id:e,features:s.features.filter(m=>m.trim())};t?await Ut.updatePlan(t.id,h):await Ut.createPlan(h),r(),n()}catch{alert("Erro ao salvar plano")}finally{l(!1)}}return a.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800 sticky top-0 bg-slate-900 z-10",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:t?"Editar Plano":"Novo Plano"}),a.jsx("button",{onClick:n,className:"text-slate-500 hover:text-white transition-colors",children:a.jsx(Ce,{size:20})})]}),a.jsxs("form",{onSubmit:f,className:"p-6 space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Nome do Plano *"}),a.jsx("input",{required:!0,value:s.name,onChange:p=>i(h=>({...h,name:p.target.value})),placeholder:"Ex: Pessoal, Família...",className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Preço Mensal (R$) *"}),a.jsx("input",{required:!0,type:"number",min:0,step:"0.01",value:s.price_monthly,onChange:p=>i(h=>({...h,price_monthly:Number(p.target.value)})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Máx. Dependentes"}),a.jsx("input",{type:"number",min:0,value:s.max_dependents,onChange:p=>i(h=>({...h,max_dependents:Number(p.target.value)})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Descrição"}),a.jsx("input",{value:s.description,onChange:p=>i(h=>({...h,description:p.target.value})),placeholder:"Breve descrição do plano...",className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Benefícios incluídos"}),a.jsxs("button",{type:"button",onClick:c,className:"text-xs font-black text-cyan-400 hover:text-cyan-300 flex items-center gap-1",children:[a.jsx(Oe,{size:12})," Adicionar"]})]}),a.jsx("div",{className:"space-y-2",children:s.features.map((p,h)=>a.jsxs("div",{className:"flex gap-2 items-center",children:[a.jsx(hI,{size:14,className:"text-slate-600 shrink-0"}),a.jsx("input",{value:p,onChange:m=>d(h,m.target.value),placeholder:`Benefício ${h+1}`,className:"flex-1 bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"}),a.jsx("button",{type:"button",onClick:()=>u(h),className:"p-1.5 rounded-lg hover:bg-rose-500/10 text-slate-500 hover:text-rose-400 transition-colors",children:a.jsx(Ce,{size:14})})]},h))})]}),t&&a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:s.active,onChange:p=>i(h=>({...h,active:p.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Plano ativo"})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:n,className:"flex-1 py-2.5 rounded-xl border border-slate-700 text-slate-400 hover:text-white text-sm font-bold transition-colors",children:"Cancelar"}),a.jsx("button",{type:"submit",disabled:o,className:"flex-1 py-2.5 rounded-xl bg-cyan-500 hover:bg-cyan-400 text-black text-sm font-black transition-colors disabled:opacity-50",children:o?"Salvando…":"Salvar"})]})]})]})})}function pve({clubId:e,faq:t,onClose:n,onSaved:r}){const[s,i]=b.useState({question:(t==null?void 0:t.question)||"",answer:(t==null?void 0:t.answer)||"",sort_order:(t==null?void 0:t.sort_order)??0,active:(t==null?void 0:t.active)??!0}),[o,l]=b.useState(!1);async function c(u){u.preventDefault(),l(!0);try{t?await Ut.updateFaq(t.id,s):await Ut.createFaq({...s,club_id:e}),r(),n()}catch{alert("Erro ao salvar FAQ")}finally{l(!1)}}return a.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-lg",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:t?"Editar FAQ":"Nova FAQ"}),a.jsx("button",{onClick:n,className:"text-slate-500 hover:text-white transition-colors",children:a.jsx(Ce,{size:20})})]}),a.jsxs("form",{onSubmit:c,className:"p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Pergunta *"}),a.jsx("input",{required:!0,value:s.question,onChange:u=>i(d=>({...d,question:u.target.value})),placeholder:"Ex: Como funciona o pagamento?",className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Resposta *"}),a.jsx("textarea",{required:!0,value:s.answer,rows:4,onChange:u=>i(d=>({...d,answer:u.target.value})),placeholder:"Resposta detalhada...",className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 resize-none"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Ordem"}),a.jsx("input",{type:"number",min:0,value:s.sort_order,onChange:u=>i(d=>({...d,sort_order:Number(u.target.value)})),className:"mt-1 w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsx("div",{className:"flex items-end pb-2",children:a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:s.active,onChange:u=>i(d=>({...d,active:u.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Ativo"})]})})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:n,className:"flex-1 py-2.5 rounded-xl border border-slate-700 text-slate-400 hover:text-white text-sm font-bold transition-colors",children:"Cancelar"}),a.jsx("button",{type:"submit",disabled:o,className:"flex-1 py-2.5 rounded-xl bg-cyan-500 hover:bg-cyan-400 text-black text-sm font-black transition-colors disabled:opacity-50",children:o?"Salvando…":"Salvar"})]})]})]})})}function hve({member:e,onChanged:t}){const[n,r]=b.useState(!1),[s,i]=b.useState(!1);async function o(l){r(!1),i(!0);try{await Ut.updateMemberStatus(e.id,l),t()}catch{alert("Erro ao atualizar status")}finally{i(!1)}}return a.jsxs("div",{className:"relative",children:[a.jsxs("button",{disabled:s,onClick:()=>r(l=>!l),className:"text-xs font-bold px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 flex items-center gap-1 transition-colors disabled:opacity-50",children:["Ações ",a.jsx(aa,{size:12})]}),n&&a.jsxs("div",{className:"absolute right-0 top-full mt-1 bg-slate-800 border border-slate-700 rounded-xl shadow-xl z-10 min-w-[160px] overflow-hidden",children:[e.status!=="active"&&a.jsxs("button",{onClick:()=>o("active"),className:"w-full text-left px-4 py-2.5 text-sm text-emerald-400 hover:bg-slate-700 flex items-center gap-2",children:[a.jsx(Ts,{size:14})," Ativar"]}),e.status==="active"&&a.jsxs("button",{onClick:()=>o("suspended"),className:"w-full text-left px-4 py-2.5 text-sm text-amber-400 hover:bg-slate-700 flex items-center gap-2",children:[a.jsx(IP,{size:14})," Suspender"]}),e.status!=="canceled"&&a.jsxs("button",{onClick:()=>{confirm("Cancelar assinatura deste membro?")&&o("canceled")},className:"w-full text-left px-4 py-2.5 text-sm text-rose-400 hover:bg-slate-700 flex items-center gap-2",children:[a.jsx(Ai,{size:14})," Cancelar"]})]})]})}const mve=[{id:"members",label:"Membros",icon:et},{id:"partners",label:"Parceiros",icon:Xo},{id:"plans",label:"Planos & Preços",icon:xm},{id:"content",label:"Condições & Regras",icon:Hr},{id:"faq",label:"FAQ / Sanfona",icon:Ol}];function f8({clubId:e,clubName:t,clubSlug:n,accentColor:r}){const[s,i]=b.useState([]),[o,l]=b.useState([]),[c,u]=b.useState([]),[d,f]=b.useState([]),[p,h]=b.useState({conditions:"",rules:""}),[m,v]=b.useState(!1),[x,y]=b.useState(""),[g,j]=b.useState(""),[N,w]=b.useState("members"),[S,k]=b.useState(null),[C,_]=b.useState(null),[A,E]=b.useState(null),[P,D]=b.useState(!0),I=r,R=b.useCallback(async()=>{D(!0);try{const F=await Ut.listMembers(e,{status:g||void 0,limit:200});i(F||[])}catch{i([])}finally{D(!1)}},[e,g]),M=b.useCallback(async()=>{try{const F=await Ut.listPartners(e);l(F||[])}catch{l([])}},[e]),W=b.useCallback(async()=>{try{const F=await Ut.listPlans(e);u(F||[])}catch{u([])}},[e]),T=b.useCallback(async()=>{try{const F=await Ut.listFaqs(e);f(F||[])}catch{f([])}},[e]);b.useEffect(()=>{R()},[R]),b.useEffect(()=>{M()},[M]),b.useEffect(()=>{W()},[W]),b.useEffect(()=>{T()},[T]),b.useEffect(()=>{n&&fetch(`/api/clubs/${n}`).then(F=>F.json()).then(F=>{h({conditions:F.conditions||"",rules:F.rules||""})}).catch(()=>{})},[n]);const V=s.filter(F=>F.status==="active").length,X=s.filter(F=>F.status==="suspended").length,U=s.filter(F=>F.status==="pending_payment").length,L=s.filter(F=>F.status==="active").reduce((F,z)=>F+Number(z.price_monthly),0),B=(()=>{const F=new Date;return Array.from({length:6},(z,q)=>{const ie=new Date(F.getFullYear(),F.getMonth()-(5-q),1),oe=ie.toLocaleDateString("pt-BR",{month:"short",year:"2-digit"}),we=s.filter(Ee=>new Date(Ee.started_at)<=new Date(ie.getFullYear(),ie.getMonth()+1,0)).length;return{label:oe,count:we}})})(),ae=g?s.filter(F=>F.status===g):s;async function se(F){confirm("Desativar este parceiro?")&&(await Ut.deletePartner(F),M())}async function xe(F){var z,q;if(confirm("Excluir este plano?"))try{await Ut.deletePlan(F),W()}catch(ie){alert(((q=(z=ie.response)==null?void 0:z.data)==null?void 0:q.error)||"Erro ao excluir plano")}}async function H(F){confirm("Excluir esta FAQ?")&&(await Ut.deleteFaq(F),T())}async function le(F){F.preventDefault(),v(!0),y("");try{await Ut.saveContent(e,p),y("Salvo com sucesso!"),setTimeout(()=>y(""),3e3)}catch{y("Erro ao salvar.")}finally{v(!1)}}async function Z(F,z){const q=d.indexOf(F),ie=z==="up"?q-1:q+1;if(ie<0||ie>=d.length)return;const oe=d[ie];await Promise.all([Ut.updateFaq(F.id,{...F,sort_order:oe.sort_order}),Ut.updateFaq(oe.id,{...oe,sort_order:F.sort_order})]),T()}return a.jsxs("div",{className:"space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{children:[a.jsx("h2",{className:"text-4xl font-black text-white tracking-tighter",children:t}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Gestão de membros, planos, parceiros e conteúdo."})]}),a.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[{label:"Membros Ativos",value:V,icon:et,color:"emerald"},{label:"MRR",value:GC(L),icon:xm,color:I},{label:"Inadimplentes",value:X,icon:Kt,color:"amber"},{label:"Aguard. Pgto",value:U,icon:IP,color:"slate"}].map(({label:F,value:z,icon:q,color:ie})=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6 hover:border-slate-700 transition-all",children:[a.jsx("div",{className:`p-3 rounded-2xl bg-slate-800 border border-white/5 text-${ie}-400 w-fit mb-4`,children:a.jsx(q,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:F}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums tracking-tighter",children:z})]},F))}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-8",children:[a.jsx("h3",{className:"text-base font-black text-white uppercase tracking-wider mb-6",children:"Evolução de Membros (6 meses)"}),a.jsx("div",{className:"h-48",children:a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(GT,{data:B,children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"gradClub",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",stopColor:"#06b6d4",stopOpacity:.3}),a.jsx("stop",{offset:"95%",stopColor:"#06b6d4",stopOpacity:0})]})}),a.jsx(xl,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),a.jsx(ia,{dataKey:"label",stroke:"#475569",tick:{fontSize:11}}),a.jsx(oa,{stroke:"#475569",tick:{fontSize:11},allowDecimals:!1}),a.jsx(on,{contentStyle:{background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#f1f5f9",fontSize:"12px"},formatter:F=>[F,"Membros"]}),a.jsx(za,{type:"monotone",dataKey:"count",stroke:"#06b6d4",strokeWidth:2,fill:"url(#gradClub)"})]})})})]}),a.jsx("div",{className:"flex gap-1 border-b border-slate-800 overflow-x-auto",children:mve.map(({id:F,label:z,icon:q})=>a.jsxs("button",{onClick:()=>w(F),className:`flex items-center gap-2 px-4 py-3 text-xs font-black uppercase tracking-wider border-b-2 whitespace-nowrap transition-all ${N===F?"border-cyan-400 text-cyan-400":"border-transparent text-slate-500 hover:text-slate-300"}`,children:[a.jsx(q,{size:14})," ",z]},F))}),N==="members"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex gap-2 flex-wrap",children:["","active","suspended","pending_payment","canceled"].map(F=>a.jsx("button",{onClick:()=>j(F),className:`px-4 py-2 rounded-xl text-xs font-black uppercase tracking-wider border transition-all ${g===F?"bg-cyan-500/10 border-cyan-500/30 text-cyan-400":"border-slate-700 text-slate-500 hover:text-slate-300"}`,children:F?d8[F]:"Todos"},F))}),P?a.jsx("div",{className:"flex justify-center py-16",children:a.jsx("div",{className:"w-8 h-8 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}):a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl overflow-hidden overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsx("tr",{className:"border-b border-slate-800",children:["Nome","CPF","Plano","Próx. Cobrança","Início","Status",""].map(F=>a.jsx("th",{className:"text-left px-5 py-4 text-[10px] font-black uppercase tracking-widest text-slate-500 whitespace-nowrap",children:F},F))})}),a.jsxs("tbody",{children:[ae.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"text-center py-12 text-slate-600 italic",children:"Nenhum membro encontrado"})}),ae.map(F=>a.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/30 transition-colors",children:[a.jsx("td",{className:"px-5 py-3.5 font-semibold text-white whitespace-nowrap",children:F.user_nome}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 font-mono text-xs",children:uve(F.user_cpf)}),a.jsx("td",{className:"px-5 py-3.5 text-slate-300 whitespace-nowrap",children:F.plan_name}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 whitespace-nowrap",children:XC(F.next_billing_at)}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 whitespace-nowrap",children:XC(F.started_at)}),a.jsx("td",{className:"px-5 py-3.5",children:a.jsx(cve,{status:F.status})}),a.jsx("td",{className:"px-5 py-3.5",children:a.jsx(hve,{member:F,onChanged:R})})]},F.id))]})]})})]}),N==="partners"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{onClick:()=>k("new"),className:"flex items-center gap-2 px-5 py-2.5 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors",children:[a.jsx(Oe,{size:16})," Novo Parceiro"]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:[o.length===0&&a.jsx("p",{className:"text-slate-600 italic col-span-3 py-8 text-center",children:"Nenhum parceiro cadastrado"}),o.map(F=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-5 hover:border-slate-700 transition-all",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-black text-white",children:F.name}),F.specialty&&a.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:F.specialty})]}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx("button",{onClick:()=>k(F),className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>se(F.id),className:"p-1.5 rounded-lg hover:bg-rose-500/10 text-slate-400 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:14})})]})]}),F.discount_percent>0&&a.jsxs("span",{className:"text-xs font-black text-cyan-400 bg-cyan-500/10 border border-cyan-500/20 px-2 py-0.5 rounded",children:[F.discount_percent,"% desconto"]}),F.phone&&a.jsx("p",{className:"text-xs text-slate-500 mt-2",children:F.phone}),F.address&&a.jsx("p",{className:"text-xs text-slate-500",children:F.address}),F.notes&&a.jsx("p",{className:"text-xs text-slate-600 mt-2 italic",children:F.notes})]},F.id))]})]}),N==="plans"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-slate-400 text-sm",children:"Planos disponíveis para assinatura neste clube."}),a.jsxs("button",{onClick:()=>_("new"),className:"flex items-center gap-2 px-5 py-2.5 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors",children:[a.jsx(Oe,{size:16})," Novo Plano"]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:[c.length===0&&a.jsx("p",{className:"text-slate-600 italic col-span-3 py-8 text-center",children:"Nenhum plano cadastrado"}),c.map(F=>{var z;return a.jsxs("div",{className:`relative bg-slate-900/40 border rounded-3xl p-6 hover:border-slate-700 transition-all ${F.active?"border-slate-800":"border-slate-800/40 opacity-60"}`,children:[!F.active&&a.jsx("span",{className:"absolute top-3 right-3 text-[10px] font-black px-2 py-0.5 rounded bg-slate-700 text-slate-400",children:"INATIVO"}),a.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-black text-white text-lg",children:F.name}),F.description&&a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:F.description})]}),a.jsxs("div",{className:"flex gap-1 shrink-0",children:[a.jsx("button",{onClick:()=>_(F),className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>xe(F.id),className:"p-1.5 rounded-lg hover:bg-rose-500/10 text-slate-400 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:14})})]})]}),a.jsxs("p",{className:"text-3xl font-black text-cyan-400 mb-1",children:[GC(F.price_monthly),a.jsx("span",{className:"text-sm text-slate-500 font-medium",children:"/mês"})]}),F.max_dependents>0&&a.jsxs("p",{className:"text-xs text-slate-500 mb-3",children:["Até ",F.max_dependents," dependente(s)"]}),((z=F.features)==null?void 0:z.length)>0&&a.jsx("ul",{className:"space-y-1.5 mt-3 pt-3 border-t border-slate-800",children:F.features.map((q,ie)=>a.jsxs("li",{className:"flex items-center gap-2 text-xs text-slate-300",children:[a.jsx(Ts,{size:12,className:"text-emerald-400 shrink-0"})," ",q]},ie))})]},F.id)})]})]}),N==="content"&&a.jsxs("form",{onSubmit:le,className:"space-y-6 max-w-3xl",children:[a.jsxs("p",{className:"text-slate-400 text-sm",children:["Defina as condições de adesão e regras de uso específicas para ",a.jsx("strong",{className:"text-white",children:t}),". O conteúdo é exibido na página pública do clube."]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-black text-slate-400 uppercase tracking-wider block mb-2",children:"Condições de Adesão"}),a.jsx("textarea",{rows:8,value:p.conditions,onChange:F=>h(z=>({...z,conditions:F.target.value})),placeholder:"Descreva as condições para adesão ao clube...",className:"w-full bg-slate-900 border border-slate-800 rounded-2xl px-4 py-3 text-sm text-white focus:outline-none focus:border-cyan-500 resize-y"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-black text-slate-400 uppercase tracking-wider block mb-2",children:"Regras de Uso"}),a.jsx("textarea",{rows:8,value:p.rules,onChange:F=>h(z=>({...z,rules:F.target.value})),placeholder:"Descreva as regras de utilização do clube...",className:"w-full bg-slate-900 border border-slate-800 rounded-2xl px-4 py-3 text-sm text-white focus:outline-none focus:border-cyan-500 resize-y"})]}),(p.conditions||p.rules)&&a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-5 space-y-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-wider",children:"Pré-visualização"}),p.conditions&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-black text-white mb-1",children:"Condições de Adesão"}),a.jsx("p",{className:"text-slate-400 text-xs whitespace-pre-line",children:p.conditions})]}),p.rules&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-black text-white mb-1",children:"Regras de Uso"}),a.jsx("p",{className:"text-slate-400 text-xs whitespace-pre-line",children:p.rules})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{type:"submit",disabled:m,className:"px-8 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors disabled:opacity-50",children:m?"Salvando…":"Salvar Conteúdo"}),x&&a.jsx("p",{className:`text-sm font-bold ${x.includes("sucesso")?"text-emerald-400":"text-rose-400"}`,children:x})]})]}),N==="faq"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-slate-400 text-sm",children:["Perguntas e respostas exibidas na página pública (",d.length," FAQ",d.length!==1?"s":"",")."]}),a.jsxs("button",{onClick:()=>E("new"),className:"flex items-center gap-2 px-5 py-2.5 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors",children:[a.jsx(Oe,{size:16})," Nova FAQ"]})]}),a.jsxs("div",{className:"space-y-3",children:[d.length===0&&a.jsx("p",{className:"text-slate-600 italic py-8 text-center",children:"Nenhuma FAQ cadastrada"}),d.map((F,z)=>a.jsx("div",{className:`bg-slate-900/40 border rounded-2xl p-5 transition-all ${F.active?"border-slate-800":"border-slate-800/40 opacity-60"}`,children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"flex flex-col gap-1 mt-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>Z(F,"up"),disabled:z===0,className:"text-slate-600 hover:text-slate-300 disabled:opacity-20 transition-colors",children:"▲"}),a.jsx("button",{onClick:()=>Z(F,"down"),disabled:z===d.length-1,className:"text-slate-600 hover:text-slate-300 disabled:opacity-20 transition-colors",children:"▼"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("p",{className:"font-bold text-white text-sm",children:F.question}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[F.active?a.jsx(Ss,{size:18,className:"text-emerald-400"}):a.jsx(Ns,{size:18,className:"text-slate-600"}),a.jsx("button",{onClick:()=>E(F),className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>H(F.id),className:"p-1.5 rounded-lg hover:bg-rose-500/10 text-slate-400 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:14})})]})]}),a.jsx("p",{className:"text-slate-400 text-xs mt-1 line-clamp-2",children:F.answer}),a.jsxs("p",{className:"text-slate-700 text-[10px] mt-2",children:["Ordem: ",F.sort_order]})]})]})},F.id))]})]}),S!==null&&a.jsx(dve,{clubId:e,partner:S==="new"?null:S,onClose:()=>k(null),onSaved:M}),C!==null&&a.jsx(fve,{clubId:e,plan:C==="new"?null:C,onClose:()=>_(null),onSaved:W}),A!==null&&a.jsx(pve,{clubId:e,faq:A==="new"?null:A,onClose:()=>E(null),onSaved:T})]})}function xve(){return a.jsx(f8,{clubId:1,clubName:"Clube Odonto",clubSlug:"odonto",accentColor:"cyan"})}function gve(){return a.jsx(f8,{clubId:2,clubName:"Clube Médico",clubSlug:"medico",accentColor:"violet"})}const YC=["#06b6d4","#8b5cf6","#10b981","#f59e0b","#ef4444"],Z0={contentStyle:{background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#f1f5f9",fontSize:"12px"}};function QC(e){return`R$ ${Number(e||0).toFixed(2).replace(".",",")}`}function vve(e,t){if(!e.length)return;const n=Object.keys(e[0]).join(","),r=e.map(l=>Object.values(l).map(c=>`"${String(c??"").replace(/"/g,'""')}"`).join(",")).join(` +`),s=new Blob([`${n} +${r}`],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=t,o.click(),URL.revokeObjectURL(i)}function yve(){const[e,t]=b.useState(null),[n,r]=b.useState(!0),[s,i]=b.useState(!1);b.useEffect(()=>{f4.get().then(t).catch(()=>t(null)).finally(()=>r(!1))},[]);const o=(()=>{const x={};return((e==null?void 0:e.growth)||[]).forEach(y=>{x[y.month]={month:y.month,new_members:Number(y.new_members),canceled:0}}),((e==null?void 0:e.churn)||[]).forEach(y=>{x[y.month]||(x[y.month]={month:y.month,new_members:0,canceled:0}),x[y.month].canceled=Number(y.canceled)}),Object.values(x).sort((y,g)=>y.month.localeCompare(g.month))})(),l=(()=>{const x={};return((e==null?void 0:e.mrr)||[]).forEach(y=>{x[y.month]=(x[y.month]||0)+Number(y.mrr)}),Object.entries(x).sort(([y],[g])=>y.localeCompare(g)).map(([y,g])=>({month:y,mrr:g}))})(),c=l.length>0?l[l.length-1].mrr:0,u=l.length>1?l[l.length-2].mrr:0,d=u?((c-u)/u*100).toFixed(1):null,f=((e==null?void 0:e.overdue)||[]).reduce((x,y)=>x+Number(y.active),0),p=((e==null?void 0:e.overdue)||[]).reduce((x,y)=>x+Number(y.suspended),0),h=f+p>0?(p/(f+p)*100).toFixed(1):"0",m=((e==null?void 0:e.planDist)||[]).map(x=>({name:`${x.club_name} — ${x.plan_name}`,value:Number(x.total)}));async function v(){i(!0);try{const x=await f4.exportCsv();vve(x,`membros-clubes-${new Date().toISOString().slice(0,10)}.csv`)}catch{alert("Erro ao exportar")}finally{i(!1)}}return n?a.jsx("div",{className:"flex justify-center py-24",children:a.jsx("div",{className:"w-8 h-8 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}):a.jsxs("div",{className:"space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex items-start justify-between",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-4xl font-black text-white tracking-tighter",children:"Relatórios do Clube"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"MRR, churn, crescimento e distribuição de planos."})]}),a.jsxs("button",{onClick:v,disabled:s,className:"flex items-center gap-2 px-5 py-2.5 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors disabled:opacity-50",children:[a.jsx(m1,{size:16}),s?"Exportando…":"Exportar CSV"]})]}),a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6",children:[a.jsx("div",{className:"p-3 rounded-2xl bg-slate-800 text-cyan-400 w-fit mb-4",children:a.jsx(xm,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:"MRR Atual"}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums",children:QC(c)}),d!==null&&a.jsxs("p",{className:`text-xs font-bold mt-1 ${Number(d)>=0?"text-emerald-400":"text-rose-400"}`,children:[Number(d)>=0?"▲":"▼"," ",Math.abs(Number(d)),"% vs mês ant."]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6",children:[a.jsx("div",{className:"p-3 rounded-2xl bg-slate-800 text-emerald-400 w-fit mb-4",children:a.jsx(Wi,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:"Membros Ativos"}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums",children:f})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6",children:[a.jsx("div",{className:"p-3 rounded-2xl bg-slate-800 text-amber-400 w-fit mb-4",children:a.jsx(Kt,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:"Taxa Inadimpl."}),a.jsxs("h3",{className:"text-3xl font-black text-white tabular-nums",children:[h,"%"]}),a.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:[p," suspenso(s)"]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6",children:[a.jsx("div",{className:"p-3 rounded-2xl bg-slate-800 text-rose-400 w-fit mb-4",children:a.jsx(FI,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:"Cancelamentos"}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums",children:((e==null?void 0:e.churn)||[]).reduce((x,y)=>x+Number(y.canceled),0)}),a.jsx("p",{className:"text-xs text-slate-500 mt-1",children:"últimos 12 meses"})]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-8",children:[a.jsx("h3",{className:"text-base font-black text-white uppercase tracking-wider mb-6",children:"MRR — Receita Recorrente Mensal"}),a.jsx("div",{className:"h-52",children:l.length>0?a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(Mue,{data:l,children:[a.jsx(xl,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),a.jsx(ia,{dataKey:"month",stroke:"#475569",tick:{fontSize:11}}),a.jsx(oa,{stroke:"#475569",tick:{fontSize:11},tickFormatter:x=>`R$${x}`}),a.jsx(on,{...Z0,formatter:x=>[QC(x),"MRR"]}),a.jsx(Cd,{type:"monotone",dataKey:"mrr",stroke:"#06b6d4",strokeWidth:2.5,dot:{fill:"#06b6d4",r:4}})]})}):a.jsx("div",{className:"h-full flex items-center justify-center text-slate-600 italic text-sm",children:"Sem dados"})})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-8",children:[a.jsx("h3",{className:"text-base font-black text-white uppercase tracking-wider mb-6",children:"Novos vs Cancelamentos"}),a.jsx("div",{className:"h-52",children:o.length>0?a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(KT,{data:o,children:[a.jsx(xl,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),a.jsx(ia,{dataKey:"month",stroke:"#475569",tick:{fontSize:10}}),a.jsx(oa,{stroke:"#475569",tick:{fontSize:10},allowDecimals:!1}),a.jsx(on,{...Z0}),a.jsx(ms,{wrapperStyle:{fontSize:11,color:"#94a3b8"}}),a.jsx($a,{dataKey:"new_members",name:"Novos",fill:"#10b981",radius:[4,4,0,0]}),a.jsx($a,{dataKey:"canceled",name:"Cancelados",fill:"#ef4444",radius:[4,4,0,0]})]})}):a.jsx("div",{className:"h-full flex items-center justify-center text-slate-600 italic text-sm",children:"Sem dados"})})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-8",children:[a.jsx("h3",{className:"text-base font-black text-white uppercase tracking-wider mb-6",children:"Distribuição de Planos"}),a.jsx("div",{className:"h-52 flex items-center",children:m.length>0?a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(Rue,{children:[a.jsx(La,{data:m,cx:"40%",cy:"50%",innerRadius:50,outerRadius:80,dataKey:"value",label:({percent:x})=>`${(x*100).toFixed(0)}%`,labelLine:!1,children:m.map((x,y)=>a.jsx(Vm,{fill:YC[y%YC.length]},y))}),a.jsx(on,{...Z0,formatter:x=>[x,"Membros"]}),a.jsx(ms,{layout:"vertical",align:"right",verticalAlign:"middle",wrapperStyle:{fontSize:11,color:"#94a3b8",maxWidth:"45%"}})]})}):a.jsx("div",{className:"w-full flex items-center justify-center text-slate-600 italic text-sm",children:"Sem dados"})})]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-8",children:[a.jsx("h3",{className:"text-base font-black text-white uppercase tracking-wider mb-6",children:"Inadimplência por Clube"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[((e==null?void 0:e.overdue)||[]).map(x=>{const y=Number(x.active)+Number(x.suspended),g=y>0?Math.round(Number(x.suspended)/y*100):0;return a.jsxs("div",{className:"bg-slate-800/50 rounded-2xl p-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"font-black text-white",children:x.club_name}),a.jsxs("span",{className:`text-sm font-black ${g>10?"text-rose-400":"text-emerald-400"}`,children:[g,"%"]})]}),a.jsx("div",{className:"w-full h-2 bg-slate-700 rounded-full overflow-hidden",children:a.jsx("div",{className:`h-full rounded-full ${g>10?"bg-rose-500":"bg-emerald-500"}`,style:{width:`${g}%`}})}),a.jsxs("div",{className:"flex justify-between mt-2 text-xs text-slate-500",children:[a.jsxs("span",{children:[x.active," ativo(s)"]}),a.jsxs("span",{children:[x.suspended," suspenso(s)"]})]})]},x.club_name)}),(!(e!=null&&e.overdue)||e.overdue.length===0)&&a.jsx("p",{className:"text-slate-600 italic col-span-2",children:"Sem dados de inadimplência"})]})]})]})}function wx(e){return e?new Date(e).toLocaleDateString("pt-BR"):"—"}function bve(e,t,n){if(n||!e&&!t)return"A combinar";const r=s=>`R$ ${Number(s).toLocaleString("pt-BR",{minimumFractionDigits:0})}`;return e&&t?`${r(e)} – ${r(t)}`:e?`A partir de ${r(e)}`:`Até ${r(t)}`}function p8(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/864e5);return n===0?"Hoje":n===1?"Ontem":n<7?`${n} dias atrás`:n<30?`${Math.floor(n/7)} sem. atrás`:wx(e)}const jve={presencial:"Presencial",hibrido:"Híbrido",remoto:"Remoto"},wve={clt:"CLT",pj:"PJ",freelance:"Freelance",estagio:"Estágio",temporario:"Temporário"},rp={novo:"Novo",em_analise:"Em Análise",aprovado:"Aprovado",reprovado:"Reprovado",contratado:"Contratado"},h8={novo:"bg-slate-700 text-slate-300",em_analise:"bg-blue-500/10 text-blue-400 border-blue-500/20",aprovado:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",reprovado:"bg-rose-500/10 text-rose-400 border-rose-500/20",contratado:"bg-violet-500/10 text-violet-400 border-violet-500/20"},Nve={presencial:"bg-amber-500/10 text-amber-400 border-amber-500/20",hibrido:"bg-blue-500/10 text-blue-400 border-blue-500/20",remoto:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"};function eg({label:e,color:t}){return a.jsx("span",{className:`text-[10px] font-black px-2 py-0.5 rounded border ${t}`,children:e})}const Sve={title:"",description:"",requirements:"",benefits:"",location:"",work_mode:"presencial",job_type:"clt",category:"",salary_min:"",salary_max:"",salary_hide:!1,slots:1,active:!0,expires_at:""};function kve({job:e,onClose:t,onSaved:n}){const[r,s]=b.useState(e?{...e,salary_min:e.salary_min??"",salary_max:e.salary_max??"",expires_at:e.expires_at?e.expires_at.slice(0,10):"",requirements:e.requirements||"",benefits:e.benefits||"",location:e.location||"",category:e.category||""}:Sve),[i,o]=b.useState(!1);function l(f,p){s(h=>({...h,[f]:p}))}async function c(f){f.preventDefault(),o(!0);try{const p={...r,salary_min:r.salary_min===""?null:Number(r.salary_min),salary_max:r.salary_max===""?null:Number(r.salary_max),expires_at:r.expires_at||null};e?await Xr.update(e.id,p):await Xr.create(p),n(),t()}catch{alert("Erro ao salvar vaga")}finally{o(!1)}}const u="w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500",d="text-xs font-bold text-slate-400 uppercase tracking-wider";return a.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-2xl max-h-[92vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800 sticky top-0 bg-slate-900 z-10",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:e?"Editar Vaga":"Nova Vaga"}),a.jsx("button",{onClick:t,className:"text-slate-500 hover:text-white",children:a.jsx(Ce,{size:20})})]}),a.jsxs("form",{onSubmit:c,className:"p-6 space-y-5",children:[a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Título da Vaga *"}),a.jsx("input",{required:!0,value:r.title,onChange:f=>l("title",f.target.value),placeholder:"Ex: Desenvolvedor Full Stack",className:`mt-1 ${u}`})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Modo"}),a.jsxs("select",{value:r.work_mode,onChange:f=>l("work_mode",f.target.value),className:`mt-1 ${u}`,children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"presencial",children:"Presencial"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"hibrido",children:"Híbrido"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"remoto",children:"Remoto"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Contrato"}),a.jsxs("select",{value:r.job_type,onChange:f=>l("job_type",f.target.value),className:`mt-1 ${u}`,children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"clt",children:"CLT"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"pj",children:"PJ"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"freelance",children:"Freelance"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"estagio",children:"Estágio"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"temporario",children:"Temporário"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Categoria"}),a.jsx("input",{value:r.category,onChange:f=>l("category",f.target.value),placeholder:"Ex: TI, Saúde...",className:`mt-1 ${u}`})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"col-span-1",children:[a.jsx("label",{className:d,children:"Localização"}),a.jsx("input",{value:r.location,onChange:f=>l("location",f.target.value),placeholder:"Cidade / UF",className:`mt-1 ${u}`})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Nº de Vagas"}),a.jsx("input",{type:"number",min:1,value:r.slots,onChange:f=>l("slots",+f.target.value),className:`mt-1 ${u}`})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Expira em"}),a.jsx("input",{type:"date",value:r.expires_at,onChange:f=>l("expires_at",f.target.value),className:`mt-1 ${u}`})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3 items-end",children:[a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Salário Mín (R$)"}),a.jsx("input",{type:"number",min:0,value:r.salary_min,onChange:f=>l("salary_min",f.target.value),disabled:r.salary_hide,placeholder:"0,00",className:`mt-1 ${u} disabled:opacity-40`})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Salário Máx (R$)"}),a.jsx("input",{type:"number",min:0,value:r.salary_max,onChange:f=>l("salary_max",f.target.value),disabled:r.salary_hide,placeholder:"0,00",className:`mt-1 ${u} disabled:opacity-40`})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pb-2",children:[a.jsx("input",{type:"checkbox",checked:r.salary_hide,onChange:f=>l("salary_hide",f.target.checked),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"A combinar"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Descrição *"}),a.jsx("textarea",{required:!0,rows:5,value:r.description,onChange:f=>l("description",f.target.value),placeholder:"Descreva as responsabilidades e o dia a dia da função...",className:`mt-1 ${u} resize-y`})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Requisitos"}),a.jsx("textarea",{rows:3,value:r.requirements,onChange:f=>l("requirements",f.target.value),placeholder:"Experiência, formação, habilidades exigidas...",className:`mt-1 ${u} resize-y`})]}),a.jsxs("div",{children:[a.jsx("label",{className:d,children:"Benefícios"}),a.jsx("textarea",{rows:3,value:r.benefits,onChange:f=>l("benefits",f.target.value),placeholder:"VT, VR, Plano de saúde, home office...",className:`mt-1 ${u} resize-y`})]}),e&&a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:r.active,onChange:f=>l("active",f.target.checked),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Vaga ativa"})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{type:"button",onClick:t,className:"flex-1 py-2.5 rounded-xl border border-slate-700 text-slate-400 hover:text-white text-sm font-bold",children:"Cancelar"}),a.jsx("button",{type:"submit",disabled:i,className:"flex-1 py-2.5 rounded-xl bg-cyan-500 hover:bg-cyan-400 text-black text-sm font-black disabled:opacity-50",children:i?"Salvando…":e?"Atualizar Vaga":"Publicar Vaga"})]})]})]})})}function m8({app:e,onClose:t,onUpdated:n}){var d,f,p;const[r,s]=b.useState(e.status),[i,o]=b.useState(e.admin_notes||""),[l,c]=b.useState(!1);async function u(){c(!0);try{await Xr.updateApplication(e.id,{status:r,admin_notes:i}),n(),t()}catch{alert("Erro ao atualizar")}finally{c(!1)}}return a.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-end md:items-center justify-center p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-t-3xl md:rounded-3xl w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800 sticky top-0 bg-slate-900 z-10",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-black text-white",children:e.applicant_nome}),a.jsxs("p",{className:"text-slate-500 text-xs mt-0.5",children:["Candidatado em ",wx(e.applied_at)]})]}),a.jsx("button",{onClick:t,className:"text-slate-500 hover:text-white",children:a.jsx(Ce,{size:20})})]}),a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-slate-500 text-xs",children:"CPF"}),a.jsx("p",{className:"text-white font-mono",children:e.applicant_cpf})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-slate-500 text-xs",children:"Telefone"}),a.jsx("p",{className:"text-white",children:e.applicant_phone||"—"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-slate-500 text-xs",children:"Email"}),a.jsx("p",{className:"text-white",children:e.applicant_email||"—"})]}),e.linkedin&&a.jsxs("div",{children:[a.jsx("p",{className:"text-slate-500 text-xs",children:"LinkedIn"}),a.jsx("a",{href:e.linkedin,target:"_blank",className:"text-cyan-400 underline text-xs",children:"Perfil"})]})]}),e.cover_letter&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-400 uppercase tracking-wider mb-2",children:"Carta de Apresentação"}),a.jsx("p",{className:"text-slate-300 text-sm bg-slate-800/40 border border-slate-800 rounded-2xl p-4 whitespace-pre-line",children:e.cover_letter})]}),e.about&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-400 uppercase tracking-wider mb-2",children:"Sobre o Candidato"}),a.jsx("p",{className:"text-slate-300 text-sm whitespace-pre-line",children:e.about})]}),((d=e.experience)==null?void 0:d.length)>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-400 uppercase tracking-wider mb-3",children:"Experiências"}),a.jsx("div",{className:"space-y-3",children:e.experience.map((h,m)=>a.jsxs("div",{className:"border-l-2 border-cyan-500/30 pl-4",children:[a.jsxs("p",{className:"font-black text-white text-sm",children:[h.role," ",a.jsxs("span",{className:"font-normal text-slate-400",children:["@ ",h.company]})]}),a.jsxs("p",{className:"text-slate-500 text-xs",children:[h.start," – ",h.current?"Atual":h.end]}),h.description&&a.jsx("p",{className:"text-slate-400 text-xs mt-1",children:h.description})]},m))})]}),((f=e.education)==null?void 0:f.length)>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-400 uppercase tracking-wider mb-3",children:"Formação"}),a.jsx("div",{className:"space-y-2",children:e.education.map((h,m)=>a.jsxs("div",{className:"border-l-2 border-violet-500/30 pl-4",children:[a.jsxs("p",{className:"font-black text-white text-sm",children:[h.degree," em ",h.course]}),a.jsxs("p",{className:"text-slate-500 text-xs",children:[h.institution," · ",h.start," – ",h.current?"Atual":h.end]})]},m))})]}),((p=e.skills)==null?void 0:p.length)>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-400 uppercase tracking-wider mb-2",children:"Habilidades"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.skills.map((h,m)=>a.jsxs("span",{className:"text-xs font-bold px-2.5 py-1 rounded-full bg-slate-800 border border-slate-700 text-slate-300",children:[h.name," ",a.jsxs("span",{className:"text-slate-500",children:["· ",h.level]})]},m))})]}),e.file_url&&a.jsxs("a",{href:e.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-4 py-2.5 rounded-xl bg-slate-800 border border-slate-700 hover:border-cyan-500/30 text-slate-300 hover:text-white text-sm font-bold transition-all w-fit",children:[a.jsx(m1,{size:14})," Baixar Currículo PDF"]}),a.jsxs("div",{className:"space-y-3 pt-3 border-t border-slate-800",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-black text-slate-400 uppercase tracking-wider block mb-2",children:"Status"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(rp).map(([h,m])=>a.jsx("button",{onClick:()=>s(h),className:`text-xs font-black px-3 py-1.5 rounded-lg border transition-all ${r===h?h8[h]:"bg-slate-800 border-slate-700 text-slate-400 hover:text-white"}`,children:m},h))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-black text-slate-400 uppercase tracking-wider block mb-1",children:"Notas Internas"}),a.jsx("textarea",{rows:3,value:i,onChange:h=>o(h.target.value),placeholder:"Observações internas sobre o candidato...",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 resize-none"})]}),a.jsx("button",{onClick:u,disabled:l,className:"w-full py-3 rounded-xl bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm disabled:opacity-50",children:l?"Salvando…":"Salvar Status e Notas"})]})]})]})})}function Cve({job:e,onClose:t}){const[n,r]=b.useState([]),[s,i]=b.useState(!0),[o,l]=b.useState(""),[c,u]=b.useState(null),d=b.useCallback(async()=>{i(!0);try{const f=await Xr.getApplications(e.id,{status:o||void 0});r(f||[])}catch{r([])}finally{i(!1)}},[e.id,o]);return b.useEffect(()=>{d()},[d]),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/60 z-40",onClick:t}),a.jsxs("aside",{className:"fixed right-0 top-0 h-full w-full max-w-xl bg-slate-900 border-l border-slate-800 z-50 flex flex-col shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-black text-white",children:e.title}),a.jsxs("p",{className:"text-slate-500 text-xs mt-0.5",children:[n.length," candidatos"]})]}),a.jsx("button",{onClick:t,className:"text-slate-500 hover:text-white",children:a.jsx(Ce,{size:20})})]}),a.jsx("div",{className:"flex gap-1.5 p-4 border-b border-slate-800 flex-wrap",children:["",...Object.keys(rp)].map(f=>a.jsx("button",{onClick:()=>l(f),className:`text-[10px] font-black px-2.5 py-1 rounded-lg border transition-all ${o===f?"bg-cyan-500/10 border-cyan-500/30 text-cyan-400":"border-slate-700 text-slate-500 hover:text-slate-300"}`,children:f?rp[f]:"Todos"},f||"all"))}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[s&&a.jsx("div",{className:"flex justify-center py-12",children:a.jsx("div",{className:"w-7 h-7 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}),!s&&n.length===0&&a.jsx("p",{className:"text-slate-600 italic text-center py-12",children:"Nenhum candidato"}),n.map(f=>a.jsxs("div",{onClick:()=>u(f),className:"bg-slate-800/40 border border-slate-800 hover:border-slate-700 rounded-2xl p-4 cursor-pointer transition-all hover:bg-slate-800/60",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-white text-sm",children:f.applicant_nome}),a.jsx("p",{className:"text-slate-500 text-xs font-mono",children:f.applicant_cpf})]}),a.jsx("span",{className:`text-[10px] font-black px-2 py-0.5 rounded border shrink-0 ${h8[f.status]}`,children:rp[f.status]})]}),a.jsx("p",{className:"text-slate-500 text-xs mt-2",children:p8(f.applied_at)}),f.cover_letter&&a.jsxs("p",{className:"text-slate-500 text-xs mt-1 line-clamp-1 italic",children:['"',f.cover_letter,'"']})]},f.id))]})]}),c&&a.jsx(m8,{app:c,onClose:()=>u(null),onUpdated:d})]})}function _ve({onBack:e}){const[t,n]=b.useState([]),[r,s]=b.useState(""),[i,o]=b.useState(!1),[l,c]=b.useState(null),u=b.useCallback(async()=>{o(!0);try{const f=await Xr.searchResumes({search:r||void 0,limit:100});n(f||[])}catch{n([])}finally{o(!1)}},[r]);b.useEffect(()=>{const f=setTimeout(u,300);return()=>clearTimeout(f)},[u]);function d(f){return f.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/,"$1.$2.$3-$4")}return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:e,className:"text-slate-400 hover:text-white",children:a.jsx(Ui,{size:20})}),a.jsx("h3",{className:"text-2xl font-black text-white",children:"Banco de Currículos"})]}),a.jsxs("div",{className:"relative",children:[a.jsx(Ir,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsx("input",{value:r,onChange:f=>s(f.target.value),placeholder:"Buscar por nome ou CPF...",className:"w-full pl-9 pr-4 py-2.5 bg-slate-900 border border-slate-800 rounded-xl text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl overflow-hidden",children:i?a.jsx("div",{className:"flex justify-center py-12",children:a.jsx("div",{className:"w-7 h-7 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsx("tr",{className:"border-b border-slate-800",children:["Nome","CPF","E-mail","Telefone","Candidaturas","Atualizado",""].map(f=>a.jsx("th",{className:"text-left px-5 py-4 text-[10px] font-black uppercase tracking-widest text-slate-500 whitespace-nowrap",children:f},f))})}),a.jsxs("tbody",{children:[t.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"text-center py-12 text-slate-600 italic",children:"Nenhum currículo encontrado"})}),t.map(f=>a.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/30 transition-colors",children:[a.jsx("td",{className:"px-5 py-3.5 font-bold text-white",children:f.user_nome}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 font-mono text-xs",children:d(f.user_cpf)}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 text-xs",children:f.email||"—"}),a.jsx("td",{className:"px-5 py-3.5 text-slate-400 text-xs",children:f.phone||"—"}),a.jsx("td",{className:"px-5 py-3.5 text-center",children:a.jsx("span",{className:"text-xs font-black text-cyan-400 bg-cyan-500/10 px-2 py-0.5 rounded",children:f.applications_count})}),a.jsx("td",{className:"px-5 py-3.5 text-slate-500 text-xs",children:wx(f.updated_at)}),a.jsx("td",{className:"px-5 py-3.5",children:a.jsxs("button",{onClick:()=>{Xr.getResume(f.user_cpf).then(p=>c(p))},className:"text-xs font-bold px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 flex items-center gap-1",children:[a.jsx($p,{size:12})," Ver"]})})]},f.id))]})]})}),l&&a.jsx(m8,{app:{...l,id:0,applicant_nome:l.user_nome,applicant_cpf:l.user_cpf,applicant_email:l.email,applicant_phone:l.phone,cover_letter:null,status:"novo",applied_at:l.created_at,admin_notes:null},onClose:()=>c(null),onUpdated:()=>{}})]})}function Ave(){const[e,t]=b.useState("jobs"),[n,r]=b.useState([]),[s,i]=b.useState(0),[o,l]=b.useState({active:0,inactive:0,total_applications:0,hired:0}),[c,u]=b.useState(!0),[d,f]=b.useState(null),[p,h]=b.useState(null),[m,v]=b.useState(""),[x,y]=b.useState(""),[g,j]=b.useState(""),N=b.useCallback(async()=>{u(!0);try{const[k,C]=await Promise.all([Xr.list({search:m||void 0,work_mode:x||void 0,active:g===""?void 0:g,limit:50}),Xr.kpi()]);r(k.jobs||[]),i(k.total||0),l(C)}catch{r([])}finally{u(!1)}},[m,x,g]);b.useEffect(()=>{const k=setTimeout(N,300);return()=>clearTimeout(k)},[N]);async function w(k){await Xr.toggle(k.id),N()}async function S(k){const C=`Excluir a vaga "${k.title}"? + +Se houver candidaturas ela será desativada em vez de excluída.`;if(!confirm(C))return;(await Xr.remove(k.id)).deactivated&&alert("Vaga desativada pois possui candidaturas."),N()}return e==="resumes"?a.jsx(_ve,{onBack:()=>t("jobs")}):a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-4xl font-black text-white tracking-tighter",children:"Vagas & Talentos"}),a.jsx("p",{className:"text-slate-400 mt-1",children:"Gestão completa de vagas, candidatos e currículos."})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{onClick:()=>t("resumes"),className:"flex items-center gap-2 px-4 py-2.5 border border-slate-700 hover:border-slate-600 text-slate-400 hover:text-white rounded-xl text-sm font-bold transition-all",children:[a.jsx(Hr,{size:15})," Currículos"]}),a.jsxs("button",{onClick:()=>f("new"),className:"flex items-center gap-2 px-5 py-2.5 bg-cyan-500 hover:bg-cyan-400 text-black font-black text-sm rounded-xl transition-colors",children:[a.jsx(Oe,{size:16})," Nova Vaga"]})]})]}),a.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[{label:"Vagas Ativas",value:o.active,icon:mm,color:"cyan"},{label:"Vagas Encerradas",value:o.inactive,icon:Xo,color:"slate"},{label:"Total Candidatos",value:o.total_applications,icon:et,color:"violet"},{label:"Contratações",value:o.hired,icon:Tl,color:"emerald"}].map(({label:k,value:C,icon:_,color:A})=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-6 hover:border-slate-700 transition-all",children:[a.jsx("div",{className:`p-3 rounded-2xl bg-slate-800 border border-white/5 text-${A}-400 w-fit mb-4`,children:a.jsx(_,{size:22})}),a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:k}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums tracking-tighter",children:C})]},k))}),a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[a.jsx(Ir,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsx("input",{value:m,onChange:k=>v(k.target.value),placeholder:"Buscar por título...",className:"w-full pl-9 pr-4 py-2.5 bg-slate-900 border border-slate-800 rounded-xl text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("select",{value:x,onChange:k=>y(k.target.value),className:"bg-slate-900 border border-slate-800 rounded-xl px-3 py-2.5 text-sm text-white focus:outline-none focus:border-cyan-500",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Todos os modos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"presencial",children:"Presencial"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"hibrido",children:"Híbrido"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"remoto",children:"Remoto"})]}),a.jsxs("select",{value:g,onChange:k=>j(k.target.value),className:"bg-slate-900 border border-slate-800 rounded-xl px-3 py-2.5 text-sm text-white focus:outline-none focus:border-cyan-500",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Ativas e inativas"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"true",children:"Somente ativas"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"false",children:"Somente inativas"})]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl overflow-hidden overflow-x-auto",children:[c?a.jsx("div",{className:"flex justify-center py-16",children:a.jsx("div",{className:"w-8 h-8 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsx("tr",{className:"border-b border-slate-800",children:["Título","Modo","Tipo","Salário","Publicado","Expira","Candidatos","Status",""].map(k=>a.jsx("th",{className:"text-left px-4 py-4 text-[10px] font-black uppercase tracking-widest text-slate-500 whitespace-nowrap",children:k},k))})}),a.jsxs("tbody",{children:[n.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"text-center py-16 text-slate-600 italic",children:"Nenhuma vaga encontrada"})}),n.map(k=>a.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/20 transition-colors",children:[a.jsxs("td",{className:"px-4 py-3.5",children:[a.jsx("p",{className:"font-bold text-white",children:k.title}),k.location&&a.jsxs("p",{className:"text-slate-500 text-xs flex items-center gap-1 mt-0.5",children:[a.jsx(gm,{size:10})," ",k.location]}),k.category&&a.jsx("p",{className:"text-slate-600 text-xs",children:k.category})]}),a.jsx("td",{className:"px-4 py-3.5",children:a.jsx(eg,{label:jve[k.work_mode]||k.work_mode,color:Nve[k.work_mode]||"bg-slate-700 text-slate-300"})}),a.jsx("td",{className:"px-4 py-3.5 text-slate-400 text-xs whitespace-nowrap",children:wve[k.job_type]||k.job_type}),a.jsx("td",{className:"px-4 py-3.5 text-slate-400 text-xs whitespace-nowrap",children:bve(k.salary_min,k.salary_max,k.salary_hide)}),a.jsx("td",{className:"px-4 py-3.5 text-slate-500 text-xs whitespace-nowrap",children:p8(k.published_at)}),a.jsx("td",{className:"px-4 py-3.5 text-slate-500 text-xs whitespace-nowrap",children:k.expires_at?wx(k.expires_at):"—"}),a.jsx("td",{className:"px-4 py-3.5",children:a.jsxs("button",{onClick:()=>h(k),className:"flex items-center gap-1.5 text-xs font-black text-cyan-400 hover:text-cyan-300 bg-cyan-500/10 border border-cyan-500/20 px-2.5 py-1 rounded-lg transition-all",children:[a.jsx(et,{size:11})," ",k.applicants_count]})}),a.jsx("td",{className:"px-4 py-3.5",children:k.active?a.jsx(eg,{label:"Ativa",color:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"}):a.jsx(eg,{label:"Inativa",color:"bg-slate-700 text-slate-400 border-slate-600"})}),a.jsx("td",{className:"px-4 py-3.5",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>f(k),title:"Editar",className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:a.jsx(Er,{size:13})}),a.jsx("button",{onClick:()=>w(k),title:k.active?"Desativar":"Ativar",className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:k.active?a.jsx(Ss,{size:15,className:"text-emerald-400"}):a.jsx(Ns,{size:15})}),a.jsx("button",{onClick:()=>S(k),title:"Excluir",className:"p-1.5 rounded-lg hover:bg-rose-500/10 text-slate-400 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:13})})]})})]},k.id))]})]}),s>50&&a.jsxs("div",{className:"px-5 py-3 border-t border-slate-800 text-xs text-slate-500",children:["Mostrando 50 de ",s," vagas"]})]}),d!==null&&a.jsx(kve,{job:d==="new"?null:d,onClose:()=>f(null),onSaved:N}),p&&a.jsx(Cve,{job:p,onClose:()=>h(null)})]})}const tg=e=>Number(e).toLocaleString("pt-BR",{style:"currency",currency:"BRL"});function JC({children:e,color:t="slate"}){const n={emerald:"bg-emerald-400/10 text-emerald-400",rose:"bg-rose-400/10 text-rose-400",slate:"bg-slate-700 text-slate-400",cyan:"bg-cyan-400/10 text-cyan-400"};return a.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-lg text-[10px] font-black uppercase tracking-widest ${n[t]||n.slate}`,children:e})}function Pve({produto:e,categorias:t,onClose:n,onSave:r}){const s=!!e,[i,o]=b.useState({sku:(e==null?void 0:e.sku)||"",nome:(e==null?void 0:e.nome)||"",descricao:(e==null?void 0:e.descricao)||"",unidade:(e==null?void 0:e.unidade)||"un",preco:(e==null?void 0:e.preco)??"",preco_promocional:(e==null?void 0:e.preco_promocional)??"",estoque:(e==null?void 0:e.estoque)??"",categoria:(e==null?void 0:e.categoria)||"",ativo:(e==null?void 0:e.ativo)!==!1}),[l,c]=b.useState(!1),[u,d]=b.useState(""),f=h=>m=>o(v=>({...v,[h]:m.target.value}));async function p(){var h,m;if(d(""),!i.nome.trim())return d("Nome é obrigatório");if(i.preco===""||isNaN(Number(i.preco)))return d("Preço inválido");c(!0);try{const v={...i,preco:Number(i.preco),preco_promocional:i.preco_promocional!==""?Number(i.preco_promocional):null,estoque:Number(i.estoque)||0};s?await zo.update(e.id,v):await zo.create(v),r()}catch(v){d(((m=(h=v.response)==null?void 0:h.data)==null?void 0:m.error)||"Erro ao salvar")}finally{c(!1)}}return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-lg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:s?"Editar Produto":"Novo Produto"}),a.jsx("button",{onClick:n,className:"text-slate-500 hover:text-white transition-colors",children:a.jsx(Ce,{size:20})})]}),a.jsxs("div",{className:"p-6 space-y-4 max-h-[70vh] overflow-y-auto",children:[u&&a.jsx("p",{className:"text-rose-400 text-sm bg-rose-400/10 px-3 py-2 rounded-xl",children:u}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"SKU"}),a.jsx("input",{value:i.sku,onChange:f("sku"),placeholder:"ex: ARROZ-5KG",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Unidade"}),a.jsx("select",{value:i.unidade,onChange:f("unidade"),className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500",children:["un","kg","lt","cx","pct","fdo","dz"].map(h=>a.jsx("option",{className:"bg-slate-900 text-white",children:h},h))})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Nome *"}),a.jsx("input",{value:i.nome,onChange:f("nome"),placeholder:"Nome do produto",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Descrição"}),a.jsx("textarea",{value:i.descricao,onChange:f("descricao"),rows:2,className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 resize-none"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Preço *"}),a.jsx("input",{type:"number",step:"0.01",value:i.preco,onChange:f("preco"),placeholder:"0,00",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:["Preço Promo ",a.jsx("span",{className:"text-slate-600 normal-case font-normal",children:"(opcional)"})]}),a.jsx("input",{type:"number",step:"0.01",value:i.preco_promocional,onChange:f("preco_promocional"),placeholder:"—",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-emerald-500"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Estoque"}),a.jsx("input",{type:"number",step:"0.001",value:i.estoque,onChange:f("estoque"),placeholder:"0",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsx("div",{className:"flex items-end pb-2",children:i.preco_promocional!==""&&Number(i.preco_promocional)>0&&Number(i.preco)>0&&a.jsxs("p",{className:"text-xs text-emerald-400 font-bold",children:[Math.round((1-Number(i.preco_promocional)/Number(i.preco))*100),"% de desconto"]})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-400 uppercase tracking-widest mb-1",children:"Categoria"}),a.jsx("input",{value:i.categoria,onChange:f("categoria"),list:"cats",placeholder:"ex: Bebidas",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"}),a.jsx("datalist",{id:"cats",children:t.map(h=>a.jsx("option",{className:"bg-slate-900 text-white",value:h},h))})]}),s&&a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[a.jsx("div",{className:`w-10 h-6 rounded-full transition-colors ${i.ativo?"bg-emerald-500":"bg-slate-700"}`,onClick:()=>o(h=>({...h,ativo:!h.ativo})),children:a.jsx("div",{className:`w-4 h-4 bg-white rounded-full mt-1 transition-all ${i.ativo?"ml-5":"ml-1"}`})}),a.jsx("span",{className:"text-sm text-slate-300 font-medium",children:"Produto ativo"})]})]}),a.jsxs("div",{className:"p-6 border-t border-slate-800 flex gap-3 justify-end",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 text-slate-400 hover:text-white transition-colors text-sm font-bold",children:"Cancelar"}),a.jsxs("button",{onClick:p,disabled:l,className:"px-6 py-2 bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[l?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(jt,{size:14}),s?"Salvar":"Criar"]})]})]})})}function Eve({onClose:e,onDone:t}){var m;const[n,r]=b.useState(""),[s,i]=b.useState(null),[o,l]=b.useState(!1),[c,u]=b.useState(""),d=b.useRef(null);function f(v){const x=v.trim().split(` +`),y=x[0].split(";").map(g=>g.trim().toLowerCase().replace(/"/g,""));return x.slice(1).map(g=>{const j=g.split(";").map(w=>w.trim().replace(/"/g,"")),N={};return y.forEach((w,S)=>{N[w]=j[S]||""}),N}).filter(g=>g.nome||g.sku)}async function p(){var x,y;if(u(""),i(null),!n.trim())return u("Cole o conteúdo CSV ou carregue um arquivo");const v=f(n);if(!v.length)return u("Nenhum produto válido encontrado no CSV");l(!0);try{const g=await zo.importar(v.map(j=>({sku:j.sku||j.codigo,nome:j.nome||j.descricao,descricao:j.observacao||"",unidade:j.unidade||"un",preco:parseFloat((j.preco||"0").replace(",",".")),estoque:parseFloat((j.estoque||j.quantidade||"0").replace(",",".")),categoria:j.categoria||j.grupo||""})));i(g)}catch(g){u(((y=(x=g.response)==null?void 0:x.data)==null?void 0:y.error)||"Erro na importação")}finally{l(!1)}}function h(v){var g;const x=(g=v.target.files)==null?void 0:g[0];if(!x)return;const y=new FileReader;y.onload=j=>{var N;return r(((N=j.target)==null?void 0:N.result)||"")},y.readAsText(x,"utf-8")}return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-2xl shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800",children:[a.jsxs("h3",{className:"text-lg font-black text-white flex items-center gap-2",children:[a.jsx(Uf,{size:18,className:"text-cyan-400"})," Importar CSV"]}),a.jsx("button",{onClick:e,className:"text-slate-500 hover:text-white",children:a.jsx(Ce,{size:20})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("p",{className:"text-slate-400 text-sm",children:["Colunas esperadas (separadas por ",a.jsx("code",{className:"text-cyan-400 text-xs",children:";"}),"):"]}),a.jsx("code",{className:"block bg-slate-800 rounded-xl px-4 py-3 text-xs text-slate-300",children:"sku;nome;descricao;unidade;preco;estoque;categoria"}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("button",{onClick:()=>{var v;return(v=d.current)==null?void 0:v.click()},className:"flex items-center gap-2 px-4 py-2 bg-slate-800 hover:bg-slate-700 rounded-xl text-sm text-slate-300 font-bold transition-colors",children:[a.jsx(Uf,{size:14})," Carregar arquivo"]}),a.jsx("input",{ref:d,type:"file",accept:".csv,.txt",className:"hidden",onChange:h})]}),a.jsx("textarea",{value:n,onChange:v=>r(v.target.value),rows:8,placeholder:"Ou cole o CSV aqui...",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-xs text-slate-300 font-mono focus:outline-none focus:border-cyan-500 resize-none"}),c&&a.jsx("p",{className:"text-rose-400 text-sm bg-rose-400/10 px-3 py-2 rounded-xl",children:c}),s&&a.jsxs("div",{className:"bg-slate-800 rounded-xl p-4 space-y-1 text-sm",children:[a.jsxs("p",{className:"text-emerald-400 font-bold",children:["Inseridos: ",s.inseridos]}),a.jsxs("p",{className:"text-cyan-400 font-bold",children:["Atualizados: ",s.atualizados]}),((m=s.erros)==null?void 0:m.length)>0&&a.jsxs("div",{className:"text-rose-400",children:[a.jsxs("p",{className:"font-bold",children:["Erros (",s.erros.length,"):"]}),a.jsx("ul",{className:"list-disc list-inside text-xs mt-1 space-y-0.5",children:s.erros.map((v,x)=>a.jsxs("li",{children:[v.sku,": ",v.erro]},x))})]})]})]}),a.jsx("div",{className:"p-6 border-t border-slate-800 flex gap-3 justify-end",children:s?a.jsx("button",{onClick:()=>{t(),e()},className:"px-6 py-2 bg-emerald-500 hover:bg-emerald-400 rounded-xl text-black font-black text-sm transition-colors",children:"Concluído"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:e,className:"px-4 py-2 text-slate-400 hover:text-white transition-colors text-sm font-bold",children:"Cancelar"}),a.jsxs("button",{onClick:p,disabled:o,className:"px-6 py-2 bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[o?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(Uf,{size:14}),"Importar"]})]})})]})})}function Ove(){const[e,t]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState(!0),[o,l]=b.useState(""),[c,u]=b.useState(""),[d,f]=b.useState(null),[p,h]=b.useState(null);async function m(){i(!0);try{const[g,j]=await Promise.all([zo.list({search:o||void 0,categoria:c||void 0}),zo.categorias()]);t(g),r(j)}catch(g){console.error(g)}finally{i(!1)}}b.useEffect(()=>{m()},[o,c]);async function v(g){confirm("Remover produto?")&&(await zo.delete(g),m())}const x=e.filter(g=>g.ativo).length,y=e.filter(g=>Number(g.estoque)<=0).length;return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex flex-wrap justify-between items-start gap-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-3xl font-black text-white tracking-tighter flex items-center gap-3",children:[a.jsx(bs,{className:"text-cyan-400",size:28})," Catálogo de Produtos"]}),a.jsxs("p",{className:"text-slate-400 mt-1 font-medium",children:[e.length," produtos · ",x," ativos · ",y," sem estoque"]})]}),a.jsxs("div",{className:"flex gap-3 flex-wrap",children:[a.jsxs("button",{onClick:()=>f("import"),className:"flex items-center gap-2 px-4 py-2 bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-xl text-sm text-slate-300 font-bold transition-colors",children:[a.jsx(Uf,{size:16})," Importar CSV"]}),a.jsxs("button",{onClick:()=>{h(null),f("new")},className:"flex items-center gap-2 px-4 py-2 bg-cyan-500 hover:bg-cyan-400 rounded-xl text-black font-black text-sm transition-colors",children:[a.jsx(Oe,{size:16})," Novo Produto"]})]})]}),a.jsxs("div",{className:"flex gap-3 flex-wrap",children:[a.jsxs("div",{className:"relative flex-1 min-w-48",children:[a.jsx(Ir,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsx("input",{value:o,onChange:g=>l(g.target.value),placeholder:"Buscar por nome, SKU...",className:"w-full bg-slate-900 border border-slate-800 rounded-xl pl-9 pr-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{className:"relative",children:[a.jsx(Xo,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsxs("select",{value:c,onChange:g=>u(g.target.value),className:"bg-slate-900 border border-slate-800 rounded-xl pl-9 pr-8 py-2 text-sm text-slate-300 focus:outline-none focus:border-cyan-500 appearance-none cursor-pointer",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Todas as categorias"}),n.map(g=>a.jsx("option",{className:"bg-slate-900 text-white",value:g,children:g},g))]}),a.jsx(aa,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]}),a.jsx("button",{onClick:m,className:"p-2 bg-slate-900 border border-slate-800 rounded-xl text-slate-400 hover:text-white transition-colors",children:a.jsx(ke,{size:16,className:s?"animate-spin":""})})]}),a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl overflow-hidden",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-slate-800 text-left",children:[a.jsx("th",{className:"px-6 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Produto"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"SKU"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Categoria"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest text-right",children:"Preço"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest text-right",children:"Estoque"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Status"}),a.jsx("th",{className:"px-4 py-4"})]})}),a.jsx("tbody",{children:s?[...Array(5)].map((g,j)=>a.jsx("tr",{className:"border-b border-slate-800/50 animate-pulse",children:[...Array(7)].map((N,w)=>a.jsx("td",{className:"px-4 py-4",children:a.jsx("div",{className:"h-4 bg-slate-800 rounded w-full"})},w))},j)):e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-6 py-16 text-center text-slate-600 text-sm italic",children:"Nenhum produto encontrado. Importe um CSV ou crie manualmente."})}):e.map(g=>a.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/20 transition-colors group",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-white",children:g.nome}),g.descricao&&a.jsx("p",{className:"text-xs text-slate-500 truncate max-w-48",children:g.descricao})]})}),a.jsx("td",{className:"px-4 py-4 text-slate-400 font-mono text-xs",children:g.sku||"—"}),a.jsx("td",{className:"px-4 py-4",children:g.categoria?a.jsx(JC,{color:"cyan",children:g.categoria}):a.jsx("span",{className:"text-slate-600 text-xs",children:"—"})}),a.jsx("td",{className:"px-4 py-4 text-right tabular-nums",children:g.preco_promocional?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs text-slate-500 line-through",children:tg(g.preco)}),a.jsx("p",{className:"font-bold text-emerald-400",children:tg(g.preco_promocional)})]}):a.jsx("span",{className:"font-bold text-white",children:tg(g.preco)})}),a.jsx("td",{className:"px-4 py-4 text-right tabular-nums",children:a.jsxs("span",{className:`font-bold ${Number(g.estoque)<=0?"text-rose-400":Number(g.estoque)<5?"text-yellow-400":"text-slate-300"}`,children:[Number(g.estoque).toLocaleString("pt-BR")," ",g.unidade]})}),a.jsx("td",{className:"px-4 py-4",children:a.jsx(JC,{color:g.ativo?"emerald":"rose",children:g.ativo?"Ativo":"Inativo"})}),a.jsx("td",{className:"px-4 py-4",children:a.jsxs("div",{className:"flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity justify-end",children:[a.jsx("button",{onClick:()=>{h(g),f("edit")},className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",children:a.jsx(HP,{size:14})}),a.jsx("button",{onClick:()=>v(g.id),className:"p-2 rounded-lg bg-slate-800 hover:bg-rose-500/20 text-slate-400 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:14})})]})})]},g.id))})]})})}),!s&&e.length>0&&a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{label:"Total",value:e.length,icon:bs,color:"text-cyan-400"},{label:"Ativos",value:x,icon:jt,color:"text-emerald-400"},{label:"Sem estoque",value:y,icon:yu,color:"text-rose-400"},{label:"Categorias",value:n.length,icon:Xo,color:"text-purple-400"}].map(g=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-4 flex items-center gap-3",children:[a.jsx(g.icon,{size:20,className:g.color}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest",children:g.label}),a.jsx("p",{className:"text-xl font-black text-white tabular-nums",children:g.value})]})]},g.label))}),(d==="new"||d==="edit")&&a.jsx(Pve,{produto:d==="edit"?p:null,categorias:n,onClose:()=>f(null),onSave:()=>{f(null),m()}}),d==="import"&&a.jsx(Eve,{onClose:()=>f(null),onDone:m})]})}function Xa({children:e,color:t="slate"}){const n={emerald:"bg-emerald-400/10 text-emerald-400 border-emerald-400/20",rose:"bg-rose-400/10 text-rose-400 border-rose-400/20",cyan:"bg-cyan-400/10 text-cyan-400 border-cyan-400/20",purple:"bg-purple-400/10 text-purple-400 border-purple-400/20",slate:"bg-slate-800 text-slate-400 border-slate-700"};return a.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-lg text-[10px] font-black uppercase tracking-widest border ${n[t]||n.slate}`,children:e})}function Yt({label:e,...t}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-500 uppercase tracking-widest mb-1",children:e}),a.jsx("input",{...t,className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 placeholder:text-slate-600 disabled:opacity-50"})]})}function ng({label:e,children:t,...n}){return a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-500 uppercase tracking-widest mb-1",children:e}),a.jsx("select",{...n,className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500 appearance-none cursor-pointer",children:t})]})}const Tve=e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),$ve=e=>e.replace(/\D/g,"").slice(0,14).replace(/(\d{2})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1/$2").replace(/(\d{4})(\d{1,2})$/,"$1-$2");async function Mve(e){const t=e.replace(/\D/g,"");if(t.length!==8)return null;try{const r=await(await fetch(`https://viacep.com.br/ws/${t}/json/`)).json();return r.erro?null:r}catch{return null}}function Rve({cliente:e,onClose:t,onSave:n}){const r=!!e,[s,i]=b.useState("dados"),[o,l]=b.useState(!1),[c,u]=b.useState(""),[d,f]=b.useState((e==null?void 0:e.tipo)||"PF"),[p,h]=b.useState((e==null?void 0:e.nome)||""),[m,v]=b.useState((e==null?void 0:e.cpf_cnpj)||""),[x,y]=b.useState((e==null?void 0:e.email)||""),[g,j]=b.useState((e==null?void 0:e.status)||"ativo"),[N,w]=b.useState([]),[S,k]=b.useState(!1),[C,_]=b.useState({tipo:"entrega",cep:"",rua:"",numero:"",complemento:"",bairro:"",cidade:"",estado:"",referencia:"",principal:!1}),[A,E]=b.useState([]),[P,D]=b.useState({tipo:"celular",numero:"",ramal:"",aceita_whatsapp:!1,principal:!1}),[I,R]=b.useState([]),[M,W]=b.useState({nome:"",cargo:"",setor:"",email:"",permissao:""});b.useEffect(()=>{!r||!(e!=null&&e.id)||(s==="enderecos"&&N.length===0&&(k(!0),Qt.listEnderecos(e.id).then(w).finally(()=>k(!1))),s==="telefones"&&A.length===0&&Qt.listTelefones(e.id).then(E),s==="responsaveis"&&I.length===0&&Qt.listResponsaveis(e.id).then(R))},[s]);async function T(){var H,le;if(u(""),!p.trim())return u("Nome é obrigatório");if(!m.trim())return u("CPF/CNPJ é obrigatório");l(!0);try{const Z={tipo:d,nome:p.trim(),cpf_cnpj:m.replace(/\D/g,""),email:x,status:g};r?await Qt.update(e.id,Z):await Qt.create(Z),n()}catch(Z){u(((le=(H=Z.response)==null?void 0:H.data)==null?void 0:le.error)||"Erro ao salvar")}finally{l(!1)}}async function V(){const H=await Mve(C.cep);H&&_(le=>({...le,rua:H.logradouro,bairro:H.bairro,cidade:H.localidade,estado:H.uf}))}async function X(){if(!C.rua)return;await Qt.addEndereco(e.id,C);const H=await Qt.listEnderecos(e.id);w(H),_({tipo:"entrega",cep:"",rua:"",numero:"",complemento:"",bairro:"",cidade:"",estado:"",referencia:"",principal:!1})}async function U(H){await Qt.deleteEndereco(e.id,H),w(le=>le.filter(Z=>Z.id!==H))}async function L(){if(!P.numero)return;await Qt.addTelefone(e.id,P);const H=await Qt.listTelefones(e.id);E(H),D({tipo:"celular",numero:"",ramal:"",aceita_whatsapp:!1,principal:!1})}async function B(H){await Qt.deleteTelefone(e.id,H),E(le=>le.filter(Z=>Z.id!==H))}async function ae(){if(!M.nome)return;await Qt.addResponsavel(e.id,M);const H=await Qt.listResponsaveis(e.id);R(H),W({nome:"",cargo:"",setor:"",email:"",permissao:""})}async function se(H){await Qt.deleteResponsavel(e.id,H),R(le=>le.filter(Z=>Z.id!==H))}const xe=[{id:"dados",label:"Dados Gerais",icon:ks},{id:"enderecos",label:"Endereços",icon:gm,disabled:!r},{id:"telefones",label:"Telefones",icon:wu,disabled:!r},{id:"responsaveis",label:"Responsáveis",icon:Tl,disabled:!r}];return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl w-full max-w-2xl shadow-2xl flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-800 shrink-0",children:[a.jsx("h3",{className:"text-lg font-black text-white",children:r?"Editar Cliente":"Novo Cliente"}),a.jsx("button",{onClick:t,className:"text-slate-500 hover:text-white transition-colors",children:a.jsx(Ce,{size:20})})]}),a.jsx("div",{className:"flex border-b border-slate-800 px-6 shrink-0 overflow-x-auto",children:xe.map(H=>a.jsxs("button",{onClick:()=>!H.disabled&&i(H.id),disabled:H.disabled,className:`flex items-center gap-2 px-4 py-3 text-xs font-black uppercase tracking-widest border-b-2 transition-colors whitespace-nowrap + ${s===H.id?"border-cyan-500 text-cyan-400":H.disabled?"border-transparent text-slate-700 cursor-not-allowed":"border-transparent text-slate-500 hover:text-slate-300"}`,children:[a.jsx(H.icon,{size:14}),H.label,H.disabled&&a.jsx("span",{className:"text-[9px] text-slate-700",children:"(salve primeiro)"})]},H.id))}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[c&&a.jsx("p",{className:"text-rose-400 text-sm bg-rose-400/10 px-3 py-2 rounded-xl",children:c}),s==="dados"&&a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex gap-3",children:["PF","PJ"].map(H=>a.jsxs("button",{onClick:()=>f(H),className:`flex-1 flex items-center justify-center gap-2 py-3 rounded-xl border font-black text-sm transition-colors + ${d===H?"border-cyan-500 bg-cyan-500/10 text-cyan-400":"border-slate-700 text-slate-500 hover:border-slate-600"}`,children:[H==="PF"?a.jsx(ks,{size:16}):a.jsx(f1,{size:16}),H==="PF"?"Pessoa Física":"Pessoa Jurídica"]},H))}),a.jsx(Yt,{label:d==="PF"?"Nome completo *":"Razão Social *",value:p,onChange:H=>h(H.target.value),placeholder:d==="PF"?"João da Silva":"Empresa Ltda"}),a.jsx(Yt,{label:d==="PF"?"CPF *":"CNPJ *",value:d==="PF"?Tve(m):$ve(m),onChange:H=>v(H.target.value),placeholder:d==="PF"?"000.000.000-00":"00.000.000/0000-00"}),a.jsx(Yt,{label:"E-mail",type:"email",value:x,onChange:H=>y(H.target.value),placeholder:"email@exemplo.com"}),r&&a.jsxs(ng,{label:"Status",value:g,onChange:H=>j(H.target.value),children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"ativo",children:"Ativo"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"inativo",children:"Inativo"})]})]}),s==="enderecos"&&a.jsx("div",{className:"space-y-4",children:S?a.jsx("p",{className:"text-slate-500 text-sm",children:"Carregando..."}):a.jsxs(a.Fragment,{children:[N.map(H=>a.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-xl p-4 flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(Xa,{color:"cyan",children:H.tipo}),H.principal&&a.jsx(Xa,{color:"emerald",children:"Principal"})]}),a.jsxs("p",{className:"text-sm text-white font-medium",children:[H.rua,", ",H.numero," ",H.complemento||""]}),a.jsxs("p",{className:"text-xs text-slate-400",children:[H.bairro," — ",H.cidade,"/",H.estado," · CEP ",H.cep]}),H.referencia&&a.jsxs("p",{className:"text-xs text-slate-500 mt-0.5",children:["Ref: ",H.referencia]})]}),a.jsx("button",{onClick:()=>U(H.id),className:"p-1.5 text-slate-600 hover:text-rose-400 transition-colors shrink-0",children:a.jsx(Te,{size:14})})]},H.id)),a.jsxs("div",{className:"bg-slate-800/30 border border-dashed border-slate-700 rounded-xl p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest",children:"Adicionar endereço"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(ng,{label:"Tipo",value:C.tipo,onChange:H=>_(le=>({...le,tipo:H.target.value})),children:["entrega","cobranca","retirada","matriz","filial"].map(H=>a.jsx("option",{className:"bg-slate-900 text-white",children:H},H))}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-black text-slate-500 uppercase tracking-widest mb-1",children:"CEP"}),a.jsx("div",{className:"flex gap-2",children:a.jsx("input",{value:C.cep,onChange:H=>_(le=>({...le,cep:H.target.value})),onBlur:V,placeholder:"00000-000",className:"flex-1 bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})})]})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsx("div",{className:"col-span-2",children:a.jsx(Yt,{label:"Rua",value:C.rua,onChange:H=>_(le=>({...le,rua:H.target.value})),placeholder:"Rua..."})}),a.jsx(Yt,{label:"Número",value:C.numero,onChange:H=>_(le=>({...le,numero:H.target.value})),placeholder:"123"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Yt,{label:"Bairro",value:C.bairro,onChange:H=>_(le=>({...le,bairro:H.target.value})),placeholder:"Bairro"}),a.jsx(Yt,{label:"Cidade",value:C.cidade,onChange:H=>_(le=>({...le,cidade:H.target.value})),placeholder:"Cidade"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Yt,{label:"Estado (UF)",value:C.estado,onChange:H=>_(le=>({...le,estado:H.target.value.toUpperCase().slice(0,2)})),placeholder:"SP"}),a.jsx(Yt,{label:"Complemento",value:C.complemento,onChange:H=>_(le=>({...le,complemento:H.target.value})),placeholder:"Apto, bloco..."})]}),a.jsx(Yt,{label:"Referência",value:C.referencia,onChange:H=>_(le=>({...le,referencia:H.target.value})),placeholder:"Próximo ao mercado..."}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:C.principal,onChange:H=>_(le=>({...le,principal:H.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Definir como endereço principal"})]}),a.jsxs("button",{onClick:X,className:"px-4 py-2 bg-cyan-500 hover:bg-cyan-400 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[a.jsx(Oe,{size:14})," Adicionar"]})]})]})}),s==="telefones"&&a.jsxs("div",{className:"space-y-4",children:[A.map(H=>a.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-xl p-4 flex items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(wu,{size:16,className:"text-slate-500"}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Xa,{color:"cyan",children:H.tipo}),H.principal&&a.jsx(Xa,{color:"emerald",children:"Principal"}),H.aceita_whatsapp&&a.jsx(Xa,{color:"purple",children:"WhatsApp"})]}),a.jsxs("p",{className:"text-sm text-white font-medium mt-1",children:[H.numero,H.ramal?` · Ramal ${H.ramal}`:""]})]})]}),a.jsx("button",{onClick:()=>B(H.id),className:"p-1.5 text-slate-600 hover:text-rose-400 transition-colors",children:a.jsx(Te,{size:14})})]},H.id)),a.jsxs("div",{className:"bg-slate-800/30 border border-dashed border-slate-700 rounded-xl p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest",children:"Adicionar telefone"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(ng,{label:"Tipo",value:P.tipo,onChange:H=>D(le=>({...le,tipo:H.target.value})),children:["celular","comercial","whatsapp","financeiro","compras"].map(H=>a.jsx("option",{className:"bg-slate-900 text-white",children:H},H))}),a.jsx(Yt,{label:"Número",value:P.numero,onChange:H=>D(le=>({...le,numero:H.target.value})),placeholder:"(11) 99999-9999"})]}),a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:P.aceita_whatsapp,onChange:H=>D(le=>({...le,aceita_whatsapp:H.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Aceita WhatsApp"})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:P.principal,onChange:H=>D(le=>({...le,principal:H.target.checked})),className:"accent-cyan-500"}),a.jsx("span",{className:"text-sm text-slate-300",children:"Principal"})]})]}),a.jsxs("button",{onClick:L,className:"px-4 py-2 bg-cyan-500 hover:bg-cyan-400 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[a.jsx(Oe,{size:14})," Adicionar"]})]})]}),s==="responsaveis"&&a.jsxs("div",{className:"space-y-4",children:[d==="PF"&&a.jsx("p",{className:"text-slate-500 text-xs italic",children:"PF normalmente tem 1 responsável (o próprio titular)."}),I.map(H=>a.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-xl p-4 flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-bold text-white",children:H.nome}),a.jsx("p",{className:"text-xs text-slate-400",children:[H.cargo,H.setor].filter(Boolean).join(" · ")}),H.email&&a.jsx("p",{className:"text-xs text-slate-500",children:H.email}),H.permissao&&a.jsx(Xa,{color:"purple",children:H.permissao})]}),a.jsx("button",{onClick:()=>se(H.id),className:"p-1.5 text-slate-600 hover:text-rose-400 transition-colors shrink-0",children:a.jsx(Te,{size:14})})]},H.id)),a.jsxs("div",{className:"bg-slate-800/30 border border-dashed border-slate-700 rounded-xl p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest",children:"Adicionar responsável"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Yt,{label:"Nome *",value:M.nome,onChange:H=>W(le=>({...le,nome:H.target.value})),placeholder:"Nome do responsável"}),a.jsx(Yt,{label:"Cargo",value:M.cargo,onChange:H=>W(le=>({...le,cargo:H.target.value})),placeholder:"Gerente, Comprador..."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Yt,{label:"Setor",value:M.setor,onChange:H=>W(le=>({...le,setor:H.target.value})),placeholder:"Financeiro, Compras..."}),a.jsx(Yt,{label:"E-mail",type:"email",value:M.email,onChange:H=>W(le=>({...le,email:H.target.value})),placeholder:"email@empresa.com"})]}),a.jsx(Yt,{label:"Permissão",value:M.permissao,onChange:H=>W(le=>({...le,permissao:H.target.value})),placeholder:"compras, financeiro, recebimento..."}),a.jsxs("button",{onClick:ae,className:"px-4 py-2 bg-cyan-500 hover:bg-cyan-400 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[a.jsx(Oe,{size:14})," Adicionar"]})]})]})]}),a.jsxs("div",{className:"p-6 border-t border-slate-800 flex gap-3 justify-end shrink-0",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 text-slate-400 hover:text-white transition-colors text-sm font-bold",children:"Fechar"}),s==="dados"&&a.jsxs("button",{onClick:T,disabled:o,className:"px-6 py-2 bg-cyan-500 hover:bg-cyan-400 disabled:opacity-50 rounded-xl text-black font-black text-sm transition-colors flex items-center gap-2",children:[o?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(jt,{size:14}),r?"Salvar":"Criar e continuar"]})]})]})})}function Dve(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(""),[o,l]=b.useState(""),[c,u]=b.useState("ativo"),[d,f]=b.useState(null),[p,h]=b.useState(null),[m,v]=b.useState(0),x=50;async function y(){r(!0);try{const j=await Qt.list({search:s||void 0,tipo:o||void 0,status:c||void 0,limit:x,offset:m*x});t(j)}catch(j){console.error(j)}finally{r(!1)}}b.useEffect(()=>{y()},[s,o,c,m]);async function g(j){confirm("Remover cliente?")&&(await Qt.delete(j),y())}return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex flex-wrap justify-between items-start gap-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-3xl font-black text-white tracking-tighter flex items-center gap-3",children:[a.jsx(et,{className:"text-cyan-400",size:28})," Clientes"]}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Cadastro PF e PJ · endereços · telefones · responsáveis"})]}),a.jsxs("button",{onClick:()=>{h(null),f("new")},className:"flex items-center gap-2 px-4 py-2 bg-cyan-500 hover:bg-cyan-400 rounded-xl text-black font-black text-sm transition-colors",children:[a.jsx(Oe,{size:16})," Novo Cliente"]})]}),a.jsxs("div",{className:"flex gap-3 flex-wrap",children:[a.jsxs("div",{className:"relative flex-1 min-w-48",children:[a.jsx(Ir,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsx("input",{value:s,onChange:j=>{i(j.target.value),v(0)},placeholder:"Buscar por nome, CPF, CNPJ, e-mail...",className:"w-full bg-slate-900 border border-slate-800 rounded-xl pl-9 pr-3 py-2 text-sm text-white focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{className:"relative",children:[a.jsxs("select",{value:o,onChange:j=>{l(j.target.value),v(0)},className:"bg-slate-900 border border-slate-800 rounded-xl px-3 py-2 text-sm text-slate-300 focus:outline-none focus:border-cyan-500 appearance-none cursor-pointer pr-8",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"PF + PJ"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"PF",children:"Pessoa Física"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"PJ",children:"Pessoa Jurídica"})]}),a.jsx(aa,{size:14,className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]}),a.jsxs("div",{className:"relative",children:[a.jsxs("select",{value:c,onChange:j=>{u(j.target.value),v(0)},className:"bg-slate-900 border border-slate-800 rounded-xl px-3 py-2 text-sm text-slate-300 focus:outline-none focus:border-cyan-500 appearance-none cursor-pointer pr-8",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Todos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"ativo",children:"Ativos"}),a.jsx("option",{className:"bg-slate-900 text-white",value:"inativo",children:"Inativos"})]}),a.jsx(aa,{size:14,className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]}),a.jsx("button",{onClick:y,className:"p-2 bg-slate-900 border border-slate-800 rounded-xl text-slate-400 hover:text-white transition-colors",children:a.jsx(ke,{size:16,className:n?"animate-spin":""})})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl overflow-hidden",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-slate-800 text-left",children:[a.jsx("th",{className:"px-6 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Cliente"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Tipo"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"CPF / CNPJ"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"E-mail"}),a.jsx("th",{className:"px-4 py-4 text-xs font-black text-slate-500 uppercase tracking-widest",children:"Status"}),a.jsx("th",{className:"px-4 py-4"})]})}),a.jsx("tbody",{children:n?[...Array(6)].map((j,N)=>a.jsx("tr",{className:"border-b border-slate-800/50 animate-pulse",children:[...Array(6)].map((w,S)=>a.jsx("td",{className:"px-4 py-4",children:a.jsx("div",{className:"h-4 bg-slate-800 rounded w-full"})},S))},N)):e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-6 py-16 text-center text-slate-600 text-sm italic",children:"Nenhum cliente encontrado."})}):e.map(j=>a.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/20 transition-colors group",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-9 h-9 rounded-xl flex items-center justify-center shrink-0 ${j.tipo==="PJ"?"bg-purple-400/10 text-purple-400":"bg-cyan-400/10 text-cyan-400"}`,children:j.tipo==="PJ"?a.jsx(f1,{size:16}):a.jsx(ks,{size:16})}),a.jsx("span",{className:"font-bold text-white",children:j.nome})]})}),a.jsx("td",{className:"px-4 py-4",children:a.jsx(Xa,{color:j.tipo==="PJ"?"purple":"cyan",children:j.tipo})}),a.jsx("td",{className:"px-4 py-4 font-mono text-xs text-slate-400",children:j.cpf_cnpj}),a.jsx("td",{className:"px-4 py-4 text-slate-400 text-xs",children:j.email||"—"}),a.jsx("td",{className:"px-4 py-4",children:a.jsx(Xa,{color:j.status==="ativo"?"emerald":"rose",children:j.status})}),a.jsx("td",{className:"px-4 py-4",children:a.jsxs("div",{className:"flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity justify-end",children:[a.jsx("button",{onClick:()=>{h(j),f("edit")},className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-400 hover:text-white transition-colors",title:"Editar",children:a.jsx(HP,{size:14})}),a.jsx("button",{onClick:()=>g(j.id),className:"p-2 rounded-lg bg-slate-800 hover:bg-rose-500/20 text-slate-400 hover:text-rose-400 transition-colors",title:"Remover",children:a.jsx(Te,{size:14})})]})})]},j.id))})]})}),e.length>0&&a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-slate-800",children:[a.jsxs("span",{className:"text-xs text-slate-500",children:[m*x+1,"–",m*x+e.length]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>v(j=>Math.max(0,j-1)),disabled:m===0,className:"p-2 rounded-lg bg-slate-800 disabled:opacity-30 text-slate-400 hover:text-white transition-colors",children:a.jsx(xd,{size:16})}),a.jsx("button",{onClick:()=>v(j=>j+1),disabled:e.lengthf(null),onSave:()=>{d==="new"&&f(null),y()}})]})}const ZC={online:"bg-emerald-400",busy:"bg-amber-400",offline:"bg-slate-600"},e_={online:"Disponível",busy:"Ocupado",offline:"Offline"};function t_(e){const t=e.availability==="online"?0:e.availability==="busy"?2:4,n=e.on_duty?0:1;return t+n}function Ive(e){if(!e)return"";const t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"agora";if(t<60)return`há ${t}min`;const n=Math.floor(t/60);return n<24?`há ${n}h`:`há ${Math.floor(n/24)}d`}function wc({funcao:e,value:t,onChange:n,allowSelf:r,accentColor:s="cyan"}){const[i,o]=b.useState(null),[l,c]=b.useState(!0),[u,d]=b.useState(""),[f,p]=b.useState(!1);b.useEffect(()=>{let y=!0;return c(!0),pt.listColaboradores(e).then(g=>{y&&o(g)}).catch(()=>{y&&o({configurado:!1,colaboradores:[]})}).finally(()=>{y&&c(!1)}),()=>{y=!1}},[e]);const h=b.useMemo(()=>{const y=((i==null?void 0:i.colaboradores)||[]).slice().sort((j,N)=>{const w=t_(j)-t_(N);return w!==0?w:j.pedidos_ativos-N.pedidos_ativos});if(!u.trim())return y;const g=u.toLowerCase();return y.filter(j=>j.name.toLowerCase().includes(g)||(j.email||"").toLowerCase().includes(g))},[i,u]),m=(i==null?void 0:i.colaboradores.find(y=>y.id===t))||null,x={cyan:{ring:"focus:border-cyan-500",bg:"bg-cyan-500/10",text:"text-cyan-400",border:"border-cyan-500/30"},purple:{ring:"focus:border-purple-500",bg:"bg-purple-500/10",text:"text-purple-400",border:"border-purple-500/30"},orange:{ring:"focus:border-orange-500",bg:"bg-orange-500/10",text:"text-orange-400",border:"border-orange-500/30"},teal:{ring:"focus:border-teal-500",bg:"bg-teal-500/10",text:"text-teal-400",border:"border-teal-500/30"},emerald:{ring:"focus:border-emerald-500",bg:"bg-emerald-500/10",text:"text-emerald-400",border:"border-emerald-500/30"}}[s];return!l&&i&&i.colaboradores.length===0?a.jsx("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-2xl p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(Kt,{size:14,className:"text-amber-400 shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("p",{className:"text-xs font-black text-amber-400 uppercase tracking-widest",children:['Nenhum colaborador para "',e,'"']}),a.jsxs("p",{className:"text-xs text-amber-400/80 mt-1",children:["Vincule colaboradores ao setor correspondente em ",a.jsx("strong",{children:"Equipe → editar colaborador"}),"."]}),i.setores_aceitos&&a.jsxs("p",{className:"text-xs text-amber-400/60 mt-1",children:["Setores aceitos: ",a.jsx("strong",{children:i.setores_aceitos.join(", ")})]})]})]})}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("button",{type:"button",onClick:()=>p(y=>!y),className:`w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2.5 text-left transition-colors hover:border-slate-600 ${x.ring}`,children:m?a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsxs("div",{className:"relative shrink-0",children:[m.avatar_url?a.jsx("img",{src:m.avatar_url,alt:"",className:"w-8 h-8 rounded-full object-cover"}):a.jsx("div",{className:"w-8 h-8 rounded-full bg-slate-700 flex items-center justify-center",children:a.jsx(Jx,{size:20,className:"text-slate-500"})}),a.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full ring-2 ring-slate-800 ${ZC[m.availability]}`})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-bold text-white truncate",children:m.name}),a.jsxs("p",{className:"text-[10px] text-slate-500",children:[e_[m.availability]," · ",m.pedidos_ativos," ativos"]})]}),a.jsx(jt,{size:14,className:x.text})]}):a.jsxs("div",{className:"flex items-center gap-2 text-slate-500",children:[a.jsx(Jx,{size:18}),a.jsx("span",{className:"text-sm",children:"Selecionar colaborador…"})]})}),r&&!m&&a.jsx("button",{type:"button",onClick:()=>n(r.id,r.nome),className:`w-full text-xs font-bold py-2 rounded-xl border ${x.bg} ${x.text} ${x.border} hover:opacity-80 transition-opacity`,children:"Atribuir a mim mesmo"}),f&&a.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-xl overflow-hidden",children:[a.jsx("div",{className:"p-2 border-b border-slate-800",children:a.jsxs("div",{className:"relative",children:[a.jsx(Ir,{size:12,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-slate-500"}),a.jsx("input",{value:u,onChange:y=>d(y.target.value),placeholder:"Buscar por nome ou email…",className:"w-full bg-slate-800 border border-slate-700 rounded-lg pl-7 pr-2 py-1.5 text-xs text-white focus:outline-none focus:border-slate-500",autoFocus:!0})]})}),l?a.jsx("div",{className:"py-6 text-center text-xs text-slate-500",children:"Carregando…"}):h.length===0?a.jsx("div",{className:"py-6 text-center text-xs text-slate-500",children:u?"Nenhum colaborador encontrado":"Nenhum colaborador na equipe"}):a.jsx("ul",{className:"max-h-64 overflow-y-auto",children:h.map(y=>{const g=t===y.id;return a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>{n(y.id,y.name),p(!1),d("")},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors hover:bg-slate-800/60 ${g?"bg-slate-800":""}`,children:[a.jsxs("div",{className:"relative shrink-0",children:[y.avatar_url?a.jsx("img",{src:y.avatar_url,alt:"",className:"w-7 h-7 rounded-full object-cover"}):a.jsx("div",{className:"w-7 h-7 rounded-full bg-slate-700 flex items-center justify-center",children:a.jsx(Jx,{size:16,className:"text-slate-500"})}),a.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2 h-2 rounded-full ring-2 ring-slate-900 ${ZC[y.availability]}`})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("p",{className:"text-xs font-bold text-white truncate",children:y.name}),y.on_duty&&a.jsx("span",{className:"text-[9px] font-black text-emerald-400 bg-emerald-500/10 px-1 rounded",children:"PLANTÃO"})]}),a.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-slate-500 mt-0.5",children:[a.jsx("span",{children:e_[y.availability]}),a.jsx("span",{children:"·"}),a.jsxs("span",{className:y.pedidos_ativos>0?"text-amber-400":"",children:[y.pedidos_ativos," ativos"]}),y.ultimo_pedido_em&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{className:"flex items-center gap-0.5",children:[a.jsx(hn,{size:8}),Ive(y.ultimo_pedido_em)]})]})]})]}),g&&a.jsx(jt,{size:14,className:x.text})]})},y.id)})}),m&&a.jsx("div",{className:"p-2 border-t border-slate-800",children:a.jsx("button",{type:"button",onClick:()=>{n(null),p(!1)},className:"w-full text-[11px] text-slate-500 hover:text-rose-400 transition-colors py-1",children:"Limpar seleção"})})]})]})}const Xn=[{id:"aguardando",label:"Aguardando",icon:hn,color:"yellow"},{id:"separacao",label:"Separação",icon:bu,color:"blue"},{id:"embalagem",label:"Embalagem",icon:Mp,color:"purple"},{id:"auditoria",label:"Auditoria",icon:Pi,color:"orange"},{id:"fiscal",label:"Fiscal",icon:Hr,color:"cyan"},{id:"expedicao",label:"Expedição",icon:Nu,color:"teal"},{id:"entregue",label:"Entregue",icon:nn,color:"emerald"},{id:"cancelado",label:"Cancelado",icon:Ar,color:"rose"}],Yn={yellow:{badge:"bg-yellow-400/10 text-yellow-400",bg:"bg-yellow-400/5",border:"border-yellow-400/20",text:"text-yellow-400"},blue:{badge:"bg-blue-400/10 text-blue-400",bg:"bg-blue-400/5",border:"border-blue-400/20",text:"text-blue-400"},purple:{badge:"bg-purple-400/10 text-purple-400",bg:"bg-purple-400/5",border:"border-purple-400/20",text:"text-purple-400"},orange:{badge:"bg-orange-400/10 text-orange-400",bg:"bg-orange-400/5",border:"border-orange-400/20",text:"text-orange-400"},cyan:{badge:"bg-cyan-400/10 text-cyan-400",bg:"bg-cyan-400/5",border:"border-cyan-400/20",text:"text-cyan-400"},teal:{badge:"bg-teal-400/10 text-teal-400",bg:"bg-teal-400/5",border:"border-teal-400/20",text:"text-teal-400"},emerald:{badge:"bg-emerald-400/10 text-emerald-400",bg:"bg-emerald-400/5",border:"border-emerald-400/20",text:"text-emerald-400"},rose:{badge:"bg-rose-400/10 text-rose-400",bg:"bg-rose-400/5",border:"border-rose-400/20",text:"text-rose-400"},slate:{badge:"bg-slate-700 text-slate-400",bg:"bg-slate-800/40",border:"border-slate-700",text:"text-slate-400"}},ei=e=>Number(e).toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),so=e=>e?new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"—",Lve={pix:"PIX",cartao:"Cartão",faturado:"Faturado",na_retirada:"Na Retirada",na_entrega:"Na Entrega"};function x8({value:e,compact:t=!1}){if(!e)return a.jsx("span",{className:"text-slate-600",children:"—"});const n=Lve[e]??e;return e==="na_entrega"?t?a.jsxs("span",{className:"text-amber-400 text-xs font-bold",children:[n," ⚠️"]}):a.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-400 font-bold",children:[n,a.jsx("span",{className:"text-[10px] bg-amber-500/15 border border-amber-500/30 text-amber-400 px-1.5 py-0.5 rounded-md font-black uppercase tracking-wide",children:"A avaliar"})]}):a.jsx("span",{className:"font-bold text-white",children:n})}function fb({status:e}){const t=Xn.find(r=>r.id===e);if(!t)return null;const n=Yn[t.color];return a.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest border ${n.badge} ${n.border}`,children:[a.jsx(t.icon,{size:11})," ",t.label]})}const zve={aguardando:"Aguardando aprovação",separacao:"Lista de Separação — confira cada item e marque ao retirar",embalagem:"Embalagem — confira itens, embale e lacre",auditoria:"Auditoria — verifique código de barras, qtd. e validade",fiscal:"Fiscal — verifique dados do cliente e totais",expedicao:"Expedição — pedido pronto para saída",entregue:"Pedido entregue",cancelado:"Pedido cancelado"};function Bve(e,t){var v;const n=x=>Number(x).toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),r=x=>x?new Date(x).toLocaleString("pt-BR"):"—",s=e.protocolo||`Pedido #${e.id}`,i=(((v=Xn.find(x=>x.id===e.status))==null?void 0:v.label)??e.status).toUpperCase(),o=zve[e.status]??"",l=["separacao","embalagem","auditoria"].includes(e.status),c=t.map(x=>` + + ${l?` +
+ `:""} + + ${x.nome_produto} + ${x.sku?`
SKU: ${x.sku}`:""} + + + ${Number(x.quantidade).toLocaleString("pt-BR")} un + + + ${n(x.subtotal)} + + `).join(""),u=e.rua?` +
+

Endereço de Entrega

+
${e.rua}, ${e.end_numero}
+
${e.bairro} · ${e.cidade}/${e.estado} · CEP ${e.cep}
+ `:"",d=e.observacao?` +
+

Observação

+
${e.observacao}
+ `:"",p={separacao:e.separador_nome,embalagem:e.embalador_nome,auditoria:e.auditor_nome,fiscal:e.fiscal_nome,expedicao:e.expedidor_nome}[e.status],h=` + + + + ${i} — ${s} + + + +

Alemão Conveniências

+
${i}
+

${o}

+
+ +

Pedido

+
${s}
+
${r(e.created_at)}
+ +
+ +

Cliente

+
${e.cliente_nome||"Consumidor"}
+ ${e.cpf_cnpj?`
${e.cpf_cnpj}
`:""} +
+ ${e.tipo_entrega?`${String(e.tipo_entrega).toUpperCase()} · `:""} + ${{pix:"PIX",cartao:"Cartão",faturado:"Faturado",na_retirada:"Na Retirada",na_entrega:"NA ENTREGA ⚠"}[e.forma_pagto]||e.forma_pagto||""} +
+ + ${u} + ${d} + +
+ +

Itens (${t.length})

+ + + ${l?'':""} + + + + + ${c} +
ProdutoQtdTotal
+ +
+ + + ${e.desconto>0?` + + + + `:""} + + + + +
Desconto-${n(e.desconto)}
TOTAL${n(e.total)}
+ + ${p?` +
+

Responsável — ${i}

+
${p}
+ `:""} + + ${e.expedidor_nome&&e.expedidor_saida_em?` +
+
+ ↗ Saída: ${r(e.expedidor_saida_em)} · ${e.expedidor_nome} +
`:""} + +
+ ${p?"Assinatura: ____________________":" "} +
+ +

+ Documento interno · ${new Date().toLocaleString("pt-BR")} +

+ +`,m=window.open("","_blank","width=420,height=720");if(!m){alert("Permita pop-ups para imprimir.");return}m.document.write(h),m.document.close(),m.focus(),setTimeout(()=>{m.print(),m.close()},350)}const _f=["Resumo","Itens","Ações"];function Fve({pedido:e,onClose:t,onUpdate:n}){var jn,Wn;const[r,s]=b.useState(e),[i,o]=b.useState([]),[l,c]=b.useState(!0),[u,d]=b.useState(!1),[f,p]=b.useState(""),[h,m]=b.useState(0),[v,x]=b.useState(""),[y,g]=b.useState(""),[j,N]=b.useState(null),[w,S]=b.useState(null),[k,C]=b.useState(null),[_,A]=b.useState(null),[E,P]=b.useState(null),[D,I]=b.useState(!1),[R,M]=b.useState(""),[W,T]=b.useState(""),[V,X]=b.useState(!1);async function U(){var ft,Tt;const ne=R.trim(),Se=W.replace(/\D/g,"");if(!ne&&!Se){alert("Informe o número do cupom ou a chave de acesso (44 dígitos).");return}if(Se&&Se.length!==44){alert("Chave de acesso NFC-e deve ter 44 dígitos.");return}X(!0);try{const gt=await pt.registrarCupom(r.id,{numero:ne||void 0,chave:Se||void 0});s(Ba=>({...Ba,cupom_numero:gt.cupom_numero,cupom_chave:gt.cupom_chave,cupom_emitido_em:gt.cupom_emitido_em,cupom_emitido_por:gt.cupom_emitido_por,cupom_emitido_por_nome:gt.cupom_emitido_por_nome})),I(!1),M(""),T(""),n()}catch(gt){alert(((Tt=(ft=gt==null?void 0:gt.response)==null?void 0:ft.data)==null?void 0:Tt.error)||"Erro ao registrar cupom fiscal")}finally{X(!1)}}b.useEffect(()=>{pt.getPedido(r.id).then(ne=>{s(ne),o(ne.itens||[])}).finally(()=>c(!1))},[r.id]),b.useEffect(()=>{const ne=Se=>{Se.key==="Escape"&&t()};return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[t]);const L=Xn.find(ne=>ne.id===r.status),B=L?Yn[L.color]:Yn.slate,ae=Xn.findIndex(ne=>ne.id===r.status),se=Xn[ae+1],xe=i.length>0&&i.every(ne=>ne.separado);async function H(){if(!(!se||se.id==="cancelado")){if(se.id==="embalagem"){await le();return}d(!0);try{r.status==="separacao"&&w?await pt.setResponsavel(r.id,"separador",w):r.status==="auditoria"&&k?await pt.setResponsavel(r.id,"auditor",k):r.status==="fiscal"&&_&&await pt.setResponsavel(r.id,"fiscal",_),se.id==="entregue"?E?await pt.marcarEntreguePorId(r.id,E):await pt.marcarEntregue(r.id,v||void 0):await pt.updateStatus(r.id,se.id),s(ne=>({...ne,status:se.id})),n()}finally{d(!1)}}}async function le(){if(!j&&!y.trim()){alert("Selecione o embalador antes de avançar.");return}d(!0);try{j?await pt.marcarEmbaladoPorId(r.id,j):await pt.marcarEmbalado(r.id,y),s(ne=>({...ne,status:"embalagem"})),n()}finally{d(!1)}}async function Z(){d(!0);try{await pt.updateStatus(r.id,"separacao"),s(ne=>({...ne,status:"separacao"})),p(""),n()}finally{d(!1)}}async function F(){if(confirm("Cancelar pedido?")){d(!0);try{await pt.updateStatus(r.id,"cancelado"),s(ne=>({...ne,status:"cancelado"})),n()}finally{d(!1)}}}async function z(ne){const Se=!ne.separado;await pt.marcarSeparado(ne.id,Se),o(ft=>ft.map(Tt=>Tt.id===ne.id?{...Tt,separado:Se}:Tt))}const q=se&&se.id!=="cancelado"&&r.status!=="entregue"&&r.status!=="cancelado",ie=r.status==="separacao"&&i.length>0&&!xe,oe=(se==null?void 0:se.id)==="embalagem"&&!j&&!y.trim(),we=r.status==="expedicao"&&(se==null?void 0:se.id)==="entregue"&&!E&&!v.trim(),Ee=ie||oe||we,ze=ie?"separe todos os itens":oe?"selecione o embalador":we?"selecione o entregador":"",gn=a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4 col-span-2 md:col-span-1",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Cliente"}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.cliente_tipo==="PJ"?a.jsx(f1,{size:15,className:"text-purple-400 shrink-0"}):a.jsx(ks,{size:15,className:"text-cyan-400 shrink-0"}),a.jsx("span",{className:"text-sm font-bold text-white leading-tight",children:r.cliente_nome||"Sem cadastro"})]}),r.cpf_cnpj&&a.jsx("p",{className:"text-xs text-slate-500 font-mono mt-0.5",children:r.cpf_cnpj})]}),a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Total"}),a.jsx("p",{className:"text-2xl font-black text-white tabular-nums",children:ei(r.total)}),r.desconto>0&&a.jsxs("p",{className:"text-xs text-emerald-400 mt-0.5",children:["Desc: ",ei(r.desconto)]})]}),a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Pagamento"}),a.jsx(x8,{value:r.forma_pagto})]}),a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Modalidade"}),a.jsx("p",{className:"text-sm font-bold text-white capitalize",children:r.tipo_entrega||"—"})]})]}),r.rua&&a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsxs("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2 flex items-center gap-1.5",children:[a.jsx(gm,{size:11})," Endereço de Entrega"]}),a.jsxs("p",{className:"text-sm text-white font-bold",children:[r.rua,", ",r.end_numero]}),a.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:[r.bairro," · ",r.cidade,"/",r.estado," · CEP ",r.cep]})]}),r.observacao&&a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Observação"}),a.jsx("p",{className:"text-sm text-slate-300",children:r.observacao})]}),r.forma_pagto==="na_entrega"&&r.status==="aguardando"&&a.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-2xl p-4 flex items-start gap-3",children:[a.jsx(Ar,{size:18,className:"text-amber-400 shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-black text-amber-400 uppercase tracking-widest",children:"Pagamento na entrega — avaliar"}),a.jsx("p",{className:"text-xs text-amber-400/70 mt-1",children:"Avalie antes de avançar para separação. Confirme apenas se aprovado pela equipe."})]})]}),r.status!=="separacao"&&r.embalador&&a.jsxs("div",{className:"bg-slate-900 border border-purple-400/10 rounded-2xl p-3 flex items-center gap-2",children:[a.jsx(Mp,{size:13,className:"text-purple-400 shrink-0"}),a.jsxs("span",{className:"text-xs text-slate-400",children:["Embalado por: ",a.jsx("strong",{className:"text-white",children:r.embalador})]})]}),Array.isArray(r.historico_responsaveis)&&r.historico_responsaveis.length>0&&a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsxs("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-4 flex items-center gap-1.5",children:[a.jsx(hn,{size:11})," Linha do Tempo"]}),a.jsx("div",{className:"space-y-0",children:r.historico_responsaveis.map((ne,Se)=>{const ft=Xn.find(Ql=>Ql.id===ne.status),Tt=ft?Yn[ft.color]:Yn.slate,gt=Se===r.historico_responsaveis.length-1,Ba=ne.status==="expedicao"&&r.expedidor_saida_em,Fa={separacao:r.separador_nome,embalagem:r.embalador_nome,auditoria:r.auditor_nome,fiscal:r.fiscal_nome,expedicao:r.expedidor_nome}[ne.status]||ne.account_name||null;return a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex flex-col items-center w-7 shrink-0",children:[a.jsx("div",{className:`w-7 h-7 rounded-xl flex items-center justify-center border ${Tt.bg} ${Tt.border}`,children:ft?a.jsx(ft.icon,{size:11,className:Tt.text}):a.jsx(jt,{size:11,className:"text-slate-400"})}),!gt&&a.jsx("div",{className:"w-px flex-1 min-h-[20px] bg-slate-800 my-1"})]}),a.jsxs("div",{className:`flex-1 min-w-0 ${gt?"":"pb-4"}`,children:[a.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[a.jsx("span",{className:`text-xs font-black uppercase tracking-widest ${Tt.text}`,children:(ft==null?void 0:ft.label)??ne.status}),a.jsx("span",{className:"text-[10px] text-slate-600 tabular-nums shrink-0",children:so(ne.feito_em)})]}),Fa&&a.jsxs("p",{className:"text-xs text-slate-400 mt-0.5 flex items-center gap-1",children:[a.jsx(ks,{size:10,className:"shrink-0"})," ",Fa]}),Ba&&a.jsxs("p",{className:"text-[11px] text-teal-400 font-bold mt-1 flex items-center gap-1",children:[a.jsx(Nu,{size:10,className:"shrink-0"}),"Saiu para entrega às ",so(r.expedidor_saida_em)]}),(ne.status==="fiscal"||ne.status==="expedicao")&&r.cupom_emitido_em&&a.jsxs("p",{className:"text-[11px] text-cyan-400 mt-1 flex items-center gap-1",children:[a.jsx(Hr,{size:10,className:"shrink-0"}),"Cupom ",r.cupom_numero?`#${r.cupom_numero}`:"registrado"," ","· ",so(r.cupom_emitido_em),r.cupom_emitido_por_nome&&` · ${r.cupom_emitido_por_nome}`]})]})]},ne.id??Se)})})]})]}),vn=a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(bu,{size:11})," ",i.length," ",i.length===1?"item":"itens"]}),["separacao","embalagem"].includes(r.status)&&i.length>0&&a.jsxs("span",{className:`text-xs font-bold ${xe?"text-emerald-400":"text-slate-500"}`,children:[i.filter(ne=>ne.separado).length,"/",i.length," separados",xe&&" ✓"]})]}),a.jsx("div",{className:"space-y-2",children:i.map(ne=>a.jsxs("div",{className:`flex items-center gap-3 p-4 rounded-2xl border transition-colors + ${ne.separado?"border-emerald-400/20 bg-emerald-400/5":"border-slate-800 bg-slate-900"}`,children:[["separacao","embalagem"].includes(r.status)&&a.jsx("button",{onClick:()=>z(ne),className:`w-7 h-7 rounded-xl border-2 flex items-center justify-center shrink-0 transition-colors + ${ne.separado?"border-emerald-500 bg-emerald-500":"border-slate-600 hover:border-emerald-500"}`,children:ne.separado&&a.jsx(jt,{size:13,className:"text-black"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`text-sm font-bold truncate ${ne.separado?"text-slate-400 line-through":"text-white"}`,children:ne.nome_produto}),a.jsxs("p",{className:"text-xs text-slate-500 mt-0.5",children:[ne.sku||""," · ",Number(ne.quantidade).toLocaleString("pt-BR"),"x · ",ei(ne.preco_unitario)]})]}),a.jsx("p",{className:"text-sm font-black text-white tabular-nums shrink-0",children:ei(ne.subtotal)})]},ne.id))}),a.jsxs("div",{className:"flex justify-between items-center pt-2 border-t border-slate-800",children:[a.jsx("span",{className:"text-xs font-black text-slate-500 uppercase tracking-widest",children:"Total"}),a.jsx("span",{className:"text-xl font-black text-white tabular-nums",children:ei(r.total)})]})]}),yn=a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:`rounded-2xl p-4 border ${B.bg} ${B.border}`,children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-2",children:"Status atual"}),a.jsx(fb,{status:r.status}),r.status==="entregue"&&a.jsx("p",{className:"text-xs text-emerald-400 mt-2 font-bold",children:"✓ Pedido finalizado com sucesso"}),r.status==="cancelado"&&a.jsx("p",{className:"text-xs text-rose-400 mt-2 font-bold",children:"✗ Pedido cancelado"})]}),r.status==="fiscal"&&a.jsxs("div",{className:"bg-slate-900 border border-cyan-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-cyan-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Hr,{size:11})," Dados Fiscais do Cliente"]}),a.jsx("div",{className:"text-sm space-y-2",children:[["CPF/CNPJ",r.cpf_cnpj||"—"],["Cliente",r.cliente_nome||"—"],["Total",ei(r.total)]].map(([ne,Se])=>a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:ne}),a.jsx("span",{className:"font-bold text-white font-mono",children:Se})]},ne))})]}),!["aguardando","cancelado"].includes(r.status)&&a.jsxs("div",{className:"bg-slate-900 border border-cyan-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-xs font-black text-cyan-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Hr,{size:11})," Cupom Fiscal"]}),r.cupom_emitido_em&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-emerald-400 font-black uppercase",children:[a.jsx(jt,{size:10})," Emitido"]})]}),r.cupom_emitido_em&&!D?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-sm space-y-1.5",children:[r.cupom_numero&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:"Número"}),a.jsx("span",{className:"font-bold text-white font-mono",children:r.cupom_numero})]}),r.cupom_chave&&a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("span",{className:"text-slate-400",children:"Chave"}),a.jsx("span",{className:"font-mono text-[11px] text-white break-all text-right",children:r.cupom_chave})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:"Emitido em"}),a.jsx("span",{className:"font-bold text-white",children:so(r.cupom_emitido_em)})]}),r.cupom_emitido_por_nome&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-slate-400",children:"Por"}),a.jsx("span",{className:"font-bold text-white",children:r.cupom_emitido_por_nome})]})]}),a.jsx("button",{onClick:()=>{I(!0),M(r.cupom_numero||""),T(r.cupom_chave||"")},className:"w-full py-2 bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-xl text-slate-300 font-bold text-xs transition-colors",children:"Re-emitir / Corrigir"})]}):D?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black text-slate-500 uppercase tracking-widest mb-1",children:"Número do cupom"}),a.jsx("input",{type:"text",value:R,onChange:ne=>M(ne.target.value),disabled:V,placeholder:"Ex.: COO 000123",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white font-mono focus:outline-none focus:border-cyan-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[10px] font-black text-slate-500 uppercase tracking-widest mb-1",children:"Chave de acesso NFC-e (44 dígitos)"}),a.jsx("input",{type:"text",value:W,onChange:ne=>T(ne.target.value),disabled:V,maxLength:56,placeholder:"00000000000000000000000000000000000000000000",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500"}),a.jsxs("p",{className:"text-[10px] text-slate-500 mt-1",children:[W.replace(/\D/g,"").length,"/44 dígitos"]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("button",{onClick:()=>{I(!1),M(""),T("")},disabled:V,className:"py-2.5 bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-xl text-slate-400 font-black text-xs transition-colors",children:"Cancelar"}),a.jsxs("button",{onClick:U,disabled:V,className:"py-2.5 bg-cyan-500/20 hover:bg-cyan-500/30 border border-cyan-500/40 rounded-xl text-cyan-300 font-black text-xs transition-colors flex items-center justify-center gap-1.5 disabled:opacity-40",children:[V?a.jsx(ke,{size:12,className:"animate-spin"}):a.jsx(jt,{size:12})," Registrar"]})]})]}):a.jsxs("button",{onClick:()=>I(!0),className:"w-full py-2.5 bg-cyan-500/10 hover:bg-cyan-500/20 border border-cyan-500/30 rounded-xl text-cyan-400 font-black text-xs transition-colors flex items-center justify-center gap-1.5",children:[a.jsx(Hr,{size:12})," Emitir Cupom Fiscal"]}),a.jsx("p",{className:"text-[10px] text-slate-500 leading-relaxed",children:"Registro do cupom emitido no PDV/ECF — sem integração SEFAZ. Pode ser feito em qualquer fase pós-pagamento."})]}),r.status==="separacao"&&a.jsxs("div",{className:"bg-slate-900 border border-blue-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-blue-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(bu,{size:11})," Separador Responsável"]}),a.jsx(wc,{funcao:"separador",value:w,onChange:S,accentColor:"cyan"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Será registrado ao avançar para Embalagem."})]}),(se==null?void 0:se.id)==="embalagem"&&r.status==="separacao"&&a.jsxs("div",{className:"bg-slate-900 border border-purple-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-purple-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Mp,{size:11})," Embalador Responsável"]}),a.jsx(wc,{funcao:"embalador",value:j,onChange:(ne,Se)=>{N(ne),g(Se||"")},accentColor:"purple"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Selecione o colaborador antes de avançar."})]}),r.status==="auditoria"&&a.jsxs("div",{className:"bg-slate-900 border border-orange-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-orange-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Pi,{size:11})," Auditor Responsável"]}),a.jsx(wc,{funcao:"auditor",value:k,onChange:C,accentColor:"orange"})]}),r.status==="fiscal"&&a.jsxs("div",{className:"bg-slate-900 border border-cyan-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-cyan-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Hr,{size:11})," Fiscal Responsável"]}),a.jsx(wc,{funcao:"fiscal",value:_,onChange:A,accentColor:"cyan"})]}),r.status==="expedicao"&&a.jsxs("div",{className:"bg-slate-900 border border-teal-400/20 rounded-2xl p-4 space-y-3",children:[a.jsxs("p",{className:"text-xs font-black text-teal-400 uppercase tracking-widest flex items-center gap-1.5",children:[a.jsx(Nu,{size:11})," Expedidor / Entregador"]}),a.jsx(wc,{funcao:"expedidor",value:E,onChange:(ne,Se)=>{P(ne),x(Se||"")},accentColor:"teal"}),a.jsxs("p",{className:"text-xs text-slate-500",children:["Modalidade: ",a.jsx("span",{className:"font-bold text-white capitalize",children:r.tipo_entrega})]})]}),r.status==="auditoria"&&a.jsxs("div",{className:"bg-slate-900 border border-orange-400/20 rounded-2xl p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-black text-orange-400 uppercase tracking-widest",children:"Auditoria Final"}),a.jsx("p",{className:"text-xs text-slate-400",children:"Confira código de barras, quantidades e validade antes de aprovar."}),a.jsx("textarea",{value:f,onChange:ne=>p(ne.target.value),rows:3,placeholder:"Motivo da reprovação (opcional)...",className:"w-full bg-slate-800 border border-slate-700 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-orange-500 resize-none"}),a.jsxs("button",{onClick:Z,disabled:u,className:"w-full py-3 bg-rose-500/20 hover:bg-rose-500/30 border border-rose-500/30 rounded-xl text-rose-400 font-black text-sm transition-colors flex items-center justify-center gap-2",children:[a.jsx(Ar,{size:14})," Reprovar — Voltar à Separação"]})]}),r.status!=="cancelado"&&r.status!=="entregue"&&a.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4",children:[a.jsx("p",{className:"text-xs font-black text-slate-500 uppercase tracking-widest mb-3",children:"Zona de Risco"}),a.jsxs("button",{onClick:F,disabled:u,className:"w-full py-3 bg-rose-500/10 hover:bg-rose-500/20 border border-rose-500/20 rounded-xl text-rose-400 font-black text-sm transition-colors flex items-center justify-center gap-2",children:[a.jsx(Ar,{size:14})," Cancelar Pedido"]})]})]}),bn=[gn,vn,yn];return Bi.createPortal(a.jsxs("div",{className:"fixed inset-0 z-[100] bg-slate-950 flex flex-col overflow-hidden",style:{width:"100vw",height:"100vh"},children:[a.jsx("div",{className:`px-6 pt-5 pb-4 border-b border-slate-800 ${B.bg} shrink-0`,children:a.jsxs("div",{className:"max-w-5xl mx-auto w-full",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-black text-white tracking-tight",children:r.protocolo||`Pedido #${r.id}`}),a.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:so(r.created_at)})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsx(fb,{status:r.status}),a.jsx("button",{onClick:()=>Bve(r,i),title:"Imprimir cupom do pedido",className:"p-1.5 text-slate-500 hover:text-white hover:bg-slate-800 rounded-xl transition-colors",children:a.jsx(GP,{size:18})}),a.jsx("button",{onClick:t,className:"p-1.5 text-slate-500 hover:text-white hover:bg-slate-800 rounded-xl transition-colors",children:a.jsx(Ce,{size:18})})]})]}),a.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide mt-3",children:Xn.filter(ne=>ne.id!=="cancelado").map((ne,Se)=>{const ft=ae>Se,Tt=ae===Se,gt=Yn[ne.color];return a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsxs("div",{className:`flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-black transition-all + ${Tt?`${gt.badge} ${gt.border} border`:ft?"text-emerald-400":"text-slate-700"}`,children:[ft?a.jsx(jt,{size:9}):a.jsx(ne.icon,{size:9}),a.jsx("span",{children:ne.label})]}),Sea.jsxs("button",{onClick:()=>m(Se),className:`flex-1 py-3 text-xs font-black uppercase tracking-widest transition-colors + ${h===Se?"text-white border-b-2 border-cyan-400":"text-slate-600 hover:text-slate-400"}`,children:[ne,Se===1&&i.length>0&&a.jsx("span",{className:`ml-1.5 px-1.5 py-0.5 rounded-full text-[10px] ${h===Se?"bg-cyan-400/20 text-cyan-400":"bg-slate-800 text-slate-500"}`,children:i.length})]},Se))}),a.jsx("div",{className:"flex-1 overflow-y-auto p-6 max-w-5xl w-full mx-auto",children:l?a.jsx("div",{className:"space-y-3 animate-pulse",children:[...Array(4)].map((ne,Se)=>a.jsx("div",{className:"h-20 bg-slate-800 rounded-2xl"},Se))}):bn[h]}),a.jsx("div",{className:"shrink-0 border-t border-slate-800 px-6 py-4 bg-slate-950/95 backdrop-blur-sm",children:a.jsxs("div",{className:"flex items-center gap-3 max-w-5xl mx-auto w-full",children:[a.jsx("button",{onClick:()=>m(ne=>Math.max(0,ne-1)),disabled:h===0,className:"px-4 py-2.5 bg-slate-900 border border-slate-800 rounded-xl text-sm font-black text-slate-400 hover:text-white disabled:opacity-30 transition-colors shrink-0",children:"← Anterior"}),a.jsx("div",{className:"flex gap-1.5 flex-1 justify-center",children:_f.map((ne,Se)=>a.jsx("button",{onClick:()=>m(Se),className:`h-1.5 rounded-full transition-all ${Se===h?"w-6 bg-cyan-400":"w-1.5 bg-slate-700 hover:bg-slate-600"}`},Se))}),q?a.jsxs("button",{onClick:H,disabled:u||Ee,title:Ee?`Antes de avançar, ${ze}.`:"",className:`flex-1 max-w-xs py-2.5 rounded-xl font-black text-sm transition-colors flex items-center justify-center gap-2 disabled:opacity-40 + ${Yn[((jn=Xn.find(ne=>ne.id===se.id))==null?void 0:jn.color)||"slate"].badge} + border ${Yn[((Wn=Xn.find(ne=>ne.id===se.id))==null?void 0:Wn.color)||"slate"].border}`,children:[u?a.jsx(ke,{size:15,className:"animate-spin"}):se&&a.jsx(se.icon,{size:15}),"Avançar para ",se==null?void 0:se.label,Ee&&a.jsxs("span",{className:"text-[10px] opacity-60",children:["(",ze,")"]})]}):a.jsx("button",{onClick:()=>m(ne=>Math.min(_f.length-1,ne+1)),disabled:h===_f.length-1,className:"px-4 py-2.5 bg-slate-900 border border-slate-800 rounded-xl text-sm font-black text-slate-400 hover:text-white disabled:opacity-30 transition-colors shrink-0",children:"Próximo →"})]})})]}),document.body)}function Vve({label:e,value:t,icon:n,color:r,onClick:s,active:i}){const o=Yn[r]||Yn.slate;return a.jsxs("button",{onClick:s,className:`flex-1 min-w-28 p-4 rounded-2xl border transition-all text-left ${i?`${o.bg} ${o.border}`:"bg-slate-900/40 border-slate-800 hover:border-slate-700"}`,children:[a.jsx("div",{className:`mb-2 ${i?o.text:"text-slate-500"}`,children:a.jsx(n,{size:18})}),a.jsx("p",{className:"text-2xl font-black text-white tabular-nums",children:t}),a.jsx("p",{className:`text-[10px] font-black uppercase tracking-widest mt-0.5 ${i?o.text:"text-slate-600"}`,children:e})]})}function Uve(){const[e,t]=b.useState([]),[n,r]=b.useState({}),[s,i]=b.useState(!0),[o,l]=b.useState("aguardando"),[c,u]=b.useState(null),[d,f]=b.useState("hoje"),p=b.useCallback(async()=>{i(!0);try{const m={status:o||void 0};if(d==="hoje")m.from=new Date().toISOString().slice(0,10),m.to=m.from;else if(d==="7d"){const y=new Date;y.setDate(y.getDate()-7),m.from=y.toISOString().slice(0,10)}else if(d==="30d"){const y=new Date;y.setDate(y.getDate()-30),m.from=y.toISOString().slice(0,10)}const[v,x]=await Promise.all([pt.listPedidos(m),pt.contadores()]);t(v),r(x)}catch(m){console.error(m)}finally{i(!1)}},[o,d]);b.useEffect(()=>{p()},[p]),b.useEffect(()=>{const m=setInterval(p,3e4);return()=>clearInterval(m)},[p]);const h=[{id:"aguardando",label:"Aguardando",icon:hn,color:"yellow",value:n.aguardando??0},{id:"separacao",label:"Separação",icon:bu,color:"blue",value:n.em_separacao??0},{id:"embalagem",label:"Embalagem",icon:Mp,color:"purple",value:n.em_embalagem??0},{id:"auditoria",label:"Auditoria",icon:Pi,color:"orange",value:n.em_auditoria??0},{id:"expedicao",label:"Expedição",icon:Nu,color:"teal",value:n.prontos??0},{id:"entregue",label:"Entregues",icon:nn,color:"emerald",value:n.entregues??0}];return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex flex-wrap justify-between items-start gap-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-3xl font-black text-white tracking-tighter flex items-center gap-3",children:[a.jsx(QP,{className:"text-cyan-400",size:28})," Pedidos"]}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Fluxo operacional · separação · embalagem · auditoria · expedição"})]}),a.jsx("button",{onClick:p,className:"flex items-center gap-2 p-2 bg-slate-900 border border-slate-800 rounded-xl text-slate-400 hover:text-white transition-colors",children:a.jsx(ke,{size:16,className:s?"animate-spin":""})})]}),a.jsx("div",{className:"flex gap-3 overflow-x-auto pb-1",children:h.map(m=>a.jsx(Vve,{label:m.label,value:m.value,icon:m.icon,color:m.color,active:o===m.id,onClick:()=>l(m.id)},m.id))}),a.jsxs("div",{className:"flex gap-3 items-center flex-wrap",children:[a.jsxs("div",{className:"relative",children:[a.jsxs("select",{value:o,onChange:m=>l(m.target.value),className:"bg-slate-900 border border-slate-800 rounded-xl px-3 py-2 text-sm text-slate-300 focus:outline-none focus:border-cyan-500 appearance-none cursor-pointer pr-8",children:[a.jsx("option",{value:"",style:{background:"#0f172a",color:"#cbd5e1"},children:"Todos os status"}),Xn.map(m=>a.jsx("option",{value:m.id,style:{background:"#0f172a",color:"#cbd5e1"},children:m.label},m.id))]}),a.jsx(aa,{size:14,className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 pointer-events-none"})]}),a.jsx("div",{className:"flex bg-slate-900 border border-slate-800 rounded-xl overflow-hidden",children:[["hoje","Hoje"],["7d","7 dias"],["30d","30 dias"],["","Todos"]].map(([m,v])=>a.jsx("button",{onClick:()=>f(m),className:`px-3 py-2 text-xs font-black transition-colors ${d===m?"bg-cyan-500/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:v},m))}),a.jsxs("span",{className:"text-xs text-slate-600",children:[e.length," pedido",e.length!==1?"s":""]})]}),a.jsx("div",{className:"space-y-3",children:s?[...Array(5)].map((m,v)=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-5 animate-pulse flex gap-4",children:[a.jsx("div",{className:"h-10 w-10 bg-slate-800 rounded-xl"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("div",{className:"h-4 w-32 bg-slate-800 rounded"}),a.jsx("div",{className:"h-3 w-48 bg-slate-800/60 rounded"})]})]},v)):e.length===0?a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-3xl p-16 text-center",children:[a.jsx(nn,{size:40,className:"text-slate-700 mx-auto mb-3"}),a.jsx("p",{className:"text-slate-600 text-sm italic",children:"Nenhum pedido neste status."})]}):e.map(m=>{const v=Xn.find(y=>y.id===m.status),x=v?Yn[v.color]:Yn.slate;return a.jsxs("button",{onClick:()=>u(m),className:`w-full text-left bg-slate-900/40 border rounded-2xl p-5 hover:border-slate-600 transition-all group flex items-center gap-4 ${x.border}`,children:[a.jsx("div",{className:`w-11 h-11 rounded-xl flex items-center justify-center shrink-0 ${x.bg} border ${x.border}`,children:v&&a.jsx(v.icon,{size:18,className:x.text})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-1 flex-wrap",children:[a.jsx("span",{className:"font-black text-white",children:m.protocolo||`Pedido #${m.id}`}),a.jsx(fb,{status:m.status}),m.cliente_tipo&&a.jsx("span",{className:`text-[10px] font-black uppercase ${m.cliente_tipo==="PJ"?"text-purple-400":"text-cyan-400"}`,children:m.cliente_tipo})]}),a.jsx("p",{className:"text-sm text-slate-400 truncate",children:m.cliente_nome||"Sem cadastro"}),a.jsxs("p",{className:"text-xs text-slate-600 mt-0.5",children:[so(m.created_at)," · ",m.tipo_entrega]})]}),a.jsxs("div",{className:"text-right shrink-0",children:[a.jsx("p",{className:"font-black text-white tabular-nums text-lg",children:ei(m.total)}),a.jsx(x8,{value:m.forma_pagto,compact:!0})]})]},m.id)})}),c&&a.jsx(Fve,{pedido:c,onClose:()=>u(null),onUpdate:p})]})}const n_=[{id:"overview",icon:a.jsx(Pr,{size:28}),gradient:"from-amber-500 to-orange-600",title:"Inbox Interno",subtitle:"Comunicação entre setores operacionais",content:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-[14px] text-slate-300 leading-relaxed",children:["O ",a.jsx("strong",{className:"text-white",children:"Inbox Interno"})," é o canal de comunicação entre os setores que processam pedidos — cotação, separação, embalagem, auditoria, expedição e mais."]}),a.jsxs("div",{className:"bg-slate-900 border border-amber-500/20 rounded-xl p-3 space-y-2",children:[a.jsx("p",{className:"text-[11px] font-bold text-amber-400 uppercase tracking-widest mb-2",children:"Exemplos de uso"}),[{emoji:"📦",msg:"Pedido #1042 separado. Aguardando auditoria.",from:"Separação → Auditoria"},{emoji:"🧾",msg:"NF do pedido #1098 com divergência de valor. Preciso checar.",from:"Fiscal → Cotação"},{emoji:"🚚",msg:"Transportadora atrasou. Pedidos #1110 e #1111 postergados.",from:"Expedição → Geral"}].map((e,t)=>a.jsxs("div",{className:"flex gap-2.5 bg-slate-950/50 rounded-lg px-2.5 py-2",children:[a.jsx("span",{className:"text-base leading-none flex-shrink-0",children:e.emoji}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-[11px] text-white leading-snug",children:['"',e.msg,'"']}),a.jsx("p",{className:"text-[10px] text-slate-600 mt-0.5",children:e.from})]})]},t))]}),a.jsxs("div",{className:"flex items-start gap-2 bg-amber-500/10 border border-amber-500/20 rounded-xl px-3 py-2.5",children:[a.jsx(Mo,{size:13,className:"text-amber-400 flex-shrink-0 mt-0.5"}),a.jsxs("p",{className:"text-[12px] text-amber-200",children:["Tudo gira em torno de ",a.jsx("strong",{children:"pedidos"}),". Mensagens podem ser vinculadas a um número de pedido para rastreio."]})]})]})},{id:"setores",icon:a.jsx(dI,{size:28}),gradient:"from-slate-600 to-slate-800",title:"Setores",subtitle:"Navegação e badges na sidebar",content:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-[14px] text-slate-300 leading-relaxed",children:"A sidebar esquerda lista todos os setores operacionais. Clique em um setor para ver suas mensagens — o setor ativo fica destacado em âmbar."}),a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-xl overflow-hidden",children:[a.jsx("div",{className:"px-3 py-2 border-b border-white/5",children:a.jsx("p",{className:"text-[10px] text-slate-500 font-bold uppercase tracking-widest",children:"Setores disponíveis"})}),a.jsx("div",{className:"divide-y divide-white/5",children:[{emoji:"💬",label:"Geral",desc:"Avisos sem setor específico"},{emoji:"📋",label:"Cotação",desc:"Pedidos e cotações de produtos"},{emoji:"📦",label:"Separação",desc:"Processo de separação de itens"},{emoji:"🚚",label:"Expedição",desc:"Despacho e entrega de pedidos",badge:!0}].map(e=>a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[a.jsx("span",{className:"text-base leading-none",children:e.emoji}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-[12px] text-white font-medium",children:e.label}),a.jsx("p",{className:"text-[10px] text-slate-500",children:e.desc})]}),e.badge&&a.jsx("span",{className:"bg-rose-500 text-white text-[10px] font-black px-1.5 py-0.5 rounded-full",children:"3"})]},e.label))})]}),a.jsxs("div",{className:"flex items-start gap-2 bg-rose-500/10 border border-rose-500/20 rounded-xl px-3 py-2.5",children:[a.jsx(RP,{size:13,className:"text-rose-400 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-[12px] text-rose-200",children:"O badge vermelho indica mensagens não lidas naquele setor — some ao marcar como lidas."})]})]})},{id:"mensagens",icon:a.jsx(rn,{size:28}),gradient:"from-blue-600 to-blue-800",title:"Mensagens",subtitle:"Leitura, filtros e marcação",content:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-[14px] text-slate-300 leading-relaxed",children:"Mensagens não lidas ficam destacadas com um ponto âmbar. Lidas aparecem com opacidade reduzida."}),a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-xl overflow-hidden divide-y divide-white/5",children:[a.jsxs("div",{className:"flex gap-3 px-3 py-2.5 bg-amber-500/5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-amber-400 mt-1.5 shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[12px] font-bold text-white",children:"Ana Silva"}),a.jsxs("span",{className:"text-[10px] text-slate-500 flex items-center gap-0.5",children:[a.jsx(bs,{size:9})," #1042"]}),a.jsx("span",{className:"ml-auto text-[10px] text-slate-600",children:"2min"})]}),a.jsx("p",{className:"text-[11px] text-slate-300",children:"Pedido separado, aguardando auditoria."})]})]}),a.jsxs("div",{className:"flex gap-3 px-3 py-2.5 opacity-50",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-slate-700 mt-1.5 shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[12px] font-bold text-white",children:"Carlos"}),a.jsx("span",{className:"ml-auto text-[10px] text-slate-600",children:"10min"})]}),a.jsx("p",{className:"text-[11px] text-slate-300",children:"Embalagem finalizada."})]})]})]}),a.jsx("div",{className:"space-y-2",children:[{icon:"✅",tip:"Clique no ✓ para marcar uma mensagem como lida individualmente"},{icon:"☑️",tip:'"Marcar todas lidas" limpa todas as não lidas do setor ativo de uma vez'},{icon:"🔍",tip:'"Só não lidas" filtra e exibe apenas mensagens pendentes de leitura'}].map((e,t)=>a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("span",{className:"text-[14px] mt-0.5 flex-shrink-0",children:e.icon}),a.jsx("p",{className:"text-[12px] text-slate-300",children:e.tip})]},t))})]})},{id:"enviar",icon:a.jsx(Rr,{size:28}),gradient:"from-emerald-600 to-teal-700",title:"Enviar Mensagem",subtitle:"Compose e atalhos",content:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-[14px] text-slate-300 leading-relaxed",children:["O painel de envio fica fixo no rodapé. A mensagem vai para o ",a.jsx("strong",{className:"text-white",children:"setor selecionado"})," na sidebar."]}),a.jsxs("div",{className:"bg-slate-950/50 border border-white/10 rounded-xl p-3 space-y-2",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"w-32 bg-slate-900 border border-white/10 rounded-lg px-2.5 py-1.5 text-[11px] text-slate-500",children:"Pedido # (opcional)"}),a.jsx("p",{className:"text-[10px] text-slate-600 self-center",children:"Ctrl+Enter para enviar"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex-1 bg-slate-900 border border-white/10 rounded-xl px-3 py-2 text-[11px] text-slate-500 min-h-[40px]",children:"Mensagem para Cotação..."}),a.jsxs("button",{className:"self-end px-3 py-1.5 bg-amber-500 text-black font-bold rounded-xl text-[11px] flex items-center gap-1",children:[a.jsx(Rr,{size:11})," Enviar"]})]})]}),a.jsx("div",{className:"space-y-2",children:[{label:"Pedido #",desc:"Vincule a mensagem a um pedido específico para rastreio"},{label:"Ctrl+Enter",desc:"Atalho para enviar sem tirar as mãos do teclado"},{label:"Setor destino",desc:"Mude o setor na sidebar antes de escrever"}].map(e=>a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ts,{size:13,className:"text-emerald-400 flex-shrink-0 mt-0.5"}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[12px] font-semibold text-emerald-300",children:[e.label," — "]}),a.jsx("span",{className:"text-[12px] text-slate-400",children:e.desc})]})]},e.label))}),a.jsxs("div",{className:"flex items-start gap-2 bg-emerald-500/10 border border-emerald-500/20 rounded-xl px-3 py-2.5",children:[a.jsx(Tp,{size:13,className:"text-emerald-400 flex-shrink-0 mt-0.5"}),a.jsx("p",{className:"text-[12px] text-emerald-200",children:"Após enviar, a lista recarrega automaticamente para refletir a nova mensagem."})]})]})},{id:"diferenca",icon:a.jsx(YP,{size:28}),gradient:"from-violet-600 to-indigo-700",title:"Inbox Interno vs WhatsApp Inbox",subtitle:"Quando usar cada um?",content:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"text-[13px] text-slate-300 leading-relaxed",children:["Existem ",a.jsx("strong",{className:"text-white",children:"duas inboxes"})," diferentes no sistema. Cada uma tem um propósito distinto:"]}),a.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/25 rounded-xl p-3 space-y-1.5",children:[a.jsxs("p",{className:"text-[12px] font-bold text-amber-300 flex items-center gap-1.5",children:[a.jsx(Pr,{size:13})," Inbox Interno (você está aqui)"]}),a.jsxs("p",{className:"text-[11px] text-slate-400 leading-snug",children:["Para comunicação sobre o ",a.jsx("strong",{className:"text-white",children:"fluxo de pedidos"})," entre setores. Usado por gestores e operadores."]}),a.jsx("div",{className:"space-y-1 mt-1",children:['📦 "Pedido #1055 com item faltando, verificar estoque"','🧾 "NF do pedido #1098 com divergência de CFOP"','🚚 "Carga do turno pronta para expedição"'].map((e,t)=>a.jsx("p",{className:"text-[11px] text-amber-200/80 bg-amber-500/5 rounded-lg px-2.5 py-1.5 leading-snug",children:e},t))})]}),a.jsxs("div",{className:"bg-[#00a884]/10 border border-[#00a884]/25 rounded-xl p-3 space-y-1.5",children:[a.jsxs("p",{className:"text-[12px] font-bold text-[#25d366] flex items-center gap-1.5",children:[a.jsx(rn,{size:13})," WhatsApp Inbox → menu lateral"]}),a.jsxs("p",{className:"text-[11px] text-slate-400 leading-snug",children:["Para ",a.jsx("strong",{className:"text-white",children:"atendimento ao cliente via WhatsApp"})," e comunicação da equipe de atendentes."]}),a.jsx("div",{className:"space-y-1 mt-1",children:['🤖 "IA escalou cliente que quer falar com humano"','💬 "DM para colega: você atendeu o protocolo #884?"','📣 "Aviso do gerente para toda equipe de atendimento"'].map((e,t)=>a.jsx("p",{className:"text-[11px] text-[#25d366]/80 bg-[#00a884]/5 rounded-lg px-2.5 py-1.5 leading-snug",children:e},t))})]}),a.jsx("p",{className:"text-[11px] text-slate-500 text-center",children:"Regra rápida: pedido → Inbox Interno · cliente/atendente → WhatsApp Inbox"})]})}];function Wve({total:e,current:t,onGo:n}){return a.jsx("div",{className:"flex items-center gap-1.5",children:Array.from({length:e}).map((r,s)=>a.jsx("button",{onClick:()=>n(s),className:`rounded-full transition-all duration-200 ${s===t?"w-5 h-2 bg-amber-400":"w-2 h-2 bg-slate-700 hover:bg-slate-500"}`},s))})}function qve({onClose:e}){const[t,n]=b.useState(0),r=n_.length,s=n_[t],i=b.useCallback(()=>n(l=>Math.min(l+1,r-1)),[r]),o=b.useCallback(()=>n(l=>Math.max(l-1,0)),[]);return b.useEffect(()=>{const l=c=>{c.key==="Escape"&&e(),c.key==="ArrowRight"&&i(),c.key==="ArrowLeft"&&o()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,i,o]),a.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:l=>{l.target===l.currentTarget&&e()},children:a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl shadow-2xl w-full max-w-md overflow-hidden flex flex-col",style:{maxHeight:"90vh"},children:[a.jsxs("div",{className:`bg-gradient-to-br ${s.gradient} px-6 pt-6 pb-5 relative flex-shrink-0`,children:[a.jsx("button",{onClick:e,className:"absolute top-4 right-4 p-1.5 rounded-full bg-black/20 hover:bg-black/40 text-white transition",children:a.jsx(Ce,{size:14})}),a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-12 h-12 rounded-2xl bg-black/20 flex items-center justify-center text-white flex-shrink-0",children:s.icon}),a.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[a.jsxs("p",{className:"text-white/60 text-[11px] font-medium uppercase tracking-widest",children:[t+1," de ",r]}),a.jsx("h2",{className:"text-white text-[18px] font-bold leading-tight mt-0.5",children:s.title}),a.jsx("p",{className:"text-white/70 text-[12px] mt-0.5",children:s.subtitle})]})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5 min-h-0",children:s.content}),a.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-t border-white/10 bg-slate-950/60",children:[a.jsxs("button",{onClick:o,disabled:t===0,className:"flex items-center gap-1.5 px-4 py-2 rounded-xl text-[12px] font-medium text-slate-400 hover:bg-white/5 disabled:opacity-30 disabled:cursor-not-allowed transition",children:[a.jsx(xd,{size:15}),"Anterior"]}),a.jsx(Wve,{total:r,current:t,onGo:n}),t{o();const u=setInterval(o,6e4);return()=>clearInterval(u)},[]),!e.length)return null;const l=u=>u.replace("@s.whatsapp.net","").replace("@c.us",""),c=u=>u>=60?`${Math.floor(u/60)}h${u%60>0?String(u%60).padStart(2,"0")+"min":""}`:`${u}min`;return a.jsxs("div",{className:"border-b border-amber-500/30 bg-amber-500/5",children:[a.jsxs("button",{onClick:()=>r(u=>!u),className:"w-full flex items-center gap-3 px-4 py-2.5 text-left hover:bg-amber-500/5 transition-colors",children:[a.jsx(Kt,{size:14,className:"text-amber-400 shrink-0 animate-pulse"}),a.jsxs("span",{className:"text-amber-400 font-black text-xs flex-1",children:[e.length," chat",e.length>1?"s":""," sem resposta da IA"]}),a.jsx("button",{onClick:u=>{u.stopPropagation(),o()},className:"p-1 text-amber-600 hover:text-amber-400 transition-colors",children:a.jsx(ke,{size:11,className:s?"animate-spin":""})}),a.jsx("span",{className:"text-amber-600 text-[10px]",children:n?"▲":"▼"})]}),n&&a.jsx("div",{className:"max-h-52 overflow-y-auto border-t border-amber-500/20",children:e.map((u,d)=>a.jsxs("div",{className:"flex items-start gap-3 px-4 py-2.5 border-b border-white/5 last:border-0",children:[a.jsx(x1,{size:13,className:"text-amber-500 shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-bold text-white truncate",children:l(u.chat_id)}),a.jsxs("p",{className:"text-[11px] text-slate-400 truncate",children:['"',u.ultima_msg||"—",'"']}),u.ultima_reply_status==="failed"&&a.jsx("p",{className:"text-[10px] text-rose-400 font-bold mt-0.5",children:"IA falhou na última tentativa"})]}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0 text-amber-400",children:[a.jsx(hn,{size:10}),a.jsx("span",{className:"text-[10px] font-bold",children:c(Number(u.minutos_aguardando))})]})]},d))})]})}const ap=[{id:"geral",label:"Geral",emoji:"💬"},{id:"atendimento",label:"Atendimento",emoji:"🎧"},{id:"cotacao",label:"Cotação",emoji:"📋"},{id:"separacao",label:"Separação",emoji:"📦"},{id:"embalagem",label:"Embalagem",emoji:"🎁"},{id:"auditoria",label:"Auditoria",emoji:"🔍"},{id:"fiscal",label:"Fiscal",emoji:"🧾"},{id:"expedicao",label:"Expedição",emoji:"🚚"},{id:"financeiro",label:"Financeiro",emoji:"💰"},{id:"suporte",label:"Suporte",emoji:"🛠"}];function Kve(e){const t=new Date(e),n=Date.now()-t.getTime();return n<6e4?"agora":n<36e5?`${Math.floor(n/6e4)}min`:n<864e5?t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString("pt-BR")}function Gve({msg:e,onLer:t}){return a.jsxs("div",{className:`flex gap-3 p-4 border-b border-white/5 transition-colors + ${e.lida?"opacity-60":"bg-amber-500/3 hover:bg-white/3"}`,children:[a.jsx("div",{className:`w-2 h-2 rounded-full mt-1.5 shrink-0 ${e.lida?"bg-slate-700":"bg-amber-400"}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-2 mb-0.5",children:[a.jsx("span",{className:"text-sm font-semibold text-white",children:e.remetente}),e.pedido_id&&a.jsxs("span",{className:"text-[10px] text-slate-500 flex items-center gap-0.5",children:[a.jsx(bs,{size:9})," #",e.pedido_id]}),a.jsx("span",{className:"ml-auto text-[10px] text-slate-600 shrink-0",children:Kve(e.created_at)})]}),a.jsx("p",{className:"text-sm text-slate-300 leading-snug",children:e.mensagem})]}),!e.lida&&a.jsx("button",{onClick:()=>t(e.id),title:"Marcar como lida",className:"text-slate-600 hover:text-emerald-400 transition-colors shrink-0 mt-0.5",children:a.jsx(jt,{size:14})})]})}function Xve({setorAtivo:e,onSent:t}){var p;const[n,r]=b.useState(""),[s,i]=b.useState(""),[o,l]=b.useState(!1),[c,u]=b.useState("");async function d(){var h,m;if(n.trim()){l(!0),u("");try{await So.enviar({setor:e,mensagem:n.trim(),pedido_id:s?Number(s):void 0}),r(""),i(""),t()}catch(v){u(((m=(h=v==null?void 0:v.response)==null?void 0:h.data)==null?void 0:m.error)??"Erro ao enviar")}finally{l(!1)}}}function f(h){h.key==="Enter"&&(h.ctrlKey||h.metaKey)&&d()}return a.jsxs("div",{className:"border-t border-white/10 p-4 bg-slate-950/50",children:[c&&a.jsxs("p",{className:"text-xs text-rose-400 mb-2 flex items-center gap-1",children:[a.jsx(Ce,{size:12})," ",c]}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{type:"number",value:s,onChange:h=>i(h.target.value),placeholder:"Pedido # (opcional)",className:"w-32 bg-slate-900 border border-white/10 rounded-lg px-3 py-1.5 text-sm text-white placeholder:text-slate-600 focus:outline-none focus:border-amber-500/50"}),a.jsx("span",{className:"text-xs text-slate-600 self-center",children:"Ctrl+Enter para enviar"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("textarea",{value:n,onChange:h=>r(h.target.value),onKeyDown:f,placeholder:`Mensagem para ${((p=ap.find(h=>h.id===e))==null?void 0:p.label)??e}...`,rows:2,className:"flex-1 bg-slate-900 border border-white/10 rounded-xl px-3 py-2 text-sm text-white placeholder:text-slate-600 resize-none focus:outline-none focus:border-amber-500/50"}),a.jsxs("button",{onClick:d,disabled:o||!n.trim(),className:"self-end px-4 py-2 bg-amber-500 text-black font-bold rounded-xl hover:bg-amber-400 disabled:opacity-50 transition-colors flex items-center gap-1.5",children:[o?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(Rr,{size:14}),"Enviar"]})]})]})}function r_(){var j,N;const[e,t]=b.useState("geral"),[n,r]=b.useState([]),[s,i]=b.useState(!1),[o,l]=b.useState({}),[c,u]=b.useState(!1),[d,f]=b.useState(!1),p=b.useRef(null);async function h(){try{const{por_setor:w}=await So.contadores(),S={};for(const k of w)S[k.setor]=Number(k.total);l(S)}catch{}}async function m(w,S){i(!0);try{const k=await So.listBySetor(w,S||void 0);r(k)}catch{}finally{i(!1)}}b.useEffect(()=>{h(),m(e,c);const w=setInterval(h,3e4);return()=>clearInterval(w)},[]),b.useEffect(()=>{m(e,c)},[e,c]);async function v(w){await So.marcarLida(w),r(S=>S.map(k=>k.id===w?{...k,lida:!0}:k)),h()}async function x(){await So.marcarTodasSetor(e),r(w=>w.map(S=>({...S,lida:!0}))),h()}function y(){m(e,c)}const g=n.filter(w=>!w.lida).length;return a.jsxs("div",{className:"flex h-screen bg-black overflow-hidden",children:[d&&a.jsx(qve,{onClose:()=>f(!1)}),a.jsxs("div",{className:"w-52 shrink-0 bg-slate-950 border-r border-white/10 flex flex-col",children:[a.jsx(Hve,{}),a.jsxs("div",{className:"px-4 py-3 border-b border-white/10 flex items-center gap-2",children:[a.jsxs("h2",{className:"text-sm font-black text-white flex items-center gap-2 flex-1",children:[a.jsx(Pr,{size:15,className:"text-amber-400"})," Inbox"]}),a.jsx("button",{onClick:()=>f(!0),title:"Ajuda",className:"p-1 rounded-full text-slate-600 hover:text-amber-400 hover:bg-white/5 transition-colors",children:a.jsx(Ol,{size:14})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:ap.map(w=>a.jsxs("button",{onClick:()=>t(w.id),className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-left transition-colors + ${e===w.id?"bg-amber-500/10 text-amber-400":"text-slate-400 hover:text-white hover:bg-white/3"}`,children:[a.jsx("span",{className:"text-base leading-none",children:w.emoji}),a.jsx("span",{className:"text-sm font-medium flex-1",children:w.label}),o[w.id]>0&&a.jsx("span",{className:"bg-rose-500 text-white text-[10px] font-black px-1.5 py-0.5 rounded-full leading-none",children:o[w.id]}),e===w.id&&a.jsx(Pa,{size:12,className:"shrink-0"})]},w.id))})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-3 border-b border-white/10 bg-slate-950/60",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-lg leading-none",children:(j=ap.find(w=>w.id===e))==null?void 0:j.emoji}),a.jsx("span",{className:"font-bold text-white",children:(N=ap.find(w=>w.id===e))==null?void 0:N.label}),o[e]>0&&a.jsxs("span",{className:"bg-rose-500/10 text-rose-400 border border-rose-500/20 text-xs px-2 py-0.5 rounded-full font-bold",children:[o[e]," não lida",o[e]>1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer select-none",children:[a.jsx("input",{type:"checkbox",checked:c,onChange:w=>u(w.target.checked),className:"accent-amber-500"}),"Só não lidas"]}),g>0&&a.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 text-xs text-emerald-400 hover:text-emerald-300 transition-colors",children:[a.jsx(Tp,{size:13})," Marcar todas lidas"]}),a.jsx("button",{onClick:()=>m(e,c),className:"p-1.5 text-slate-500 hover:text-white rounded-lg hover:bg-white/5 transition-colors",children:a.jsx(ke,{size:13})})]})]}),a.jsx("div",{ref:p,className:"flex-1 overflow-y-auto",children:s?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsx("div",{className:"w-6 h-6 border-2 border-amber-500 border-t-transparent rounded-full animate-spin"})}):n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-3 text-slate-600",children:[a.jsx(rn,{size:36,className:"opacity-30"}),a.jsxs("p",{className:"text-sm",children:["Nenhuma mensagem",c?" não lida":""," neste setor."]})]}):n.map(w=>a.jsx(Gve,{msg:w,onLer:v},w.id))}),a.jsx(Xve,{setorAtivo:e,onSent:y})]})]})}const Af=e=>e!=null?`R$ ${Number(e).toFixed(2).replace(".",",")}`:"—",Ya=e=>e!=null?Number(e).toLocaleString("pt-BR"):"—";function ti(){return new Date().toISOString().slice(0,10)}function pb(e){const t=new Date;return t.setDate(t.getDate()-e),t.toISOString().slice(0,10)}function Yve({from:e,to:t}){const[n,r]=b.useState([]),[s,i]=b.useState(!1);return b.useEffect(()=>{i(!0),$.get("/cotacoes/admin/relatorio/ranking",{params:{from:e,to:t}}).then(o=>r(o.data??[])).catch(()=>{}).finally(()=>i(!1))},[e,t]),s?a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(ke,{size:20,className:"animate-spin text-amber-400"})}):n.length?a.jsx("div",{className:"flex flex-col gap-3",children:n.map((o,l)=>a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl p-4 flex items-center gap-4",children:[a.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-lg font-black shrink-0",style:{background:l===0?"#f59e0b22":l===1?"#94a3b822":"#475569/10",color:l===0?"#f59e0b":l===1?"#94a3b8":"#64748b"},children:l===0?"🥇":l===1?"🥈":l===2?"🥉":`#${l+1}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-sm font-bold text-white",children:["Equipe ",o.equipe_id]}),a.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 mt-0.5 text-xs text-slate-400",children:[a.jsxs("span",{children:["✅ ",Ya(o.pedidos_entregues)," entregues"]}),a.jsxs("span",{children:["📦 ",Ya(o.pedidos_processados)," processados"]}),o.media_horas_entrega!=null&&a.jsxs("span",{children:["⏱ ",o.media_horas_entrega,"h média"]})]})]})]},o.equipe_id))}):a.jsx("div",{className:"text-center py-16 text-slate-500 text-sm",children:"Nenhum dado encontrado para o período selecionado."})}const Qve={aguardando:"Aguardando",separacao:"Separação",embalagem:"Embalagem",auditoria:"Auditoria",fiscal:"Fiscal",expedicao:"Expedição",entregue:"Entregue",cancelado:"Cancelado"};function Jve({from:e,to:t}){var f,p;const[n,r]=b.useState(null),[s,i]=b.useState(!1);if(b.useEffect(()=>{i(!0),$.get("/cotacoes/admin/relatorio/setor",{params:{from:e,to:t}}).then(h=>r(h.data)).catch(()=>{}).finally(()=>i(!1))},[e,t]),s)return a.jsx("div",{className:"flex items-center justify-center py-16",children:a.jsx(ke,{size:20,className:"animate-spin text-amber-400"})});if(!n)return null;const{volume_por_status:o=[],volume_por_dia:l=[],top_clientes:c=[]}=n,u=o.reduce((h,m)=>h+Number(m.total),0),d=o.reduce((h,m)=>h+Number(m.receita||0),0);return a.jsxs("div",{className:"flex flex-col gap-6",children:[a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[{label:"Total de Pedidos",value:Ya(u),icon:bs,color:"#f59e0b"},{label:"Receita Total",value:Af(d),icon:Wi,color:"#10b981"},{label:"Entregues",value:Ya(((f=o.find(h=>h.status==="entregue"))==null?void 0:f.total)??0),icon:ym,color:"#06b6d4"},{label:"Cancelados",value:Ya(((p=o.find(h=>h.status==="cancelado"))==null?void 0:p.total)??0),icon:et,color:"#f43f5e"}].map(h=>{const m=h.icon;return a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(m,{size:14,style:{color:h.color}}),a.jsx("p",{className:"text-xs text-slate-400",children:h.label})]}),a.jsx("p",{className:"text-xl font-black text-white",children:h.value})]},h.label)})}),a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl p-4",children:[a.jsx("p",{className:"text-sm font-bold text-white mb-3",children:"Volume por Status"}),a.jsx("div",{className:"flex flex-col gap-2",children:o.map(h=>{const m=u>0?Number(h.total)/u*100:0;return a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-xs text-slate-400 w-24 shrink-0",children:Qve[h.status]??h.status}),a.jsx("div",{className:"flex-1 bg-slate-800 rounded-full h-1.5",children:a.jsx("div",{className:"h-1.5 rounded-full bg-amber-500",style:{width:`${m}%`}})}),a.jsx("span",{className:"text-xs text-white font-bold w-6 text-right",children:Ya(h.total)}),a.jsx("span",{className:"text-xs text-slate-500 w-24 text-right",children:Af(h.receita)})]},h.status)})})]}),l.length>0&&a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl p-4 overflow-x-auto",children:[a.jsxs("p",{className:"text-sm font-bold text-white mb-3",children:["Volume por Dia (últimos ",l.length," dias)"]}),a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-slate-500 border-b border-white/10",children:[a.jsx("th",{className:"text-left py-1 pr-4",children:"Data"}),a.jsx("th",{className:"text-right py-1 pr-4",children:"Pedidos"}),a.jsx("th",{className:"text-right py-1",children:"Receita"})]})}),a.jsx("tbody",{children:l.map(h=>a.jsxs("tr",{className:"border-b border-white/5 hover:bg-white/3",children:[a.jsx("td",{className:"py-1.5 pr-4 text-slate-300",children:new Date(h.dia).toLocaleDateString("pt-BR")}),a.jsx("td",{className:"py-1.5 pr-4 text-right font-bold text-white",children:Ya(h.pedidos)}),a.jsx("td",{className:"py-1.5 text-right text-emerald-400",children:Af(h.receita)})]},h.dia))})]})]}),c.length>0&&a.jsxs("div",{className:"bg-slate-900 border border-white/10 rounded-2xl p-4",children:[a.jsx("p",{className:"text-sm font-bold text-white mb-3",children:"Top 10 Clientes"}),a.jsx("div",{className:"flex flex-col gap-2",children:c.map((h,m)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("span",{className:"text-xs text-slate-500 w-4 text-right shrink-0",children:[m+1,"."]}),a.jsx("span",{className:"text-xs text-white flex-1 truncate",children:h.cliente??"—"}),a.jsxs("span",{className:"text-xs text-slate-400",children:[Ya(h.pedidos)," ped."]}),a.jsx("span",{className:"text-xs font-bold text-amber-400 w-24 text-right",children:Af(h.gasto)})]},m))})]})]})}const Zve=[{label:"Hoje",from:()=>ti(),to:()=>ti()},{label:"7 dias",from:()=>pb(7),to:()=>ti()},{label:"30 dias",from:()=>pb(30),to:()=>ti()},{label:"Mês",from:()=>ti().slice(0,7)+"-01",to:()=>ti()}];function eye(){const[e,t]=b.useState("performance"),[n,r]=b.useState(pb(30)),[s,i]=b.useState(ti());return a.jsxs("div",{className:"max-w-4xl mx-auto",children:[a.jsx("div",{className:"flex flex-wrap items-center justify-between gap-4 mb-8",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl font-black text-white flex items-center gap-2",children:[a.jsx(ys,{size:22,className:"text-amber-400"})," Relatórios"]}),a.jsx("p",{className:"text-slate-400 text-sm mt-0.5",children:"Performance operacional e ranking de equipes"})]})}),a.jsxs("div",{className:"flex flex-wrap gap-2 mb-5",children:[Zve.map(o=>a.jsx("button",{onClick:()=>{r(o.from()),i(o.to())},className:`px-3 py-1.5 rounded-lg text-xs font-semibold transition-colors + ${n===o.from()&&s===o.to()?"bg-amber-500 text-black":"bg-slate-800 text-slate-400 hover:text-white"}`,children:o.label},o.label)),a.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[a.jsx(Op,{size:13,className:"text-slate-500"}),a.jsx("input",{type:"date",value:n,onChange:o=>r(o.target.value),className:"bg-slate-900 border border-white/10 rounded-lg px-2 py-1 text-xs text-white"}),a.jsx("span",{className:"text-slate-500 text-xs",children:"até"}),a.jsx("input",{type:"date",value:s,onChange:o=>i(o.target.value),className:"bg-slate-900 border border-white/10 rounded-lg px-2 py-1 text-xs text-white"})]})]}),a.jsx("div",{className:"flex gap-1 bg-slate-900 rounded-xl p-1 mb-6 w-fit",children:[{id:"performance",label:"Performance",icon:Wi},{id:"ranking",label:"Ranking Equipes",icon:ym}].map(o=>{const l=o.icon;return a.jsxs("button",{onClick:()=>t(o.id),className:`flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-semibold transition-colors + ${e===o.id?"bg-amber-500 text-black":"text-slate-400 hover:text-white"}`,children:[a.jsx(l,{size:14})," ",o.label]},o.id)})}),e==="performance"&&a.jsx(Jve,{from:n,to:s}),e==="ranking"&&a.jsx(Yve,{from:n,to:s})]})}function tye(e){return`R$ ${Number(e||0).toFixed(2).replace(".",",")}`}function a_(e){try{const t=new AudioContext,n=t.createOscillator(),r=t.createGain();n.connect(r),r.connect(t.destination),n.frequency.value=e?880:330,n.type="sine",r.gain.setValueAtTime(.4,t.currentTime),r.gain.exponentialRampToValueAtTime(.001,t.currentTime+.18),n.start(t.currentTime),n.stop(t.currentTime+.18)}catch{}}function s_(e){var t;try{(t=navigator.vibrate)==null||t.call(navigator,e?[50]:[80,40,80])}catch{}}function nye({pedido:e,onClick:t}){return a.jsxs("button",{onClick:t,className:"w-full text-left bg-slate-900 border border-white/10 rounded-2xl p-4 hover:border-amber-500/30 transition-all active:scale-[.98]",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-bold text-sm",children:e.protocolo||`#${e.id}`}),a.jsx("p",{className:"text-slate-400 text-xs mt-0.5 truncate",children:e.cliente_nome||"—"})]}),a.jsx("span",{className:"text-xs font-black text-amber-400 shrink-0",children:tye(e.total)})]}),a.jsx("div",{className:"mt-3 flex items-center gap-2",children:a.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest bg-blue-500/10 text-blue-400 border border-blue-500/20 px-2 py-0.5 rounded-full",children:"Separação"})})]})}const i_=[{id:"falta",label:"🚫 Falta",cor:"border-rose-500/40 text-rose-400 bg-rose-500/10"},{id:"marca_diferente",label:"🔄 Marca diferente",cor:"border-amber-500/40 text-amber-400 bg-amber-500/10"},{id:"substituicao",label:"📸 Substituição",cor:"border-blue-500/40 text-blue-400 bg-blue-500/10"}];function rye({item:e,onSeparado:t,onAlerta:n}){const[r,s]=b.useState(!1),[i,o]=b.useState(e.alerta_tipo||""),[l,c]=b.useState(e.alerta_obs||""),[u,d]=b.useState(e.alerta_foto||""),[f,p]=b.useState(!1);async function h(){if(i){p(!0);try{await $.patch(`/cotacoes/admin/pedidos/itens/${e.id}/alerta`,{tipo:i,obs:l,foto:u||null}),n(e.id,{alerta_tipo:i,alerta_obs:l,alerta_foto:u||null,alerta_confirmado:!1}),s(!1)}catch{}finally{p(!1)}}}async function m(){p(!0);try{await $.delete(`/cotacoes/admin/pedidos/itens/${e.id}/alerta`),n(e.id,{alerta_tipo:null,alerta_obs:null,alerta_foto:null,alerta_confirmado:!1}),o(""),c(""),d("")}catch{}finally{p(!1)}}const v=i_.find(x=>x.id===e.alerta_tipo);return a.jsxs("div",{className:`rounded-xl border transition-all ${e.separado?"bg-emerald-500/5 border-emerald-500/20":e.alerta_tipo?"bg-slate-900 border-rose-500/30":"bg-slate-900 border-white/8"}`,children:[a.jsxs("div",{className:"flex items-center gap-3 p-3",children:[a.jsx("button",{onClick:()=>t(e.id,!e.separado),className:`w-7 h-7 rounded-lg flex items-center justify-center shrink-0 border-2 transition-all ${e.separado?"bg-emerald-500 border-emerald-500 text-white":"border-slate-600 hover:border-amber-400"}`,children:e.separado&&a.jsx(jt,{size:14})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`text-sm font-bold truncate ${e.separado?"text-slate-500 line-through":"text-white"}`,children:e.nome_produto}),a.jsxs("p",{className:"text-xs text-slate-600",children:[e.sku&&a.jsxs("span",{className:"text-slate-500 font-mono",children:[e.sku," · "]}),"Qtd: ",e.quantidade]}),e.observacao&&!e.separado&&a.jsxs("div",{className:"mt-1.5 flex items-start gap-1.5 bg-amber-500/10 border border-amber-500/30 rounded-lg px-2 py-1",children:[a.jsx(Kt,{size:12,className:"text-amber-400 shrink-0 mt-0.5"}),a.jsx("p",{className:"text-xs text-amber-300 font-semibold leading-tight",children:e.observacao})]}),e.alerta_tipo&&!r&&a.jsxs("div",{className:`mt-1.5 flex items-center gap-1.5 rounded-lg px-2 py-1 border text-xs font-bold ${(v==null?void 0:v.cor)??""}`,children:[a.jsx("span",{className:"flex-1",children:(v==null?void 0:v.label)??e.alerta_tipo}),e.alerta_confirmado&&a.jsx("span",{className:"text-emerald-400 text-[10px]",children:"✓ Confirmado"})]})]}),!e.separado&&a.jsx("button",{onClick:()=>{o(e.alerta_tipo||""),c(e.alerta_obs||""),d(e.alerta_foto||""),s(x=>!x)},title:"Sinalizar problema",className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 border transition-all ${e.alerta_tipo?"bg-rose-500/20 border-rose-500/40 text-rose-400":"border-slate-700 text-slate-500 hover:text-amber-400 hover:border-amber-500/40"}`,children:e.alerta_tipo?a.jsx(oI,{size:14}):a.jsx(Vf,{size:14})})]}),r&&a.jsxs("div",{className:"border-t border-white/8 px-3 pb-3 pt-2 space-y-2",children:[a.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500",children:"Sinalizar problema"}),a.jsx("div",{className:"flex gap-1.5 flex-wrap",children:i_.map(x=>a.jsx("button",{onClick:()=>o(x.id),className:`text-xs px-2.5 py-1 rounded-full border font-semibold transition-all ${i===x.id?x.cor:"border-slate-700 text-slate-500 hover:border-slate-500"}`,children:x.label},x.id))}),a.jsx("input",{value:l,onChange:x=>c(x.target.value),placeholder:"Observação (opcional)",className:"w-full bg-slate-800 border border-white/10 rounded-lg px-2.5 py-1.5 text-xs text-white placeholder:text-slate-600 focus:outline-none focus:border-amber-500/40"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(BP,{size:14,className:"text-slate-500 shrink-0"}),a.jsx("input",{value:u,onChange:x=>d(x.target.value),placeholder:"URL da foto (opcional)",className:"flex-1 bg-slate-800 border border-white/10 rounded-lg px-2.5 py-1.5 text-xs text-white placeholder:text-slate-600 focus:outline-none focus:border-amber-500/40"})]}),a.jsxs("div",{className:"flex gap-2 pt-1",children:[a.jsx("button",{onClick:h,disabled:!i||f,className:"flex-1 bg-amber-500 text-black text-xs font-black py-1.5 rounded-lg disabled:opacity-40",children:f?"…":"Salvar alerta"}),e.alerta_tipo&&a.jsx("button",{onClick:m,disabled:f,className:"px-3 py-1.5 rounded-lg border border-rose-500/30 text-rose-400 text-xs font-bold",children:a.jsx(Ce,{size:12})}),a.jsx("button",{onClick:()=>s(!1),className:"px-3 py-1.5 rounded-lg border border-white/10 text-slate-400 text-xs",children:"Cancelar"})]})]})]})}function aye({pedido:e,onBack:t}){const[n,r]=b.useState(e.itens||[]),[s,i]=b.useState(""),[o,l]=b.useState(null),[c,u]=b.useState(""),[d,f]=b.useState(!1),[p,h]=b.useState(""),m=b.useRef(null),v=b.useRef(null),x=b.useRef(!1),y=b.useRef(null),g=n.filter(A=>A.separado).length,j=n.length,N=g===j&&j>0,w=b.useCallback(async(A,E)=>{await $.patch(`/cotacoes/admin/pedidos/itens/${A}/separado`,{separado:E}),r(P=>P.map(D=>D.id===A?{...D,separado:E}:D))},[]),S=b.useCallback(async A=>{const E=A.trim().toUpperCase();if(!E)return;const P=n.find(D=>{var I;return!D.separado&&((I=D.sku)==null?void 0:I.toUpperCase())===E});P?(a_(!0),s_(!0),l("ok"),u(`✓ ${P.nome_produto}`),await w(P.id,!0)):n.find(I=>{var R;return I.separado&&((R=I.sku)==null?void 0:R.toUpperCase())===E})?(l("err"),u("Já separado")):(a_(!1),s_(!1),l("err"),u(`SKU não encontrado: ${E}`)),setTimeout(()=>l(null),1800)},[n,w]),k=b.useCallback(async()=>{h("");try{const A=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});v.current=A,m.current&&(m.current.srcObject=A,await m.current.play()),"BarcodeDetector"in window&&(y.current=new BarcodeDetector({formats:["ean_13","ean_8","code_128","code_39","qr_code"]})),f(!0),x.current=!0;const E=async()=>{if(x.current){if(y.current&&m.current&&m.current.readyState>=2)try{const P=await y.current.detect(m.current);if(P.length>0){const D=P[0].rawValue;x.current=!1,await S(D),setTimeout(()=>{x.current=!0,requestAnimationFrame(E)},1900);return}}catch{}requestAnimationFrame(E)}};requestAnimationFrame(E)}catch(A){h((A==null?void 0:A.message)||"Câmera indisponível")}},[S]),C=b.useCallback(()=>{var A;x.current=!1,(A=v.current)==null||A.getTracks().forEach(E=>E.stop()),v.current=null,f(!1)},[]);b.useEffect(()=>()=>{var A;x.current=!1,(A=v.current)==null||A.getTracks().forEach(E=>E.stop())},[]);async function _(A){A.preventDefault(),await S(s),i("")}return a.jsxs("div",{className:"flex flex-col min-h-screen bg-slate-950",children:[a.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-white/5",children:[a.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:a.jsx(xd,{size:22})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-white font-black text-sm truncate",children:e.protocolo||`Pedido #${e.id}`}),a.jsx("p",{className:"text-slate-500 text-xs truncate",children:e.cliente_nome})]}),a.jsxs("div",{className:"text-right shrink-0",children:[a.jsxs("p",{className:"text-sm font-black",style:{color:N?"#10b981":"#f59e0b"},children:[g,"/",j]}),a.jsx("p",{className:"text-[10px] text-slate-500",children:"itens"})]})]}),a.jsx("div",{className:"h-1 bg-slate-800",children:a.jsx("div",{className:"h-1 transition-all duration-500",style:{width:j>0?`${g/j*100}%`:"0%",background:N?"#10b981":"#f59e0b"}})}),o&&a.jsxs("div",{className:`mx-4 mt-4 px-4 py-3 rounded-2xl flex items-center gap-2 text-sm font-bold transition-all ${o==="ok"?"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400":"bg-rose-500/10 border border-rose-500/30 text-rose-400"}`,children:[o==="ok"?a.jsx(nn,{size:18}):a.jsx(Kt,{size:18}),c]}),a.jsxs("div",{className:"relative mx-4 mt-4 rounded-2xl overflow-hidden bg-slate-900 border border-white/10",style:{height:220},children:[a.jsx("video",{ref:m,className:"w-full h-full object-cover",playsInline:!0,muted:!0,style:{display:d?"block":"none"}}),!d&&a.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-slate-500",children:p?a.jsxs(a.Fragment,{children:[a.jsx(W2,{size:32}),a.jsx("p",{className:"text-xs text-center px-4",children:p})]}):a.jsxs(a.Fragment,{children:[a.jsx(q2,{size:32}),a.jsx("p",{className:"text-xs",children:"Toque para ativar a câmera"})]})}),d&&a.jsx("div",{className:"absolute inset-0 pointer-events-none flex items-center justify-center",children:a.jsx("div",{className:"w-48 h-24 border-2 border-amber-400/60 rounded-lg"})}),a.jsx("button",{onClick:d?C:k,className:`absolute bottom-3 right-3 p-2 rounded-xl text-sm font-bold transition-all ${d?"bg-rose-500/20 text-rose-400":"bg-amber-500/20 text-amber-400"}`,children:d?a.jsx(W2,{size:18}):a.jsx(q2,{size:18})})]}),a.jsxs("form",{onSubmit:_,className:"mx-4 mt-3 flex gap-2",children:[a.jsxs("div",{className:"flex-1 flex items-center bg-slate-900 border border-white/10 rounded-xl px-3 gap-2",children:[a.jsx(Ir,{size:16,className:"text-slate-500 shrink-0"}),a.jsx("input",{type:"text",value:s,onChange:A=>i(A.target.value),placeholder:"Digitar SKU manualmente…",className:"flex-1 bg-transparent py-2.5 text-sm text-white placeholder-slate-600 focus:outline-none"})]}),a.jsx("button",{type:"submit",className:"px-4 py-2.5 bg-amber-500 text-black rounded-xl font-black text-sm shrink-0",children:"OK"})]}),N?a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2 text-emerald-400",children:[a.jsx(nn,{size:40}),a.jsx("p",{className:"font-black text-lg",children:"Separação completa!"}),a.jsx("p",{className:"text-slate-500 text-sm",children:"Todos os itens foram separados"}),a.jsx("button",{onClick:t,className:"mt-3 px-6 py-2 bg-emerald-500 text-black rounded-xl font-black text-sm",children:"Voltar à lista"})]}):a.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-2",children:n.map(A=>a.jsx(rye,{item:A,onSeparado:(E,P)=>w(E,P),onAlerta:(E,P)=>r(D=>D.map(I=>I.id===E?{...I,...P}:I))},A.id))})]})}function sye(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(null),[o,l]=b.useState(!1);async function c(){r(!0);try{const d=await $.get("/cotacoes/admin/pedidos",{params:{status:"separacao",limit:50}}).then(f=>f.data);t(Array.isArray(d)?d:d.pedidos??[])}catch{}finally{r(!1)}}b.useEffect(()=>{c()},[]);async function u(d){l(!0);try{const f=await $.get(`/cotacoes/admin/pedidos/${d.id}`).then(p=>p.data);i(f)}catch{i(d)}finally{l(!1)}}return s?a.jsx(aye,{pedido:s,onBack:()=>{i(null),c()}}):a.jsxs("div",{className:"max-w-lg mx-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl font-black text-white flex items-center gap-2",children:[a.jsx(js,{size:22,className:"text-amber-400"})," Separador"]}),a.jsx("p",{className:"text-slate-400 text-sm mt-0.5",children:"Pedidos aguardando separação"})]}),a.jsx("button",{onClick:c,disabled:n,className:"p-2 rounded-xl bg-slate-800 text-slate-400 hover:text-white transition-colors disabled:opacity-40",children:a.jsx(ke,{size:16,className:n?"animate-spin":""})})]}),o&&a.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:a.jsx(Vr,{size:36,className:"animate-spin text-amber-400"})}),n?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsx(Vr,{size:28,className:"animate-spin text-amber-400"})}):e.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-3 text-slate-500",children:[a.jsx(bs,{size:40}),a.jsx("p",{className:"text-sm font-bold",children:"Nenhum pedido em separação"}),a.jsx("button",{onClick:c,className:"text-xs text-amber-400 hover:text-amber-300",children:"Atualizar"})]}):a.jsx("div",{className:"space-y-3",children:e.map(d=>a.jsx(nye,{pedido:d,onClick:()=>u(d)},d.id))})]})}const iye=e=>Number(e).toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),o_=e=>e?new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"—";function oye({s:e}){return e==="aprovado"?a.jsx("span",{className:"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 text-[10px] font-black uppercase px-2 py-0.5 rounded-full",children:"Aprovado"}):e==="rejeitado"?a.jsx("span",{className:"bg-rose-500/10 border border-rose-500/30 text-rose-400 text-[10px] font-black uppercase px-2 py-0.5 rounded-full",children:"Rejeitado"}):a.jsx("span",{className:"bg-amber-500/10 border border-amber-500/30 text-amber-400 text-[10px] font-black uppercase px-2 py-0.5 rounded-full",children:"Pendente"})}function lye({pedido:e,onDecisao:t}){const[n,r]=b.useState(!1),[s,i]=b.useState(!1),[o,l]=b.useState(""),[c,u]=b.useState("");async function d(p){var h,m;i(!0),u("");try{await pt.financeiroDecisao(e.id,p,o||void 0),t()}catch(v){u(((m=(h=v==null?void 0:v.response)==null?void 0:h.data)==null?void 0:m.error)??"Erro ao processar decisão")}finally{i(!1)}}const f=[e.rua,e.end_numero,e.bairro,e.cidade,e.estado].filter(Boolean).join(", ");return a.jsxs("div",{className:"bg-slate-900/50 border border-amber-500/20 rounded-2xl overflow-hidden",children:[a.jsxs("div",{className:"p-5 flex items-start gap-4",children:[a.jsx("div",{className:"w-11 h-11 rounded-xl bg-amber-500/10 border border-amber-500/20 flex items-center justify-center shrink-0",children:a.jsx(Nu,{size:18,className:"text-amber-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-wrap mb-1",children:[a.jsxs("span",{className:"font-black text-white",children:["Pedido #",e.id]}),a.jsx(oye,{s:e.financeiro_status}),e.cliente_tipo&&a.jsx("span",{className:`text-[10px] font-black uppercase ${e.cliente_tipo==="PJ"?"text-purple-400":"text-cyan-400"}`,children:e.cliente_tipo})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-slate-400",children:[a.jsx(ks,{size:12,className:"shrink-0"}),a.jsx("span",{children:e.cliente_nome||"Cliente não identificado"}),e.cpf_cnpj&&a.jsxs("span",{className:"text-slate-600",children:["· ",e.cpf_cnpj]})]}),f&&a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-slate-500 mt-0.5",children:[a.jsx(gm,{size:11,className:"shrink-0"}),a.jsx("span",{children:f})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-slate-600 mt-0.5",children:[a.jsx(hn,{size:11,className:"shrink-0"}),a.jsx("span",{children:o_(e.created_at)})]})]}),a.jsxs("div",{className:"text-right shrink-0",children:[a.jsx("p",{className:"font-black text-white text-lg tabular-nums",children:iye(e.total)}),a.jsx("button",{onClick:()=>r(p=>!p),className:"text-slate-500 hover:text-white transition-colors mt-1",children:n?a.jsx(p1,{size:16}):a.jsx(aa,{size:16})})]})]}),n&&e.financeiro_status==="pendente"&&a.jsxs("div",{className:"border-t border-white/5 p-5 flex flex-col gap-3",children:[a.jsxs("p",{className:"text-xs text-slate-400",children:["O cliente solicitou ",a.jsx("strong",{className:"text-amber-400",children:"pagamento na entrega"}),". Avalie o histórico e decida se libera ou recusa."]}),a.jsx("textarea",{value:o,onChange:p=>l(p.target.value),placeholder:"Observação interna (opcional)...",rows:2,className:"w-full bg-slate-800/60 border border-white/10 rounded-xl px-3 py-2 text-sm text-white placeholder:text-slate-600 resize-none focus:outline-none focus:border-amber-500/50"}),c&&a.jsxs("div",{className:"flex items-center gap-2 text-rose-400 text-xs",children:[a.jsx(Kt,{size:13})," ",c]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("button",{disabled:s,onClick:()=>d("rejeitar"),className:"flex items-center justify-center gap-2 py-2.5 rounded-xl border border-rose-500/30 bg-rose-500/10 text-rose-400 hover:bg-rose-500/20 font-black text-sm transition-colors disabled:opacity-50",children:[a.jsx(Ai,{size:16})," Rejeitar"]}),a.jsxs("button",{disabled:s,onClick:()=>d("aprovar"),className:"flex items-center justify-center gap-2 py-2.5 rounded-xl border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20 font-black text-sm transition-colors disabled:opacity-50",children:[s?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(nn,{size:16}),"Aprovar"]})]})]}),n&&e.financeiro_status!=="pendente"&&a.jsx("div",{className:"border-t border-white/5 p-5",children:a.jsxs("p",{className:"text-xs text-slate-500",children:["Decisão registrada em ",o_(e.financeiro_em),".",e.financeiro_obs&&a.jsxs("span",{className:"block mt-1 text-slate-400 italic",children:['"',e.financeiro_obs,'"']})]})})]})}function cye(){const[e,t]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState("pendente"),o=b.useCallback(async()=>{r(!0);try{const u=await pt.listFinanceiro();t(u)}catch{t([])}finally{r(!1)}},[]);b.useEffect(()=>{o()},[o]);const l=e.filter(u=>u.financeiro_status==="pendente"),c=s==="pendente"?l:e;return a.jsxs("div",{className:"space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500",children:[a.jsxs("header",{className:"flex justify-between items-center flex-wrap gap-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-3xl font-bold text-white tracking-tighter uppercase italic flex items-center gap-3",children:[a.jsx(tv,{size:28,className:"text-amber-400"}),"Financeiro"]}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Aprovação de pagamentos na entrega."})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-1 flex gap-1",children:["pendente","todos"].map(u=>a.jsx("button",{onClick:()=>i(u),className:`px-4 py-1.5 rounded-lg text-xs font-black uppercase transition-colors ${s===u?"bg-amber-500 text-black":"text-slate-400 hover:text-white"}`,children:u==="pendente"?`Pendentes (${l.length})`:`Todos (${e.length})`},u))}),a.jsx("button",{onClick:o,disabled:n,className:"p-2.5 bg-slate-800 border border-slate-700 rounded-xl text-slate-400 hover:text-white transition-colors disabled:opacity-50",children:a.jsx(ke,{size:16,className:n?"animate-spin":""})})]})]}),!n&&l.length===0&&s==="pendente"&&a.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/20 rounded-2xl p-10 text-center",children:[a.jsx(nn,{size:36,className:"text-emerald-500/40 mx-auto mb-3"}),a.jsx("p",{className:"text-slate-500 font-medium",children:"Nenhuma solicitação pendente."}),a.jsx("p",{className:"text-slate-600 text-sm mt-1",children:"Todos os pedidos de pagamento na entrega foram avaliados."})]}),n?a.jsx("div",{className:"space-y-4",children:[1,2,3].map(u=>a.jsx("div",{className:"h-28 bg-slate-900/40 border border-slate-800 rounded-2xl animate-pulse"},u))}):a.jsx("div",{className:"space-y-4",children:c.map(u=>a.jsx(lye,{pedido:u,onDecisao:o},u.id))}),!n&&c.length===0&&s==="todos"&&a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-2xl p-10 text-center",children:[a.jsx(tv,{size:36,className:"text-slate-700 mx-auto mb-3"}),a.jsx("p",{className:"text-slate-600 text-sm",children:"Nenhum registro de pagamento na entrega ainda."})]})]})}const Yh=[{value:"owner",label:"Owner",icon:ws},{value:"manager",label:"Gerente",icon:ws},{value:"supervisor",label:"Supervisor",icon:Tl},{value:"secretary",label:"Secretária",icon:mm},{value:"agent",label:"Agente",icon:et},{value:"viewer",label:"Visualizador",icon:$p}],l_={online:"bg-emerald-500",busy:"bg-yellow-500",offline:"bg-slate-500"},uye={online:"Online",busy:"Ocupado",offline:"Offline"};function dye({role:e}){const t=Yh.find(r=>r.value===e)||Yh[4],n={owner:"bg-violet-500/20 text-violet-300 border-violet-500/30",manager:"bg-blue-500/20 text-blue-300 border-blue-500/30",supervisor:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",secretary:"bg-teal-500/20 text-teal-300 border-teal-500/30",agent:"bg-slate-700 text-slate-300 border-slate-600",viewer:"bg-slate-800 text-slate-400 border-slate-700"};return a.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full border font-medium ${n[e]||n.agent}`,children:t.label})}function fye({account:e,sectors:t,nwSectors:n,onClose:r,onSave:s}){const i=!!e,[o,l]=b.useState({name:(e==null?void 0:e.name)||"",email:(e==null?void 0:e.email)||"",password:"",role:(e==null?void 0:e.role)||"agent",phone:(e==null?void 0:e.phone)||"",avatar_url:(e==null?void 0:e.avatar_url)||"",active:(e==null?void 0:e.active)!==!1,nw_sector_id:(e==null?void 0:e.nw_sector_id)||"",nw_team_id:(e==null?void 0:e.nw_team_id)||"",sector_id:"",sector_function:""}),[c,u]=b.useState(!1),[d,f]=b.useState(""),p=n.find(m=>m.id===o.nw_sector_id);async function h(m){var v,x;if(m.preventDefault(),!o.name.trim()){f("Nome é obrigatório");return}u(!0),f("");try{const y={name:o.name.trim(),email:o.email||void 0,role:o.role,phone:o.phone||void 0,avatar_url:o.avatar_url||void 0,active:o.active,nw_sector_id:o.nw_sector_id||null,nw_team_id:o.nw_team_id||null};if((!i||o.password)&&(y.password=o.password||void 0),i)await Zn.update(e.id,y);else{if(!o.password){f("Senha é obrigatória para novo colaborador"),u(!1);return}const g=await Zn.create({...y,password:o.password});o.sector_id&&await Js.add({account_id:g.id,sector_id:parseInt(o.sector_id),function:o.sector_function||void 0})}s()}catch(y){f(((x=(v=y==null?void 0:y.response)==null?void 0:v.data)==null?void 0:x.error)||"Erro ao salvar")}finally{u(!1)}}return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",children:a.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-2xl w-full max-w-lg shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-slate-800",children:[a.jsx("h2",{className:"text-white font-semibold text-lg",children:i?"Editar Colaborador":"Novo Colaborador"}),a.jsx("button",{onClick:r,className:"text-slate-400 hover:text-white",children:a.jsx(Ce,{size:20})})]}),a.jsxs("form",{onSubmit:h,className:"p-5 space-y-4 max-h-[75vh] overflow-y-auto",children:[d&&a.jsx("div",{className:"bg-red-500/10 border border-red-500/30 text-red-400 text-sm px-3 py-2 rounded-lg",children:d}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Nome *"}),a.jsx("input",{value:o.name,onChange:m=>l(v=>({...v,name:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",placeholder:"Nome completo"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"E-mail"}),a.jsx("input",{value:o.email,onChange:m=>l(v=>({...v,email:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",placeholder:"email@exemplo.com"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:i?"Nova senha (deixe vazio para manter)":"Senha *"}),a.jsx("input",{type:"password",value:o.password,onChange:m=>l(v=>({...v,password:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",placeholder:"••••••••"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Função / Role"}),a.jsx("select",{value:o.role,onChange:m=>l(v=>({...v,role:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",children:Yh.map(m=>a.jsx("option",{className:"bg-slate-900 text-white",value:m.value,children:m.label},m.value))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-slate-400 mb-1 block",children:"Telefone"}),a.jsx("input",{value:o.phone,onChange:m=>l(v=>({...v,phone:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",placeholder:"(67) 9 9999-9999"})]})]}),!i&&t.length>0&&a.jsxs("div",{className:"border-t border-slate-800 pt-4",children:[a.jsx("label",{className:"text-xs text-slate-400 mb-2 block font-medium",children:"Atribuir ao Setor Interno (opcional)"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("select",{value:o.sector_id,onChange:m=>l(v=>({...v,sector_id:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Nenhum setor"}),t.map(m=>a.jsx("option",{className:"bg-slate-900 text-white",value:m.id,children:m.name},m.id))]}),a.jsx("input",{value:o.sector_function,onChange:m=>l(v=>({...v,sector_function:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",placeholder:"Função no setor"})]})]}),n.length>0&&a.jsxs("div",{className:"border-t border-slate-800 pt-4",children:[a.jsxs("label",{className:"text-xs text-slate-400 mb-2 flex items-center gap-1.5 font-medium",children:[a.jsx(Go,{size:12})," Vincular à Equipe WA-Inbox (opcional)"]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("select",{value:o.nw_sector_id,onChange:m=>l(v=>({...v,nw_sector_id:m.target.value,nw_team_id:""})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Setor WA-Inbox"}),n.map(m=>a.jsx("option",{className:"bg-slate-900 text-white",value:m.id,children:m.name},m.id))]}),a.jsxs("select",{value:o.nw_team_id,onChange:m=>l(v=>({...v,nw_team_id:m.target.value})),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",disabled:!p,children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Equipe WA-Inbox"}),((p==null?void 0:p.teams)||[]).map(m=>a.jsx("option",{className:"bg-slate-900 text-white",value:m.id,children:m.name},m.id))]})]})]}),i&&a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx("input",{type:"checkbox",id:"active-toggle",checked:o.active,onChange:m=>l(v=>({...v,active:m.target.checked})),className:"w-4 h-4 accent-cyan-500"}),a.jsx("label",{htmlFor:"active-toggle",className:"text-sm text-slate-300",children:"Conta ativa"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 rounded-lg border border-slate-700 text-slate-300 text-sm hover:bg-slate-800",children:"Cancelar"}),a.jsxs("button",{type:"submit",disabled:c,className:"px-4 py-2 rounded-lg bg-cyan-600 hover:bg-cyan-500 text-white text-sm font-medium flex items-center gap-2 disabled:opacity-50",children:[c?a.jsx(ke,{size:14,className:"animate-spin"}):a.jsx(jt,{size:14}),i?"Salvar":"Criar"]})]})]})]})})}function pye(){const[e,t]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[o,l]=b.useState(!0),[c,u]=b.useState(""),[d,f]=b.useState(""),[p,h]=b.useState(!1),[m,v]=b.useState(null),x=b.useCallback(async()=>{l(!0);try{const[N,w,S]=await Promise.all([Zn.list(),er.list(),yfe.list().catch(()=>[])]);t(N),r(w),i(S)}finally{l(!1)}},[]);b.useEffect(()=>{x()},[x]);async function y(N){if(confirm("Remover este colaborador? Esta ação não pode ser desfeita.")){v(N);try{await Zn.remove(N),t(w=>w.filter(S=>S.id!==N))}finally{v(null)}}}const g=e.filter(N=>{const w=!c||N.name.toLowerCase().includes(c.toLowerCase())||(N.email||"").toLowerCase().includes(c.toLowerCase()),S=!d||N.role===d;return w&&S});function j(N){if(!N.nw_team_id&&!N.nw_sector_id)return null;const w=s.find(k=>k.id===N.nw_sector_id),S=w==null?void 0:w.teams.find(k=>k.id===N.nw_team_id);return w&&S?`${w.name} › ${S.name}`:w?w.name:null}return a.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[a.jsx(et,{size:24,className:"text-cyan-400"})," Equipe"]}),a.jsxs("p",{className:"text-slate-400 text-sm mt-0.5",children:[e.length," colaborador",e.length!==1?"es":""," cadastrado",e.length!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:x,className:"p-2 rounded-lg border border-slate-700 text-slate-400 hover:text-white hover:bg-slate-800",children:a.jsx(ke,{size:16,className:o?"animate-spin":""})}),a.jsxs("button",{onClick:()=>h(null),className:"flex items-center gap-2 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 text-white rounded-lg text-sm font-medium",children:[a.jsx(Oe,{size:16})," Novo Colaborador"]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsx("input",{value:c,onChange:N=>u(N.target.value),placeholder:"Buscar por nome ou e-mail...",className:"flex-1 min-w-48 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500"}),a.jsxs("select",{value:d,onChange:N=>f(N.target.value),className:"bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-cyan-500",children:[a.jsx("option",{className:"bg-slate-900 text-white",value:"",children:"Todas as funções"}),Yh.map(N=>a.jsx("option",{className:"bg-slate-900 text-white",value:N.value,children:N.label},N.value))]})]}),o?a.jsxs("div",{className:"flex items-center justify-center py-16 text-slate-400",children:[a.jsx(ke,{size:24,className:"animate-spin mr-3"})," Carregando..."]}):g.length===0?a.jsxs("div",{className:"text-center py-16 text-slate-500",children:[a.jsx(et,{size:40,className:"mx-auto mb-3 opacity-30"}),a.jsx("p",{children:"Nenhum colaborador encontrado."})]}):a.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-slate-800 text-slate-400 text-xs uppercase tracking-wider",children:[a.jsx("th",{className:"text-left px-5 py-3",children:"Colaborador"}),a.jsx("th",{className:"text-left px-4 py-3",children:"Função"}),a.jsx("th",{className:"text-left px-4 py-3",children:"Setores"}),a.jsx("th",{className:"text-left px-4 py-3 hidden lg:table-cell",children:"WA-Inbox"}),a.jsx("th",{className:"text-left px-4 py-3 hidden md:table-cell",children:"Status"}),a.jsx("th",{className:"px-4 py-3"})]})}),a.jsx("tbody",{className:"divide-y divide-slate-800/60",children:g.map(N=>{const w=N.name.split(" ").map(k=>k[0]).slice(0,2).join("").toUpperCase(),S=j(N);return a.jsxs("tr",{className:`hover:bg-slate-800/40 transition-colors ${N.active?"":"opacity-50"}`,children:[a.jsx("td",{className:"px-5 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"relative",children:[N.avatar_url?a.jsx("img",{src:N.avatar_url,className:"w-9 h-9 rounded-full object-cover"}):a.jsx("div",{className:"w-9 h-9 rounded-full bg-slate-700 flex items-center justify-center text-slate-300 font-semibold text-xs",children:w}),a.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-slate-900 ${l_[N.availability]||l_.offline}`})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium leading-tight",children:N.name}),N.email&&a.jsxs("p",{className:"text-slate-500 text-xs flex items-center gap-1",children:[a.jsx(kI,{size:10}),N.email]}),N.phone&&a.jsxs("p",{className:"text-slate-500 text-xs flex items-center gap-1",children:[a.jsx(wu,{size:10}),N.phone]})]})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(dye,{role:N.role})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[(N.sectors||[]).slice(0,2).map(k=>a.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full border ${k.on_duty?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-slate-800 text-slate-400 border-slate-700"}`,children:k.sector_name},k.sector_id)),(N.sectors||[]).length>2&&a.jsxs("span",{className:"text-xs text-slate-500",children:["+",N.sectors.length-2]}),(N.sectors||[]).length===0&&a.jsx("span",{className:"text-xs text-slate-600 italic",children:"Sem setor"})]})}),a.jsx("td",{className:"px-4 py-3 hidden lg:table-cell",children:S?a.jsxs("span",{className:"text-xs text-cyan-400 flex items-center gap-1",children:[a.jsx(Go,{size:10}),S]}):a.jsx("span",{className:"text-xs text-slate-600 italic",children:"—"})}),a.jsx("td",{className:"px-4 py-3 hidden md:table-cell",children:a.jsx("span",{className:"text-xs text-slate-400",children:uye[N.availability]||"Offline"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-1 justify-end",children:[a.jsx("button",{onClick:()=>h(N),className:"p-1.5 rounded-lg text-slate-400 hover:text-cyan-400 hover:bg-slate-800",children:a.jsx(Er,{size:14})}),a.jsx("button",{onClick:()=>y(N.id),disabled:m===N.id,className:"p-1.5 rounded-lg text-slate-400 hover:text-red-400 hover:bg-slate-800 disabled:opacity-40",children:a.jsx(Te,{size:14})})]})})]},N.id)})})]})}),p!==!1&&a.jsx(fye,{account:p,sectors:n,nwSectors:s,onClose:()=>h(!1),onSave:()=>{h(!1),x()}})]})}function hye(e){const t=new Date(e),n=Date.now()-t.getTime();return n<6e4?"agora":n<36e5?`${Math.floor(n/6e4)}min atrás`:n<864e5?`${Math.floor(n/36e5)}h atrás`:t.toLocaleDateString("pt-BR")}const mye={aguardando:"bg-slate-600",separacao:"bg-blue-500",embalagem:"bg-violet-500",auditoria:"bg-amber-500",fiscal:"bg-cyan-500",expedicao:"bg-orange-500",entregue:"bg-emerald-500",cancelado:"bg-rose-500"};function xye(){const[e,t]=b.useState(!1),[n,r]=b.useState([]),[s,i]=b.useState(0),[o,l]=b.useState(0),c=b.useRef(null);async function u(){try{const[d,f]=await Promise.all([pt.notificacoes(1440),So.contadores()]),p=new Date;p.setHours(0,0,0,0);const h=d.filter(m=>new Date(m.created_at)>=p);r(h.slice(0,10)),i(f.total),l(h.length+f.total)}catch{}}return b.useEffect(()=>{u();const d=setInterval(u,3e4);return()=>clearInterval(d)},[]),b.useEffect(()=>{function d(f){c.current&&!c.current.contains(f.target)&&t(!1)}return e&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[e]),a.jsxs("div",{className:"relative",ref:c,children:[a.jsxs("button",{onClick:()=>t(d=>!d),className:"relative p-2 rounded-lg text-slate-400 hover:text-white hover:bg-white/5 transition-colors",title:"Notificações",children:[a.jsx(Vf,{size:18}),o>0&&a.jsx("span",{className:"absolute -top-0.5 -right-0.5 bg-rose-500 text-white text-[10px] font-black w-4 h-4 rounded-full flex items-center justify-center leading-none",children:o>9?"9+":o})]}),e&&a.jsxs("div",{className:"absolute right-0 top-full mt-2 w-80 bg-slate-900 border border-white/10 rounded-xl shadow-2xl z-50 overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10",children:[a.jsxs("span",{className:"text-sm font-bold text-white flex items-center gap-2",children:[a.jsx(Vf,{size:14,className:"text-amber-400"})," Notificações"]}),a.jsx("button",{onClick:()=>t(!1),className:"text-slate-500 hover:text-white",children:a.jsx(Ce,{size:14})})]}),a.jsxs("div",{className:"max-h-96 overflow-y-auto",children:[s>0&&a.jsxs("div",{className:"px-4 py-2.5 border-b border-white/5 flex items-center gap-3 bg-amber-500/5",children:[a.jsx("div",{className:"w-7 h-7 rounded-full bg-amber-500/20 flex items-center justify-center shrink-0",children:a.jsx(Vf,{size:13,className:"text-amber-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-semibold text-white",children:"Inbox interno"}),a.jsxs("p",{className:"text-[11px] text-amber-400",children:[s," mensagen",s!==1?"s":""," não lida",s!==1?"s":""]})]})]}),n.length===0&&s===0?a.jsx("div",{className:"px-4 py-8 text-center text-slate-500 text-sm",children:"Nenhuma notificação nova"}):n.map(d=>a.jsxs("div",{className:"px-4 py-2.5 border-b border-white/5 flex items-center gap-3 hover:bg-white/3 transition-colors",children:[a.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${mye[d.status]??"bg-slate-600"}`}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-xs font-semibold text-white truncate",children:["Pedido #",d.id,d.total?` — R$ ${Number(d.total).toFixed(2).replace(".",",")}`:""]}),a.jsxs("p",{className:"text-[11px] text-slate-500 flex items-center gap-1",children:[a.jsx(hn,{size:10})," ",hye(d.created_at),a.jsx("span",{className:"ml-1 capitalize",children:d.status})]})]}),a.jsx(QP,{size:13,className:"text-slate-600 shrink-0"})]},d.id))]}),(n.length>0||s>0)&&a.jsx("div",{className:"px-4 py-2 border-t border-white/10",children:a.jsx("button",{onClick:()=>{t(!1),u()},className:"text-xs text-amber-400 hover:text-amber-300 transition-colors",children:"Atualizar"})})]})]})}function gye({icon:e,label:t,href:n,active:r,accentColor:s}){const i=s||"#06b6d4";return a.jsxs($P,{to:n,className:`flex items-center gap-3 px-4 py-3 rounded-xl transition-all duration-200 group ${r?"border":"text-slate-400 hover:bg-slate-800 hover:text-slate-200 border border-transparent"}`,style:r?{background:`${i}15`,borderColor:`${i}30`,color:i}:{},children:[a.jsx(e,{size:20,style:r?{color:i}:{},className:r?"":"text-slate-500 group-hover:text-slate-300"}),a.jsx("span",{className:"font-medium",children:t}),r&&a.jsx("div",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:i,boxShadow:`0 0 8px ${i}99`}})]})}function vye({tenant:e,adminInfo:t,isOpen:n,onClose:r,collapsed:s,onToggleCollapse:i}){const l=El().pathname,c=(e==null?void 0:e.primary_color)||"#06b6d4",u=s?"w-16":"w-72",d=[{icon:nv,label:"Dashboard",href:"/"},{icon:av,label:"Sorteios",href:"/raffles"},{icon:Wi,label:"Promoções",href:"/promotions"},{icon:av,label:"Pedidos Sorteio",href:"/orders"},{icon:zP,label:"Resgates",href:"/claims"},{icon:et,label:"Clientes",href:"/users"},{icon:JP,label:"Cotação — Pedidos",href:"/cotacao/pedidos"},{icon:tv,label:"Financeiro",href:"/cotacao/financeiro"},{icon:PI,label:"Catálogo",href:"/cotacao/catalogo"},{icon:WI,label:"Clientes Cotação",href:"/cotacao/clientes"},{icon:js,label:"Separador PWA",href:"/cotacao/separador"},{icon:rn,label:"Inbox Interno",href:"/cotacao/inbox"},{icon:VI,label:"Equipe",href:"/equipe"},{icon:ys,label:"Relatórios Op.",href:"/cotacao/relatorios"},{icon:Pr,label:"WhatsApp Inbox",href:"/wa-inbox"},{icon:sv,label:"WA Webhooks",href:"/wa-webhooks"},{icon:rn,label:"WhatsApp (Logs)",href:"/whatsapp"},{icon:XP,label:"Integrações",href:"/plugins"},{icon:zI,label:"Clube Odonto",href:"/clubs/odonto"},{icon:xI,label:"Clube Médico",href:"/clubs/medico"},{icon:ys,label:"Relatórios Clube",href:"/clubs/reports"},{icon:mm,label:"Vagas & Talentos",href:"/jobs"},{icon:Pi,label:"Administradores",href:"/admins"},{icon:v1,label:"Configurações",href:"/settings"}],f=(t==null?void 0:t.nome)||(t==null?void 0:t.username)||(t==null?void 0:t.email)||"Admin",p=f.split(" ").map(h=>h[0]).slice(0,2).join("").toUpperCase();return a.jsxs(a.Fragment,{children:[n&&a.jsx("div",{className:"fixed inset-0 bg-black/60 z-30 md:hidden",onClick:r}),a.jsxs("aside",{className:`fixed md:sticky top-0 left-0 z-40 ${u} bg-slate-950 border-r border-slate-900 flex flex-col h-screen overflow-hidden transition-all duration-300 ease-in-out ${n?"translate-x-0":"-translate-x-full md:translate-x-0"}`,children:[a.jsx("div",{className:"absolute top-0 left-0 w-full h-32 bg-gradient-to-b from-cyan-500/5 to-transparent pointer-events-none"}),a.jsxs("div",{className:`relative z-10 border-b border-slate-900 flex items-center gap-3 ${s?"p-2 justify-center h-16":"p-4"}`,children:[!s&&a.jsxs(a.Fragment,{children:[e!=null&&e.logo_url?a.jsx("img",{src:e.logo_url,alt:e.name,className:"h-9 object-contain shrink-0"}):a.jsx("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center shadow-lg shrink-0",style:{background:`linear-gradient(135deg, ${c}, ${c}88)`},children:a.jsx(nv,{className:"text-white",size:18})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-sm font-black text-white tracking-tight leading-tight truncate",children:(e==null?void 0:e.name)||"Admin"}),a.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest leading-none mt-0.5",style:{color:c},children:"Cloud Admin v2"})]})]}),a.jsx("button",{onClick:i,className:"hidden md:flex w-8 h-8 items-center justify-center rounded-lg text-slate-500 hover:text-white hover:bg-slate-800 transition-colors shrink-0",title:s?"Expandir menu":"Recolher menu",children:a.jsx(Pa,{size:16,className:`transition-transform duration-300 ${s?"":"rotate-180"}`})}),a.jsx("button",{onClick:r,className:"md:hidden text-slate-500 hover:text-white transition-colors shrink-0",children:a.jsx(Ce,{size:18})})]}),a.jsx("nav",{className:`flex-1 py-2 flex flex-col relative z-10 overflow-y-auto ${s?"px-1 gap-1 items-center":"px-3 gap-0.5"}`,children:d.map(({icon:h,label:m,href:v})=>{const x=l===v;return s?a.jsx($P,{to:v,title:m,className:`flex items-center justify-center w-10 h-10 rounded-xl transition-all shrink-0 ${x?"border":"text-slate-500 hover:bg-slate-800 hover:text-slate-200 border border-transparent"}`,style:x?{background:`${c}15`,borderColor:`${c}30`,color:c}:{},children:a.jsx(h,{size:18,style:x?{color:c}:{}})},v):a.jsx(gye,{icon:h,label:m,href:v,active:x,accentColor:c},v)})}),a.jsxs("div",{className:`mt-auto border-t border-slate-900 relative z-10 bg-slate-950/80 backdrop-blur-sm ${s?"p-1 flex flex-col items-center gap-1":"p-3"}`,children:[!s&&t&&a.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 mb-2 bg-slate-900/60 rounded-xl border border-slate-800",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-xs font-black text-white shrink-0",style:{background:`linear-gradient(135deg, ${c}, ${c}88)`},children:p}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-bold text-white truncate leading-tight",children:f}),t.email&&a.jsx("p",{className:"text-[10px] text-slate-500 truncate",children:t.email})]})]}),s&&t&&a.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-xs font-black text-white",style:{background:`linear-gradient(135deg, ${c}, ${c}88)`},title:f,children:p}),!s&&a.jsxs("a",{href:"/",target:"_blank",className:"flex items-center gap-3 px-3 py-2 text-slate-400 hover:text-white transition-colors group rounded-xl hover:bg-slate-800 mb-1",children:[a.jsx(LP,{size:16,className:"group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform shrink-0"}),a.jsx("span",{className:"text-xs font-medium",children:"Ver Site Público"})]}),a.jsxs("button",{onClick:()=>{window.location.href="/admin/logout"},className:`flex items-center gap-3 text-rose-400 hover:bg-rose-500/10 rounded-xl transition-all group ${s?"w-10 h-10 justify-center":"w-full px-3 py-2"}`,title:"Encerrar Sessão",children:[a.jsx(NI,{size:16,className:"group-hover:-translate-x-0.5 transition-transform shrink-0"}),!s&&a.jsx("span",{className:"text-xs font-medium",children:"Encerrar Sessão"})]})]})]})]})}function Pf({label:e,value:t,icon:n,trend:r,color:s}){return a.jsxs("div",{className:"bg-slate-900/40 backdrop-blur-sm border border-slate-800 p-6 rounded-3xl hover:border-slate-700 transition-all group",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:`p-3 rounded-2xl bg-slate-800 border border-white/5 text-${s}-400 group-hover:scale-110 transition-transform`,children:a.jsx(n,{size:24})}),r&&a.jsx("span",{className:"text-xs font-black text-emerald-400 bg-emerald-400/10 px-2 py-1 rounded-lg tracking-tighter",children:r})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-slate-500 text-xs font-bold uppercase tracking-widest mb-1",children:e}),a.jsx("h3",{className:"text-3xl font-black text-white tabular-nums tracking-tighter",children:t})]})]})}const c_={contentStyle:{background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",color:"#f1f5f9",fontSize:"12px"}},rg=e=>e.toLocaleString("pt-BR",{style:"currency",currency:"BRL"});function yye(){return a.jsxs("div",{className:"space-y-10 animate-pulse",children:[a.jsxs("div",{className:"flex flex-wrap justify-between items-start gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"h-9 w-56 bg-slate-800 rounded-xl"}),a.jsx("div",{className:"h-4 w-80 bg-slate-800/60 rounded-lg"})]}),a.jsx("div",{className:"h-10 w-36 bg-slate-800 rounded-2xl"})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[...Array(4)].map((e,t)=>a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 p-6 rounded-3xl space-y-4",children:[a.jsx("div",{className:"h-10 w-10 bg-slate-800 rounded-2xl"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"h-3 w-24 bg-slate-800 rounded"}),a.jsx("div",{className:"h-8 w-20 bg-slate-800 rounded-lg"})]})]},t))}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[a.jsx("div",{className:"lg:col-span-2 bg-slate-900/40 border border-slate-800 rounded-[2.5rem] p-10 h-96"}),a.jsx("div",{className:"bg-slate-900/40 border border-slate-800 rounded-[2.5rem] p-10 h-96"})]})]})}function bye(){var u,d,f,p,h;const e=hm(),[t,n]=b.useState(null),[r,s]=b.useState(null),[i,o]=b.useState(!0);if(b.useEffect(()=>{Promise.all([xfe.getDashboard().catch(()=>null),pt.contadores().catch(()=>null)]).then(([m,v])=>{n(m),s(v)}).finally(()=>o(!1))},[]),i)return a.jsx(yye,{});const l=((t==null?void 0:t.salesByDay)||[]).map(m=>({...m,revenue:parseFloat(m.revenue||0),label:m.date?new Date(m.date).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit"}):m.date})),c=((t==null?void 0:t.salesByHour)||[]).map(m=>({...m,tickets_sold:parseInt(m.tickets_sold||0)}));return a.jsxs("div",{className:"space-y-10 animate-in fade-in slide-in-from-bottom-4 duration-700",children:[a.jsxs("header",{className:"flex flex-wrap justify-between items-start gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-black text-white tracking-tighter",children:"Resumo Geral"}),a.jsx("p",{className:"text-slate-400 mt-1 font-medium",children:"Monitoramento em tempo real do ecossistema Alemão."})]}),a.jsxs("div",{className:"bg-slate-900 border border-slate-800 p-2 rounded-2xl flex items-center gap-2 shrink-0",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),a.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 pr-2",children:"Sistema Online"})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[a.jsx(Pf,{label:"Receita Total",value:rg(parseFloat(((u=t==null?void 0:t.revenueStats)==null?void 0:u.total_revenue)||0)),icon:xm,color:"cyan"}),a.jsx(Pf,{label:"Tickets Vendidos",value:String(((d=t==null?void 0:t.revenueStats)==null?void 0:d.total_tickets_sold)??0),icon:av,color:"blue"}),a.jsx(Pf,{label:"Base Clientes",value:String(((f=t==null?void 0:t.revenueStats)==null?void 0:f.total_users)??0),icon:et,color:"purple"}),a.jsx(Pf,{label:"Tickets Ativos",value:String(((p=t==null?void 0:t.revenueStats)==null?void 0:p.active_tickets)??0),icon:hn,color:"orange"})]}),r&&a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{label:"Pedidos Hoje",value:r.hoje??0,color:"text-cyan-400",href:"/cotacao/pedidos"},{label:"Em Separação",value:r.em_separacao??0,color:"text-blue-400",href:"/cotacao/pedidos"},{label:"Em Auditoria",value:r.em_auditoria??0,color:"text-orange-400",href:"/cotacao/pedidos"},{label:"Promos Ativas",value:r.promocoes_ativas??0,color:"text-emerald-400",href:"/promotions"}].map(m=>a.jsxs("button",{onClick:()=>e(m.href),className:"bg-slate-900/40 border border-slate-800 hover:border-slate-700 rounded-2xl p-4 text-left transition-all group",children:[a.jsx("p",{className:`text-3xl font-black tabular-nums group-hover:scale-105 transition-transform inline-block ${m.color}`,children:m.value}),a.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500 mt-1",children:m.label})]},m.label))}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[a.jsxs("div",{className:"lg:col-span-2 bg-slate-900/40 border border-slate-800 rounded-[2.5rem] p-5 md:p-10 relative overflow-hidden group",children:[a.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-cyan-500/5 blur-3xl rounded-full"}),a.jsx("div",{className:"flex items-center justify-between mb-8 relative z-10",children:a.jsxs("h3",{className:"text-2xl font-black text-white flex items-center gap-3 tracking-tight",children:[a.jsx(Wi,{className:"text-cyan-400",size:24}),"Performance de Mercado"]})}),a.jsxs("div",{className:"h-56 w-full mb-8 relative z-10",children:[a.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500 mb-3",children:"Receita por Dia (Últimos 30 Dias)"}),l.length>0?a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(GT,{data:l,children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"gradRevenue",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",stopColor:"#06b6d4",stopOpacity:.3}),a.jsx("stop",{offset:"95%",stopColor:"#06b6d4",stopOpacity:0})]})}),a.jsx(xl,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),a.jsx(ia,{dataKey:"label",stroke:"#475569",tick:{fontSize:10}}),a.jsx(oa,{stroke:"#475569",tick:{fontSize:10},tickFormatter:m=>`R$${m}`}),a.jsx(on,{...c_,formatter:m=>[rg(Number(m)),"Receita"]}),a.jsx(za,{type:"monotone",dataKey:"revenue",stroke:"#06b6d4",strokeWidth:2,fill:"url(#gradRevenue)"})]})}):a.jsx("div",{className:"h-full flex items-center justify-center text-slate-600 text-sm italic",children:"Sem dados disponíveis"})]}),a.jsxs("div",{className:"h-40 w-full relative z-10",children:[a.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500 mb-3",children:"Picos de Venda por Horário"}),c.length>0?a.jsx(Do,{width:"100%",height:"100%",children:a.jsxs(KT,{data:c,children:[a.jsx(xl,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),a.jsx(ia,{dataKey:"hour_of_day",stroke:"#475569",tick:{fontSize:10},tickFormatter:m=>`${m}h`}),a.jsx(oa,{stroke:"#475569",tick:{fontSize:10}}),a.jsx(on,{...c_,formatter:m=>[m,"Tickets"]}),a.jsx($a,{dataKey:"tickets_sold",fill:"#10b981",radius:[4,4,0,0]})]})}):a.jsx("div",{className:"h-full flex items-center justify-center text-slate-600 text-sm italic",children:"Sem dados disponíveis"})]})]}),a.jsxs("div",{className:"bg-slate-900/40 border border-slate-800 rounded-[2.5rem] p-5 md:p-10 flex flex-col relative overflow-hidden group",children:[a.jsx("h3",{className:"text-2xl font-black text-white mb-8 tracking-tight relative z-10",children:"Sorteios Quentes"}),a.jsxs("div",{className:"space-y-4 relative z-10 flex-1",children:[(h=t==null?void 0:t.salesByRaffle)==null?void 0:h.slice(0,4).map(m=>{const v=m.total_numeros>0?Math.min(100,Math.round(m.tickets_sold/m.total_numeros*100)):0;return a.jsxs("div",{className:"flex items-center gap-4 p-5 rounded-[1.5rem] bg-slate-800/40 border border-slate-800 hover:border-cyan-500/30 hover:bg-slate-800/60 transition-all cursor-pointer group/item",onClick:()=>e("/raffles"),children:[a.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-slate-700 to-slate-800 rounded-2xl flex items-center justify-center text-xl font-bold border border-white/5 shadow-lg",children:"🍀"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h4",{className:"text-sm font-black text-white truncate uppercase tracking-tight",children:m.raffle_name}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("div",{className:"flex-1 h-1 bg-slate-700 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-cyan-400 transition-all duration-500",style:{width:`${v}%`}})}),a.jsxs("span",{className:"text-[10px] text-slate-500 font-bold tabular-nums",children:[v,"%"]})]}),a.jsxs("p",{className:"text-[10px] text-slate-600 mt-1 tabular-nums",children:[m.tickets_sold," / ",m.total_numeros," bilhetes · ",rg(parseFloat(m.revenue||0))]})]}),a.jsx(Pa,{className:"text-slate-600 group-hover/item:text-cyan-400 group-hover/item:translate-x-1 transition-all",size:20})]},m.raffle_id)}),(!(t!=null&&t.salesByRaffle)||t.salesByRaffle.length===0)&&a.jsx("p",{className:"text-slate-600 text-sm italic text-center py-8",children:"Nenhum sorteio ativo"})]}),a.jsx("button",{onClick:()=>e("/raffles"),className:"mt-6 w-full py-5 text-sm font-black text-slate-400 hover:text-cyan-400 hover:bg-cyan-500/5 rounded-2xl transition-all border border-slate-800 hover:border-cyan-500/20",children:"Auditagem de Bilhetes"})]})]})]})}function jye({authState:e,setAuthState:t,teamAccount:n,setTeamAccount:r}){const s=hm(),i=El(),[o,l]=b.useState(null),[c,u]=b.useState(null),[d,f]=b.useState(!1),[p,h]=b.useState(!1);return b.useEffect(()=>{e==="admin"&&Hc.get().then(m=>{l(m.tenant),u(m.admin)}).catch(()=>{})},[e]),b.useEffect(()=>{f(!1)},[i.pathname]),e==="login"?a.jsx(nve,{onLogin:(m,v)=>{m==="team"&&v?(r(v),t("team"),s("/wa-inbox")):(r(null),t("admin"),s("/"))}}):e==="team"?a.jsx(qC,{teamAccount:n,onTeamLogout:async()=>{await fetch("/api/team/logout",{method:"POST",credentials:"include"}),r(null),t("login")}}):i.pathname==="/wa-inbox"?a.jsx(qC,{}):i.pathname==="/wa-webhooks"?a.jsx(Zge,{}):i.pathname==="/cotacao/inbox"?a.jsx(r_,{}):a.jsxs("div",{className:"flex min-h-screen bg-black font-sans text-slate-200 selection:bg-cyan-500/30 selection:text-cyan-200",children:[a.jsx(vye,{tenant:o,adminInfo:c,isOpen:d,onClose:()=>f(!1),collapsed:p,onToggleCollapse:()=>h(m=>!m)}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[a.jsxs("header",{className:"md:hidden flex items-center gap-4 px-4 h-14 bg-slate-950 border-b border-slate-900 sticky top-0 z-20",children:[a.jsx("button",{onClick:()=>f(!0),className:"text-slate-400 hover:text-white",children:a.jsx(CI,{size:22})}),a.jsx("span",{className:"font-black text-white text-sm truncate flex-1",children:(o==null?void 0:o.name)||"Admin"}),a.jsx(xye,{})]}),a.jsxs("main",{className:"flex-1 p-4 sm:p-8 md:p-16 overflow-y-auto relative",children:[a.jsx("div",{className:"fixed inset-0 opacity-[0.03] pointer-events-none bg-[url('https://www.transparenttextures.com/patterns/carbon-fibre.png')]"}),a.jsx("div",{className:"max-w-7xl mx-auto",children:a.jsxs(VD,{children:[a.jsx(st,{path:"/",element:a.jsx(bye,{})}),a.jsx(st,{path:"/raffles",element:a.jsx(wfe,{})}),a.jsx(st,{path:"/promotions",element:a.jsx(Nfe,{})}),a.jsx(st,{path:"/orders",element:a.jsx(ave,{})}),a.jsx(st,{path:"/claims",element:a.jsx(ove,{})}),a.jsx(st,{path:"/clubs/odonto",element:a.jsx(xve,{})}),a.jsx(st,{path:"/clubs/medico",element:a.jsx(gve,{})}),a.jsx(st,{path:"/clubs/reports",element:a.jsx(yve,{})}),a.jsx(st,{path:"/jobs",element:a.jsx(Ave,{})}),a.jsx(st,{path:"/users",element:a.jsx(bfe,{})}),a.jsx(st,{path:"/whatsapp",element:a.jsx(Ofe,{})}),a.jsx(st,{path:"/plugins",element:a.jsx(eve,{})}),a.jsx(st,{path:"/admins",element:a.jsx(tve,{})}),a.jsx(st,{path:"/settings",element:a.jsx(jfe,{})}),a.jsx(st,{path:"/cotacao/pedidos",element:a.jsx(Uve,{})}),a.jsx(st,{path:"/cotacao/financeiro",element:a.jsx(cye,{})}),a.jsx(st,{path:"/cotacao/catalogo",element:a.jsx(Ove,{})}),a.jsx(st,{path:"/cotacao/clientes",element:a.jsx(Dve,{})}),a.jsx(st,{path:"/cotacao/inbox",element:a.jsx(r_,{})}),a.jsx(st,{path:"/cotacao/relatorios",element:a.jsx(eye,{})}),a.jsx(st,{path:"/cotacao/separador",element:a.jsx(sye,{})}),a.jsx(st,{path:"/equipe",element:a.jsx(pye,{})})]})})]})]})]})}function wye(){const[e,t]=b.useState("checking"),[n,r]=b.useState(null);return b.useEffect(()=>{fetch("/api/admin/me",{credentials:"include",headers:{Accept:"application/json"}}).then(async i=>{if(i.ok){t("admin");return}const o=await fetch("/api/team/me",{credentials:"include",headers:{Accept:"application/json"}});if(o.ok){const l=await o.json();r(l.account),t("team")}else t("login")}).catch(()=>t("login"));const s=()=>t("login");return window.addEventListener("auth:logout",s),()=>window.removeEventListener("auth:logout",s)},[]),e==="checking"?a.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:a.jsx("div",{className:"w-8 h-8 border-2 border-cyan-500 border-t-transparent rounded-full animate-spin"})}):a.jsx(XD,{basename:"/admin-v2",children:a.jsx(jye,{authState:e,setAuthState:t,teamAccount:n,setTeamAccount:r})})}ag.createRoot(document.getElementById("root")).render(a.jsx(O.StrictMode,{children:a.jsx(wye,{})})); diff --git a/frontend/sistema-nuvem/public/admin-v2/index.html b/frontend/sistema-nuvem/public/admin-v2/index.html new file mode 100644 index 0000000..aba3c38 --- /dev/null +++ b/frontend/sistema-nuvem/public/admin-v2/index.html @@ -0,0 +1,14 @@ + + + + + + + Alemão Conveniências Admin + + + + +
+ + diff --git a/frontend/sistema-nuvem/public/app/assets/index-BsQsNy1r.js b/frontend/sistema-nuvem/public/app/assets/index-BsQsNy1r.js new file mode 100644 index 0000000..f8a7cda --- /dev/null +++ b/frontend/sistema-nuvem/public/app/assets/index-BsQsNy1r.js @@ -0,0 +1,74 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function te(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function A(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ne(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ne(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+te(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),ne(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&te(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&te(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,k=ee.port2;ee.port1.onmessage=D,O=function(){k.postMessage(null)}}else O=function(){_(D,0)};function te(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,te(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1se||(e.current=oe[se],oe[se]=null,se--)}function N(e,t){se++,oe[se]=e.current,e.current=t}var ue=ce(null),de=ce(null),fe=ce(null),pe=ce(null);function me(e,t){switch(N(fe,t),N(de,e),N(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}le(ue),N(ue,e)}function he(){le(ue),le(de),le(fe)}function ge(e){e.memoizedState!==null&&N(pe,e);var t=ue.current,n=Hd(t,e.type);t!==n&&(N(de,e),N(ue,n))}function _e(e){de.current===e&&(le(ue),le(de)),pe.current===e&&(le(pe),Qf._currentValue=ae)}var ve,ye;function be(e){if(ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ve=t&&t[1]||``,ye=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{xe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?be(n):``}function Ce(e,t){switch(e.tag){case 26:case 27:case 5:return be(e.type);case 16:return be(`Lazy`);case 13:return e.child!==t&&t!==null?be(`Suspense Fallback`):be(`Suspense`);case 19:return be(`SuspenseList`);case 0:case 15:return Se(e.type,!1);case 11:return Se(e.type.render,!1);case 1:return Se(e.type,!0);case 31:return be(`Activity`);default:return``}}function we(e){try{var t=``,n=null;do t+=Ce(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var Te=Object.prototype.hasOwnProperty,Ee=t.unstable_scheduleCallback,De=t.unstable_cancelCallback,Oe=t.unstable_shouldYield,ke=t.unstable_requestPaint,Ae=t.unstable_now,je=t.unstable_getCurrentPriorityLevel,Me=t.unstable_ImmediatePriority,Ne=t.unstable_UserBlockingPriority,Pe=t.unstable_NormalPriority,Fe=t.unstable_LowPriority,Ie=t.unstable_IdlePriority,Le=t.log,Re=t.unstable_setDisableYieldValue,ze=null,Be=null;function Ve(e){if(typeof Le==`function`&&Re(e),Be&&typeof Be.setStrictMode==`function`)try{Be.setStrictMode(ze,e)}catch{}}var He=Math.clz32?Math.clz32:Ge,Ue=Math.log,We=Math.LN2;function Ge(e){return e>>>=0,e===0?32:31-(Ue(e)/We|0)|0}var Ke=256,qe=262144,Je=4194304;function Ye(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Xe(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ye(n))):i=Ye(o):i=Ye(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ye(n))):i=Ye(o)):i=Ye(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ze(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Qe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function $e(){var e=Je;return Je<<=1,!(Je&62914560)&&(Je=4194304),e}function et(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function tt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function nt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),hn=!1;if(mn)try{var gn={};Object.defineProperty(gn,`passive`,{get:function(){hn=!0}}),window.addEventListener(`test`,gn,gn),window.removeEventListener(`test`,gn,gn)}catch{hn=!1}var _n=null,vn=null,yn=null;function bn(){if(yn)return yn;var e,t=vn,n=t.length,r,i=`value`in _n?_n.value:_n.textContent,a=i.length;for(e=0;e=Zn),er=` `,tr=!1;function nr(e,t){switch(e){case`keyup`:return Yn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function rr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ir=!1;function ar(e,t){switch(e){case`compositionend`:return rr(t);case`keypress`:return t.which===32?(tr=!0,er):null;case`textInput`:return e=t.data,e===er&&tr?null:e;default:return null}}function or(e,t){if(ir)return e===`compositionend`||!Xn&&nr(e,t)?(e=bn(),yn=vn=_n=null,ir=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Or(n)}}function Ar(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ar(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Vt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Vt(e.document)}return t}function Mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Nr=mn&&`documentMode`in document&&11>=document.documentMode,Pr=null,Fr=null,Ir=null,Lr=!1;function Rr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Lr||Pr==null||Pr!==Vt(r)||(r=Pr,`selectionStart`in r&&Mr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ir&&Dr(Ir,r)||(Ir=r,r=Ed(Fr,`onSelect`),0>=o,i-=o,Di=1<<32-He(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),z&&ki(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),z&&ki(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return z&&ki(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),z&&ki(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Oa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Fa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=hi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=mi(o.type,o.key,o.props,null,e.mode,c),Fa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=vi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Oa(o),b(e,r,o,c)}if(ie(o))return h(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Pa(o),c);if(o.$$typeof===C)return b(e,r,na(e,o),c);Ia(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=gi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Na=0;var i=b(e,t,n,r);return Ma=null,i}catch(t){if(t===Sa||t===wa)throw t;var a=ui(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ra=La(!0),za=La(!1),Ba=!1;function Va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ha(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ua(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,K&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=si(e),oi(e,null,n),t}return ai(e,r,t,n),si(e)}function Ga(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,it(e,n)}}function B(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ka=!1;function qa(){if(Ka){var e=pa;if(e!==null)throw e}}function Ja(e,t,n,r){Ka=!1;var i=e.updateQueue;Ba=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Y&f)===f:(r&f)===f){f!==0&&f===fa&&(Ka=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ba=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Gl|=o,e.lanes=o,e.memoizedState=d}}function Ya(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Xa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=j.T,s={};j.T=s,Ns(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ms(e,t,ga(c,r),pu(e)):Ms(e,t,r,pu(e))}catch(n){Ms(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function Ss(){}function Cs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ws(e).queue;xs(e,a,t,ae,n===null?Ss:function(){return Ts(e),n(r)})}function ws(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:ae},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ts(e){var t=ws(e);t.next===null&&(t=e.alternate.memoizedState),Ms(e,t.next.queue,{},pu())}function Es(){return ta(Qf)}function Ds(){return Ao().memoizedState}function Os(){return Ao().memoizedState}function ks(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=Ua(n);var r=Wa(t,e,n);r!==null&&(hu(r,t,n),Ga(r,t,n)),t={cache:ca()},e.payload=t;return}t=t.return}}function As(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ps(e)?Fs(t,n):(n=F(e,t,n,r),n!==null&&(hu(n,e,r),Is(n,t,r)))}function js(e,t,n){Ms(e,t,n,pu())}function Ms(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ps(e))Fs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Er(s,o))return ai(e,t,i,0),q===null&&ii(),!1}catch{}if(n=F(e,t,i,r),n!==null)return hu(n,e,r),Is(n,t,r),!0}return!1}function Ns(e,t,n,r){if(r={lane:2,revertLane:dd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ps(e)){if(t)throw Error(i(479))}else t=F(e,n,r,2),t!==null&&hu(t,e,2)}function Ps(e){var t=e.alternate;return e===H||t!==null&&t===H}function Fs(e,t){mo=po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Is(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,it(e,n)}}var Ls={readContext:ta,use:No,useCallback:bo,useContext:bo,useEffect:bo,useImperativeHandle:bo,useLayoutEffect:bo,useInsertionEffect:bo,useMemo:bo,useReducer:bo,useRef:bo,useState:bo,useDebugValue:bo,useDeferredValue:bo,useTransition:bo,useSyncExternalStore:bo,useId:bo,useHostTransitionStatus:bo,useFormState:bo,useActionState:bo,useOptimistic:bo,useMemoCache:bo,useCacheRefresh:bo};Ls.useEffectEvent=bo;var Rs={readContext:ta,use:No,useCallback:function(e,t){return ko().memoizedState=[e,t===void 0?null:t],e},useContext:ta,useEffect:W,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ss(4194308,4,ms.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ss(4194308,4,e,t)},useInsertionEffect:function(e,t){ss(4,2,e,t)},useMemo:function(e,t){var n=ko();t=t===void 0?null:t;var r=e();if(ho){Ve(!0);try{e()}finally{Ve(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ko();if(n!==void 0){var i=n(t);if(ho){Ve(!0);try{n(t)}finally{Ve(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=As.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=ko();return e={current:e},t.memoizedState=e},useState:function(e){e=Go(e);var t=e.queue,n=js.bind(null,H,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:gs,useDeferredValue:function(e,t){return ys(ko(),e,t)},useTransition:function(){var e=Go(!1);return e=xs.bind(null,H,e.queue,!0,!1),ko().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=H,a=ko();if(z){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),q===null)throw Error(i(349));Y&127||Bo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,W(Ho.bind(null,r,o,e),[e]),r.flags|=2048,as(9,{destroy:void 0},Vo.bind(null,r,o,n,t),null),n},useId:function(){var e=ko(),t=q.identifierPrefix;if(z){var n=Oi,r=Di;n=(r&~(1<<32-He(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=go++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[dt]=t,o[ft]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Mc(t)}}return G(t),Nc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=fe.current,Vi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Pi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[dt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Md(e.nodeValue,n)),e||Ri(t,!0)}else e=Bd(e).createTextNode(r),e[dt]=t,t.stateNode=e}return G(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Vi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[dt]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;G(t),e=!1}else n=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(so(t),t):(so(t),null);if(t.flags&128)throw Error(i(558))}return G(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Vi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[dt]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;G(t),a=!1}else a=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(so(t),t):(so(t),null)}return so(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Fc(t,t.updateQueue),G(t),null);case 4:return he(),e===null&&Sd(t.stateNode.containerInfo),G(t),null;case 10:return Yi(t.type),G(t),null;case 19:if(le(co),r=t.memoizedState,r===null)return G(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Ic(r,!1);else{if(Wl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=lo(e),o!==null){for(t.flags|=128,Ic(r,!1),e=o.updateQueue,t.updateQueue=e,Fc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)pi(n,e),n=n.sibling;return N(co,co.current&1|2),z&&ki(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ae()>tu&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304)}else{if(!a)if(e=lo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Fc(t,e),Ic(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!z)return G(t),null}else 2*Ae()-r.renderingStartTime>tu&&n!==536870912&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(G(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ae(),e.sibling=null,n=co.current,N(co,a?n&1|2:n&1),z&&ki(t,r.treeForkCount),e);case 22:case 23:return so(t),to(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(G(t),t.subtreeFlags&6&&(t.flags|=8192)):G(t),n=t.updateQueue,n!==null&&Fc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&le(va),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Yi(sa),G(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Rc(e,t){switch(Mi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yi(sa),he(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return _e(t),null;case 31:if(t.memoizedState!==null){if(so(t),t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(so(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(co),null;case 4:return he(),null;case 10:return Yi(t.type),null;case 22:case 23:return so(t),to(),e!==null&&le(va),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Yi(sa),null;case 25:return null;default:return null}}function zc(e,t){switch(Mi(t),t.tag){case 3:Yi(sa),he();break;case 26:case 27:case 5:_e(t);break;case 4:he();break;case 31:t.memoizedState!==null&&so(t);break;case 13:so(t);break;case 19:le(co);break;case 10:Yi(t.type);break;case 22:case 23:so(t),to(),e!==null&&le(va);break;case 24:Yi(sa)}}function Bc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Vc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function Hc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Xa(t,n)}catch(t){Z(e,e.return,t)}}}function Uc(e,t,n){n.props=Gs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Wc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function Gc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}function Kc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function qc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[ft]=t}catch(t){Z(e,e.return,t)}}function Jc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Yc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Jc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=an));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[dt]=e,t[ft]=n}catch(t){Z(e,e.return,t)}}var $c=!1,el=!1,tl=!1,nl=typeof WeakSet==`function`?WeakSet:Set,rl=null;function il(e,t){if(e=e.containerInfo,Rd=sp,e=jr(e),Mr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,rl=t;rl!==null;)if(t=rl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,rl=e;else for(;rl!==null;){switch(t=rl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(o,r,n),o[dt]=e,wt(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=kr(s,h),v=kr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,j.T=null,n=lu,lu=null;var o=au,s=su;if(iu=0,ou=au=null,su=0,K&6)throw Error(i(331));var c=K;if(K|=4,Pl(o.current),El(o,o.current,s,n),K=c,id(0,!1),Be&&typeof Be.onPostCommitFiberRoot==`function`)try{Be.onPostCommitFiberRoot(ze,o)}catch{}return!0}finally{M.p=a,j.T=r,Vu(e,t)}}function Wu(e,t,n){t=bi(n,t),t=Zs(e.stateNode,t,2),e=Wa(e,t,2),e!==null&&(tt(e,2),rd(e))}function Z(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ru===null||!ru.has(r))){e=bi(n,e),n=Qs(2),r=Wa(t,n,2),r!==null&&($s(n,r,t,e),tt(r,2),rd(r));break}}t=t.return}}function Gu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Hl=!0,i.add(n),e=Ku.bind(null,e,t,n),t.then(e,e))}function Ku(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,q===e&&(Y&n)===n&&(Wl===4||Wl===3&&(Y&62914560)===Y&&300>Ae()-$l?!(K&2)&&Su(e,0):ql|=n,Yl===Y&&(Yl=0)),rd(e)}function qu(e,t){t===0&&(t=$e()),e=I(e,t),e!==null&&(tt(e,t),rd(e))}function Ju(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function Yu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),qu(e,n)}function Xu(e,t){return Ee(e,t)}var Zu=null,Qu=null,$u=!1,ed=!1,td=!1,nd=0;function rd(e){e!==Qu&&e.next===null&&(Qu===null?Zu=Qu=e:Qu=Qu.next=e),ed=!0,$u||($u=!0,ud())}function id(e,t){if(!td&&ed){td=!0;do for(var n=!1,r=Zu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-He(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ld(r,a))}else a=Y,a=Xe(r,r===q?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ze(r,a)||(n=!0,ld(r,a));r=r.next}while(n);td=!1}}function ad(){od()}function od(){ed=$u=!1;var e=0;nd!==0&&Gd()&&(e=nd);for(var t=Ae(),n=null,r=Zu;r!==null;){var i=r.next,a=sd(r,t);a===0?(r.next=null,n===null?Zu=i:n.next=i,i===null&&(Qu=n)):(n=r,(e!==0||a&3)&&(ed=!0)),r=i}iu!==0&&iu!==5||id(e,!1),nd!==0&&(nd=0)}function sd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Ut(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),wt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ut(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ut(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ut(n.imageSizes)+`"]`)):i+=`[href="`+Ut(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),wt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ut(r)+`"][href="`+Ut(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),wt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=Ct(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);wt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=Ct(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),wt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=Ct(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),wt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=fe.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=Ct(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=Ct(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=Ct(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Ut(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),wt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Ut(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ut(n.href)+`"]`);if(r)return t.instance=r,wt(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),wt(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,wt(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),wt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,wt(a),a):(r=n,(a=mf.get(o))&&(r=m({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),wt(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,wt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),wt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=l(d(),1),y=_(),b=`modulepreload`,x=function(e){return`/app/`+e},S={},C=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=x(t,n),t in S)return;S[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:b,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},w=`popstate`;function T(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function E(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return te(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:A(t)}return re(t,n,null,e)}function D(e,t){if(e===!1||e==null)throw Error(t)}function O(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ee(){return Math.random().toString(36).substring(2,10)}function k(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function te(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?ne(t):t,state:n,key:t&&t.key||r||ee(),unstable_mask:i}}function A({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function ne(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function re(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=T(e)?e:te(h.location,e,t);n&&n(r,e),l=u()+1;let d=k(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=T(e)?e:te(h.location,e,t);n&&n(r,e),l=u();let i=k(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ie(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(w,d),c=e,()=>{i.removeEventListener(w,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function ie(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),D(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:A(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function j(e,t,n=`/`){return M(e,t,n,!1)}function M(e,t,n,r){let i=xe((typeof t==`string`?ne(t):t).pathname||`/`,n);if(i==null)return null;let a=oe(e);ce(a);let o=null;for(let e=0;o==null&&e{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;D(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Ae([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(D(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),oe(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:he(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of se(e.path))a(e,t,!0,n)}),t}function se(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=se(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ce(e){e.sort((e,t)=>e.score===t.score?ge(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var le=/^:[\w-]+$/,N=3,ue=2,de=1,fe=10,pe=-2,me=e=>e===`*`;function he(e,t){let n=e.split(`/`),r=n.length;return n.some(me)&&(r+=pe),t&&(r+=ue),n.filter(e=>!me(e)).reduce((e,t)=>e+(le.test(t)?N:t===``?de:fe),r)}function ge(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function _e(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function ye(e,t=!1,n=!0){O(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function be(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return O(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function xe(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var Se=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Ce(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?ne(e):e,a;return n?(n=ke(n),a=n.startsWith(`/`)?we(n.substring(1),`/`):we(n,t)):a=t,{pathname:a,search:Ne(r),hash:Pe(i)}}function we(e,t){let n=je(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Te(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Ee(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function De(e){let t=Ee(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Oe(e,t,n,r=!1){let i;typeof e==`string`?i=ne(e):(i={...e},D(!i.pathname||!i.pathname.includes(`?`),Te(`?`,`pathname`,`search`,i)),D(!i.pathname||!i.pathname.includes(`#`),Te(`#`,`pathname`,`hash`,i)),D(!i.search||!i.search.includes(`#`),Te(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Ce(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var ke=e=>e.replace(/\/\/+/g,`/`),Ae=e=>ke(e.join(`/`)),je=e=>e.replace(/\/+$/,``),Me=e=>je(e).replace(/^\/*/,`/`),Ne=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Pe=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Fe=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Ie(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Le(e){return Ae(e.map(e=>e.route.path).filter(Boolean))||`/`}var Re=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ze(e,t){let n=e;if(typeof n!=`string`||!Se.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Re)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=xe(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{O(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Be=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Be);var Ve=[`GET`,...Be];new Set(Ve);var He=v.createContext(null);He.displayName=`DataRouter`;var Ue=v.createContext(null);Ue.displayName=`DataRouterState`;var We=v.createContext(!1);function Ge(){return v.useContext(We)}var Ke=v.createContext({isTransitioning:!1});Ke.displayName=`ViewTransition`;var qe=v.createContext(new Map);qe.displayName=`Fetchers`;var Je=v.createContext(null);Je.displayName=`Await`;var Ye=v.createContext(null);Ye.displayName=`Navigation`;var Xe=v.createContext(null);Xe.displayName=`Location`;var Ze=v.createContext({outlet:null,matches:[],isDataRoute:!1});Ze.displayName=`Route`;var Qe=v.createContext(null);Qe.displayName=`RouteError`;var $e=`REACT_ROUTER_ERROR`,et=`REDIRECT`,tt=`ROUTE_ERROR_RESPONSE`;function nt(e){if(e.startsWith(`${$e}:${et}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function rt(e){if(e.startsWith(`${$e}:${tt}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Fe(t.status,t.statusText,t.data)}catch{}}function it(e,{relative:t}={}){D(at(),`useHref() may be used only in the context of a component.`);let{basename:n,navigator:r}=v.useContext(Ye),{hash:i,pathname:a,search:o}=ft(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Ae([n,a])),r.createHref({pathname:s,search:o,hash:i})}function at(){return v.useContext(Xe)!=null}function ot(){return D(at(),`useLocation() may be used only in the context of a component.`),v.useContext(Xe).location}var st=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function ct(e){v.useContext(Ye).static||v.useLayoutEffect(e)}function lt(){let{isDataRoute:e}=v.useContext(Ze);return e?jt():ut()}function ut(){D(at(),`useNavigate() may be used only in the context of a component.`);let e=v.useContext(He),{basename:t,navigator:n}=v.useContext(Ye),{matches:r}=v.useContext(Ze),{pathname:i}=ot(),a=JSON.stringify(De(r)),o=v.useRef(!1);return ct(()=>{o.current=!0}),v.useCallback((r,s={})=>{if(O(o.current,st),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Oe(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Ae([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}v.createContext(null);function dt(){let{matches:e}=v.useContext(Ze),t=e[e.length-1];return t?t.params:{}}function ft(e,{relative:t}={}){let{matches:n}=v.useContext(Ze),{pathname:r}=ot(),i=JSON.stringify(De(n));return v.useMemo(()=>Oe(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function pt(e,t){return mt(e,t)}function mt(e,t,n){D(at(),`useRoutes() may be used only in the context of a component.`);let{navigator:r}=v.useContext(Ye),{matches:i}=v.useContext(Ze),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Nt(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant (or called \`useRoutes()\`) at "${s}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let u=ot(),d;if(t){let e=typeof t==`string`?ne(t):t;D(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=j(e,{pathname:p});O(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),O(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let h=xt(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Ae([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Ae([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?v.createElement(Xe.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function ht(){let e=At(),t=Ie(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=v.createElement(v.Fragment,null,v.createElement(`p`,null,`💿 Hey developer 👋`),v.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,v.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,v.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:i},n):null,o)}var gt=v.createElement(ht,null),_t=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=rt(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(Ze.Provider,{value:this.props.routeContext},v.createElement(Qe.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(yt,{error:e},t):t}};_t.contextType=We;var vt=new WeakMap;function yt({children:e,error:t}){let{basename:n}=v.useContext(Ye);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=nt(t.digest);if(e){let r=vt.get(t);if(r)throw r;let i=ze(e.location,n);if(Re&&!vt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw vt.set(t,n),n}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function bt({routeContext:e,match:t,children:n}){let r=v.useContext(He);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Ze.Provider,{value:e},n)}function xt(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);D(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:Le(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||gt,o&&(s<0&&c===0?(Nt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(bt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(_t,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function St(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ct(e){let t=v.useContext(He);return D(t,St(e)),t}function wt(e){let t=v.useContext(Ue);return D(t,St(e)),t}function Tt(e){let t=v.useContext(Ze);return D(t,St(e)),t}function Et(e){let t=Tt(e),n=t.matches[t.matches.length-1];return D(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Dt(){return Et(`useRouteId`)}function Ot(){return wt(`useNavigation`).navigation}function kt(){let{matches:e,loaderData:t}=wt(`useMatches`);return v.useMemo(()=>e.map(e=>ae(e,t)),[e,t])}function At(){let e=v.useContext(Qe),t=wt(`useRouteError`),n=Et(`useRouteError`);return e===void 0?t.errors?.[n]:e}function jt(){let{router:e}=Ct(`useNavigate`),t=Et(`useNavigate`),n=v.useRef(!1);return ct(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{O(n.current,st),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Mt={};function Nt(e,t,n){!t&&!Mt[e]&&(Mt[e]=!0,O(!1,n))}v.useOptimistic,v.memo(Pt);function Pt({routes:e,future:t,state:n,isStatic:r,onError:i}){return mt(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function Ft({to:e,replace:t,state:n,relative:r}){D(at(),` may be used only in the context of a component.`);let{static:i}=v.useContext(Ye);O(!i,` must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.`);let{matches:a}=v.useContext(Ze),{pathname:o}=ot(),s=lt(),c=Oe(e,De(a),o,r===`path`),l=JSON.stringify(c);return v.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function It(e){D(!1,`A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .`)}function Lt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){D(!at(),`You cannot render a inside another . You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=ne(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=v.useMemo(()=>{let e=xe(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return O(h!=null,` is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the won't render anything.`),h==null?null:v.createElement(Ye.Provider,{value:c},v.createElement(Xe.Provider,{children:t,value:h}))}function Rt({children:e,location:t}){return pt(zt(e),t)}v.Component;function zt(e,t=[]){let n=[];return v.Children.forEach(e,(e,r)=>{if(!v.isValidElement(e))return;let i=[...t,r];if(e.type===v.Fragment){n.push.apply(n,zt(e.props.children,i));return}D(e.type===It,`[${typeof e.type==`string`?e.type:e.type.name}] is not a component. All component children of must be a or `),D(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=zt(e.props.children,i)),n.push(a)}),n}var Bt=`get`,Vt=`application/x-www-form-urlencoded`;function Ht(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Ut(e){return Ht(e)&&e.tagName.toLowerCase()===`button`}function Wt(e){return Ht(e)&&e.tagName.toLowerCase()===`form`}function Gt(e){return Ht(e)&&e.tagName.toLowerCase()===`input`}function Kt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function qt(e,t){return e.button===0&&(!t||t===`_self`)&&!Kt(e)}function Jt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Yt(e,t){let n=Jt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Xt=null;function Zt(){if(Xt===null)try{new FormData(document.createElement(`form`),0),Xt=!1}catch{Xt=!0}return Xt}var Qt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function $t(e){return e!=null&&!Qt.has(e)?(O(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Vt}"`),null):e}function en(e,t){let n,r,i,a,o;if(Wt(e)){let o=e.getAttribute(`action`);r=o?xe(o,t):null,n=e.getAttribute(`method`)||Bt,i=$t(e.getAttribute(`enctype`))||Vt,a=new FormData(e)}else if(Ut(e)||Gt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a