From b7bb455f565ef3ed0df4fd76f8b783d7d756a9f7 Mon Sep 17 00:00:00 2001 From: VPS 4 Builder Date: Mon, 18 May 2026 00:37:49 +0200 Subject: [PATCH] feat: add isolated staging environment, manual promotion script, and prepended staging domain pattern --- deploy-prod-builder.sh | 19 +- deploy-to-prod.sh | 53 ++ docker-compose-staging.yml | 59 ++ frontend/dist/assets/index-CS4bnJiX.js | 736 ----------------------- frontend/dist/assets/index-CwbNbjIf.css | 1 + frontend/dist/assets/index-DBXVhurK.js | 737 ++++++++++++++++++++++++ frontend/dist/assets/index-VV5qCksm.css | 1 - frontend/dist/index.html | 4 +- nginx/default-staging.conf | 52 ++ 9 files changed, 912 insertions(+), 750 deletions(-) create mode 100755 deploy-to-prod.sh create mode 100644 docker-compose-staging.yml delete mode 100644 frontend/dist/assets/index-CS4bnJiX.js create mode 100644 frontend/dist/assets/index-CwbNbjIf.css create mode 100644 frontend/dist/assets/index-DBXVhurK.js delete mode 100644 frontend/dist/assets/index-VV5qCksm.css create mode 100644 nginx/default-staging.conf diff --git a/deploy-prod-builder.sh b/deploy-prod-builder.sh index 67ccf21..120fc0e 100755 --- a/deploy-prod-builder.sh +++ b/deploy-prod-builder.sh @@ -36,19 +36,16 @@ node update-version.js log "⚙️ Instalando dependências e preparando o Backend..." cd /home/deploy/stack/scoreodonto.com/backend npm install -# Prisma removido — backend usa pg nativo, schema.prisma é legado -# 2.1 Compilar os Plugins -log "⚙️ Compilando os Plugins da plataforma..." -cd /home/deploy/stack/scoreodonto.com/plugins -if [ -f "/home/deploy/stack/scoreodonto.com/backend/node_modules/.bin/tsc" ]; then - /home/deploy/stack/scoreodonto.com/backend/node_modules/.bin/tsc -p tsconfig.json || true -fi +# 3. Compilar o Frontend +log "⚙️ Instalando dependências e compilando o Frontend (Vite)..." +cd /home/deploy/stack/scoreodonto.com/frontend +npm install +npm run build -# 4. Reconstruir containers localmente na VPS 4 (servidor de produção) -log "🔄 Reconstruindo containers na VPS 4 (produção real)..." -cd /home/deploy/stack/scoreodonto.com -docker compose up -d --build +# 4. Reiniciar os serviços de Staging localmente na VPS 4 +log "🔄 Reiniciando contêineres de STAGING na VPS 4..." +docker compose -f /home/deploy/stack/scoreodonto.com/docker-compose-staging.yml up -d --build # 6. Salvar incremento de versão no Git log "💾 Comitando o incremento de versão de volta para o repositório central..." diff --git a/deploy-to-prod.sh b/deploy-to-prod.sh new file mode 100755 index 0000000..3e5eb33 --- /dev/null +++ b/deploy-to-prod.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# ─── deploy-to-prod.sh (ScoreOdonto) ────────────────────────────────────────── +# Script de Promoção Manual: Staging (VPS 4) ➔ Produção (VPS 1) +# ───────────────────────────────────────────────────────────────────────────── +set -e + +LOCK_FILE="/tmp/deploy-prod-scoreodonto-release.lock" +if [ -f "$LOCK_FILE" ]; then + echo "🚨 Promoção para produção já está em andamento! Aguarde..." + exit 1 +fi +touch "$LOCK_FILE" +trap 'rm -f "$LOCK_FILE"' EXIT + +LOG_FILE="/home/deploy/stack/webhook-listener/deploy.log" +log() { + echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] [SCOREODONTO-PROD] $1" | tee -a "$LOG_FILE" +} + +log "🚀 Iniciando PROMOÇÃO MANUAL de Staging (VPS 4) para PRODUÇÃO (VPS 1)..." + +# 1. Sincronizar Backend para a VPS 1 +log "🚚 Despachando Backend para a VPS 1 (Produção)..." +rsync -avz --delete \ + --exclude '.env' \ + --exclude 'node_modules/.cache' \ + /home/deploy/stack/scoreodonto.com/backend/ \ + deploy@10.99.0.1:/home/deploy/stack/scoreodonto.com/backend/ + +# 2. Sincronizar Frontend (build compilada em Staging) para a VPS 1 +log "🚚 Despachando Frontend (build) para a VPS 1 (Produção)..." +rsync -avz --delete \ + /home/deploy/stack/scoreodonto.com/frontend/dist/ \ + deploy@10.99.0.1:/home/deploy/stack/scoreodonto.com/frontend/dist/ + +# 3. Sincronizar Plugins para a VPS 1 +log "🚚 Despachando Plugins..." +rsync -avz --delete \ + /home/deploy/stack/scoreodonto.com/plugins/ \ + deploy@10.99.0.1:/home/deploy/stack/scoreodonto.com/plugins/ + +# 4. Sincronizar Docker Compose de Produção e Configurações de Nginx +log "🚚 Despachando Infraestrutura (Docker/Config) para a VPS 1..." +rsync -avz \ + /home/deploy/stack/scoreodonto.com/docker-compose.yml \ + /home/deploy/stack/scoreodonto.com/nginx \ + deploy@10.99.0.1:/home/deploy/stack/scoreodonto.com/ + +# 5. SSH na VPS 1 para Reiniciar Serviços de Produção +log "🔄 Reiniciando containers de PRODUÇÃO na VPS 1..." +ssh -o BatchMode=yes deploy@10.99.0.1 "cd /home/deploy/stack/scoreodonto.com && DOCKER_HOST=unix:///run/user/1000/docker.sock docker compose up -d" + +log "✅ PROMOÇÃO PARA PRODUÇÃO CONCLUÍDA COM SUCESSO!" diff --git a/docker-compose-staging.yml b/docker-compose-staging.yml new file mode 100644 index 0000000..8e6b4c9 --- /dev/null +++ b/docker-compose-staging.yml @@ -0,0 +1,59 @@ +services: + nginx: + image: nginx:alpine + container_name: scoreodonto-nginx-staging + restart: always + ports: + - "8082:80" + volumes: + - "./nginx/default-staging.conf:/etc/nginx/conf.d/default.conf:ro" + networks: + - staging-net + depends_on: + - scoreodonto-backend-staging + - scoreodonto-frontend-staging + + scoreodonto-backend-staging: + build: + context: "./backend" + dockerfile: Dockerfile + container_name: scoreodonto-backend-staging + restart: always + env_file: + - "./backend/.env" + environment: + - BAILEYS_ENGINE=infinite + - PORT=8018 + - NODE_ENV=staging + - DATABASE_URL=postgresql://scoreodonto_user:clube67_scoreodonto_pass_9903@10.99.0.3:5432/scoreodonto?schema=public + - DRAGONFLY_URL=redis://:clube67_dragonfly_pass_9903@10.99.0.3:6379/1 + - NATS_URL=nats://10.99.0.3:4222 + - TEMPORAL_ADDRESS=10.99.0.3:7233 + - BAILEYS_SESSIONS_PATH=/app/sessions + - APP_URL=https://staging.scoreodonto.com + - GOOGLE_REDIRECT_URI=https://staging.scoreodonto.com/api/oauth2callback + volumes: + - "/home/deploy/scoreodonto-sessions-staging:/app/sessions" + - "/home/deploy/scoreodonto-media-staging:/app/media" + - "./plugins:/app/plugins" + networks: + - staging-net + + scoreodonto-frontend-staging: + build: + context: "." + dockerfile: frontend/Dockerfile + container_name: scoreodonto-frontend-staging + restart: always + env_file: + - "./frontend/.env.production.local" + environment: + - PORT=3013 + - NODE_ENV=staging + - NEXT_PUBLIC_API_URL=https://staging.scoreodonto.com/api + networks: + - staging-net + +networks: + staging-net: + driver: bridge diff --git a/frontend/dist/assets/index-CS4bnJiX.js b/frontend/dist/assets/index-CS4bnJiX.js deleted file mode 100644 index a6e9c9d..0000000 --- a/frontend/dist/assets/index-CS4bnJiX.js +++ /dev/null @@ -1,736 +0,0 @@ -var By=t=>{throw TypeError(t)};var Zh=(t,e,n)=>e.has(t)||By("Cannot "+n);var z=(t,e,n)=>(Zh(t,e,"read from private field"),n?n.call(t):e.get(t)),Ee=(t,e,n)=>e.has(t)?By("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),pe=(t,e,n,r)=>(Zh(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Pe=(t,e,n)=>(Zh(t,e,"access private method"),n);var id=(t,e,n,r)=>({set _(i){pe(t,e,i,n)},get _(){return z(t,e,r)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const c of i)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function n(i){const c={};return i.integrity&&(c.integrity=i.integrity),i.referrerPolicy&&(c.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?c.credentials="include":i.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(i){if(i.ep)return;i.ep=!0;const c=n(i);fetch(i.href,c)}})();function RN(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Kh={exports:{}},Yi={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Hy;function Y2(){if(Hy)return Yi;Hy=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,c){var d=null;if(c!==void 0&&(d=""+c),i.key!==void 0&&(d=""+i.key),"key"in i){c={};for(var f in i)f!=="key"&&(c[f]=i[f])}else c=i;return i=c.ref,{$$typeof:t,type:r,key:d,ref:i!==void 0?i:null,props:c}}return Yi.Fragment=e,Yi.jsx=n,Yi.jsxs=n,Yi}var Gy;function Q2(){return Gy||(Gy=1,Kh.exports=Y2()),Kh.exports}var s=Q2(),Jh={exports:{}},De={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Vy;function W2(){if(Vy)return De;Vy=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),m=Symbol.iterator;function v(T){return T===null||typeof T!="object"?null:(T=m&&T[m]||T["@@iterator"],typeof T=="function"?T:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,j={};function R(T,X,ie){this.props=T,this.context=X,this.refs=j,this.updater=ie||N}R.prototype.isReactComponent={},R.prototype.setState=function(T,X){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,X,"setState")},R.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function C(){}C.prototype=R.prototype;function O(T,X,ie){this.props=T,this.context=X,this.refs=j,this.updater=ie||N}var A=O.prototype=new C;A.constructor=O,S(A,R.prototype),A.isPureReactComponent=!0;var k=Array.isArray;function _(){}var B={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function G(T,X,ie){var de=ie.ref;return{$$typeof:t,type:T,key:X,ref:de!==void 0?de:null,props:ie}}function ee(T,X){return G(T.type,X,T.props)}function ne(T){return typeof T=="object"&&T!==null&&T.$$typeof===t}function oe(T){var X={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(ie){return X[ie]})}var Q=/\/+/g;function ce(T,X){return typeof T=="object"&&T!==null&&T.key!=null?oe(""+T.key):X.toString(36)}function he(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(_,_):(T.status="pending",T.then(function(X){T.status==="pending"&&(T.status="fulfilled",T.value=X)},function(X){T.status==="pending"&&(T.status="rejected",T.reason=X)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function H(T,X,ie,de,ve){var je=typeof T;(je==="undefined"||je==="boolean")&&(T=null);var Te=!1;if(T===null)Te=!0;else switch(je){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(T.$$typeof){case t:case e:Te=!0;break;case b:return Te=T._init,H(Te(T._payload),X,ie,de,ve)}}if(Te)return ve=ve(T),Te=de===""?"."+ce(T,0):de,k(ve)?(ie="",Te!=null&&(ie=Te.replace(Q,"$&/")+"/"),H(ve,X,ie,"",function(It){return It})):ve!=null&&(ne(ve)&&(ve=ee(ve,ie+(ve.key==null||T&&T.key===ve.key?"":(""+ve.key).replace(Q,"$&/")+"/")+Te)),X.push(ve)),1;Te=0;var bt=de===""?".":de+":";if(k(T))for(var Ue=0;Ue>>1,te=H[W];if(0>>1;Wi(ie,P))dei(ve,ie)?(H[W]=ve,H[de]=P,W=de):(H[W]=ie,H[X]=P,W=X);else if(dei(ve,P))H[W]=ve,H[de]=P,W=de;else break e}}return V}function i(H,V){var P=H.sortIndex-V.sortIndex;return P!==0?P:H.id-V.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();t.unstable_now=function(){return d.now()-f}}var h=[],p=[],b=1,y=null,m=3,v=!1,N=!1,S=!1,j=!1,R=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function A(H){for(var V=n(p);V!==null;){if(V.callback===null)r(p);else if(V.startTime<=H)r(p),V.sortIndex=V.expirationTime,e(h,V);else break;V=n(p)}}function k(H){if(S=!1,A(H),!N)if(n(h)!==null)N=!0,_||(_=!0,oe());else{var V=n(p);V!==null&&he(k,V.startTime-H)}}var _=!1,B=-1,F=5,G=-1;function ee(){return j?!0:!(t.unstable_now()-GH&&ee());){var W=y.callback;if(typeof W=="function"){y.callback=null,m=y.priorityLevel;var te=W(y.expirationTime<=H);if(H=t.unstable_now(),typeof te=="function"){y.callback=te,A(H),V=!0;break t}y===n(h)&&r(h),A(H)}else r(h);y=n(h)}if(y!==null)V=!0;else{var T=n(p);T!==null&&he(k,T.startTime-H),V=!1}}break e}finally{y=null,m=P,v=!1}V=void 0}}finally{V?oe():_=!1}}}var oe;if(typeof O=="function")oe=function(){O(ne)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,ce=Q.port2;Q.port1.onmessage=ne,oe=function(){ce.postMessage(null)}}else oe=function(){R(ne,0)};function he(H,V){B=R(function(){H(t.unstable_now())},V)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(H){H.callback=null},t.unstable_forceFrameRate=function(H){0>H||125W?(H.sortIndex=P,e(p,H),n(h)===null&&H===n(p)&&(S?(C(B),B=-1):S=!0,he(k,P-W))):(H.sortIndex=te,e(h,H),N||v||(N=!0,_||(_=!0,oe()))),H},t.unstable_shouldYield=ee,t.unstable_wrapCallback=function(H){var V=m;return function(){var P=m;m=V;try{return H.apply(this,arguments)}finally{m=P}}}})(np)),np}var $y;function Z2(){return $y||($y=1,tp.exports=X2()),tp.exports}var ap={exports:{}},Vt={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Yy;function K2(){if(Yy)return Vt;Yy=1;var t=pu();function e(h){var p="https://react.dev/errors/"+h;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),ap.exports=K2(),ap.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Wy;function J2(){if(Wy)return Qi;Wy=1;var t=Z2(),e=pu(),n=TN();function r(a){var l="https://react.dev/errors/"+a;if(1te||(a.current=W[te],W[te]=null,te--)}function ie(a,l){te++,W[te]=a.current,a.current=l}var de=T(null),ve=T(null),je=T(null),Te=T(null);function bt(a,l){switch(ie(je,l),ie(ve,a),ie(de,null),l.nodeType){case 9:case 11:a=(a=l.documentElement)&&(a=a.namespaceURI)?cy(a):0;break;default:if(a=l.tagName,l=l.namespaceURI)l=cy(l),a=dy(l,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}X(de),ie(de,a)}function Ue(){X(de),X(ve),X(je)}function It(a){a.memoizedState!==null&&ie(Te,a);var l=de.current,o=dy(l,a.type);l!==o&&(ie(ve,a),ie(de,o))}function Rn(a){ve.current===a&&(X(de),X(ve)),Te.current===a&&(X(Te),Vi._currentValue=P)}var ue,Oe;function Ce(a){if(ue===void 0)try{throw Error()}catch(o){var l=o.stack.trim().match(/\n( *(at )?)/);ue=l&&l[1]||"",Oe=-1)":-1g||M[u]!==$[g]){var ae=` -`+M[u].replace(" at new "," at ");return a.displayName&&ae.includes("")&&(ae=ae.replace("",a.displayName)),ae}while(1<=u&&0<=g);break}}}finally{yt=!1,Error.prepareStackTrace=o}return(o=a?a.displayName||a.name:"")?Ce(o):""}function jA(a,l){switch(a.tag){case 26:case 27:case 5:return Ce(a.type);case 16:return Ce("Lazy");case 13:return a.child!==l&&l!==null?Ce("Suspense Fallback"):Ce("Suspense");case 19:return Ce("SuspenseList");case 0:case 15:return Yn(a.type,!1);case 11:return Yn(a.type.render,!1);case 1:return Yn(a.type,!0);case 31:return Ce("Activity");default:return""}}function Bm(a){try{var l="",o=null;do l+=jA(a,o),o=a,a=a.return;while(a);return l}catch(u){return` -Error generating stack: `+u.message+` -`+u.stack}}var Iu=Object.prototype.hasOwnProperty,Lu=t.unstable_scheduleCallback,zu=t.unstable_cancelCallback,AA=t.unstable_shouldYield,wA=t.unstable_requestPaint,dn=t.unstable_now,CA=t.unstable_getCurrentPriorityLevel,Hm=t.unstable_ImmediatePriority,Gm=t.unstable_UserBlockingPriority,Fo=t.unstable_NormalPriority,DA=t.unstable_LowPriority,Vm=t.unstable_IdlePriority,OA=t.log,RA=t.unstable_setDisableYieldValue,ti=null,un=null;function $a(a){if(typeof OA=="function"&&RA(a),un&&typeof un.setStrictMode=="function")try{un.setStrictMode(ti,a)}catch{}}var fn=Math.clz32?Math.clz32:_A,TA=Math.log,kA=Math.LN2;function _A(a){return a>>>=0,a===0?32:31-(TA(a)/kA|0)|0}var qo=256,$o=262144,Yo=4194304;function Gs(a){var l=a&42;if(l!==0)return l;switch(a&-a){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 a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function Qo(a,l,o){var u=a.pendingLanes;if(u===0)return 0;var g=0,x=a.suspendedLanes,E=a.pingedLanes;a=a.warmLanes;var D=u&134217727;return D!==0?(u=D&~x,u!==0?g=Gs(u):(E&=D,E!==0?g=Gs(E):o||(o=D&~a,o!==0&&(g=Gs(o))))):(D=u&~x,D!==0?g=Gs(D):E!==0?g=Gs(E):o||(o=u&~a,o!==0&&(g=Gs(o)))),g===0?0:l!==0&&l!==g&&(l&x)===0&&(x=g&-g,o=l&-l,x>=o||x===32&&(o&4194048)!==0)?l:g}function ni(a,l){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&l)===0}function MA(a,l){switch(a){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 Fm(){var a=Yo;return Yo<<=1,(Yo&62914560)===0&&(Yo=4194304),a}function Pu(a){for(var l=[],o=0;31>o;o++)l.push(a);return l}function ai(a,l){a.pendingLanes|=l,l!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function IA(a,l,o,u,g,x){var E=a.pendingLanes;a.pendingLanes=o,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=o,a.entangledLanes&=o,a.errorRecoveryDisabledLanes&=o,a.shellSuspendCounter=0;var D=a.entanglements,M=a.expirationTimes,$=a.hiddenUpdates;for(o=E&~o;0"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var HA=/[\n"\\]/g;function kn(a){return a.replace(HA,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Fu(a,l,o,u,g,x,E,D){a.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?a.type=E:a.removeAttribute("type"),l!=null?E==="number"?(l===0&&a.value===""||a.value!=l)&&(a.value=""+Tn(l)):a.value!==""+Tn(l)&&(a.value=""+Tn(l)):E!=="submit"&&E!=="reset"||a.removeAttribute("value"),l!=null?qu(a,E,Tn(l)):o!=null?qu(a,E,Tn(o)):u!=null&&a.removeAttribute("value"),g==null&&x!=null&&(a.defaultChecked=!!x),g!=null&&(a.checked=g&&typeof g!="function"&&typeof g!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?a.name=""+Tn(D):a.removeAttribute("name")}function ax(a,l,o,u,g,x,E,D){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(a.type=x),l!=null||o!=null){if(!(x!=="submit"&&x!=="reset"||l!=null)){Vu(a);return}o=o!=null?""+Tn(o):"",l=l!=null?""+Tn(l):o,D||l===a.value||(a.value=l),a.defaultValue=l}u=u??g,u=typeof u!="function"&&typeof u!="symbol"&&!!u,a.checked=D?a.checked:!!u,a.defaultChecked=!!u,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(a.name=E),Vu(a)}function qu(a,l,o){l==="number"&&Zo(a.ownerDocument)===a||a.defaultValue===""+o||(a.defaultValue=""+o)}function Ur(a,l,o,u){if(a=a.options,l){l={};for(var g=0;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xu=!1;if(xa)try{var ii={};Object.defineProperty(ii,"passive",{get:function(){Xu=!0}}),window.addEventListener("test",ii,ii),window.removeEventListener("test",ii,ii)}catch{Xu=!1}var Qa=null,Zu=null,Jo=null;function dx(){if(Jo)return Jo;var a,l=Zu,o=l.length,u,g="value"in Qa?Qa.value:Qa.textContent,x=g.length;for(a=0;a=di),mx=" ",xx=!1;function bx(a,l){switch(a){case"keyup":return gw.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yx(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Vr=!1;function xw(a,l){switch(a){case"compositionend":return yx(l);case"keypress":return l.which!==32?null:(xx=!0,mx);case"textInput":return a=l.data,a===mx&&xx?null:a;default:return null}}function bw(a,l){if(Vr)return a==="compositionend"||!nf&&bx(a,l)?(a=dx(),Jo=Zu=Qa=null,Vr=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:o,offset:l-a};a=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Cx(o)}}function Ox(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?Ox(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function Rx(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var l=Zo(a.document);l instanceof a.HTMLIFrameElement;){try{var o=typeof l.contentWindow.location.href=="string"}catch{o=!1}if(o)a=l.contentWindow;else break;l=Zo(a.document)}return l}function rf(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l&&(l==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||l==="textarea"||a.contentEditable==="true")}var ww=xa&&"documentMode"in document&&11>=document.documentMode,Fr=null,lf=null,pi=null,of=!1;function Tx(a,l,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;of||Fr==null||Fr!==Zo(u)||(u=Fr,"selectionStart"in u&&rf(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),pi&&hi(pi,u)||(pi=u,u=$c(lf,"onSelect"),0>=E,g-=E,na=1<<32-fn(l)+g|o<ke?(ze=xe,xe=null):ze=xe.sibling;var Ye=Y(U,xe,q[ke],se);if(Ye===null){xe===null&&(xe=ze);break}a&&xe&&Ye.alternate===null&&l(U,xe),L=x(Ye,L,ke),$e===null?Ne=Ye:$e.sibling=Ye,$e=Ye,xe=ze}if(ke===q.length)return o(U,xe),Be&&ya(U,ke),Ne;if(xe===null){for(;keke?(ze=xe,xe=null):ze=xe.sibling;var ms=Y(U,xe,Ye.value,se);if(ms===null){xe===null&&(xe=ze);break}a&&xe&&ms.alternate===null&&l(U,xe),L=x(ms,L,ke),$e===null?Ne=ms:$e.sibling=ms,$e=ms,xe=ze}if(Ye.done)return o(U,xe),Be&&ya(U,ke),Ne;if(xe===null){for(;!Ye.done;ke++,Ye=q.next())Ye=re(U,Ye.value,se),Ye!==null&&(L=x(Ye,L,ke),$e===null?Ne=Ye:$e.sibling=Ye,$e=Ye);return Be&&ya(U,ke),Ne}for(xe=u(xe);!Ye.done;ke++,Ye=q.next())Ye=K(xe,U,ke,Ye.value,se),Ye!==null&&(a&&Ye.alternate!==null&&xe.delete(Ye.key===null?ke:Ye.key),L=x(Ye,L,ke),$e===null?Ne=Ye:$e.sibling=Ye,$e=Ye);return a&&xe.forEach(function($2){return l(U,$2)}),Be&&ya(U,ke),Ne}function st(U,L,q,se){if(typeof q=="object"&&q!==null&&q.type===S&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case v:e:{for(var Ne=q.key;L!==null;){if(L.key===Ne){if(Ne=q.type,Ne===S){if(L.tag===7){o(U,L.sibling),se=g(L,q.props.children),se.return=U,U=se;break e}}else if(L.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===F&&Js(Ne)===L.type){o(U,L.sibling),se=g(L,q.props),vi(se,q),se.return=U,U=se;break e}o(U,L);break}else l(U,L);L=L.sibling}q.type===S?(se=Qs(q.props.children,U.mode,se,q.key),se.return=U,U=se):(se=cc(q.type,q.key,q.props,null,U.mode,se),vi(se,q),se.return=U,U=se)}return E(U);case N:e:{for(Ne=q.key;L!==null;){if(L.key===Ne)if(L.tag===4&&L.stateNode.containerInfo===q.containerInfo&&L.stateNode.implementation===q.implementation){o(U,L.sibling),se=g(L,q.children||[]),se.return=U,U=se;break e}else{o(U,L);break}else l(U,L);L=L.sibling}se=gf(q,U.mode,se),se.return=U,U=se}return E(U);case F:return q=Js(q),st(U,L,q,se)}if(he(q))return ge(U,L,q,se);if(oe(q)){if(Ne=oe(q),typeof Ne!="function")throw Error(r(150));return q=Ne.call(q),Ae(U,L,q,se)}if(typeof q.then=="function")return st(U,L,mc(q),se);if(q.$$typeof===O)return st(U,L,fc(U,q),se);xc(U,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,L!==null&&L.tag===6?(o(U,L.sibling),se=g(L,q),se.return=U,U=se):(o(U,L),se=pf(q,U.mode,se),se.return=U,U=se),E(U)):o(U,L)}return function(U,L,q,se){try{yi=0;var Ne=st(U,L,q,se);return tl=null,Ne}catch(xe){if(xe===el||xe===pc)throw xe;var $e=pn(29,xe,null,U.mode);return $e.lanes=se,$e.return=U,$e}finally{}}}var tr=e0(!0),t0=e0(!1),Ja=!1;function Cf(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Df(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function es(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function ts(a,l,o){var u=a.updateQueue;if(u===null)return null;if(u=u.shared,(We&2)!==0){var g=u.pending;return g===null?l.next=l:(l.next=g.next,g.next=l),u.pending=l,l=oc(a),Px(a,null,o),l}return ic(a,u,l,o),oc(a)}function Ni(a,l,o){if(l=l.updateQueue,l!==null&&(l=l.shared,(o&4194048)!==0)){var u=l.lanes;u&=a.pendingLanes,o|=u,l.lanes=o,$m(a,o)}}function Of(a,l){var o=a.updateQueue,u=a.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var g=null,x=null;if(o=o.firstBaseUpdate,o!==null){do{var E={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};x===null?g=x=E:x=x.next=E,o=o.next}while(o!==null);x===null?g=x=l:x=x.next=l}else g=x=l;o={baseState:u.baseState,firstBaseUpdate:g,lastBaseUpdate:x,shared:u.shared,callbacks:u.callbacks},a.updateQueue=o;return}a=o.lastBaseUpdate,a===null?o.firstBaseUpdate=l:a.next=l,o.lastBaseUpdate=l}var Rf=!1;function Ei(){if(Rf){var a=Jr;if(a!==null)throw a}}function Si(a,l,o,u){Rf=!1;var g=a.updateQueue;Ja=!1;var x=g.firstBaseUpdate,E=g.lastBaseUpdate,D=g.shared.pending;if(D!==null){g.shared.pending=null;var M=D,$=M.next;M.next=null,E===null?x=$:E.next=$,E=M;var ae=a.alternate;ae!==null&&(ae=ae.updateQueue,D=ae.lastBaseUpdate,D!==E&&(D===null?ae.firstBaseUpdate=$:D.next=$,ae.lastBaseUpdate=M))}if(x!==null){var re=g.baseState;E=0,ae=$=M=null,D=x;do{var Y=D.lane&-536870913,K=Y!==D.lane;if(K?(Le&Y)===Y:(u&Y)===Y){Y!==0&&Y===Kr&&(Rf=!0),ae!==null&&(ae=ae.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var ge=a,Ae=D;Y=l;var st=o;switch(Ae.tag){case 1:if(ge=Ae.payload,typeof ge=="function"){re=ge.call(st,re,Y);break e}re=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ae.payload,Y=typeof ge=="function"?ge.call(st,re,Y):ge,Y==null)break e;re=y({},re,Y);break e;case 2:Ja=!0}}Y=D.callback,Y!==null&&(a.flags|=64,K&&(a.flags|=8192),K=g.callbacks,K===null?g.callbacks=[Y]:K.push(Y))}else K={lane:Y,tag:D.tag,payload:D.payload,callback:D.callback,next:null},ae===null?($=ae=K,M=re):ae=ae.next=K,E|=Y;if(D=D.next,D===null){if(D=g.shared.pending,D===null)break;K=D,D=K.next,K.next=null,g.lastBaseUpdate=K,g.shared.pending=null}}while(!0);ae===null&&(M=re),g.baseState=M,g.firstBaseUpdate=$,g.lastBaseUpdate=ae,x===null&&(g.shared.lanes=0),ls|=E,a.lanes=E,a.memoizedState=re}}function n0(a,l){if(typeof a!="function")throw Error(r(191,a));a.call(l)}function a0(a,l){var o=a.callbacks;if(o!==null)for(a.callbacks=null,a=0;ax?x:8;var E=H.T,D={};H.T=D,Wf(a,!1,l,o);try{var M=g(),$=H.S;if($!==null&&$(D,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var ae=Iw(M,u);wi(a,l,ae,yn(a))}else wi(a,l,u,yn(a))}catch(re){wi(a,l,{then:function(){},status:"rejected",reason:re},yn())}finally{V.p=x,E!==null&&D.types!==null&&(E.types=D.types),H.T=E}}function Hw(){}function Yf(a,l,o,u){if(a.tag!==5)throw Error(r(476));var g=I0(a).queue;M0(a,g,l,P,o===null?Hw:function(){return L0(a),o(u)})}function I0(a){var l=a.memoizedState;if(l!==null)return l;l={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sa,lastRenderedState:P},next:null};var o={};return l.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sa,lastRenderedState:o},next:null},a.memoizedState=l,a=a.alternate,a!==null&&(a.memoizedState=l),l}function L0(a){var l=I0(a);l.next===null&&(l=a.alternate.memoizedState),wi(a,l.next.queue,{},yn())}function Qf(){return Pt(Vi)}function z0(){return Nt().memoizedState}function P0(){return Nt().memoizedState}function Gw(a){for(var l=a.return;l!==null;){switch(l.tag){case 24:case 3:var o=yn();a=es(o);var u=ts(l,a,o);u!==null&&(sn(u,l,o),Ni(u,l,o)),l={cache:Sf()},a.payload=l;return}l=l.return}}function Vw(a,l,o){var u=yn();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Cc(a)?B0(l,o):(o=ff(a,l,o,u),o!==null&&(sn(o,a,u),H0(o,l,u)))}function U0(a,l,o){var u=yn();wi(a,l,o,u)}function wi(a,l,o,u){var g={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Cc(a))B0(l,g);else{var x=a.alternate;if(a.lanes===0&&(x===null||x.lanes===0)&&(x=l.lastRenderedReducer,x!==null))try{var E=l.lastRenderedState,D=x(E,o);if(g.hasEagerState=!0,g.eagerState=D,hn(D,E))return ic(a,l,g,0),rt===null&&lc(),!1}catch{}finally{}if(o=ff(a,l,g,u),o!==null)return sn(o,a,u),H0(o,l,u),!0}return!1}function Wf(a,l,o,u){if(u={lane:2,revertLane:Ch(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Cc(a)){if(l)throw Error(r(479))}else l=ff(a,o,u,2),l!==null&&sn(l,a,2)}function Cc(a){var l=a.alternate;return a===Re||l!==null&&l===Re}function B0(a,l){al=vc=!0;var o=a.pending;o===null?l.next=l:(l.next=o.next,o.next=l),a.pending=l}function H0(a,l,o){if((o&4194048)!==0){var u=l.lanes;u&=a.pendingLanes,o|=u,l.lanes=o,$m(a,o)}}var Ci={readContext:Pt,use:Sc,useCallback:pt,useContext:pt,useEffect:pt,useImperativeHandle:pt,useLayoutEffect:pt,useInsertionEffect:pt,useMemo:pt,useReducer:pt,useRef:pt,useState:pt,useDebugValue:pt,useDeferredValue:pt,useTransition:pt,useSyncExternalStore:pt,useId:pt,useHostTransitionStatus:pt,useFormState:pt,useActionState:pt,useOptimistic:pt,useMemoCache:pt,useCacheRefresh:pt};Ci.useEffectEvent=pt;var G0={readContext:Pt,use:Sc,useCallback:function(a,l){return Yt().memoizedState=[a,l===void 0?null:l],a},useContext:Pt,useEffect:A0,useImperativeHandle:function(a,l,o){o=o!=null?o.concat([a]):null,Ac(4194308,4,O0.bind(null,l,a),o)},useLayoutEffect:function(a,l){return Ac(4194308,4,a,l)},useInsertionEffect:function(a,l){Ac(4,2,a,l)},useMemo:function(a,l){var o=Yt();l=l===void 0?null:l;var u=a();if(nr){$a(!0);try{a()}finally{$a(!1)}}return o.memoizedState=[u,l],u},useReducer:function(a,l,o){var u=Yt();if(o!==void 0){var g=o(l);if(nr){$a(!0);try{o(l)}finally{$a(!1)}}}else g=l;return u.memoizedState=u.baseState=g,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:g},u.queue=a,a=a.dispatch=Vw.bind(null,Re,a),[u.memoizedState,a]},useRef:function(a){var l=Yt();return a={current:a},l.memoizedState=a},useState:function(a){a=Gf(a);var l=a.queue,o=U0.bind(null,Re,l);return l.dispatch=o,[a.memoizedState,o]},useDebugValue:qf,useDeferredValue:function(a,l){var o=Yt();return $f(o,a,l)},useTransition:function(){var a=Gf(!1);return a=M0.bind(null,Re,a.queue,!0,!1),Yt().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,l,o){var u=Re,g=Yt();if(Be){if(o===void 0)throw Error(r(407));o=o()}else{if(o=l(),rt===null)throw Error(r(349));(Le&127)!==0||c0(u,l,o)}g.memoizedState=o;var x={value:o,getSnapshot:l};return g.queue=x,A0(u0.bind(null,u,x,a),[a]),u.flags|=2048,rl(9,{destroy:void 0},d0.bind(null,u,x,o,l),null),o},useId:function(){var a=Yt(),l=rt.identifierPrefix;if(Be){var o=aa,u=na;o=(u&~(1<<32-fn(u)-1)).toString(32)+o,l="_"+l+"R_"+o,o=Nc++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof u.is=="string"?E.createElement("select",{is:u.is}):E.createElement("select"),u.multiple?x.multiple=!0:u.size&&(x.size=u.size);break;default:x=typeof u.is=="string"?E.createElement(g,{is:u.is}):E.createElement(g)}}x[Lt]=l,x[Kt]=u;e:for(E=l.child;E!==null;){if(E.tag===5||E.tag===6)x.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===l)break e;for(;E.sibling===null;){if(E.return===null||E.return===l)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}l.stateNode=x;e:switch(Bt(x,g,u),g){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Aa(l)}}return ct(l),ch(l,l.type,a===null?null:a.memoizedProps,l.pendingProps,o),null;case 6:if(a&&l.stateNode!=null)a.memoizedProps!==u&&Aa(l);else{if(typeof u!="string"&&l.stateNode===null)throw Error(r(166));if(a=je.current,Xr(l)){if(a=l.stateNode,o=l.memoizedProps,u=null,g=zt,g!==null)switch(g.tag){case 27:case 5:u=g.memoizedProps}a[Lt]=l,a=!!(a.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||iy(a.nodeValue,o)),a||Za(l,!0)}else a=Yc(a).createTextNode(u),a[Lt]=l,l.stateNode=a}return ct(l),null;case 31:if(o=l.memoizedState,a===null||a.memoizedState!==null){if(u=Xr(l),o!==null){if(a===null){if(!u)throw Error(r(318));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[Lt]=l}else Ws(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;ct(l),a=!1}else o=yf(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=o),a=!0;if(!a)return l.flags&256?(mn(l),l):(mn(l),null);if((l.flags&128)!==0)throw Error(r(558))}return ct(l),null;case 13:if(u=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(g=Xr(l),u!==null&&u.dehydrated!==null){if(a===null){if(!g)throw Error(r(318));if(g=l.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[Lt]=l}else Ws(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;ct(l),g=!1}else g=yf(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=g),g=!0;if(!g)return l.flags&256?(mn(l),l):(mn(l),null)}return mn(l),(l.flags&128)!==0?(l.lanes=o,l):(o=u!==null,a=a!==null&&a.memoizedState!==null,o&&(u=l.child,g=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(g=u.alternate.memoizedState.cachePool.pool),x=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(x=u.memoizedState.cachePool.pool),x!==g&&(u.flags|=2048)),o!==a&&o&&(l.child.flags|=8192),kc(l,l.updateQueue),ct(l),null);case 4:return Ue(),a===null&&Th(l.stateNode.containerInfo),ct(l),null;case 10:return Na(l.type),ct(l),null;case 19:if(X(vt),u=l.memoizedState,u===null)return ct(l),null;if(g=(l.flags&128)!==0,x=u.rendering,x===null)if(g)Oi(u,!1);else{if(gt!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(x=yc(a),x!==null){for(l.flags|=128,Oi(u,!1),a=x.updateQueue,l.updateQueue=a,kc(l,a),l.subtreeFlags=0,a=o,o=l.child;o!==null;)Ux(o,a),o=o.sibling;return ie(vt,vt.current&1|2),Be&&ya(l,u.treeForkCount),l.child}a=a.sibling}u.tail!==null&&dn()>zc&&(l.flags|=128,g=!0,Oi(u,!1),l.lanes=4194304)}else{if(!g)if(a=yc(x),a!==null){if(l.flags|=128,g=!0,a=a.updateQueue,l.updateQueue=a,kc(l,a),Oi(u,!0),u.tail===null&&u.tailMode==="hidden"&&!x.alternate&&!Be)return ct(l),null}else 2*dn()-u.renderingStartTime>zc&&o!==536870912&&(l.flags|=128,g=!0,Oi(u,!1),l.lanes=4194304);u.isBackwards?(x.sibling=l.child,l.child=x):(a=u.last,a!==null?a.sibling=x:l.child=x,u.last=x)}return u.tail!==null?(a=u.tail,u.rendering=a,u.tail=a.sibling,u.renderingStartTime=dn(),a.sibling=null,o=vt.current,ie(vt,g?o&1|2:o&1),Be&&ya(l,u.treeForkCount),a):(ct(l),null);case 22:case 23:return mn(l),kf(),u=l.memoizedState!==null,a!==null?a.memoizedState!==null!==u&&(l.flags|=8192):u&&(l.flags|=8192),u?(o&536870912)!==0&&(l.flags&128)===0&&(ct(l),l.subtreeFlags&6&&(l.flags|=8192)):ct(l),o=l.updateQueue,o!==null&&kc(l,o.retryQueue),o=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==o&&(l.flags|=2048),a!==null&&X(Ks),null;case 24:return o=null,a!==null&&(o=a.memoizedState.cache),l.memoizedState.cache!==o&&(l.flags|=2048),Na(St),ct(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function Qw(a,l){switch(xf(l),l.tag){case 1:return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return Na(St),Ue(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 26:case 27:case 5:return Rn(l),null;case 31:if(l.memoizedState!==null){if(mn(l),l.alternate===null)throw Error(r(340));Ws()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 13:if(mn(l),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Ws()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return X(vt),null;case 4:return Ue(),null;case 10:return Na(l.type),null;case 22:case 23:return mn(l),kf(),a!==null&&X(Ks),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 24:return Na(St),null;case 25:return null;default:return null}}function fb(a,l){switch(xf(l),l.tag){case 3:Na(St),Ue();break;case 26:case 27:case 5:Rn(l);break;case 4:Ue();break;case 31:l.memoizedState!==null&&mn(l);break;case 13:mn(l);break;case 19:X(vt);break;case 10:Na(l.type);break;case 22:case 23:mn(l),kf(),a!==null&&X(Ks);break;case 24:Na(St)}}function Ri(a,l){try{var o=l.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var g=u.next;o=g;do{if((o.tag&a)===a){u=void 0;var x=o.create,E=o.inst;u=x(),E.destroy=u}o=o.next}while(o!==g)}}catch(D){et(l,l.return,D)}}function ss(a,l,o){try{var u=l.updateQueue,g=u!==null?u.lastEffect:null;if(g!==null){var x=g.next;u=x;do{if((u.tag&a)===a){var E=u.inst,D=E.destroy;if(D!==void 0){E.destroy=void 0,g=l;var M=o,$=D;try{$()}catch(ae){et(g,M,ae)}}}u=u.next}while(u!==x)}}catch(ae){et(l,l.return,ae)}}function hb(a){var l=a.updateQueue;if(l!==null){var o=a.stateNode;try{a0(l,o)}catch(u){et(a,a.return,u)}}}function pb(a,l,o){o.props=ar(a.type,a.memoizedProps),o.state=a.memoizedState;try{o.componentWillUnmount()}catch(u){et(a,l,u)}}function Ti(a,l){try{var o=a.ref;if(o!==null){switch(a.tag){case 26:case 27:case 5:var u=a.stateNode;break;case 30:u=a.stateNode;break;default:u=a.stateNode}typeof o=="function"?a.refCleanup=o(u):o.current=u}}catch(g){et(a,l,g)}}function sa(a,l){var o=a.ref,u=a.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(g){et(a,l,g)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(g){et(a,l,g)}else o.current=null}function gb(a){var l=a.type,o=a.memoizedProps,u=a.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(g){et(a,a.return,g)}}function dh(a,l,o){try{var u=a.stateNode;m2(u,a.type,o,l),u[Kt]=l}catch(g){et(a,a.return,g)}}function mb(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&us(a.type)||a.tag===4}function uh(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||mb(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&us(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function fh(a,l,o){var u=a.tag;if(u===5||u===6)a=a.stateNode,l?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(a,l):(l=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,l.appendChild(a),o=o._reactRootContainer,o!=null||l.onclick!==null||(l.onclick=ma));else if(u!==4&&(u===27&&us(a.type)&&(o=a.stateNode,l=null),a=a.child,a!==null))for(fh(a,l,o),a=a.sibling;a!==null;)fh(a,l,o),a=a.sibling}function _c(a,l,o){var u=a.tag;if(u===5||u===6)a=a.stateNode,l?o.insertBefore(a,l):o.appendChild(a);else if(u!==4&&(u===27&&us(a.type)&&(o=a.stateNode),a=a.child,a!==null))for(_c(a,l,o),a=a.sibling;a!==null;)_c(a,l,o),a=a.sibling}function xb(a){var l=a.stateNode,o=a.memoizedProps;try{for(var u=a.type,g=l.attributes;g.length;)l.removeAttributeNode(g[0]);Bt(l,u,o),l[Lt]=a,l[Kt]=o}catch(x){et(a,a.return,x)}}var wa=!1,wt=!1,hh=!1,bb=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function Ww(a,l){if(a=a.containerInfo,Mh=ed,a=Rx(a),rf(a)){if("selectionStart"in a)var o={start:a.selectionStart,end:a.selectionEnd};else e:{o=(o=a.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var g=u.anchorOffset,x=u.focusNode;u=u.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var E=0,D=-1,M=-1,$=0,ae=0,re=a,Y=null;t:for(;;){for(var K;re!==o||g!==0&&re.nodeType!==3||(D=E+g),re!==x||u!==0&&re.nodeType!==3||(M=E+u),re.nodeType===3&&(E+=re.nodeValue.length),(K=re.firstChild)!==null;)Y=re,re=K;for(;;){if(re===a)break t;if(Y===o&&++$===g&&(D=E),Y===x&&++ae===u&&(M=E),(K=re.nextSibling)!==null)break;re=Y,Y=re.parentNode}re=K}o=D===-1||M===-1?null:{start:D,end:M}}else o=null}o=o||{start:0,end:0}}else o=null;for(Ih={focusedElem:a,selectionRange:o},ed=!1,Rt=l;Rt!==null;)if(l=Rt,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,Rt=a;else for(;Rt!==null;){switch(l=Rt,x=l.alternate,a=l.flags,l.tag){case 0:if((a&4)!==0&&(a=l.updateQueue,a=a!==null?a.events:null,a!==null))for(o=0;o title"))),Bt(x,u,o),x[Lt]=a,Ot(x),u=x;break e;case"link":var E=jy("link","href",g).get(u+(o.href||""));if(E){for(var D=0;Dst&&(E=st,st=Ae,Ae=E);var U=Dx(D,Ae),L=Dx(D,st);if(U&&L&&(K.rangeCount!==1||K.anchorNode!==U.node||K.anchorOffset!==U.offset||K.focusNode!==L.node||K.focusOffset!==L.offset)){var q=re.createRange();q.setStart(U.node,U.offset),K.removeAllRanges(),Ae>st?(K.addRange(q),K.extend(L.node,L.offset)):(q.setEnd(L.node,L.offset),K.addRange(q))}}}}for(re=[],K=D;K=K.parentNode;)K.nodeType===1&&re.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;Do?32:o,H.T=null,o=vh,vh=null;var x=os,E=Ta;if(Dt=0,dl=os=null,Ta=0,(We&6)!==0)throw Error(r(331));var D=We;if(We|=4,Ob(x.current),wb(x,x.current,E,o),We=D,zi(0,!1),un&&typeof un.onPostCommitFiberRoot=="function")try{un.onPostCommitFiberRoot(ti,x)}catch{}return!0}finally{V.p=g,H.T=u,Yb(a,l)}}function Wb(a,l,o){l=Mn(o,l),l=Jf(a.stateNode,l,2),a=ts(a,l,2),a!==null&&(ai(a,2),ra(a))}function et(a,l,o){if(a.tag===3)Wb(a,a,o);else for(;l!==null;){if(l.tag===3){Wb(l,a,o);break}else if(l.tag===1){var u=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(is===null||!is.has(u))){a=Mn(o,a),o=X0(2),u=ts(l,o,2),u!==null&&(Z0(o,u,l,a),ai(u,2),ra(u));break}}l=l.return}}function jh(a,l,o){var u=a.pingCache;if(u===null){u=a.pingCache=new Kw;var g=new Set;u.set(l,g)}else g=u.get(l),g===void 0&&(g=new Set,u.set(l,g));g.has(o)||(mh=!0,g.add(o),a=a2.bind(null,a,l,o),l.then(a,a))}function a2(a,l,o){var u=a.pingCache;u!==null&&u.delete(l),a.pingedLanes|=a.suspendedLanes&o,a.warmLanes&=~o,rt===a&&(Le&o)===o&&(gt===4||gt===3&&(Le&62914560)===Le&&300>dn()-Lc?(We&2)===0&&ul(a,0):xh|=o,cl===Le&&(cl=0)),ra(a)}function Xb(a,l){l===0&&(l=Fm()),a=Ys(a,l),a!==null&&(ai(a,l),ra(a))}function s2(a){var l=a.memoizedState,o=0;l!==null&&(o=l.retryLane),Xb(a,o)}function r2(a,l){var o=0;switch(a.tag){case 31:case 13:var u=a.stateNode,g=a.memoizedState;g!==null&&(o=g.retryLane);break;case 19:u=a.stateNode;break;case 22:u=a.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(l),Xb(a,o)}function l2(a,l){return Lu(a,l)}var Vc=null,hl=null,Ah=!1,Fc=!1,wh=!1,ds=0;function ra(a){a!==hl&&a.next===null&&(hl===null?Vc=hl=a:hl=hl.next=a),Fc=!0,Ah||(Ah=!0,o2())}function zi(a,l){if(!wh&&Fc){wh=!0;do for(var o=!1,u=Vc;u!==null;){if(a!==0){var g=u.pendingLanes;if(g===0)var x=0;else{var E=u.suspendedLanes,D=u.pingedLanes;x=(1<<31-fn(42|a)+1)-1,x&=g&~(E&~D),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(o=!0,ey(u,x))}else x=Le,x=Qo(u,u===rt?x:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(x&3)===0||ni(u,x)||(o=!0,ey(u,x));u=u.next}while(o);wh=!1}}function i2(){Zb()}function Zb(){Fc=Ah=!1;var a=0;ds!==0&&b2()&&(a=ds);for(var l=dn(),o=null,u=Vc;u!==null;){var g=u.next,x=Kb(u,l);x===0?(u.next=null,o===null?Vc=g:o.next=g,g===null&&(hl=o)):(o=u,(a!==0||(x&3)!==0)&&(Fc=!0)),u=g}Dt!==0&&Dt!==5||zi(a),ds!==0&&(ds=0)}function Kb(a,l){for(var o=a.suspendedLanes,u=a.pingedLanes,g=a.expirationTimes,x=a.pendingLanes&-62914561;0D)break;var ae=M.transferSize,re=M.initiatorType;ae&&oy(re)&&(M=M.responseEnd,E+=ae*(M"u"?null:document;function vy(a,l,o){var u=pl;if(u&&typeof l=="string"&&l){var g=kn(l);g='link[rel="'+a+'"][href="'+g+'"]',typeof o=="string"&&(g+='[crossorigin="'+o+'"]'),yy.has(g)||(yy.add(g),a={rel:a,crossOrigin:o,href:l},u.querySelector(g)===null&&(l=u.createElement("link"),Bt(l,"link",a),Ot(l),u.head.appendChild(l)))}}function C2(a){ka.D(a),vy("dns-prefetch",a,null)}function D2(a,l){ka.C(a,l),vy("preconnect",a,l)}function O2(a,l,o){ka.L(a,l,o);var u=pl;if(u&&a&&l){var g='link[rel="preload"][as="'+kn(l)+'"]';l==="image"&&o&&o.imageSrcSet?(g+='[imagesrcset="'+kn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(g+='[imagesizes="'+kn(o.imageSizes)+'"]')):g+='[href="'+kn(a)+'"]';var x=g;switch(l){case"style":x=gl(a);break;case"script":x=ml(a)}Bn.has(x)||(a=y({rel:"preload",href:l==="image"&&o&&o.imageSrcSet?void 0:a,as:l},o),Bn.set(x,a),u.querySelector(g)!==null||l==="style"&&u.querySelector(Hi(x))||l==="script"&&u.querySelector(Gi(x))||(l=u.createElement("link"),Bt(l,"link",a),Ot(l),u.head.appendChild(l)))}}function R2(a,l){ka.m(a,l);var o=pl;if(o&&a){var u=l&&typeof l.as=="string"?l.as:"script",g='link[rel="modulepreload"][as="'+kn(u)+'"][href="'+kn(a)+'"]',x=g;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=ml(a)}if(!Bn.has(x)&&(a=y({rel:"modulepreload",href:a},l),Bn.set(x,a),o.querySelector(g)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Gi(x)))return}u=o.createElement("link"),Bt(u,"link",a),Ot(u),o.head.appendChild(u)}}}function T2(a,l,o){ka.S(a,l,o);var u=pl;if(u&&a){var g=zr(u).hoistableStyles,x=gl(a);l=l||"default";var E=g.get(x);if(!E){var D={loading:0,preload:null};if(E=u.querySelector(Hi(x)))D.loading=5;else{a=y({rel:"stylesheet",href:a,"data-precedence":l},o),(o=Bn.get(x))&&Gh(a,o);var M=E=u.createElement("link");Ot(M),Bt(M,"link",a),M._p=new Promise(function($,ae){M.onload=$,M.onerror=ae}),M.addEventListener("load",function(){D.loading|=1}),M.addEventListener("error",function(){D.loading|=2}),D.loading|=4,Wc(E,l,u)}E={type:"stylesheet",instance:E,count:1,state:D},g.set(x,E)}}}function k2(a,l){ka.X(a,l);var o=pl;if(o&&a){var u=zr(o).hoistableScripts,g=ml(a),x=u.get(g);x||(x=o.querySelector(Gi(g)),x||(a=y({src:a,async:!0},l),(l=Bn.get(g))&&Vh(a,l),x=o.createElement("script"),Ot(x),Bt(x,"link",a),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(g,x))}}function _2(a,l){ka.M(a,l);var o=pl;if(o&&a){var u=zr(o).hoistableScripts,g=ml(a),x=u.get(g);x||(x=o.querySelector(Gi(g)),x||(a=y({src:a,async:!0,type:"module"},l),(l=Bn.get(g))&&Vh(a,l),x=o.createElement("script"),Ot(x),Bt(x,"link",a),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(g,x))}}function Ny(a,l,o,u){var g=(g=je.current)?Qc(g):null;if(!g)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(l=gl(o.href),o=zr(g).hoistableStyles,u=o.get(l),u||(u={type:"style",instance:null,count:0,state:null},o.set(l,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){a=gl(o.href);var x=zr(g).hoistableStyles,E=x.get(a);if(E||(g=g.ownerDocument||g,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(a,E),(x=g.querySelector(Hi(a)))&&!x._p&&(E.instance=x,E.state.loading=5),Bn.has(a)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Bn.set(a,o),x||M2(g,a,o,E.state))),l&&u===null)throw Error(r(528,""));return E}if(l&&u!==null)throw Error(r(529,""));return null;case"script":return l=o.async,o=o.src,typeof o=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=ml(o),o=zr(g).hoistableScripts,u=o.get(l),u||(u={type:"script",instance:null,count:0,state:null},o.set(l,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function gl(a){return'href="'+kn(a)+'"'}function Hi(a){return'link[rel="stylesheet"]['+a+"]"}function Ey(a){return y({},a,{"data-precedence":a.precedence,precedence:null})}function M2(a,l,o,u){a.querySelector('link[rel="preload"][as="style"]['+l+"]")?u.loading=1:(l=a.createElement("link"),u.preload=l,l.addEventListener("load",function(){return u.loading|=1}),l.addEventListener("error",function(){return u.loading|=2}),Bt(l,"link",o),Ot(l),a.head.appendChild(l))}function ml(a){return'[src="'+kn(a)+'"]'}function Gi(a){return"script[async]"+a}function Sy(a,l,o){if(l.count++,l.instance===null)switch(l.type){case"style":var u=a.querySelector('style[data-href~="'+kn(o.href)+'"]');if(u)return l.instance=u,Ot(u),u;var g=y({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(a.ownerDocument||a).createElement("style"),Ot(u),Bt(u,"style",g),Wc(u,o.precedence,a),l.instance=u;case"stylesheet":g=gl(o.href);var x=a.querySelector(Hi(g));if(x)return l.state.loading|=4,l.instance=x,Ot(x),x;u=Ey(o),(g=Bn.get(g))&&Gh(u,g),x=(a.ownerDocument||a).createElement("link"),Ot(x);var E=x;return E._p=new Promise(function(D,M){E.onload=D,E.onerror=M}),Bt(x,"link",u),l.state.loading|=4,Wc(x,o.precedence,a),l.instance=x;case"script":return x=ml(o.src),(g=a.querySelector(Gi(x)))?(l.instance=g,Ot(g),g):(u=o,(g=Bn.get(x))&&(u=y({},o),Vh(u,g)),a=a.ownerDocument||a,g=a.createElement("script"),Ot(g),Bt(g,"link",u),a.head.appendChild(g),l.instance=g);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(u=l.instance,l.state.loading|=4,Wc(u,o.precedence,a));return l.instance}function Wc(a,l,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=u.length?u[u.length-1]:null,x=g,E=0;E title"):null)}function I2(a,l,o){if(o===1||l.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return a=l.disabled,typeof l.precedence=="string"&&a==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function wy(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function L2(a,l,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var g=gl(u.href),x=l.querySelector(Hi(g));if(x){l=x._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(a.count++,a=Zc.bind(a),l.then(a,a)),o.state.loading|=4,o.instance=x,Ot(x);return}x=l.ownerDocument||l,u=Ey(u),(g=Bn.get(g))&&Gh(u,g),x=x.createElement("link"),Ot(x);var E=x;E._p=new Promise(function(D,M){E.onload=D,E.onerror=M}),Bt(x,"link",u),o.instance=x}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(o,l),(l=o.state.preload)&&(o.state.loading&3)===0&&(a.count++,o=Zc.bind(a),l.addEventListener("load",o),l.addEventListener("error",o))}}var Fh=0;function z2(a,l){return a.stylesheets&&a.count===0&&Jc(a,a.stylesheets),0Fh?50:800)+l);return a.unsuspend=o,function(){a.unsuspend=null,clearTimeout(u),clearTimeout(g)}}:null}function Zc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Jc(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Kc=null;function Jc(a,l){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Kc=new Map,l.forEach(P2,a),Kc=null,Zc.call(a))}function P2(a,l){if(!(l.state.loading&4)){var o=Kc.get(a);if(o)var u=o.get(null);else{o=new Map,Kc.set(a,o);for(var g=a.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),ep.exports=J2(),ep.exports}var tC=eC();const Zy=t=>t?t.toUpperCase():"",Hn=t=>{const e={...t};for(const n in e)typeof e[n]=="string"&&n!=="id"&&n!=="email"&&n!=="start"&&n!=="end"&&!n.includes("data")&&!n.includes("cor")&&n!=="corAgenda"&&n!=="corCartao"&&(e[n]=e[n].toUpperCase());return e},me="/api",be=async(t,e={})=>{const n=localStorage.getItem("SCOREODONTO_AUTH_TOKEN"),r={...e.headers,...n?{Authorization:`Bearer ${n}`}:{}};return fetch(t,{...e,headers:r})},J={dbConfig:{database:"scoreodonto"},login:async(t,e)=>{const n=t.toLowerCase().trim(),r=e.trim();try{const i=await be(`${me}/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n,password:r})});if(i.ok){const c=await i.json();return localStorage.setItem("SCOREODONTO_AUTH_TOKEN",c.token),localStorage.setItem("SCOREODONTO_USER_DATA",JSON.stringify(c.user)),localStorage.setItem("SCOREODONTO_WORKSPACES",JSON.stringify(c.workspaces)),c.workspaces&&c.workspaces.length>0&&localStorage.setItem("SCOREODONTO_ACTIVE_WORKSPACE",JSON.stringify(c.workspaces[0])),!0}return!1}catch(i){return console.error("Login error:",i),!1}},logout:()=>{localStorage.removeItem("SCOREODONTO_AUTH_TOKEN"),localStorage.removeItem("SCOREODONTO_USER_DATA"),localStorage.removeItem("SCOREODONTO_WORKSPACES"),localStorage.removeItem("SCOREODONTO_ACTIVE_WORKSPACE"),window.location.href="/",window.location.reload()},isAuthenticated:()=>!!localStorage.getItem("SCOREODONTO_AUTH_TOKEN"),getCurrentUser:()=>{const t=localStorage.getItem("SCOREODONTO_USER_DATA");if(!t)return null;try{return JSON.parse(t).email}catch{return null}},getCurrentUserName:()=>{const t=localStorage.getItem("SCOREODONTO_USER_DATA");if(!t)return"USUÁRIO";try{return JSON.parse(t).nome}catch{return"USUÁRIO"}},getWorkspaces:()=>{const t=localStorage.getItem("SCOREODONTO_WORKSPACES");return t?JSON.parse(t):[]},getActiveWorkspace:()=>{const t=localStorage.getItem("SCOREODONTO_ACTIVE_WORKSPACE");return t?JSON.parse(t):null},switchWorkspace:t=>{const n=J.getWorkspaces().find(r=>r.id===t);n&&(["SCOREODONTO_CACHE_PACIENTES","SCOREODONTO_CACHE_AGENDAMENTOS","SCOREODONTO_CACHE_FINANCEIRO","SCOREODONTO_CACHE_DENTISTAS","SCOREODONTO_CACHE_GUIAS","SCOREODONTO_CACHE_GTO","SCOREODONTO_CACHE_PROCEDIMENTOS","SCOREODONTO_CACHE_PLANOS","SCOREODONTO_CACHE_NOTIFICACOES"].forEach(i=>localStorage.removeItem(i)),console.log(`[SECURITY] Cache cleared for tenant switch to: ${t}`),localStorage.setItem("SCOREODONTO_ACTIVE_WORKSPACE",JSON.stringify(n)),window.location.reload())},getCurrentRole:()=>{const t=J.getActiveWorkspace();return(t==null?void 0:t.role)||"paciente"},getDashboardStats:async()=>await(await be(`${me}/dashboard/stats`)).json(),isDbConfigured:()=>localStorage.getItem("SCOREODONTO_DB_CONFIGURED")==="true",runInstallScript:async t=>{const e=["--------------------------------------------------"," SCOREODONTO - ATUALIZADOR DE BANCO DE DADOS ","--------------------------------------------------","[INFO] VERIFICANDO AMBIENTE...","[OK] AMBIENTE POSTGRESQL DETECTADO.",`[INFO] CONECTANDO DB: ${J.dbConfig.database}...`,"[INFO] INICIANDO BACKUP DE SEGURANCA...",`[OK] BACKUP SALVO EM: ./bkp_database/BKP_${new Date().toISOString().replace(/[:.]/g,"-")}.SQL`,"[INFO] CONECTANDO API GOOGLE SHEETS...","[INFO] LENDO PLANILHA: 'Dados Pacientes'..."," > 1.240 LINHAS ENCONTRADAS."," > VALIDANDO DADOS (CPF, TELEFONE)...","[INFO] SINCRONIZANDO COM POSTGRESQL (scoreodonto)..."," > FORCANDO PADRAO 'UPPERCASE' EM TODOS OS CAMPOS TEXTUAIS..."," > ATUALIZANDO TABELA: PACIENTES..."," > ATUALIZANDO TABELA: FINANCEIRO..."," > ATUALIZANDO TABELA: AGENDA...","[INFO] LIMPANDO CACHE DE SESSAO...","--------------------------------------------------"," ATUALIZACAO CONCLUIDA COM SUCESSO! ","--------------------------------------------------"];for(const n of e)await new Promise(r=>setTimeout(r,600)),t(n);return localStorage.setItem("SCOREODONTO_DB_CONFIGURED","true"),!0},syncGoogleSheetsToPg:async t=>(t("INICIANDO CONEXÃO COM GOOGLE SHEETS..."),await new Promise(e=>setTimeout(e,800)),t("LENDO ABA 'DADOS PACIENTES'..."),await new Promise(e=>setTimeout(e,800)),t(`CONECTANDO AO POSTGRESQL (${J.dbConfig.database})...`),await new Promise(e=>setTimeout(e,800)),t("COMPARANDO REGISTROS (HASH CHECK)..."),await new Promise(e=>setTimeout(e,1e3)),t("INSERINDO 2 NOVOS PACIENTES NO POSTGRESQL..."),t("ATUALIZANDO 4 AGENDAMENTOS..."),await new Promise(e=>setTimeout(e,500)),t("SINCRONIZAÇÃO CONCLUÍDA COM SUCESSO!"),!0),getPacientes:async(t="",e="recentes")=>{const n=new URLSearchParams;return t.trim()&&n.set("q",t.trim()),e&&n.set("sort",e),(await be(`${me}/pacientes?${n}`)).json()},checkCpfExists:async t=>{const e=t.replace(/\D/g,"");if(!e)return!1;const n=await be(`${me}/pacientes?q=${encodeURIComponent(t)}`),{data:r}=await n.json();return(r||[]).some(c=>c.cpf.replace(/\D/g,"")===e)},savePaciente:async t=>{const e=Hn(t),n={...e,id:e.id||`p_${Date.now()}`};return await(await be(`${me}/pacientes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).json()},updatePaciente:async t=>{const e=Hn(t);return await(await be(`${me}/pacientes/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},getGruposFamiliares:async t=>{const e=t!=null&&t.trim()?`${me}/grupos-familiares?q=${encodeURIComponent(t)}`:`${me}/grupos-familiares`,r=await(await be(e)).json();return Array.isArray(r)?r:[]},criarGrupoFamiliar:async(t,e)=>(await be(`${me}/grupos-familiares`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nome:t,responsavel_id:e})})).json(),getMembrosFamilia:async t=>(await be(`${me}/grupos-familiares/${t}/membros`)).json(),getModelosReceita:async t=>{const e=t?`${me}/modelos-receita?especialidadeId=${t}`:`${me}/modelos-receita`,r=await(await be(e)).json();return Array.isArray(r)?r:[]},saveModeloReceita:async t=>(await be(`${me}/modelos-receita`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),updateModeloReceita:async t=>(await be(`${me}/modelos-receita/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),deleteModeloReceita:async t=>{await be(`${me}/modelos-receita/${t}`,{method:"DELETE"})},savePedidoExame:async t=>(await be(`${me}/pedidos-exame`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),getPedidosExame:async t=>{const e=t?`${me}/pedidos-exame?pacienteId=${t}`:`${me}/pedidos-exame`,r=await(await be(e)).json();return Array.isArray(r)?r:[]},getDentistas:async t=>{const e=t?`${me}/dentistas?clinicaId=${t}`:`${me}/dentistas`;return await(await be(e)).json()},getPlanos:async()=>await(await be(`${me}/planos`)).json(),updateDentista:async t=>{const e=Hn(t);return await(await be(`${me}/dentistas/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},saveDentista:async t=>{const e=J.getActiveWorkspace(),r={...Hn(t),id:Math.random().toString(),clinica_id:e==null?void 0:e.id};return await(await be(`${me}/dentistas`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json()},reorderDentistas:async t=>await(await be(`${me}/dentistas/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({orders:t})})).json(),deleteDentista:async t=>{await be(`${me}/dentistas/${t}`,{method:"DELETE"})},getHorariosByDentista:async(t,e)=>await(await be(`${me}/dentistas/${t}/horarios?clinicaId=${e}`)).json(),saveHorario:async t=>await(await be(`${me}/dentistas/horarios`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),deleteHorario:async t=>{await be(`${me}/dentistas/horarios/${t}`,{method:"DELETE"})},getProductivityReport:async(t,e,n)=>await(await be(`${me}/reports/productivity?clinicaId=${t}&start=${e||""}&end=${n||""}`)).json(),updateEspecialidade:async t=>{const e=Hn(t);return await(await be(`${me}/especialidades/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},saveEspecialidade:async t=>{const n={...Hn(t),id:Math.random().toString()};return await(await be(`${me}/especialidades`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).json()},reorderEspecialidades:async t=>await(await be(`${me}/especialidades/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({orders:t})})).json(),deleteEspecialidade:async t=>{await be(`${me}/especialidades/${t}`,{method:"DELETE"})},updateProcedimento:async t=>{const e=Hn(t);return await(await be(`${me}/procedimentos/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},saveProcedimento:async t=>{const n={...Hn(t),id:Math.random().toString()};return await(await be(`${me}/procedimentos`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).json()},reorderProcedimentos:async t=>await(await be(`${me}/procedimentos/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({orders:t})})).json(),deleteProcedimento:async t=>{await be(`${me}/procedimentos/${t}`,{method:"DELETE"})},updatePlano:async t=>{const e=Hn(t);return await(await be(`${me}/planos/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},savePlano:async t=>{const n={...Hn(t),id:Math.random().toString()};return await(await be(`${me}/planos`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).json()},deletePlano:async t=>{await be(`${me}/planos/${t}`,{method:"DELETE"})},getEspecialidades:async()=>await(await be(`${me}/especialidades`)).json(),getProcedimentos:async()=>await(await be(`${me}/procedimentos`)).json(),getFinanceiro:async()=>await(await be(`${me}/financeiro`)).json(),saveFinanceiro:async t=>{const e=Hn(t);return await(await be(`${me}/financeiro`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},updateFinanceiro:async t=>{const e=Hn(t);return await(await be(`${me}/financeiro/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},deleteFinanceiro:async t=>{await be(`${me}/financeiro/${t}`,{method:"DELETE"})},getAgendamentos:async()=>await(await be(`${me}/agendamentos`,{})).json(),salvarAgendamento:async t=>{const e=await be(`${me}/agendamentos`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.message||"Erro ao salvar agendamento.")}return await e.json()},atualizarAgendamento:async(t,e)=>{const n=await be(`${me}/agendamentos/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.message||"Erro ao atualizar agendamento.")}return await n.json()},excluirAgendamento:async t=>{await be(`${me}/agendamentos/${t}`,{method:"DELETE"})},getOrtoTreatments:async()=>[{id:"t1",pacienteId:"1",pacienteNome:"ANA SILVA",dataNascimento:"2014-03-15",responsavel:"MARIA SILVA",tipoPaciente:"Adolescente",triagem:{queixaPrincipal:"DENTES TORTOS NA FRENTE",historicoMedico:"NENHUMA CONDIÇÃO RELEVANTE",medicacao:"NENHUMA",alergias:"NENHUMA",respiracaoBucal:!1,habitos:"BRUXISMO LEVE NOTURNO"},diagnostico:{classeAngle:"II",perfil:"Convexo",apinhamento:"Moderado",mordida:"Profunda",linhaMedia:"1MM PARA ESQUERDA"},dataInicio:"2024-08-10",tipoAparelho:"AUTOLIGADO METÁLICO",extracoes:"NÃO",sequenciaFios:"0.12 → 0.14 → 0.16 → 0.18 → 0.20x0.25",elasticos:"CLASSE II",iprPlanejado:"NÃO",tempoEstimado:"18–24 MESES",valor:4500,formaPagamento:"PARCELADO 24X",faseAtual:"NIVELAMENTO",fioAtual:"0.16",classificacao:"CLASSE II",cooperacao:"Média",percentualConcluido:35,ultimaConsulta:"2026-01-14",proximaConsulta:"2026-02-14",mesesRestantes:14,status:"Em Tratamento",evolucoes:[{id:"ev1",data:"2024-08-10",tipo:"Colagem",procedimento:"COLAGEM APARELHO SUPERIOR E INFERIOR",proximoRetorno:"2024-09-10",fio:"0.12",higiene:8,cooperacao:"Boa"},{id:"ev2",data:"2024-09-10",tipo:"Manutenção",procedimento:"TROCA DE FIO SUPERIOR 0.14",proximoRetorno:"2024-10-10",fio:"0.14",higiene:7,cooperacao:"Boa"},{id:"ev3",data:"2024-10-10",tipo:"Troca de fio",procedimento:"TROCA DE FIO SUPERIOR 0.16 + ELÁSTICO CLASSE II",proximoRetorno:"2024-11-10",fio:"0.16",elastico:"CLASSE II",higiene:6,cooperacao:"Média"},{id:"ev4",data:"2025-11-10",tipo:"Manutenção",procedimento:"MANUTENÇÃO + PROFILAXIA",proximoRetorno:"2025-12-10",fio:"0.16",elastico:"CLASSE II",procedimentos:["Profilaxia"],higiene:5,cooperacao:"Média",observacoes:"HIGIENE ABAIXO DO IDEAL. ORIENTAÇÕES REFORÇADAS."},{id:"ev5",data:"2026-01-14",tipo:"Manutenção",procedimento:"MANUTENÇÃO CORRENTE ELÁSTICA",proximoRetorno:"2026-02-14",fio:"0.16",elastico:"CLASSE II",higiene:6,cooperacao:"Média"}],flags:[{tipo:"warning",mensagem:"HIGIENE ABAIXO DO IDEAL"},{tipo:"info",mensagem:"COOPERAÇÃO MÉDIA NAS ÚLTIMAS 3 VISITAS"}],fotos:[{url:"",tipo:"inicio",data:"2024-08-10"},{url:"",tipo:"atual",data:"2026-01-14"}]},{id:"t2",pacienteId:"2",pacienteNome:"CARLOS EDUARDO MENDES",dataNascimento:"1990-07-22",tipoPaciente:"Adulto",triagem:{queixaPrincipal:"MORDIDA CRUZADA ANTERIOR",historicoMedico:"HIPERTENSÃO CONTROLADA",medicacao:"LOSARTANA 50MG",alergias:"DIPIRONA",respiracaoBucal:!1,habitos:"NENHUM",periodonto:"RECESSÃO GENGIVAL LEVE EM 31-41",implantes:"NENHUM",recessoes:"31 E 41 - CLASSE I MILLER",mobilidade:"NENHUMA"},diagnostico:{classeAngle:"III",perfil:"Côncavo",apinhamento:"Severo",mordida:"Cruzada",linhaMedia:"3MM PARA DIREITA"},dataInicio:"2024-03-05",tipoAparelho:"AUTOLIGADO CERÂMICO",extracoes:"1º PRÉ-MOLARES SUPERIORES (14 E 24)",sequenciaFios:"0.14 → 0.16 → 0.18 → 0.19x0.25 → 0.21x0.25",elasticos:"CLASSE III",iprPlanejado:"SIM - INFERIOR ANTERIOR",tempoEstimado:"24–30 MESES",valor:7200,formaPagamento:"PARCELADO 30X",faseAtual:"FECHAMENTO DE ESPAÇOS",fioAtual:"0.19x0.25",classificacao:"CLASSE III",cooperacao:"Boa",percentualConcluido:55,ultimaConsulta:"2026-02-05",proximaConsulta:"2026-03-05",mesesRestantes:10,status:"Em Tratamento",evolucoes:[{id:"ev6",data:"2024-03-05",tipo:"Colagem",procedimento:"COLAGEM APARELHO CERÂMICO SUP/INF + EXTRAÇÕES 14 E 24",proximoRetorno:"2024-04-05",fio:"0.14",higiene:9,cooperacao:"Boa"},{id:"ev7",data:"2025-06-05",tipo:"Manutenção",procedimento:"IPR INFERIOR ANTERIOR + MOLA FECHAMENTO",proximoRetorno:"2025-07-05",fio:"0.19x0.25",procedimentos:["IPR"],higiene:8,cooperacao:"Boa"},{id:"ev8",data:"2026-02-05",tipo:"Manutenção",procedimento:"ATIVAÇÃO MOLA + ELÁSTICO CLASSE III",proximoRetorno:"2026-03-05",fio:"0.19x0.25",elastico:"CLASSE III",higiene:9,cooperacao:"Boa"}],flags:[{tipo:"danger",mensagem:"COMPLEXIDADE ALTA - APINHAMENTO SEVERO"},{tipo:"warning",mensagem:"RISCO PERIODONTAL - RECESSÃO CLASSE I"}],fotos:[{url:"",tipo:"inicio",data:"2024-03-05"},{url:"",tipo:"atual",data:"2026-02-05"}]}],saveEvolucaoOrto:async(t,e)=>{const n={id:"ev_"+Math.random().toString(36).substring(2,8),data:new Date().toISOString().split("T")[0],tipo:e.tipo||"Manutenção",procedimento:e.procedimento||"",proximoRetorno:e.proximoRetorno||"",fio:e.fio,elastico:e.elastico,procedimentos:e.procedimentos,higiene:e.higiene,cooperacao:e.cooperacao,observacoes:e.observacoes};return console.log(`[Mock] Evolução salva no tratamento ${t}:`,n),n},updateTratamentoOrto:async t=>{console.log("[Mock] Tratamento atualizado:",t)},finalizarTratamentoOrto:async(t,e)=>{console.log(`[Mock] Tratamento ${t} finalizado com contenção:`,e)},saveLead:async t=>{const e={id:Math.random().toString(),nome:Zy(t.nome),sobrenome:Zy(t.sobrenome),cpf:t.cpf||"",whatsapp:t.whatsapp||"",tipoInteresse:t.tipoInteresse||"Particular",dataCadastro:new Date().toISOString(),status:"Novo"};return await be(`${me}/leads`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),e},getLeads:async()=>await(await be(`${me}/leads`)).json(),getNotifications:async()=>{try{return await(await be(`${me}/notificacoes`)).json()}catch{return[]}},markNotificationRead:async t=>{try{await be(`${me}/notificacoes/${t}/read`,{method:"PUT"})}catch(e){console.error("Erro ao marcar como lida:",e)}},markAllNotificationsRead:async()=>{try{await be(`${me}/notificacoes/read-all`,{method:"POST"})}catch(t){console.error("Erro ao marcar todas como lidas:",t)}},deleteNotification:async t=>{try{await be(`${me}/notificacoes/${t}`,{method:"DELETE"})}catch(e){console.error("Erro ao excluir notificação:",e)}},getSettings:async()=>await(await be(`${me}/settings`)).json(),saveSettings:async t=>await(await be(`${me}/settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),getGoogleEvents:async()=>{try{return await(await be(`${me}/google/events`)).json()}catch{return[]}},getContratos:async t=>{const e=t?`?paciente_id=${t}`:"";return(await be(`${me}/contratos${e}`)).json()},saveContrato:async t=>(await be(`${me}/contratos`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),updateContrato:async t=>{await be(`${me}/contratos/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},deleteContrato:async t=>{await be(`${me}/contratos/${t}`,{method:"DELETE"})}};/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kN=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nC=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aC=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ky=t=>{const e=aC(t);return e.charAt(0).toUpperCase()+e.slice(1)};/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var sC={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.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rC=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lC=w.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:c,iconNode:d,...f},h)=>w.createElement("svg",{ref:h,...sC,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:kN("lucide",i),...!c&&!rC(f)&&{"aria-hidden":"true"},...f},[...d.map(([p,b])=>w.createElement(p,b)),...Array.isArray(c)?c:[c]]));/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const le=(t,e)=>{const n=w.forwardRef(({className:r,...i},c)=>w.createElement(lC,{ref:c,iconNode:e,className:kN(`lucide-${nC(Ky(t))}`,`lucide-${t}`,r),...i}));return n.displayName=Ky(t),n};/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iC=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Vl=le("activity",iC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oC=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],_N=le("arrow-down-right",oC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cC=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],MN=le("arrow-left",cC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dC=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ls=le("arrow-right",dC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uC=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],od=le("arrow-up-down",uC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fC=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],IN=le("arrow-up-right",fC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hC=[["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"}]],pC=le("award",hC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gC=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],mC=le("badge-check",gC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xC=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]],LN=le("banknote",xC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bC=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],uo=le("bell",bC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yC=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],vC=le("book-open",yC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NC=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Cg=le("building-2",NC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EC=[["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"}]],SC=le("calendar-days",EC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jC=[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]],AC=le("calendar-range",jC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wC=[["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"}]],Et=le("calendar",wC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CC=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Ad=le("camera",CC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DC=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],ko=le("chart-column",DC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OC=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],RC=le("chart-pie",OC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TC=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],fo=le("check",TC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kC=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_o=le("chevron-down",kC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _C=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Bs=le("chevron-left",_C);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MC=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ts=le("chevron-right",MC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IC=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Dg=le("chevron-up",IC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LC=[["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"}]],gu=le("circle-alert",LC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zC=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ua=le("circle-check-big",zC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],da=le("circle-check",PC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const UC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],zN=le("circle-plus",UC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BC=[["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"}]],HC=le("circle-x",BC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const GC=[["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:"m9 14 2 2 4-4",key:"df797q"}]],PN=le("clipboard-check",GC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VC=[["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"}]],so=le("clipboard-list",VC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FC=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Fl=le("clock",FC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qC=[["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"}]],$C=le("copy",qC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YC=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],QC=le("credit-card",YC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WC=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Er=le("database",WC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XC=[["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"}]],Ba=le("dollar-sign",XC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZC=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Og=le("download",ZC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KC=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],JC=le("droplets",KC);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eD=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],tD=le("ellipsis",eD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nD=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],aD=le("eye-off",nD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sD=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],rD=le("eye",sD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lD=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],Jy=le("file-down",lD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iD=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],za=le("file-text",iD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oD=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]],ev=le("file-x",oD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cD=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],tv=le("folder-open",cD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dD=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],mu=le("funnel",dD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uD=[["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"}]],ql=le("grip-vertical",uD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fD=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],hD=le("heart",fD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pD=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],gD=le("history",pD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mD=[["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"}]],xD=le("image",mD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bD=[["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"}]],nv=le("inbox",bD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yD=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],UN=le("info",yD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vD=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],av=le("key-round",vD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ND=[["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"}]],ED=le("layout-dashboard",ND);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SD=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ct=le("loader-circle",SD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jD=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],_d=le("lock",jD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AD=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],BN=le("log-out",AD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wD=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Rg=le("mail",wD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CD=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],HN=le("map-pin",CD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DD=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],GN=le("megaphone",DD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OD=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],VN=le("menu",OD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RD=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],TD=le("message-circle",RD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kD=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Tg=le("message-square",kD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _D=[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]],MD=le("microscope",_D);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ID=[["path",{d:"M5 12h14",key:"1ays0h"}]],FN=le("minus",ID);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LD=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["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:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],zD=le("palette",LD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PD=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Mo=le("pencil",PD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const UD=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],BD=le("percent",UD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HD=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],qN=le("phone",HD);/** - * @license lucide-react v0.563.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=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],VD=le("play",GD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ft=le("plus",FD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qD=[["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"}]],Va=le("printer",qD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $D=[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]],YD=le("radio-tower",$D);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QD=[["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"}]],xu=le("refresh-cw",QD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WD=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],XD=le("rocket",WD);/** - * @license lucide-react v0.563.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=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],sv=le("rotate-ccw",ZD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KD=[["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"}]],Io=le("save",KD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JD=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],eO=le("scissors",JD);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tO=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ha=le("search",tO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nO=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Md=le("settings",nO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aO=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],$N=le("share-2",aO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sO=[["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"}]],Id=le("shield-alert",sO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rO=[["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"}]],Sr=le("shield-check",rO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lO=[["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"}]],iO=le("shield",lO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oO=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],cO=le("smartphone",oO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dO=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],uO=le("sparkles",dO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fO=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Lo=le("square-pen",fO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hO=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],ua=le("stethoscope",hO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pO=[["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"}]],gO=le("tag",pO);/** - * @license lucide-react v0.563.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=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],rv=le("terminal",mO);/** - * @license lucide-react v0.563.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=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],$t=le("trash-2",xO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bO=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],yO=le("trending-down",bO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vO=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],YN=le("trending-up",vO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NO=[["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"}]],kg=le("triangle-alert",NO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EO=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],SO=le("upload",EO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jO=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["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"}]],$l=le("user-check",jO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AO=[["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"}]],Ld=le("user-plus",AO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wO=[["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"}]],zo=le("user",wO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CO=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],$n=le("users",CO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DO=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],OO=le("wallet",DO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RO=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],TO=le("wrench",RO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kO=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Qe=le("x",kO);/** - * @license lucide-react v0.563.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _O=[["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"}]],MO=le("zap",_O),IO=({activeTab:t,setActiveTab:e})=>{const n=J.getCurrentRole(),r=J.getCurrentUserName(),i=J.getCurrentUser(),c=J.getActiveWorkspace(),d=(c==null?void 0:c.cor)||"#2563eb",f=[{id:"dashboard",label:"VISÃO GERAL",icon:ED},{id:"clinicas",label:"MINHAS CLÍNICAS",icon:Cg},{id:"leads",label:"GESTÃO DE LEADS",icon:GN},{id:"pacientes",label:"PACIENTES",icon:$n},{id:"tratamentos",label:"MEUS TRATAMENTOS",icon:so},{id:"lancar-gto",label:"LANÇAR GTO",icon:so},{id:"agenda",label:"AGENDA",icon:Et},{id:"ortodontia",label:"ORTODONTIA",icon:Vl},{id:"financeiro",label:"FINANCEIRO",icon:Ba},{id:"contratos",label:"CONTRATOS",icon:za},{id:"relatorios",label:"RELATÓRIOS",icon:ko},{id:"dentistas",label:"DENTISTAS",icon:ua},{id:"especialidades",label:"ESPECIALIDADES",icon:pC},{id:"procedimentos",label:"PROCEDIMENTOS",icon:so},{id:"planos",label:"PLANOS / CONVÊNIOS",icon:vC},{id:"notificacoes",label:"NOTIFICAÇÕES",icon:uo},{id:"sync",label:"SINCRONIZAÇÃO",icon:xu},{id:"configuracoes",label:"CONFIGURAÇÕES",icon:Md}].filter(p=>["admin","donoclinica"].includes(n)?!0:n==="paciente"?["tratamentos","notificacoes","configuracoes"].includes(p.id):n==="dentista"?["dashboard","pacientes","tratamentos","agenda","ortodontia","notificacoes","clinicas","configuracoes","contratos"].includes(p.id):n==="funcionario"?["dashboard","leads","pacientes","tratamentos","lancar-gto","agenda","financeiro","relatorios","notificacoes","clinicas","configuracoes","contratos"].includes(p.id):!1),h=()=>{window.confirm("TEM CERTEZA QUE DESEJA SAIR DO SISTEMA?")&&J.logout()};return s.jsxs("div",{className:"w-64 bg-white border-r border-gray-200 h-screen flex flex-col shadow-xl md:shadow-none",children:[s.jsxs("div",{className:"p-6 flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-white font-bold shadow-lg transition-colors duration-500",style:{backgroundColor:d},children:s.jsx(Er,{size:18})}),s.jsxs("div",{children:[s.jsx("span",{className:"font-bold text-lg text-gray-800 block leading-tight tracking-tight",children:"SCOREODONTO"}),s.jsx("span",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-wider",children:"POSTGRESQL + GOOGLE"})]})]}),s.jsx("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:f.map(p=>{const b=p.icon,y=t===p.id;return s.jsxs("button",{onClick:()=>e(p.id),className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl text-[11px] font-bold uppercase transition-all duration-300 group ${y?"text-white":"text-gray-500 hover:bg-gray-50"}`,style:{backgroundColor:y?d:"transparent",boxShadow:y?`0 10px 15px -5px ${d}44`:"none"},children:[s.jsx(b,{size:18,className:`${y?"text-white":"text-gray-400 group-hover:text-gray-600"} transition-colors`,style:{color:y?"#fff":void 0}}),p.label]},p.id)})}),s.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50/50 space-y-2",children:[s.jsxs("button",{onClick:()=>e("configuracoes"),className:"w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-all group",style:{backgroundColor:t==="configuracoes"?d:"transparent"},children:[s.jsx("div",{className:"w-8 h-8 bg-gray-100 rounded-full flex items-center justify-center text-gray-500 border border-gray-200 flex-shrink-0",children:s.jsx(zo,{size:15})}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsx("p",{className:`text-[10px] font-black uppercase truncate leading-none ${t==="configuracoes"?"text-white":"text-gray-700"}`,children:r}),s.jsx("p",{className:`text-[9px] font-medium truncate mt-0.5 ${t==="configuracoes"?"text-white/70":"text-gray-400"}`,children:i})]}),s.jsx(Md,{size:14,className:t==="configuracoes"?"text-white":"text-gray-400"})]}),s.jsxs("button",{onClick:h,className:"w-full flex items-center gap-3 px-4 py-2 text-red-500 hover:bg-red-50 rounded-xl text-[10px] font-black uppercase transition-all",children:[s.jsx(BN,{size:16}),"SAIR DO SISTEMA"]})]})]})};var wr=TN();const LO=RN(wr),QN=w.createContext(void 0),zO=({children:t})=>{const[e,n]=w.useState([]),r=w.useCallback((c,d)=>{const f=Date.now();n(h=>[...h,{id:f,message:c,type:d}]),setTimeout(()=>{n(h=>h.filter(p=>p.id!==f))},4e3)},[]),i={toasts:e,addToast:r};return s.jsx(QN.Provider,{value:i,children:t})},Fe=()=>{const t=w.useContext(QN);if(!t)throw new Error("useToast must be used within a ToastProvider");return{...t,success:e=>t.addToast(e,"success"),error:e=>t.addToast(e,"error"),info:e=>t.addToast(e,"info")}},PO={success:s.jsx(Ua,{className:"text-green-500",size:20}),error:s.jsx(kg,{className:"text-red-500",size:20}),info:s.jsx(UN,{className:"text-blue-500",size:20})},UO={success:"bg-green-50 border-green-200",error:"bg-red-50 border-red-200",info:"bg-blue-50 border-blue-200"},BO=()=>{const{toasts:t}=Fe(),e=document.getElementById("toast-container");return e?wr.createPortal(s.jsx("div",{className:"fixed top-6 right-6 z-[100] space-y-3",children:t.map(n=>s.jsxs("div",{className:`w-80 p-4 rounded-xl shadow-lg flex items-start gap-3 border animate-in slide-in-from-top-4 ${UO[n.type]}`,children:[s.jsx("div",{className:"flex-shrink-0 mt-0.5",children:PO[n.type]}),s.jsx("p",{className:"flex-1 text-sm text-gray-800 font-bold uppercase",children:n.message})]},n.id))}),e):null},cn=({title:t,description:e,children:n})=>s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-gray-900 uppercase",children:t}),e&&s.jsx("p",{className:"text-gray-500 text-xs uppercase font-bold mt-1",children:e})]}),s.jsx("div",{className:"flex items-center gap-3",children:n})]});function _e(t,e=[]){const[n,r]=w.useState(null),[i,c]=w.useState(!0),[d,f]=w.useState(null),[h,p]=w.useState(0),b=w.useCallback(async()=>{c(!0),f(null);try{const m=await t();r(m)}catch(m){f(m instanceof Error?m:new Error("An unknown error occurred"))}finally{c(!1)}},[...e,h]);return w.useEffect(()=>{b()},[b]),{data:n,isLoading:i,error:d,refresh:()=>{p(m=>m+1)}}}const HO=()=>{const[t,e]=w.useState(!1),[n,r]=w.useState([]),[i,c]=w.useState(0),d=async()=>{try{const y=await J.getNotifications();r(y),c(y.filter(m=>!m.lida).length)}catch{console.error("Erro ao carregar notificações")}};w.useEffect(()=>{d();const y=setInterval(d,3e4);return()=>clearInterval(y)},[]);const f=()=>e(!t),h=async y=>{await J.markNotificationRead(y),r(m=>m.map(v=>v.id===y?{...v,lida:!0}:v)),c(m=>Math.max(0,m-1))},p=y=>{switch(y){case"agenda":return s.jsx(Et,{size:18,className:"text-blue-500"});case"financeiro":return s.jsx(Ba,{size:18,className:"text-emerald-500"});case"lead":return s.jsx($l,{size:18,className:"text-amber-500"});case"sistema":return s.jsx(Id,{size:18,className:"text-red-500"});default:return s.jsx(Tg,{size:18,className:"text-gray-500"})}},b=y=>{switch(y){case"agenda":return"Agenda";case"financeiro":return"Financeiro";case"lead":return"Novo Lead";case"sistema":return"Sistema";default:return"Geral"}};return s.jsx("div",{className:"relative z-[1002]",children:s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:f,className:"group relative w-11 h-11 flex items-center justify-center rounded-xl bg-white/80 backdrop-blur-md border border-white/20 shadow-[0_8px_32px_rgba(0,0,0,0.06)] hover:shadow-[0_8px_32px_rgba(59,130,246,0.15)] hover:border-blue-400/50 transition-all duration-300",children:[s.jsx(uo,{size:22,className:"text-slate-600 group-hover:text-blue-600 transition-colors"}),i>0&&s.jsxs("span",{className:"absolute -top-1.5 -right-1.5 flex h-5 w-5",children:[s.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),s.jsx("span",{className:"relative inline-flex rounded-full h-5 w-5 bg-red-500 text-[10px] font-bold text-white items-center justify-center shadow-lg",children:i})]})]}),t&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0",onClick:f}),s.jsxs("div",{className:"absolute right-0 mt-4 w-[380px] bg-white/95 backdrop-blur-lg rounded-2xl shadow-[0_20px_50px_rgba(0,0,0,0.15)] border border-white/20 overflow-hidden animate-in fade-in zoom-in-95 slide-in-from-top-4 duration-300 transform origin-top-right",children:[s.jsxs("div",{className:"px-6 py-5 bg-gradient-to-r from-slate-50 to-white border-b border-slate-100 flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-slate-800 text-lg tracking-tight",children:"Centro de Notificações"}),s.jsxs("p",{className:"text-[11px] text-slate-400 font-medium uppercase tracking-wider",children:["Você tem ",i," novas mensagens"]})]}),s.jsx("button",{onClick:f,className:"p-2 hover:bg-slate-100 rounded-full transition-colors",children:s.jsx(Qe,{size:18,className:"text-slate-400"})})]}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto custom-scrollbar bg-slate-50/30",children:n.length===0?s.jsxs("div",{className:"py-20 flex flex-col items-center justify-center text-center px-8",children:[s.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mb-4",children:s.jsx(uo,{size:32,className:"text-slate-300"})}),s.jsx("p",{className:"text-slate-500 font-medium",children:"Tudo limpo por aqui!"}),s.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"Não há notificações para mostrar no momento."})]}):s.jsx("div",{className:"divide-y divide-slate-100",children:n.map(y=>s.jsxs("div",{className:`group p-5 hover:bg-white transition-all duration-200 cursor-default ${y.lida?"":"bg-blue-50/40 relative"}`,children:[!y.lida&&s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 bg-blue-500 rounded-r-full"}),s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:`mt-1 h-10 w-10 flex-shrink-0 flex items-center justify-center rounded-xl ${y.tipo==="agenda"?"bg-blue-100 text-blue-600":y.tipo==="financeiro"?"bg-emerald-100 text-emerald-600":y.tipo==="lead"?"bg-amber-100 text-amber-600":"bg-red-100 text-red-600"}`,children:p(y.tipo)}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex justify-between items-center mb-1",children:[s.jsx("span",{className:"text-[11px] font-bold text-slate-400 uppercase tracking-wide",children:b(y.tipo)}),s.jsx("span",{className:"text-[10px] text-slate-400",children:new Date(y.data).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})})]}),s.jsx("h4",{className:`text-sm font-bold leading-tight ${y.lida?"text-slate-600":"text-slate-900"}`,children:y.titulo}),s.jsx("p",{className:"text-xs text-slate-500 mt-1 line-clamp-2 leading-relaxed",children:y.mensagem}),!y.lida&&s.jsx("button",{onClick:()=>h(y.id),className:"text-[11px] text-blue-600 font-bold mt-3 opacity-0 group-hover:opacity-100 transition-opacity hover:underline",children:"MARCAR COMO LIDA"})]})]})]},y.id))})}),s.jsx("div",{className:"p-4 bg-white border-t border-slate-100 text-center",children:s.jsx("button",{onClick:()=>{history.pushState({},"","/notificacoes"),e(!1)},className:"text-xs font-bold text-slate-500 hover:text-blue-600 transition-colors tracking-widest uppercase",children:"Histórico Completo"})})]})]})]})})},cd=({title:t,value:e,icon:n,trend:r,isPositive:i,color:c,onClick:d})=>{const f={blue:"bg-blue-50 text-blue-600",green:"bg-emerald-50 text-emerald-600",purple:"bg-indigo-50 text-indigo-600",amber:"bg-amber-50 text-amber-600"};return s.jsxs("div",{onClick:d,className:`bg-white rounded-[2rem] p-8 border border-gray-100 shadow-[0_10px_40px_-15px_rgba(0,0,0,0.05)] hover:shadow-[0_20px_50px_-20px_rgba(0,0,0,0.1)] transition-all duration-500 group relative overflow-hidden ${d?"cursor-pointer":""}`,children:[s.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 opacity-[0.03] -mr-8 -mt-8 rounded-full bg-current transform group-hover:scale-110 transition-transform duration-700"}),s.jsx("div",{className:"flex justify-between items-start relative z-10",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:`w-12 h-12 ${f[c]} rounded-2xl flex items-center justify-center mb-2 group-hover:scale-110 transition-transform`,children:n}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-[0.2em]",children:t}),s.jsx("h3",{className:"text-3xl font-black text-gray-900 tracking-tight mt-1",children:e})]}),r&&s.jsxs("div",{className:`flex items-center gap-1.5 text-xs font-bold ${i?"text-emerald-600":"text-rose-600"}`,children:[s.jsx("div",{className:`p-0.5 rounded-full ${i?"bg-emerald-100":"bg-rose-100"}`,children:i?s.jsx(IN,{size:12}):s.jsx(_N,{size:12})}),r]})]})})]})},GO=()=>{const{data:t,isLoading:e}=_e(J.getDashboardStats),n=w.useMemo(()=>{if(!(t!=null&&t.growth)||t.growth.length===0)return Array(6).fill(null).map((h,p)=>({label:`MÊS ${p+1}`,receita:0,despesa:0,heightP:"0%",heightR:"0%"}));const f=Math.max(...t.growth.map(h=>Math.max(parseFloat(h.receita),parseFloat(h.despesa))),1e3);return t.growth.map(h=>{const[p,b]=h.mes.split("-");return{label:new Date(parseInt(p),parseInt(b)-1).toLocaleString("pt-BR",{month:"short"}).toUpperCase(),receita:parseFloat(h.receita),despesa:parseFloat(h.despesa),heightR:`${parseFloat(h.receita)/f*100}%`,heightD:`${parseFloat(h.despesa)/f*100}%`}}).slice(-6)},[t]),r=J.getCurrentRole(),i=["admin","donoclinica","funcionario"].includes(r);if(e)return s.jsx("div",{className:"flex items-center justify-center h-96",children:s.jsx("div",{className:"w-12 h-12 border-4 border-blue-600 border-t-transparent rounded-full animate-spin"})});const c=(t==null?void 0:t.stats)||{totalPacientes:0,totalAgendamentos:0,totalLeads:0,faturamentoTotal:0},d=(t==null?void 0:t.recentAgendamentos)||[];return s.jsxs("div",{className:"space-y-10 pb-10",children:[s.jsxs("header",{className:"flex flex-col md:flex-row md:items-end justify-between gap-6",children:[s.jsx("div",{children:s.jsx(cn,{title:"DASHBOARD ANALÍTICO",description:"Informações consolidadas em tempo real da sua clínica."})}),s.jsxs("div",{className:"flex items-center gap-3",children:[(r==="admin"||r==="donoclinica"||r==="funcionario")&&s.jsxs("button",{onClick:()=>history.pushState({},"","/relatorios"),className:"bg-white text-gray-900 border border-gray-200 px-6 py-3 rounded-2xl text-xs font-black uppercase tracking-widest hover:bg-gray-50 transition-all flex items-center gap-2 shadow-sm",children:[s.jsx(Fl,{size:16})," Relatórios"]}),(r==="admin"||r==="donoclinica"||r==="funcionario")&&s.jsxs("button",{onClick:()=>history.pushState({},"","/pacientes"),className:"bg-blue-600 text-white px-6 py-3 rounded-2xl text-xs font-black uppercase tracking-widest hover:bg-blue-700 hover:shadow-xl hover:shadow-blue-200 transition-all flex items-center gap-2 shadow-lg shadow-blue-100",children:[s.jsx(ft,{size:16})," Novo Paciente"]}),s.jsx(HO,{})]})]}),s.jsxs("div",{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-${i?"4":"2"} gap-8`,children:[s.jsx(cd,{title:"Pacientes Ativos",value:c.totalPacientes,icon:s.jsx($n,{size:24}),trend:"+12% este mês",isPositive:!0,color:"blue",onClick:()=>history.pushState({},"","/pacientes")}),i&&s.jsx(cd,{title:"Faturamento Bruto",value:new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(c.faturamentoTotal),icon:s.jsx(Ba,{size:24}),trend:"+5.4% vs mês ant.",isPositive:!0,color:"green",onClick:()=>history.pushState({},"","/financeiro")}),s.jsx(cd,{title:"Agendamentos",value:c.totalAgendamentos,icon:s.jsx(Et,{size:24}),trend:"82% de ocupação",isPositive:!0,color:"purple",onClick:()=>history.pushState({},"","/agenda")}),i&&s.jsx(cd,{title:"Novas Leads",value:c.totalLeads,icon:s.jsx(GN,{size:24}),trend:"-2% vs ontem",isPositive:!1,color:"amber",onClick:()=>history.pushState({},"","/leads")})]}),s.jsxs("div",{className:`grid lg:grid-cols-${i?"3":"1"} gap-8`,children:[i&&s.jsxs("div",{className:"lg:col-span-2 bg-white rounded-[2.5rem] p-10 border border-gray-100 shadow-[0_20px_50px_-15px_rgba(0,0,0,0.03)]",children:[s.jsxs("div",{className:"flex justify-between items-center mb-10",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-xl font-black text-gray-900 uppercase tracking-tighter italic",children:"Crescimento Mensal"}),s.jsx("p",{className:"text-xs font-bold text-gray-400 mt-1 uppercase",children:"Receitas vs Despesas Reais"})]}),s.jsxs("select",{id:"chart-period-dashboard",name:"chart-period",className:"bg-gray-50 border-none text-[10px] font-black uppercase tracking-widest px-4 py-2 rounded-xl focus:ring-2 focus:ring-blue-100 cursor-pointer",children:[s.jsx("option",{value:"6m",children:"Últimos 6 meses"}),s.jsx("option",{value:"year",children:"Este Ano"})]})]}),s.jsx("div",{className:"h-64 flex items-end justify-between gap-4 px-4",children:n.map((f,h)=>s.jsxs("div",{className:"flex-1 flex flex-col items-center gap-3 group",children:[s.jsxs("div",{className:"w-full flex justify-center gap-1 items-end h-[200px] bg-slate-50/50 rounded-2xl p-1",children:[s.jsx("div",{title:`Despesa: R$ ${f.despesa}`,className:"w-1/3 bg-rose-200 rounded-lg group-hover:bg-rose-300 transition-all duration-500 origin-bottom",style:{height:f.heightD||"5%"}}),s.jsx("div",{title:`Receita: R$ ${f.receita}`,className:"w-1/3 bg-blue-500 rounded-lg group-hover:bg-blue-600 shadow-sm group-hover:shadow-blue-200 transition-all duration-500 origin-bottom",style:{height:f.heightR||"5%"}})]}),s.jsx("span",{className:"text-[10px] font-black text-gray-400 uppercase tracking-tighter",children:f.label})]},h))}),s.jsxs("div",{className:"flex justify-center gap-6 mt-6",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded-sm"}),s.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase",children:"Receitas"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-3 h-3 bg-rose-200 rounded-sm"}),s.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase",children:"Despesas"})]})]})]}),s.jsxs("div",{className:"bg-gray-900 rounded-[2.5rem] p-10 shadow-2xl shadow-blue-200 overflow-hidden relative",children:[s.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-blue-600/20 blur-[80px] rounded-full"}),s.jsxs("div",{className:"relative z-10 h-full flex flex-col",children:[s.jsx("h4",{className:"text-xl font-black text-white uppercase tracking-tighter italic mb-8",children:"Últimos Agendamentos"}),s.jsx("div",{className:"space-y-6 flex-1 overflow-y-auto custom-scrollbar pr-2",children:d.length>0?d.map(f=>s.jsxs("div",{onClick:()=>history.pushState({},"","/agenda"),className:"flex items-center gap-4 group cursor-pointer",children:[s.jsx("div",{className:"w-12 h-12 rounded-2xl bg-white/10 flex items-center justify-center text-blue-400 group-hover:bg-blue-600 group-hover:text-white transition-all duration-300 flex-shrink-0",children:s.jsx(Et,{size:20})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm font-black text-white uppercase tracking-tight truncate",children:f.pacientenome||"Paciente"}),s.jsxs("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-0.5 truncate",children:[f.dentistaNome||"Dr. Dentista"," • ",new Date(f.start_time).toLocaleDateString("pt-BR")," ",new Date(f.start_time).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})]})]}),s.jsx(Ts,{size:16,className:"text-gray-600 group-hover:text-white group-hover:translate-x-1 transition-all"})]},f.id)):s.jsxs("div",{className:"flex flex-col items-center justify-center py-10 opacity-40",children:[s.jsx(Et,{size:40,className:"text-white mb-2"}),s.jsx("p",{className:"text-white text-[10px] font-bold uppercase tracking-widest",children:"Nenhum agendamento recente."})]})}),s.jsxs("button",{onClick:()=>history.pushState({},"","/agenda"),className:"w-full mt-8 bg-white/5 border border-white/10 text-white py-4 rounded-2xl text-[10px] font-black uppercase tracking-widest hover:bg-white/10 transition-all flex items-center justify-center gap-2 group",children:["Ver Agenda Completa ",s.jsx(Ls,{size:14,className:"group-hover:translate-x-1 transition-transform"})]})]})]})]})]})},VO=()=>s.jsx("div",{className:"col-span-3 flex justify-center items-center py-10",children:s.jsx(Ct,{className:"animate-spin text-blue-600",size:32})}),FO=({error:t})=>s.jsxs("div",{className:"col-span-3 text-center py-10 text-red-500 uppercase font-bold text-sm",children:["ERRO AO CARREGAR LEADS: ",t.message]}),qO=({onClose:t,onSaved:e})=>{const n=Fe(),[r,i]=w.useState({nome:"",sobrenome:"",whatsapp:"",tipoInteresse:"Particular"});w.useEffect(()=>{const d=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t]);const c=async d=>{if(d.preventDefault(),!r.nome||!r.whatsapp){n.error("PREENCHA NOME E WHATSAPP.");return}try{await J.saveLead({...r,status:"Novo",dataCadastro:new Date().toISOString()}),n.success("LEAD CADASTRADO!"),e(),t()}catch{n.error("ERRO AO CADASTRAR LEAD.")}};return s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-green-50 to-white",children:[s.jsxs("h2",{className:"text-base font-bold text-gray-800 uppercase flex items-center gap-2",children:[s.jsx(Ld,{size:18,className:"text-green-500"})," CADASTRAR NOVO LEAD"]}),s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:c,className:"space-y-4 max-w-2xl mx-auto",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"NOME"}),s.jsx("input",{type:"text",value:r.nome,onChange:d=>i(f=>({...f,nome:d.target.value.toUpperCase()})),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 text-sm font-semibold uppercase-input",placeholder:"NOME",required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"SOBRENOME"}),s.jsx("input",{type:"text",value:r.sobrenome,onChange:d=>i(f=>({...f,sobrenome:d.target.value.toUpperCase()})),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 text-sm font-semibold uppercase-input",placeholder:"SOBRENOME"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"WHATSAPP"}),s.jsx("input",{type:"text",value:r.whatsapp,onChange:d=>i(f=>({...f,whatsapp:d.target.value})),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 text-sm",placeholder:"(XX) XXXXX-XXXX",required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"TIPO DE INTERESSE"}),s.jsxs("select",{value:r.tipoInteresse,onChange:d=>i(f=>({...f,tipoInteresse:d.target.value})),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 text-sm bg-white uppercase-select",children:[s.jsx("option",{value:"Particular",children:"PARTICULAR"}),s.jsx("option",{value:"Plano",children:"PLANO"})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-6",children:[s.jsx("button",{type:"button",onClick:t,className:"px-6 py-2.5 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-sm uppercase",children:"CANCELAR"}),s.jsxs("button",{type:"submit",className:"px-6 py-2.5 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg text-sm uppercase flex items-center gap-2",children:[s.jsx(Ld,{size:16})," CADASTRAR"]})]})]})})]})})},$O=()=>{const{data:t,isLoading:e,error:n,refresh:r}=_e(J.getLeads),{data:i}=_e(J.getDentistas),[c,d]=w.useState(!1),[f,h]=w.useState(!1),[p,b]=w.useState(null),[y,m]=w.useState("TODOS"),[v,N]=w.useState(!1),S=Fe();w.useEffect(()=>{if(!c)return;const O=A=>{A.key==="Escape"&&d(!1)};return document.addEventListener("keydown",O),()=>{document.removeEventListener("keydown",O)}},[c]);const j=async O=>{if(O.preventDefault(),!!p)try{S.info(`FUNCIONALIDADE DE CONVERSÃO PARA ${p.nome} EM DESENVOLVIMENTO.`),d(!1)}catch{S.error("FALHA AO CONVERTER LEAD.")}},R=["TODOS","NOVO","CONVERTIDO"],C=t==null?void 0:t.filter(O=>{var A;return y==="TODOS"?!0:((A=O.status)==null?void 0:A.toUpperCase())===y});return s.jsxs("div",{className:"space-y-6",children:[s.jsx(cn,{title:"GESTÃO DE LEADS",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>N(O=>!O),className:"bg-white border border-gray-300 text-gray-600 px-3 py-2 rounded-lg text-sm flex items-center gap-2 hover:bg-gray-50 uppercase font-bold",children:[s.jsx(mu,{size:16}),y,s.jsx(_o,{size:14,className:`transition-transform ${v?"rotate-180":""}`})]}),v&&s.jsx("div",{className:"absolute right-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg z-10 min-w-[140px]",children:R.map(O=>s.jsx("button",{onClick:()=>{m(O),N(!1)},className:`w-full text-left px-4 py-2 text-sm font-bold uppercase hover:bg-gray-50 ${y===O?"text-blue-600 bg-blue-50":"text-gray-700"}`,children:O},O))})]}),s.jsxs("button",{onClick:()=>h(!0),className:"bg-green-600 text-white px-4 py-2 rounded-lg text-sm flex items-center gap-2 hover:bg-green-700 uppercase font-bold shadow-sm",children:[s.jsx(ft,{size:16})," NOVO LEAD"]})]})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[e&&s.jsx(VO,{}),n&&s.jsx(FO,{error:n}),C&&C.map(O=>s.jsxs("div",{className:`bg-white rounded-xl shadow-sm border ${O.status==="Novo"?"border-amber-200 bg-amber-50/30":"border-gray-200"} p-6 relative`,children:[O.status==="Novo"&&s.jsx("div",{className:"absolute top-4 right-4 w-2 h-2 bg-amber-500 rounded-full animate-pulse"}),s.jsxs("div",{className:"flex items-start justify-between mb-4",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-900 uppercase",children:[O.nome," ",O.sobrenome]}),s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1 mt-1 font-medium",children:[s.jsx(Tg,{size:14})," ",O.whatsapp]})]}),s.jsx("span",{className:`px-2 py-1 text-xs font-bold rounded uppercase ${O.tipoInteresse==="Particular"?"bg-orange-100 text-orange-800":"bg-purple-100 text-purple-800"}`,children:O.tipoInteresse})]}),s.jsxs("div",{className:"text-xs text-gray-400 mb-6 font-bold uppercase",children:["CADASTRADO EM: ",new Date(O.dataCadastro).toLocaleDateString()]}),O.status!=="Convertido"?s.jsxs("button",{onClick:()=>{b(O),d(!0)},className:"w-full py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg flex items-center justify-center gap-2 font-bold transition-colors uppercase text-xs",children:[s.jsx(Ld,{size:18})," AGENDAR E CADASTRAR"]}):s.jsxs("div",{className:"w-full py-2 bg-gray-100 text-gray-500 rounded-lg flex items-center justify-center gap-2 font-bold uppercase text-xs",children:[s.jsx(Ua,{size:18})," CONVERTIDO"]})]},O.id)),(C==null?void 0:C.length)===0&&!e&&s.jsx("div",{className:"col-span-3 text-center py-10 text-gray-400 uppercase font-bold text-sm",children:"NENHUM LEAD ENCONTRADO."})]}),c&&p&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-blue-50 to-white",children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-800 uppercase flex items-center gap-2",children:[s.jsx(Ld,{size:18,className:"text-blue-500"})," CONVERTER LEAD"]}),s.jsx("button",{onClick:()=>d(!1),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:j,className:"space-y-4 max-w-2xl mx-auto",children:[s.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg mb-4 text-xs text-blue-800 border border-blue-100 font-bold uppercase",children:["AO SALVAR, O SISTEMA IRÁ AUTOMATICAMENTE ",s.jsx("strong",{children:"CADASTRAR O PACIENTE"})," E CRIAR O AGENDAMENTO."]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-700 mb-1 uppercase",children:"PACIENTE"}),s.jsx("input",{disabled:!0,value:`${p.nome} ${p.sobrenome}`.toUpperCase(),className:"w-full bg-gray-100 border border-gray-300 rounded-lg p-2.5 text-gray-500 uppercase font-bold"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-700 mb-1 uppercase",children:"DATA AGENDAMENTO"}),s.jsx("input",{type:"date",required:!0,className:"w-full border border-gray-300 rounded-lg p-2.5 font-semibold"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-700 mb-1 uppercase",children:"HORA"}),s.jsx("input",{type:"time",required:!0,className:"w-full border border-gray-300 rounded-lg p-2.5 font-semibold"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-700 mb-1 uppercase",children:"DENTISTA RESPONSÁVEL"}),s.jsx("select",{className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select font-semibold",children:i&&i.map(O=>s.jsx("option",{value:O.id,children:O.nome},O.id))})]}),s.jsx("div",{className:"pt-6",children:s.jsx("button",{type:"submit",className:"w-full bg-green-600 text-white py-3 rounded-lg font-bold hover:bg-green-700 uppercase text-sm shadow-sm transition-all",children:"CONFIRMAR AGENDAMENTO"})})]})})]})}),f&&s.jsx(qO,{onClose:()=>h(!1),onSaved:r})]})},YO=()=>{const[t,e]=w.useState({nome:"",sobrenome:"",cpf:"",whatsapp:"",tipo:""}),[n,r]=w.useState(!1),[i,c]=w.useState(!1),d=Fe(),f=async p=>{if(p.preventDefault(),r(!0),!t.tipo){d.error("POR FAVOR, SELECIONE PARTICULAR OU PLANO."),r(!1);return}try{if(await J.checkCpfExists(t.cpf)){d.error("CPF JÁ CADASTRADO. ENTRE EM CONTATO PELO WHATSAPP."),r(!1);return}await J.saveLead({nome:t.nome,sobrenome:t.sobrenome,cpf:t.cpf,whatsapp:t.whatsapp,tipoInteresse:t.tipo}),c(!0)}catch{d.error("ERRO AO ENVIAR DADOS. TENTE NOVAMENTE.")}finally{r(!1)}},h=p=>{e({...t,[p.target.name]:p.target.value.toUpperCase()})};return i?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white p-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-green-100 text-green-600 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx(Ua,{size:32})}),s.jsx("h2",{className:"text-xl font-bold text-amber-900 uppercase",children:"MENSAGEM ENVIADA!"}),s.jsx("p",{className:"text-amber-800 mt-2 uppercase font-bold text-sm",children:"NOSSA EQUIPE ENTRARÁ EM CONTATO EM BREVE."})]})}):s.jsx("div",{className:"min-h-screen bg-white flex flex-col items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-md",children:[s.jsx("h1",{className:"text-center font-bold text-xl mb-6 text-black uppercase",children:"DEIXE SEU CONTATO"}),s.jsxs("form",{onSubmit:f,className:"space-y-4",children:[s.jsx("input",{type:"text",name:"nome",placeholder:"NOME",className:"w-full border border-amber-700 rounded-lg p-3 text-gray-800 outline-none focus:ring-2 focus:ring-amber-500 placeholder-gray-500 uppercase-input",required:!0,value:t.nome,onChange:h}),s.jsx("input",{type:"text",name:"sobrenome",placeholder:"SOBRENOME",className:"w-full border border-amber-700 rounded-lg p-3 text-gray-800 outline-none focus:ring-2 focus:ring-amber-500 placeholder-gray-500 uppercase-input",required:!0,value:t.sobrenome,onChange:h}),s.jsx("input",{type:"text",name:"cpf",placeholder:"CPF",className:"w-full border border-amber-700 rounded-lg p-3 text-gray-800 outline-none focus:ring-2 focus:ring-amber-500 placeholder-gray-500 uppercase-input",required:!0,value:t.cpf,onChange:h}),s.jsx("input",{type:"text",name:"whatsapp",placeholder:"WHATSAPP",className:"w-full border border-amber-700 rounded-lg p-3 text-gray-800 outline-none focus:ring-2 focus:ring-amber-500 placeholder-gray-500 uppercase-input",required:!0,value:t.whatsapp,onChange:h}),s.jsxs("div",{className:"flex gap-4",children:[s.jsx("button",{type:"button",onClick:()=>e({...t,tipo:"Particular"}),className:`flex-1 py-3 rounded-lg font-bold uppercase text-sm transition-colors border ${t.tipo==="Particular"?"bg-amber-800 text-white border-amber-800":"bg-amber-600 text-white border-amber-600 hover:bg-amber-700"}`,children:"PARTICULAR"}),s.jsx("button",{type:"button",onClick:()=>e({...t,tipo:"Plano"}),className:`flex-1 py-3 rounded-lg font-bold uppercase text-sm transition-colors border ${t.tipo==="Plano"?"bg-purple-800 text-white border-purple-800":"bg-purple-600 text-white border-purple-600 hover:bg-purple-700"}`,children:"PLANO"})]}),s.jsx("button",{type:"submit",disabled:n,className:"w-full py-4 bg-gray-800 text-white font-bold rounded-lg mt-6 shadow-sm hover:opacity-90 transition-opacity uppercase disabled:bg-gray-400",children:n?"VERIFICANDO...":"ENVIAR"})]})]})})};function Wt(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var QO=typeof Symbol=="function"&&Symbol.observable||"@@observable",lv=QO,iv=()=>Math.random().toString(36).substring(7).split("").join("."),WO={INIT:`@@redux/INIT${iv()}`,REPLACE:`@@redux/REPLACE${iv()}`},ov=WO;function XO(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function WN(t,e,n){if(typeof t!="function")throw new Error(Wt(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Wt(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Wt(1));return n(WN)(t,e)}let r=t,i=e,c=new Map,d=c,f=0,h=!1;function p(){d===c&&(d=new Map,c.forEach((j,R)=>{d.set(R,j)}))}function b(){if(h)throw new Error(Wt(3));return i}function y(j){if(typeof j!="function")throw new Error(Wt(4));if(h)throw new Error(Wt(5));let R=!0;p();const C=f++;return d.set(C,j),function(){if(R){if(h)throw new Error(Wt(6));R=!1,p(),d.delete(C),c=null}}}function m(j){if(!XO(j))throw new Error(Wt(7));if(typeof j.type>"u")throw new Error(Wt(8));if(typeof j.type!="string")throw new Error(Wt(17));if(h)throw new Error(Wt(9));try{h=!0,i=r(i,j)}finally{h=!1}return(c=d).forEach(C=>{C()}),j}function v(j){if(typeof j!="function")throw new Error(Wt(10));r=j,m({type:ov.REPLACE})}function N(){const j=y;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Wt(11));function C(){const A=R;A.next&&A.next(b())}return C(),{unsubscribe:j(C)}},[lv](){return this}}}return m({type:ov.INIT}),{dispatch:m,subscribe:y,getState:b,replaceReducer:v,[lv]:N}}function cv(t,e){return function(...n){return e(t.apply(this,n))}}function dv(t,e){if(typeof t=="function")return cv(t,e);if(typeof t!="object"||t===null)throw new Error(Wt(16));const n={};for(const r in t){const i=t[r];typeof i=="function"&&(n[r]=cv(i,e))}return n}function XN(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function ZO(...t){return e=>(n,r)=>{const i=e(n,r);let c=()=>{throw new Error(Wt(15))};const d={getState:i.getState,dispatch:(h,...p)=>c(h,...p)},f=t.map(h=>h(d));return c=XN(...f)(i.dispatch),{...i,dispatch:c}}}var sp={exports:{}},rp={};/** - * @license React - * use-sync-external-store-with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var uv;function KO(){if(uv)return rp;uv=1;var t=pu();function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,c=t.useEffect,d=t.useMemo,f=t.useDebugValue;return rp.useSyncExternalStoreWithSelector=function(h,p,b,y,m){var v=i(null);if(v.current===null){var N={hasValue:!1,value:null};v.current=N}else N=v.current;v=d(function(){function j(k){if(!R){if(R=!0,C=k,k=y(k),m!==void 0&&N.hasValue){var _=N.value;if(m(_,k))return O=_}return O=k}if(_=O,n(C,k))return _;var B=y(k);return m!==void 0&&m(_,B)?(C=k,_):(C=k,O=B)}var R=!1,C,O,A=b===void 0?null:b;return[function(){return j(p())},A===null?void 0:function(){return j(A())}]},[p,b,y,m]);var S=r(h,v[0],v[1]);return c(function(){N.hasValue=!0,N.value=S},[S]),f(S),S},rp}var fv;function JO(){return fv||(fv=1,sp.exports=KO()),sp.exports}JO();var eR=w.version.startsWith("19"),tR=Symbol.for(eR?"react.transitional.element":"react.element"),nR=Symbol.for("react.portal"),aR=Symbol.for("react.fragment"),sR=Symbol.for("react.strict_mode"),rR=Symbol.for("react.profiler"),lR=Symbol.for("react.consumer"),iR=Symbol.for("react.context"),ZN=Symbol.for("react.forward_ref"),oR=Symbol.for("react.suspense"),cR=Symbol.for("react.suspense_list"),_g=Symbol.for("react.memo"),dR=Symbol.for("react.lazy"),uR=ZN,fR=_g;function hR(t){if(typeof t=="object"&&t!==null){const{$$typeof:e}=t;switch(e){case tR:switch(t=t.type,t){case aR:case rR:case sR:case oR:case cR:return t;default:switch(t=t&&t.$$typeof,t){case iR:case ZN:case dR:case _g:return t;case lR:return t;default:return e}}case nR:return e}}}function pR(t){return hR(t)===_g}function gR(t,e,n,r,{areStatesEqual:i,areOwnPropsEqual:c,areStatePropsEqual:d}){let f=!1,h,p,b,y,m;function v(C,O){return h=C,p=O,b=t(h,p),y=e(r,p),m=n(b,y,p),f=!0,m}function N(){return b=t(h,p),e.dependsOnOwnProps&&(y=e(r,p)),m=n(b,y,p),m}function S(){return t.dependsOnOwnProps&&(b=t(h,p)),e.dependsOnOwnProps&&(y=e(r,p)),m=n(b,y,p),m}function j(){const C=t(h,p),O=!d(C,b);return b=C,O&&(m=n(b,y,p)),m}function R(C,O){const A=!c(O,p),k=!i(C,h,O,p);return h=C,p=O,A&&k?N():A?S():k?j():m}return function(O,A){return f?R(O,A):v(O,A)}}function mR(t,{initMapStateToProps:e,initMapDispatchToProps:n,initMergeProps:r,...i}){const c=e(t,i),d=n(t,i),f=r(t,i);return gR(c,d,f,t,i)}function xR(t,e){const n={};for(const r in t){const i=t[r];typeof i=="function"&&(n[r]=(...c)=>e(i(...c)))}return n}function Hp(t){return function(n){const r=t(n);function i(){return r}return i.dependsOnOwnProps=!1,i}}function hv(t){return t.dependsOnOwnProps?!!t.dependsOnOwnProps:t.length!==1}function KN(t,e){return function(r,{displayName:i}){const c=function(f,h){return c.dependsOnOwnProps?c.mapToProps(f,h):c.mapToProps(f,void 0)};return c.dependsOnOwnProps=!0,c.mapToProps=function(f,h){c.mapToProps=t,c.dependsOnOwnProps=hv(t);let p=c(f,h);return typeof p=="function"&&(c.mapToProps=p,c.dependsOnOwnProps=hv(p),p=c(f,h)),p},c}}function Mg(t,e){return(n,r)=>{throw new Error(`Invalid value of type ${typeof t} for ${e} argument when connecting component ${r.wrappedComponentName}.`)}}function bR(t){return t&&typeof t=="object"?Hp(e=>xR(t,e)):t?typeof t=="function"?KN(t):Mg(t,"mapDispatchToProps"):Hp(e=>({dispatch:e}))}function yR(t){return t?typeof t=="function"?KN(t):Mg(t,"mapStateToProps"):Hp(()=>({}))}function vR(t,e,n){return{...n,...t,...e}}function NR(t){return function(n,{displayName:r,areMergedPropsEqual:i}){let c=!1,d;return function(h,p,b){const y=t(h,p,b);return c?i(y,d)||(d=y):(c=!0,d=y),d}}}function ER(t){return t?typeof t=="function"?NR(t):Mg(t,"mergeProps"):()=>vR}function SR(t){t()}function jR(){let t=null,e=null;return{clear(){t=null,e=null},notify(){SR(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var pv={notify(){},get:()=>[]};function JN(t,e){let n,r=pv,i=0,c=!1;function d(S){b();const j=r.subscribe(S);let R=!1;return()=>{R||(R=!0,j(),y())}}function f(){r.notify()}function h(){N.onStateChange&&N.onStateChange()}function p(){return c}function b(){i++,n||(n=e?e.addNestedSub(h):t.subscribe(h),r=jR())}function y(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=pv)}function m(){c||(c=!0,b())}function v(){c&&(c=!1,y())}const N={addNestedSub:d,notifyNestedSubs:f,handleChangeWrapper:h,isSubscribed:p,trySubscribe:m,tryUnsubscribe:v,getListeners:()=>r};return N}var AR=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wR=AR(),CR=()=>typeof navigator<"u"&&navigator.product==="ReactNative",DR=CR(),OR=()=>wR||DR?w.useLayoutEffect:w.useEffect,zd=OR();function gv(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function lp(t,e){if(gv(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;it(...e),n)}function HR(t,e,n,r,i,c){t.current=r,n.current=!1,i.current&&(i.current=null,c())}function GR(t,e,n,r,i,c,d,f,h,p,b){if(!t)return()=>{};let y=!1,m=null;const v=()=>{if(y||!f.current)return;const S=e.getState();let j,R;try{j=r(S,i.current)}catch(C){R=C,m=C}R||(m=null),j===c.current?d.current||p():(c.current=j,h.current=j,d.current=!0,b())};return n.onStateChange=v,n.trySubscribe(),v(),()=>{if(y=!0,n.tryUnsubscribe(),n.onStateChange=null,m)throw m}}function VR(t,e){return t===e}function FR(t,e,n,{pure:r,areStatesEqual:i=VR,areOwnPropsEqual:c=lp,areStatePropsEqual:d=lp,areMergedPropsEqual:f=lp,forwardRef:h=!1,context:p=tE}={}){const b=p,y=yR(t),m=bR(e),v=ER(n),N=!!t;return j=>{const R=j.displayName||j.name||"Component",C=`Connect(${R})`,O={shouldHandleStateChanges:N,displayName:C,wrappedComponentName:R,WrappedComponent:j,initMapStateToProps:y,initMapDispatchToProps:m,initMergeProps:v,areStatesEqual:i,areStatePropsEqual:d,areOwnPropsEqual:c,areMergedPropsEqual:f};function A(B){const[F,G,ee]=w.useMemo(()=>{const{reactReduxForwardedRef:ue,...Oe}=B;return[B.context,ue,Oe]},[B]),ne=w.useMemo(()=>{let ue=b;return F!=null&&F.Consumer,ue},[F,b]),oe=w.useContext(ne),Q=!!B.store&&!!B.store.getState&&!!B.store.dispatch,ce=!!oe&&!!oe.store,he=Q?B.store:oe.store,H=ce?oe.getServerState:he.getState,V=w.useMemo(()=>mR(he.dispatch,O),[he]),[P,W]=w.useMemo(()=>{if(!N)return UR;const ue=JN(he,Q?void 0:oe.subscription),Oe=ue.notifyNestedSubs.bind(ue);return[ue,Oe]},[he,Q,oe]),te=w.useMemo(()=>Q?oe:{...oe,subscription:P},[Q,oe,P]),T=w.useRef(void 0),X=w.useRef(ee),ie=w.useRef(void 0),de=w.useRef(!1),ve=w.useRef(!1),je=w.useRef(void 0);zd(()=>(ve.current=!0,()=>{ve.current=!1}),[]);const Te=w.useMemo(()=>()=>ie.current&&ee===X.current?ie.current:V(he.getState(),ee),[he,ee]),bt=w.useMemo(()=>Oe=>P?GR(N,he,P,V,X,T,de,ve,ie,W,Oe):()=>{},[P]);BR(HR,[X,T,de,ee,ie,W]);let Ue;try{Ue=w.useSyncExternalStore(bt,Te,H?()=>V(H(),ee):Te)}catch(ue){throw je.current&&(ue.message+=` -The error may be correlated with this previous error: -${je.current.stack} - -`),ue}zd(()=>{je.current=void 0,ie.current=void 0,T.current=Ue});const It=w.useMemo(()=>w.createElement(j,{...Ue,ref:G}),[G,j,Ue]);return w.useMemo(()=>N?w.createElement(ne.Provider,{value:te},It):It,[ne,It,te])}const _=w.memo(A);if(_.WrappedComponent=j,_.displayName=A.displayName=C,h){const F=w.forwardRef(function(ee,ne){return w.createElement(_,{...ee,reactReduxForwardedRef:ne})});return F.displayName=C,F.WrappedComponent=j,Gp(F,j)}return Gp(_,j)}}var nE=FR;function qR(t){const{children:e,context:n,serverState:r,store:i}=t,c=w.useMemo(()=>{const h=JN(i);return{store:i,subscription:h,getServerState:r?()=>r:void 0}},[i,r]),d=w.useMemo(()=>i.getState(),[i]);zd(()=>{const{subscription:h}=c;return h.onStateChange=h.notifyNestedSubs,h.trySubscribe(),d!==i.getState()&&h.notifyNestedSubs(),()=>{h.tryUnsubscribe(),h.onStateChange=void 0}},[c,d]);const f=n||tE;return w.createElement(f.Provider,{value:c},e)}var $R=qR,YR="Invariant failed";function QR(t,e){throw new Error(YR)}var Jn=function(e){var n=e.top,r=e.right,i=e.bottom,c=e.left,d=r-c,f=i-n,h={top:n,right:r,bottom:i,left:c,width:d,height:f,x:c,y:n,center:{x:(r+c)/2,y:(i+n)/2}};return h},Ig=function(e,n){return{top:e.top-n.top,left:e.left-n.left,bottom:e.bottom+n.bottom,right:e.right+n.right}},yv=function(e,n){return{top:e.top+n.top,left:e.left+n.left,bottom:e.bottom-n.bottom,right:e.right-n.right}},WR=function(e,n){return{top:e.top+n.y,left:e.left+n.x,bottom:e.bottom+n.y,right:e.right+n.x}},cp={top:0,right:0,bottom:0,left:0},Lg=function(e){var n=e.borderBox,r=e.margin,i=r===void 0?cp:r,c=e.border,d=c===void 0?cp:c,f=e.padding,h=f===void 0?cp:f,p=Jn(Ig(n,i)),b=Jn(yv(n,d)),y=Jn(yv(b,h));return{marginBox:p,borderBox:Jn(n),paddingBox:b,contentBox:y,margin:i,border:d,padding:h}},Gn=function(e){var n=e.slice(0,-2),r=e.slice(-2);if(r!=="px")return 0;var i=Number(n);return isNaN(i)&&QR(),i},XR=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Pd=function(e,n){var r=e.borderBox,i=e.border,c=e.margin,d=e.padding,f=WR(r,n);return Lg({borderBox:f,border:i,margin:c,padding:d})},Ud=function(e,n){return n===void 0&&(n=XR()),Pd(e,n)},aE=function(e,n){var r={top:Gn(n.marginTop),right:Gn(n.marginRight),bottom:Gn(n.marginBottom),left:Gn(n.marginLeft)},i={top:Gn(n.paddingTop),right:Gn(n.paddingRight),bottom:Gn(n.paddingBottom),left:Gn(n.paddingLeft)},c={top:Gn(n.borderTopWidth),right:Gn(n.borderRightWidth),bottom:Gn(n.borderBottomWidth),left:Gn(n.borderLeftWidth)};return Lg({borderBox:e,margin:r,padding:i,border:c})},sE=function(e){var n=e.getBoundingClientRect(),r=window.getComputedStyle(e);return aE(n,r)},ho=function(e){var n=[],r=null,i=function(){for(var d=arguments.length,f=new Array(d),h=0;h{const c=ZR(n,i.options);return t.addEventListener(i.eventName,i.fn,c),function(){t.removeEventListener(i.eventName,i.fn,c)}});return function(){r.forEach(c=>{c()})}}const KR="Invariant failed";class Hd extends Error{}Hd.prototype.toString=function(){return this.message};function fe(t,e){throw new Hd(KR)}let JR=class extends Ve.Component{constructor(...e){super(...e),this.callbacks=null,this.unbind=ks,this.onWindowError=n=>{const r=this.getCallbacks();r.isDragging()&&r.tryAbort(),n.error instanceof Hd&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in ");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=Fn(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(e){if(e instanceof Hd){this.setState({});return}throw e}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}};const eT=` - Press space bar to start a drag. - When dragging you can use the arrow keys to move the item around and escape to cancel. - Some screen readers may require you to be in focus mode or to use your pass through key -`,Gd=t=>t+1,tT=t=>` - You have lifted an item in position ${Gd(t.source.index)} -`,lE=(t,e)=>{const n=t.droppableId===e.droppableId,r=Gd(t.index),i=Gd(e.index);return n?` - You have moved the item from position ${r} - to position ${i} - `:` - You have moved the item from position ${r} - in list ${t.droppableId} - to list ${e.droppableId} - in position ${i} - `},iE=(t,e,n)=>e.droppableId===n.droppableId?` - The item ${t} - has been combined with ${n.draggableId}`:` - The item ${t} - in list ${e.droppableId} - has been combined with ${n.draggableId} - in list ${n.droppableId} - `,nT=t=>{const e=t.destination;if(e)return lE(t.source,e);const n=t.combine;return n?iE(t.draggableId,t.source,n):"You are over an area that cannot be dropped on"},vv=t=>` - The item has returned to its starting position - of ${Gd(t.index)} -`,aT=t=>{if(t.reason==="CANCEL")return` - Movement cancelled. - ${vv(t.source)} - `;const e=t.destination,n=t.combine;return e?` - You have dropped the item. - ${lE(t.source,e)} - `:n?` - You have dropped the item. - ${iE(t.draggableId,t.source,n)} - `:` - The item has been dropped while not over a drop area. - ${vv(t.source)} - `},wd={dragHandleUsageInstructions:eT,onDragStart:tT,onDragUpdate:nT,onDragEnd:aT};function sT(t,e){return!!(t===e||Number.isNaN(t)&&Number.isNaN(e))}function oE(t,e){if(t.length!==e.length)return!1;for(let n=0;n({inputs:e,result:t()}))[0],r=w.useRef(!0),i=w.useRef(n),d=r.current||!!(e&&i.current.inputs&&oE(e,i.current.inputs))?i.current:{inputs:e,result:t()};return w.useEffect(()=>{r.current=!1,i.current=d},[d]),d.result}function ye(t,e){return qe(()=>t,e)}const Mt={x:0,y:0},Gt=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),Sn=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),_s=(t,e)=>t.x===e.x&&t.y===e.y,Yl=t=>({x:t.x!==0?-t.x:0,y:t.y!==0?-t.y:0}),Cr=(t,e,n=0)=>t==="x"?{x:e,y:n}:{x:n,y:e},po=(t,e)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),Nv=(t,e)=>Math.min(...e.map(n=>po(t,n))),cE=t=>e=>({x:t(e.x),y:t(e.y)});var rT=(t,e)=>{const n=Jn({top:Math.max(e.top,t.top),right:Math.min(e.right,t.right),bottom:Math.min(e.bottom,t.bottom),left:Math.max(e.left,t.left)});return n.width<=0||n.height<=0?null:n};const Po=(t,e)=>({top:t.top+e.y,left:t.left+e.x,bottom:t.bottom+e.y,right:t.right+e.x}),Ev=t=>[{x:t.left,y:t.top},{x:t.right,y:t.top},{x:t.left,y:t.bottom},{x:t.right,y:t.bottom}],lT={top:0,right:0,bottom:0,left:0},iT=(t,e)=>e?Po(t,e.scroll.diff.displacement):t,oT=(t,e,n)=>n&&n.increasedBy?{...t,[e.end]:t[e.end]+n.increasedBy[e.line]}:t,cT=(t,e)=>e&&e.shouldClipSubject?rT(e.pageMarginBox,t):Jn(t);var zl=({page:t,withPlaceholder:e,axis:n,frame:r})=>{const i=iT(t.marginBox,r),c=oT(i,n,e),d=cT(c,r);return{page:t,withPlaceholder:e,active:d}},zg=(t,e)=>{t.frame||fe();const n=t.frame,r=Sn(e,n.scroll.initial),i=Yl(r),c={...n,scroll:{initial:n.scroll.initial,current:e,diff:{value:r,displacement:i},max:n.scroll.max}},d=zl({page:t.subject.page,withPlaceholder:t.subject.withPlaceholder,axis:t.axis,frame:c});return{...t,frame:c,subject:d}};function kt(t,e=oE){let n=null;function r(...i){if(n&&n.lastThis===this&&e(i,n.lastArgs))return n.lastResult;const c=t.apply(this,i);return n={lastResult:c,lastArgs:i,lastThis:this},c}return r.clear=function(){n=null},r}const dE=kt(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),uE=kt(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),bu=kt(t=>Object.values(t)),dT=kt(t=>Object.values(t));var Ql=kt((t,e)=>dT(e).filter(r=>t===r.descriptor.droppableId).sort((r,i)=>r.descriptor.index-i.descriptor.index));function Pg(t){return t.at&&t.at.type==="REORDER"?t.at.destination:null}function yu(t){return t.at&&t.at.type==="COMBINE"?t.at.combine:null}var vu=kt((t,e)=>e.filter(n=>n.descriptor.id!==t.descriptor.id)),uT=({isMovingForward:t,draggable:e,destination:n,insideDestination:r,previousImpact:i})=>{if(!n.isCombineEnabled||!Pg(i))return null;function d(v){const N={type:"COMBINE",combine:{draggableId:v,droppableId:n.descriptor.id}};return{...i,at:N}}const f=i.displaced.all,h=f.length?f[0]:null;if(t)return h?d(h):null;const p=vu(e,r);if(!h){if(!p.length)return null;const v=p[p.length-1];return d(v.descriptor.id)}const b=p.findIndex(v=>v.descriptor.id===h);b===-1&&fe();const y=b-1;if(y<0)return null;const m=p[y];return d(m.descriptor.id)},Wl=(t,e)=>t.descriptor.droppableId===e.descriptor.id;const fE={point:Mt,value:0},go={invisible:{},visible:{},all:[]},fT={displaced:go,displacedBy:fE,at:null};var qn=(t,e)=>n=>t<=n&&n<=e,hE=t=>{const e=qn(t.top,t.bottom),n=qn(t.left,t.right);return r=>{if(e(r.top)&&e(r.bottom)&&n(r.left)&&n(r.right))return!0;const c=e(r.top)||e(r.bottom),d=n(r.left)||n(r.right);if(c&&d)return!0;const h=r.topt.bottom,p=r.leftt.right;return h&&p?!0:h&&d||p&&c}},hT=t=>{const e=qn(t.top,t.bottom),n=qn(t.left,t.right);return r=>e(r.top)&&e(r.bottom)&&n(r.left)&&n(r.right)};const Ug={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},pE={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var pT=t=>e=>{const n=qn(e.top,e.bottom),r=qn(e.left,e.right);return i=>t===Ug?n(i.top)&&n(i.bottom):r(i.left)&&r(i.right)};const gT=(t,e)=>{const n=e.frame?e.frame.scroll.diff.displacement:Mt;return Po(t,n)},mT=(t,e,n)=>e.subject.active?n(e.subject.active)(t):!1,xT=(t,e,n)=>n(e)(t),Bg=({target:t,destination:e,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:i})=>{const c=r?gT(t,e):t;return mT(c,e,i)&&xT(c,n,i)},bT=t=>Bg({...t,isVisibleThroughFrameFn:hE}),gE=t=>Bg({...t,isVisibleThroughFrameFn:hT}),yT=t=>Bg({...t,isVisibleThroughFrameFn:pT(t.destination.axis)}),vT=(t,e,n)=>{if(typeof n=="boolean")return n;if(!e)return!0;const{invisible:r,visible:i}=e;if(r[t])return!1;const c=i[t];return c?c.shouldAnimate:!0};function NT(t,e){const n=t.page.marginBox,r={top:e.point.y,right:0,bottom:0,left:e.point.x};return Jn(Ig(n,r))}function mo({afterDragging:t,destination:e,displacedBy:n,viewport:r,forceShouldAnimate:i,last:c}){return t.reduce(function(f,h){const p=NT(h,n),b=h.descriptor.id;if(f.all.push(b),!bT({target:p,destination:e,viewport:r,withDroppableDisplacement:!0}))return f.invisible[h.descriptor.id]=!0,f;const m=vT(b,c,i),v={draggableId:b,shouldAnimate:m};return f.visible[b]=v,f},{all:[],visible:{},invisible:{}})}function ET(t,e){if(!t.length)return 0;const n=t[t.length-1].descriptor.index;return e.inHomeList?n:n+1}function Sv({insideDestination:t,inHomeList:e,displacedBy:n,destination:r}){const i=ET(t,{inHomeList:e});return{displaced:go,displacedBy:n,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:i}}}}function Vd({draggable:t,insideDestination:e,destination:n,viewport:r,displacedBy:i,last:c,index:d,forceShouldAnimate:f}){const h=Wl(t,n);if(d==null)return Sv({insideDestination:e,inHomeList:h,displacedBy:i,destination:n});const p=e.find(N=>N.descriptor.index===d);if(!p)return Sv({insideDestination:e,inHomeList:h,displacedBy:i,destination:n});const b=vu(t,e),y=e.indexOf(p),m=b.slice(y);return{displaced:mo({afterDragging:m,destination:n,displacedBy:i,last:c,viewport:r.frame,forceShouldAnimate:f}),displacedBy:i,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:d}}}}function zs(t,e){return!!e.effected[t]}var ST=({isMovingForward:t,destination:e,draggables:n,combine:r,afterCritical:i})=>{if(!e.isCombineEnabled)return null;const c=r.draggableId,f=n[c].descriptor.index;return zs(c,i)?t?f:f-1:t?f+1:f},jT=({isMovingForward:t,isInHomeList:e,insideDestination:n,location:r})=>{if(!n.length)return null;const i=r.index,c=t?i+1:i-1,d=n[0].descriptor.index,f=n[n.length-1].descriptor.index,h=e?f:f+1;return ch?null:c},AT=({isMovingForward:t,isInHomeList:e,draggable:n,draggables:r,destination:i,insideDestination:c,previousImpact:d,viewport:f,afterCritical:h})=>{const p=d.at;if(p||fe(),p.type==="REORDER"){const y=jT({isMovingForward:t,isInHomeList:e,location:p.destination,insideDestination:c});return y==null?null:Vd({draggable:n,insideDestination:c,destination:i,viewport:f,last:d.displaced,displacedBy:d.displacedBy,index:y})}const b=ST({isMovingForward:t,destination:i,displaced:d.displaced,draggables:r,combine:p.combine,afterCritical:h});return b==null?null:Vd({draggable:n,insideDestination:c,destination:i,viewport:f,last:d.displaced,displacedBy:d.displacedBy,index:b})},wT=({displaced:t,afterCritical:e,combineWith:n,displacedBy:r})=>{const i=!!(t.visible[n]||t.invisible[n]);return zs(n,e)?i?Mt:Yl(r.point):i?r.point:Mt},CT=({afterCritical:t,impact:e,draggables:n})=>{const r=yu(e);r||fe();const i=r.draggableId,c=n[i].page.borderBox.center,d=wT({displaced:e.displaced,afterCritical:t,combineWith:i,displacedBy:e.displacedBy});return Gt(c,d)};const mE=(t,e)=>e.margin[t.start]+e.borderBox[t.size]/2,DT=(t,e)=>e.margin[t.end]+e.borderBox[t.size]/2,Hg=(t,e,n)=>e[t.crossAxisStart]+n.margin[t.crossAxisStart]+n.borderBox[t.crossAxisSize]/2,jv=({axis:t,moveRelativeTo:e,isMoving:n})=>Cr(t.line,e.marginBox[t.end]+mE(t,n),Hg(t,e.marginBox,n)),Av=({axis:t,moveRelativeTo:e,isMoving:n})=>Cr(t.line,e.marginBox[t.start]-DT(t,n),Hg(t,e.marginBox,n)),OT=({axis:t,moveInto:e,isMoving:n})=>Cr(t.line,e.contentBox[t.start]+mE(t,n),Hg(t,e.contentBox,n));var RT=({impact:t,draggable:e,draggables:n,droppable:r,afterCritical:i})=>{const c=Ql(r.descriptor.id,n),d=e.page,f=r.axis;if(!c.length)return OT({axis:f,moveInto:r.page,isMoving:d});const{displaced:h,displacedBy:p}=t,b=h.all[0];if(b){const m=n[b];if(zs(b,i))return Av({axis:f,moveRelativeTo:m.page,isMoving:d});const v=Pd(m.page,p.point);return Av({axis:f,moveRelativeTo:v,isMoving:d})}const y=c[c.length-1];if(y.descriptor.id===e.descriptor.id)return d.borderBox.center;if(zs(y.descriptor.id,i)){const m=Pd(y.page,Yl(i.displacedBy.point));return jv({axis:f,moveRelativeTo:m,isMoving:d})}return jv({axis:f,moveRelativeTo:y.page,isMoving:d})},Vp=(t,e)=>{const n=t.frame;return n?Gt(e,n.scroll.diff.displacement):e};const TT=({impact:t,draggable:e,droppable:n,draggables:r,afterCritical:i})=>{const c=e.page.borderBox.center,d=t.at;return!n||!d?c:d.type==="REORDER"?RT({impact:t,draggable:e,draggables:r,droppable:n,afterCritical:i}):CT({impact:t,draggables:r,afterCritical:i})};var Nu=t=>{const e=TT(t),n=t.droppable;return n?Vp(n,e):e},xE=(t,e)=>{const n=Sn(e,t.scroll.initial),r=Yl(n);return{frame:Jn({top:e.y,bottom:e.y+t.frame.height,left:e.x,right:e.x+t.frame.width}),scroll:{initial:t.scroll.initial,max:t.scroll.max,current:e,diff:{value:n,displacement:r}}}};function wv(t,e){return t.map(n=>e[n])}function kT(t,e){for(let n=0;n{const c=xE(e,Gt(e.scroll.current,i)),d=n.frame?zg(n,Gt(n.frame.scroll.current,i)):n,f=t.displaced,h=mo({afterDragging:wv(f.all,r),destination:n,displacedBy:t.displacedBy,viewport:c.frame,last:f,forceShouldAnimate:!1}),p=mo({afterDragging:wv(f.all,r),destination:d,displacedBy:t.displacedBy,viewport:e.frame,last:f,forceShouldAnimate:!1}),b={},y={},m=[f,h,p];return f.all.forEach(N=>{const S=kT(N,m);if(S){y[N]=S;return}b[N]=!0}),{...t,displaced:{all:f.all,invisible:b,visible:y}}},MT=(t,e)=>Gt(t.scroll.diff.displacement,e),Gg=({pageBorderBoxCenter:t,draggable:e,viewport:n})=>{const r=MT(n,t),i=Sn(r,e.page.borderBox.center);return Gt(e.client.borderBox.center,i)},bE=({draggable:t,destination:e,newPageBorderBoxCenter:n,viewport:r,withDroppableDisplacement:i,onlyOnMainAxis:c=!1})=>{const d=Sn(n,t.page.borderBox.center),h={target:Po(t.page.borderBox,d),destination:e,withDroppableDisplacement:i,viewport:r};return c?yT(h):gE(h)},IT=({isMovingForward:t,draggable:e,destination:n,draggables:r,previousImpact:i,viewport:c,previousPageBorderBoxCenter:d,previousClientSelection:f,afterCritical:h})=>{if(!n.isEnabled)return null;const p=Ql(n.descriptor.id,r),b=Wl(e,n),y=uT({isMovingForward:t,draggable:e,destination:n,insideDestination:p,previousImpact:i})||AT({isMovingForward:t,isInHomeList:b,draggable:e,draggables:r,destination:n,insideDestination:p,previousImpact:i,viewport:c,afterCritical:h});if(!y)return null;const m=Nu({impact:y,draggable:e,droppable:n,draggables:r,afterCritical:h});if(bE({draggable:e,destination:n,newPageBorderBoxCenter:m,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:Gg({pageBorderBoxCenter:m,draggable:e,viewport:c}),impact:y,scrollJumpRequest:null};const N=Sn(m,d),S=_T({impact:y,viewport:c,destination:n,draggables:r,maxScrollChange:N});return{clientSelection:f,impact:S,scrollJumpRequest:N}};const Qt=t=>{const e=t.subject.active;return e||fe(),e};var LT=({isMovingForward:t,pageBorderBoxCenter:e,source:n,droppables:r,viewport:i})=>{const c=n.subject.active;if(!c)return null;const d=n.axis,f=qn(c[d.start],c[d.end]),h=bu(r).filter(b=>b!==n).filter(b=>b.isEnabled).filter(b=>!!b.subject.active).filter(b=>hE(i.frame)(Qt(b))).filter(b=>{const y=Qt(b);return t?c[d.crossAxisEnd]{const y=Qt(b),m=qn(y[d.start],y[d.end]);return f(y[d.start])||f(y[d.end])||m(c[d.start])||m(c[d.end])}).sort((b,y)=>{const m=Qt(b)[d.crossAxisStart],v=Qt(y)[d.crossAxisStart];return t?m-v:v-m}).filter((b,y,m)=>Qt(b)[d.crossAxisStart]===Qt(m[0])[d.crossAxisStart]);if(!h.length)return null;if(h.length===1)return h[0];const p=h.filter(b=>qn(Qt(b)[d.start],Qt(b)[d.end])(e[d.line]));return p.length===1?p[0]:p.length>1?p.sort((b,y)=>Qt(b)[d.start]-Qt(y)[d.start])[0]:h.sort((b,y)=>{const m=Nv(e,Ev(Qt(b))),v=Nv(e,Ev(Qt(y)));return m!==v?m-v:Qt(b)[d.start]-Qt(y)[d.start]})[0]};const Cv=(t,e)=>{const n=t.page.borderBox.center;return zs(t.descriptor.id,e)?Sn(n,e.displacedBy.point):n},zT=(t,e)=>{const n=t.page.borderBox;return zs(t.descriptor.id,e)?Po(n,Yl(e.displacedBy.point)):n};var PT=({pageBorderBoxCenter:t,viewport:e,destination:n,insideDestination:r,afterCritical:i})=>r.filter(d=>gE({target:zT(d,i),destination:n,viewport:e.frame,withDroppableDisplacement:!0})).sort((d,f)=>{const h=po(t,Vp(n,Cv(d,i))),p=po(t,Vp(n,Cv(f,i)));return h{const r=t.axis;if(t.descriptor.mode==="virtual")return Cr(r.line,e[r.line]);const i=t.subject.page.contentBox[r.size],h=Ql(t.descriptor.id,n).reduce((p,b)=>p+b.client.marginBox[r.size],0)+e[r.line]-i;return h<=0?null:Cr(r.line,h)},yE=(t,e)=>({...t,scroll:{...t.scroll,max:e}}),vE=(t,e,n)=>{const r=t.frame;Wl(e,t)&&fe(),t.subject.withPlaceholder&&fe();const i=Uo(t.axis,e.displaceBy).point,c=UT(t,i,n),d={placeholderSize:i,increasedBy:c,oldFrameMaxScroll:t.frame?t.frame.scroll.max:null};if(!r){const b=zl({page:t.subject.page,withPlaceholder:d,axis:t.axis,frame:t.frame});return{...t,subject:b}}const f=c?Gt(r.scroll.max,c):r.scroll.max,h=yE(r,f),p=zl({page:t.subject.page,withPlaceholder:d,axis:t.axis,frame:h});return{...t,subject:p,frame:h}},BT=t=>{const e=t.subject.withPlaceholder;e||fe();const n=t.frame;if(!n){const d=zl({page:t.subject.page,axis:t.axis,frame:null,withPlaceholder:null});return{...t,subject:d}}const r=e.oldFrameMaxScroll;r||fe();const i=yE(n,r),c=zl({page:t.subject.page,axis:t.axis,frame:i,withPlaceholder:null});return{...t,subject:c,frame:i}};var HT=({previousPageBorderBoxCenter:t,moveRelativeTo:e,insideDestination:n,draggable:r,draggables:i,destination:c,viewport:d,afterCritical:f})=>{if(!e){if(n.length)return null;const y={displaced:go,displacedBy:fE,at:{type:"REORDER",destination:{droppableId:c.descriptor.id,index:0}}},m=Nu({impact:y,draggable:r,droppable:c,draggables:i,afterCritical:f}),v=Wl(r,c)?c:vE(c,r,i);return bE({draggable:r,destination:v,newPageBorderBoxCenter:m,viewport:d.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?y:null}const h=t[c.axis.line]<=e.page.borderBox.center[c.axis.line],p=(()=>{const y=e.descriptor.index;return e.descriptor.id===r.descriptor.id||h?y:y+1})(),b=Uo(c.axis,r.displaceBy);return Vd({draggable:r,insideDestination:n,destination:c,viewport:d,displacedBy:b,last:go,index:p})},GT=({isMovingForward:t,previousPageBorderBoxCenter:e,draggable:n,isOver:r,draggables:i,droppables:c,viewport:d,afterCritical:f})=>{const h=LT({isMovingForward:t,pageBorderBoxCenter:e,source:r,droppables:c,viewport:d});if(!h)return null;const p=Ql(h.descriptor.id,i),b=PT({pageBorderBoxCenter:e,viewport:d,destination:h,insideDestination:p,afterCritical:f}),y=HT({previousPageBorderBoxCenter:e,destination:h,draggable:n,draggables:i,moveRelativeTo:b,insideDestination:p,viewport:d,afterCritical:f});if(!y)return null;const m=Nu({impact:y,draggable:n,droppable:h,draggables:i,afterCritical:f});return{clientSelection:Gg({pageBorderBoxCenter:m,draggable:n,viewport:d}),impact:y,scrollJumpRequest:null}},jn=t=>{const e=t.at;return e?e.type==="REORDER"?e.destination.droppableId:e.combine.droppableId:null};const VT=(t,e)=>{const n=jn(t);return n?e[n]:null};var FT=({state:t,type:e})=>{const n=VT(t.impact,t.dimensions.droppables),r=!!n,i=t.dimensions.droppables[t.critical.droppable.id],c=n||i,d=c.axis.direction,f=d==="vertical"&&(e==="MOVE_UP"||e==="MOVE_DOWN")||d==="horizontal"&&(e==="MOVE_LEFT"||e==="MOVE_RIGHT");if(f&&!r)return null;const h=e==="MOVE_DOWN"||e==="MOVE_RIGHT",p=t.dimensions.draggables[t.critical.draggable.id],b=t.current.page.borderBoxCenter,{draggables:y,droppables:m}=t.dimensions;return f?IT({isMovingForward:h,previousPageBorderBoxCenter:b,draggable:p,destination:c,draggables:y,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):GT({isMovingForward:h,previousPageBorderBoxCenter:b,draggable:p,isOver:c,draggables:y,droppables:m,viewport:t.viewport,afterCritical:t.afterCritical})};function ir(t){return t.phase==="DRAGGING"||t.phase==="COLLECTING"}function NE(t){const e=qn(t.top,t.bottom),n=qn(t.left,t.right);return function(i){return e(i.y)&&n(i.x)}}function qT(t,e){return t.lefte.left&&t.tope.top}function $T({pageBorderBox:t,draggable:e,candidates:n}){const r=e.page.borderBox.center,i=n.map(c=>{const d=c.axis,f=Cr(c.axis.line,t.center[d.line],c.page.borderBox.center[d.crossAxisLine]);return{id:c.descriptor.id,distance:po(r,f)}}).sort((c,d)=>d.distance-c.distance);return i[0]?i[0].id:null}function YT({pageBorderBox:t,draggable:e,droppables:n}){const r=bu(n).filter(i=>{if(!i.isEnabled)return!1;const c=i.subject.active;if(!c||!qT(t,c))return!1;if(NE(c)(t.center))return!0;const d=i.axis,f=c.center[d.crossAxisLine],h=t[d.crossAxisStart],p=t[d.crossAxisEnd],b=qn(c[d.crossAxisStart],c[d.crossAxisEnd]),y=b(h),m=b(p);return!y&&!m?!0:y?hf});return r.length?r.length===1?r[0].descriptor.id:$T({pageBorderBox:t,draggable:e,candidates:r}):null}const EE=(t,e)=>Jn(Po(t,e));var QT=(t,e)=>{const n=t.frame;return n?EE(e,n.scroll.diff.value):e};function SE({displaced:t,id:e}){return!!(t.visible[e]||t.invisible[e])}function WT({draggable:t,closest:e,inHomeList:n}){return e?n&&e.descriptor.index>t.descriptor.index?e.descriptor.index-1:e.descriptor.index:null}var XT=({pageBorderBoxWithDroppableScroll:t,draggable:e,destination:n,insideDestination:r,last:i,viewport:c,afterCritical:d})=>{const f=n.axis,h=Uo(n.axis,e.displaceBy),p=h.value,b=t[f.start],y=t[f.end],v=vu(e,r).find(S=>{const j=S.descriptor.id,R=S.page.borderBox.center[f.line],C=zs(j,d),O=SE({displaced:i,id:j});return C?O?y<=R:b{if(!r.isCombineEnabled)return null;const d=r.axis,f=Uo(r.axis,t.displaceBy),h=f.value,p=e[d.start],b=e[d.end],m=vu(t,i).find(N=>{const S=N.descriptor.id,j=N.page.borderBox,C=j[d.size]/ZT,O=zs(S,c),A=SE({displaced:n.displaced,id:S});return O?A?b>j[d.start]+C&&bj[d.start]-h+C&&pj[d.start]+h+C&&bj[d.start]+C&&p{const f=EE(e.page.borderBox,t),h=YT({pageBorderBox:f,draggable:e,droppables:r});if(!h)return fT;const p=r[h],b=Ql(p.descriptor.id,n),y=QT(p,f);return KT({pageBorderBoxWithDroppableScroll:y,draggable:e,previousImpact:i,destination:p,insideDestination:b,afterCritical:d})||XT({pageBorderBoxWithDroppableScroll:y,draggable:e,destination:p,insideDestination:b,last:i.displaced,viewport:c,afterCritical:d})},Vg=(t,e)=>({...t,[e.descriptor.id]:e});const JT=({previousImpact:t,impact:e,droppables:n})=>{const r=jn(t),i=jn(e);if(!r||r===i)return n;const c=n[r];if(!c.subject.withPlaceholder)return n;const d=BT(c);return Vg(n,d)};var ek=({draggable:t,draggables:e,droppables:n,previousImpact:r,impact:i})=>{const c=JT({previousImpact:r,impact:i,droppables:n}),d=jn(i);if(!d)return c;const f=n[d];if(Wl(t,f)||f.subject.withPlaceholder)return c;const h=vE(f,t,e);return Vg(c,h)},ro=({state:t,clientSelection:e,dimensions:n,viewport:r,impact:i,scrollJumpRequest:c})=>{const d=r||t.viewport,f=n||t.dimensions,h=e||t.current.client.selection,p=Sn(h,t.initial.client.selection),b={offset:p,selection:h,borderBoxCenter:Gt(t.initial.client.borderBoxCenter,p)},y={selection:Gt(b.selection,d.scroll.current),borderBoxCenter:Gt(b.borderBoxCenter,d.scroll.current),offset:Gt(b.offset,d.scroll.diff.value)},m={client:b,page:y};if(t.phase==="COLLECTING")return{...t,dimensions:f,viewport:d,current:m};const v=f.draggables[t.critical.draggable.id],N=i||jE({pageOffset:y.offset,draggable:v,draggables:f.draggables,droppables:f.droppables,previousImpact:t.impact,viewport:d,afterCritical:t.afterCritical}),S=ek({draggable:v,impact:N,previousImpact:t.impact,draggables:f.draggables,droppables:f.droppables});return{...t,current:m,dimensions:{draggables:f.draggables,droppables:S},impact:N,viewport:d,scrollJumpRequest:c||null,forceShouldAnimate:c?!1:null}};function tk(t,e){return t.map(n=>e[n])}var AE=({impact:t,viewport:e,draggables:n,destination:r,forceShouldAnimate:i})=>{const c=t.displaced,d=tk(c.all,n),f=mo({afterDragging:d,destination:r,displacedBy:t.displacedBy,viewport:e.frame,forceShouldAnimate:i,last:c});return{...t,displaced:f}},wE=({impact:t,draggable:e,droppable:n,draggables:r,viewport:i,afterCritical:c})=>{const d=Nu({impact:t,draggable:e,draggables:r,droppable:n,afterCritical:c});return Gg({pageBorderBoxCenter:d,draggable:e,viewport:i})},CE=({state:t,dimensions:e,viewport:n})=>{t.movementMode!=="SNAP"&&fe();const r=t.impact,i=n||t.viewport,c=e||t.dimensions,{draggables:d,droppables:f}=c,h=d[t.critical.draggable.id],p=jn(r);p||fe();const b=f[p],y=AE({impact:r,viewport:i,destination:b,draggables:d}),m=wE({impact:y,draggable:h,droppable:b,draggables:d,viewport:i,afterCritical:t.afterCritical});return ro({impact:y,clientSelection:m,state:t,dimensions:c,viewport:i})},nk=t=>({index:t.index,droppableId:t.droppableId}),DE=({draggable:t,home:e,draggables:n,viewport:r})=>{const i=Uo(e.axis,t.displaceBy),c=Ql(e.descriptor.id,n),d=c.indexOf(t);d===-1&&fe();const f=c.slice(d+1),h=f.reduce((m,v)=>(m[v.descriptor.id]=!0,m),{}),p={inVirtualList:e.descriptor.mode==="virtual",displacedBy:i,effected:h};return{impact:{displaced:mo({afterDragging:f,destination:e,displacedBy:i,last:null,viewport:r.frame,forceShouldAnimate:!1}),displacedBy:i,at:{type:"REORDER",destination:nk(t.descriptor)}},afterCritical:p}},ak=(t,e)=>({draggables:t.draggables,droppables:Vg(t.droppables,e)}),sk=({draggable:t,offset:e,initialWindowScroll:n})=>{const r=Pd(t.client,e),i=Ud(r,n);return{...t,placeholder:{...t.placeholder,client:r},client:r,page:i}},rk=t=>{const e=t.frame;return e||fe(),e},lk=({additions:t,updatedDroppables:e,viewport:n})=>{const r=n.scroll.diff.value;return t.map(i=>{const c=i.descriptor.droppableId,d=e[c],h=rk(d).scroll.diff.value,p=Gt(r,h);return sk({draggable:i,offset:p,initialWindowScroll:n.scroll.initial})})},ik=({state:t,published:e})=>{const n=e.modified.map(R=>{const C=t.dimensions.droppables[R.droppableId];return zg(C,R.scroll)}),r={...t.dimensions.droppables,...dE(n)},i=uE(lk({additions:e.additions,updatedDroppables:r,viewport:t.viewport})),c={...t.dimensions.draggables,...i};e.removals.forEach(R=>{delete c[R]});const d={droppables:r,draggables:c},f=jn(t.impact),h=f?d.droppables[f]:null,p=d.draggables[t.critical.draggable.id],b=d.droppables[t.critical.droppable.id],{impact:y,afterCritical:m}=DE({draggable:p,home:b,draggables:c,viewport:t.viewport}),v=h&&h.isCombineEnabled?t.impact:y,N=jE({pageOffset:t.current.page.offset,draggable:d.draggables[t.critical.draggable.id],draggables:d.draggables,droppables:d.droppables,previousImpact:v,viewport:t.viewport,afterCritical:m}),S={...t,phase:"DRAGGING",impact:N,onLiftImpact:y,dimensions:d,afterCritical:m,forceShouldAnimate:!1};return t.phase==="COLLECTING"?S:{...S,phase:"DROP_PENDING",reason:t.reason,isWaiting:!1}};const Fp=t=>t.movementMode==="SNAP",dp=(t,e,n)=>{const r=ak(t.dimensions,e);return!Fp(t)||n?ro({state:t,dimensions:r}):CE({state:t,dimensions:r})};function up(t){return t.isDragging&&t.movementMode==="SNAP"?{...t,scrollJumpRequest:null}:t}const Dv={phase:"IDLE",completed:null,shouldFlush:!1};var ok=(t=Dv,e)=>{if(e.type==="FLUSH")return{...Dv,shouldFlush:!0};if(e.type==="INITIAL_PUBLISH"){t.phase!=="IDLE"&&fe();const{critical:n,clientSelection:r,viewport:i,dimensions:c,movementMode:d}=e.payload,f=c.draggables[n.draggable.id],h=c.droppables[n.droppable.id],p={selection:r,borderBoxCenter:f.client.borderBox.center,offset:Mt},b={client:p,page:{selection:Gt(p.selection,i.scroll.initial),borderBoxCenter:Gt(p.selection,i.scroll.initial),offset:Gt(p.selection,i.scroll.diff.value)}},y=bu(c.droppables).every(S=>!S.isFixedOnPage),{impact:m,afterCritical:v}=DE({draggable:f,home:h,draggables:c.draggables,viewport:i});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:d,dimensions:c,initial:b,current:b,isWindowScrollAllowed:y,impact:m,afterCritical:v,onLiftImpact:m,viewport:i,scrollJumpRequest:null,forceShouldAnimate:null}}if(e.type==="COLLECTION_STARTING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"?t:(t.phase!=="DRAGGING"&&fe(),{...t,phase:"COLLECTING"});if(e.type==="PUBLISH_WHILE_DRAGGING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"||fe(),ik({state:t,published:e.payload});if(e.type==="MOVE"){if(t.phase==="DROP_PENDING")return t;ir(t)||fe();const{client:n}=e.payload;return _s(n,t.current.client.selection)?t:ro({state:t,clientSelection:n,impact:Fp(t)?t.impact:null})}if(e.type==="UPDATE_DROPPABLE_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="COLLECTING")return up(t);ir(t)||fe();const{id:n,newScroll:r}=e.payload,i=t.dimensions.droppables[n];if(!i)return t;const c=zg(i,r);return dp(t,c,!1)}if(e.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(t.phase==="DROP_PENDING")return t;ir(t)||fe();const{id:n,isEnabled:r}=e.payload,i=t.dimensions.droppables[n];i||fe(),i.isEnabled===r&&fe();const c={...i,isEnabled:r};return dp(t,c,!0)}if(e.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(t.phase==="DROP_PENDING")return t;ir(t)||fe();const{id:n,isCombineEnabled:r}=e.payload,i=t.dimensions.droppables[n];i||fe(),i.isCombineEnabled===r&&fe();const c={...i,isCombineEnabled:r};return dp(t,c,!0)}if(e.type==="MOVE_BY_WINDOW_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="DROP_ANIMATING")return t;ir(t)||fe(),t.isWindowScrollAllowed||fe();const n=e.payload.newScroll;if(_s(t.viewport.scroll.current,n))return up(t);const r=xE(t.viewport,n);return Fp(t)?CE({state:t,viewport:r}):ro({state:t,viewport:r})}if(e.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!ir(t))return t;const n=e.payload.maxScroll;if(_s(n,t.viewport.scroll.max))return t;const r={...t.viewport,scroll:{...t.viewport.scroll,max:n}};return{...t,viewport:r}}if(e.type==="MOVE_UP"||e.type==="MOVE_DOWN"||e.type==="MOVE_LEFT"||e.type==="MOVE_RIGHT"){if(t.phase==="COLLECTING"||t.phase==="DROP_PENDING")return t;t.phase!=="DRAGGING"&&fe();const n=FT({state:t,type:e.type});return n?ro({state:t,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):t}if(e.type==="DROP_PENDING"){const n=e.payload.reason;return t.phase!=="COLLECTING"&&fe(),{...t,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(e.type==="DROP_ANIMATE"){const{completed:n,dropDuration:r,newHomeClientOffset:i}=e.payload;return t.phase==="DRAGGING"||t.phase==="DROP_PENDING"||fe(),{phase:"DROP_ANIMATING",completed:n,dropDuration:r,newHomeClientOffset:i,dimensions:t.dimensions}}if(e.type==="DROP_COMPLETE"){const{completed:n}=e.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return t};function Xe(t,e){return t instanceof Object&&"type"in t&&t.type===e}const ck=t=>({type:"BEFORE_INITIAL_CAPTURE",payload:t}),dk=t=>({type:"LIFT",payload:t}),uk=t=>({type:"INITIAL_PUBLISH",payload:t}),fk=t=>({type:"PUBLISH_WHILE_DRAGGING",payload:t}),hk=()=>({type:"COLLECTION_STARTING",payload:null}),pk=t=>({type:"UPDATE_DROPPABLE_SCROLL",payload:t}),gk=t=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:t}),mk=t=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:t}),OE=t=>({type:"MOVE",payload:t}),xk=t=>({type:"MOVE_BY_WINDOW_SCROLL",payload:t}),bk=t=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:t}),yk=()=>({type:"MOVE_UP",payload:null}),vk=()=>({type:"MOVE_DOWN",payload:null}),Nk=()=>({type:"MOVE_RIGHT",payload:null}),Ek=()=>({type:"MOVE_LEFT",payload:null}),Fg=()=>({type:"FLUSH",payload:null}),Sk=t=>({type:"DROP_ANIMATE",payload:t}),qg=t=>({type:"DROP_COMPLETE",payload:t}),RE=t=>({type:"DROP",payload:t}),jk=t=>({type:"DROP_PENDING",payload:t}),TE=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var Ak=t=>({getState:e,dispatch:n})=>r=>i=>{if(!Xe(i,"LIFT")){r(i);return}const{id:c,clientSelection:d,movementMode:f}=i.payload,h=e();h.phase==="DROP_ANIMATING"&&n(qg({completed:h.completed})),e().phase!=="IDLE"&&fe(),n(Fg()),n(ck({draggableId:c,movementMode:f}));const b={draggableId:c,scrollOptions:{shouldPublishImmediately:f==="SNAP"}},{critical:y,dimensions:m,viewport:v}=t.startPublishing(b);n(uk({critical:y,dimensions:m,clientSelection:d,movementMode:f,viewport:v}))},wk=t=>()=>e=>n=>{Xe(n,"INITIAL_PUBLISH")&&t.dragging(),Xe(n,"DROP_ANIMATE")&&t.dropping(n.payload.completed.result.reason),(Xe(n,"FLUSH")||Xe(n,"DROP_COMPLETE"))&&t.resting(),e(n)};const $g={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},xo={opacity:{drop:0,combining:.7},scale:{drop:.75}},kE={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},lr=`${kE.outOfTheWay}s ${$g.outOfTheWay}`,lo={fluid:`opacity ${lr}`,snap:`transform ${lr}, opacity ${lr}`,drop:t=>{const e=`${t}s ${$g.drop}`;return`transform ${e}, opacity ${e}`},outOfTheWay:`transform ${lr}`,placeholder:`height ${lr}, width ${lr}, margin ${lr}`},Ov=t=>_s(t,Mt)?void 0:`translate(${t.x}px, ${t.y}px)`,qp={moveTo:Ov,drop:(t,e)=>{const n=Ov(t);if(n)return e?`${n} scale(${xo.scale.drop})`:n}},{minDropTime:$p,maxDropTime:_E}=kE,Ck=_E-$p,Rv=1500,Dk=.6;var Ok=({current:t,destination:e,reason:n})=>{const r=po(t,e);if(r<=0)return $p;if(r>=Rv)return _E;const i=r/Rv,c=$p+Ck*i,d=n==="CANCEL"?c*Dk:c;return Number(d.toFixed(2))},Rk=({impact:t,draggable:e,dimensions:n,viewport:r,afterCritical:i})=>{const{draggables:c,droppables:d}=n,f=jn(t),h=f?d[f]:null,p=d[e.descriptor.droppableId],b=wE({impact:t,draggable:e,draggables:c,afterCritical:i,droppable:h||p,viewport:r});return Sn(b,e.client.borderBox.center)},Tk=({draggables:t,reason:e,lastImpact:n,home:r,viewport:i,onLiftImpact:c})=>!n.at||e!=="DROP"?{impact:AE({draggables:t,impact:c,destination:r,viewport:i,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:go},didDropInsideDroppable:!0};const kk=({getState:t,dispatch:e})=>n=>r=>{if(!Xe(r,"DROP")){n(r);return}const i=t(),c=r.payload.reason;if(i.phase==="COLLECTING"){e(jk({reason:c}));return}if(i.phase==="IDLE")return;i.phase==="DROP_PENDING"&&i.isWaiting&&fe(),i.phase==="DRAGGING"||i.phase==="DROP_PENDING"||fe();const f=i.critical,h=i.dimensions,p=h.draggables[i.critical.draggable.id],{impact:b,didDropInsideDroppable:y}=Tk({reason:c,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),m=y?Pg(b):null,v=y?yu(b):null,N={index:f.draggable.index,droppableId:f.droppable.id},S={draggableId:p.descriptor.id,type:p.descriptor.type,source:N,reason:c,mode:i.movementMode,destination:m,combine:v},j=Rk({impact:b,draggable:p,dimensions:h,viewport:i.viewport,afterCritical:i.afterCritical}),R={critical:i.critical,afterCritical:i.afterCritical,result:S,impact:b};if(!(!_s(i.current.client.offset,j)||!!S.combine)){e(qg({completed:R}));return}const O=Ok({current:i.current.client.offset,destination:j,reason:c});e(Sk({newHomeClientOffset:j,dropDuration:O,completed:R}))};var ME=()=>({x:window.pageXOffset,y:window.pageYOffset});function _k(t){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:e=>{e.target!==window&&e.target!==window.document||t()}}}function Mk({onWindowScroll:t}){function e(){t(ME())}const n=ho(e),r=_k(n);let i=ks;function c(){return i!==ks}function d(){c()&&fe(),i=Fn(window,[r])}function f(){c()||fe(),n.cancel(),i(),i=ks}return{start:d,stop:f,isActive:c}}const Ik=t=>Xe(t,"DROP_COMPLETE")||Xe(t,"DROP_ANIMATE")||Xe(t,"FLUSH"),Lk=t=>{const e=Mk({onWindowScroll:n=>{t.dispatch(xk({newScroll:n}))}});return n=>r=>{!e.isActive()&&Xe(r,"INITIAL_PUBLISH")&&e.start(),e.isActive()&&Ik(r)&&e.stop(),n(r)}};var zk=t=>{let e=!1,n=!1;const r=setTimeout(()=>{n=!0}),i=c=>{e||n||(e=!0,t(c),clearTimeout(r))};return i.wasCalled=()=>e,i},Pk=()=>{const t=[],e=i=>{const c=t.findIndex(f=>f.timerId===i);c===-1&&fe();const[d]=t.splice(c,1);d.callback()};return{add:i=>{const c=setTimeout(()=>e(c)),d={timerId:c,callback:i};t.push(d)},flush:()=>{if(!t.length)return;const i=[...t];t.length=0,i.forEach(c=>{clearTimeout(c.timerId),c.callback()})}}};const Uk=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.droppableId===e.droppableId&&t.index===e.index,Bk=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.draggableId===e.draggableId&&t.droppableId===e.droppableId,Hk=(t,e)=>{if(t===e)return!0;const n=t.draggable.id===e.draggable.id&&t.draggable.droppableId===e.draggable.droppableId&&t.draggable.type===e.draggable.type&&t.draggable.index===e.draggable.index,r=t.droppable.id===e.droppable.id&&t.droppable.type===e.droppable.type;return n&&r},Wi=(t,e)=>{e()},dd=(t,e)=>({draggableId:t.draggable.id,type:t.droppable.type,source:{droppableId:t.droppable.id,index:t.draggable.index},mode:e});function fp(t,e,n,r){if(!t){n(r(e));return}const i=zk(n);t(e,{announce:i}),i.wasCalled()||n(r(e))}var Gk=(t,e)=>{const n=Pk();let r=null;const i=(y,m)=>{r&&fe(),Wi("onBeforeCapture",()=>{const v=t().onBeforeCapture;v&&v({draggableId:y,mode:m})})},c=(y,m)=>{r&&fe(),Wi("onBeforeDragStart",()=>{const v=t().onBeforeDragStart;v&&v(dd(y,m))})},d=(y,m)=>{r&&fe();const v=dd(y,m);r={mode:m,lastCritical:y,lastLocation:v.source,lastCombine:null},n.add(()=>{Wi("onDragStart",()=>fp(t().onDragStart,v,e,wd.onDragStart))})},f=(y,m)=>{const v=Pg(m),N=yu(m);r||fe();const S=!Hk(y,r.lastCritical);S&&(r.lastCritical=y);const j=!Uk(r.lastLocation,v);j&&(r.lastLocation=v);const R=!Bk(r.lastCombine,N);if(R&&(r.lastCombine=N),!S&&!j&&!R)return;const C={...dd(y,r.mode),combine:N,destination:v};n.add(()=>{Wi("onDragUpdate",()=>fp(t().onDragUpdate,C,e,wd.onDragUpdate))})},h=()=>{r||fe(),n.flush()},p=y=>{r||fe(),r=null,Wi("onDragEnd",()=>fp(t().onDragEnd,y,e,wd.onDragEnd))};return{beforeCapture:i,beforeStart:c,start:d,update:f,flush:h,drop:p,abort:()=>{if(!r)return;const y={...dd(r.lastCritical,r.mode),combine:null,destination:null,reason:"CANCEL"};p(y)}}},Vk=(t,e)=>{const n=Gk(t,e);return r=>i=>c=>{if(Xe(c,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(c.payload.draggableId,c.payload.movementMode);return}if(Xe(c,"INITIAL_PUBLISH")){const f=c.payload.critical;n.beforeStart(f,c.payload.movementMode),i(c),n.start(f,c.payload.movementMode);return}if(Xe(c,"DROP_COMPLETE")){const f=c.payload.completed.result;n.flush(),i(c),n.drop(f);return}if(i(c),Xe(c,"FLUSH")){n.abort();return}const d=r.getState();d.phase==="DRAGGING"&&n.update(d.critical,d.impact)}};const Fk=t=>e=>n=>{if(!Xe(n,"DROP_ANIMATION_FINISHED")){e(n);return}const r=t.getState();r.phase!=="DROP_ANIMATING"&&fe(),t.dispatch(qg({completed:r.completed}))},qk=t=>{let e=null,n=null;function r(){n&&(cancelAnimationFrame(n),n=null),e&&(e(),e=null)}return i=>c=>{if((Xe(c,"FLUSH")||Xe(c,"DROP_COMPLETE")||Xe(c,"DROP_ANIMATION_FINISHED"))&&r(),i(c),!Xe(c,"DROP_ANIMATE"))return;const d={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){t.getState().phase==="DROP_ANIMATING"&&t.dispatch(TE())}};n=requestAnimationFrame(()=>{n=null,e=Fn(window,[d])})}};var $k=t=>()=>e=>n=>{(Xe(n,"DROP_COMPLETE")||Xe(n,"FLUSH")||Xe(n,"DROP_ANIMATE"))&&t.stopPublishing(),e(n)},Yk=t=>{let e=!1;return()=>n=>r=>{if(Xe(r,"INITIAL_PUBLISH")){e=!0,t.tryRecordFocus(r.payload.critical.draggable.id),n(r),t.tryRestoreFocusRecorded();return}if(n(r),!!e){if(Xe(r,"FLUSH")){e=!1,t.tryRestoreFocusRecorded();return}if(Xe(r,"DROP_COMPLETE")){e=!1;const i=r.payload.completed.result;i.combine&&t.tryShiftRecord(i.draggableId,i.combine.draggableId),t.tryRestoreFocusRecorded()}}}};const Qk=t=>Xe(t,"DROP_COMPLETE")||Xe(t,"DROP_ANIMATE")||Xe(t,"FLUSH");var Wk=t=>e=>n=>r=>{if(Qk(r)){t.stop(),n(r);return}if(Xe(r,"INITIAL_PUBLISH")){n(r);const i=e.getState();i.phase!=="DRAGGING"&&fe(),t.start(i);return}n(r),t.scroll(e.getState())};const Xk=t=>e=>n=>{if(e(n),!Xe(n,"PUBLISH_WHILE_DRAGGING"))return;const r=t.getState();r.phase==="DROP_PENDING"&&(r.isWaiting||t.dispatch(RE({reason:r.reason})))},Zk=XN;var Kk=({dimensionMarshal:t,focusMarshal:e,styleMarshal:n,getResponders:r,announce:i,autoScroller:c})=>WN(ok,Zk(ZO(wk(n),$k(t),Ak(t),kk,Fk,qk,Xk,Wk(c),Lk,Yk(e),Vk(r,i))));const hp=()=>({additions:{},removals:{},modified:{}});function Jk({registry:t,callbacks:e}){let n=hp(),r=null;const i=()=>{r||(e.collectionStarting(),r=requestAnimationFrame(()=>{r=null;const{additions:h,removals:p,modified:b}=n,y=Object.keys(h).map(N=>t.draggable.getById(N).getDimension(Mt)).sort((N,S)=>N.descriptor.index-S.descriptor.index),m=Object.keys(b).map(N=>{const j=t.droppable.getById(N).callbacks.getScrollWhileDragging();return{droppableId:N,scroll:j}}),v={additions:y,removals:Object.keys(p),modified:m};n=hp(),e.publish(v)}))};return{add:h=>{const p=h.descriptor.id;n.additions[p]=h,n.modified[h.descriptor.droppableId]=!0,n.removals[p]&&delete n.removals[p],i()},remove:h=>{const p=h.descriptor;n.removals[p.id]=!0,n.modified[p.droppableId]=!0,n.additions[p.id]&&delete n.additions[p.id],i()},stop:()=>{r&&(cancelAnimationFrame(r),r=null,n=hp())}}}var IE=({scrollHeight:t,scrollWidth:e,height:n,width:r})=>{const i=Sn({x:e,y:t},{x:r,y:n});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},LE=()=>{const t=document.documentElement;return t||fe(),t},zE=()=>{const t=LE();return IE({scrollHeight:t.scrollHeight,scrollWidth:t.scrollWidth,width:t.clientWidth,height:t.clientHeight})},e_=()=>{const t=ME(),e=zE(),n=t.y,r=t.x,i=LE(),c=i.clientWidth,d=i.clientHeight,f=r+c,h=n+d;return{frame:Jn({top:n,left:r,right:f,bottom:h}),scroll:{initial:t,current:t,max:e,diff:{value:Mt,displacement:Mt}}}},t_=({critical:t,scrollOptions:e,registry:n})=>{const r=e_(),i=r.scroll.current,c=t.droppable,d=n.droppable.getAllByType(c.type).map(b=>b.callbacks.getDimensionAndWatchScroll(i,e)),f=n.draggable.getAllByType(t.draggable.type).map(b=>b.getDimension(i));return{dimensions:{draggables:uE(f),droppables:dE(d)},critical:t,viewport:r}};function Tv(t,e,n){return!(n.descriptor.id===e.id||n.descriptor.type!==e.type||t.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual")}var n_=(t,e)=>{let n=null;const r=Jk({callbacks:{publish:e.publishWhileDragging,collectionStarting:e.collectionStarting},registry:t}),i=(m,v)=>{t.droppable.exists(m)||fe(),n&&e.updateDroppableIsEnabled({id:m,isEnabled:v})},c=(m,v)=>{n&&(t.droppable.exists(m)||fe(),e.updateDroppableIsCombineEnabled({id:m,isCombineEnabled:v}))},d=(m,v)=>{n&&(t.droppable.exists(m)||fe(),e.updateDroppableScroll({id:m,newScroll:v}))},f=(m,v)=>{n&&t.droppable.getById(m).callbacks.scroll(v)},h=()=>{if(!n)return;r.stop();const m=n.critical.droppable;t.droppable.getAllByType(m.type).forEach(v=>v.callbacks.dragStopped()),n.unsubscribe(),n=null},p=m=>{n||fe();const v=n.critical.draggable;m.type==="ADDITION"&&Tv(t,v,m.value)&&r.add(m.value),m.type==="REMOVAL"&&Tv(t,v,m.value)&&r.remove(m.value)};return{updateDroppableIsEnabled:i,updateDroppableIsCombineEnabled:c,scrollDroppable:f,updateDroppableScroll:d,startPublishing:m=>{n&&fe();const v=t.draggable.getById(m.draggableId),N=t.droppable.getById(v.descriptor.droppableId),S={draggable:v.descriptor,droppable:N.descriptor},j=t.subscribe(p);return n={critical:S,unsubscribe:j},t_({critical:S,registry:t,scrollOptions:m.scrollOptions})},stopPublishing:h}},PE=(t,e)=>t.phase==="IDLE"?!0:t.phase!=="DROP_ANIMATING"||t.completed.result.draggableId===e?!1:t.completed.result.reason==="DROP",a_=t=>{window.scrollBy(t.x,t.y)};const s_=kt(t=>bu(t).filter(e=>!(!e.isEnabled||!e.frame))),r_=(t,e)=>s_(e).find(r=>(r.frame||fe(),NE(r.frame.pageMarginBox)(t)))||null;var l_=({center:t,destination:e,droppables:n})=>{if(e){const i=n[e];return i.frame?i:null}return r_(t,n)};const bo={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:t=>t**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var i_=(t,e,n=()=>bo)=>{const r=n(),i=t[e.size]*r.startFromPercentage,c=t[e.size]*r.maxScrollAtPercentage;return{startScrollingFrom:i,maxScrollValueAt:c}},UE=({startOfRange:t,endOfRange:e,current:n})=>{const r=e-t;return r===0?0:(n-t)/r},Yg=1,o_=(t,e,n=()=>bo)=>{const r=n();if(t>e.startScrollingFrom)return 0;if(t<=e.maxScrollValueAt)return r.maxPixelScroll;if(t===e.startScrollingFrom)return Yg;const c=1-UE({startOfRange:e.maxScrollValueAt,endOfRange:e.startScrollingFrom,current:t}),d=r.maxPixelScroll*r.ease(c);return Math.ceil(d)},c_=(t,e,n)=>{const r=n(),i=r.durationDampening.accelerateAt,c=r.durationDampening.stopDampeningAt,d=e,f=c,p=Date.now()-d;if(p>=c)return t;if(p{const c=o_(t,e,i);return c===0?0:r?Math.max(c_(c,n,i),Yg):c},_v=({container:t,distanceToEdges:e,dragStartTime:n,axis:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const d=i_(t,r,c);return e[r.end]{const r=e.height>t.height,i=e.width>t.width;return!i&&!r?n:i&&r?null:{x:i?0:n.x,y:r?0:n.y}};const u_=cE(t=>t===0?0:t);var BE=({dragStartTime:t,container:e,subject:n,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const d={top:r.y-e.top,right:e.right-r.x,bottom:e.bottom-r.y,left:r.x-e.left},f=_v({container:e,distanceToEdges:d,dragStartTime:t,axis:Ug,shouldUseTimeDampening:i,getAutoScrollerOptions:c}),h=_v({container:e,distanceToEdges:d,dragStartTime:t,axis:pE,shouldUseTimeDampening:i,getAutoScrollerOptions:c}),p=u_({x:h,y:f});if(_s(p,Mt))return null;const b=d_({container:e,subject:n,proposedScroll:p});return b?_s(b,Mt)?null:b:null};const f_=cE(t=>t===0?0:t>0?1:-1),Qg=(()=>{const t=(e,n)=>e<0?e:e>n?e-n:0;return({current:e,max:n,change:r})=>{const i=Gt(e,r),c={x:t(i.x,n.x),y:t(i.y,n.y)};return _s(c,Mt)?null:c}})(),HE=({max:t,current:e,change:n})=>{const r={x:Math.max(e.x,t.x),y:Math.max(e.y,t.y)},i=f_(n),c=Qg({max:r,current:e,change:i});return!c||i.x!==0&&c.x===0||i.y!==0&&c.y===0},Wg=(t,e)=>HE({current:t.scroll.current,max:t.scroll.max,change:e}),h_=(t,e)=>{if(!Wg(t,e))return null;const n=t.scroll.max,r=t.scroll.current;return Qg({current:r,max:n,change:e})},Xg=(t,e)=>{const n=t.frame;return n?HE({current:n.scroll.current,max:n.scroll.max,change:e}):!1},p_=(t,e)=>{const n=t.frame;return!n||!Xg(t,e)?null:Qg({current:n.scroll.current,max:n.scroll.max,change:e})};var g_=({viewport:t,subject:e,center:n,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const d=BE({dragStartTime:r,container:t.frame,subject:e,center:n,shouldUseTimeDampening:i,getAutoScrollerOptions:c});return d&&Wg(t,d)?d:null},m_=({droppable:t,subject:e,center:n,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const d=t.frame;if(!d)return null;const f=BE({dragStartTime:r,container:d.pageMarginBox,subject:e,center:n,shouldUseTimeDampening:i,getAutoScrollerOptions:c});return f&&Xg(t,f)?f:null},Mv=({state:t,dragStartTime:e,shouldUseTimeDampening:n,scrollWindow:r,scrollDroppable:i,getAutoScrollerOptions:c})=>{const d=t.current.page.borderBoxCenter,h=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){const y=t.viewport,m=g_({dragStartTime:e,viewport:y,subject:h,center:d,shouldUseTimeDampening:n,getAutoScrollerOptions:c});if(m){r(m);return}}const p=l_({center:d,destination:jn(t.impact),droppables:t.dimensions.droppables});if(!p)return;const b=m_({dragStartTime:e,droppable:p,subject:h,center:d,shouldUseTimeDampening:n,getAutoScrollerOptions:c});b&&i(p.descriptor.id,b)},x_=({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n=()=>bo})=>{const r=ho(t),i=ho(e);let c=null;const d=p=>{c||fe();const{shouldUseTimeDampening:b,dragStartTime:y}=c;Mv({state:p,scrollWindow:r,scrollDroppable:i,dragStartTime:y,shouldUseTimeDampening:b,getAutoScrollerOptions:n})};return{start:p=>{c&&fe();const b=Date.now();let y=!1;const m=()=>{y=!0};Mv({state:p,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:m,scrollDroppable:m,getAutoScrollerOptions:n}),c={dragStartTime:b,shouldUseTimeDampening:y},y&&d(p)},stop:()=>{c&&(r.cancel(),i.cancel(),c=null)},scroll:d}},b_=({move:t,scrollDroppable:e,scrollWindow:n})=>{const r=(f,h)=>{const p=Gt(f.current.client.selection,h);t({client:p})},i=(f,h)=>{if(!Xg(f,h))return h;const p=p_(f,h);if(!p)return e(f.descriptor.id,h),null;const b=Sn(h,p);return e(f.descriptor.id,b),Sn(h,b)},c=(f,h,p)=>{if(!f||!Wg(h,p))return p;const b=h_(h,p);if(!b)return n(p),null;const y=Sn(p,b);return n(y),Sn(p,y)};return f=>{const h=f.scrollJumpRequest;if(!h)return;const p=jn(f.impact);p||fe();const b=i(f.dimensions.droppables[p],h);if(!b)return;const y=f.viewport,m=c(f.isWindowScrollAllowed,y,b);m&&r(f,m)}},y_=({scrollDroppable:t,scrollWindow:e,move:n,getAutoScrollerOptions:r})=>{const i=x_({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r}),c=b_({move:n,scrollWindow:e,scrollDroppable:t});return{scroll:h=>{if(!(r().disabled||h.phase!=="DRAGGING")){if(h.movementMode==="FLUID"){i.scroll(h);return}h.scrollJumpRequest&&c(h)}},start:i.start,stop:i.stop}};const Pl="data-rfd",Ul=(()=>{const t=`${Pl}-drag-handle`;return{base:t,draggableId:`${t}-draggable-id`,contextId:`${t}-context-id`}})(),Yp=(()=>{const t=`${Pl}-draggable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),v_=(()=>{const t=`${Pl}-droppable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),Iv={contextId:`${Pl}-scroll-container-context-id`},N_=t=>e=>`[${e}="${t}"]`,Xi=(t,e)=>t.map(n=>{const r=n.styles[e];return r?`${n.selector} { ${r} }`:""}).join(" "),E_="pointer-events: none;";var S_=t=>{const e=N_(t),n=(()=>{const f=` - cursor: -webkit-grab; - cursor: grab; - `;return{selector:e(Ul.contextId),styles:{always:` - -webkit-touch-callout: none; - -webkit-tap-highlight-color: rgba(0,0,0,0); - touch-action: manipulation; - `,resting:f,dragging:E_,dropAnimating:f}}})(),r=(()=>{const f=` - transition: ${lo.outOfTheWay}; - `;return{selector:e(Yp.contextId),styles:{dragging:f,dropAnimating:f,userCancel:f}}})(),i={selector:e(v_.contextId),styles:{always:"overflow-anchor: none;"}},d=[r,n,i,{selector:"body",styles:{dragging:` - cursor: grabbing; - cursor: -webkit-grabbing; - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - overflow-anchor: none; - `}}];return{always:Xi(d,"always"),resting:Xi(d,"resting"),dragging:Xi(d,"dragging"),dropAnimating:Xi(d,"dropAnimating"),userCancel:Xi(d,"userCancel")}};const An=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,pp=()=>{const t=document.querySelector("head");return t||fe(),t},Lv=t=>{const e=document.createElement("style");return t&&e.setAttribute("nonce",t),e.type="text/css",e};function j_(t,e){const n=qe(()=>S_(t),[t]),r=w.useRef(null),i=w.useRef(null),c=ye(kt(y=>{const m=i.current;m||fe(),m.textContent=y}),[]),d=ye(y=>{const m=r.current;m||fe(),m.textContent=y},[]);An(()=>{!r.current&&!i.current||fe();const y=Lv(e),m=Lv(e);return r.current=y,i.current=m,y.setAttribute(`${Pl}-always`,t),m.setAttribute(`${Pl}-dynamic`,t),pp().appendChild(y),pp().appendChild(m),d(n.always),c(n.resting),()=>{const v=N=>{const S=N.current;S||fe(),pp().removeChild(S),N.current=null};v(r),v(i)}},[e,d,c,n.always,n.resting,t]);const f=ye(()=>c(n.dragging),[c,n.dragging]),h=ye(y=>{if(y==="DROP"){c(n.dropAnimating);return}c(n.userCancel)},[c,n.dropAnimating,n.userCancel]),p=ye(()=>{i.current&&c(n.resting)},[c,n.resting]);return qe(()=>({dragging:f,dropping:h,resting:p}),[f,h,p])}function GE(t,e){return Array.from(t.querySelectorAll(e))}var VE=t=>t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:window;function Eu(t){return t instanceof VE(t).HTMLElement}function A_(t,e){const n=`[${Ul.contextId}="${t}"]`,r=GE(document,n);if(!r.length)return null;const i=r.find(c=>c.getAttribute(Ul.draggableId)===e);return!i||!Eu(i)?null:i}function w_(t){const e=w.useRef({}),n=w.useRef(null),r=w.useRef(null),i=w.useRef(!1),c=ye(function(m,v){const N={id:m,focus:v};return e.current[m]=N,function(){const j=e.current;j[m]!==N&&delete j[m]}},[]),d=ye(function(m){const v=A_(t,m);v&&v!==document.activeElement&&v.focus()},[t]),f=ye(function(m,v){n.current===m&&(n.current=v)},[]),h=ye(function(){r.current||i.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const m=n.current;m&&d(m)}))},[d]),p=ye(function(m){n.current=null;const v=document.activeElement;v&&v.getAttribute(Ul.draggableId)===m&&(n.current=m)},[]);return An(()=>(i.current=!0,function(){i.current=!1;const m=r.current;m&&cancelAnimationFrame(m)}),[]),qe(()=>({register:c,tryRecordFocus:p,tryRestoreFocusRecorded:h,tryShiftRecord:f}),[c,p,h,f])}function C_(){const t={draggables:{},droppables:{}},e=[];function n(y){return e.push(y),function(){const v=e.indexOf(y);v!==-1&&e.splice(v,1)}}function r(y){e.length&&e.forEach(m=>m(y))}function i(y){return t.draggables[y]||null}function c(y){const m=i(y);return m||fe(),m}const d={register:y=>{t.draggables[y.descriptor.id]=y,r({type:"ADDITION",value:y})},update:(y,m)=>{const v=t.draggables[m.descriptor.id];v&&v.uniqueId===y.uniqueId&&(delete t.draggables[m.descriptor.id],t.draggables[y.descriptor.id]=y)},unregister:y=>{const m=y.descriptor.id,v=i(m);v&&y.uniqueId===v.uniqueId&&(delete t.draggables[m],t.droppables[y.descriptor.droppableId]&&r({type:"REMOVAL",value:y}))},getById:c,findById:i,exists:y=>!!i(y),getAllByType:y=>Object.values(t.draggables).filter(m=>m.descriptor.type===y)};function f(y){return t.droppables[y]||null}function h(y){const m=f(y);return m||fe(),m}const p={register:y=>{t.droppables[y.descriptor.id]=y},unregister:y=>{const m=f(y.descriptor.id);m&&y.uniqueId===m.uniqueId&&delete t.droppables[y.descriptor.id]},getById:h,findById:f,exists:y=>!!f(y),getAllByType:y=>Object.values(t.droppables).filter(m=>m.descriptor.type===y)};function b(){t.draggables={},t.droppables={},e.length=0}return{draggable:d,droppable:p,subscribe:n,clean:b}}function D_(){const t=qe(C_,[]);return w.useEffect(()=>function(){t.clean()},[t]),t}var Zg=Ve.createContext(null),Fd=()=>{const t=document.body;return t||fe(),t};const O_={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},R_=t=>`rfd-announcement-${t}`;function T_(t){const e=qe(()=>R_(t),[t]),n=w.useRef(null);return w.useEffect(function(){const c=document.createElement("div");return n.current=c,c.id=e,c.setAttribute("aria-live","assertive"),c.setAttribute("aria-atomic","true"),Bd(c.style,O_),Fd().appendChild(c),function(){setTimeout(function(){const h=Fd();h.contains(c)&&h.removeChild(c),c===n.current&&(n.current=null)})}},[e]),ye(i=>{const c=n.current;if(c){c.textContent=i;return}},[])}const k_={separator:"::"};function Kg(t,e=k_){const n=Ve.useId();return qe(()=>`${t}${e.separator}${n}`,[e.separator,t,n])}function __({contextId:t,uniqueId:e}){return`rfd-hidden-text-${t}-${e}`}function M_({contextId:t,text:e}){const n=Kg("hidden-text",{separator:"-"}),r=qe(()=>__({contextId:t,uniqueId:n}),[n,t]);return w.useEffect(function(){const c=document.createElement("div");return c.id=r,c.textContent=e,c.style.display="none",Fd().appendChild(c),function(){const f=Fd();f.contains(c)&&f.removeChild(c)}},[r,e]),r}var Su=Ve.createContext(null);function FE(t){const e=w.useRef(t);return w.useEffect(()=>{e.current=t}),e}function I_(){let t=null;function e(){return!!t}function n(d){return d===t}function r(d){t&&fe();const f={abandon:d};return t=f,f}function i(){t||fe(),t=null}function c(){t&&(t.abandon(),i())}return{isClaimed:e,isActive:n,claim:r,release:i,tryAbandon:c}}function yo(t){return t.phase==="IDLE"||t.phase==="DROP_ANIMATING"?!1:t.isDragging}const L_=9,z_=13,Jg=27,qE=32,P_=33,U_=34,B_=35,H_=36,G_=37,V_=38,F_=39,q_=40,$_={[z_]:!0,[L_]:!0};var $E=t=>{$_[t.keyCode]&&t.preventDefault()};const ju=(()=>{const t="visibilitychange";return typeof document>"u"?t:[t,`ms${t}`,`webkit${t}`,`moz${t}`,`o${t}`].find(r=>`on${r}`in document)||t})(),YE=0,zv=5;function Y_(t,e){return Math.abs(e.x-t.x)>=zv||Math.abs(e.y-t.y)>=zv}const Pv={type:"IDLE"};function Q_({cancel:t,completed:e,getPhase:n,setPhase:r}){return[{eventName:"mousemove",fn:i=>{const{button:c,clientX:d,clientY:f}=i;if(c!==YE)return;const h={x:d,y:f},p=n();if(p.type==="DRAGGING"){i.preventDefault(),p.actions.move(h);return}p.type!=="PENDING"&&fe();const b=p.point;if(!Y_(b,h))return;i.preventDefault();const y=p.actions.fluidLift(h);r({type:"DRAGGING",actions:y})}},{eventName:"mouseup",fn:i=>{const c=n();if(c.type!=="DRAGGING"){t();return}i.preventDefault(),c.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"mousedown",fn:i=>{n().type==="DRAGGING"&&i.preventDefault(),t()}},{eventName:"keydown",fn:i=>{if(n().type==="PENDING"){t();return}if(i.keyCode===Jg){i.preventDefault(),t();return}$E(i)}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&t()}},{eventName:"webkitmouseforcedown",fn:i=>{const c=n();if(c.type==="IDLE"&&fe(),c.actions.shouldRespectForcePress()){t();return}i.preventDefault()}},{eventName:ju,fn:t}]}function W_(t){const e=w.useRef(Pv),n=w.useRef(ks),r=qe(()=>({eventName:"mousedown",fn:function(y){if(y.defaultPrevented||y.button!==YE||y.ctrlKey||y.metaKey||y.shiftKey||y.altKey)return;const m=t.findClosestDraggableId(y);if(!m)return;const v=t.tryGetLock(m,d,{sourceEvent:y});if(!v)return;y.preventDefault();const N={x:y.clientX,y:y.clientY};n.current(),p(v,N)}}),[t]),i=qe(()=>({eventName:"webkitmouseforcewillbegin",fn:b=>{if(b.defaultPrevented)return;const y=t.findClosestDraggableId(b);if(!y)return;const m=t.findOptionsForDraggable(y);m&&(m.shouldRespectForcePress||t.canGetLock(y)&&b.preventDefault())}}),[t]),c=ye(function(){const y={passive:!1,capture:!0};n.current=Fn(window,[i,r],y)},[i,r]),d=ye(()=>{e.current.type!=="IDLE"&&(e.current=Pv,n.current(),c())},[c]),f=ye(()=>{const b=e.current;d(),b.type==="DRAGGING"&&b.actions.cancel({shouldBlockNextClick:!0}),b.type==="PENDING"&&b.actions.abort()},[d]),h=ye(function(){const y={capture:!0,passive:!1},m=Q_({cancel:f,completed:d,getPhase:()=>e.current,setPhase:v=>{e.current=v}});n.current=Fn(window,m,y)},[f,d]),p=ye(function(y,m){e.current.type!=="IDLE"&&fe(),e.current={type:"PENDING",point:m,actions:y},h()},[h]);An(function(){return c(),function(){n.current()}},[c])}function X_(){}const Z_={[U_]:!0,[P_]:!0,[H_]:!0,[B_]:!0};function K_(t,e){function n(){e(),t.cancel()}function r(){e(),t.drop()}return[{eventName:"keydown",fn:i=>{if(i.keyCode===Jg){i.preventDefault(),n();return}if(i.keyCode===qE){i.preventDefault(),r();return}if(i.keyCode===q_){i.preventDefault(),t.moveDown();return}if(i.keyCode===V_){i.preventDefault(),t.moveUp();return}if(i.keyCode===F_){i.preventDefault(),t.moveRight();return}if(i.keyCode===G_){i.preventDefault(),t.moveLeft();return}if(Z_[i.keyCode]){i.preventDefault();return}$E(i)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:ju,fn:n}]}function J_(t){const e=w.useRef(X_),n=qe(()=>({eventName:"keydown",fn:function(c){if(c.defaultPrevented||c.keyCode!==qE)return;const d=t.findClosestDraggableId(c);if(!d)return;const f=t.tryGetLock(d,b,{sourceEvent:c});if(!f)return;c.preventDefault();let h=!0;const p=f.snapLift();e.current();function b(){h||fe(),h=!1,e.current(),r()}e.current=Fn(window,K_(p,b),{capture:!0,passive:!1})}}),[t]),r=ye(function(){const c={passive:!1,capture:!0};e.current=Fn(window,[n],c)},[n]);An(function(){return r(),function(){e.current()}},[r])}const gp={type:"IDLE"},e5=120,t5=.15;function n5({cancel:t,getPhase:e}){return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(e().type!=="DRAGGING"){t();return}n.keyCode===Jg&&n.preventDefault(),t()}},{eventName:ju,fn:t}]}function a5({cancel:t,completed:e,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:r=>{const i=n();if(i.type!=="DRAGGING"){t();return}i.hasMoved=!0;const{clientX:c,clientY:d}=r.touches[0],f={x:c,y:d};r.preventDefault(),i.actions.move(f)}},{eventName:"touchend",fn:r=>{const i=n();if(i.type!=="DRAGGING"){t();return}r.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"touchcancel",fn:r=>{if(n().type!=="DRAGGING"){t();return}r.preventDefault(),t()}},{eventName:"touchforcechange",fn:r=>{const i=n();i.type==="IDLE"&&fe();const c=r.touches[0];if(!c||!(c.force>=t5))return;const f=i.actions.shouldRespectForcePress();if(i.type==="PENDING"){f&&t();return}if(f){if(i.hasMoved){r.preventDefault();return}t();return}r.preventDefault()}},{eventName:ju,fn:t}]}function s5(t){const e=w.useRef(gp),n=w.useRef(ks),r=ye(function(){return e.current},[]),i=ye(function(v){e.current=v},[]),c=qe(()=>({eventName:"touchstart",fn:function(v){if(v.defaultPrevented)return;const N=t.findClosestDraggableId(v);if(!N)return;const S=t.tryGetLock(N,f,{sourceEvent:v});if(!S)return;const j=v.touches[0],{clientX:R,clientY:C}=j,O={x:R,y:C};n.current(),y(S,O)}}),[t]),d=ye(function(){const v={capture:!0,passive:!1};n.current=Fn(window,[c],v)},[c]),f=ye(()=>{const m=e.current;m.type!=="IDLE"&&(m.type==="PENDING"&&clearTimeout(m.longPressTimerId),i(gp),n.current(),d())},[d,i]),h=ye(()=>{const m=e.current;f(),m.type==="DRAGGING"&&m.actions.cancel({shouldBlockNextClick:!0}),m.type==="PENDING"&&m.actions.abort()},[f]),p=ye(function(){const v={capture:!0,passive:!1},N={cancel:h,completed:f,getPhase:r},S=Fn(window,a5(N),v),j=Fn(window,n5(N),v);n.current=function(){S(),j()}},[h,r,f]),b=ye(function(){const v=r();v.type!=="PENDING"&&fe();const N=v.actions.fluidLift(v.point);i({type:"DRAGGING",actions:N,hasMoved:!1})},[r,i]),y=ye(function(v,N){r().type!=="IDLE"&&fe();const S=setTimeout(b,e5);i({type:"PENDING",point:N,actions:v,longPressTimerId:S}),p()},[p,r,i,b]);An(function(){return d(),function(){n.current();const N=r();N.type==="PENDING"&&(clearTimeout(N.longPressTimerId),i(gp))}},[r,d,i]),An(function(){return Fn(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const r5=["input","button","textarea","select","option","optgroup","video","audio"];function QE(t,e){if(e==null)return!1;if(r5.includes(e.tagName.toLowerCase()))return!0;const r=e.getAttribute("contenteditable");return r==="true"||r===""?!0:e===t?!1:QE(t,e.parentElement)}function l5(t,e){const n=e.target;return Eu(n)?QE(t,n):!1}var i5=t=>Jn(t.getBoundingClientRect()).center;function o5(t){return t instanceof VE(t).Element}const c5=(()=>{const t="matches";return typeof document>"u"?t:[t,"msMatchesSelector","webkitMatchesSelector"].find(r=>r in Element.prototype)||t})();function WE(t,e){return t==null?null:t[c5](e)?t:WE(t.parentElement,e)}function d5(t,e){return t.closest?t.closest(e):WE(t,e)}function u5(t){return`[${Ul.contextId}="${t}"]`}function f5(t,e){const n=e.target;if(!o5(n))return null;const r=u5(t),i=d5(n,r);return!i||!Eu(i)?null:i}function h5(t,e){const n=f5(t,e);return n?n.getAttribute(Ul.draggableId):null}function p5(t,e){const n=`[${Yp.contextId}="${t}"]`,i=GE(document,n).find(c=>c.getAttribute(Yp.id)===e);return!i||!Eu(i)?null:i}function g5(t){t.preventDefault()}function ud({expected:t,phase:e,isLockActive:n,shouldWarn:r}){return!(!n()||t!==e)}function XE({lockAPI:t,store:e,registry:n,draggableId:r}){if(t.isClaimed())return!1;const i=n.draggable.findById(r);return!(!i||!i.options.isEnabled||!PE(e.getState(),r))}function m5({lockAPI:t,contextId:e,store:n,registry:r,draggableId:i,forceSensorStop:c,sourceEvent:d}){if(!XE({lockAPI:t,store:n,registry:r,draggableId:i}))return null;const h=r.draggable.getById(i),p=p5(e,h.descriptor.id);if(!p||d&&!h.options.canDragInteractiveElements&&l5(p,d))return null;const b=t.claim(c||ks);let y="PRE_DRAG";function m(){return h.options.shouldRespectForcePress}function v(){return t.isActive(b)}function N(k,_){ud({expected:k,phase:y,isLockActive:v,shouldWarn:!0})&&n.dispatch(_())}const S=N.bind(null,"DRAGGING");function j(k){function _(){t.release(),y="COMPLETED"}y!=="PRE_DRAG"&&(_(),fe()),n.dispatch(dk(k.liftActionArgs)),y="DRAGGING";function B(F,G={shouldBlockNextClick:!1}){if(k.cleanup(),G.shouldBlockNextClick){const ee=Fn(window,[{eventName:"click",fn:g5,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(ee)}_(),n.dispatch(RE({reason:F}))}return{isActive:()=>ud({expected:"DRAGGING",phase:y,isLockActive:v,shouldWarn:!1}),shouldRespectForcePress:m,drop:F=>B("DROP",F),cancel:F=>B("CANCEL",F),...k.actions}}function R(k){const _=ho(F=>{S(()=>OE({client:F}))});return{...j({liftActionArgs:{id:i,clientSelection:k,movementMode:"FLUID"},cleanup:()=>_.cancel(),actions:{move:_}}),move:_}}function C(){const k={moveUp:()=>S(yk),moveRight:()=>S(Nk),moveDown:()=>S(vk),moveLeft:()=>S(Ek)};return j({liftActionArgs:{id:i,clientSelection:i5(p),movementMode:"SNAP"},cleanup:ks,actions:k})}function O(){ud({expected:"PRE_DRAG",phase:y,isLockActive:v,shouldWarn:!0})&&t.release()}return{isActive:()=>ud({expected:"PRE_DRAG",phase:y,isLockActive:v,shouldWarn:!1}),shouldRespectForcePress:m,fluidLift:R,snapLift:C,abort:O}}const x5=[W_,J_,s5];function b5({contextId:t,store:e,registry:n,customSensors:r,enableDefaultSensors:i}){const c=[...i?x5:[],...r||[]],d=w.useState(()=>I_())[0],f=ye(function(j,R){yo(j)&&!yo(R)&&d.tryAbandon()},[d]);An(function(){let j=e.getState();return e.subscribe(()=>{const C=e.getState();f(j,C),j=C})},[d,e,f]),An(()=>d.tryAbandon,[d.tryAbandon]);const h=ye(S=>XE({lockAPI:d,registry:n,store:e,draggableId:S}),[d,n,e]),p=ye((S,j,R)=>m5({lockAPI:d,registry:n,contextId:t,store:e,draggableId:S,forceSensorStop:j||null,sourceEvent:R&&R.sourceEvent?R.sourceEvent:null}),[t,d,n,e]),b=ye(S=>h5(t,S),[t]),y=ye(S=>{const j=n.draggable.findById(S);return j?j.options:null},[n.draggable]),m=ye(function(){d.isClaimed()&&(d.tryAbandon(),e.getState().phase!=="IDLE"&&e.dispatch(Fg()))},[d,e]),v=ye(()=>d.isClaimed(),[d]),N=qe(()=>({canGetLock:h,tryGetLock:p,findClosestDraggableId:b,findOptionsForDraggable:y,tryReleaseLock:m,isLockClaimed:v}),[h,p,b,y,m,v]);for(let S=0;S({onBeforeCapture:e=>{const n=()=>{t.onBeforeCapture&&t.onBeforeCapture(e)};wr.flushSync(n)},onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd,onDragUpdate:t.onDragUpdate}),v5=t=>({...bo,...t.autoScrollerOptions,durationDampening:{...bo.durationDampening,...t.autoScrollerOptions}});function Zi(t){return t.current||fe(),t.current}function N5(t){const{contextId:e,setCallbacks:n,sensors:r,nonce:i,dragHandleUsageInstructions:c}=t,d=w.useRef(null),f=FE(t),h=ye(()=>y5(f.current),[f]),p=ye(()=>v5(f.current),[f]),b=T_(e),y=M_({contextId:e,text:c}),m=j_(e,i),v=ye(ee=>{Zi(d).dispatch(ee)},[]),N=qe(()=>dv({publishWhileDragging:fk,updateDroppableScroll:pk,updateDroppableIsEnabled:gk,updateDroppableIsCombineEnabled:mk,collectionStarting:hk},v),[v]),S=D_(),j=qe(()=>n_(S,N),[S,N]),R=qe(()=>y_({scrollWindow:a_,scrollDroppable:j.scrollDroppable,getAutoScrollerOptions:p,...dv({move:OE},v)}),[j.scrollDroppable,v,p]),C=w_(e),O=qe(()=>Kk({announce:b,autoScroller:R,dimensionMarshal:j,focusMarshal:C,getResponders:h,styleMarshal:m}),[b,R,j,C,h,m]);d.current=O;const A=ye(()=>{const ee=Zi(d);ee.getState().phase!=="IDLE"&&ee.dispatch(Fg())},[]),k=ye(()=>{const ee=Zi(d).getState();return ee.phase==="DROP_ANIMATING"?!0:ee.phase==="IDLE"?!1:ee.isDragging},[]),_=qe(()=>({isDragging:k,tryAbort:A}),[k,A]);n(_);const B=ye(ee=>PE(Zi(d).getState(),ee),[]),F=ye(()=>ir(Zi(d).getState()),[]),G=qe(()=>({marshal:j,focus:C,contextId:e,canLift:B,isMovementAllowed:F,dragHandleUsageInstructionsId:y,registry:S}),[e,j,y,C,B,F,S]);return b5({contextId:e,store:O,registry:S,customSensors:r||null,enableDefaultSensors:t.enableDefaultSensors!==!1}),w.useEffect(()=>A,[A]),Ve.createElement(Su.Provider,{value:G},Ve.createElement($R,{context:Zg,store:O},t.children))}function E5(){return Ve.useId()}function Xl(t){const e=E5(),n=t.dragHandleUsageInstructions||wd.dragHandleUsageInstructions;return Ve.createElement(JR,null,r=>Ve.createElement(N5,{nonce:t.nonce,contextId:e,setCallbacks:r,dragHandleUsageInstructions:n,enableDefaultSensors:t.enableDefaultSensors,sensors:t.sensors,onBeforeCapture:t.onBeforeCapture,onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragUpdate:t.onDragUpdate,onDragEnd:t.onDragEnd,autoScrollerOptions:t.autoScrollerOptions},t.children))}const Uv={dragging:5e3,dropAnimating:4500},S5=(t,e)=>e?lo.drop(e.duration):t?lo.snap:lo.fluid,j5=(t,e)=>{if(t)return e?xo.opacity.drop:xo.opacity.combining},A5=t=>t.forceShouldAnimate!=null?t.forceShouldAnimate:t.mode==="SNAP";function w5(t){const n=t.dimension.client,{offset:r,combineWith:i,dropping:c}=t,d=!!i,f=A5(t),h=!!c,p=h?qp.drop(r,d):qp.moveTo(r);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:S5(f,c),transform:p,opacity:j5(d,h),zIndex:h?Uv.dropAnimating:Uv.dragging,pointerEvents:"none"}}function C5(t){return{transform:qp.moveTo(t.offset),transition:t.shouldAnimateDisplacement?void 0:"none"}}function D5(t){return t.type==="DRAGGING"?w5(t):C5(t)}function O5(t,e,n=Mt){const r=window.getComputedStyle(e),i=e.getBoundingClientRect(),c=aE(i,r),d=Ud(c,n),f={client:c,tagName:e.tagName.toLowerCase(),display:r.display},h={x:c.marginBox.width,y:c.marginBox.height};return{descriptor:t,placeholder:f,displaceBy:h,client:c,page:d}}function R5(t){const e=Kg("draggable"),{descriptor:n,registry:r,getDraggableRef:i,canDragInteractiveElements:c,shouldRespectForcePress:d,isEnabled:f}=t,h=qe(()=>({canDragInteractiveElements:c,shouldRespectForcePress:d,isEnabled:f}),[c,f,d]),p=ye(v=>{const N=i();return N||fe(),O5(n,N,v)},[n,i]),b=qe(()=>({uniqueId:e,descriptor:n,options:h,getDimension:p}),[n,p,h,e]),y=w.useRef(b),m=w.useRef(!0);An(()=>(r.draggable.register(y.current),()=>r.draggable.unregister(y.current)),[r.draggable]),An(()=>{if(m.current){m.current=!1;return}const v=y.current;y.current=b,r.draggable.update(b,v)},[b,r.draggable])}var em=Ve.createContext(null);function qd(t){const e=w.useContext(t);return e||fe(),e}function T5(t){t.preventDefault()}const k5=t=>{const e=w.useRef(null),n=ye((_=null)=>{e.current=_},[]),r=ye(()=>e.current,[]),{contextId:i,dragHandleUsageInstructionsId:c,registry:d}=qd(Su),{type:f,droppableId:h}=qd(em),p=qe(()=>({id:t.draggableId,index:t.index,type:f,droppableId:h}),[t.draggableId,t.index,f,h]),{children:b,draggableId:y,isEnabled:m,shouldRespectForcePress:v,canDragInteractiveElements:N,isClone:S,mapped:j,dropAnimationFinished:R}=t;if(!S){const _=qe(()=>({descriptor:p,registry:d,getDraggableRef:r,canDragInteractiveElements:N,shouldRespectForcePress:v,isEnabled:m}),[p,d,r,N,v,m]);R5(_)}const C=qe(()=>m?{tabIndex:0,role:"button","aria-describedby":c,"data-rfd-drag-handle-draggable-id":y,"data-rfd-drag-handle-context-id":i,draggable:!1,onDragStart:T5}:null,[i,c,y,m]),O=ye(_=>{j.type==="DRAGGING"&&j.dropping&&_.propertyName==="transform"&&wr.flushSync(R)},[R,j]),A=qe(()=>{const _=D5(j),B=j.type==="DRAGGING"&&j.dropping?O:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":i,"data-rfd-draggable-id":y,style:_,onTransitionEnd:B},dragHandleProps:C}},[i,C,y,j,O,n]),k=qe(()=>({draggableId:p.id,type:p.type,source:{index:p.index,droppableId:p.droppableId}}),[p.droppableId,p.id,p.index,p.type]);return Ve.createElement(Ve.Fragment,null,b(A,j.snapshot,k))};var ZE=(t,e)=>t===e,KE=t=>{const{combine:e,destination:n}=t;return n?n.droppableId:e?e.droppableId:null};const _5=t=>t.combine?t.combine.draggableId:null,M5=t=>t.at&&t.at.type==="COMBINE"?t.at.combine.draggableId:null;function I5(){const t=kt((i,c)=>({x:i,y:c})),e=kt((i,c,d=null,f=null,h=null)=>({isDragging:!0,isClone:c,isDropAnimating:!!h,dropAnimation:h,mode:i,draggingOver:d,combineWith:f,combineTargetFor:null})),n=kt((i,c,d,f,h=null,p=null,b=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:h,combineWith:p,mode:c,offset:i,dimension:d,forceShouldAnimate:b,snapshot:e(c,f,h,p,null)}}));return(i,c)=>{if(yo(i)){if(i.critical.draggable.id!==c.draggableId)return null;const d=i.current.client.offset,f=i.dimensions.draggables[c.draggableId],h=jn(i.impact),p=M5(i.impact),b=i.forceShouldAnimate;return n(t(d.x,d.y),i.movementMode,f,c.isClone,h,p,b)}if(i.phase==="DROP_ANIMATING"){const d=i.completed;if(d.result.draggableId!==c.draggableId)return null;const f=c.isClone,h=i.dimensions.draggables[c.draggableId],p=d.result,b=p.mode,y=KE(p),m=_5(p),N={duration:i.dropDuration,curve:$g.drop,moveTo:i.newHomeClientOffset,opacity:m?xo.opacity.drop:null,scale:m?xo.scale.drop:null};return{mapped:{type:"DRAGGING",offset:i.newHomeClientOffset,dimension:h,dropping:N,draggingOver:y,combineWith:m,mode:b,forceShouldAnimate:null,snapshot:e(b,f,y,m,N)}}}return null}}function JE(t=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:t,combineWith:null}}const L5={mapped:{type:"SECONDARY",offset:Mt,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:JE(null)}};function z5(){const t=kt((d,f)=>({x:d,y:f})),e=kt(JE),n=kt((d,f=null,h)=>({mapped:{type:"SECONDARY",offset:d,combineTargetFor:f,shouldAnimateDisplacement:h,snapshot:e(f)}})),r=d=>d?n(Mt,d,!0):null,i=(d,f,h,p)=>{const b=h.displaced.visible[d],y=!!(p.inVirtualList&&p.effected[d]),m=yu(h),v=m&&m.draggableId===d?f:null;if(!b){if(!y)return r(v);if(h.displaced.invisible[d])return null;const j=Yl(p.displacedBy.point),R=t(j.x,j.y);return n(R,v,!0)}if(y)return r(v);const N=h.displacedBy.point,S=t(N.x,N.y);return n(S,v,b.shouldAnimate)};return(d,f)=>{if(yo(d))return d.critical.draggable.id===f.draggableId?null:i(f.draggableId,d.critical.draggable.id,d.impact,d.afterCritical);if(d.phase==="DROP_ANIMATING"){const h=d.completed;return h.result.draggableId===f.draggableId?null:i(f.draggableId,h.result.draggableId,h.impact,h.afterCritical)}return null}}const P5=()=>{const t=I5(),e=z5();return(r,i)=>t(r,i)||e(r,i)||L5},U5={dropAnimationFinished:TE},B5=nE(P5,U5,null,{context:Zg,areStatePropsEqual:ZE})(k5);function eS(t){return qd(em).isUsingCloneFor===t.draggableId&&!t.isClone?null:Ve.createElement(B5,t)}function Zl(t){const e=typeof t.isDragDisabled=="boolean"?!t.isDragDisabled:!0,n=!!t.disableInteractiveElementBlocking,r=!!t.shouldRespectForcePress;return Ve.createElement(eS,Bd({},t,{isClone:!1,isEnabled:e,canDragInteractiveElements:n,shouldRespectForcePress:r}))}const tS=t=>e=>t===e,H5=tS("scroll"),G5=tS("auto"),Bv=(t,e)=>e(t.overflowX)||e(t.overflowY),V5=t=>{const e=window.getComputedStyle(t),n={overflowX:e.overflowX,overflowY:e.overflowY};return Bv(n,H5)||Bv(n,G5)},F5=()=>!1,nS=t=>t==null?null:t===document.body?F5()?t:null:t===document.documentElement?null:V5(t)?t:nS(t.parentElement);var Qp=t=>({x:t.scrollLeft,y:t.scrollTop});const aS=t=>t?window.getComputedStyle(t).position==="fixed"?!0:aS(t.parentElement):!1;var q5=t=>{const e=nS(t),n=aS(t);return{closestScrollable:e,isFixedOnPage:n}},$5=({descriptor:t,isEnabled:e,isCombineEnabled:n,isFixedOnPage:r,direction:i,client:c,page:d,closest:f})=>{const h=(()=>{if(!f)return null;const{scrollSize:m,client:v}=f,N=IE({scrollHeight:m.scrollHeight,scrollWidth:m.scrollWidth,height:v.paddingBox.height,width:v.paddingBox.width});return{pageMarginBox:f.page.marginBox,frameClient:v,scrollSize:m,shouldClipSubject:f.shouldClipSubject,scroll:{initial:f.scroll,current:f.scroll,max:N,diff:{value:Mt,displacement:Mt}}}})(),p=i==="vertical"?Ug:pE,b=zl({page:d,withPlaceholder:null,axis:p,frame:h});return{descriptor:t,isCombineEnabled:n,isFixedOnPage:r,axis:p,isEnabled:e,client:c,page:d,frame:h,subject:b}};const Y5=(t,e)=>{const n=sE(t);if(!e||t!==e)return n;const r=n.paddingBox.top-e.scrollTop,i=n.paddingBox.left-e.scrollLeft,c=r+e.scrollHeight,d=i+e.scrollWidth,h=Ig({top:r,right:d,bottom:c,left:i},n.border);return Lg({borderBox:h,margin:n.margin,border:n.border,padding:n.padding})};var Q5=({ref:t,descriptor:e,env:n,windowScroll:r,direction:i,isDropDisabled:c,isCombineEnabled:d,shouldClipSubject:f})=>{const h=n.closestScrollable,p=Y5(t,h),b=Ud(p,r),y=(()=>{if(!h)return null;const v=sE(h),N={scrollHeight:h.scrollHeight,scrollWidth:h.scrollWidth};return{client:v,page:Ud(v,r),scroll:Qp(h),scrollSize:N,shouldClipSubject:f}})();return $5({descriptor:e,isEnabled:!c,isCombineEnabled:d,isFixedOnPage:n.isFixedOnPage,direction:i,client:p,page:b,closest:y})};const W5={passive:!1},X5={passive:!0};var Hv=t=>t.shouldPublishImmediately?W5:X5;const fd=t=>t&&t.env.closestScrollable||null;function Z5(t){const e=w.useRef(null),n=qd(Su),r=Kg("droppable"),{registry:i,marshal:c}=n,d=FE(t),f=qe(()=>({id:t.droppableId,type:t.type,mode:t.mode}),[t.droppableId,t.mode,t.type]),h=w.useRef(f),p=qe(()=>kt((A,k)=>{e.current||fe();const _={x:A,y:k};c.updateDroppableScroll(f.id,_)}),[f.id,c]),b=ye(()=>{const A=e.current;return!A||!A.env.closestScrollable?Mt:Qp(A.env.closestScrollable)},[]),y=ye(()=>{const A=b();p(A.x,A.y)},[b,p]),m=qe(()=>ho(y),[y]),v=ye(()=>{const A=e.current,k=fd(A);if(A&&k||fe(),A.scrollOptions.shouldPublishImmediately){y();return}m()},[m,y]),N=ye((A,k)=>{e.current&&fe();const _=d.current,B=_.getDroppableRef();B||fe();const F=q5(B),G={ref:B,descriptor:f,env:F,scrollOptions:k};e.current=G;const ee=Q5({ref:B,descriptor:f,env:F,windowScroll:A,direction:_.direction,isDropDisabled:_.isDropDisabled,isCombineEnabled:_.isCombineEnabled,shouldClipSubject:!_.ignoreContainerClipping}),ne=F.closestScrollable;return ne&&(ne.setAttribute(Iv.contextId,n.contextId),ne.addEventListener("scroll",v,Hv(G.scrollOptions))),ee},[n.contextId,f,v,d]),S=ye(()=>{const A=e.current,k=fd(A);return A&&k||fe(),Qp(k)},[]),j=ye(()=>{const A=e.current;A||fe();const k=fd(A);e.current=null,k&&(m.cancel(),k.removeAttribute(Iv.contextId),k.removeEventListener("scroll",v,Hv(A.scrollOptions)))},[v,m]),R=ye(A=>{const k=e.current;k||fe();const _=fd(k);_||fe(),_.scrollTop+=A.y,_.scrollLeft+=A.x},[]),C=qe(()=>({getDimensionAndWatchScroll:N,getScrollWhileDragging:S,dragStopped:j,scroll:R}),[j,N,S,R]),O=qe(()=>({uniqueId:r,descriptor:f,callbacks:C}),[C,f,r]);An(()=>(h.current=O.descriptor,i.droppable.register(O),()=>{e.current&&j(),i.droppable.unregister(O)}),[C,f,j,O,c,i.droppable]),An(()=>{e.current&&c.updateDroppableIsEnabled(h.current.id,!t.isDropDisabled)},[t.isDropDisabled,c]),An(()=>{e.current&&c.updateDroppableIsCombineEnabled(h.current.id,t.isCombineEnabled)},[t.isCombineEnabled,c])}function mp(){}const Gv={width:0,height:0,margin:lT},K5=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>t||n==="close"?Gv:{height:e.client.borderBox.height,width:e.client.borderBox.width,margin:e.client.margin},J5=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>{const r=K5({isAnimatingOpenOnMount:t,placeholder:e,animate:n});return{display:e.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?lo.placeholder:null}},eM=t=>{const e=w.useRef(null),n=ye(()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]),{animate:r,onTransitionEnd:i,onClose:c,contextId:d}=t,[f,h]=w.useState(t.animate==="open");w.useEffect(()=>f?r!=="open"?(n(),h(!1),mp):e.current?mp:(e.current=setTimeout(()=>{e.current=null,h(!1)}),n):mp,[r,f,n]);const p=ye(y=>{y.propertyName==="height"&&(i(),r==="close"&&c())},[r,c,i]),b=J5({isAnimatingOpenOnMount:f,animate:t.animate,placeholder:t.placeholder});return Ve.createElement(t.placeholder.tagName,{style:b,"data-rfd-placeholder-context-id":d,onTransitionEnd:p,ref:t.innerRef})};var tM=Ve.memo(eM);class nM extends Ve.PureComponent{constructor(...e){super(...e),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(e,n){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!e.on,data:e.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)}}const aM=t=>{const e=w.useContext(Su);e||fe();const{contextId:n,isMovementAllowed:r}=e,i=w.useRef(null),c=w.useRef(null),{children:d,droppableId:f,type:h,mode:p,direction:b,ignoreContainerClipping:y,isDropDisabled:m,isCombineEnabled:v,snapshot:N,useClone:S,updateViewportMaxScroll:j,getContainerForClone:R}=t,C=ye(()=>i.current,[]),O=ye((ne=null)=>{i.current=ne},[]);ye(()=>c.current,[]);const A=ye((ne=null)=>{c.current=ne},[]),k=ye(()=>{r()&&j({maxScroll:zE()})},[r,j]);Z5({droppableId:f,type:h,mode:p,direction:b,isDropDisabled:m,isCombineEnabled:v,ignoreContainerClipping:y,getDroppableRef:C});const _=qe(()=>Ve.createElement(nM,{on:t.placeholder,shouldAnimate:t.shouldAnimatePlaceholder},({onClose:ne,data:oe,animate:Q})=>Ve.createElement(tM,{placeholder:oe,onClose:ne,innerRef:A,animate:Q,contextId:n,onTransitionEnd:k})),[n,k,t.placeholder,t.shouldAnimatePlaceholder,A]),B=qe(()=>({innerRef:O,placeholder:_,droppableProps:{"data-rfd-droppable-id":f,"data-rfd-droppable-context-id":n}}),[n,f,_,O]),F=S?S.dragging.draggableId:null,G=qe(()=>({droppableId:f,type:h,isUsingCloneFor:F}),[f,F,h]);function ee(){if(!S)return null;const{dragging:ne,render:oe}=S,Q=Ve.createElement(eS,{draggableId:ne.draggableId,index:ne.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(ce,he)=>oe(ce,he,ne));return LO.createPortal(Q,R())}return Ve.createElement(em.Provider,{value:G},d(B,N),ee())};function sM(){return document.body||fe(),document.body}const Vv={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:sM},sS=t=>{let e={...t},n;for(n in Vv)t[n]===void 0&&(e={...e,[n]:Vv[n]});return e},xp=(t,e)=>t===e.droppable.type,Fv=(t,e)=>e.draggables[t.draggable.id],rM=()=>{const t={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},e={...t,shouldAnimatePlaceholder:!1},n=kt(c=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}})),r=kt((c,d,f,h,p,b)=>{const y=p.descriptor.id;if(p.descriptor.droppableId===c){const N=b?{render:b,dragging:n(p.descriptor)}:null,S={isDraggingOver:f,draggingOverWith:f?y:null,draggingFromThisWith:y,isUsingPlaceholder:!0};return{placeholder:p.placeholder,shouldAnimatePlaceholder:!1,snapshot:S,useClone:N}}if(!d)return e;if(!h)return t;const v={isDraggingOver:f,draggingOverWith:y,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:p.placeholder,shouldAnimatePlaceholder:!0,snapshot:v,useClone:null}});return(c,d)=>{const f=sS(d),h=f.droppableId,p=f.type,b=!f.isDropDisabled,y=f.renderClone;if(yo(c)){const m=c.critical;if(!xp(p,m))return e;const v=Fv(m,c.dimensions),N=jn(c.impact)===h;return r(h,b,N,N,v,y)}if(c.phase==="DROP_ANIMATING"){const m=c.completed;if(!xp(p,m.critical))return e;const v=Fv(m.critical,c.dimensions);return r(h,b,KE(m.result)===h,jn(m.impact)===h,v,y)}if(c.phase==="IDLE"&&c.completed&&!c.shouldFlush){const m=c.completed;if(!xp(p,m.critical))return e;const v=jn(m.impact)===h,N=!!(m.impact.at&&m.impact.at.type==="COMBINE"),S=m.critical.droppable.id===h;return v?N?t:e:S?t:e}return e}},lM={updateViewportMaxScroll:bk},Kl=nE(rM,lM,(t,e,n)=>({...sS(n),...t,...e}),{context:Zg,areStatePropsEqual:ZE})(aM),iM=["VO","SL","IV","IM","SC","Tópico","Inalatória","Colírio","Nasal"],oM=["1x/dia","2x/dia","3x/dia","4x/dia","6/6h","8/8h","12/12h","24/24h","Dose única","Se necessário"],cM=["1 dia","2 dias","3 dias","5 dias","7 dias","10 dias","14 dias","21 dias","30 dias","Contínuo"],bp={medicamento:"",dose:"",via:"VO",frequencia:"8/8h",duracao:"7 dias",instrucoes:""},qv=({item:t,onChange:e,onSave:n,onCancel:r})=>{const i="w-full border border-gray-200 rounded-lg px-3 py-2 text-xs focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none bg-white",c=i+" appearance-none";return s.jsxs("div",{className:"bg-blue-50 border border-blue-100 rounded-xl p-3 space-y-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Medicamento"}),s.jsx("input",{autoFocus:!0,value:t.medicamento,onChange:d=>e({...t,medicamento:d.target.value.toUpperCase()}),placeholder:"EX: AMOXICILINA 500MG",className:i})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Dose"}),s.jsx("input",{value:t.dose,onChange:d=>e({...t,dose:d.target.value}),placeholder:"EX: 500mg",className:i})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Via"}),s.jsx("select",{value:t.via,onChange:d=>e({...t,via:d.target.value}),className:c,children:iM.map(d=>s.jsx("option",{children:d},d))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Frequência"}),s.jsx("select",{value:t.frequencia,onChange:d=>e({...t,frequencia:d.target.value}),className:c,children:oM.map(d=>s.jsx("option",{children:d},d))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Duração"}),s.jsx("select",{value:t.duracao,onChange:d=>e({...t,duracao:d.target.value}),className:c,children:cM.map(d=>s.jsx("option",{children:d},d))})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Instruções extras (opcional)"}),s.jsx("input",{value:t.instrucoes||"",onChange:d=>e({...t,instrucoes:d.target.value}),placeholder:"EX: TOMAR APÓS AS REFEIÇÕES",className:i})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[s.jsx("button",{onClick:r,className:"px-3 py-1.5 bg-white border border-gray-200 text-gray-600 rounded-lg text-xs font-bold hover:bg-gray-50",children:"Cancelar"}),s.jsxs("button",{onClick:n,disabled:!t.medicamento.trim(),className:"px-3 py-1.5 bg-blue-600 text-white rounded-lg text-xs font-bold hover:bg-blue-700 disabled:opacity-40 flex items-center gap-1",children:[s.jsx(Io,{size:12})," Confirmar"]})]})]})},dM=({modelo:t,especialidades:e,onSave:n,onBack:r})=>{var oe;const i=Fe(),[c,d]=w.useState((t==null?void 0:t.nome)||""),[f,h]=w.useState((t==null?void 0:t.especialidadeId)||""),[p,b]=w.useState((t==null?void 0:t.instrucoes)||""),[y,m]=w.useState((t==null?void 0:t.items)||[]),[v,N]=w.useState(null),[S,j]=w.useState(bp),[R,C]=w.useState(!1),[O,A]=w.useState(!1),k=((oe=e.find(Q=>Q.id===f))==null?void 0:oe.nome)||"",_=Q=>{if(!Q.destination)return;const ce=[...y],[he]=ce.splice(Q.source.index,1);ce.splice(Q.destination.index,0,he),m(ce.map((H,V)=>({...H,ordem:V})))},B=()=>{S.medicamento.trim()&&(m(Q=>[...Q,{...S,id:`new_${Date.now()}`,ordem:Q.length}]),j(bp),C(!1))},F=(Q,ce)=>{m(he=>he.map((H,V)=>V===Q?{...H,...ce}:H))},G=Q=>m(ce=>ce.filter((he,H)=>H!==Q)),ee=async()=>{if(!c.trim()){i.error("NOME DO MODELO OBRIGATÓRIO");return}A(!0);try{const Q={nome:c.toUpperCase(),especialidadeId:f||void 0,especialidadeNome:k||void 0,instrucoes:p||void 0,items:y};if(t!=null&&t.id)await J.updateModeloReceita({...Q,id:t.id});else{const ce=await J.saveModeloReceita(Q);n({...Q,id:ce.id,items:y});return}n({...Q,id:t.id,items:y})}catch{i.error("ERRO AO SALVAR MODELO")}finally{A(!1)}},ne="w-full border border-gray-200 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none bg-white";return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center gap-3",children:[s.jsx("button",{onClick:r,className:"text-gray-400 hover:text-gray-700 flex-shrink-0",children:s.jsx(Bs,{size:18})}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase",children:t?"Editar Modelo":"Novo Modelo"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Nome do Modelo *"}),s.jsx("input",{value:c,onChange:Q=>d(Q.target.value.toUpperCase()),className:ne,placeholder:"EX: ANTIBIÓTICO PÓS-CIRÚRGICO"})]}),s.jsx("div",{className:"grid grid-cols-2 gap-3",children:s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Especialidade"}),s.jsxs("select",{value:f,onChange:Q=>h(Q.target.value),className:ne+" text-sm",children:[s.jsx("option",{value:"",children:"— Geral —"}),e.map(Q=>s.jsx("option",{value:Q.id,children:Q.nome},Q.id))]})]})}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Instrução Geral (opcional)"}),s.jsx("input",{value:p,onChange:Q=>b(Q.target.value),className:ne,placeholder:"EX: USO EM CASO DE INFECÇÃO ODONTOGÊNICA"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("label",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider",children:["Medicamentos (",y.length,")"]}),!R&&s.jsxs("button",{onClick:()=>C(!0),className:"flex items-center gap-1 text-xs font-bold text-blue-600 hover:text-blue-800",children:[s.jsx(ft,{size:13})," Adicionar"]})]}),R&&s.jsx("div",{className:"mb-2",children:s.jsx(qv,{item:S,onChange:j,onSave:B,onCancel:()=>{C(!1),j(bp)}})}),s.jsx(Xl,{onDragEnd:_,children:s.jsx(Kl,{droppableId:"items-receita",children:Q=>s.jsxs("div",{ref:Q.innerRef,...Q.droppableProps,className:"space-y-1.5",children:[y.map((ce,he)=>s.jsx(Zl,{draggableId:ce.id,index:he,children:(H,V)=>s.jsx("div",{ref:H.innerRef,...H.draggableProps,className:`rounded-xl border transition-shadow ${V.isDragging?"shadow-lg border-blue-300 bg-blue-50":"border-gray-200 bg-white"}`,children:v===he?s.jsx("div",{className:"p-2",children:s.jsx(qv,{item:{medicamento:ce.medicamento,dose:ce.dose,via:ce.via,frequencia:ce.frequencia,duracao:ce.duracao,instrucoes:ce.instrucoes},onChange:P=>F(he,P),onSave:()=>N(null),onCancel:()=>N(null)})}):s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[s.jsx("span",{...H.dragHandleProps,className:"text-gray-300 hover:text-gray-500 cursor-grab flex-shrink-0",children:s.jsx(ql,{size:15})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs font-bold text-gray-800 uppercase truncate",children:ce.medicamento}),s.jsx("p",{className:"text-[10px] text-gray-400",children:[ce.dose,ce.via,ce.frequencia,ce.duracao].filter(Boolean).join(" · ")}),ce.instrucoes&&s.jsx("p",{className:"text-[10px] text-blue-500 italic",children:ce.instrucoes})]}),s.jsx("button",{onClick:()=>N(he),className:"text-gray-300 hover:text-blue-500 flex-shrink-0",children:s.jsx(Mo,{size:13})}),s.jsx("button",{onClick:()=>G(he),className:"text-gray-300 hover:text-red-500 flex-shrink-0",children:s.jsx($t,{size:13})})]})})},ce.id)),Q.placeholder,y.length===0&&!R&&s.jsx("div",{className:"text-center py-6 text-xs text-gray-400 border-2 border-dashed border-gray-200 rounded-xl",children:"Nenhum medicamento adicionado ainda"})]})})})]})]}),s.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-end gap-2",children:[s.jsx("button",{onClick:r,className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase",children:"Cancelar"}),s.jsxs("button",{onClick:ee,disabled:O||!c.trim(),className:"px-5 py-2 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5 disabled:opacity-40",children:[s.jsx(Io,{size:14})," ",O?"Salvando...":"Salvar Modelo"]})]})]})},uM=({modelo:t,paciente:e,dentista:n,onClose:r})=>{const i=new Date().toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"});return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between print:hidden",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:r,className:"text-gray-400 hover:text-gray-700",children:s.jsx(Bs,{size:18})}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase",children:"Pré-visualização"})]}),s.jsxs("button",{onClick:()=>window.print(),className:"flex items-center gap-2 px-4 py-2 bg-gray-900 text-white rounded-lg text-xs font-bold hover:bg-black",children:[s.jsx(Va,{size:14})," Imprimir / Salvar PDF"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-100 p-6 print:p-0 print:bg-white",children:s.jsxs("div",{id:"receita-print",className:"max-w-xl mx-auto bg-white rounded-2xl shadow-sm border border-gray-200 p-8 print:shadow-none print:rounded-none print:border-0 print:max-w-full",children:[s.jsxs("div",{className:"text-center border-b-2 border-gray-800 pb-4 mb-6",children:[s.jsx("h1",{className:"text-lg font-black text-gray-900 uppercase",children:"RECEITUÁRIO"}),n&&s.jsxs("p",{className:"text-sm font-bold text-gray-700 mt-1",children:[n.nome," — CRO: ",n.cro||"—","/",n.cro_uf||"—"]})]}),s.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500 text-xs uppercase font-bold",children:"Paciente"}),s.jsx("p",{className:"font-bold text-gray-900 uppercase",children:e.nome})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500 text-xs uppercase font-bold",children:"Data"}),s.jsx("p",{className:"font-bold text-gray-900",children:i})]})]}),t.instrucoes&&s.jsx("div",{className:"mb-5 p-3 bg-amber-50 border border-amber-200 rounded-lg text-xs text-amber-800 font-medium italic",children:t.instrucoes}),s.jsx("div",{className:"space-y-4",children:t.items.map((c,d)=>s.jsxs("div",{className:"border-b border-gray-100 pb-3 last:border-0 last:pb-0",children:[s.jsxs("p",{className:"font-black text-gray-900 text-sm",children:[d+1,". ",c.medicamento]}),s.jsx("p",{className:"text-gray-700 text-sm ml-4",children:[c.dose,c.via,c.frequencia,`por ${c.duracao}`].filter(Boolean).join(" — ")}),c.instrucoes&&s.jsx("p",{className:"text-gray-500 text-xs ml-4 italic mt-0.5",children:c.instrucoes})]},c.id))}),s.jsxs("div",{className:"mt-12 pt-6 border-t-2 border-gray-800 flex justify-between items-end",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500",children:"Assinatura e Carimbo"}),s.jsx("div",{className:"h-10"})]}),s.jsx("p",{className:"text-xs text-gray-400",children:i})]})]})})]})},fM=({paciente:t,onClose:e})=>{const n=Fe(),{data:r}=_e(J.getEspecialidades),i=r??[],{data:c}=_e(J.getDentistas),d=c??[],[f,h]=w.useState([]),[p,b]=w.useState(!0),[y,m]=w.useState(""),[v,N]=w.useState(""),[S,j]=w.useState("lista"),[R,C]=w.useState(null),[O,A]=w.useState(null),k=d[0],_=w.useCallback(async()=>{b(!0);try{h(await J.getModelosReceita())}catch{n.error("Erro ao carregar modelos")}finally{b(!1)}},[]);w.useEffect(()=>{_()},[_]),w.useEffect(()=>{const G=ee=>{ee.key==="Escape"&&(S!=="lista"?j("lista"):e())};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[S,e]);const B=async G=>{confirm("Excluir este modelo?")&&(await J.deleteModeloReceita(G),h(ee=>ee.filter(ne=>ne.id!==G)))},F=f.filter(G=>{const ee=!y||G.especialidadeId===y,ne=!v||G.nome.toLowerCase().includes(v.toLowerCase());return ee&&ne});return s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[S==="lista"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-red-100 rounded-lg flex items-center justify-center",children:s.jsx(za,{size:15,className:"text-red-600"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-black text-gray-800 uppercase",children:"Modelos de Receita"}),s.jsx("p",{className:"text-[10px] text-gray-400 uppercase",children:t.nome})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>{C(null),j("editor")},className:"flex items-center gap-1.5 px-3 py-2 bg-green-600 hover:bg-green-700 text-white text-xs font-bold rounded-lg",children:[s.jsx(ft,{size:13})," Novo Modelo"]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]})]}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsxs("div",{className:"w-44 border-r border-gray-100 flex-shrink-0 overflow-y-auto bg-gray-50 p-2",children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase px-2 mb-2 tracking-wider",children:"Especialidade"}),s.jsx("button",{onClick:()=>m(""),className:`w-full text-left px-2.5 py-1.5 rounded-lg text-xs font-bold mb-0.5 transition-colors ${y?"text-gray-600 hover:bg-gray-100":"bg-blue-600 text-white"}`,children:"Todas"}),i.map(G=>s.jsx("button",{onClick:()=>m(G.id),className:`w-full text-left px-2.5 py-1.5 rounded-lg text-xs font-bold mb-0.5 transition-colors truncate ${y===G.id?"bg-blue-600 text-white":"text-gray-600 hover:bg-gray-100"}`,children:G.nome},G.id))]}),s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsx("div",{className:"p-3 border-b border-gray-100",children:s.jsxs("div",{className:"relative",children:[s.jsx(ha,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400"}),s.jsx("input",{value:v,onChange:G=>N(G.target.value),placeholder:"Buscar modelo...",className:"w-full pl-8 pr-3 py-2 border border-gray-200 rounded-lg text-xs focus:ring-2 focus:ring-blue-100 outline-none"})]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[p&&s.jsx("div",{className:"text-center py-8 text-xs text-gray-400",children:"Carregando..."}),!p&&F.length===0&&s.jsxs("div",{className:"text-center py-10",children:[s.jsx(so,{size:28,className:"text-gray-200 mx-auto mb-2"}),s.jsx("p",{className:"text-xs text-gray-400",children:"Nenhum modelo encontrado"}),s.jsx("button",{onClick:()=>{C(null),j("editor")},className:"mt-3 text-xs font-bold text-blue-600 hover:underline",children:"+ Criar primeiro modelo"})]}),F.map(G=>s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-3 hover:border-blue-200 hover:shadow-sm transition-all group",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase truncate",children:G.nome}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[G.especialidadeNome&&s.jsx("span",{className:"text-[9px] bg-blue-50 text-blue-600 px-1.5 py-0.5 rounded-full font-bold uppercase",children:G.especialidadeNome}),s.jsxs("span",{className:"text-[9px] text-gray-400",children:[G.items.length," medicamento",G.items.length!==1?"s":""]})]}),G.instrucoes&&s.jsx("p",{className:"text-[10px] text-gray-400 italic mt-1 truncate",children:G.instrucoes})]}),s.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:[s.jsx("button",{onClick:()=>{A(G),j("print")},title:"Prescrever para este paciente",className:"p-1.5 text-gray-400 hover:text-green-600 hover:bg-green-50 rounded-lg",children:s.jsx(Va,{size:13})}),s.jsx("button",{onClick:()=>{C(G),j("editor")},className:"p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg",children:s.jsx(Mo,{size:13})}),s.jsx("button",{onClick:()=>B(G.id),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg",children:s.jsx($t,{size:13})})]})]}),G.items.length>0&&s.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-50 space-y-0.5",children:[G.items.slice(0,3).map(ee=>s.jsxs("p",{className:"text-[10px] text-gray-500 truncate",children:["• ",ee.medicamento," — ",ee.dose," ",ee.frequencia]},ee.id)),G.items.length>3&&s.jsxs("p",{className:"text-[10px] text-gray-400",children:["+",G.items.length-3," mais..."]})]})]},G.id))]})]})]})]}),S==="editor"&&s.jsx(dM,{modelo:R,especialidades:i,onSave:G=>{_(),j("lista"),n.success("MODELO SALVO!")},onBack:()=>j("lista")}),S==="print"&&O&&s.jsx(uM,{modelo:O,paciente:t,dentista:k,onClose:()=>j("lista")})]})})},$d=[{categoria:"RAIO-X",icon:s.jsx(xD,{size:14}),cor:"blue",items:[{nome:"Periapical"},{nome:"Interproximal (Bite-Wing)"},{nome:"Panorâmica"},{nome:"Oclusal Superior"},{nome:"Oclusal Inferior"},{nome:"Cefalométrica Lateral"},{nome:"P.A. de Face"}]},{categoria:"TOMOGRAFIA",icon:s.jsx(Vl,{size:14}),cor:"purple",items:[{nome:"Cone Beam — Dente Único",regiao:""},{nome:"Cone Beam — Terço Anterior"},{nome:"Cone Beam — Arcada Completa Superior"},{nome:"Cone Beam — Arcada Completa Inferior"},{nome:"Cone Beam — Ambas Arcadas"},{nome:"ATM (Articulação Temporomandibular)"}]},{categoria:"OUTROS",icon:s.jsx(MD,{size:14}),cor:"green",items:[{nome:"Cefalometria Analítica"},{nome:"Fotografia Clínica Extraoral"},{nome:"Fotografia Clínica Intraoral"},{nome:"Modelos de Gesso / Escaneamento"},{nome:"Biópsia"},{nome:"Exame Laboratorial"}]}],Wp={blue:{bg:"bg-blue-50",text:"text-blue-700",border:"border-blue-200",chip:"bg-blue-100 text-blue-700"},purple:{bg:"bg-purple-50",text:"text-purple-700",border:"border-purple-200",chip:"bg-purple-100 text-purple-700"},green:{bg:"bg-green-50",text:"text-green-700",border:"border-green-200",chip:"bg-green-100 text-green-700"}},hM=({pedido:t,dentista:e,onClose:n})=>{const r=new Date().toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"}),i=$d.map(c=>({...c,selecionados:t.items.filter(d=>d.categoria===c.categoria)})).filter(c=>c.selecionados.length>0);return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between print:hidden",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-700",children:s.jsx(Bs,{size:18})}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase",children:"Pré-visualização"})]}),s.jsxs("button",{onClick:()=>window.print(),className:"flex items-center gap-2 px-4 py-2 bg-gray-900 text-white rounded-lg text-xs font-bold hover:bg-black",children:[s.jsx(Va,{size:14})," Imprimir / Salvar PDF"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-100 p-6 print:p-0 print:bg-white",children:s.jsxs("div",{className:"max-w-xl mx-auto bg-white rounded-2xl shadow-sm border border-gray-200 p-8 print:shadow-none print:rounded-none print:border-0 print:max-w-full",children:[s.jsxs("div",{className:"text-center border-b-2 border-gray-800 pb-4 mb-6",children:[s.jsx("h1",{className:"text-lg font-black text-gray-900 uppercase",children:"PEDIDO DE EXAMES"}),e&&s.jsxs("p",{className:"text-sm font-bold text-gray-700 mt-1",children:[e.nome," — CRO: ",e.cro||"—","/",e.cro_uf||"—"]})]}),s.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500 text-xs uppercase font-bold",children:"Paciente"}),s.jsx("p",{className:"font-bold text-gray-900 uppercase",children:t.pacienteNome})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500 text-xs uppercase font-bold",children:"Data"}),s.jsx("p",{className:"font-bold text-gray-900",children:r})]})]}),s.jsx("div",{className:"space-y-5",children:i.map(c=>s.jsxs("div",{children:[s.jsx("h3",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-2 border-b border-gray-100 pb-1",children:c.categoria}),s.jsx("ul",{className:"space-y-1.5",children:c.selecionados.map((d,f)=>s.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-800",children:[s.jsxs("span",{className:"font-black text-gray-400 w-5 flex-shrink-0",children:[f+1,"."]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-bold",children:d.nome}),d.regiao&&s.jsxs("span",{className:"text-gray-500",children:[" — Região: ",d.regiao]}),d.observacao&&s.jsx("p",{className:"text-xs text-gray-500 italic mt-0.5",children:d.observacao})]})]},d.id))})]},c.categoria))}),t.observacoes&&s.jsxs("div",{className:"mt-5 p-3 bg-amber-50 border border-amber-200 rounded-lg text-xs text-amber-800 italic",children:[s.jsx("span",{className:"font-black not-italic uppercase",children:"Obs: "}),t.observacoes]}),s.jsxs("div",{className:"mt-12 pt-6 border-t-2 border-gray-800 flex justify-between items-end",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500",children:"Assinatura e Carimbo"}),s.jsx("div",{className:"h-10"})]}),s.jsx("p",{className:"text-xs text-gray-400",children:r})]})]})})]})},pM=({item:t,onChange:e,onRemove:n,dragHandle:r,isDragging:i})=>{const[c,d]=w.useState(!1),f=$d.find(p=>p.categoria===t.categoria),h=Wp[(f==null?void 0:f.cor)||"blue"];return s.jsxs("div",{className:`rounded-xl border transition-all ${i?"shadow-lg":""} ${h.border} bg-white`,children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[s.jsx("span",{className:"text-gray-300 hover:text-gray-500 cursor-grab flex-shrink-0",children:r}),s.jsx("span",{className:`text-[9px] font-black px-1.5 py-0.5 rounded-full flex-shrink-0 ${h.chip}`,children:t.categoria}),s.jsx("p",{className:"flex-1 text-xs font-bold text-gray-800 truncate",children:t.nome}),s.jsx("button",{onClick:()=>d(p=>!p),className:`text-[9px] font-bold px-2 py-0.5 rounded-full border flex-shrink-0 ${c?"bg-gray-100 text-gray-600 border-gray-200":"text-gray-400 border-gray-200 hover:bg-gray-50"}`,children:c?"fechar":"detalhe"}),s.jsx("button",{onClick:n,className:"text-gray-300 hover:text-red-500 flex-shrink-0",children:s.jsx($t,{size:13})})]}),c&&s.jsxs("div",{className:"px-3 pb-3 pt-0 grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase",children:"Região / Dente"}),s.jsx("input",{value:t.regiao||"",onChange:p=>e({regiao:p.target.value}),placeholder:"ex: dente 16, arcada inf.",className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-xs focus:ring-2 focus:ring-blue-100 outline-none"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase",children:"Observação"}),s.jsx("input",{value:t.observacao||"",onChange:p=>e({observacao:p.target.value}),placeholder:"ex: urgente, pós-cirúrgico",className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-xs focus:ring-2 focus:ring-blue-100 outline-none"})]})]})]})},gM=({paciente:t,onClose:e})=>{const n=Fe(),{data:r}=_e(J.getDentistas),i=r??[],[c,d]=w.useState([]),[f,h]=w.useState(""),[p,b]=w.useState(""),[y,m]=w.useState(null),[v,N]=w.useState("editor"),[S,j]=w.useState(!1),R=i[0];w.useEffect(()=>{const G=ee=>{ee.key==="Escape"&&(v!=="editor"?N("editor"):e())};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[v,e]);const C=$d.map(G=>({...G,items:G.items.filter(ee=>!(y&&G.categoria!==y||p&&!ee.nome.toLowerCase().includes(p.toLowerCase())))})).filter(G=>G.items.length>0),O=(G,ee,ne)=>{if(c.some(oe=>oe.nome===ee&&oe.categoria===G)){n.error("EXAME JÁ ADICIONADO");return}d(oe=>[...oe,{id:`ex_${Date.now()}_${Math.random()}`,nome:ee,categoria:G,regiao:ne||"",observacao:"",ordem:oe.length}])},A=(G,ee)=>{d(ne=>ne.map(oe=>oe.id===G?{...oe,...ee}:oe))},k=G=>d(ee=>ee.filter(ne=>ne.id!==G)),_=G=>{if(!G.destination)return;const ee=[...c],[ne]=ee.splice(G.source.index,1);ee.splice(G.destination.index,0,ne),d(ee.map((oe,Q)=>({...oe,ordem:Q})))},B=async()=>{if(c.length===0){n.error("ADICIONE AO MENOS UM EXAME");return}j(!0);try{await J.savePedidoExame({pacienteId:t.id,pacienteNome:t.nome,profissionalId:R==null?void 0:R.id,profissionalNome:R==null?void 0:R.nome,data:new Date().toISOString().slice(0,10),observacoes:f||void 0,items:c}),N("print")}catch{n.error("ERRO AO SALVAR PEDIDO")}finally{j(!1)}},F={id:"preview",pacienteId:t.id,pacienteNome:t.nome,profissionalId:R==null?void 0:R.id,profissionalNome:R==null?void 0:R.nome,data:new Date().toISOString().slice(0,10),observacoes:f,items:c};return v==="print"?s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsx("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col overflow-hidden",children:s.jsx(hM,{pedido:F,dentista:R,onClose:()=>N("editor")})})}):s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between flex-shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-indigo-100 rounded-lg flex items-center justify-center",children:s.jsx(ev,{size:15,className:"text-indigo-600"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-black text-gray-800 uppercase",children:"Pedido de Exames"}),s.jsx("p",{className:"text-[10px] text-gray-400 uppercase",children:t.nome})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsxs("div",{className:"w-80 flex-shrink-0 border-r border-gray-100 flex flex-col",children:[s.jsxs("div",{className:"p-3 border-b border-gray-100 space-y-2",children:[s.jsxs("div",{className:"relative",children:[s.jsx(ha,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400"}),s.jsx("input",{value:p,onChange:G=>b(G.target.value),placeholder:"Buscar exame...",className:"w-full pl-8 pr-3 py-2 border border-gray-200 rounded-lg text-xs focus:ring-2 focus:ring-blue-100 outline-none"})]}),s.jsxs("div",{className:"flex gap-1 flex-wrap",children:[s.jsx("button",{onClick:()=>m(null),className:`text-[10px] font-bold px-2 py-0.5 rounded-full border transition-colors ${y?"text-gray-500 border-gray-200 hover:bg-gray-50":"bg-gray-800 text-white border-gray-800"}`,children:"Todos"}),$d.map(G=>{const ee=Wp[G.cor];return s.jsx("button",{onClick:()=>m(ne=>ne===G.categoria?null:G.categoria),className:`text-[10px] font-bold px-2 py-0.5 rounded-full border transition-colors ${y===G.categoria?ee.chip+" border-transparent":"text-gray-500 border-gray-200 hover:bg-gray-50"}`,children:G.categoria},G.categoria)})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-4",children:[C.map(G=>{const ee=Wp[G.cor];return s.jsxs("div",{children:[s.jsxs("div",{className:`flex items-center gap-1.5 mb-2 ${ee.text}`,children:[G.icon,s.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider",children:G.categoria})]}),s.jsx("div",{className:"space-y-1",children:G.items.map(ne=>{const oe=c.some(Q=>Q.nome===ne.nome&&Q.categoria===G.categoria);return s.jsxs("button",{onClick:()=>O(G.categoria,ne.nome,ne.regiao),disabled:oe,className:`w-full text-left px-3 py-2 rounded-lg text-xs transition-all flex items-center justify-between group ${oe?`${ee.bg} ${ee.text} font-bold opacity-60 cursor-default`:`border border-gray-100 hover:${ee.bg} hover:${ee.border} hover:${ee.text} text-gray-600 font-medium`}`,children:[s.jsx("span",{children:ne.nome}),oe?s.jsx("span",{className:"text-[9px] font-black opacity-70",children:"✓"}):s.jsx(ft,{size:12,className:"opacity-0 group-hover:opacity-100 flex-shrink-0"})]},ne.nome)})})]},G.categoria)}),C.length===0&&s.jsx("p",{className:"text-xs text-gray-400 text-center py-6",children:"Nenhum exame encontrado"})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"p-3 border-b border-gray-100 flex items-center justify-between",children:[s.jsxs("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider",children:["Exames Selecionados ",c.length>0&&s.jsxs("span",{className:"text-blue-600 ml-1",children:["(",c.length,")"]})]}),c.length>0&&s.jsx("button",{onClick:()=>d([]),className:"text-[10px] text-red-500 hover:text-red-700 font-bold",children:"Limpar tudo"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-2xl flex items-center justify-center mb-3",children:s.jsx(ev,{size:24,className:"text-gray-300"})}),s.jsx("p",{className:"text-sm font-bold text-gray-400",children:"Nenhum exame selecionado"}),s.jsx("p",{className:"text-xs text-gray-300 mt-1",children:"Clique nos exames ao lado para adicionar"})]}):s.jsx(Xl,{onDragEnd:_,children:s.jsx(Kl,{droppableId:"exames-selecionados",children:G=>s.jsxs("div",{ref:G.innerRef,...G.droppableProps,className:"space-y-2",children:[c.map((ee,ne)=>s.jsx(Zl,{draggableId:ee.id,index:ne,children:(oe,Q)=>s.jsx("div",{ref:oe.innerRef,...oe.draggableProps,children:s.jsx(pM,{item:ee,isDragging:Q.isDragging,dragHandle:s.jsx("span",{...oe.dragHandleProps,children:s.jsx(ql,{size:15})}),onChange:ce=>A(ee.id,ce),onRemove:()=>k(ee.id)})})},ee.id)),G.placeholder]})})})}),s.jsxs("div",{className:"p-3 border-t border-gray-100 space-y-3 flex-shrink-0",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[9px] font-black text-gray-400 uppercase tracking-wider mb-1",children:"Observações (opcional)"}),s.jsx("input",{value:f,onChange:G=>h(G.target.value),placeholder:"ex: urgente, pós-cirúrgico, encaminhar para...",className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-xs focus:ring-2 focus:ring-blue-100 outline-none"})]}),s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsx("button",{onClick:e,className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase",children:"Cancelar"}),s.jsxs("button",{onClick:B,disabled:c.length===0||S,className:"flex items-center gap-2 px-5 py-2 bg-indigo-600 hover:bg-indigo-700 text-white font-bold rounded-lg text-xs uppercase disabled:opacity-40",children:[s.jsx(Va,{size:14})," ",S?"Salvando...":"Gerar Pedido"]})]})]})]})]})]})})},$v=t=>{let e;const n=new Set,r=(p,b)=>{const y=typeof p=="function"?p(e):p;if(!Object.is(y,e)){const m=e;e=b??(typeof y!="object"||y===null)?y:Object.assign({},e,y),n.forEach(v=>v(e,m))}},i=()=>e,f={setState:r,getState:i,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=e=t(r,i,f);return f},mM=(t=>t?$v(t):$v),xM=t=>t;function bM(t,e=xM){const n=Ve.useSyncExternalStore(t.subscribe,Ve.useCallback(()=>e(t.getState()),[t,e]),Ve.useCallback(()=>e(t.getInitialState()),[t,e]));return Ve.useDebugValue(n),n}const Yv=t=>{const e=mM(t),n=r=>bM(e,r);return Object.assign(n,e),n},yM=(t=>t?Yv(t):Yv),rS=yM(t=>({paciente:null,dentista:null,credenciada:"CASSEMS - SEDE CENTRAL",items:[],setPaciente:e=>t({paciente:e}),setDentista:e=>t({dentista:e}),setCredenciada:e=>t({credenciada:e}),addItem:e=>t(n=>({items:[...n.items,e].slice(0,20)})),removeItem:e=>t(n=>({items:n.items.filter(r=>r.id!==e)})),clear:()=>t({paciente:null,dentista:null,items:[]})})),xs={q1:[14,13,12,11,18,17,16,15],q2:[21,22,23,24,25,26,27,28],q4:[44,43,42,41,48,47,46,45],q3:[31,32,33,34,35,36,37,38],extras:{q1:19,q2:29,q4:49,q3:39}},hd={q1:[null,53,52,51,null,null,55,54],q2:[61,62,63,null,64,65,null,null],q4:[null,43,42,41,null,null,46,45],q3:[71,72,73,null,74,75,null,null]},vM=()=>{var he,H;const t=rS(),e=Fe(),[n,r]=w.useState([]),[i,c]=w.useState([]),[d,f]=w.useState([]),[h,p]=w.useState([]),[b,y]=w.useState(""),[m,v]=w.useState(null),[N,S]=w.useState("ADULTO"),[j,R]=w.useState([]),[C,O]=w.useState(null),[A,k]=w.useState(""),[_,B]=w.useState("");w.useEffect(()=>{(async()=>{const P=await J.getPacientes(),W=await J.getDentistas(),te=await J.getEspecialidades(),T=await J.getProcedimentos();r(P),c(W),f(te),p(T)})()},[]);const F=w.useMemo(()=>b?h.filter(V=>V.especialidadeId===b):[],[b,h]),G=V=>{if((m==null?void 0:m.tipo_regiao)!=="DENTE"){e.error("ESTE PROCEDIMENTO NÃO PERMITE SELEÇÃO DE DENTE INDIVIDUAL.");return}O(null),R(P=>P.includes(V)?P.filter(W=>W!==V):[...P,V])},ee=V=>{if((m==null?void 0:m.tipo_regiao)!=="ARCO"){e.error("ESTE PROCEDIMENTO NÃO PERMITE SELEÇÃO DE ARCO.");return}R([]),O(V)},ne=()=>{if(!m){e.error("SELECIONE UM PROCEDIMENTO PRIMEIRO.");return}if(m.tipo_regiao==="DENTE"&&j.length===0){e.error("ESTE PROCEDIMENTO EXIGE A SELEÇÃO DE AO MENOS UM DENTE.");return}if(m.tipo_regiao==="ARCO"&&!C){e.error("ESTE PROCEDIMENTO EXIGE A SELEÇÃO DE UM ARCO (AI/AS).");return}if(m.exige_face&&(!A||A.trim()==="")){e.error("A FACE É OBRIGATÓRIA PARA ESTE PROCEDIMENTO.");return}const V={id:Math.random().toString(36).substring(7),procedimentoId:m.id,codigoTUSS:m.codigo||"000000",codigoInterno:m.codigoInterno||"",descricao:m.nome,dente:j.join(", "),arco:C||void 0,face:A,quantidade:1,valorUnitario:m.valorParticular||0,valorTotal:m.valorParticular||0,observacao:_};t.addItem(V),e.success("ADICIONADO AO RASCUNHO."),R([]),O(null),k(""),B("")},oe=async()=>{if(!t.paciente||!t.dentista||t.items.length===0){e.error("PACIENTE, DENTISTA E PELO MENOS 1 ITEM SÃO OBRIGATÓRIOS.");return}try{e.success("GTO GERADA COM SUCESSO!"),t.clear(),y(""),v(null)}catch{e.error("ERRO AO GERAR GTO.")}},Q=t.items.reduce((V,P)=>V+P.valorTotal,0),ce=(V,P)=>{if(V===null)return s.jsx("div",{className:"w-9 h-9"},`empty-${P}`);const W=V.toString(),te=j.includes(W),T=!!m&&m.tipo_regiao!=="DENTE";return s.jsx("button",{onClick:()=>G(W),disabled:T,className:`w-9 h-9 rounded-lg border-2 text-[11px] font-black transition-all shadow-sm flex items-center justify-center - ${te?"bg-blue-600 border-blue-700 text-white scale-110 z-10":T?"bg-gray-50 border-gray-100 text-gray-300 cursor-not-allowed opacity-50":"bg-white border-gray-200 text-gray-700 hover:border-blue-400 hover:bg-blue-50"} - `,children:W},W)};return s.jsxs("div",{className:"space-y-6",children:[s.jsx(cn,{title:"LANÇAR GTO",description:"MONTGEM DINÂMICA DE GUIA ODONTOLÓGICA (GTO)."}),s.jsxs("div",{className:"grid grid-cols-12 gap-6 items-start",children:[s.jsxs("div",{className:"col-span-12 lg:col-span-8 space-y-6",children:[s.jsxs("div",{className:"bg-white rounded-3xl border border-gray-100 shadow-xl p-8 space-y-6",children:[s.jsx("div",{className:"flex justify-center mb-4",children:s.jsxs("div",{className:"inline-flex bg-gray-100 p-1 rounded-xl shadow-inner",children:[s.jsx("button",{onClick:()=>{S("ADULTO"),R([])},className:`px-8 py-2 rounded-lg text-xs font-black transition-all uppercase ${N==="ADULTO"?"bg-blue-600 text-white shadow-md scale-105":"text-gray-500 hover:text-gray-800"}`,children:"Adulto"}),s.jsx("button",{onClick:()=>{S("CRIANCA"),R([])},className:`px-8 py-2 rounded-lg text-xs font-black transition-all uppercase ${N==="CRIANCA"?"bg-blue-600 text-white shadow-md scale-105":"text-gray-500 hover:text-gray-800"}`,children:"Criança"})]})}),s.jsxs("div",{className:"relative border-t border-b border-gray-50 py-10",children:[s.jsx("div",{className:"absolute left-1/2 top-4 bottom-4 w-[2px] bg-gray-200 -translate-x-1/2"}),s.jsx("div",{className:"absolute top-1/2 left-4 right-4 h-[2px] bg-gray-200 -translate-y-1/2"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-16",children:[s.jsxs("div",{className:"flex justify-end items-center gap-2 pr-2",children:[N==="ADULTO"&&ce(xs.extras.q1),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:(N==="ADULTO"?xs.q1:hd.q1).map((V,P)=>ce(V,P))})]}),s.jsxs("div",{className:"flex justify-start items-center gap-2 pl-2",children:[s.jsx("div",{className:"grid grid-cols-4 gap-2",children:(N==="ADULTO"?xs.q2:hd.q2).map((V,P)=>ce(V,P))}),N==="ADULTO"&&ce(xs.extras.q2)]}),s.jsxs("div",{className:"flex justify-end items-center gap-2 pr-2",children:[N==="ADULTO"&&ce(xs.extras.q4),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:(N==="ADULTO"?xs.q4:hd.q4).map((V,P)=>ce(V,P))})]}),s.jsxs("div",{className:"flex justify-start items-center gap-2 pl-2",children:[s.jsx("div",{className:"grid grid-cols-4 gap-2",children:(N==="ADULTO"?xs.q3:hd.q3).map((V,P)=>ce(V,P))}),N==="ADULTO"&&ce(xs.extras.q3)]})]})]}),s.jsxs("div",{className:"flex justify-center gap-4 pt-4",children:[s.jsx("button",{onClick:()=>ee("AI"),disabled:!!m&&m.tipo_regiao!=="ARCO",className:`px-10 py-3 rounded-2xl border-2 font-black text-sm uppercase transition-all shadow-sm - ${C==="AI"?"bg-amber-500 border-amber-600 text-white":m&&m.tipo_regiao!=="ARCO"?"bg-gray-50 border-gray-100 text-gray-300 cursor-not-allowed opacity-50":"bg-white border-gray-100 text-gray-500 hover:border-amber-400"}`,children:"AI - Inferior"}),s.jsx("button",{onClick:()=>ee("AS"),disabled:!!m&&m.tipo_regiao!=="ARCO",className:`px-10 py-3 rounded-2xl border-2 font-black text-sm uppercase transition-all shadow-sm - ${C==="AS"?"bg-amber-500 border-amber-600 text-white":m&&m.tipo_regiao!=="ARCO"?"bg-gray-50 border-gray-100 text-gray-300 cursor-not-allowed opacity-50":"bg-white border-gray-100 text-gray-500 hover:border-amber-400"}`,children:"AS - Superior"})]})]}),s.jsxs("div",{className:"bg-white rounded-3xl border border-gray-100 overflow-hidden shadow-xl",children:[s.jsxs("div",{className:"bg-[#d49a4a] p-4 text-white font-black text-sm uppercase flex justify-between items-center tracking-widest",children:[s.jsx("span",{children:"PROCEDIMENTOS DO RASCUNHO"}),s.jsxs("div",{className:"bg-white/20 px-3 py-1 rounded-full text-[10px]",children:[t.items.length,"/20 ITENS"]})]}),s.jsxs("div",{className:"p-6 space-y-4",children:[t.items.length===0&&s.jsxs("div",{className:"py-16 text-center text-gray-300 font-bold uppercase flex flex-col items-center gap-4",children:[s.jsx("div",{className:"w-16 h-16 bg-gray-50 rounded-full flex items-center justify-center outline outline-gray-100 outline-offset-4",children:s.jsx(gu,{size:32})}),"NÃO HÁ ITENS ADICIONADOS"]}),t.items.map(V=>{var P;return s.jsxs("div",{className:"border border-gray-100 rounded-2xl p-5 bg-gray-50/30 hover:bg-white transition-all shadow-sm group",children:[s.jsxs("div",{className:"flex justify-between items-start mb-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{className:"bg-blue-600 text-white text-[10px] font-black px-2 py-1 rounded-md uppercase shadow-sm",children:["COD ",V.codigoTUSS]}),s.jsx("h4",{className:"font-black text-gray-900 text-sm uppercase tracking-tight",children:V.descricao})]}),s.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-gray-400 font-bold uppercase",children:[s.jsx($n,{size:12})," ",(P=t.paciente)==null?void 0:P.nome]})]}),s.jsx("button",{onClick:()=>t.removeItem(V.id),className:"text-gray-300 hover:text-red-600 p-2 transition-colors",children:s.jsx($t,{size:20})})]}),s.jsxs("div",{className:"grid grid-cols-4 gap-6 text-[11px] font-black text-gray-500 uppercase tracking-wider mb-4 border-t border-gray-100 pt-4",children:[s.jsxs("div",{children:["DENTE: ",s.jsx("span",{className:"text-blue-600 ml-1",children:V.dente||"--"})]}),s.jsxs("div",{children:["ARCO: ",s.jsx("span",{className:"text-amber-600 ml-1",children:V.arco||"--"})]}),s.jsxs("div",{children:["FACE: ",s.jsx("span",{className:"text-gray-900 ml-1",children:V.face||"--"})]}),s.jsxs("div",{children:["VALOR: ",s.jsxs("span",{className:"text-green-600 ml-1 text-xs",children:["R$ ",V.valorTotal.toFixed(2)]})]})]}),V.observacao&&s.jsxs("div",{className:"text-[11px] text-gray-500 bg-white p-3 border border-gray-100 rounded-xl leading-relaxed",children:[s.jsx("span",{className:"font-black text-gray-400 uppercase mr-2 opacity-50",children:"OBS:"})," ",V.observacao]})]},V.id)}),s.jsxs("div",{className:"pt-6 border-t-2 border-dotted border-gray-200 flex justify-between items-center",children:[s.jsxs("button",{className:"flex items-center gap-2 text-blue-600 font-black text-[11px] uppercase hover:bg-blue-50 px-4 py-2 rounded-xl transition-all",children:[s.jsx(Ad,{size:16})," ANEXAR DOCUMENTOS"]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-[0.2em] mb-1",children:"TOTAL ACUMULADO"}),s.jsxs("h3",{className:"text-3xl font-black text-gray-900 p-2 bg-gray-50 rounded-2xl border border-gray-100 shadow-inner",children:["R$ ",Q.toFixed(2)]})]})]})]})]})]}),s.jsxs("div",{className:"col-span-12 lg:col-span-4 space-y-4 sticky top-6",children:[s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xl space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3 text-blue-600 font-black text-base uppercase tracking-wider",children:[s.jsx($n,{size:20,strokeWidth:3})," 01. Paciente"]}),s.jsxs("select",{value:((he=t.paciente)==null?void 0:he.id)||"",onChange:V=>{const P=n.find(W=>W.id===V.target.value);t.setPaciente(P||null)},className:"w-full p-4 bg-gray-50 border-2 border-gray-100 rounded-2xl font-black text-gray-800 text-sm focus:border-blue-500 outline-none transition-all uppercase",children:[s.jsx("option",{value:"",children:"SELECIONE O BENEFICIÁRIO"}),n.map(V=>s.jsx("option",{value:V.id,children:V.nome},V.id))]})]}),s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xl space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-3 text-orange-500 font-black text-base uppercase tracking-wider",children:[s.jsx(ua,{size:20,strokeWidth:3})," 02. Especialidade"]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("select",{value:b,onChange:V=>{y(V.target.value),v(null)},className:"w-full p-4 bg-gray-50 border-2 border-gray-100 rounded-2xl font-black text-gray-700 text-sm focus:border-orange-400 outline-none transition-all uppercase",children:[s.jsx("option",{value:"",children:"ESCOLHA A ÁREA..."}),d.map(V=>s.jsx("option",{value:V.id,children:V.nome},V.id))]}),b&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("select",{value:(m==null?void 0:m.id)||"",onChange:V=>{const P=h.find(W=>W.id===V.target.value);v(P||null),R([]),O(null)},className:"w-full p-4 bg-white border-2 border-orange-100 rounded-2xl font-black text-gray-800 text-sm shadow-inner uppercase",children:[s.jsx("option",{value:"",children:"BUSCAR PROCEDIMENTO"}),F.map(V=>s.jsx("option",{value:V.id,children:V.nome},V.id))]}),m&&s.jsxs("div",{className:"bg-orange-50 p-3 rounded-xl border border-orange-100 animate-in fade-in slide-in-from-top-1 duration-300",children:[s.jsx("p",{className:"text-[9px] font-black text-orange-600 uppercase mb-1",children:"REGRAS DE SELEÇÃO"}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("span",{className:"text-[10px] font-bold text-orange-800 flex items-center gap-1",children:[s.jsx(Ts,{size:10}),m.tipo_regiao==="DENTE"?"EXIGE DENTE(S)":m.tipo_regiao==="ARCO"?"EXIGE ARCO (AI/AS)":"PROCEDIMENTO GERAL"]}),m.exige_face&&s.jsxs("span",{className:"text-[10px] font-bold text-red-600 flex items-center gap-1",children:[s.jsx(Ts,{size:10})," EXIGE FACE CLINICA"]})]})]})]})]})]}),s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xl space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3 text-[#2d6a4f] font-black text-base uppercase tracking-wider",children:[s.jsx(fo,{size:20,strokeWidth:3,className:"bg-green-100 p-1 rounded-full text-green-700"})," 03. Dentista Executor"]}),s.jsxs("select",{value:((H=t.dentista)==null?void 0:H.id)||"",onChange:V=>{const P=i.find(W=>W.id===V.target.value);t.setDentista(P||null)},className:"w-full p-4 bg-gray-50 border-2 border-gray-100 rounded-2xl font-black text-gray-800 text-sm focus:border-green-500 outline-none transition-all uppercase",children:[s.jsx("option",{value:"",children:"SELECIONE O PROFISSIONAL"}),i.map(V=>s.jsx("option",{value:V.id,children:V.nome},V.id))]})]}),s.jsx("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xl space-y-4",children:s.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"block text-[10px] font-black text-gray-400 uppercase tracking-widest mb-2 flex justify-between",children:[s.jsx("span",{children:"Face (O, M, D, V, L, P)"}),(m==null?void 0:m.exige_face)&&s.jsx("span",{className:"text-red-500 font-black animate-pulse",children:"* OBRIGATÓRIO"})]}),s.jsx("input",{type:"text",value:A,onChange:V=>k(V.target.value.toUpperCase()),disabled:(m==null?void 0:m.tipo_regiao)==="GERAL"&&!(m!=null&&m.exige_face),className:`w-full p-4 border-2 rounded-2xl text-sm font-black outline-none transition-all - ${m!=null&&m.exige_face?"bg-red-50 border-red-100 focus:border-red-400":"bg-gray-50 border-gray-100 focus:border-amber-400"} - `,placeholder:m!=null&&m.exige_face?"DIGITE AS FACES...":"OPCIONAL"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-400 uppercase tracking-widest mb-2 italic",children:"Observações Clínicas"}),s.jsxs("div",{className:"relative",children:[s.jsx("textarea",{value:_,onChange:V=>B(V.target.value),className:"w-full p-4 bg-gray-50 border-2 border-gray-100 rounded-2xl text-[11px] h-20 focus:border-amber-400 outline-none transition-all"}),s.jsx(zN,{size:24,className:"absolute bottom-4 right-4 text-green-500 opacity-50"})]})]})]})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 p-2",children:[s.jsxs("button",{onClick:ne,className:"col-span-3 bg-[#2d6a4f] text-white py-5 rounded-3xl font-black text-lg uppercase shadow-2xl shadow-green-200 hover:bg-[#1b4332] active:scale-95 transition-all flex items-center justify-center gap-3 group",children:["ADICIONAR ITEM ",s.jsx(Ts,{className:"group-hover:translate-x-1 transition-transform"})]}),s.jsx("button",{onClick:oe,className:"col-span-1 bg-gray-900 text-white py-5 rounded-3xl flex items-center justify-center shadow-xl hover:bg-black active:scale-95 transition-all",title:"FINALIZAR GTO",children:s.jsx(fo,{size:32,strokeWidth:4})})]})]})]})]})},NM=["V","L","M","D","O"],EM=["Superior","Inferior","Ambas"],SM=["Pix","Cartão","Dinheiro","Boleto"],jM=["Pendente","Pago","Atrasado"],Zn=t=>t.toLocaleString("pt-BR",{style:"currency",currency:"BRL"});function Qv(t,e){const n=new Date(t+"T12:00:00");return n.setMonth(n.getMonth()+e),n.toISOString().slice(0,10)}const AM=({item:t,onChange:e,onRemove:n})=>{const[r,i]=w.useState(t.proc.tipo_regiao!=="GERAL"),c="border border-gray-200 rounded-lg px-2 py-1.5 text-xs focus:ring-2 focus:ring-blue-100 outline-none w-full";return s.jsxs("div",{className:"border border-gray-200 rounded-xl bg-white overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase truncate",children:t.proc.nome}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[t.proc.especialidadeNome&&s.jsx("span",{className:"text-[9px] bg-blue-50 text-blue-600 px-1.5 py-0.5 rounded-full font-bold uppercase",children:t.proc.especialidadeNome}),s.jsx("span",{className:"text-[10px] font-bold text-green-600",children:Zn(t.valorUnit*t.quantidade)}),t.quantidade>1&&s.jsxs("span",{className:"text-[9px] text-gray-400",children:[t.quantidade,"× ",Zn(t.valorUnit)]})]})]}),s.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[s.jsx("button",{onClick:()=>e({quantidade:Math.max(1,t.quantidade-1)}),className:"w-6 h-6 rounded-full border border-gray-200 flex items-center justify-center hover:bg-gray-100",children:s.jsx(FN,{size:10})}),s.jsx("span",{className:"w-5 text-center text-xs font-bold",children:t.quantidade}),s.jsx("button",{onClick:()=>e({quantidade:t.quantidade+1}),className:"w-6 h-6 rounded-full border border-gray-200 flex items-center justify-center hover:bg-gray-100",children:s.jsx(ft,{size:10})})]}),s.jsx("button",{onClick:()=>i(d=>!d),className:"text-gray-300 hover:text-gray-600 flex-shrink-0",children:s.jsx(_o,{size:14,className:`transition-transform ${r?"rotate-180":""}`})}),s.jsx("button",{onClick:n,className:"text-gray-300 hover:text-red-500 flex-shrink-0",children:s.jsx($t,{size:13})})]}),r&&s.jsxs("div",{className:"border-t border-gray-100 bg-gray-50/50 px-3 py-2.5 grid grid-cols-2 gap-2",children:[t.proc.tipo_regiao==="DENTE"&&s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Dente(s)"}),s.jsx("input",{value:t.dente,onChange:d=>e({dente:d.target.value}),className:c,placeholder:"ex: 16, 21-22"})]}),t.proc.tipo_regiao==="ARCO"&&s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Arcada"}),s.jsxs("select",{value:t.arco,onChange:d=>e({arco:d.target.value}),className:c,children:[s.jsx("option",{value:"",children:"— Selecione —"}),EM.map(d=>s.jsx("option",{children:d},d))]})]}),t.proc.exige_face&&s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Face(s)"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:NM.map(d=>s.jsx("button",{type:"button",onClick:()=>{const f=t.face.split("").filter(Boolean),h=f.includes(d)?f.filter(p=>p!==d):[...f,d];e({face:h.join("")})},className:`w-7 h-7 rounded-lg text-[10px] font-black border transition-colors ${t.face.includes(d)?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-500 border-gray-200 hover:border-blue-400"}`,children:d},d))})]}),s.jsxs("div",{className:t.proc.tipo_regiao!=="GERAL"||t.proc.exige_face?"":"col-span-2",children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Obs"}),s.jsx("input",{value:t.observacao,onChange:d=>e({observacao:d.target.value}),className:c,placeholder:"observação opcional"})]})]})]})},wM=({patient:t,onClose:e,onSaved:n})=>{const r=Fe(),{data:i}=_e(J.getProcedimentos),{data:c}=_e(J.getEspecialidades),{data:d}=_e(J.getPlanos),f=i??[],h=c??[],p=d??[],[b,y]=w.useState(""),[m,v]=w.useState(""),[N,S]=w.useState([]),[j,R]=w.useState(!1),[C,O]=w.useState("R$"),[A,k]=w.useState(""),[_,B]=w.useState(""),[F,G]=w.useState(1),[ee,ne]=w.useState(new Date().toISOString().slice(0,10)),[oe,Q]=w.useState("Pix"),[ce,he]=w.useState("Pendente"),H=w.useMemo(()=>t.convenio?p.find(ue=>ue.nome===t.convenio)??null:null,[t.convenio,p]),V=ue=>{var Oe;if(H){const Ce=(Oe=ue.valoresPlanos)==null?void 0:Oe.find(yt=>yt.planoId===H.id);if(Ce)return Ce.valor}return ue.valorParticular??0},P=ue=>{if(N.some(Oe=>Oe.proc.id===ue.id)){S(Oe=>Oe.map(Ce=>Ce.proc.id===ue.id?{...Ce,quantidade:Ce.quantidade+1}:Ce));return}S(Oe=>[...Oe,{uid:`${ue.id}_${Date.now()}`,proc:ue,quantidade:1,dente:"",face:"",arco:"",observacao:"",valorUnit:V(ue)}])},W=(ue,Oe)=>S(Ce=>Ce.map(yt=>yt.uid===ue?{...yt,...Oe}:yt)),te=ue=>S(Oe=>Oe.filter(Ce=>Ce.uid!==ue)),T=N.reduce((ue,Oe)=>ue+Oe.valorUnit*Oe.quantidade,0),X=parseFloat(A)||0,ie=C==="%"?T*X/100:X,de=parseFloat(_)||0,ve=Math.max(0,T-ie-de),je=F>0?ve/F:0,Te=w.useMemo(()=>f.filter(ue=>!(m&&ue.especialidadeId!==m||b&&!ue.nome.toLowerCase().includes(b.toLowerCase()))),[f,m,b]),bt=w.useMemo(()=>{const ue={};return Te.forEach(Oe=>{const Ce=Oe.especialidadeId||"__geral";ue[Ce]||(ue[Ce]={esp:h.find(yt=>yt.id===Oe.especialidadeId)??null,procs:[]}),ue[Ce].procs.push(Oe)}),Object.values(ue).sort((Oe,Ce)=>{var yt,Yn;return(((yt=Oe.esp)==null?void 0:yt.ordem)??99)-(((Yn=Ce.esp)==null?void 0:Yn.ordem)??99)})},[Te,h]),Ue=async()=>{if(N.length===0){r.error("SELECIONE AO MENOS UM PROCEDIMENTO");return}R(!0);try{const ue=[],Oe=N.map(Ce=>{const yt=[Ce.dente,Ce.arco,Ce.face].filter(Boolean).join("/");return Ce.proc.nome+(yt?` (${yt})`:"")+(Ce.quantidade>1?` x${Ce.quantidade}`:"")}).join(", ");de>0&&ue.push({id:crypto.randomUUID(),pacienteNome:t.nome,descricao:`ENTRADA — ${Oe}`,valor:de,dataVencimento:ee,status:"Pago",formaPagamento:oe});for(let Ce=0;Ce1?` — ${Ce+1}/${F}`:"";ue.push({id:crypto.randomUUID(),pacienteNome:t.nome,descricao:Oe+yt,valor:parseFloat(je.toFixed(2)),dataVencimento:de>0?Qv(ee,Ce+1):Qv(ee,Ce),status:Ce===0&&F===1||Ce===0?ce:"Pendente",formaPagamento:oe})}for(const Ce of ue)await J.saveFinanceiro(Ce);r.success(`${ue.length} LANÇAMENTO(S) GERADO(S) COM SUCESSO!`),n(),e()}catch{r.error("ERRO AO SALVAR LANÇAMENTOS")}finally{R(!1)}},It="border border-gray-200 rounded-lg px-2.5 py-2 text-sm focus:ring-2 focus:ring-blue-100 outline-none w-full bg-white",Rn=ue=>N.some(Oe=>Oe.proc.id===ue);return s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[s.jsxs("div",{className:"flex-shrink-0 px-5 py-4 border-b border-gray-100 flex items-center justify-between bg-gradient-to-r from-emerald-50 to-white",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-9 h-9 bg-emerald-100 rounded-xl flex items-center justify-center",children:s.jsx(Ba,{size:18,className:"text-emerald-600"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-black text-gray-800 uppercase",children:"Lançar Procedimento"}),s.jsxs("p",{className:"text-[10px] text-gray-400 uppercase font-medium",children:[t.nome,H&&s.jsx("span",{className:"ml-2 bg-emerald-100 text-emerald-700 px-1.5 py-0.5 rounded-full font-bold",children:H.nome})]})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600 p-1.5 hover:bg-gray-100 rounded-lg transition-colors",children:s.jsx(Qe,{size:18})})]}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsxs("div",{className:"w-72 flex-shrink-0 border-r border-gray-100 flex flex-col bg-gray-50/30",children:[s.jsxs("div",{className:"p-3 space-y-2 border-b border-gray-100 flex-shrink-0",children:[s.jsxs("div",{className:"relative",children:[s.jsx(ha,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400"}),s.jsx("input",{value:b,onChange:ue=>y(ue.target.value),placeholder:"Buscar procedimento...",className:"w-full pl-8 pr-3 py-2 border border-gray-200 rounded-lg text-xs focus:ring-2 focus:ring-blue-100 outline-none bg-white"})]}),s.jsxs("div",{className:"flex gap-1 flex-wrap",children:[s.jsx("button",{onClick:()=>v(""),className:`text-[10px] font-bold px-2 py-0.5 rounded-full border transition-colors ${m?"text-gray-500 border-gray-200 hover:bg-gray-100":"bg-gray-800 text-white border-gray-800"}`,children:"Todas"}),h.map(ue=>s.jsx("button",{onClick:()=>v(Oe=>Oe===ue.id?"":ue.id),className:`text-[10px] font-bold px-2 py-0.5 rounded-full border transition-colors ${m===ue.id?"bg-blue-600 text-white border-blue-600":"text-gray-500 border-gray-200 hover:bg-gray-100"}`,children:ue.nome},ue.id))]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-3",children:[!i&&s.jsx("div",{className:"flex justify-center pt-8",children:s.jsx(Ct,{size:18,className:"animate-spin text-gray-300"})}),bt.map((ue,Oe)=>s.jsxs("div",{children:[ue.esp&&s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest px-2 mb-1",children:ue.esp.nome}),s.jsx("div",{className:"space-y-0.5",children:ue.procs.map(Ce=>{const yt=V(Ce),Yn=Rn(Ce.id);return s.jsxs("button",{onClick:()=>P(Ce),className:`w-full text-left px-2.5 py-2 rounded-lg transition-all flex items-center justify-between gap-2 group ${Yn?"bg-emerald-50 border border-emerald-200":"border border-transparent hover:bg-white hover:border-gray-200 hover:shadow-sm"}`,children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:`text-xs font-bold truncate ${Yn?"text-emerald-700":"text-gray-700"}`,children:Ce.nome}),Ce.codigo&&s.jsx("p",{className:"text-[9px] text-gray-400",children:Ce.codigo})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:`text-[10px] font-black ${Yn?"text-emerald-600":"text-green-600"}`,children:Zn(yt)}),Yn?s.jsx(fo,{size:13,className:"text-emerald-500"}):s.jsx(ft,{size:13,className:"text-gray-300 group-hover:text-blue-500"})]})]},Ce.id)})})]},Oe)),i&&Te.length===0&&s.jsx("p",{className:"text-xs text-gray-400 text-center pt-6",children:"Nenhum procedimento encontrado"})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-2",children:N.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-2xl flex items-center justify-center mb-3",children:s.jsx(gO,{size:24,className:"text-gray-300"})}),s.jsx("p",{className:"text-sm font-bold text-gray-400",children:"Nenhum procedimento selecionado"}),s.jsx("p",{className:"text-xs text-gray-300 mt-1",children:"Clique nos procedimentos ao lado para adicionar"})]}):N.map(ue=>s.jsx(AM,{item:ue,onChange:Oe=>W(ue.uid,Oe),onRemove:()=>te(ue.uid)},ue.uid))}),s.jsxs("div",{className:"flex-shrink-0 border-t border-gray-100 bg-gray-50/50 p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"font-bold text-gray-500 uppercase text-xs",children:"Subtotal"}),s.jsx("span",{className:"font-black text-gray-800 text-base",children:Zn(T)})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Desconto"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx("button",{onClick:()=>O(ue=>ue==="R$"?"%":"R$"),className:"px-2 py-2 border border-gray-200 rounded-lg text-[10px] font-black text-gray-500 hover:bg-gray-100 flex-shrink-0 bg-white",children:C==="R$"?s.jsx(LN,{size:12}):s.jsx(BD,{size:12})}),s.jsx("input",{type:"number",step:"0.01",value:A,onChange:ue=>k(ue.target.value),placeholder:"0",className:It+" text-sm"})]}),ie>0&&s.jsxs("p",{className:"text-[10px] text-red-500 mt-0.5",children:["− ",Zn(ie)]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Entrada (R$)"}),s.jsx("input",{type:"number",step:"0.01",value:_,onChange:ue=>B(ue.target.value),placeholder:"0",className:It}),de>0&&s.jsxs("p",{className:"text-[10px] text-blue-500 mt-0.5",children:["− ",Zn(de)," (marca como Pago)"]})]})]}),s.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-3 space-y-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs font-black text-gray-500 uppercase",children:"Restante a parcelar"}),s.jsx("span",{className:"text-lg font-black text-emerald-600",children:Zn(ve)})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Parcelas"}),s.jsx("select",{value:F,onChange:ue=>G(Number(ue.target.value)),className:It+" text-xs",children:Array.from({length:48},(ue,Oe)=>Oe+1).map(ue=>s.jsxs("option",{value:ue,children:[ue,"x — ",Zn(ve/ue)]},ue))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"1ª Parcela"}),s.jsx("input",{type:"date",value:ee,onChange:ue=>ne(ue.target.value),className:It+" text-xs"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Forma"}),s.jsx("select",{value:oe,onChange:ue=>Q(ue.target.value),className:It+" text-xs",children:SM.map(ue=>s.jsx("option",{children:ue},ue))})]})]}),F>1&&s.jsxs("div",{className:"flex items-center justify-between bg-emerald-50 rounded-lg px-3 py-2",children:[s.jsxs("span",{className:"text-xs font-bold text-emerald-700",children:[F,"x de"]}),s.jsx("span",{className:"text-sm font-black text-emerald-700",children:Zn(je)})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Status 1ª parcela"}),s.jsx("select",{value:ce,onChange:ue=>he(ue.target.value),className:It+" text-xs",children:jM.map(ue=>s.jsx("option",{children:ue},ue))})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs("div",{className:"w-full bg-gray-50 border border-gray-100 rounded-lg p-2 text-center",children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase",children:"Total geral"}),s.jsx("p",{className:"text-sm font-black text-gray-800",children:Zn(de+ve)})]})})]})]}),s.jsxs("div",{className:"flex gap-2 pt-1",children:[s.jsx("button",{onClick:e,className:"px-5 py-2.5 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase flex-shrink-0",children:"Cancelar"}),s.jsxs("button",{onClick:Ue,disabled:N.length===0||j,className:"flex-1 py-2.5 bg-emerald-600 hover:bg-emerald-700 text-white font-black rounded-lg text-xs uppercase disabled:opacity-40 flex items-center justify-center gap-2 transition-colors",children:[j?s.jsx(Ct,{size:14,className:"animate-spin"}):s.jsx(fo,{size:14}),j?"Salvando...":`Confirmar ${N.length>0?`— ${Zn(de+ve)}`:""}`]})]})]})]})]})]})})};function CM(t,e){const[n,r]=w.useState(t);return w.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}function DM({label:t,placeholder:e,value:n,onSelect:r,onClear:i,fetchFn:c}){const[d,f]=w.useState(""),[h,p]=w.useState([]),[b,y]=w.useState(!1),[m,v]=w.useState(!1),N=CM(d,300),S=w.useRef(null);return w.useEffect(()=>{if(!N.trim()||n){p([]),y(!1);return}v(!0),c(N).then(j=>{const R=Array.isArray(j)?j:[];p(R),y(R.length>0)}).finally(()=>v(!1))},[N]),w.useEffect(()=>{const j=R=>{S.current&&!S.current.contains(R.target)&&y(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[]),n?s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:t}),s.jsxs("div",{className:"flex items-center justify-between bg-blue-50 border border-blue-100 rounded-lg px-3 py-2",children:[s.jsx("span",{className:"text-xs font-bold text-blue-700 uppercase truncate",children:n.nome}),s.jsx("button",{type:"button",onClick:i,className:"ml-2 text-blue-300 hover:text-blue-600 flex-shrink-0",children:s.jsx(Qe,{size:13})})]})]}):s.jsxs("div",{ref:S,className:"relative",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:t}),s.jsxs("div",{className:"relative",children:[s.jsx(ha,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),s.jsx("input",{value:d,onChange:j=>f(j.target.value),placeholder:e,className:"w-full pl-7 pr-3 py-2 border border-gray-200 rounded-lg text-xs focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none"}),m&&s.jsx(Ct,{size:12,className:"absolute right-2.5 top-1/2 -translate-y-1/2 animate-spin text-gray-400"})]}),b&&h.length>0&&s.jsx("div",{className:"absolute z-50 w-full mt-1 bg-white border border-gray-200 rounded-xl shadow-xl overflow-hidden",children:h.map(j=>s.jsxs("button",{type:"button",onClick:()=>{r(j),f(""),y(!1)},className:"w-full text-left px-3 py-2 hover:bg-blue-50 text-xs font-medium text-gray-700 flex items-center gap-2 border-b border-gray-50 last:border-0",children:[s.jsx($n,{size:12,className:"text-gray-400 flex-shrink-0"}),j.nome]},j.id))})]})}const Wv=`CLÁUSULA 1ª – DO OBJETO -O presente contrato tem por objeto a prestação de serviços odontológicos conforme os procedimentos descritos neste instrumento, obrigando-se o profissional a realizá-los com toda a técnica e diligência necessárias. - -CLÁUSULA 2ª – DAS OBRIGAÇÕES DO CONTRATANTE -O(A) paciente obriga-se a: comparecer às consultas agendadas; comunicar cancelamentos com antecedência mínima de 24 horas; seguir as orientações clínicas do profissional; e efetuar os pagamentos nos prazos acordados. - -CLÁUSULA 3ª – DO PAGAMENTO -O valor total do tratamento, a forma de pagamento e o parcelamento estão descritos neste contrato. Em caso de atraso no pagamento, incidirão multa de 2% (dois por cento) e juros de 1% (um por cento) ao mês sobre o valor devido. - -CLÁUSULA 4ª – DA VIGÊNCIA -O presente contrato vigorará pelo período necessário à conclusão do tratamento acordado, podendo ser prorrogado mediante aditivo escrito firmado por ambas as partes. - -CLÁUSULA 5ª – DO CANCELAMENTO E DESISTÊNCIA -Em caso de desistência do tratamento pelo contratante, serão devidos os valores correspondentes aos procedimentos já realizados. Os valores pagos a maior serão restituídos no prazo de 30 dias. - -CLÁUSULA 6ª – DA PROTEÇÃO DE DADOS (LGPD) -Os dados pessoais e de saúde do contratante serão tratados em conformidade com a Lei nº 13.709/2018 (LGPD), utilizados exclusivamente para fins relacionados ao tratamento odontológico. - -CLÁUSULA 7ª – DO FORO -Fica eleito o foro da comarca do domicílio do contratado para dirimir quaisquer controvérsias oriundas do presente contrato, com renúncia expressa de qualquer outro.`,yp=["DADOS","ITENS","CLÁUSULAS"],Nn=t=>t.toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),OM=({form:t,items:e,valorTotal:n,contratoId:r,onBack:i})=>{const c=new Date().toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"}),d=n-t.entrada,f=t.parcelas>0&&d>0?d/t.parcelas:0;return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center gap-3 print:hidden flex-shrink-0",children:[s.jsxs("button",{type:"button",onClick:i,className:"flex items-center gap-1.5 px-3 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-xs font-bold",children:[s.jsx(Bs,{size:14})," Voltar"]}),s.jsxs("button",{type:"button",onClick:()=>window.print(),className:"flex items-center gap-1.5 px-4 py-2 bg-gray-900 hover:bg-black text-white rounded-lg text-xs font-bold",children:[s.jsx(Va,{size:14})," Imprimir / Salvar PDF"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-6 print:p-0 print:bg-white",children:s.jsxs("div",{className:"max-w-3xl mx-auto bg-white rounded-2xl shadow-sm border border-gray-200 p-10 print:shadow-none print:rounded-none print:border-0 print:max-w-full",children:[s.jsxs("div",{className:"text-center border-b-2 border-gray-800 pb-6 mb-6",children:[s.jsx("h1",{className:"text-xl font-black text-gray-900 uppercase tracking-wide",children:"CONTRATO DE PRESTAÇÃO DE SERVIÇOS ODONTOLÓGICOS"}),s.jsx("p",{className:"text-sm text-gray-500 mt-1 font-bold uppercase",children:"Nome da Clínica"}),r&&s.jsxs("p",{className:"text-[10px] text-gray-400 mt-0.5",children:["Contrato Nº ",r]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6 mb-6",children:[s.jsxs("div",{className:"border border-gray-200 rounded-xl p-4",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest mb-2",children:"CONTRATANTE (PACIENTE)"}),s.jsx("p",{className:"font-bold text-gray-800 uppercase",children:t.pacienteNome||"—"}),s.jsxs("div",{className:"mt-2 space-y-1",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"CPF: ___________________________________"}),s.jsx("p",{className:"text-xs text-gray-500",children:"RG: ____________________________________"}),s.jsx("p",{className:"text-xs text-gray-500",children:"Endereço: ______________________________"})]})]}),s.jsxs("div",{className:"border border-gray-200 rounded-xl p-4",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest mb-2",children:"CONTRATADO (DENTISTA)"}),s.jsx("p",{className:"font-bold text-gray-800 uppercase",children:t.dentistaNome||"—"}),s.jsxs("div",{className:"mt-2 space-y-1",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"CRO: ___________________________________"}),s.jsxs("p",{className:"text-xs text-gray-500",children:["Especialidade: ",t.especialidadeNome||"—"]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["Data de início: ",t.dataInicio?new Date(t.dataInicio+"T12:00").toLocaleDateString("pt-BR"):"—"]})]})]})]}),s.jsxs("div",{className:"mb-6",children:[s.jsxs("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:["OBJETO DO CONTRATO — ",t.titulo]}),e.length>0?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-gray-50",children:[s.jsx("th",{className:"text-left px-3 py-2 text-xs font-black text-gray-500 uppercase border border-gray-200",children:"Procedimento"}),s.jsx("th",{className:"text-center px-3 py-2 text-xs font-black text-gray-500 uppercase border border-gray-200 w-16",children:"Qtd"}),s.jsx("th",{className:"text-right px-3 py-2 text-xs font-black text-gray-500 uppercase border border-gray-200 w-28",children:"Unit."}),s.jsx("th",{className:"text-right px-3 py-2 text-xs font-black text-gray-500 uppercase border border-gray-200 w-28",children:"Total"})]})}),s.jsx("tbody",{children:e.map((h,p)=>s.jsxs("tr",{className:p%2===0?"bg-white":"bg-gray-50/50",children:[s.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 border border-gray-200 font-medium uppercase",children:h.procedimentoNome}),s.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 border border-gray-200 text-center",children:h.quantidade}),s.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 border border-gray-200 text-right",children:Nn(h.valorUnitario)}),s.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 border border-gray-200 text-right font-bold",children:Nn(h.valorTotal)})]},h.id))}),s.jsx("tfoot",{children:s.jsxs("tr",{className:"bg-gray-100",children:[s.jsx("td",{colSpan:3,className:"px-3 py-2 text-xs font-black text-gray-700 uppercase border border-gray-200 text-right",children:"VALOR TOTAL"}),s.jsx("td",{className:"px-3 py-2 text-sm font-black text-gray-900 border border-gray-200 text-right",children:Nn(n)})]})})]}):s.jsx("p",{className:"text-xs text-gray-500 italic",children:"Nenhum procedimento listado."})]}),s.jsxs("div",{className:"mb-6 border border-gray-200 rounded-xl p-4",children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3",children:"RESUMO FINANCEIRO"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Valor Total"}),s.jsx("p",{className:"font-bold text-gray-800",children:Nn(n)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Forma de Pagamento"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.formaPagamento||"—"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Entrada"}),s.jsx("p",{className:"font-bold text-gray-800",children:Nn(t.entrada)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Restante"}),s.jsx("p",{className:"font-bold text-gray-800",children:Nn(d)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Parcelas"}),s.jsxs("p",{className:"font-bold text-gray-800",children:[t.parcelas,"x"]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Valor por Parcela"}),s.jsx("p",{className:"font-bold text-gray-800",children:Nn(f)})]})]})]}),t.clausulas&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:"CLÁUSULAS CONTRATUAIS"}),s.jsx("div",{className:"text-xs text-gray-700 whitespace-pre-wrap leading-relaxed",children:t.clausulas})]}),s.jsxs("div",{className:"mt-10 pt-6 border-t-2 border-gray-800",children:[s.jsx("p",{className:"text-xs text-gray-500 text-center mb-8",children:"Estando de pleno acordo com as cláusulas e condições acima, as partes assinam o presente contrato."}),s.jsxs("p",{className:"text-xs text-gray-500 text-center mb-10",children:["___________________, ",c,"."]}),s.jsx("div",{className:"grid grid-cols-3 gap-8",children:[{title:"CONTRATANTE (PACIENTE)",name:t.pacienteNome},{title:"CONTRATADO (DENTISTA)",name:t.dentistaNome},{title:"TESTEMUNHA",name:""}].map((h,p)=>s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"h-16 border-b border-gray-400 mb-2"}),s.jsx("p",{className:"text-[10px] font-black text-gray-500 uppercase",children:h.title}),h.name&&s.jsx("p",{className:"text-[10px] text-gray-400 uppercase mt-0.5",children:h.name}),s.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"CPF: __________________________"})]},p))})]}),r&&s.jsxs("div",{className:"mt-6 pt-3 border-t border-gray-100 flex justify-between items-center",children:[s.jsxs("p",{className:"text-[9px] text-gray-300",children:["ID: ",r]}),s.jsxs("p",{className:"text-[9px] text-gray-300",children:["Gerado em ",c]})]})]})})]})},lS=({contrato:t,paciente:e,onClose:n,onSaved:r})=>{var V;const i=Fe(),{data:c}=_e(J.getDentistas),{data:d}=_e(J.getEspecialidades),{data:f}=_e(J.getProcedimentos),[h,p]=w.useState(0),[b,y]=w.useState("editor"),[m,v]=w.useState(!1),[N,S]=w.useState({titulo:(t==null?void 0:t.titulo)||"CONTRATO DE SERVIÇOS ODONTOLÓGICOS",status:(t==null?void 0:t.status)||"Rascunho",pacienteId:(t==null?void 0:t.pacienteId)||(e==null?void 0:e.id)||"",pacienteNome:(t==null?void 0:t.pacienteNome)||(e==null?void 0:e.nome)||"",dentistaId:(t==null?void 0:t.dentistaId)||"",dentistaNome:(t==null?void 0:t.dentistaNome)||"",especialidadeId:(t==null?void 0:t.especialidadeId)||"",especialidadeNome:(t==null?void 0:t.especialidadeNome)||"",dataInicio:(t==null?void 0:t.dataInicio)||new Date().toISOString().split("T")[0],dataFim:(t==null?void 0:t.dataFim)||"",observacoes:(t==null?void 0:t.observacoes)||"",entrada:(t==null?void 0:t.entrada)||0,parcelas:(t==null?void 0:t.parcelas)||1,formaPagamento:(t==null?void 0:t.formaPagamento)||"Pix",clausulas:(t==null?void 0:t.clausulas)||Wv}),[j,R]=w.useState(((V=t==null?void 0:t.items)==null?void 0:V.map((P,W)=>({id:P.id,procedimentoNome:P.procedimentoNome,quantidade:P.quantidade,valorUnitario:P.valorUnitario,valorTotal:P.valorTotal,descricao:P.descricao,ordem:P.ordem??W})))??[]),[C,O]=w.useState(e?{id:e.id,nome:e.nome}:t!=null&&t.pacienteId?{id:t.pacienteId,nome:t.pacienteNome}:null),[A,k]=w.useState(""),_=j.length>0?j.reduce((P,W)=>P+W.valorTotal,0):0,B=_-N.entrada,F=N.parcelas>0&&B>0?B/N.parcelas:0;w.useEffect(()=>{const P=W=>{W.key==="Escape"&&n()};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[n]);const G=P=>{const W=d==null?void 0:d.find(te=>te.id===P);S(te=>({...te,especialidadeId:P,especialidadeNome:(W==null?void 0:W.nome)||"",titulo:W?`CONTRATO DE SERVIÇOS ODONTOLÓGICOS — ${W.nome.toUpperCase()}`:te.titulo}))},ee=P=>{const W=j.find(T=>T.procedimentoNome===P.nome);if(W){R(T=>T.map(X=>X.id===W.id?{...X,quantidade:X.quantidade+1,valorTotal:(X.quantidade+1)*X.valorUnitario}:X));return}const te={id:Math.random().toString(36).substring(2,10),procedimentoNome:P.nome,quantidade:1,valorUnitario:P.valorParticular,valorTotal:P.valorParticular,ordem:j.length};R(T=>[...T,te])},ne=()=>{const P={id:Math.random().toString(36).substring(2,10),procedimentoNome:"",quantidade:1,valorUnitario:0,valorTotal:0,ordem:j.length};R(W=>[...W,P])},oe=(P,W,te)=>{R(T=>T.map(X=>{if(X.id!==P)return X;const ie={...X,[W]:te};return(W==="quantidade"||W==="valorUnitario")&&(ie.valorTotal=ie.quantidade*ie.valorUnitario),ie}))},Q=P=>R(W=>W.filter(te=>te.id!==P)),ce=P=>{if(!P.destination)return;const W=[...j],[te]=W.splice(P.source.index,1);W.splice(P.destination.index,0,te),R(W.map((T,X)=>({...T,ordem:X})))},he=async()=>{if(!N.pacienteNome&&!C){i.error("SELECIONE UM PACIENTE.");return}v(!0);try{const P={id:t==null?void 0:t.id,titulo:N.titulo,status:N.status,paciente_id:(C==null?void 0:C.id)||N.pacienteId||void 0,paciente_nome:(C==null?void 0:C.nome)||N.pacienteNome,dentista_id:N.dentistaId||void 0,dentista_nome:N.dentistaNome||void 0,especialidade_id:N.especialidadeId||void 0,especialidade_nome:N.especialidadeNome||void 0,data_inicio:N.dataInicio||void 0,data_fim:N.dataFim||void 0,valor_total:_,entrada:N.entrada,parcelas:N.parcelas,forma_pagamento:N.formaPagamento,clausulas:N.clausulas,observacoes:N.observacoes||void 0,items:j.map((W,te)=>({id:W.id,procedimento_nome:W.procedimentoNome,quantidade:W.quantidade,valor_unitario:W.valorUnitario,valor_total:W.valorTotal,descricao:W.descricao||void 0,ordem:te}))};t!=null&&t.id?await J.updateContrato({...t,...P,items:t.items}):await J.saveContrato(P),i.success("CONTRATO SALVO COM SUCESSO!"),r(),n()}catch{i.error("ERRO AO SALVAR CONTRATO.")}finally{v(!1)}},H=Ve.useMemo(()=>{const P=f??[],W=A.trim()?P.filter(T=>T.nome.toLowerCase().includes(A.toLowerCase())||T.especialidadeNome.toLowerCase().includes(A.toLowerCase())):P,te={};return W.forEach(T=>{const X=T.especialidadeNome||"Outros";te[X]||(te[X]=[]),te[X].push(T)}),te},[f,A]);return b==="print"?s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200 overflow-hidden",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between flex-shrink-0 print:hidden",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(za,{size:16,className:"text-indigo-600"}),s.jsx("span",{className:"text-sm font-black text-gray-800 uppercase",children:"Visualização de Impressão"})]}),s.jsx("button",{type:"button",onClick:n,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsx(OM,{form:N,items:j,valorTotal:_,contratoId:t==null?void 0:t.id,onBack:()=>y("editor")})]})}):s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200 overflow-hidden",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between flex-shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-indigo-100 rounded-lg flex items-center justify-center",children:s.jsx(za,{size:16,className:"text-indigo-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase",children:t?"Editar Contrato":"Novo Contrato"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-medium uppercase",children:N.pacienteNome||"Paciente não selecionado"})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>y("print"),className:"flex items-center gap-1.5 px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-xs font-bold transition-colors",children:[s.jsx(Va,{size:13})," Imprimir/Assinar"]}),s.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]})]}),s.jsx("div",{className:"px-6 pt-4 pb-2 flex-shrink-0",children:s.jsx("div",{className:"flex items-center",children:yp.map((P,W)=>s.jsxs(Ve.Fragment,{children:[s.jsxs("button",{type:"button",onClick:()=>p(W),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-[10px] font-black uppercase transition-all whitespace-nowrap ${h===W?"bg-indigo-600 text-white":W{O({id:P.id,nome:P.nome}),S(W=>({...W,pacienteId:P.id,pacienteNome:P.nome}))},onClear:()=>{O(null),S(P=>({...P,pacienteId:"",pacienteNome:""}))},fetchFn:P=>J.getPacientes(P).then(W=>W.data)}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Dentista"}),s.jsxs("select",{value:N.dentistaId,onChange:P=>{const W=c==null?void 0:c.find(te=>te.id===P.target.value);S(te=>({...te,dentistaId:P.target.value,dentistaNome:(W==null?void 0:W.nome)||""}))},className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",children:[s.jsx("option",{value:"",children:"— Selecionar —"}),c==null?void 0:c.map(P=>s.jsx("option",{value:P.id,children:P.nome},P.id))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Especialidade"}),s.jsxs("select",{value:N.especialidadeId,onChange:P=>G(P.target.value),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",children:[s.jsx("option",{value:"",children:"— Selecionar —"}),d==null?void 0:d.map(P=>s.jsx("option",{value:P.id,children:P.nome},P.id))]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Título do Contrato"}),s.jsx("input",{value:N.titulo,onChange:P=>S(W=>({...W,titulo:P.target.value.toUpperCase()})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",placeholder:"CONTRATO DE SERVIÇOS ODONTOLÓGICOS"})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Status"}),s.jsxs("select",{value:N.status,onChange:P=>S(W=>({...W,status:P.target.value})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",children:[s.jsx("option",{value:"Rascunho",children:"Rascunho"}),s.jsx("option",{value:"Ativo",children:"Ativo"}),s.jsx("option",{value:"Assinado",children:"Assinado"}),s.jsx("option",{value:"Encerrado",children:"Encerrado"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Data Início"}),s.jsx("input",{type:"date",value:N.dataInicio,onChange:P=>S(W=>({...W,dataInicio:P.target.value})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Data Fim (opcional)"}),s.jsx("input",{type:"date",value:N.dataFim,onChange:P=>S(W=>({...W,dataFim:P.target.value})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Observações"}),s.jsx("textarea",{value:N.observacoes,onChange:P=>S(W=>({...W,observacoes:P.target.value})),rows:3,className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none resize-none",placeholder:"Observações gerais do contrato..."})]})]}),h===1&&s.jsxs("div",{className:"flex-1 overflow-hidden flex gap-0 min-h-0",children:[s.jsxs("div",{className:"w-72 flex-shrink-0 border-r border-gray-100 flex flex-col min-h-0",children:[s.jsxs("div",{className:"p-3 border-b border-gray-100",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider mb-2",children:"Catálogo de Procedimentos"}),s.jsxs("div",{className:"relative",children:[s.jsx(ha,{size:12,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),s.jsx("input",{value:A,onChange:P=>k(P.target.value),placeholder:"Buscar procedimento...",className:"w-full pl-7 pr-3 py-1.5 border border-gray-200 rounded-lg text-[11px] focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none"})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-3",children:[Object.entries(H).map(([P,W])=>s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest px-2 py-1",children:P}),W.map(te=>s.jsxs("button",{type:"button",onClick:()=>ee(te),className:"w-full flex items-center justify-between px-2 py-1.5 hover:bg-indigo-50 rounded-lg text-left transition-colors group",children:[s.jsx("span",{className:"text-[11px] text-gray-700 font-medium flex-1 truncate",children:te.nome}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0 ml-1",children:[s.jsx("span",{className:"text-[10px] text-green-600 font-bold",children:Nn(te.valorParticular)}),s.jsx("div",{className:"w-5 h-5 rounded-full bg-indigo-100 group-hover:bg-indigo-600 text-indigo-600 group-hover:text-white flex items-center justify-center transition-colors",children:s.jsx(ft,{size:11})})]})]},te.id))]},P)),Object.keys(H).length===0&&s.jsx("p",{className:"text-center text-xs text-gray-400 py-6",children:"Nenhum procedimento encontrado."})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[s.jsxs("div",{className:"p-3 border-b border-gray-100 flex items-center justify-between",children:[s.jsxs("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider",children:["Itens do Contrato (",j.length,")"]}),s.jsxs("button",{type:"button",onClick:ne,className:"flex items-center gap-1 px-2.5 py-1.5 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 rounded-lg text-[11px] font-bold transition-colors",children:[s.jsx(ft,{size:12})," Adicionar Item Manual"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:j.length===0?s.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400 py-10",children:[s.jsx(za,{size:36,className:"mb-3 opacity-30"}),s.jsx("p",{className:"text-xs font-bold uppercase",children:"Nenhum item adicionado"}),s.jsx("p",{className:"text-[10px] mt-1",children:"Clique em procedimentos no catálogo ou adicione manualmente"})]}):s.jsx(Xl,{onDragEnd:ce,children:s.jsx(Kl,{droppableId:"items",children:P=>s.jsxs("div",{ref:P.innerRef,...P.droppableProps,className:"space-y-2",children:[j.map((W,te)=>s.jsx(Zl,{draggableId:W.id,index:te,children:(T,X)=>s.jsx("div",{ref:T.innerRef,...T.draggableProps,className:`bg-white border border-gray-200 rounded-xl p-3 ${X.isDragging?"shadow-lg border-indigo-300":""}`,children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{...T.dragHandleProps,className:"mt-1 text-gray-300 hover:text-gray-500 cursor-grab flex-shrink-0",children:s.jsx(ql,{size:16})}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("input",{value:W.procedimentoNome,onChange:ie=>oe(W.id,"procedimentoNome",ie.target.value.toUpperCase()),className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-xs font-bold text-gray-800 focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",placeholder:"Nome do procedimento"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1 border border-gray-200 rounded-lg overflow-hidden",children:[s.jsx("button",{type:"button",onClick:()=>oe(W.id,"quantidade",Math.max(1,W.quantidade-1)),className:"px-2 py-1.5 hover:bg-gray-100 text-gray-600 transition-colors",children:s.jsx(FN,{size:11})}),s.jsx("span",{className:"text-xs font-bold text-gray-800 w-6 text-center",children:W.quantidade}),s.jsx("button",{type:"button",onClick:()=>oe(W.id,"quantidade",W.quantidade+1),className:"px-2 py-1.5 hover:bg-gray-100 text-gray-600 transition-colors",children:s.jsx(ft,{size:11})})]}),s.jsx("div",{className:"flex-1",children:s.jsx("input",{type:"number",step:"0.01",min:"0",value:W.valorUnitario,onChange:ie=>oe(W.id,"valorUnitario",parseFloat(ie.target.value)||0),className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",placeholder:"Valor unit."})}),s.jsx("div",{className:"text-sm font-black text-indigo-600 w-24 text-right flex-shrink-0",children:Nn(W.valorTotal)}),s.jsx("button",{type:"button",onClick:()=>Q(W.id),className:"text-red-300 hover:text-red-600 flex-shrink-0 transition-colors",children:s.jsx($t,{size:14})})]}),s.jsx("input",{value:W.descricao||"",onChange:ie=>oe(W.id,"descricao",ie.target.value),className:"w-full border border-gray-100 rounded-lg px-2.5 py-1 text-[11px] text-gray-500 focus:ring-1 focus:ring-indigo-100 outline-none bg-gray-50",placeholder:"Descrição opcional..."})]})]})})},W.id)),P.placeholder]})})})}),j.length>0&&s.jsxs("div",{className:"p-3 border-t border-gray-100 flex justify-between items-center bg-indigo-50/50",children:[s.jsx("span",{className:"text-xs font-black text-gray-500 uppercase",children:"Total"}),s.jsx("span",{className:"text-lg font-black text-indigo-700",children:Nn(_)})]})]})]}),h===2&&s.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-5",children:[s.jsxs("div",{className:"bg-indigo-50/60 border border-indigo-100 rounded-2xl p-4 space-y-3",children:[s.jsx("p",{className:"text-[10px] font-black text-indigo-600 uppercase tracking-widest",children:"Financeiro"}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Valor Total"}),s.jsx("div",{className:"w-full border border-gray-200 rounded-lg p-2.5 text-sm font-black text-indigo-700 bg-white",children:Nn(_)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Entrada (R$)"}),s.jsx("input",{type:"number",step:"0.01",min:"0",value:N.entrada||"",onChange:P=>S(W=>({...W,entrada:parseFloat(P.target.value)||0})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",placeholder:"0,00"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Parcelas"}),s.jsx("select",{value:N.parcelas,onChange:P=>S(W=>({...W,parcelas:parseInt(P.target.value)})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",children:Array.from({length:48},(P,W)=>W+1).map(P=>s.jsxs("option",{value:P,children:[P,"x"]},P))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Forma de Pagamento"}),s.jsx("select",{value:N.formaPagamento,onChange:P=>S(W=>({...W,formaPagamento:P.target.value})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",children:["Pix","Dinheiro","Cartão de Crédito","Cartão de Débito","Boleto","Transferência"].map(P=>s.jsx("option",{value:P,children:P},P))})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-4 pt-2 border-t border-indigo-100",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-[10px] text-indigo-400 font-bold uppercase",children:"Restante"}),s.jsx("p",{className:"text-sm font-black text-indigo-700",children:Nn(B)})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-[10px] text-indigo-400 font-bold uppercase",children:"Valor por Parcela"}),s.jsx("p",{className:"text-sm font-black text-indigo-700",children:Nn(F)})]})]})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider",children:"Cláusulas Contratuais"}),s.jsx("button",{type:"button",onClick:()=>S(P=>({...P,clausulas:Wv})),className:"text-[10px] text-indigo-500 hover:text-indigo-700 font-bold uppercase transition-colors",children:"Restaurar padrão"})]}),s.jsx("textarea",{value:N.clausulas,onChange:P=>S(W=>({...W,clausulas:P.target.value})),rows:18,className:"w-full border border-gray-200 rounded-xl p-3 text-xs font-mono focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none resize-none leading-relaxed"})]})]})]}),s.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-between items-center flex-shrink-0",children:[s.jsxs("button",{type:"button",onClick:()=>h>0?p(P=>P-1):n(),className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:[s.jsx(Bs,{size:14})," ",h===0?"Cancelar":"Voltar"]}),s.jsx("div",{className:"flex items-center gap-2",children:hp(P=>P+1),className:"px-5 py-2 bg-indigo-600 hover:bg-indigo-700 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:["Próximo ",s.jsx(Ts,{size:14})]}):s.jsxs("button",{type:"button",onClick:he,disabled:m,className:"px-5 py-2 bg-green-600 hover:bg-green-700 disabled:opacity-60 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:[m?s.jsx(Ct,{size:14,className:"animate-spin"}):s.jsx(Io,{size:14}),m?"Salvando...":"Salvar Contrato"]})})]})]})})},iS=["MÃE","PAI","FILHO","FILHA","IRMÃO","IRMÃ","CÔNJUGE","AVÔ","AVÓ","NETO","NETA","TIO","TIA","SOBRINHO","SOBRINHA","PRIMO","PRIMA","PADRASTO","MADRASTA","ENTEADO","ENTEADA"];function RM(t){if(!t)return"";if(/^\d{4}-\d{2}-\d{2}$/.test(t))return t;const e=t.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);return e?`${e[3]}-${e[2]}-${e[1]}`:""}function oS(t,e){const[n,r]=w.useState(t);return w.useEffect(()=>{const i=setTimeout(()=>{r(t)},e);return()=>clearTimeout(i)},[t,e]),n}function Yd({label:t,placeholder:e,value:n,onSelect:r,onClear:i,fetchFn:c,renderOption:d,extraAction:f}){const[h,p]=w.useState(""),[b,y]=w.useState([]),[m,v]=w.useState(!1),[N,S]=w.useState(!1),j=oS(h,300),R=w.useRef(null);return w.useEffect(()=>{if(!j.trim()||n){y([]),v(!1);return}S(!0),c(j).then(C=>{const O=Array.isArray(C)?C:[];y(O),v(O.length>0)}).finally(()=>S(!1))},[j]),w.useEffect(()=>{const C=O=>{R.current&&!R.current.contains(O.target)&&v(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]),n?s.jsxs("div",{className:"flex items-center justify-between bg-blue-50 border border-blue-100 rounded-lg px-3 py-2",children:[s.jsx("span",{className:"text-xs font-bold text-blue-700 uppercase truncate",children:n.nome}),s.jsx("button",{onClick:i,className:"ml-2 text-blue-300 hover:text-blue-600 flex-shrink-0",children:s.jsx(Qe,{size:13})})]}):s.jsxs("div",{ref:R,className:"relative",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:t}),s.jsxs("div",{className:"flex gap-1",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(ha,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),s.jsx("input",{value:h,onChange:C=>p(C.target.value),placeholder:e,className:"w-full pl-7 pr-3 py-2 border border-gray-200 rounded-lg text-xs focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none"}),N&&s.jsx(Ct,{size:12,className:"absolute right-2.5 top-1/2 -translate-y-1/2 animate-spin text-gray-400"})]}),f]}),m&&b.length>0&&s.jsx("div",{className:"absolute z-50 w-full mt-1 bg-white border border-gray-200 rounded-xl shadow-xl overflow-hidden",children:b.map(C=>s.jsx("button",{onClick:()=>{r(C),p(""),v(!1)},className:"w-full text-left px-3 py-2 hover:bg-blue-50 text-xs font-medium text-gray-700 flex items-center gap-2 border-b border-gray-50 last:border-0",children:d?d(C):C.nome},C.id))})]})}const TM=({paciente:t,onClose:e})=>(w.useEffect(()=>{const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[e]),s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-indigo-100 rounded-lg flex items-center justify-center",children:s.jsx($n,{size:16,className:"text-indigo-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase",children:"Vínculo Familiar"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-medium uppercase",children:t.nome})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsx("div",{className:"p-4",children:t.grupoFamiliarId?s.jsxs("div",{className:"flex items-center gap-3 p-3 bg-indigo-50 rounded-xl border border-indigo-100",children:[s.jsx("div",{className:"w-9 h-9 rounded-full bg-indigo-200 flex items-center justify-center flex-shrink-0",children:s.jsx($l,{size:15,className:"text-indigo-700"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-bold text-gray-800 uppercase",children:t.grupoFamiliarNome}),s.jsx("p",{className:"text-[10px] text-indigo-500 font-bold uppercase",children:t.grupoFamiliarRelacao||"Familiar"})]})]}):s.jsx("p",{className:"text-center text-xs text-gray-400 py-4",children:"Nenhum familiar vinculado."})}),s.jsx("div",{className:"p-4 border-t border-gray-100 flex justify-end",children:s.jsx("button",{onClick:e,className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 text-xs font-bold rounded-lg uppercase",children:"Fechar"})})]})})),kM=({patient:t,onClose:e})=>{const{data:n}=_e(J.getDentistas),{data:r,refresh:i}=_e(J.getAgendamentos),c=Fe(),[d,f]=w.useState(30),[h,p]=w.useState(new Date().toISOString().split("T")[0]),[b,y]=w.useState(""),[m,v]=w.useState(void 0),[N,S]=w.useState("");w.useEffect(()=>{var A;n&&!m&&v((A=n[0])==null?void 0:A.id)},[n,m]),w.useEffect(()=>{const A=k=>{k.key==="Escape"&&e()};return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A)}},[e]);const j=n==null?void 0:n.find(A=>A.id===m),C=w.useCallback(()=>{const A=[];if(!m||!h)return A;const k=480,_=1080,B=720,F=840,G=(r??[]).filter(ee=>ee.dentistaId===m&&new Date(ee.start).toISOString().split("T")[0]===h).map(ee=>({start:new Date(ee.start).getHours()*60+new Date(ee.start).getMinutes(),end:new Date(ee.end).getHours()*60+new Date(ee.end).getMinutes()}));for(let ee=k;ee<_;ee+=d){const ne=ee,oe=ee+d;if(oe>_||ne>=B&&neB&&oe<=F||neF)continue;if(!G.some(he=>ne>=he.start&&nehe.start&&oe<=he.end||nehe.end)){const he=Math.floor(ne/60),H=ne%60;A.push({time:`${String(he).padStart(2,"0")}:${String(H).padStart(2,"0")}`,available:!0})}}return A},[m,h,r,d])(),O=async A=>{if(A.preventDefault(),!h||!b||!m||!N){c.error("PREENCHA TODOS OS CAMPOS PARA AGENDAR.");return}const k=new Date(`${h}T${b}:00`),_=new Date(k.getTime()+d*6e4);try{await J.salvarAgendamento({pacienteNome:t.nome,dentistaId:m,start:k.toISOString(),end:_.toISOString(),status:"Pendente",procedimento:N.toUpperCase()}),c.success(`AGENDAMENTO PARA ${t.nome} SALVO!`),i(),e()}catch{c.error("ERRO AO SALVAR AGENDAMENTO.")}};return s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("form",{onSubmit:O,className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsx("div",{className:"p-5 border-b border-gray-200",children:s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[s.jsx(Et,{size:20,className:"text-orange-500"})," AGENDAR CONSULTA"]}),s.jsx("button",{type:"button",onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:20})})]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"PACIENTE"}),s.jsx("div",{className:"w-full bg-gray-100 p-3 rounded-lg mt-1 font-bold text-gray-800 uppercase",children:t.nome})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"DENTISTA RESPONSÁVEL"}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx("select",{value:m,onChange:A=>v(A.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select",children:n==null?void 0:n.map(A=>s.jsx("option",{value:A.id,children:A.nome},A.id))}),s.jsx("div",{className:"w-7 h-7 rounded-full border-2 border-white shadow flex-shrink-0",style:{backgroundColor:(j==null?void 0:j.corAgenda)||"#ccc"}})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"DATA"}),s.jsx("input",{type:"date",value:h,onChange:A=>p(A.target.value),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"TEMPO"}),s.jsxs("select",{value:d,onChange:A=>f(Number(A.target.value)),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select",children:[s.jsx("option",{value:15,children:"15 MIN"}),s.jsx("option",{value:30,children:"30 MIN"}),s.jsx("option",{value:45,children:"45 MIN"}),s.jsx("option",{value:60,children:"60 MIN"})]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"HORÁRIOS"}),s.jsxs("div",{className:"grid grid-cols-6 gap-2 mt-2",children:[C.map(A=>s.jsx("button",{type:"button",onClick:()=>y(A.time),className:`py-2 rounded-lg text-sm font-bold border transition-colors ${b===A.time?"bg-blue-600 text-white border-blue-600":"bg-white border-gray-300 hover:border-blue-500"}`,children:A.time},A.time)),C.length===0&&s.jsx("p",{className:"col-span-6 text-center text-xs text-gray-500 p-4 bg-gray-50 rounded-lg",children:"NENHUM HORÁRIO DISPONÍVEL PARA ESTA DATA/DURAÇÃO."})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"PROCEDIMENTO"}),s.jsx("input",{type:"text",value:N,onChange:A=>S(A.target.value.toUpperCase()),placeholder:"EX: AVALIAÇÃO...",className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 uppercase-input"})]})]}),s.jsxs("div",{className:"p-4 bg-gray-50 border-t border-gray-200 flex justify-end gap-3",children:[s.jsx("button",{type:"button",onClick:e,className:"px-6 py-2 bg-gray-200 hover:bg-gray-300 text-gray-700 font-bold rounded-lg transition-colors text-sm uppercase",children:"CANCELAR"}),s.jsx("button",{type:"submit",className:"px-6 py-2 bg-orange-500 hover:bg-orange-600 text-white font-bold rounded-lg shadow-sm transition-colors text-sm uppercase",children:"CONFIRMAR"})]})]})})},_M=({onClose:t,onSaved:e})=>{const n=Fe(),[r,i]=w.useState({nome:"",cpf:"",telefone:"",dataNascimento:"",convenio:"",email:""}),[c,d]=w.useState(null),[f,h]=w.useState(""),[p,b]=w.useState(null),{data:y}=_e(J.getPlanos);w.useEffect(()=>{const N=S=>{S.key==="Escape"&&t()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[t]);const m=async N=>{if(N.preventDefault(),!r.nome||!r.cpf){n.error("PREENCHA NOME E CPF.");return}try{const S=Date.now().toString();await J.savePaciente({...r,id:S,grupoFamiliarId:c==null?void 0:c.id,grupoFamiliarRelacao:f||void 0,indicadoPorId:p==null?void 0:p.id}),n.success("PACIENTE CADASTRADO!"),e(),t()}catch{n.error("ERRO AO CADASTRAR PACIENTE.")}},v="w-full border border-gray-200 rounded-lg p-2.5 text-sm focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none";return s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex justify-between items-center",children:[s.jsxs("h2",{className:"text-sm font-black text-gray-800 uppercase flex items-center gap-2",children:[s.jsx(ft,{size:16,className:"text-green-500"})," Novo Paciente"]}),s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsxs("form",{onSubmit:m,className:"flex-1 overflow-y-auto p-5 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Nome Completo *"}),s.jsx("input",{required:!0,value:r.nome,onChange:N=>i(S=>({...S,nome:N.target.value.toUpperCase()})),className:v,placeholder:"NOME COMPLETO"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"CPF *"}),s.jsx("input",{required:!0,value:r.cpf,onChange:N=>i(S=>({...S,cpf:N.target.value})),className:v,placeholder:"000.000.000-00"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Telefone"}),s.jsx("input",{value:r.telefone,onChange:N=>i(S=>({...S,telefone:N.target.value})),className:v,placeholder:"(67) 99999-9999"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Nascimento"}),s.jsx("input",{type:"date",value:r.dataNascimento,onChange:N=>i(S=>({...S,dataNascimento:N.target.value})),className:v})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Convênio"}),s.jsxs("select",{value:r.convenio,onChange:N=>i(S=>({...S,convenio:N.target.value})),className:v,children:[s.jsx("option",{value:"",children:"— Particular —"}),y==null?void 0:y.map(N=>s.jsx("option",{value:N.nome,children:N.nome},N.id))]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"E-mail"}),s.jsx("input",{type:"email",value:r.email,onChange:N=>i(S=>({...S,email:N.target.value})),className:v,placeholder:"email@exemplo.com"})]}),s.jsxs("div",{className:"border-t border-gray-100 pt-3 space-y-3",children:[s.jsx(Yd,{label:"Familiar (vínculo)",placeholder:"Buscar paciente familiar...",value:c,onSelect:N=>{d({id:N.id,nome:N.nome})},onClear:()=>{d(null),h("")},fetchFn:N=>J.getPacientes(N).then(S=>S.data),renderOption:N=>s.jsxs("span",{className:"flex items-center gap-2 w-full",children:[s.jsx($n,{size:12,className:"text-indigo-400 flex-shrink-0"}),s.jsx("span",{className:"font-bold flex-1",children:N.nome}),s.jsx("span",{className:"text-[10px] text-gray-400",children:N.cpf})]})}),c&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Parentesco"}),s.jsx("input",{list:"relacoes-list-novo",value:f,onChange:N=>h(N.target.value.toUpperCase()),placeholder:"EX: MÃE, PAI, IRMÃO...",className:v}),s.jsx("datalist",{id:"relacoes-list-novo",children:iS.map(N=>s.jsx("option",{value:N},N))})]}),s.jsx(Yd,{label:"Indicado por",placeholder:"Buscar paciente que indicou...",value:p,onSelect:N=>b({id:N.id,nome:N.nome}),onClear:()=>b(null),fetchFn:N=>J.getPacientes(N).then(S=>S.data),renderOption:N=>s.jsxs("span",{className:"flex items-center gap-2 w-full",children:[s.jsx($l,{size:12,className:"text-green-400 flex-shrink-0"}),s.jsx("span",{className:"font-bold flex-1",children:N.nome}),s.jsx("span",{className:"text-[10px] text-gray-400",children:N.cpf})]})})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[s.jsx("button",{type:"button",onClick:t,className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase",children:"Cancelar"}),s.jsxs("button",{type:"submit",className:"px-5 py-2 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:[s.jsx(ft,{size:14})," Cadastrar"]})]})]})]})})},MM=({patient:t,onClose:e})=>{const{data:n,isLoading:r}=_e(J.getAgendamentos),i=(n==null?void 0:n.filter(c=>c.pacienteNome===t.nome))||[];return w.useEffect(()=>{const c=d=>{d.key==="Escape"&&e()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e]),s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-200 flex justify-between items-center",children:[s.jsxs("h2",{className:"text-base font-bold text-gray-800 uppercase",children:["HISTÓRICO — ",t.nome]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:20})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2",children:[r&&s.jsx("p",{className:"text-center text-gray-400 text-sm",children:"CARREGANDO..."}),!r&&i.length===0&&s.jsx("p",{className:"text-center text-gray-400 text-sm py-6",children:"NENHUM AGENDAMENTO ENCONTRADO."}),i.map(c=>s.jsxs("div",{className:"flex items-center justify-between border border-gray-100 rounded-lg p-3 bg-gray-50",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-bold text-gray-800 text-sm uppercase",children:c.procedimento}),s.jsx("p",{className:"text-xs text-gray-500",children:new Date(c.start).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})})]}),s.jsx("span",{className:`text-xs font-bold px-2 py-1 rounded-full uppercase ${c.status==="Confirmado"?"bg-green-100 text-green-700":c.status==="Pendente"?"bg-amber-100 text-amber-700":"bg-gray-100 text-gray-600"}`,children:c.status})]},c.id))]}),s.jsx("div",{className:"p-4 border-t border-gray-200 flex justify-end",children:s.jsx("button",{onClick:e,className:"px-6 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-sm uppercase",children:"FECHAR"})})]})})},IM=["AC","AL","AP","AM","BA","CE","DF","ES","GO","MA","MT","MS","MG","PA","PB","PR","PE","PI","RJ","RN","RS","RO","RR","SC","SP","SE","TO"],vp=["Dados","Família","Endereço","Histórico"],LM=({patient:t,onClose:e,onSaved:n})=>{const r=Fe(),{data:i}=_e(J.getPlanos),{data:c}=_e(J.getAgendamentos),[d,f]=w.useState(0),[h,p]=w.useState({...t,dataNascimento:RM(t.dataNascimento)}),[b,y]=w.useState(t.grupoFamiliarId?{id:t.grupoFamiliarId,nome:t.grupoFamiliarNome||""}:null),[m,v]=w.useState(t.grupoFamiliarRelacao||""),[N,S]=w.useState(t.indicadoPorId?{id:t.indicadoPorId,nome:t.indicadoPorNome||""}:null),j=(c??[]).filter(O=>O.pacienteNome===t.nome);w.useEffect(()=>{const O=A=>{A.key==="Escape"&&e()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[e]);const R=async()=>{try{const{grupoFamiliarNome:O,indicadoPorNome:A,...k}=h;await J.updatePaciente({...k,grupoFamiliarId:b==null?void 0:b.id,grupoFamiliarRelacao:m||void 0,indicadoPorId:N==null?void 0:N.id}),r.success("PACIENTE ATUALIZADO!"),n(),e()}catch{r.error("ERRO AO SALVAR.")}},C="w-full border border-gray-200 rounded-lg p-2.5 text-sm focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none";return s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex justify-between items-center flex-shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Mo,{size:15,className:"text-blue-500"}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-black text-gray-800 uppercase",children:"Editar Paciente"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-medium uppercase",children:t.nome})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsx("div",{className:"px-6 pt-4 pb-0 flex-shrink-0",children:s.jsx("div",{className:"flex items-center",children:vp.map((O,A)=>s.jsxs(Ve.Fragment,{children:[s.jsxs("button",{onClick:()=>f(A),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-[10px] font-black uppercase transition-all whitespace-nowrap ${d===A?"bg-blue-600 text-white":Ap(A=>({...A,nome:O.target.value.toUpperCase()})),className:C})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"CPF"}),s.jsx("input",{value:h.cpf,onChange:O=>p(A=>({...A,cpf:O.target.value})),className:C})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Telefone"}),s.jsx("input",{value:h.telefone,onChange:O=>p(A=>({...A,telefone:O.target.value})),className:C})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Nascimento"}),s.jsx("input",{type:"date",value:h.dataNascimento,onChange:O=>p(A=>({...A,dataNascimento:O.target.value})),className:C})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Convênio"}),s.jsxs("select",{value:h.convenio||"",onChange:O=>p(A=>({...A,convenio:O.target.value})),className:C,children:[s.jsx("option",{value:"",children:"— Particular —"}),i==null?void 0:i.map(O=>s.jsx("option",{value:O.nome,children:O.nome},O.id))]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"E-mail"}),s.jsx("input",{type:"email",value:h.email||"",onChange:O=>p(A=>({...A,email:O.target.value})),className:C})]})]}),d===1&&s.jsxs("div",{className:"space-y-4",children:[s.jsx(Yd,{label:"Familiar (vínculo)",placeholder:"Buscar paciente familiar...",value:b,onSelect:O=>{y({id:O.id,nome:O.nome})},onClear:()=>{y(null),v("")},fetchFn:O=>J.getPacientes(O).then(A=>A.data),renderOption:O=>s.jsxs("span",{className:"flex items-center gap-2 w-full",children:[s.jsx($n,{size:12,className:"text-indigo-400 flex-shrink-0"}),s.jsx("span",{className:"font-bold flex-1",children:O.nome}),s.jsx("span",{className:"text-[10px] text-gray-400",children:O.cpf})]})}),b&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Parentesco"}),s.jsx("input",{list:"relacoes-list-editar",value:m,onChange:O=>v(O.target.value.toUpperCase()),placeholder:"EX: MÃE, PAI, IRMÃO...",className:C}),s.jsx("datalist",{id:"relacoes-list-editar",children:iS.map(O=>s.jsx("option",{value:O},O))})]}),s.jsx(Yd,{label:"Indicado por",placeholder:"Buscar paciente que indicou...",value:N,onSelect:O=>S({id:O.id,nome:O.nome}),onClear:()=>S(null),fetchFn:O=>J.getPacientes(O).then(A=>A.data),renderOption:O=>s.jsxs("span",{className:"flex items-center gap-2 w-full",children:[s.jsx($l,{size:12,className:"text-green-400 flex-shrink-0"}),s.jsx("span",{className:"font-bold flex-1",children:O.nome}),s.jsx("span",{className:"text-[10px] text-gray-400",children:O.cpf})]})})]}),d===2&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"CEP"}),s.jsx("input",{value:h.cep||"",onChange:O=>p(A=>({...A,cep:O.target.value})),className:C,placeholder:"00000-000",maxLength:9})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Logradouro"}),s.jsx("input",{value:h.logradouro||"",onChange:O=>p(A=>({...A,logradouro:O.target.value.toUpperCase()})),className:C,placeholder:"RUA, AV, TRAVESSA..."})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Número"}),s.jsx("input",{value:h.numero||"",onChange:O=>p(A=>({...A,numero:O.target.value})),className:C,placeholder:"123"})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Complemento"}),s.jsx("input",{value:h.complemento||"",onChange:O=>p(A=>({...A,complemento:O.target.value.toUpperCase()})),className:C,placeholder:"APTO, BLOCO..."})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"col-span-2",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Bairro"}),s.jsx("input",{value:h.bairro||"",onChange:O=>p(A=>({...A,bairro:O.target.value.toUpperCase()})),className:C,placeholder:"BAIRRO"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"UF"}),s.jsxs("select",{value:h.estado||"",onChange:O=>p(A=>({...A,estado:O.target.value})),className:C,children:[s.jsx("option",{value:"",children:"—"}),IM.map(O=>s.jsx("option",{children:O},O))]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Cidade"}),s.jsx("input",{value:h.cidade||"",onChange:O=>p(A=>({...A,cidade:O.target.value.toUpperCase()})),className:C,placeholder:"CIDADE"})]})]}),d===3&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Observações Clínicas"}),s.jsx("textarea",{rows:4,value:h.observacoes||"",onChange:O=>p(A=>({...A,observacoes:O.target.value})),className:C+" resize-none",placeholder:"ALERGIAS, HISTÓRICO MÉDICO, OBSERVAÇÕES..."})]}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider mb-2",children:["Histórico de Atendimentos ",s.jsxs("span",{className:"text-blue-600",children:["(",j.length,")"]})]}),j.length===0&&s.jsx("p",{className:"text-xs text-gray-400 text-center py-4 border-2 border-dashed border-gray-100 rounded-xl",children:"Nenhum atendimento registrado."}),s.jsx("div",{className:"space-y-1.5 max-h-52 overflow-y-auto",children:j.map(O=>s.jsxs("div",{className:"flex items-center justify-between border border-gray-100 rounded-lg p-2.5 bg-gray-50/70",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-bold text-gray-800 text-xs uppercase",children:O.procedimento}),s.jsx("p",{className:"text-[10px] text-gray-400",children:new Date(O.start).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),s.jsx("span",{className:`text-[9px] font-black px-2 py-0.5 rounded-full uppercase ${O.status==="Confirmado"?"bg-green-100 text-green-700":O.status==="Pendente"?"bg-amber-100 text-amber-700":O.status==="Faltou"?"bg-red-100 text-red-600":"bg-gray-100 text-gray-600"}`,children:O.status})]},O.id))})]})]})]}),s.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-between items-center flex-shrink-0",children:[s.jsxs("button",{type:"button",onClick:()=>d>0?f(O=>O-1):e(),className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:[s.jsx(Bs,{size:14})," ",d===0?"Cancelar":"Voltar"]}),df(O=>O+1),className:"px-5 py-2 bg-blue-600 hover:bg-blue-700 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:["Próximo ",s.jsx(Ts,{size:14})]}):s.jsxs("button",{type:"button",onClick:R,className:"px-5 py-2 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:[s.jsx(Io,{size:14})," Salvar Tudo"]})]})]})})},zM=({patient:t,onClose:e})=>{const{data:n,isLoading:r}=_e(J.getAgendamentos),i=(n??[]).filter(h=>h.pacienteNome===t.nome),c=i.filter(h=>h.status==="Concluido"),d=i.filter(h=>h.status==="Faltou"),f=c.reduce((h,p)=>(h[p.procedimento]=(h[p.procedimento]||0)+1,h),{});return w.useEffect(()=>{const h=p=>{p.key==="Escape"&&e()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e]),s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between flex-shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-teal-100 rounded-lg flex items-center justify-center",children:s.jsx(ua,{size:16,className:"text-teal-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase",children:"Tratamentos"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-medium uppercase",children:t.nome})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3 p-5 flex-shrink-0",children:[s.jsxs("div",{className:"bg-blue-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-2xl font-black text-blue-600",children:i.length}),s.jsx("p",{className:"text-[10px] font-bold text-blue-400 uppercase",children:"Total Consultas"})]}),s.jsxs("div",{className:"bg-green-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-2xl font-black text-green-600",children:c.length}),s.jsx("p",{className:"text-[10px] font-bold text-green-400 uppercase",children:"Concluídas"})]}),s.jsxs("div",{className:"bg-red-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-2xl font-black text-red-600",children:d.length}),s.jsx("p",{className:"text-[10px] font-bold text-red-400 uppercase",children:"Faltas"})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-5 space-y-5",children:[Object.keys(f).length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider mb-2",children:"Procedimentos Realizados"}),s.jsx("div",{className:"space-y-1.5",children:Object.entries(f).sort(([,h],[,p])=>p-h).map(([h,p])=>s.jsxs("div",{className:"flex items-center justify-between bg-gray-50 rounded-lg px-3 py-2",children:[s.jsx("p",{className:"text-xs font-bold text-gray-700 uppercase",children:h}),s.jsxs("span",{className:"text-[10px] font-black bg-blue-100 text-blue-700 px-2 py-0.5 rounded-full",children:[p,"x"]})]},h))})]}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider mb-2",children:["Histórico Cronológico (",i.length,")"]}),r&&s.jsx("p",{className:"text-xs text-gray-400 text-center py-4",children:"Carregando..."}),!r&&i.length===0&&s.jsx("p",{className:"text-xs text-gray-400 text-center py-4 border-2 border-dashed border-gray-100 rounded-xl",children:"Nenhum atendimento registrado."}),s.jsx("div",{className:"space-y-1.5",children:[...i].sort((h,p)=>new Date(p.start).getTime()-new Date(h.start).getTime()).map(h=>s.jsxs("div",{className:"flex items-center justify-between border border-gray-100 rounded-lg p-2.5",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-bold text-gray-800 text-xs uppercase truncate",children:h.procedimento}),s.jsx("p",{className:"text-[10px] text-gray-400",children:new Date(h.start).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),s.jsx("span",{className:`text-[9px] font-black px-2 py-0.5 rounded-full uppercase flex-shrink-0 ml-2 ${h.status==="Concluido"?"bg-green-100 text-green-700":h.status==="Confirmado"?"bg-blue-100 text-blue-700":h.status==="Pendente"?"bg-amber-100 text-amber-700":"bg-red-100 text-red-600"}`,children:h.status})]},h.id))})]})]}),s.jsx("div",{className:"p-4 border-t border-gray-100 flex justify-end flex-shrink-0",children:s.jsx("button",{onClick:e,className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 text-xs font-bold rounded-lg uppercase",children:"Fechar"})})]})})},PM=({patient:t,onClose:e})=>{const{data:n}=_e(J.getAgendamentos),r=(n??[]).filter(f=>f.pacienteNome===t.nome),i=r.filter(f=>f.status==="Concluido").length,c=r.filter(f=>f.status==="Faltou").length,d=new Date().toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"});return w.useEffect(()=>{const f=h=>{h.key==="Escape"&&e()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e]),s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between flex-shrink-0 print:hidden",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-violet-100 rounded-lg flex items-center justify-center",children:s.jsx(ko,{size:16,className:"text-violet-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase",children:"Relatório do Paciente"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-medium uppercase",children:t.nome})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>window.print(),className:"flex items-center gap-1.5 px-3 py-2 bg-gray-900 text-white rounded-lg text-xs font-bold hover:bg-black",children:[s.jsx(Va,{size:13})," Imprimir"]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-6 print:p-0 print:bg-white",children:s.jsxs("div",{className:"max-w-2xl mx-auto bg-white rounded-2xl shadow-sm border border-gray-200 p-8 print:shadow-none print:rounded-none print:border-0 print:max-w-full space-y-6",children:[s.jsxs("div",{className:"border-b-2 border-gray-800 pb-4",children:[s.jsx("h1",{className:"text-lg font-black text-gray-900 uppercase",children:"Relatório do Paciente"}),s.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Gerado em ",d]})]}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:"Dados Pessoais"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Nome"}),s.jsx("p",{className:"font-bold text-gray-800 uppercase",children:t.nome})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"CPF"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.cpf||"—"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Telefone"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.telefone||"—"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"E-mail"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.email||"—"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Nascimento"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.dataNascimento||"—"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Convênio"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.convenio||"Particular"})]})]})]}),(t.logradouro||t.cidade)&&s.jsxs("div",{children:[s.jsxs("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1 flex items-center gap-1",children:[s.jsx(HN,{size:11})," Endereço"]}),s.jsxs("p",{className:"text-sm text-gray-700",children:[[t.logradouro,t.numero,t.complemento].filter(Boolean).join(", "),t.bairro&&s.jsxs("span",{className:"block",children:[t.bairro,t.cidade&&` — ${t.cidade}/${t.estado}`]}),t.cep&&s.jsxs("span",{className:"block text-gray-400 text-xs",children:["CEP ",t.cep]})]})]}),(t.grupoFamiliarNome||t.indicadoPorNome)&&s.jsxs("div",{children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:"Vínculos"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[t.grupoFamiliarNome&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Familiar"}),s.jsxs("p",{className:"font-bold text-gray-800 uppercase",children:[t.grupoFamiliarNome," ",t.grupoFamiliarRelacao&&`(${t.grupoFamiliarRelacao})`]})]}),t.indicadoPorNome&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Indicado por"}),s.jsx("p",{className:"font-bold text-gray-800 uppercase",children:t.indicadoPorNome})]})]})]}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:"Resumo de Atendimentos"}),s.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[s.jsxs("div",{className:"bg-blue-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-xl font-black text-blue-600",children:r.length}),s.jsx("p",{className:"text-[10px] font-bold text-blue-400 uppercase",children:"Total"})]}),s.jsxs("div",{className:"bg-green-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-xl font-black text-green-600",children:i}),s.jsx("p",{className:"text-[10px] font-bold text-green-400 uppercase",children:"Concluídos"})]}),s.jsxs("div",{className:"bg-red-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-xl font-black text-red-600",children:c}),s.jsx("p",{className:"text-[10px] font-bold text-red-400 uppercase",children:"Faltas"})]})]}),s.jsx("div",{className:"space-y-1.5 max-h-48 overflow-y-auto",children:[...r].sort((f,h)=>new Date(h.start).getTime()-new Date(f.start).getTime()).slice(0,20).map(f=>s.jsxs("div",{className:"flex items-center justify-between border border-gray-100 rounded-lg px-3 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-bold text-gray-800 uppercase",children:f.procedimento}),s.jsx("p",{className:"text-[10px] text-gray-400",children:new Date(f.start).toLocaleDateString("pt-BR")})]}),s.jsx("span",{className:`text-[9px] font-black px-2 py-0.5 rounded-full uppercase ${f.status==="Concluido"?"bg-green-100 text-green-700":f.status==="Faltou"?"bg-red-100 text-red-600":"bg-amber-100 text-amber-700"}`,children:f.status})]},f.id))})]}),t.observacoes&&s.jsxs("div",{children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:"Observações Clínicas"}),s.jsx("p",{className:"text-sm text-gray-700 italic",children:t.observacoes})]}),s.jsxs("div",{className:"pt-6 border-t-2 border-gray-800 flex justify-between items-end",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500",children:"Assinatura / Responsável"}),s.jsx("div",{className:"h-8"})]}),s.jsx("p",{className:"text-xs text-gray-400",children:d})]})]})})]})})},pd=({label:t,value:e})=>{const[n,r]=w.useState(!1),i=()=>{e&&navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return s.jsxs("div",{className:"flex items-center justify-between bg-gray-50/70 border border-gray-200/50 rounded-lg px-2 py-1.5 gap-1 min-w-0",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-gray-400 text-[9px] font-bold uppercase leading-none mb-0.5",children:t}),s.jsx("p",{className:"text-gray-800 font-semibold text-xs truncate leading-tight",children:e||"—"})]}),e&&s.jsx("button",{onClick:i,className:"flex-shrink-0 text-gray-300 hover:text-blue-500 transition-colors ml-1",title:`Copiar ${t}`,children:n?s.jsx(da,{size:13,className:"text-green-500"}):s.jsx($C,{size:13})})]})},UM=[{key:"recentes",label:"Recentes"},{key:"az",label:"A→Z"},{key:"za",label:"Z→A"},{key:"convenio",label:"Convênio"}],BM=()=>{const[t,e]=w.useState(""),[n,r]=w.useState("recentes"),i=oS(t,500),c=w.useCallback(()=>J.getPacientes(i,n),[i,n]),{data:d,isLoading:f,error:h,refresh:p}=_e(c,[i,n]),b=(d==null?void 0:d.data)??[];d==null||d.total;const y=Fe(),[m,v]=w.useState({type:null,patient:null}),[N,S]=w.useState(null),[j,R]=w.useState(!1),C=w.useCallback(()=>v({type:null,patient:null}),[]);w.useEffect(()=>{if(!(m.type!==null&&m.type!=="agendamento"&&m.type!=="historico"&&m.type!=="editar"))return;const ce=he=>{he.key==="Escape"&&C()};return document.addEventListener("keydown",ce),()=>{document.removeEventListener("keydown",ce)}},[m.type,C]);const[O,A]=w.useState({tratamento:"",valorTotal:"",desconto:"",entrada:"",parcelas:1,vencimento:new Date().toISOString().split("T")[0]});w.useEffect(()=>{m.type==="asaas"&&A({tratamento:"",valorTotal:"",desconto:"",entrada:"",parcelas:1,vencimento:new Date().toISOString().split("T")[0]})},[m.type,m.patient]);const k=Q=>{const{name:ce,value:he}=Q.target;A(H=>({...H,[ce]:he}))},_=parseFloat(O.valorTotal)||0,B=parseFloat(O.desconto)||0,F=parseFloat(O.entrada)||0,G=_-B-F,ee=G>0&&O.parcelas>0?G/Number(O.parcelas):0,ne=Q=>{var ce;Q.preventDefault(),y.success(`COBRANÇA GERADA NO ASAAS PARA ${(ce=m.patient)==null?void 0:ce.nome}!`),C()},oe=b;return s.jsxs("div",{className:"h-full flex flex-col relative",children:[s.jsx(cn,{title:"PACIENTES",children:s.jsxs("button",{onClick:()=>R(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-colors uppercase font-bold text-sm shadow-sm",children:[s.jsx(ft,{size:18}),"NOVO PACIENTE"]})}),s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(ha,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none",size:16}),s.jsx("input",{type:"text",placeholder:"Nome ou CPF...",className:"w-full pl-9 pr-3 py-2 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none bg-white",value:t,onChange:Q=>e(Q.target.value.toUpperCase())})]}),s.jsx("div",{className:"flex items-center gap-1 bg-gray-100 rounded-lg p-1",children:UM.map(Q=>s.jsx("button",{onClick:()=>r(Q.key),className:`px-2.5 py-1 rounded-md text-[11px] font-bold transition-all whitespace-nowrap ${n===Q.key?"bg-white text-gray-800 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:Q.label},Q.key))})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3 overflow-y-auto pb-6",children:[f&&s.jsxs("div",{className:"col-span-3 text-center p-10 text-gray-500 uppercase font-bold flex justify-center items-center gap-2",children:[s.jsx(Ct,{className:"animate-spin"})," CARREGANDO DADOS DO POSTGRESQL..."]}),h&&s.jsxs("div",{className:"col-span-3 text-center p-10 text-red-600 uppercase font-bold",children:["ERRO AO CARREGAR: ",h.message]}),oe&&oe.map(Q=>s.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-all duration-200 flex flex-col",children:[s.jsxs("div",{className:"px-3 pt-3 pb-2 flex-grow flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[s.jsx("h3",{className:"font-bold text-blue-700 text-[11px] leading-snug uppercase break-words flex-1",children:Q.nome}),Q.convenio&&s.jsx("span",{className:"bg-green-100 text-green-700 text-[9px] font-black px-1.5 py-0.5 rounded-full uppercase shrink-0",children:Q.convenio})]}),(Q.grupoFamiliarNome||Q.indicadoPorNome)&&s.jsxs("div",{className:"flex flex-wrap gap-1",children:[Q.grupoFamiliarNome&&s.jsxs("button",{onClick:()=>S(Q),className:"flex items-center gap-1 bg-indigo-50 hover:bg-indigo-100 text-indigo-600 px-1.5 py-0.5 rounded-full text-[9px] font-bold uppercase transition-colors",children:[s.jsx($n,{size:9}),Q.grupoFamiliarRelacao?`${Q.grupoFamiliarRelacao}: ${Q.grupoFamiliarNome}`:Q.grupoFamiliarNome]}),Q.indicadoPorNome&&s.jsxs("span",{className:"flex items-center gap-1 bg-emerald-50 text-emerald-600 px-1.5 py-0.5 rounded-full text-[9px] font-bold uppercase",children:[s.jsx($l,{size:9}),Q.indicadoPorNome]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-1",children:[s.jsx(pd,{label:"CPF",value:Q.cpf}),s.jsx(pd,{label:"Telefone",value:Q.telefone}),s.jsx(pd,{label:"Nascimento",value:Q.dataNascimento}),s.jsx(pd,{label:"Convênio",value:Q.convenio})]})]}),s.jsxs("div",{className:"flex border-t border-gray-100",children:[s.jsxs("button",{onClick:()=>v({type:"clinical",patient:Q}),className:"w-1/2 flex items-center justify-center gap-1.5 py-2 text-blue-600 hover:bg-blue-50 rounded-bl-xl text-[10px] font-bold transition-colors uppercase",children:[s.jsx(tv,{size:12})," Clínico"]}),s.jsx("div",{className:"border-l border-gray-100"}),s.jsxs("button",{onClick:()=>v({type:"financial",patient:Q}),className:"w-1/2 flex items-center justify-center gap-1.5 py-2 text-green-700 hover:bg-green-50 rounded-br-xl text-[10px] font-bold transition-colors uppercase",children:[s.jsx(Ba,{size:12})," Financeiro"]})]})]},Q.id))]}),N&&s.jsx(TM,{paciente:N,onClose:()=>S(null)}),j&&s.jsx(_M,{onClose:()=>R(!1),onSaved:p}),m.type==="editar"&&m.patient&&s.jsx(LM,{patient:m.patient,onClose:C,onSaved:p}),m.type==="historico"&&m.patient&&s.jsx(MM,{patient:m.patient,onClose:C}),m.type==="clinical"&&m.patient&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col p-6 animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"flex justify-between items-center mb-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-gray-700 font-bold text-xl",children:[s.jsx(tv,{size:28,className:"text-gray-400"}),"Menu Clínico"]}),s.jsx("button",{onClick:C,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:20})})]}),s.jsx("p",{className:"text-gray-500 text-sm mb-6 font-bold uppercase",children:m.patient.nome}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 flex-1 content-start",children:[s.jsxs("button",{onClick:()=>v({type:"agendamento",patient:m.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-orange-400 hover:bg-orange-50/50 transition-all group shadow-sm",children:[s.jsx(SC,{size:32,className:"text-orange-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"AGENDAR"})]}),s.jsxs("button",{onClick:()=>v({type:"historico",patient:m.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-sky-400 hover:bg-sky-50/50 transition-all group shadow-sm",children:[s.jsx(Et,{size:32,className:"text-sky-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"AGENDAMENTOS"})]}),s.jsxs("button",{onClick:()=>v({type:"tratamentos",patient:m.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-teal-400 hover:bg-teal-50/50 transition-all group shadow-sm",children:[s.jsx(ua,{size:32,className:"text-teal-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"TRATAMENTOS"})]}),s.jsxs("button",{onClick:()=>{rS.getState().setPaciente(m.patient),C(),window.location.hash="#/lancargto"},className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-yellow-400 hover:bg-yellow-50/50 transition-all group shadow-sm",children:[s.jsx(so,{size:32,className:"text-yellow-600 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"GTOs"})]}),s.jsxs("button",{onClick:()=>v({type:"doc-receita",patient:m.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-red-400 hover:bg-red-50/50 transition-all group shadow-sm",children:[s.jsx(za,{size:32,className:"text-red-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"RECEITA"})]}),s.jsxs("button",{onClick:()=>v({type:"doc-raiox",patient:m.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-purple-400 hover:bg-purple-50/50 transition-all group shadow-sm",children:[s.jsx(YD,{size:32,className:"text-purple-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"RAIO-X"})]}),s.jsxs("button",{onClick:()=>v({type:"relatorio-paciente",patient:m.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-violet-400 hover:bg-violet-50/50 transition-all group shadow-sm",children:[s.jsx(ko,{size:32,className:"text-violet-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"RELATÓRIOS"})]}),s.jsxs("button",{onClick:()=>v({type:"editar",patient:m.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-blue-400 hover:bg-blue-50/50 transition-all group shadow-sm",children:[s.jsx(Mo,{size:32,className:"text-blue-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"EDITAR DADOS"})]})]})]})}),m.type==="agendamento"&&m.patient&&s.jsx(kM,{patient:m.patient,onClose:C}),m.type==="doc-receita"&&m.patient&&s.jsx(fM,{paciente:m.patient,onClose:C}),m.type==="doc-raiox"&&m.patient&&s.jsx(gM,{paciente:m.patient,onClose:C}),m.type==="tratamentos"&&m.patient&&s.jsx(zM,{patient:m.patient,onClose:C}),m.type==="relatorio-paciente"&&m.patient&&s.jsx(PM,{patient:m.patient,onClose:C}),m.type==="lancar"&&m.patient&&s.jsx(wM,{patient:m.patient,onClose:C,onSaved:p}),m.type==="contrato"&&m.patient&&s.jsx(lS,{paciente:m.patient,onClose:C,onSaved:p}),m.type==="financial"&&m.patient&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col p-6 animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"flex justify-between items-center mb-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-gray-700 font-bold text-xl",children:[s.jsx(OO,{size:28,className:"text-gray-400"}),"Menu Financeiro"]}),s.jsx("button",{onClick:C,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:20})})]}),s.jsx("p",{className:"text-gray-500 text-sm mb-8 font-bold uppercase",children:m.patient.nome}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[s.jsxs("button",{onClick:()=>v({type:"lancar",patient:m.patient}),className:"flex flex-col items-center justify-center p-6 bg-white border border-gray-200 rounded-xl hover:border-green-400 hover:bg-green-50/50 transition-all group shadow-sm",children:[s.jsx(zN,{size:32,className:"text-green-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm",children:"LANÇAR"})]}),s.jsxs("button",{onClick:()=>v({type:"asaas",patient:m.patient}),className:"flex flex-col items-center justify-center p-6 bg-white border border-gray-200 rounded-xl hover:border-blue-400 hover:bg-blue-50/50 transition-all group shadow-sm",children:[s.jsx(LN,{size:32,className:"text-blue-600 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm",children:"ASAAS"})]}),s.jsxs("button",{onClick:()=>v({type:"historico",patient:m.patient}),className:"flex flex-col items-center justify-center p-6 bg-white border border-gray-200 rounded-xl hover:border-gray-400 hover:bg-gray-50/50 transition-all group shadow-sm",children:[s.jsx(gD,{size:32,className:"text-gray-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm",children:"HISTÓRICO"})]}),s.jsxs("button",{onClick:()=>v({type:"contrato",patient:m.patient}),className:"flex flex-col items-center justify-center p-6 bg-white border border-gray-200 rounded-xl hover:border-indigo-400 hover:bg-indigo-50/50 transition-all group shadow-sm",children:[s.jsx(za,{size:32,className:"text-indigo-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm",children:"CONTRATOS"})]})]})]})}),m.type==="asaas"&&m.patient&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsx("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:s.jsxs("form",{onSubmit:ne,children:[s.jsx("div",{className:"p-6 border-b border-gray-200",children:s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[s.jsx("span",{className:"w-6 h-4 bg-yellow-400 rounded-sm flex items-center justify-center text-yellow-800",children:s.jsx(QC,{size:14})}),"PARCELAMENTO INTELIGENTE (ASAAS)"]}),s.jsxs("p",{className:"text-sm text-gray-500 mt-2",children:["Cliente: ",s.jsx("span",{className:"font-bold uppercase",children:m.patient.nome})]})]}),s.jsx("button",{type:"button",onClick:C,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:20})})]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"TRATAMENTO"}),s.jsx("input",{type:"text",name:"tratamento",value:O.tratamento,onChange:k,placeholder:"EX: ORTODONTIA COMPLETA",className:"w-full border border-gray-300 rounded-md p-2 text-sm uppercase-input"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"VALOR TOTAL (R$)"}),s.jsx("input",{type:"number",step:"0.01",name:"valorTotal",value:O.valorTotal,onChange:k,placeholder:"0,00",className:"w-full border border-gray-300 rounded-md p-2 text-sm"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"DESCONTO (R$)"}),s.jsx("input",{type:"number",step:"0.01",name:"desconto",value:O.desconto,onChange:k,placeholder:"0,00",className:"w-full border border-gray-300 rounded-md p-2 text-sm"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"ENTRADA (R$)"}),s.jsx("input",{type:"number",step:"0.01",name:"entrada",value:O.entrada,onChange:k,placeholder:"0,00",className:"w-full border border-gray-300 rounded-md p-2 text-sm"})]}),s.jsxs("div",{className:"bg-blue-50/70 p-3 rounded-md flex justify-between items-center border border-blue-100/50",children:[s.jsx("span",{className:"font-semibold text-blue-700 text-sm",children:"SALDO A PARCELAR:"}),s.jsx("span",{className:"font-bold text-blue-700 text-lg",children:G.toLocaleString("pt-BR",{style:"currency",currency:"BRL"})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"PARCELAS (ATÉ 48X)"}),s.jsx("select",{name:"parcelas",value:O.parcelas,onChange:k,className:"w-full border border-gray-300 rounded-md p-2 text-sm bg-white",children:Array.from({length:48},(Q,ce)=>ce+1).map(Q=>s.jsxs("option",{value:Q,children:[Q,"x"]},Q))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"VENCIMENTO 1ª PARCELA"}),s.jsx("input",{type:"date",name:"vencimento",value:O.vencimento,onChange:k,className:"w-full border border-gray-300 rounded-md p-2 text-sm"})]})]}),s.jsxs("div",{className:"text-center text-blue-600 font-bold text-lg py-2",children:[O.parcelas,"x DE ",ee.toLocaleString("pt-BR",{style:"currency",currency:"BRL"})]})]}),s.jsxs("div",{className:"p-6 bg-gray-50 border-t border-gray-200 flex justify-end gap-3",children:[s.jsx("button",{type:"button",onClick:C,className:"px-6 py-2 bg-gray-200 hover:bg-gray-300 text-gray-700 font-bold rounded-lg transition-colors text-sm uppercase",children:"CANCELAR"}),s.jsxs("button",{type:"submit",className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white font-bold rounded-lg shadow-sm flex items-center justify-center gap-2 transition-colors text-sm uppercase",children:[s.jsx(XD,{size:16}),"GERAR CARNÊ/PIX"]})]})]})})})]})};var Au,Se,cS,dS,Bl,ur,Xv,uS,fS,Qd={},hS=[],HM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Ds(t,e){for(var n in e)t[n]=e[n];return t}function pS(t){var e=t.parentNode;e&&e.removeChild(t)}function I(t,e,n){var r,i,c,d={};for(c in e)c=="key"?r=e[c]:c=="ref"?i=e[c]:d[c]=e[c];if(arguments.length>2&&(d.children=arguments.length>3?Au.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(c in t.defaultProps)d[c]===void 0&&(d[c]=t.defaultProps[c]);return Cd(t,d,r,i,null)}function Cd(t,e,n,r,i){var c={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:i??++cS};return i==null&&Se.vnode!=null&&Se.vnode(c),c}function Zt(){return{current:null}}function lt(t){return t.children}function GM(t,e,n,r,i){var c;for(c in n)c==="children"||c==="key"||c in e||Wd(t,c,null,n[c],r);for(c in e)i&&typeof e[c]!="function"||c==="children"||c==="key"||c==="value"||c==="checked"||n[c]===e[c]||Wd(t,c,e[c],n[c],r)}function Zv(t,e,n){e[0]==="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||HM.test(e)?n:n+"px"}function Wd(t,e,n,r,i){var c;e:if(e==="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||Zv(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||Zv(t.style,e,n[e])}else if(e[0]==="o"&&e[1]==="n")c=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+c]=n,n?r||t.addEventListener(e,c?Jv:Kv,c):t.removeEventListener(e,c?Jv:Kv,c);else if(e!=="dangerouslySetInnerHTML"){if(i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e.indexOf("-")==-1?t.removeAttribute(e):t.setAttribute(e,n))}}function Kv(t){Bl=!0;try{return this.l[t.type+!1](Se.event?Se.event(t):t)}finally{Bl=!1}}function Jv(t){Bl=!0;try{return this.l[t.type+!0](Se.event?Se.event(t):t)}finally{Bl=!1}}function wn(t,e){this.props=t,this.context=e}function vo(t,e){if(e==null)return t.__?vo(t.__,t.__.__k.indexOf(t)+1):null;for(var n;ee&&ur.sort(function(h,p){return h.__v.__b-p.__v.__b}));Xd.__r=0}function mS(t,e,n,r,i,c,d,f,h,p){var b,y,m,v,N,S,j,R=r&&r.__k||hS,C=R.length;for(n.__k=[],b=0;b0?Cd(v.type,v.props,v.key,v.ref?v.ref:null,v.__v):v)!=null){if(v.__=n,v.__b=n.__b+1,(m=R[b])===null||m&&v.key==m.key&&v.type===m.type)R[b]=void 0;else for(y=0;y=0;e--)if((n=t.__k[e])&&(r=yS(n)))return r}return null}function tm(t,e,n,r,i,c,d,f,h){var p,b,y,m,v,N,S,j,R,C,O,A,k,_,B,F=e.type;if(e.constructor!==void 0)return null;n.__h!=null&&(h=n.__h,f=e.__e=n.__e,e.__h=null,c=[f]),(p=Se.__b)&&p(e);try{e:if(typeof F=="function"){if(j=e.props,R=(p=F.contextType)&&r[p.__c],C=p?R?R.props.value:p.__:r,n.__c?S=(b=e.__c=n.__c).__=b.__E:("prototype"in F&&F.prototype.render?e.__c=b=new F(j,C):(e.__c=b=new wn(j,C),b.constructor=F,b.render=qM),R&&R.sub(b),b.props=j,b.state||(b.state={}),b.context=C,b.__n=r,y=b.__d=!0,b.__h=[],b._sb=[]),b.__s==null&&(b.__s=b.state),F.getDerivedStateFromProps!=null&&(b.__s==b.state&&(b.__s=Ds({},b.__s)),Ds(b.__s,F.getDerivedStateFromProps(j,b.__s))),m=b.props,v=b.state,b.__v=e,y)F.getDerivedStateFromProps==null&&b.componentWillMount!=null&&b.componentWillMount(),b.componentDidMount!=null&&b.__h.push(b.componentDidMount);else{if(F.getDerivedStateFromProps==null&&j!==m&&b.componentWillReceiveProps!=null&&b.componentWillReceiveProps(j,C),!b.__e&&b.shouldComponentUpdate!=null&&b.shouldComponentUpdate(j,b.__s,C)===!1||e.__v===n.__v){for(e.__v!==n.__v&&(b.props=j,b.state=b.__s,b.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.forEach(function(G){G&&(G.__=e)}),O=0;O3;)n.pop()();if(n[1]>>1,1),e.i.removeChild(r)}}),No(I(ZM,{context:e.context},t.__v),e.l)):e.l&&e.componentWillUnmount()}function JM(t,e){var n=I(KM,{__v:t,i:e});return n.containerInfo=e,n}(gd.prototype=new wn).__a=function(t){var e=this,n=wS(e.__v),r=e.o.get(t);return r[0]++,function(i){var c=function(){e.props.revealOrder?(r.push(i),u1(e,t,r)):i()};n?n(c):c()}},gd.prototype.render=function(t){this.u=null,this.o=new Map;var e=Zd(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},gd.prototype.componentDidUpdate=gd.prototype.componentDidMount=function(){var t=this;this.o.forEach(function(e,n){u1(t,n,e)})};var eI=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,tI=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,nI=typeof document<"u",aI=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(t)};wn.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(wn.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var f1=Se.event;function sI(){}function rI(){return this.cancelBubble}function lI(){return this.defaultPrevented}Se.event=function(t){return f1&&(t=f1(t)),t.persist=sI,t.isPropagationStopped=rI,t.isDefaultPrevented=lI,t.nativeEvent=t};var h1={configurable:!0,get:function(){return this.class}},p1=Se.vnode;Se.vnode=function(t){var e=t.type,n=t.props,r=n;if(typeof e=="string"){var i=e.indexOf("-")===-1;for(var c in r={},n){var d=n[c];nI&&c==="children"&&e==="noscript"||c==="value"&&"defaultValue"in n&&d==null||(c==="defaultValue"&&"value"in n&&n.value==null?c="value":c==="download"&&d===!0?d="":/ondoubleclick/i.test(c)?c="ondblclick":/^onchange(textarea|input)/i.test(c+e)&&!aI(n.type)?c="oninput":/^onfocus$/i.test(c)?c="onfocusin":/^onblur$/i.test(c)?c="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(c)?c=c.toLowerCase():i&&tI.test(c)?c=c.replace(/[A-Z0-9]/g,"-$&").toLowerCase():d===null&&(d=void 0),/^oninput$/i.test(c)&&(c=c.toLowerCase(),r[c]&&(c="oninputCapture")),r[c]=d)}e=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=Zd(n.children).forEach(function(f){f.props.selected=r.value.indexOf(f.props.value)!=-1})),e=="select"&&r.defaultValue!=null&&(r.value=Zd(n.children).forEach(function(f){f.props.selected=r.multiple?r.defaultValue.indexOf(f.props.value)!=-1:r.defaultValue==f.props.value})),t.props=r,n.class!=n.className&&(h1.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",h1))}t.$$typeof=eI,p1&&p1(t)};var g1=Se.__r;Se.__r=function(t){g1&&g1(t),t.__c};const CS=[],Kp=new Map;function nm(t){CS.push(t),Kp.forEach(e=>{OS(e,t)})}function iI(t){t.isConnected&&t.getRootNode&&DS(t.getRootNode())}function DS(t){let e=Kp.get(t);if(!e||!e.isConnected){if(e=t.querySelector("style[data-fullcalendar]"),!e){e=document.createElement("style"),e.setAttribute("data-fullcalendar","");const n=cI();n&&(e.nonce=n);const r=t===document?document.head:t,i=t===document?r.querySelector("script,link[rel=stylesheet],link[as=style],style"):r.firstChild;r.insertBefore(e,i)}Kp.set(t,e),oI(e)}}function oI(t){for(const e of CS)OS(t,e)}function OS(t,e){const{sheet:n}=t,r=n.cssRules.length;e.split("}").forEach((i,c)=>{i=i.trim(),i&&n.insertRule(i+"}",r+c)})}let jp;function cI(){return jp===void 0&&(jp=dI()),jp}function dI(){const t=document.querySelector('meta[name="csp-nonce"]');if(t&&t.hasAttribute("content"))return t.getAttribute("content");const e=document.querySelector("script[nonce]");return e&&e.nonce||""}typeof document<"u"&&DS(document);var uI=':root{--fc-small-font-size:.85em;--fc-page-bg-color:#fff;--fc-neutral-bg-color:hsla(0,0%,82%,.3);--fc-neutral-text-color:grey;--fc-border-color:#ddd;--fc-button-text-color:#fff;--fc-button-bg-color:#2c3e50;--fc-button-border-color:#2c3e50;--fc-button-hover-bg-color:#1e2b37;--fc-button-hover-border-color:#1a252f;--fc-button-active-bg-color:#1a252f;--fc-button-active-border-color:#151e27;--fc-event-bg-color:#3788d8;--fc-event-border-color:#3788d8;--fc-event-text-color:#fff;--fc-event-selected-overlay-color:rgba(0,0,0,.25);--fc-more-link-bg-color:#d0d0d0;--fc-more-link-text-color:inherit;--fc-event-resizer-thickness:8px;--fc-event-resizer-dot-total-width:8px;--fc-event-resizer-dot-border-width:1px;--fc-non-business-color:hsla(0,0%,84%,.3);--fc-bg-event-color:#8fdf82;--fc-bg-event-opacity:0.3;--fc-highlight-color:rgba(188,232,241,.3);--fc-today-bg-color:rgba(255,220,40,.15);--fc-now-indicator-color:red}.fc-not-allowed,.fc-not-allowed .fc-event{cursor:not-allowed}.fc{display:flex;flex-direction:column;font-size:1em}.fc,.fc *,.fc :after,.fc :before{box-sizing:border-box}.fc table{border-collapse:collapse;border-spacing:0;font-size:1em}.fc th{text-align:center}.fc td,.fc th{padding:0;vertical-align:top}.fc a[data-navlink]{cursor:pointer}.fc a[data-navlink]:hover{text-decoration:underline}.fc-direction-ltr{direction:ltr;text-align:left}.fc-direction-rtl{direction:rtl;text-align:right}.fc-theme-standard td,.fc-theme-standard th{border:1px solid var(--fc-border-color)}.fc-liquid-hack td,.fc-liquid-hack th{position:relative}@font-face{font-family:fcicons;font-style:normal;font-weight:400;src:url("data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBfAAAAC8AAAAYGNtYXAXVtKNAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZgYydxIAAAF4AAAFNGhlYWQUJ7cIAAAGrAAAADZoaGVhB20DzAAABuQAAAAkaG10eCIABhQAAAcIAAAALGxvY2ED4AU6AAAHNAAAABhtYXhwAA8AjAAAB0wAAAAgbmFtZXsr690AAAdsAAABhnBvc3QAAwAAAAAI9AAAACAAAwPAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpBgPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6Qb//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAWIAjQKeAskAEwAAJSc3NjQnJiIHAQYUFwEWMjc2NCcCnuLiDQ0MJAz/AA0NAQAMJAwNDcni4gwjDQwM/wANIwz/AA0NDCMNAAAAAQFiAI0CngLJABMAACUBNjQnASYiBwYUHwEHBhQXFjI3AZ4BAA0N/wAMJAwNDeLiDQ0MJAyNAQAMIw0BAAwMDSMM4uINIwwNDQAAAAIA4gC3Ax4CngATACcAACUnNzY0JyYiDwEGFB8BFjI3NjQnISc3NjQnJiIPAQYUHwEWMjc2NCcB87e3DQ0MIw3VDQ3VDSMMDQ0BK7e3DQ0MJAzVDQ3VDCQMDQ3zuLcMJAwNDdUNIwzWDAwNIwy4twwkDA0N1Q0jDNYMDA0jDAAAAgDiALcDHgKeABMAJwAAJTc2NC8BJiIHBhQfAQcGFBcWMjchNzY0LwEmIgcGFB8BBwYUFxYyNwJJ1Q0N1Q0jDA0Nt7cNDQwjDf7V1Q0N1QwkDA0Nt7cNDQwkDLfWDCMN1Q0NDCQMt7gMIw0MDNYMIw3VDQ0MJAy3uAwjDQwMAAADAFUAAAOrA1UAMwBoAHcAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMhMjY1NCYjISIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAAVYRGRkR/qoRGRkRA1UFBAUOCQkVDAsZDf2rDRkLDBUJCA4FBQUFBQUOCQgVDAsZDQJVDRkLDBUJCQ4FBAVVAgECBQMCBwQECAX9qwQJAwQHAwMFAQICAgIBBQMDBwQDCQQCVQUIBAQHAgMFAgEC/oAZEhEZGRESGQAAAAADAFUAAAOrA1UAMwBoAIkAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMzFRQWMzI2PQEzMjY1NCYrATU0JiMiBh0BIyIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAgBkSEhmAERkZEYAZEhIZgBEZGREDVQUEBQ4JCRUMCxkN/asNGQsMFQkIDgUFBQUFBQ4JCBUMCxkNAlUNGQsMFQkJDgUEBVUCAQIFAwIHBAQIBf2rBAkDBAcDAwUBAgICAgEFAwMHBAMJBAJVBQgEBAcCAwUCAQL+gIASGRkSgBkSERmAEhkZEoAZERIZAAABAOIAjQMeAskAIAAAExcHBhQXFjI/ARcWMjc2NC8BNzY0JyYiDwEnJiIHBhQX4uLiDQ0MJAzi4gwkDA0N4uINDQwkDOLiDCQMDQ0CjeLiDSMMDQ3h4Q0NDCMN4uIMIw0MDOLiDAwNIwwAAAABAAAAAQAAa5n0y18PPPUACwQAAAAAANivOVsAAAAA2K85WwAAAAADqwNVAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAOrAAEAAAAAAAAAAAAAAAAAAAALBAAAAAAAAAAAAAAAAgAAAAQAAWIEAAFiBAAA4gQAAOIEAABVBAAAVQQAAOIAAAAAAAoAFAAeAEQAagCqAOoBngJkApoAAQAAAAsAigADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGZjaWNvbnMAZgBjAGkAYwBvAG4Ac1ZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGZjaWNvbnMAZgBjAGkAYwBvAG4Ac2ZjaWNvbnMAZgBjAGkAYwBvAG4Ac1JlZ3VsYXIAUgBlAGcAdQBsAGEAcmZjaWNvbnMAZgBjAGkAYwBvAG4Ac0ZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format("truetype")}.fc-icon{speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;font-family:fcicons!important;font-style:normal;font-variant:normal;font-weight:400;height:1em;line-height:1;text-align:center;text-transform:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1em}.fc-icon-chevron-left:before{content:"\\e900"}.fc-icon-chevron-right:before{content:"\\e901"}.fc-icon-chevrons-left:before{content:"\\e902"}.fc-icon-chevrons-right:before{content:"\\e903"}.fc-icon-minus-square:before{content:"\\e904"}.fc-icon-plus-square:before{content:"\\e905"}.fc-icon-x:before{content:"\\e906"}.fc .fc-button{border-radius:0;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;overflow:visible;text-transform:none}.fc .fc-button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}.fc .fc-button{-webkit-appearance:button}.fc .fc-button:not(:disabled){cursor:pointer}.fc .fc-button{background-color:transparent;border:1px solid transparent;border-radius:.25em;display:inline-block;font-size:1em;font-weight:400;line-height:1.5;padding:.4em .65em;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle}.fc .fc-button:hover{text-decoration:none}.fc .fc-button:focus{box-shadow:0 0 0 .2rem rgba(44,62,80,.25);outline:0}.fc .fc-button:disabled{opacity:.65}.fc .fc-button-primary{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:hover{background-color:var(--fc-button-hover-bg-color);border-color:var(--fc-button-hover-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:disabled{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button-primary:not(:disabled).fc-button-active,.fc .fc-button-primary:not(:disabled):active{background-color:var(--fc-button-active-bg-color);border-color:var(--fc-button-active-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:not(:disabled).fc-button-active:focus,.fc .fc-button-primary:not(:disabled):active:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button .fc-icon{font-size:1.5em;vertical-align:middle}.fc .fc-button-group{display:inline-flex;position:relative;vertical-align:middle}.fc .fc-button-group>.fc-button{flex:1 1 auto;position:relative}.fc .fc-button-group>.fc-button.fc-button-active,.fc .fc-button-group>.fc-button:active,.fc .fc-button-group>.fc-button:focus,.fc .fc-button-group>.fc-button:hover{z-index:1}.fc-direction-ltr .fc-button-group>.fc-button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-1px}.fc-direction-ltr .fc-button-group>.fc-button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.fc-direction-rtl .fc-button-group>.fc-button:not(:first-child){border-bottom-right-radius:0;border-top-right-radius:0;margin-right:-1px}.fc-direction-rtl .fc-button-group>.fc-button:not(:last-child){border-bottom-left-radius:0;border-top-left-radius:0}.fc .fc-toolbar{align-items:center;display:flex;justify-content:space-between}.fc .fc-toolbar.fc-header-toolbar{margin-bottom:1.5em}.fc .fc-toolbar.fc-footer-toolbar{margin-top:1.5em}.fc .fc-toolbar-title{font-size:1.75em;margin:0}.fc-direction-ltr .fc-toolbar>*>:not(:first-child){margin-left:.75em}.fc-direction-rtl .fc-toolbar>*>:not(:first-child){margin-right:.75em}.fc-direction-rtl .fc-toolbar-ltr{flex-direction:row-reverse}.fc .fc-scroller{-webkit-overflow-scrolling:touch;position:relative}.fc .fc-scroller-liquid{height:100%}.fc .fc-scroller-liquid-absolute{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-scroller-harness{direction:ltr;overflow:hidden;position:relative}.fc .fc-scroller-harness-liquid{height:100%}.fc-direction-rtl .fc-scroller-harness>.fc-scroller{direction:rtl}.fc-theme-standard .fc-scrollgrid{border:1px solid var(--fc-border-color)}.fc .fc-scrollgrid,.fc .fc-scrollgrid table{table-layout:fixed;width:100%}.fc .fc-scrollgrid table{border-left-style:hidden;border-right-style:hidden;border-top-style:hidden}.fc .fc-scrollgrid{border-bottom-width:0;border-collapse:separate;border-right-width:0}.fc .fc-scrollgrid-liquid{height:100%}.fc .fc-scrollgrid-section,.fc .fc-scrollgrid-section table,.fc .fc-scrollgrid-section>td{height:1px}.fc .fc-scrollgrid-section-liquid>td{height:100%}.fc .fc-scrollgrid-section>*{border-left-width:0;border-top-width:0}.fc .fc-scrollgrid-section-footer>*,.fc .fc-scrollgrid-section-header>*{border-bottom-width:0}.fc .fc-scrollgrid-section-body table,.fc .fc-scrollgrid-section-footer table{border-bottom-style:hidden}.fc .fc-scrollgrid-section-sticky>*{background:var(--fc-page-bg-color);position:sticky;z-index:3}.fc .fc-scrollgrid-section-header.fc-scrollgrid-section-sticky>*{top:0}.fc .fc-scrollgrid-section-footer.fc-scrollgrid-section-sticky>*{bottom:0}.fc .fc-scrollgrid-sticky-shim{height:1px;margin-bottom:-1px}.fc-sticky{position:sticky}.fc .fc-view-harness{flex-grow:1;position:relative}.fc .fc-view-harness-active>.fc-view{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-col-header-cell-cushion{display:inline-block;padding:2px 4px}.fc .fc-bg-event,.fc .fc-highlight,.fc .fc-non-business{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-non-business{background:var(--fc-non-business-color)}.fc .fc-bg-event{background:var(--fc-bg-event-color);opacity:var(--fc-bg-event-opacity)}.fc .fc-bg-event .fc-event-title{font-size:var(--fc-small-font-size);font-style:italic;margin:.5em}.fc .fc-highlight{background:var(--fc-highlight-color)}.fc .fc-cell-shaded,.fc .fc-day-disabled{background:var(--fc-neutral-bg-color)}a.fc-event,a.fc-event:hover{text-decoration:none}.fc-event.fc-event-draggable,.fc-event[href]{cursor:pointer}.fc-event .fc-event-main{position:relative;z-index:2}.fc-event-dragging:not(.fc-event-selected){opacity:.75}.fc-event-dragging.fc-event-selected{box-shadow:0 2px 7px rgba(0,0,0,.3)}.fc-event .fc-event-resizer{display:none;position:absolute;z-index:4}.fc-event-selected .fc-event-resizer,.fc-event:hover .fc-event-resizer{display:block}.fc-event-selected .fc-event-resizer{background:var(--fc-page-bg-color);border-color:inherit;border-radius:calc(var(--fc-event-resizer-dot-total-width)/2);border-style:solid;border-width:var(--fc-event-resizer-dot-border-width);height:var(--fc-event-resizer-dot-total-width);width:var(--fc-event-resizer-dot-total-width)}.fc-event-selected .fc-event-resizer:before{bottom:-20px;content:"";left:-20px;position:absolute;right:-20px;top:-20px}.fc-event-selected,.fc-event:focus{box-shadow:0 2px 5px rgba(0,0,0,.2)}.fc-event-selected:before,.fc-event:focus:before{bottom:0;content:"";left:0;position:absolute;right:0;top:0;z-index:3}.fc-event-selected:after,.fc-event:focus:after{background:var(--fc-event-selected-overlay-color);bottom:-1px;content:"";left:-1px;position:absolute;right:-1px;top:-1px;z-index:1}.fc-h-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-h-event .fc-event-main{color:var(--fc-event-text-color)}.fc-h-event .fc-event-main-frame{display:flex}.fc-h-event .fc-event-time{max-width:100%;overflow:hidden}.fc-h-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-width:0}.fc-h-event .fc-event-title{display:inline-block;left:0;max-width:100%;overflow:hidden;right:0;vertical-align:top}.fc-h-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-start),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-end){border-bottom-left-radius:0;border-left-width:0;border-top-left-radius:0}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-end),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-start){border-bottom-right-radius:0;border-right-width:0;border-top-right-radius:0}.fc-h-event:not(.fc-event-selected) .fc-event-resizer{bottom:0;top:0;width:var(--fc-event-resizer-thickness)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end{cursor:w-resize;left:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start{cursor:e-resize;right:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-h-event.fc-event-selected .fc-event-resizer{margin-top:calc(var(--fc-event-resizer-dot-total-width)*-.5);top:50%}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-start,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-end{left:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-end,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-start{right:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc .fc-popover{box-shadow:0 2px 6px rgba(0,0,0,.15);position:absolute;z-index:9999}.fc .fc-popover-header{align-items:center;display:flex;flex-direction:row;justify-content:space-between;padding:3px 4px}.fc .fc-popover-title{margin:0 2px}.fc .fc-popover-close{cursor:pointer;font-size:1.1em;opacity:.65}.fc-theme-standard .fc-popover{background:var(--fc-page-bg-color);border:1px solid var(--fc-border-color)}.fc-theme-standard .fc-popover-header{background:var(--fc-neutral-bg-color)}';nm(uI);class am{constructor(e){this.drainedOption=e,this.isRunning=!1,this.isDirty=!1,this.pauseDepths={},this.timeoutId=0}request(e){this.isDirty=!0,this.isPaused()||(this.clearTimeout(),e==null?this.tryDrain():this.timeoutId=setTimeout(this.tryDrain.bind(this),e))}pause(e=""){let{pauseDepths:n}=this;n[e]=(n[e]||0)+1,this.clearTimeout()}resume(e="",n){let{pauseDepths:r}=this;e in r&&(n?delete r[e]:(r[e]-=1,r[e]<=0&&delete r[e]),this.tryDrain())}isPaused(){return Object.keys(this.pauseDepths).length}tryDrain(){if(!this.isRunning&&!this.isPaused()){for(this.isRunning=!0;this.isDirty;)this.isDirty=!1,this.drained();this.isRunning=!1}}clear(){this.clearTimeout(),this.isDirty=!1,this.pauseDepths={}}clearTimeout(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=0)}drained(){this.drainedOption&&this.drainedOption()}}function sm(t){t.parentNode&&t.parentNode.removeChild(t)}function qt(t,e){if(t.closest)return t.closest(e);if(!document.documentElement.contains(t))return null;do{if(fI(t,e))return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType===1);return null}function fI(t,e){return(t.matches||t.matchesSelector||t.msMatchesSelector).call(t,e)}function hI(t,e){let n=t instanceof HTMLElement?[t]:t,r=[];for(let i=0;i{let r=qt(n.target,t);r&&e.call(r,n,r)}}function kS(t,e,n,r){let i=gI(n,r);return t.addEventListener(e,i),()=>{t.removeEventListener(e,i)}}function mI(t,e,n,r){let i;return kS(t,"mouseover",e,(c,d)=>{if(d!==i){i=d,n(c,d);let f=h=>{i=null,r(h,d),d.removeEventListener("mouseleave",f)};d.addEventListener("mouseleave",f)}})}const x1=["webkitTransitionEnd","otransitionend","oTransitionEnd","msTransitionEnd","transitionend"];function xI(t,e){let n=r=>{e(r),x1.forEach(i=>{t.removeEventListener(i,n)})};x1.forEach(r=>{t.addEventListener(r,n)})}function _S(t){return Object.assign({onClick:t},MS(t))}function MS(t){return{tabIndex:0,onKeyDown(e){(e.key==="Enter"||e.key===" ")&&(t(e),e.preventDefault())}}}let b1=0;function Tr(){return b1+=1,String(b1)}function rm(){document.body.classList.add("fc-not-allowed")}function lm(){document.body.classList.remove("fc-not-allowed")}function bI(t){t.style.userSelect="none",t.style.webkitUserSelect="none",t.addEventListener("selectstart",Cu)}function yI(t){t.style.userSelect="",t.style.webkitUserSelect="",t.removeEventListener("selectstart",Cu)}function vI(t){t.addEventListener("contextmenu",Cu)}function NI(t){t.removeEventListener("contextmenu",Cu)}function EI(t){let e=[],n=[],r,i;for(typeof t=="string"?n=t.split(/\s*,\s*/):typeof t=="function"?n=[t]:Array.isArray(t)&&(n=t),r=0;rr.replace("$"+c,i||""),t):n}function wI(t,e){return t-e}function Od(t){return t%1===0}function CI(t){let e=t.querySelector(".fc-scrollgrid-shrink-frame"),n=t.querySelector(".fc-scrollgrid-shrink-cushion");if(!e)throw new Error("needs fc-scrollgrid-shrink-frame className");if(!n)throw new Error("needs fc-scrollgrid-shrink-cushion className");return t.getBoundingClientRect().width-e.getBoundingClientRect().width+n.getBoundingClientRect().width}const y1=["years","months","days","milliseconds"],DI=/^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/;function Ge(t,e){return typeof t=="string"?OI(t):typeof t=="object"&&t?v1(t):typeof t=="number"?v1({[e||"milliseconds"]:t}):null}function OI(t){let e=DI.exec(t);if(e){let n=e[1]?-1:1;return{years:0,months:0,days:n*(e[2]?parseInt(e[2],10):0),milliseconds:n*((e[3]?parseInt(e[3],10):0)*60*60*1e3+(e[4]?parseInt(e[4],10):0)*60*1e3+(e[5]?parseInt(e[5],10):0)*1e3+(e[6]?parseInt(e[6],10):0))}}return null}function v1(t){let e={years:t.years||t.year||0,months:t.months||t.month||0,days:t.days||t.day||0,milliseconds:(t.hours||t.hour||0)*60*60*1e3+(t.minutes||t.minute||0)*60*1e3+(t.seconds||t.second||0)*1e3+(t.milliseconds||t.millisecond||t.ms||0)},n=t.weeks||t.week;return n&&(e.days+=n*7,e.specifiedWeeks=!0),e}function RI(t,e){return t.years===e.years&&t.months===e.months&&t.days===e.days&&t.milliseconds===e.milliseconds}function Jp(t,e){return{years:t.years+e.years,months:t.months+e.months,days:t.days+e.days,milliseconds:t.milliseconds+e.milliseconds}}function TI(t,e){return{years:t.years-e.years,months:t.months-e.months,days:t.days-e.days,milliseconds:t.milliseconds-e.milliseconds}}function kI(t,e){return{years:t.years*e,months:t.months*e,days:t.days*e,milliseconds:t.milliseconds*e}}function _I(t){return El(t)/365}function MI(t){return El(t)/30}function El(t){return ea(t)/864e5}function ea(t){return t.years*(365*864e5)+t.months*(30*864e5)+t.days*864e5+t.milliseconds}function im(t,e){let n=null;for(let r=0;r=1?Math.min(i,c):i}function Ap(t,e,n,r){let i=on([e,0,1+$I(e,n,r)]),c=it(t),d=Math.round(kr(i,c));return Math.floor(d/7)+1}function $I(t,e,n){let r=7+e-n;return-((7+on([t,0,r]).getUTCDay()-e)%7)+r-1}function E1(t){return[t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]}function S1(t){return new Date(t[0],t[1]||0,t[2]==null?1:t[2],t[3]||0,t[4]||0,t[5]||0)}function Os(t){return[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()]}function on(t){return t.length===1&&(t=t.concat([0])),new Date(Date.UTC(...t))}function IS(t){return!isNaN(t.valueOf())}function Rs(t){return t.getUTCHours()*1e3*60*60+t.getUTCMinutes()*1e3*60+t.getUTCSeconds()*1e3+t.getUTCMilliseconds()}function LS(t,e,n=!1){let r=t.toISOString();return r=r.replace(".000",""),n&&(r=r.replace("T00:00:00Z","")),r.length>10&&(e==null?r=r.replace("Z",""):e!==0&&(r=r.replace("Z",cm(e,!0)))),r}function om(t){return t.toISOString().replace(/T.*$/,"")}function YI(t){return t.toISOString().match(/^\d{4}-\d{2}/)[0]}function QI(t){return Nl(t.getUTCHours(),2)+":"+Nl(t.getUTCMinutes(),2)+":"+Nl(t.getUTCSeconds(),2)}function cm(t,e=!1){let n=t<0?"-":"+",r=Math.abs(t),i=Math.floor(r/60),c=Math.round(r%60);return e?`${n+Nl(i,2)}:${Nl(c,2)}`:`GMT${n}${i}${c?`:${Nl(c,2)}`:""}`}function we(t,e,n){let r,i;return function(...c){if(!r)i=t.apply(this,c);else if(!Ps(r,c)){let d=t.apply(this,c);(!e||!e(d,i))&&(i=d)}return r=c,i}}function Rd(t,e,n){let r,i;return c=>(r?ta(r,c)||(i=t.call(this,c)):i=t.call(this,c),r=c,i)}const wp={week:3,separator:9,omitZeroMinute:9,meridiem:9,omitCommas:9},Jd={timeZoneName:7,era:6,year:5,month:4,day:2,weekday:2,hour:1,minute:1,second:1},md=/\s*([ap])\.?m\.?/i,WI=/,/g,XI=/\s+/g,ZI=/\u200e/g,KI=/UTC|GMT/;class JI{constructor(e){let n={},r={},i=9;for(let c in e)c in wp?(r[c]=e[c],wp[c]<9&&(i=Math.min(wp[c],i))):(n[c]=e[c],c in Jd&&(i=Math.min(Jd[c],i)));this.standardDateProps=n,this.extendedSettings=r,this.smallestUnitNum=i,this.buildFormattingFunc=we(j1)}format(e,n){return this.buildFormattingFunc(this.standardDateProps,this.extendedSettings,n)(e)}formatRange(e,n,r,i){let{standardDateProps:c,extendedSettings:d}=this,f=r4(e.marker,n.marker,r.calendarSystem);if(!f)return this.format(e,r);let h=f;h>1&&(c.year==="numeric"||c.year==="2-digit")&&(c.month==="numeric"||c.month==="2-digit")&&(c.day==="numeric"||c.day==="2-digit")&&(h=1);let p=this.format(e,r),b=this.format(n,r);if(p===b)return p;let y=l4(c,h),m=j1(y,d,r),v=m(e),N=m(n),S=i4(p,v,b,N),j=d.separator||i||r.defaultSeparator||"";return S?S.before+v+j+N+S.after:p+j+b}getSmallestUnit(){switch(this.smallestUnitNum){case 7:case 6:case 5:return"year";case 4:return"month";case 3:return"week";case 2:return"day";default:return"time"}}}function j1(t,e,n){let r=Object.keys(t).length;return r===1&&t.timeZoneName==="short"?i=>cm(i.timeZoneOffset):r===0&&e.week?i=>s4(n.computeWeekNumber(i.marker),n.weekText,n.weekTextLong,n.locale,e.week):e4(t,e,n)}function e4(t,e,n){t=Object.assign({},t),e=Object.assign({},e),t4(t,e),t.timeZone="UTC";let r=new Intl.DateTimeFormat(n.locale.codes,t),i;if(e.omitZeroMinute){let c=Object.assign({},t);delete c.minute,i=new Intl.DateTimeFormat(n.locale.codes,c)}return c=>{let{marker:d}=c,f;i&&!d.getUTCMinutes()?f=i:f=r;let h=f.format(d);return n4(h,c,t,e,n)}}function t4(t,e){t.timeZoneName&&(t.hour||(t.hour="2-digit"),t.minute||(t.minute="2-digit")),t.timeZoneName==="long"&&(t.timeZoneName="short"),e.omitZeroMinute&&(t.second||t.millisecond)&&delete e.omitZeroMinute}function n4(t,e,n,r,i){return t=t.replace(ZI,""),n.timeZoneName==="short"&&(t=a4(t,i.timeZone==="UTC"||e.timeZoneOffset==null?"UTC":cm(e.timeZoneOffset))),r.omitCommas&&(t=t.replace(WI,"").trim()),r.omitZeroMinute&&(t=t.replace(":00","")),r.meridiem===!1?t=t.replace(md,"").trim():r.meridiem==="narrow"?t=t.replace(md,(c,d)=>d.toLocaleLowerCase()):r.meridiem==="short"?t=t.replace(md,(c,d)=>`${d.toLocaleLowerCase()}m`):r.meridiem==="lowercase"&&(t=t.replace(md,c=>c.toLocaleLowerCase())),t=t.replace(XI," "),t=t.trim(),t}function a4(t,e){let n=!1;return t=t.replace(KI,()=>(n=!0,e)),n||(t+=` ${e}`),t}function s4(t,e,n,r,i){let c=[];return i==="long"?c.push(n):(i==="short"||i==="narrow")&&c.push(e),(i==="long"||i==="short")&&c.push(" "),c.push(r.simpleNumberFormat.format(t)),r.options.direction==="rtl"&&c.reverse(),c.join("")}function r4(t,e,n){return n.getMarkerYear(t)!==n.getMarkerYear(e)?5:n.getMarkerMonth(t)!==n.getMarkerMonth(e)?4:n.getMarkerDay(t)!==n.getMarkerDay(e)?2:Rs(t)!==Rs(e)?1:0}function l4(t,e){let n={};for(let r in t)(!(r in Jd)||Jd[r]<=e)&&(n[r]=t[r]);return n}function i4(t,e,n,r){let i=0;for(;i=0;c-=1){let d=t[c][r];if(typeof d=="object"&&d)i.unshift(d);else if(d!==void 0){n[r]=d;break}}i.length&&(n[r]=um(i))}}for(let r=t.length-1;r>=0;r-=1){let i=t[r];for(let c in i)c in n||(n[c]=i[c])}return n}function Dr(t,e){let n={};for(let r in t)e(t[r],r)&&(n[r]=t[r]);return n}function Ha(t,e){let n={};for(let r in t)n[r]=e(t[r],r);return n}function zS(t){let e={};for(let n of t)e[n]=!0;return e}function fm(t){let e=[];for(let n in t)e.push(t[n]);return e}function ta(t,e){if(t===e)return!0;for(let n in t)if(tu.call(t,n)&&!(n in e))return!1;for(let n in e)if(tu.call(e,n)&&t[n]!==e[n])return!1;return!0}const u4=/^on[A-Z]/;function f4(t,e){const n=h4(t,e);for(let r of n)if(!u4.test(r))return!1;return!0}function h4(t,e){let n=[];for(let r in t)tu.call(t,r)&&(r in e||n.push(r));for(let r in e)tu.call(e,r)&&t[r]!==e[r]&&n.push(r);return n}function Dp(t,e,n={}){if(t===e)return!0;for(let r in e)if(!(r in t&&p4(t[r],e[r],n[r])))return!1;for(let r in t)if(!(r in e))return!1;return!0}function p4(t,e,n){return t===e||n===!0?!0:n?n(t,e):!1}function g4(t,e=0,n,r=1){let i=[];n==null&&(n=Object.keys(t).length);for(let c=e;c{this.props.value!==d.value&&c.forEach(f=>{f.context=d.value,f.forceUpdate()})},this.sub=d=>{c.push(d);let f=d.componentWillUnmount;d.componentWillUnmount=()=>{c.splice(c.indexOf(d),1),f&&f.call(d)}}}return i},e}class S4{constructor(e,n,r,i){this.execFunc=e,this.emitter=n,this.scrollTime=r,this.scrollTimeReset=i,this.handleScrollRequest=c=>{this.queuedRequest=Object.assign({},this.queuedRequest||{},c),this.drain()},n.on("_scrollRequest",this.handleScrollRequest),this.fireInitialScroll()}detach(){this.emitter.off("_scrollRequest",this.handleScrollRequest)}update(e){e&&this.scrollTimeReset?this.fireInitialScroll():this.drain()}fireInitialScroll(){this.handleScrollRequest({time:this.scrollTime})}drain(){this.queuedRequest&&this.execFunc(this.queuedRequest)&&(this.queuedRequest=null)}}const Fa=US({});function j4(t,e,n,r,i,c,d,f,h,p,b,y,m,v){return{dateEnv:i,nowManager:c,options:n,pluginHooks:f,emitter:b,dispatch:h,getCurrentData:p,calendarApi:y,viewSpec:t,viewApi:e,dateProfileGenerator:r,theme:d,isRtl:n.direction==="rtl",addResizeHandler(N){b.on("_resize",N)},removeResizeHandler(N){b.off("_resize",N)},createScrollResponder(N){return new S4(N,b,Ge(n.scrollTime),n.scrollTimeReset)},registerInteractiveComponent:m,unregisterInteractiveComponent:v}}class _r extends wn{shouldComponentUpdate(e,n){return!Dp(this.props,e,this.propEquality)||!Dp(this.state,n,this.stateEquality)}safeSetState(e){Dp(this.state,Object.assign(Object.assign({},this.state),e),this.stateEquality)||this.setState(e)}}_r.addPropsEquality=A4;_r.addStateEquality=w4;_r.contextType=Fa;_r.prototype.propEquality={};_r.prototype.stateEquality={};class Ke extends _r{}Ke.contextType=Fa;function A4(t){let e=Object.create(this.prototype.propEquality);Object.assign(e,t),this.prototype.propEquality=e}function w4(t){let e=Object.create(this.prototype.stateEquality);Object.assign(e,t),this.prototype.stateEquality=e}function fa(t,e){typeof t=="function"?t(e):t&&(t.current=e)}class hm extends Ke{constructor(){super(...arguments),this.id=Tr(),this.queuedDomNodes=[],this.currentDomNodes=[],this.handleEl=e=>{const{options:n}=this.context,{generatorName:r}=this.props;(!n.customRenderingReplaces||!tg(r,n))&&this.updateElRef(e)},this.updateElRef=e=>{this.props.elRef&&fa(this.props.elRef,e)}}render(){const{props:e,context:n}=this,{options:r}=n,{customGenerator:i,defaultGenerator:c,renderProps:d}=e,f=BS(e,[],this.handleEl);let h=!1,p,b=[],y;if(i!=null){const m=typeof i=="function"?i(d,I):i;if(m===!0)h=!0;else{const v=m&&typeof m=="object";v&&"html"in m?f.dangerouslySetInnerHTML={__html:m.html}:v&&"domNodes"in m?b=Array.prototype.slice.call(m.domNodes):(v?dS(m):typeof m!="function")?p=m:y=m}}else h=!tg(e.generatorName,r);return h&&c&&(p=c(d)),this.queuedDomNodes=b,this.currentGeneratorMeta=y,I(e.elTag,f,p)}componentDidMount(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentDidUpdate(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentWillUnmount(){this.triggerCustomRendering(!1)}triggerCustomRendering(e){var n;const{props:r,context:i}=this,{handleCustomRendering:c,customRenderingMetaMap:d}=i.options;if(c){const f=(n=this.currentGeneratorMeta)!==null&&n!==void 0?n:d==null?void 0:d[r.generatorName];f&&c(Object.assign(Object.assign({id:this.id,isActive:e,containerEl:this.base,reportNewContainerEl:this.updateElRef,generatorMeta:f},r),{elClasses:(r.elClasses||[]).filter(C4)}))}}applyQueueudDomNodes(){const{queuedDomNodes:e,currentDomNodes:n}=this,r=this.base;if(!Ps(e,n)){n.forEach(sm);for(let i of e)r.appendChild(i);this.currentDomNodes=e}}}hm.addPropsEquality({elClasses:Ps,elStyle:ta,elAttrs:f4,renderProps:ta});function tg(t,e){var n;return!!(e.handleCustomRendering&&t&&(!((n=e.customRenderingMetaMap)===null||n===void 0)&&n[t]))}function BS(t,e,n){const r=Object.assign(Object.assign({},t.elAttrs),{ref:n});return(t.elClasses||e)&&(r.className=(t.elClasses||[]).concat(e||[]).concat(r.className||[]).filter(Boolean).join(" ")),t.elStyle&&(r.style=t.elStyle),r}function C4(t){return!!t}const HS=US(0);class On extends wn{constructor(){super(...arguments),this.InnerContent=D4.bind(void 0,this),this.handleEl=e=>{this.el=e,this.props.elRef&&(fa(this.props.elRef,e),e&&this.didMountMisfire&&this.componentDidMount())}}render(){const{props:e}=this,n=O4(e.classNameGenerator,e.renderProps);if(e.children){const r=BS(e,n,this.handleEl),i=e.children(this.InnerContent,e.renderProps,r);return e.elTag?I(e.elTag,r,i):i}else return I(hm,Object.assign(Object.assign({},e),{elRef:this.handleEl,elTag:e.elTag||"div",elClasses:(e.elClasses||[]).concat(n),renderId:this.context}))}componentDidMount(){var e,n;this.el?(n=(e=this.props).didMount)===null||n===void 0||n.call(e,Object.assign(Object.assign({},this.props.renderProps),{el:this.el})):this.didMountMisfire=!0}componentWillUnmount(){var e,n;(n=(e=this.props).willUnmount)===null||n===void 0||n.call(e,Object.assign(Object.assign({},this.props.renderProps),{el:this.el}))}}On.contextType=HS;function D4(t,e){const n=t.props;return I(hm,Object.assign({renderProps:n.renderProps,generatorName:n.generatorName,customGenerator:n.customGenerator,defaultGenerator:n.defaultGenerator,renderId:t.context},e))}function O4(t,e){const n=typeof t=="function"?t(e):t||[];return typeof n=="string"?[n]:n}class au extends Ke{render(){let{props:e,context:n}=this,{options:r}=n,i={view:n.viewApi};return I(On,{elRef:e.elRef,elTag:e.elTag||"div",elAttrs:e.elAttrs,elClasses:[...GS(e.viewSpec),...e.elClasses||[]],elStyle:e.elStyle,renderProps:i,classNameGenerator:r.viewClassNames,generatorName:void 0,didMount:r.viewDidMount,willUnmount:r.viewWillUnmount},()=>e.children)}}function GS(t){return[`fc-${t.type}-view`,"fc-view"]}function R4(t,e){let n=null,r=null;return t.start&&(n=e.createMarker(t.start)),t.end&&(r=e.createMarker(t.end)),!n&&!r||n&&r&&rr&&n.push({start:r,end:c.start}),c.end>r&&(r=c.end);return re.start)&&(t.start===null||e.end===null||t.start=t.start)&&(t.end===null||e.end!==null&&e.end<=t.end)}function Pa(t,e){return(t.start===null||e>=t.start)&&(t.end===null||e=e.end?new Date(e.end.valueOf()-1):t}function VS(t){let e=Math.floor(kr(t.start,t.end))||1,n=it(t.start),r=_t(n,e);return{start:n,end:r}}function FS(t,e=Ge(0)){let n=null,r=null;if(t.end){r=it(t.end);let i=t.end.valueOf()-r.valueOf();i&&i>=ea(e)&&(r=_t(r,1))}return t.start&&(n=it(t.start),r&&r<=n&&(r=_t(n,1))),{start:n,end:r}}function vl(t,e,n,r){return r==="year"?Ge(n.diffWholeYears(t,e),"year"):r==="month"?Ge(n.diffWholeMonths(t,e),"month"):BI(t,e)}class qS{constructor(e){this.props=e,this.initHiddenDays()}buildPrev(e,n,r){let{dateEnv:i}=this.props,c=i.subtract(i.startOf(n,e.currentRangeUnit),e.dateIncrement);return this.build(c,-1,r)}buildNext(e,n,r){let{dateEnv:i}=this.props,c=i.add(i.startOf(n,e.currentRangeUnit),e.dateIncrement);return this.build(c,1,r)}build(e,n,r=!0){let{props:i}=this,c,d,f,h,p,b;return c=this.buildValidRange(),c=this.trimHiddenDays(c),r&&(e=_4(e,c)),d=this.buildCurrentRangeInfo(e,n),f=/^(year|month|week|day)$/.test(d.unit),h=this.buildRenderRange(this.trimHiddenDays(d.range),d.unit,f),h=this.trimHiddenDays(h),p=h,i.showNonCurrentDates||(p=Or(p,d.range)),p=this.adjustActiveRange(p),p=Or(p,c),b=pm(d.range,c),Pa(h,e)||(e=h.start),{currentDate:e,validRange:c,currentRange:d.range,currentRangeUnit:d.unit,isRangeAllDay:f,activeRange:p,renderRange:h,slotMinTime:i.slotMinTime,slotMaxTime:i.slotMaxTime,isValid:b,dateIncrement:this.buildDateIncrement(d.duration)}}buildValidRange(){let e=this.props.validRangeInput,n=typeof e=="function"?e.call(this.props.calendarApi,this.props.dateEnv.toDate(this.props.nowManager.getDateMarker())):e;return this.refineRange(n)||{start:null,end:null}}buildCurrentRangeInfo(e,n){let{props:r}=this,i=null,c=null,d=null,f;return r.duration?(i=r.duration,c=r.durationUnit,d=this.buildRangeFromDuration(e,n,i,c)):(f=this.props.dayCount)?(c="day",d=this.buildRangeFromDayCount(e,n,f)):(d=this.buildCustomVisibleRange(e))?c=r.dateEnv.greatestWholeUnit(d.start,d.end).unit:(i=this.getFallbackDuration(),c=eg(i).unit,d=this.buildRangeFromDuration(e,n,i,c)),{duration:i,unit:c,range:d}}getFallbackDuration(){return Ge({day:1})}adjustActiveRange(e){let{dateEnv:n,usesMinMaxTime:r,slotMinTime:i,slotMaxTime:c}=this.props,{start:d,end:f}=e;return r&&(El(i)<0&&(d=it(d),d=n.add(d,i)),El(c)>1&&(f=it(f),f=_t(f,-1),f=n.add(f,c))),{start:d,end:f}}buildRangeFromDuration(e,n,r,i){let{dateEnv:c,dateAlignment:d}=this.props,f,h,p;if(!d){let{dateIncrement:y}=this.props;y&&ea(y)!d[h.defId].recurringDef);for(let h in d){let p=d[h];if(p.recurringDef){let{duration:b}=p.recurringDef;b||(b=p.allDay?c.defaultAllDayEventDuration:c.defaultTimedEventDuration);let y=I4(p,b,e,r,i.recurringTypes);for(let m of y){let v=gm(h,{start:m,end:r.add(m,b)});f[v.instanceId]=v}}}return{defs:d,instances:f}}function I4(t,e,n,r,i){let d=i[t.recurringDef.typeId].expand(t.recurringDef.typeData,{start:r.subtract(n.start,e),end:n.end},r);return t.allDay&&(d=d.map(it)),d}const Td={id:String,groupId:String,title:String,url:String,interactive:Boolean},$S={start:Z,end:Z,date:Z,allDay:Boolean},L4=Object.assign(Object.assign(Object.assign({},Td),$S),{extendedProps:Z});function YS(t,e,n,r,i=mm(n),c,d){let{refined:f,extra:h}=QS(t,n,i),p=P4(e,n),b=M4(f,p,n.dateEnv,n.pluginHooks.recurringTypes);if(b){let m=ng(f,h,e?e.sourceId:"",b.allDay,!!b.duration,n,c);return m.recurringDef={typeId:b.typeId,typeData:b.typeData,duration:b.duration},{def:m,instance:null}}let y=z4(f,p,n,r);if(y){let m=ng(f,h,e?e.sourceId:"",y.allDay,y.hasEnd,n,c),v=gm(m.defId,y.range,y.forcedStartTzo,y.forcedEndTzo);return d&&m.publicId&&d[m.publicId]&&(v.instanceId=d[m.publicId]),{def:m,instance:v}}return null}function QS(t,e,n=mm(e)){return dm(t,n)}function mm(t){return Object.assign(Object.assign(Object.assign({},su),L4),t.pluginHooks.eventRefiners)}function ng(t,e,n,r,i,c,d){let f={title:t.title||"",groupId:t.groupId||"",publicId:t.id||"",url:t.url||"",recurringDef:null,defId:(d&&t.id?d[t.id]:"")||Tr(),sourceId:n,allDay:r,hasEnd:i,interactive:t.interactive,ui:ru(t,c),extendedProps:Object.assign(Object.assign({},t.extendedProps||{}),e)};for(let h of c.pluginHooks.eventDefMemberAdders)Object.assign(f,h(t));return Object.freeze(f.ui.classNames),Object.freeze(f.extendedProps),f}function z4(t,e,n,r){let{allDay:i}=t,c,d=null,f=!1,h,p=null,b=t.start!=null?t.start:t.date;if(c=n.dateEnv.createMarkerMeta(b),c)d=c.marker;else if(!r)return null;return t.end!=null&&(h=n.dateEnv.createMarkerMeta(t.end)),i==null&&(e!=null?i=e:i=(!c||c.isTimeUnspecified)&&(!h||h.isTimeUnspecified)),i&&d&&(d=it(d)),h&&(p=h.marker,i&&(p=it(p)),d&&p<=d&&(p=null)),p?f=!0:r||(f=n.options.forceEventDuration||!1,p=n.dateEnv.add(d,i?n.options.defaultAllDayEventDuration:n.options.defaultTimedEventDuration)),{allDay:i,hasEnd:f,range:{start:d,end:p},forcedStartTzo:c?c.forcedTzo:null,forcedEndTzo:h?h.forcedTzo:null}}function P4(t,e){let n=null;return t&&(n=t.defaultAllDay),n==null&&(n=e.options.defaultAllDay),n}function Eo(t,e,n,r,i,c){let d=Cn(),f=mm(n);for(let h of t){let p=YS(h,e,n,r,f,i,c);p&&ag(p,d)}return d}function ag(t,e=Cn()){return e.defs[t.def.defId]=t.def,t.instance&&(e.instances[t.instance.instanceId]=t.instance),e}function xm(t,e){let n=t.instances[e];if(n){let r=t.defs[n.defId],i=Ou(t,c=>U4(r,c));return i.defs[r.defId]=r,i.instances[n.instanceId]=n,i}return Cn()}function U4(t,e){return!!(t.groupId&&t.groupId===e.groupId)}function Cn(){return{defs:{},instances:{}}}function bm(t,e){return{defs:Object.assign(Object.assign({},t.defs),e.defs),instances:Object.assign(Object.assign({},t.instances),e.instances)}}function Ou(t,e){let n=Dr(t.defs,e),r=Dr(t.instances,i=>n[i.defId]);return{defs:n,instances:r}}function B4(t,e){let{defs:n,instances:r}=t,i={},c={};for(let d in n)e.defs[d]||(i[d]=n[d]);for(let d in r)!e.instances[d]&&i[r[d].defId]&&(c[d]=r[d]);return{defs:i,instances:c}}function H4(t,e){return Array.isArray(t)?Eo(t,null,e,!0):typeof t=="object"&&t?Eo([t],null,e,!0):t!=null?String(t):null}function R1(t){return Array.isArray(t)?t:typeof t=="string"?t.split(/\s+/):[]}const su={display:String,editable:Boolean,startEditable:Boolean,durationEditable:Boolean,constraint:Z,overlap:Z,allow:Z,className:R1,classNames:R1,color:String,backgroundColor:String,borderColor:String,textColor:String},G4={display:null,startEditable:null,durationEditable:null,constraints:[],overlap:null,allows:[],backgroundColor:"",borderColor:"",textColor:"",classNames:[]};function ru(t,e){let n=H4(t.constraint,e);return{display:t.display||null,startEditable:t.startEditable!=null?t.startEditable:t.editable,durationEditable:t.durationEditable!=null?t.durationEditable:t.editable,constraints:n!=null?[n]:[],overlap:t.overlap!=null?t.overlap:null,allows:t.allow!=null?[t.allow]:[],backgroundColor:t.backgroundColor||t.color||"",borderColor:t.borderColor||t.color||"",textColor:t.textColor||"",classNames:(t.className||[]).concat(t.classNames||[])}}function WS(t){return t.reduce(V4,G4)}function V4(t,e){return{display:e.display!=null?e.display:t.display,startEditable:e.startEditable!=null?e.startEditable:t.startEditable,durationEditable:e.durationEditable!=null?e.durationEditable:t.durationEditable,constraints:t.constraints.concat(e.constraints),overlap:typeof e.overlap=="boolean"?e.overlap:t.overlap,allows:t.allows.concat(e.allows),backgroundColor:e.backgroundColor||t.backgroundColor,borderColor:e.borderColor||t.borderColor,textColor:e.textColor||t.textColor,classNames:t.classNames.concat(e.classNames)}}const F4={id:String,defaultAllDay:Boolean,url:String,format:String,events:Z,eventDataTransform:Z,success:Z,failure:Z};function XS(t,e,n=ZS(e)){let r;if(typeof t=="string"?r={url:t}:typeof t=="function"||Array.isArray(t)?r={events:t}:typeof t=="object"&&t&&(r=t),r){let{refined:i,extra:c}=dm(r,n),d=q4(i,e);if(d)return{_raw:t,isFetching:!1,latestFetchId:"",fetchRange:null,defaultAllDay:i.defaultAllDay,eventDataTransform:i.eventDataTransform,success:i.success,failure:i.failure,publicId:i.id||"",sourceId:Tr(),sourceDefId:d.sourceDefId,meta:d.meta,ui:ru(i,e),extendedProps:c}}return null}function ZS(t){return Object.assign(Object.assign(Object.assign({},su),F4),t.pluginHooks.eventSourceRefiners)}function q4(t,e){let n=e.pluginHooks.eventSourceDefs;for(let r=n.length-1;r>=0;r-=1){let c=n[r].parseMeta(t);if(c)return{sourceDefId:r,meta:c}}return null}function $4(t,e,n,r,i){switch(e.type){case"RECEIVE_EVENTS":return Y4(t,n[e.sourceId],e.fetchId,e.fetchRange,e.rawEvents,i);case"RESET_RAW_EVENTS":return Q4(t,n[e.sourceId],e.rawEvents,r.activeRange,i);case"ADD_EVENTS":return W4(t,e.eventStore,r?r.activeRange:null,i);case"RESET_EVENTS":return e.eventStore;case"MERGE_EVENTS":return bm(t,e.eventStore);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return r?Rr(t,r.activeRange,i):t;case"REMOVE_EVENTS":return B4(t,e.eventStore);case"REMOVE_EVENT_SOURCE":return JS(t,e.sourceId);case"REMOVE_ALL_EVENT_SOURCES":return Ou(t,c=>!c.sourceId);case"REMOVE_ALL_EVENTS":return Cn();default:return t}}function Y4(t,e,n,r,i,c){if(e&&n===e.latestFetchId){let d=Eo(KS(i,e,c),e,c);return r&&(d=Rr(d,r,c)),bm(JS(t,e.sourceId),d)}return t}function Q4(t,e,n,r,i){const{defIdMap:c,instanceIdMap:d}=Z4(t);let f=Eo(KS(n,e,i),e,i,!1,c,d);return Rr(f,r,i)}function KS(t,e,n){let r=n.options.eventDataTransform,i=e?e.eventDataTransform:null;return i&&(t=T1(t,i)),r&&(t=T1(t,r)),t}function T1(t,e){let n;if(!e)n=t;else{n=[];for(let r of t){let i=e(r);i?n.push(i):i==null&&n.push(r)}}return n}function W4(t,e,n,r){return n&&(e=Rr(e,n,r)),bm(t,e)}function k1(t,e,n){let{defs:r}=t,i=Ha(t.instances,c=>r[c.defId].allDay?c:Object.assign(Object.assign({},c),{range:{start:n.createMarker(e.toDate(c.range.start,c.forcedStartTzo)),end:n.createMarker(e.toDate(c.range.end,c.forcedEndTzo))},forcedStartTzo:n.canComputeOffset?null:c.forcedStartTzo,forcedEndTzo:n.canComputeOffset?null:c.forcedEndTzo}));return{defs:r,instances:i}}function JS(t,e){return Ou(t,n=>n.sourceId!==e)}function X4(t,e){return{defs:t.defs,instances:Dr(t.instances,n=>!e[n.instanceId])}}function Z4(t){const{defs:e,instances:n}=t,r={},i={};for(let c in e){const d=e[c],{publicId:f}=d;f&&(r[f]=c)}for(let c in n){const d=n[c],f=e[d.defId],{publicId:h}=f;h&&(i[h]=c)}return{defIdMap:r,instanceIdMap:i}}class Ru{constructor(){this.handlers={},this.thisContext=null}setThisContext(e){this.thisContext=e}setOptions(e){this.options=e}on(e,n){K4(this.handlers,e,n)}off(e,n){J4(this.handlers,e,n)}trigger(e,...n){let r=this.handlers[e]||[],i=this.options&&this.options[e],c=[].concat(i||[],r);for(let d of c)d.apply(this.thisContext,n)}hasHandlers(e){return!!(this.handlers[e]&&this.handlers[e].length||this.options&&this.options[e])}}function K4(t,e,n){(t[e]||(t[e]=[])).push(n)}function J4(t,e,n){n?t[e]&&(t[e]=t[e].filter(r=>r!==n)):delete t[e]}const e3={startTime:"09:00",endTime:"17:00",daysOfWeek:[1,2,3,4,5],display:"inverse-background",classNames:"fc-non-business",groupId:"_businessHours"};function t3(t,e){return Eo(n3(t),null,e)}function n3(t){let e;return t===!0?e=[{}]:Array.isArray(t)?e=t.filter(n=>n.daysOfWeek):typeof t=="object"&&t?e=[t]:e=[],e=e.map(n=>Object.assign(Object.assign({},e3),n)),e}function ej(t,e,n){n.emitter.trigger("select",Object.assign(Object.assign({},ym(t,n)),{jsEvent:e?e.origEvent:null,view:n.viewApi||n.calendarApi.view}))}function a3(t,e){e.emitter.trigger("unselect",{jsEvent:t?t.origEvent:null,view:e.viewApi||e.calendarApi.view})}function ym(t,e){let n={};for(let r of e.pluginHooks.dateSpanTransforms)Object.assign(n,r(t,e));return Object.assign(n,x3(t,e.dateEnv)),n}function _1(t,e,n){let{dateEnv:r,options:i}=n,c=e;return t?(c=it(c),c=r.add(c,i.defaultAllDayEventDuration)):c=r.add(c,i.defaultTimedEventDuration),c}function vm(t,e,n,r){let i=lu(t.defs,e),c=Cn();for(let d in t.defs){let f=t.defs[d];c.defs[d]=s3(f,i[d],n,r)}for(let d in t.instances){let f=t.instances[d],h=c.defs[f.defId];c.instances[d]=r3(f,h,i[f.defId],n,r)}return c}function s3(t,e,n,r){let i=n.standardProps||{};i.hasEnd==null&&e.durationEditable&&(n.startDelta||n.endDelta)&&(i.hasEnd=!0);let c=Object.assign(Object.assign(Object.assign({},t),i),{ui:Object.assign(Object.assign({},t.ui),i.ui)});n.extendedProps&&(c.extendedProps=Object.assign(Object.assign({},c.extendedProps),n.extendedProps));for(let d of r.pluginHooks.eventDefMutationAppliers)d(c,n,r);return!c.hasEnd&&r.options.forceEventDuration&&(c.hasEnd=!0),c}function r3(t,e,n,r,i){let{dateEnv:c}=i,d=r.standardProps&&r.standardProps.allDay===!0,f=r.standardProps&&r.standardProps.hasEnd===!1,h=Object.assign({},t);return d&&(h.range=VS(h.range)),r.datesDelta&&n.startEditable&&(h.range={start:c.add(h.range.start,r.datesDelta),end:c.add(h.range.end,r.datesDelta)}),r.startDelta&&n.durationEditable&&(h.range={start:c.add(h.range.start,r.startDelta),end:h.range.end}),r.endDelta&&n.durationEditable&&(h.range={start:h.range.start,end:c.add(h.range.end,r.endDelta)}),f&&(h.range={start:h.range.start,end:_1(e.allDay,h.range.start,i)}),e.allDay&&(h.range={start:it(h.range.start),end:it(h.range.end)}),h.range.endnj(n,e))}function nj(t,e){let n=[];return e[""]&&n.push(e[""]),e[t.defId]&&n.push(e[t.defId]),n.push(t.ui),WS(n)}function aj(t,e){let n=t.map(i3);return n.sort((r,i)=>SI(r,i,e)),n.map(r=>r._seg)}function i3(t){let{eventRange:e}=t,n=e.def,r=e.instance?e.instance.range:e.range,i=r.start?r.start.valueOf():0,c=r.end?r.end.valueOf():0;return Object.assign(Object.assign(Object.assign({},n.extendedProps),n),{id:n.publicId,start:i,end:c,duration:c-i,allDay:Number(n.allDay),_seg:t})}function o3(t,e){let{pluginHooks:n}=e,r=n.isDraggableTransformers,{def:i,ui:c}=t.eventRange,d=c.startEditable;for(let f of r)d=f(d,i,c,e);return d}function c3(t,e){return t.isStart&&t.eventRange.ui.durationEditable&&e.options.eventResizableFromStart}function d3(t,e){return t.isEnd&&t.eventRange.ui.durationEditable}function sj(t,e,n,r,i,c,d){let{dateEnv:f,options:h}=n,{displayEventTime:p,displayEventEnd:b}=h,y=t.eventRange.def,m=t.eventRange.instance;p==null&&(p=r!==!1),b==null&&(b=i!==!1);let v=m.range.start,N=m.range.end,S=t.start||t.eventRange.range.start,j=t.end||t.eventRange.range.end,R=it(v).valueOf()===it(S).valueOf(),C=it(Us(N,-1)).valueOf()===it(Us(j,-1)).valueOf();return p&&!y.allDay&&(R||C)?(S=R?v:S,j=C?N:j,b&&y.hasEnd?f.formatRange(S,j,e,{forcedStartTzo:m.forcedStartTzo,forcedEndTzo:m.forcedEndTzo}):f.format(S,e,{forcedTzo:m.forcedStartTzo})):""}function Ms(t,e,n){let r=t.eventRange.range;return{isPast:r.end<=(n||e.start),isFuture:r.start>=(n||e.end),isToday:e&&Pa(e,r.start)}}function u3(t){let e=["fc-event"];return t.isMirror&&e.push("fc-event-mirror"),t.isDraggable&&e.push("fc-event-draggable"),(t.isStartResizable||t.isEndResizable)&&e.push("fc-event-resizable"),t.isDragging&&e.push("fc-event-dragging"),t.isResizing&&e.push("fc-event-resizing"),t.isSelected&&e.push("fc-event-selected"),t.isStart&&e.push("fc-event-start"),t.isEnd&&e.push("fc-event-end"),t.isPast&&e.push("fc-event-past"),t.isToday&&e.push("fc-event-today"),t.isFuture&&e.push("fc-event-future"),e}function rj(t){return t.instance?t.instance.instanceId:`${t.def.defId}:${t.range.start.toISOString()}`}function lj(t,e){let{def:n,instance:r}=t.eventRange,{url:i}=n;if(i)return{href:i};let{emitter:c,options:d}=e,{eventInteractive:f}=d;return f==null&&(f=n.interactive,f==null&&(f=!!c.hasHandlers("eventClick"))),f?MS(h=>{c.trigger("eventClick",{el:h.target,event:new ut(e,n,r),jsEvent:h,view:e.viewApi})}):{}}const f3={start:Z,end:Z,allDay:Boolean};function h3(t,e,n){let r=p3(t,e),{range:i}=r;if(!i.start)return null;if(!i.end){if(n==null)return null;i.end=e.add(i.start,n)}return r}function p3(t,e){let{refined:n,extra:r}=dm(t,f3),i=n.start?e.createMarkerMeta(n.start):null,c=n.end?e.createMarkerMeta(n.end):null,{allDay:d}=n;return d==null&&(d=i&&i.isTimeUnspecified&&(!c||c.isTimeUnspecified)),Object.assign({range:{start:i?i.marker:null,end:c?c.marker:null},allDay:d},r)}function g3(t,e){return k4(t.range,e.range)&&t.allDay===e.allDay&&m3(t,e)}function m3(t,e){for(let n in e)if(n!=="range"&&n!=="allDay"&&t[n]!==e[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}function x3(t,e){return Object.assign(Object.assign({},oj(t.range,e,t.allDay)),{allDay:t.allDay})}function ij(t,e,n){return Object.assign(Object.assign({},oj(t,e,n)),{timeZone:e.timeZone})}function oj(t,e,n){return{start:e.toDate(t.start),end:e.toDate(t.end),startStr:e.formatIso(t.start,{omitTime:n}),endStr:e.formatIso(t.end,{omitTime:n})}}function b3(t,e,n){let r=QS({editable:!1},n),i=ng(r.refined,r.extra,"",t.allDay,!0,n);return{def:i,ui:nj(i,e),instance:gm(i.defId,t.range),range:t.range,isStart:!0,isEnd:!0}}function y3(t,e,n){let r=!1,i=function(f){r||(r=!0,e(f))},c=function(f){r||(r=!0,n(f))},d=t(i,c);d&&typeof d.then=="function"&&d.then(i,c)}class L1 extends Error{constructor(e,n){super(e),this.response=n}}function v3(t,e,n){t=t.toUpperCase();const r={method:t};return t==="GET"?e+=(e.indexOf("?")===-1?"?":"&")+new URLSearchParams(n):(r.body=new URLSearchParams(n),r.headers={"Content-Type":"application/x-www-form-urlencoded"}),fetch(e,r).then(i=>{if(i.ok)return i.json().then(c=>[c,i],()=>{throw new L1("Failure parsing JSON",i)});throw new L1("Request failed",i)})}let Op;function cj(){return Op==null&&(Op=N3()),Op}function N3(){if(typeof document>"u")return!0;let t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.innerHTML="
",t.querySelector("table").style.height="100px",t.querySelector("div").style.height="100%",document.body.appendChild(t);let n=t.querySelector("div").offsetHeight>0;return document.body.removeChild(t),n}class E3 extends Ke{constructor(){super(...arguments),this.state={forPrint:!1},this.handleBeforePrint=()=>{nu(()=>{this.setState({forPrint:!0})})},this.handleAfterPrint=()=>{nu(()=>{this.setState({forPrint:!1})})}}render(){let{props:e}=this,{options:n}=e,{forPrint:r}=this.state,i=r||n.height==="auto"||n.contentHeight==="auto",c=!i&&n.height!=null?n.height:"",d=["fc",r?"fc-media-print":"fc-media-screen",`fc-direction-${n.direction}`,e.theme.getClass("root")];return cj()||d.push("fc-liquid-hack"),e.children(d,c,i,r)}componentDidMount(){let{emitter:e}=this.props;e.on("_beforeprint",this.handleBeforePrint),e.on("_afterprint",this.handleAfterPrint)}componentWillUnmount(){let{emitter:e}=this.props;e.off("_beforeprint",this.handleBeforePrint),e.off("_afterprint",this.handleAfterPrint)}}class Jl{constructor(e){this.component=e.component,this.isHitComboAllowed=e.isHitComboAllowed||null}destroy(){}}function S3(t,e){return{component:t,el:e.el,useEventCenter:e.useEventCenter!=null?e.useEventCenter:!0,isHitComboAllowed:e.isHitComboAllowed||null}}function Nm(t){return{[t.component.uid]:t}}const sg={};class ei extends wn{constructor(e,n){super(e,n),this.handleRefresh=()=>{let r=this.computeTiming();r.state.nowDate.valueOf()!==this.state.nowDate.valueOf()&&this.setState(r.state),this.clearTimeout(),this.setTimeout(r.waitMs)},this.handleVisibilityChange=()=>{document.hidden||this.handleRefresh()},this.state=this.computeTiming().state}render(){let{props:e,state:n}=this;return e.children(n.nowDate,n.todayRange)}componentDidMount(){this.setTimeout(),this.context.nowManager.addResetListener(this.handleRefresh),document.addEventListener("visibilitychange",this.handleVisibilityChange)}componentDidUpdate(e){e.unit!==this.props.unit&&(this.clearTimeout(),this.setTimeout())}componentWillUnmount(){this.clearTimeout(),this.context.nowManager.removeResetListener(this.handleRefresh),document.removeEventListener("visibilitychange",this.handleVisibilityChange)}computeTiming(){let{props:e,context:n}=this,r=n.nowManager.getDateMarker(),{nowIndicatorSnap:i}=n.options;i==="auto"&&(i=/year|month|week|day/.test(e.unit)||(e.unitValue||1)===1);let c,d;return i?(c=n.dateEnv.startOf(r,e.unit),d=n.dateEnv.add(c,Ge(1,e.unit)).valueOf()-r.valueOf()):(c=r,d=1e3*60),d=Math.min(1e3*60*60*24,d),{state:{nowDate:c,todayRange:j3(c)},waitMs:d}}setTimeout(e=this.computeTiming().waitMs){this.timeoutId=setTimeout(()=>{const n=this.computeTiming();this.setState(n.state,()=>{this.setTimeout(n.waitMs)})},e)}clearTimeout(){this.timeoutId&&clearTimeout(this.timeoutId)}}ei.contextType=Fa;function j3(t){let e=it(t),n=_t(e,1);return{start:e,end:n}}class A3{getCurrentData(){return this.currentDataManager.getCurrentData()}dispatch(e){this.currentDataManager.dispatch(e)}get view(){return this.getCurrentData().viewApi}batchRendering(e){e()}updateSize(){this.trigger("_resize",!0)}setOption(e,n){this.dispatch({type:"SET_OPTION",optionName:e,rawOptionValue:n})}getOption(e){return this.currentDataManager.currentCalendarOptionsInput[e]}getAvailableLocaleCodes(){return Object.keys(this.getCurrentData().availableRawLocales)}on(e,n){let{currentDataManager:r}=this;r.currentCalendarOptionsRefiners[e]?r.emitter.on(e,n):console.warn(`Unknown listener name '${e}'`)}off(e,n){this.currentDataManager.emitter.off(e,n)}trigger(e,...n){this.currentDataManager.emitter.trigger(e,...n)}changeView(e,n){this.batchRendering(()=>{if(this.unselect(),n)if(n.start&&n.end)this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e}),this.dispatch({type:"SET_OPTION",optionName:"visibleRange",rawOptionValue:n});else{let{dateEnv:r}=this.getCurrentData();this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e,dateMarker:r.createMarker(n)})}else this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e})})}zoomTo(e,n){let r=this.getCurrentData(),i;n=n||"day",i=r.viewSpecs[n]||this.getUnitViewSpec(n),this.unselect(),i?this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:i.type,dateMarker:e}):this.dispatch({type:"CHANGE_DATE",dateMarker:e})}getUnitViewSpec(e){let{viewSpecs:n,toolbarConfig:r}=this.getCurrentData(),i=[].concat(r.header?r.header.viewsWithButtons:[],r.footer?r.footer.viewsWithButtons:[]),c,d;for(let f in n)i.push(f);for(c=0;c{this.dispatch({type:"REMOVE_EVENTS",eventStore:tj(e)})}})}getEventById(e){let n=this.getCurrentData(),{defs:r,instances:i}=n.eventStore;e=String(e);for(let c in r){let d=r[c];if(d.publicId===e){if(d.recurringDef)return new ut(n,d,null);for(let f in i){let h=i[f];if(h.defId===d.defId)return new ut(n,d,h)}}}return null}getEvents(){let e=this.getCurrentData();return jr(e.eventStore,e)}removeAllEvents(){this.dispatch({type:"REMOVE_ALL_EVENTS"})}getEventSources(){let e=this.getCurrentData(),n=e.eventSources,r=[];for(let i in n)r.push(new yl(e,n[i]));return r}getEventSourceById(e){let n=this.getCurrentData(),r=n.eventSources;e=String(e);for(let i in r)if(r[i].publicId===e)return new yl(n,r[i]);return null}addEventSource(e){let n=this.getCurrentData();if(e instanceof yl)return n.eventSources[e.internalEventSource.sourceId]||this.dispatch({type:"ADD_EVENT_SOURCES",sources:[e.internalEventSource]}),e;let r=XS(e,n);return r?(this.dispatch({type:"ADD_EVENT_SOURCES",sources:[r]}),new yl(n,r)):null}removeAllEventSources(){this.dispatch({type:"REMOVE_ALL_EVENT_SOURCES"})}refetchEvents(){this.dispatch({type:"FETCH_EVENT_SOURCES",isRefetch:!0})}scrollToTime(e){let n=Ge(e);n&&this.trigger("_scrollRequest",{time:n})}}function w3(t,e){return t.left>=e.left&&t.left=e.top&&t.topthis.eventUiBuilders[y]||we(T3));for(let b in n){let y=n[b],m=d[b]||Rp,v=this.eventUiBuilders[b];p[b]={businessHours:y.businessHours||e.businessHours,dateSelection:i[b]||null,eventStore:m,eventUiBases:v(e.eventUiBases[""],y.ui,c[b]),eventSelection:m.instances[e.eventSelection]?e.eventSelection:"",eventDrag:f[b]||null,eventResize:h[b]||null}}return p}_splitDateSpan(e){let n={};if(e){let r=this.getKeysForDateSpan(e);for(let i of r)n[i]=e}return n}_getKeysForEventDefs(e){return Ha(e.defs,n=>this.getKeysForEventDef(n))}_splitEventStore(e,n){let{defs:r,instances:i}=e,c={};for(let d in r)for(let f of n[d])c[f]||(c[f]=Cn()),c[f].defs[d]=r[d];for(let d in i){let f=i[d];for(let h of n[f.defId])c[h]&&(c[h].instances[d]=f)}return c}_splitIndividualUi(e,n){let r={};for(let i in e)if(i)for(let c of n[i])r[c]||(r[c]={}),r[c][i]=e[i];return r}_splitInteraction(e){let n={};if(e){let r=this._splitEventStore(e.affectedEvents,this._getKeysForEventDefs(e.affectedEvents)),i=this._getKeysForEventDefs(e.mutatedEvents),c=this._splitEventStore(e.mutatedEvents,i),d=f=>{n[f]||(n[f]={affectedEvents:r[f]||Rp,mutatedEvents:c[f]||Rp,isEvent:e.isEvent})};for(let f in r)d(f);for(let f in c)d(f)}return n}}function T3(t,e,n){let r=[];t&&r.push(t),e&&r.push(e);let i={"":WS(r)};return n&&Object.assign(i,n),i}function uj(t,e,n,r){return{dow:t.getUTCDay(),isDisabled:!!(r&&(!r.activeRange||!Pa(r.activeRange,t))),isOther:!!(r&&!Pa(r.currentRange,t)),isToday:!!(e&&Pa(e,t)),isPast:!!(e&&t=e.end)}}function Em(t,e){let n=["fc-day",`fc-day-${II[t.dow]}`];return t.isDisabled?n.push("fc-day-disabled"):(t.isToday&&(n.push("fc-day-today"),n.push(e.getClass("today"))),t.isPast&&n.push("fc-day-past"),t.isFuture&&n.push("fc-day-future"),t.isOther&&n.push("fc-day-other")),n}const k3=ht({year:"numeric",month:"long",day:"numeric"}),_3=ht({week:"long"});function iu(t,e,n="day",r=!0){const{dateEnv:i,options:c,calendarApi:d}=t;let f=i.format(e,n==="week"?_3:k3);if(c.navLinks){let h=i.toDate(e);const p=b=>{let y=n==="day"?c.navLinkDayClick:n==="week"?c.navLinkWeekClick:null;typeof y=="function"?y.call(d,i.toDate(e),b):(typeof y=="string"&&(n=y),d.zoomTo(e,n))};return Object.assign({title:oo(c.navLinkHint,[f,h],f),"data-navlink":""},r?_S(p):{onClick:p})}return{"aria-label":f}}let Tp=null;function M3(){return Tp===null&&(Tp=I3()),Tp}function I3(){let t=document.createElement("div");io(t,{position:"absolute",top:-1e3,left:0,border:0,padding:0,overflow:"scroll",direction:"rtl"}),t.innerHTML="
",document.body.appendChild(t);let n=t.firstChild.getBoundingClientRect().left>t.getBoundingClientRect().left;return sm(t),n}let kp;function L3(){return kp||(kp=z3()),kp}function z3(){let t=document.createElement("div");t.style.overflow="scroll",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",document.body.appendChild(t);let e=fj(t);return document.body.removeChild(t),e}function fj(t){return{x:t.offsetHeight-t.clientHeight,y:t.offsetWidth-t.clientWidth}}function P3(t,e=!1){let n=window.getComputedStyle(t),r=parseInt(n.borderLeftWidth,10)||0,i=parseInt(n.borderRightWidth,10)||0,c=parseInt(n.borderTopWidth,10)||0,d=parseInt(n.borderBottomWidth,10)||0,f=fj(t),h=f.y-r-i,p=f.x-c-d,b={borderLeft:r,borderRight:i,borderTop:c,borderBottom:d,scrollbarBottom:p,scrollbarLeft:0,scrollbarRight:0};return M3()&&n.direction==="rtl"?b.scrollbarLeft=h:b.scrollbarRight=h,e&&(b.paddingLeft=parseInt(n.paddingLeft,10)||0,b.paddingRight=parseInt(n.paddingRight,10)||0,b.paddingTop=parseInt(n.paddingTop,10)||0,b.paddingBottom=parseInt(n.paddingBottom,10)||0),b}function U3(t,e=!1,n){let r=Sm(t),i=P3(t,e),c={left:r.left+i.borderLeft+i.scrollbarLeft,right:r.right-i.borderRight-i.scrollbarRight,top:r.top+i.borderTop,bottom:r.bottom-i.borderBottom-i.scrollbarBottom};return e&&(c.left+=i.paddingLeft,c.right-=i.paddingRight,c.top+=i.paddingTop,c.bottom-=i.paddingBottom),c}function Sm(t){let e=t.getBoundingClientRect();return{left:e.left+window.scrollX,top:e.top+window.scrollY,right:e.right+window.scrollX,bottom:e.bottom+window.scrollY}}function B3(t){let e=hj(t),n=t.getBoundingClientRect();for(let r of e){let i=dj(n,r.getBoundingClientRect());if(i)n=i;else return null}return n}function hj(t){let e=[];for(;t instanceof HTMLElement;){let n=window.getComputedStyle(t);if(n.position==="fixed")break;/(auto|scroll)/.test(n.overflow+n.overflowY+n.overflowX)&&e.push(t),t=t.parentNode}return e}class Gl{constructor(e,n,r,i){this.els=n;let c=this.originClientRect=e.getBoundingClientRect();r&&this.buildElHorizontals(c.left),i&&this.buildElVerticals(c.top)}buildElHorizontals(e){let n=[],r=[];for(let i of this.els){let c=i.getBoundingClientRect();n.push(c.left-e),r.push(c.right-e)}this.lefts=n,this.rights=r}buildElVerticals(e){let n=[],r=[];for(let i of this.els){let c=i.getBoundingClientRect();n.push(c.top-e),r.push(c.bottom-e)}this.tops=n,this.bottoms=r}leftToIndex(e){let{lefts:n,rights:r}=this,i=n.length,c;for(c=0;c=n[c]&&e=n[c]&&e0}canScrollHorizontally(){return this.getMaxScrollLeft()>0}canScrollUp(){return this.getScrollTop()>0}canScrollDown(){return this.getScrollTop()0}canScrollRight(){return this.getScrollLeft()n.thickness||1){this.getEntryThickness=e,this.strictOrder=!1,this.allowReslicing=!1,this.maxCoord=-1,this.maxStackCnt=-1,this.levelCoords=[],this.entriesByLevel=[],this.stackCnts={}}addSegs(e){let n=[];for(let r of e)this.insertEntry(r,n);return n}insertEntry(e,n){let r=this.findInsertion(e);this.isInsertionValid(r,e)?this.insertEntryAt(e,r):this.handleInvalidInsertion(r,e,n)}isInsertionValid(e,n){return(this.maxCoord===-1||e.levelCoord+this.getEntryThickness(n)<=this.maxCoord)&&(this.maxStackCnt===-1||e.stackCntc.end&&this.insertEntry({index:e.index,thickness:e.thickness,span:{start:c.end,end:i.end}},r)}insertEntryAt(e,n){let{entriesByLevel:r,levelCoords:i}=this;n.lateral===-1?(_p(i,n.level,n.levelCoord),_p(r,n.level,[e])):_p(r[n.level],n.lateral,e),this.stackCnts[Ar(e)]=n.stackCnt}findInsertion(e){let{levelCoords:n,entriesByLevel:r,strictOrder:i,stackCnts:c}=this,d=n.length,f=0,h=-1,p=-1,b=null,y=0;for(let N=0;N=f+this.getEntryThickness(e))break;let j=r[N],R,C=lg(j,e.span.start,rg),O=C[0]+C[1];for(;(R=j[O])&&R.span.startf&&(f=A,b=R,h=N,p=O),A===f&&(y=Math.max(y,c[Ar(R)]+1)),O+=1}}let m=0;if(b)for(m=h+1;mn(t[i-1]))return[i,0];for(;rd)r=c+1;else return[c,1]}return[r,0]}class q3{constructor(e,n){this.emitter=new Ru}destroy(){}setMirrorIsVisible(e){}setMirrorNeedsRevert(e){}setAutoScrollEnabled(e){}}const wm={};function $3(t,e){return!t||e>10?ht({weekday:"short"}):e>1?ht({weekday:"short",month:"numeric",day:"numeric",omitCommas:!0}):ht({weekday:"long"})}const gj="fc-col-header-cell";function mj(t){return t.text}class Y3 extends Ke{render(){let{dateEnv:e,options:n,theme:r,viewApi:i}=this.context,{props:c}=this,{date:d,dateProfile:f}=c,h=uj(d,c.todayRange,null,f),p=[gj].concat(Em(h,r)),b=e.format(d,c.dayHeaderFormat),y=!h.isDisabled&&c.colCnt>1?iu(this.context,d):{},m=e.toDate(d);e.namedTimeZoneImpl&&(m=Us(m,36e5));let v=Object.assign(Object.assign(Object.assign({date:m,view:i},c.extraRenderProps),{text:b}),h);return I(On,{elTag:"th",elClasses:p,elAttrs:Object.assign({role:"columnheader",colSpan:c.colSpan,"data-date":h.isDisabled?void 0:om(d)},c.extraDataAttrs),renderProps:v,generatorName:"dayHeaderContent",customGenerator:n.dayHeaderContent,defaultGenerator:mj,classNameGenerator:n.dayHeaderClassNames,didMount:n.dayHeaderDidMount,willUnmount:n.dayHeaderWillUnmount},N=>I("div",{className:"fc-scrollgrid-sync-inner"},!h.isDisabled&&I(N,{elTag:"a",elAttrs:y,elClasses:["fc-col-header-cell-cushion",c.isSticky&&"fc-sticky"]})))}}const Q3=ht({weekday:"long"});class W3 extends Ke{render(){let{props:e}=this,{dateEnv:n,theme:r,viewApi:i,options:c}=this.context,d=_t(new Date(2592e5),e.dow),f={dow:e.dow,isDisabled:!1,isFuture:!1,isPast:!1,isToday:!1,isOther:!1},h=n.format(d,e.dayHeaderFormat),p=Object.assign(Object.assign(Object.assign(Object.assign({date:d},f),{view:i}),e.extraRenderProps),{text:h});return I(On,{elTag:"th",elClasses:[gj,...Em(f,r),...e.extraClassNames||[]],elAttrs:Object.assign({role:"columnheader",colSpan:e.colSpan},e.extraDataAttrs),renderProps:p,generatorName:"dayHeaderContent",customGenerator:c.dayHeaderContent,defaultGenerator:mj,classNameGenerator:c.dayHeaderClassNames,didMount:c.dayHeaderDidMount,willUnmount:c.dayHeaderWillUnmount},b=>I("div",{className:"fc-scrollgrid-sync-inner"},I(b,{elTag:"a",elClasses:["fc-col-header-cell-cushion",e.isSticky&&"fc-sticky"],elAttrs:{"aria-label":n.format(d,Q3)}})))}}class xj extends Ke{constructor(){super(...arguments),this.createDayHeaderFormatter=we(X3)}render(){let{context:e}=this,{dates:n,dateProfile:r,datesRepDistinctDays:i,renderIntro:c}=this.props,d=this.createDayHeaderFormatter(e.options.dayHeaderFormat,i,n.length);return I(ei,{unit:"day"},(f,h)=>I("tr",{role:"row"},c&&c("day"),n.map(p=>i?I(Y3,{key:p.toISOString(),date:p,dateProfile:r,todayRange:h,colCnt:n.length,dayHeaderFormat:d}):I(W3,{key:p.getUTCDay(),dow:p.getUTCDay(),dayHeaderFormat:d}))))}}function X3(t,e,n){return t||$3(e,n)}class bj{constructor(e,n){let r=e.start,{end:i}=e,c=[],d=[],f=-1;for(;r=n.length?n[n.length-1]+1:n[r]}}class yj{constructor(e,n){let{dates:r}=e,i,c,d;if(n){for(c=r[0].getUTCDay(),i=1;ic.groupId===t)):typeof t=="object"&&t?Mp(Rr(t,e,i)):[]}function Mp(t){let{instances:e}=t,n=[];for(let r in e)n.push(e[r].range);return n}function n6(t,e){for(let n of t)if(Du(n,e))return!0;return!1}const vd=/^(visible|hidden)$/;class a6 extends Ke{constructor(){super(...arguments),this.handleEl=e=>{this.el=e,fa(this.props.elRef,e)}}render(){let{props:e}=this,{liquid:n,liquidIsAbsolute:r}=e,i=n&&r,c=["fc-scroller"];return n&&(r?c.push("fc-scroller-liquid-absolute"):c.push("fc-scroller-liquid")),I("div",{ref:this.handleEl,className:c.join(" "),style:{overflowX:e.overflowX,overflowY:e.overflowY,left:i&&-(e.overcomeLeft||0)||"",right:i&&-(e.overcomeRight||0)||"",bottom:i&&-(e.overcomeBottom||0)||"",marginLeft:!i&&-(e.overcomeLeft||0)||"",marginRight:!i&&-(e.overcomeRight||0)||"",marginBottom:!i&&-(e.overcomeBottom||0)||"",maxHeight:e.maxHeight||""}},e.children)}needsXScrolling(){if(vd.test(this.props.overflowX))return!1;let{el:e}=this,n=this.el.getBoundingClientRect().width-this.getYScrollbarWidth(),{children:r}=e;for(let i=0;in)return!0;return!1}needsYScrolling(){if(vd.test(this.props.overflowY))return!1;let{el:e}=this,n=this.el.getBoundingClientRect().height-this.getXScrollbarWidth(),{children:r}=e;for(let i=0;in)return!0;return!1}getXScrollbarWidth(){return vd.test(this.props.overflowX)?0:this.el.offsetHeight-this.el.clientHeight}getYScrollbarWidth(){return vd.test(this.props.overflowY)?0:this.el.offsetWidth-this.el.clientWidth}}class La{constructor(e){this.masterCallback=e,this.currentMap={},this.depths={},this.callbackMap={},this.handleValue=(n,r)=>{let{depths:i,currentMap:c}=this,d=!1,f=!1;n!==null?(d=r in c,c[r]=n,i[r]=(i[r]||0)+1,f=!0):(i[r]-=1,i[r]||(delete c[r],delete this.callbackMap[r],d=!0)),this.masterCallback&&(d&&this.masterCallback(null,String(r)),f&&this.masterCallback(n,String(r)))}}createRef(e){let n=this.callbackMap[e];return n||(n=this.callbackMap[e]=r=>{this.handleValue(r,String(e))}),n}collect(e,n,r){return g4(this.currentMap,e,n,r)}getAll(){return fm(this.currentMap)}}function s6(t){let e=hI(t,".fc-scrollgrid-shrink"),n=0;for(let r of e)n=Math.max(n,CI(r));return Math.ceil(n)}function jj(t,e){return t.liquid&&e.liquid}function r6(t,e){return e.maxHeight!=null||jj(t,e)}function l6(t,e,n,r){let{expandRows:i}=n;return typeof e.content=="function"?e.content(n):I("table",{role:"presentation",className:[e.tableClassName,t.syncRowHeights?"fc-scrollgrid-sync-table":""].join(" "),style:{minWidth:n.tableMinWidth,width:n.clientWidth,height:i?n.clientHeight:""}},n.tableColGroupNode,I(r?"thead":"tbody",{role:"presentation"},typeof e.rowContent=="function"?e.rowContent(n):e.rowContent))}function i6(t,e){return Ps(t,e,ta)}function o6(t,e){let n=[];for(let r of t){let i=r.span||1;for(let c=0;ce,i6),this.renderMicroColGroup=we(o6),this.scrollerRefs=new La,this.scrollerElRefs=new La(this._handleScrollerEl.bind(this)),this.state={shrinkWidth:null,forceYScrollbars:!1,scrollerClientWidths:{},scrollerClientHeights:{}},this.handleSizing=()=>{this.safeSetState(Object.assign({shrinkWidth:this.computeShrinkWidth()},this.computeScrollerDims()))}}render(){let{props:e,state:n,context:r}=this,i=e.sections||[],c=this.processCols(e.cols),d=this.renderMicroColGroup(c,n.shrinkWidth),f=u6(e.liquid,r);e.collapsibleWidth&&f.push("fc-scrollgrid-collapsible");let h=i.length,p=0,b,y=[],m=[],v=[];for(;p{}},i);return I(i?"th":"td",{ref:r.elRef,role:"presentation"},I("div",{className:`fc-scroller-harness${b?" fc-scroller-harness-liquid":""}`},I(a6,{ref:this.scrollerRefs.createRef(m),elRef:this.scrollerElRefs.createRef(m),overflowY:y,overflowX:c.liquid?"hidden":"visible",maxHeight:e.maxHeight,liquid:b,liquidIsAbsolute:!0},v)))}_handleScrollerEl(e,n){let r=h6(this.props.sections,n);r&&fa(r.chunk.scrollerElRef,e)}componentDidMount(){this.handleSizing(),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(){this.handleSizing()}componentWillUnmount(){this.context.removeResizeHandler(this.handleSizing)}computeShrinkWidth(){return d6(this.props.cols)?s6(this.scrollerElRefs.getAll()):0}computeScrollerDims(){let e=L3(),{scrollerRefs:n,scrollerElRefs:r}=this,i=!1,c={},d={};for(let f in n.currentMap){let h=n.currentMap[f];if(h&&h.needsYScrolling()){i=!0;break}}for(let f of this.props.sections){let h=f.key,p=r.currentMap[h];if(p){let b=p.parentNode;c[h]=Math.floor(b.getBoundingClientRect().width-(i?e.y:0)),d[h]=Math.floor(b.getBoundingClientRect().height)}}return{forceYScrollbars:i,scrollerClientWidths:c,scrollerClientHeights:d}}}Cm.addStateEquality({scrollerClientWidths:ta,scrollerClientHeights:ta});function h6(t,e){for(let n of t)if(n.key===e)return n;return null}class Dm extends Ke{constructor(){super(...arguments),this.buildPublicEvent=we((e,n,r)=>new ut(e,n,r)),this.handleEl=e=>{this.el=e,fa(this.props.elRef,e),e&&I1(e,this.props.seg)}}render(){const{props:e,context:n}=this,{options:r}=n,{seg:i}=e,{eventRange:c}=i,{ui:d}=c,f={event:this.buildPublicEvent(n,c.def,c.instance),view:n.viewApi,timeText:e.timeText,textColor:d.textColor,backgroundColor:d.backgroundColor,borderColor:d.borderColor,isDraggable:!e.disableDragging&&o3(i,n),isStartResizable:!e.disableResizing&&c3(i,n),isEndResizable:!e.disableResizing&&d3(i),isMirror:!!(e.isDragging||e.isResizing||e.isDateSelecting),isStart:!!i.isStart,isEnd:!!i.isEnd,isPast:!!e.isPast,isFuture:!!e.isFuture,isToday:!!e.isToday,isSelected:!!e.isSelected,isDragging:!!e.isDragging,isResizing:!!e.isResizing};return I(On,{elRef:this.handleEl,elTag:e.elTag,elAttrs:e.elAttrs,elClasses:[...u3(f),...i.eventRange.ui.classNames,...e.elClasses||[]],elStyle:e.elStyle,renderProps:f,generatorName:"eventContent",customGenerator:r.eventContent,defaultGenerator:e.defaultGenerator,classNameGenerator:r.eventClassNames,didMount:r.eventDidMount,willUnmount:r.eventWillUnmount},e.children)}componentDidUpdate(e){this.el&&this.props.seg!==e.seg&&I1(this.el,this.props.seg)}}class Om extends Ke{render(){let{props:e,context:n}=this,{options:r}=n,{seg:i}=e,{ui:c}=i.eventRange,d=r.eventTimeFormat||e.defaultTimeFormat,f=sj(i,d,n,e.defaultDisplayEventTime,e.defaultDisplayEventEnd);return I(Dm,Object.assign({},e,{elTag:"a",elStyle:{borderColor:c.borderColor,backgroundColor:c.backgroundColor},elAttrs:lj(i,n),defaultGenerator:p6,timeText:f}),(h,p)=>I(lt,null,I(h,{elTag:"div",elClasses:["fc-event-main"],elStyle:{color:p.textColor}}),!!p.isStartResizable&&I("div",{className:"fc-event-resizer fc-event-resizer-start"}),!!p.isEndResizable&&I("div",{className:"fc-event-resizer fc-event-resizer-end"})))}}Om.addPropsEquality({seg:ta});function p6(t){return I("div",{className:"fc-event-main-frame"},t.timeText&&I("div",{className:"fc-event-time"},t.timeText),I("div",{className:"fc-event-title-container"},I("div",{className:"fc-event-title fc-sticky"},t.event.title||I(lt,null," "))))}const Rm=t=>I(Fa.Consumer,null,e=>{let{options:n}=e,r={isAxis:t.isAxis,date:e.dateEnv.toDate(t.date),view:e.viewApi};return I(On,{elRef:t.elRef,elTag:t.elTag||"div",elAttrs:t.elAttrs,elClasses:t.elClasses,elStyle:t.elStyle,renderProps:r,generatorName:"nowIndicatorContent",customGenerator:n.nowIndicatorContent,classNameGenerator:n.nowIndicatorClassNames,didMount:n.nowIndicatorDidMount,willUnmount:n.nowIndicatorWillUnmount},t.children)}),g6=ht({day:"numeric"});class Tm extends Ke{constructor(){super(...arguments),this.refineRenderProps=Rd(m6)}render(){let{props:e,context:n}=this,{options:r}=n,i=this.refineRenderProps({date:e.date,dateProfile:e.dateProfile,todayRange:e.todayRange,isMonthStart:e.isMonthStart||!1,showDayNumber:e.showDayNumber,extraRenderProps:e.extraRenderProps,viewApi:n.viewApi,dateEnv:n.dateEnv,monthStartFormat:r.monthStartFormat});return I(On,{elRef:e.elRef,elTag:e.elTag,elAttrs:Object.assign(Object.assign({},e.elAttrs),i.isDisabled?{}:{"data-date":om(e.date)}),elClasses:[...Em(i,n.theme),...e.elClasses||[]],elStyle:e.elStyle,renderProps:i,generatorName:"dayCellContent",customGenerator:r.dayCellContent,defaultGenerator:e.defaultGenerator,classNameGenerator:i.isDisabled?void 0:r.dayCellClassNames,didMount:r.dayCellDidMount,willUnmount:r.dayCellWillUnmount},e.children)}}function km(t){return!!(t.dayCellContent||tg("dayCellContent",t))}function m6(t){let{date:e,dateEnv:n,dateProfile:r,isMonthStart:i}=t,c=uj(e,t.todayRange,null,r),d=t.showDayNumber?n.format(e,i?t.monthStartFormat:g6):"";return Object.assign(Object.assign(Object.assign({date:n.toDate(e),view:t.viewApi},c),{isMonthStart:i,dayNumberText:d}),t.extraRenderProps)}class wj extends Ke{render(){let{props:e}=this,{seg:n}=e;return I(Dm,{elTag:"div",elClasses:["fc-bg-event"],elStyle:{backgroundColor:n.eventRange.ui.backgroundColor},defaultGenerator:x6,seg:n,timeText:"",isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:!1,isPast:e.isPast,isFuture:e.isFuture,isToday:e.isToday,disableDragging:!0,disableResizing:!0})}}function x6(t){let{title:e}=t.event;return e&&I("div",{className:"fc-event-title"},t.event.title)}function Cj(t){return I("div",{className:`fc-${t}`})}const Dj=t=>I(Fa.Consumer,null,e=>{let{dateEnv:n,options:r}=e,{date:i}=t,c=r.weekNumberFormat||t.defaultFormat,d=n.computeWeekNumber(i),f=n.format(i,c),h={num:d,text:f,date:i};return I(On,{elRef:t.elRef,elTag:t.elTag,elAttrs:t.elAttrs,elClasses:t.elClasses,elStyle:t.elStyle,renderProps:h,generatorName:"weekNumberContent",customGenerator:r.weekNumberContent,defaultGenerator:b6,classNameGenerator:r.weekNumberClassNames,didMount:r.weekNumberDidMount,willUnmount:r.weekNumberWillUnmount},t.children)});function b6(t){return t.text}const Ip=10;class y6 extends Ke{constructor(){super(...arguments),this.state={titleId:wu()},this.handleRootEl=e=>{this.rootEl=e,this.props.elRef&&fa(this.props.elRef,e)},this.handleDocumentMouseDown=e=>{const n=TS(e);this.rootEl.contains(n)||this.handleCloseClick()},this.handleDocumentKeyDown=e=>{e.key==="Escape"&&this.handleCloseClick()},this.handleCloseClick=()=>{let{onClose:e}=this.props;e&&e()}}render(){let{theme:e,options:n}=this.context,{props:r,state:i}=this,c=["fc-popover",e.getClass("popover")].concat(r.extraClassNames||[]);return JM(I("div",Object.assign({},r.extraAttrs,{id:r.id,className:c.join(" "),"aria-labelledby":i.titleId,ref:this.handleRootEl}),I("div",{className:"fc-popover-header "+e.getClass("popoverHeader")},I("span",{className:"fc-popover-title",id:i.titleId},r.title),I("span",{className:"fc-popover-close "+e.getIconClass("close"),title:n.closeHint,onClick:this.handleCloseClick})),I("div",{className:"fc-popover-body "+e.getClass("popoverContent")},r.children)),r.parentEl)}componentDidMount(){document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleDocumentKeyDown),this.updateSize()}componentWillUnmount(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleDocumentKeyDown)}updateSize(){let{isRtl:e}=this.context,{alignmentEl:n,alignGridTop:r}=this.props,{rootEl:i}=this,c=B3(n);if(c){let d=i.getBoundingClientRect(),f=r?qt(n,".fc-scrollgrid").getBoundingClientRect().top:c.top,h=e?c.right-d.width:c.left;f=Math.max(f,Ip),h=Math.min(h,document.documentElement.clientWidth-Ip-d.width),h=Math.max(h,Ip);let p=i.offsetParent.getBoundingClientRect();io(i,{top:f-p.top,left:h-p.left})}}}class v6 extends pa{constructor(){super(...arguments),this.handleRootEl=e=>{this.rootEl=e,e?this.context.registerInteractiveComponent(this,{el:e,useEventCenter:!1}):this.context.unregisterInteractiveComponent(this)}}render(){let{options:e,dateEnv:n}=this.context,{props:r}=this,{startDate:i,todayRange:c,dateProfile:d}=r,f=n.format(i,e.dayPopoverFormat);return I(Tm,{elRef:this.handleRootEl,date:i,dateProfile:d,todayRange:c},(h,p,b)=>I(y6,{elRef:b.ref,id:r.id,title:f,extraClassNames:["fc-more-popover"].concat(b.className||[]),extraAttrs:b,parentEl:r.parentEl,alignmentEl:r.alignmentEl,alignGridTop:r.alignGridTop,onClose:r.onClose},km(e)&&I(h,{elTag:"div",elClasses:["fc-more-popover-misc"]}),r.children))}queryHit(e,n,r,i){let{rootEl:c,props:d}=this;return e>=0&&e=0&&n{this.linkEl=e,this.props.elRef&&fa(this.props.elRef,e)},this.handleClick=e=>{let{props:n,context:r}=this,{moreLinkClick:i}=r.options,c=z1(n).start;function d(f){let{def:h,instance:p,range:b}=f.eventRange;return{event:new ut(r,h,p),start:r.dateEnv.toDate(b.start),end:r.dateEnv.toDate(b.end),isStart:f.isStart,isEnd:f.isEnd}}typeof i=="function"&&(i=i({date:c,allDay:!!n.allDayDate,allSegs:n.allSegs.map(d),hiddenSegs:n.hiddenSegs.map(d),jsEvent:e,view:r.viewApi})),!i||i==="popover"?this.setState({isPopoverOpen:!0}):typeof i=="string"&&r.calendarApi.zoomTo(c,i)},this.handlePopoverClose=()=>{this.setState({isPopoverOpen:!1})}}render(){let{props:e,state:n}=this;return I(Fa.Consumer,null,r=>{let{viewApi:i,options:c,calendarApi:d}=r,{moreLinkText:f}=c,{moreCnt:h}=e,p=z1(e),b=typeof f=="function"?f.call(d,h):`+${h} ${f}`,y=oo(c.moreLinkHint,[h],b),m={num:h,shortText:`+${h}`,text:b,view:i};return I(lt,null,!!e.moreCnt&&I(On,{elTag:e.elTag||"a",elRef:this.handleLinkEl,elClasses:[...e.elClasses||[],"fc-more-link"],elStyle:e.elStyle,elAttrs:Object.assign(Object.assign(Object.assign({},e.elAttrs),_S(this.handleClick)),{title:y,"aria-expanded":n.isPopoverOpen,"aria-controls":n.isPopoverOpen?n.popoverId:""}),renderProps:m,generatorName:"moreLinkContent",customGenerator:c.moreLinkContent,defaultGenerator:e.defaultGenerator||N6,classNameGenerator:c.moreLinkClassNames,didMount:c.moreLinkDidMount,willUnmount:c.moreLinkWillUnmount},e.children),n.isPopoverOpen&&I(v6,{id:n.popoverId,startDate:p.start,endDate:p.end,dateProfile:e.dateProfile,todayRange:e.todayRange,extraDateSpan:e.extraDateSpan,parentEl:this.parentEl,alignmentEl:e.alignmentElRef?e.alignmentElRef.current:this.linkEl,alignGridTop:e.alignGridTop,forceTimed:e.forceTimed,onClose:this.handlePopoverClose},e.popoverContent()))})}componentDidMount(){this.updateParentEl()}componentDidUpdate(){this.updateParentEl()}updateParentEl(){this.linkEl&&(this.parentEl=qt(this.linkEl,".fc-view-harness"))}}function N6(t){return t.text}function z1(t){if(t.allDayDate)return{start:t.allDayDate,end:_t(t.allDayDate,1)};let{hiddenSegs:e}=t;return{start:Rj(e),end:S6(e)}}function Rj(t){return t.reduce(E6).eventRange.range.start}function E6(t,e){return t.eventRange.range.starte.eventRange.range.end?t:e}class A6{constructor(){this.handlers=[]}set(e){this.currentValue=e;for(let n of this.handlers)n(e)}subscribe(e){this.handlers.push(e),this.currentValue!==void 0&&e(this.currentValue)}}class w6 extends A6{constructor(){super(...arguments),this.map=new Map}handle(e){const{map:n}=this;let r=!1;e.isActive?(n.set(e.id,e),r=!0):n.has(e.id)&&(n.delete(e.id),r=!0),r&&this.set(n)}}const C6=[],Tj={code:"en",week:{dow:0,doy:4},direction:"ltr",buttonText:{prev:"prev",next:"next",prevYear:"prev year",nextYear:"next year",year:"year",today:"today",month:"month",week:"week",day:"day",list:"list"},weekText:"W",weekTextLong:"Week",closeHint:"Close",timeHint:"Time",eventHint:"Event",allDayText:"all-day",moreLinkText:"more",noEventsText:"No events to display"},kj=Object.assign(Object.assign({},Tj),{buttonHints:{prev:"Previous $0",next:"Next $0",today(t,e){return e==="day"?"Today":`This ${t}`}},viewHint:"$0 view",navLinkHint:"Go to $0",moreLinkHint(t){return`Show ${t} more event${t===1?"":"s"}`}});function D6(t){let e=t.length>0?t[0].code:"en",n=C6.concat(t),r={en:kj};for(let i of n)r[i.code]=i;return{map:r,defaultCode:e}}function _j(t,e){return typeof t=="object"&&!Array.isArray(t)?Mj(t.code,[t.code],t):O6(t,e)}function O6(t,e){let n=[].concat(t||[]),r=R6(n,e)||kj;return Mj(t,n,r)}function R6(t,e){for(let n=0;n0;i-=1){let c=r.slice(0,i).join("-");if(e[c])return e[c]}}return null}function Mj(t,e,n){let r=um([Tj,n],["buttonText"]);delete r.code;let{week:i}=r;return delete r.week,{codeArg:t,codes:e,week:i,simpleNumberFormat:new Intl.NumberFormat(t),options:r}}function qa(t){return{id:Tr(),name:t.name,premiumReleaseDate:t.premiumReleaseDate?new Date(t.premiumReleaseDate):void 0,deps:t.deps||[],reducers:t.reducers||[],isLoadingFuncs:t.isLoadingFuncs||[],contextInit:[].concat(t.contextInit||[]),eventRefiners:t.eventRefiners||{},eventDefMemberAdders:t.eventDefMemberAdders||[],eventSourceRefiners:t.eventSourceRefiners||{},isDraggableTransformers:t.isDraggableTransformers||[],eventDragMutationMassagers:t.eventDragMutationMassagers||[],eventDefMutationAppliers:t.eventDefMutationAppliers||[],dateSelectionTransformers:t.dateSelectionTransformers||[],datePointTransforms:t.datePointTransforms||[],dateSpanTransforms:t.dateSpanTransforms||[],views:t.views||{},viewPropsTransformers:t.viewPropsTransformers||[],isPropsValid:t.isPropsValid||null,externalDefTransforms:t.externalDefTransforms||[],viewContainerAppends:t.viewContainerAppends||[],eventDropTransformers:t.eventDropTransformers||[],componentInteractions:t.componentInteractions||[],calendarInteractions:t.calendarInteractions||[],themeClasses:t.themeClasses||{},eventSourceDefs:t.eventSourceDefs||[],cmdFormatter:t.cmdFormatter,recurringTypes:t.recurringTypes||[],namedTimeZonedImpl:t.namedTimeZonedImpl,initialView:t.initialView||"",elementDraggingImpl:t.elementDraggingImpl,optionChangeHandlers:t.optionChangeHandlers||{},scrollGridImpl:t.scrollGridImpl||null,listenerRefiners:t.listenerRefiners||{},optionRefiners:t.optionRefiners||{},propSetHandlers:t.propSetHandlers||{}}}function T6(t,e){let n={},r={premiumReleaseDate:void 0,reducers:[],isLoadingFuncs:[],contextInit:[],eventRefiners:{},eventDefMemberAdders:[],eventSourceRefiners:{},isDraggableTransformers:[],eventDragMutationMassagers:[],eventDefMutationAppliers:[],dateSelectionTransformers:[],datePointTransforms:[],dateSpanTransforms:[],views:{},viewPropsTransformers:[],isPropsValid:null,externalDefTransforms:[],viewContainerAppends:[],eventDropTransformers:[],componentInteractions:[],calendarInteractions:[],themeClasses:{},eventSourceDefs:[],cmdFormatter:null,recurringTypes:[],namedTimeZonedImpl:null,initialView:"",elementDraggingImpl:null,optionChangeHandlers:{},scrollGridImpl:null,listenerRefiners:{},optionRefiners:{},propSetHandlers:{}};function i(c){for(let d of c){const f=d.name,h=n[f];h===void 0?(n[f]=d.id,i(d.deps),r=_6(r,d)):h!==d.id&&console.warn(`Duplicate plugin '${f}'`)}}return t&&i(t),i(e),r}function k6(){let t=[],e=[],n;return(r,i)=>((!n||!Ps(r,t)||!Ps(i,e))&&(n=T6(r,i)),t=r,e=i,n)}function _6(t,e){return{premiumReleaseDate:M6(t.premiumReleaseDate,e.premiumReleaseDate),reducers:t.reducers.concat(e.reducers),isLoadingFuncs:t.isLoadingFuncs.concat(e.isLoadingFuncs),contextInit:t.contextInit.concat(e.contextInit),eventRefiners:Object.assign(Object.assign({},t.eventRefiners),e.eventRefiners),eventDefMemberAdders:t.eventDefMemberAdders.concat(e.eventDefMemberAdders),eventSourceRefiners:Object.assign(Object.assign({},t.eventSourceRefiners),e.eventSourceRefiners),isDraggableTransformers:t.isDraggableTransformers.concat(e.isDraggableTransformers),eventDragMutationMassagers:t.eventDragMutationMassagers.concat(e.eventDragMutationMassagers),eventDefMutationAppliers:t.eventDefMutationAppliers.concat(e.eventDefMutationAppliers),dateSelectionTransformers:t.dateSelectionTransformers.concat(e.dateSelectionTransformers),datePointTransforms:t.datePointTransforms.concat(e.datePointTransforms),dateSpanTransforms:t.dateSpanTransforms.concat(e.dateSpanTransforms),views:Object.assign(Object.assign({},t.views),e.views),viewPropsTransformers:t.viewPropsTransformers.concat(e.viewPropsTransformers),isPropsValid:e.isPropsValid||t.isPropsValid,externalDefTransforms:t.externalDefTransforms.concat(e.externalDefTransforms),viewContainerAppends:t.viewContainerAppends.concat(e.viewContainerAppends),eventDropTransformers:t.eventDropTransformers.concat(e.eventDropTransformers),calendarInteractions:t.calendarInteractions.concat(e.calendarInteractions),componentInteractions:t.componentInteractions.concat(e.componentInteractions),themeClasses:Object.assign(Object.assign({},t.themeClasses),e.themeClasses),eventSourceDefs:t.eventSourceDefs.concat(e.eventSourceDefs),cmdFormatter:e.cmdFormatter||t.cmdFormatter,recurringTypes:t.recurringTypes.concat(e.recurringTypes),namedTimeZonedImpl:e.namedTimeZonedImpl||t.namedTimeZonedImpl,initialView:t.initialView||e.initialView,elementDraggingImpl:t.elementDraggingImpl||e.elementDraggingImpl,optionChangeHandlers:Object.assign(Object.assign({},t.optionChangeHandlers),e.optionChangeHandlers),scrollGridImpl:e.scrollGridImpl||t.scrollGridImpl,listenerRefiners:Object.assign(Object.assign({},t.listenerRefiners),e.listenerRefiners),optionRefiners:Object.assign(Object.assign({},t.optionRefiners),e.optionRefiners),propSetHandlers:Object.assign(Object.assign({},t.propSetHandlers),e.propSetHandlers)}}function M6(t,e){return t===void 0?e:e===void 0?t:new Date(Math.max(t.valueOf(),e.valueOf()))}class Hs extends Bo{}Hs.prototype.classes={root:"fc-theme-standard",tableCellShaded:"fc-cell-shaded",buttonGroup:"fc-button-group",button:"fc-button fc-button-primary",buttonActive:"fc-button-active"};Hs.prototype.baseIconClass="fc-icon";Hs.prototype.iconClasses={close:"fc-icon-x",prev:"fc-icon-chevron-left",next:"fc-icon-chevron-right",prevYear:"fc-icon-chevrons-left",nextYear:"fc-icon-chevrons-right"};Hs.prototype.rtlIconClasses={prev:"fc-icon-chevron-right",next:"fc-icon-chevron-left",prevYear:"fc-icon-chevrons-right",nextYear:"fc-icon-chevrons-left"};Hs.prototype.iconOverrideOption="buttonIcons";Hs.prototype.iconOverrideCustomButtonOption="icon";Hs.prototype.iconOverridePrefix="fc-icon-";function I6(t,e){let n={},r;for(r in t)og(r,n,t,e);for(r in e)og(r,n,t,e);return n}function og(t,e,n,r){if(e[t])return e[t];let i=L6(t,e,n,r);return i&&(e[t]=i),i}function L6(t,e,n,r){let i=n[t],c=r[t],d=b=>i&&i[b]!==null?i[b]:c&&c[b]!==null?c[b]:null,f=d("component"),h=d("superType"),p=null;if(h){if(h===t)throw new Error("Can't have a custom view type that references itself");p=og(h,e,n,r)}return!f&&p&&(f=p.component),f?{type:t,component:f,defaults:Object.assign(Object.assign({},p?p.defaults:{}),i?i.rawOptions:{}),overrides:Object.assign(Object.assign({},p?p.overrides:{}),c?c.rawOptions:{})}:null}function P1(t){return Ha(t,z6)}function z6(t){let e=typeof t=="function"?{component:t}:t,{component:n}=e;return e.content?n=U1(e):n&&!(n.prototype instanceof Ke)&&(n=U1(Object.assign(Object.assign({},e),{content:n}))),{superType:e.type,component:n,rawOptions:e}}function U1(t){return e=>I(Fa.Consumer,null,n=>I(On,{elTag:"div",elClasses:GS(n.viewSpec),renderProps:Object.assign(Object.assign({},e),{nextDayThreshold:n.options.nextDayThreshold}),generatorName:void 0,customGenerator:t.content,classNameGenerator:t.classNames,didMount:t.didMount,willUnmount:t.willUnmount}))}function P6(t,e,n,r){let i=P1(t),c=P1(e.views),d=I6(i,c);return Ha(d,f=>U6(f,c,e,n,r))}function U6(t,e,n,r,i){let c=t.overrides.duration||t.defaults.duration||r.duration||n.duration,d=null,f="",h="",p={};if(c&&(d=B6(c),d)){let m=eg(d);f=m.unit,m.value===1&&(h=f,p=e[f]?e[f].rawOptions:{})}let b=m=>{let v=m.buttonText||{},N=t.defaults.buttonTextKey;return N!=null&&v[N]!=null?v[N]:v[t.type]!=null?v[t.type]:v[h]!=null?v[h]:null},y=m=>{let v=m.buttonHints||{},N=t.defaults.buttonTextKey;return N!=null&&v[N]!=null?v[N]:v[t.type]!=null?v[t.type]:v[h]!=null?v[h]:null};return{type:t.type,component:t.component,duration:d,durationUnit:f,singleUnit:h,optionDefaults:t.defaults,optionOverrides:Object.assign(Object.assign({},p),t.overrides),buttonTextOverride:b(r)||b(n)||t.overrides.buttonText,buttonTextDefault:b(i)||t.defaults.buttonText||b(co)||t.type,buttonTitleOverride:y(r)||y(n)||t.overrides.buttonHint,buttonTitleDefault:y(i)||t.defaults.buttonHint||y(co)}}let B1={};function B6(t){let e=JSON.stringify(t),n=B1[e];return n===void 0&&(n=Ge(t),B1[e]=n),n}function H6(t,e){switch(e.type){case"CHANGE_VIEW_TYPE":t=e.viewType}return t}function G6(t,e){switch(e.type){case"CHANGE_DATE":return e.dateMarker;default:return t}}function V6(t,e,n){let r=t.initialDate;return r!=null?e.createMarker(r):n.getDateMarker()}function F6(t,e){switch(e.type){case"SET_OPTION":return Object.assign(Object.assign({},t),{[e.optionName]:e.rawOptionValue});default:return t}}function q6(t,e,n,r){let i;switch(e.type){case"CHANGE_VIEW_TYPE":return r.build(e.dateMarker||n);case"CHANGE_DATE":return r.build(e.dateMarker);case"PREV":if(i=r.buildPrev(t,n),i.isValid)return i;break;case"NEXT":if(i=r.buildNext(t,n),i.isValid)return i;break}return t}function $6(t,e,n){let r=e?e.activeRange:null;return Lj({},J6(t,n),r,n)}function Y6(t,e,n,r){let i=n?n.activeRange:null;switch(e.type){case"ADD_EVENT_SOURCES":return Lj(t,e.sources,i,r);case"REMOVE_EVENT_SOURCE":return W6(t,e.sourceId);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return n?zj(t,i,r):t;case"FETCH_EVENT_SOURCES":return _m(t,e.sourceIds?zS(e.sourceIds):Pj(t,r),i,e.isRefetch||!1,r);case"RECEIVE_EVENTS":case"RECEIVE_EVENT_ERROR":return K6(t,e.sourceId,e.fetchId,e.fetchRange);case"REMOVE_ALL_EVENT_SOURCES":return{};default:return t}}function Q6(t,e,n){let r=e?e.activeRange:null;return _m(t,Pj(t,n),r,!0,n)}function Ij(t){for(let e in t)if(t[e].isFetching)return!0;return!1}function Lj(t,e,n,r){let i={};for(let c of e)i[c.sourceId]=c;return n&&(i=zj(i,n,r)),Object.assign(Object.assign({},t),i)}function W6(t,e){return Dr(t,n=>n.sourceId!==e)}function zj(t,e,n){return _m(t,Dr(t,r=>X6(r,e,n)),e,!1,n)}function X6(t,e,n){return Uj(t,n)?!n.options.lazyFetching||!t.fetchRange||t.isFetching||e.startt.fetchRange.end:!t.latestFetchId}function _m(t,e,n,r,i){let c={};for(let d in t){let f=t[d];e[d]?c[d]=Z6(f,n,r,i):c[d]=f}return c}function Z6(t,e,n,r){let{options:i,calendarApi:c}=r,d=r.pluginHooks.eventSourceDefs[t.sourceDefId],f=Tr();return d.fetch({eventSource:t,range:e,isRefetch:n,context:r},h=>{let{rawEvents:p}=h;i.eventSourceSuccess&&(p=i.eventSourceSuccess.call(c,p,h.response)||p),t.success&&(p=t.success.call(c,p,h.response)||p),r.dispatch({type:"RECEIVE_EVENTS",sourceId:t.sourceId,fetchId:f,fetchRange:e,rawEvents:p})},h=>{let p=!1;i.eventSourceFailure&&(i.eventSourceFailure.call(c,h),p=!0),t.failure&&(t.failure(h),p=!0),p||console.warn(h.message,h),r.dispatch({type:"RECEIVE_EVENT_ERROR",sourceId:t.sourceId,fetchId:f,fetchRange:e,error:h})}),Object.assign(Object.assign({},t),{isFetching:!0,latestFetchId:f})}function K6(t,e,n,r){let i=t[e];return i&&n===i.latestFetchId?Object.assign(Object.assign({},t),{[e]:Object.assign(Object.assign({},i),{isFetching:!1,fetchRange:r})}):t}function Pj(t,e){return Dr(t,n=>Uj(n,e))}function J6(t,e){let n=ZS(e),r=[].concat(t.eventSources||[]),i=[];t.initialEvents&&r.unshift(t.initialEvents),t.events&&r.unshift(t.events);for(let c of r){let d=XS(c,e,n);d&&i.push(d)}return i}function Uj(t,e){return!e.pluginHooks.eventSourceDefs[t.sourceDefId].ignoreRange}function eL(t,e){switch(e.type){case"UNSELECT_DATES":return null;case"SELECT_DATES":return e.selection;default:return t}}function tL(t,e){switch(e.type){case"UNSELECT_EVENT":return"";case"SELECT_EVENT":return e.eventInstanceId;default:return t}}function nL(t,e){let n;switch(e.type){case"UNSET_EVENT_DRAG":return null;case"SET_EVENT_DRAG":return n=e.state,{affectedEvents:n.affectedEvents,mutatedEvents:n.mutatedEvents,isEvent:n.isEvent};default:return t}}function aL(t,e){let n;switch(e.type){case"UNSET_EVENT_RESIZE":return null;case"SET_EVENT_RESIZE":return n=e.state,{affectedEvents:n.affectedEvents,mutatedEvents:n.mutatedEvents,isEvent:n.isEvent};default:return t}}function sL(t,e,n,r,i){let c=t.headerToolbar?H1(t.headerToolbar,t,e,n,r,i):null,d=t.footerToolbar?H1(t.footerToolbar,t,e,n,r,i):null;return{header:c,footer:d}}function H1(t,e,n,r,i,c){let d={},f=[],h=!1;for(let p in t){let b=t[p],y=rL(b,e,n,r,i,c);d[p]=y.widgets,f.push(...y.viewsWithButtons),h=h||y.hasTitle}return{sectionWidgets:d,viewsWithButtons:f,hasTitle:h}}function rL(t,e,n,r,i,c){let d=e.direction==="rtl",f=e.customButtons||{},h=n.buttonText||{},p=e.buttonText||{},b=n.buttonHints||{},y=e.buttonHints||{},m=t?t.split(" "):[],v=[],N=!1;return{widgets:m.map(j=>j.split(",").map(R=>{if(R==="title")return N=!0,{buttonName:R};let C,O,A,k,_,B;if(C=f[R])A=F=>{C.click&&C.click.call(F.target,F,F.target)},(k=r.getCustomButtonIconClass(C))||(k=r.getIconClass(R,d))||(_=C.text),B=C.hint||C.text;else if(O=i[R]){v.push(R),A=()=>{c.changeView(R)},(_=O.buttonTextOverride)||(k=r.getIconClass(R,d))||(_=O.buttonTextDefault);let F=O.buttonTextOverride||O.buttonTextDefault;B=oo(O.buttonTitleOverride||O.buttonTitleDefault||e.viewHint,[F,R],F)}else if(c[R])if(A=()=>{c[R]()},(_=h[R])||(k=r.getIconClass(R,d))||(_=p[R]),R==="prevYear"||R==="nextYear"){let F=R==="prevYear"?"prev":"next";B=oo(b[F]||y[F],[p.year||"year","year"],p[R])}else B=F=>oo(b[R]||y[R],[p[F]||F,F],p[R]);return{buttonName:R,buttonClick:A,buttonIcon:k,buttonText:_,buttonHint:B}})),viewsWithButtons:v,hasTitle:N}}class lL{constructor(e,n,r){this.type=e,this.getCurrentData=n,this.dateEnv=r}get calendar(){return this.getCurrentData().calendarApi}get title(){return this.getCurrentData().viewTitle}get activeStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.start)}get activeEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.end)}get currentStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.start)}get currentEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.end)}getOption(e){return this.getCurrentData().options[e]}}let iL={ignoreRange:!0,parseMeta(t){return Array.isArray(t.events)?t.events:null},fetch(t,e){e({rawEvents:t.eventSource.meta})}};const oL=qa({name:"array-event-source",eventSourceDefs:[iL]});let cL={parseMeta(t){return typeof t.events=="function"?t.events:null},fetch(t,e,n){const{dateEnv:r}=t.context,i=t.eventSource.meta;y3(i.bind(null,ij(t.range,r)),c=>e({rawEvents:c}),n)}};const dL=qa({name:"func-event-source",eventSourceDefs:[cL]}),uL={method:String,extraParams:Z,startParam:String,endParam:String,timeZoneParam:String};let fL={parseMeta(t){return t.url&&(t.format==="json"||!t.format)?{url:t.url,format:"json",method:(t.method||"GET").toUpperCase(),extraParams:t.extraParams,startParam:t.startParam,endParam:t.endParam,timeZoneParam:t.timeZoneParam}:null},fetch(t,e,n){const{meta:r}=t.eventSource,i=pL(r,t.range,t.context);v3(r.method,r.url,i).then(([c,d])=>{e({rawEvents:c,response:d})},n)}};const hL=qa({name:"json-event-source",eventSourceRefiners:uL,eventSourceDefs:[fL]});function pL(t,e,n){let{dateEnv:r,options:i}=n,c,d,f,h,p={};return c=t.startParam,c==null&&(c=i.startParam),d=t.endParam,d==null&&(d=i.endParam),f=t.timeZoneParam,f==null&&(f=i.timeZoneParam),typeof t.extraParams=="function"?h=t.extraParams():h=t.extraParams||{},Object.assign(p,h),p[c]=r.formatIso(e.start),p[d]=r.formatIso(e.end),r.timeZone!=="local"&&(p[f]=r.timeZone),p}const gL={daysOfWeek:Z,startTime:Ge,endTime:Ge,duration:Ge,startRecur:Z,endRecur:Z};let mL={parse(t,e){if(t.daysOfWeek||t.startTime||t.endTime||t.startRecur||t.endRecur){let n={daysOfWeek:t.daysOfWeek||null,startTime:t.startTime||null,endTime:t.endTime||null,startRecur:t.startRecur?e.createMarker(t.startRecur):null,endRecur:t.endRecur?e.createMarker(t.endRecur):null,dateEnv:e},r;return t.duration&&(r=t.duration),!r&&t.startTime&&t.endTime&&(r=TI(t.endTime,t.startTime)),{allDayGuess:!t.startTime&&!t.endTime,duration:r,typeData:n}}return null},expand(t,e,n){let r=Or(e,{start:t.startRecur,end:t.endRecur});return r?bL(t.daysOfWeek,t.startTime,t.dateEnv,n,r):[]}};const xL=qa({name:"simple-recurring-event",recurringTypes:[mL],eventRefiners:gL});function bL(t,e,n,r,i){let c=t?zS(t):null,d=it(i.start),f=i.end,h=[];for(e&&(e.milliseconds<0?f=_t(f,1):e.milliseconds>=1e3*60*60*24&&(d=_t(d,-1)));dIj(t.eventSources)],propSetHandlers:{dateProfile:vL,eventStore:NL}})];class SL{constructor(e,n){this.runTaskOption=e,this.drainedOption=n,this.queue=[],this.delayedRunner=new am(this.drain.bind(this))}request(e,n){this.queue.push(e),this.delayedRunner.request(n)}pause(e){this.delayedRunner.pause(e)}resume(e,n){this.delayedRunner.resume(e,n)}drain(){let{queue:e}=this;for(;e.length;){let n=[],r;for(;r=e.shift();)this.runTask(r),n.push(r);this.drained(n)}}runTask(e){this.runTaskOption&&this.runTaskOption(e)}drained(e){this.drainedOption&&this.drainedOption(e)}}function jL(t,e,n){let r;return/^(year|month)$/.test(t.currentRangeUnit)?r=t.currentRange:r=t.activeRange,n.formatRange(r.start,r.end,ht(e.titleFormat||AL(t)),{isEndExclusive:t.isRangeAllDay,defaultSeparator:e.titleRangeSeparator})}function AL(t){let{currentRangeUnit:e}=t;if(e==="year")return{year:"numeric"};if(e==="month")return{year:"numeric",month:"long"};let n=Kd(t.currentRange.start,t.currentRange.end);return n!==null&&n>1?{year:"numeric",month:"short",day:"numeric"}:{year:"numeric",month:"long",day:"numeric"}}class V1{constructor(){this.resetListeners=new Set}handleInput(e,n){const r=this.dateEnv;if(e!==r&&(typeof n=="function"?this.nowFn=n:r||(this.nowAnchorDate=e.toDate(n?e.createMarker(n):e.createNowMarker()),this.nowAnchorQueried=Date.now()),this.dateEnv=e,r))for(const i of this.resetListeners.values())i()}getDateMarker(){return this.nowAnchorDate?this.dateEnv.timestampToMarker(this.nowAnchorDate.valueOf()+(Date.now()-this.nowAnchorQueried)):this.dateEnv.createMarker(this.nowFn())}addResetListener(e){this.resetListeners.add(e)}removeResetListener(e){this.resetListeners.delete(e)}}class wL{constructor(e){this.computeCurrentViewData=we(this._computeCurrentViewData),this.organizeRawLocales=we(D6),this.buildLocale=we(_j),this.buildPluginHooks=k6(),this.buildDateEnv=we(CL),this.buildTheme=we(DL),this.parseToolbars=we(sL),this.buildViewSpecs=we(P6),this.buildDateProfileGenerator=Rd(OL),this.buildViewApi=we(RL),this.buildViewUiProps=Rd(_L),this.buildEventUiBySource=we(TL,ta),this.buildEventUiBases=we(kL),this.parseContextBusinessHours=Rd(ML),this.buildTitle=we(jL),this.nowManager=new V1,this.emitter=new Ru,this.actionRunner=new SL(this._handleAction.bind(this),this.updateData.bind(this)),this.currentCalendarOptionsInput={},this.currentCalendarOptionsRefined={},this.currentViewOptionsInput={},this.currentViewOptionsRefined={},this.currentCalendarOptionsRefiners={},this.optionsForRefining=[],this.optionsForHandling=[],this.getCurrentData=()=>this.data,this.dispatch=m=>{this.actionRunner.request(m)},this.props=e,this.actionRunner.pause(),this.nowManager=new V1;let n={},r=this.computeOptionsData(e.optionOverrides,n,e.calendarApi),i=r.calendarOptions.initialView||r.pluginHooks.initialView,c=this.computeCurrentViewData(i,r,e.optionOverrides,n);e.calendarApi.currentDataManager=this,this.emitter.setThisContext(e.calendarApi),this.emitter.setOptions(c.options);let d={nowManager:this.nowManager,dateEnv:r.dateEnv,options:r.calendarOptions,pluginHooks:r.pluginHooks,calendarApi:e.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData},f=V6(r.calendarOptions,r.dateEnv,this.nowManager),h=c.dateProfileGenerator.build(f);Pa(h.activeRange,f)||(f=h.currentRange.start);for(let m of r.pluginHooks.contextInit)m(d);let p=$6(r.calendarOptions,h,d),b={dynamicOptionOverrides:n,currentViewType:i,currentDate:f,dateProfile:h,businessHours:this.parseContextBusinessHours(d),eventSources:p,eventUiBases:{},eventStore:Cn(),renderableEventStore:Cn(),dateSelection:null,eventSelection:"",eventDrag:null,eventResize:null,selectionConfig:this.buildViewUiProps(d).selectionConfig},y=Object.assign(Object.assign({},d),b);for(let m of r.pluginHooks.reducers)Object.assign(b,m(null,null,y));Lp(b,d)&&this.emitter.trigger("loading",!0),this.state=b,this.updateData(),this.actionRunner.resume()}resetOptions(e,n){let{props:r}=this;n===void 0?r.optionOverrides=e:(r.optionOverrides=Object.assign(Object.assign({},r.optionOverrides||{}),e),this.optionsForRefining.push(...n)),(n===void 0||n.length)&&this.actionRunner.request({type:"NOTHING"})}_handleAction(e){let{props:n,state:r,emitter:i}=this,c=F6(r.dynamicOptionOverrides,e),d=this.computeOptionsData(n.optionOverrides,c,n.calendarApi),f=H6(r.currentViewType,e),h=this.computeCurrentViewData(f,d,n.optionOverrides,c);n.calendarApi.currentDataManager=this,i.setThisContext(n.calendarApi),i.setOptions(h.options);let p={nowManager:this.nowManager,dateEnv:d.dateEnv,options:d.calendarOptions,pluginHooks:d.pluginHooks,calendarApi:n.calendarApi,dispatch:this.dispatch,emitter:i,getCurrentData:this.getCurrentData},{currentDate:b,dateProfile:y}=r;this.data&&this.data.dateProfileGenerator!==h.dateProfileGenerator&&(y=h.dateProfileGenerator.build(b)),b=G6(b,e),y=q6(y,e,b,h.dateProfileGenerator),(e.type==="PREV"||e.type==="NEXT"||!Pa(y.currentRange,b))&&(b=y.currentRange.start);let m=Y6(r.eventSources,e,y,p),v=$4(r.eventStore,e,m,y,p),S=Ij(m)&&!h.options.progressiveEventRendering&&r.renderableEventStore||v,{eventUiSingleBase:j,selectionConfig:R}=this.buildViewUiProps(p),C=this.buildEventUiBySource(m),O=this.buildEventUiBases(S.defs,j,C),A={dynamicOptionOverrides:c,currentViewType:f,currentDate:b,dateProfile:y,eventSources:m,eventStore:v,renderableEventStore:S,selectionConfig:R,eventUiBases:O,businessHours:this.parseContextBusinessHours(p),dateSelection:eL(r.dateSelection,e),eventSelection:tL(r.eventSelection,e),eventDrag:nL(r.eventDrag,e),eventResize:aL(r.eventResize,e)},k=Object.assign(Object.assign({},p),A);for(let F of d.pluginHooks.reducers)Object.assign(A,F(r,e,k));let _=Lp(r,p),B=Lp(A,p);!_&&B?i.trigger("loading",!0):_&&!B&&i.trigger("loading",!1),this.state=A,n.onAction&&n.onAction(e)}updateData(){let{props:e,state:n}=this,r=this.data,i=this.computeOptionsData(e.optionOverrides,n.dynamicOptionOverrides,e.calendarApi),c=this.computeCurrentViewData(n.currentViewType,i,e.optionOverrides,n.dynamicOptionOverrides),d=this.data=Object.assign(Object.assign(Object.assign({nowManager:this.nowManager,viewTitle:this.buildTitle(n.dateProfile,c.options,i.dateEnv),calendarApi:e.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData},i),c),n),f=i.pluginHooks.optionChangeHandlers,h=r&&r.calendarOptions,p=i.calendarOptions;if(h&&h!==p){h.timeZone!==p.timeZone&&(n.eventSources=d.eventSources=Q6(d.eventSources,n.dateProfile,d),n.eventStore=d.eventStore=k1(d.eventStore,r.dateEnv,d.dateEnv),n.renderableEventStore=d.renderableEventStore=k1(d.renderableEventStore,r.dateEnv,d.dateEnv));for(let b in f)(this.optionsForHandling.indexOf(b)!==-1||h[b]!==p[b])&&f[b](p[b],d)}this.optionsForHandling=[],e.onData&&e.onData(d)}computeOptionsData(e,n,r){if(!this.optionsForRefining.length&&e===this.stableOptionOverrides&&n===this.stableDynamicOptionOverrides)return this.stableCalendarOptionsData;let{refinedOptions:i,pluginHooks:c,localeDefaults:d,availableLocaleData:f,extra:h}=this.processRawCalendarOptions(e,n);F1(h);let p=this.buildDateEnv(i.timeZone,i.locale,i.weekNumberCalculation,i.firstDay,i.weekText,c,f,i.defaultRangeSeparator),b=this.buildViewSpecs(c.views,this.stableOptionOverrides,this.stableDynamicOptionOverrides,d),y=this.buildTheme(i,c),m=this.parseToolbars(i,this.stableOptionOverrides,y,b,r);return this.stableCalendarOptionsData={calendarOptions:i,pluginHooks:c,dateEnv:p,viewSpecs:b,theme:y,toolbarConfig:m,localeDefaults:d,availableRawLocales:f.map}}processRawCalendarOptions(e,n){let{locales:r,locale:i}=Cp([co,e,n]),c=this.organizeRawLocales(r),d=c.map,f=this.buildLocale(i||c.defaultCode,d).options,h=this.buildPluginHooks(e.plugins||[],EL),p=this.currentCalendarOptionsRefiners=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},w1),C1),D1),h.listenerRefiners),h.optionRefiners),b={},y=Cp([co,f,e,n]),m={},v=this.currentCalendarOptionsInput,N=this.currentCalendarOptionsRefined,S=!1;for(let j in y)this.optionsForRefining.indexOf(j)===-1&&(y[j]===v[j]||or[j]&&j in v&&or[j](v[j],y[j]))?m[j]=N[j]:p[j]?(m[j]=p[j](y[j]),S=!0):b[j]=v[j];return S&&(this.currentCalendarOptionsInput=y,this.currentCalendarOptionsRefined=m,this.stableOptionOverrides=e,this.stableDynamicOptionOverrides=n),this.optionsForHandling.push(...this.optionsForRefining),this.optionsForRefining=[],{rawOptions:this.currentCalendarOptionsInput,refinedOptions:this.currentCalendarOptionsRefined,pluginHooks:h,availableLocaleData:c,localeDefaults:f,extra:b}}_computeCurrentViewData(e,n,r,i){let c=n.viewSpecs[e];if(!c)throw new Error(`viewType "${e}" is not available. Please make sure you've loaded all neccessary plugins`);let{refinedOptions:d,extra:f}=this.processRawViewOptions(c,n.pluginHooks,n.localeDefaults,r,i);F1(f),this.nowManager.handleInput(n.dateEnv,d.now);let h=this.buildDateProfileGenerator({dateProfileGeneratorClass:c.optionDefaults.dateProfileGeneratorClass,nowManager:this.nowManager,duration:c.duration,durationUnit:c.durationUnit,usesMinMaxTime:c.optionDefaults.usesMinMaxTime,dateEnv:n.dateEnv,calendarApi:this.props.calendarApi,slotMinTime:d.slotMinTime,slotMaxTime:d.slotMaxTime,showNonCurrentDates:d.showNonCurrentDates,dayCount:d.dayCount,dateAlignment:d.dateAlignment,dateIncrement:d.dateIncrement,hiddenDays:d.hiddenDays,weekends:d.weekends,validRangeInput:d.validRange,visibleRangeInput:d.visibleRange,fixedWeekCount:d.fixedWeekCount}),p=this.buildViewApi(e,this.getCurrentData,n.dateEnv);return{viewSpec:c,options:d,dateProfileGenerator:h,viewApi:p}}processRawViewOptions(e,n,r,i,c){let d=Cp([co,e.optionDefaults,r,i,e.optionOverrides,c]),f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},w1),C1),D1),d4),n.listenerRefiners),n.optionRefiners),h={},p=this.currentViewOptionsInput,b=this.currentViewOptionsRefined,y=!1,m={};for(let v in d)d[v]===p[v]||or[v]&&or[v](d[v],p[v])?h[v]=b[v]:(d[v]===this.currentCalendarOptionsInput[v]||or[v]&&or[v](d[v],this.currentCalendarOptionsInput[v])?v in this.currentCalendarOptionsRefined&&(h[v]=this.currentCalendarOptionsRefined[v]):f[v]?h[v]=f[v](d[v]):m[v]=d[v],y=!0);return y&&(this.currentViewOptionsInput=d,this.currentViewOptionsRefined=h),{rawOptions:this.currentViewOptionsInput,refinedOptions:this.currentViewOptionsRefined,extra:m}}}function CL(t,e,n,r,i,c,d,f){let h=_j(e||d.defaultCode,d.map);return new N4({calendarSystem:"gregory",timeZone:t,namedTimeZoneImpl:c.namedTimeZonedImpl,locale:h,weekNumberCalculation:n,firstDay:r,weekText:i,cmdFormatter:c.cmdFormatter,defaultSeparator:f})}function DL(t,e){let n=e.themeClasses[t.themeSystem]||Hs;return new n(t)}function OL(t){let e=t.dateProfileGeneratorClass||qS;return new e(t)}function RL(t,e,n){return new lL(t,e,n)}function TL(t){return Ha(t,e=>e.ui)}function kL(t,e,n){let r={"":e};for(let i in t){let c=t[i];c.sourceId&&n[c.sourceId]&&(r[i]=n[c.sourceId])}return r}function _L(t){let{options:e}=t;return{eventUiSingleBase:ru({display:e.eventDisplay,editable:e.editable,startEditable:e.eventStartEditable,durationEditable:e.eventDurationEditable,constraint:e.eventConstraint,overlap:typeof e.eventOverlap=="boolean"?e.eventOverlap:void 0,allow:e.eventAllow,backgroundColor:e.eventBackgroundColor,borderColor:e.eventBorderColor,textColor:e.eventTextColor,color:e.eventColor},t),selectionConfig:ru({constraint:e.selectConstraint,overlap:typeof e.selectOverlap=="boolean"?e.selectOverlap:void 0,allow:e.selectAllow},t)}}function Lp(t,e){for(let n of e.pluginHooks.isLoadingFuncs)if(n(t))return!0;return!1}function ML(t){return t3(t.options.businessHours,t)}function F1(t,e){for(let n in t)console.warn(`Unknown option '${n}'`)}class IL extends Ke{render(){let e=this.props.widgetGroups.map(n=>this.renderWidgetGroup(n));return I("div",{className:"fc-toolbar-chunk"},...e)}renderWidgetGroup(e){let{props:n}=this,{theme:r}=this.context,i=[],c=!0;for(let d of e){let{buttonName:f,buttonClick:h,buttonText:p,buttonIcon:b,buttonHint:y}=d;if(f==="title")c=!1,i.push(I("h2",{className:"fc-toolbar-title",id:n.titleId},n.title));else{let m=f===n.activeButton,v=!n.isTodayEnabled&&f==="today"||!n.isPrevEnabled&&f==="prev"||!n.isNextEnabled&&f==="next",N=[`fc-${f}-button`,r.getClass("button")];m&&N.push(r.getClass("buttonActive")),i.push(I("button",{type:"button",title:typeof y=="function"?y(n.navUnit):y,disabled:v,"aria-pressed":m,className:N.join(" "),onClick:h},p||(b?I("span",{className:b,role:"img"}):"")))}}if(i.length>1){let d=c&&r.getClass("buttonGroup")||"";return I("div",{className:d},...i)}return i[0]}}class q1 extends Ke{render(){let{model:e,extraClassName:n}=this.props,r=!1,i,c,d=e.sectionWidgets,f=d.center;return d.left?(r=!0,i=d.left):i=d.start,d.right?(r=!0,c=d.right):c=d.end,I("div",{className:[n||"","fc-toolbar",r?"fc-toolbar-ltr":""].join(" ")},this.renderSection("start",i||[]),this.renderSection("center",f||[]),this.renderSection("end",c||[]))}renderSection(e,n){let{props:r}=this;return I(IL,{key:e,widgetGroups:n,title:r.title,navUnit:r.navUnit,activeButton:r.activeButton,isTodayEnabled:r.isTodayEnabled,isPrevEnabled:r.isPrevEnabled,isNextEnabled:r.isNextEnabled,titleId:r.titleId})}}class LL extends Ke{constructor(){super(...arguments),this.state={availableWidth:null},this.handleEl=e=>{this.el=e,fa(this.props.elRef,e),this.updateAvailableWidth()},this.handleResize=()=>{this.updateAvailableWidth()}}render(){let{props:e,state:n}=this,{aspectRatio:r}=e,i=["fc-view-harness",r||e.liquid||e.height?"fc-view-harness-active":"fc-view-harness-passive"],c="",d="";return r?n.availableWidth!==null?c=n.availableWidth/r:d=`${1/r*100}%`:c=e.height||"",I("div",{"aria-labelledby":e.labeledById,ref:this.handleEl,className:i.join(" "),style:{height:c,paddingBottom:d}},e.children)}componentDidMount(){this.context.addResizeHandler(this.handleResize)}componentWillUnmount(){this.context.removeResizeHandler(this.handleResize)}updateAvailableWidth(){this.el&&this.props.aspectRatio&&this.setState({availableWidth:this.el.offsetWidth})}}class zL extends Jl{constructor(e){super(e),this.handleSegClick=(n,r)=>{let{component:i}=this,{context:c}=i,d=Hl(r);if(d&&i.isValidSegDownEl(n.target)){let f=qt(n.target,".fc-event-forced-url"),h=f?f.querySelector("a[href]").href:"";c.emitter.trigger("eventClick",{el:r,event:new ut(i.context,d.eventRange.def,d.eventRange.instance),jsEvent:n,view:c.viewApi}),h&&!n.defaultPrevented&&(window.location.href=h)}},this.destroy=kS(e.el,"click",".fc-event",this.handleSegClick)}}class PL extends Jl{constructor(e){super(e),this.handleEventElRemove=n=>{n===this.currentSegEl&&this.handleSegLeave(null,this.currentSegEl)},this.handleSegEnter=(n,r)=>{Hl(r)&&(this.currentSegEl=r,this.triggerEvent("eventMouseEnter",n,r))},this.handleSegLeave=(n,r)=>{this.currentSegEl&&(this.currentSegEl=null,this.triggerEvent("eventMouseLeave",n,r))},this.removeHoverListeners=mI(e.el,".fc-event",this.handleSegEnter,this.handleSegLeave)}destroy(){this.removeHoverListeners()}triggerEvent(e,n,r){let{component:i}=this,{context:c}=i,d=Hl(r);(!n||i.isValidSegDownEl(n.target))&&c.emitter.trigger(e,{el:r,event:new ut(c,d.eventRange.def,d.eventRange.instance),jsEvent:n,view:c.viewApi})}}class UL extends _r{constructor(){super(...arguments),this.buildViewContext=we(j4),this.buildViewPropTransformers=we(HL),this.buildToolbarProps=we(BL),this.headerRef=Zt(),this.footerRef=Zt(),this.interactionsStore={},this.state={viewLabelId:wu()},this.registerInteractiveComponent=(e,n)=>{let r=S3(e,n),d=[zL,PL].concat(this.props.pluginHooks.componentInteractions).map(f=>new f(r));this.interactionsStore[e.uid]=d,sg[e.uid]=r},this.unregisterInteractiveComponent=e=>{let n=this.interactionsStore[e.uid];if(n){for(let r of n)r.destroy();delete this.interactionsStore[e.uid]}delete sg[e.uid]},this.resizeRunner=new am(()=>{this.props.emitter.trigger("_resize",!0),this.props.emitter.trigger("windowResize",{view:this.props.viewApi})}),this.handleWindowResize=e=>{let{options:n}=this.props;n.handleWindowResize&&e.target===window&&this.resizeRunner.request(n.windowResizeDelay)}}render(){let{props:e}=this,{toolbarConfig:n,options:r}=e,i=!1,c="",d;e.isHeightAuto||e.forPrint?c="":r.height!=null?i=!0:r.contentHeight!=null?c=r.contentHeight:d=Math.max(r.aspectRatio,.5);let f=this.buildViewContext(e.viewSpec,e.viewApi,e.options,e.dateProfileGenerator,e.dateEnv,e.nowManager,e.theme,e.pluginHooks,e.dispatch,e.getCurrentData,e.emitter,e.calendarApi,this.registerInteractiveComponent,this.unregisterInteractiveComponent),h=n.header&&n.header.hasTitle?this.state.viewLabelId:void 0;return I(Fa.Provider,{value:f},I(ei,{unit:"day"},p=>{let b=this.buildToolbarProps(e.viewSpec,e.dateProfile,e.dateProfileGenerator,e.currentDate,p,e.viewTitle);return I(lt,null,n.header&&I(q1,Object.assign({ref:this.headerRef,extraClassName:"fc-header-toolbar",model:n.header,titleId:h},b)),I(LL,{liquid:i,height:c,aspectRatio:d,labeledById:h},this.renderView(e),this.buildAppendContent()),n.footer&&I(q1,Object.assign({ref:this.footerRef,extraClassName:"fc-footer-toolbar",model:n.footer,titleId:""},b)))}))}componentDidMount(){let{props:e}=this;this.calendarInteractions=e.pluginHooks.calendarInteractions.map(r=>new r(e)),window.addEventListener("resize",this.handleWindowResize);let{propSetHandlers:n}=e.pluginHooks;for(let r in n)n[r](e[r],e)}componentDidUpdate(e){let{props:n}=this,{propSetHandlers:r}=n.pluginHooks;for(let i in r)n[i]!==e[i]&&r[i](n[i],n)}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.resizeRunner.clear();for(let e of this.calendarInteractions)e.destroy();this.props.emitter.trigger("_unmount")}buildAppendContent(){let{props:e}=this,n=e.pluginHooks.viewContainerAppends.map(r=>r(e));return I(lt,{},...n)}renderView(e){let{pluginHooks:n}=e,{viewSpec:r}=e,i={dateProfile:e.dateProfile,businessHours:e.businessHours,eventStore:e.renderableEventStore,eventUiBases:e.eventUiBases,dateSelection:e.dateSelection,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,isHeightAuto:e.isHeightAuto,forPrint:e.forPrint},c=this.buildViewPropTransformers(n.viewPropsTransformers);for(let f of c)Object.assign(i,f.transform(i,e));let d=r.component;return I(d,Object.assign({},i))}}function BL(t,e,n,r,i,c){let d=n.build(i,void 0,!1),f=n.buildPrev(e,r,!1),h=n.buildNext(e,r,!1);return{title:c,activeButton:t.type,navUnit:t.singleUnit,isTodayEnabled:d.isValid&&!Pa(e.currentRange,i),isPrevEnabled:f.isValid,isNextEnabled:h.isValid}}function HL(t){return t.map(e=>new e)}class GL extends A3{constructor(e,n={}){super(),this.isRendering=!1,this.isRendered=!1,this.currentClassNames=[],this.customContentRenderId=0,this.handleAction=r=>{switch(r.type){case"SET_EVENT_DRAG":case"SET_EVENT_RESIZE":this.renderRunner.tryDrain()}},this.handleData=r=>{this.currentData=r,this.renderRunner.request(r.calendarOptions.rerenderDelay)},this.handleRenderRequest=()=>{if(this.isRendering){this.isRendered=!0;let{currentData:r}=this;nu(()=>{No(I(E3,{options:r.calendarOptions,theme:r.theme,emitter:r.emitter},(i,c,d,f)=>(this.setClassNames(i),this.setHeight(c),I(HS.Provider,{value:this.customContentRenderId},I(UL,Object.assign({isHeightAuto:d,forPrint:f},r))))),this.el)})}else this.isRendered&&(this.isRendered=!1,No(null,this.el),this.setClassNames([]),this.setHeight(""))},iI(e),this.el=e,this.renderRunner=new am(this.handleRenderRequest),new wL({optionOverrides:n,calendarApi:this,onAction:this.handleAction,onData:this.handleData})}render(){let e=this.isRendering;e?this.customContentRenderId+=1:this.isRendering=!0,this.renderRunner.request(),e&&this.updateSize()}destroy(){this.isRendering&&(this.isRendering=!1,this.renderRunner.request())}updateSize(){nu(()=>{super.updateSize()})}batchRendering(e){this.renderRunner.pause("batchRendering"),e(),this.renderRunner.resume("batchRendering")}pauseRendering(){this.renderRunner.pause("pauseRendering")}resumeRendering(){this.renderRunner.resume("pauseRendering",!0)}resetOptions(e,n){this.currentDataManager.resetOptions(e,n)}setClassNames(e){if(!Ps(e,this.currentClassNames)){let{classList:n}=this.el;for(let r of this.currentClassNames)n.remove(r);for(let r of e)n.add(r);this.currentClassNames=e}}setHeight(e){RS(this.el,"height",e)}}const VL=parseInt(String(Ve.version).split(".")[0]),FL=VL<18;class Bj extends w.Component{constructor(){super(...arguments),this.elRef=w.createRef(),this.isUpdating=!1,this.isUnmounting=!1,this.state={customRenderingMap:new Map},this.requestResize=()=>{this.isUnmounting||(this.cancelResize(),this.resizeId=requestAnimationFrame(()=>{this.doResize()}))}}render(){const e=[];for(const n of this.state.customRenderingMap.values())e.push(Ve.createElement(qL,{key:n.id,customRendering:n}));return Ve.createElement("div",{ref:this.elRef},e)}componentDidMount(){this.isUnmounting=!1;const e=new w6;this.handleCustomRendering=e.handle.bind(e),this.calendar=new GL(this.elRef.current,Object.assign(Object.assign({},this.props),{handleCustomRendering:this.handleCustomRendering})),this.calendar.render(),this.calendar.on("_beforeprint",()=>{wr.flushSync(()=>{})});let n;e.subscribe(r=>{const i=Date.now(),c=!n;(FL||c||this.isUpdating||this.isUnmounting||i-n<100?Hj:wr.flushSync)(()=>{this.setState({customRenderingMap:r},()=>{n=i,c?this.doResize():this.requestResize()})})})}componentDidUpdate(){this.isUpdating=!0,this.calendar.resetOptions(Object.assign(Object.assign({},this.props),{handleCustomRendering:this.handleCustomRendering})),this.isUpdating=!1}componentWillUnmount(){this.isUnmounting=!0,this.cancelResize(),this.calendar.destroy()}doResize(){this.calendar.updateSize()}cancelResize(){this.resizeId!==void 0&&(cancelAnimationFrame(this.resizeId),this.resizeId=void 0)}getApi(){return this.calendar}}Bj.act=Hj;class qL extends w.PureComponent{render(){const{customRendering:e}=this.props,{generatorMeta:n}=e,r=typeof n=="function"?n(e.renderProps):n;return wr.createPortal(r,e.containerEl)}}function Hj(t){t()}class $L extends pa{constructor(){super(...arguments),this.headerElRef=Zt()}renderSimpleLayout(e,n){let{props:r,context:i}=this,c=[],d=ou(i.options);return e&&c.push({type:"header",key:"header",isSticky:d,chunk:{elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}}),c.push({type:"body",key:"body",liquid:!0,chunk:{content:n}}),I(au,{elClasses:["fc-daygrid"],viewSpec:i.viewSpec},I(Cm,{liquid:!r.isHeightAuto&&!r.forPrint,collapsibleWidth:r.forPrint,cols:[],sections:c}))}renderHScrollLayout(e,n,r,i){let c=this.context.pluginHooks.scrollGridImpl;if(!c)throw new Error("No ScrollGrid implementation");let{props:d,context:f}=this,h=!d.forPrint&&ou(f.options),p=!d.forPrint&&Aj(f.options),b=[];return e&&b.push({type:"header",key:"header",isSticky:h,chunks:[{key:"main",elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}]}),b.push({type:"body",key:"body",liquid:!0,chunks:[{key:"main",content:n}]}),p&&b.push({type:"footer",key:"footer",isSticky:!0,chunks:[{key:"main",content:ig}]}),I(au,{elClasses:["fc-daygrid"],viewSpec:f.viewSpec},I(c,{liquid:!d.isHeightAuto&&!d.forPrint,forPrint:d.forPrint,collapsibleWidth:d.forPrint,colGroups:[{cols:[{span:r,minWidth:i}]}],sections:b}))}}function kd(t,e){let n=[];for(let r=0;r{let i=(e.eventDrag?e.eventDrag.affectedInstances:null)||(e.eventResize?e.eventResize.affectedInstances:null)||{};return I(lt,null,n.map(c=>{let d=c.eventRange.instance.instanceId;return I("div",{className:"fc-daygrid-event-harness",key:d,style:{visibility:i[d]?"hidden":""}},Vj(c)?I(qj,Object.assign({seg:c,isDragging:!1,isSelected:d===e.eventSelection,defaultDisplayEventEnd:!1},Ms(c,e.todayRange))):I(Fj,Object.assign({seg:c,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:d===e.eventSelection,defaultDisplayEventEnd:!1},Ms(c,e.todayRange))))}))}})}}function WL(t){let e=[],n=[];for(let r of t)e.push(r.seg),r.isVisible||n.push(r.seg);return{allSegs:e,invisibleSegs:n}}const XL=ht({week:"narrow"});class ZL extends pa{constructor(){super(...arguments),this.rootElRef=Zt(),this.state={dayNumberId:wu()},this.handleRootEl=e=>{fa(this.rootElRef,e),fa(this.props.elRef,e)}}render(){let{context:e,props:n,state:r,rootElRef:i}=this,{options:c,dateEnv:d}=e,{date:f,dateProfile:h}=n;const p=n.showDayNumber&&JL(f,h.currentRange,d);return I(Tm,{elTag:"td",elRef:this.handleRootEl,elClasses:["fc-daygrid-day",...n.extraClassNames||[]],elAttrs:Object.assign(Object.assign(Object.assign({},n.extraDataAttrs),n.showDayNumber?{"aria-labelledby":r.dayNumberId}:{}),{role:"gridcell"}),defaultGenerator:KL,date:f,dateProfile:h,todayRange:n.todayRange,showDayNumber:n.showDayNumber,isMonthStart:p,extraRenderProps:n.extraRenderProps},(b,y)=>I("div",{ref:n.innerElRef,className:"fc-daygrid-day-frame fc-scrollgrid-sync-inner",style:{minHeight:n.minHeight}},n.showWeekNumber&&I(Dj,{elTag:"a",elClasses:["fc-daygrid-week-number"],elAttrs:iu(e,f,"week"),date:f,defaultFormat:XL}),!y.isDisabled&&(n.showDayNumber||km(c)||n.forceDayTop)?I("div",{className:"fc-daygrid-day-top"},I(b,{elTag:"a",elClasses:["fc-daygrid-day-number",p&&"fc-daygrid-month-start"],elAttrs:Object.assign(Object.assign({},iu(e,f)),{id:r.dayNumberId})})):n.showDayNumber?I("div",{className:"fc-daygrid-day-top",style:{visibility:"hidden"}},I("a",{className:"fc-daygrid-day-number"}," ")):void 0,I("div",{className:"fc-daygrid-day-events",ref:n.fgContentElRef},n.fgContent,I("div",{className:"fc-daygrid-day-bottom",style:{marginTop:n.moreMarginTop}},I(QL,{allDayDate:f,singlePlacements:n.singlePlacements,moreCnt:n.moreCnt,alignmentElRef:i,alignGridTop:!n.showDayNumber,extraDateSpan:n.extraDateSpan,dateProfile:n.dateProfile,eventSelection:n.eventSelection,eventDrag:n.eventDrag,eventResize:n.eventResize,todayRange:n.todayRange}))),I("div",{className:"fc-daygrid-day-bg"},n.bgContent)))}}function KL(t){return t.dayNumberText||I(lt,null," ")}function JL(t,e,n){const{start:r,end:i}=e,c=Us(i,-1),d=n.getYear(r),f=n.getMonth(r),h=n.getYear(c),p=n.getMonth(c);return!(d===h&&f===p)&&(t.valueOf()===r.valueOf()||n.getDay(t)===1&&t.valueOf(){let C=t[R.index].eventRange.instance.instanceId+":"+R.span.start+":"+(R.span.end-1);return i[C]||1});f.allowReslicing=!0,f.strictOrder=r,e===!0||n===!0?(f.maxCoord=c,f.hiddenConsumes=!0):typeof e=="number"?f.maxStackCnt=e:typeof n=="number"&&(f.maxStackCnt=n,f.hiddenConsumes=!0);let h=[],p=[];for(let R=0;R1,j=v.span.start===f;y+=v.levelCoord-b,b=v.levelCoord+v.thickness,S?(y+=v.thickness,j&&m.push({seg:Sl(N,v.span.start,v.span.end,n),isVisible:!0,isAbsolute:!0,absoluteTop:v.levelCoord,marginTop:0})):j&&(m.push({seg:Sl(N,v.span.start,v.span.end,n),isVisible:!0,isAbsolute:!1,absoluteTop:v.levelCoord,marginTop:y}),y=0)}i.push(p),c.push(m),d.push(y)}return{singleColPlacements:i,multiColPlacements:c,leftoverMargins:d}}function nz(t,e){let n=[];for(let r=0;r!this.forceHidden[Ar(c)];for(let c=0;c{e&&this.updateSizing(!0)}}render(){let{props:e,state:n,context:r}=this,{options:i}=r,c=e.cells.length,d=Nd(e.businessHourSegs,c),f=Nd(e.bgEventSegs,c),h=Nd(this.getHighlightSegs(),c),p=Nd(this.getMirrorSegs(),c),{singleColPlacements:b,multiColPlacements:y,moreCnts:m,moreMarginTops:v}=ez(aj(e.fgEventSegs,i.eventOrder),e.dayMaxEvents,e.dayMaxEventRows,i.eventOrderStrict,n.segHeights,n.maxContentHeight,e.cells),N=e.eventDrag&&e.eventDrag.affectedInstances||e.eventResize&&e.eventResize.affectedInstances||{};return I("tr",{ref:this.rootElRef,role:"row"},e.renderIntro&&e.renderIntro(),e.cells.map((S,j)=>{let R=this.renderFgSegs(j,e.forPrint?b[j]:y[j],e.todayRange,N),C=this.renderFgSegs(j,sz(p[j],y),e.todayRange,{},!!e.eventDrag,!!e.eventResize,!1);return I(ZL,{key:S.key,elRef:this.cellElRefs.createRef(S.key),innerElRef:this.frameElRefs.createRef(S.key),dateProfile:e.dateProfile,date:S.date,showDayNumber:e.showDayNumbers,showWeekNumber:e.showWeekNumbers&&j===0,forceDayTop:e.showWeekNumbers,todayRange:e.todayRange,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,extraRenderProps:S.extraRenderProps,extraDataAttrs:S.extraDataAttrs,extraClassNames:S.extraClassNames,extraDateSpan:S.extraDateSpan,moreCnt:m[j],moreMarginTop:v[j],singlePlacements:b[j],fgContentElRef:this.fgElRefs.createRef(S.key),fgContent:I(lt,null,I(lt,null,R),I(lt,null,C)),bgContent:I(lt,null,this.renderFillSegs(h[j],"highlight"),this.renderFillSegs(d[j],"non-business"),this.renderFillSegs(f[j],"bg-event")),minHeight:e.cellMinHeight})}))}componentDidMount(){this.updateSizing(!0),this.context.addResizeHandler(this.handleResize)}componentDidUpdate(e,n){let r=this.props;this.updateSizing(!ta(e,r))}componentWillUnmount(){this.context.removeResizeHandler(this.handleResize)}getHighlightSegs(){let{props:e}=this;return e.eventDrag&&e.eventDrag.segs.length?e.eventDrag.segs:e.eventResize&&e.eventResize.segs.length?e.eventResize.segs:e.dateSelectionSegs}getMirrorSegs(){let{props:e}=this;return e.eventResize&&e.eventResize.segs.length?e.eventResize.segs:[]}renderFgSegs(e,n,r,i,c,d,f){let{context:h}=this,{eventSelection:p}=this.props,{framePositions:b}=this.state,y=this.props.cells.length===1,m=c||d||f,v=[];if(b)for(let N of n){let{seg:S}=N,{instanceId:j}=S.eventRange.instance,R=N.isVisible&&!i[j],C=N.isAbsolute,O="",A="";C&&(h.isRtl?(A=0,O=b.lefts[S.lastCol]-b.lefts[S.firstCol]):(O=0,A=b.rights[S.firstCol]-b.rights[S.lastCol])),v.push(I("div",{className:"fc-daygrid-event-harness"+(C?" fc-daygrid-event-harness-abs":""),key:$j(S),ref:m?null:this.segHarnessRefs.createRef(Yj(S)),style:{visibility:R?"":"hidden",marginTop:C?"":N.marginTop,top:C?N.absoluteTop:"",left:O,right:A}},Vj(S)?I(qj,Object.assign({seg:S,isDragging:c,isSelected:j===p,defaultDisplayEventEnd:y},Ms(S,r))):I(Fj,Object.assign({seg:S,isDragging:c,isResizing:d,isDateSelecting:f,isSelected:j===p,defaultDisplayEventEnd:y},Ms(S,r)))))}return v}renderFillSegs(e,n){let{isRtl:r}=this.context,{todayRange:i}=this.props,{framePositions:c}=this.state,d=[];if(c)for(let f of e){let h=r?{right:0,left:c.lefts[f.lastCol]-c.lefts[f.firstCol]}:{left:0,right:c.rights[f.firstCol]-c.rights[f.lastCol]};d.push(I("div",{key:rj(f.eventRange),className:"fc-daygrid-bg-harness",style:h},n==="bg-event"?I(wj,Object.assign({seg:f},Ms(f,i))):Cj(n)))}return I(lt,{},...d)}updateSizing(e){let{props:n,state:r,frameElRefs:i}=this;if(!n.forPrint&&n.clientWidth!==null){if(e){let h=n.cells.map(p=>i.currentMap[p.key]);if(h.length){let p=this.rootElRef.current,b=new Gl(p,h,!0,!1);(!r.framePositions||!r.framePositions.similarTo(b))&&this.setState({framePositions:new Gl(p,h,!0,!1)})}}const c=this.state.segHeights,d=this.querySegHeights(),f=n.dayMaxEvents===!0||n.dayMaxEventRows===!0;this.safeSetState({segHeights:Object.assign(Object.assign({},c),d),maxContentHeight:f?this.computeMaxContentHeight():null})}}querySegHeights(){let e=this.segHarnessRefs.currentMap,n={};for(let r in e){let i=Math.round(e[r].getBoundingClientRect().height);n[r]=Math.max(n[r]||0,i)}return n}computeMaxContentHeight(){let e=this.props.cells[0].key,n=this.cellElRefs.currentMap[e],r=this.fgElRefs.currentMap[e];return n.getBoundingClientRect().bottom-r.getBoundingClientRect().top}getCellEls(){let e=this.cellElRefs.currentMap;return this.props.cells.map(n=>e[n.key])}}Qj.addStateEquality({segHeights:ta});function sz(t,e){if(!t.length)return[];let n=rz(e);return t.map(r=>({seg:r,isVisible:!0,isAbsolute:!0,absoluteTop:n[r.eventRange.instance.instanceId],marginTop:0}))}function rz(t){let e={};for(let n of t)for(let r of n)e[r.seg.eventRange.instance.instanceId]=r.absoluteTop;return e}class lz extends pa{constructor(){super(...arguments),this.splitBusinessHourSegs=we(kd),this.splitBgEventSegs=we(iz),this.splitFgEventSegs=we(kd),this.splitDateSelectionSegs=we(kd),this.splitEventDrag=we($1),this.splitEventResize=we($1),this.rowRefs=new La}render(){let{props:e,context:n}=this,r=e.cells.length,i=this.splitBusinessHourSegs(e.businessHourSegs,r),c=this.splitBgEventSegs(e.bgEventSegs,r),d=this.splitFgEventSegs(e.fgEventSegs,r),f=this.splitDateSelectionSegs(e.dateSelectionSegs,r),h=this.splitEventDrag(e.eventDrag,r),p=this.splitEventResize(e.eventResize,r),b=r>=7&&e.clientWidth?e.clientWidth/n.options.aspectRatio/6:null;return I(ei,{unit:"day"},(y,m)=>I(lt,null,e.cells.map((v,N)=>I(Qj,{ref:this.rowRefs.createRef(N),key:v.length?v[0].date.toISOString():N,showDayNumbers:r>1,showWeekNumbers:e.showWeekNumbers,todayRange:m,dateProfile:e.dateProfile,cells:v,renderIntro:e.renderRowIntro,businessHourSegs:i[N],eventSelection:e.eventSelection,bgEventSegs:c[N],fgEventSegs:d[N],dateSelectionSegs:f[N],eventDrag:h[N],eventResize:p[N],dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,clientWidth:e.clientWidth,clientHeight:e.clientHeight,cellMinHeight:b,forPrint:e.forPrint}))))}componentDidMount(){this.registerInteractiveComponent()}componentDidUpdate(){this.registerInteractiveComponent()}registerInteractiveComponent(){if(!this.rootEl){const e=this.rowRefs.currentMap[0].getCellEls()[0],n=e?e.closest(".fc-daygrid-body"):null;n&&(this.rootEl=n,this.context.registerInteractiveComponent(this,{el:n,isHitComboAllowed:this.props.isHitComboAllowed}))}}componentWillUnmount(){this.rootEl&&(this.context.unregisterInteractiveComponent(this),this.rootEl=null)}prepareHits(){this.rowPositions=new Gl(this.rootEl,this.rowRefs.collect().map(e=>e.getCellEls()[0]),!1,!0),this.colPositions=new Gl(this.rootEl,this.rowRefs.currentMap[0].getCellEls(),!0,!1)}queryHit(e,n){let{colPositions:r,rowPositions:i}=this,c=r.leftToIndex(e),d=i.topToIndex(n);if(d!=null&&c!=null){let f=this.props.cells[d][c];return{dateProfile:this.props.dateProfile,dateSpan:Object.assign({range:this.getCellRange(d,c),allDay:!0},f.extraDateSpan),dayEl:this.getCellEl(d,c),rect:{left:r.lefts[c],right:r.rights[c],top:i.tops[d],bottom:i.bottoms[d]},layer:0}}return null}getCellEl(e,n){return this.rowRefs.currentMap[e].getCellEls()[n]}getCellRange(e,n){let r=this.props.cells[e][n].date,i=_t(r,1);return{start:r,end:i}}}function iz(t,e){return kd(t.filter(oz),e)}function oz(t){return t.eventRange.def.allDay}class cz extends pa{constructor(){super(...arguments),this.elRef=Zt(),this.needsScrollReset=!1}render(){let{props:e}=this,{dayMaxEventRows:n,dayMaxEvents:r,expandRows:i}=e,c=r===!0||n===!0;c&&!i&&(c=!1,n=null,r=null);let d=["fc-daygrid-body",c?"fc-daygrid-body-balanced":"fc-daygrid-body-unbalanced",i?"":"fc-daygrid-body-natural"];return I("div",{ref:this.elRef,className:d.join(" "),style:{width:e.clientWidth,minWidth:e.tableMinWidth}},I("table",{role:"presentation",className:"fc-scrollgrid-sync-table",style:{width:e.clientWidth,minWidth:e.tableMinWidth,height:i?e.clientHeight:""}},e.colGroupNode,I("tbody",{role:"presentation"},I(lz,{dateProfile:e.dateProfile,cells:e.cells,renderRowIntro:e.renderRowIntro,showWeekNumbers:e.showWeekNumbers,clientWidth:e.clientWidth,clientHeight:e.clientHeight,businessHourSegs:e.businessHourSegs,bgEventSegs:e.bgEventSegs,fgEventSegs:e.fgEventSegs,dateSelectionSegs:e.dateSelectionSegs,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,dayMaxEvents:r,dayMaxEventRows:n,forPrint:e.forPrint,isHitComboAllowed:e.isHitComboAllowed}))))}componentDidMount(){this.requestScrollReset()}componentDidUpdate(e){e.dateProfile!==this.props.dateProfile?this.requestScrollReset():this.flushScrollReset()}requestScrollReset(){this.needsScrollReset=!0,this.flushScrollReset()}flushScrollReset(){if(this.needsScrollReset&&this.props.clientWidth){const e=dz(this.elRef.current,this.props.dateProfile);if(e){const n=e.closest(".fc-daygrid-body"),r=n.closest(".fc-scroller"),i=e.getBoundingClientRect().top-n.getBoundingClientRect().top;r.scrollTop=i?i+1:0}this.needsScrollReset=!1}}}function dz(t,e){let n;return e.currentRangeUnit.match(/year|month/)&&(n=t.querySelector(`[data-date="${YI(e.currentDate)}-01"]`)),n||(n=t.querySelector(`[data-date="${om(e.currentDate)}"]`)),n}class uz extends vj{constructor(){super(...arguments),this.forceDayIfListItem=!0}sliceRange(e,n){return n.sliceRange(e)}}class Wj extends pa{constructor(){super(...arguments),this.slicer=new uz,this.tableRef=Zt()}render(){let{props:e,context:n}=this;return I(cz,Object.assign({ref:this.tableRef},this.slicer.sliceProps(e,e.dateProfile,e.nextDayThreshold,n,e.dayTableModel),{dateProfile:e.dateProfile,cells:e.dayTableModel.cells,colGroupNode:e.colGroupNode,tableMinWidth:e.tableMinWidth,renderRowIntro:e.renderRowIntro,dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,showWeekNumbers:e.showWeekNumbers,expandRows:e.expandRows,headerAlignElRef:e.headerAlignElRef,clientWidth:e.clientWidth,clientHeight:e.clientHeight,forPrint:e.forPrint}))}}class fz extends $L{constructor(){super(...arguments),this.buildDayTableModel=we(hz),this.headerRef=Zt(),this.tableRef=Zt()}render(){let{options:e,dateProfileGenerator:n}=this.context,{props:r}=this,i=this.buildDayTableModel(r.dateProfile,n),c=e.dayHeaders&&I(xj,{ref:this.headerRef,dateProfile:r.dateProfile,dates:i.headerDates,datesRepDistinctDays:i.rowCnt===1}),d=f=>I(Wj,{ref:this.tableRef,dateProfile:r.dateProfile,dayTableModel:i,businessHours:r.businessHours,dateSelection:r.dateSelection,eventStore:r.eventStore,eventUiBases:r.eventUiBases,eventSelection:r.eventSelection,eventDrag:r.eventDrag,eventResize:r.eventResize,nextDayThreshold:e.nextDayThreshold,colGroupNode:f.tableColGroupNode,tableMinWidth:f.tableMinWidth,dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,showWeekNumbers:e.weekNumbers,expandRows:!r.isHeightAuto,headerAlignElRef:this.headerElRef,clientWidth:f.clientWidth,clientHeight:f.clientHeight,forPrint:r.forPrint});return e.dayMinWidth?this.renderHScrollLayout(c,d,i.colCnt,e.dayMinWidth):this.renderSimpleLayout(c,d)}}function hz(t,e){let n=new bj(t.renderRange,e);return new yj(n,/year|month|week/.test(t.currentRangeUnit))}class pz extends qS{buildRenderRange(e,n,r){let i=super.buildRenderRange(e,n,r),{props:c}=this;return gz({currentRange:i,snapToWeek:/^(year|month)$/.test(n),fixedWeekCount:c.fixedWeekCount,dateEnv:c.dateEnv})}}function gz(t){let{dateEnv:e,currentRange:n}=t,{start:r,end:i}=n,c;if(t.snapToWeek&&(r=e.startOfWeek(r),c=e.startOfWeek(i),c.valueOf()!==i.valueOf()&&(i=N1(c,1))),t.fixedWeekCount){let d=e.startOfWeek(e.startOfMonth(_t(n.end,-1))),f=Math.ceil(LI(d,i));i=N1(i,6-f)}return{start:r,end:i}}var mz=':root{--fc-daygrid-event-dot-width:8px}.fc-daygrid-day-events:after,.fc-daygrid-day-events:before,.fc-daygrid-day-frame:after,.fc-daygrid-day-frame:before,.fc-daygrid-event-harness:after,.fc-daygrid-event-harness:before{clear:both;content:"";display:table}.fc .fc-daygrid-body{position:relative;z-index:1}.fc .fc-daygrid-day.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-daygrid-day-frame{min-height:100%;position:relative}.fc .fc-daygrid-day-top{display:flex;flex-direction:row-reverse}.fc .fc-day-other .fc-daygrid-day-top{opacity:.3}.fc .fc-daygrid-day-number{padding:4px;position:relative;z-index:4}.fc .fc-daygrid-month-start{font-size:1.1em;font-weight:700}.fc .fc-daygrid-day-events{margin-top:1px}.fc .fc-daygrid-body-balanced .fc-daygrid-day-events{left:0;position:absolute;right:0}.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events{min-height:2em;position:relative}.fc .fc-daygrid-body-natural .fc-daygrid-day-events{margin-bottom:1em}.fc .fc-daygrid-event-harness{position:relative}.fc .fc-daygrid-event-harness-abs{left:0;position:absolute;right:0;top:0}.fc .fc-daygrid-bg-harness{bottom:0;position:absolute;top:0}.fc .fc-daygrid-day-bg .fc-non-business{z-index:1}.fc .fc-daygrid-day-bg .fc-bg-event{z-index:2}.fc .fc-daygrid-day-bg .fc-highlight{z-index:3}.fc .fc-daygrid-event{margin-top:1px;z-index:6}.fc .fc-daygrid-event.fc-event-mirror{z-index:7}.fc .fc-daygrid-day-bottom{font-size:.85em;margin:0 2px}.fc .fc-daygrid-day-bottom:after,.fc .fc-daygrid-day-bottom:before{clear:both;content:"";display:table}.fc .fc-daygrid-more-link{border-radius:3px;cursor:pointer;line-height:1;margin-top:1px;max-width:100%;overflow:hidden;padding:2px;position:relative;white-space:nowrap;z-index:4}.fc .fc-daygrid-more-link:hover{background-color:rgba(0,0,0,.1)}.fc .fc-daygrid-week-number{background-color:var(--fc-neutral-bg-color);color:var(--fc-neutral-text-color);min-width:1.5em;padding:2px;position:absolute;text-align:center;top:0;z-index:5}.fc .fc-more-popover .fc-popover-body{min-width:220px;padding:10px}.fc-direction-ltr .fc-daygrid-event.fc-event-start,.fc-direction-rtl .fc-daygrid-event.fc-event-end{margin-left:2px}.fc-direction-ltr .fc-daygrid-event.fc-event-end,.fc-direction-rtl .fc-daygrid-event.fc-event-start{margin-right:2px}.fc-direction-ltr .fc-daygrid-more-link{float:left}.fc-direction-ltr .fc-daygrid-week-number{border-radius:0 0 3px 0;left:0}.fc-direction-rtl .fc-daygrid-more-link{float:right}.fc-direction-rtl .fc-daygrid-week-number{border-radius:0 0 0 3px;right:0}.fc-liquid-hack .fc-daygrid-day-frame{position:static}.fc-daygrid-event{border-radius:3px;font-size:var(--fc-small-font-size);position:relative;white-space:nowrap}.fc-daygrid-block-event .fc-event-time{font-weight:700}.fc-daygrid-block-event .fc-event-time,.fc-daygrid-block-event .fc-event-title{padding:1px}.fc-daygrid-dot-event{align-items:center;display:flex;padding:2px 0}.fc-daygrid-dot-event .fc-event-title{flex-grow:1;flex-shrink:1;font-weight:700;min-width:0;overflow:hidden}.fc-daygrid-dot-event.fc-event-mirror,.fc-daygrid-dot-event:hover{background:rgba(0,0,0,.1)}.fc-daygrid-dot-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-daygrid-event-dot{border:calc(var(--fc-daygrid-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-daygrid-event-dot-width)/2);box-sizing:content-box;height:0;margin:0 4px;width:0}.fc-direction-ltr .fc-daygrid-event .fc-event-time{margin-right:3px}.fc-direction-rtl .fc-daygrid-event .fc-event-time{margin-left:3px}';nm(mz);var xz=qa({name:"@fullcalendar/daygrid",initialView:"dayGridMonth",views:{dayGrid:{component:fz,dateProfileGeneratorClass:pz},dayGridDay:{type:"dayGrid",duration:{days:1}},dayGridWeek:{type:"dayGrid",duration:{weeks:1}},dayGridMonth:{type:"dayGrid",duration:{months:1},fixedWeekCount:!0},dayGridYear:{type:"dayGrid",duration:{years:1}}}});class bz extends R3{getKeyInfo(){return{allDay:{},timed:{}}}getKeysForDateSpan(e){return e.allDay?["allDay"]:["timed"]}getKeysForEventDef(e){return e.allDay?l3(e)?["timed","allDay"]:["allDay"]:["timed"]}}const yz=ht({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"short"});function Xj(t){let e=["fc-timegrid-slot","fc-timegrid-slot-label",t.isLabeled?"fc-scrollgrid-shrink":"fc-timegrid-slot-minor"];return I(Fa.Consumer,null,n=>{if(!t.isLabeled)return I("td",{className:e.join(" "),"data-time":t.isoTimeStr});let{dateEnv:r,options:i,viewApi:c}=n,d=i.slotLabelFormat==null?yz:Array.isArray(i.slotLabelFormat)?ht(i.slotLabelFormat[0]):ht(i.slotLabelFormat),f={level:0,time:t.time,date:r.toDate(t.date),view:c,text:r.format(t.date,d)};return I(On,{elTag:"td",elClasses:e,elAttrs:{"data-time":t.isoTimeStr},renderProps:f,generatorName:"slotLabelContent",customGenerator:i.slotLabelContent,defaultGenerator:vz,classNameGenerator:i.slotLabelClassNames,didMount:i.slotLabelDidMount,willUnmount:i.slotLabelWillUnmount},h=>I("div",{className:"fc-timegrid-slot-label-frame fc-scrollgrid-shrink-frame"},I(h,{elTag:"div",elClasses:["fc-timegrid-slot-label-cushion","fc-scrollgrid-shrink-cushion"]})))})}function vz(t){return t.text}class Nz extends Ke{render(){return this.props.slatMetas.map(e=>I("tr",{key:e.key},I(Xj,Object.assign({},e))))}}const Ez=ht({week:"short"}),Sz=5;class jz extends pa{constructor(){super(...arguments),this.allDaySplitter=new bz,this.headerElRef=Zt(),this.rootElRef=Zt(),this.scrollerElRef=Zt(),this.state={slatCoords:null},this.handleScrollTopRequest=e=>{let n=this.scrollerElRef.current;n&&(n.scrollTop=e)},this.renderHeadAxis=(e,n="")=>{let{options:r}=this.context,{dateProfile:i}=this.props,c=i.renderRange,f=kr(c.start,c.end)===1?iu(this.context,c.start,"week"):{};return r.weekNumbers&&e==="day"?I(Dj,{elTag:"th",elClasses:["fc-timegrid-axis","fc-scrollgrid-shrink"],elAttrs:{"aria-hidden":!0},date:c.start,defaultFormat:Ez},h=>I("div",{className:["fc-timegrid-axis-frame","fc-scrollgrid-shrink-frame","fc-timegrid-axis-frame-liquid"].join(" "),style:{height:n}},I(h,{elTag:"a",elClasses:["fc-timegrid-axis-cushion","fc-scrollgrid-shrink-cushion","fc-scrollgrid-sync-inner"],elAttrs:f}))):I("th",{"aria-hidden":!0,className:"fc-timegrid-axis"},I("div",{className:"fc-timegrid-axis-frame",style:{height:n}}))},this.renderTableRowAxis=e=>{let{options:n,viewApi:r}=this.context,i={text:n.allDayText,view:r};return I(On,{elTag:"td",elClasses:["fc-timegrid-axis","fc-scrollgrid-shrink"],elAttrs:{"aria-hidden":!0},renderProps:i,generatorName:"allDayContent",customGenerator:n.allDayContent,defaultGenerator:Az,classNameGenerator:n.allDayClassNames,didMount:n.allDayDidMount,willUnmount:n.allDayWillUnmount},c=>I("div",{className:["fc-timegrid-axis-frame","fc-scrollgrid-shrink-frame",e==null?" fc-timegrid-axis-frame-liquid":""].join(" "),style:{height:e}},I(c,{elTag:"span",elClasses:["fc-timegrid-axis-cushion","fc-scrollgrid-shrink-cushion","fc-scrollgrid-sync-inner"]})))},this.handleSlatCoords=e=>{this.setState({slatCoords:e})}}renderSimpleLayout(e,n,r){let{context:i,props:c}=this,d=[],f=ou(i.options);return e&&d.push({type:"header",key:"header",isSticky:f,chunk:{elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}}),n&&(d.push({type:"body",key:"all-day",chunk:{content:n}}),d.push({type:"body",key:"all-day-divider",outerContent:I("tr",{role:"presentation",className:"fc-scrollgrid-section"},I("td",{className:"fc-timegrid-divider "+i.theme.getClass("tableCellShaded")}))})),d.push({type:"body",key:"body",liquid:!0,expandRows:!!i.options.expandRows,chunk:{scrollerElRef:this.scrollerElRef,content:r}}),I(au,{elRef:this.rootElRef,elClasses:["fc-timegrid"],viewSpec:i.viewSpec},I(Cm,{liquid:!c.isHeightAuto&&!c.forPrint,collapsibleWidth:c.forPrint,cols:[{width:"shrink"}],sections:d}))}renderHScrollLayout(e,n,r,i,c,d,f){let h=this.context.pluginHooks.scrollGridImpl;if(!h)throw new Error("No ScrollGrid implementation");let{context:p,props:b}=this,y=!b.forPrint&&ou(p.options),m=!b.forPrint&&Aj(p.options),v=[];e&&v.push({type:"header",key:"header",isSticky:y,syncRowHeights:!0,chunks:[{key:"axis",rowContent:S=>I("tr",{role:"presentation"},this.renderHeadAxis("day",S.rowSyncHeights[0]))},{key:"cols",elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}]}),n&&(v.push({type:"body",key:"all-day",syncRowHeights:!0,chunks:[{key:"axis",rowContent:S=>I("tr",{role:"presentation"},this.renderTableRowAxis(S.rowSyncHeights[0]))},{key:"cols",content:n}]}),v.push({key:"all-day-divider",type:"body",outerContent:I("tr",{role:"presentation",className:"fc-scrollgrid-section"},I("td",{colSpan:2,className:"fc-timegrid-divider "+p.theme.getClass("tableCellShaded")}))}));let N=p.options.nowIndicator;return v.push({type:"body",key:"body",liquid:!0,expandRows:!!p.options.expandRows,chunks:[{key:"axis",content:S=>I("div",{className:"fc-timegrid-axis-chunk"},I("table",{"aria-hidden":!0,style:{height:S.expandRows?S.clientHeight:""}},S.tableColGroupNode,I("tbody",null,I(Nz,{slatMetas:d}))),I("div",{className:"fc-timegrid-now-indicator-container"},I(ei,{unit:N?"minute":"day"},j=>{let R=N&&f&&f.safeComputeTop(j);return typeof R=="number"?I(Rm,{elClasses:["fc-timegrid-now-indicator-arrow"],elStyle:{top:R},isAxis:!0,date:j}):null})))},{key:"cols",scrollerElRef:this.scrollerElRef,content:r}]}),m&&v.push({key:"footer",type:"footer",isSticky:!0,chunks:[{key:"axis",content:ig},{key:"cols",content:ig}]}),I(au,{elRef:this.rootElRef,elClasses:["fc-timegrid"],viewSpec:p.viewSpec},I(h,{liquid:!b.isHeightAuto&&!b.forPrint,forPrint:b.forPrint,collapsibleWidth:!1,colGroups:[{width:"shrink",cols:[{width:"shrink"}]},{cols:[{span:i,minWidth:c}]}],sections:v}))}getAllDayMaxEventProps(){let{dayMaxEvents:e,dayMaxEventRows:n}=this.context.options;return(e===!0||n===!0)&&(e=void 0,n=Sz),{dayMaxEvents:e,dayMaxEventRows:n}}}function Az(t){return t.text}class wz{constructor(e,n,r){this.positions=e,this.dateProfile=n,this.slotDuration=r}safeComputeTop(e){let{dateProfile:n}=this;if(Pa(n.currentRange,e)){let r=it(e),i=e.valueOf()-r.valueOf();if(i>=ea(n.slotMinTime)&&i{let f={time:c.time,date:n.dateEnv.toDate(c.date),view:n.viewApi};return I("tr",{key:c.key,ref:i.createRef(c.key)},e.axis&&I(Xj,Object.assign({},c)),I(On,{elTag:"td",elClasses:["fc-timegrid-slot","fc-timegrid-slot-lane",!c.isLabeled&&"fc-timegrid-slot-minor"],elAttrs:{"data-time":c.isoTimeStr},renderProps:f,generatorName:"slotLaneContent",customGenerator:r.slotLaneContent,classNameGenerator:r.slotLaneClassNames,didMount:r.slotLaneDidMount,willUnmount:r.slotLaneWillUnmount}))}))}}class Dz extends Ke{constructor(){super(...arguments),this.rootElRef=Zt(),this.slatElRefs=new La}render(){let{props:e,context:n}=this;return I("div",{ref:this.rootElRef,className:"fc-timegrid-slots"},I("table",{"aria-hidden":!0,className:n.theme.getClass("table"),style:{minWidth:e.tableMinWidth,width:e.clientWidth,height:e.minHeight}},e.tableColGroupNode,I(Cz,{slatElRefs:this.slatElRefs,axis:e.axis,slatMetas:e.slatMetas})))}componentDidMount(){this.updateSizing()}componentDidUpdate(){this.updateSizing()}componentWillUnmount(){this.props.onCoords&&this.props.onCoords(null)}updateSizing(){let{context:e,props:n}=this;n.onCoords&&n.clientWidth!==null&&this.rootElRef.current.offsetHeight&&n.onCoords(new wz(new Gl(this.rootElRef.current,Oz(this.slatElRefs.currentMap,n.slatMetas),!1,!0),this.props.dateProfile,e.options.slotDuration))}}function Oz(t,e){return e.map(n=>t[n.key])}function Ki(t,e){let n=[],r;for(r=0;rKj(e.hiddenSegs,e),defaultGenerator:Tz,forceTimed:!0},n=>I(n,{elTag:"div",elClasses:["fc-timegrid-more-link-inner","fc-sticky"]}))}}function Tz(t){return t.shortText}function kz(t,e,n){let r=new pj;e!=null&&(r.strictOrder=e),n!=null&&(r.maxStackCnt=n);let i=r.addSegs(t),c=V3(i),d=_z(r);return d=zz(d,1),{segRects:Pz(d),hiddenGroups:c}}function _z(t){const{entriesByLevel:e}=t,n=Mm((r,i)=>r+":"+i,(r,i)=>{let c=Lz(t,r,i),d=Q1(c,n),f=e[r][i];return[Object.assign(Object.assign({},f),{nextLevelNodes:d[0]}),f.thickness+d[1]]});return Q1(e.length?{level:0,lateralStart:0,lateralEnd:e[0].length}:null,n)[0]}function Q1(t,e){if(!t)return[[],0];let{level:n,lateralStart:r,lateralEnd:i}=t,c=r,d=[];for(;cAr(r),(r,i,c)=>{let{nextLevelNodes:d,thickness:f}=r,h=f+c,p=f/h,b,y=[];if(!d.length)b=e;else for(let v of d)if(b===void 0){let N=n(v,i,h);b=N[0],y.push(N[1])}else{let N=n(v,b,0);y.push(N[1])}let m=(b-i)*p;return[b-m,Object.assign(Object.assign({},r),{thickness:m,nextLevelNodes:y})]});return t.map(r=>n(r,0,0)[1])}function Pz(t){let e=[];const n=Mm((i,c,d)=>Ar(i),(i,c,d)=>{let f=Object.assign(Object.assign({},i),{levelCoord:c,stackDepth:d,stackForward:0});return e.push(f),f.stackForward=r(i.nextLevelNodes,c+i.thickness,d+1)+1});function r(i,c,d){let f=0;for(let h of i)f=Math.max(n(h,c,d),f);return f}return r(t,0,0),e}function Mm(t,e){const n={};return(...r)=>{let i=t(...r);return i in n?n[i]:n[i]=e(...r)}}function W1(t,e,n=null,r=0){let i=[];if(n)for(let c=0;cI("div",{className:"fc-timegrid-col-frame"},I("div",{className:"fc-timegrid-col-bg"},this.renderFillSegs(e.businessHourSegs,"non-business"),this.renderFillSegs(e.bgEventSegs,"bg-event"),this.renderFillSegs(e.dateSelectionSegs,"highlight")),I("div",{className:"fc-timegrid-col-events"},this.renderFgSegs(f,d,!1,!1,!1)),I("div",{className:"fc-timegrid-col-events"},this.renderFgSegs(c,{},!!e.eventDrag,!!e.eventResize,!!i,"mirror")),I("div",{className:"fc-timegrid-now-indicator-container"},this.renderNowIndicator(e.nowIndicatorSegs)),km(r)&&I(h,{elTag:"div",elClasses:["fc-timegrid-col-misc"]})))}renderFgSegs(e,n,r,i,c,d){let{props:f}=this;return f.forPrint?Kj(e,f):this.renderPositionedFgSegs(e,n,r,i,c,d)}renderPositionedFgSegs(e,n,r,i,c,d){let{eventMaxStack:f,eventShortHeight:h,eventOrderStrict:p,eventMinHeight:b}=this.context.options,{date:y,slatCoords:m,eventSelection:v,todayRange:N,nowDate:S}=this.props,j=r||i||c,R=W1(e,y,m,b),{segPlacements:C,hiddenGroups:O}=Uz(e,R,p,f);return I(lt,null,this.renderHiddenGroups(O,e),C.map(A=>{let{seg:k,rect:_}=A,B=k.eventRange.instance.instanceId,F=j||!!(!n[B]&&_),G=zp(_&&_.span),ee=!j&&_?this.computeSegHStyle(_):{left:0,right:0},ne=!!_&&_.stackForward>0,oe=!!_&&_.span.end-_.span.start{let y=zp(b.span),m=Gz(b.entries,n);return I(Rz,{key:LS(Rj(m)),hiddenSegs:m,top:y.top,bottom:y.bottom,extraDateSpan:r,dateProfile:i,todayRange:c,nowDate:d,eventSelection:f,eventDrag:h,eventResize:p})}))}renderFillSegs(e,n){let{props:r,context:i}=this,d=W1(e,r.date,r.slatCoords,i.options.eventMinHeight).map((f,h)=>{let p=e[h];return I("div",{key:rj(p.eventRange),className:"fc-timegrid-bg-harness",style:zp(f)},n==="bg-event"?I(wj,Object.assign({seg:p},Ms(p,r.todayRange,r.nowDate))):Cj(n))});return I(lt,null,d)}renderNowIndicator(e){let{slatCoords:n,date:r}=this.props;return n?e.map((i,c)=>I(Rm,{key:c,elClasses:["fc-timegrid-now-indicator-line"],elStyle:{top:n.computeDateTop(i.start,r)},isAxis:!1,date:r})):null}computeSegHStyle(e){let{isRtl:n,options:r}=this.context,i=r.slotEventOverlap,c=e.levelCoord,d=e.levelCoord+e.thickness,f,h;i&&(d=Math.min(1,c+(d-c)*2)),n?(f=1-d,h=c):(f=c,h=1-d);let p={zIndex:e.stackDepth+1,left:f*100+"%",right:h*100+"%"};return i&&!e.stackForward&&(p[n?"marginLeft":"marginRight"]=20),p}}function Kj(t,{todayRange:e,nowDate:n,eventSelection:r,eventDrag:i,eventResize:c}){let d=(i?i.affectedInstances:null)||(c?c.affectedInstances:null)||{};return I(lt,null,t.map(f=>{let h=f.eventRange.instance.instanceId;return I("div",{key:h,style:{visibility:d[h]?"hidden":""}},I(Zj,Object.assign({seg:f,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:h===r,isShort:!1},Ms(f,e,n))))}))}function zp(t){return t?{top:t.start,bottom:-t.end}:{top:"",bottom:""}}function Gz(t,e){return t.map(n=>e[n.index])}class Vz extends Ke{constructor(){super(...arguments),this.splitFgEventSegs=we(Ki),this.splitBgEventSegs=we(Ki),this.splitBusinessHourSegs=we(Ki),this.splitNowIndicatorSegs=we(Ki),this.splitDateSelectionSegs=we(Ki),this.splitEventDrag=we(Y1),this.splitEventResize=we(Y1),this.rootElRef=Zt(),this.cellElRefs=new La}render(){let{props:e,context:n}=this,r=n.options.nowIndicator&&e.slatCoords&&e.slatCoords.safeComputeTop(e.nowDate),i=e.cells.length,c=this.splitFgEventSegs(e.fgEventSegs,i),d=this.splitBgEventSegs(e.bgEventSegs,i),f=this.splitBusinessHourSegs(e.businessHourSegs,i),h=this.splitNowIndicatorSegs(e.nowIndicatorSegs,i),p=this.splitDateSelectionSegs(e.dateSelectionSegs,i),b=this.splitEventDrag(e.eventDrag,i),y=this.splitEventResize(e.eventResize,i);return I("div",{className:"fc-timegrid-cols",ref:this.rootElRef},I("table",{role:"presentation",style:{minWidth:e.tableMinWidth,width:e.clientWidth}},e.tableColGroupNode,I("tbody",{role:"presentation"},I("tr",{role:"row"},e.axis&&I("td",{"aria-hidden":!0,className:"fc-timegrid-col fc-timegrid-axis"},I("div",{className:"fc-timegrid-col-frame"},I("div",{className:"fc-timegrid-now-indicator-container"},typeof r=="number"&&I(Rm,{elClasses:["fc-timegrid-now-indicator-arrow"],elStyle:{top:r},isAxis:!0,date:e.nowDate})))),e.cells.map((m,v)=>I(Hz,{key:m.key,elRef:this.cellElRefs.createRef(m.key),dateProfile:e.dateProfile,date:m.date,nowDate:e.nowDate,todayRange:e.todayRange,extraRenderProps:m.extraRenderProps,extraDataAttrs:m.extraDataAttrs,extraClassNames:m.extraClassNames,extraDateSpan:m.extraDateSpan,fgEventSegs:c[v],bgEventSegs:d[v],businessHourSegs:f[v],nowIndicatorSegs:h[v],dateSelectionSegs:p[v],eventDrag:b[v],eventResize:y[v],slatCoords:e.slatCoords,eventSelection:e.eventSelection,forPrint:e.forPrint}))))))}componentDidMount(){this.updateCoords()}componentDidUpdate(){this.updateCoords()}updateCoords(){let{props:e}=this;e.onColCoords&&e.clientWidth!==null&&e.onColCoords(new Gl(this.rootElRef.current,Fz(this.cellElRefs.currentMap,e.cells),!0,!1))}}function Fz(t,e){return e.map(n=>t[n.key])}class qz extends pa{constructor(){super(...arguments),this.processSlotOptions=we($z),this.state={slatCoords:null},this.handleRootEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e,isHitComboAllowed:this.props.isHitComboAllowed}):this.context.unregisterInteractiveComponent(this)},this.handleScrollRequest=e=>{let{onScrollTopRequest:n}=this.props,{slatCoords:r}=this.state;if(n&&r){if(e.time){let i=r.computeTimeTop(e.time);i=Math.ceil(i),i&&(i+=1),n(i)}return!0}return!1},this.handleColCoords=e=>{this.colCoords=e},this.handleSlatCoords=e=>{this.setState({slatCoords:e}),this.props.onSlatCoords&&this.props.onSlatCoords(e)}}render(){let{props:e,state:n}=this;return I("div",{className:"fc-timegrid-body",ref:this.handleRootEl,style:{width:e.clientWidth,minWidth:e.tableMinWidth}},I(Dz,{axis:e.axis,dateProfile:e.dateProfile,slatMetas:e.slatMetas,clientWidth:e.clientWidth,minHeight:e.expandRows?e.clientHeight:"",tableMinWidth:e.tableMinWidth,tableColGroupNode:e.axis?e.tableColGroupNode:null,onCoords:this.handleSlatCoords}),I(Vz,{cells:e.cells,axis:e.axis,dateProfile:e.dateProfile,businessHourSegs:e.businessHourSegs,bgEventSegs:e.bgEventSegs,fgEventSegs:e.fgEventSegs,dateSelectionSegs:e.dateSelectionSegs,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,todayRange:e.todayRange,nowDate:e.nowDate,nowIndicatorSegs:e.nowIndicatorSegs,clientWidth:e.clientWidth,tableMinWidth:e.tableMinWidth,tableColGroupNode:e.tableColGroupNode,slatCoords:n.slatCoords,onColCoords:this.handleColCoords,forPrint:e.forPrint}))}componentDidMount(){this.scrollResponder=this.context.createScrollResponder(this.handleScrollRequest)}componentDidUpdate(e){this.scrollResponder.update(e.dateProfile!==this.props.dateProfile)}componentWillUnmount(){this.scrollResponder.detach()}queryHit(e,n){let{dateEnv:r,options:i}=this.context,{colCoords:c}=this,{dateProfile:d}=this.props,{slatCoords:f}=this.state,{snapDuration:h,snapsPerSlot:p}=this.processSlotOptions(this.props.slotDuration,i.snapDuration),b=c.leftToIndex(e),y=f.positions.topToIndex(n);if(b!=null&&y!=null){let m=this.props.cells[b],v=f.positions.tops[y],N=f.positions.getHeight(y),S=(n-v)/N,j=Math.floor(S*p),R=y*p+j,C=this.props.cells[b].date,O=Jp(d.slotMinTime,kI(h,R)),A=r.add(C,O),k=r.add(A,h);return{dateProfile:d,dateSpan:Object.assign({range:{start:A,end:k},allDay:!1},m.extraDateSpan),dayEl:c.els[b],rect:{left:c.lefts[b],right:c.rights[b],top:v,bottom:v+N},layer:0}}return null}}function $z(t,e){let n=e||t,r=im(t,n);return r===null&&(n=t,r=1),{snapDuration:n,snapsPerSlot:r}}class Yz extends vj{sliceRange(e,n){let r=[];for(let i=0;iI(qz,Object.assign({ref:this.timeColsRef},this.slicer.sliceProps(e,r,null,n,f),{forPrint:e.forPrint,axis:e.axis,dateProfile:r,slatMetas:e.slatMetas,slotDuration:e.slotDuration,cells:i.cells[0],tableColGroupNode:e.tableColGroupNode,tableMinWidth:e.tableMinWidth,clientWidth:e.clientWidth,clientHeight:e.clientHeight,expandRows:e.expandRows,nowDate:h,nowIndicatorSegs:c&&this.slicer.sliceNowDate(h,r,d,n,f),todayRange:p,onScrollTopRequest:e.onScrollTopRequest,onSlatCoords:e.onSlatCoords})))}}function Wz(t,e,n){let r=[];for(let i of t.headerDates)r.push({start:n.add(i,e.slotMinTime),end:n.add(i,e.slotMaxTime)});return r}const X1=[{hours:1},{minutes:30},{minutes:15},{seconds:30},{seconds:15}];function Xz(t,e,n,r,i){let c=new Date(0),d=t,f=Ge(0),h=n||Zz(r),p=[];for(;ea(d)=0;e-=1)if(n=Ge(X1[e]),r=im(n,t),r!==null&&r>1)return n;return t}class Kz extends jz{constructor(){super(...arguments),this.buildTimeColsModel=we(Jz),this.buildSlatMetas=we(Xz)}render(){let{options:e,dateEnv:n,dateProfileGenerator:r}=this.context,{props:i}=this,{dateProfile:c}=i,d=this.buildTimeColsModel(c,r),f=this.allDaySplitter.splitProps(i),h=this.buildSlatMetas(c.slotMinTime,c.slotMaxTime,e.slotLabelInterval,e.slotDuration,n),{dayMinWidth:p}=e,b=!p,y=p,m=e.dayHeaders&&I(xj,{dates:d.headerDates,dateProfile:c,datesRepDistinctDays:!0,renderIntro:b?this.renderHeadAxis:null}),v=e.allDaySlot!==!1&&(S=>I(Wj,Object.assign({},f.allDay,{dateProfile:c,dayTableModel:d,nextDayThreshold:e.nextDayThreshold,tableMinWidth:S.tableMinWidth,colGroupNode:S.tableColGroupNode,renderRowIntro:b?this.renderTableRowAxis:null,showWeekNumbers:!1,expandRows:!1,headerAlignElRef:this.headerElRef,clientWidth:S.clientWidth,clientHeight:S.clientHeight,forPrint:i.forPrint},this.getAllDayMaxEventProps()))),N=S=>I(Qz,Object.assign({},f.timed,{dayTableModel:d,dateProfile:c,axis:b,slotDuration:e.slotDuration,slatMetas:h,forPrint:i.forPrint,tableColGroupNode:S.tableColGroupNode,tableMinWidth:S.tableMinWidth,clientWidth:S.clientWidth,clientHeight:S.clientHeight,onSlatCoords:this.handleSlatCoords,expandRows:S.expandRows,onScrollTopRequest:this.handleScrollTopRequest}));return y?this.renderHScrollLayout(m,v,N,d.colCnt,p,h,this.state.slatCoords):this.renderSimpleLayout(m,v,N)}}function Jz(t,e){let n=new bj(t.renderRange,e);return new yj(n,!1)}var eP='.fc-v-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-v-event .fc-event-main{color:var(--fc-event-text-color);height:100%}.fc-v-event .fc-event-main-frame{display:flex;flex-direction:column;height:100%}.fc-v-event .fc-event-time{flex-grow:0;flex-shrink:0;max-height:100%;overflow:hidden}.fc-v-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-height:0}.fc-v-event .fc-event-title{bottom:0;max-height:100%;overflow:hidden;top:0}.fc-v-event:not(.fc-event-start){border-top-left-radius:0;border-top-right-radius:0;border-top-width:0}.fc-v-event:not(.fc-event-end){border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-width:0}.fc-v-event.fc-event-selected:before{left:-10px;right:-10px}.fc-v-event .fc-event-resizer-start{cursor:n-resize}.fc-v-event .fc-event-resizer-end{cursor:s-resize}.fc-v-event:not(.fc-event-selected) .fc-event-resizer{height:var(--fc-event-resizer-thickness);left:0;right:0}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-start{top:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer{left:50%;margin-left:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-start{top:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc .fc-timegrid .fc-daygrid-body{z-index:2}.fc .fc-timegrid-divider{padding:0 0 2px}.fc .fc-timegrid-body{min-height:100%;position:relative;z-index:1}.fc .fc-timegrid-axis-chunk{position:relative}.fc .fc-timegrid-axis-chunk>table,.fc .fc-timegrid-slots{position:relative;z-index:1}.fc .fc-timegrid-slot{border-bottom:0;height:1.5em}.fc .fc-timegrid-slot:empty:before{content:"\\00a0"}.fc .fc-timegrid-slot-minor{border-top-style:dotted}.fc .fc-timegrid-slot-label-cushion{display:inline-block;white-space:nowrap}.fc .fc-timegrid-slot-label{vertical-align:middle}.fc .fc-timegrid-axis-cushion,.fc .fc-timegrid-slot-label-cushion{padding:0 4px}.fc .fc-timegrid-axis-frame-liquid{height:100%}.fc .fc-timegrid-axis-frame{align-items:center;display:flex;justify-content:flex-end;overflow:hidden}.fc .fc-timegrid-axis-cushion{flex-shrink:0;max-width:60px}.fc-direction-ltr .fc-timegrid-slot-label-frame{text-align:right}.fc-direction-rtl .fc-timegrid-slot-label-frame{text-align:left}.fc-liquid-hack .fc-timegrid-axis-frame-liquid{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-timegrid-col-frame{min-height:100%;position:relative}.fc-media-screen.fc-liquid-hack .fc-timegrid-col-frame{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols{bottom:0;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols>table{height:100%}.fc-media-screen .fc-timegrid-col-bg,.fc-media-screen .fc-timegrid-col-events,.fc-media-screen .fc-timegrid-now-indicator-container{left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col-bg{z-index:2}.fc .fc-timegrid-col-bg .fc-non-business{z-index:1}.fc .fc-timegrid-col-bg .fc-bg-event{z-index:2}.fc .fc-timegrid-col-bg .fc-highlight{z-index:3}.fc .fc-timegrid-bg-harness{left:0;position:absolute;right:0}.fc .fc-timegrid-col-events{z-index:3}.fc .fc-timegrid-now-indicator-container{bottom:0;overflow:hidden}.fc-direction-ltr .fc-timegrid-col-events{margin:0 2.5% 0 2px}.fc-direction-rtl .fc-timegrid-col-events{margin:0 2px 0 2.5%}.fc-timegrid-event-harness{position:absolute}.fc-timegrid-event-harness>.fc-timegrid-event{bottom:0;left:0;position:absolute;right:0;top:0}.fc-timegrid-event-harness-inset .fc-timegrid-event,.fc-timegrid-event.fc-event-mirror,.fc-timegrid-more-link{box-shadow:0 0 0 1px var(--fc-page-bg-color)}.fc-timegrid-event,.fc-timegrid-more-link{border-radius:3px;font-size:var(--fc-small-font-size)}.fc-timegrid-event{margin-bottom:1px}.fc-timegrid-event .fc-event-main{padding:1px 1px 0}.fc-timegrid-event .fc-event-time{font-size:var(--fc-small-font-size);margin-bottom:1px;white-space:nowrap}.fc-timegrid-event-short .fc-event-main-frame{flex-direction:row;overflow:hidden}.fc-timegrid-event-short .fc-event-time:after{content:"\\00a0-\\00a0"}.fc-timegrid-event-short .fc-event-title{font-size:var(--fc-small-font-size)}.fc-timegrid-more-link{background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;margin-bottom:1px;position:absolute;z-index:9999}.fc-timegrid-more-link-inner{padding:3px 2px;top:0}.fc-direction-ltr .fc-timegrid-more-link{right:0}.fc-direction-rtl .fc-timegrid-more-link{left:0}.fc .fc-timegrid-now-indicator-arrow,.fc .fc-timegrid-now-indicator-line{pointer-events:none}.fc .fc-timegrid-now-indicator-line{border-color:var(--fc-now-indicator-color);border-style:solid;border-width:1px 0 0;left:0;position:absolute;right:0;z-index:4}.fc .fc-timegrid-now-indicator-arrow{border-color:var(--fc-now-indicator-color);border-style:solid;margin-top:-5px;position:absolute;z-index:4}.fc-direction-ltr .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 0 5px 6px;left:0}.fc-direction-rtl .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 6px 5px 0;right:0}';nm(eP);const tP={allDaySlot:Boolean};var nP=qa({name:"@fullcalendar/timegrid",initialView:"timeGridWeek",optionRefiners:tP,views:{timeGrid:{component:Kz,usesMinMaxTime:!0,allDaySlot:!0,slotDuration:"00:30:00",slotEventOverlap:!0},timeGridDay:{type:"timeGrid",duration:{days:1}},timeGridWeek:{type:"timeGrid",duration:{weeks:1}}}});wm.touchMouseIgnoreWait=500;let cg=0,cu=0,dg=!1;class Jj{constructor(e){this.subjectEl=null,this.selector="",this.handleSelector="",this.shouldIgnoreMove=!1,this.shouldWatchScroll=!0,this.isDragging=!1,this.isTouchDragging=!1,this.wasTouchScroll=!1,this.handleMouseDown=n=>{if(!this.shouldIgnoreMouse()&&aP(n)&&this.tryStart(n)){let r=this.createEventFromMouse(n,!0);this.emitter.trigger("pointerdown",r),this.initScrollWatch(r),this.shouldIgnoreMove||document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}},this.handleMouseMove=n=>{let r=this.createEventFromMouse(n);this.recordCoords(r),this.emitter.trigger("pointermove",r)},this.handleMouseUp=n=>{document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.emitter.trigger("pointerup",this.createEventFromMouse(n)),this.cleanup()},this.handleTouchStart=n=>{if(this.tryStart(n)){this.isTouchDragging=!0;let r=this.createEventFromTouch(n,!0);this.emitter.trigger("pointerdown",r),this.initScrollWatch(r);let i=n.target;this.shouldIgnoreMove||i.addEventListener("touchmove",this.handleTouchMove),i.addEventListener("touchend",this.handleTouchEnd),i.addEventListener("touchcancel",this.handleTouchEnd),window.addEventListener("scroll",this.handleTouchScroll,!0)}},this.handleTouchMove=n=>{let r=this.createEventFromTouch(n);this.recordCoords(r),this.emitter.trigger("pointermove",r)},this.handleTouchEnd=n=>{if(this.isDragging){let r=n.target;r.removeEventListener("touchmove",this.handleTouchMove),r.removeEventListener("touchend",this.handleTouchEnd),r.removeEventListener("touchcancel",this.handleTouchEnd),window.removeEventListener("scroll",this.handleTouchScroll,!0),this.emitter.trigger("pointerup",this.createEventFromTouch(n)),this.cleanup(),this.isTouchDragging=!1,sP()}},this.handleTouchScroll=()=>{this.wasTouchScroll=!0},this.handleScroll=n=>{if(!this.shouldIgnoreMove){let r=window.scrollX-this.prevScrollX+this.prevPageX,i=window.scrollY-this.prevScrollY+this.prevPageY;this.emitter.trigger("pointermove",{origEvent:n,isTouch:this.isTouchDragging,subjectEl:this.subjectEl,pageX:r,pageY:i,deltaX:r-this.origPageX,deltaY:i-this.origPageY})}},this.containerEl=e,this.emitter=new Ru,e.addEventListener("mousedown",this.handleMouseDown),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),rP()}destroy(){this.containerEl.removeEventListener("mousedown",this.handleMouseDown),this.containerEl.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),lP()}tryStart(e){let n=this.querySubjectEl(e),r=e.target;return n&&(!this.handleSelector||qt(r,this.handleSelector))?(this.subjectEl=n,this.isDragging=!0,this.wasTouchScroll=!1,!0):!1}cleanup(){dg=!1,this.isDragging=!1,this.subjectEl=null,this.destroyScrollWatch()}querySubjectEl(e){return this.selector?qt(e.target,this.selector):this.containerEl}shouldIgnoreMouse(){return cg||this.isTouchDragging}cancelTouchScroll(){this.isDragging&&(dg=!0)}initScrollWatch(e){this.shouldWatchScroll&&(this.recordCoords(e),window.addEventListener("scroll",this.handleScroll,!0))}recordCoords(e){this.shouldWatchScroll&&(this.prevPageX=e.pageX,this.prevPageY=e.pageY,this.prevScrollX=window.scrollX,this.prevScrollY=window.scrollY)}destroyScrollWatch(){this.shouldWatchScroll&&window.removeEventListener("scroll",this.handleScroll,!0)}createEventFromMouse(e,n){let r=0,i=0;return n?(this.origPageX=e.pageX,this.origPageY=e.pageY):(r=e.pageX-this.origPageX,i=e.pageY-this.origPageY),{origEvent:e,isTouch:!1,subjectEl:this.subjectEl,pageX:e.pageX,pageY:e.pageY,deltaX:r,deltaY:i}}createEventFromTouch(e,n){let r=e.touches,i,c,d=0,f=0;return r&&r.length?(i=r[0].pageX,c=r[0].pageY):(i=e.pageX,c=e.pageY),n?(this.origPageX=i,this.origPageY=c):(d=i-this.origPageX,f=c-this.origPageY),{origEvent:e,isTouch:!0,subjectEl:this.subjectEl,pageX:i,pageY:c,deltaX:d,deltaY:f}}}function aP(t){return t.button===0&&!t.ctrlKey}function sP(){cg+=1,setTimeout(()=>{cg-=1},wm.touchMouseIgnoreWait)}function rP(){cu+=1,cu===1&&window.addEventListener("touchmove",eA,{passive:!1})}function lP(){cu-=1,cu||window.removeEventListener("touchmove",eA,{passive:!1})}function eA(t){dg&&t.preventDefault()}class iP{constructor(){this.isVisible=!1,this.sourceEl=null,this.mirrorEl=null,this.sourceElRect=null,this.parentNode=document.body,this.zIndex=9999,this.revertDuration=0}start(e,n,r){this.sourceEl=e,this.sourceElRect=this.sourceEl.getBoundingClientRect(),this.origScreenX=n-window.scrollX,this.origScreenY=r-window.scrollY,this.deltaX=0,this.deltaY=0,this.updateElPosition()}handleMove(e,n){this.deltaX=e-window.scrollX-this.origScreenX,this.deltaY=n-window.scrollY-this.origScreenY,this.updateElPosition()}setIsVisible(e){e?this.isVisible||(this.mirrorEl&&(this.mirrorEl.style.display=""),this.isVisible=e,this.updateElPosition()):this.isVisible&&(this.mirrorEl&&(this.mirrorEl.style.display="none"),this.isVisible=e)}stop(e,n){let r=()=>{this.cleanup(),n()};e&&this.mirrorEl&&this.isVisible&&this.revertDuration&&(this.deltaX||this.deltaY)?this.doRevertAnimation(r,this.revertDuration):setTimeout(r,0)}doRevertAnimation(e,n){let r=this.mirrorEl,i=this.sourceEl.getBoundingClientRect();r.style.transition="top "+n+"ms,left "+n+"ms",io(r,{left:i.left,top:i.top}),xI(r,()=>{r.style.transition="",e()})}cleanup(){this.mirrorEl&&(sm(this.mirrorEl),this.mirrorEl=null),this.sourceEl=null}updateElPosition(){this.sourceEl&&this.isVisible&&io(this.getMirrorEl(),{left:this.sourceElRect.left+this.deltaX,top:this.sourceElRect.top+this.deltaY})}getMirrorEl(){let e=this.sourceElRect,n=this.mirrorEl;return n||(n=this.mirrorEl=this.sourceEl.cloneNode(!0),n.style.userSelect="none",n.style.webkitUserSelect="none",n.style.pointerEvents="none",n.classList.add("fc-event-dragging"),io(n,{position:"fixed",zIndex:this.zIndex,visibility:"",boxSizing:"border-box",width:e.right-e.left,height:e.bottom-e.top,right:"auto",bottom:"auto",margin:0}),this.parentNode.appendChild(n)),n}}class tA extends jm{constructor(e,n){super(),this.handleScroll=()=>{this.scrollTop=this.scrollController.getScrollTop(),this.scrollLeft=this.scrollController.getScrollLeft(),this.handleScrollChange()},this.scrollController=e,this.doesListening=n,this.scrollTop=this.origScrollTop=e.getScrollTop(),this.scrollLeft=this.origScrollLeft=e.getScrollLeft(),this.scrollWidth=e.getScrollWidth(),this.scrollHeight=e.getScrollHeight(),this.clientWidth=e.getClientWidth(),this.clientHeight=e.getClientHeight(),this.clientRect=this.computeClientRect(),this.doesListening&&this.getEventTarget().addEventListener("scroll",this.handleScroll)}destroy(){this.doesListening&&this.getEventTarget().removeEventListener("scroll",this.handleScroll)}getScrollTop(){return this.scrollTop}getScrollLeft(){return this.scrollLeft}setScrollTop(e){this.scrollController.setScrollTop(e),this.doesListening||(this.scrollTop=Math.max(Math.min(e,this.getMaxScrollTop()),0),this.handleScrollChange())}setScrollLeft(e){this.scrollController.setScrollLeft(e),this.doesListening||(this.scrollLeft=Math.max(Math.min(e,this.getMaxScrollLeft()),0),this.handleScrollChange())}getClientWidth(){return this.clientWidth}getClientHeight(){return this.clientHeight}getScrollWidth(){return this.scrollWidth}getScrollHeight(){return this.scrollHeight}handleScrollChange(){}}class nA extends tA{constructor(e,n){super(new H3(e),n)}getEventTarget(){return this.scrollController.el}computeClientRect(){return U3(this.scrollController.el)}}class oP extends tA{constructor(e){super(new G3,e)}getEventTarget(){return window}computeClientRect(){return{left:this.scrollLeft,right:this.scrollLeft+this.clientWidth,top:this.scrollTop,bottom:this.scrollTop+this.clientHeight}}handleScrollChange(){this.clientRect=this.computeClientRect()}}const Z1=typeof performance=="function"?performance.now:Date.now;class cP{constructor(){this.isEnabled=!0,this.scrollQuery=[window,".fc-scroller"],this.edgeThreshold=50,this.maxVelocity=300,this.pointerScreenX=null,this.pointerScreenY=null,this.isAnimating=!1,this.scrollCaches=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.animate=()=>{if(this.isAnimating){let e=this.computeBestEdge(this.pointerScreenX+window.scrollX,this.pointerScreenY+window.scrollY);if(e){let n=Z1();this.handleSide(e,(n-this.msSinceRequest)/1e3),this.requestAnimation(n)}else this.isAnimating=!1}}}start(e,n,r){this.isEnabled&&(this.scrollCaches=this.buildCaches(r),this.pointerScreenX=null,this.pointerScreenY=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.handleMove(e,n))}handleMove(e,n){if(this.isEnabled){let r=e-window.scrollX,i=n-window.scrollY,c=this.pointerScreenY===null?0:i-this.pointerScreenY,d=this.pointerScreenX===null?0:r-this.pointerScreenX;c<0?this.everMovedUp=!0:c>0&&(this.everMovedDown=!0),d<0?this.everMovedLeft=!0:d>0&&(this.everMovedRight=!0),this.pointerScreenX=r,this.pointerScreenY=i,this.isAnimating||(this.isAnimating=!0,this.requestAnimation(Z1()))}}stop(){if(this.isEnabled){this.isAnimating=!1;for(let e of this.scrollCaches)e.destroy();this.scrollCaches=null}}requestAnimation(e){this.msSinceRequest=e,requestAnimationFrame(this.animate)}handleSide(e,n){let{scrollCache:r}=e,{edgeThreshold:i}=this,c=i-e.distance,d=c*c/(i*i)*this.maxVelocity*n,f=1;switch(e.name){case"left":f=-1;case"right":r.setScrollLeft(r.getScrollLeft()+d*f);break;case"top":f=-1;case"bottom":r.setScrollTop(r.getScrollTop()+d*f);break}}computeBestEdge(e,n){let{edgeThreshold:r}=this,i=null,c=this.scrollCaches||[];for(let d of c){let f=d.clientRect,h=e-f.left,p=f.right-e,b=n-f.top,y=f.bottom-n;h>=0&&p>=0&&b>=0&&y>=0&&(b<=r&&this.everMovedUp&&d.canScrollUp()&&(!i||i.distance>b)&&(i={scrollCache:d,name:"top",distance:b}),y<=r&&this.everMovedDown&&d.canScrollDown()&&(!i||i.distance>y)&&(i={scrollCache:d,name:"bottom",distance:y}),h<=r&&this.everMovedLeft&&d.canScrollLeft()&&(!i||i.distance>h)&&(i={scrollCache:d,name:"left",distance:h}),p<=r&&this.everMovedRight&&d.canScrollRight()&&(!i||i.distance>p)&&(i={scrollCache:d,name:"right",distance:p}))}return i}buildCaches(e){return this.queryScrollEls(e).map(n=>n===window?new oP(!1):new nA(n,!1))}queryScrollEls(e){let n=[];for(let r of this.scrollQuery)typeof r=="object"?n.push(r):n.push(...Array.prototype.slice.call(e.getRootNode().querySelectorAll(r)));return n}}class Ho extends q3{constructor(e,n){super(e),this.containerEl=e,this.delay=null,this.minDistance=0,this.touchScrollAllowed=!0,this.mirrorNeedsRevert=!1,this.isInteracting=!1,this.isDragging=!1,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,this.delayTimeoutId=null,this.onPointerDown=i=>{this.isDragging||(this.isInteracting=!0,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,bI(document.body),vI(document.body),i.isTouch||i.origEvent.preventDefault(),this.emitter.trigger("pointerdown",i),this.isInteracting&&!this.pointer.shouldIgnoreMove&&(this.mirror.setIsVisible(!1),this.mirror.start(i.subjectEl,i.pageX,i.pageY),this.startDelay(i),this.minDistance||this.handleDistanceSurpassed(i)))},this.onPointerMove=i=>{if(this.isInteracting){if(this.emitter.trigger("pointermove",i),!this.isDistanceSurpassed){let c=this.minDistance,d,{deltaX:f,deltaY:h}=i;d=f*f+h*h,d>=c*c&&this.handleDistanceSurpassed(i)}this.isDragging&&(i.origEvent.type!=="scroll"&&(this.mirror.handleMove(i.pageX,i.pageY),this.autoScroller.handleMove(i.pageX,i.pageY)),this.emitter.trigger("dragmove",i))}},this.onPointerUp=i=>{this.isInteracting&&(this.isInteracting=!1,yI(document.body),NI(document.body),this.emitter.trigger("pointerup",i),this.isDragging&&(this.autoScroller.stop(),this.tryStopDrag(i)),this.delayTimeoutId&&(clearTimeout(this.delayTimeoutId),this.delayTimeoutId=null))};let r=this.pointer=new Jj(e);r.emitter.on("pointerdown",this.onPointerDown),r.emitter.on("pointermove",this.onPointerMove),r.emitter.on("pointerup",this.onPointerUp),n&&(r.selector=n),this.mirror=new iP,this.autoScroller=new cP}destroy(){this.pointer.destroy(),this.onPointerUp({})}startDelay(e){typeof this.delay=="number"?this.delayTimeoutId=setTimeout(()=>{this.delayTimeoutId=null,this.handleDelayEnd(e)},this.delay):this.handleDelayEnd(e)}handleDelayEnd(e){this.isDelayEnded=!0,this.tryStartDrag(e)}handleDistanceSurpassed(e){this.isDistanceSurpassed=!0,this.tryStartDrag(e)}tryStartDrag(e){this.isDelayEnded&&this.isDistanceSurpassed&&(!this.pointer.wasTouchScroll||this.touchScrollAllowed)&&(this.isDragging=!0,this.mirrorNeedsRevert=!1,this.autoScroller.start(e.pageX,e.pageY,this.containerEl),this.emitter.trigger("dragstart",e),this.touchScrollAllowed===!1&&this.pointer.cancelTouchScroll())}tryStopDrag(e){this.mirror.stop(this.mirrorNeedsRevert,this.stopDrag.bind(this,e))}stopDrag(e){this.isDragging=!1,this.emitter.trigger("dragend",e)}setIgnoreMove(e){this.pointer.shouldIgnoreMove=e}setMirrorIsVisible(e){this.mirror.setIsVisible(e)}setMirrorNeedsRevert(e){this.mirrorNeedsRevert=e}setAutoScrollEnabled(e){this.autoScroller.isEnabled=e}}class dP{constructor(e){this.el=e,this.origRect=Sm(e),this.scrollCaches=hj(e).map(n=>new nA(n,!0))}destroy(){for(let e of this.scrollCaches)e.destroy()}computeLeft(){let e=this.origRect.left;for(let n of this.scrollCaches)e+=n.origScrollLeft-n.getScrollLeft();return e}computeTop(){let e=this.origRect.top;for(let n of this.scrollCaches)e+=n.origScrollTop-n.getScrollTop();return e}isWithinClipping(e,n){let r={left:e,top:n};for(let i of this.scrollCaches)if(!uP(i.getEventTarget())&&!w3(r,i.clientRect))return!1;return!0}}function uP(t){let e=t.tagName;return e==="HTML"||e==="BODY"}class Tu{constructor(e,n){this.useSubjectCenter=!1,this.requireInitial=!0,this.disablePointCheck=!1,this.initialHit=null,this.movingHit=null,this.finalHit=null,this.handlePointerDown=r=>{let{dragging:i}=this;this.initialHit=null,this.movingHit=null,this.finalHit=null,this.prepareHits(),this.processFirstCoord(r),this.initialHit||!this.requireInitial?(i.setIgnoreMove(!1),this.emitter.trigger("pointerdown",r)):i.setIgnoreMove(!0)},this.handleDragStart=r=>{this.emitter.trigger("dragstart",r),this.handleMove(r,!0)},this.handleDragMove=r=>{this.emitter.trigger("dragmove",r),this.handleMove(r)},this.handlePointerUp=r=>{this.releaseHits(),this.emitter.trigger("pointerup",r)},this.handleDragEnd=r=>{this.movingHit&&this.emitter.trigger("hitupdate",null,!0,r),this.finalHit=this.movingHit,this.movingHit=null,this.emitter.trigger("dragend",r)},this.droppableStore=n,e.emitter.on("pointerdown",this.handlePointerDown),e.emitter.on("dragstart",this.handleDragStart),e.emitter.on("dragmove",this.handleDragMove),e.emitter.on("pointerup",this.handlePointerUp),e.emitter.on("dragend",this.handleDragEnd),this.dragging=e,this.emitter=new Ru}processFirstCoord(e){let n={left:e.pageX,top:e.pageY},r=n,i=e.subjectEl,c;i instanceof HTMLElement&&(c=Sm(i),r=C3(r,c));let d=this.initialHit=this.queryHitForOffset(r.left,r.top);if(d){if(this.useSubjectCenter&&c){let f=dj(c,d.rect);f&&(r=D3(f))}this.coordAdjust=O3(r,n)}else this.coordAdjust={left:0,top:0}}handleMove(e,n){let r=this.queryHitForOffset(e.pageX+this.coordAdjust.left,e.pageY+this.coordAdjust.top);(n||!ku(this.movingHit,r))&&(this.movingHit=r,this.emitter.trigger("hitupdate",r,!1,e))}prepareHits(){this.offsetTrackers=Ha(this.droppableStore,e=>(e.component.prepareHits(),new dP(e.el)))}releaseHits(){let{offsetTrackers:e}=this;for(let n in e)e[n].destroy();this.offsetTrackers={}}queryHitForOffset(e,n){let{droppableStore:r,offsetTrackers:i}=this,c=null;for(let d in r){let f=r[d].component,h=i[d];if(h&&h.isWithinClipping(e,n)){let p=h.computeLeft(),b=h.computeTop(),y=e-p,m=n-b,{origRect:v}=h,N=v.right-v.left,S=v.bottom-v.top;if(y>=0&&y=0&&mc.layer)&&(j.componentId=d,j.context=f.context,j.rect.left+=p,j.rect.right+=p,j.rect.top+=b,j.rect.bottom+=b,c=j)}}}return c}}function ku(t,e){return!t&&!e?!0:!!t!=!!e?!1:g3(t.dateSpan,e.dateSpan)}function aA(t,e){let n={};for(let r of e.pluginHooks.datePointTransforms)Object.assign(n,r(t,e));return Object.assign(n,fP(t,e.dateEnv)),n}function fP(t,e){return{date:e.toDate(t.range.start),dateStr:e.formatIso(t.range.start,{omitTime:t.allDay}),allDay:t.allDay}}class hP extends Jl{constructor(e){super(e),this.handlePointerDown=r=>{let{dragging:i}=this,c=r.origEvent.target;i.setIgnoreMove(!this.component.isValidDateDownEl(c))},this.handleDragEnd=r=>{let{component:i}=this,{pointer:c}=this.dragging;if(!c.wasTouchScroll){let{initialHit:d,finalHit:f}=this.hitDragging;if(d&&f&&ku(d,f)){let{context:h}=i,p=Object.assign(Object.assign({},aA(d.dateSpan,h)),{dayEl:d.dayEl,jsEvent:r.origEvent,view:h.viewApi||h.calendarApi.view});h.emitter.trigger("dateClick",p)}}},this.dragging=new Ho(e.el),this.dragging.autoScroller.isEnabled=!1;let n=this.hitDragging=new Tu(this.dragging,Nm(e));n.emitter.on("pointerdown",this.handlePointerDown),n.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}}class pP extends Jl{constructor(e){super(e),this.dragSelection=null,this.handlePointerDown=d=>{let{component:f,dragging:h}=this,{options:p}=f.context,b=p.selectable&&f.isValidDateDownEl(d.origEvent.target);h.setIgnoreMove(!b),h.delay=d.isTouch?gP(f):null},this.handleDragStart=d=>{this.component.context.calendarApi.unselect(d)},this.handleHitUpdate=(d,f)=>{let{context:h}=this.component,p=null,b=!1;if(d){let y=this.hitDragging.initialHit;d.componentId===y.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(y,d)||(p=mP(y,d,h.pluginHooks.dateSelectionTransformers)),(!p||!Z3(p,d.dateProfile,h))&&(b=!0,p=null)}p?h.dispatch({type:"SELECT_DATES",selection:p}):f||h.dispatch({type:"UNSELECT_DATES"}),b?rm():lm(),f||(this.dragSelection=p)},this.handlePointerUp=d=>{this.dragSelection&&(ej(this.dragSelection,d,this.component.context),this.dragSelection=null)};let{component:n}=e,{options:r}=n.context,i=this.dragging=new Ho(e.el);i.touchScrollAllowed=!1,i.minDistance=r.selectMinDistance||0,i.autoScroller.isEnabled=r.dragScroll;let c=this.hitDragging=new Tu(this.dragging,Nm(e));c.emitter.on("pointerdown",this.handlePointerDown),c.emitter.on("dragstart",this.handleDragStart),c.emitter.on("hitupdate",this.handleHitUpdate),c.emitter.on("pointerup",this.handlePointerUp)}destroy(){this.dragging.destroy()}}function gP(t){let{options:e}=t.context,n=e.selectLongPressDelay;return n==null&&(n=e.longPressDelay),n}function mP(t,e,n){let r=t.dateSpan,i=e.dateSpan,c=[r.range.start,r.range.end,i.range.start,i.range.end];c.sort(wI);let d={};for(let f of n){let h=f(t,e);if(h===!1)return null;h&&Object.assign(d,h)}return d.range={start:c[0],end:c[3]},d.allDay=r.allDay,d}class Go extends Jl{constructor(e){super(e),this.subjectEl=null,this.subjectSeg=null,this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=d=>{let f=d.origEvent.target,{component:h,dragging:p}=this,{mirror:b}=p,{options:y}=h.context,m=h.context;this.subjectEl=d.subjectEl;let v=this.subjectSeg=Hl(d.subjectEl),S=(this.eventRange=v.eventRange).instance.instanceId;this.relevantEvents=xm(m.getCurrentData().eventStore,S),p.minDistance=d.isTouch?0:y.eventDragMinDistance,p.delay=d.isTouch&&S!==h.props.eventSelection?bP(h):null,y.fixedMirrorParent?b.parentNode=y.fixedMirrorParent:b.parentNode=qt(f,".fc"),b.revertDuration=y.dragRevertDuration;let j=h.isValidSegDownEl(f)&&!qt(f,".fc-event-resizer");p.setIgnoreMove(!j),this.isDragging=j&&d.subjectEl.classList.contains("fc-event-draggable")},this.handleDragStart=d=>{let f=this.component.context,h=this.eventRange,p=h.instance.instanceId;d.isTouch?p!==this.component.props.eventSelection&&f.dispatch({type:"SELECT_EVENT",eventInstanceId:p}):f.dispatch({type:"UNSELECT_EVENT"}),this.isDragging&&(f.calendarApi.unselect(d),f.emitter.trigger("eventDragStart",{el:this.subjectEl,event:new ut(f,h.def,h.instance),jsEvent:d.origEvent,view:f.viewApi}))},this.handleHitUpdate=(d,f)=>{if(!this.isDragging)return;let h=this.relevantEvents,p=this.hitDragging.initialHit,b=this.component.context,y=null,m=null,v=null,N=!1,S={affectedEvents:h,mutatedEvents:Cn(),isEvent:!0};if(d){y=d.context;let j=y.options;b===y||j.editable&&j.droppable?(m=xP(p,d,this.eventRange.instance.range.start,y.getCurrentData().pluginHooks.eventDragMutationMassagers),m&&(v=vm(h,y.getCurrentData().eventUiBases,m,y),S.mutatedEvents=v,Nj(S,d.dateProfile,y)||(N=!0,m=null,v=null,S.mutatedEvents=Cn()))):y=null}this.displayDrag(y,S),N?rm():lm(),f||(b===y&&ku(p,d)&&(m=null),this.dragging.setMirrorNeedsRevert(!m),this.dragging.setMirrorIsVisible(!d||!this.subjectEl.getRootNode().querySelector(".fc-event-mirror")),this.receivingContext=y,this.validMutation=m,this.mutatedRelevantEvents=v)},this.handlePointerUp=()=>{this.isDragging||this.cleanup()},this.handleDragEnd=d=>{if(this.isDragging){let f=this.component.context,h=f.viewApi,{receivingContext:p,validMutation:b}=this,y=this.eventRange.def,m=this.eventRange.instance,v=new ut(f,y,m),N=this.relevantEvents,S=this.mutatedRelevantEvents,{finalHit:j}=this.hitDragging;if(this.clearDrag(),f.emitter.trigger("eventDragStop",{el:this.subjectEl,event:v,jsEvent:d.origEvent,view:h}),b){if(p===f){let R=new ut(f,S.defs[y.defId],m?S.instances[m.instanceId]:null);f.dispatch({type:"MERGE_EVENTS",eventStore:S});let C={oldEvent:v,event:R,relatedEvents:jr(S,f,m),revert(){f.dispatch({type:"MERGE_EVENTS",eventStore:N})}},O={};for(let A of f.getCurrentData().pluginHooks.eventDropTransformers)Object.assign(O,A(b,f));f.emitter.trigger("eventDrop",Object.assign(Object.assign(Object.assign({},C),O),{el:d.subjectEl,delta:b.datesDelta,jsEvent:d.origEvent,view:h})),f.emitter.trigger("eventChange",C)}else if(p){let R={event:v,relatedEvents:jr(N,f,m),revert(){f.dispatch({type:"MERGE_EVENTS",eventStore:N})}};f.emitter.trigger("eventLeave",Object.assign(Object.assign({},R),{draggedEl:d.subjectEl,view:h})),f.dispatch({type:"REMOVE_EVENTS",eventStore:N}),f.emitter.trigger("eventRemove",R);let C=S.defs[y.defId],O=S.instances[m.instanceId],A=new ut(p,C,O);p.dispatch({type:"MERGE_EVENTS",eventStore:S});let k={event:A,relatedEvents:jr(S,p,O),revert(){p.dispatch({type:"REMOVE_EVENTS",eventStore:S})}};p.emitter.trigger("eventAdd",k),d.isTouch&&p.dispatch({type:"SELECT_EVENT",eventInstanceId:m.instanceId}),p.emitter.trigger("drop",Object.assign(Object.assign({},aA(j.dateSpan,p)),{draggedEl:d.subjectEl,jsEvent:d.origEvent,view:j.context.viewApi})),p.emitter.trigger("eventReceive",Object.assign(Object.assign({},k),{draggedEl:d.subjectEl,view:j.context.viewApi}))}}else f.emitter.trigger("_noEventDrop")}this.cleanup()};let{component:n}=this,{options:r}=n.context,i=this.dragging=new Ho(e.el);i.pointer.selector=Go.SELECTOR,i.touchScrollAllowed=!1,i.autoScroller.isEnabled=r.dragScroll;let c=this.hitDragging=new Tu(this.dragging,sg);c.useSubjectCenter=e.useEventCenter,c.emitter.on("pointerdown",this.handlePointerDown),c.emitter.on("dragstart",this.handleDragStart),c.emitter.on("hitupdate",this.handleHitUpdate),c.emitter.on("pointerup",this.handlePointerUp),c.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}displayDrag(e,n){let r=this.component.context,i=this.receivingContext;i&&i!==e&&(i===r?i.dispatch({type:"SET_EVENT_DRAG",state:{affectedEvents:n.affectedEvents,mutatedEvents:Cn(),isEvent:!0}}):i.dispatch({type:"UNSET_EVENT_DRAG"})),e&&e.dispatch({type:"SET_EVENT_DRAG",state:n})}clearDrag(){let e=this.component.context,{receivingContext:n}=this;n&&n.dispatch({type:"UNSET_EVENT_DRAG"}),e!==n&&e.dispatch({type:"UNSET_EVENT_DRAG"})}cleanup(){this.subjectSeg=null,this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null}}Go.SELECTOR=".fc-event-draggable, .fc-event-resizable";function xP(t,e,n,r){let i=t.dateSpan,c=e.dateSpan,d=i.range.start,f=c.range.start,h={};i.allDay!==c.allDay&&(h.allDay=c.allDay,h.hasEnd=e.context.options.allDayMaintainDuration,c.allDay?d=it(n):d=n);let p=vl(d,f,t.context.dateEnv,t.componentId===e.componentId?t.largeUnit:null);p.milliseconds&&(h.allDay=!1);let b={datesDelta:p,standardProps:h};for(let y of r)y(b,t,e);return b}function bP(t){let{options:e}=t.context,n=e.eventLongPressDelay;return n==null&&(n=e.longPressDelay),n}class yP extends Jl{constructor(e){super(e),this.draggingSegEl=null,this.draggingSeg=null,this.eventRange=null,this.relevantEvents=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=c=>{let{component:d}=this,f=this.querySegEl(c),h=Hl(f),p=this.eventRange=h.eventRange;this.dragging.minDistance=d.context.options.eventDragMinDistance,this.dragging.setIgnoreMove(!this.component.isValidSegDownEl(c.origEvent.target)||c.isTouch&&this.component.props.eventSelection!==p.instance.instanceId)},this.handleDragStart=c=>{let{context:d}=this.component,f=this.eventRange;this.relevantEvents=xm(d.getCurrentData().eventStore,this.eventRange.instance.instanceId);let h=this.querySegEl(c);this.draggingSegEl=h,this.draggingSeg=Hl(h),d.calendarApi.unselect(),d.emitter.trigger("eventResizeStart",{el:h,event:new ut(d,f.def,f.instance),jsEvent:c.origEvent,view:d.viewApi})},this.handleHitUpdate=(c,d,f)=>{let{context:h}=this.component,p=this.relevantEvents,b=this.hitDragging.initialHit,y=this.eventRange.instance,m=null,v=null,N=!1,S={affectedEvents:p,mutatedEvents:Cn(),isEvent:!0};c&&(c.componentId===b.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(b,c)||(m=vP(b,c,f.subjectEl.classList.contains("fc-event-resizer-start"),y.range))),m&&(v=vm(p,h.getCurrentData().eventUiBases,m,h),S.mutatedEvents=v,Nj(S,c.dateProfile,h)||(N=!0,m=null,v=null,S.mutatedEvents=null)),v?h.dispatch({type:"SET_EVENT_RESIZE",state:S}):h.dispatch({type:"UNSET_EVENT_RESIZE"}),N?rm():lm(),d||(m&&ku(b,c)&&(m=null),this.validMutation=m,this.mutatedRelevantEvents=v)},this.handleDragEnd=c=>{let{context:d}=this.component,f=this.eventRange.def,h=this.eventRange.instance,p=new ut(d,f,h),b=this.relevantEvents,y=this.mutatedRelevantEvents;if(d.emitter.trigger("eventResizeStop",{el:this.draggingSegEl,event:p,jsEvent:c.origEvent,view:d.viewApi}),this.validMutation){let m=new ut(d,y.defs[f.defId],h?y.instances[h.instanceId]:null);d.dispatch({type:"MERGE_EVENTS",eventStore:y});let v={oldEvent:p,event:m,relatedEvents:jr(y,d,h),revert(){d.dispatch({type:"MERGE_EVENTS",eventStore:b})}};d.emitter.trigger("eventResize",Object.assign(Object.assign({},v),{el:this.draggingSegEl,startDelta:this.validMutation.startDelta||Ge(0),endDelta:this.validMutation.endDelta||Ge(0),jsEvent:c.origEvent,view:d.viewApi})),d.emitter.trigger("eventChange",v)}else d.emitter.trigger("_noEventResize");this.draggingSeg=null,this.relevantEvents=null,this.validMutation=null};let{component:n}=e,r=this.dragging=new Ho(e.el);r.pointer.selector=".fc-event-resizer",r.touchScrollAllowed=!1,r.autoScroller.isEnabled=n.context.options.dragScroll;let i=this.hitDragging=new Tu(this.dragging,Nm(e));i.emitter.on("pointerdown",this.handlePointerDown),i.emitter.on("dragstart",this.handleDragStart),i.emitter.on("hitupdate",this.handleHitUpdate),i.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}querySegEl(e){return qt(e.subjectEl,".fc-event")}}function vP(t,e,n,r){let i=t.context.dateEnv,c=t.dateSpan.range.start,d=e.dateSpan.range.start,f=vl(c,d,i,t.largeUnit);if(n){if(i.add(r.start,f)r.start)return{endDelta:f};return null}class NP{constructor(e){this.context=e,this.isRecentPointerDateSelect=!1,this.matchesCancel=!1,this.matchesEvent=!1,this.onSelect=r=>{r.jsEvent&&(this.isRecentPointerDateSelect=!0)},this.onDocumentPointerDown=r=>{let i=this.context.options.unselectCancel,c=TS(r.origEvent);this.matchesCancel=!!qt(c,i),this.matchesEvent=!!qt(c,Go.SELECTOR)},this.onDocumentPointerUp=r=>{let{context:i}=this,{documentPointer:c}=this,d=i.getCurrentData();if(!c.wasTouchScroll){if(d.dateSelection&&!this.isRecentPointerDateSelect){let f=i.options.unselectAuto;f&&(!f||!this.matchesCancel)&&i.calendarApi.unselect(r)}d.eventSelection&&!this.matchesEvent&&i.dispatch({type:"UNSELECT_EVENT"})}this.isRecentPointerDateSelect=!1};let n=this.documentPointer=new Jj(document);n.shouldIgnoreMove=!0,n.shouldWatchScroll=!1,n.emitter.on("pointerdown",this.onDocumentPointerDown),n.emitter.on("pointerup",this.onDocumentPointerUp),e.emitter.on("select",this.onSelect)}destroy(){this.context.emitter.off("select",this.onSelect),this.documentPointer.destroy()}}const EP={fixedMirrorParent:Z},SP={dateClick:Z,eventDragStart:Z,eventDragStop:Z,eventDrop:Z,eventResizeStart:Z,eventResizeStop:Z,eventResize:Z,drop:Z,eventReceive:Z,eventLeave:Z};wm.dataAttrPrefix="";var jP=qa({name:"@fullcalendar/interaction",componentInteractions:[hP,pP,Go,yP],calendarInteractions:[NP],elementDraggingImpl:Ho,optionRefiners:EP,listenerRefiners:SP});const du=({ownerId:t,isConnected:e,onStatusChange:n})=>{const[r,i]=w.useState(!1),c=async()=>{i(!0);try{const f=await fetch(`/api/auth/google/url?dentistId=${t}`),h=await f.json();if(!f.ok||h.error){alert(`Erro: ${h.error||"Falha ao obter URL de autenticação"}`),i(!1);return}const{url:p}=h,b=600,y=700,m=window.screen.width/2-b/2,v=window.screen.height/2-y/2,N=window.open(p,"google-auth",`width=${b},height=${y},left=${m},top=${v}`),S=setInterval(()=>{(!N||N.closed)&&(clearInterval(S),i(!1),n&&n())},1e3)}catch(f){console.error("Erro ao conectar Google Agenda:",f),i(!1)}},d=async()=>{if(confirm("Deseja realmente desconectar esta agenda?")){i(!0);try{await fetch(`/api/auth/google/${t}`,{method:"DELETE"}),n&&n()}catch(f){console.error("Erro ao desconectar:",f)}finally{i(!1)}}};return e?s.jsxs("div",{className:"flex items-center gap-3 bg-emerald-50 border border-emerald-100 p-4 rounded-2xl",children:[s.jsx("div",{className:"p-2 bg-emerald-500 rounded-xl",children:s.jsx(da,{size:18,className:"text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-[10px] font-black text-emerald-800 uppercase tracking-tight",children:"Google Agenda Conectada"}),s.jsx("p",{className:"text-[9px] text-emerald-600 font-bold uppercase tracking-widest mt-0.5",children:"Sincronização Ativa"})]}),s.jsx("button",{onClick:d,disabled:r,className:"text-[9px] font-black text-red-500 hover:text-red-700 uppercase tracking-widest px-3 py-1 bg-white border border-red-100 rounded-lg shadow-sm transition-all",children:r?s.jsx(Ct,{size:12,className:"animate-spin"}):"Desconectar"})]}):s.jsxs("button",{onClick:c,disabled:r,className:"w-full group relative overflow-hidden flex items-center gap-4 bg-white border-2 border-gray-100 p-4 rounded-2xl hover:border-blue-500 hover:shadow-xl hover:shadow-blue-50/50 transition-all duration-300",children:[s.jsx("div",{className:"p-3 bg-gray-50 group-hover:bg-blue-600 rounded-xl transition-colors duration-300",children:s.jsx(Et,{size:20,className:"text-gray-400 group-hover:text-white transition-colors duration-300"})}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase tracking-tight group-hover:text-blue-600",children:"Conectar Google Agenda"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-widest",children:"Sincronize horários externos"})]}),r&&s.jsx("div",{className:"absolute right-4",children:s.jsx(Ct,{size:18,className:"text-blue-600 animate-spin"})})]})},AP=({isOpen:t,onClose:e,dentists:n})=>{const[r,i]=w.useState(1),[c,d]=w.useState({clinicEmail:"",clinicCalendarId:"",googleApiKey:"",googleCalendarIds:{}}),[f,h]=w.useState(!1),[p,b]=w.useState([]),y=Fe(),m=async()=>{try{const R=await(await fetch("/api/auth/google/status")).json();b(R)}catch(j){console.error("Erro ao buscar status do Google:",j)}};w.useEffect(()=>{t&&((async()=>{try{const R=await J.getSettings();d({clinicEmail:R.clinicEmail||"",clinicCalendarId:R.clinicCalendarId||"",googleApiKey:R.googleApiKey||"",googleCalendarIds:R.googleCalendarIds||{}})}catch(R){console.error("Erro ao carregar configurações:",R)}})(),m(),i(1))},[t]);const v=j=>{const R=`/api/auth/google/url?dentistId=${j}`;navigator.clipboard.writeText(R),y.success("LINK DE CONVITE COPIADO!")},N=async()=>{h(!0);try{await J.saveSettings(c),y.success("CONFIGURAÇÕES SALVAS COM SUCESSO!"),e()}catch{y.error("ERRO AO SALVAR CONFIGURAÇÕES.")}finally{h(!1)}};if(!t)return null;const S=3;return s.jsxs("div",{className:"fixed inset-0 bg-black/60 z-[60] flex items-center justify-center backdrop-blur-md p-0",children:[s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-[2.5rem] flex flex-col overflow-hidden border border-gray-100 animate-in fade-in zoom-in-95 duration-300",children:[s.jsxs("div",{className:"px-10 py-8 border-b border-gray-50 flex justify-between items-center bg-gradient-to-br from-gray-50 to-white",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-blue-600 rounded-2xl shadow-lg shadow-blue-200",children:s.jsx(Md,{size:24,className:"text-white animate-spin-slow"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-black text-gray-900 uppercase tracking-tighter",children:"Configurações da Agenda"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-0.5",children:"Integrações e Comunicação"})]})]}),s.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-xl transition-colors text-gray-400",children:s.jsx(Qe,{size:24})})]}),s.jsx("div",{className:"h-1.5 w-full bg-gray-100 flex",children:s.jsx("div",{className:"h-full bg-blue-600 transition-all duration-500 ease-out shadow-[0_0_10px_rgba(37,99,235,0.5)]",style:{width:`${r/S*100}%`}})}),s.jsx("div",{className:"flex-1 relative overflow-hidden bg-white",children:s.jsxs("div",{className:"absolute inset-0 flex transition-transform duration-500 ease-in-out transform-gpu",style:{transform:`translateX(-${(r-1)*100}%)`},children:[s.jsxs("div",{className:"w-full shrink-0 p-10 animate-in fade-in duration-700",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[s.jsx(Rg,{className:"text-blue-600",size:24}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase tracking-tight",children:"E-mails da Clínica"})]}),s.jsx("div",{className:"space-y-6",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-[0.2em] ml-1",children:"E-mail para Notificações"}),s.jsx("input",{type:"email",placeholder:"EX: CONTATO@CLINICA.COM",className:"w-full bg-gray-50 border-2 border-transparent focus:border-blue-600 focus:bg-white rounded-2xl p-4 font-bold text-gray-800 outline-none transition-all shadow-sm",value:c.clinicEmail,onChange:j=>d({...c,clinicEmail:j.target.value.toUpperCase()})}),s.jsx("p",{className:"text-[10px] text-gray-400 italic ml-1",children:"* Este e-mail será usado para alertas de sistema e envio de comprovantes."})]})})]}),s.jsxs("div",{className:"w-full shrink-0 p-10 animate-in fade-in duration-700 overflow-y-auto custom-scrollbar",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{className:"text-emerald-600",size:24}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase tracking-tight",children:"Configuração Google Agenda"})]}),s.jsx("a",{href:"https://console.cloud.google.com/apis/library/calendar-json.googleapis.com",target:"_blank",rel:"noreferrer",className:"text-[9px] font-black text-white bg-black px-3 py-1.5 rounded-lg hover:opacity-80 transition-all uppercase tracking-widest",children:"1. Ativar API"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6 mb-8",children:[s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"bg-emerald-50 rounded-2xl p-4 border border-emerald-100",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("div",{className:"w-5 h-5 bg-emerald-600 text-white text-[10px] font-black flex items-center justify-center rounded-full",children:"1"}),s.jsx("span",{className:"text-[10px] font-black text-emerald-800 uppercase",children:"Google API Key"})]}),s.jsx("input",{type:"password",placeholder:"COLE A CHAVE AQUI",className:"w-full bg-white border border-emerald-200 rounded-xl px-4 py-2 text-xs font-bold text-gray-700 outline-none focus:ring-2 focus:ring-emerald-100",value:c.googleApiKey,onChange:j=>d({...c,googleApiKey:j.target.value})}),s.jsx("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noreferrer",className:"text-[8px] font-black text-emerald-600 hover:underline mt-2 inline-block uppercase",children:"Criar Credenciais ➔"})]})}),s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"bg-blue-50 rounded-2xl p-4 border border-blue-100",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("div",{className:"w-5 h-5 bg-blue-600 text-white text-[10px] font-black flex items-center justify-center rounded-full",children:"2"}),s.jsx("span",{className:"text-[10px] font-black text-blue-800 uppercase",children:"ID Agenda Clínica"})]}),s.jsx("input",{type:"text",placeholder:"ID DA AGENDA",className:"w-full bg-white border border-blue-200 rounded-xl px-4 py-2 text-xs font-bold text-gray-700 outline-none focus:ring-2 focus:ring-blue-100",value:c.clinicCalendarId,onChange:j=>d({...c,clinicCalendarId:j.target.value})}),s.jsx("a",{href:"https://calendar.google.com/calendar/r/settings",target:"_blank",rel:"noreferrer",className:"text-[8px] font-black text-blue-600 hover:underline mt-2 inline-block uppercase",children:"Pegar ID nas Configs ➔"})]})})]}),s.jsxs("div",{className:"bg-gray-900 rounded-3xl p-6 text-white",children:[s.jsx("h4",{className:"text-[10px] font-black text-blue-400 uppercase tracking-[0.2em] mb-4",children:"Guia de Integração"}),s.jsxs("ul",{className:"space-y-3",children:[s.jsxs("li",{className:"flex gap-3 text-xs",children:[s.jsx(da,{size:16,className:"text-emerald-500 shrink-0"}),s.jsxs("span",{className:"text-gray-300",children:["Crie um projeto no ",s.jsx("strong",{children:"Google Cloud Console"}),"."]})]}),s.jsxs("li",{className:"flex gap-3 text-xs",children:[s.jsx(da,{size:16,className:"text-emerald-500 shrink-0"}),s.jsxs("span",{className:"text-gray-300",children:["No menu 'Biblioteca', ative a ",s.jsx("strong",{children:"Google Calendar API"}),"."]})]}),s.jsxs("li",{className:"flex gap-3 text-xs",children:[s.jsx(da,{size:16,className:"text-emerald-500 shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("span",{className:"text-gray-300",children:["Pegue o ",s.jsx("strong",{children:"ID da Agenda"})," nas configurações (Integrar agenda)."]}),s.jsx("a",{href:"https://calendar.google.com/calendar/r/settings",target:"_blank",rel:"noreferrer",className:"text-[9px] font-black text-blue-400 hover:underline flex items-center gap-1 uppercase",children:"Abrir Configurações de Agenda ➔"})]})]}),s.jsxs("li",{className:"flex gap-3 text-xs",children:[s.jsx(da,{size:16,className:"text-emerald-500 shrink-0"}),s.jsxs("span",{className:"text-gray-300",children:["No Google Agenda, torne a agenda ",s.jsx("strong",{children:"Pública"})," nas autorizações de acesso."]})]})]})]})]}),s.jsxs("div",{className:"w-full shrink-0 p-10 animate-in fade-in duration-700 overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{className:"text-emerald-600",size:24}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase tracking-tight",children:"Agendas dos Dentistas"})]}),s.jsx("a",{href:"https://calendar.google.com/calendar/u/0/r/settings",target:"_blank",rel:"noreferrer",className:"text-[9px] font-black text-white bg-gray-900 px-3 py-1.5 rounded-lg hover:bg-black transition-colors uppercase tracking-widest",children:"Abrir Google Calendar"})]}),s.jsxs("div",{className:"space-y-4 flex-1 overflow-y-auto pr-4 custom-scrollbar",children:[s.jsxs("div",{className:"bg-blue-50/50 p-4 rounded-2xl border border-blue-100 mb-2",children:[s.jsx("p",{className:"text-[10px] text-blue-800 font-bold mb-1 uppercase tracking-wider",children:"Nova Integração Inteligente (OAuth2)"}),s.jsx("p",{className:"text-[10px] text-blue-600 italic",children:"Agora você pode conectar agendas sem precisar torná-las públicas ou usar API Keys."})]}),s.jsxs("div",{className:"space-y-3 mb-6",children:[s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1",children:"Sua Conta (Administrador)"}),s.jsx(du,{ownerId:"admin",isConnected:p.some(j=>j.owner_id==="admin"||j.owner_id.includes("@")),onStatusChange:m})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1",children:"Contas dos Dentistas"}),n!=null&&n.length?n.map(j=>{var C;const R=p.some(O=>O.owner_id===j.id);return s.jsxs("div",{className:"bg-gray-50 rounded-2xl p-4 border border-transparent hover:border-gray-200 transition-all",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:j.corAgenda}}),s.jsx("span",{className:"text-xs font-black text-gray-800 uppercase",children:j.nome})]}),R?s.jsx("span",{className:"text-[9px] font-black text-emerald-600 bg-emerald-100 px-2 py-1 rounded-lg uppercase",children:"Conectado"}):s.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase",children:"Não Vinculado"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx(du,{ownerId:j.id,isConnected:R,onStatusChange:m})}),!R&&s.jsx("button",{onClick:()=>v(j.id),className:"p-4 bg-gray-100 text-gray-600 rounded-2xl hover:bg-gray-200 transition-all flex items-center justify-center group",title:"Gerar Link para o Dentista",children:s.jsx($N,{size:18,className:"group-hover:scale-110 transition-transform"})})]}),s.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200/50",children:[s.jsx("label",{className:"text-[9px] font-bold text-gray-400 uppercase ml-1",children:"ID Alternativo (API Key/Legado)"}),s.jsx("input",{type:"text",placeholder:"ID DA AGENDA GOOGLE (SE NÃO USAR OAUTH2)",className:"w-full bg-white/50 border border-gray-200 rounded-xl px-4 py-2 text-[10px] font-bold text-gray-500 outline-none focus:ring-1 focus:ring-blue-100 mt-1",value:((C=c.googleCalendarIds)==null?void 0:C[j.id])||"",onChange:O=>d({...c,googleCalendarIds:{...c.googleCalendarIds,[j.id]:O.target.value}})})]})]},j.id)}):s.jsx("p",{className:"text-center text-xs text-gray-400 py-10 uppercase font-bold",children:"Nenhum dentista cadastrado."})]})]})]})]})}),s.jsxs("div",{className:"px-10 py-8 bg-gray-50/50 border-t border-gray-100 flex justify-between items-center",children:[s.jsx("div",{className:"flex gap-2",children:r>1&&s.jsxs("button",{onClick:()=>i(r-1),className:"flex items-center gap-2 px-6 py-3 text-xs font-black text-gray-500 hover:text-gray-900 bg-white rounded-2xl border border-gray-200 hover:shadow-md transition-all uppercase tracking-widest",children:[s.jsx(Bs,{size:16})," Anterior"]})}),s.jsx("div",{className:"flex gap-4",children:ri(r+1),className:"flex items-center gap-2 px-8 py-4 bg-blue-600 text-white rounded-[1.5rem] text-xs font-black uppercase tracking-widest hover:bg-blue-700 hover:shadow-xl hover:shadow-blue-200 transition-all shadow-lg shadow-blue-100",children:["Próximo ",s.jsx(Ts,{size:16})]}):s.jsx("button",{onClick:N,disabled:f,className:"flex items-center gap-2 px-10 py-4 bg-emerald-600 text-white rounded-[1.5rem] text-xs font-black uppercase tracking-widest hover:bg-emerald-700 hover:shadow-xl hover:shadow-emerald-200 transition-all shadow-lg shadow-emerald-100 disabled:bg-gray-400",children:f?"Salvando...":s.jsxs(s.Fragment,{children:[s.jsx(Io,{size:16})," Salvar Tudo"]})})})]})]}),s.jsx("style",{children:` - .animate-spin-slow { - animation: spin 8s linear infinite; - } - @keyframes spin { - from { transform: rotate(0deg); } - to { transform: rotate(360deg); } - } - .custom-scrollbar::-webkit-scrollbar { - width: 4px; - } - .custom-scrollbar::-webkit-scrollbar-track { - background: #f1f1f1; - border-radius: 10px; - } - .custom-scrollbar::-webkit-scrollbar-thumb { - background: #cbd5e1; - border-radius: 10px; - } - .custom-scrollbar::-webkit-scrollbar-thumb:hover { - background: #94a3b8; - } - `})]})};function wP(t,e){const[n,r]=w.useState(t);return w.useEffect(()=>{const i=setTimeout(()=>{r(t)},e);return()=>clearTimeout(i)},[t,e]),n}const CP=({isOpen:t,onClose:e,onSave:n,dentists:r,initialDate:i,initialAppointment:c})=>{var W;const[d,f]=w.useState(null),[h,p]=w.useState(""),[b,y]=w.useState(15),[m,v]=w.useState(i?i.split("T")[0]:new Date().toISOString().split("T")[0]),[N,S]=w.useState(i?new Date(i).toTimeString().substring(0,5):""),[j,R]=w.useState((W=r==null?void 0:r[0])==null?void 0:W.id),[C,O]=w.useState(""),[A,k]=w.useState(!1),_=wP(h,400),B=w.useCallback(()=>J.getPacientes(_).then(te=>Array.isArray(te.data)?te.data:[]),[_]),{data:F,isLoading:G}=_e(B,[_]),{data:ee,refresh:ne}=_e(J.getAgendamentos),oe=J.getActiveWorkspace(),{data:Q}=_e(()=>j&&oe?J.getHorariosByDentista(j,oe.id):Promise.resolve([]),[j,oe==null?void 0:oe.id]),ce=Fe();w.useEffect(()=>{if(t)if(c){f({nome:c.pacienteNome,cpf:"",id:"temp"});const te=new Date(c.start),T=new Date(c.end);v(te.toISOString().split("T")[0]),S(te.toTimeString().substring(0,5)),y((T.getTime()-te.getTime())/6e4),R(c.dentistaId),O(c.procedimento)}else f(null),p(""),v(i?i.split("T")[0]:new Date().toISOString().split("T")[0]),S(i?new Date(i).toTimeString().substring(0,5):""),O(""),y(15),r&&r.length>0&&R(r[0].id)},[t,i,r,c]),w.useEffect(()=>{if(!t)return;const te=T=>{T.key==="Escape"&&e()};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[t,e]);const he=r==null?void 0:r.find(te=>te.id===j),H=w.useCallback(()=>{const te=[];if(!j||!m)return te;const T=(ee??[]).filter(de=>de.dentistaId===j&&new Date(de.start).toISOString().split("T")[0]===m&&de.id!==(c==null?void 0:c.id)).map(de=>({start:new Date(de.start).getHours()*60+new Date(de.start).getMinutes(),end:new Date(de.end).getHours()*60+new Date(de.end).getMinutes()})),X=new Date(m).getUTCDay(),ie=(Q==null?void 0:Q.filter(de=>de.dia_semana===X&&de.ativo))||[];if(ie.length===0){for(let de=480;de<1080;de+=15)if(!T.some(je=>de>=je.start&&deUe>=Rn.start&&Ue{f(te),p(""),k(!1)},P=async te=>{if(te.preventDefault(),!d||!m||!N||!j||!C){ce.error("PREENCHA TODOS OS CAMPOS PARA AGENDAR.");return}const T=new Date(`${m}T${N}:00`),X=new Date(T.getTime()+b*6e4);try{const ie={pacienteNome:d.nome,dentistaId:j,start:T.toISOString(),end:X.toISOString(),status:(c==null?void 0:c.status)||"Pendente",procedimento:C.toUpperCase()};c!=null&&c.id?(await J.atualizarAgendamento(c.id,ie),ce.success(`AGENDAMENTO DE ${d.nome} ATUALIZADO!`)):(await J.salvarAgendamento(ie),ce.success(`AGENDAMENTO PARA ${d.nome} SALVO!`)),ne(),n()}catch{ce.error("ERRO AO SALVAR AGENDAMENTO.")}};return t?s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("form",{onSubmit:P,className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-orange-50 to-white",children:[s.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2 uppercase",children:[s.jsx(Et,{size:22,className:"text-orange-500"})," AGENDAR CONSULTA"]}),s.jsx("button",{type:"button",onClick:e,className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"PACIENTE"}),d?s.jsxs("div",{className:"w-full lg:w-1/2 bg-green-50 border border-green-200 p-3 lg:p-4 rounded-lg mt-2 flex justify-between items-center",children:[s.jsx("span",{className:"font-bold text-green-800 uppercase text-sm lg:text-base",children:d.nome}),s.jsx("button",{type:"button",onClick:()=>f(null),className:"text-xs font-bold bg-blue-100 text-blue-700 hover:bg-blue-200 px-3 py-1.5 rounded-md transition-colors",children:"ALTERAR"})]}):s.jsxs("div",{className:"relative mt-2",children:[s.jsx("input",{type:"text",value:h,onChange:te=>p(te.target.value.toUpperCase()),onFocus:()=>k(!0),onBlur:()=>setTimeout(()=>k(!1),200),placeholder:"DIGITE O NOME OU CPF...",className:"w-full lg:w-1/2 bg-gray-100 p-3 lg:p-4 rounded-lg font-bold text-gray-800 uppercase focus:border-blue-500 outline-none border-2 border-transparent focus:border-2 text-sm lg:text-base"}),A&&_&&s.jsxs("ul",{className:"absolute z-10 w-full lg:w-1/2 bg-white border border-gray-300 rounded-lg mt-1 max-h-48 overflow-y-auto shadow-lg",children:[G&&s.jsx("li",{className:"p-3 text-sm text-gray-500",children:"BUSCANDO..."}),F==null?void 0:F.map(te=>s.jsxs("li",{onMouseDown:()=>V(te),className:"p-3 hover:bg-gray-100 cursor-pointer uppercase font-semibold text-sm",children:[te.nome," (",te.cpf,")"]},te.id))]})]})]}),d&&s.jsx("div",{className:"animate-in fade-in space-y-6 lg:space-y-0",children:s.jsxs("div",{className:"lg:grid lg:grid-cols-3 lg:gap-x-8 lg:gap-y-6 space-y-5 lg:space-y-0",children:[s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"DENTISTA RESPONSÁVEL"}),s.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[s.jsx("select",{value:j,onChange:te=>R(te.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 lg:p-3 bg-white uppercase-select text-sm",children:r==null?void 0:r.map(te=>s.jsx("option",{value:te.id,children:te.nome},te.id))}),s.jsx("div",{className:"w-7 h-7 rounded-full flex-shrink-0 border-2 border-white shadow-md",style:{backgroundColor:(he==null?void 0:he.corAgenda)||"#ccc"}})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"DATA"}),s.jsx("input",{type:"date",value:m,onChange:te=>v(te.target.value),className:"w-full mt-2 border border-gray-300 bg-white text-gray-800 rounded-lg p-2.5 lg:p-3 text-sm"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"DURAÇÃO"}),s.jsxs("select",{value:b,onChange:te=>y(Number(te.target.value)),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 bg-white uppercase-select text-sm",children:[s.jsx("option",{value:15,children:"15 MIN"}),s.jsx("option",{value:30,children:"30 MIN"}),s.jsx("option",{value:45,children:"45 MIN"}),s.jsx("option",{value:60,children:"60 MIN"})]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"PROCEDIMENTO"}),s.jsx("input",{type:"text",value:C,onChange:te=>O(te.target.value.toUpperCase()),placeholder:"EX: AVALIAÇÃO, LIMPEZA...",className:"w-full mt-2 border border-gray-300 bg-white text-gray-800 rounded-lg p-2.5 lg:p-3 uppercase-input placeholder-gray-400 text-sm"})]})]}),s.jsxs("div",{className:"lg:col-span-2",children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"HORÁRIOS DISPONÍVEIS"}),s.jsxs("div",{className:"grid grid-cols-6 lg:grid-cols-8 xl:grid-cols-10 gap-2 mt-3",children:[H.map(te=>s.jsx("button",{type:"button",onClick:()=>S(te),className:`py-2.5 lg:py-3 rounded-lg text-sm font-bold border transition-all duration-150 ${N===te?"bg-blue-600 text-white border-blue-600 shadow-md scale-105":"bg-white text-gray-800 border-gray-300 hover:border-blue-400 hover:bg-blue-50"}`,children:te},te)),H.length===0&&s.jsx("p",{className:"col-span-6 lg:col-span-8 xl:col-span-10 text-center text-sm text-gray-400 p-8 bg-gray-50 rounded-lg border border-dashed border-gray-200 uppercase font-bold",children:"NENHUM HORÁRIO DISPONÍVEL."})]})]})]})})]}),s.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-t border-gray-200 flex justify-end gap-3 flex-shrink-0",children:[s.jsx("button",{type:"button",onClick:e,className:"px-8 py-2.5 bg-gray-200 hover:bg-gray-300 text-gray-800 font-bold rounded-lg transition-colors text-sm uppercase",children:"CANCELAR"}),s.jsxs("button",{type:"submit",disabled:!d,className:"px-10 py-2.5 bg-orange-500 hover:bg-orange-600 text-white font-bold rounded-lg shadow-sm transition-colors text-sm uppercase disabled:bg-gray-400 disabled:cursor-not-allowed flex items-center gap-2",children:[s.jsx(Et,{size:16})," CONFIRMAR"]})]})]})}):null},DP=()=>{var oe;const{data:t,refresh:e}=_e(J.getAgendamentos),{data:n,refresh:r}=_e(J.getDentistas),{data:i,refresh:c}=_e(J.getGoogleEvents),[d,f]=w.useState([]),[h,p]=w.useState(!1),[b,y]=w.useState(!1),[m,v]=w.useState(null),[N,S]=w.useState(null),[j,R]=w.useState(!1),C=Fe();w.useEffect(()=>{var Q;if(t&&n){const ce=J.getCurrentRole(),he=J.getCurrentUser(),H=ce==="dentista",V=(Q=n.find(te=>te.email===he))==null?void 0:Q.id;let P=t;H&&(P=t.filter(te=>te.dentistaId===V));const W=P.map(te=>{const T=n.find(X=>X.id===te.dentistaId);return{id:te.id,title:`${te.pacienteNome} - ${te.procedimento}`,start:te.start,end:te.end,backgroundColor:te.status==="Faltou"?"#ef4444":T?T.corAgenda:"#94a3b8",borderColor:te.status==="Faltou"?"#ef4444":T?T.corAgenda:"#94a3b8",extendedProps:{...te,isGoogle:!1,dentistaNome:T==null?void 0:T.nome}}});if(i&&i.length>0){let te=i;H&&(te=i.filter(T=>T.extendedProps.owner_id===he)),W.push(...te)}f(W)}},[t,n,i]);const O=Q=>{v(Q),p(!0)},A=Q=>{if(Q.event.extendedProps.isGoogle){C.info(`EVENTO DO GOOGLE CALENDAR: ${Q.event.title}`);return}const ce=Q.event.extendedProps;S(ce),R(!0)},k=async(Q,ce)=>{try{await J.atualizarAgendamento(Q,{status:ce}),C.success(`STATUS ATUALIZADO PARA ${ce.toUpperCase()}`),e(),R(!1)}catch{C.error("ERRO AO ATUALIZAR STATUS.")}},_=async Q=>{if(confirm("DESEJA REALMENTE EXCLUIR ESTE AGENDAMENTO?"))try{await J.excluirAgendamento(Q),C.success("AGENDAMENTO EXCLUÍDO!"),e(),R(!1)}catch{C.error("ERRO AO EXCLUIR AGENDAMENTO.")}},B=()=>{e(),c(),p(!1),S(null)},F=async Q=>{if(!Q.destination||!n)return;const ce=Array.from(n),[he]=ce.splice(Q.source.index,1);ce.splice(Q.destination.index,0,he);const H=ce.map((V,P)=>({id:V.id,ordem:P}));try{await J.reorderDentistas(H),C.success("ORDEM DOS DENTISTAS ATUALIZADA!"),r()}catch{C.error("ERRO AO REORDENAR DENTISTAS.")}},G=J.getCurrentRole(),ee=J.getCurrentUser(),ne=n==null?void 0:n.filter(Q=>G==="admin"||G==="donoclinica"||G==="funcionario"?!0:G==="dentista"?Q.email===ee:!1);return s.jsxs("div",{className:"space-y-6",children:[s.jsx(cn,{title:"AGENDA CLÍNICA",children:s.jsxs("div",{className:"flex gap-4 items-center",children:[s.jsx(Xl,{onDragEnd:F,children:s.jsx(Kl,{droppableId:"dentists-legend",direction:"horizontal",children:Q=>s.jsxs("div",{...Q.droppableProps,ref:Q.innerRef,className:"hidden lg:flex gap-2 items-center",children:[ne==null?void 0:ne.map((ce,he)=>s.jsx(Zl,{draggableId:ce.id,index:he,isDragDisabled:G==="dentista",children:(H,V)=>s.jsxs("div",{ref:H.innerRef,...H.draggableProps,...H.dragHandleProps,className:`flex items-center gap-1.5 text-[10px] text-gray-700 bg-white border border-gray-200 px-3 py-1.5 rounded-full uppercase font-bold shadow-sm transition-all ${G!=="dentista"?"cursor-grab active:cursor-grabbing hover:border-gray-300":""} ${V.isDragging?"ring-2 ring-blue-500 scale-105 shadow-lg":""}`,children:[G!=="dentista"&&s.jsx(ql,{size:12,className:"text-gray-400"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full shadow-inner",style:{backgroundColor:ce.corAgenda}}),ce.nome]})},ce.id)),Q.placeholder]})})}),(G==="admin"||G==="donoclinica")&&s.jsx("button",{onClick:()=>y(!0),className:"p-2.5 bg-white text-gray-400 hover:text-blue-600 border border-gray-200 rounded-xl transition-all hover:border-blue-200 hover:shadow-sm",children:s.jsx(Md,{size:20})}),G!=="paciente"&&s.jsxs("button",{onClick:()=>{v({dateStr:new Date().toISOString()}),p(!0)},className:"bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-bold uppercase flex items-center gap-2 hover:bg-blue-700 shadow-sm transition-colors",children:[s.jsx(ft,{size:16})," NOVO AGENDAMENTO"]})]})}),s.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-4 relative",style:{height:"750px"},children:s.jsx(Bj,{plugins:[xz,nP,jP],initialView:"timeGridWeek",headerToolbar:{left:"prev,next today",center:"title",right:"dayGridMonth,timeGridWeek,timeGridDay"},locale:"pt-br",buttonText:{today:"HOJE",month:"MÊS",week:"SEMANA",day:"DIA"},slotMinTime:"08:00:00",slotMaxTime:"19:00:00",allDaySlot:!1,events:d,dateClick:O,eventClick:A,height:"100%",slotLabelFormat:{hour:"2-digit",minute:"2-digit",hour12:!1},eventContent:Q=>{const ce=Q.event.extendedProps.isGoogle;return s.jsxs("div",{className:"p-0.5 overflow-hidden uppercase h-full",children:[s.jsx("div",{className:"text-[10px] font-bold",children:Q.timeText}),ce?s.jsx("div",{className:"text-[10px] font-black leading-tight break-words",children:Q.event.title}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-xs truncate font-bold",children:Q.event.extendedProps.pacienteNome}),s.jsx("div",{className:"text-[10px] truncate opacity-90",children:Q.event.extendedProps.procedimento})]})]})}})}),j&&N&&s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[70] flex items-center justify-center backdrop-blur-sm p-0 animate-in fade-in duration-200",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-[2rem] flex flex-col overflow-hidden border border-gray-100",children:[s.jsxs("div",{className:"px-8 py-6 border-b border-gray-50 flex justify-between items-center bg-gray-50/30",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>{R(!1),p(!0)},className:"p-2.5 bg-white text-gray-400 hover:text-blue-600 rounded-xl border border-gray-100 hover:shadow-md transition-all group",title:"EDITAR",children:s.jsx(Lo,{size:18,className:"group-hover:scale-110 transition-transform"})}),s.jsx("button",{onClick:()=>_(N.id),className:"p-2.5 bg-white text-gray-400 hover:text-red-600 rounded-xl border border-gray-100 hover:shadow-md transition-all group",title:"EXCLUIR",children:s.jsx($t,{size:18,className:"group-hover:scale-110 transition-transform"})})]}),s.jsx("button",{onClick:()=>R(!1),className:"p-2 hover:bg-gray-100 rounded-full transition-colors text-gray-400",children:s.jsx(Qe,{size:24})})]}),s.jsxs("div",{className:"p-10 space-y-8",children:[s.jsxs("div",{className:"flex items-start gap-5",children:[s.jsx("div",{className:"p-4 bg-blue-50 rounded-2xl",children:s.jsx(zo,{size:28,className:"text-blue-600"})}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("h3",{className:"text-xl font-black text-gray-900 leading-none uppercase tracking-tighter",children:N.pacienteNome}),s.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-2 bg-gray-100 px-3 py-1 rounded-full w-fit",children:[s.jsx(ua,{size:12,className:"text-blue-400"})," ",N.procedimento]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-8 py-6 border-y border-gray-50",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Data e Hora"}),s.jsxs("div",{className:"flex items-center gap-2 text-sm font-bold text-gray-700",children:[s.jsx(AC,{size:16,className:"text-blue-500"}),new Date(N.start).toLocaleDateString("pt-BR",{weekday:"long",day:"numeric",month:"long"})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm font-bold text-gray-700",children:[s.jsx(Fl,{size:16,className:"text-blue-500"}),new Date(N.start).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Profissional"}),s.jsxs("div",{className:"flex items-center gap-2 text-sm font-bold text-gray-700",children:[s.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow-sm",style:{backgroundColor:(oe=n==null?void 0:n.find(Q=>Q.id===N.dentistaId))==null?void 0:oe.corAgenda}}),N.dentistaNome]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1",children:"Status do Atendimento"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("button",{onClick:()=>k(N.id,"Faltou"),className:`flex items-center justify-center gap-2 py-4 rounded-2xl text-xs font-black uppercase tracking-widest transition-all border-2 ${N.status==="Faltou"?"bg-red-50 text-red-600 border-red-200":"bg-white border-gray-100 text-gray-500 hover:border-red-200 hover:text-red-500"}`,children:[s.jsx(gu,{size:16})," Marcar Falta"]}),s.jsxs("button",{onClick:()=>k(N.id,"Confirmado"),className:`flex items-center justify-center gap-2 py-4 rounded-2xl text-xs font-black uppercase tracking-widest transition-all border-2 ${N.status==="Confirmado"?"bg-emerald-50 text-emerald-600 border-emerald-200":"bg-white border-gray-100 text-gray-500 hover:border-emerald-200 hover:text-emerald-500"}`,children:[s.jsx(da,{size:16})," Confirmar"]})]})]})]}),s.jsx("div",{className:"px-10 py-8 bg-gray-50/50 border-t border-gray-100 flex gap-4",children:s.jsx("button",{onClick:()=>{R(!1),p(!0)},className:"flex-1 py-4 bg-blue-600 text-white rounded-2xl text-xs font-black uppercase tracking-widest hover:bg-blue-700 hover:shadow-xl hover:shadow-blue-200 transition-all shadow-lg shadow-blue-100",children:"Reagendar Consulta"})})]})}),s.jsx("style",{children:` - .animate-in { animation: animate-in 0.2s ease-out; } - @keyframes animate-in { - from { opacity: 0; transform: scale(0.95); } - to { opacity: 1; transform: scale(1); } - } - .custom-scrollbar::-webkit-scrollbar { width: 4px; } - .custom-scrollbar::-webkit-scrollbar-track { background: #f1f1f1; } - .custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; } - `}),s.jsx(CP,{isOpen:h,onClose:()=>{p(!1),S(null)},onSave:B,dentists:n,initialDate:m==null?void 0:m.dateStr,initialAppointment:N}),s.jsx(AP,{isOpen:b,onClose:()=>y(!1),dentists:n})]})};function sA(t){if(!t)return null;const e=new Date(t),n=new Date;let r=n.getFullYear()-e.getFullYear();const i=n.getMonth()-e.getMonth();return(i<0||i===0&&n.getDate(){var r;const e=sA(t.dataNascimento),n=OP(e);return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-5 shadow-sm",children:[s.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-14 h-14 bg-purple-100 text-purple-600 rounded-full flex items-center justify-center font-bold text-lg flex-shrink-0",children:t.pacienteNome.substring(0,2)}),s.jsxs("div",{children:[s.jsxs("h2",{className:"text-xl font-bold text-gray-900 uppercase",children:[t.pacienteNome," ",e!==null&&s.jsxs("span",{className:"text-gray-500 font-normal",children:["— ",e," ANOS"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 mt-1",children:[n&&s.jsx("span",{className:"text-[10px] font-bold bg-purple-100 text-purple-700 px-2 py-0.5 rounded-full uppercase",children:n}),s.jsx("span",{className:"text-[10px] font-bold bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full uppercase",children:t.classificacao||((r=t.diagnostico)==null?void 0:r.classeAngle)}),s.jsxs("span",{className:"text-[10px] font-bold bg-blue-100 text-blue-600 px-2 py-0.5 rounded-full uppercase",children:["FASE: ",t.faseAtual]}),s.jsxs("span",{className:"text-[10px] font-bold bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full uppercase",children:["FIO ",t.fioAtual]}),t.cooperacao&&s.jsxs("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full uppercase ${Im[t.cooperacao]||""}`,children:["COOPERAÇÃO ",t.cooperacao.toUpperCase()]})]})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-4 text-xs uppercase font-bold text-gray-500",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Et,{size:14})," ÚLTIMA: ",t.ultimaConsulta?new Date(t.ultimaConsulta).toLocaleDateString():"—"]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Et,{size:14,className:"text-blue-500"})," PRÓX: ",t.proximaConsulta?new Date(t.proximaConsulta).toLocaleDateString():"—"]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Fl,{size:14})," ",t.mesesRestantes??"?"," MESES RESTANTES"]})]})]}),t.percentualConcluido!=null&&s.jsxs("div",{className:"mt-4",children:[s.jsxs("div",{className:"flex justify-between text-[10px] font-bold text-gray-500 uppercase mb-1",children:[s.jsx("span",{children:"PROGRESSO DO TRATAMENTO"}),s.jsxs("span",{children:[t.percentualConcluido,"%"]})]}),s.jsx("div",{className:"w-full bg-gray-100 rounded-full h-2.5",children:s.jsx("div",{className:"bg-blue-500 h-2.5 rounded-full transition-all duration-500",style:{width:`${t.percentualConcluido}%`}})})]}),t.flags&&t.flags.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mt-3",children:t.flags.map((i,c)=>{const d=uu[i.tipo]||uu.info;return s.jsxs("div",{className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg border text-xs font-bold uppercase ${d.bg} ${d.text}`,children:[d.icon," ",i.mensagem]},c)})}),t.responsavel&&s.jsxs("p",{className:"mt-2 text-[10px] text-gray-400 font-bold uppercase",children:["RESPONSÁVEL: ",t.responsavel]})]})},kP=({t})=>{const[e,n]=w.useState(!1),r=t.triagem;if(!r)return null;const i=sA(t.dataNascimento),c=i!==null&&i>=18;return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[s.jsxs("button",{onClick:()=>n(!e),className:"w-full px-5 py-3 flex justify-between items-center bg-gray-50 hover:bg-gray-100 transition-colors",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2",children:[s.jsx(ua,{size:16,className:"text-purple-500"})," TRIAGEM CLÍNICA"]}),e?s.jsx(Dg,{size:18,className:"text-gray-400"}):s.jsx(_o,{size:18,className:"text-gray-400"})]}),e&&s.jsxs("div",{className:"p-5 grid grid-cols-1 md:grid-cols-2 gap-4 text-sm animate-in fade-in",children:[s.jsx(xt,{label:"QUEIXA PRINCIPAL",value:r.queixaPrincipal}),s.jsx(xt,{label:"HISTÓRICO MÉDICO",value:r.historicoMedico}),s.jsx(xt,{label:"MEDICAÇÃO",value:r.medicacao}),s.jsx(xt,{label:"ALERGIAS",value:r.alergias}),s.jsx(xt,{label:"RESPIRAÇÃO BUCAL",value:r.respiracaoBucal?"SIM":"NÃO"}),s.jsx(xt,{label:"HÁBITOS",value:r.habitos}),c&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"col-span-full border-t pt-3 mt-1",children:s.jsx("span",{className:"text-[10px] font-bold text-purple-500 uppercase",children:"CAMPOS ADULTO"})}),s.jsx(xt,{label:"PERIODONTO",value:r.periodonto}),s.jsx(xt,{label:"IMPLANTES",value:r.implantes}),s.jsx(xt,{label:"RECESSÕES",value:r.recessoes}),s.jsx(xt,{label:"MOBILIDADE",value:r.mobilidade})]})]})]})},_P=({t})=>{const[e,n]=w.useState(!1),r=t.diagnostico;return r?s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[s.jsxs("button",{onClick:()=>n(!e),className:"w-full px-5 py-3 flex justify-between items-center bg-gray-50 hover:bg-gray-100 transition-colors",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2",children:[s.jsx(za,{size:16,className:"text-blue-500"})," DIAGNÓSTICO ORTODÔNTICO"]}),e?s.jsx(Dg,{size:18,className:"text-gray-400"}):s.jsx(_o,{size:18,className:"text-gray-400"})]}),e&&s.jsxs("div",{className:"p-5 grid grid-cols-2 md:grid-cols-3 gap-4 text-sm animate-in fade-in",children:[s.jsx(xt,{label:"CLASSE ANGLE",value:r.classeAngle,highlight:!0}),s.jsx(xt,{label:"PERFIL",value:r.perfil}),s.jsx(xt,{label:"APINHAMENTO",value:r.apinhamento,highlight:r.apinhamento==="Severo"}),s.jsx(xt,{label:"MORDIDA",value:r.mordida}),s.jsx(xt,{label:"LINHA MÉDIA",value:r.linhaMedia})]})]}):null},MP=({t})=>{const[e,n]=w.useState(!0);return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[s.jsxs("button",{onClick:()=>n(!e),className:"w-full px-5 py-3 flex justify-between items-center bg-gray-50 hover:bg-gray-100 transition-colors",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2",children:[s.jsx(hD,{size:16,className:"text-pink-500"})," PLANO DE TRATAMENTO"]}),e?s.jsx(Dg,{size:18,className:"text-gray-400"}):s.jsx(_o,{size:18,className:"text-gray-400"})]}),e&&s.jsxs("div",{className:"p-5 space-y-3 text-sm animate-in fade-in",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[s.jsx(xt,{label:"APARELHO",value:t.tipoAparelho,highlight:!0}),s.jsx(xt,{label:"EXTRAÇÕES",value:t.extracoes}),s.jsx(xt,{label:"ELÁSTICOS",value:t.elasticos}),s.jsx(xt,{label:"IPR PLANEJADO",value:t.iprPlanejado}),s.jsx(xt,{label:"TEMPO ESTIMADO",value:t.tempoEstimado}),t.valor!=null&&s.jsx(xt,{label:"VALOR",value:`R$ ${t.valor.toLocaleString("pt-BR",{minimumFractionDigits:2})}`}),t.formaPagamento&&s.jsx(xt,{label:"PAGAMENTO",value:t.formaPagamento})]}),t.sequenciaFios&&s.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 border border-gray-100 mt-2",children:[s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"SEQUÊNCIA DE FIOS"}),s.jsx("p",{className:"font-bold text-gray-800 mt-1 tracking-wide",children:t.sequenciaFios})]})]})]})},IP=({evolucoes:t})=>{const e=[...t].sort((n,r)=>new Date(r.data).getTime()-new Date(n.data).getTime());return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(Vl,{size:16,className:"text-blue-500"})," LINHA DO TEMPO — ",t.length," EVENTO",t.length!==1&&"S"]}),s.jsx("div",{className:"space-y-4 relative before:absolute before:left-[7px] before:top-2 before:bottom-2 before:w-0.5 before:bg-gray-200",children:e.map(n=>{var r;return s.jsxs("div",{className:"relative pl-7",children:[s.jsx("div",{className:`absolute left-0 top-1.5 w-3.5 h-3.5 rounded-full z-10 border-2 ${n.tipo==="Falta"?"bg-red-500 border-red-300":n.tipo==="Colagem"?"bg-green-500 border-green-300":"bg-white border-blue-500"}`}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 border border-gray-100",children:[s.jsxs("div",{className:"flex flex-wrap justify-between items-start gap-2 mb-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-bold text-gray-900 text-sm",children:new Date(n.data).toLocaleDateString()}),s.jsx("span",{className:"text-[9px] font-bold bg-gray-200 text-gray-600 px-2 py-0.5 rounded-full uppercase",children:n.tipo})]}),s.jsxs("span",{className:"text-[10px] text-blue-600 flex items-center gap-1 font-bold uppercase",children:["PRÓX: ",new Date(n.proximoRetorno).toLocaleDateString()," ",s.jsx(Ls,{size:10})]})]}),s.jsx("p",{className:"text-xs text-gray-700 uppercase font-medium",children:n.procedimento}),s.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[n.fio&&s.jsxs("span",{className:"text-[9px] font-bold bg-blue-50 text-blue-600 px-2 py-0.5 rounded-full uppercase",children:["FIO: ",n.fio]}),n.elastico&&s.jsxs("span",{className:"text-[9px] font-bold bg-purple-50 text-purple-600 px-2 py-0.5 rounded-full uppercase",children:["ELÁSTICO: ",n.elastico]}),(r=n.procedimentos)==null?void 0:r.map((i,c)=>s.jsx("span",{className:"text-[9px] font-bold bg-green-50 text-green-600 px-2 py-0.5 rounded-full uppercase",children:i},c)),n.higiene!=null&&s.jsxs("span",{className:`text-[9px] font-bold px-2 py-0.5 rounded-full uppercase ${n.higiene>=7?"bg-green-50 text-green-600":n.higiene>=5?"bg-amber-50 text-amber-600":"bg-red-50 text-red-600"}`,children:["HIGIENE: ",n.higiene,"/10"]}),n.cooperacao&&s.jsxs("span",{className:`text-[9px] font-bold px-2 py-0.5 rounded-full uppercase ${Im[n.cooperacao]||""}`,children:["COOP: ",n.cooperacao.toUpperCase()]})]}),n.observacoes&&s.jsx("p",{className:"text-[10px] text-gray-500 mt-2 italic uppercase",children:n.observacoes})]})]},n.id)})})]})},LP=({tratamentoId:t,currentFio:e,onSaved:n})=>{const r=Fe(),[i,c]=w.useState("Manutenção"),[d,f]=w.useState(e||""),[h,p]=w.useState(""),[b,y]=w.useState([]),[m,v]=w.useState(7),[N,S]=w.useState("Boa"),[j,R]=w.useState(""),[C,O]=w.useState(""),A=_=>{y(B=>B.includes(_)?B.filter(F=>F!==_):[...B,_])},k=async()=>{const _=[i,d&&`FIO ${d}`,h&&`ELÁSTICO ${h}`,...b].filter(Boolean).join(" + ");try{await J.saveEvolucaoOrto(t,{tipo:i,procedimento:_.toUpperCase(),proximoRetorno:C,fio:d||void 0,elastico:h||void 0,procedimentos:b.length>0?b:void 0,higiene:m,cooperacao:N,observacoes:j.toUpperCase()||void 0}),r.success("EVOLUÇÃO SALVA COM SUCESSO!"),c("Manutenção"),p(""),y([]),v(7),S("Boa"),R(""),O(""),n()}catch{r.error("ERRO AO SALVAR EVOLUÇÃO.")}};return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(ft,{size:16,className:"text-green-500"})," NOVA EVOLUÇÃO"]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"TIPO EVENTO"}),s.jsxs("select",{value:i,onChange:_=>c(_.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1",children:[s.jsx("option",{children:"Manutenção"}),s.jsx("option",{children:"Troca de fio"}),s.jsx("option",{children:"Colagem"}),s.jsx("option",{children:"Emergência"}),s.jsx("option",{children:"Falta"}),s.jsx("option",{children:"Finalização"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"FIO"}),s.jsxs("select",{value:d,onChange:_=>f(_.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1",children:[s.jsx("option",{value:"",children:"— MANTER ATUAL —"}),s.jsx("option",{children:"0.12"}),s.jsx("option",{children:"0.14"}),s.jsx("option",{children:"0.16"}),s.jsx("option",{children:"0.18"}),s.jsx("option",{children:"0.20x0.25"}),s.jsx("option",{children:"0.19x0.25"}),s.jsx("option",{children:"0.21x0.25"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"ELÁSTICO"}),s.jsxs("select",{value:h,onChange:_=>p(_.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1",children:[s.jsx("option",{value:"",children:"— NENHUM —"}),s.jsx("option",{children:"CLASSE II"}),s.jsx("option",{children:"CLASSE III"}),s.jsx("option",{children:"VERTICAL"}),s.jsx("option",{children:"CRUZADO"})]})]})]}),s.jsxs("div",{className:"mt-4",children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"PROCEDIMENTOS REALIZADOS"}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:RP.map(_=>s.jsxs("button",{type:"button",onClick:()=>A(_.label),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-bold uppercase border transition-all ${b.includes(_.label)?"bg-green-600 text-white border-green-600 shadow-sm":"bg-white text-gray-600 border-gray-300 hover:border-green-400 hover:bg-green-50"}`,children:[_.icon," ",_.label]},_.label))})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"HIGIENE (1–10)"}),s.jsx("input",{type:"range",min:1,max:10,value:m,onChange:_=>v(Number(_.target.value)),className:"w-full mt-2"}),s.jsxs("div",{className:"text-center font-bold text-lg mt-1",children:[m,s.jsx("span",{className:"text-gray-400 text-xs",children:"/10"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"COOPERAÇÃO"}),s.jsxs("select",{value:N,onChange:_=>S(_.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1",children:[s.jsx("option",{children:"Boa"}),s.jsx("option",{children:"Média"}),s.jsx("option",{children:"Ruim"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"PRÓXIMO RETORNO"}),s.jsx("input",{type:"date",value:C,onChange:_=>O(_.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white mt-1"})]})]}),s.jsxs("div",{className:"mt-4",children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"OBSERVAÇÕES CLÍNICAS"}),s.jsx("textarea",{value:j,onChange:_=>R(_.target.value.toUpperCase()),placeholder:"ANOTAÇÕES LIVRES...",className:"w-full border border-gray-300 rounded-lg p-3 mt-1 h-20 uppercase-textarea text-sm"})]}),s.jsxs("button",{onClick:k,className:"mt-4 w-full bg-green-600 hover:bg-green-700 text-white py-3 rounded-lg font-bold uppercase text-sm transition-colors shadow-sm flex items-center justify-center gap-2",children:[s.jsx(Ua,{size:16})," SALVAR EVOLUÇÃO"]})]})},zP=({t})=>{var e,n,r,i;return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(Ad,{size:16,className:"text-indigo-500"})," COMPARATIVO FOTOGRÁFICO"]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"border-2 border-dashed border-gray-200 rounded-xl p-8 flex flex-col items-center justify-center text-center bg-gray-50 min-h-[160px]",children:[s.jsx(Ad,{size:32,className:"text-gray-300 mb-2"}),s.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase",children:"INÍCIO"}),((n=(e=t.fotos)==null?void 0:e.find(c=>c.tipo==="inicio"))==null?void 0:n.data)&&s.jsx("span",{className:"text-[10px] text-gray-400 mt-1",children:new Date(t.fotos.find(c=>c.tipo==="inicio").data).toLocaleDateString()})]}),s.jsxs("div",{className:"border-2 border-dashed border-gray-200 rounded-xl p-8 flex flex-col items-center justify-center text-center bg-gray-50 min-h-[160px]",children:[s.jsx(Ad,{size:32,className:"text-gray-300 mb-2"}),s.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase",children:"ATUAL"}),((i=(r=t.fotos)==null?void 0:r.find(c=>c.tipo==="atual"))==null?void 0:i.data)&&s.jsx("span",{className:"text-[10px] text-gray-400 mt-1",children:new Date(t.fotos.find(c=>c.tipo==="atual").data).toLocaleDateString()})]})]}),s.jsxs("button",{className:"mt-4 w-full border-2 border-dashed border-gray-300 hover:border-blue-400 hover:bg-blue-50 py-3 rounded-lg text-xs font-bold text-gray-500 hover:text-blue-600 uppercase transition-colors flex items-center justify-center gap-2",children:[s.jsx(SO,{size:16})," UPLOAD FOTOS"]})]})},PP=({t,onFinalize:e})=>{const n=Fe(),[r,i]=w.useState({alinhamento:!1,oclusao:!1,raizes:!1,estetica:!1}),[c,d]=w.useState("CONTENÇÃO FIXA INFERIOR"),[f,h]=w.useState(!1),[p,b]=w.useState(!0),[y,m]=w.useState("PERMANENTE"),v=Object.values(r).every(Boolean),N=async()=>{if(!v){n.error("PREENCHA TODOS OS CRITÉRIOS DO CHECKLIST.");return}try{await J.finalizarTratamentoOrto(t.id,{tipo:c,superior:f,inferior:p,tempoUso:y}),n.success("TRATAMENTO FINALIZADO COM SUCESSO!"),e()}catch{n.error("ERRO AO FINALIZAR TRATAMENTO.")}};return t.status==="Finalizado"?s.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-xl p-5 text-center",children:[s.jsx(Ua,{size:32,className:"text-green-500 mx-auto mb-2"}),s.jsx("h3",{className:"font-bold text-green-700 uppercase",children:"TRATAMENTO FINALIZADO"}),t.contencaoTipo&&s.jsxs("p",{className:"text-xs text-green-600 mt-1 uppercase",children:["CONTENÇÃO: ",t.contencaoTipo]})]}):s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(Sr,{size:16,className:"text-green-500"})," FINALIZAÇÃO E CONTENÇÃO"]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"CHECKLIST OBRIGATÓRIO"}),s.jsx("div",{className:"space-y-2 mt-2",children:Object.entries({alinhamento:"ALINHAMENTO OK",oclusao:"OCLUSÃO OK",raizes:"RAÍZES PARALELAS",estetica:"ESTÉTICA ACEITA"}).map(([S,j])=>s.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:r[S],onChange:()=>i(R=>({...R,[S]:!R[S]})),className:"w-4 h-4 rounded border-gray-300 text-green-600"}),s.jsx("span",{className:"font-bold uppercase text-gray-700",children:j})]},S))})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"TIPO CONTENÇÃO"}),s.jsxs("select",{value:c,onChange:S=>d(S.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1 text-sm",children:[s.jsx("option",{children:"CONTENÇÃO FIXA INFERIOR"}),s.jsx("option",{children:"CONTENÇÃO FIXA SUPERIOR E INFERIOR"}),s.jsx("option",{children:"PLACA DE CONTENÇÃO REMOVÍVEL"}),s.jsx("option",{children:"ESSIX (ALINHADOR)"})]})]}),s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:f,onChange:()=>h(!f),className:"w-4 h-4 rounded"}),s.jsx("span",{className:"font-bold uppercase text-gray-700",children:"SUPERIOR"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:p,onChange:()=>b(!p),className:"w-4 h-4 rounded"}),s.jsx("span",{className:"font-bold uppercase text-gray-700",children:"INFERIOR"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"TEMPO DE USO"}),s.jsxs("select",{value:y,onChange:S=>m(S.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1 text-sm",children:[s.jsx("option",{children:"PERMANENTE"}),s.jsx("option",{children:"6 MESES"}),s.jsx("option",{children:"12 MESES"}),s.jsx("option",{children:"24 MESES"})]})]})]})]}),s.jsxs("button",{onClick:N,disabled:!v,className:`mt-5 w-full py-3 rounded-lg font-bold uppercase text-sm transition-colors flex items-center justify-center gap-2 ${v?"bg-green-600 hover:bg-green-700 text-white shadow-sm":"bg-gray-200 text-gray-400 cursor-not-allowed"}`,children:[s.jsx(Ua,{size:16})," FINALIZAR TRATAMENTO"]})]})},UP=({t})=>{Fe();const[e,n]=w.useState(350),[r,i]=w.useState(!1);return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(PN,{size:16,className:"text-orange-500"})," CONTENÇÃO — TERMO E VALOR"]}),s.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 mb-4",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(gu,{size:18,className:"text-amber-600 flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-bold text-amber-700 uppercase mb-1",children:"TERMO DE CIÊNCIA"}),s.jsxs("p",{className:"text-xs text-amber-800 leading-relaxed",children:["O PACIENTE DECLARA ESTAR CIENTE DE QUE A ",s.jsx("strong",{children:"CONTENÇÃO ORTODÔNTICA"})," (FIXA E/OU REMOVÍVEL) É UM PROCEDIMENTO ",s.jsx("strong",{children:"SEPARADO DO TRATAMENTO ORTODÔNTICO"})," E ",s.jsx("strong",{children:"NÃO ESTÁ INCLUÍDA NO VALOR DA MANUTENÇÃO MENSAL"}),". O CUSTO DA CONTENÇÃO SERÁ COBRADO À PARTE, CONFORME VALORES ABAIXO INFORMADOS."]})]})]})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"VALOR DA CONTENÇÃO (R$)"}),s.jsx("input",{type:"number",value:e,onChange:c=>n(Number(c.target.value)),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white mt-1 text-sm font-bold",min:0,step:50}),s.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"VALOR COBRADO SEPARADAMENTE DA MENSALIDADE"})]}),s.jsx("div",{className:"flex flex-col justify-end",children:s.jsxs("label",{className:"flex items-start gap-2 cursor-pointer bg-gray-50 border border-gray-200 rounded-lg p-3",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:()=>i(!r),className:"w-4 h-4 rounded border-gray-300 text-orange-600 mt-0.5"}),s.jsx("span",{className:"text-xs font-bold uppercase text-gray-700 leading-relaxed",children:"PACIENTE CIENTE E DE ACORDO COM A COBRANÇA SEPARADA DA CONTENÇÃO"})]})})]}),r&&s.jsxs("div",{className:"mt-3 bg-green-50 border border-green-200 rounded-lg p-3 flex items-center gap-2",children:[s.jsx(Ua,{size:16,className:"text-green-500"}),s.jsxs("span",{className:"text-xs font-bold text-green-700 uppercase",children:["TERMO ACEITO — R$ ",e.toLocaleString("pt-BR",{minimumFractionDigits:2})]})]})]})},BP=({t})=>{const e=Fe(),[n,r]=w.useState([]),[i,c]=w.useState("LIMPEZA / PROFILAXIA"),[d,f]=w.useState(""),[h,p]=w.useState(""),b=["LIMPEZA / PROFILAXIA","DENTE COM CÁRIE","DENTE PARA EXTRAIR","RASPAGEM PERIODONTAL"],y=()=>{r(v=>[...v,{tipo:i,dente:d.toUpperCase()||void 0,obs:h.toUpperCase()||void 0}]),f(""),p(""),e.success("SOLICITAÇÃO ADICIONADA!")},m=v=>{r(N=>N.filter((S,j)=>j!==v))};return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(ua,{size:16,className:"text-red-500"})," SOLICITAÇÕES CLÍNICAS"]}),n.length>0&&s.jsx("div",{className:"space-y-2 mb-4",children:n.map((v,N)=>s.jsxs("div",{className:"flex items-center justify-between bg-gray-50 border border-gray-200 rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${v.tipo.includes("CÁRIE")?"bg-red-500":v.tipo.includes("EXTRAIR")?"bg-orange-500":v.tipo.includes("RASPAGEM")?"bg-purple-500":"bg-blue-500"}`}),s.jsxs("div",{children:[s.jsx("span",{className:"text-xs font-bold text-gray-800 uppercase",children:v.tipo}),v.dente&&s.jsxs("span",{className:"text-[10px] text-gray-500 ml-2",children:["DENTE: ",v.dente]}),v.obs&&s.jsx("p",{className:"text-[10px] text-gray-400 italic",children:v.obs})]})]}),s.jsx("button",{onClick:()=>m(N),className:"text-gray-400 hover:text-red-500 transition-colors",children:s.jsx(Qe,{size:16})})]},N))}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"TIPO"}),s.jsx("select",{value:i,onChange:v=>c(v.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white mt-1 text-sm",children:b.map(v=>s.jsx("option",{children:v},v))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"DENTE (OPCIONAL)"}),s.jsx("input",{type:"text",value:d,onChange:v=>f(v.target.value),placeholder:"EX: 36, 14",className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white mt-1 text-sm uppercase"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"OBSERVAÇÃO"}),s.jsx("input",{type:"text",value:h,onChange:v=>p(v.target.value),placeholder:"DETALHES...",className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white mt-1 text-sm uppercase"})]})]}),s.jsxs("button",{onClick:y,className:"mt-3 w-full border-2 border-dashed border-gray-300 hover:border-blue-400 hover:bg-blue-50 py-2.5 rounded-lg text-xs font-bold text-gray-500 hover:text-blue-600 uppercase transition-colors flex items-center justify-center gap-2",children:[s.jsx(ft,{size:14})," ADICIONAR SOLICITAÇÃO"]})]})},HP=({t})=>{const e=Fe(),n=()=>{const c=[...t.evolucoes].sort((f,h)=>new Date(f.data).getTime()-new Date(h.data).getTime()),d=["════════════════════════════════════════════════════════"," RELATÓRIO DE MANUTENÇÕES ORTODÔNTICAS","════════════════════════════════════════════════════════","",`PACIENTE: ${t.pacienteNome}`,`APARELHO: ${t.tipoAparelho}`,`INÍCIO: ${new Date(t.dataInicio).toLocaleDateString()}`,`STATUS: ${t.status}`,`FASE ATUAL: ${t.faseAtual||"—"}`,`FIO ATUAL: ${t.fioAtual||"—"}`,`PROGRESSO: ${t.percentualConcluido??"—"}%`,"","────────────────────────────────────────────────────────",` TOTAL DE ATENDIMENTOS: ${c.length}`,"────────────────────────────────────────────────────────",""];return c.forEach((f,h)=>{var p;d.push(` #${h+1} | ${new Date(f.data).toLocaleDateString()} | ${f.tipo}`),d.push(` ${f.procedimento}`),f.fio&&d.push(` FIO: ${f.fio}`),f.elastico&&d.push(` ELÁSTICO: ${f.elastico}`),(p=f.procedimentos)!=null&&p.length&&d.push(` PROC: ${f.procedimentos.join(", ")}`),f.higiene!=null&&d.push(` HIGIENE: ${f.higiene}/10`),f.cooperacao&&d.push(` COOPERAÇÃO: ${f.cooperacao}`),f.observacoes&&d.push(` OBS: ${f.observacoes}`),d.push(` PRÓXIMO RETORNO: ${new Date(f.proximoRetorno).toLocaleDateString()}`),d.push("")}),d.push("────────────────────────────────────────────────────────"),d.push(` GERADO EM: ${new Date().toLocaleString()}`),d.push(" SCOREODONTO — GESTÃO ORTODÔNTICA"),d.push("════════════════════════════════════════════════════════"),d.join(` -`)},r=()=>{const c=n(),d=new Blob([c],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(d),h=document.createElement("a");h.href=f,h.download=`RELATORIO_ORTO_${t.pacienteNome.replace(/\s+/g,"_")}_${new Date().toISOString().split("T")[0]}.txt`,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(f),e.success("RELATÓRIO EXPORTADO COM SUCESSO!")},i=()=>{const c=n();navigator.clipboard.writeText(c).then(()=>{e.success("RELATÓRIO COPIADO PARA ÁREA DE TRANSFERÊNCIA!")})};return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(Jy,{size:16,className:"text-teal-500"})," RELATÓRIO DE MANUTENÇÕES"]}),s.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 mb-4",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-center",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-gray-800",children:t.evolucoes.length}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"ATENDIMENTOS"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-gray-800",children:new Date(t.dataInicio).toLocaleDateString()}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"INÍCIO"})]}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-2xl font-bold text-gray-800",children:[t.percentualConcluido??"—","%"]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"PROGRESSO"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-gray-800",children:t.mesesRestantes??"—"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"MESES REST."})]})]})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[s.jsxs("button",{onClick:r,className:"bg-teal-600 hover:bg-teal-700 text-white py-3 rounded-lg font-bold uppercase text-sm transition-colors shadow-sm flex items-center justify-center gap-2",children:[s.jsx(Jy,{size:16})," EXPORTAR RELATÓRIO (.TXT)"]}),s.jsxs("button",{onClick:i,className:"bg-gray-600 hover:bg-gray-700 text-white py-3 rounded-lg font-bold uppercase text-sm transition-colors shadow-sm flex items-center justify-center gap-2",children:[s.jsx(PN,{size:16})," COPIAR PARA ÁREA DE TRANSFERÊNCIA"]})]})]})},xt=({label:t,value:e,highlight:n})=>s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:t}),s.jsx("p",{className:`font-bold uppercase mt-0.5 ${n?"text-blue-600":"text-gray-800"}`,children:e||"—"})]}),GP=({treatment:t,onClose:e})=>{const[n,r]=w.useState(t),{refresh:i}=_e(J.getOrtoTreatments),c=w.useCallback(()=>{J.getOrtoTreatments().then(d=>{const f=d.find(h=>h.id===n.id);f&&r(f)})},[n.id]);return w.useEffect(()=>{const d=f=>{f.key==="Escape"&&e()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e]),s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-gray-50 shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-3 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-white",children:[s.jsxs("button",{onClick:e,className:"flex items-center gap-2 text-gray-500 hover:text-gray-800 text-xs font-bold uppercase transition-colors",children:[s.jsx(MN,{size:16})," VOLTAR À LISTA"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`px-3 py-1 rounded-full text-[10px] font-bold uppercase ${n.status==="Finalizado"?"bg-green-100 text-green-700":n.status==="Contenção"?"bg-blue-100 text-blue-700":"bg-amber-100 text-amber-700"}`,children:n.status}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:20})})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 lg:p-6 space-y-5",children:[s.jsx(TP,{t:n}),s.jsx(kP,{t:n}),s.jsx(_P,{t:n}),s.jsx(MP,{t:n}),s.jsx(IP,{evolucoes:n.evolucoes}),s.jsx(LP,{tratamentoId:n.id,currentFio:n.fioAtual,onSaved:c}),s.jsx(zP,{t:n}),s.jsx(UP,{t:n}),s.jsx(BP,{t:n}),s.jsx(HP,{t:n}),s.jsx(PP,{t:n,onFinalize:()=>{i(),e()}})]})]})})},VP=()=>{const{data:t,refresh:e}=_e(J.getOrtoTreatments),[n,r]=w.useState(null);return s.jsxs("div",{className:"space-y-6",children:[s.jsx(cn,{title:"GESTÃO ORTODÔNTICA",children:s.jsxs("button",{className:"bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 hover:bg-blue-700 text-xs font-bold uppercase transition-colors shadow-sm",children:[s.jsx(ft,{size:18})," NOVO TRATAMENTO"]})}),s.jsx("div",{className:"grid grid-cols-1 gap-6",children:t==null?void 0:t.map(i=>s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-shadow cursor-pointer",onClick:()=>r(i),children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50 flex justify-between items-center",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 bg-purple-100 text-purple-600 rounded-full flex items-center justify-center font-bold text-sm",children:i.pacienteNome.substring(0,2).toUpperCase()}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-gray-900 uppercase",children:i.pacienteNome}),s.jsxs("p",{className:"text-[10px] text-gray-500 uppercase font-bold",children:[i.tipoAparelho," • INÍCIO: ",new Date(i.dataInicio).toLocaleDateString(),i.faseAtual&&` • FASE: ${i.faseAtual}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[i.percentualConcluido!=null&&s.jsxs("div",{className:"hidden md:flex items-center gap-2",children:[s.jsx("div",{className:"w-24 bg-gray-200 rounded-full h-1.5",children:s.jsx("div",{className:"bg-blue-500 h-1.5 rounded-full",style:{width:`${i.percentualConcluido}%`}})}),s.jsxs("span",{className:"text-[10px] font-bold text-gray-500",children:[i.percentualConcluido,"%"]})]}),i.cooperacao&&s.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full uppercase hidden lg:inline-block ${Im[i.cooperacao]||""}`,children:i.cooperacao}),s.jsx("span",{className:`px-3 py-1 rounded-full text-[10px] font-bold uppercase ${i.status==="Finalizado"?"bg-green-100 text-green-700":i.status==="Contenção"?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"}`,children:i.status})]})]}),s.jsxs("div",{className:"p-4",children:[s.jsxs("h4",{className:"text-xs font-bold text-gray-500 mb-3 flex items-center gap-2 uppercase",children:[s.jsx(Vl,{size:14})," ÚLTIMAS EVOLUÇÕES"]}),s.jsx("div",{className:"space-y-2",children:i.evolucoes.slice(-2).map(c=>s.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[s.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full flex-shrink-0"}),s.jsx("span",{className:"font-bold text-gray-700",children:new Date(c.data).toLocaleDateString()}),s.jsx("span",{className:"text-gray-500 truncate uppercase",children:c.procedimento})]},c.id))}),i.flags&&i.flags.length>0&&s.jsx("div",{className:"flex gap-2 mt-3 pt-3 border-t border-gray-100",children:i.flags.map((c,d)=>{const f=uu[c.tipo]||uu.info;return s.jsx("span",{className:`text-[9px] font-bold px-2 py-1 rounded-lg border uppercase ${f.bg} ${f.text}`,children:c.mensagem},d)})})]})]},i.id))}),n&&s.jsx(GP,{treatment:n,onClose:()=>{r(null),e()}})]})};function FP(t,e){const[n,r]=w.useState(t);return w.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}const qP=({onClose:t,onSaved:e})=>{const n=Fe(),[r,i]=w.useState(null),[c,d]=w.useState(""),[f,h]=w.useState(!1),p=FP(c,400),[b,y]=w.useState([]),[m,v]=w.useState(!1);w.useEffect(()=>{if(!p){y([]);return}v(!0),J.getPacientes(p).then(C=>{y(C),v(!1)})},[p]);const N=C=>{i(C),d(""),h(!1)},[S,j]=w.useState({id:crypto.randomUUID(),descricao:"",valor:"",dataVencimento:new Date().toISOString().split("T")[0],status:"Pendente",formaPagamento:"Pix"});w.useEffect(()=>{const C=O=>{O.key==="Escape"&&t()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t]);const R=async C=>{if(C.preventDefault(),!r||!S.descricao||!S.valor){n.error("PREENCHA TODOS OS CAMPOS OBRIGATÓRIOS.");return}try{await J.saveFinanceiro({...S,pacienteNome:r.nome,valor:parseFloat(S.valor)}),n.success("LANÇAMENTO SALVO COM SUCESSO!"),e(),t()}catch{n.error("ERRO AO SALVAR LANÇAMENTO.")}};return s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("form",{onSubmit:R,className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-green-50 to-white",children:[s.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[s.jsx(Ba,{size:22,className:"text-green-600"})," NOVO LANÇAMENTO"]}),s.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"PACIENTE *"}),r?s.jsxs("div",{className:"w-full lg:w-1/2 bg-green-50 border border-green-200 p-3 lg:p-4 rounded-lg mt-2 flex justify-between items-center",children:[s.jsx("span",{className:"font-bold text-green-800 uppercase text-sm lg:text-base",children:r.nome}),s.jsx("button",{type:"button",onClick:()=>i(null),className:"text-xs font-bold bg-blue-100 text-blue-700 hover:bg-blue-200 px-3 py-1.5 rounded-md transition-colors",children:"ALTERAR"})]}):s.jsxs("div",{className:"relative mt-2",children:[s.jsx("input",{type:"text",value:c,onChange:C=>d(C.target.value.toUpperCase()),onFocus:()=>h(!0),onBlur:()=>setTimeout(()=>h(!1),200),placeholder:"DIGITE O NOME OU CPF...",className:"w-full lg:w-1/2 bg-gray-100 p-3 lg:p-4 rounded-lg font-bold text-gray-800 uppercase focus:border-blue-500 outline-none border-2 border-transparent focus:border-2 text-sm lg:text-base"}),f&&p&&s.jsxs("ul",{className:"absolute z-10 w-full lg:w-1/2 bg-white border border-gray-300 rounded-lg mt-1 max-h-48 overflow-y-auto shadow-lg",children:[m&&s.jsx("li",{className:"p-3 text-sm text-gray-500",children:"BUSCANDO..."}),b.map(C=>s.jsxs("li",{onMouseDown:()=>N(C),className:"p-3 hover:bg-gray-100 cursor-pointer uppercase font-semibold text-sm",children:[C.nome," (",C.cpf,")"]},C.id)),!m&&b.length===0&&s.jsx("li",{className:"p-3 text-sm text-gray-500",children:"NENHUM PACIENTE ENCONTRADO."})]})]})]}),s.jsxs("div",{className:"lg:grid lg:grid-cols-2 lg:gap-x-8 lg:gap-y-5 space-y-5 lg:space-y-0",children:[s.jsxs("div",{className:"lg:col-span-2",children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"DESCRIÇÃO *"}),s.jsx("input",{type:"text",required:!0,value:S.descricao,onChange:C=>j(O=>({...O,descricao:C.target.value.toUpperCase()})),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 uppercase-input text-sm",placeholder:"EX: CONSULTA AVALIAÇÃO, LIMPEZA..."})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"VALOR (R$) *"}),s.jsx("input",{type:"number",step:"0.01",required:!0,value:S.valor,onChange:C=>j(O=>({...O,valor:C.target.value})),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 text-sm",placeholder:"0,00"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"DATA VENCIMENTO"}),s.jsx("input",{type:"date",value:S.dataVencimento,onChange:C=>j(O=>({...O,dataVencimento:C.target.value})),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 text-sm"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"STATUS"}),s.jsxs("select",{value:S.status,onChange:C=>j(O=>({...O,status:C.target.value})),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 bg-white text-sm uppercase-select",children:[s.jsx("option",{value:"Pendente",children:"PENDENTE"}),s.jsx("option",{value:"Pago",children:"PAGO"}),s.jsx("option",{value:"Atrasado",children:"ATRASADO"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"FORMA DE PAGAMENTO"}),s.jsxs("select",{value:S.formaPagamento,onChange:C=>j(O=>({...O,formaPagamento:C.target.value})),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 bg-white text-sm uppercase-select",children:[s.jsx("option",{value:"Pix",children:"PIX"}),s.jsx("option",{value:"Boleto",children:"BOLETO"}),s.jsx("option",{value:"Cartão",children:"CARTÃO"}),s.jsx("option",{value:"Dinheiro",children:"DINHEIRO"})]})]})]})]}),s.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-t border-gray-200 flex justify-end gap-3 flex-shrink-0",children:[s.jsx("button",{type:"button",onClick:t,className:"px-6 py-2.5 bg-gray-200 hover:bg-gray-300 text-gray-700 font-bold rounded-lg text-sm uppercase transition-colors",children:"CANCELAR"}),s.jsxs("button",{type:"submit",className:"px-8 py-2.5 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg shadow-sm text-sm uppercase flex items-center gap-2 transition-colors",children:[s.jsx(ft,{size:16})," SALVAR"]})]})]})})},$P=()=>{const[t,e]=w.useState([]),[n,r]=w.useState(!0),[i,c]=w.useState("TODOS"),[d,f]=w.useState(!1),[h,p]=w.useState(!1),b=Fe(),y=w.useCallback(()=>{r(!0),J.getFinanceiro().then(A=>{e(A),r(!1)})},[]);w.useEffect(()=>{y()},[y]);const m=i==="TODOS"?t:t.filter(A=>A.status===i),v=t.filter(A=>A.status==="Pago").reduce((A,k)=>A+Number(k.valor),0),N=t.filter(A=>A.status==="Pendente").reduce((A,k)=>A+Number(k.valor),0),S=t.filter(A=>A.status==="Atrasado").reduce((A,k)=>A+Number(k.valor),0),j=async A=>{if(window.confirm(`CONFIRMAR PAGAMENTO DE R$ ${Number(A.valor).toFixed(2)} DE ${A.pacienteNome}?`))try{await J.updateFinanceiro({...A,status:"Pago"}),b.success(`PAGAMENTO DE ${A.pacienteNome} CONFIRMADO!`),y()}catch{b.error("ERRO AO CONFIRMAR PAGAMENTO.")}},R=async A=>{if(window.confirm(`TEM CERTEZA QUE DESEJA EXCLUIR O LANÇAMENTO DE ${A.pacienteNome}? ESTA AÇÃO NÃO PODE SER DESFEITA.`))try{await J.deleteFinanceiro(A.id),b.success("LANÇAMENTO EXCLUÍDO!"),y()}catch{b.error("ERRO AO EXCLUIR LANÇAMENTO.")}},C=A=>{b.success(`RECIBO DE ${A.pacienteNome} GERADO COM SUCESSO!`)},O=i==="TODOS"?"FILTRAR":i.toUpperCase();return s.jsxs("div",{className:"space-y-6",children:[s.jsx(cn,{title:"FINANCEIRO & FATURAMENTO",children:s.jsxs("div",{className:"flex gap-2 relative",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>f(!d),className:`border px-3 py-2 rounded-lg flex items-center gap-2 font-bold text-xs uppercase transition-colors ${i!=="TODOS"?"bg-blue-50 border-blue-300 text-blue-700":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50"}`,children:[s.jsx(mu,{size:18})," ",O]}),d&&s.jsx("div",{className:"absolute right-0 top-full mt-1 bg-white border border-gray-200 rounded-lg shadow-xl z-20 min-w-[160px] overflow-hidden",children:["TODOS","Pago","Pendente","Atrasado"].map(A=>s.jsxs("button",{onClick:()=>{c(A),f(!1)},className:`w-full text-left px-4 py-2.5 text-sm font-bold uppercase hover:bg-gray-50 transition-colors flex items-center justify-between ${i===A?"text-blue-700 bg-blue-50":"text-gray-700"}`,children:[A.toUpperCase(),i===A&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-600"})]},A))})]}),s.jsxs("button",{onClick:()=>p(!0),className:"bg-green-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 hover:bg-green-700 font-bold text-xs uppercase shadow-sm transition-colors",children:[s.jsx(ft,{size:18})," NOVO LANÇAMENTO"]})]})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"bg-white p-6 rounded-xl border border-gray-200 shadow-sm flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 font-bold mb-1 uppercase",children:"RECEBIDO (MÊS)"}),s.jsxs("h3",{className:"text-2xl font-bold text-green-600",children:["R$ ",v.toLocaleString("pt-BR",{minimumFractionDigits:2})]})]}),s.jsx("div",{className:"bg-green-100 p-3 rounded-full text-green-600",children:s.jsx(YN,{size:24})})]}),s.jsxs("div",{className:"bg-white p-6 rounded-xl border border-gray-200 shadow-sm flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 font-bold mb-1 uppercase",children:"A RECEBER / PENDENTE"}),s.jsxs("h3",{className:"text-2xl font-bold text-yellow-600",children:["R$ ",N.toLocaleString("pt-BR",{minimumFractionDigits:2})]})]}),s.jsx("div",{className:"bg-yellow-100 p-3 rounded-full text-yellow-600",children:s.jsx(Fl,{size:24})})]}),s.jsxs("div",{className:"bg-white p-6 rounded-xl border border-gray-200 shadow-sm flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 font-bold mb-1 uppercase",children:"EM ATRASO"}),s.jsxs("h3",{className:"text-2xl font-bold text-red-600",children:["R$ ",S.toLocaleString("pt-BR",{minimumFractionDigits:2})]})]}),s.jsx("div",{className:"bg-red-100 p-3 rounded-full text-red-600",children:s.jsx(yO,{size:24})})]})]}),s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[s.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gray-50 flex justify-between items-center",children:[s.jsxs("h3",{className:"font-bold text-gray-800 uppercase",children:["LANÇAMENTOS ",i!=="TODOS"&&s.jsxs("span",{className:"text-blue-600 text-sm",children:["(",i.toUpperCase(),")"]})]}),s.jsxs("span",{className:"text-xs text-gray-400 font-bold uppercase",children:[m.length," REGISTRO(S)"]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm text-left",children:[s.jsx("thead",{className:"bg-gray-50 text-gray-500 uppercase text-xs font-bold",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-6 py-3",children:"PACIENTE"}),s.jsx("th",{className:"px-6 py-3",children:"DESCRIÇÃO"}),s.jsx("th",{className:"px-6 py-3",children:"VENCIMENTO"}),s.jsx("th",{className:"px-6 py-3",children:"VALOR"}),s.jsx("th",{className:"px-6 py-3",children:"STATUS"}),s.jsx("th",{className:"px-6 py-3 text-right",children:"AÇÕES"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-100",children:n?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"p-6 text-center text-gray-500 uppercase font-bold",children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(Ct,{className:"animate-spin",size:18})," CARREGANDO..."]})})}):m.length===0?s.jsx("tr",{children:s.jsxs("td",{colSpan:6,className:"p-10 text-center text-gray-400 uppercase font-bold text-sm",children:["NENHUM LANÇAMENTO ENCONTRADO ",i!=="TODOS"&&`COM STATUS "${i.toUpperCase()}"`,"."]})}):m.map(A=>{var k;return s.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[s.jsx("td",{className:"px-6 py-4 font-bold text-gray-900 uppercase",children:A.pacienteNome}),s.jsxs("td",{className:"px-6 py-4 text-gray-600 font-medium uppercase",children:[A.descricao,s.jsx("span",{className:"text-[10px] text-gray-400 block font-bold",children:(k=A.formaPagamento)==null?void 0:k.toUpperCase()})]}),s.jsx("td",{className:"px-6 py-4 text-gray-600 font-medium",children:new Date(A.dataVencimento).toLocaleDateString("pt-BR")}),s.jsxs("td",{className:"px-6 py-4 font-bold text-gray-800",children:["R$ ",Number(A.valor).toLocaleString("pt-BR",{minimumFractionDigits:2})]}),s.jsx("td",{className:"px-6 py-4",children:s.jsx("span",{className:`px-2.5 py-1 rounded-full text-[10px] font-bold uppercase - ${A.status==="Pago"?"bg-green-100 text-green-700":A.status==="Atrasado"?"bg-red-100 text-red-700":"bg-yellow-100 text-yellow-700"}`,children:A.status})}),s.jsx("td",{className:"px-6 py-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-1",children:[A.status!=="Pago"&&s.jsx("button",{onClick:()=>j(A),title:"CONFIRMAR PAGAMENTO",className:"p-1.5 text-green-600 hover:bg-green-50 rounded-lg transition-colors",children:s.jsx(Ua,{size:18})}),s.jsx("button",{onClick:()=>C(A),title:"GERAR RECIBO",className:"p-1.5 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",children:s.jsx(Og,{size:18})}),s.jsx("button",{onClick:()=>R(A),title:"EXCLUIR",className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors",children:s.jsx($t,{size:18})})]})})]},A.id)})})]})})]}),d&&s.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>f(!1)}),h&&s.jsx(qP,{onClose:()=>p(!1),onSaved:y})]})};var Vo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},hr,vs,jl,vN,YP=(vN=class extends Vo{constructor(){super();Ee(this,hr);Ee(this,vs);Ee(this,jl);pe(this,jl,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){z(this,vs)||this.setEventListener(z(this,jl))}onUnsubscribe(){var e;this.hasListeners()||((e=z(this,vs))==null||e.call(this),pe(this,vs,void 0))}setEventListener(e){var n;pe(this,jl,e),(n=z(this,vs))==null||n.call(this),pe(this,vs,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){z(this,hr)!==e&&(pe(this,hr,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof z(this,hr)=="boolean"?z(this,hr):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},hr=new WeakMap,vs=new WeakMap,jl=new WeakMap,vN),Lm=new YP,QP={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Ns,wg,NN,WP=(NN=class{constructor(){Ee(this,Ns,QP);Ee(this,wg,!1)}setTimeoutProvider(t){pe(this,Ns,t)}setTimeout(t,e){return z(this,Ns).setTimeout(t,e)}clearTimeout(t){z(this,Ns).clearTimeout(t)}setInterval(t,e){return z(this,Ns).setInterval(t,e)}clearInterval(t){z(this,Ns).clearInterval(t)}},Ns=new WeakMap,wg=new WeakMap,NN),fr=new WP;function XP(t){setTimeout(t,0)}var ZP=typeof window>"u"||"Deno"in globalThis;function ln(){}function KP(t,e){return typeof t=="function"?t(e):t}function ug(t){return typeof t=="number"&&t>=0&&t!==1/0}function rA(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Is(t,e){return typeof t=="function"?t(e):t}function En(t,e){return typeof t=="function"?t(e):t}function K1(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:c,queryKey:d,stale:f}=t;if(d){if(r){if(e.queryHash!==zm(d,e.options))return!1}else if(!jo(e.queryKey,d))return!1}if(n!=="all"){const h=e.isActive();if(n==="active"&&!h||n==="inactive"&&h)return!1}return!(typeof f=="boolean"&&e.isStale()!==f||i&&i!==e.state.fetchStatus||c&&!c(e))}function J1(t,e){const{exact:n,status:r,predicate:i,mutationKey:c}=t;if(c){if(!e.options.mutationKey)return!1;if(n){if(So(e.options.mutationKey)!==So(c))return!1}else if(!jo(e.options.mutationKey,c))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function zm(t,e){return((e==null?void 0:e.queryKeyHashFn)||So)(t)}function So(t){return JSON.stringify(t,(e,n)=>hg(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function jo(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>jo(t[n],e[n])):!1}var JP=Object.prototype.hasOwnProperty;function lA(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=eN(t)&&eN(e);if(!r&&!(hg(t)&&hg(e)))return e;const c=(r?t:Object.keys(t)).length,d=r?e:Object.keys(e),f=d.length,h=r?new Array(f):{};let p=0;for(let b=0;b{fr.setTimeout(e,t)})}function pg(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?lA(t,e):e}function tU(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function nU(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Pm=Symbol();function iA(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Pm?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function oA(t,e){return typeof t=="function"?t(...e):!!t}function aU(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var Ao=(()=>{let t=()=>ZP;return{isServer(){return t()},setIsServer(e){t=e}}})();function gg(){let t,e;const n=new Promise((i,c)=>{t=i,e=c});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var sU=XP;function rU(){let t=[],e=0,n=f=>{f()},r=f=>{f()},i=sU;const c=f=>{e?t.push(f):i(()=>{n(f)})},d=()=>{const f=t;t=[],f.length&&i(()=>{r(()=>{f.forEach(h=>{n(h)})})})};return{batch:f=>{let h;e++;try{h=f()}finally{e--,e||d()}return h},batchCalls:f=>(...h)=>{c(()=>{f(...h)})},schedule:c,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{r=f},setScheduler:f=>{i=f}}}var Ht=rU(),Al,Es,wl,EN,lU=(EN=class extends Vo{constructor(){super();Ee(this,Al,!0);Ee(this,Es);Ee(this,wl);pe(this,wl,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){z(this,Es)||this.setEventListener(z(this,wl))}onUnsubscribe(){var e;this.hasListeners()||((e=z(this,Es))==null||e.call(this),pe(this,Es,void 0))}setEventListener(e){var n;pe(this,wl,e),(n=z(this,Es))==null||n.call(this),pe(this,Es,e(this.setOnline.bind(this)))}setOnline(e){z(this,Al)!==e&&(pe(this,Al,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return z(this,Al)}},Al=new WeakMap,Es=new WeakMap,wl=new WeakMap,EN),fu=new lU;function iU(t){return Math.min(1e3*2**t,3e4)}function cA(t){return(t??"online")==="online"?fu.isOnline():!0}var mg=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function dA(t){let e=!1,n=0,r;const i=gg(),c=()=>i.status!=="pending",d=S=>{var j;if(!c()){const R=new mg(S);m(R),(j=t.onCancel)==null||j.call(t,R)}},f=()=>{e=!0},h=()=>{e=!1},p=()=>Lm.isFocused()&&(t.networkMode==="always"||fu.isOnline())&&t.canRun(),b=()=>cA(t.networkMode)&&t.canRun(),y=S=>{c()||(r==null||r(),i.resolve(S))},m=S=>{c()||(r==null||r(),i.reject(S))},v=()=>new Promise(S=>{var j;r=R=>{(c()||p())&&S(R)},(j=t.onPause)==null||j.call(t)}).then(()=>{var S;r=void 0,c()||(S=t.onContinue)==null||S.call(t)}),N=()=>{if(c())return;let S;const j=n===0?t.initialPromise:void 0;try{S=j??t.fn()}catch(R){S=Promise.reject(R)}Promise.resolve(S).then(y).catch(R=>{var _;if(c())return;const C=t.retry??(Ao.isServer()?0:3),O=t.retryDelay??iU,A=typeof O=="function"?O(n,R):O,k=C===!0||typeof C=="number"&&np()?void 0:v()).then(()=>{e?m(R):N()})})};return{promise:i,status:()=>i.status,cancel:d,continue:()=>(r==null||r(),i),cancelRetry:f,continueRetry:h,canStart:b,start:()=>(b()?N():v().then(N),i)}}var pr,SN,uA=(SN=class{constructor(){Ee(this,pr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ug(this.gcTime)&&pe(this,pr,fr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Ao.isServer()?1/0:300*1e3))}clearGcTimeout(){z(this,pr)!==void 0&&(fr.clearTimeout(z(this,pr)),pe(this,pr,void 0))}},pr=new WeakMap,SN);function oU(t){return{onFetch:(e,n)=>{var b,y,m,v,N;const r=e.options,i=(m=(y=(b=e.fetchOptions)==null?void 0:b.meta)==null?void 0:y.fetchMore)==null?void 0:m.direction,c=((v=e.state.data)==null?void 0:v.pages)||[],d=((N=e.state.data)==null?void 0:N.pageParams)||[];let f={pages:[],pageParams:[]},h=0;const p=async()=>{let S=!1;const j=O=>{aU(O,()=>e.signal,()=>S=!0)},R=iA(e.options,e.fetchOptions),C=async(O,A,k)=>{if(S)return Promise.reject(e.signal.reason);if(A==null&&O.pages.length)return Promise.resolve(O);const B=(()=>{const ne={client:e.client,queryKey:e.queryKey,pageParam:A,direction:k?"backward":"forward",meta:e.options.meta};return j(ne),ne})(),F=await R(B),{maxPages:G}=e.options,ee=k?nU:tU;return{pages:ee(O.pages,F,G),pageParams:ee(O.pageParams,A,G)}};if(i&&c.length){const O=i==="backward",A=O?cU:nN,k={pages:c,pageParams:d},_=A(r,k);f=await C(k,_,O)}else{const O=t??c.length;do{const A=h===0?d[0]??r.initialPageParam:nN(r,f);if(h>0&&A==null)break;f=await C(f,A),h++}while(h{var S,j;return(j=(S=e.options).persister)==null?void 0:j.call(S,p,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=p}}}function nN(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function cU(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Cl,gr,Dl,Vn,mr,Tt,Co,xr,vn,fA,_a,jN,dU=(jN=class extends uA{constructor(e){super();Ee(this,vn);Ee(this,Cl);Ee(this,gr);Ee(this,Dl);Ee(this,Vn);Ee(this,mr);Ee(this,Tt);Ee(this,Co);Ee(this,xr);pe(this,xr,!1),pe(this,Co,e.defaultOptions),this.setOptions(e.options),this.observers=[],pe(this,mr,e.client),pe(this,Vn,z(this,mr).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,pe(this,gr,sN(this.options)),this.state=e.state??z(this,gr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return z(this,Cl)}get promise(){var e;return(e=z(this,Tt))==null?void 0:e.promise}setOptions(e){if(this.options={...z(this,Co),...e},e!=null&&e._type&&pe(this,Cl,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=sN(this.options);n.data!==void 0&&(this.setState(aN(n.data,n.dataUpdatedAt)),pe(this,gr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&z(this,Vn).remove(this)}setData(e,n){const r=pg(this.state.data,e,this.options);return Pe(this,vn,_a).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){Pe(this,vn,_a).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=z(this,Tt))==null?void 0:r.promise;return(i=z(this,Tt))==null||i.cancel(e),n?n.then(ln).catch(ln):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return z(this,gr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>En(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Is(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!rA(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=z(this,Tt))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=z(this,Tt))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),z(this,Vn).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(z(this,Tt)&&(z(this,xr)||Pe(this,vn,fA).call(this)?z(this,Tt).cancel({revert:!0}):z(this,Tt).cancelRetry()),this.scheduleGc()),z(this,Vn).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Pe(this,vn,_a).call(this,{type:"invalidate"})}async fetch(e,n){var p,b,y,m,v,N,S,j,R,C,O;if(this.state.fetchStatus!=="idle"&&((p=z(this,Tt))==null?void 0:p.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(z(this,Tt))return z(this,Tt).continueRetry(),z(this,Tt).promise}if(e&&this.setOptions(e),!this.options.queryFn){const A=this.observers.find(k=>k.options.queryFn);A&&this.setOptions(A.options)}const r=new AbortController,i=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(pe(this,xr,!0),r.signal)})},c=()=>{const A=iA(this.options,n),_=(()=>{const B={client:z(this,mr),queryKey:this.queryKey,meta:this.meta};return i(B),B})();return pe(this,xr,!1),this.options.persister?this.options.persister(A,_,this):A(_)},f=(()=>{const A={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:z(this,mr),state:this.state,fetchFn:c};return i(A),A})(),h=z(this,Cl)==="infinite"?oU(this.options.pages):this.options.behavior;h==null||h.onFetch(f,this),pe(this,Dl,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((b=f.fetchOptions)==null?void 0:b.meta))&&Pe(this,vn,_a).call(this,{type:"fetch",meta:(y=f.fetchOptions)==null?void 0:y.meta}),pe(this,Tt,dA({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:A=>{A instanceof mg&&A.revert&&this.setState({...z(this,Dl),fetchStatus:"idle"}),r.abort()},onFail:(A,k)=>{Pe(this,vn,_a).call(this,{type:"failed",failureCount:A,error:k})},onPause:()=>{Pe(this,vn,_a).call(this,{type:"pause"})},onContinue:()=>{Pe(this,vn,_a).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const A=await z(this,Tt).start();if(A===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(A),(v=(m=z(this,Vn).config).onSuccess)==null||v.call(m,A,this),(S=(N=z(this,Vn).config).onSettled)==null||S.call(N,A,this.state.error,this),A}catch(A){if(A instanceof mg){if(A.silent)return z(this,Tt).promise;if(A.revert){if(this.state.data===void 0)throw A;return this.state.data}}throw Pe(this,vn,_a).call(this,{type:"error",error:A}),(R=(j=z(this,Vn).config).onError)==null||R.call(j,A,this),(O=(C=z(this,Vn).config).onSettled)==null||O.call(C,this.state.data,A,this),A}finally{this.scheduleGc()}}},Cl=new WeakMap,gr=new WeakMap,Dl=new WeakMap,Vn=new WeakMap,mr=new WeakMap,Tt=new WeakMap,Co=new WeakMap,xr=new WeakMap,vn=new WeakSet,fA=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},_a=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...hA(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...aN(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return pe(this,Dl,e.manual?i:void 0),i;case"error":const c=e.error;return{...r,error:c,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:c,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Ht.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),z(this,Vn).notify({query:this,type:"updated",action:e})})},jN);function hA(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:cA(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function aN(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function sN(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var rn,He,Do,Xt,br,Ol,Ma,Ss,Oo,Rl,Tl,yr,vr,js,kl,Ze,ao,xg,bg,yg,vg,Ng,Eg,Sg,pA,AN,uU=(AN=class extends Vo{constructor(e,n){super();Ee(this,Ze);Ee(this,rn);Ee(this,He);Ee(this,Do);Ee(this,Xt);Ee(this,br);Ee(this,Ol);Ee(this,Ma);Ee(this,Ss);Ee(this,Oo);Ee(this,Rl);Ee(this,Tl);Ee(this,yr);Ee(this,vr);Ee(this,js);Ee(this,kl,new Set);this.options=n,pe(this,rn,e),pe(this,Ss,null),pe(this,Ma,gg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(z(this,He).addObserver(this),rN(z(this,He),this.options)?Pe(this,Ze,ao).call(this):this.updateResult(),Pe(this,Ze,vg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return jg(z(this,He),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return jg(z(this,He),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Pe(this,Ze,Ng).call(this),Pe(this,Ze,Eg).call(this),z(this,He).removeObserver(this)}setOptions(e){const n=this.options,r=z(this,He);if(this.options=z(this,rn).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof En(this.options.enabled,z(this,He))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Pe(this,Ze,Sg).call(this),z(this,He).setOptions(this.options),n._defaulted&&!fg(this.options,n)&&z(this,rn).getQueryCache().notify({type:"observerOptionsUpdated",query:z(this,He),observer:this});const i=this.hasListeners();i&&lN(z(this,He),r,this.options,n)&&Pe(this,Ze,ao).call(this),this.updateResult(),i&&(z(this,He)!==r||En(this.options.enabled,z(this,He))!==En(n.enabled,z(this,He))||Is(this.options.staleTime,z(this,He))!==Is(n.staleTime,z(this,He)))&&Pe(this,Ze,xg).call(this);const c=Pe(this,Ze,bg).call(this);i&&(z(this,He)!==r||En(this.options.enabled,z(this,He))!==En(n.enabled,z(this,He))||c!==z(this,js))&&Pe(this,Ze,yg).call(this,c)}getOptimisticResult(e){const n=z(this,rn).getQueryCache().build(z(this,rn),e),r=this.createResult(n,e);return hU(this,r)&&(pe(this,Xt,r),pe(this,Ol,this.options),pe(this,br,z(this,He).state)),r}getCurrentResult(){return z(this,Xt)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&z(this,Ma).status==="pending"&&z(this,Ma).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){z(this,kl).add(e)}getCurrentQuery(){return z(this,He)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=z(this,rn).defaultQueryOptions(e),r=z(this,rn).getQueryCache().build(z(this,rn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Pe(this,Ze,ao).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),z(this,Xt)))}createResult(e,n){var G;const r=z(this,He),i=this.options,c=z(this,Xt),d=z(this,br),f=z(this,Ol),p=e!==r?e.state:z(this,Do),{state:b}=e;let y={...b},m=!1,v;if(n._optimisticResults){const ee=this.hasListeners(),ne=!ee&&rN(e,n),oe=ee&&lN(e,r,n,i);(ne||oe)&&(y={...y,...hA(b.data,e.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:N,errorUpdatedAt:S,status:j}=y;v=y.data;let R=!1;if(n.placeholderData!==void 0&&v===void 0&&j==="pending"){let ee;c!=null&&c.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(ee=c.data,R=!0):ee=typeof n.placeholderData=="function"?n.placeholderData((G=z(this,Tl))==null?void 0:G.state.data,z(this,Tl)):n.placeholderData,ee!==void 0&&(j="success",v=pg(c==null?void 0:c.data,ee,n),m=!0)}if(n.select&&v!==void 0&&!R)if(c&&v===(d==null?void 0:d.data)&&n.select===z(this,Oo))v=z(this,Rl);else try{pe(this,Oo,n.select),v=n.select(v),v=pg(c==null?void 0:c.data,v,n),pe(this,Rl,v),pe(this,Ss,null)}catch(ee){pe(this,Ss,ee)}z(this,Ss)&&(N=z(this,Ss),v=z(this,Rl),S=Date.now(),j="error");const C=y.fetchStatus==="fetching",O=j==="pending",A=j==="error",k=O&&C,_=v!==void 0,F={status:j,fetchStatus:y.fetchStatus,isPending:O,isSuccess:j==="success",isError:A,isInitialLoading:k,isLoading:k,data:v,dataUpdatedAt:y.dataUpdatedAt,error:N,errorUpdatedAt:S,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>p.dataUpdateCount||y.errorUpdateCount>p.errorUpdateCount,isFetching:C,isRefetching:C&&!O,isLoadingError:A&&!_,isPaused:y.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:A&&_,isStale:Um(e,n),refetch:this.refetch,promise:z(this,Ma),isEnabled:En(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const ee=F.data!==void 0,ne=F.status==="error"&&!ee,oe=he=>{ne?he.reject(F.error):ee&&he.resolve(F.data)},Q=()=>{const he=pe(this,Ma,F.promise=gg());oe(he)},ce=z(this,Ma);switch(ce.status){case"pending":e.queryHash===r.queryHash&&oe(ce);break;case"fulfilled":(ne||F.data!==ce.value)&&Q();break;case"rejected":(!ne||F.error!==ce.reason)&&Q();break}}return F}updateResult(){const e=z(this,Xt),n=this.createResult(z(this,He),this.options);if(pe(this,br,z(this,He).state),pe(this,Ol,this.options),z(this,br).data!==void 0&&pe(this,Tl,z(this,He)),fg(n,e))return;pe(this,Xt,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,c=typeof i=="function"?i():i;if(c==="all"||!c&&!z(this,kl).size)return!0;const d=new Set(c??z(this,kl));return this.options.throwOnError&&d.add("error"),Object.keys(z(this,Xt)).some(f=>{const h=f;return z(this,Xt)[h]!==e[h]&&d.has(h)})};Pe(this,Ze,pA).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Pe(this,Ze,vg).call(this)}},rn=new WeakMap,He=new WeakMap,Do=new WeakMap,Xt=new WeakMap,br=new WeakMap,Ol=new WeakMap,Ma=new WeakMap,Ss=new WeakMap,Oo=new WeakMap,Rl=new WeakMap,Tl=new WeakMap,yr=new WeakMap,vr=new WeakMap,js=new WeakMap,kl=new WeakMap,Ze=new WeakSet,ao=function(e){Pe(this,Ze,Sg).call(this);let n=z(this,He).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(ln)),n},xg=function(){Pe(this,Ze,Ng).call(this);const e=Is(this.options.staleTime,z(this,He));if(Ao.isServer()||z(this,Xt).isStale||!ug(e))return;const r=rA(z(this,Xt).dataUpdatedAt,e)+1;pe(this,yr,fr.setTimeout(()=>{z(this,Xt).isStale||this.updateResult()},r))},bg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(z(this,He)):this.options.refetchInterval)??!1},yg=function(e){Pe(this,Ze,Eg).call(this),pe(this,js,e),!(Ao.isServer()||En(this.options.enabled,z(this,He))===!1||!ug(z(this,js))||z(this,js)===0)&&pe(this,vr,fr.setInterval(()=>{(this.options.refetchIntervalInBackground||Lm.isFocused())&&Pe(this,Ze,ao).call(this)},z(this,js)))},vg=function(){Pe(this,Ze,xg).call(this),Pe(this,Ze,yg).call(this,Pe(this,Ze,bg).call(this))},Ng=function(){z(this,yr)!==void 0&&(fr.clearTimeout(z(this,yr)),pe(this,yr,void 0))},Eg=function(){z(this,vr)!==void 0&&(fr.clearInterval(z(this,vr)),pe(this,vr,void 0))},Sg=function(){const e=z(this,rn).getQueryCache().build(z(this,rn),this.options);if(e===z(this,He))return;const n=z(this,He);pe(this,He,e),pe(this,Do,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},pA=function(e){Ht.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(z(this,Xt))}),z(this,rn).getQueryCache().notify({query:z(this,He),type:"observerResultsUpdated"})})},AN);function fU(t,e){return En(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&En(e.retryOnMount,t)===!1)}function rN(t,e){return fU(t,e)||t.state.data!==void 0&&jg(t,e,e.refetchOnMount)}function jg(t,e,n){if(En(e.enabled,t)!==!1&&Is(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Um(t,e)}return!1}function lN(t,e,n,r){return(t!==e||En(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Um(t,n)}function Um(t,e){return En(e.enabled,t)!==!1&&t.isStaleByTime(Is(e.staleTime,t))}function hU(t,e){return!fg(t.getCurrentResult(),e)}var Ro,la,Ft,Nr,ia,ys,wN,pU=(wN=class extends uA{constructor(e){super();Ee(this,ia);Ee(this,Ro);Ee(this,la);Ee(this,Ft);Ee(this,Nr);pe(this,Ro,e.client),this.mutationId=e.mutationId,pe(this,Ft,e.mutationCache),pe(this,la,[]),this.state=e.state||gU(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){z(this,la).includes(e)||(z(this,la).push(e),this.clearGcTimeout(),z(this,Ft).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){pe(this,la,z(this,la).filter(n=>n!==e)),this.scheduleGc(),z(this,Ft).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){z(this,la).length||(this.state.status==="pending"?this.scheduleGc():z(this,Ft).remove(this))}continue(){var e;return((e=z(this,Nr))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var d,f,h,p,b,y,m,v,N,S,j,R,C,O,A,k,_,B;const n=()=>{Pe(this,ia,ys).call(this,{type:"continue"})},r={client:z(this,Ro),meta:this.options.meta,mutationKey:this.options.mutationKey};pe(this,Nr,dA({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(F,G)=>{Pe(this,ia,ys).call(this,{type:"failed",failureCount:F,error:G})},onPause:()=>{Pe(this,ia,ys).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>z(this,Ft).canRun(this)}));const i=this.state.status==="pending",c=!z(this,Nr).canStart();try{if(i)n();else{Pe(this,ia,ys).call(this,{type:"pending",variables:e,isPaused:c}),z(this,Ft).config.onMutate&&await z(this,Ft).config.onMutate(e,this,r);const G=await((f=(d=this.options).onMutate)==null?void 0:f.call(d,e,r));G!==this.state.context&&Pe(this,ia,ys).call(this,{type:"pending",context:G,variables:e,isPaused:c})}const F=await z(this,Nr).start();return await((p=(h=z(this,Ft).config).onSuccess)==null?void 0:p.call(h,F,e,this.state.context,this,r)),await((y=(b=this.options).onSuccess)==null?void 0:y.call(b,F,e,this.state.context,r)),await((v=(m=z(this,Ft).config).onSettled)==null?void 0:v.call(m,F,null,this.state.variables,this.state.context,this,r)),await((S=(N=this.options).onSettled)==null?void 0:S.call(N,F,null,e,this.state.context,r)),Pe(this,ia,ys).call(this,{type:"success",data:F}),F}catch(F){try{await((R=(j=z(this,Ft).config).onError)==null?void 0:R.call(j,F,e,this.state.context,this,r))}catch(G){Promise.reject(G)}try{await((O=(C=this.options).onError)==null?void 0:O.call(C,F,e,this.state.context,r))}catch(G){Promise.reject(G)}try{await((k=(A=z(this,Ft).config).onSettled)==null?void 0:k.call(A,void 0,F,this.state.variables,this.state.context,this,r))}catch(G){Promise.reject(G)}try{await((B=(_=this.options).onSettled)==null?void 0:B.call(_,void 0,F,e,this.state.context,r))}catch(G){Promise.reject(G)}throw Pe(this,ia,ys).call(this,{type:"error",error:F}),F}finally{z(this,Ft).runNext(this)}}},Ro=new WeakMap,la=new WeakMap,Ft=new WeakMap,Nr=new WeakMap,ia=new WeakSet,ys=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ht.batch(()=>{z(this,la).forEach(r=>{r.onMutationUpdate(e)}),z(this,Ft).notify({mutation:this,type:"updated",action:e})})},wN);function gU(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ia,Kn,To,CN,mU=(CN=class extends Vo{constructor(e={}){super();Ee(this,Ia);Ee(this,Kn);Ee(this,To);this.config=e,pe(this,Ia,new Set),pe(this,Kn,new Map),pe(this,To,0)}build(e,n,r){const i=new pU({client:e,mutationCache:this,mutationId:++id(this,To)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){z(this,Ia).add(e);const n=Ed(e);if(typeof n=="string"){const r=z(this,Kn).get(n);r?r.push(e):z(this,Kn).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(z(this,Ia).delete(e)){const n=Ed(e);if(typeof n=="string"){const r=z(this,Kn).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&z(this,Kn).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Ed(e);if(typeof n=="string"){const r=z(this,Kn).get(n),i=r==null?void 0:r.find(c=>c.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=Ed(e);if(typeof n=="string"){const i=(r=z(this,Kn).get(n))==null?void 0:r.find(c=>c!==e&&c.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ht.batch(()=>{z(this,Ia).forEach(e=>{this.notify({type:"removed",mutation:e})}),z(this,Ia).clear(),z(this,Kn).clear()})}getAll(){return Array.from(z(this,Ia))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>J1(n,r))}findAll(e={}){return this.getAll().filter(n=>J1(e,n))}notify(e){Ht.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Ht.batch(()=>Promise.all(e.map(n=>n.continue().catch(ln))))}},Ia=new WeakMap,Kn=new WeakMap,To=new WeakMap,CN);function Ed(t){var e;return(e=t.options.scope)==null?void 0:e.id}var oa,DN,xU=(DN=class extends Vo{constructor(e={}){super();Ee(this,oa);this.config=e,pe(this,oa,new Map)}build(e,n,r){const i=n.queryKey,c=n.queryHash??zm(i,n);let d=this.get(c);return d||(d=new dU({client:e,queryKey:i,queryHash:c,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(d)),d}add(e){z(this,oa).has(e.queryHash)||(z(this,oa).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=z(this,oa).get(e.queryHash);n&&(e.destroy(),n===e&&z(this,oa).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ht.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return z(this,oa).get(e)}getAll(){return[...z(this,oa).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>K1(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>K1(e,r)):n}notify(e){Ht.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Ht.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ht.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},oa=new WeakMap,DN),mt,As,ws,_l,Ml,Cs,Il,Ll,ON,bU=(ON=class{constructor(t={}){Ee(this,mt);Ee(this,As);Ee(this,ws);Ee(this,_l);Ee(this,Ml);Ee(this,Cs);Ee(this,Il);Ee(this,Ll);pe(this,mt,t.queryCache||new xU),pe(this,As,t.mutationCache||new mU),pe(this,ws,t.defaultOptions||{}),pe(this,_l,new Map),pe(this,Ml,new Map),pe(this,Cs,0)}mount(){id(this,Cs)._++,z(this,Cs)===1&&(pe(this,Il,Lm.subscribe(async t=>{t&&(await this.resumePausedMutations(),z(this,mt).onFocus())})),pe(this,Ll,fu.subscribe(async t=>{t&&(await this.resumePausedMutations(),z(this,mt).onOnline())})))}unmount(){var t,e;id(this,Cs)._--,z(this,Cs)===0&&((t=z(this,Il))==null||t.call(this),pe(this,Il,void 0),(e=z(this,Ll))==null||e.call(this),pe(this,Ll,void 0))}isFetching(t){return z(this,mt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return z(this,As).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=z(this,mt).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=z(this,mt).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Is(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return z(this,mt).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=z(this,mt).get(r.queryHash),c=i==null?void 0:i.state.data,d=KP(e,c);if(d!==void 0)return z(this,mt).build(this,r).setData(d,{...n,manual:!0})}setQueriesData(t,e,n){return Ht.batch(()=>z(this,mt).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=z(this,mt).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=z(this,mt);Ht.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=z(this,mt);return Ht.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Ht.batch(()=>z(this,mt).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(ln).catch(ln)}invalidateQueries(t,e={}){return Ht.batch(()=>(z(this,mt).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Ht.batch(()=>z(this,mt).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let c=i.fetch(void 0,n);return n.throwOnError||(c=c.catch(ln)),i.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(r).then(ln)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=z(this,mt).build(this,e);return n.isStaleByTime(Is(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(ln).catch(ln)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(ln).catch(ln)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return fu.isOnline()?z(this,As).resumePausedMutations():Promise.resolve()}getQueryCache(){return z(this,mt)}getMutationCache(){return z(this,As)}getDefaultOptions(){return z(this,ws)}setDefaultOptions(t){pe(this,ws,t)}setQueryDefaults(t,e){z(this,_l).set(So(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...z(this,_l).values()],n={};return e.forEach(r=>{jo(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){z(this,Ml).set(So(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...z(this,Ml).values()],n={};return e.forEach(r=>{jo(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...z(this,ws).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=zm(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Pm&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...z(this,ws).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){z(this,mt).clear(),z(this,As).clear()}},mt=new WeakMap,As=new WeakMap,ws=new WeakMap,_l=new WeakMap,Ml=new WeakMap,Cs=new WeakMap,Il=new WeakMap,Ll=new WeakMap,ON),gA=w.createContext(void 0),yU=t=>{const e=w.useContext(gA);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},vU=({client:t,children:e})=>(w.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),s.jsx(gA.Provider,{value:t,children:e})),mA=w.createContext(!1),NU=()=>w.useContext(mA);mA.Provider;function EU(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var SU=w.createContext(EU()),jU=()=>w.useContext(SU),AU=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?oA(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},wU=t=>{w.useEffect(()=>{t.clearReset()},[t])},CU=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||oA(n,[t.error,r])),DU=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},OU=(t,e)=>t.isLoading&&t.isFetching&&!e,RU=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,iN=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function TU(t,e,n){var m,v,N,S;const r=NU(),i=jU(),c=yU(),d=c.defaultQueryOptions(t);(v=(m=c.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||v.call(m,d);const f=c.getQueryCache().get(d.queryHash);d._optimisticResults=r?"isRestoring":"optimistic",DU(d),AU(d,i,f),wU(i);const h=!c.getQueryCache().get(d.queryHash),[p]=w.useState(()=>new e(c,d)),b=p.getOptimisticResult(d),y=!r&&t.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(j=>{const R=y?p.subscribe(Ht.batchCalls(j)):ln;return p.updateResult(),R},[p,y]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),w.useEffect(()=>{p.setOptions(d)},[d,p]),RU(d,b))throw iN(d,p,i);if(CU({result:b,errorResetBoundary:i,throwOnError:d.throwOnError,query:f,suspense:d.suspense}))throw b.error;if((S=(N=c.getDefaultOptions().queries)==null?void 0:N._experimental_afterQuery)==null||S.call(N,d,b),d.experimental_prefetchInRender&&!Ao.isServer()&&OU(b,r)){const j=h?iN(d,p,i):f==null?void 0:f.promise;j==null||j.catch(ln).finally(()=>{p.updateResult()})}return d.notifyOnChangeProps?b:p.trackResult(b)}function kU(t,e){return TU(t,uU)}const xA=6048e5,_U=864e5,bA=6e4,yA=36e5,oN=Symbol.for("constructDateFrom");function Ga(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&oN in t?t[oN](e):t instanceof Date?new t.constructor(e):new Date(e)}function Dn(t,e){return Ga(e||t,t)}let MU={};function _u(){return MU}function wo(t,e){var f,h,p,b;const n=_u(),r=(e==null?void 0:e.weekStartsOn)??((h=(f=e==null?void 0:e.locale)==null?void 0:f.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((b=(p=n.locale)==null?void 0:p.options)==null?void 0:b.weekStartsOn)??0,i=Dn(t,e==null?void 0:e.in),c=i.getDay(),d=(c=c.getTime()?r+1:n.getTime()>=f.getTime()?r:r-1}function cN(t){const e=Dn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function IU(t,...e){const n=Ga.bind(null,e.find(r=>typeof r=="object"));return e.map(n)}function dN(t,e){const n=Dn(t,e==null?void 0:e.in);return n.setHours(0,0,0,0),n}function LU(t,e,n){const[r,i]=IU(n==null?void 0:n.in,t,e),c=dN(r),d=dN(i),f=+c-cN(c),h=+d-cN(d);return Math.round((f-h)/_U)}function zU(t,e){const n=vA(t,e),r=Ga(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),hu(r)}function PU(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function UU(t){return!(!PU(t)&&typeof t!="number"||isNaN(+Dn(t)))}function BU(t,e){const n=Dn(t,e==null?void 0:e.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const HU={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},GU=(t,e,n)=>{let r;const i=HU[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Pp(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const VU={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},FU={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},qU={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$U={date:Pp({formats:VU,defaultWidth:"full"}),time:Pp({formats:FU,defaultWidth:"full"}),dateTime:Pp({formats:qU,defaultWidth:"full"})},YU={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},QU=(t,e,n,r)=>YU[t];function Ji(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const d=t.defaultFormattingWidth||t.defaultWidth,f=n!=null&&n.width?String(n.width):d;i=t.formattingValues[f]||t.formattingValues[d]}else{const d=t.defaultWidth,f=n!=null&&n.width?String(n.width):t.defaultWidth;i=t.values[f]||t.values[d]}const c=t.argumentCallback?t.argumentCallback(e):e;return i[c]}}const WU={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},XU={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ZU={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},KU={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},JU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},e8={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},t8=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},n8={ordinalNumber:t8,era:Ji({values:WU,defaultWidth:"wide"}),quarter:Ji({values:XU,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ji({values:ZU,defaultWidth:"wide"}),day:Ji({values:KU,defaultWidth:"wide"}),dayPeriod:Ji({values:JU,defaultWidth:"wide",formattingValues:e8,defaultFormattingWidth:"wide"})};function eo(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],c=e.match(i);if(!c)return null;const d=c[0],f=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],h=Array.isArray(f)?s8(f,y=>y.test(d)):a8(f,y=>y.test(d));let p;p=t.valueCallback?t.valueCallback(h):h,p=n.valueCallback?n.valueCallback(p):p;const b=e.slice(d.length);return{value:p,rest:b}}}function a8(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function s8(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],c=e.match(t.parsePattern);if(!c)return null;let d=t.valueCallback?t.valueCallback(c[0]):c[0];d=n.valueCallback?n.valueCallback(d):d;const f=e.slice(i.length);return{value:d,rest:f}}}const l8=/^(\d+)(th|st|nd|rd)?/i,i8=/\d+/i,o8={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},c8={any:[/^b/i,/^(a|c)/i]},d8={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},u8={any:[/1/i,/2/i,/3/i,/4/i]},f8={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},h8={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},p8={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},g8={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},m8={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},x8={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},b8={ordinalNumber:r8({matchPattern:l8,parsePattern:i8,valueCallback:t=>parseInt(t,10)}),era:eo({matchPatterns:o8,defaultMatchWidth:"wide",parsePatterns:c8,defaultParseWidth:"any"}),quarter:eo({matchPatterns:d8,defaultMatchWidth:"wide",parsePatterns:u8,defaultParseWidth:"any",valueCallback:t=>t+1}),month:eo({matchPatterns:f8,defaultMatchWidth:"wide",parsePatterns:h8,defaultParseWidth:"any"}),day:eo({matchPatterns:p8,defaultMatchWidth:"wide",parsePatterns:g8,defaultParseWidth:"any"}),dayPeriod:eo({matchPatterns:m8,defaultMatchWidth:"any",parsePatterns:x8,defaultParseWidth:"any"})},y8={code:"en-US",formatDistance:GU,formatLong:$U,formatRelative:QU,localize:n8,match:b8,options:{weekStartsOn:0,firstWeekContainsDate:1}};function v8(t,e){const n=Dn(t,e==null?void 0:e.in);return LU(n,BU(n))+1}function N8(t,e){const n=Dn(t,e==null?void 0:e.in),r=+hu(n)-+zU(n);return Math.round(r/xA)+1}function NA(t,e){var b,y,m,v;const n=Dn(t,e==null?void 0:e.in),r=n.getFullYear(),i=_u(),c=(e==null?void 0:e.firstWeekContainsDate)??((y=(b=e==null?void 0:e.locale)==null?void 0:b.options)==null?void 0:y.firstWeekContainsDate)??i.firstWeekContainsDate??((v=(m=i.locale)==null?void 0:m.options)==null?void 0:v.firstWeekContainsDate)??1,d=Ga((e==null?void 0:e.in)||t,0);d.setFullYear(r+1,0,c),d.setHours(0,0,0,0);const f=wo(d,e),h=Ga((e==null?void 0:e.in)||t,0);h.setFullYear(r,0,c),h.setHours(0,0,0,0);const p=wo(h,e);return+n>=+f?r+1:+n>=+p?r:r-1}function E8(t,e){var f,h,p,b;const n=_u(),r=(e==null?void 0:e.firstWeekContainsDate)??((h=(f=e==null?void 0:e.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((b=(p=n.locale)==null?void 0:p.options)==null?void 0:b.firstWeekContainsDate)??1,i=NA(t,e),c=Ga((e==null?void 0:e.in)||t,0);return c.setFullYear(i,0,r),c.setHours(0,0,0,0),wo(c,e)}function S8(t,e){const n=Dn(t,e==null?void 0:e.in),r=+wo(n,e)-+E8(n,e);return Math.round(r/xA)+1}function tt(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const bs={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return tt(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):tt(n+1,2)},d(t,e){return tt(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return tt(t.getHours()%12||12,e.length)},H(t,e){return tt(t.getHours(),e.length)},m(t,e){return tt(t.getMinutes(),e.length)},s(t,e){return tt(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return tt(i,e.length)}},bl={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},uN={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return bs.y(t,e)},Y:function(t,e,n,r){const i=NA(t,r),c=i>0?i:1-i;if(e==="YY"){const d=c%100;return tt(d,2)}return e==="Yo"?n.ordinalNumber(c,{unit:"year"}):tt(c,e.length)},R:function(t,e){const n=vA(t);return tt(n,e.length)},u:function(t,e){const n=t.getFullYear();return tt(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return tt(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return tt(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return bs.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return tt(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=S8(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):tt(i,e.length)},I:function(t,e,n){const r=N8(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):tt(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):bs.d(t,e)},D:function(t,e,n){const r=v8(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):tt(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),c=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(c);case"ee":return tt(c,2);case"eo":return n.ordinalNumber(c,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),c=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(c);case"cc":return tt(c,e.length);case"co":return n.ordinalNumber(c,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return tt(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=bl.noon:r===0?i=bl.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=bl.evening:r>=12?i=bl.afternoon:r>=4?i=bl.morning:i=bl.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return bs.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):bs.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):tt(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):tt(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):bs.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):bs.s(t,e)},S:function(t,e){return bs.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return hN(r);case"XXXX":case"XX":return dr(r);case"XXXXX":case"XXX":default:return dr(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return hN(r);case"xxxx":case"xx":return dr(r);case"xxxxx":case"xxx":default:return dr(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+fN(r,":");case"OOOO":default:return"GMT"+dr(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+fN(r,":");case"zzzz":default:return"GMT"+dr(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return tt(r,e.length)},T:function(t,e,n){return tt(+t,e.length)}};function fN(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),c=r%60;return c===0?n+String(i):n+String(i)+e+tt(c,2)}function hN(t,e){return t%60===0?(t>0?"-":"+")+tt(Math.abs(t)/60,2):dr(t,e)}function dr(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=tt(Math.trunc(r/60),2),c=tt(r%60,2);return n+i+e+c}const pN=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},EA=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},j8=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return pN(t,e);let c;switch(r){case"P":c=e.dateTime({width:"short"});break;case"PP":c=e.dateTime({width:"medium"});break;case"PPP":c=e.dateTime({width:"long"});break;case"PPPP":default:c=e.dateTime({width:"full"});break}return c.replace("{{date}}",pN(r,e)).replace("{{time}}",EA(i,e))},A8={p:EA,P:j8},w8=/^D+$/,C8=/^Y+$/,D8=["D","DD","YY","YYYY"];function O8(t){return w8.test(t)}function R8(t){return C8.test(t)}function T8(t,e,n){const r=k8(t,e,n);if(console.warn(r),D8.includes(t))throw new RangeError(r)}function k8(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const _8=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,M8=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,I8=/^'([^]*?)'?$/,L8=/''/g,z8=/[a-zA-Z]/;function Up(t,e,n){var b,y,m,v;const r=_u(),i=r.locale??y8,c=r.firstWeekContainsDate??((y=(b=r.locale)==null?void 0:b.options)==null?void 0:y.firstWeekContainsDate)??1,d=r.weekStartsOn??((v=(m=r.locale)==null?void 0:m.options)==null?void 0:v.weekStartsOn)??0,f=Dn(t,n==null?void 0:n.in);if(!UU(f))throw new RangeError("Invalid time value");let h=e.match(M8).map(N=>{const S=N[0];if(S==="p"||S==="P"){const j=A8[S];return j(N,i.formatLong)}return N}).join("").match(_8).map(N=>{if(N==="''")return{isToken:!1,value:"'"};const S=N[0];if(S==="'")return{isToken:!1,value:P8(N)};if(uN[S])return{isToken:!0,value:N};if(S.match(z8))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:N}});i.localize.preprocessor&&(h=i.localize.preprocessor(f,h));const p={firstWeekContainsDate:c,weekStartsOn:d,locale:i};return h.map(N=>{if(!N.isToken)return N.value;const S=N.value;(R8(S)||O8(S))&&T8(S,e,String(t));const j=uN[S[0]];return j(f,S,i.localize,p)}).join("")}function P8(t){const e=t.match(I8);return e?e[1].replace(L8,"'"):t}function gN(t,e){const n=()=>Ga(e==null?void 0:e.in,NaN),i=G8(t);let c;if(i.date){const p=V8(i.date,2);c=F8(p.restDateString,p.year)}if(!c||isNaN(+c))return n();const d=+c;let f=0,h;if(i.time&&(f=q8(i.time),isNaN(f)))return n();if(i.timezone){if(h=$8(i.timezone),isNaN(h))return n()}else{const p=new Date(d+f),b=Dn(0,e==null?void 0:e.in);return b.setFullYear(p.getUTCFullYear(),p.getUTCMonth(),p.getUTCDate()),b.setHours(p.getUTCHours(),p.getUTCMinutes(),p.getUTCSeconds(),p.getUTCMilliseconds()),b}return Dn(d+f+h,e==null?void 0:e.in)}const Sd={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},U8=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,B8=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,H8=/^([+-])(\d{2})(?::?(\d{2}))?$/;function G8(t){const e={},n=t.split(Sd.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],Sd.timeZoneDelimiter.test(e.date)&&(e.date=t.split(Sd.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const i=Sd.timezone.exec(r);i?(e.time=r.replace(i[1],""),e.timezone=i[1]):e.time=r}return e}function V8(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const i=r[1]?parseInt(r[1]):null,c=r[2]?parseInt(r[2]):null;return{year:c===null?i:c*100,restDateString:t.slice((r[1]||r[2]).length)}}function F8(t,e){if(e===null)return new Date(NaN);const n=t.match(U8);if(!n)return new Date(NaN);const r=!!n[4],i=to(n[1]),c=to(n[2])-1,d=to(n[3]),f=to(n[4]),h=to(n[5])-1;if(r)return Z8(e,f,h)?Y8(e,f,h):new Date(NaN);{const p=new Date(0);return!W8(e,c,d)||!X8(e,i)?new Date(NaN):(p.setUTCFullYear(e,c,Math.max(i,d)),p)}}function to(t){return t?parseInt(t):1}function q8(t){const e=t.match(B8);if(!e)return NaN;const n=Bp(e[1]),r=Bp(e[2]),i=Bp(e[3]);return K8(n,r,i)?n*yA+r*bA+i*1e3:NaN}function Bp(t){return t&&parseFloat(t.replace(",","."))||0}function $8(t){if(t==="Z")return 0;const e=t.match(H8);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return J8(r,i)?n*(r*yA+i*bA):NaN}function Y8(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const i=r.getUTCDay()||7,c=(e-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+c),r}const Q8=[31,null,31,30,31,30,31,31,30,31,30,31];function SA(t){return t%400===0||t%4===0&&t%100!==0}function W8(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(Q8[e]||(SA(t)?29:28))}function X8(t,e){return e>=1&&e<=(SA(t)?366:365)}function Z8(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function K8(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function J8(t,e){return e>=0&&e<=59}function mN(t,e){const[n,r]=Ve.useState(t);return Ve.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}const eB=({status:t})=>{const e={AUTORIZADO:{label:"Autorizado",color:"bg-green-100 text-green-700 border-green-200"},AUTORIZADO_PARCIAL:{label:"Autorizado Parcialmente",color:"bg-yellow-100 text-yellow-700 border-yellow-200"},NEGADO:{label:"Negado",color:"bg-red-100 text-red-700 border-red-200"},EM_ANALISE:{label:"Em Análise",color:"bg-blue-100 text-blue-700 border-blue-200"},CANCELADO:{label:"Cancelado",color:"bg-gray-100 text-gray-700 border-gray-200"}},n=e[t]||e.EM_ANALISE;return s.jsx("span",{className:`px-2 py-1 rounded-full text-[10px] font-bold border uppercase ${n.color}`,children:n.label})},tB=()=>{const[t,e]=w.useState(1),[n]=w.useState(10),[r,i]=w.useState(""),[c,d]=w.useState(""),[f,h]=w.useState(""),[p,b]=w.useState(""),[y,m]=w.useState(""),[v,N]=w.useState("dataSolicitacao"),[S,j]=w.useState("DESC"),R=mN(r,500),C=mN(c,500),O=async()=>{const ne=new URLSearchParams({page:t.toString(),pageSize:n.toString(),search:R,gto:C,status:f,dataInicio:p,dataFim:y,sortField:v,sortOrder:S}),oe=localStorage.getItem("SCOREODONTO_AUTH_TOKEN"),Q=await fetch(`/api/guias?${ne}`,{headers:oe?{Authorization:`Bearer ${oe}`}:{}});if(!Q.ok)throw new Error("Falha ao carregar guias");return Q.json()},{data:A,isLoading:k,isError:_,refetch:B}=kU({queryKey:["guias",t,R,C,f,p,y,v,S],queryFn:O,placeholderData:ne=>ne}),F=ne=>{v===ne?j(S==="ASC"?"DESC":"ASC"):(N(ne),j("DESC"))},G=A?Math.ceil(A.total/n):0,ee=()=>{if(!(A!=null&&A.data))return;const ne=["Data Solicitação","Identificação","Beneficiário","Tipo Tratamento","GTO","Situação"],oe=A.data.map(H=>[Up(gN(H.dataSolicitacao),"dd/MM/yyyy"),H.beneficiarioIdentificacao,H.beneficiarioNome,H.tipoTratamento,H.numeroGuiaPrestador,H.status]),Q="data:text/csv;charset=utf-8,"+ne.join(",")+` -`+oe.map(H=>H.join(",")).join(` -`),ce=encodeURI(Q),he=document.createElement("a");he.setAttribute("href",ce),he.setAttribute("download",`tratamentos_${Up(new Date,"yyyyMMdd")}.csv`),document.body.appendChild(he),he.click(),document.body.removeChild(he)};return s.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[s.jsx(cn,{title:"Meus Tratamentos",description:"LISTAGEM E GESTÃO DE GUIAS DE TRATAMENTO ODONTOLÓGICO (GTO).",children:s.jsxs("button",{onClick:ee,className:"flex items-center gap-2 px-4 py-2 bg-gray-800 text-white rounded-lg hover:bg-gray-700 transition-colors text-sm font-bold uppercase shadow-sm",children:[s.jsx(Og,{size:18})," Exportar CSV"]})}),s.jsxs("div",{className:"bg-white p-6 rounded-xl border border-gray-200 shadow-sm space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[s.jsxs("div",{className:"flex-1 min-w-[200px]",children:[s.jsx("label",{className:"block text-[10px] font-bold text-gray-400 uppercase mb-1",children:"Status da Guia"}),s.jsxs("select",{value:f,onChange:ne=>{h(ne.target.value),e(1)},className:"w-full px-4 py-2 bg-gray-50 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none text-sm font-semibold uppercase",children:[s.jsx("option",{value:"",children:"TODOS OS STATUS"}),s.jsx("option",{value:"AUTORIZADO",children:"AUTORIZADO"}),s.jsx("option",{value:"AUTORIZADO_PARCIAL",children:"AUTORIZADO PARCIALMENTE"}),s.jsx("option",{value:"NEGADO",children:"NEGADO"}),s.jsx("option",{value:"EM_ANALISE",children:"EM ANÁLISE"}),s.jsx("option",{value:"CANCELADO",children:"CANCELADO"})]})]}),s.jsxs("div",{className:"w-48",children:[s.jsx("label",{className:"block text-[10px] font-bold text-gray-400 uppercase mb-1",children:"GTO (Número)"}),s.jsxs("div",{className:"relative",children:[s.jsx(mu,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:16}),s.jsx("input",{type:"text",placeholder:"EX: 177903",value:c,onChange:ne=>{d(ne.target.value),e(1)},className:"w-full pl-10 pr-4 py-2 bg-gray-50 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none text-sm font-semibold uppercase"})]})]}),s.jsxs("div",{className:"flex-1 min-w-[300px]",children:[s.jsx("label",{className:"block text-[10px] font-bold text-gray-400 uppercase mb-1",children:"Pesquisar Beneficiário"}),s.jsxs("div",{className:"relative",children:[s.jsx(ha,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:16}),s.jsx("input",{type:"text",placeholder:"DIGITE NOME OU IDENTIFICAÇÃO...",value:r,onChange:ne=>{i(ne.target.value.toUpperCase()),e(1)},className:"w-full pl-10 pr-4 py-2 bg-gray-50 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none text-sm font-semibold uppercase"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 pt-2 border-t border-gray-50",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Et,{size:16,className:"text-gray-400"}),s.jsx("input",{type:"date",value:p,onChange:ne=>{b(ne.target.value),e(1)},className:"px-3 py-1.5 bg-gray-50 border border-gray-200 rounded-lg text-xs font-semibold"}),s.jsx("span",{className:"text-gray-400 font-bold text-xs uppercase",children:"até"}),s.jsx("input",{type:"date",value:y,onChange:ne=>{m(ne.target.value),e(1)},className:"px-3 py-1.5 bg-gray-50 border border-gray-200 rounded-lg text-xs font-semibold"})]}),s.jsx("button",{onClick:()=>{i(""),d(""),h(""),b(""),m(""),e(1)},className:"text-[10px] font-bold text-blue-600 hover:text-blue-800 uppercase",children:"Limpar Filtros"})]})]}),s.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden flex-1 flex flex-col min-h-[400px]",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[s.jsx("th",{className:"px-6 py-4",children:s.jsxs("button",{onClick:()=>F("dataSolicitacao"),className:"flex items-center gap-2 text-[11px] font-extrabold text-gray-500 uppercase tracking-wider hover:text-blue-600 transition-colors",children:["Data Solicitação ",s.jsx(od,{size:14})]})}),s.jsx("th",{className:"px-6 py-4",children:s.jsx("span",{className:"text-[11px] font-extrabold text-gray-500 uppercase tracking-wider",children:"Identificação do Beneficiário"})}),s.jsx("th",{className:"px-6 py-4",children:s.jsxs("button",{onClick:()=>F("beneficiarioNome"),className:"flex items-center gap-2 text-[11px] font-extrabold text-gray-500 uppercase tracking-wider hover:text-blue-600 transition-colors",children:["Nome Beneficiário ",s.jsx(od,{size:14})]})}),s.jsx("th",{className:"px-6 py-4",children:s.jsx("span",{className:"text-[11px] font-extrabold text-gray-500 uppercase tracking-wider",children:"Tipo Tratamento"})}),s.jsx("th",{className:"px-6 py-4",children:s.jsxs("button",{onClick:()=>F("numeroGuiaPrestador"),className:"flex items-center gap-2 text-[11px] font-extrabold text-gray-500 uppercase tracking-wider hover:text-blue-600 transition-colors",children:["GTO ",s.jsx(od,{size:14})]})}),s.jsx("th",{className:"px-6 py-4",children:s.jsxs("button",{onClick:()=>F("status"),className:"flex items-center gap-2 text-[11px] font-extrabold text-gray-500 uppercase tracking-wider hover:text-blue-600 transition-colors",children:["Situação da GTO ",s.jsx(od,{size:14})]})})]})}),s.jsx("tbody",{className:"divide-y divide-gray-100",children:k?Array.from({length:5}).map((ne,oe)=>s.jsx("tr",{className:"animate-pulse",children:s.jsx("td",{colSpan:6,className:"px-6 py-4 h-16 bg-gray-50/30"})},oe)):_?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-red-500 font-bold uppercase",children:"Erro ao carregar dados."})}):(A==null?void 0:A.data.length)===0?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-gray-400 font-bold uppercase",children:"Nenhum tratamento encontrado."})}):A==null?void 0:A.data.map(ne=>s.jsxs("tr",{className:"hover:bg-blue-50/50 transition-colors cursor-pointer group",children:[s.jsx("td",{className:"px-6 py-4 text-sm font-semibold text-gray-700",children:Up(gN(ne.dataSolicitacao),"dd/MM/yyyy")}),s.jsx("td",{className:"px-6 py-4 text-sm font-bold text-blue-600 group-hover:underline",children:ne.beneficiarioIdentificacao}),s.jsx("td",{className:"px-6 py-4",children:s.jsx("p",{className:"text-sm font-bold text-gray-900 uppercase",children:ne.beneficiarioNome})}),s.jsx("td",{className:"px-6 py-4 text-sm text-gray-600",children:ne.tipoTratamento}),s.jsx("td",{className:"px-6 py-4 text-sm font-bold text-gray-800",children:ne.numeroGuiaPrestador}),s.jsx("td",{className:"px-6 py-4",children:s.jsx(eB,{status:ne.status})})]},ne.id))})]})}),s.jsxs("div",{className:"mt-auto bg-gray-50 px-6 py-4 border-t border-gray-200 flex items-center justify-between",children:[s.jsxs("div",{className:"text-xs font-bold text-gray-500 uppercase",children:["Mostrando ",s.jsx("span",{className:"text-gray-900",children:(A==null?void 0:A.data.length)||0})," de ",s.jsx("span",{className:"text-gray-900",children:(A==null?void 0:A.total)||0})," resultados"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{disabled:t===1,onClick:()=>e(ne=>Math.max(1,ne-1)),className:"p-2 border border-gray-300 rounded-lg hover:bg-white disabled:opacity-30 disabled:hover:bg-transparent transition-colors shadow-sm",children:s.jsx(Bs,{size:16})}),s.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:G},(ne,oe)=>oe+1).map(ne=>s.jsx("button",{onClick:()=>e(ne),className:`w-8 h-8 rounded-lg text-xs font-bold transition-all ${ne===t?"bg-blue-600 text-white shadow-md":"text-gray-600 hover:bg-white border border-transparent hover:border-gray-200"}`,children:ne},ne))}),s.jsx("button",{disabled:t===G,onClick:()=>e(ne=>Math.min(G,ne+1)),className:"p-2 border border-gray-300 rounded-lg hover:bg-white disabled:opacity-30 disabled:hover:bg-transparent transition-colors shadow-sm",children:s.jsx(Ts,{size:16})})]})]})]})]})},Ag="V1.0.6",nB=({onLoginSuccess:t})=>{const[e,n]=w.useState(""),[r,i]=w.useState(""),[c,d]=w.useState(!1),[f,h]=w.useState(""),[p,b]=w.useState(!0);if(w.useEffect(()=>{const m=setTimeout(()=>b(!1),3e3);return()=>clearTimeout(m)},[]),p)return s.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col items-center justify-center p-4",children:[s.jsx(Ct,{className:"animate-spin text-blue-600 mb-4",size:48}),s.jsx("h2",{className:"text-gray-500 font-bold uppercase tracking-widest text-sm",children:"Inicializando Sistema..."}),s.jsx("span",{className:"text-gray-400 text-xs mt-2 font-mono font-bold bg-gray-200 px-2 py-1 rounded",children:Ag})]});const y=async m=>{m.preventDefault(),d(!0),h("");try{await J.login(e,r)?t():h("CREDENCIAIS INVÁLIDAS. VERIFIQUE EMAIL E SENHA.")}catch{h("ERRO DE CONEXÃO. TENTE NOVAMENTE.")}finally{d(!1)}};return s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:s.jsxs("div",{className:"max-w-md w-full bg-white rounded-2xl shadow-xl overflow-hidden border border-gray-100",children:[s.jsxs("div",{className:"bg-blue-600 p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-white/20 rounded-xl flex items-center justify-center text-white mx-auto backdrop-blur-sm mb-4",children:s.jsx(Er,{size:32})}),s.jsx("h1",{className:"text-2xl font-bold text-white uppercase tracking-wide",children:"SCOREODONTO"}),s.jsx("p",{className:"text-blue-100 text-xs font-bold uppercase mt-1",children:"SISTEMA INTEGRADO POSTGRESQL + GOOGLE"})]}),s.jsxs("div",{className:"p-8",children:[s.jsxs("h2",{className:"text-lg font-bold text-gray-800 uppercase mb-6 text-center flex items-center justify-center gap-2",children:[s.jsx(_d,{size:18,className:"text-blue-600"})," ACESSO RESTRITO"]}),s.jsxs("form",{onSubmit:y,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"USUÁRIO / EMAIL"}),s.jsxs("div",{className:"relative",children:[s.jsx(zo,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400",size:18}),s.jsx("input",{type:"email",required:!0,value:e,onChange:m=>n(m.target.value),className:"w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none transition-all text-sm font-medium",placeholder:"ex: usuario@email.com"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"SENHA DE ACESSO"}),s.jsxs("div",{className:"relative",children:[s.jsx(_d,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400",size:18}),s.jsx("input",{type:"password",required:!0,value:r,onChange:m=>i(m.target.value),className:"w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none transition-all text-sm font-medium",placeholder:"••••••••"})]})]}),f&&s.jsx("div",{className:"p-3 bg-red-50 text-red-600 text-xs font-bold uppercase rounded-lg border border-red-100 text-center",children:f}),s.jsx("button",{type:"submit",disabled:c,className:"w-full bg-blue-600 hover:bg-blue-700 text-white py-3 rounded-lg font-bold uppercase flex items-center justify-center gap-2 transition-all shadow-lg hover:shadow-xl disabled:opacity-70 disabled:cursor-not-allowed mt-4",children:c?s.jsx("span",{children:"VERIFICANDO..."}):s.jsxs(s.Fragment,{children:["ENTRAR NO SISTEMA ",s.jsx(Ls,{size:18})]})})]}),s.jsxs("div",{className:"mt-8 flex flex-col items-center justify-center gap-2 text-gray-400 text-[10px] font-bold uppercase",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Sr,{size:12})," AMBIENTE SEGURO E CRIPTOGRAFADO"]}),s.jsx("span",{className:"bg-gray-100 text-gray-500 px-2 py-1 rounded font-mono",children:Ag})]})]})]})})},jd=({icon:t,title:e,description:n})=>s.jsxs("div",{className:"bg-white/70 backdrop-blur-md p-8 rounded-3xl border border-white/50 shadow-[0_8px_30px_rgb(0,0,0,0.04)] hover:shadow-[0_20px_50px_rgba(8,112,184,0.1)] transition-all duration-500 group",children:[s.jsx("div",{className:"w-14 h-14 bg-blue-600/10 rounded-2xl flex items-center justify-center mb-6 group-hover:bg-blue-600 group-hover:text-white transition-all duration-500 text-blue-600",children:t}),s.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-3 uppercase tracking-tight",children:e}),s.jsx("p",{className:"text-gray-600 leading-relaxed text-sm",children:n})]}),aB=({onGetStarted:t})=>{const[e,n]=w.useState(!1),[r,i]=w.useState(!1);return w.useEffect(()=>{const c=()=>n(window.scrollY>20);return window.addEventListener("scroll",c),()=>window.removeEventListener("scroll",c)},[]),s.jsxs("div",{className:"min-h-screen bg-[#F8FAFC] font-sans selection:bg-blue-100 selection:text-blue-900 overflow-x-hidden",children:[s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-[100] transition-all duration-500 ${e?"bg-white/80 backdrop-blur-xl border-b border-gray-100 py-3 shadow-sm":"bg-transparent py-6"}`,children:s.jsxs("div",{className:"max-w-7xl mx-auto px-6 flex justify-between items-center",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-10 h-10 bg-gradient-to-tr from-blue-600 to-indigo-600 rounded-xl flex items-center justify-center shadow-lg shadow-blue-200",children:s.jsx(ua,{className:"text-white",size:24})}),s.jsxs("span",{className:"text-2xl font-black text-gray-900 tracking-tighter uppercase italic",children:["Score",s.jsx("span",{className:"text-blue-600",children:"Odonto"})]})]}),s.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[s.jsx("a",{href:"#features",className:"text-sm font-bold text-gray-600 hover:text-blue-600 transition-colors uppercase tracking-widest",children:"Recursos"}),s.jsx("a",{href:"#solutions",className:"text-sm font-bold text-gray-600 hover:text-blue-600 transition-colors uppercase tracking-widest",children:"Soluções"}),s.jsx("a",{href:"#mobile",className:"text-sm font-bold text-gray-600 hover:text-blue-600 transition-colors uppercase tracking-widest",children:"Mobile"}),s.jsx("button",{onClick:t,className:"bg-gray-900 text-white px-6 py-3 rounded-full text-xs font-black uppercase tracking-widest hover:bg-blue-600 hover:shadow-xl hover:shadow-blue-200 transition-all active:scale-95",children:"Começar Agora"})]}),s.jsx("button",{className:"md:hidden p-2 text-gray-900",onClick:()=>i(!r),children:r?s.jsx(Qe,{size:28}):s.jsx(VN,{size:28})})]})}),s.jsxs("section",{className:"relative pt-32 pb-20 lg:pt-48 lg:pb-40 overflow-hidden",children:[s.jsx("div",{className:"absolute top-0 right-0 w-1/2 h-full bg-gradient-to-l from-blue-50/50 to-transparent -z-10 translate-x-20 skew-x-12"}),s.jsx("div",{className:"absolute top-40 left-10 w-72 h-72 bg-blue-400/10 rounded-full blur-3xl -z-10"}),s.jsx("div",{className:"max-w-7xl mx-auto px-6",children:s.jsxs("div",{className:"grid lg:grid-cols-2 gap-16 items-center",children:[s.jsxs("div",{className:"space-y-8",children:[s.jsxs("h1",{className:"text-6xl lg:text-7xl font-black text-gray-900 leading-[1.05] tracking-tighter",children:["O Futuro da Sua Clínica é ",s.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-indigo-600 underline decoration-blue-200 underline-offset-8",children:"Inteligente"})]}),s.jsx("p",{className:"text-xl text-gray-600 leading-relaxed max-w-lg font-medium",children:"Maximize a produtividade com gestão financeira, agenda com arraste e solte, e controle absoluto de tratamentos em uma plataforma única e elegante."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[s.jsxs("button",{onClick:t,className:"bg-blue-600 text-white px-10 py-5 rounded-2xl text-sm font-black uppercase tracking-widest shadow-2xl shadow-blue-200 hover:bg-blue-700 hover:-translate-y-1 transition-all flex items-center justify-center gap-3 group",children:["Acessar Plataforma ",s.jsx(Ls,{size:18,className:"group-hover:translate-x-1 transition-transform"})]}),s.jsxs("div",{className:"flex items-center gap-4 py-2 px-4",children:[s.jsx("div",{className:"flex -space-x-3",children:[1,2,3,4].map(c=>s.jsx("div",{className:"w-10 h-10 rounded-full border-2 border-white bg-gray-200 flex items-center justify-center text-[10px] font-bold overflow-hidden shadow-sm",children:s.jsx("img",{src:`https://i.pravatar.cc/100?img=${c+10}`,alt:"User"})},c))}),s.jsxs("div",{className:"text-xs text-gray-500 font-bold uppercase tracking-tight",children:[s.jsx("span",{className:"text-gray-900",children:"+400 Clínicas"})," ",s.jsx("br",{})," que já otimizaram processos"]})]})]})]}),s.jsxs("div",{className:"relative",children:[s.jsxs("div",{className:"relative z-10 rounded-[3rem] overflow-hidden shadow-[0_50px_100px_-20px_rgba(0,0,0,0.2)] border-8 border-white group",children:[s.jsx("img",{src:"/dental_landing_hero.png",alt:"Interface ScoreOdonto",className:"w-full h-auto transform group-hover:scale-105 transition-all duration-700",onError:c=>{c.target.src="https://images.unsplash.com/photo-1594832284143-588b813ed334?q=80&w=2070&auto=format&fit=crop"}}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/40 to-transparent flex items-bottom p-10 opacity-0 group-hover:opacity-100 transition-opacity duration-500",children:s.jsx("p",{className:"mt-auto text-white font-bold uppercase text-xs tracking-widest",children:"Interface Real: Dashboard Analítico"})})]}),s.jsx("div",{className:"absolute -top-10 -right-10 z-20 bg-white p-6 rounded-3xl shadow-2xl border border-blue-50 animate-bounce transition-all duration-1000 hidden md:block",style:{animationDelay:"0.2s"},children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-blue-100 text-blue-600 rounded-2xl",children:s.jsx(Et,{size:24})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Sincronização Total"}),s.jsx("div",{className:"text-lg font-black text-gray-900 tracking-tight",children:"Google Agenda"})]})]})}),s.jsx("div",{className:"absolute -bottom-10 -left-10 z-20 bg-white p-6 rounded-3xl shadow-2xl border border-green-50 animate-bounce transition-all duration-1000",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-green-100 text-green-600 rounded-2xl",children:s.jsx(TD,{size:24})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Comunicação"}),s.jsx("div",{className:"text-lg font-black text-gray-900 tracking-tight",children:"CRM WhatsApp"})]})]})})]})]})})]}),s.jsx("div",{className:"bg-white border-y border-gray-100 py-10",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-6 overflow-hidden",children:[s.jsx("p",{className:"text-center text-[10px] font-black text-gray-400 uppercase tracking-[0.3em] mb-10",children:"Conectado com os principais convênios"}),s.jsxs("div",{className:"flex justify-between items-center opacity-30 grayscale gap-10",children:[s.jsx("span",{className:"text-2xl font-black italic",children:"CASSEMS"}),s.jsx("span",{className:"text-2xl font-black italic",children:"UNIMED"}),s.jsx("span",{className:"text-2xl font-black italic",children:"BRADESCO"}),s.jsx("span",{className:"text-2xl font-black italic",children:"SULAMÉRICA"}),s.jsx("span",{className:"text-2xl font-black italic",children:"AMIL DENTAL"}),s.jsx("span",{className:"text-2xl font-black italic",children:"REDE DENTAL"})]})]})}),s.jsx("section",{id:"features",className:"py-32 px-6",children:s.jsxs("div",{className:"max-w-7xl mx-auto",children:[s.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-20 space-y-4",children:[s.jsx("h2",{className:"text-4xl lg:text-5xl font-black text-gray-900 leading-tight tracking-tighter uppercase",children:"Todo o Controle na Sua Mão"}),s.jsx("p",{className:"text-lg text-gray-600 font-medium",children:"Focamos na tecnologia para que você foque no que mais importa: o sorriso do seu paciente."})]}),s.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-8",children:[s.jsx(jd,{icon:s.jsx(Et,{size:28}),title:"Agenda 4.0",description:"Controle total com arraste e solte, cores por profissional e sincronização em tempo real."}),s.jsx(jd,{icon:s.jsx(Sr,{size:28}),title:"GTO Segura",description:"Lançamento simplificado de guias de convênio com validação automática de erros."}),s.jsx(jd,{icon:s.jsx($n,{size:28}),title:"Gestão de Pacientes",description:"CRM odontológico completo com histórico clínico, anexos e ortodontia avançada."}),s.jsx(jd,{icon:s.jsx(ko,{size:28}),title:"BI Financeiro",description:"Gráficos de produtividade, fluxo de caixa e gestão de taxas de operadoras."})]})]})}),s.jsx("section",{className:"py-20 px-6",children:s.jsxs("div",{className:"max-w-7xl mx-auto bg-gradient-to-br from-blue-600 to-indigo-700 rounded-[3rem] p-12 lg:p-24 overflow-hidden relative shadow-2xl shadow-blue-300",children:[s.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2 blur-3xl"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-64 h-64 bg-black/10 rounded-full translate-y-1/2 -translate-x-1/2 blur-3xl"}),s.jsxs("div",{className:"relative z-10 text-center space-y-8 max-w-3xl mx-auto",children:[s.jsxs("h2",{className:"text-4xl lg:text-6xl font-black text-white leading-tight tracking-tighter uppercase italic",children:["Sua Clínica Elevada ao ",s.jsx("span",{className:"bg-white text-blue-600 px-4 py-1 rounded-2xl not-italic",children:"Próximo Nível"})]}),s.jsx("p",{className:"text-blue-100 text-xl font-medium",children:"Junte-se a centenas de profissionais que já transformaram a gestão de seus consultórios. Comece agora gratuitamente."}),s.jsx("div",{className:"pt-6",children:s.jsx("button",{onClick:t,className:"bg-white text-blue-600 px-12 py-6 rounded-3xl text-sm font-black uppercase tracking-widest shadow-xl hover:bg-gray-50 hover:-translate-y-1 transition-all active:scale-95",children:"Testar Demonstrativo"})})]})]})}),s.jsxs("footer",{className:"py-20 border-t border-gray-100 bg-white",children:[s.jsxs("div",{className:"max-w-7xl mx-auto px-6 grid md:grid-cols-4 gap-12",children:[s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center",children:s.jsx(ua,{className:"text-white",size:18})}),s.jsxs("span",{className:"text-xl font-black text-gray-900 tracking-tighter uppercase italic",children:["Score",s.jsx("span",{className:"text-blue-600",children:"Odonto"})]})]}),s.jsx("p",{className:"text-gray-500 text-sm leading-relaxed",children:"A plataforma líder em gestão odontológica para clínicas que buscam excelência e eficiência."}),s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"w-8 h-8 bg-gray-100 rounded-full hover:bg-blue-600 hover:text-white transition-all flex items-center justify-center cursor-pointer",children:s.jsx(cO,{size:16})}),s.jsx("div",{className:"w-8 h-8 bg-gray-100 rounded-full hover:bg-blue-600 hover:text-white transition-all flex items-center justify-center cursor-pointer",children:s.jsx($n,{size:16})}),s.jsx("div",{className:"w-8 h-8 bg-gray-100 rounded-full hover:bg-blue-600 hover:text-white transition-all flex items-center justify-center cursor-pointer",children:s.jsx(MO,{size:16})})]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx("h4",{className:"text-xs font-black text-gray-900 uppercase tracking-widest",children:"Produto"}),s.jsxs("ul",{className:"space-y-3 text-sm text-gray-500 font-bold uppercase tracking-tight",children:[s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Funcionalidades"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Segurança"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"API"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Mobile"})]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx("h4",{className:"text-xs font-black text-gray-900 uppercase tracking-widest",children:"Empresa"}),s.jsxs("ul",{className:"space-y-3 text-sm text-gray-500 font-bold uppercase tracking-tight",children:[s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Sobre Nós"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Blog"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Carreiras"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Contato"})]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx("h4",{className:"text-xs font-black text-gray-900 uppercase tracking-widest",children:"Suporte"}),s.jsxs("div",{className:"p-4 bg-gray-50 rounded-2xl border border-gray-100",children:[s.jsx("p",{className:"text-xs text-gray-500 font-bold uppercase mb-2",children:"Central de Ajuda"}),s.jsx("a",{href:"mailto:suporte@scoreodonto.com",className:"text-sm font-black text-blue-600 hover:underline",children:"suporte@scoreodonto.com"})]})]})]}),s.jsxs("div",{className:"max-w-7xl mx-auto px-6 mt-20 pt-10 border-t border-gray-50 flex flex-col md:flex-row justify-between items-center gap-6",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"© 2026 ScoreOdonto. Todos os direitos reservados."}),s.jsxs("div",{className:"flex gap-8 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:[s.jsx("span",{className:"hover:text-gray-900 cursor-pointer",children:"Termos"}),s.jsx("span",{className:"hover:text-gray-900 cursor-pointer",children:"Privacidade"}),s.jsx("span",{className:"hover:text-gray-900 cursor-pointer",children:"Cookies"})]})]})]})]})},sB=()=>{const[t,e]=w.useState(!1),[n,r]=w.useState([]),[i,c]=w.useState(!1),d=async()=>{e(!0),r([]),c(!1),await J.runInstallScript(h=>{r(p=>[...p,h])}),c(!0),e(!1)},f=()=>{window.location.href="./"};return s.jsx("div",{className:"min-h-screen bg-gray-900 flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-2xl bg-white rounded-xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"bg-gray-100 p-6 border-b border-gray-200 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 bg-blue-600 rounded-lg flex items-center justify-center text-white",children:s.jsx(Er,{size:24})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold text-gray-900 uppercase",children:"SCOREODONTO ADMIN"}),s.jsx("p",{className:"text-gray-500 text-xs font-bold uppercase",children:"FERRAMENTA DE ATUALIZAÇÃO DE BANCO"})]})]}),s.jsxs("button",{onClick:f,className:"text-gray-500 hover:text-gray-800 flex items-center gap-1 text-xs font-bold uppercase",children:[s.jsx(MN,{size:16})," VOLTAR AO SISTEMA"]})]}),s.jsx("div",{className:"p-8",children:!t&&n.length===0?s.jsxs("div",{className:"text-center space-y-6",children:[s.jsx("div",{className:"w-20 h-20 bg-amber-100 text-amber-600 rounded-full flex items-center justify-center mx-auto",children:s.jsx(rv,{size:40})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-bold text-gray-800 uppercase",children:"SCRIPT DE ATUALIZAÇÃO (SH/UPDATE_DB.SH)"}),s.jsx("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto uppercase",children:'ESTA AÇÃO IRÁ LER A PLANILHA "DADOS PACIENTES", GERAR UM BACKUP SQL E ATUALIZAR AS TABELAS DO POSTGRESQL.'})]}),s.jsx("div",{className:"bg-gray-800 text-green-400 p-4 rounded-lg font-mono text-sm text-left max-w-md mx-auto shadow-inner",children:"$ ./sh/update_db.sh --force-sync"}),s.jsxs("button",{onClick:d,className:"bg-blue-600 hover:bg-blue-700 text-white px-8 py-4 rounded-lg font-bold uppercase flex items-center gap-3 mx-auto transition-all hover:scale-105 shadow-lg",children:[s.jsx(VD,{size:20,fill:"currentColor"}),"EXECUTAR ATUALIZAÇÃO"]})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex justify-between items-center mb-2",children:[s.jsxs("h3",{className:"font-bold text-gray-800 uppercase flex items-center gap-2",children:[s.jsx(rv,{size:18})," TERMINAL DE SAÍDA"]}),i&&s.jsxs("span",{className:"text-green-600 text-xs font-bold uppercase flex items-center gap-1",children:[s.jsx(Ua,{size:14})," PROCESSO FINALIZADO"]})]}),s.jsxs("div",{className:"bg-gray-900 text-green-500 font-mono text-xs p-6 rounded-lg h-80 overflow-y-auto shadow-inner border-4 border-gray-800",children:[n.map((h,p)=>s.jsx("div",{className:"mb-1",children:h},p)),t&&s.jsx("div",{className:"animate-pulse mt-2",children:"_"})]}),i&&s.jsx("button",{onClick:f,className:"w-full py-3 bg-gray-200 hover:bg-gray-300 text-gray-800 font-bold rounded-lg uppercase transition-colors",children:"VOLTAR PARA O LOGIN"})]})})]})})},xN=[{name:"Azul Score",value:"#2563eb"},{name:"Verde Esmeralda",value:"#059669"},{name:"Indigo Premium",value:"#4f46e5"},{name:"Vinho Elegante",value:"#9f1239"},{name:"Slate Moderno",value:"#334155"},{name:"Laranja Vibrante",value:"#ea580c"},{name:"Teal Clínico",value:"#0d9488"},{name:"Roxo Nobre",value:"#7c3aed"}],rB=()=>{const t=J.getWorkspaces(),e=J.getActiveWorkspace(),n=Fe(),r=J.getCurrentRole(),i=r==="admin"||r==="donoclinica",[c,d]=w.useState(null),[f,h]=w.useState(!1),p=y=>{if((e==null?void 0:e.id)===y){n.info("VOCÊ JÁ ESTÁ NESTA UNIDADE.");return}J.switchWorkspace(y),n.success("TROCANDO DE UNIDADE...")},b=async(y,m)=>{h(!0);try{const v=localStorage.getItem("SCOREODONTO_AUTH_TOKEN");if((await fetch(`/api/clinicas/${y}/color`,{method:"PUT",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({cor:m})})).ok){n.success("COR DA UNIDADE ATUALIZADA!");const S=t.map(j=>j.id===y?{...j,cor:m}:j);localStorage.setItem("SCOREODONTO_WORKSPACES",JSON.stringify(S)),(e==null?void 0:e.id)===y&&localStorage.setItem("SCOREODONTO_ACTIVE_WORKSPACE",JSON.stringify({...e,cor:m})),d(null),setTimeout(()=>window.location.reload(),1e3)}else n.error("ERRO AO SALVAR COR.")}catch{n.error("ERRO DE CONEXÃO.")}finally{h(!1)}};return s.jsxs("div",{className:"space-y-10 animate-in fade-in duration-500",children:[s.jsx(cn,{title:"GESTÃO DE UNIDADES",description:"Configure a identidade visual e selecione a clínica para gerenciar atendimentos."}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:t.map(y=>{const m=(e==null?void 0:e.id)===y.id,v=y.cor||"#2563eb";return s.jsx("div",{className:`group relative bg-white rounded-[2.5rem] p-1 border-2 transition-all duration-500 ${m?"shadow-[0_20px_50px_-15px_rgba(0,0,0,0.1)]":"border-transparent hover:border-gray-100 shadow-[0_10px_40px_-15px_rgba(0,0,0,0.05)]"}`,style:{borderColor:m?v:"transparent"},children:s.jsxs("div",{className:"px-8 py-10 rounded-[2.2rem] bg-white h-full flex flex-col",children:[s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center transition-all duration-500 group-hover:scale-110 shadow-lg",style:{backgroundColor:v,color:"#fff",boxShadow:`0 10px 20px -5px ${v}44`},children:s.jsx(Cg,{size:32})}),s.jsxs("div",{className:"flex flex-col items-end gap-2",children:[m&&s.jsx("span",{className:"text-white text-[9px] font-black px-4 py-1.5 rounded-full uppercase tracking-widest shadow-sm",style:{backgroundColor:v},children:"ATIVA"}),i&&s.jsx("button",{onClick:()=>d(c===y.id?null:y.id),className:"p-2 text-gray-400 hover:text-gray-600 bg-gray-50 rounded-xl transition-colors",title:"Mudar Cor",children:s.jsx(zD,{size:16})})]})]}),s.jsxs("div",{className:"space-y-2 flex-grow",children:[s.jsx("h3",{className:"text-2xl font-black text-gray-900 uppercase tracking-tighter leading-tight",children:y.nome}),c===y.id?s.jsxs("div",{className:"mt-4 p-4 bg-gray-50 rounded-2xl border border-gray-100 animate-in slide-in-from-top-2 duration-300",children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest mb-3",children:"Escolha a cor da marca"}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:xN.map(N=>s.jsx("button",{onClick:()=>b(y.id,N.value),disabled:f,className:`w-full h-8 rounded-lg border-2 transition-all ${y.cor===N.value?"border-white ring-2 ring-gray-300":"border-transparent hover:scale-110"}`,style:{backgroundColor:N.value},title:N.name,children:f&&y.cor===N.value&&s.jsx(Ct,{size:12,className:"animate-spin text-white mx-auto"})},N.value))})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 text-gray-400",children:[s.jsx(HN,{size:14}),s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest",children:"Unidade Operacional"})]}),s.jsxs("div",{className:"mt-6 pt-6 border-t border-gray-50 flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center",style:{backgroundColor:`${v}11`,color:v},children:s.jsx(iO,{size:16})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest leading-none mb-1",children:"Seu Perfil"}),s.jsx("p",{className:"text-xs font-bold text-gray-700 uppercase",children:y.role})]})]})]})]}),s.jsx("button",{onClick:()=>p(y.id),disabled:m||c===y.id,className:"mt-10 w-full py-4 rounded-2xl text-xs font-black uppercase tracking-widest transition-all duration-300 flex items-center justify-center gap-3 group/btn shadow-lg",style:{backgroundColor:m?"#f3f4f6":v,color:m?"#9ca3af":"#fff",boxShadow:m?"none":`0 10px 20px -10px ${v}66`},children:m?s.jsxs(s.Fragment,{children:["UNIDADE ATUAL ",s.jsx(mC,{size:18})]}):s.jsxs(s.Fragment,{children:["ACESSAR UNIDADE ",s.jsx(Ls,{size:18,className:"group-hover/btn:translate-x-1 transition-transform"})]})})]})},y.id)})}),s.jsxs("div",{className:"bg-white rounded-[2rem] p-10 border border-gray-100 flex flex-col md:flex-row items-center justify-between gap-6 shadow-sm",children:[s.jsxs("div",{className:"text-center md:text-left",children:[s.jsx("h4",{className:"text-lg font-black text-gray-900 uppercase tracking-tight italic",children:"Identidade Visual Dinâmica"}),s.jsx("p",{className:"text-sm text-gray-500 font-medium",children:"A cor escolhida será aplicada automaticamente em toda a interface desta clínica."})]}),s.jsx("div",{className:"flex gap-2",children:xN.slice(0,4).map(y=>s.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:y.value}},y.value))})]})]})},lB=()=>{const[t,e]=w.useState(1),[n,r]=w.useState(!1),i=Fe(),c=new URLSearchParams(window.location.search),d=c.get("clinica"),f=c.get("nome"),h=c.get("token"),[p,b]=w.useState({nome:f||"",email:"",senha:"",cro:"",cro_uf:"MS",celular:"",especialidade:""});if(!h||!d)return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 p-4",children:s.jsxs("div",{className:"text-center space-y-4",children:[s.jsx("div",{className:"w-20 h-20 bg-red-50 text-red-500 rounded-full flex items-center justify-center mx-auto shadow-sm",children:s.jsx(_d,{size:40})}),s.jsx("h2",{className:"text-2xl font-black text-gray-900 uppercase",children:"LINK INVÁLIDO OU EXPIRADO"}),s.jsx("p",{className:"text-gray-500 max-w-sm mx-auto font-medium",children:"Por favor, solicite um novo convite ao administrador da clínica."})]})});const y=async m=>{m.preventDefault(),r(!0);try{(await fetch("/api/dentistas/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...p,id:"d_"+Math.random().toString(36).substring(2,9),clinicaId:d})})).ok?(i.success("CADASTRO REALIZADO COM SUCESSO!"),e(3)):i.error("ERRO AO REALIZAR CADASTRO.")}catch{i.error("FALHA DE CONEXÃO.")}finally{r(!1)}};return s.jsx("div",{className:"min-h-screen bg-[#F8FAFC] flex items-center justify-center p-4",children:s.jsxs("div",{className:"max-w-xl w-full",children:[s.jsxs("div",{className:"mb-10 text-center space-y-2",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-1.5 bg-blue-50 text-blue-600 rounded-full text-[10px] font-black uppercase tracking-widest border border-blue-100 mb-4",children:[s.jsx(Sr,{size:14})," Convite de Profissional"]}),s.jsx("h1",{className:"text-4xl font-black text-gray-900 tracking-tighter uppercase leading-none",children:"Complete seu Perfil"}),s.jsxs("p",{className:"text-gray-500 font-medium",children:["Bem-vindo ao SCOREODONTO. Você está sendo convidado para a unidade: ",s.jsx("span",{className:"text-blue-600 font-bold uppercase",children:d})]})]}),s.jsxs("div",{className:"bg-white rounded-[2.5rem] shadow-[0_50px_100px_-20px_rgba(0,0,0,0.08)] border border-gray-100 overflow-hidden relative",children:[s.jsx("div",{className:"h-2 bg-gray-100 w-full",children:s.jsx("div",{className:"h-full bg-blue-600 transition-all duration-700",style:{width:`${t/3*100}%`}})}),t===1&&s.jsx("div",{className:"p-10 animate-in fade-in slide-in-from-right-10 duration-500",children:s.jsxs("form",{className:"space-y-6",onSubmit:m=>{m.preventDefault(),e(2)},children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Seu Nome Profissional"}),s.jsxs("div",{className:"relative group",children:[s.jsx(zo,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-blue-500 transition-colors",size:20}),s.jsx("input",{required:!0,value:p.nome,onChange:m=>b({...p,nome:m.target.value.toUpperCase()}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800 uppercase",placeholder:"NOME COMPLETO"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Email de Acesso"}),s.jsxs("div",{className:"relative group",children:[s.jsx(Rg,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:20}),s.jsx("input",{type:"email",required:!0,value:p.email,onChange:m=>b({...p,email:m.target.value}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800",placeholder:"seu@email.com"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Senha de Acesso"}),s.jsxs("div",{className:"relative group",children:[s.jsx(_d,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:20}),s.jsx("input",{type:"password",required:!0,value:p.senha,onChange:m=>b({...p,senha:m.target.value}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800",placeholder:"••••••••"})]})]})]})]}),s.jsxs("button",{type:"submit",className:"w-full bg-gray-900 text-white py-5 rounded-2xl font-black uppercase tracking-widest hover:bg-blue-600 hover:shadow-2xl hover:shadow-blue-200 transition-all flex items-center justify-center gap-3 active:scale-95",children:["Próximo Passo ",s.jsx(Ls,{size:20})]})]})}),t===2&&s.jsx("div",{className:"p-10 animate-in fade-in slide-in-from-right-10 duration-500",children:s.jsxs("form",{className:"space-y-6",onSubmit:y,children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Inscrição CRO"}),s.jsxs("div",{className:"relative group",children:[s.jsx(Er,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:20}),s.jsx("input",{required:!0,value:p.cro,onChange:m=>b({...p,cro:m.target.value}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800 uppercase",placeholder:"00000"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Estado CRO"}),s.jsxs("select",{value:p.cro_uf,onChange:m=>b({...p,cro_uf:m.target.value}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-6 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800",children:[s.jsx("option",{children:"MS"}),s.jsx("option",{children:"SP"}),s.jsx("option",{children:"RJ"}),s.jsx("option",{children:"MG"}),s.jsx("option",{children:"PR"}),s.jsx("option",{children:"SC"})]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Especialidade Principal"}),s.jsxs("div",{className:"relative group",children:[s.jsx(ua,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:20}),s.jsx("input",{required:!0,value:p.especialidade,onChange:m=>b({...p,especialidade:m.target.value.toUpperCase()}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800 uppercase",placeholder:"EX: ORTODONTIA"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"WhatsApp de Contato"}),s.jsxs("div",{className:"relative group",children:[s.jsx(qN,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:20}),s.jsx("input",{required:!0,value:p.celular,onChange:m=>b({...p,celular:m.target.value}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800 uppercase",placeholder:"(00) 00000-0000"})]})]})]}),s.jsxs("div",{className:"flex gap-4 pt-4",children:[s.jsx("button",{type:"button",onClick:()=>e(1),className:"flex-1 bg-gray-100 text-gray-600 py-5 rounded-2xl font-black uppercase tracking-widest hover:bg-gray-200 transition-all font-bold",children:"Voltar"}),s.jsx("button",{type:"submit",disabled:n,className:"flex-[2] bg-blue-600 text-white py-5 rounded-2xl font-black uppercase tracking-widest hover:bg-blue-700 shadow-xl shadow-blue-200 transition-all flex items-center justify-center gap-3 disabled:opacity-50",children:n?s.jsx(Ct,{className:"animate-spin"}):s.jsxs(s.Fragment,{children:["Finalizar e Entrar ",s.jsx(Ls,{size:20})]})})]})]})}),t===3&&s.jsxs("div",{className:"p-16 text-center animate-in zoom-in duration-500",children:[s.jsx("div",{className:"w-24 h-24 bg-green-50 text-green-500 rounded-[2rem] flex items-center justify-center mx-auto mb-8 shadow-inner ring-1 ring-green-100",children:s.jsx(Sr,{size:48})}),s.jsx("h2",{className:"text-3xl font-black text-gray-900 uppercase tracking-tight mb-4",children:"Tudo Pronto!"}),s.jsxs("p",{className:"text-gray-500 font-medium mb-10",children:["Seu perfil foi criado e você já está vinculado à unidade ",s.jsx("br",{})," ",s.jsx("span",{className:"text-blue-600 font-bold",children:d}),"."]}),s.jsx("button",{onClick:()=>{history.pushState({},"","/login"),window.location.reload()},className:"w-full bg-gray-900 text-white py-5 rounded-2xl font-black uppercase tracking-widest hover:bg-blue-600 shadow-2xl transition-all",children:"Ir para o Login"})]})]}),s.jsxs("div",{className:"mt-8 flex items-center justify-center gap-2 text-gray-400 text-[10px] font-black uppercase tracking-widest",children:[s.jsx(Sr,{size:14})," Ambiente Seguro e Auditorado por Administradores"]})]})})},Mu=({title:t,buttonLabel:e,onButtonClick:n,children:r})=>s.jsxs("div",{className:"space-y-6",children:[s.jsx(cn,{title:t,children:s.jsxs("button",{onClick:n,className:"bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 hover:bg-blue-700 font-bold text-xs uppercase transition-colors shadow-sm",children:[s.jsx(ft,{size:18})," ",e]})}),r]}),iB=({dentist:t,clinicaId:e,onClose:n})=>{const{data:r,refresh:i}=_e(()=>J.getHorariosByDentista(t.id,e)),c=Fe(),d=["DOMINGO","SEGUNDA","TERÇA","QUARTA","QUINTA","SEXTA","SÁBADO"],f=async h=>{h.preventDefault();const p=new FormData(h.target);await J.saveHorario({dentista_id:t.id,clinica_id:e,dia_semana:parseInt(p.get("dia")),hora_inicio:p.get("inicio"),hora_fim:p.get("fim"),ativo:!0}),c.success("HORÁRIO ADICIONADO!"),i()};return s.jsx("div",{className:"fixed inset-0 bg-black/60 z-[60] flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",children:[s.jsxs("div",{className:"px-6 py-4 border-b border-gray-100 flex justify-between items-center bg-gray-50",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-black text-gray-900 uppercase leading-tight",children:"ESCALA DE ATENDIMENTO"}),s.jsx("p",{className:"text-[10px] text-blue-600 font-bold uppercase",children:t.nome})]}),s.jsx("button",{onClick:n,className:"p-2 hover:bg-gray-200 rounded-xl transition-colors",children:s.jsx(Qe,{size:20})})]}),s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsxs("form",{onSubmit:f,className:"grid grid-cols-1 md:grid-cols-4 gap-3 bg-blue-50/50 p-4 rounded-xl border border-blue-100",children:[s.jsx("select",{name:"dia",className:"bg-white border-blue-200 border rounded-lg p-2 text-xs font-bold uppercase",required:!0,children:d.map((h,p)=>s.jsx("option",{value:p,children:h},p))}),s.jsx("input",{name:"inicio",type:"time",className:"bg-white border-blue-200 border rounded-lg p-2 text-xs font-bold",required:!0}),s.jsx("input",{name:"fim",type:"time",className:"bg-white border-blue-200 border rounded-lg p-2 text-xs font-bold",required:!0}),s.jsxs("button",{type:"submit",className:"bg-blue-600 text-white rounded-lg font-black text-[10px] uppercase hover:bg-blue-700 transition-all flex items-center justify-center gap-2",children:[s.jsx(ft,{size:14})," ADICIONAR"]})]}),s.jsx("div",{className:"space-y-2 flex-1 overflow-y-auto pr-2",children:r==null?void 0:r.map(h=>s.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-xl border border-gray-100 hover:border-blue-200 transition-all group",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-10 h-10 bg-white rounded-lg flex items-center justify-center shadow-sm text-blue-600 border border-gray-100 font-black text-[10px]",children:d[h.dia_semana].substring(0,3)}),s.jsxs("div",{className:"flex items-center gap-2 text-xs font-black text-gray-700",children:[s.jsx(Fl,{size:14,className:"text-gray-400"}),s.jsx("span",{children:h.hora_inicio.substring(0,5)}),s.jsx(Ls,{size:12,className:"text-gray-300"}),s.jsx("span",{children:h.hora_fim.substring(0,5)})]})]}),s.jsx("button",{onClick:async()=>{await J.deleteHorario(h.id),i(),c.success("REMOVIDO!")},className:"p-2 text-gray-300 hover:text-red-500 hover:bg-red-50 rounded-lg transition-all opacity-0 group-hover:opacity-100",children:s.jsx($t,{size:16})})]},h.id))})]})]})})},oB=()=>{const t=J.getActiveWorkspace(),{data:e,isLoading:n,error:r,refresh:i}=_e(()=>J.getDentistas(t==null?void 0:t.id)),[c,d]=w.useState(!1),[f,h]=w.useState(null),[p,b]=w.useState(!1),[y,m]=w.useState(null),[v,N]=w.useState([]),S=Fe(),j=async()=>{try{const B=await(await fetch("/api/auth/google/status")).json();N(B)}catch(_){console.error("Erro ao buscar status do Google:",_)}};w.useEffect(()=>{j()},[]),w.useEffect(()=>{if(!c)return;const _=B=>{B.key==="Escape"&&d(!1)};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[c]);const R=async _=>{_.preventDefault();const B=new FormData(_.target),F=Object.fromEntries(B);try{f&&f.id?(await J.updateDentista({...f,...F}),S.success("DENTISTA ATUALIZADO!")):(await J.saveDentista({...F,ativo:!0}),S.success("DENTISTA CADASTRADO!")),d(!1),i()}catch{S.error("ERRO AO SALVAR DENTISTA.")}},C=async _=>{window.confirm("TEM CERTEZA QUE DESEJA EXCLUIR ESTE DENTISTA?")&&(await J.deleteDentista(_),S.success("Dentista excluído."),i())},[O,A]=w.useState(null),k=async _=>{try{const B=J.getActiveWorkspace(),F=await fetch("/api/dentistas/magic-link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clinicaId:B.id,dentistName:_.nome})}),{link:G}=await F.json();await navigator.clipboard.writeText(G),A(_.id),S.success("LINK MÁGICO COPIADO!"),setTimeout(()=>A(null),2e3)}catch{S.error("ERRO AO GERAR LINK.")}};return s.jsxs(Mu,{title:"DENTISTAS & ESPECIALISTAS",buttonLabel:"NOVO DENTISTA",onButtonClick:()=>{h({}),d(!0)},children:[n&&s.jsx(Ct,{className:"animate-spin text-blue-500"}),r&&s.jsxs("p",{className:"text-red-500",children:["Erro: ",r.message]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e==null?void 0:e.map(_=>s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm hover:shadow-md transition-shadow flex flex-col",children:[s.jsxs("div",{className:"p-5 flex-grow",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-gray-900 uppercase",children:_.nome}),s.jsx("span",{className:"text-xs font-bold text-blue-600 bg-blue-50 px-2 py-0.5 rounded-full uppercase",children:_.especialidade})]}),s.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow",style:{backgroundColor:_.corAgenda}})]}),s.jsxs("div",{className:"mt-4 space-y-2 text-xs text-gray-500",children:[s.jsxs("p",{className:"flex items-center gap-2 font-medium",children:[s.jsx(Rg,{size:14})," ",_.email]}),s.jsxs("p",{className:"flex items-center gap-2 font-medium",children:[s.jsx(qN,{size:14})," ",_.telefone]})]}),s.jsxs("div",{className:"mt-5 border-t border-gray-50 pt-4 flex items-center gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx(du,{ownerId:_.id,isConnected:v.some(B=>B.owner_id===_.id),onStatusChange:j})}),s.jsx("button",{onClick:()=>k(_),title:"COMPARTILHAR LINK DE CADASTRO",className:`p-2.5 rounded-xl border transition-all ${O===_.id?"bg-green-50 text-green-600 border-green-200":"bg-gray-50 text-gray-400 border-gray-100 hover:bg-blue-50 hover:text-blue-600 hover:border-blue-100"}`,children:O===_.id?s.jsx(fo,{size:18}):s.jsx($N,{size:18})})]})]}),s.jsxs("div",{className:"border-t border-gray-100 p-2 grid grid-cols-3 gap-1",children:[s.jsxs("button",{onClick:()=>{h(_),d(!0)},className:"text-[10px] uppercase font-bold text-gray-600 hover:bg-gray-100 py-2 rounded-md flex items-center justify-center gap-1",children:[s.jsx(Lo,{size:12})," EDITAR"]}),s.jsxs("button",{onClick:()=>{m(_),b(!0)},className:"text-[10px] uppercase font-bold text-blue-600 hover:bg-blue-50 py-2 rounded-md flex items-center justify-center gap-1",children:[s.jsx(Fl,{size:12})," ESCALA"]}),s.jsxs("button",{onClick:()=>C(_.id),className:"text-[10px] uppercase font-bold text-red-500 hover:bg-red-50 py-2 rounded-md flex items-center justify-center gap-1",children:[s.jsx($t,{size:12})," EXCLUIR"]})]})]},_.id))}),c&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-blue-50 to-white",children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-800 uppercase",children:[f!=null&&f.id?"EDITAR":"NOVO"," DENTISTA"]}),s.jsx("button",{onClick:()=>d(!1),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:R,className:"space-y-4 max-w-2xl mx-auto",children:[s.jsx("input",{id:"dentista-nome",type:"text",name:"nome",placeholder:"NOME COMPLETO",defaultValue:f==null?void 0:f.nome,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input",required:!0}),s.jsx("input",{id:"dentista-email",type:"email",name:"email",placeholder:"EMAIL",defaultValue:f==null?void 0:f.email,className:"w-full border border-gray-300 rounded-lg p-2",required:!0}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx("input",{id:"dentista-telefone",type:"text",name:"telefone",placeholder:"TELEFONE",defaultValue:f==null?void 0:f.telefone,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input"}),s.jsx("input",{id:"dentista-celular",type:"text",name:"celular",placeholder:"WHATSAPP / CELULAR",defaultValue:f==null?void 0:f.celular,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx("input",{id:"dentista-cro",type:"text",name:"cro",placeholder:"NÚMERO CRO",defaultValue:f==null?void 0:f.cro,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input"}),s.jsxs("select",{id:"dentista-cro-uf",name:"cro_uf",defaultValue:(f==null?void 0:f.cro_uf)||"MS",className:"w-full border border-gray-300 rounded-lg p-2",children:[s.jsx("option",{value:"MS",children:"MS"}),s.jsx("option",{value:"SP",children:"SP"}),s.jsx("option",{value:"RJ",children:"RJ"}),s.jsx("option",{value:"MG",children:"MG"}),s.jsx("option",{value:"PR",children:"PR"}),s.jsx("option",{value:"SC",children:"SC"})]})]}),s.jsx("input",{id:"dentista-especialidade",type:"text",name:"especialidade",placeholder:"ESPECIALIDADE PRINCIPAL",defaultValue:f==null?void 0:f.especialidade,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input",required:!0}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"dentista-cor",className:"text-xs font-bold text-gray-500 uppercase",children:"COR NA AGENDA"}),s.jsx("input",{id:"dentista-cor",type:"color",name:"corAgenda",defaultValue:(f==null?void 0:f.corAgenda)||"#3B82F6",className:"w-full h-10 border border-gray-300 rounded-lg p-1"})]}),s.jsx("button",{type:"submit",className:"w-full bg-green-600 text-white py-2 rounded-lg font-bold hover:bg-green-700 uppercase",children:"SALVAR"})]})})]})}),p&&y&&t&&s.jsx(iB,{dentist:y,clinicaId:t.id,onClose:()=>{b(!1),m(null)}})]})},cB=()=>{const{data:t,isLoading:e,error:n,refresh:r}=_e(J.getEspecialidades),[i,c]=w.useState(!1),[d,f]=w.useState(null),h=Fe();w.useEffect(()=>{if(!i)return;const m=v=>{v.key==="Escape"&&c(!1)};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[i]);const p=async m=>{m.preventDefault();const v=new FormData(m.target),N=Object.fromEntries(v);try{d&&d.id?(await J.updateEspecialidade({...d,...N}),h.success("ESPECIALIDADE ATUALIZADA!")):(await J.saveEspecialidade(N),h.success("ESPECIALIDADE SALVA!")),c(!1),r()}catch{h.error("ERRO AO SALVAR ESPECIALIDADE.")}},b=async m=>{window.confirm("TEM CERTEZA QUE DESEJA EXCLUIR ESTA ESPECIALIDADE?")&&(await J.deleteEspecialidade(m),h.success("Especialidade excluída."),r())},y=async m=>{if(!m.destination||!t)return;const v=Array.from(t),[N]=v.splice(m.source.index,1);v.splice(m.destination.index,0,N);const S=v.map((j,R)=>({id:j.id,ordem:R}));try{await J.reorderEspecialidades(S),h.success("ORDEM ATUALIZADA!"),r()}catch{h.error("ERRO AO REORDENAR.")}};return s.jsxs(Mu,{title:"ESPECIALIDADES CLÍNICAS",buttonLabel:"NOVA ESPECIALIDADE",onButtonClick:()=>{f({}),c(!0)},children:[s.jsx("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-gray-50 text-gray-500 uppercase text-xs font-bold",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-6 py-3 text-left w-10"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"NOME"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"DESCRIÇÃO"}),s.jsx("th",{className:"px-6 py-3 text-right",children:"AÇÕES"})]})}),s.jsx(Xl,{onDragEnd:y,children:s.jsx(Kl,{droppableId:"especialidades",children:m=>s.jsxs("tbody",{...m.droppableProps,ref:m.innerRef,className:"divide-y divide-gray-100",children:[e&&s.jsx("tr",{children:s.jsx("td",{colSpan:4,className:"p-6 text-center",children:s.jsx(Ct,{className:"animate-spin text-blue-500 mx-auto"})})}),n&&s.jsx("tr",{children:s.jsx("td",{colSpan:4,className:"p-6 text-center text-red-500",children:n.message})}),t==null?void 0:t.map((v,N)=>s.jsx(Zl,{draggableId:v.id,index:N,children:(S,j)=>s.jsxs("tr",{ref:S.innerRef,...S.draggableProps,className:`${j.isDragging?"bg-blue-50 shadow-md ring-1 ring-blue-200":"bg-white"} transition-shadow`,children:[s.jsx("td",{className:"px-6 py-4 text-gray-400 cursor-grab active:cursor-grabbing",...S.dragHandleProps,children:s.jsx(ql,{size:18})}),s.jsx("td",{className:"px-6 py-4 font-bold text-gray-800",children:v.nome}),s.jsx("td",{className:"px-6 py-4 text-gray-600",children:v.descricao}),s.jsx("td",{className:"px-6 py-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:()=>{f(v),c(!0)},className:"p-2 text-gray-500 hover:bg-gray-100 rounded-md",children:s.jsx(Lo,{size:16})}),s.jsx("button",{onClick:()=>b(v.id),className:"p-2 text-gray-500 hover:bg-red-50 hover:text-red-600 rounded-md",children:s.jsx($t,{size:16})})]})})]})},v.id)),m.placeholder]})})})]})}),i&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-blue-50 to-white",children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-800 uppercase",children:[d!=null&&d.id?"EDITAR":"NOVA"," ESPECIALIDADE"]}),s.jsx("button",{onClick:()=>c(!1),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:p,className:"space-y-4 max-w-2xl mx-auto",children:[s.jsx("input",{id:"esp-nome",name:"nome",placeholder:"NOME DA ESPECIALIDADE",defaultValue:d==null?void 0:d.nome,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input",required:!0}),s.jsx("textarea",{id:"esp-desc",name:"descricao",placeholder:"BREVE DESCRIÇÃO",defaultValue:d==null?void 0:d.descricao,className:"w-full border border-gray-300 rounded-lg p-2 h-24 uppercase-textarea"}),s.jsx("button",{type:"submit",className:"w-full bg-green-600 text-white py-2 rounded-lg font-bold hover:bg-green-700 uppercase",children:"SALVAR"})]})})]})})]})},dB=()=>{const{data:t,isLoading:e,error:n,refresh:r}=_e(J.getProcedimentos),{data:i}=_e(J.getEspecialidades),{data:c}=_e(J.getPlanos),[d,f]=w.useState(!1),[h,p]=w.useState(null),[b,y]=w.useState([]),m=Fe();w.useEffect(()=>{if(!d)return;const A=k=>{k.key==="Escape"&&f(!1)};return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A)}},[d]),w.useEffect(()=>{h&&(y(h.valoresPlanos||[]),!h.id&&!h.categoria&&p(A=>({...A,categoria:"Particular"})))},[h]);const v=()=>{const A=((t==null?void 0:t.length)||0)+1;p(k=>({...k,codigoInterno:A.toString()}))},N=async A=>{A.preventDefault();const k=new FormData(A.target),_=Object.fromEntries(k.entries()),B=i==null?void 0:i.find(G=>G.id===_.especialidadeId),F={id:h==null?void 0:h.id,nome:_.nome,codigo:_.codigo,codigoInterno:_.codigoInterno,categoria:_.categoria,descricao:_.descricao,especialidadeId:_.especialidadeId,especialidadeNome:(B==null?void 0:B.nome)||"",valorParticular:parseFloat(_.valorParticular),tipo_regiao:(h==null?void 0:h.tipo_regiao)||"GERAL",exige_face:(h==null?void 0:h.tipo_regiao)==="DENTE"?!!(h!=null&&h.exige_face):!1,valoresPlanos:b.map(G=>{var ee;return{planoId:G.planoId,planoNome:((ee=c==null?void 0:c.find(ne=>ne.id===G.planoId))==null?void 0:ee.nome)||"",valor:parseFloat(G.valor),codigoPlano:G.codigoPlano||""}})};try{F.id?(await J.updateProcedimento(F),m.success("PROCEDIMENTO ATUALIZADO!")):(await J.saveProcedimento(F),m.success("PROCEDIMENTO SALVO!")),f(!1),r()}catch{m.error("ERRO AO SALVAR PROCEDIMENTO.")}},S=async A=>{window.confirm("TEM CERTEZA QUE DESEJA EXCLUIR ESTE PROCEDIMENTO?")&&(await J.deleteProcedimento(A),m.success("Procedimento excluído."),r())},j=()=>y(A=>[...A,{planoId:"",valor:0,codigoPlano:""}]),R=A=>y(k=>k.filter((_,B)=>B!==A)),C=(A,k,_)=>{const B=[...b];B[A]={...B[A],[k]:_},y(B)},O=async A=>{if(!A.destination||!t)return;const k=Array.from(t),[_]=k.splice(A.source.index,1);k.splice(A.destination.index,0,_);const B=k.map((F,G)=>({id:F.id,ordem:G}));try{await J.reorderProcedimentos(B),m.success("ORDEM DOS PROCEDIMENTOS ATUALIZADA!"),r()}catch{m.error("ERRO AO REORDENAR PROCEDIMENTOS.")}};return s.jsxs(Mu,{title:"PROCEDIMENTOS E VALORES",buttonLabel:"NOVO PROCEDIMENTO",onButtonClick:()=>{p({}),f(!0)},children:[s.jsx("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-gray-50 text-gray-500 uppercase text-xs font-bold",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-6 py-3 text-left w-10"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"NOME"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"CÓDIGO (TUSS/INT)"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"CATEGORIA"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"ESPECIALIDADE"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"VALOR PARTICULAR"}),s.jsx("th",{className:"px-6 py-3 text-right",children:"AÇÕES"})]})}),s.jsx(Xl,{onDragEnd:O,children:s.jsx(Kl,{droppableId:"procedimentos",children:A=>s.jsxs("tbody",{...A.droppableProps,ref:A.innerRef,className:"divide-y divide-gray-100",children:[e&&s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"p-6 text-center",children:s.jsx(Ct,{className:"animate-spin text-blue-500 mx-auto"})})}),n&&s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"p-6 text-center text-red-500",children:n.message})}),t==null?void 0:t.map((k,_)=>s.jsx(Zl,{draggableId:k.id,index:_,children:(B,F)=>s.jsxs("tr",{ref:B.innerRef,...B.draggableProps,className:`${F.isDragging?"bg-blue-50 shadow-md ring-1 ring-blue-200":"bg-white"} transition-shadow`,children:[s.jsx("td",{className:"px-6 py-4 text-gray-400 cursor-grab active:cursor-grabbing",...B.dragHandleProps,children:s.jsx(ql,{size:18})}),s.jsx("td",{className:"px-6 py-4 font-bold text-gray-800",children:k.nome}),s.jsx("td",{className:"px-6 py-4",children:s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:["TUSS: ",k.codigo||"---"]}),s.jsxs("span",{className:"text-[10px] font-bold text-blue-600 uppercase bg-blue-50 px-1.5 py-0.5 rounded w-fit",children:["INT: ",k.codigoInterno||"---"]})]})}),s.jsx("td",{className:"px-6 py-4",children:s.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded-full bg-gray-100 text-gray-600 uppercase",children:k.categoria})}),s.jsx("td",{className:"px-6 py-4 text-gray-600",children:k.especialidadeNome}),s.jsxs("td",{className:"px-6 py-4 font-semibold text-gray-700",children:["R$ ",Number(k.valorParticular).toFixed(2)]}),s.jsx("td",{className:"px-6 py-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:()=>{p(k),f(!0)},className:"p-2 text-gray-500 hover:bg-gray-100 rounded-md",children:s.jsx(Lo,{size:16})}),s.jsx("button",{onClick:()=>S(k.id),className:"p-2 text-gray-500 hover:bg-red-50 hover:text-red-600 rounded-md",children:s.jsx($t,{size:16})})]})})]})},k.id)),A.placeholder]})})})]})}),d&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-blue-50 to-white",children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-800 uppercase",children:[h!=null&&h.id?"EDITAR":"NOVO"," PROCEDIMENTO"]}),s.jsx("button",{onClick:()=>f(!1),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:N,className:"space-y-4 max-w-2xl mx-auto pb-4",children:[s.jsx("input",{name:"nome",placeholder:"NOME DO PROCEDIMENTO",defaultValue:h==null?void 0:h.nome,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input",required:!0}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"CATEGORIA"}),s.jsxs("select",{name:"categoria",value:(h==null?void 0:h.categoria)||"Particular",onChange:A=>{const k=A.target.value;p(_=>({..._,categoria:k})),k==="Particular"&&!(h!=null&&h.codigoInterno)&&v()},className:"w-full border border-gray-300 rounded-lg p-2 bg-white uppercase-select",required:!0,children:[s.jsx("option",{value:"Particular",children:"Particular"}),s.jsx("option",{value:"Plano",children:"Plano"}),s.jsx("option",{value:"Convênio",children:"Convênio"}),s.jsx("option",{value:"Outros",children:"Outros"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"CÓDIGO TUSS"}),s.jsx("input",{name:"codigo",placeholder:(h==null?void 0:h.categoria)==="Plano"?"00000000":"OPCIONAL",defaultValue:h==null?void 0:h.codigo,className:`w-full border border-gray-300 rounded-lg p-2 uppercase-input ${(h==null?void 0:h.categoria)!=="Plano"?"bg-gray-50":""}`,required:(h==null?void 0:h.categoria)==="Plano"})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"text-xs font-bold text-gray-500 uppercase flex justify-between",children:["CÓDIGO INTERNO",(h==null?void 0:h.categoria)!=="Particular"&&s.jsx("button",{type:"button",onClick:v,className:"text-blue-600 hover:text-blue-800",children:s.jsx(xu,{size:12})})]}),s.jsx("input",{name:"codigoInterno",placeholder:(h==null?void 0:h.categoria)==="Particular"?"AUTO (CONTAGEM + 1)":"EX: 101",value:(h==null?void 0:h.codigoInterno)||"",onChange:A=>p(k=>({...k,codigoInterno:A.target.value})),className:`w-full border border-gray-300 rounded-lg p-2 uppercase-input ${(h==null?void 0:h.categoria)==="Particular"?"bg-gray-50 text-blue-600 font-bold":""}`,required:(h==null?void 0:h.categoria)!=="Particular"})]})]}),s.jsx("textarea",{name:"descricao",placeholder:"BREVE DESCRIÇÃO",defaultValue:h==null?void 0:h.descricao,className:"w-full border border-gray-300 rounded-lg p-2 h-20 uppercase-textarea"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"ESPECIALIDADE"}),s.jsxs("select",{name:"especialidadeId",defaultValue:h==null?void 0:h.especialidadeId,className:"w-full border border-gray-300 rounded-lg p-2 bg-white uppercase-select",required:!0,children:[s.jsx("option",{value:"",children:"SELECIONE UMA ESPECIALIDADE"}),i==null?void 0:i.map(A=>s.jsx("option",{value:A.id,children:A.nome},A.id))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"VALOR PARTICULAR (R$)"}),s.jsx("input",{type:"number",step:"0.01",name:"valorParticular",placeholder:"0.00",defaultValue:h==null?void 0:h.valorParticular,className:"w-full border border-gray-300 rounded-lg p-2",required:!0})]})]}),s.jsxs("div",{className:"bg-blue-50/50 p-4 rounded-xl border border-blue-100 space-y-4",children:[s.jsxs("h4",{className:"text-[10px] font-black text-blue-600 uppercase tracking-widest flex items-center gap-2",children:[s.jsx(Vl,{size:12})," REGRA DO ODONTOGRAMA (GTO)"]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("label",{className:"text-xs font-bold text-gray-700 uppercase",children:"EXIGÊNCIA DE REGIÃO NO LANÇAMENTO"}),s.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{id:"GERAL",label:"PROCED. GERAL",desc:"SEM ODONTOGRAMA"},{id:"DENTE",label:"DENTE ESPECÍFICO",desc:"LIBERA NÚMEROS"},{id:"ARCO",label:"ARCO COMPLETO",desc:"LIBERA AI / AS"}].map(A=>s.jsxs("label",{className:` - relative flex flex-col p-3 rounded-lg border-2 cursor-pointer transition-all - ${((h==null?void 0:h.tipo_regiao)||"GERAL")===A.id?"border-blue-600 bg-blue-50 ring-2 ring-blue-100":"border-gray-200 bg-white hover:border-gray-300"} - `,children:[s.jsx("input",{type:"radio",name:"tipo_regiao",value:A.id,checked:((h==null?void 0:h.tipo_regiao)||"GERAL")===A.id,onChange:k=>p(_=>({..._,tipo_regiao:k.target.value})),className:"sr-only"}),s.jsx("span",{className:"text-[10px] font-black uppercase text-gray-900 leading-tight",children:A.label}),s.jsx("span",{className:"text-[9px] font-bold text-gray-400 mt-1 uppercase",children:A.desc})]},A.id))})]}),(h==null?void 0:h.tipo_regiao)==="DENTE"&&s.jsx("div",{className:"pt-2 animate-in slide-in-from-top-2 duration-200",children:s.jsxs("label",{className:"flex items-center gap-3 p-3 bg-white rounded-lg border border-blue-200 cursor-pointer hover:bg-blue-50/50 transition-colors",children:[s.jsx("div",{className:"relative flex items-center",children:s.jsx("input",{type:"checkbox",name:"exige_face",checked:!!(h!=null&&h.exige_face),onChange:A=>p(k=>({...k,exige_face:A.target.checked})),className:"w-5 h-5 rounded border-gray-300 text-blue-600 focus:ring-blue-500"})}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-[11px] font-black text-gray-800 uppercase",children:"Exigir preenchimento de Face?"}),s.jsx("span",{className:"text-[9px] font-bold text-gray-400 uppercase",children:"(O, M, D, V, L, P) será obrigatório na GTO"})]})]})})]}),s.jsxs("div",{className:"pt-4",children:[s.jsx("h4",{className:"font-bold text-gray-700 uppercase mb-2",children:"VALORES PARA PLANOS / CONVÊNIOS"}),s.jsx("div",{className:"space-y-2",children:b.map((A,k)=>s.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-2 bg-gray-50 p-2 rounded-lg border",children:[s.jsxs("select",{value:A.planoId,onChange:_=>C(k,"planoId",_.target.value),className:"flex-1 border border-gray-300 rounded-lg p-2 bg-white uppercase-select",children:[s.jsx("option",{value:"",children:"SELECIONE UM PLANO"}),c==null?void 0:c.filter(_=>_.tipo!=="Particular").map(_=>s.jsx("option",{value:_.id,children:_.nome},_.id))]}),s.jsx("input",{type:"number",step:"0.01",placeholder:"VALOR (R$)",value:A.valor,onChange:_=>C(k,"valor",_.target.value),className:"w-32 border border-gray-300 rounded-lg p-2"}),s.jsx("input",{type:"text",placeholder:"CÓD. PLANO",value:A.codigoPlano,onChange:_=>C(k,"codigoPlano",_.target.value),className:"w-32 border border-gray-300 rounded-lg p-2 uppercase-input"}),s.jsx("button",{type:"button",onClick:()=>R(k),className:"p-2 text-red-500 hover:bg-red-100 rounded-md",children:s.jsx($t,{size:16})})]},k))}),s.jsxs("button",{type:"button",onClick:j,className:"mt-2 text-xs font-bold text-blue-600 hover:underline uppercase flex items-center gap-1",children:[s.jsx(ft,{size:14})," ADICIONAR VALOR DE PLANO"]})]}),s.jsx("div",{className:"pt-4 flex-shrink-0",children:s.jsx("button",{type:"submit",className:"w-full bg-green-600 text-white py-4 rounded-xl font-black hover:bg-green-700 uppercase text-xs shadow-lg shadow-green-100 transition-all active:scale-[0.98]",children:"SALVAR PROCEDIMENTO"})})]})})]})})]})},uB=()=>{const{data:t,isLoading:e,error:n,refresh:r}=_e(J.getPlanos),[i,c]=w.useState(!1),[d,f]=w.useState(null),h=Fe();w.useEffect(()=>{if(!i)return;const y=m=>{m.key==="Escape"&&c(!1)};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[i]);const p=async y=>{y.preventDefault();const m=new FormData(y.target),v=Object.fromEntries(m);try{d&&d.id?(await J.updatePlano({...d,...v}),h.success("PLANO ATUALIZADO!")):(await J.savePlano(v),h.success("PLANO SALVO!")),c(!1),r()}catch{h.error("ERRO AO SALVAR PLANO.")}},b=async y=>{window.confirm("TEM CERTEZA QUE DESEJA EXCLUIR ESTE PLANO?")&&(await J.deletePlano(y),h.success("Plano excluído."),r())};return s.jsxs(Mu,{title:"PLANOS E CONVÊNIOS",buttonLabel:"NOVO PLANO",onButtonClick:()=>{f({}),c(!0)},children:[e&&s.jsx(Ct,{className:"animate-spin text-blue-500"}),n&&s.jsxs("p",{className:"text-red-500",children:["Erro: ",n.message]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:t==null?void 0:t.map(y=>s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm hover:shadow-md transition-shadow flex flex-col overflow-hidden",style:{borderTop:`4px solid ${y.corCartao}`},children:[s.jsxs("div",{className:"p-5 flex-grow",children:[s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("h3",{className:"font-bold text-gray-900 uppercase",children:y.nome}),s.jsx("span",{className:"text-xs font-bold text-gray-500 bg-gray-100 px-2 py-0.5 rounded-full uppercase",children:y.tipo})]}),s.jsxs("p",{className:"text-sm text-gray-600 mt-2",children:["DESCONTO PADRÃO: ",s.jsxs("span",{className:"font-bold",children:[y.descontoPadrao,"%"]})]})]}),s.jsxs("div",{className:"border-t border-gray-100 p-2 flex gap-2 bg-gray-50/50",children:[s.jsxs("button",{onClick:()=>{f(y),c(!0)},className:"flex-1 text-xs uppercase font-bold text-gray-600 hover:bg-gray-100 py-2 rounded-md flex items-center justify-center gap-2",children:[s.jsx(Lo,{size:14})," EDITAR"]}),s.jsxs("button",{onClick:()=>b(y.id),className:"flex-1 text-xs uppercase font-bold text-red-500 hover:bg-red-50 py-2 rounded-md flex items-center justify-center gap-2",children:[s.jsx($t,{size:14})," EXCLUIR"]})]})]},y.id))}),i&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-blue-50 to-white",children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-800 uppercase",children:[d!=null&&d.id?"EDITAR":"NOVO"," PLANO"]}),s.jsx("button",{onClick:()=>c(!1),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:p,className:"space-y-4 max-w-2xl mx-auto",children:[s.jsx("input",{name:"nome",placeholder:"NOME DO PLANO/CONVÊNIO",defaultValue:d==null?void 0:d.nome,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input",required:!0}),s.jsxs("select",{name:"tipo",defaultValue:(d==null?void 0:d.tipo)||"Convenio",className:"w-full border border-gray-300 rounded-lg p-2 bg-white uppercase-select",required:!0,children:[s.jsx("option",{children:"Convenio"}),s.jsx("option",{children:"Particular"}),s.jsx("option",{children:"Parceria"})]}),s.jsx("input",{type:"number",name:"descontoPadrao",placeholder:"DESCONTO PADRÃO (%)",defaultValue:d==null?void 0:d.descontoPadrao,className:"w-full border border-gray-300 rounded-lg p-2"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"COR DO CARTÃO"}),s.jsx("input",{type:"color",name:"corCartao",defaultValue:(d==null?void 0:d.corCartao)||"#1f2937",className:"w-full h-10 border border-gray-300 rounded-lg p-1"})]}),s.jsx("button",{type:"submit",className:"w-full bg-green-600 text-white py-2 rounded-lg font-bold hover:bg-green-700 uppercase",children:"SALVAR"})]})})]})})]})},fB=["pacientes","agendamentos","financeiro","leads","guias"],hB=()=>{const[t,e]=w.useState([]),[n,r]=w.useState(null),[i,c]=w.useState(null),d=Fe(),f={Authorization:`Bearer ${localStorage.getItem("SCOREODONTO_AUTH_TOKEN")}`,"Content-Type":"application/json"},h=async()=>{try{const y=await fetch("/api/sync/status",{headers:f});y.ok&&c(await y.json())}catch{}};w.useEffect(()=>{h()},[]);const p=async y=>{r(y),e([`>>> ${{push:"BACKUP PostgreSQL → Google Sheets",pull:"RESTAURAR Google Sheets → PostgreSQL","import-legacy":"IMPORTAR PACIENTES (aba PACIENTES-CONSULTT-CLINIC)..."}[y]}...`]);try{const N=await(await fetch(`/api/sync/${y}`,{method:"POST",headers:f})).json();if(e(N.logs||[]),N.success){const S={push:"BACKUP REALIZADO!",pull:"DADOS RESTAURADOS!","import-legacy":`${N.imported??0} PACIENTES IMPORTADOS!`};d.success(S[y]),h()}else d.error("ERRO NA SINCRONIZAÇÃO. VERIFIQUE OS LOGS.")}catch(v){e(N=>[...N,`[ERRO] ${v.message}`]),d.error("FALHA NA CONEXÃO.")}finally{r(null)}},b=y=>y?new Date(y).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"—";return s.jsxs("div",{className:"max-w-5xl mx-auto space-y-6",children:[s.jsx(cn,{title:"BACKUP & SINCRONIZAÇÃO",description:"POSTGRESQL ↔ GOOGLE SHEETS",children:s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("button",{onClick:()=>p("push"),disabled:!!n,className:`px-4 py-2 rounded-xl flex items-center gap-2 text-xs font-black uppercase transition-all shadow-sm ${n?"bg-gray-200 text-gray-400 cursor-not-allowed":"bg-green-600 hover:bg-green-700 text-white shadow-green-100"}`,children:[s.jsx(xu,{size:15,className:n==="push"?"animate-spin":""}),n==="push"?"ENVIANDO...":"BACKUP AGORA"]}),s.jsxs("button",{onClick:()=>p("pull"),disabled:!!n,className:`px-4 py-2 rounded-xl flex items-center gap-2 text-xs font-black uppercase transition-all shadow-sm ${n?"bg-gray-200 text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 text-white shadow-blue-100"}`,children:[s.jsx(Er,{size:15,className:n==="pull"?"animate-spin":""}),n==="pull"?"IMPORTANDO...":"RESTAURAR DO BACKUP"]}),s.jsxs("button",{onClick:()=>p("import-legacy"),disabled:!!n,title:"Importa pacientes da aba PACIENTES-CONSULTT-CLINIC (Apps Script)",className:`px-4 py-2 rounded-xl flex items-center gap-2 text-xs font-black uppercase transition-all shadow-sm ${n?"bg-gray-200 text-gray-400 cursor-not-allowed":"bg-amber-500 hover:bg-amber-600 text-white shadow-amber-100"}`,children:[s.jsx(Er,{size:15,className:n==="import-legacy"?"animate-spin":""}),n==="import-legacy"?"IMPORTANDO...":"IMPORTAR PLANILHA LEGADA"]})]})}),s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-gray-50",children:s.jsx("h3",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"ESTADO DAS TABELAS"})}),s.jsx("div",{className:"divide-y divide-gray-50",children:fB.map(y=>{var N,S;const m=(N=i==null?void 0:i.syncStatus)==null?void 0:N[y],v=(S=i==null?void 0:i.counts)==null?void 0:S[y];return s.jsxs("div",{className:"flex items-center justify-between px-6 py-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:`w-2 h-2 rounded-full ${m!=null&&m.lastPush?"bg-green-400":"bg-gray-200"}`}),s.jsx("span",{className:"text-sm font-black uppercase text-gray-700",children:y})]}),s.jsxs("div",{className:"flex items-center gap-8 text-right",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase",children:"No banco"}),s.jsx("p",{className:"text-sm font-black text-gray-800",children:v??"—"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase",children:"Último backup"}),s.jsx("p",{className:"text-xs font-bold text-gray-600",children:b(m==null?void 0:m.lastPush)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase",children:"Registros no backup"}),s.jsx("p",{className:"text-xs font-bold text-gray-600",children:(m==null?void 0:m.count)??"—"})]})]})]},y)})}),(i==null?void 0:i.spreadsheetId)&&s.jsxs("div",{className:"px-6 py-3 bg-gray-50 border-t border-gray-100 flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"PLANILHA:"}),s.jsx("span",{className:"text-[10px] font-mono text-blue-600 truncate",children:i.spreadsheetId})]})]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsxs("div",{className:"px-6 py-4 border-b border-gray-50 flex items-center justify-between",children:[s.jsx("h3",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"LOG DE OPERAÇÃO"}),t.length>0&&s.jsx("button",{onClick:()=>e([]),className:"text-[10px] font-bold text-gray-400 hover:text-gray-600 uppercase",children:"LIMPAR"})]}),s.jsx("div",{className:"p-4",children:s.jsxs("div",{className:"bg-gray-950 rounded-xl p-4 font-mono text-xs text-green-400 min-h-[160px] max-h-80 overflow-y-auto",children:[t.length===0?s.jsx("span",{className:"text-gray-600",children:"AGUARDANDO OPERAÇÃO..."}):t.map((y,m)=>s.jsx("div",{className:`mb-1 pl-2 border-l-2 ${y.startsWith("[ERRO]")?"border-red-500 text-red-400":y.startsWith("[✓]")?"border-green-400 text-green-300":"border-gray-700"}`,children:y},m)),n&&s.jsx("div",{className:"animate-pulse text-green-500 mt-1",children:"▋"})]})}),s.jsxs("div",{className:"bg-amber-50 border-t border-amber-100 px-6 py-3 flex items-start gap-3",children:[s.jsx(Er,{size:14,className:"text-amber-600 mt-0.5 flex-shrink-0"}),s.jsx("p",{className:"text-[10px] text-amber-700 font-bold uppercase leading-relaxed",children:'BACKUP AUTOMÁTICO: cada alteração de paciente, agendamento, financeiro ou lead é enviada para a planilha automaticamente (com delay de 5s para agrupar alterações). Use "Restaurar" para recuperar dados da planilha caso o banco seja reiniciado.'})]})]})]})},pB=()=>{const[t,e]=w.useState([]),[n,r]=w.useState(!0),[i,c]=w.useState(""),[d,f]=w.useState("all"),[h,p]=w.useState("all"),b=Fe(),y=async()=>{r(!0);try{const C=await J.getNotifications();e(C.sort((O,A)=>new Date(A.data).getTime()-new Date(O.data).getTime()))}catch{b.error("Erro ao carregar notificações")}finally{r(!1)}};w.useEffect(()=>{y()},[]);const m=async C=>{try{await J.markNotificationRead(C),e(O=>O.map(A=>A.id===C?{...A,lida:!0}:A)),b.success("Notificação marcada como lida")}catch{b.error("Erro ao atualizar notificação")}},v=async()=>{if(t.filter(O=>!O.lida).length!==0)try{await J.markAllNotificationsRead(),e(O=>O.map(A=>({...A,lida:!0}))),b.success("Todas as notificações foram marcadas como lidas")}catch{b.error("Erro ao atualizar notificações")}},N=async C=>{try{await J.deleteNotification(C),e(O=>O.filter(A=>A.id!==C)),b.success("Notificação removida")}catch{b.error("Erro ao excluir notificação")}},S=C=>{switch(C){case"agenda":return s.jsx(Et,{size:20,className:"text-blue-500"});case"financeiro":return s.jsx(Ba,{size:20,className:"text-emerald-500"});case"lead":return s.jsx($l,{size:20,className:"text-amber-500"});case"sistema":return s.jsx(Id,{size:20,className:"text-red-500"});default:return s.jsx(Tg,{size:20,className:"text-gray-500"})}},j=t.filter(C=>{const O=C.titulo.toLowerCase().includes(i.toLowerCase())||C.mensagem.toLowerCase().includes(i.toLowerCase()),A=d==="all"||d==="unread"&&!C.lida||d==="important"&&C.tipo==="sistema",k=h==="all"||C.tipo===h;return O&&A&&k}),R=t.filter(C=>!C.lida).length;return s.jsxs("div",{className:"space-y-6 animate-in fade-in duration-500",children:[s.jsx(cn,{title:"CENTRO DE NOTIFICAÇÕES",children:s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("button",{onClick:v,className:"flex items-center gap-2 px-4 py-2 bg-white border border-slate-200 text-slate-600 hover:text-blue-600 hover:border-blue-200 rounded-xl font-bold text-xs uppercase tracking-wider transition-all shadow-sm",children:[s.jsx(da,{size:16})," Marcar todas como lidas"]}),s.jsxs("button",{onClick:y,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white hover:bg-blue-700 rounded-xl font-bold text-xs uppercase tracking-wider transition-all shadow-md active:scale-95",children:[s.jsx(uo,{size:16})," Atualizar"]})]})}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[{label:"Total",count:t.length,icon:nv,color:"text-slate-600",bg:"bg-slate-100"},{label:"Não Lidas",count:R,icon:uo,color:"text-blue-600",bg:"bg-blue-50"},{label:"Sistema",count:t.filter(C=>C.tipo==="sistema").length,icon:Id,color:"text-red-600",bg:"bg-red-50"},{label:"Financeiro",count:t.filter(C=>C.tipo==="financeiro").length,icon:Ba,color:"text-emerald-600",bg:"bg-emerald-50"}].map((C,O)=>s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-slate-100 shadow-sm flex items-center gap-4 group hover:shadow-md transition-all",children:[s.jsx("div",{className:`p-3 rounded-xl ${C.bg} ${C.color} group-hover:scale-110 transition-transform`,children:s.jsx(C.icon,{size:24})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:C.label}),s.jsx("h4",{className:"text-2xl font-black text-slate-800 tracking-tighter",children:C.count})]})]},O))}),s.jsxs("div",{className:"bg-white rounded-[2.5rem] border border-slate-100 shadow-sm overflow-hidden min-h-[600px] flex flex-col",children:[s.jsxs("div",{className:"p-8 border-b border-slate-50 flex flex-col lg:flex-row lg:items-center justify-between gap-6 bg-slate-50/30",children:[s.jsx("div",{className:"flex p-1.5 bg-slate-100 rounded-2xl w-fit",children:[{id:"all",label:"Todas"},{id:"unread",label:"Não Lidas"},{id:"important",label:"Importantes"}].map(C=>s.jsxs("button",{onClick:()=>f(C.id),className:`px-6 py-2.5 rounded-xl text-xs font-black uppercase tracking-widest transition-all ${d===C.id?"bg-white text-blue-600 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:[C.label,C.id==="unread"&&R>0&&s.jsx("span",{className:"ml-2 bg-blue-600 text-white px-1.5 py-0.5 rounded-md text-[9px]",children:R})]},C.id))}),s.jsxs("div",{className:"flex flex-1 max-w-2xl gap-3",children:[s.jsxs("div",{className:"relative flex-1 group",children:[s.jsx(ha,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400 group-focus-within:text-blue-500 transition-colors",size:18}),s.jsx("input",{type:"text",placeholder:"Pesquisar notificações...",value:i,onChange:C=>c(C.target.value),className:"w-full pl-12 pr-4 py-3.5 bg-white border border-slate-200 rounded-2xl text-sm font-bold uppercase tracking-tight focus:ring-4 focus:ring-blue-50 focus:border-blue-500 outline-none transition-all placeholder:text-slate-300"})]}),s.jsxs("select",{value:h,onChange:C=>p(C.target.value),className:"px-4 py-3.5 bg-white border border-slate-200 rounded-2xl text-xs font-black uppercase tracking-widest focus:ring-4 focus:ring-blue-50 outline-none cursor-pointer",children:[s.jsx("option",{value:"all",children:"Filtro: Todos"}),s.jsx("option",{value:"lead",children:"Novos Leads"}),s.jsx("option",{value:"agenda",children:"Agendamentos"}),s.jsx("option",{value:"financeiro",children:"Financeiro"}),s.jsx("option",{value:"sistema",children:"Alertas de Sistema"})]})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:n?s.jsxs("div",{className:"flex flex-col items-center justify-center h-[400px]",children:[s.jsx("div",{className:"w-12 h-12 border-4 border-blue-100 border-t-blue-600 rounded-full animate-spin mb-4"}),s.jsx("p",{className:"text-slate-400 font-black uppercase tracking-widest text-xs",children:"Carregando Histórico..."})]}):j.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center p-20 text-center",children:[s.jsx("div",{className:"w-32 h-32 bg-slate-50 rounded-[3rem] flex items-center justify-center mb-6",children:s.jsx(nv,{size:48,className:"text-slate-200"})}),s.jsx("h3",{className:"text-xl font-black text-slate-800 uppercase tracking-tighter",children:"Nenhuma notificação encontrada"}),s.jsx("p",{className:"text-slate-400 text-sm mt-2 max-w-sm",children:"Não existem registros que correspondam aos seus filtros ou pesquisa no momento."})]}):s.jsx("div",{className:"divide-y divide-slate-50",children:j.map((C,O)=>s.jsxs("div",{className:`group p-8 transition-all hover:bg-slate-50/50 flex flex-col md:flex-row md:items-center gap-6 relative ${C.lida?"":"bg-blue-50/20"}`,style:{animationDelay:`${O*50}ms`},children:[!C.lida&&s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1.5 bg-blue-600 rounded-r-full shadow-[2px_0_10px_rgba(37,99,235,0.3)]"}),s.jsx("div",{className:`p-4 rounded-[1.5rem] flex-shrink-0 shadow-sm border border-white transition-transform group-hover:scale-110 ${C.tipo==="agenda"?"bg-blue-100/50 text-blue-600":C.tipo==="financeiro"?"bg-emerald-100/50 text-emerald-600":C.tipo==="lead"?"bg-amber-100/50 text-amber-600":"bg-red-100/50 text-red-600"}`,children:S(C.tipo)}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("span",{className:`text-[10px] font-black uppercase tracking-[0.2em] px-3 py-1 rounded-full ${C.tipo==="agenda"?"bg-blue-100 text-blue-600":C.tipo==="financeiro"?"bg-emerald-100 text-emerald-600":C.tipo==="lead"?"bg-amber-100 text-amber-600":"bg-red-100 text-red-600"}`,children:C.tipo}),s.jsxs("span",{className:"text-[11px] font-bold text-slate-300 flex items-center gap-1.5 uppercase tracking-wider",children:[s.jsx(Et,{size:12}),new Date(C.data).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})]}),s.jsxs("span",{className:"text-[11px] font-bold text-slate-300 flex items-center gap-1.5 uppercase tracking-wider",children:[s.jsx(gB,{size:12,className:"ml-2"}),new Date(C.data).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})]})]}),s.jsx("h3",{className:`text-lg font-black tracking-tighter uppercase ${C.lida?"text-slate-600":"text-slate-900"}`,children:C.titulo}),s.jsx("p",{className:"text-slate-500 text-sm leading-relaxed max-w-4xl",children:C.mensagem})]}),s.jsxs("div",{className:"flex items-center gap-3 opacity-0 group-hover:opacity-100 transition-all transform translate-x-4 group-hover:translate-x-0",children:[!C.lida&&s.jsx("button",{onClick:()=>m(C.id),className:"p-3 bg-blue-600 text-white rounded-xl shadow-lg shadow-blue-100 hover:bg-blue-700 hover:-translate-y-1 transition-all",title:"Marcar como lida",children:s.jsx(da,{size:20})}),s.jsx("button",{onClick:()=>N(C.id),className:"p-3 bg-white text-slate-400 border border-slate-100 rounded-xl shadow-sm hover:text-red-600 hover:border-red-100 hover:-translate-y-1 transition-all",title:"Excluir",children:s.jsx($t,{size:20})}),s.jsx("button",{className:"p-3 bg-white text-slate-400 border border-slate-100 rounded-xl shadow-sm hover:text-slate-600 hover:-translate-y-1 transition-all",children:s.jsx(tD,{size:20})})]})]},C.id))})}),s.jsxs("div",{className:"p-6 bg-slate-50 border-t border-slate-100 flex items-center justify-between",children:[s.jsxs("p",{className:"text-[11px] font-bold text-slate-400 uppercase tracking-widest",children:["Mostrando ",j.length," de ",t.length," registros"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{className:"px-5 py-2 rounded-xl bg-white border border-slate-200 text-[11px] font-black uppercase tracking-wider text-slate-500 hover:bg-slate-50 transition-colors",children:"Voltar"}),s.jsx("button",{className:"px-5 py-2 rounded-xl bg-white border border-slate-200 text-[11px] font-black uppercase tracking-wider text-slate-500 hover:bg-slate-50 transition-colors",children:"Próximo"})]})]})]})]})},gB=({size:t,className:e})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),mB=()=>{var m,v,N;const t=J.getActiveWorkspace(),[e,n]=w.useState(new Date(new Date().getFullYear(),new Date().getMonth(),1).toISOString().split("T")[0]),[r,i]=w.useState(new Date().toISOString().split("T")[0]),{data:c,isLoading:d,refresh:f}=_e(()=>t?J.getProductivityReport(t.id,e,r):Promise.resolve(null),[t==null?void 0:t.id,e,r]),h=((m=c==null?void 0:c.financeiro)==null?void 0:m.receita)||0,p=((v=c==null?void 0:c.financeiro)==null?void 0:v.despesa)||0,b=h-p,y=()=>{if(!c)return;let S=`Dentista,Total,Concluidos,Faltas,Taxa Ocupacao -`;c.producao.forEach(O=>{const A=O.totalAgendamentos>0?(O.concluidos/O.totalAgendamentos*100).toFixed(1):0;S+=`${O.dentista},${O.totalAgendamentos},${O.concluidos},${O.faltas},${A}% -`});const j=new Blob([S],{type:"text/csv"}),R=window.URL.createObjectURL(j),C=document.createElement("a");C.href=R,C.download=`relatorio_producao_${e}_${r}.csv`,C.click()};return s.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500 pb-10",children:[s.jsx(cn,{title:"RELATÓRIOS & PERFORMANCE",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("button",{onClick:()=>window.print(),className:"bg-white border border-gray-200 text-gray-600 p-2 rounded-lg hover:bg-gray-50 flex items-center gap-2 text-xs font-bold transition-all shadow-sm",children:[s.jsx(Va,{size:16})," ",s.jsx("span",{className:"hidden sm:inline",children:"IMPRIMIR"})]}),s.jsxs("button",{onClick:y,className:"bg-white border border-gray-200 text-gray-600 p-2 rounded-lg hover:bg-gray-50 flex items-center gap-2 text-xs font-bold transition-all shadow-sm",children:[s.jsx(Og,{size:16})," ",s.jsx("span",{className:"hidden sm:inline",children:"EXPORTAR"})]})]})}),s.jsxs("div",{className:"bg-white p-6 rounded-2xl shadow-sm border border-gray-100 flex flex-wrap items-end gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest flex items-center gap-2",children:[s.jsx(Et,{size:12})," INÍCIO DO PERÍODO"]}),s.jsx("input",{type:"date",value:e,onChange:S=>n(S.target.value),className:"bg-gray-50 border border-gray-200 rounded-xl px-4 py-2.5 text-sm font-bold text-gray-700 focus:ring-2 focus:ring-blue-100 outline-none transition-all"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest flex items-center gap-2",children:[s.jsx(Et,{size:12})," FIM DO PERÍODO"]}),s.jsx("input",{type:"date",value:r,onChange:S=>i(S.target.value),className:"bg-gray-50 border border-gray-200 rounded-xl px-4 py-2.5 text-sm font-bold text-gray-700 focus:ring-2 focus:ring-blue-100 outline-none transition-all"})]}),s.jsxs("button",{onClick:f,className:"bg-blue-600 text-white px-6 py-3 rounded-xl font-black text-xs uppercase hover:bg-blue-700 transition-all shadow-lg shadow-blue-200 flex items-center gap-2",children:[s.jsx(mu,{size:16})," FILTRAR"]})]}),d?s.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4",children:[s.jsx(Ct,{className:"animate-spin text-blue-600",size:40}),s.jsx("p",{className:"text-xs font-black text-gray-400 uppercase tracking-widest",children:"Processando dados clínicos..."})]}):s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[s.jsxs("div",{className:"bg-white p-6 rounded-2xl border border-gray-100 shadow-sm overflow-hidden relative group",children:[s.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:scale-110 transition-transform",children:s.jsx(Ba,{size:80,className:"text-green-600"})}),s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"RECEITA NO PERÍODO"}),s.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-2xl font-black text-gray-900",children:["R$ ",h.toLocaleString("pt-BR",{minimumFractionDigits:2})]}),s.jsxs("span",{className:"text-green-500 text-[10px] font-black flex items-center",children:[s.jsx(IN,{size:12})," +2.4%"]})]}),s.jsx("div",{className:"mt-4 w-full bg-gray-50 h-1.5 rounded-full overflow-hidden",children:s.jsx("div",{className:"bg-green-500 h-full w-[70%]"})})]}),s.jsxs("div",{className:"bg-white p-6 rounded-2xl border border-gray-100 shadow-sm overflow-hidden relative group",children:[s.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:scale-110 transition-transform",children:s.jsx(YN,{size:80,className:"text-red-600"})}),s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"DESPESA NO PERÍODO"}),s.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-2xl font-black text-gray-900",children:["R$ ",p.toLocaleString("pt-BR",{minimumFractionDigits:2})]}),s.jsxs("span",{className:"text-red-500 text-[10px] font-black flex items-center",children:[s.jsx(_N,{size:12})," -1.2%"]})]}),s.jsx("div",{className:"mt-4 w-full bg-gray-50 h-1.5 rounded-full overflow-hidden",children:s.jsx("div",{className:"bg-red-500 h-full w-[30%]"})})]}),s.jsxs("div",{className:"bg-white p-6 rounded-2xl border border-gray-100 shadow-sm overflow-hidden relative group",children:[s.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:scale-110 transition-transform",children:s.jsx(Vl,{size:80,className:"text-blue-600"})}),s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"SALDO OPERACIONAL"}),s.jsx("div",{className:"mt-2",children:s.jsxs("span",{className:`text-2xl font-black ${b>=0?"text-blue-600":"text-red-600"}`,children:["R$ ",b.toLocaleString("pt-BR",{minimumFractionDigits:2})]})}),s.jsx("p",{className:"mt-4 text-[10px] font-bold text-gray-400",children:"LIQUIDEZ ATUAL DA UNIDADE"})]}),s.jsxs("div",{className:"bg-white p-6 rounded-2xl border border-gray-100 shadow-sm overflow-hidden relative group",children:[s.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:scale-110 transition-transform",children:s.jsx($n,{size:80,className:"text-purple-600"})}),s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"TRANSAÇÕES"}),s.jsx("div",{className:"mt-2",children:s.jsx("span",{className:"text-2xl font-black text-gray-900",children:((N=c==null?void 0:c.financeiro)==null?void 0:N.totalTransacoes)||0})}),s.jsx("p",{className:"mt-4 text-[10px] font-bold text-gray-400",children:"MOVIMENTAÇÕES FINANCEIRAS"})]})]}),s.jsxs("div",{className:"bg-white rounded-3xl border border-gray-100 shadow-xl overflow-hidden",children:[s.jsxs("div",{className:"px-8 py-6 bg-gradient-to-r from-gray-50 to-white border-b border-gray-100 flex justify-between items-center",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 bg-blue-600 rounded-xl flex items-center justify-center text-white shadow-lg shadow-blue-200",children:s.jsx(ko,{size:20})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-black text-gray-900 uppercase",children:"PRODUTIVIDADE POR DENTISTA"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-widest",children:"DESEMPENHO CLÍNICO NO PERÍODO"})]})]}),s.jsxs("div",{className:"hidden sm:flex items-center gap-2 px-4 py-2 bg-blue-50 rounded-full",children:[s.jsx(RC,{size:16,className:"text-blue-600"}),s.jsx("span",{className:"text-[10px] font-black text-blue-600 uppercase",children:"Visão por Especialista"})]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left",children:[s.jsx("thead",{className:"bg-gray-50/50",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"ESPECIALISTA"}),s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"TOTAL APPTS"}),s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"EFETIVADOS"}),s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"FALTAS"}),s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"TAXA OCUPAÇÃO"}),s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"STATUS"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-100",children:((c==null?void 0:c.producao)||[]).map((S,j)=>{const R=S.totalAgendamentos>0?S.concluidos/S.totalAgendamentos*100:0;return s.jsxs("tr",{className:"hover:bg-blue-50/30 transition-colors group",children:[s.jsx("td",{className:"px-8 py-5",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-100 flex items-center justify-center text-gray-400 font-black text-xs group-hover:bg-blue-600 group-hover:text-white transition-all",children:S.dentista.substring(0,2).toUpperCase()}),s.jsx("span",{className:"font-bold text-gray-900 uppercase text-xs",children:S.dentista})]})}),s.jsx("td",{className:"px-8 py-5 font-bold text-gray-600 text-xs",children:S.totalAgendamentos}),s.jsx("td",{className:"px-8 py-5 font-bold text-green-600 text-xs",children:S.concluidos}),s.jsx("td",{className:"px-8 py-5 font-bold text-red-500 text-xs",children:S.faltas}),s.jsx("td",{className:"px-8 py-5",children:s.jsxs("div",{className:"flex items-center gap-3 min-w-[120px]",children:[s.jsx("div",{className:"flex-1 h-2 bg-gray-100 rounded-full overflow-hidden shadow-inner",children:s.jsx("div",{className:`h-full transition-all duration-1000 ${R>70?"bg-green-500":R>40?"bg-blue-500":"bg-orange-400"}`,style:{width:`${R}%`}})}),s.jsxs("span",{className:"text-[10px] font-black text-gray-400",children:[R.toFixed(0),"%"]})]})}),s.jsx("td",{className:"px-8 py-5",children:R>75?s.jsx("span",{className:"px-2 py-1 bg-green-50 text-green-600 text-[9px] font-black rounded-lg uppercase border border-green-100",children:"Alta Performance"}):R>30?s.jsx("span",{className:"px-2 py-1 bg-blue-50 text-blue-600 text-[9px] font-black rounded-lg uppercase border border-blue-100",children:"Estável"}):s.jsx("span",{className:"px-2 py-1 bg-gray-50 text-gray-400 text-[9px] font-black rounded-lg uppercase border border-gray-100",children:"Baixa Ocupação"})})]},j)})})]})})]})]})]})},xB=()=>{const[t,e]=w.useState([]),[n,r]=w.useState(null),[i,c]=w.useState(""),[d,f]=w.useState(""),[h,p]=w.useState(!1),[b,y]=w.useState(!1),m=J.getCurrentRole(),v=J.getCurrentUserName(),N=J.getCurrentUser(),S=J.getActiveWorkspace(),j=(S==null?void 0:S.cor)||"#2563eb",R=Fe(),C={Authorization:`Bearer ${localStorage.getItem("SCOREODONTO_AUTH_TOKEN")}`,"Content-Type":"application/json"},O=async()=>{try{const B=await fetch("/api/auth/google/status");e(await B.json())}catch{}},A=async()=>{try{const B=await fetch("/api/settings/google-credentials",{headers:C});B.ok&&r(await B.json())}catch{}};w.useEffect(()=>{O(),m==="admin"&&A()},[]);const k=async()=>{if(!i.trim()||!d.trim()){R.error("PREENCHA OS DOIS CAMPOS.");return}y(!0);try{const B=await fetch("/api/settings/google-credentials",{method:"POST",headers:C,body:JSON.stringify({clientId:i.trim(),clientSecret:d.trim()})});if(B.ok)R.success("CREDENCIAIS SALVAS!"),c(""),f(""),await A();else{const F=await B.json();R.error(F.error||"ERRO AO SALVAR.")}}catch{R.error("FALHA NA CONEXÃO.")}finally{y(!1)}},_=()=>{window.confirm("TEM CERTEZA QUE DESEJA SAIR DO SISTEMA?")&&J.logout()};return s.jsxs("div",{className:"space-y-8 max-w-2xl",children:[s.jsxs("div",{className:"flex items-end justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-black text-gray-900 uppercase tracking-tight",children:"Configurações"}),s.jsx("p",{className:"text-sm text-gray-400 font-medium mt-1",children:"Gerencie seu perfil e integrações"})]}),s.jsx("span",{className:"bg-gray-100 text-gray-400 text-[11px] font-mono font-bold px-3 py-1 rounded-full border border-gray-200 mb-1",children:Ag})]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-gray-50",children:s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"Perfil"})}),s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-14 h-14 bg-gray-100 rounded-full flex items-center justify-center text-gray-500 border border-gray-200 flex-shrink-0",children:s.jsx(zo,{size:24})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-base font-black text-gray-800 uppercase truncate leading-none mb-1",children:v||"—"}),s.jsx("p",{className:"text-sm font-medium text-gray-400 truncate",children:N||"—"}),s.jsx("span",{className:"inline-block mt-2 text-[10px] font-black uppercase tracking-widest px-2 py-0.5 rounded-full",style:{backgroundColor:`${j}18`,color:j},children:m})]})]})})]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-gray-50",children:s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"Unidade Ativa"})}),s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center text-white flex-shrink-0",style:{backgroundColor:j},children:s.jsx(Cg,{size:20})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-black text-gray-800 uppercase",children:(S==null?void 0:S.nome)||"Sem unidade vinculada"}),(S==null?void 0:S.id)&&s.jsxs("p",{className:"text-[11px] text-gray-400 font-mono mt-0.5",children:["ID: ",S.id]})]}),s.jsx("div",{className:"ml-auto w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:j}})]})})]}),m==="admin"&&s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-gray-50",children:s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"Integrações Google"})}),s.jsxs("div",{className:"p-6 space-y-4 border-b border-gray-50",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(av,{size:15,className:"text-gray-400"}),s.jsx("span",{className:"text-xs font-black text-gray-700 uppercase tracking-wide",children:"Credenciais OAuth 2.0"})]}),n!=null&&n.configured?s.jsxs("div",{className:"flex items-center gap-1.5 text-green-600 bg-green-50 px-3 py-1 rounded-full border border-green-100",children:[s.jsx(da,{size:12}),s.jsx("span",{className:"text-[10px] font-black uppercase",children:n.fromEnv?"Via ENV":"Configurado"})]}):s.jsxs("div",{className:"flex items-center gap-1.5 text-amber-600 bg-amber-50 px-3 py-1 rounded-full border border-amber-100",children:[s.jsx(gu,{size:12}),s.jsx("span",{className:"text-[10px] font-black uppercase",children:"Não configurado"})]})]}),(n==null?void 0:n.configured)&&n.clientIdHint&&!n.fromEnv&&s.jsxs("div",{className:"bg-gray-50 rounded-xl px-4 py-3 border border-gray-100",children:[s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase mb-1",children:"Client ID atual"}),s.jsx("p",{className:"text-xs font-mono text-gray-600",children:n.clientIdHint})]}),(n==null?void 0:n.fromEnv)&&s.jsx("p",{className:"text-[11px] text-gray-400 font-medium",children:"Credenciais carregadas via variável de ambiente. Para substituir, preencha os campos abaixo."}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1.5",children:"Client ID"}),s.jsx("input",{type:"text",value:i,onChange:B=>c(B.target.value),placeholder:n!=null&&n.configured?"Deixe vazio para manter atual":"xxxxxxxxxxxx.apps.googleusercontent.com",className:"w-full border border-gray-200 rounded-xl px-4 py-2.5 text-sm font-mono focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none transition-all"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1.5",children:"Client Secret"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:h?"text":"password",value:d,onChange:B=>f(B.target.value),placeholder:n!=null&&n.configured?"Deixe vazio para manter atual":"GOCSPX-...",className:"w-full border border-gray-200 rounded-xl px-4 py-2.5 pr-10 text-sm font-mono focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none transition-all"}),s.jsx("button",{type:"button",onClick:()=>p(B=>!B),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:h?s.jsx(aD,{size:15}):s.jsx(rD,{size:15})})]})]}),s.jsxs("button",{onClick:k,disabled:b||!i.trim()&&!d.trim(),className:"w-full flex items-center justify-center gap-2 py-2.5 rounded-xl text-xs font-black uppercase tracking-widest transition-all disabled:opacity-40 disabled:cursor-not-allowed bg-gray-900 text-white hover:bg-gray-700",children:[b?s.jsx(Ct,{size:14,className:"animate-spin"}):s.jsx(av,{size:14}),b?"Salvando...":"Salvar Credenciais"]})]}),s.jsxs("p",{className:"text-[10px] text-gray-400 leading-relaxed",children:["Obtenha as credenciais em"," ",s.jsx("span",{className:"font-mono text-blue-500",children:"console.cloud.google.com"})," ","→ APIs & Services → Credentials → OAuth 2.0 Client ID. Adicione"," ",s.jsx("span",{className:"font-mono text-gray-600",children:"https://scoreodonto.com/api/oauth2callback"})," ","como URI de redirecionamento autorizado."]})]}),s.jsxs("div",{className:"p-6",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest mb-3",children:"Conta conectada"}),s.jsx(du,{ownerId:"admin",isConnected:t.some(B=>B.owner_id==="admin"||B.owner_id===N),onStatusChange:O})]})]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-gray-50",children:s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"Segurança"})}),s.jsxs("div",{className:"p-6 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3 text-green-600 bg-green-50 px-4 py-3 rounded-xl border border-green-100",children:[s.jsx(Sr,{size:16}),s.jsx("span",{className:"text-xs font-bold uppercase tracking-wide",children:"Sessão ativa e autenticada"})]}),s.jsxs("button",{onClick:_,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-red-50 text-red-600 hover:bg-red-100 rounded-xl text-xs font-black uppercase tracking-widest transition-all border border-red-100",children:[s.jsx(BN,{size:16}),"Sair do Sistema"]})]})]})]})},bB=["TODOS","Ativo","Rascunho","Assinado","Encerrado"],yB={Ativo:"bg-green-100 text-green-700",Rascunho:"bg-amber-100 text-amber-700",Assinado:"bg-blue-100 text-blue-700",Encerrado:"bg-gray-100 text-gray-600"},vB=t=>t.toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),NB=()=>{const t=Fe(),{data:e,isLoading:n,refresh:r}=_e(J.getContratos),i=e??[],[c,d]=w.useState(""),[f,h]=w.useState("TODOS"),[p,b]=w.useState(!1),[y,m]=w.useState(null),[v,N]=w.useState(null),S=i.filter(k=>{const _=!c.trim()||k.pacienteNome.toLowerCase().includes(c.toLowerCase())||k.titulo.toLowerCase().includes(c.toLowerCase()),B=f==="TODOS"||k.status===f;return _&&B}),j={total:i.length,ativos:i.filter(k=>k.status==="Ativo").length,rascunhos:i.filter(k=>k.status==="Rascunho").length,encerrados:i.filter(k=>k.status==="Encerrado"||k.status==="Assinado").length},R=async(k,_)=>{if(confirm(`EXCLUIR o contrato de ${_}?`))try{await J.deleteContrato(k),t.success("CONTRATO EXCLUÍDO."),r()}catch{t.error("ERRO AO EXCLUIR CONTRATO.")}},C=()=>{m(null),b(!0)},O=k=>{m(k),b(!0)},A=k=>{N(k),b(!0)};return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsx(cn,{title:"CONTRATOS",description:"Gestão de contratos de serviços odontológicos",children:s.jsxs("button",{onClick:C,className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-colors uppercase font-bold text-sm shadow-sm",children:[s.jsx(ft,{size:18})," NOVO CONTRATO"]})}),s.jsx("div",{className:"grid grid-cols-4 gap-3 mb-4",children:[{label:"Total",value:j.total,color:"bg-indigo-50 text-indigo-700"},{label:"Ativos",value:j.ativos,color:"bg-green-50 text-green-700"},{label:"Rascunhos",value:j.rascunhos,color:"bg-amber-50 text-amber-700"},{label:"Encerrados/Assinados",value:j.encerrados,color:"bg-gray-50 text-gray-600"}].map(k=>s.jsxs("div",{className:`${k.color} rounded-xl p-3 text-center`,children:[s.jsx("p",{className:"text-2xl font-black",children:k.value}),s.jsx("p",{className:"text-[10px] font-bold uppercase opacity-70",children:k.label})]},k.label))}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(ha,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none",size:16}),s.jsx("input",{type:"text",placeholder:"Buscar por paciente ou título...",className:"w-full pl-9 pr-3 py-2 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none bg-white",value:c,onChange:k=>d(k.target.value)})]}),s.jsx("div",{className:"flex items-center gap-1 bg-gray-100 rounded-lg p-1 overflow-x-auto",children:bB.map(k=>s.jsx("button",{onClick:()=>h(k),className:`px-2.5 py-1 rounded-md text-[11px] font-bold transition-all whitespace-nowrap ${f===k?"bg-white text-gray-800 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:k},k))})]}),n&&s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx(Ct,{className:"animate-spin text-indigo-400",size:32})}),!n&&S.length===0&&s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-400 py-20",children:[s.jsx(za,{size:48,className:"mb-4 opacity-30"}),s.jsx("p",{className:"text-sm font-bold uppercase",children:"Nenhum contrato encontrado"}),s.jsx("p",{className:"text-xs mt-1",children:c||f!=="TODOS"?"Tente limpar os filtros.":'Clique em "NOVO CONTRATO" para começar.'}),!c&&f==="TODOS"&&s.jsxs("button",{onClick:C,className:"mt-4 flex items-center gap-2 px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg text-sm font-bold transition-colors",children:[s.jsx(ft,{size:16})," Criar Primeiro Contrato"]})]}),!n&&S.length>0&&s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 overflow-y-auto pb-6",children:S.map(k=>{var _;return s.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-all duration-200 flex flex-col",children:[s.jsxs("div",{className:"p-4 flex-1",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[s.jsx("h3",{className:"font-black text-gray-800 text-sm uppercase leading-tight flex-1",children:k.pacienteNome}),s.jsx("span",{className:`text-[9px] font-black px-2 py-0.5 rounded-full uppercase flex-shrink-0 ${yB[k.status]||"bg-gray-100 text-gray-600"}`,children:k.status})]}),s.jsx("p",{className:"text-[11px] text-gray-500 font-medium uppercase truncate mb-2",children:k.titulo}),s.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[k.especialidadeNome&&s.jsx("span",{className:"bg-indigo-50 text-indigo-600 text-[9px] font-bold px-2 py-0.5 rounded-full uppercase",children:k.especialidadeNome}),k.dentistaNome&&s.jsx("span",{className:"bg-gray-50 text-gray-500 text-[9px] font-bold px-2 py-0.5 rounded-full uppercase",children:k.dentistaNome})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px]",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 font-bold uppercase block",children:"Valor Total"}),s.jsx("span",{className:"font-black text-indigo-700 text-sm",children:vB(k.valorTotal)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 font-bold uppercase block",children:"Itens"}),s.jsxs("span",{className:"font-bold text-gray-700",children:[((_=k.items)==null?void 0:_.length)??0," proc."]})]}),k.dataInicio&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 font-bold uppercase block",children:"Início"}),s.jsx("span",{className:"font-bold text-gray-700",children:new Date(k.dataInicio+"T12:00").toLocaleDateString("pt-BR")})]}),k.dataFim&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 font-bold uppercase block",children:"Fim"}),s.jsx("span",{className:"font-bold text-gray-700",children:new Date(k.dataFim+"T12:00").toLocaleDateString("pt-BR")})]})]})]}),s.jsxs("div",{className:"flex border-t border-gray-100",children:[s.jsxs("button",{onClick:()=>O(k),className:"flex-1 flex items-center justify-center gap-1.5 py-2 text-indigo-600 hover:bg-indigo-50 rounded-bl-xl text-[10px] font-bold transition-colors uppercase",children:[s.jsx(Mo,{size:12})," Editar"]}),s.jsx("div",{className:"border-l border-gray-100"}),s.jsxs("button",{onClick:()=>A(k),className:"flex-1 flex items-center justify-center gap-1.5 py-2 text-gray-600 hover:bg-gray-50 text-[10px] font-bold transition-colors uppercase",children:[s.jsx(Va,{size:12})," Imprimir"]}),s.jsx("div",{className:"border-l border-gray-100"}),s.jsxs("button",{onClick:()=>R(k.id,k.pacienteNome),className:"flex-1 flex items-center justify-center gap-1.5 py-2 text-red-500 hover:bg-red-50 rounded-br-xl text-[10px] font-bold transition-colors uppercase",children:[s.jsx($t,{size:12})," Excluir"]})]})]},k.id)})}),p&&s.jsx(lS,{contrato:y,onClose:()=>{b(!1),m(null),N(null)},onSaved:r})]})},EB={"/":"landing","/dashboard":"dashboard","/landing":"landing","/leads":"leads","/contato":"public","/pacientes":"pacientes","/agenda":"agenda","/ortodontia":"ortodontia","/financeiro":"financeiro","/login":"login","/update":"update","/clinicas":"clinicas","/admin/dentistas":"dentistas","/admin/especialidades":"especialidades","/admin/procedimentos":"procedimentos","/admin/planos":"planos","/admin/sync":"sync","/tratamentos":"tratamentos","/lancar-gto":"lancar-gto","/notificacoes":"notificacoes","/relatorios":"relatorios","/cadastro-dentista":"cadastro-dentista","/configuracoes":"configuracoes","/contratos":"contratos"},SB={landing:"/",dashboard:"/dashboard",leads:"/leads",public:"/contato",pacientes:"/pacientes",agenda:"/agenda",ortodontia:"/ortodontia",financeiro:"/financeiro",login:"/login",update:"/update",clinicas:"/clinicas",dentistas:"/admin/dentistas",especialidades:"/admin/especialidades",procedimentos:"/admin/procedimentos",planos:"/admin/planos",tratamentos:"/tratamentos","lancar-gto":"/lancar-gto",notificacoes:"/notificacoes",relatorios:"/relatorios",sync:"/admin/sync","cadastro-dentista":"/cadastro-dentista",configuracoes:"/configuracoes",contratos:"/contratos"};function bN(){const t=window.location.pathname||"/";return EB[t]??"dashboard"}function no(t){const e=SB[t];history.pushState({},"",e)}const jB=()=>{const[t,e]=w.useState(!1);J.getCurrentRole();const n=J.getActiveWorkspace(),r=(n==null?void 0:n.cor)||"#2563eb",i=(m,v)=>{var S;return["landing","login","public","update"].includes(m)||v==="admin"||v==="donoclinica"?!0:((S={paciente:["tratamentos","notificacoes","configuracoes"],dentista:["dashboard","pacientes","agenda","ortodontia","tratamentos","notificacoes","clinicas","configuracoes","contratos"],funcionario:["dashboard","leads","pacientes","agenda","financeiro","tratamentos","lancar-gto","relatorios","notificacoes","clinicas","configuracoes","contratos"]}[v])==null?void 0:S.includes(m))||!1},c=m=>m==="paciente"?"tratamentos":"dashboard",d=()=>{const m=bN(),v=J.getCurrentRole();return J.isAuthenticated()&&["landing","login"].includes(m)?c(v):!["landing","login","public"].includes(m)&&!J.isAuthenticated()?"landing":J.isAuthenticated()&&!i(m,v)?c(v):m},[f,h]=w.useState(d),p=m=>{const v=J.getCurrentRole();i(m,v)&&(h(m),no(m),e(!1))};w.useEffect(()=>{const m=()=>{const v=bN(),N=J.getCurrentRole();if(!["landing","login","public"].includes(v)&&!J.isAuthenticated()){h("landing"),no("landing");return}if(J.isAuthenticated()&&!i(v,N)){const j=c(N);h(j),no(j);return}h(v)};return window.addEventListener("popstate",m),()=>window.removeEventListener("popstate",m)},[]),w.useEffect(()=>{document.documentElement.style.setProperty("--brand-color",r),document.documentElement.style.setProperty("--brand-color-soft",`${r}11`)},[r]),w.useEffect(()=>{no(f)},[]);const b=()=>{switch(f){case"landing":return s.jsx(aB,{onGetStarted:()=>p("login")});case"dashboard":return s.jsx(GO,{});case"leads":return s.jsx($O,{});case"public":return s.jsx(YO,{});case"pacientes":return s.jsx(BM,{});case"agenda":return s.jsx(DP,{});case"ortodontia":return s.jsx(VP,{});case"financeiro":return s.jsx($P,{});case"dentistas":return s.jsx(oB,{});case"especialidades":return s.jsx(cB,{});case"procedimentos":return s.jsx(dB,{});case"planos":return s.jsx(uB,{});case"sync":return s.jsx(hB,{});case"tratamentos":return s.jsx(tB,{});case"lancar-gto":return s.jsx(vM,{});case"update":return s.jsx(sB,{});case"clinicas":return s.jsx(rB,{});case"notificacoes":return s.jsx(pB,{});case"relatorios":return s.jsx(mB,{});case"cadastro-dentista":return s.jsx(lB,{});case"configuracoes":return s.jsx(xB,{});case"contratos":return s.jsx(NB,{});case"login":default:return s.jsx(nB,{onLoginSuccess:()=>{const m=J.getCurrentRole(),v=c(m);h(v),no(v)}})}},y=["landing","login","public","update","cadastro-dentista"].includes(f);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex h-screen bg-gray-50 text-gray-800 overflow-hidden relative",children:[s.jsx("style",{children:` - :root { --brand-color: ${r}; } - .bg-brand { background-color: var(--brand-color); } - .text-brand { color: var(--brand-color); } - .border-brand { border-color: var(--brand-color); } - .hover\\:bg-brand:hover { background-color: var(--brand-color); } - .focus\\:ring-brand:focus { --tw-ring-color: var(--brand-color); } - `}),!y&&s.jsxs(s.Fragment,{children:[t&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-20 md:hidden backdrop-blur-sm transition-opacity",onClick:()=>e(!1)}),s.jsx("div",{className:`fixed inset-y-0 left-0 z-30 transform transition-transform duration-300 md:relative md:translate-x-0 ${t?"translate-x-0":"-translate-x-full"}`,children:s.jsx(IO,{activeTab:f,setActiveTab:m=>p(m)})})]}),s.jsxs("main",{className:"flex-1 h-full relative flex flex-col min-w-0",children:[!y&&s.jsx(s.Fragment,{children:s.jsxs("div",{className:"md:hidden flex items-center justify-between px-4 py-3 bg-white border-b border-gray-200",children:[s.jsx("button",{onClick:()=>e(!0),className:"p-2 text-gray-600 hover:bg-gray-100 rounded-lg transition-colors",children:s.jsx(VN,{size:24})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 rounded flex items-center justify-center text-white font-bold text-sm shadow-sm",style:{backgroundColor:r},children:"S"}),s.jsx("span",{className:"font-bold text-gray-800 text-sm tracking-tight uppercase",children:"SCOREODONTO"})]}),s.jsx("div",{className:"w-8"})]})}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-8 pb-20 scroll-smooth",children:s.jsx("div",{className:"max-w-7xl mx-auto h-full",children:b()})})]})]}),s.jsx(BO,{})]})};class AB extends Ve.Component{constructor(e){super(e),this.handleReload=()=>{window.location.reload()},this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e,errorInfo:null}}componentDidCatch(e,n){console.error("Uncaught error:",e,n),this.setState({errorInfo:n})}render(){var e;return this.state.hasError?s.jsx("div",{className:"min-h-screen bg-red-50 flex items-center justify-center p-6 font-sans",children:s.jsxs("div",{className:"max-w-3xl w-full bg-white rounded-2xl shadow-2xl overflow-hidden border border-red-100",children:[s.jsxs("div",{className:"bg-red-600 p-6 flex items-center gap-4",children:[s.jsx("div",{className:"bg-white/20 p-3 rounded-full text-white",children:s.jsx(HC,{size:32})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white uppercase",children:"ERRO CRÍTICO NO SISTEMA"}),s.jsx("p",{className:"text-red-100 text-xs font-bold uppercase mt-1",children:"O APLICATIVO ENCONTROU UM PROBLEMA INESPERADO"})]})]}),s.jsxs("div",{className:"p-8",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("p",{className:"text-gray-700 font-bold uppercase mb-2",children:"O QUE ACONTECEU?"}),s.jsx("p",{className:"text-gray-600 text-sm",children:"Ocorreu uma falha durante a renderização da interface. Tente recarregar a página. Se o problema persistir, envie o log abaixo para o suporte técnico."})]}),this.state.error&&s.jsxs("div",{className:"bg-gray-900 rounded-lg p-4 mb-6 overflow-x-auto border-l-4 border-red-500",children:[s.jsxs("div",{className:"flex items-center gap-2 text-red-400 font-bold text-xs uppercase mb-2",children:[s.jsx(kg,{size:14})," Stack Trace / Log Técnico"]}),s.jsxs("pre",{className:"text-green-400 font-mono text-xs leading-relaxed whitespace-pre-wrap break-words",children:[this.state.error.toString(),s.jsx("br",{}),(e=this.state.errorInfo)==null?void 0:e.componentStack]})]}),s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("button",{onClick:this.handleReload,className:"bg-red-600 hover:bg-red-700 text-white px-6 py-3 rounded-lg font-bold uppercase flex items-center gap-2 transition-colors shadow-lg",children:[s.jsx(xu,{size:18})," RECARREGAR SISTEMA"]}),s.jsx("button",{onClick:()=>{localStorage.clear(),window.location.reload()},className:"bg-gray-200 hover:bg-gray-300 text-gray-700 px-6 py-3 rounded-lg font-bold uppercase flex items-center gap-2 transition-colors",children:"LIMPAR CACHE E REINICIAR"})]})]})]})}):this.props.children}}const wB=new bU,yN=document.getElementById("root");if(yN)tC.createRoot(yN).render(s.jsx(Ve.StrictMode,{children:s.jsx(vU,{client:wB,children:s.jsx(AB,{children:s.jsx(zO,{children:s.jsx(jB,{})})})})}));else{console.error("CRITICAL: Root element #root not found. App could not be mounted.");const t=document.getElementById("global-error-display");t&&(t.style.display="block",t.innerText="ERRO CRÍTICO: O ELEMENTO #ROOT NÃO FOI ENCONTRADO NO HTML.")} diff --git a/frontend/dist/assets/index-CwbNbjIf.css b/frontend/dist/assets/index-CwbNbjIf.css new file mode 100644 index 0000000..28ed989 --- /dev/null +++ b/frontend/dist/assets/index-CwbNbjIf.css @@ -0,0 +1 @@ +/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-800:oklch(47% .157 37.304);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-teal-50:oklch(98.4% .014 180.72);--color-teal-100:oklch(95.3% .051 180.801);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-teal-600:oklch(60% .118 184.704);--color-teal-700:oklch(51.1% .096 186.391);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-violet-50:oklch(96.9% .016 293.756);--color-violet-100:oklch(94.3% .029 294.588);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:oklch(60.6% .25 292.717);--color-violet-600:oklch(54.1% .281 293.009);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-purple-800:oklch(43.8% .218 303.724);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-600:oklch(58.6% .253 17.585);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-gray-950:oklch(13% .028 261.692);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--animate-bounce:bounce 1s infinite;--blur-sm:8px;--blur-md:12px;--blur-lg:16px;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}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;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.-top-1\.5{top:calc(var(--spacing) * -1.5)}.-top-10{top:calc(var(--spacing) * -10)}.top-0{top:calc(var(--spacing) * 0)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-4{top:calc(var(--spacing) * 4)}.top-6{top:calc(var(--spacing) * 6)}.top-40{top:calc(var(--spacing) * 40)}.top-full{top:100%}.-right-1\.5{right:calc(var(--spacing) * -1.5)}.-right-10{right:calc(var(--spacing) * -10)}.right-0{right:calc(var(--spacing) * 0)}.right-2{right:calc(var(--spacing) * 2)}.right-2\.5{right:calc(var(--spacing) * 2.5)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.right-6{right:calc(var(--spacing) * 6)}.-bottom-10{bottom:calc(var(--spacing) * -10)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-2{bottom:calc(var(--spacing) * 2)}.bottom-4{bottom:calc(var(--spacing) * 4)}.-left-10{left:calc(var(--spacing) * -10)}.left-0{left:calc(var(--spacing) * 0)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing) * 2)}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-4{left:calc(var(--spacing) * 4)}.left-10{left:calc(var(--spacing) * 10)}.-z-10{z-index:-10}.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-\[60\]{z-index:60}.z-\[70\]{z-index:70}.z-\[100\]{z-index:100}.z-\[1002\]{z-index:1002}.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-4{grid-column:span 4/span 4}.col-span-6{grid-column:span 6/span 6}.col-span-8{grid-column:span 8/span 8}.col-span-12{grid-column:span 12/span 12}.col-span-full{grid-column:1/-1}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-auto{margin-inline:auto}.-mt-8{margin-top:calc(var(--spacing) * -8)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mt-10{margin-top:calc(var(--spacing) * 10)}.mt-12{margin-top:calc(var(--spacing) * 12)}.mt-20{margin-top:calc(var(--spacing) * 20)}.mt-auto{margin-top:auto}.-mr-8{margin-right:calc(var(--spacing) * -8)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5{margin-bottom:calc(var(--spacing) * 2.5)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.mb-20{margin-bottom:calc(var(--spacing) * 20)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-32{height:calc(var(--spacing) * 32)}.h-64{height:calc(var(--spacing) * 64)}.h-72{height:calc(var(--spacing) * 72)}.h-80{height:calc(var(--spacing) * 80)}.h-96{height:calc(var(--spacing) * 96)}.h-\[2px\]{height:2px}.h-\[200px\]{height:200px}.h-\[400px\]{height:400px}.h-auto{height:auto}.h-dvh{height:100dvh}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-52{max-height:calc(var(--spacing) * 52)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\[450px\]{max-height:450px}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\[160px\]{min-height:160px}.min-h-\[400px\]{min-height:400px}.min-h-\[600px\]{min-height:600px}.min-h-screen{min-height:100vh}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-1\/2{width:50%}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-44{width:calc(var(--spacing) * 44)}.w-48{width:calc(var(--spacing) * 48)}.w-64{width:calc(var(--spacing) * 64)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-96{width:calc(var(--spacing) * 96)}.w-\[2px\]{width:2px}.w-\[30\%\]{width:30%}.w-\[70\%\]{width:70%}.w-\[380px\]{width:380px}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[120px\]{max-width:120px}.max-w-\[200px\]{max-width:200px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[160px\]{min-width:160px}.min-w-\[200px\]{min-width:200px}.min-w-\[300px\]{min-width:300px}.flex-1{flex:1}.flex-\[2\]{flex:2}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.border-collapse{border-collapse:collapse}.origin-bottom{transform-origin:bottom}.origin-top-right{transform-origin:100% 0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing) * 4);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-20{--tw-translate-x:calc(var(--spacing) * 20);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-1\/2{--tw-translate-y: 50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.rotate-180{rotate:180deg}.skew-x-12{--tw-skew-x:skewX(12deg);transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.transform-gpu{transform:translateZ(0) var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-bounce{animation:var(--animate-bounce)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.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))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-start{align-content:flex-start}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing) * 0)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-10{gap:calc(var(--spacing) * 10)}.gap-12{gap:calc(var(--spacing) * 12)}.gap-16{gap:calc(var(--spacing) * 16)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-10>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 10) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 10) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-12{column-gap:calc(var(--spacing) * 12)}:where(.-space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * -3) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * -3) * calc(1 - var(--tw-space-x-reverse)))}.gap-y-6{row-gap:calc(var(--spacing) * 6)}.gap-y-16{row-gap:calc(var(--spacing) * 16)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-50>:not(:last-child)){border-color:var(--color-gray-50)}:where(.divide-gray-100>:not(:last-child)){border-color:var(--color-gray-100)}:where(.divide-slate-50>:not(:last-child)){border-color:var(--color-slate-50)}:where(.divide-slate-100>:not(:last-child)){border-color:var(--color-slate-100)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.scroll-smooth{scroll-behavior:smooth}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\[1\.5rem\]{border-radius:1.5rem}.rounded-\[2\.2rem\]{border-radius:2.2rem}.rounded-\[2\.5rem\]{border-radius:2.5rem}.rounded-\[2rem\]{border-radius:2rem}.rounded-\[3rem\]{border-radius:3rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-r-full{border-top-right-radius:3.40282e38px;border-bottom-right-radius:3.40282e38px}.rounded-br-xl{border-bottom-right-radius:var(--radius-xl)}.rounded-bl-xl{border-bottom-left-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-8{border-style:var(--tw-border-style);border-width:8px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-none{--tw-border-style:none;border-style:none}.border-amber-100{border-color:var(--color-amber-100)}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-300{border-color:var(--color-amber-300)}.border-amber-600{border-color:var(--color-amber-600)}.border-amber-700{border-color:var(--color-amber-700)}.border-amber-800{border-color:var(--color-amber-800)}.border-blue-50{border-color:var(--color-blue-50)}.border-blue-100{border-color:var(--color-blue-100)}.border-blue-100\/50{border-color:#dbeafe80}@supports (color:color-mix(in lab,red,red)){.border-blue-100\/50{border-color:color-mix(in oklab,var(--color-blue-100) 50%,transparent)}}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-300{border-color:var(--color-blue-300)}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-600{border-color:var(--color-blue-600)}.border-blue-700{border-color:var(--color-blue-700)}.border-emerald-100{border-color:var(--color-emerald-100)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-50{border-color:var(--color-gray-50)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-200\/50{border-color:#e5e7eb80}@supports (color:color-mix(in lab,red,red)){.border-gray-200\/50{border-color:color-mix(in oklab,var(--color-gray-200) 50%,transparent)}}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-400{border-color:var(--color-gray-400)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-800{border-color:var(--color-gray-800)}.border-green-50{border-color:var(--color-green-50)}.border-green-100{border-color:var(--color-green-100)}.border-green-200{border-color:var(--color-green-200)}.border-green-300{border-color:var(--color-green-300)}.border-green-400{border-color:var(--color-green-400)}.border-green-600{border-color:var(--color-green-600)}.border-indigo-100{border-color:var(--color-indigo-100)}.border-indigo-300{border-color:var(--color-indigo-300)}.border-orange-100{border-color:var(--color-orange-100)}.border-purple-200{border-color:var(--color-purple-200)}.border-purple-600{border-color:var(--color-purple-600)}.border-purple-800{border-color:var(--color-purple-800)}.border-red-100{border-color:var(--color-red-100)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-red-500{border-color:var(--color-red-500)}.border-slate-50{border-color:var(--color-slate-50)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-transparent{border-color:#0000}.border-white{border-color:var(--color-white)}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.border-white\/50{border-color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.border-white\/50{border-color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.border-yellow-200{border-color:var(--color-yellow-200)}.border-t-blue-600{border-top-color:var(--color-blue-600)}.border-t-transparent{border-top-color:#0000}.bg-\[\#2d6a4f\]{background-color:#2d6a4f}.bg-\[\#F8FAFC\]{background-color:#f8fafc}.bg-\[\#d49a4a\]{background-color:#d49a4a}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-50\/30{background-color:#fffbeb4d}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/30{background-color:color-mix(in oklab,var(--color-amber-50) 30%,transparent)}}.bg-amber-100{background-color:var(--color-amber-100)}.bg-amber-100\/50{background-color:#fef3c680}@supports (color:color-mix(in lab,red,red)){.bg-amber-100\/50{background-color:color-mix(in oklab,var(--color-amber-100) 50%,transparent)}}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-600{background-color:var(--color-amber-600)}.bg-amber-800{background-color:var(--color-amber-800)}.bg-black{background-color:var(--color-black)}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-50\/20{background-color:#eff6ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/20{background-color:color-mix(in oklab,var(--color-blue-50) 20%,transparent)}}.bg-blue-50\/40{background-color:#eff6ff66}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/40{background-color:color-mix(in oklab,var(--color-blue-50) 40%,transparent)}}.bg-blue-50\/50{background-color:#eff6ff80}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/50{background-color:color-mix(in oklab,var(--color-blue-50) 50%,transparent)}}.bg-blue-50\/70{background-color:#eff6ffb3}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/70{background-color:color-mix(in oklab,var(--color-blue-50) 70%,transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-100\/50{background-color:#dbeafe80}@supports (color:color-mix(in lab,red,red)){.bg-blue-100\/50{background-color:color-mix(in oklab,var(--color-blue-100) 50%,transparent)}}.bg-blue-400\/10{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-400\/10{background-color:color-mix(in oklab,var(--color-blue-400) 10%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-blue-600\/10{background-color:#155dfc1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-600\/10{background-color:color-mix(in oklab,var(--color-blue-600) 10%,transparent)}}.bg-blue-600\/20{background-color:#155dfc33}@supports (color:color-mix(in lab,red,red)){.bg-blue-600\/20{background-color:color-mix(in oklab,var(--color-blue-600) 20%,transparent)}}.bg-current{background-color:currentColor}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-emerald-100\/50{background-color:#d0fae580}@supports (color:color-mix(in lab,red,red)){.bg-emerald-100\/50{background-color:color-mix(in oklab,var(--color-emerald-100) 50%,transparent)}}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-50\/30{background-color:#f9fafb4d}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/30{background-color:color-mix(in oklab,var(--color-gray-50) 30%,transparent)}}.bg-gray-50\/40{background-color:#f9fafb66}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/40{background-color:color-mix(in oklab,var(--color-gray-50) 40%,transparent)}}.bg-gray-50\/50{background-color:#f9fafb80}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/50{background-color:color-mix(in oklab,var(--color-gray-50) 50%,transparent)}}.bg-gray-50\/70{background-color:#f9fafbb3}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/70{background-color:color-mix(in oklab,var(--color-gray-50) 70%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-gray-950{background-color:var(--color-gray-950)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-300{background-color:var(--color-green-300)}.bg-green-400{background-color:var(--color-green-400)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-600{background-color:var(--color-green-600)}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-50\/50{background-color:#eef2ff80}@supports (color:color-mix(in lab,red,red)){.bg-indigo-50\/50{background-color:color-mix(in oklab,var(--color-indigo-50) 50%,transparent)}}.bg-indigo-50\/60{background-color:#eef2ff99}@supports (color:color-mix(in lab,red,red)){.bg-indigo-50\/60{background-color:color-mix(in oklab,var(--color-indigo-50) 60%,transparent)}}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-200{background-color:var(--color-indigo-200)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-orange-50{background-color:var(--color-orange-50)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-orange-400{background-color:var(--color-orange-400)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-purple-50{background-color:var(--color-purple-50)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-purple-500{background-color:var(--color-purple-500)}.bg-purple-600{background-color:var(--color-purple-600)}.bg-purple-800{background-color:var(--color-purple-800)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-100\/50{background-color:#ffe2e280}@supports (color:color-mix(in lab,red,red)){.bg-red-100\/50{background-color:color-mix(in oklab,var(--color-red-100) 50%,transparent)}}.bg-red-400{background-color:var(--color-red-400)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-600{background-color:var(--color-red-600)}.bg-rose-100{background-color:var(--color-rose-100)}.bg-rose-200{background-color:var(--color-rose-200)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-50\/30{background-color:#f8fafc4d}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/30{background-color:color-mix(in oklab,var(--color-slate-50) 30%,transparent)}}.bg-slate-50\/50{background-color:#f8fafc80}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/50{background-color:color-mix(in oklab,var(--color-slate-50) 50%,transparent)}}.bg-slate-100{background-color:var(--color-slate-100)}.bg-teal-100{background-color:var(--color-teal-100)}.bg-teal-600{background-color:var(--color-teal-600)}.bg-transparent{background-color:#0000}.bg-violet-100{background-color:var(--color-violet-100)}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.bg-white\/50{background-color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.bg-white\/50{background-color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.bg-white\/70{background-color:color-mix(in oklab,var(--color-white) 70%,transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.bg-white\/95{background-color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.bg-white\/95{background-color:color-mix(in oklab,var(--color-white) 95%,transparent)}}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-yellow-400{background-color:var(--color-yellow-400)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-l{--tw-gradient-position:to left in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-tr{--tw-gradient-position:to top right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-black\/40{--tw-gradient-from:#0006}@supports (color:color-mix(in lab,red,red)){.from-black\/40{--tw-gradient-from:color-mix(in oklab, var(--color-black) 40%, transparent)}}.from-black\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-50\/50{--tw-gradient-from:#eff6ff80}@supports (color:color-mix(in lab,red,red)){.from-blue-50\/50{--tw-gradient-from:color-mix(in oklab, var(--color-blue-50) 50%, transparent)}}.from-blue-50\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-600{--tw-gradient-from:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-50{--tw-gradient-from:var(--color-emerald-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-gray-50{--tw-gradient-from:var(--color-gray-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-green-50{--tw-gradient-from:var(--color-green-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-50{--tw-gradient-from:var(--color-orange-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-slate-50{--tw-gradient-from:var(--color-slate-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-600{--tw-gradient-to:var(--color-indigo-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-700{--tw-gradient-to:var(--color-indigo-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-white{--tw-gradient-to:var(--color-white);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-10{padding:calc(var(--spacing) * 10)}.p-12{padding:calc(var(--spacing) * 12)}.p-16{padding:calc(var(--spacing) * 16)}.p-20{padding:calc(var(--spacing) * 20)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.px-10{padding-inline:calc(var(--spacing) * 10)}.px-12{padding-inline:calc(var(--spacing) * 12)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-14{padding-block:calc(var(--spacing) * 14)}.py-16{padding-block:calc(var(--spacing) * 16)}.py-20{padding-block:calc(var(--spacing) * 20)}.py-32{padding-block:calc(var(--spacing) * 32)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-10{padding-top:calc(var(--spacing) * 10)}.pt-32{padding-top:calc(var(--spacing) * 32)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-0{padding-bottom:calc(var(--spacing) * 0)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-10{padding-bottom:calc(var(--spacing) * 10)}.pb-20{padding-bottom:calc(var(--spacing) * 20)}.pl-1{padding-left:calc(var(--spacing) * 1)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.pl-10{padding-left:calc(var(--spacing) * 10)}.pl-12{padding-left:calc(var(--spacing) * 12)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-\[1\.05\]{--tw-leading:1.05;line-height:1.05}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-\[0\.3em\]{--tw-tracking:.3em;letter-spacing:.3em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-tighter{--tw-tracking:var(--tracking-tighter);letter-spacing:var(--tracking-tighter)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#2d6a4f\]{color:#2d6a4f}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-900{color:var(--color-amber-900)}.text-black{color:var(--color-black)}.text-blue-100{color:var(--color-blue-100)}.text-blue-300{color:var(--color-blue-300)}.text-blue-400{color:var(--color-blue-400)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-indigo-400{color:var(--color-indigo-400)}.text-indigo-500{color:var(--color-indigo-500)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-orange-500{color:var(--color-orange-500)}.text-orange-600{color:var(--color-orange-600)}.text-orange-800{color:var(--color-orange-800)}.text-pink-500{color:var(--color-pink-500)}.text-purple-500{color:var(--color-purple-500)}.text-purple-600{color:var(--color-purple-600)}.text-purple-700{color:var(--color-purple-700)}.text-purple-800{color:var(--color-purple-800)}.text-red-100{color:var(--color-red-100)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-rose-600{color:var(--color-rose-600)}.text-sky-500{color:var(--color-sky-500)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-teal-500{color:var(--color-teal-500)}.text-teal-600{color:var(--color-teal-600)}.text-transparent{color:#0000}.text-violet-500{color:var(--color-violet-500)}.text-violet-600{color:var(--color-violet-600)}.text-white{color:var(--color-white)}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white) 70%,transparent)}}.text-yellow-600{color:var(--color-yellow-600)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.underline{text-decoration-line:underline}.decoration-blue-200{-webkit-text-decoration-color:var(--color-blue-200);text-decoration-color:var(--color-blue-200)}.underline-offset-8{text-underline-offset:8px}.placeholder-gray-400::placeholder{color:var(--color-gray-400)}.placeholder-gray-500::placeholder{color:var(--color-gray-500)}.opacity-0{opacity:0}.opacity-10{opacity:.1}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.03\]{opacity:.03}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_10px_rgba\(37\,99\,235\,0\.5\)\]{--tw-shadow:0 0 10px var(--tw-shadow-color,#2563eb80);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_8px_30px_rgb\(0\,0\,0\,0\.04\)\]{--tw-shadow:0 8px 30px var(--tw-shadow-color,#0000000a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_8px_32px_rgba\(0\,0\,0\,0\.06\)\]{--tw-shadow:0 8px 32px var(--tw-shadow-color,#0000000f);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_10px_40px_-15px_rgba\(0\,0\,0\,0\.05\)\]{--tw-shadow:0 10px 40px -15px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_20px_50px_-15px_rgba\(0\,0\,0\,0\.1\)\]{--tw-shadow:0 20px 50px -15px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_20px_50px_-15px_rgba\(0\,0\,0\,0\.03\)\]{--tw-shadow:0 20px 50px -15px var(--tw-shadow-color,#00000008);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_20px_50px_rgba\(0\,0\,0\,0\.15\)\]{--tw-shadow:0 20px 50px var(--tw-shadow-color,#00000026);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_50px_100px_-20px_rgba\(0\,0\,0\,0\.2\)\]{--tw-shadow:0 50px 100px -20px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_50px_100px_-20px_rgba\(0\,0\,0\,0\.08\)\]{--tw-shadow:0 50px 100px -20px var(--tw-shadow-color,#00000014);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[2px_0_10px_rgba\(37\,99\,235\,0\.3\)\]{--tw-shadow:2px 0 10px var(--tw-shadow-color,#2563eb4d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-100{--tw-shadow-color:oklch(96.2% .059 95.617)}@supports (color:color-mix(in lab,red,red)){.shadow-amber-100{--tw-shadow-color:color-mix(in oklab, var(--color-amber-100) var(--tw-shadow-alpha), transparent)}}.shadow-blue-100{--tw-shadow-color:oklch(93.2% .032 255.585)}@supports (color:color-mix(in lab,red,red)){.shadow-blue-100{--tw-shadow-color:color-mix(in oklab, var(--color-blue-100) var(--tw-shadow-alpha), transparent)}}.shadow-blue-200{--tw-shadow-color:oklch(88.2% .059 254.128)}@supports (color:color-mix(in lab,red,red)){.shadow-blue-200{--tw-shadow-color:color-mix(in oklab, var(--color-blue-200) var(--tw-shadow-alpha), transparent)}}.shadow-blue-300{--tw-shadow-color:oklch(80.9% .105 251.813)}@supports (color:color-mix(in lab,red,red)){.shadow-blue-300{--tw-shadow-color:color-mix(in oklab, var(--color-blue-300) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-100{--tw-shadow-color:oklch(95% .052 163.051)}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-100{--tw-shadow-color:color-mix(in oklab, var(--color-emerald-100) var(--tw-shadow-alpha), transparent)}}.shadow-green-100{--tw-shadow-color:oklch(96.2% .044 156.743)}@supports (color:color-mix(in lab,red,red)){.shadow-green-100{--tw-shadow-color:color-mix(in oklab, var(--color-green-100) var(--tw-shadow-alpha), transparent)}}.shadow-green-200{--tw-shadow-color:oklch(92.5% .084 155.995)}@supports (color:color-mix(in lab,red,red)){.shadow-green-200{--tw-shadow-color:color-mix(in oklab, var(--color-green-200) var(--tw-shadow-alpha), transparent)}}.ring-blue-100{--tw-ring-color:var(--color-blue-100)}.ring-blue-200{--tw-ring-color:var(--color-blue-200)}.ring-blue-500{--tw-ring-color:var(--color-blue-500)}.ring-gray-300{--tw-ring-color:var(--color-gray-300)}.ring-green-100{--tw-ring-color:var(--color-green-100)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-offset-4{outline-offset:4px}.outline-gray-100{outline-color:var(--color-gray-100)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));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,)}.blur-\[80px\]{--tw-blur:blur(80px);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,)}.backdrop-blur-lg{--tw-backdrop-blur:blur(var(--blur-lg));-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-md{--tw-backdrop-blur:blur(var(--blur-md));-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(var(--blur-sm));-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(var(--blur-xl));-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,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-700{--tw-duration:.7s;transition-duration:.7s}.duration-1000{--tw-duration:1s;transition-duration:1s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.group-focus-within\:text-blue-500:is(:where(.group):focus-within *){color:var(--color-blue-500)}@media(hover:hover){.group-hover\:translate-x-0:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:translate-x-1:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:scale-105:is(:where(.group):hover *){--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.group-hover\:scale-110:is(:where(.group):hover *){--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.group-hover\:bg-blue-600:is(:where(.group):hover *){background-color:var(--color-blue-600)}.group-hover\:bg-indigo-600:is(:where(.group):hover *){background-color:var(--color-indigo-600)}.group-hover\:bg-rose-300:is(:where(.group):hover *){background-color:var(--color-rose-300)}.group-hover\:text-blue-500:is(:where(.group):hover *){color:var(--color-blue-500)}.group-hover\:text-blue-600:is(:where(.group):hover *){color:var(--color-blue-600)}.group-hover\:text-gray-600:is(:where(.group):hover *){color:var(--color-gray-600)}.group-hover\:text-white:is(:where(.group):hover *){color:var(--color-white)}.group-hover\:underline:is(:where(.group):hover *){text-decoration-line:underline}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.group-hover\:shadow-blue-200:is(:where(.group):hover *){--tw-shadow-color:oklch(88.2% .059 254.128)}@supports (color:color-mix(in lab,red,red)){.group-hover\:shadow-blue-200:is(:where(.group):hover *){--tw-shadow-color:color-mix(in oklab, var(--color-blue-200) var(--tw-shadow-alpha), transparent)}}.group-hover\/btn\:translate-x-1:is(:where(.group\/btn):hover *){--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}}.selection\:bg-blue-100 ::selection{background-color:var(--color-blue-100)}.selection\:bg-blue-100::selection{background-color:var(--color-blue-100)}.selection\:text-blue-900 ::selection{color:var(--color-blue-900)}.selection\:text-blue-900::selection{color:var(--color-blue-900)}.placeholder\:text-gray-300::placeholder{color:var(--color-gray-300)}.placeholder\:text-slate-300::placeholder{color:var(--color-slate-300)}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:top-2:before{content:var(--tw-content);top:calc(var(--spacing) * 2)}.before\:bottom-2:before{content:var(--tw-content);bottom:calc(var(--spacing) * 2)}.before\:left-\[7px\]:before{content:var(--tw-content);left:7px}.before\:w-0\.5:before{content:var(--tw-content);width:calc(var(--spacing) * .5)}.before\:bg-gray-200:before{content:var(--tw-content);background-color:var(--color-gray-200)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:pb-0:last-child{padding-bottom:calc(var(--spacing) * 0)}@media(hover:hover){.hover\:-translate-y-1:hover{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:border-amber-400:hover{border-color:var(--color-amber-400)}.hover\:border-blue-100:hover{border-color:var(--color-blue-100)}.hover\:border-blue-200:hover{border-color:var(--color-blue-200)}.hover\:border-blue-300:hover{border-color:var(--color-blue-300)}.hover\:border-blue-400:hover{border-color:var(--color-blue-400)}.hover\:border-blue-400\/50:hover{border-color:#54a2ff80}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-400\/50:hover{border-color:color-mix(in oklab,var(--color-blue-400) 50%,transparent)}}.hover\:border-blue-500:hover{border-color:var(--color-blue-500)}.hover\:border-emerald-200:hover{border-color:var(--color-emerald-200)}.hover\:border-gray-100:hover{border-color:var(--color-gray-100)}.hover\:border-gray-200:hover{border-color:var(--color-gray-200)}.hover\:border-gray-300:hover{border-color:var(--color-gray-300)}.hover\:border-gray-400:hover{border-color:var(--color-gray-400)}.hover\:border-green-400:hover{border-color:var(--color-green-400)}.hover\:border-indigo-400:hover{border-color:var(--color-indigo-400)}.hover\:border-orange-400:hover{border-color:var(--color-orange-400)}.hover\:border-purple-400:hover{border-color:var(--color-purple-400)}.hover\:border-red-100:hover{border-color:var(--color-red-100)}.hover\:border-red-200:hover{border-color:var(--color-red-200)}.hover\:border-red-400:hover{border-color:var(--color-red-400)}.hover\:border-sky-400:hover{border-color:var(--color-sky-400)}.hover\:border-teal-400:hover{border-color:var(--color-teal-400)}.hover\:border-violet-400:hover{border-color:var(--color-violet-400)}.hover\:border-yellow-400:hover{border-color:var(--color-yellow-400)}.hover\:bg-\[\#1b4332\]:hover{background-color:#1b4332}.hover\:bg-amber-50:hover{background-color:var(--color-amber-50)}.hover\:bg-amber-100:hover{background-color:var(--color-amber-100)}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-amber-700:hover{background-color:var(--color-amber-700)}.hover\:bg-black:hover{background-color:var(--color-black)}.hover\:bg-blue-50:hover{background-color:var(--color-blue-50)}.hover\:bg-blue-50\/30:hover{background-color:#eff6ff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-50\/30:hover{background-color:color-mix(in oklab,var(--color-blue-50) 30%,transparent)}}.hover\:bg-blue-50\/50:hover{background-color:#eff6ff80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-50\/50:hover{background-color:color-mix(in oklab,var(--color-blue-50) 50%,transparent)}}.hover\:bg-blue-200:hover{background-color:var(--color-blue-200)}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-emerald-700:hover{background-color:var(--color-emerald-700)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-50\/50:hover{background-color:#f9fafb80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-50\/50:hover{background-color:color-mix(in oklab,var(--color-gray-50) 50%,transparent)}}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-400:hover{background-color:var(--color-gray-400)}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-green-50:hover{background-color:var(--color-green-50)}.hover\:bg-green-50\/50:hover{background-color:#f0fdf480}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-50\/50:hover{background-color:color-mix(in oklab,var(--color-green-50) 50%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-indigo-50:hover{background-color:var(--color-indigo-50)}.hover\:bg-indigo-50\/50:hover{background-color:#eef2ff80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-50\/50:hover{background-color:color-mix(in oklab,var(--color-indigo-50) 50%,transparent)}}.hover\:bg-indigo-100:hover{background-color:var(--color-indigo-100)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}.hover\:bg-orange-50\/50:hover{background-color:#fff7ed80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-50\/50:hover{background-color:color-mix(in oklab,var(--color-orange-50) 50%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-50\/50:hover{background-color:#faf5ff80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-50\/50:hover{background-color:color-mix(in oklab,var(--color-purple-50) 50%,transparent)}}.hover\:bg-purple-700:hover{background-color:var(--color-purple-700)}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-50\/50:hover{background-color:#fef2f280}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-50\/50:hover{background-color:color-mix(in oklab,var(--color-red-50) 50%,transparent)}}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-sky-50\/50:hover{background-color:#f0f9ff80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-sky-50\/50:hover{background-color:color-mix(in oklab,var(--color-sky-50) 50%,transparent)}}.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-50\/50:hover{background-color:#f8fafc80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-50\/50:hover{background-color:color-mix(in oklab,var(--color-slate-50) 50%,transparent)}}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-teal-50\/50:hover{background-color:#f0fdfa80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-teal-50\/50:hover{background-color:color-mix(in oklab,var(--color-teal-50) 50%,transparent)}}.hover\:bg-teal-700:hover{background-color:var(--color-teal-700)}.hover\:bg-violet-50\/50:hover{background-color:#f5f3ff80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-violet-50\/50:hover{background-color:color-mix(in oklab,var(--color-violet-50) 50%,transparent)}}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.hover\:bg-yellow-50\/50:hover{background-color:#fefce880}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-50\/50:hover{background-color:color-mix(in oklab,var(--color-yellow-50) 50%,transparent)}}.hover\:text-blue-500:hover{color:var(--color-blue-500)}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-blue-800:hover{color:var(--color-blue-800)}.hover\:text-emerald-500:hover{color:var(--color-emerald-500)}.hover\:text-gray-500:hover{color:var(--color-gray-500)}.hover\:text-gray-600:hover{color:var(--color-gray-600)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}.hover\:text-gray-900:hover{color:var(--color-gray-900)}.hover\:text-green-600:hover{color:var(--color-green-600)}.hover\:text-indigo-700:hover{color:var(--color-indigo-700)}.hover\:text-red-500:hover{color:var(--color-red-500)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:text-red-700:hover{color:var(--color-red-700)}.hover\:text-slate-600:hover{color:var(--color-slate-600)}.hover\:text-slate-700:hover{color:var(--color-slate-700)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-2xl:hover{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-\[0_8px_32px_rgba\(59\,130\,246\,0\.15\)\]:hover{--tw-shadow:0 8px 32px var(--tw-shadow-color,#3b82f626);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-\[0_20px_50px_-20px_rgba\(0\,0\,0\,0\.1\)\]:hover{--tw-shadow:0 20px 50px -20px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-\[0_20px_50px_rgba\(8\,112\,184\,0\.1\)\]:hover{--tw-shadow:0 20px 50px var(--tw-shadow-color,#0870b81a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-sm:hover{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-blue-50\/50:hover{--tw-shadow-color:#eff6ff80}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-blue-50\/50:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-blue-50) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-blue-200:hover{--tw-shadow-color:oklch(88.2% .059 254.128)}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-blue-200:hover{--tw-shadow-color:color-mix(in oklab, var(--color-blue-200) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-emerald-200:hover{--tw-shadow-color:oklch(90.5% .093 164.15)}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-emerald-200:hover{--tw-shadow-color:color-mix(in oklab, var(--color-emerald-200) var(--tw-shadow-alpha), transparent)}}}.focus\:border-2:focus{border-style:var(--tw-border-style);border-width:2px}.focus\:border-amber-300:focus{border-color:var(--color-amber-300)}.focus\:border-amber-400:focus{border-color:var(--color-amber-400)}.focus\:border-blue-300:focus{border-color:var(--color-blue-300)}.focus\:border-blue-500:focus{border-color:var(--color-blue-500)}.focus\:border-blue-600:focus{border-color:var(--color-blue-600)}.focus\:border-green-500:focus{border-color:var(--color-green-500)}.focus\:border-indigo-300:focus{border-color:var(--color-indigo-300)}.focus\:border-orange-400:focus{border-color:var(--color-orange-400)}.focus\:border-red-400:focus{border-color:var(--color-red-400)}.focus\:border-transparent:focus{border-color:#0000}.focus\:bg-white:focus{background-color:var(--color-white)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-4:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-amber-500:focus{--tw-ring-color:var(--color-amber-500)}.focus\:ring-blue-50:focus{--tw-ring-color:var(--color-blue-50)}.focus\:ring-blue-100:focus{--tw-ring-color:var(--color-blue-100)}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-emerald-100:focus{--tw-ring-color:var(--color-emerald-100)}.focus\:ring-indigo-100:focus{--tw-ring-color:var(--color-indigo-100)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:scale-\[0\.98\]:active{scale:.98}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-400:disabled{background-color:var(--color-gray-400)}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.disabled\:opacity-70:disabled{opacity:.7}@media(hover:hover){.disabled\:hover\:bg-transparent:disabled:hover{background-color:#0000}}@media(min-width:40rem){.sm\:mb-4{margin-bottom:calc(var(--spacing) * 4)}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:inline{display:inline}.sm\:h-9{height:calc(var(--spacing) * 9)}.sm\:w-9{width:calc(var(--spacing) * 9)}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:gap-2{gap:calc(var(--spacing) * 2)}:where(.sm\:space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.sm\:gap-x-12{column-gap:calc(var(--spacing) * 12)}.sm\:gap-y-16{row-gap:calc(var(--spacing) * 16)}.sm\:p-6{padding:calc(var(--spacing) * 6)}.sm\:p-8{padding:calc(var(--spacing) * 8)}.sm\:px-8{padding-inline:calc(var(--spacing) * 8)}.sm\:py-6{padding-block:calc(var(--spacing) * 6)}.sm\:py-10{padding-block:calc(var(--spacing) * 10)}.sm\:pr-2{padding-right:calc(var(--spacing) * 2)}.sm\:pl-2{padding-left:calc(var(--spacing) * 2)}.sm\:text-\[11px\]{font-size:11px}}@media(min-width:48rem){.md\:relative{position:relative}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-\[98vh\]{height:98vh}.md\:w-\[96vw\]{width:96vw}.md\:max-w-\[300px\]{max-width:300px}.md\:translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:items-end{align-items:flex-end}.md\:gap-4{gap:calc(var(--spacing) * 4)}.md\:rounded-2xl{border-radius:var(--radius-2xl)}.md\:rounded-\[2\.5rem\]{border-radius:2.5rem}.md\:rounded-\[2rem\]{border-radius:2rem}.md\:rounded-xl{border-radius:var(--radius-xl)}.md\:p-8{padding:calc(var(--spacing) * 8)}.md\:px-8{padding-inline:calc(var(--spacing) * 8)}.md\:text-left{text-align:left}.md\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}@media(min-width:64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:col-span-4{grid-column:span 4/span 4}.lg\:col-span-8{grid-column:span 8/span 8}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:inline-block{display:inline-block}.lg\:w-1\/2{width:50%}.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))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:justify-between{justify-content:space-between}:where(.lg\:space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 0) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 0) * calc(1 - var(--tw-space-y-reverse)))}.lg\:gap-x-8{column-gap:calc(var(--spacing) * 8)}.lg\:gap-y-5{row-gap:calc(var(--spacing) * 5)}.lg\:gap-y-6{row-gap:calc(var(--spacing) * 6)}.lg\:p-3{padding:calc(var(--spacing) * 3)}.lg\:p-4{padding:calc(var(--spacing) * 4)}.lg\:p-6{padding:calc(var(--spacing) * 6)}.lg\:p-8{padding:calc(var(--spacing) * 8)}.lg\:p-24{padding:calc(var(--spacing) * 24)}.lg\:py-3{padding-block:calc(var(--spacing) * 3)}.lg\:pt-48{padding-top:calc(var(--spacing) * 48)}.lg\:pb-0{padding-bottom:calc(var(--spacing) * 0)}.lg\:pb-40{padding-bottom:calc(var(--spacing) * 40)}.lg\:text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.lg\:text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.lg\:text-7xl{font-size:var(--text-7xl);line-height:var(--tw-leading,var(--text-7xl--line-height))}.lg\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}}@media(min-width:80rem){.xl\:col-span-10{grid-column:span 10/span 10}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}}@media print{.print\:hidden{display:none}.print\:max-w-full{max-width:100%}.print\:rounded-none{border-radius:0}.print\:border-0{border-style:var(--tw-border-style);border-width:0}.print\:bg-white{background-color:var(--color-white)}.print\:p-0{padding:calc(var(--spacing) * 0)}.print\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}}body{background-color:#f3f4f6;font-family:Inter,sans-serif}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#f1f1f1}::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.fc{font-family:Inter,sans-serif}.fc-toolbar-title{color:#1f2937;font-size:1.25rem!important;font-weight:600!important}.fc-button-primary{background-color:#2563eb!important;border-color:#2563eb!important}.fc-daygrid-event{border-radius:4px;font-size:.75rem;font-weight:500}.uppercase-input,.uppercase-textarea,.uppercase-select{text-transform:uppercase}.dark-date-input::-webkit-calendar-picker-indicator{filter:invert();cursor:pointer}.fc{max-height:100%}.fc-theme-standard td,.fc-theme-standard th{border:1px solid #e5e7eb!important}.fc-timegrid-slot{height:3em!important}.fc-col-header-cell{background-color:#f9fafb;padding:8px 0!important}.fc-scrollgrid{border-radius:8px;overflow:hidden}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}} diff --git a/frontend/dist/assets/index-DBXVhurK.js b/frontend/dist/assets/index-DBXVhurK.js new file mode 100644 index 0000000..a311e83 --- /dev/null +++ b/frontend/dist/assets/index-DBXVhurK.js @@ -0,0 +1,737 @@ +var Fy=t=>{throw TypeError(t)};var ep=(t,e,n)=>e.has(t)||Fy("Cannot "+n);var U=(t,e,n)=>(ep(t,e,"read from private field"),n?n.call(t):e.get(t)),we=(t,e,n)=>e.has(t)?Fy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),me=(t,e,n,r)=>(ep(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),He=(t,e,n)=>(ep(t,e,"access private method"),n);var dd=(t,e,n,r)=>({set _(i){me(t,e,i,n)},get _(){return U(t,e,r)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const c of i)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function n(i){const c={};return i.integrity&&(c.integrity=i.integrity),i.referrerPolicy&&(c.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?c.credentials="include":i.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(i){if(i.ep)return;i.ep=!0;const c=n(i);fetch(i.href,c)}})();function _N(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var tp={exports:{}},Zi={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Vy;function Q2(){if(Vy)return Zi;Vy=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,c){var d=null;if(c!==void 0&&(d=""+c),i.key!==void 0&&(d=""+i.key),"key"in i){c={};for(var f in i)f!=="key"&&(c[f]=i[f])}else c=i;return i=c.ref,{$$typeof:t,type:r,key:d,ref:i!==void 0?i:null,props:c}}return Zi.Fragment=e,Zi.jsx=n,Zi.jsxs=n,Zi}var qy;function W2(){return qy||(qy=1,tp.exports=Q2()),tp.exports}var s=W2(),np={exports:{}},Te={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var $y;function X2(){if($y)return Te;$y=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),x=Symbol.iterator;function v(T){return T===null||typeof T!="object"?null:(T=x&&T[x]||T["@@iterator"],typeof T=="function"?T:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,S={};function R(T,X,le){this.props=T,this.context=X,this.refs=S,this.updater=le||N}R.prototype.isReactComponent={},R.prototype.setState=function(T,X){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,X,"setState")},R.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function w(){}w.prototype=R.prototype;function D(T,X,le){this.props=T,this.context=X,this.refs=S,this.updater=le||N}var C=D.prototype=new w;C.constructor=D,j(C,R.prototype),C.isPureReactComponent=!0;var I=Array.isArray;function L(){}var F={H:null,A:null,T:null,S:null},Y=Object.prototype.hasOwnProperty;function $(T,X,le){var se=le.ref;return{$$typeof:t,type:T,key:X,ref:se!==void 0?se:null,props:le}}function M(T,X){return $(T.type,X,T.props)}function H(T){return typeof T=="object"&&T!==null&&T.$$typeof===t}function ne(T){var X={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(le){return X[le]})}var ee=/\/+/g;function he(T,X){return typeof T=="object"&&T!==null&&T.key!=null?ne(""+T.key):X.toString(36)}function pe(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(L,L):(T.status="pending",T.then(function(X){T.status==="pending"&&(T.status="fulfilled",T.value=X)},function(X){T.status==="pending"&&(T.status="rejected",T.reason=X)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function z(T,X,le,se,Ne){var Ae=typeof T;(Ae==="undefined"||Ae==="boolean")&&(T=null);var Re=!1;if(T===null)Re=!0;else switch(Ae){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(T.$$typeof){case t:case e:Re=!0;break;case b:return Re=T._init,z(Re(T._payload),X,le,se,Ne)}}if(Re)return Ne=Ne(T),Re=se===""?"."+he(T,0):se,I(Ne)?(le="",Re!=null&&(le=Re.replace(ee,"$&/")+"/"),z(Ne,X,le,"",function(St){return St})):Ne!=null&&(H(Ne)&&(Ne=M(Ne,le+(Ne.key==null||T&&T.key===Ne.key?"":(""+Ne.key).replace(ee,"$&/")+"/")+Re)),X.push(Ne)),1;Re=0;var ft=se===""?".":se+":";if(I(T))for(var Le=0;Le>>1,re=z[te];if(0>>1;tei(le,G))sei(Ne,le)?(z[te]=Ne,z[se]=G,te=se):(z[te]=le,z[X]=G,te=X);else if(sei(Ne,G))z[te]=Ne,z[se]=G,te=se;else break e}}return oe}function i(z,oe){var G=z.sortIndex-oe.sortIndex;return G!==0?G:z.id-oe.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();t.unstable_now=function(){return d.now()-f}}var h=[],p=[],b=1,y=null,x=3,v=!1,N=!1,j=!1,S=!1,R=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function C(z){for(var oe=n(p);oe!==null;){if(oe.callback===null)r(p);else if(oe.startTime<=z)r(p),oe.sortIndex=oe.expirationTime,e(h,oe);else break;oe=n(p)}}function I(z){if(j=!1,C(z),!N)if(n(h)!==null)N=!0,L||(L=!0,ne());else{var oe=n(p);oe!==null&&pe(I,oe.startTime-z)}}var L=!1,F=-1,Y=5,$=-1;function M(){return S?!0:!(t.unstable_now()-$z&&M());){var te=y.callback;if(typeof te=="function"){y.callback=null,x=y.priorityLevel;var re=te(y.expirationTime<=z);if(z=t.unstable_now(),typeof re=="function"){y.callback=re,C(z),oe=!0;break t}y===n(h)&&r(h),C(z)}else r(h);y=n(h)}if(y!==null)oe=!0;else{var T=n(p);T!==null&&pe(I,T.startTime-z),oe=!1}}break e}finally{y=null,x=G,v=!1}oe=void 0}}finally{oe?ne():L=!1}}}var ne;if(typeof D=="function")ne=function(){D(H)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,he=ee.port2;ee.port1.onmessage=H,ne=function(){he.postMessage(null)}}else ne=function(){R(H,0)};function pe(z,oe){F=R(function(){z(t.unstable_now())},oe)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_forceFrameRate=function(z){0>z||125te?(z.sortIndex=G,e(p,z),n(h)===null&&z===n(p)&&(j?(w(F),F=-1):j=!0,pe(I,G-te))):(z.sortIndex=re,e(h,z),N||v||(N=!0,L||(L=!0,ne()))),z},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(z){var oe=x;return function(){var G=x;x=oe;try{return z.apply(this,arguments)}finally{x=G}}}})(rp)),rp}var Wy;function K2(){return Wy||(Wy=1,sp.exports=Z2()),sp.exports}var lp={exports:{}},Vt={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Xy;function J2(){if(Xy)return Vt;Xy=1;var t=xu();function e(h){var p="https://react.dev/errors/"+h;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),lp.exports=J2(),lp.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ky;function eC(){if(Ky)return Ki;Ky=1;var t=K2(),e=xu(),n=MN();function r(a){var l="https://react.dev/errors/"+a;if(1re||(a.current=te[re],te[re]=null,re--)}function le(a,l){re++,te[re]=a.current,a.current=l}var se=T(null),Ne=T(null),Ae=T(null),Re=T(null);function ft(a,l){switch(le(Ae,l),le(Ne,a),le(se,null),l.nodeType){case 9:case 11:a=(a=l.documentElement)&&(a=a.namespaceURI)?fy(a):0;break;default:if(a=l.tagName,l=l.namespaceURI)l=fy(l),a=hy(l,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}X(se),le(se,a)}function Le(){X(se),X(Ne),X(Ae)}function St(a){a.memoizedState!==null&&le(Re,a);var l=se.current,o=hy(l,a.type);l!==o&&(le(Ne,a),le(se,o))}function Wt(a){Ne.current===a&&(X(se),X(Ne)),Re.current===a&&(X(Re),Yi._currentValue=G)}var fe,W;function de(a){if(fe===void 0)try{throw Error()}catch(o){var l=o.stack.trim().match(/\n( *(at )?)/);fe=l&&l[1]||"",W=-1)":-1g||k[u]!==q[g]){var ae=` +`+k[u].replace(" at new "," at ");return a.displayName&&ae.includes("")&&(ae=ae.replace("",a.displayName)),ae}while(1<=u&&0<=g);break}}}finally{ye=!1,Error.prepareStackTrace=o}return(o=a?a.displayName||a.name:"")?de(o):""}function Wn(a,l){switch(a.tag){case 26:case 27:case 5:return de(a.type);case 16:return de("Lazy");case 13:return a.child!==l&&l!==null?de("Suspense Fallback"):de("Suspense");case 19:return de("SuspenseList");case 0:case 15:return Me(a.type,!1);case 11:return Me(a.type.render,!1);case 1:return Me(a.type,!0);case 31:return de("Activity");default:return""}}function si(a){try{var l="",o=null;do l+=Wn(a,o),o=a,a=a.return;while(a);return l}catch(u){return` +Error generating stack: `+u.message+` +`+u.stack}}var Pu=Object.prototype.hasOwnProperty,Uu=t.unstable_scheduleCallback,Bu=t.unstable_cancelCallback,wA=t.unstable_shouldYield,CA=t.unstable_requestPaint,hn=t.unstable_now,DA=t.unstable_getCurrentPriorityLevel,Vm=t.unstable_ImmediatePriority,qm=t.unstable_UserBlockingPriority,Yo=t.unstable_NormalPriority,OA=t.unstable_LowPriority,$m=t.unstable_IdlePriority,RA=t.log,TA=t.unstable_setDisableYieldValue,ri=null,pn=null;function Xa(a){if(typeof RA=="function"&&TA(a),pn&&typeof pn.setStrictMode=="function")try{pn.setStrictMode(ri,a)}catch{}}var gn=Math.clz32?Math.clz32:MA,kA=Math.log,_A=Math.LN2;function MA(a){return a>>>=0,a===0?32:31-(kA(a)/_A|0)|0}var Qo=256,Wo=262144,Xo=4194304;function Vs(a){var l=a&42;if(l!==0)return l;switch(a&-a){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 a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function Zo(a,l,o){var u=a.pendingLanes;if(u===0)return 0;var g=0,m=a.suspendedLanes,E=a.pingedLanes;a=a.warmLanes;var O=u&134217727;return O!==0?(u=O&~m,u!==0?g=Vs(u):(E&=O,E!==0?g=Vs(E):o||(o=O&~a,o!==0&&(g=Vs(o))))):(O=u&~m,O!==0?g=Vs(O):E!==0?g=Vs(E):o||(o=u&~a,o!==0&&(g=Vs(o)))),g===0?0:l!==0&&l!==g&&(l&m)===0&&(m=g&-g,o=l&-l,m>=o||m===32&&(o&4194048)!==0)?l:g}function li(a,l){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&l)===0}function IA(a,l){switch(a){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 Ym(){var a=Xo;return Xo<<=1,(Xo&62914560)===0&&(Xo=4194304),a}function Hu(a){for(var l=[],o=0;31>o;o++)l.push(a);return l}function ii(a,l){a.pendingLanes|=l,l!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function LA(a,l,o,u,g,m){var E=a.pendingLanes;a.pendingLanes=o,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=o,a.entangledLanes&=o,a.errorRecoveryDisabledLanes&=o,a.shellSuspendCounter=0;var O=a.entanglements,k=a.expirationTimes,q=a.hiddenUpdates;for(o=E&~o;0"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var GA=/[\n"\\]/g;function Mn(a){return a.replace(GA,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Yu(a,l,o,u,g,m,E,O){a.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?a.type=E:a.removeAttribute("type"),l!=null?E==="number"?(l===0&&a.value===""||a.value!=l)&&(a.value=""+_n(l)):a.value!==""+_n(l)&&(a.value=""+_n(l)):E!=="submit"&&E!=="reset"||a.removeAttribute("value"),l!=null?Qu(a,E,_n(l)):o!=null?Qu(a,E,_n(o)):u!=null&&a.removeAttribute("value"),g==null&&m!=null&&(a.defaultChecked=!!m),g!=null&&(a.checked=g&&typeof g!="function"&&typeof g!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?a.name=""+_n(O):a.removeAttribute("name")}function lx(a,l,o,u,g,m,E,O){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(a.type=m),l!=null||o!=null){if(!(m!=="submit"&&m!=="reset"||l!=null)){$u(a);return}o=o!=null?""+_n(o):"",l=l!=null?""+_n(l):o,O||l===a.value||(a.value=l),a.defaultValue=l}u=u??g,u=typeof u!="function"&&typeof u!="symbol"&&!!u,a.checked=O?a.checked:!!u,a.defaultChecked=!!u,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(a.name=E),$u(a)}function Qu(a,l,o){l==="number"&&ec(a.ownerDocument)===a||a.defaultValue===""+o||(a.defaultValue=""+o)}function Hr(a,l,o,u){if(a=a.options,l){l={};for(var g=0;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ju=!1;if(ya)try{var ui={};Object.defineProperty(ui,"passive",{get:function(){Ju=!0}}),window.addEventListener("test",ui,ui),window.removeEventListener("test",ui,ui)}catch{Ju=!1}var Ka=null,ef=null,nc=null;function hx(){if(nc)return nc;var a,l=ef,o=l.length,u,g="value"in Ka?Ka.value:Ka.textContent,m=g.length;for(a=0;a=pi),yx=" ",vx=!1;function Nx(a,l){switch(a){case"keyup":return mw.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ex(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var qr=!1;function bw(a,l){switch(a){case"compositionend":return Ex(l);case"keypress":return l.which!==32?null:(vx=!0,yx);case"textInput":return a=l.data,a===yx&&vx?null:a;default:return null}}function yw(a,l){if(qr)return a==="compositionend"||!rf&&Nx(a,l)?(a=hx(),nc=ef=Ka=null,qr=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:o,offset:l-a};a=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Rx(o)}}function kx(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?kx(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function _x(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var l=ec(a.document);l instanceof a.HTMLIFrameElement;){try{var o=typeof l.contentWindow.location.href=="string"}catch{o=!1}if(o)a=l.contentWindow;else break;l=ec(a.document)}return l}function cf(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l&&(l==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||l==="textarea"||a.contentEditable==="true")}var Cw=ya&&"documentMode"in document&&11>=document.documentMode,$r=null,df=null,bi=null,uf=!1;function Mx(a,l,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;uf||$r==null||$r!==ec(u)||(u=$r,"selectionStart"in u&&cf(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),bi&&xi(bi,u)||(bi=u,u=Wc(df,"onSelect"),0>=E,g-=E,la=1<<32-gn(l)+g|o<_e?(Be=ve,ve=null):Be=ve.sibling;var Xe=Q(B,ve,V[_e],ie);if(Xe===null){ve===null&&(ve=Be);break}a&&ve&&Xe.alternate===null&&l(B,ve),P=m(Xe,P,_e),We===null?Se=Xe:We.sibling=Xe,We=Xe,ve=Be}if(_e===V.length)return o(B,ve),Ge&&Na(B,_e),Se;if(ve===null){for(;_e_e?(Be=ve,ve=null):Be=ve.sibling;var vs=Q(B,ve,Xe.value,ie);if(vs===null){ve===null&&(ve=Be);break}a&&ve&&vs.alternate===null&&l(B,ve),P=m(vs,P,_e),We===null?Se=vs:We.sibling=vs,We=vs,ve=Be}if(Xe.done)return o(B,ve),Ge&&Na(B,_e),Se;if(ve===null){for(;!Xe.done;_e++,Xe=V.next())Xe=ce(B,Xe.value,ie),Xe!==null&&(P=m(Xe,P,_e),We===null?Se=Xe:We.sibling=Xe,We=Xe);return Ge&&Na(B,_e),Se}for(ve=u(ve);!Xe.done;_e++,Xe=V.next())Xe=J(ve,B,_e,Xe.value,ie),Xe!==null&&(a&&Xe.alternate!==null&&ve.delete(Xe.key===null?_e:Xe.key),P=m(Xe,P,_e),We===null?Se=Xe:We.sibling=Xe,We=Xe);return a&&ve.forEach(function(Y2){return l(B,Y2)}),Ge&&Na(B,_e),Se}function lt(B,P,V,ie){if(typeof V=="object"&&V!==null&&V.type===j&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case v:e:{for(var Se=V.key;P!==null;){if(P.key===Se){if(Se=V.type,Se===j){if(P.tag===7){o(B,P.sibling),ie=g(P,V.props.children),ie.return=B,B=ie;break e}}else if(P.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===Y&&tr(Se)===P.type){o(B,P.sibling),ie=g(P,V.props),Si(ie,V),ie.return=B,B=ie;break e}o(B,P);break}else l(B,P);P=P.sibling}V.type===j?(ie=Xs(V.props.children,B.mode,ie,V.key),ie.return=B,B=ie):(ie=fc(V.type,V.key,V.props,null,B.mode,ie),Si(ie,V),ie.return=B,B=ie)}return E(B);case N:e:{for(Se=V.key;P!==null;){if(P.key===Se)if(P.tag===4&&P.stateNode.containerInfo===V.containerInfo&&P.stateNode.implementation===V.implementation){o(B,P.sibling),ie=g(P,V.children||[]),ie.return=B,B=ie;break e}else{o(B,P);break}else l(B,P);P=P.sibling}ie=bf(V,B.mode,ie),ie.return=B,B=ie}return E(B);case Y:return V=tr(V),lt(B,P,V,ie)}if(pe(V))return xe(B,P,V,ie);if(ne(V)){if(Se=ne(V),typeof Se!="function")throw Error(r(150));return V=Se.call(V),De(B,P,V,ie)}if(typeof V.then=="function")return lt(B,P,yc(V),ie);if(V.$$typeof===D)return lt(B,P,gc(B,V),ie);vc(B,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,P!==null&&P.tag===6?(o(B,P.sibling),ie=g(P,V),ie.return=B,B=ie):(o(B,P),ie=xf(V,B.mode,ie),ie.return=B,B=ie),E(B)):o(B,P)}return function(B,P,V,ie){try{ji=0;var Se=lt(B,P,V,ie);return al=null,Se}catch(ve){if(ve===nl||ve===xc)throw ve;var We=xn(29,ve,null,B.mode);return We.lanes=ie,We.return=B,We}finally{}}}var ar=a0(!0),s0=a0(!1),as=!1;function Rf(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Tf(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function ss(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function rs(a,l,o){var u=a.updateQueue;if(u===null)return null;if(u=u.shared,(Ze&2)!==0){var g=u.pending;return g===null?l.next=l:(l.next=g.next,g.next=l),u.pending=l,l=uc(a),Hx(a,null,o),l}return dc(a,u,l,o),uc(a)}function Ai(a,l,o){if(l=l.updateQueue,l!==null&&(l=l.shared,(o&4194048)!==0)){var u=l.lanes;u&=a.pendingLanes,o|=u,l.lanes=o,Wm(a,o)}}function kf(a,l){var o=a.updateQueue,u=a.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var g=null,m=null;if(o=o.firstBaseUpdate,o!==null){do{var E={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};m===null?g=m=E:m=m.next=E,o=o.next}while(o!==null);m===null?g=m=l:m=m.next=l}else g=m=l;o={baseState:u.baseState,firstBaseUpdate:g,lastBaseUpdate:m,shared:u.shared,callbacks:u.callbacks},a.updateQueue=o;return}a=o.lastBaseUpdate,a===null?o.firstBaseUpdate=l:a.next=l,o.lastBaseUpdate=l}var _f=!1;function wi(){if(_f){var a=tl;if(a!==null)throw a}}function Ci(a,l,o,u){_f=!1;var g=a.updateQueue;as=!1;var m=g.firstBaseUpdate,E=g.lastBaseUpdate,O=g.shared.pending;if(O!==null){g.shared.pending=null;var k=O,q=k.next;k.next=null,E===null?m=q:E.next=q,E=k;var ae=a.alternate;ae!==null&&(ae=ae.updateQueue,O=ae.lastBaseUpdate,O!==E&&(O===null?ae.firstBaseUpdate=q:O.next=q,ae.lastBaseUpdate=k))}if(m!==null){var ce=g.baseState;E=0,ae=q=k=null,O=m;do{var Q=O.lane&-536870913,J=Q!==O.lane;if(J?(Ue&Q)===Q:(u&Q)===Q){Q!==0&&Q===el&&(_f=!0),ae!==null&&(ae=ae.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var xe=a,De=O;Q=l;var lt=o;switch(De.tag){case 1:if(xe=De.payload,typeof xe=="function"){ce=xe.call(lt,ce,Q);break e}ce=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=De.payload,Q=typeof xe=="function"?xe.call(lt,ce,Q):xe,Q==null)break e;ce=y({},ce,Q);break e;case 2:as=!0}}Q=O.callback,Q!==null&&(a.flags|=64,J&&(a.flags|=8192),J=g.callbacks,J===null?g.callbacks=[Q]:J.push(Q))}else J={lane:Q,tag:O.tag,payload:O.payload,callback:O.callback,next:null},ae===null?(q=ae=J,k=ce):ae=ae.next=J,E|=Q;if(O=O.next,O===null){if(O=g.shared.pending,O===null)break;J=O,O=J.next,J.next=null,g.lastBaseUpdate=J,g.shared.pending=null}}while(!0);ae===null&&(k=ce),g.baseState=k,g.firstBaseUpdate=q,g.lastBaseUpdate=ae,m===null&&(g.shared.lanes=0),ds|=E,a.lanes=E,a.memoizedState=ce}}function r0(a,l){if(typeof a!="function")throw Error(r(191,a));a.call(l)}function l0(a,l){var o=a.callbacks;if(o!==null)for(a.callbacks=null,a=0;am?m:8;var E=z.T,O={};z.T=O,Kf(a,!1,l,o);try{var k=g(),q=z.S;if(q!==null&&q(O,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var ae=Lw(k,u);Ri(a,l,ae,En(a))}else Ri(a,l,u,En(a))}catch(ce){Ri(a,l,{then:function(){},status:"rejected",reason:ce},En())}finally{oe.p=m,E!==null&&O.types!==null&&(E.types=O.types),z.T=E}}function Gw(){}function Xf(a,l,o,u){if(a.tag!==5)throw Error(r(476));var g=P0(a).queue;z0(a,g,l,G,o===null?Gw:function(){return U0(a),o(u)})}function P0(a){var l=a.memoizedState;if(l!==null)return l;l={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Aa,lastRenderedState:G},next:null};var o={};return l.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Aa,lastRenderedState:o},next:null},a.memoizedState=l,a=a.alternate,a!==null&&(a.memoizedState=l),l}function U0(a){var l=P0(a);l.next===null&&(l=a.alternate.memoizedState),Ri(a,l.next.queue,{},En())}function Zf(){return Ut(Yi)}function B0(){return Et().memoizedState}function H0(){return Et().memoizedState}function Fw(a){for(var l=a.return;l!==null;){switch(l.tag){case 24:case 3:var o=En();a=ss(o);var u=rs(l,a,o);u!==null&&(on(u,l,o),Ai(u,l,o)),l={cache:wf()},a.payload=l;return}l=l.return}}function Vw(a,l,o){var u=En();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Rc(a)?F0(l,o):(o=gf(a,l,o,u),o!==null&&(on(o,a,u),V0(o,l,u)))}function G0(a,l,o){var u=En();Ri(a,l,o,u)}function Ri(a,l,o,u){var g={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Rc(a))F0(l,g);else{var m=a.alternate;if(a.lanes===0&&(m===null||m.lanes===0)&&(m=l.lastRenderedReducer,m!==null))try{var E=l.lastRenderedState,O=m(E,o);if(g.hasEagerState=!0,g.eagerState=O,mn(O,E))return dc(a,l,g,0),it===null&&cc(),!1}catch{}finally{}if(o=gf(a,l,g,u),o!==null)return on(o,a,u),V0(o,l,u),!0}return!1}function Kf(a,l,o,u){if(u={lane:2,revertLane:Rh(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Rc(a)){if(l)throw Error(r(479))}else l=gf(a,o,u,2),l!==null&&on(l,a,2)}function Rc(a){var l=a.alternate;return a===ke||l!==null&&l===ke}function F0(a,l){rl=jc=!0;var o=a.pending;o===null?l.next=l:(l.next=o.next,o.next=l),a.pending=l}function V0(a,l,o){if((o&4194048)!==0){var u=l.lanes;u&=a.pendingLanes,o|=u,l.lanes=o,Wm(a,o)}}var Ti={readContext:Ut,use:wc,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useLayoutEffect:xt,useInsertionEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useSyncExternalStore:xt,useId:xt,useHostTransitionStatus:xt,useFormState:xt,useActionState:xt,useOptimistic:xt,useMemoCache:xt,useCacheRefresh:xt};Ti.useEffectEvent=xt;var q0={readContext:Ut,use:wc,useCallback:function(a,l){return Xt().memoizedState=[a,l===void 0?null:l],a},useContext:Ut,useEffect:D0,useImperativeHandle:function(a,l,o){o=o!=null?o.concat([a]):null,Dc(4194308,4,k0.bind(null,l,a),o)},useLayoutEffect:function(a,l){return Dc(4194308,4,a,l)},useInsertionEffect:function(a,l){Dc(4,2,a,l)},useMemo:function(a,l){var o=Xt();l=l===void 0?null:l;var u=a();if(sr){Xa(!0);try{a()}finally{Xa(!1)}}return o.memoizedState=[u,l],u},useReducer:function(a,l,o){var u=Xt();if(o!==void 0){var g=o(l);if(sr){Xa(!0);try{o(l)}finally{Xa(!1)}}}else g=l;return u.memoizedState=u.baseState=g,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:g},u.queue=a,a=a.dispatch=Vw.bind(null,ke,a),[u.memoizedState,a]},useRef:function(a){var l=Xt();return a={current:a},l.memoizedState=a},useState:function(a){a=qf(a);var l=a.queue,o=G0.bind(null,ke,l);return l.dispatch=o,[a.memoizedState,o]},useDebugValue:Qf,useDeferredValue:function(a,l){var o=Xt();return Wf(o,a,l)},useTransition:function(){var a=qf(!1);return a=z0.bind(null,ke,a.queue,!0,!1),Xt().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,l,o){var u=ke,g=Xt();if(Ge){if(o===void 0)throw Error(r(407));o=o()}else{if(o=l(),it===null)throw Error(r(349));(Ue&127)!==0||f0(u,l,o)}g.memoizedState=o;var m={value:o,getSnapshot:l};return g.queue=m,D0(p0.bind(null,u,m,a),[a]),u.flags|=2048,il(9,{destroy:void 0},h0.bind(null,u,m,o,l),null),o},useId:function(){var a=Xt(),l=it.identifierPrefix;if(Ge){var o=ia,u=la;o=(u&~(1<<32-gn(u)-1)).toString(32)+o,l="_"+l+"R_"+o,o=Sc++,0<\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof u.is=="string"?E.createElement("select",{is:u.is}):E.createElement("select"),u.multiple?m.multiple=!0:u.size&&(m.size=u.size);break;default:m=typeof u.is=="string"?E.createElement(g,{is:u.is}):E.createElement(g)}}m[zt]=l,m[tn]=u;e:for(E=l.child;E!==null;){if(E.tag===5||E.tag===6)m.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===l)break e;for(;E.sibling===null;){if(E.return===null||E.return===l)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}l.stateNode=m;e:switch(Ht(m,g,u),g){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Ca(l)}}return ut(l),fh(l,l.type,a===null?null:a.memoizedProps,l.pendingProps,o),null;case 6:if(a&&l.stateNode!=null)a.memoizedProps!==u&&Ca(l);else{if(typeof u!="string"&&l.stateNode===null)throw Error(r(166));if(a=Ae.current,Kr(l)){if(a=l.stateNode,o=l.memoizedProps,u=null,g=Pt,g!==null)switch(g.tag){case 27:case 5:u=g.memoizedProps}a[zt]=l,a=!!(a.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||dy(a.nodeValue,o)),a||ts(l,!0)}else a=Xc(a).createTextNode(u),a[zt]=l,l.stateNode=a}return ut(l),null;case 31:if(o=l.memoizedState,a===null||a.memoizedState!==null){if(u=Kr(l),o!==null){if(a===null){if(!u)throw Error(r(318));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[zt]=l}else Zs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;ut(l),a=!1}else o=Ef(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=o),a=!0;if(!a)return l.flags&256?(yn(l),l):(yn(l),null);if((l.flags&128)!==0)throw Error(r(558))}return ut(l),null;case 13:if(u=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(g=Kr(l),u!==null&&u.dehydrated!==null){if(a===null){if(!g)throw Error(r(318));if(g=l.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[zt]=l}else Zs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;ut(l),g=!1}else g=Ef(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=g),g=!0;if(!g)return l.flags&256?(yn(l),l):(yn(l),null)}return yn(l),(l.flags&128)!==0?(l.lanes=o,l):(o=u!==null,a=a!==null&&a.memoizedState!==null,o&&(u=l.child,g=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(g=u.alternate.memoizedState.cachePool.pool),m=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(m=u.memoizedState.cachePool.pool),m!==g&&(u.flags|=2048)),o!==a&&o&&(l.child.flags|=8192),Ic(l,l.updateQueue),ut(l),null);case 4:return Le(),a===null&&Mh(l.stateNode.containerInfo),ut(l),null;case 10:return ja(l.type),ut(l),null;case 19:if(X(Nt),u=l.memoizedState,u===null)return ut(l),null;if(g=(l.flags&128)!==0,m=u.rendering,m===null)if(g)_i(u,!1);else{if(bt!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(m=Ec(a),m!==null){for(l.flags|=128,_i(u,!1),a=m.updateQueue,l.updateQueue=a,Ic(l,a),l.subtreeFlags=0,a=o,o=l.child;o!==null;)Gx(o,a),o=o.sibling;return le(Nt,Nt.current&1|2),Ge&&Na(l,u.treeForkCount),l.child}a=a.sibling}u.tail!==null&&hn()>Bc&&(l.flags|=128,g=!0,_i(u,!1),l.lanes=4194304)}else{if(!g)if(a=Ec(m),a!==null){if(l.flags|=128,g=!0,a=a.updateQueue,l.updateQueue=a,Ic(l,a),_i(u,!0),u.tail===null&&u.tailMode==="hidden"&&!m.alternate&&!Ge)return ut(l),null}else 2*hn()-u.renderingStartTime>Bc&&o!==536870912&&(l.flags|=128,g=!0,_i(u,!1),l.lanes=4194304);u.isBackwards?(m.sibling=l.child,l.child=m):(a=u.last,a!==null?a.sibling=m:l.child=m,u.last=m)}return u.tail!==null?(a=u.tail,u.rendering=a,u.tail=a.sibling,u.renderingStartTime=hn(),a.sibling=null,o=Nt.current,le(Nt,g?o&1|2:o&1),Ge&&Na(l,u.treeForkCount),a):(ut(l),null);case 22:case 23:return yn(l),If(),u=l.memoizedState!==null,a!==null?a.memoizedState!==null!==u&&(l.flags|=8192):u&&(l.flags|=8192),u?(o&536870912)!==0&&(l.flags&128)===0&&(ut(l),l.subtreeFlags&6&&(l.flags|=8192)):ut(l),o=l.updateQueue,o!==null&&Ic(l,o.retryQueue),o=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==o&&(l.flags|=2048),a!==null&&X(er),null;case 24:return o=null,a!==null&&(o=a.memoizedState.cache),l.memoizedState.cache!==o&&(l.flags|=2048),ja(At),ut(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function Ww(a,l){switch(vf(l),l.tag){case 1:return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return ja(At),Le(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 26:case 27:case 5:return Wt(l),null;case 31:if(l.memoizedState!==null){if(yn(l),l.alternate===null)throw Error(r(340));Zs()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 13:if(yn(l),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Zs()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return X(Nt),null;case 4:return Le(),null;case 10:return ja(l.type),null;case 22:case 23:return yn(l),If(),a!==null&&X(er),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 24:return ja(At),null;case 25:return null;default:return null}}function gb(a,l){switch(vf(l),l.tag){case 3:ja(At),Le();break;case 26:case 27:case 5:Wt(l);break;case 4:Le();break;case 31:l.memoizedState!==null&&yn(l);break;case 13:yn(l);break;case 19:X(Nt);break;case 10:ja(l.type);break;case 22:case 23:yn(l),If(),a!==null&&X(er);break;case 24:ja(At)}}function Mi(a,l){try{var o=l.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var g=u.next;o=g;do{if((o.tag&a)===a){u=void 0;var m=o.create,E=o.inst;u=m(),E.destroy=u}o=o.next}while(o!==g)}}catch(O){nt(l,l.return,O)}}function os(a,l,o){try{var u=l.updateQueue,g=u!==null?u.lastEffect:null;if(g!==null){var m=g.next;u=m;do{if((u.tag&a)===a){var E=u.inst,O=E.destroy;if(O!==void 0){E.destroy=void 0,g=l;var k=o,q=O;try{q()}catch(ae){nt(g,k,ae)}}}u=u.next}while(u!==m)}}catch(ae){nt(l,l.return,ae)}}function mb(a){var l=a.updateQueue;if(l!==null){var o=a.stateNode;try{l0(l,o)}catch(u){nt(a,a.return,u)}}}function xb(a,l,o){o.props=rr(a.type,a.memoizedProps),o.state=a.memoizedState;try{o.componentWillUnmount()}catch(u){nt(a,l,u)}}function Ii(a,l){try{var o=a.ref;if(o!==null){switch(a.tag){case 26:case 27:case 5:var u=a.stateNode;break;case 30:u=a.stateNode;break;default:u=a.stateNode}typeof o=="function"?a.refCleanup=o(u):o.current=u}}catch(g){nt(a,l,g)}}function oa(a,l){var o=a.ref,u=a.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(g){nt(a,l,g)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(g){nt(a,l,g)}else o.current=null}function bb(a){var l=a.type,o=a.memoizedProps,u=a.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(g){nt(a,a.return,g)}}function hh(a,l,o){try{var u=a.stateNode;x2(u,a.type,o,l),u[tn]=l}catch(g){nt(a,a.return,g)}}function yb(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&gs(a.type)||a.tag===4}function ph(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||yb(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&gs(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function gh(a,l,o){var u=a.tag;if(u===5||u===6)a=a.stateNode,l?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(a,l):(l=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,l.appendChild(a),o=o._reactRootContainer,o!=null||l.onclick!==null||(l.onclick=ba));else if(u!==4&&(u===27&&gs(a.type)&&(o=a.stateNode,l=null),a=a.child,a!==null))for(gh(a,l,o),a=a.sibling;a!==null;)gh(a,l,o),a=a.sibling}function Lc(a,l,o){var u=a.tag;if(u===5||u===6)a=a.stateNode,l?o.insertBefore(a,l):o.appendChild(a);else if(u!==4&&(u===27&&gs(a.type)&&(o=a.stateNode),a=a.child,a!==null))for(Lc(a,l,o),a=a.sibling;a!==null;)Lc(a,l,o),a=a.sibling}function vb(a){var l=a.stateNode,o=a.memoizedProps;try{for(var u=a.type,g=l.attributes;g.length;)l.removeAttributeNode(g[0]);Ht(l,u,o),l[zt]=a,l[tn]=o}catch(m){nt(a,a.return,m)}}var Da=!1,Dt=!1,mh=!1,Nb=typeof WeakSet=="function"?WeakSet:Set,kt=null;function Xw(a,l){if(a=a.containerInfo,zh=ad,a=_x(a),cf(a)){if("selectionStart"in a)var o={start:a.selectionStart,end:a.selectionEnd};else e:{o=(o=a.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var g=u.anchorOffset,m=u.focusNode;u=u.focusOffset;try{o.nodeType,m.nodeType}catch{o=null;break e}var E=0,O=-1,k=-1,q=0,ae=0,ce=a,Q=null;t:for(;;){for(var J;ce!==o||g!==0&&ce.nodeType!==3||(O=E+g),ce!==m||u!==0&&ce.nodeType!==3||(k=E+u),ce.nodeType===3&&(E+=ce.nodeValue.length),(J=ce.firstChild)!==null;)Q=ce,ce=J;for(;;){if(ce===a)break t;if(Q===o&&++q===g&&(O=E),Q===m&&++ae===u&&(k=E),(J=ce.nextSibling)!==null)break;ce=Q,Q=ce.parentNode}ce=J}o=O===-1||k===-1?null:{start:O,end:k}}else o=null}o=o||{start:0,end:0}}else o=null;for(Ph={focusedElem:a,selectionRange:o},ad=!1,kt=l;kt!==null;)if(l=kt,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,kt=a;else for(;kt!==null;){switch(l=kt,m=l.alternate,a=l.flags,l.tag){case 0:if((a&4)!==0&&(a=l.updateQueue,a=a!==null?a.events:null,a!==null))for(o=0;o title"))),Ht(m,u,o),m[zt]=a,Tt(m),u=m;break e;case"link":var E=Cy("link","href",g).get(u+(o.href||""));if(E){for(var O=0;Olt&&(E=lt,lt=De,De=E);var B=Tx(O,De),P=Tx(O,lt);if(B&&P&&(J.rangeCount!==1||J.anchorNode!==B.node||J.anchorOffset!==B.offset||J.focusNode!==P.node||J.focusOffset!==P.offset)){var V=ce.createRange();V.setStart(B.node,B.offset),J.removeAllRanges(),De>lt?(J.addRange(V),J.extend(P.node,P.offset)):(V.setEnd(P.node,P.offset),J.addRange(V))}}}}for(ce=[],J=O;J=J.parentNode;)J.nodeType===1&&ce.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;Oo?32:o,z.T=null,o=jh,jh=null;var m=fs,E=_a;if(Rt=0,fl=fs=null,_a=0,(Ze&6)!==0)throw Error(r(331));var O=Ze;if(Ze|=4,kb(m.current),Ob(m,m.current,E,o),Ze=O,Hi(0,!1),pn&&typeof pn.onPostCommitFiberRoot=="function")try{pn.onPostCommitFiberRoot(ri,m)}catch{}return!0}finally{oe.p=g,z.T=u,Xb(a,l)}}function Kb(a,l,o){l=Ln(o,l),l=nh(a.stateNode,l,2),a=rs(a,l,2),a!==null&&(ii(a,2),ca(a))}function nt(a,l,o){if(a.tag===3)Kb(a,a,o);else for(;l!==null;){if(l.tag===3){Kb(l,a,o);break}else if(l.tag===1){var u=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(us===null||!us.has(u))){a=Ln(o,a),o=J0(2),u=rs(l,o,2),u!==null&&(eb(o,u,l,a),ii(u,2),ca(u));break}}l=l.return}}function Ch(a,l,o){var u=a.pingCache;if(u===null){u=a.pingCache=new Jw;var g=new Set;u.set(l,g)}else g=u.get(l),g===void 0&&(g=new Set,u.set(l,g));g.has(o)||(yh=!0,g.add(o),a=s2.bind(null,a,l,o),l.then(a,a))}function s2(a,l,o){var u=a.pingCache;u!==null&&u.delete(l),a.pingedLanes|=a.suspendedLanes&o,a.warmLanes&=~o,it===a&&(Ue&o)===o&&(bt===4||bt===3&&(Ue&62914560)===Ue&&300>hn()-Uc?(Ze&2)===0&&hl(a,0):vh|=o,ul===Ue&&(ul=0)),ca(a)}function Jb(a,l){l===0&&(l=Ym()),a=Ws(a,l),a!==null&&(ii(a,l),ca(a))}function r2(a){var l=a.memoizedState,o=0;l!==null&&(o=l.retryLane),Jb(a,o)}function l2(a,l){var o=0;switch(a.tag){case 31:case 13:var u=a.stateNode,g=a.memoizedState;g!==null&&(o=g.retryLane);break;case 19:u=a.stateNode;break;case 22:u=a.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(l),Jb(a,o)}function i2(a,l){return Uu(a,l)}var $c=null,gl=null,Dh=!1,Yc=!1,Oh=!1,ps=0;function ca(a){a!==gl&&a.next===null&&(gl===null?$c=gl=a:gl=gl.next=a),Yc=!0,Dh||(Dh=!0,c2())}function Hi(a,l){if(!Oh&&Yc){Oh=!0;do for(var o=!1,u=$c;u!==null;){if(a!==0){var g=u.pendingLanes;if(g===0)var m=0;else{var E=u.suspendedLanes,O=u.pingedLanes;m=(1<<31-gn(42|a)+1)-1,m&=g&~(E&~O),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(o=!0,ay(u,m))}else m=Ue,m=Zo(u,u===it?m:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(m&3)===0||li(u,m)||(o=!0,ay(u,m));u=u.next}while(o);Oh=!1}}function o2(){ey()}function ey(){Yc=Dh=!1;var a=0;ps!==0&&y2()&&(a=ps);for(var l=hn(),o=null,u=$c;u!==null;){var g=u.next,m=ty(u,l);m===0?(u.next=null,o===null?$c=g:o.next=g,g===null&&(gl=o)):(o=u,(a!==0||(m&3)!==0)&&(Yc=!0)),u=g}Rt!==0&&Rt!==5||Hi(a),ps!==0&&(ps=0)}function ty(a,l){for(var o=a.suspendedLanes,u=a.pingedLanes,g=a.expirationTimes,m=a.pendingLanes&-62914561;0O)break;var ae=k.transferSize,ce=k.initiatorType;ae&&uy(ce)&&(k=k.responseEnd,E+=ae*(k"u"?null:document;function jy(a,l,o){var u=ml;if(u&&typeof l=="string"&&l){var g=Mn(l);g='link[rel="'+a+'"][href="'+g+'"]',typeof o=="string"&&(g+='[crossorigin="'+o+'"]'),Ey.has(g)||(Ey.add(g),a={rel:a,crossOrigin:o,href:l},u.querySelector(g)===null&&(l=u.createElement("link"),Ht(l,"link",a),Tt(l),u.head.appendChild(l)))}}function D2(a){Ma.D(a),jy("dns-prefetch",a,null)}function O2(a,l){Ma.C(a,l),jy("preconnect",a,l)}function R2(a,l,o){Ma.L(a,l,o);var u=ml;if(u&&a&&l){var g='link[rel="preload"][as="'+Mn(l)+'"]';l==="image"&&o&&o.imageSrcSet?(g+='[imagesrcset="'+Mn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(g+='[imagesizes="'+Mn(o.imageSizes)+'"]')):g+='[href="'+Mn(a)+'"]';var m=g;switch(l){case"style":m=xl(a);break;case"script":m=bl(a)}Gn.has(m)||(a=y({rel:"preload",href:l==="image"&&o&&o.imageSrcSet?void 0:a,as:l},o),Gn.set(m,a),u.querySelector(g)!==null||l==="style"&&u.querySelector(qi(m))||l==="script"&&u.querySelector($i(m))||(l=u.createElement("link"),Ht(l,"link",a),Tt(l),u.head.appendChild(l)))}}function T2(a,l){Ma.m(a,l);var o=ml;if(o&&a){var u=l&&typeof l.as=="string"?l.as:"script",g='link[rel="modulepreload"][as="'+Mn(u)+'"][href="'+Mn(a)+'"]',m=g;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=bl(a)}if(!Gn.has(m)&&(a=y({rel:"modulepreload",href:a},l),Gn.set(m,a),o.querySelector(g)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector($i(m)))return}u=o.createElement("link"),Ht(u,"link",a),Tt(u),o.head.appendChild(u)}}}function k2(a,l,o){Ma.S(a,l,o);var u=ml;if(u&&a){var g=Ur(u).hoistableStyles,m=xl(a);l=l||"default";var E=g.get(m);if(!E){var O={loading:0,preload:null};if(E=u.querySelector(qi(m)))O.loading=5;else{a=y({rel:"stylesheet",href:a,"data-precedence":l},o),(o=Gn.get(m))&&qh(a,o);var k=E=u.createElement("link");Tt(k),Ht(k,"link",a),k._p=new Promise(function(q,ae){k.onload=q,k.onerror=ae}),k.addEventListener("load",function(){O.loading|=1}),k.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Kc(E,l,u)}E={type:"stylesheet",instance:E,count:1,state:O},g.set(m,E)}}}function _2(a,l){Ma.X(a,l);var o=ml;if(o&&a){var u=Ur(o).hoistableScripts,g=bl(a),m=u.get(g);m||(m=o.querySelector($i(g)),m||(a=y({src:a,async:!0},l),(l=Gn.get(g))&&$h(a,l),m=o.createElement("script"),Tt(m),Ht(m,"link",a),o.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(g,m))}}function M2(a,l){Ma.M(a,l);var o=ml;if(o&&a){var u=Ur(o).hoistableScripts,g=bl(a),m=u.get(g);m||(m=o.querySelector($i(g)),m||(a=y({src:a,async:!0,type:"module"},l),(l=Gn.get(g))&&$h(a,l),m=o.createElement("script"),Tt(m),Ht(m,"link",a),o.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(g,m))}}function Sy(a,l,o,u){var g=(g=Ae.current)?Zc(g):null;if(!g)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(l=xl(o.href),o=Ur(g).hoistableStyles,u=o.get(l),u||(u={type:"style",instance:null,count:0,state:null},o.set(l,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){a=xl(o.href);var m=Ur(g).hoistableStyles,E=m.get(a);if(E||(g=g.ownerDocument||g,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(a,E),(m=g.querySelector(qi(a)))&&!m._p&&(E.instance=m,E.state.loading=5),Gn.has(a)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Gn.set(a,o),m||I2(g,a,o,E.state))),l&&u===null)throw Error(r(528,""));return E}if(l&&u!==null)throw Error(r(529,""));return null;case"script":return l=o.async,o=o.src,typeof o=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=bl(o),o=Ur(g).hoistableScripts,u=o.get(l),u||(u={type:"script",instance:null,count:0,state:null},o.set(l,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function xl(a){return'href="'+Mn(a)+'"'}function qi(a){return'link[rel="stylesheet"]['+a+"]"}function Ay(a){return y({},a,{"data-precedence":a.precedence,precedence:null})}function I2(a,l,o,u){a.querySelector('link[rel="preload"][as="style"]['+l+"]")?u.loading=1:(l=a.createElement("link"),u.preload=l,l.addEventListener("load",function(){return u.loading|=1}),l.addEventListener("error",function(){return u.loading|=2}),Ht(l,"link",o),Tt(l),a.head.appendChild(l))}function bl(a){return'[src="'+Mn(a)+'"]'}function $i(a){return"script[async]"+a}function wy(a,l,o){if(l.count++,l.instance===null)switch(l.type){case"style":var u=a.querySelector('style[data-href~="'+Mn(o.href)+'"]');if(u)return l.instance=u,Tt(u),u;var g=y({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(a.ownerDocument||a).createElement("style"),Tt(u),Ht(u,"style",g),Kc(u,o.precedence,a),l.instance=u;case"stylesheet":g=xl(o.href);var m=a.querySelector(qi(g));if(m)return l.state.loading|=4,l.instance=m,Tt(m),m;u=Ay(o),(g=Gn.get(g))&&qh(u,g),m=(a.ownerDocument||a).createElement("link"),Tt(m);var E=m;return E._p=new Promise(function(O,k){E.onload=O,E.onerror=k}),Ht(m,"link",u),l.state.loading|=4,Kc(m,o.precedence,a),l.instance=m;case"script":return m=bl(o.src),(g=a.querySelector($i(m)))?(l.instance=g,Tt(g),g):(u=o,(g=Gn.get(m))&&(u=y({},o),$h(u,g)),a=a.ownerDocument||a,g=a.createElement("script"),Tt(g),Ht(g,"link",u),a.head.appendChild(g),l.instance=g);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(u=l.instance,l.state.loading|=4,Kc(u,o.precedence,a));return l.instance}function Kc(a,l,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=u.length?u[u.length-1]:null,m=g,E=0;E title"):null)}function L2(a,l,o){if(o===1||l.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return a=l.disabled,typeof l.precedence=="string"&&a==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function Oy(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function z2(a,l,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var g=xl(u.href),m=l.querySelector(qi(g));if(m){l=m._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(a.count++,a=ed.bind(a),l.then(a,a)),o.state.loading|=4,o.instance=m,Tt(m);return}m=l.ownerDocument||l,u=Ay(u),(g=Gn.get(g))&&qh(u,g),m=m.createElement("link"),Tt(m);var E=m;E._p=new Promise(function(O,k){E.onload=O,E.onerror=k}),Ht(m,"link",u),o.instance=m}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(o,l),(l=o.state.preload)&&(o.state.loading&3)===0&&(a.count++,o=ed.bind(a),l.addEventListener("load",o),l.addEventListener("error",o))}}var Yh=0;function P2(a,l){return a.stylesheets&&a.count===0&&nd(a,a.stylesheets),0Yh?50:800)+l);return a.unsuspend=o,function(){a.unsuspend=null,clearTimeout(u),clearTimeout(g)}}:null}function ed(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nd(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var td=null;function nd(a,l){a.stylesheets=null,a.unsuspend!==null&&(a.count++,td=new Map,l.forEach(U2,a),td=null,ed.call(a))}function U2(a,l){if(!(l.state.loading&4)){var o=td.get(a);if(o)var u=o.get(null);else{o=new Map,td.set(a,o);for(var g=a.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),ap.exports=eC(),ap.exports}var nC=tC();const ev=t=>t?t.toUpperCase():"",Fn=t=>{const e={...t};for(const n in e)typeof e[n]=="string"&&n!=="id"&&n!=="email"&&n!=="start"&&n!=="end"&&!n.includes("data")&&!n.includes("cor")&&n!=="corAgenda"&&n!=="corCartao"&&(e[n]=e[n].toUpperCase());return e},be="/api",Ee=async(t,e={})=>{const n=localStorage.getItem("SCOREODONTO_AUTH_TOKEN"),r={...e.headers,...n?{Authorization:`Bearer ${n}`}:{}};return fetch(t,{...e,headers:r})},K={dbConfig:{database:"scoreodonto"},login:async(t,e)=>{const n=t.toLowerCase().trim(),r=e.trim();try{const i=await Ee(`${be}/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:n,password:r})});if(i.ok){const c=await i.json();return localStorage.setItem("SCOREODONTO_AUTH_TOKEN",c.token),localStorage.setItem("SCOREODONTO_USER_DATA",JSON.stringify(c.user)),localStorage.setItem("SCOREODONTO_WORKSPACES",JSON.stringify(c.workspaces)),c.workspaces&&c.workspaces.length>0&&localStorage.setItem("SCOREODONTO_ACTIVE_WORKSPACE",JSON.stringify(c.workspaces[0])),!0}return!1}catch(i){return console.error("Login error:",i),!1}},logout:()=>{localStorage.removeItem("SCOREODONTO_AUTH_TOKEN"),localStorage.removeItem("SCOREODONTO_USER_DATA"),localStorage.removeItem("SCOREODONTO_WORKSPACES"),localStorage.removeItem("SCOREODONTO_ACTIVE_WORKSPACE"),window.location.href="/",window.location.reload()},isAuthenticated:()=>!!localStorage.getItem("SCOREODONTO_AUTH_TOKEN"),getCurrentUser:()=>{const t=localStorage.getItem("SCOREODONTO_USER_DATA");if(!t)return null;try{return JSON.parse(t).email}catch{return null}},getCurrentUserName:()=>{const t=localStorage.getItem("SCOREODONTO_USER_DATA");if(!t)return"USUÁRIO";try{return JSON.parse(t).nome}catch{return"USUÁRIO"}},getWorkspaces:()=>{const t=localStorage.getItem("SCOREODONTO_WORKSPACES");return t?JSON.parse(t):[]},getActiveWorkspace:()=>{const t=localStorage.getItem("SCOREODONTO_ACTIVE_WORKSPACE");return t?JSON.parse(t):null},switchWorkspace:t=>{const n=K.getWorkspaces().find(r=>r.id===t);n&&(["SCOREODONTO_CACHE_PACIENTES","SCOREODONTO_CACHE_AGENDAMENTOS","SCOREODONTO_CACHE_FINANCEIRO","SCOREODONTO_CACHE_DENTISTAS","SCOREODONTO_CACHE_GUIAS","SCOREODONTO_CACHE_GTO","SCOREODONTO_CACHE_PROCEDIMENTOS","SCOREODONTO_CACHE_PLANOS","SCOREODONTO_CACHE_NOTIFICACOES"].forEach(i=>localStorage.removeItem(i)),console.log(`[SECURITY] Cache cleared for tenant switch to: ${t}`),localStorage.setItem("SCOREODONTO_ACTIVE_WORKSPACE",JSON.stringify(n)),window.location.reload())},getCurrentRole:()=>{const t=K.getActiveWorkspace();return(t==null?void 0:t.role)||"paciente"},getDashboardStats:async()=>await(await Ee(`${be}/dashboard/stats`)).json(),isDbConfigured:()=>localStorage.getItem("SCOREODONTO_DB_CONFIGURED")==="true",runInstallScript:async t=>{const e=["--------------------------------------------------"," SCOREODONTO - ATUALIZADOR DE BANCO DE DADOS ","--------------------------------------------------","[INFO] VERIFICANDO AMBIENTE...","[OK] AMBIENTE POSTGRESQL DETECTADO.",`[INFO] CONECTANDO DB: ${K.dbConfig.database}...`,"[INFO] INICIANDO BACKUP DE SEGURANCA...",`[OK] BACKUP SALVO EM: ./bkp_database/BKP_${new Date().toISOString().replace(/[:.]/g,"-")}.SQL`,"[INFO] CONECTANDO API GOOGLE SHEETS...","[INFO] LENDO PLANILHA: 'Dados Pacientes'..."," > 1.240 LINHAS ENCONTRADAS."," > VALIDANDO DADOS (CPF, TELEFONE)...","[INFO] SINCRONIZANDO COM POSTGRESQL (scoreodonto)..."," > FORCANDO PADRAO 'UPPERCASE' EM TODOS OS CAMPOS TEXTUAIS..."," > ATUALIZANDO TABELA: PACIENTES..."," > ATUALIZANDO TABELA: FINANCEIRO..."," > ATUALIZANDO TABELA: AGENDA...","[INFO] LIMPANDO CACHE DE SESSAO...","--------------------------------------------------"," ATUALIZACAO CONCLUIDA COM SUCESSO! ","--------------------------------------------------"];for(const n of e)await new Promise(r=>setTimeout(r,600)),t(n);return localStorage.setItem("SCOREODONTO_DB_CONFIGURED","true"),!0},syncGoogleSheetsToPg:async t=>(t("INICIANDO CONEXÃO COM GOOGLE SHEETS..."),await new Promise(e=>setTimeout(e,800)),t("LENDO ABA 'DADOS PACIENTES'..."),await new Promise(e=>setTimeout(e,800)),t(`CONECTANDO AO POSTGRESQL (${K.dbConfig.database})...`),await new Promise(e=>setTimeout(e,800)),t("COMPARANDO REGISTROS (HASH CHECK)..."),await new Promise(e=>setTimeout(e,1e3)),t("INSERINDO 2 NOVOS PACIENTES NO POSTGRESQL..."),t("ATUALIZANDO 4 AGENDAMENTOS..."),await new Promise(e=>setTimeout(e,500)),t("SINCRONIZAÇÃO CONCLUÍDA COM SUCESSO!"),!0),getPacientes:async(t="",e="recentes")=>{const n=new URLSearchParams;return t.trim()&&n.set("q",t.trim()),e&&n.set("sort",e),(await Ee(`${be}/pacientes?${n}`)).json()},checkCpfExists:async t=>{const e=t.replace(/\D/g,"");if(!e)return!1;const n=await Ee(`${be}/pacientes?q=${encodeURIComponent(t)}`),{data:r}=await n.json();return(r||[]).some(c=>c.cpf.replace(/\D/g,"")===e)},savePaciente:async t=>{const e=Fn(t),n={...e,id:e.id||`p_${Date.now()}`};return await(await Ee(`${be}/pacientes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).json()},updatePaciente:async t=>{const e=Fn(t);return await(await Ee(`${be}/pacientes/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},getGruposFamiliares:async t=>{const e=t!=null&&t.trim()?`${be}/grupos-familiares?q=${encodeURIComponent(t)}`:`${be}/grupos-familiares`,r=await(await Ee(e)).json();return Array.isArray(r)?r:[]},criarGrupoFamiliar:async(t,e)=>(await Ee(`${be}/grupos-familiares`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nome:t,responsavel_id:e})})).json(),getMembrosFamilia:async t=>(await Ee(`${be}/grupos-familiares/${t}/membros`)).json(),getModelosReceita:async t=>{const e=t?`${be}/modelos-receita?especialidadeId=${t}`:`${be}/modelos-receita`,r=await(await Ee(e)).json();return Array.isArray(r)?r:[]},saveModeloReceita:async t=>(await Ee(`${be}/modelos-receita`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),updateModeloReceita:async t=>(await Ee(`${be}/modelos-receita/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),deleteModeloReceita:async t=>{await Ee(`${be}/modelos-receita/${t}`,{method:"DELETE"})},savePedidoExame:async t=>(await Ee(`${be}/pedidos-exame`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),getPedidosExame:async t=>{const e=t?`${be}/pedidos-exame?pacienteId=${t}`:`${be}/pedidos-exame`,r=await(await Ee(e)).json();return Array.isArray(r)?r:[]},getDentistas:async t=>{const e=t?`${be}/dentistas?clinicaId=${t}`:`${be}/dentistas`;return await(await Ee(e)).json()},getPlanos:async()=>await(await Ee(`${be}/planos`)).json(),updateDentista:async t=>{const e=Fn(t);return await(await Ee(`${be}/dentistas/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},saveDentista:async t=>{const e=K.getActiveWorkspace(),r={...Fn(t),id:Math.random().toString(),clinica_id:e==null?void 0:e.id};return await(await Ee(`${be}/dentistas`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json()},reorderDentistas:async t=>await(await Ee(`${be}/dentistas/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({orders:t})})).json(),deleteDentista:async t=>{await Ee(`${be}/dentistas/${t}`,{method:"DELETE"})},getHorariosByDentista:async(t,e)=>await(await Ee(`${be}/dentistas/${t}/horarios?clinicaId=${e}`)).json(),saveHorario:async t=>await(await Ee(`${be}/dentistas/horarios`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),deleteHorario:async t=>{await Ee(`${be}/dentistas/horarios/${t}`,{method:"DELETE"})},getProductivityReport:async(t,e,n)=>await(await Ee(`${be}/reports/productivity?clinicaId=${t}&start=${e||""}&end=${n||""}`)).json(),updateEspecialidade:async t=>{const e=Fn(t);return await(await Ee(`${be}/especialidades/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},saveEspecialidade:async t=>{const n={...Fn(t),id:Math.random().toString()};return await(await Ee(`${be}/especialidades`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).json()},reorderEspecialidades:async t=>await(await Ee(`${be}/especialidades/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({orders:t})})).json(),deleteEspecialidade:async t=>{await Ee(`${be}/especialidades/${t}`,{method:"DELETE"})},updateProcedimento:async t=>{const e=Fn(t);return await(await Ee(`${be}/procedimentos/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},saveProcedimento:async t=>{const n={...Fn(t),id:Math.random().toString()};return await(await Ee(`${be}/procedimentos`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).json()},reorderProcedimentos:async t=>await(await Ee(`${be}/procedimentos/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({orders:t})})).json(),deleteProcedimento:async t=>{await Ee(`${be}/procedimentos/${t}`,{method:"DELETE"})},updatePlano:async t=>{const e=Fn(t);return await(await Ee(`${be}/planos/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},savePlano:async t=>{const n={...Fn(t),id:Math.random().toString()};return await(await Ee(`${be}/planos`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).json()},deletePlano:async t=>{await Ee(`${be}/planos/${t}`,{method:"DELETE"})},getEspecialidades:async()=>await(await Ee(`${be}/especialidades`)).json(),getProcedimentos:async()=>await(await Ee(`${be}/procedimentos`)).json(),getFinanceiro:async()=>await(await Ee(`${be}/financeiro`)).json(),saveFinanceiro:async t=>{const e=Fn(t);return await(await Ee(`${be}/financeiro`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},updateFinanceiro:async t=>{const e=Fn(t);return await(await Ee(`${be}/financeiro/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json()},deleteFinanceiro:async t=>{await Ee(`${be}/financeiro/${t}`,{method:"DELETE"})},getAgendamentos:async()=>await(await Ee(`${be}/agendamentos`,{})).json(),salvarAgendamento:async t=>{const e=await Ee(`${be}/agendamentos`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.message||"Erro ao salvar agendamento.")}return await e.json()},atualizarAgendamento:async(t,e)=>{const n=await Ee(`${be}/agendamentos/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.message||"Erro ao atualizar agendamento.")}return await n.json()},excluirAgendamento:async t=>{await Ee(`${be}/agendamentos/${t}`,{method:"DELETE"})},getOrtoTreatments:async()=>[{id:"t1",pacienteId:"1",pacienteNome:"ANA SILVA",dataNascimento:"2014-03-15",responsavel:"MARIA SILVA",tipoPaciente:"Adolescente",triagem:{queixaPrincipal:"DENTES TORTOS NA FRENTE",historicoMedico:"NENHUMA CONDIÇÃO RELEVANTE",medicacao:"NENHUMA",alergias:"NENHUMA",respiracaoBucal:!1,habitos:"BRUXISMO LEVE NOTURNO"},diagnostico:{classeAngle:"II",perfil:"Convexo",apinhamento:"Moderado",mordida:"Profunda",linhaMedia:"1MM PARA ESQUERDA"},dataInicio:"2024-08-10",tipoAparelho:"AUTOLIGADO METÁLICO",extracoes:"NÃO",sequenciaFios:"0.12 → 0.14 → 0.16 → 0.18 → 0.20x0.25",elasticos:"CLASSE II",iprPlanejado:"NÃO",tempoEstimado:"18–24 MESES",valor:4500,formaPagamento:"PARCELADO 24X",faseAtual:"NIVELAMENTO",fioAtual:"0.16",classificacao:"CLASSE II",cooperacao:"Média",percentualConcluido:35,ultimaConsulta:"2026-01-14",proximaConsulta:"2026-02-14",mesesRestantes:14,status:"Em Tratamento",evolucoes:[{id:"ev1",data:"2024-08-10",tipo:"Colagem",procedimento:"COLAGEM APARELHO SUPERIOR E INFERIOR",proximoRetorno:"2024-09-10",fio:"0.12",higiene:8,cooperacao:"Boa"},{id:"ev2",data:"2024-09-10",tipo:"Manutenção",procedimento:"TROCA DE FIO SUPERIOR 0.14",proximoRetorno:"2024-10-10",fio:"0.14",higiene:7,cooperacao:"Boa"},{id:"ev3",data:"2024-10-10",tipo:"Troca de fio",procedimento:"TROCA DE FIO SUPERIOR 0.16 + ELÁSTICO CLASSE II",proximoRetorno:"2024-11-10",fio:"0.16",elastico:"CLASSE II",higiene:6,cooperacao:"Média"},{id:"ev4",data:"2025-11-10",tipo:"Manutenção",procedimento:"MANUTENÇÃO + PROFILAXIA",proximoRetorno:"2025-12-10",fio:"0.16",elastico:"CLASSE II",procedimentos:["Profilaxia"],higiene:5,cooperacao:"Média",observacoes:"HIGIENE ABAIXO DO IDEAL. ORIENTAÇÕES REFORÇADAS."},{id:"ev5",data:"2026-01-14",tipo:"Manutenção",procedimento:"MANUTENÇÃO CORRENTE ELÁSTICA",proximoRetorno:"2026-02-14",fio:"0.16",elastico:"CLASSE II",higiene:6,cooperacao:"Média"}],flags:[{tipo:"warning",mensagem:"HIGIENE ABAIXO DO IDEAL"},{tipo:"info",mensagem:"COOPERAÇÃO MÉDIA NAS ÚLTIMAS 3 VISITAS"}],fotos:[{url:"",tipo:"inicio",data:"2024-08-10"},{url:"",tipo:"atual",data:"2026-01-14"}]},{id:"t2",pacienteId:"2",pacienteNome:"CARLOS EDUARDO MENDES",dataNascimento:"1990-07-22",tipoPaciente:"Adulto",triagem:{queixaPrincipal:"MORDIDA CRUZADA ANTERIOR",historicoMedico:"HIPERTENSÃO CONTROLADA",medicacao:"LOSARTANA 50MG",alergias:"DIPIRONA",respiracaoBucal:!1,habitos:"NENHUM",periodonto:"RECESSÃO GENGIVAL LEVE EM 31-41",implantes:"NENHUM",recessoes:"31 E 41 - CLASSE I MILLER",mobilidade:"NENHUMA"},diagnostico:{classeAngle:"III",perfil:"Côncavo",apinhamento:"Severo",mordida:"Cruzada",linhaMedia:"3MM PARA DIREITA"},dataInicio:"2024-03-05",tipoAparelho:"AUTOLIGADO CERÂMICO",extracoes:"1º PRÉ-MOLARES SUPERIORES (14 E 24)",sequenciaFios:"0.14 → 0.16 → 0.18 → 0.19x0.25 → 0.21x0.25",elasticos:"CLASSE III",iprPlanejado:"SIM - INFERIOR ANTERIOR",tempoEstimado:"24–30 MESES",valor:7200,formaPagamento:"PARCELADO 30X",faseAtual:"FECHAMENTO DE ESPAÇOS",fioAtual:"0.19x0.25",classificacao:"CLASSE III",cooperacao:"Boa",percentualConcluido:55,ultimaConsulta:"2026-02-05",proximaConsulta:"2026-03-05",mesesRestantes:10,status:"Em Tratamento",evolucoes:[{id:"ev6",data:"2024-03-05",tipo:"Colagem",procedimento:"COLAGEM APARELHO CERÂMICO SUP/INF + EXTRAÇÕES 14 E 24",proximoRetorno:"2024-04-05",fio:"0.14",higiene:9,cooperacao:"Boa"},{id:"ev7",data:"2025-06-05",tipo:"Manutenção",procedimento:"IPR INFERIOR ANTERIOR + MOLA FECHAMENTO",proximoRetorno:"2025-07-05",fio:"0.19x0.25",procedimentos:["IPR"],higiene:8,cooperacao:"Boa"},{id:"ev8",data:"2026-02-05",tipo:"Manutenção",procedimento:"ATIVAÇÃO MOLA + ELÁSTICO CLASSE III",proximoRetorno:"2026-03-05",fio:"0.19x0.25",elastico:"CLASSE III",higiene:9,cooperacao:"Boa"}],flags:[{tipo:"danger",mensagem:"COMPLEXIDADE ALTA - APINHAMENTO SEVERO"},{tipo:"warning",mensagem:"RISCO PERIODONTAL - RECESSÃO CLASSE I"}],fotos:[{url:"",tipo:"inicio",data:"2024-03-05"},{url:"",tipo:"atual",data:"2026-02-05"}]}],saveEvolucaoOrto:async(t,e)=>{const n={id:"ev_"+Math.random().toString(36).substring(2,8),data:new Date().toISOString().split("T")[0],tipo:e.tipo||"Manutenção",procedimento:e.procedimento||"",proximoRetorno:e.proximoRetorno||"",fio:e.fio,elastico:e.elastico,procedimentos:e.procedimentos,higiene:e.higiene,cooperacao:e.cooperacao,observacoes:e.observacoes};return console.log(`[Mock] Evolução salva no tratamento ${t}:`,n),n},updateTratamentoOrto:async t=>{console.log("[Mock] Tratamento atualizado:",t)},finalizarTratamentoOrto:async(t,e)=>{console.log(`[Mock] Tratamento ${t} finalizado com contenção:`,e)},saveLead:async t=>{const e={id:Math.random().toString(),nome:ev(t.nome),sobrenome:ev(t.sobrenome),cpf:t.cpf||"",whatsapp:t.whatsapp||"",tipoInteresse:t.tipoInteresse||"Particular",dataCadastro:new Date().toISOString(),status:"Novo"};return await Ee(`${be}/leads`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),e},getLeads:async()=>await(await Ee(`${be}/leads`)).json(),getNotifications:async()=>{try{return await(await Ee(`${be}/notificacoes`)).json()}catch{return[]}},markNotificationRead:async t=>{try{await Ee(`${be}/notificacoes/${t}/read`,{method:"PUT"})}catch(e){console.error("Erro ao marcar como lida:",e)}},markAllNotificationsRead:async()=>{try{await Ee(`${be}/notificacoes/read-all`,{method:"POST"})}catch(t){console.error("Erro ao marcar todas como lidas:",t)}},deleteNotification:async t=>{try{await Ee(`${be}/notificacoes/${t}`,{method:"DELETE"})}catch(e){console.error("Erro ao excluir notificação:",e)}},getSettings:async()=>await(await Ee(`${be}/settings`)).json(),saveSettings:async t=>await(await Ee(`${be}/settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),getGoogleEvents:async()=>{try{return await(await Ee(`${be}/google/events`)).json()}catch{return[]}},getContratos:async t=>{const e=t?`?paciente_id=${t}`:"";return(await Ee(`${be}/contratos${e}`)).json()},saveContrato:async t=>(await Ee(`${be}/contratos`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),updateContrato:async t=>{await Ee(`${be}/contratos/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},deleteContrato:async t=>{await Ee(`${be}/contratos/${t}`,{method:"DELETE"})}};/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IN=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aC=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sC=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/** + * @license lucide-react v0.563.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=t=>{const e=sC(t);return e.charAt(0).toUpperCase()+e.slice(1)};/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var rC={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.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lC=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iC=A.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:c,iconNode:d,...f},h)=>A.createElement("svg",{ref:h,...rC,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:IN("lucide",i),...!c&&!lC(f)&&{"aria-hidden":"true"},...f},[...d.map(([p,b])=>A.createElement(p,b)),...Array.isArray(c)?c:[c]]));/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ue=(t,e)=>{const n=A.forwardRef(({className:r,...i},c)=>A.createElement(iC,{ref:c,iconNode:e,className:IN(`lucide-${aC(tv(t))}`,`lucide-${t}`,r),...i}));return n.displayName=tv(t),n};/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oC=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],$l=ue("activity",oC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cC=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],LN=ue("arrow-down-right",cC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dC=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],zN=ue("arrow-left",dC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uC=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Us=ue("arrow-right",uC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fC=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],ud=ue("arrow-up-down",fC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hC=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],PN=ue("arrow-up-right",hC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pC=[["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"}]],gC=ue("award",pC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mC=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],xC=ue("badge-check",mC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bC=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]],UN=ue("banknote",bC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yC=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],go=ue("bell",yC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vC=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],NC=ue("book-open",vC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EC=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Rg=ue("building-2",EC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jC=[["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"}]],SC=ue("calendar-days",jC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AC=[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]],wC=ue("calendar-range",AC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CC=[["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"}]],jt=ue("calendar",CC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DC=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Dd=ue("camera",DC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OC=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Io=ue("chart-column",OC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RC=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],TC=ue("chart-pie",RC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kC=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],jl=ue("check",kC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _C=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Lo=ue("chevron-down",_C);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MC=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],$a=ue("chevron-left",MC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IC=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Pa=ue("chevron-right",IC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LC=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Tg=ue("chevron-up",LC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zC=[["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"}]],bu=ue("circle-alert",zC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PC=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ga=ue("circle-check-big",PC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],pa=ue("circle-check",UC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],BN=ue("circle-plus",BC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HC=[["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"}]],GC=ue("circle-x",HC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FC=[["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:"m9 14 2 2 4-4",key:"df797q"}]],HN=ue("clipboard-check",FC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VC=[["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"}]],oo=ue("clipboard-list",VC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qC=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Yl=ue("clock",qC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $C=[["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"}]],YC=ue("copy",$C);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QC=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],WC=ue("credit-card",QC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XC=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Sr=ue("database",XC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZC=[["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"}]],Fa=ue("dollar-sign",ZC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KC=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],kg=ue("download",KC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JC=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],eD=ue("droplets",JC);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tD=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],nD=ue("ellipsis",tD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aD=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],sD=ue("eye-off",aD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rD=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],lD=ue("eye",rD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iD=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],nv=ue("file-down",iD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oD=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ba=ue("file-text",oD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cD=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]],av=ue("file-x",cD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dD=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],sv=ue("folder-open",dD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uD=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],yu=ue("funnel",uD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fD=[["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"}]],Ql=ue("grip-vertical",fD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hD=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],pD=ue("heart",hD);/** + * @license lucide-react v0.563.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=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],mD=ue("history",gD);/** + * @license lucide-react v0.563.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=[["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"}]],bD=ue("image",xD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yD=[["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"}]],rv=ue("inbox",yD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vD=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],GN=ue("info",vD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ND=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],lv=ue("key-round",ND);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ED=[["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"}]],jD=ue("layout-dashboard",ED);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SD=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ot=ue("loader-circle",SD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AD=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Ld=ue("lock",AD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wD=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],FN=ue("log-out",wD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CD=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],_g=ue("mail",CD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DD=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],VN=ue("map-pin",DD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OD=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],qN=ue("megaphone",OD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RD=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],$N=ue("menu",RD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TD=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],kD=ue("message-circle",TD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _D=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Mg=ue("message-square",_D);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MD=[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]],ID=ue("microscope",MD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LD=[["path",{d:"M5 12h14",key:"1ays0h"}]],YN=ue("minus",LD);/** + * @license lucide-react v0.563.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=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["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:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],PD=ue("palette",zD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UD=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],zo=ue("pencil",UD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BD=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],HD=ue("percent",BD);/** + * @license lucide-react v0.563.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=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],QN=ue("phone",GD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FD=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],VD=ue("play",FD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],gt=ue("plus",qD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $D=[["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"}]],Ya=ue("printer",$D);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YD=[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]],QD=ue("radio-tower",YD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WD=[["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"}]],vu=ue("refresh-cw",WD);/** + * @license lucide-react v0.563.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=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],ZD=ue("rocket",XD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KD=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],iv=ue("rotate-ccw",KD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JD=[["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"}]],Po=ue("save",JD);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eO=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],tO=ue("scissors",eO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nO=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qn=ue("search",nO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aO=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],zd=ue("settings",aO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sO=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],WN=ue("share-2",sO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rO=[["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"}]],Pd=ue("shield-alert",rO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lO=[["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"}]],Ar=ue("shield-check",lO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iO=[["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"}]],oO=ue("shield",iO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cO=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],dO=ue("smartphone",cO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uO=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],fO=ue("sparkles",uO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hO=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Uo=ue("square-pen",hO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pO=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],aa=ue("stethoscope",pO);/** + * @license lucide-react v0.563.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=[["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"}]],mO=ue("tag",gO);/** + * @license lucide-react v0.563.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=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ov=ue("terminal",xO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bO=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Qt=ue("trash-2",bO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yO=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],vO=ue("trending-down",yO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NO=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],XN=ue("trending-up",NO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EO=[["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"}]],Ig=ue("triangle-alert",EO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jO=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],SO=ue("upload",jO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AO=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["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"}]],Wl=ue("user-check",AO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wO=[["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"}]],Ud=ue("user-plus",wO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CO=[["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"}]],Bo=ue("user",CO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DO=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],sa=ue("users",DO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OO=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],RO=ue("wallet",OO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TO=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],kO=ue("wrench",TO);/** + * @license lucide-react v0.563.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _O=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Qe=ue("x",_O);/** + * @license lucide-react v0.563.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=[["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"}]],IO=ue("zap",MO),LO=({activeTab:t,setActiveTab:e})=>{const n=K.getCurrentRole(),r=K.getCurrentUserName(),i=K.getCurrentUser(),c=K.getActiveWorkspace(),d=(c==null?void 0:c.cor)||"#2563eb",f=[{id:"dashboard",label:"VISÃO GERAL",icon:jD},{id:"agenda",label:"AGENDA",icon:jt},{id:"pacientes",label:"PACIENTES",icon:sa},{id:"lancar-gto",label:"LANÇAR GTO",icon:oo},{id:"ortodontia",label:"ORTODONTIA",icon:$l},{id:"financeiro",label:"FINANCEIRO",icon:Fa},{id:"relatorios",label:"RELATÓRIOS",icon:Io},{id:"contratos",label:"CONTRATOS",icon:Ba},{id:"leads",label:"GESTÃO DE LEADS",icon:qN},{id:"tratamentos",label:"MEUS TRATAMENTOS",icon:oo},{id:"clinicas",label:"MINHAS CLÍNICAS",icon:Rg},{id:"dentistas",label:"DENTISTAS",icon:aa},{id:"especialidades",label:"ESPECIALIDADES",icon:gC},{id:"procedimentos",label:"PROCEDIMENTOS",icon:oo},{id:"planos",label:"PLANOS / CONVÊNIOS",icon:NC},{id:"notificacoes",label:"NOTIFICAÇÕES",icon:go},{id:"sync",label:"SINCRONIZAÇÃO",icon:vu},{id:"configuracoes",label:"CONFIGURAÇÕES",icon:zd}].filter(p=>["admin","donoclinica"].includes(n)?!0:n==="paciente"?["tratamentos","notificacoes","configuracoes"].includes(p.id):n==="dentista"?["dashboard","pacientes","tratamentos","agenda","ortodontia","notificacoes","clinicas","configuracoes","contratos"].includes(p.id):n==="funcionario"?["dashboard","leads","pacientes","tratamentos","lancar-gto","agenda","financeiro","relatorios","notificacoes","clinicas","configuracoes","contratos"].includes(p.id):!1),h=()=>{window.confirm("TEM CERTEZA QUE DESEJA SAIR DO SISTEMA?")&&K.logout()};return s.jsxs("div",{className:"w-64 bg-white border-r border-gray-200 h-screen flex flex-col shadow-xl md:shadow-none",children:[s.jsxs("div",{className:"p-6 flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-white font-bold shadow-lg transition-colors duration-500",style:{backgroundColor:d},children:s.jsx(Sr,{size:18})}),s.jsxs("div",{children:[s.jsx("span",{className:"font-bold text-lg text-gray-800 block leading-tight tracking-tight",children:"SCOREODONTO"}),s.jsx("span",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-wider",children:"POSTGRESQL + GOOGLE"})]})]}),s.jsx("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:f.map(p=>{const b=p.icon,y=t===p.id;return s.jsxs("button",{onClick:()=>e(p.id),className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl text-[11px] font-bold uppercase transition-all duration-300 group ${y?"text-white":"text-gray-500 hover:bg-gray-50"}`,style:{backgroundColor:y?d:"transparent",boxShadow:y?`0 10px 15px -5px ${d}44`:"none"},children:[s.jsx(b,{size:18,className:`${y?"text-white":"text-gray-400 group-hover:text-gray-600"} transition-colors`,style:{color:y?"#fff":void 0}}),p.label]},p.id)})}),s.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50/50 space-y-2",children:[s.jsxs("button",{onClick:()=>e("configuracoes"),className:"w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-all group",style:{backgroundColor:t==="configuracoes"?d:"transparent"},children:[s.jsx("div",{className:"w-8 h-8 bg-gray-100 rounded-full flex items-center justify-center text-gray-500 border border-gray-200 flex-shrink-0",children:s.jsx(Bo,{size:15})}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsx("p",{className:`text-[10px] font-black uppercase truncate leading-none ${t==="configuracoes"?"text-white":"text-gray-700"}`,children:r}),s.jsx("p",{className:`text-[9px] font-medium truncate mt-0.5 ${t==="configuracoes"?"text-white/70":"text-gray-400"}`,children:i})]}),s.jsx(zd,{size:14,className:t==="configuracoes"?"text-white":"text-gray-400"})]}),s.jsxs("button",{onClick:h,className:"w-full flex items-center gap-3 px-4 py-2 text-red-500 hover:bg-red-50 rounded-xl text-[10px] font-black uppercase transition-all",children:[s.jsx(FN,{size:16}),"SAIR DO SISTEMA"]})]})]})};var Dr=MN();const zO=_N(Dr),ZN=A.createContext(void 0),PO=({children:t})=>{const[e,n]=A.useState([]),r=A.useCallback((c,d)=>{const f=Date.now();n(h=>[...h,{id:f,message:c,type:d}]),setTimeout(()=>{n(h=>h.filter(p=>p.id!==f))},4e3)},[]),i={toasts:e,addToast:r};return s.jsx(ZN.Provider,{value:i,children:t})},$e=()=>{const t=A.useContext(ZN);if(!t)throw new Error("useToast must be used within a ToastProvider");return{...t,success:e=>t.addToast(e,"success"),error:e=>t.addToast(e,"error"),info:e=>t.addToast(e,"info")}},UO={success:s.jsx(Ga,{className:"text-green-500",size:20}),error:s.jsx(Ig,{className:"text-red-500",size:20}),info:s.jsx(GN,{className:"text-blue-500",size:20})},BO={success:"bg-green-50 border-green-200",error:"bg-red-50 border-red-200",info:"bg-blue-50 border-blue-200"},HO=()=>{const{toasts:t}=$e(),e=document.getElementById("toast-container");return e?Dr.createPortal(s.jsx("div",{className:"fixed top-6 right-6 z-[100] space-y-3",children:t.map(n=>s.jsxs("div",{className:`w-80 p-4 rounded-xl shadow-lg flex items-start gap-3 border animate-in slide-in-from-top-4 ${BO[n.type]}`,children:[s.jsx("div",{className:"flex-shrink-0 mt-0.5",children:UO[n.type]}),s.jsx("p",{className:"flex-1 text-sm text-gray-800 font-bold uppercase",children:n.message})]},n.id))}),e):null},fn=({title:t,description:e,children:n})=>s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-gray-900 uppercase",children:t}),e&&s.jsx("p",{className:"text-gray-500 text-xs uppercase font-bold mt-1",children:e})]}),s.jsx("div",{className:"flex items-center gap-3",children:n})]});function Ie(t,e=[]){const[n,r]=A.useState(null),[i,c]=A.useState(!0),[d,f]=A.useState(null),[h,p]=A.useState(0),b=A.useCallback(async()=>{c(!0),f(null);try{const x=await t();r(x)}catch(x){f(x instanceof Error?x:new Error("An unknown error occurred"))}finally{c(!1)}},[...e,h]);return A.useEffect(()=>{b()},[b]),{data:n,isLoading:i,error:d,refresh:()=>{p(x=>x+1)}}}const GO=()=>{const[t,e]=A.useState(!1),[n,r]=A.useState([]),[i,c]=A.useState(0),d=async()=>{try{const y=await K.getNotifications();r(y),c(y.filter(x=>!x.lida).length)}catch{console.error("Erro ao carregar notificações")}};A.useEffect(()=>{d();const y=setInterval(d,3e4);return()=>clearInterval(y)},[]);const f=()=>e(!t),h=async y=>{await K.markNotificationRead(y),r(x=>x.map(v=>v.id===y?{...v,lida:!0}:v)),c(x=>Math.max(0,x-1))},p=y=>{switch(y){case"agenda":return s.jsx(jt,{size:18,className:"text-blue-500"});case"financeiro":return s.jsx(Fa,{size:18,className:"text-emerald-500"});case"lead":return s.jsx(Wl,{size:18,className:"text-amber-500"});case"sistema":return s.jsx(Pd,{size:18,className:"text-red-500"});default:return s.jsx(Mg,{size:18,className:"text-gray-500"})}},b=y=>{switch(y){case"agenda":return"Agenda";case"financeiro":return"Financeiro";case"lead":return"Novo Lead";case"sistema":return"Sistema";default:return"Geral"}};return s.jsx("div",{className:"relative z-[1002]",children:s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:f,className:"group relative w-11 h-11 flex items-center justify-center rounded-xl bg-white/80 backdrop-blur-md border border-white/20 shadow-[0_8px_32px_rgba(0,0,0,0.06)] hover:shadow-[0_8px_32px_rgba(59,130,246,0.15)] hover:border-blue-400/50 transition-all duration-300",children:[s.jsx(go,{size:22,className:"text-slate-600 group-hover:text-blue-600 transition-colors"}),i>0&&s.jsxs("span",{className:"absolute -top-1.5 -right-1.5 flex h-5 w-5",children:[s.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),s.jsx("span",{className:"relative inline-flex rounded-full h-5 w-5 bg-red-500 text-[10px] font-bold text-white items-center justify-center shadow-lg",children:i})]})]}),t&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0",onClick:f}),s.jsxs("div",{className:"absolute right-0 mt-4 w-[380px] bg-white/95 backdrop-blur-lg rounded-2xl shadow-[0_20px_50px_rgba(0,0,0,0.15)] border border-white/20 overflow-hidden animate-in fade-in zoom-in-95 slide-in-from-top-4 duration-300 transform origin-top-right",children:[s.jsxs("div",{className:"px-6 py-5 bg-gradient-to-r from-slate-50 to-white border-b border-slate-100 flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-slate-800 text-lg tracking-tight",children:"Centro de Notificações"}),s.jsxs("p",{className:"text-[11px] text-slate-400 font-medium uppercase tracking-wider",children:["Você tem ",i," novas mensagens"]})]}),s.jsx("button",{onClick:f,className:"p-2 hover:bg-slate-100 rounded-full transition-colors",children:s.jsx(Qe,{size:18,className:"text-slate-400"})})]}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto custom-scrollbar bg-slate-50/30",children:n.length===0?s.jsxs("div",{className:"py-20 flex flex-col items-center justify-center text-center px-8",children:[s.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mb-4",children:s.jsx(go,{size:32,className:"text-slate-300"})}),s.jsx("p",{className:"text-slate-500 font-medium",children:"Tudo limpo por aqui!"}),s.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"Não há notificações para mostrar no momento."})]}):s.jsx("div",{className:"divide-y divide-slate-100",children:n.map(y=>s.jsxs("div",{className:`group p-5 hover:bg-white transition-all duration-200 cursor-default ${y.lida?"":"bg-blue-50/40 relative"}`,children:[!y.lida&&s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 bg-blue-500 rounded-r-full"}),s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:`mt-1 h-10 w-10 flex-shrink-0 flex items-center justify-center rounded-xl ${y.tipo==="agenda"?"bg-blue-100 text-blue-600":y.tipo==="financeiro"?"bg-emerald-100 text-emerald-600":y.tipo==="lead"?"bg-amber-100 text-amber-600":"bg-red-100 text-red-600"}`,children:p(y.tipo)}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex justify-between items-center mb-1",children:[s.jsx("span",{className:"text-[11px] font-bold text-slate-400 uppercase tracking-wide",children:b(y.tipo)}),s.jsx("span",{className:"text-[10px] text-slate-400",children:new Date(y.data).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})})]}),s.jsx("h4",{className:`text-sm font-bold leading-tight ${y.lida?"text-slate-600":"text-slate-900"}`,children:y.titulo}),s.jsx("p",{className:"text-xs text-slate-500 mt-1 line-clamp-2 leading-relaxed",children:y.mensagem}),!y.lida&&s.jsx("button",{onClick:()=>h(y.id),className:"text-[11px] text-blue-600 font-bold mt-3 opacity-0 group-hover:opacity-100 transition-opacity hover:underline",children:"MARCAR COMO LIDA"})]})]})]},y.id))})}),s.jsx("div",{className:"p-4 bg-white border-t border-slate-100 text-center",children:s.jsx("button",{onClick:()=>{history.pushState({},"","/notificacoes"),e(!1)},className:"text-xs font-bold text-slate-500 hover:text-blue-600 transition-colors tracking-widest uppercase",children:"Histórico Completo"})})]})]})]})})},fd=({title:t,value:e,icon:n,trend:r,isPositive:i,color:c,onClick:d})=>{const f={blue:"bg-blue-50 text-blue-600",green:"bg-emerald-50 text-emerald-600",purple:"bg-indigo-50 text-indigo-600",amber:"bg-amber-50 text-amber-600"};return s.jsxs("div",{onClick:d,className:`bg-white rounded-[2rem] p-8 border border-gray-100 shadow-[0_10px_40px_-15px_rgba(0,0,0,0.05)] hover:shadow-[0_20px_50px_-20px_rgba(0,0,0,0.1)] transition-all duration-500 group relative overflow-hidden ${d?"cursor-pointer":""}`,children:[s.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 opacity-[0.03] -mr-8 -mt-8 rounded-full bg-current transform group-hover:scale-110 transition-transform duration-700"}),s.jsx("div",{className:"flex justify-between items-start relative z-10",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:`w-12 h-12 ${f[c]} rounded-2xl flex items-center justify-center mb-2 group-hover:scale-110 transition-transform`,children:n}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-[0.2em]",children:t}),s.jsx("h3",{className:"text-3xl font-black text-gray-900 tracking-tight mt-1",children:e})]}),r&&s.jsxs("div",{className:`flex items-center gap-1.5 text-xs font-bold ${i?"text-emerald-600":"text-rose-600"}`,children:[s.jsx("div",{className:`p-0.5 rounded-full ${i?"bg-emerald-100":"bg-rose-100"}`,children:i?s.jsx(PN,{size:12}):s.jsx(LN,{size:12})}),r]})]})})]})},FO=()=>{const{data:t,isLoading:e}=Ie(K.getDashboardStats),n=A.useMemo(()=>{if(!(t!=null&&t.growth)||t.growth.length===0)return Array(6).fill(null).map((h,p)=>({label:`MÊS ${p+1}`,receita:0,despesa:0,heightP:"0%",heightR:"0%"}));const f=Math.max(...t.growth.map(h=>Math.max(parseFloat(h.receita),parseFloat(h.despesa))),1e3);return t.growth.map(h=>{const[p,b]=h.mes.split("-");return{label:new Date(parseInt(p),parseInt(b)-1).toLocaleString("pt-BR",{month:"short"}).toUpperCase(),receita:parseFloat(h.receita),despesa:parseFloat(h.despesa),heightR:`${parseFloat(h.receita)/f*100}%`,heightD:`${parseFloat(h.despesa)/f*100}%`}}).slice(-6)},[t]),r=K.getCurrentRole(),i=["admin","donoclinica","funcionario"].includes(r);if(e)return s.jsx("div",{className:"flex items-center justify-center h-96",children:s.jsx("div",{className:"w-12 h-12 border-4 border-blue-600 border-t-transparent rounded-full animate-spin"})});const c=(t==null?void 0:t.stats)||{totalPacientes:0,totalAgendamentos:0,totalLeads:0,faturamentoTotal:0},d=(t==null?void 0:t.recentAgendamentos)||[];return s.jsxs("div",{className:"space-y-10 pb-10",children:[s.jsxs("header",{className:"flex flex-col md:flex-row md:items-end justify-between gap-6",children:[s.jsx("div",{children:s.jsx(fn,{title:"DASHBOARD ANALÍTICO",description:"Informações consolidadas em tempo real da sua clínica."})}),s.jsxs("div",{className:"flex items-center gap-3",children:[(r==="admin"||r==="donoclinica"||r==="funcionario")&&s.jsxs("button",{onClick:()=>history.pushState({},"","/relatorios"),className:"bg-white text-gray-900 border border-gray-200 px-6 py-3 rounded-2xl text-xs font-black uppercase tracking-widest hover:bg-gray-50 transition-all flex items-center gap-2 shadow-sm",children:[s.jsx(Yl,{size:16})," Relatórios"]}),(r==="admin"||r==="donoclinica"||r==="funcionario")&&s.jsxs("button",{onClick:()=>history.pushState({},"","/pacientes"),className:"bg-blue-600 text-white px-6 py-3 rounded-2xl text-xs font-black uppercase tracking-widest hover:bg-blue-700 hover:shadow-xl hover:shadow-blue-200 transition-all flex items-center gap-2 shadow-lg shadow-blue-100",children:[s.jsx(gt,{size:16})," Novo Paciente"]}),s.jsx(GO,{})]})]}),s.jsxs("div",{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-${i?"4":"2"} gap-8`,children:[s.jsx(fd,{title:"Pacientes Ativos",value:c.totalPacientes,icon:s.jsx(sa,{size:24}),trend:"+12% este mês",isPositive:!0,color:"blue",onClick:()=>history.pushState({},"","/pacientes")}),i&&s.jsx(fd,{title:"Faturamento Bruto",value:new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(c.faturamentoTotal),icon:s.jsx(Fa,{size:24}),trend:"+5.4% vs mês ant.",isPositive:!0,color:"green",onClick:()=>history.pushState({},"","/financeiro")}),s.jsx(fd,{title:"Agendamentos",value:c.totalAgendamentos,icon:s.jsx(jt,{size:24}),trend:"82% de ocupação",isPositive:!0,color:"purple",onClick:()=>history.pushState({},"","/agenda")}),i&&s.jsx(fd,{title:"Novas Leads",value:c.totalLeads,icon:s.jsx(qN,{size:24}),trend:"-2% vs ontem",isPositive:!1,color:"amber",onClick:()=>history.pushState({},"","/leads")})]}),s.jsxs("div",{className:`grid lg:grid-cols-${i?"3":"1"} gap-8`,children:[i&&s.jsxs("div",{className:"lg:col-span-2 bg-white rounded-[2.5rem] p-10 border border-gray-100 shadow-[0_20px_50px_-15px_rgba(0,0,0,0.03)]",children:[s.jsxs("div",{className:"flex justify-between items-center mb-10",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-xl font-black text-gray-900 uppercase tracking-tighter italic",children:"Crescimento Mensal"}),s.jsx("p",{className:"text-xs font-bold text-gray-400 mt-1 uppercase",children:"Receitas vs Despesas Reais"})]}),s.jsxs("select",{id:"chart-period-dashboard",name:"chart-period",className:"bg-gray-50 border-none text-[10px] font-black uppercase tracking-widest px-4 py-2 rounded-xl focus:ring-2 focus:ring-blue-100 cursor-pointer",children:[s.jsx("option",{value:"6m",children:"Últimos 6 meses"}),s.jsx("option",{value:"year",children:"Este Ano"})]})]}),s.jsx("div",{className:"h-64 flex items-end justify-between gap-4 px-4",children:n.map((f,h)=>s.jsxs("div",{className:"flex-1 flex flex-col items-center gap-3 group",children:[s.jsxs("div",{className:"w-full flex justify-center gap-1 items-end h-[200px] bg-slate-50/50 rounded-2xl p-1",children:[s.jsx("div",{title:`Despesa: R$ ${f.despesa}`,className:"w-1/3 bg-rose-200 rounded-lg group-hover:bg-rose-300 transition-all duration-500 origin-bottom",style:{height:f.heightD||"5%"}}),s.jsx("div",{title:`Receita: R$ ${f.receita}`,className:"w-1/3 bg-blue-500 rounded-lg group-hover:bg-blue-600 shadow-sm group-hover:shadow-blue-200 transition-all duration-500 origin-bottom",style:{height:f.heightR||"5%"}})]}),s.jsx("span",{className:"text-[10px] font-black text-gray-400 uppercase tracking-tighter",children:f.label})]},h))}),s.jsxs("div",{className:"flex justify-center gap-6 mt-6",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded-sm"}),s.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase",children:"Receitas"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-3 h-3 bg-rose-200 rounded-sm"}),s.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase",children:"Despesas"})]})]})]}),s.jsxs("div",{className:"bg-gray-900 rounded-[2.5rem] p-10 shadow-2xl shadow-blue-200 overflow-hidden relative",children:[s.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-blue-600/20 blur-[80px] rounded-full"}),s.jsxs("div",{className:"relative z-10 h-full flex flex-col",children:[s.jsx("h4",{className:"text-xl font-black text-white uppercase tracking-tighter italic mb-8",children:"Últimos Agendamentos"}),s.jsx("div",{className:"space-y-6 flex-1 overflow-y-auto custom-scrollbar pr-2",children:d.length>0?d.map(f=>s.jsxs("div",{onClick:()=>history.pushState({},"","/agenda"),className:"flex items-center gap-4 group cursor-pointer",children:[s.jsx("div",{className:"w-12 h-12 rounded-2xl bg-white/10 flex items-center justify-center text-blue-400 group-hover:bg-blue-600 group-hover:text-white transition-all duration-300 flex-shrink-0",children:s.jsx(jt,{size:20})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm font-black text-white uppercase tracking-tight truncate",children:f.pacientenome||"Paciente"}),s.jsxs("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-0.5 truncate",children:[f.dentistaNome||"Dr. Dentista"," • ",new Date(f.start_time).toLocaleDateString("pt-BR")," ",new Date(f.start_time).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})]})]}),s.jsx(Pa,{size:16,className:"text-gray-600 group-hover:text-white group-hover:translate-x-1 transition-all"})]},f.id)):s.jsxs("div",{className:"flex flex-col items-center justify-center py-10 opacity-40",children:[s.jsx(jt,{size:40,className:"text-white mb-2"}),s.jsx("p",{className:"text-white text-[10px] font-bold uppercase tracking-widest",children:"Nenhum agendamento recente."})]})}),s.jsxs("button",{onClick:()=>history.pushState({},"","/agenda"),className:"w-full mt-8 bg-white/5 border border-white/10 text-white py-4 rounded-2xl text-[10px] font-black uppercase tracking-widest hover:bg-white/10 transition-all flex items-center justify-center gap-2 group",children:["Ver Agenda Completa ",s.jsx(Us,{size:14,className:"group-hover:translate-x-1 transition-transform"})]})]})]})]})]})},VO=()=>s.jsx("div",{className:"col-span-3 flex justify-center items-center py-10",children:s.jsx(Ot,{className:"animate-spin text-blue-600",size:32})}),qO=({error:t})=>s.jsxs("div",{className:"col-span-3 text-center py-10 text-red-500 uppercase font-bold text-sm",children:["ERRO AO CARREGAR LEADS: ",t.message]}),$O=({onClose:t,onSaved:e})=>{const n=$e(),[r,i]=A.useState({nome:"",sobrenome:"",whatsapp:"",tipoInteresse:"Particular"});A.useEffect(()=>{const d=f=>{f.key==="Escape"&&t()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t]);const c=async d=>{if(d.preventDefault(),!r.nome||!r.whatsapp){n.error("PREENCHA NOME E WHATSAPP.");return}try{await K.saveLead({...r,status:"Novo",dataCadastro:new Date().toISOString()}),n.success("LEAD CADASTRADO!"),e(),t()}catch{n.error("ERRO AO CADASTRAR LEAD.")}};return s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-green-50 to-white",children:[s.jsxs("h2",{className:"text-base font-bold text-gray-800 uppercase flex items-center gap-2",children:[s.jsx(Ud,{size:18,className:"text-green-500"})," CADASTRAR NOVO LEAD"]}),s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:c,className:"space-y-4 max-w-2xl mx-auto",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"NOME"}),s.jsx("input",{type:"text",value:r.nome,onChange:d=>i(f=>({...f,nome:d.target.value.toUpperCase()})),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 text-sm font-semibold uppercase-input",placeholder:"NOME",required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"SOBRENOME"}),s.jsx("input",{type:"text",value:r.sobrenome,onChange:d=>i(f=>({...f,sobrenome:d.target.value.toUpperCase()})),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 text-sm font-semibold uppercase-input",placeholder:"SOBRENOME"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"WHATSAPP"}),s.jsx("input",{type:"text",value:r.whatsapp,onChange:d=>i(f=>({...f,whatsapp:d.target.value})),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 text-sm",placeholder:"(XX) XXXXX-XXXX",required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"TIPO DE INTERESSE"}),s.jsxs("select",{value:r.tipoInteresse,onChange:d=>i(f=>({...f,tipoInteresse:d.target.value})),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 text-sm bg-white uppercase-select",children:[s.jsx("option",{value:"Particular",children:"PARTICULAR"}),s.jsx("option",{value:"Plano",children:"PLANO"})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-6",children:[s.jsx("button",{type:"button",onClick:t,className:"px-6 py-2.5 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-sm uppercase",children:"CANCELAR"}),s.jsxs("button",{type:"submit",className:"px-6 py-2.5 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg text-sm uppercase flex items-center gap-2",children:[s.jsx(Ud,{size:16})," CADASTRAR"]})]})]})})]})})},YO=()=>{const{data:t,isLoading:e,error:n,refresh:r}=Ie(K.getLeads),{data:i}=Ie(K.getDentistas),[c,d]=A.useState(!1),[f,h]=A.useState(!1),[p,b]=A.useState(null),[y,x]=A.useState("TODOS"),[v,N]=A.useState(!1),j=$e();A.useEffect(()=>{if(!c)return;const D=C=>{C.key==="Escape"&&d(!1)};return document.addEventListener("keydown",D),()=>{document.removeEventListener("keydown",D)}},[c]);const S=async D=>{if(D.preventDefault(),!!p)try{j.info(`FUNCIONALIDADE DE CONVERSÃO PARA ${p.nome} EM DESENVOLVIMENTO.`),d(!1)}catch{j.error("FALHA AO CONVERTER LEAD.")}},R=["TODOS","NOVO","CONVERTIDO"],w=t==null?void 0:t.filter(D=>{var C;return y==="TODOS"?!0:((C=D.status)==null?void 0:C.toUpperCase())===y});return s.jsxs("div",{className:"space-y-6",children:[s.jsx(fn,{title:"GESTÃO DE LEADS",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>N(D=>!D),className:"bg-white border border-gray-300 text-gray-600 px-3 py-2 rounded-lg text-sm flex items-center gap-2 hover:bg-gray-50 uppercase font-bold",children:[s.jsx(yu,{size:16}),y,s.jsx(Lo,{size:14,className:`transition-transform ${v?"rotate-180":""}`})]}),v&&s.jsx("div",{className:"absolute right-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg z-10 min-w-[140px]",children:R.map(D=>s.jsx("button",{onClick:()=>{x(D),N(!1)},className:`w-full text-left px-4 py-2 text-sm font-bold uppercase hover:bg-gray-50 ${y===D?"text-blue-600 bg-blue-50":"text-gray-700"}`,children:D},D))})]}),s.jsxs("button",{onClick:()=>h(!0),className:"bg-green-600 text-white px-4 py-2 rounded-lg text-sm flex items-center gap-2 hover:bg-green-700 uppercase font-bold shadow-sm",children:[s.jsx(gt,{size:16})," NOVO LEAD"]})]})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[e&&s.jsx(VO,{}),n&&s.jsx(qO,{error:n}),w&&w.map(D=>s.jsxs("div",{className:`bg-white rounded-xl shadow-sm border ${D.status==="Novo"?"border-amber-200 bg-amber-50/30":"border-gray-200"} p-6 relative`,children:[D.status==="Novo"&&s.jsx("div",{className:"absolute top-4 right-4 w-2 h-2 bg-amber-500 rounded-full animate-pulse"}),s.jsxs("div",{className:"flex items-start justify-between mb-4",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-900 uppercase",children:[D.nome," ",D.sobrenome]}),s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1 mt-1 font-medium",children:[s.jsx(Mg,{size:14})," ",D.whatsapp]})]}),s.jsx("span",{className:`px-2 py-1 text-xs font-bold rounded uppercase ${D.tipoInteresse==="Particular"?"bg-orange-100 text-orange-800":"bg-purple-100 text-purple-800"}`,children:D.tipoInteresse})]}),s.jsxs("div",{className:"text-xs text-gray-400 mb-6 font-bold uppercase",children:["CADASTRADO EM: ",new Date(D.dataCadastro).toLocaleDateString()]}),D.status!=="Convertido"?s.jsxs("button",{onClick:()=>{b(D),d(!0)},className:"w-full py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg flex items-center justify-center gap-2 font-bold transition-colors uppercase text-xs",children:[s.jsx(Ud,{size:18})," AGENDAR E CADASTRAR"]}):s.jsxs("div",{className:"w-full py-2 bg-gray-100 text-gray-500 rounded-lg flex items-center justify-center gap-2 font-bold uppercase text-xs",children:[s.jsx(Ga,{size:18})," CONVERTIDO"]})]},D.id)),(w==null?void 0:w.length)===0&&!e&&s.jsx("div",{className:"col-span-3 text-center py-10 text-gray-400 uppercase font-bold text-sm",children:"NENHUM LEAD ENCONTRADO."})]}),c&&p&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-blue-50 to-white",children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-800 uppercase flex items-center gap-2",children:[s.jsx(Ud,{size:18,className:"text-blue-500"})," CONVERTER LEAD"]}),s.jsx("button",{onClick:()=>d(!1),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:S,className:"space-y-4 max-w-2xl mx-auto",children:[s.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg mb-4 text-xs text-blue-800 border border-blue-100 font-bold uppercase",children:["AO SALVAR, O SISTEMA IRÁ AUTOMATICAMENTE ",s.jsx("strong",{children:"CADASTRAR O PACIENTE"})," E CRIAR O AGENDAMENTO."]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-700 mb-1 uppercase",children:"PACIENTE"}),s.jsx("input",{disabled:!0,value:`${p.nome} ${p.sobrenome}`.toUpperCase(),className:"w-full bg-gray-100 border border-gray-300 rounded-lg p-2.5 text-gray-500 uppercase font-bold"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-700 mb-1 uppercase",children:"DATA AGENDAMENTO"}),s.jsx("input",{type:"date",required:!0,className:"w-full border border-gray-300 rounded-lg p-2.5 font-semibold"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-700 mb-1 uppercase",children:"HORA"}),s.jsx("input",{type:"time",required:!0,className:"w-full border border-gray-300 rounded-lg p-2.5 font-semibold"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-700 mb-1 uppercase",children:"DENTISTA RESPONSÁVEL"}),s.jsx("select",{className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select font-semibold",children:i&&i.map(D=>s.jsx("option",{value:D.id,children:D.nome},D.id))})]}),s.jsx("div",{className:"pt-6",children:s.jsx("button",{type:"submit",className:"w-full bg-green-600 text-white py-3 rounded-lg font-bold hover:bg-green-700 uppercase text-sm shadow-sm transition-all",children:"CONFIRMAR AGENDAMENTO"})})]})})]})}),f&&s.jsx($O,{onClose:()=>h(!1),onSaved:r})]})},QO=()=>{const[t,e]=A.useState({nome:"",sobrenome:"",cpf:"",whatsapp:"",tipo:""}),[n,r]=A.useState(!1),[i,c]=A.useState(!1),d=$e(),f=async p=>{if(p.preventDefault(),r(!0),!t.tipo){d.error("POR FAVOR, SELECIONE PARTICULAR OU PLANO."),r(!1);return}try{if(await K.checkCpfExists(t.cpf)){d.error("CPF JÁ CADASTRADO. ENTRE EM CONTATO PELO WHATSAPP."),r(!1);return}await K.saveLead({nome:t.nome,sobrenome:t.sobrenome,cpf:t.cpf,whatsapp:t.whatsapp,tipoInteresse:t.tipo}),c(!0)}catch{d.error("ERRO AO ENVIAR DADOS. TENTE NOVAMENTE.")}finally{r(!1)}},h=p=>{e({...t,[p.target.name]:p.target.value.toUpperCase()})};return i?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white p-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-green-100 text-green-600 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx(Ga,{size:32})}),s.jsx("h2",{className:"text-xl font-bold text-amber-900 uppercase",children:"MENSAGEM ENVIADA!"}),s.jsx("p",{className:"text-amber-800 mt-2 uppercase font-bold text-sm",children:"NOSSA EQUIPE ENTRARÁ EM CONTATO EM BREVE."})]})}):s.jsx("div",{className:"min-h-screen bg-white flex flex-col items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-md",children:[s.jsx("h1",{className:"text-center font-bold text-xl mb-6 text-black uppercase",children:"DEIXE SEU CONTATO"}),s.jsxs("form",{onSubmit:f,className:"space-y-4",children:[s.jsx("input",{type:"text",name:"nome",placeholder:"NOME",className:"w-full border border-amber-700 rounded-lg p-3 text-gray-800 outline-none focus:ring-2 focus:ring-amber-500 placeholder-gray-500 uppercase-input",required:!0,value:t.nome,onChange:h}),s.jsx("input",{type:"text",name:"sobrenome",placeholder:"SOBRENOME",className:"w-full border border-amber-700 rounded-lg p-3 text-gray-800 outline-none focus:ring-2 focus:ring-amber-500 placeholder-gray-500 uppercase-input",required:!0,value:t.sobrenome,onChange:h}),s.jsx("input",{type:"text",name:"cpf",placeholder:"CPF",className:"w-full border border-amber-700 rounded-lg p-3 text-gray-800 outline-none focus:ring-2 focus:ring-amber-500 placeholder-gray-500 uppercase-input",required:!0,value:t.cpf,onChange:h}),s.jsx("input",{type:"text",name:"whatsapp",placeholder:"WHATSAPP",className:"w-full border border-amber-700 rounded-lg p-3 text-gray-800 outline-none focus:ring-2 focus:ring-amber-500 placeholder-gray-500 uppercase-input",required:!0,value:t.whatsapp,onChange:h}),s.jsxs("div",{className:"flex gap-4",children:[s.jsx("button",{type:"button",onClick:()=>e({...t,tipo:"Particular"}),className:`flex-1 py-3 rounded-lg font-bold uppercase text-sm transition-colors border ${t.tipo==="Particular"?"bg-amber-800 text-white border-amber-800":"bg-amber-600 text-white border-amber-600 hover:bg-amber-700"}`,children:"PARTICULAR"}),s.jsx("button",{type:"button",onClick:()=>e({...t,tipo:"Plano"}),className:`flex-1 py-3 rounded-lg font-bold uppercase text-sm transition-colors border ${t.tipo==="Plano"?"bg-purple-800 text-white border-purple-800":"bg-purple-600 text-white border-purple-600 hover:bg-purple-700"}`,children:"PLANO"})]}),s.jsx("button",{type:"submit",disabled:n,className:"w-full py-4 bg-gray-800 text-white font-bold rounded-lg mt-6 shadow-sm hover:opacity-90 transition-opacity uppercase disabled:bg-gray-400",children:n?"VERIFICANDO...":"ENVIAR"})]})]})})};function Kt(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var WO=typeof Symbol=="function"&&Symbol.observable||"@@observable",cv=WO,dv=()=>Math.random().toString(36).substring(7).split("").join("."),XO={INIT:`@@redux/INIT${dv()}`,REPLACE:`@@redux/REPLACE${dv()}`},uv=XO;function ZO(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function KN(t,e,n){if(typeof t!="function")throw new Error(Kt(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Kt(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Kt(1));return n(KN)(t,e)}let r=t,i=e,c=new Map,d=c,f=0,h=!1;function p(){d===c&&(d=new Map,c.forEach((S,R)=>{d.set(R,S)}))}function b(){if(h)throw new Error(Kt(3));return i}function y(S){if(typeof S!="function")throw new Error(Kt(4));if(h)throw new Error(Kt(5));let R=!0;p();const w=f++;return d.set(w,S),function(){if(R){if(h)throw new Error(Kt(6));R=!1,p(),d.delete(w),c=null}}}function x(S){if(!ZO(S))throw new Error(Kt(7));if(typeof S.type>"u")throw new Error(Kt(8));if(typeof S.type!="string")throw new Error(Kt(17));if(h)throw new Error(Kt(9));try{h=!0,i=r(i,S)}finally{h=!1}return(c=d).forEach(w=>{w()}),S}function v(S){if(typeof S!="function")throw new Error(Kt(10));r=S,x({type:uv.REPLACE})}function N(){const S=y;return{subscribe(R){if(typeof R!="object"||R===null)throw new Error(Kt(11));function w(){const C=R;C.next&&C.next(b())}return w(),{unsubscribe:S(w)}},[cv](){return this}}}return x({type:uv.INIT}),{dispatch:x,subscribe:y,getState:b,replaceReducer:v,[cv]:N}}function fv(t,e){return function(...n){return e(t.apply(this,n))}}function hv(t,e){if(typeof t=="function")return fv(t,e);if(typeof t!="object"||t===null)throw new Error(Kt(16));const n={};for(const r in t){const i=t[r];typeof i=="function"&&(n[r]=fv(i,e))}return n}function JN(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function KO(...t){return e=>(n,r)=>{const i=e(n,r);let c=()=>{throw new Error(Kt(15))};const d={getState:i.getState,dispatch:(h,...p)=>c(h,...p)},f=t.map(h=>h(d));return c=JN(...f)(i.dispatch),{...i,dispatch:c}}}var ip={exports:{}},op={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var pv;function JO(){if(pv)return op;pv=1;var t=xu();function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,c=t.useEffect,d=t.useMemo,f=t.useDebugValue;return op.useSyncExternalStoreWithSelector=function(h,p,b,y,x){var v=i(null);if(v.current===null){var N={hasValue:!1,value:null};v.current=N}else N=v.current;v=d(function(){function S(I){if(!R){if(R=!0,w=I,I=y(I),x!==void 0&&N.hasValue){var L=N.value;if(x(L,I))return D=L}return D=I}if(L=D,n(w,I))return L;var F=y(I);return x!==void 0&&x(L,F)?(w=I,L):(w=I,D=F)}var R=!1,w,D,C=b===void 0?null:b;return[function(){return S(p())},C===null?void 0:function(){return S(C())}]},[p,b,y,x]);var j=r(h,v[0],v[1]);return c(function(){N.hasValue=!0,N.value=j},[j]),f(j),j},op}var gv;function eR(){return gv||(gv=1,ip.exports=JO()),ip.exports}eR();var tR=A.version.startsWith("19"),nR=Symbol.for(tR?"react.transitional.element":"react.element"),aR=Symbol.for("react.portal"),sR=Symbol.for("react.fragment"),rR=Symbol.for("react.strict_mode"),lR=Symbol.for("react.profiler"),iR=Symbol.for("react.consumer"),oR=Symbol.for("react.context"),eE=Symbol.for("react.forward_ref"),cR=Symbol.for("react.suspense"),dR=Symbol.for("react.suspense_list"),Lg=Symbol.for("react.memo"),uR=Symbol.for("react.lazy"),fR=eE,hR=Lg;function pR(t){if(typeof t=="object"&&t!==null){const{$$typeof:e}=t;switch(e){case nR:switch(t=t.type,t){case sR:case lR:case rR:case cR:case dR:return t;default:switch(t=t&&t.$$typeof,t){case oR:case eE:case uR:case Lg:return t;case iR:return t;default:return e}}case aR:return e}}}function gR(t){return pR(t)===Lg}function mR(t,e,n,r,{areStatesEqual:i,areOwnPropsEqual:c,areStatePropsEqual:d}){let f=!1,h,p,b,y,x;function v(w,D){return h=w,p=D,b=t(h,p),y=e(r,p),x=n(b,y,p),f=!0,x}function N(){return b=t(h,p),e.dependsOnOwnProps&&(y=e(r,p)),x=n(b,y,p),x}function j(){return t.dependsOnOwnProps&&(b=t(h,p)),e.dependsOnOwnProps&&(y=e(r,p)),x=n(b,y,p),x}function S(){const w=t(h,p),D=!d(w,b);return b=w,D&&(x=n(b,y,p)),x}function R(w,D){const C=!c(D,p),I=!i(w,h,D,p);return h=w,p=D,C&&I?N():C?j():I?S():x}return function(D,C){return f?R(D,C):v(D,C)}}function xR(t,{initMapStateToProps:e,initMapDispatchToProps:n,initMergeProps:r,...i}){const c=e(t,i),d=n(t,i),f=r(t,i);return mR(c,d,f,t,i)}function bR(t,e){const n={};for(const r in t){const i=t[r];typeof i=="function"&&(n[r]=(...c)=>e(i(...c)))}return n}function Vp(t){return function(n){const r=t(n);function i(){return r}return i.dependsOnOwnProps=!1,i}}function mv(t){return t.dependsOnOwnProps?!!t.dependsOnOwnProps:t.length!==1}function tE(t,e){return function(r,{displayName:i}){const c=function(f,h){return c.dependsOnOwnProps?c.mapToProps(f,h):c.mapToProps(f,void 0)};return c.dependsOnOwnProps=!0,c.mapToProps=function(f,h){c.mapToProps=t,c.dependsOnOwnProps=mv(t);let p=c(f,h);return typeof p=="function"&&(c.mapToProps=p,c.dependsOnOwnProps=mv(p),p=c(f,h)),p},c}}function zg(t,e){return(n,r)=>{throw new Error(`Invalid value of type ${typeof t} for ${e} argument when connecting component ${r.wrappedComponentName}.`)}}function yR(t){return t&&typeof t=="object"?Vp(e=>bR(t,e)):t?typeof t=="function"?tE(t):zg(t,"mapDispatchToProps"):Vp(e=>({dispatch:e}))}function vR(t){return t?typeof t=="function"?tE(t):zg(t,"mapStateToProps"):Vp(()=>({}))}function NR(t,e,n){return{...n,...t,...e}}function ER(t){return function(n,{displayName:r,areMergedPropsEqual:i}){let c=!1,d;return function(h,p,b){const y=t(h,p,b);return c?i(y,d)||(d=y):(c=!0,d=y),d}}}function jR(t){return t?typeof t=="function"?ER(t):zg(t,"mergeProps"):()=>NR}function SR(t){t()}function AR(){let t=null,e=null;return{clear(){t=null,e=null},notify(){SR(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var xv={notify(){},get:()=>[]};function nE(t,e){let n,r=xv,i=0,c=!1;function d(j){b();const S=r.subscribe(j);let R=!1;return()=>{R||(R=!0,S(),y())}}function f(){r.notify()}function h(){N.onStateChange&&N.onStateChange()}function p(){return c}function b(){i++,n||(n=e?e.addNestedSub(h):t.subscribe(h),r=AR())}function y(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=xv)}function x(){c||(c=!0,b())}function v(){c&&(c=!1,y())}const N={addNestedSub:d,notifyNestedSubs:f,handleChangeWrapper:h,isSubscribed:p,trySubscribe:x,tryUnsubscribe:v,getListeners:()=>r};return N}var wR=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",CR=wR(),DR=()=>typeof navigator<"u"&&navigator.product==="ReactNative",OR=DR(),RR=()=>CR||OR?A.useLayoutEffect:A.useEffect,Bd=RR();function bv(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function cp(t,e){if(bv(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;it(...e),n)}function GR(t,e,n,r,i,c){t.current=r,n.current=!1,i.current&&(i.current=null,c())}function FR(t,e,n,r,i,c,d,f,h,p,b){if(!t)return()=>{};let y=!1,x=null;const v=()=>{if(y||!f.current)return;const j=e.getState();let S,R;try{S=r(j,i.current)}catch(w){R=w,x=w}R||(x=null),S===c.current?d.current||p():(c.current=S,h.current=S,d.current=!0,b())};return n.onStateChange=v,n.trySubscribe(),v(),()=>{if(y=!0,n.tryUnsubscribe(),n.onStateChange=null,x)throw x}}function VR(t,e){return t===e}function qR(t,e,n,{pure:r,areStatesEqual:i=VR,areOwnPropsEqual:c=cp,areStatePropsEqual:d=cp,areMergedPropsEqual:f=cp,forwardRef:h=!1,context:p=sE}={}){const b=p,y=vR(t),x=yR(e),v=jR(n),N=!!t;return S=>{const R=S.displayName||S.name||"Component",w=`Connect(${R})`,D={shouldHandleStateChanges:N,displayName:w,wrappedComponentName:R,WrappedComponent:S,initMapStateToProps:y,initMapDispatchToProps:x,initMergeProps:v,areStatesEqual:i,areStatePropsEqual:d,areOwnPropsEqual:c,areMergedPropsEqual:f};function C(F){const[Y,$,M]=A.useMemo(()=>{const{reactReduxForwardedRef:fe,...W}=F;return[F.context,fe,W]},[F]),H=A.useMemo(()=>{let fe=b;return Y!=null&&Y.Consumer,fe},[Y,b]),ne=A.useContext(H),ee=!!F.store&&!!F.store.getState&&!!F.store.dispatch,he=!!ne&&!!ne.store,pe=ee?F.store:ne.store,z=he?ne.getServerState:pe.getState,oe=A.useMemo(()=>xR(pe.dispatch,D),[pe]),[G,te]=A.useMemo(()=>{if(!N)return BR;const fe=nE(pe,ee?void 0:ne.subscription),W=fe.notifyNestedSubs.bind(fe);return[fe,W]},[pe,ee,ne]),re=A.useMemo(()=>ee?ne:{...ne,subscription:G},[ee,ne,G]),T=A.useRef(void 0),X=A.useRef(M),le=A.useRef(void 0),se=A.useRef(!1),Ne=A.useRef(!1),Ae=A.useRef(void 0);Bd(()=>(Ne.current=!0,()=>{Ne.current=!1}),[]);const Re=A.useMemo(()=>()=>le.current&&M===X.current?le.current:oe(pe.getState(),M),[pe,M]),ft=A.useMemo(()=>W=>G?FR(N,pe,G,oe,X,T,se,Ne,le,te,W):()=>{},[G]);HR(GR,[X,T,se,M,le,te]);let Le;try{Le=A.useSyncExternalStore(ft,Re,z?()=>oe(z(),M):Re)}catch(fe){throw Ae.current&&(fe.message+=` +The error may be correlated with this previous error: +${Ae.current.stack} + +`),fe}Bd(()=>{Ae.current=void 0,le.current=void 0,T.current=Le});const St=A.useMemo(()=>A.createElement(S,{...Le,ref:$}),[$,S,Le]);return A.useMemo(()=>N?A.createElement(H.Provider,{value:re},St):St,[H,St,re])}const L=A.memo(C);if(L.WrappedComponent=S,L.displayName=C.displayName=w,h){const Y=A.forwardRef(function(M,H){return A.createElement(L,{...M,reactReduxForwardedRef:H})});return Y.displayName=w,Y.WrappedComponent=S,qp(Y,S)}return qp(L,S)}}var rE=qR;function $R(t){const{children:e,context:n,serverState:r,store:i}=t,c=A.useMemo(()=>{const h=nE(i);return{store:i,subscription:h,getServerState:r?()=>r:void 0}},[i,r]),d=A.useMemo(()=>i.getState(),[i]);Bd(()=>{const{subscription:h}=c;return h.onStateChange=h.notifyNestedSubs,h.trySubscribe(),d!==i.getState()&&h.notifyNestedSubs(),()=>{h.tryUnsubscribe(),h.onStateChange=void 0}},[c,d]);const f=n||sE;return A.createElement(f.Provider,{value:c},e)}var YR=$R,QR="Invariant failed";function WR(t,e){throw new Error(QR)}var ta=function(e){var n=e.top,r=e.right,i=e.bottom,c=e.left,d=r-c,f=i-n,h={top:n,right:r,bottom:i,left:c,width:d,height:f,x:c,y:n,center:{x:(r+c)/2,y:(i+n)/2}};return h},Pg=function(e,n){return{top:e.top-n.top,left:e.left-n.left,bottom:e.bottom+n.bottom,right:e.right+n.right}},Ev=function(e,n){return{top:e.top+n.top,left:e.left+n.left,bottom:e.bottom-n.bottom,right:e.right-n.right}},XR=function(e,n){return{top:e.top+n.y,left:e.left+n.x,bottom:e.bottom+n.y,right:e.right+n.x}},fp={top:0,right:0,bottom:0,left:0},Ug=function(e){var n=e.borderBox,r=e.margin,i=r===void 0?fp:r,c=e.border,d=c===void 0?fp:c,f=e.padding,h=f===void 0?fp:f,p=ta(Pg(n,i)),b=ta(Ev(n,d)),y=ta(Ev(b,h));return{marginBox:p,borderBox:ta(n),paddingBox:b,contentBox:y,margin:i,border:d,padding:h}},Vn=function(e){var n=e.slice(0,-2),r=e.slice(-2);if(r!=="px")return 0;var i=Number(n);return isNaN(i)&&WR(),i},ZR=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Hd=function(e,n){var r=e.borderBox,i=e.border,c=e.margin,d=e.padding,f=XR(r,n);return Ug({borderBox:f,border:i,margin:c,padding:d})},Gd=function(e,n){return n===void 0&&(n=ZR()),Hd(e,n)},lE=function(e,n){var r={top:Vn(n.marginTop),right:Vn(n.marginRight),bottom:Vn(n.marginBottom),left:Vn(n.marginLeft)},i={top:Vn(n.paddingTop),right:Vn(n.paddingRight),bottom:Vn(n.paddingBottom),left:Vn(n.paddingLeft)},c={top:Vn(n.borderTopWidth),right:Vn(n.borderRightWidth),bottom:Vn(n.borderBottomWidth),left:Vn(n.borderLeftWidth)};return Ug({borderBox:e,margin:r,padding:i,border:c})},iE=function(e){var n=e.getBoundingClientRect(),r=window.getComputedStyle(e);return lE(n,r)},mo=function(e){var n=[],r=null,i=function(){for(var d=arguments.length,f=new Array(d),h=0;h{const c=KR(n,i.options);return t.addEventListener(i.eventName,i.fn,c),function(){t.removeEventListener(i.eventName,i.fn,c)}});return function(){r.forEach(c=>{c()})}}const JR="Invariant failed";class Vd extends Error{}Vd.prototype.toString=function(){return this.message};function ge(t,e){throw new Vd(JR)}let eT=class extends qe.Component{constructor(...e){super(...e),this.callbacks=null,this.unbind=Is,this.onWindowError=n=>{const r=this.getCallbacks();r.isDragging()&&r.tryAbort(),n.error instanceof Vd&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in ");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=$n(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(e){if(e instanceof Vd){this.setState({});return}throw e}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}};const tT=` + Press space bar to start a drag. + When dragging you can use the arrow keys to move the item around and escape to cancel. + Some screen readers may require you to be in focus mode or to use your pass through key +`,qd=t=>t+1,nT=t=>` + You have lifted an item in position ${qd(t.source.index)} +`,cE=(t,e)=>{const n=t.droppableId===e.droppableId,r=qd(t.index),i=qd(e.index);return n?` + You have moved the item from position ${r} + to position ${i} + `:` + You have moved the item from position ${r} + in list ${t.droppableId} + to list ${e.droppableId} + in position ${i} + `},dE=(t,e,n)=>e.droppableId===n.droppableId?` + The item ${t} + has been combined with ${n.draggableId}`:` + The item ${t} + in list ${e.droppableId} + has been combined with ${n.draggableId} + in list ${n.droppableId} + `,aT=t=>{const e=t.destination;if(e)return cE(t.source,e);const n=t.combine;return n?dE(t.draggableId,t.source,n):"You are over an area that cannot be dropped on"},jv=t=>` + The item has returned to its starting position + of ${qd(t.index)} +`,sT=t=>{if(t.reason==="CANCEL")return` + Movement cancelled. + ${jv(t.source)} + `;const e=t.destination,n=t.combine;return e?` + You have dropped the item. + ${cE(t.source,e)} + `:n?` + You have dropped the item. + ${dE(t.draggableId,t.source,n)} + `:` + The item has been dropped while not over a drop area. + ${jv(t.source)} + `},Od={dragHandleUsageInstructions:tT,onDragStart:nT,onDragUpdate:aT,onDragEnd:sT};function rT(t,e){return!!(t===e||Number.isNaN(t)&&Number.isNaN(e))}function uE(t,e){if(t.length!==e.length)return!1;for(let n=0;n({inputs:e,result:t()}))[0],r=A.useRef(!0),i=A.useRef(n),d=r.current||!!(e&&i.current.inputs&&uE(e,i.current.inputs))?i.current:{inputs:e,result:t()};return A.useEffect(()=>{r.current=!1,i.current=d},[d]),d.result}function je(t,e){return Ye(()=>t,e)}const Lt={x:0,y:0},Ft=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),wn=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),Ls=(t,e)=>t.x===e.x&&t.y===e.y,Xl=t=>({x:t.x!==0?-t.x:0,y:t.y!==0?-t.y:0}),Or=(t,e,n=0)=>t==="x"?{x:e,y:n}:{x:n,y:e},xo=(t,e)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),Sv=(t,e)=>Math.min(...e.map(n=>xo(t,n))),fE=t=>e=>({x:t(e.x),y:t(e.y)});var lT=(t,e)=>{const n=ta({top:Math.max(e.top,t.top),right:Math.min(e.right,t.right),bottom:Math.min(e.bottom,t.bottom),left:Math.max(e.left,t.left)});return n.width<=0||n.height<=0?null:n};const Ho=(t,e)=>({top:t.top+e.y,left:t.left+e.x,bottom:t.bottom+e.y,right:t.right+e.x}),Av=t=>[{x:t.left,y:t.top},{x:t.right,y:t.top},{x:t.left,y:t.bottom},{x:t.right,y:t.bottom}],iT={top:0,right:0,bottom:0,left:0},oT=(t,e)=>e?Ho(t,e.scroll.diff.displacement):t,cT=(t,e,n)=>n&&n.increasedBy?{...t,[e.end]:t[e.end]+n.increasedBy[e.line]}:t,dT=(t,e)=>e&&e.shouldClipSubject?lT(e.pageMarginBox,t):ta(t);var Bl=({page:t,withPlaceholder:e,axis:n,frame:r})=>{const i=oT(t.marginBox,r),c=cT(i,n,e),d=dT(c,r);return{page:t,withPlaceholder:e,active:d}},Bg=(t,e)=>{t.frame||ge();const n=t.frame,r=wn(e,n.scroll.initial),i=Xl(r),c={...n,scroll:{initial:n.scroll.initial,current:e,diff:{value:r,displacement:i},max:n.scroll.max}},d=Bl({page:t.subject.page,withPlaceholder:t.subject.withPlaceholder,axis:t.axis,frame:c});return{...t,frame:c,subject:d}};function Mt(t,e=uE){let n=null;function r(...i){if(n&&n.lastThis===this&&e(i,n.lastArgs))return n.lastResult;const c=t.apply(this,i);return n={lastResult:c,lastArgs:i,lastThis:this},c}return r.clear=function(){n=null},r}const hE=Mt(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),pE=Mt(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),Nu=Mt(t=>Object.values(t)),uT=Mt(t=>Object.values(t));var Zl=Mt((t,e)=>uT(e).filter(r=>t===r.descriptor.droppableId).sort((r,i)=>r.descriptor.index-i.descriptor.index));function Hg(t){return t.at&&t.at.type==="REORDER"?t.at.destination:null}function Eu(t){return t.at&&t.at.type==="COMBINE"?t.at.combine:null}var ju=Mt((t,e)=>e.filter(n=>n.descriptor.id!==t.descriptor.id)),fT=({isMovingForward:t,draggable:e,destination:n,insideDestination:r,previousImpact:i})=>{if(!n.isCombineEnabled||!Hg(i))return null;function d(v){const N={type:"COMBINE",combine:{draggableId:v,droppableId:n.descriptor.id}};return{...i,at:N}}const f=i.displaced.all,h=f.length?f[0]:null;if(t)return h?d(h):null;const p=ju(e,r);if(!h){if(!p.length)return null;const v=p[p.length-1];return d(v.descriptor.id)}const b=p.findIndex(v=>v.descriptor.id===h);b===-1&&ge();const y=b-1;if(y<0)return null;const x=p[y];return d(x.descriptor.id)},Kl=(t,e)=>t.descriptor.droppableId===e.descriptor.id;const gE={point:Lt,value:0},bo={invisible:{},visible:{},all:[]},hT={displaced:bo,displacedBy:gE,at:null};var Yn=(t,e)=>n=>t<=n&&n<=e,mE=t=>{const e=Yn(t.top,t.bottom),n=Yn(t.left,t.right);return r=>{if(e(r.top)&&e(r.bottom)&&n(r.left)&&n(r.right))return!0;const c=e(r.top)||e(r.bottom),d=n(r.left)||n(r.right);if(c&&d)return!0;const h=r.topt.bottom,p=r.leftt.right;return h&&p?!0:h&&d||p&&c}},pT=t=>{const e=Yn(t.top,t.bottom),n=Yn(t.left,t.right);return r=>e(r.top)&&e(r.bottom)&&n(r.left)&&n(r.right)};const Gg={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},xE={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var gT=t=>e=>{const n=Yn(e.top,e.bottom),r=Yn(e.left,e.right);return i=>t===Gg?n(i.top)&&n(i.bottom):r(i.left)&&r(i.right)};const mT=(t,e)=>{const n=e.frame?e.frame.scroll.diff.displacement:Lt;return Ho(t,n)},xT=(t,e,n)=>e.subject.active?n(e.subject.active)(t):!1,bT=(t,e,n)=>n(e)(t),Fg=({target:t,destination:e,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:i})=>{const c=r?mT(t,e):t;return xT(c,e,i)&&bT(c,n,i)},yT=t=>Fg({...t,isVisibleThroughFrameFn:mE}),bE=t=>Fg({...t,isVisibleThroughFrameFn:pT}),vT=t=>Fg({...t,isVisibleThroughFrameFn:gT(t.destination.axis)}),NT=(t,e,n)=>{if(typeof n=="boolean")return n;if(!e)return!0;const{invisible:r,visible:i}=e;if(r[t])return!1;const c=i[t];return c?c.shouldAnimate:!0};function ET(t,e){const n=t.page.marginBox,r={top:e.point.y,right:0,bottom:0,left:e.point.x};return ta(Pg(n,r))}function yo({afterDragging:t,destination:e,displacedBy:n,viewport:r,forceShouldAnimate:i,last:c}){return t.reduce(function(f,h){const p=ET(h,n),b=h.descriptor.id;if(f.all.push(b),!yT({target:p,destination:e,viewport:r,withDroppableDisplacement:!0}))return f.invisible[h.descriptor.id]=!0,f;const x=NT(b,c,i),v={draggableId:b,shouldAnimate:x};return f.visible[b]=v,f},{all:[],visible:{},invisible:{}})}function jT(t,e){if(!t.length)return 0;const n=t[t.length-1].descriptor.index;return e.inHomeList?n:n+1}function wv({insideDestination:t,inHomeList:e,displacedBy:n,destination:r}){const i=jT(t,{inHomeList:e});return{displaced:bo,displacedBy:n,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:i}}}}function $d({draggable:t,insideDestination:e,destination:n,viewport:r,displacedBy:i,last:c,index:d,forceShouldAnimate:f}){const h=Kl(t,n);if(d==null)return wv({insideDestination:e,inHomeList:h,displacedBy:i,destination:n});const p=e.find(N=>N.descriptor.index===d);if(!p)return wv({insideDestination:e,inHomeList:h,displacedBy:i,destination:n});const b=ju(t,e),y=e.indexOf(p),x=b.slice(y);return{displaced:yo({afterDragging:x,destination:n,displacedBy:i,last:c,viewport:r.frame,forceShouldAnimate:f}),displacedBy:i,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:d}}}}function Bs(t,e){return!!e.effected[t]}var ST=({isMovingForward:t,destination:e,draggables:n,combine:r,afterCritical:i})=>{if(!e.isCombineEnabled)return null;const c=r.draggableId,f=n[c].descriptor.index;return Bs(c,i)?t?f:f-1:t?f+1:f},AT=({isMovingForward:t,isInHomeList:e,insideDestination:n,location:r})=>{if(!n.length)return null;const i=r.index,c=t?i+1:i-1,d=n[0].descriptor.index,f=n[n.length-1].descriptor.index,h=e?f:f+1;return ch?null:c},wT=({isMovingForward:t,isInHomeList:e,draggable:n,draggables:r,destination:i,insideDestination:c,previousImpact:d,viewport:f,afterCritical:h})=>{const p=d.at;if(p||ge(),p.type==="REORDER"){const y=AT({isMovingForward:t,isInHomeList:e,location:p.destination,insideDestination:c});return y==null?null:$d({draggable:n,insideDestination:c,destination:i,viewport:f,last:d.displaced,displacedBy:d.displacedBy,index:y})}const b=ST({isMovingForward:t,destination:i,displaced:d.displaced,draggables:r,combine:p.combine,afterCritical:h});return b==null?null:$d({draggable:n,insideDestination:c,destination:i,viewport:f,last:d.displaced,displacedBy:d.displacedBy,index:b})},CT=({displaced:t,afterCritical:e,combineWith:n,displacedBy:r})=>{const i=!!(t.visible[n]||t.invisible[n]);return Bs(n,e)?i?Lt:Xl(r.point):i?r.point:Lt},DT=({afterCritical:t,impact:e,draggables:n})=>{const r=Eu(e);r||ge();const i=r.draggableId,c=n[i].page.borderBox.center,d=CT({displaced:e.displaced,afterCritical:t,combineWith:i,displacedBy:e.displacedBy});return Ft(c,d)};const yE=(t,e)=>e.margin[t.start]+e.borderBox[t.size]/2,OT=(t,e)=>e.margin[t.end]+e.borderBox[t.size]/2,Vg=(t,e,n)=>e[t.crossAxisStart]+n.margin[t.crossAxisStart]+n.borderBox[t.crossAxisSize]/2,Cv=({axis:t,moveRelativeTo:e,isMoving:n})=>Or(t.line,e.marginBox[t.end]+yE(t,n),Vg(t,e.marginBox,n)),Dv=({axis:t,moveRelativeTo:e,isMoving:n})=>Or(t.line,e.marginBox[t.start]-OT(t,n),Vg(t,e.marginBox,n)),RT=({axis:t,moveInto:e,isMoving:n})=>Or(t.line,e.contentBox[t.start]+yE(t,n),Vg(t,e.contentBox,n));var TT=({impact:t,draggable:e,draggables:n,droppable:r,afterCritical:i})=>{const c=Zl(r.descriptor.id,n),d=e.page,f=r.axis;if(!c.length)return RT({axis:f,moveInto:r.page,isMoving:d});const{displaced:h,displacedBy:p}=t,b=h.all[0];if(b){const x=n[b];if(Bs(b,i))return Dv({axis:f,moveRelativeTo:x.page,isMoving:d});const v=Hd(x.page,p.point);return Dv({axis:f,moveRelativeTo:v,isMoving:d})}const y=c[c.length-1];if(y.descriptor.id===e.descriptor.id)return d.borderBox.center;if(Bs(y.descriptor.id,i)){const x=Hd(y.page,Xl(i.displacedBy.point));return Cv({axis:f,moveRelativeTo:x,isMoving:d})}return Cv({axis:f,moveRelativeTo:y.page,isMoving:d})},$p=(t,e)=>{const n=t.frame;return n?Ft(e,n.scroll.diff.displacement):e};const kT=({impact:t,draggable:e,droppable:n,draggables:r,afterCritical:i})=>{const c=e.page.borderBox.center,d=t.at;return!n||!d?c:d.type==="REORDER"?TT({impact:t,draggable:e,draggables:r,droppable:n,afterCritical:i}):DT({impact:t,draggables:r,afterCritical:i})};var Su=t=>{const e=kT(t),n=t.droppable;return n?$p(n,e):e},vE=(t,e)=>{const n=wn(e,t.scroll.initial),r=Xl(n);return{frame:ta({top:e.y,bottom:e.y+t.frame.height,left:e.x,right:e.x+t.frame.width}),scroll:{initial:t.scroll.initial,max:t.scroll.max,current:e,diff:{value:n,displacement:r}}}};function Ov(t,e){return t.map(n=>e[n])}function _T(t,e){for(let n=0;n{const c=vE(e,Ft(e.scroll.current,i)),d=n.frame?Bg(n,Ft(n.frame.scroll.current,i)):n,f=t.displaced,h=yo({afterDragging:Ov(f.all,r),destination:n,displacedBy:t.displacedBy,viewport:c.frame,last:f,forceShouldAnimate:!1}),p=yo({afterDragging:Ov(f.all,r),destination:d,displacedBy:t.displacedBy,viewport:e.frame,last:f,forceShouldAnimate:!1}),b={},y={},x=[f,h,p];return f.all.forEach(N=>{const j=_T(N,x);if(j){y[N]=j;return}b[N]=!0}),{...t,displaced:{all:f.all,invisible:b,visible:y}}},IT=(t,e)=>Ft(t.scroll.diff.displacement,e),qg=({pageBorderBoxCenter:t,draggable:e,viewport:n})=>{const r=IT(n,t),i=wn(r,e.page.borderBox.center);return Ft(e.client.borderBox.center,i)},NE=({draggable:t,destination:e,newPageBorderBoxCenter:n,viewport:r,withDroppableDisplacement:i,onlyOnMainAxis:c=!1})=>{const d=wn(n,t.page.borderBox.center),h={target:Ho(t.page.borderBox,d),destination:e,withDroppableDisplacement:i,viewport:r};return c?vT(h):bE(h)},LT=({isMovingForward:t,draggable:e,destination:n,draggables:r,previousImpact:i,viewport:c,previousPageBorderBoxCenter:d,previousClientSelection:f,afterCritical:h})=>{if(!n.isEnabled)return null;const p=Zl(n.descriptor.id,r),b=Kl(e,n),y=fT({isMovingForward:t,draggable:e,destination:n,insideDestination:p,previousImpact:i})||wT({isMovingForward:t,isInHomeList:b,draggable:e,draggables:r,destination:n,insideDestination:p,previousImpact:i,viewport:c,afterCritical:h});if(!y)return null;const x=Su({impact:y,draggable:e,droppable:n,draggables:r,afterCritical:h});if(NE({draggable:e,destination:n,newPageBorderBoxCenter:x,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:qg({pageBorderBoxCenter:x,draggable:e,viewport:c}),impact:y,scrollJumpRequest:null};const N=wn(x,d),j=MT({impact:y,viewport:c,destination:n,draggables:r,maxScrollChange:N});return{clientSelection:f,impact:j,scrollJumpRequest:N}};const Zt=t=>{const e=t.subject.active;return e||ge(),e};var zT=({isMovingForward:t,pageBorderBoxCenter:e,source:n,droppables:r,viewport:i})=>{const c=n.subject.active;if(!c)return null;const d=n.axis,f=Yn(c[d.start],c[d.end]),h=Nu(r).filter(b=>b!==n).filter(b=>b.isEnabled).filter(b=>!!b.subject.active).filter(b=>mE(i.frame)(Zt(b))).filter(b=>{const y=Zt(b);return t?c[d.crossAxisEnd]{const y=Zt(b),x=Yn(y[d.start],y[d.end]);return f(y[d.start])||f(y[d.end])||x(c[d.start])||x(c[d.end])}).sort((b,y)=>{const x=Zt(b)[d.crossAxisStart],v=Zt(y)[d.crossAxisStart];return t?x-v:v-x}).filter((b,y,x)=>Zt(b)[d.crossAxisStart]===Zt(x[0])[d.crossAxisStart]);if(!h.length)return null;if(h.length===1)return h[0];const p=h.filter(b=>Yn(Zt(b)[d.start],Zt(b)[d.end])(e[d.line]));return p.length===1?p[0]:p.length>1?p.sort((b,y)=>Zt(b)[d.start]-Zt(y)[d.start])[0]:h.sort((b,y)=>{const x=Sv(e,Av(Zt(b))),v=Sv(e,Av(Zt(y)));return x!==v?x-v:Zt(b)[d.start]-Zt(y)[d.start]})[0]};const Rv=(t,e)=>{const n=t.page.borderBox.center;return Bs(t.descriptor.id,e)?wn(n,e.displacedBy.point):n},PT=(t,e)=>{const n=t.page.borderBox;return Bs(t.descriptor.id,e)?Ho(n,Xl(e.displacedBy.point)):n};var UT=({pageBorderBoxCenter:t,viewport:e,destination:n,insideDestination:r,afterCritical:i})=>r.filter(d=>bE({target:PT(d,i),destination:n,viewport:e.frame,withDroppableDisplacement:!0})).sort((d,f)=>{const h=xo(t,$p(n,Rv(d,i))),p=xo(t,$p(n,Rv(f,i)));return h{const r=t.axis;if(t.descriptor.mode==="virtual")return Or(r.line,e[r.line]);const i=t.subject.page.contentBox[r.size],h=Zl(t.descriptor.id,n).reduce((p,b)=>p+b.client.marginBox[r.size],0)+e[r.line]-i;return h<=0?null:Or(r.line,h)},EE=(t,e)=>({...t,scroll:{...t.scroll,max:e}}),jE=(t,e,n)=>{const r=t.frame;Kl(e,t)&&ge(),t.subject.withPlaceholder&&ge();const i=Go(t.axis,e.displaceBy).point,c=BT(t,i,n),d={placeholderSize:i,increasedBy:c,oldFrameMaxScroll:t.frame?t.frame.scroll.max:null};if(!r){const b=Bl({page:t.subject.page,withPlaceholder:d,axis:t.axis,frame:t.frame});return{...t,subject:b}}const f=c?Ft(r.scroll.max,c):r.scroll.max,h=EE(r,f),p=Bl({page:t.subject.page,withPlaceholder:d,axis:t.axis,frame:h});return{...t,subject:p,frame:h}},HT=t=>{const e=t.subject.withPlaceholder;e||ge();const n=t.frame;if(!n){const d=Bl({page:t.subject.page,axis:t.axis,frame:null,withPlaceholder:null});return{...t,subject:d}}const r=e.oldFrameMaxScroll;r||ge();const i=EE(n,r),c=Bl({page:t.subject.page,axis:t.axis,frame:i,withPlaceholder:null});return{...t,subject:c,frame:i}};var GT=({previousPageBorderBoxCenter:t,moveRelativeTo:e,insideDestination:n,draggable:r,draggables:i,destination:c,viewport:d,afterCritical:f})=>{if(!e){if(n.length)return null;const y={displaced:bo,displacedBy:gE,at:{type:"REORDER",destination:{droppableId:c.descriptor.id,index:0}}},x=Su({impact:y,draggable:r,droppable:c,draggables:i,afterCritical:f}),v=Kl(r,c)?c:jE(c,r,i);return NE({draggable:r,destination:v,newPageBorderBoxCenter:x,viewport:d.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?y:null}const h=t[c.axis.line]<=e.page.borderBox.center[c.axis.line],p=(()=>{const y=e.descriptor.index;return e.descriptor.id===r.descriptor.id||h?y:y+1})(),b=Go(c.axis,r.displaceBy);return $d({draggable:r,insideDestination:n,destination:c,viewport:d,displacedBy:b,last:bo,index:p})},FT=({isMovingForward:t,previousPageBorderBoxCenter:e,draggable:n,isOver:r,draggables:i,droppables:c,viewport:d,afterCritical:f})=>{const h=zT({isMovingForward:t,pageBorderBoxCenter:e,source:r,droppables:c,viewport:d});if(!h)return null;const p=Zl(h.descriptor.id,i),b=UT({pageBorderBoxCenter:e,viewport:d,destination:h,insideDestination:p,afterCritical:f}),y=GT({previousPageBorderBoxCenter:e,destination:h,draggable:n,draggables:i,moveRelativeTo:b,insideDestination:p,viewport:d,afterCritical:f});if(!y)return null;const x=Su({impact:y,draggable:n,droppable:h,draggables:i,afterCritical:f});return{clientSelection:qg({pageBorderBoxCenter:x,draggable:n,viewport:d}),impact:y,scrollJumpRequest:null}},Cn=t=>{const e=t.at;return e?e.type==="REORDER"?e.destination.droppableId:e.combine.droppableId:null};const VT=(t,e)=>{const n=Cn(t);return n?e[n]:null};var qT=({state:t,type:e})=>{const n=VT(t.impact,t.dimensions.droppables),r=!!n,i=t.dimensions.droppables[t.critical.droppable.id],c=n||i,d=c.axis.direction,f=d==="vertical"&&(e==="MOVE_UP"||e==="MOVE_DOWN")||d==="horizontal"&&(e==="MOVE_LEFT"||e==="MOVE_RIGHT");if(f&&!r)return null;const h=e==="MOVE_DOWN"||e==="MOVE_RIGHT",p=t.dimensions.draggables[t.critical.draggable.id],b=t.current.page.borderBoxCenter,{draggables:y,droppables:x}=t.dimensions;return f?LT({isMovingForward:h,previousPageBorderBoxCenter:b,draggable:p,destination:c,draggables:y,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):FT({isMovingForward:h,previousPageBorderBoxCenter:b,draggable:p,isOver:c,draggables:y,droppables:x,viewport:t.viewport,afterCritical:t.afterCritical})};function cr(t){return t.phase==="DRAGGING"||t.phase==="COLLECTING"}function SE(t){const e=Yn(t.top,t.bottom),n=Yn(t.left,t.right);return function(i){return e(i.y)&&n(i.x)}}function $T(t,e){return t.lefte.left&&t.tope.top}function YT({pageBorderBox:t,draggable:e,candidates:n}){const r=e.page.borderBox.center,i=n.map(c=>{const d=c.axis,f=Or(c.axis.line,t.center[d.line],c.page.borderBox.center[d.crossAxisLine]);return{id:c.descriptor.id,distance:xo(r,f)}}).sort((c,d)=>d.distance-c.distance);return i[0]?i[0].id:null}function QT({pageBorderBox:t,draggable:e,droppables:n}){const r=Nu(n).filter(i=>{if(!i.isEnabled)return!1;const c=i.subject.active;if(!c||!$T(t,c))return!1;if(SE(c)(t.center))return!0;const d=i.axis,f=c.center[d.crossAxisLine],h=t[d.crossAxisStart],p=t[d.crossAxisEnd],b=Yn(c[d.crossAxisStart],c[d.crossAxisEnd]),y=b(h),x=b(p);return!y&&!x?!0:y?hf});return r.length?r.length===1?r[0].descriptor.id:YT({pageBorderBox:t,draggable:e,candidates:r}):null}const AE=(t,e)=>ta(Ho(t,e));var WT=(t,e)=>{const n=t.frame;return n?AE(e,n.scroll.diff.value):e};function wE({displaced:t,id:e}){return!!(t.visible[e]||t.invisible[e])}function XT({draggable:t,closest:e,inHomeList:n}){return e?n&&e.descriptor.index>t.descriptor.index?e.descriptor.index-1:e.descriptor.index:null}var ZT=({pageBorderBoxWithDroppableScroll:t,draggable:e,destination:n,insideDestination:r,last:i,viewport:c,afterCritical:d})=>{const f=n.axis,h=Go(n.axis,e.displaceBy),p=h.value,b=t[f.start],y=t[f.end],v=ju(e,r).find(j=>{const S=j.descriptor.id,R=j.page.borderBox.center[f.line],w=Bs(S,d),D=wE({displaced:i,id:S});return w?D?y<=R:b{if(!r.isCombineEnabled)return null;const d=r.axis,f=Go(r.axis,t.displaceBy),h=f.value,p=e[d.start],b=e[d.end],x=ju(t,i).find(N=>{const j=N.descriptor.id,S=N.page.borderBox,w=S[d.size]/KT,D=Bs(j,c),C=wE({displaced:n.displaced,id:j});return D?C?b>S[d.start]+w&&bS[d.start]-h+w&&pS[d.start]+h+w&&bS[d.start]+w&&p{const f=AE(e.page.borderBox,t),h=QT({pageBorderBox:f,draggable:e,droppables:r});if(!h)return hT;const p=r[h],b=Zl(p.descriptor.id,n),y=WT(p,f);return JT({pageBorderBoxWithDroppableScroll:y,draggable:e,previousImpact:i,destination:p,insideDestination:b,afterCritical:d})||ZT({pageBorderBoxWithDroppableScroll:y,draggable:e,destination:p,insideDestination:b,last:i.displaced,viewport:c,afterCritical:d})},$g=(t,e)=>({...t,[e.descriptor.id]:e});const ek=({previousImpact:t,impact:e,droppables:n})=>{const r=Cn(t),i=Cn(e);if(!r||r===i)return n;const c=n[r];if(!c.subject.withPlaceholder)return n;const d=HT(c);return $g(n,d)};var tk=({draggable:t,draggables:e,droppables:n,previousImpact:r,impact:i})=>{const c=ek({previousImpact:r,impact:i,droppables:n}),d=Cn(i);if(!d)return c;const f=n[d];if(Kl(t,f)||f.subject.withPlaceholder)return c;const h=jE(f,t,e);return $g(c,h)},co=({state:t,clientSelection:e,dimensions:n,viewport:r,impact:i,scrollJumpRequest:c})=>{const d=r||t.viewport,f=n||t.dimensions,h=e||t.current.client.selection,p=wn(h,t.initial.client.selection),b={offset:p,selection:h,borderBoxCenter:Ft(t.initial.client.borderBoxCenter,p)},y={selection:Ft(b.selection,d.scroll.current),borderBoxCenter:Ft(b.borderBoxCenter,d.scroll.current),offset:Ft(b.offset,d.scroll.diff.value)},x={client:b,page:y};if(t.phase==="COLLECTING")return{...t,dimensions:f,viewport:d,current:x};const v=f.draggables[t.critical.draggable.id],N=i||CE({pageOffset:y.offset,draggable:v,draggables:f.draggables,droppables:f.droppables,previousImpact:t.impact,viewport:d,afterCritical:t.afterCritical}),j=tk({draggable:v,impact:N,previousImpact:t.impact,draggables:f.draggables,droppables:f.droppables});return{...t,current:x,dimensions:{draggables:f.draggables,droppables:j},impact:N,viewport:d,scrollJumpRequest:c||null,forceShouldAnimate:c?!1:null}};function nk(t,e){return t.map(n=>e[n])}var DE=({impact:t,viewport:e,draggables:n,destination:r,forceShouldAnimate:i})=>{const c=t.displaced,d=nk(c.all,n),f=yo({afterDragging:d,destination:r,displacedBy:t.displacedBy,viewport:e.frame,forceShouldAnimate:i,last:c});return{...t,displaced:f}},OE=({impact:t,draggable:e,droppable:n,draggables:r,viewport:i,afterCritical:c})=>{const d=Su({impact:t,draggable:e,draggables:r,droppable:n,afterCritical:c});return qg({pageBorderBoxCenter:d,draggable:e,viewport:i})},RE=({state:t,dimensions:e,viewport:n})=>{t.movementMode!=="SNAP"&&ge();const r=t.impact,i=n||t.viewport,c=e||t.dimensions,{draggables:d,droppables:f}=c,h=d[t.critical.draggable.id],p=Cn(r);p||ge();const b=f[p],y=DE({impact:r,viewport:i,destination:b,draggables:d}),x=OE({impact:y,draggable:h,droppable:b,draggables:d,viewport:i,afterCritical:t.afterCritical});return co({impact:y,clientSelection:x,state:t,dimensions:c,viewport:i})},ak=t=>({index:t.index,droppableId:t.droppableId}),TE=({draggable:t,home:e,draggables:n,viewport:r})=>{const i=Go(e.axis,t.displaceBy),c=Zl(e.descriptor.id,n),d=c.indexOf(t);d===-1&&ge();const f=c.slice(d+1),h=f.reduce((x,v)=>(x[v.descriptor.id]=!0,x),{}),p={inVirtualList:e.descriptor.mode==="virtual",displacedBy:i,effected:h};return{impact:{displaced:yo({afterDragging:f,destination:e,displacedBy:i,last:null,viewport:r.frame,forceShouldAnimate:!1}),displacedBy:i,at:{type:"REORDER",destination:ak(t.descriptor)}},afterCritical:p}},sk=(t,e)=>({draggables:t.draggables,droppables:$g(t.droppables,e)}),rk=({draggable:t,offset:e,initialWindowScroll:n})=>{const r=Hd(t.client,e),i=Gd(r,n);return{...t,placeholder:{...t.placeholder,client:r},client:r,page:i}},lk=t=>{const e=t.frame;return e||ge(),e},ik=({additions:t,updatedDroppables:e,viewport:n})=>{const r=n.scroll.diff.value;return t.map(i=>{const c=i.descriptor.droppableId,d=e[c],h=lk(d).scroll.diff.value,p=Ft(r,h);return rk({draggable:i,offset:p,initialWindowScroll:n.scroll.initial})})},ok=({state:t,published:e})=>{const n=e.modified.map(R=>{const w=t.dimensions.droppables[R.droppableId];return Bg(w,R.scroll)}),r={...t.dimensions.droppables,...hE(n)},i=pE(ik({additions:e.additions,updatedDroppables:r,viewport:t.viewport})),c={...t.dimensions.draggables,...i};e.removals.forEach(R=>{delete c[R]});const d={droppables:r,draggables:c},f=Cn(t.impact),h=f?d.droppables[f]:null,p=d.draggables[t.critical.draggable.id],b=d.droppables[t.critical.droppable.id],{impact:y,afterCritical:x}=TE({draggable:p,home:b,draggables:c,viewport:t.viewport}),v=h&&h.isCombineEnabled?t.impact:y,N=CE({pageOffset:t.current.page.offset,draggable:d.draggables[t.critical.draggable.id],draggables:d.draggables,droppables:d.droppables,previousImpact:v,viewport:t.viewport,afterCritical:x}),j={...t,phase:"DRAGGING",impact:N,onLiftImpact:y,dimensions:d,afterCritical:x,forceShouldAnimate:!1};return t.phase==="COLLECTING"?j:{...j,phase:"DROP_PENDING",reason:t.reason,isWaiting:!1}};const Yp=t=>t.movementMode==="SNAP",hp=(t,e,n)=>{const r=sk(t.dimensions,e);return!Yp(t)||n?co({state:t,dimensions:r}):RE({state:t,dimensions:r})};function pp(t){return t.isDragging&&t.movementMode==="SNAP"?{...t,scrollJumpRequest:null}:t}const Tv={phase:"IDLE",completed:null,shouldFlush:!1};var ck=(t=Tv,e)=>{if(e.type==="FLUSH")return{...Tv,shouldFlush:!0};if(e.type==="INITIAL_PUBLISH"){t.phase!=="IDLE"&&ge();const{critical:n,clientSelection:r,viewport:i,dimensions:c,movementMode:d}=e.payload,f=c.draggables[n.draggable.id],h=c.droppables[n.droppable.id],p={selection:r,borderBoxCenter:f.client.borderBox.center,offset:Lt},b={client:p,page:{selection:Ft(p.selection,i.scroll.initial),borderBoxCenter:Ft(p.selection,i.scroll.initial),offset:Ft(p.selection,i.scroll.diff.value)}},y=Nu(c.droppables).every(j=>!j.isFixedOnPage),{impact:x,afterCritical:v}=TE({draggable:f,home:h,draggables:c.draggables,viewport:i});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:d,dimensions:c,initial:b,current:b,isWindowScrollAllowed:y,impact:x,afterCritical:v,onLiftImpact:x,viewport:i,scrollJumpRequest:null,forceShouldAnimate:null}}if(e.type==="COLLECTION_STARTING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"?t:(t.phase!=="DRAGGING"&&ge(),{...t,phase:"COLLECTING"});if(e.type==="PUBLISH_WHILE_DRAGGING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"||ge(),ok({state:t,published:e.payload});if(e.type==="MOVE"){if(t.phase==="DROP_PENDING")return t;cr(t)||ge();const{client:n}=e.payload;return Ls(n,t.current.client.selection)?t:co({state:t,clientSelection:n,impact:Yp(t)?t.impact:null})}if(e.type==="UPDATE_DROPPABLE_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="COLLECTING")return pp(t);cr(t)||ge();const{id:n,newScroll:r}=e.payload,i=t.dimensions.droppables[n];if(!i)return t;const c=Bg(i,r);return hp(t,c,!1)}if(e.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(t.phase==="DROP_PENDING")return t;cr(t)||ge();const{id:n,isEnabled:r}=e.payload,i=t.dimensions.droppables[n];i||ge(),i.isEnabled===r&&ge();const c={...i,isEnabled:r};return hp(t,c,!0)}if(e.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(t.phase==="DROP_PENDING")return t;cr(t)||ge();const{id:n,isCombineEnabled:r}=e.payload,i=t.dimensions.droppables[n];i||ge(),i.isCombineEnabled===r&&ge();const c={...i,isCombineEnabled:r};return hp(t,c,!0)}if(e.type==="MOVE_BY_WINDOW_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="DROP_ANIMATING")return t;cr(t)||ge(),t.isWindowScrollAllowed||ge();const n=e.payload.newScroll;if(Ls(t.viewport.scroll.current,n))return pp(t);const r=vE(t.viewport,n);return Yp(t)?RE({state:t,viewport:r}):co({state:t,viewport:r})}if(e.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!cr(t))return t;const n=e.payload.maxScroll;if(Ls(n,t.viewport.scroll.max))return t;const r={...t.viewport,scroll:{...t.viewport.scroll,max:n}};return{...t,viewport:r}}if(e.type==="MOVE_UP"||e.type==="MOVE_DOWN"||e.type==="MOVE_LEFT"||e.type==="MOVE_RIGHT"){if(t.phase==="COLLECTING"||t.phase==="DROP_PENDING")return t;t.phase!=="DRAGGING"&&ge();const n=qT({state:t,type:e.type});return n?co({state:t,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):t}if(e.type==="DROP_PENDING"){const n=e.payload.reason;return t.phase!=="COLLECTING"&&ge(),{...t,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(e.type==="DROP_ANIMATE"){const{completed:n,dropDuration:r,newHomeClientOffset:i}=e.payload;return t.phase==="DRAGGING"||t.phase==="DROP_PENDING"||ge(),{phase:"DROP_ANIMATING",completed:n,dropDuration:r,newHomeClientOffset:i,dimensions:t.dimensions}}if(e.type==="DROP_COMPLETE"){const{completed:n}=e.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return t};function Ke(t,e){return t instanceof Object&&"type"in t&&t.type===e}const dk=t=>({type:"BEFORE_INITIAL_CAPTURE",payload:t}),uk=t=>({type:"LIFT",payload:t}),fk=t=>({type:"INITIAL_PUBLISH",payload:t}),hk=t=>({type:"PUBLISH_WHILE_DRAGGING",payload:t}),pk=()=>({type:"COLLECTION_STARTING",payload:null}),gk=t=>({type:"UPDATE_DROPPABLE_SCROLL",payload:t}),mk=t=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:t}),xk=t=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:t}),kE=t=>({type:"MOVE",payload:t}),bk=t=>({type:"MOVE_BY_WINDOW_SCROLL",payload:t}),yk=t=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:t}),vk=()=>({type:"MOVE_UP",payload:null}),Nk=()=>({type:"MOVE_DOWN",payload:null}),Ek=()=>({type:"MOVE_RIGHT",payload:null}),jk=()=>({type:"MOVE_LEFT",payload:null}),Yg=()=>({type:"FLUSH",payload:null}),Sk=t=>({type:"DROP_ANIMATE",payload:t}),Qg=t=>({type:"DROP_COMPLETE",payload:t}),_E=t=>({type:"DROP",payload:t}),Ak=t=>({type:"DROP_PENDING",payload:t}),ME=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var wk=t=>({getState:e,dispatch:n})=>r=>i=>{if(!Ke(i,"LIFT")){r(i);return}const{id:c,clientSelection:d,movementMode:f}=i.payload,h=e();h.phase==="DROP_ANIMATING"&&n(Qg({completed:h.completed})),e().phase!=="IDLE"&&ge(),n(Yg()),n(dk({draggableId:c,movementMode:f}));const b={draggableId:c,scrollOptions:{shouldPublishImmediately:f==="SNAP"}},{critical:y,dimensions:x,viewport:v}=t.startPublishing(b);n(fk({critical:y,dimensions:x,clientSelection:d,movementMode:f,viewport:v}))},Ck=t=>()=>e=>n=>{Ke(n,"INITIAL_PUBLISH")&&t.dragging(),Ke(n,"DROP_ANIMATE")&&t.dropping(n.payload.completed.result.reason),(Ke(n,"FLUSH")||Ke(n,"DROP_COMPLETE"))&&t.resting(),e(n)};const Wg={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},vo={opacity:{drop:0,combining:.7},scale:{drop:.75}},IE={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},or=`${IE.outOfTheWay}s ${Wg.outOfTheWay}`,uo={fluid:`opacity ${or}`,snap:`transform ${or}, opacity ${or}`,drop:t=>{const e=`${t}s ${Wg.drop}`;return`transform ${e}, opacity ${e}`},outOfTheWay:`transform ${or}`,placeholder:`height ${or}, width ${or}, margin ${or}`},kv=t=>Ls(t,Lt)?void 0:`translate(${t.x}px, ${t.y}px)`,Qp={moveTo:kv,drop:(t,e)=>{const n=kv(t);if(n)return e?`${n} scale(${vo.scale.drop})`:n}},{minDropTime:Wp,maxDropTime:LE}=IE,Dk=LE-Wp,_v=1500,Ok=.6;var Rk=({current:t,destination:e,reason:n})=>{const r=xo(t,e);if(r<=0)return Wp;if(r>=_v)return LE;const i=r/_v,c=Wp+Dk*i,d=n==="CANCEL"?c*Ok:c;return Number(d.toFixed(2))},Tk=({impact:t,draggable:e,dimensions:n,viewport:r,afterCritical:i})=>{const{draggables:c,droppables:d}=n,f=Cn(t),h=f?d[f]:null,p=d[e.descriptor.droppableId],b=OE({impact:t,draggable:e,draggables:c,afterCritical:i,droppable:h||p,viewport:r});return wn(b,e.client.borderBox.center)},kk=({draggables:t,reason:e,lastImpact:n,home:r,viewport:i,onLiftImpact:c})=>!n.at||e!=="DROP"?{impact:DE({draggables:t,impact:c,destination:r,viewport:i,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:bo},didDropInsideDroppable:!0};const _k=({getState:t,dispatch:e})=>n=>r=>{if(!Ke(r,"DROP")){n(r);return}const i=t(),c=r.payload.reason;if(i.phase==="COLLECTING"){e(Ak({reason:c}));return}if(i.phase==="IDLE")return;i.phase==="DROP_PENDING"&&i.isWaiting&&ge(),i.phase==="DRAGGING"||i.phase==="DROP_PENDING"||ge();const f=i.critical,h=i.dimensions,p=h.draggables[i.critical.draggable.id],{impact:b,didDropInsideDroppable:y}=kk({reason:c,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),x=y?Hg(b):null,v=y?Eu(b):null,N={index:f.draggable.index,droppableId:f.droppable.id},j={draggableId:p.descriptor.id,type:p.descriptor.type,source:N,reason:c,mode:i.movementMode,destination:x,combine:v},S=Tk({impact:b,draggable:p,dimensions:h,viewport:i.viewport,afterCritical:i.afterCritical}),R={critical:i.critical,afterCritical:i.afterCritical,result:j,impact:b};if(!(!Ls(i.current.client.offset,S)||!!j.combine)){e(Qg({completed:R}));return}const D=Rk({current:i.current.client.offset,destination:S,reason:c});e(Sk({newHomeClientOffset:S,dropDuration:D,completed:R}))};var zE=()=>({x:window.pageXOffset,y:window.pageYOffset});function Mk(t){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:e=>{e.target!==window&&e.target!==window.document||t()}}}function Ik({onWindowScroll:t}){function e(){t(zE())}const n=mo(e),r=Mk(n);let i=Is;function c(){return i!==Is}function d(){c()&&ge(),i=$n(window,[r])}function f(){c()||ge(),n.cancel(),i(),i=Is}return{start:d,stop:f,isActive:c}}const Lk=t=>Ke(t,"DROP_COMPLETE")||Ke(t,"DROP_ANIMATE")||Ke(t,"FLUSH"),zk=t=>{const e=Ik({onWindowScroll:n=>{t.dispatch(bk({newScroll:n}))}});return n=>r=>{!e.isActive()&&Ke(r,"INITIAL_PUBLISH")&&e.start(),e.isActive()&&Lk(r)&&e.stop(),n(r)}};var Pk=t=>{let e=!1,n=!1;const r=setTimeout(()=>{n=!0}),i=c=>{e||n||(e=!0,t(c),clearTimeout(r))};return i.wasCalled=()=>e,i},Uk=()=>{const t=[],e=i=>{const c=t.findIndex(f=>f.timerId===i);c===-1&&ge();const[d]=t.splice(c,1);d.callback()};return{add:i=>{const c=setTimeout(()=>e(c)),d={timerId:c,callback:i};t.push(d)},flush:()=>{if(!t.length)return;const i=[...t];t.length=0,i.forEach(c=>{clearTimeout(c.timerId),c.callback()})}}};const Bk=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.droppableId===e.droppableId&&t.index===e.index,Hk=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.draggableId===e.draggableId&&t.droppableId===e.droppableId,Gk=(t,e)=>{if(t===e)return!0;const n=t.draggable.id===e.draggable.id&&t.draggable.droppableId===e.draggable.droppableId&&t.draggable.type===e.draggable.type&&t.draggable.index===e.draggable.index,r=t.droppable.id===e.droppable.id&&t.droppable.type===e.droppable.type;return n&&r},Ji=(t,e)=>{e()},hd=(t,e)=>({draggableId:t.draggable.id,type:t.droppable.type,source:{droppableId:t.droppable.id,index:t.draggable.index},mode:e});function gp(t,e,n,r){if(!t){n(r(e));return}const i=Pk(n);t(e,{announce:i}),i.wasCalled()||n(r(e))}var Fk=(t,e)=>{const n=Uk();let r=null;const i=(y,x)=>{r&&ge(),Ji("onBeforeCapture",()=>{const v=t().onBeforeCapture;v&&v({draggableId:y,mode:x})})},c=(y,x)=>{r&&ge(),Ji("onBeforeDragStart",()=>{const v=t().onBeforeDragStart;v&&v(hd(y,x))})},d=(y,x)=>{r&&ge();const v=hd(y,x);r={mode:x,lastCritical:y,lastLocation:v.source,lastCombine:null},n.add(()=>{Ji("onDragStart",()=>gp(t().onDragStart,v,e,Od.onDragStart))})},f=(y,x)=>{const v=Hg(x),N=Eu(x);r||ge();const j=!Gk(y,r.lastCritical);j&&(r.lastCritical=y);const S=!Bk(r.lastLocation,v);S&&(r.lastLocation=v);const R=!Hk(r.lastCombine,N);if(R&&(r.lastCombine=N),!j&&!S&&!R)return;const w={...hd(y,r.mode),combine:N,destination:v};n.add(()=>{Ji("onDragUpdate",()=>gp(t().onDragUpdate,w,e,Od.onDragUpdate))})},h=()=>{r||ge(),n.flush()},p=y=>{r||ge(),r=null,Ji("onDragEnd",()=>gp(t().onDragEnd,y,e,Od.onDragEnd))};return{beforeCapture:i,beforeStart:c,start:d,update:f,flush:h,drop:p,abort:()=>{if(!r)return;const y={...hd(r.lastCritical,r.mode),combine:null,destination:null,reason:"CANCEL"};p(y)}}},Vk=(t,e)=>{const n=Fk(t,e);return r=>i=>c=>{if(Ke(c,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(c.payload.draggableId,c.payload.movementMode);return}if(Ke(c,"INITIAL_PUBLISH")){const f=c.payload.critical;n.beforeStart(f,c.payload.movementMode),i(c),n.start(f,c.payload.movementMode);return}if(Ke(c,"DROP_COMPLETE")){const f=c.payload.completed.result;n.flush(),i(c),n.drop(f);return}if(i(c),Ke(c,"FLUSH")){n.abort();return}const d=r.getState();d.phase==="DRAGGING"&&n.update(d.critical,d.impact)}};const qk=t=>e=>n=>{if(!Ke(n,"DROP_ANIMATION_FINISHED")){e(n);return}const r=t.getState();r.phase!=="DROP_ANIMATING"&&ge(),t.dispatch(Qg({completed:r.completed}))},$k=t=>{let e=null,n=null;function r(){n&&(cancelAnimationFrame(n),n=null),e&&(e(),e=null)}return i=>c=>{if((Ke(c,"FLUSH")||Ke(c,"DROP_COMPLETE")||Ke(c,"DROP_ANIMATION_FINISHED"))&&r(),i(c),!Ke(c,"DROP_ANIMATE"))return;const d={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){t.getState().phase==="DROP_ANIMATING"&&t.dispatch(ME())}};n=requestAnimationFrame(()=>{n=null,e=$n(window,[d])})}};var Yk=t=>()=>e=>n=>{(Ke(n,"DROP_COMPLETE")||Ke(n,"FLUSH")||Ke(n,"DROP_ANIMATE"))&&t.stopPublishing(),e(n)},Qk=t=>{let e=!1;return()=>n=>r=>{if(Ke(r,"INITIAL_PUBLISH")){e=!0,t.tryRecordFocus(r.payload.critical.draggable.id),n(r),t.tryRestoreFocusRecorded();return}if(n(r),!!e){if(Ke(r,"FLUSH")){e=!1,t.tryRestoreFocusRecorded();return}if(Ke(r,"DROP_COMPLETE")){e=!1;const i=r.payload.completed.result;i.combine&&t.tryShiftRecord(i.draggableId,i.combine.draggableId),t.tryRestoreFocusRecorded()}}}};const Wk=t=>Ke(t,"DROP_COMPLETE")||Ke(t,"DROP_ANIMATE")||Ke(t,"FLUSH");var Xk=t=>e=>n=>r=>{if(Wk(r)){t.stop(),n(r);return}if(Ke(r,"INITIAL_PUBLISH")){n(r);const i=e.getState();i.phase!=="DRAGGING"&&ge(),t.start(i);return}n(r),t.scroll(e.getState())};const Zk=t=>e=>n=>{if(e(n),!Ke(n,"PUBLISH_WHILE_DRAGGING"))return;const r=t.getState();r.phase==="DROP_PENDING"&&(r.isWaiting||t.dispatch(_E({reason:r.reason})))},Kk=JN;var Jk=({dimensionMarshal:t,focusMarshal:e,styleMarshal:n,getResponders:r,announce:i,autoScroller:c})=>KN(ck,Kk(KO(Ck(n),Yk(t),wk(t),_k,qk,$k,Zk,Xk(c),zk,Qk(e),Vk(r,i))));const mp=()=>({additions:{},removals:{},modified:{}});function e5({registry:t,callbacks:e}){let n=mp(),r=null;const i=()=>{r||(e.collectionStarting(),r=requestAnimationFrame(()=>{r=null;const{additions:h,removals:p,modified:b}=n,y=Object.keys(h).map(N=>t.draggable.getById(N).getDimension(Lt)).sort((N,j)=>N.descriptor.index-j.descriptor.index),x=Object.keys(b).map(N=>{const S=t.droppable.getById(N).callbacks.getScrollWhileDragging();return{droppableId:N,scroll:S}}),v={additions:y,removals:Object.keys(p),modified:x};n=mp(),e.publish(v)}))};return{add:h=>{const p=h.descriptor.id;n.additions[p]=h,n.modified[h.descriptor.droppableId]=!0,n.removals[p]&&delete n.removals[p],i()},remove:h=>{const p=h.descriptor;n.removals[p.id]=!0,n.modified[p.droppableId]=!0,n.additions[p.id]&&delete n.additions[p.id],i()},stop:()=>{r&&(cancelAnimationFrame(r),r=null,n=mp())}}}var PE=({scrollHeight:t,scrollWidth:e,height:n,width:r})=>{const i=wn({x:e,y:t},{x:r,y:n});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},UE=()=>{const t=document.documentElement;return t||ge(),t},BE=()=>{const t=UE();return PE({scrollHeight:t.scrollHeight,scrollWidth:t.scrollWidth,width:t.clientWidth,height:t.clientHeight})},t5=()=>{const t=zE(),e=BE(),n=t.y,r=t.x,i=UE(),c=i.clientWidth,d=i.clientHeight,f=r+c,h=n+d;return{frame:ta({top:n,left:r,right:f,bottom:h}),scroll:{initial:t,current:t,max:e,diff:{value:Lt,displacement:Lt}}}},n5=({critical:t,scrollOptions:e,registry:n})=>{const r=t5(),i=r.scroll.current,c=t.droppable,d=n.droppable.getAllByType(c.type).map(b=>b.callbacks.getDimensionAndWatchScroll(i,e)),f=n.draggable.getAllByType(t.draggable.type).map(b=>b.getDimension(i));return{dimensions:{draggables:pE(f),droppables:hE(d)},critical:t,viewport:r}};function Mv(t,e,n){return!(n.descriptor.id===e.id||n.descriptor.type!==e.type||t.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual")}var a5=(t,e)=>{let n=null;const r=e5({callbacks:{publish:e.publishWhileDragging,collectionStarting:e.collectionStarting},registry:t}),i=(x,v)=>{t.droppable.exists(x)||ge(),n&&e.updateDroppableIsEnabled({id:x,isEnabled:v})},c=(x,v)=>{n&&(t.droppable.exists(x)||ge(),e.updateDroppableIsCombineEnabled({id:x,isCombineEnabled:v}))},d=(x,v)=>{n&&(t.droppable.exists(x)||ge(),e.updateDroppableScroll({id:x,newScroll:v}))},f=(x,v)=>{n&&t.droppable.getById(x).callbacks.scroll(v)},h=()=>{if(!n)return;r.stop();const x=n.critical.droppable;t.droppable.getAllByType(x.type).forEach(v=>v.callbacks.dragStopped()),n.unsubscribe(),n=null},p=x=>{n||ge();const v=n.critical.draggable;x.type==="ADDITION"&&Mv(t,v,x.value)&&r.add(x.value),x.type==="REMOVAL"&&Mv(t,v,x.value)&&r.remove(x.value)};return{updateDroppableIsEnabled:i,updateDroppableIsCombineEnabled:c,scrollDroppable:f,updateDroppableScroll:d,startPublishing:x=>{n&&ge();const v=t.draggable.getById(x.draggableId),N=t.droppable.getById(v.descriptor.droppableId),j={draggable:v.descriptor,droppable:N.descriptor},S=t.subscribe(p);return n={critical:j,unsubscribe:S},n5({critical:j,registry:t,scrollOptions:x.scrollOptions})},stopPublishing:h}},HE=(t,e)=>t.phase==="IDLE"?!0:t.phase!=="DROP_ANIMATING"||t.completed.result.draggableId===e?!1:t.completed.result.reason==="DROP",s5=t=>{window.scrollBy(t.x,t.y)};const r5=Mt(t=>Nu(t).filter(e=>!(!e.isEnabled||!e.frame))),l5=(t,e)=>r5(e).find(r=>(r.frame||ge(),SE(r.frame.pageMarginBox)(t)))||null;var i5=({center:t,destination:e,droppables:n})=>{if(e){const i=n[e];return i.frame?i:null}return l5(t,n)};const No={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:t=>t**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var o5=(t,e,n=()=>No)=>{const r=n(),i=t[e.size]*r.startFromPercentage,c=t[e.size]*r.maxScrollAtPercentage;return{startScrollingFrom:i,maxScrollValueAt:c}},GE=({startOfRange:t,endOfRange:e,current:n})=>{const r=e-t;return r===0?0:(n-t)/r},Xg=1,c5=(t,e,n=()=>No)=>{const r=n();if(t>e.startScrollingFrom)return 0;if(t<=e.maxScrollValueAt)return r.maxPixelScroll;if(t===e.startScrollingFrom)return Xg;const c=1-GE({startOfRange:e.maxScrollValueAt,endOfRange:e.startScrollingFrom,current:t}),d=r.maxPixelScroll*r.ease(c);return Math.ceil(d)},d5=(t,e,n)=>{const r=n(),i=r.durationDampening.accelerateAt,c=r.durationDampening.stopDampeningAt,d=e,f=c,p=Date.now()-d;if(p>=c)return t;if(p{const c=c5(t,e,i);return c===0?0:r?Math.max(d5(c,n,i),Xg):c},Lv=({container:t,distanceToEdges:e,dragStartTime:n,axis:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const d=o5(t,r,c);return e[r.end]{const r=e.height>t.height,i=e.width>t.width;return!i&&!r?n:i&&r?null:{x:i?0:n.x,y:r?0:n.y}};const f5=fE(t=>t===0?0:t);var FE=({dragStartTime:t,container:e,subject:n,center:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const d={top:r.y-e.top,right:e.right-r.x,bottom:e.bottom-r.y,left:r.x-e.left},f=Lv({container:e,distanceToEdges:d,dragStartTime:t,axis:Gg,shouldUseTimeDampening:i,getAutoScrollerOptions:c}),h=Lv({container:e,distanceToEdges:d,dragStartTime:t,axis:xE,shouldUseTimeDampening:i,getAutoScrollerOptions:c}),p=f5({x:h,y:f});if(Ls(p,Lt))return null;const b=u5({container:e,subject:n,proposedScroll:p});return b?Ls(b,Lt)?null:b:null};const h5=fE(t=>t===0?0:t>0?1:-1),Zg=(()=>{const t=(e,n)=>e<0?e:e>n?e-n:0;return({current:e,max:n,change:r})=>{const i=Ft(e,r),c={x:t(i.x,n.x),y:t(i.y,n.y)};return Ls(c,Lt)?null:c}})(),VE=({max:t,current:e,change:n})=>{const r={x:Math.max(e.x,t.x),y:Math.max(e.y,t.y)},i=h5(n),c=Zg({max:r,current:e,change:i});return!c||i.x!==0&&c.x===0||i.y!==0&&c.y===0},Kg=(t,e)=>VE({current:t.scroll.current,max:t.scroll.max,change:e}),p5=(t,e)=>{if(!Kg(t,e))return null;const n=t.scroll.max,r=t.scroll.current;return Zg({current:r,max:n,change:e})},Jg=(t,e)=>{const n=t.frame;return n?VE({current:n.scroll.current,max:n.scroll.max,change:e}):!1},g5=(t,e)=>{const n=t.frame;return!n||!Jg(t,e)?null:Zg({current:n.scroll.current,max:n.scroll.max,change:e})};var m5=({viewport:t,subject:e,center:n,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const d=FE({dragStartTime:r,container:t.frame,subject:e,center:n,shouldUseTimeDampening:i,getAutoScrollerOptions:c});return d&&Kg(t,d)?d:null},x5=({droppable:t,subject:e,center:n,dragStartTime:r,shouldUseTimeDampening:i,getAutoScrollerOptions:c})=>{const d=t.frame;if(!d)return null;const f=FE({dragStartTime:r,container:d.pageMarginBox,subject:e,center:n,shouldUseTimeDampening:i,getAutoScrollerOptions:c});return f&&Jg(t,f)?f:null},zv=({state:t,dragStartTime:e,shouldUseTimeDampening:n,scrollWindow:r,scrollDroppable:i,getAutoScrollerOptions:c})=>{const d=t.current.page.borderBoxCenter,h=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){const y=t.viewport,x=m5({dragStartTime:e,viewport:y,subject:h,center:d,shouldUseTimeDampening:n,getAutoScrollerOptions:c});if(x){r(x);return}}const p=i5({center:d,destination:Cn(t.impact),droppables:t.dimensions.droppables});if(!p)return;const b=x5({dragStartTime:e,droppable:p,subject:h,center:d,shouldUseTimeDampening:n,getAutoScrollerOptions:c});b&&i(p.descriptor.id,b)},b5=({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n=()=>No})=>{const r=mo(t),i=mo(e);let c=null;const d=p=>{c||ge();const{shouldUseTimeDampening:b,dragStartTime:y}=c;zv({state:p,scrollWindow:r,scrollDroppable:i,dragStartTime:y,shouldUseTimeDampening:b,getAutoScrollerOptions:n})};return{start:p=>{c&&ge();const b=Date.now();let y=!1;const x=()=>{y=!0};zv({state:p,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:x,scrollDroppable:x,getAutoScrollerOptions:n}),c={dragStartTime:b,shouldUseTimeDampening:y},y&&d(p)},stop:()=>{c&&(r.cancel(),i.cancel(),c=null)},scroll:d}},y5=({move:t,scrollDroppable:e,scrollWindow:n})=>{const r=(f,h)=>{const p=Ft(f.current.client.selection,h);t({client:p})},i=(f,h)=>{if(!Jg(f,h))return h;const p=g5(f,h);if(!p)return e(f.descriptor.id,h),null;const b=wn(h,p);return e(f.descriptor.id,b),wn(h,b)},c=(f,h,p)=>{if(!f||!Kg(h,p))return p;const b=p5(h,p);if(!b)return n(p),null;const y=wn(p,b);return n(y),wn(p,y)};return f=>{const h=f.scrollJumpRequest;if(!h)return;const p=Cn(f.impact);p||ge();const b=i(f.dimensions.droppables[p],h);if(!b)return;const y=f.viewport,x=c(f.isWindowScrollAllowed,y,b);x&&r(f,x)}},v5=({scrollDroppable:t,scrollWindow:e,move:n,getAutoScrollerOptions:r})=>{const i=b5({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:r}),c=y5({move:n,scrollWindow:e,scrollDroppable:t});return{scroll:h=>{if(!(r().disabled||h.phase!=="DRAGGING")){if(h.movementMode==="FLUID"){i.scroll(h);return}h.scrollJumpRequest&&c(h)}},start:i.start,stop:i.stop}};const Hl="data-rfd",Gl=(()=>{const t=`${Hl}-drag-handle`;return{base:t,draggableId:`${t}-draggable-id`,contextId:`${t}-context-id`}})(),Xp=(()=>{const t=`${Hl}-draggable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),N5=(()=>{const t=`${Hl}-droppable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),Pv={contextId:`${Hl}-scroll-container-context-id`},E5=t=>e=>`[${e}="${t}"]`,eo=(t,e)=>t.map(n=>{const r=n.styles[e];return r?`${n.selector} { ${r} }`:""}).join(" "),j5="pointer-events: none;";var S5=t=>{const e=E5(t),n=(()=>{const f=` + cursor: -webkit-grab; + cursor: grab; + `;return{selector:e(Gl.contextId),styles:{always:` + -webkit-touch-callout: none; + -webkit-tap-highlight-color: rgba(0,0,0,0); + touch-action: manipulation; + `,resting:f,dragging:j5,dropAnimating:f}}})(),r=(()=>{const f=` + transition: ${uo.outOfTheWay}; + `;return{selector:e(Xp.contextId),styles:{dragging:f,dropAnimating:f,userCancel:f}}})(),i={selector:e(N5.contextId),styles:{always:"overflow-anchor: none;"}},d=[r,n,i,{selector:"body",styles:{dragging:` + cursor: grabbing; + cursor: -webkit-grabbing; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + overflow-anchor: none; + `}}];return{always:eo(d,"always"),resting:eo(d,"resting"),dragging:eo(d,"dragging"),dropAnimating:eo(d,"dropAnimating"),userCancel:eo(d,"userCancel")}};const Dn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?A.useLayoutEffect:A.useEffect,xp=()=>{const t=document.querySelector("head");return t||ge(),t},Uv=t=>{const e=document.createElement("style");return t&&e.setAttribute("nonce",t),e.type="text/css",e};function A5(t,e){const n=Ye(()=>S5(t),[t]),r=A.useRef(null),i=A.useRef(null),c=je(Mt(y=>{const x=i.current;x||ge(),x.textContent=y}),[]),d=je(y=>{const x=r.current;x||ge(),x.textContent=y},[]);Dn(()=>{!r.current&&!i.current||ge();const y=Uv(e),x=Uv(e);return r.current=y,i.current=x,y.setAttribute(`${Hl}-always`,t),x.setAttribute(`${Hl}-dynamic`,t),xp().appendChild(y),xp().appendChild(x),d(n.always),c(n.resting),()=>{const v=N=>{const j=N.current;j||ge(),xp().removeChild(j),N.current=null};v(r),v(i)}},[e,d,c,n.always,n.resting,t]);const f=je(()=>c(n.dragging),[c,n.dragging]),h=je(y=>{if(y==="DROP"){c(n.dropAnimating);return}c(n.userCancel)},[c,n.dropAnimating,n.userCancel]),p=je(()=>{i.current&&c(n.resting)},[c,n.resting]);return Ye(()=>({dragging:f,dropping:h,resting:p}),[f,h,p])}function qE(t,e){return Array.from(t.querySelectorAll(e))}var $E=t=>t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:window;function Au(t){return t instanceof $E(t).HTMLElement}function w5(t,e){const n=`[${Gl.contextId}="${t}"]`,r=qE(document,n);if(!r.length)return null;const i=r.find(c=>c.getAttribute(Gl.draggableId)===e);return!i||!Au(i)?null:i}function C5(t){const e=A.useRef({}),n=A.useRef(null),r=A.useRef(null),i=A.useRef(!1),c=je(function(x,v){const N={id:x,focus:v};return e.current[x]=N,function(){const S=e.current;S[x]!==N&&delete S[x]}},[]),d=je(function(x){const v=w5(t,x);v&&v!==document.activeElement&&v.focus()},[t]),f=je(function(x,v){n.current===x&&(n.current=v)},[]),h=je(function(){r.current||i.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const x=n.current;x&&d(x)}))},[d]),p=je(function(x){n.current=null;const v=document.activeElement;v&&v.getAttribute(Gl.draggableId)===x&&(n.current=x)},[]);return Dn(()=>(i.current=!0,function(){i.current=!1;const x=r.current;x&&cancelAnimationFrame(x)}),[]),Ye(()=>({register:c,tryRecordFocus:p,tryRestoreFocusRecorded:h,tryShiftRecord:f}),[c,p,h,f])}function D5(){const t={draggables:{},droppables:{}},e=[];function n(y){return e.push(y),function(){const v=e.indexOf(y);v!==-1&&e.splice(v,1)}}function r(y){e.length&&e.forEach(x=>x(y))}function i(y){return t.draggables[y]||null}function c(y){const x=i(y);return x||ge(),x}const d={register:y=>{t.draggables[y.descriptor.id]=y,r({type:"ADDITION",value:y})},update:(y,x)=>{const v=t.draggables[x.descriptor.id];v&&v.uniqueId===y.uniqueId&&(delete t.draggables[x.descriptor.id],t.draggables[y.descriptor.id]=y)},unregister:y=>{const x=y.descriptor.id,v=i(x);v&&y.uniqueId===v.uniqueId&&(delete t.draggables[x],t.droppables[y.descriptor.droppableId]&&r({type:"REMOVAL",value:y}))},getById:c,findById:i,exists:y=>!!i(y),getAllByType:y=>Object.values(t.draggables).filter(x=>x.descriptor.type===y)};function f(y){return t.droppables[y]||null}function h(y){const x=f(y);return x||ge(),x}const p={register:y=>{t.droppables[y.descriptor.id]=y},unregister:y=>{const x=f(y.descriptor.id);x&&y.uniqueId===x.uniqueId&&delete t.droppables[y.descriptor.id]},getById:h,findById:f,exists:y=>!!f(y),getAllByType:y=>Object.values(t.droppables).filter(x=>x.descriptor.type===y)};function b(){t.draggables={},t.droppables={},e.length=0}return{draggable:d,droppable:p,subscribe:n,clean:b}}function O5(){const t=Ye(D5,[]);return A.useEffect(()=>function(){t.clean()},[t]),t}var em=qe.createContext(null),Yd=()=>{const t=document.body;return t||ge(),t};const R5={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},T5=t=>`rfd-announcement-${t}`;function k5(t){const e=Ye(()=>T5(t),[t]),n=A.useRef(null);return A.useEffect(function(){const c=document.createElement("div");return n.current=c,c.id=e,c.setAttribute("aria-live","assertive"),c.setAttribute("aria-atomic","true"),Fd(c.style,R5),Yd().appendChild(c),function(){setTimeout(function(){const h=Yd();h.contains(c)&&h.removeChild(c),c===n.current&&(n.current=null)})}},[e]),je(i=>{const c=n.current;if(c){c.textContent=i;return}},[])}const _5={separator:"::"};function tm(t,e=_5){const n=qe.useId();return Ye(()=>`${t}${e.separator}${n}`,[e.separator,t,n])}function M5({contextId:t,uniqueId:e}){return`rfd-hidden-text-${t}-${e}`}function I5({contextId:t,text:e}){const n=tm("hidden-text",{separator:"-"}),r=Ye(()=>M5({contextId:t,uniqueId:n}),[n,t]);return A.useEffect(function(){const c=document.createElement("div");return c.id=r,c.textContent=e,c.style.display="none",Yd().appendChild(c),function(){const f=Yd();f.contains(c)&&f.removeChild(c)}},[r,e]),r}var wu=qe.createContext(null);function YE(t){const e=A.useRef(t);return A.useEffect(()=>{e.current=t}),e}function L5(){let t=null;function e(){return!!t}function n(d){return d===t}function r(d){t&&ge();const f={abandon:d};return t=f,f}function i(){t||ge(),t=null}function c(){t&&(t.abandon(),i())}return{isClaimed:e,isActive:n,claim:r,release:i,tryAbandon:c}}function Eo(t){return t.phase==="IDLE"||t.phase==="DROP_ANIMATING"?!1:t.isDragging}const z5=9,P5=13,nm=27,QE=32,U5=33,B5=34,H5=35,G5=36,F5=37,V5=38,q5=39,$5=40,Y5={[P5]:!0,[z5]:!0};var WE=t=>{Y5[t.keyCode]&&t.preventDefault()};const Cu=(()=>{const t="visibilitychange";return typeof document>"u"?t:[t,`ms${t}`,`webkit${t}`,`moz${t}`,`o${t}`].find(r=>`on${r}`in document)||t})(),XE=0,Bv=5;function Q5(t,e){return Math.abs(e.x-t.x)>=Bv||Math.abs(e.y-t.y)>=Bv}const Hv={type:"IDLE"};function W5({cancel:t,completed:e,getPhase:n,setPhase:r}){return[{eventName:"mousemove",fn:i=>{const{button:c,clientX:d,clientY:f}=i;if(c!==XE)return;const h={x:d,y:f},p=n();if(p.type==="DRAGGING"){i.preventDefault(),p.actions.move(h);return}p.type!=="PENDING"&&ge();const b=p.point;if(!Q5(b,h))return;i.preventDefault();const y=p.actions.fluidLift(h);r({type:"DRAGGING",actions:y})}},{eventName:"mouseup",fn:i=>{const c=n();if(c.type!=="DRAGGING"){t();return}i.preventDefault(),c.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"mousedown",fn:i=>{n().type==="DRAGGING"&&i.preventDefault(),t()}},{eventName:"keydown",fn:i=>{if(n().type==="PENDING"){t();return}if(i.keyCode===nm){i.preventDefault(),t();return}WE(i)}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&t()}},{eventName:"webkitmouseforcedown",fn:i=>{const c=n();if(c.type==="IDLE"&&ge(),c.actions.shouldRespectForcePress()){t();return}i.preventDefault()}},{eventName:Cu,fn:t}]}function X5(t){const e=A.useRef(Hv),n=A.useRef(Is),r=Ye(()=>({eventName:"mousedown",fn:function(y){if(y.defaultPrevented||y.button!==XE||y.ctrlKey||y.metaKey||y.shiftKey||y.altKey)return;const x=t.findClosestDraggableId(y);if(!x)return;const v=t.tryGetLock(x,d,{sourceEvent:y});if(!v)return;y.preventDefault();const N={x:y.clientX,y:y.clientY};n.current(),p(v,N)}}),[t]),i=Ye(()=>({eventName:"webkitmouseforcewillbegin",fn:b=>{if(b.defaultPrevented)return;const y=t.findClosestDraggableId(b);if(!y)return;const x=t.findOptionsForDraggable(y);x&&(x.shouldRespectForcePress||t.canGetLock(y)&&b.preventDefault())}}),[t]),c=je(function(){const y={passive:!1,capture:!0};n.current=$n(window,[i,r],y)},[i,r]),d=je(()=>{e.current.type!=="IDLE"&&(e.current=Hv,n.current(),c())},[c]),f=je(()=>{const b=e.current;d(),b.type==="DRAGGING"&&b.actions.cancel({shouldBlockNextClick:!0}),b.type==="PENDING"&&b.actions.abort()},[d]),h=je(function(){const y={capture:!0,passive:!1},x=W5({cancel:f,completed:d,getPhase:()=>e.current,setPhase:v=>{e.current=v}});n.current=$n(window,x,y)},[f,d]),p=je(function(y,x){e.current.type!=="IDLE"&&ge(),e.current={type:"PENDING",point:x,actions:y},h()},[h]);Dn(function(){return c(),function(){n.current()}},[c])}function Z5(){}const K5={[B5]:!0,[U5]:!0,[G5]:!0,[H5]:!0};function J5(t,e){function n(){e(),t.cancel()}function r(){e(),t.drop()}return[{eventName:"keydown",fn:i=>{if(i.keyCode===nm){i.preventDefault(),n();return}if(i.keyCode===QE){i.preventDefault(),r();return}if(i.keyCode===$5){i.preventDefault(),t.moveDown();return}if(i.keyCode===V5){i.preventDefault(),t.moveUp();return}if(i.keyCode===q5){i.preventDefault(),t.moveRight();return}if(i.keyCode===F5){i.preventDefault(),t.moveLeft();return}if(K5[i.keyCode]){i.preventDefault();return}WE(i)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:Cu,fn:n}]}function e_(t){const e=A.useRef(Z5),n=Ye(()=>({eventName:"keydown",fn:function(c){if(c.defaultPrevented||c.keyCode!==QE)return;const d=t.findClosestDraggableId(c);if(!d)return;const f=t.tryGetLock(d,b,{sourceEvent:c});if(!f)return;c.preventDefault();let h=!0;const p=f.snapLift();e.current();function b(){h||ge(),h=!1,e.current(),r()}e.current=$n(window,J5(p,b),{capture:!0,passive:!1})}}),[t]),r=je(function(){const c={passive:!1,capture:!0};e.current=$n(window,[n],c)},[n]);Dn(function(){return r(),function(){e.current()}},[r])}const bp={type:"IDLE"},t_=120,n_=.15;function a_({cancel:t,getPhase:e}){return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(e().type!=="DRAGGING"){t();return}n.keyCode===nm&&n.preventDefault(),t()}},{eventName:Cu,fn:t}]}function s_({cancel:t,completed:e,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:r=>{const i=n();if(i.type!=="DRAGGING"){t();return}i.hasMoved=!0;const{clientX:c,clientY:d}=r.touches[0],f={x:c,y:d};r.preventDefault(),i.actions.move(f)}},{eventName:"touchend",fn:r=>{const i=n();if(i.type!=="DRAGGING"){t();return}r.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"touchcancel",fn:r=>{if(n().type!=="DRAGGING"){t();return}r.preventDefault(),t()}},{eventName:"touchforcechange",fn:r=>{const i=n();i.type==="IDLE"&&ge();const c=r.touches[0];if(!c||!(c.force>=n_))return;const f=i.actions.shouldRespectForcePress();if(i.type==="PENDING"){f&&t();return}if(f){if(i.hasMoved){r.preventDefault();return}t();return}r.preventDefault()}},{eventName:Cu,fn:t}]}function r_(t){const e=A.useRef(bp),n=A.useRef(Is),r=je(function(){return e.current},[]),i=je(function(v){e.current=v},[]),c=Ye(()=>({eventName:"touchstart",fn:function(v){if(v.defaultPrevented)return;const N=t.findClosestDraggableId(v);if(!N)return;const j=t.tryGetLock(N,f,{sourceEvent:v});if(!j)return;const S=v.touches[0],{clientX:R,clientY:w}=S,D={x:R,y:w};n.current(),y(j,D)}}),[t]),d=je(function(){const v={capture:!0,passive:!1};n.current=$n(window,[c],v)},[c]),f=je(()=>{const x=e.current;x.type!=="IDLE"&&(x.type==="PENDING"&&clearTimeout(x.longPressTimerId),i(bp),n.current(),d())},[d,i]),h=je(()=>{const x=e.current;f(),x.type==="DRAGGING"&&x.actions.cancel({shouldBlockNextClick:!0}),x.type==="PENDING"&&x.actions.abort()},[f]),p=je(function(){const v={capture:!0,passive:!1},N={cancel:h,completed:f,getPhase:r},j=$n(window,s_(N),v),S=$n(window,a_(N),v);n.current=function(){j(),S()}},[h,r,f]),b=je(function(){const v=r();v.type!=="PENDING"&&ge();const N=v.actions.fluidLift(v.point);i({type:"DRAGGING",actions:N,hasMoved:!1})},[r,i]),y=je(function(v,N){r().type!=="IDLE"&&ge();const j=setTimeout(b,t_);i({type:"PENDING",point:N,actions:v,longPressTimerId:j}),p()},[p,r,i,b]);Dn(function(){return d(),function(){n.current();const N=r();N.type==="PENDING"&&(clearTimeout(N.longPressTimerId),i(bp))}},[r,d,i]),Dn(function(){return $n(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const l_=["input","button","textarea","select","option","optgroup","video","audio"];function ZE(t,e){if(e==null)return!1;if(l_.includes(e.tagName.toLowerCase()))return!0;const r=e.getAttribute("contenteditable");return r==="true"||r===""?!0:e===t?!1:ZE(t,e.parentElement)}function i_(t,e){const n=e.target;return Au(n)?ZE(t,n):!1}var o_=t=>ta(t.getBoundingClientRect()).center;function c_(t){return t instanceof $E(t).Element}const d_=(()=>{const t="matches";return typeof document>"u"?t:[t,"msMatchesSelector","webkitMatchesSelector"].find(r=>r in Element.prototype)||t})();function KE(t,e){return t==null?null:t[d_](e)?t:KE(t.parentElement,e)}function u_(t,e){return t.closest?t.closest(e):KE(t,e)}function f_(t){return`[${Gl.contextId}="${t}"]`}function h_(t,e){const n=e.target;if(!c_(n))return null;const r=f_(t),i=u_(n,r);return!i||!Au(i)?null:i}function p_(t,e){const n=h_(t,e);return n?n.getAttribute(Gl.draggableId):null}function g_(t,e){const n=`[${Xp.contextId}="${t}"]`,i=qE(document,n).find(c=>c.getAttribute(Xp.id)===e);return!i||!Au(i)?null:i}function m_(t){t.preventDefault()}function pd({expected:t,phase:e,isLockActive:n,shouldWarn:r}){return!(!n()||t!==e)}function JE({lockAPI:t,store:e,registry:n,draggableId:r}){if(t.isClaimed())return!1;const i=n.draggable.findById(r);return!(!i||!i.options.isEnabled||!HE(e.getState(),r))}function x_({lockAPI:t,contextId:e,store:n,registry:r,draggableId:i,forceSensorStop:c,sourceEvent:d}){if(!JE({lockAPI:t,store:n,registry:r,draggableId:i}))return null;const h=r.draggable.getById(i),p=g_(e,h.descriptor.id);if(!p||d&&!h.options.canDragInteractiveElements&&i_(p,d))return null;const b=t.claim(c||Is);let y="PRE_DRAG";function x(){return h.options.shouldRespectForcePress}function v(){return t.isActive(b)}function N(I,L){pd({expected:I,phase:y,isLockActive:v,shouldWarn:!0})&&n.dispatch(L())}const j=N.bind(null,"DRAGGING");function S(I){function L(){t.release(),y="COMPLETED"}y!=="PRE_DRAG"&&(L(),ge()),n.dispatch(uk(I.liftActionArgs)),y="DRAGGING";function F(Y,$={shouldBlockNextClick:!1}){if(I.cleanup(),$.shouldBlockNextClick){const M=$n(window,[{eventName:"click",fn:m_,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(M)}L(),n.dispatch(_E({reason:Y}))}return{isActive:()=>pd({expected:"DRAGGING",phase:y,isLockActive:v,shouldWarn:!1}),shouldRespectForcePress:x,drop:Y=>F("DROP",Y),cancel:Y=>F("CANCEL",Y),...I.actions}}function R(I){const L=mo(Y=>{j(()=>kE({client:Y}))});return{...S({liftActionArgs:{id:i,clientSelection:I,movementMode:"FLUID"},cleanup:()=>L.cancel(),actions:{move:L}}),move:L}}function w(){const I={moveUp:()=>j(vk),moveRight:()=>j(Ek),moveDown:()=>j(Nk),moveLeft:()=>j(jk)};return S({liftActionArgs:{id:i,clientSelection:o_(p),movementMode:"SNAP"},cleanup:Is,actions:I})}function D(){pd({expected:"PRE_DRAG",phase:y,isLockActive:v,shouldWarn:!0})&&t.release()}return{isActive:()=>pd({expected:"PRE_DRAG",phase:y,isLockActive:v,shouldWarn:!1}),shouldRespectForcePress:x,fluidLift:R,snapLift:w,abort:D}}const b_=[X5,e_,r_];function y_({contextId:t,store:e,registry:n,customSensors:r,enableDefaultSensors:i}){const c=[...i?b_:[],...r||[]],d=A.useState(()=>L5())[0],f=je(function(S,R){Eo(S)&&!Eo(R)&&d.tryAbandon()},[d]);Dn(function(){let S=e.getState();return e.subscribe(()=>{const w=e.getState();f(S,w),S=w})},[d,e,f]),Dn(()=>d.tryAbandon,[d.tryAbandon]);const h=je(j=>JE({lockAPI:d,registry:n,store:e,draggableId:j}),[d,n,e]),p=je((j,S,R)=>x_({lockAPI:d,registry:n,contextId:t,store:e,draggableId:j,forceSensorStop:S||null,sourceEvent:R&&R.sourceEvent?R.sourceEvent:null}),[t,d,n,e]),b=je(j=>p_(t,j),[t]),y=je(j=>{const S=n.draggable.findById(j);return S?S.options:null},[n.draggable]),x=je(function(){d.isClaimed()&&(d.tryAbandon(),e.getState().phase!=="IDLE"&&e.dispatch(Yg()))},[d,e]),v=je(()=>d.isClaimed(),[d]),N=Ye(()=>({canGetLock:h,tryGetLock:p,findClosestDraggableId:b,findOptionsForDraggable:y,tryReleaseLock:x,isLockClaimed:v}),[h,p,b,y,x,v]);for(let j=0;j({onBeforeCapture:e=>{const n=()=>{t.onBeforeCapture&&t.onBeforeCapture(e)};Dr.flushSync(n)},onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd,onDragUpdate:t.onDragUpdate}),N_=t=>({...No,...t.autoScrollerOptions,durationDampening:{...No.durationDampening,...t.autoScrollerOptions}});function to(t){return t.current||ge(),t.current}function E_(t){const{contextId:e,setCallbacks:n,sensors:r,nonce:i,dragHandleUsageInstructions:c}=t,d=A.useRef(null),f=YE(t),h=je(()=>v_(f.current),[f]),p=je(()=>N_(f.current),[f]),b=k5(e),y=I5({contextId:e,text:c}),x=A5(e,i),v=je(M=>{to(d).dispatch(M)},[]),N=Ye(()=>hv({publishWhileDragging:hk,updateDroppableScroll:gk,updateDroppableIsEnabled:mk,updateDroppableIsCombineEnabled:xk,collectionStarting:pk},v),[v]),j=O5(),S=Ye(()=>a5(j,N),[j,N]),R=Ye(()=>v5({scrollWindow:s5,scrollDroppable:S.scrollDroppable,getAutoScrollerOptions:p,...hv({move:kE},v)}),[S.scrollDroppable,v,p]),w=C5(e),D=Ye(()=>Jk({announce:b,autoScroller:R,dimensionMarshal:S,focusMarshal:w,getResponders:h,styleMarshal:x}),[b,R,S,w,h,x]);d.current=D;const C=je(()=>{const M=to(d);M.getState().phase!=="IDLE"&&M.dispatch(Yg())},[]),I=je(()=>{const M=to(d).getState();return M.phase==="DROP_ANIMATING"?!0:M.phase==="IDLE"?!1:M.isDragging},[]),L=Ye(()=>({isDragging:I,tryAbort:C}),[I,C]);n(L);const F=je(M=>HE(to(d).getState(),M),[]),Y=je(()=>cr(to(d).getState()),[]),$=Ye(()=>({marshal:S,focus:w,contextId:e,canLift:F,isMovementAllowed:Y,dragHandleUsageInstructionsId:y,registry:j}),[e,S,y,w,F,Y,j]);return y_({contextId:e,store:D,registry:j,customSensors:r||null,enableDefaultSensors:t.enableDefaultSensors!==!1}),A.useEffect(()=>C,[C]),qe.createElement(wu.Provider,{value:$},qe.createElement(YR,{context:em,store:D},t.children))}function j_(){return qe.useId()}function Jl(t){const e=j_(),n=t.dragHandleUsageInstructions||Od.dragHandleUsageInstructions;return qe.createElement(eT,null,r=>qe.createElement(E_,{nonce:t.nonce,contextId:e,setCallbacks:r,dragHandleUsageInstructions:n,enableDefaultSensors:t.enableDefaultSensors,sensors:t.sensors,onBeforeCapture:t.onBeforeCapture,onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragUpdate:t.onDragUpdate,onDragEnd:t.onDragEnd,autoScrollerOptions:t.autoScrollerOptions},t.children))}const Gv={dragging:5e3,dropAnimating:4500},S_=(t,e)=>e?uo.drop(e.duration):t?uo.snap:uo.fluid,A_=(t,e)=>{if(t)return e?vo.opacity.drop:vo.opacity.combining},w_=t=>t.forceShouldAnimate!=null?t.forceShouldAnimate:t.mode==="SNAP";function C_(t){const n=t.dimension.client,{offset:r,combineWith:i,dropping:c}=t,d=!!i,f=w_(t),h=!!c,p=h?Qp.drop(r,d):Qp.moveTo(r);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:S_(f,c),transform:p,opacity:A_(d,h),zIndex:h?Gv.dropAnimating:Gv.dragging,pointerEvents:"none"}}function D_(t){return{transform:Qp.moveTo(t.offset),transition:t.shouldAnimateDisplacement?void 0:"none"}}function O_(t){return t.type==="DRAGGING"?C_(t):D_(t)}function R_(t,e,n=Lt){const r=window.getComputedStyle(e),i=e.getBoundingClientRect(),c=lE(i,r),d=Gd(c,n),f={client:c,tagName:e.tagName.toLowerCase(),display:r.display},h={x:c.marginBox.width,y:c.marginBox.height};return{descriptor:t,placeholder:f,displaceBy:h,client:c,page:d}}function T_(t){const e=tm("draggable"),{descriptor:n,registry:r,getDraggableRef:i,canDragInteractiveElements:c,shouldRespectForcePress:d,isEnabled:f}=t,h=Ye(()=>({canDragInteractiveElements:c,shouldRespectForcePress:d,isEnabled:f}),[c,f,d]),p=je(v=>{const N=i();return N||ge(),R_(n,N,v)},[n,i]),b=Ye(()=>({uniqueId:e,descriptor:n,options:h,getDimension:p}),[n,p,h,e]),y=A.useRef(b),x=A.useRef(!0);Dn(()=>(r.draggable.register(y.current),()=>r.draggable.unregister(y.current)),[r.draggable]),Dn(()=>{if(x.current){x.current=!1;return}const v=y.current;y.current=b,r.draggable.update(b,v)},[b,r.draggable])}var am=qe.createContext(null);function Qd(t){const e=A.useContext(t);return e||ge(),e}function k_(t){t.preventDefault()}const __=t=>{const e=A.useRef(null),n=je((L=null)=>{e.current=L},[]),r=je(()=>e.current,[]),{contextId:i,dragHandleUsageInstructionsId:c,registry:d}=Qd(wu),{type:f,droppableId:h}=Qd(am),p=Ye(()=>({id:t.draggableId,index:t.index,type:f,droppableId:h}),[t.draggableId,t.index,f,h]),{children:b,draggableId:y,isEnabled:x,shouldRespectForcePress:v,canDragInteractiveElements:N,isClone:j,mapped:S,dropAnimationFinished:R}=t;if(!j){const L=Ye(()=>({descriptor:p,registry:d,getDraggableRef:r,canDragInteractiveElements:N,shouldRespectForcePress:v,isEnabled:x}),[p,d,r,N,v,x]);T_(L)}const w=Ye(()=>x?{tabIndex:0,role:"button","aria-describedby":c,"data-rfd-drag-handle-draggable-id":y,"data-rfd-drag-handle-context-id":i,draggable:!1,onDragStart:k_}:null,[i,c,y,x]),D=je(L=>{S.type==="DRAGGING"&&S.dropping&&L.propertyName==="transform"&&Dr.flushSync(R)},[R,S]),C=Ye(()=>{const L=O_(S),F=S.type==="DRAGGING"&&S.dropping?D:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":i,"data-rfd-draggable-id":y,style:L,onTransitionEnd:F},dragHandleProps:w}},[i,w,y,S,D,n]),I=Ye(()=>({draggableId:p.id,type:p.type,source:{index:p.index,droppableId:p.droppableId}}),[p.droppableId,p.id,p.index,p.type]);return qe.createElement(qe.Fragment,null,b(C,S.snapshot,I))};var ej=(t,e)=>t===e,tj=t=>{const{combine:e,destination:n}=t;return n?n.droppableId:e?e.droppableId:null};const M_=t=>t.combine?t.combine.draggableId:null,I_=t=>t.at&&t.at.type==="COMBINE"?t.at.combine.draggableId:null;function L_(){const t=Mt((i,c)=>({x:i,y:c})),e=Mt((i,c,d=null,f=null,h=null)=>({isDragging:!0,isClone:c,isDropAnimating:!!h,dropAnimation:h,mode:i,draggingOver:d,combineWith:f,combineTargetFor:null})),n=Mt((i,c,d,f,h=null,p=null,b=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:h,combineWith:p,mode:c,offset:i,dimension:d,forceShouldAnimate:b,snapshot:e(c,f,h,p,null)}}));return(i,c)=>{if(Eo(i)){if(i.critical.draggable.id!==c.draggableId)return null;const d=i.current.client.offset,f=i.dimensions.draggables[c.draggableId],h=Cn(i.impact),p=I_(i.impact),b=i.forceShouldAnimate;return n(t(d.x,d.y),i.movementMode,f,c.isClone,h,p,b)}if(i.phase==="DROP_ANIMATING"){const d=i.completed;if(d.result.draggableId!==c.draggableId)return null;const f=c.isClone,h=i.dimensions.draggables[c.draggableId],p=d.result,b=p.mode,y=tj(p),x=M_(p),N={duration:i.dropDuration,curve:Wg.drop,moveTo:i.newHomeClientOffset,opacity:x?vo.opacity.drop:null,scale:x?vo.scale.drop:null};return{mapped:{type:"DRAGGING",offset:i.newHomeClientOffset,dimension:h,dropping:N,draggingOver:y,combineWith:x,mode:b,forceShouldAnimate:null,snapshot:e(b,f,y,x,N)}}}return null}}function nj(t=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:t,combineWith:null}}const z_={mapped:{type:"SECONDARY",offset:Lt,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:nj(null)}};function P_(){const t=Mt((d,f)=>({x:d,y:f})),e=Mt(nj),n=Mt((d,f=null,h)=>({mapped:{type:"SECONDARY",offset:d,combineTargetFor:f,shouldAnimateDisplacement:h,snapshot:e(f)}})),r=d=>d?n(Lt,d,!0):null,i=(d,f,h,p)=>{const b=h.displaced.visible[d],y=!!(p.inVirtualList&&p.effected[d]),x=Eu(h),v=x&&x.draggableId===d?f:null;if(!b){if(!y)return r(v);if(h.displaced.invisible[d])return null;const S=Xl(p.displacedBy.point),R=t(S.x,S.y);return n(R,v,!0)}if(y)return r(v);const N=h.displacedBy.point,j=t(N.x,N.y);return n(j,v,b.shouldAnimate)};return(d,f)=>{if(Eo(d))return d.critical.draggable.id===f.draggableId?null:i(f.draggableId,d.critical.draggable.id,d.impact,d.afterCritical);if(d.phase==="DROP_ANIMATING"){const h=d.completed;return h.result.draggableId===f.draggableId?null:i(f.draggableId,h.result.draggableId,h.impact,h.afterCritical)}return null}}const U_=()=>{const t=L_(),e=P_();return(r,i)=>t(r,i)||e(r,i)||z_},B_={dropAnimationFinished:ME},H_=rE(U_,B_,null,{context:em,areStatePropsEqual:ej})(__);function aj(t){return Qd(am).isUsingCloneFor===t.draggableId&&!t.isClone?null:qe.createElement(H_,t)}function ei(t){const e=typeof t.isDragDisabled=="boolean"?!t.isDragDisabled:!0,n=!!t.disableInteractiveElementBlocking,r=!!t.shouldRespectForcePress;return qe.createElement(aj,Fd({},t,{isClone:!1,isEnabled:e,canDragInteractiveElements:n,shouldRespectForcePress:r}))}const sj=t=>e=>t===e,G_=sj("scroll"),F_=sj("auto"),Fv=(t,e)=>e(t.overflowX)||e(t.overflowY),V_=t=>{const e=window.getComputedStyle(t),n={overflowX:e.overflowX,overflowY:e.overflowY};return Fv(n,G_)||Fv(n,F_)},q_=()=>!1,rj=t=>t==null?null:t===document.body?q_()?t:null:t===document.documentElement?null:V_(t)?t:rj(t.parentElement);var Zp=t=>({x:t.scrollLeft,y:t.scrollTop});const lj=t=>t?window.getComputedStyle(t).position==="fixed"?!0:lj(t.parentElement):!1;var $_=t=>{const e=rj(t),n=lj(t);return{closestScrollable:e,isFixedOnPage:n}},Y_=({descriptor:t,isEnabled:e,isCombineEnabled:n,isFixedOnPage:r,direction:i,client:c,page:d,closest:f})=>{const h=(()=>{if(!f)return null;const{scrollSize:x,client:v}=f,N=PE({scrollHeight:x.scrollHeight,scrollWidth:x.scrollWidth,height:v.paddingBox.height,width:v.paddingBox.width});return{pageMarginBox:f.page.marginBox,frameClient:v,scrollSize:x,shouldClipSubject:f.shouldClipSubject,scroll:{initial:f.scroll,current:f.scroll,max:N,diff:{value:Lt,displacement:Lt}}}})(),p=i==="vertical"?Gg:xE,b=Bl({page:d,withPlaceholder:null,axis:p,frame:h});return{descriptor:t,isCombineEnabled:n,isFixedOnPage:r,axis:p,isEnabled:e,client:c,page:d,frame:h,subject:b}};const Q_=(t,e)=>{const n=iE(t);if(!e||t!==e)return n;const r=n.paddingBox.top-e.scrollTop,i=n.paddingBox.left-e.scrollLeft,c=r+e.scrollHeight,d=i+e.scrollWidth,h=Pg({top:r,right:d,bottom:c,left:i},n.border);return Ug({borderBox:h,margin:n.margin,border:n.border,padding:n.padding})};var W_=({ref:t,descriptor:e,env:n,windowScroll:r,direction:i,isDropDisabled:c,isCombineEnabled:d,shouldClipSubject:f})=>{const h=n.closestScrollable,p=Q_(t,h),b=Gd(p,r),y=(()=>{if(!h)return null;const v=iE(h),N={scrollHeight:h.scrollHeight,scrollWidth:h.scrollWidth};return{client:v,page:Gd(v,r),scroll:Zp(h),scrollSize:N,shouldClipSubject:f}})();return Y_({descriptor:e,isEnabled:!c,isCombineEnabled:d,isFixedOnPage:n.isFixedOnPage,direction:i,client:p,page:b,closest:y})};const X_={passive:!1},Z_={passive:!0};var Vv=t=>t.shouldPublishImmediately?X_:Z_;const gd=t=>t&&t.env.closestScrollable||null;function K_(t){const e=A.useRef(null),n=Qd(wu),r=tm("droppable"),{registry:i,marshal:c}=n,d=YE(t),f=Ye(()=>({id:t.droppableId,type:t.type,mode:t.mode}),[t.droppableId,t.mode,t.type]),h=A.useRef(f),p=Ye(()=>Mt((C,I)=>{e.current||ge();const L={x:C,y:I};c.updateDroppableScroll(f.id,L)}),[f.id,c]),b=je(()=>{const C=e.current;return!C||!C.env.closestScrollable?Lt:Zp(C.env.closestScrollable)},[]),y=je(()=>{const C=b();p(C.x,C.y)},[b,p]),x=Ye(()=>mo(y),[y]),v=je(()=>{const C=e.current,I=gd(C);if(C&&I||ge(),C.scrollOptions.shouldPublishImmediately){y();return}x()},[x,y]),N=je((C,I)=>{e.current&&ge();const L=d.current,F=L.getDroppableRef();F||ge();const Y=$_(F),$={ref:F,descriptor:f,env:Y,scrollOptions:I};e.current=$;const M=W_({ref:F,descriptor:f,env:Y,windowScroll:C,direction:L.direction,isDropDisabled:L.isDropDisabled,isCombineEnabled:L.isCombineEnabled,shouldClipSubject:!L.ignoreContainerClipping}),H=Y.closestScrollable;return H&&(H.setAttribute(Pv.contextId,n.contextId),H.addEventListener("scroll",v,Vv($.scrollOptions))),M},[n.contextId,f,v,d]),j=je(()=>{const C=e.current,I=gd(C);return C&&I||ge(),Zp(I)},[]),S=je(()=>{const C=e.current;C||ge();const I=gd(C);e.current=null,I&&(x.cancel(),I.removeAttribute(Pv.contextId),I.removeEventListener("scroll",v,Vv(C.scrollOptions)))},[v,x]),R=je(C=>{const I=e.current;I||ge();const L=gd(I);L||ge(),L.scrollTop+=C.y,L.scrollLeft+=C.x},[]),w=Ye(()=>({getDimensionAndWatchScroll:N,getScrollWhileDragging:j,dragStopped:S,scroll:R}),[S,N,j,R]),D=Ye(()=>({uniqueId:r,descriptor:f,callbacks:w}),[w,f,r]);Dn(()=>(h.current=D.descriptor,i.droppable.register(D),()=>{e.current&&S(),i.droppable.unregister(D)}),[w,f,S,D,c,i.droppable]),Dn(()=>{e.current&&c.updateDroppableIsEnabled(h.current.id,!t.isDropDisabled)},[t.isDropDisabled,c]),Dn(()=>{e.current&&c.updateDroppableIsCombineEnabled(h.current.id,t.isCombineEnabled)},[t.isCombineEnabled,c])}function yp(){}const qv={width:0,height:0,margin:iT},J_=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>t||n==="close"?qv:{height:e.client.borderBox.height,width:e.client.borderBox.width,margin:e.client.margin},eM=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>{const r=J_({isAnimatingOpenOnMount:t,placeholder:e,animate:n});return{display:e.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?uo.placeholder:null}},tM=t=>{const e=A.useRef(null),n=je(()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]),{animate:r,onTransitionEnd:i,onClose:c,contextId:d}=t,[f,h]=A.useState(t.animate==="open");A.useEffect(()=>f?r!=="open"?(n(),h(!1),yp):e.current?yp:(e.current=setTimeout(()=>{e.current=null,h(!1)}),n):yp,[r,f,n]);const p=je(y=>{y.propertyName==="height"&&(i(),r==="close"&&c())},[r,c,i]),b=eM({isAnimatingOpenOnMount:f,animate:t.animate,placeholder:t.placeholder});return qe.createElement(t.placeholder.tagName,{style:b,"data-rfd-placeholder-context-id":d,onTransitionEnd:p,ref:t.innerRef})};var nM=qe.memo(tM);class aM extends qe.PureComponent{constructor(...e){super(...e),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(e,n){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!e.on,data:e.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)}}const sM=t=>{const e=A.useContext(wu);e||ge();const{contextId:n,isMovementAllowed:r}=e,i=A.useRef(null),c=A.useRef(null),{children:d,droppableId:f,type:h,mode:p,direction:b,ignoreContainerClipping:y,isDropDisabled:x,isCombineEnabled:v,snapshot:N,useClone:j,updateViewportMaxScroll:S,getContainerForClone:R}=t,w=je(()=>i.current,[]),D=je((H=null)=>{i.current=H},[]);je(()=>c.current,[]);const C=je((H=null)=>{c.current=H},[]),I=je(()=>{r()&&S({maxScroll:BE()})},[r,S]);K_({droppableId:f,type:h,mode:p,direction:b,isDropDisabled:x,isCombineEnabled:v,ignoreContainerClipping:y,getDroppableRef:w});const L=Ye(()=>qe.createElement(aM,{on:t.placeholder,shouldAnimate:t.shouldAnimatePlaceholder},({onClose:H,data:ne,animate:ee})=>qe.createElement(nM,{placeholder:ne,onClose:H,innerRef:C,animate:ee,contextId:n,onTransitionEnd:I})),[n,I,t.placeholder,t.shouldAnimatePlaceholder,C]),F=Ye(()=>({innerRef:D,placeholder:L,droppableProps:{"data-rfd-droppable-id":f,"data-rfd-droppable-context-id":n}}),[n,f,L,D]),Y=j?j.dragging.draggableId:null,$=Ye(()=>({droppableId:f,type:h,isUsingCloneFor:Y}),[f,Y,h]);function M(){if(!j)return null;const{dragging:H,render:ne}=j,ee=qe.createElement(aj,{draggableId:H.draggableId,index:H.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(he,pe)=>ne(he,pe,H));return zO.createPortal(ee,R())}return qe.createElement(am.Provider,{value:$},d(F,N),M())};function rM(){return document.body||ge(),document.body}const $v={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:rM},ij=t=>{let e={...t},n;for(n in $v)t[n]===void 0&&(e={...e,[n]:$v[n]});return e},vp=(t,e)=>t===e.droppable.type,Yv=(t,e)=>e.draggables[t.draggable.id],lM=()=>{const t={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},e={...t,shouldAnimatePlaceholder:!1},n=Mt(c=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}})),r=Mt((c,d,f,h,p,b)=>{const y=p.descriptor.id;if(p.descriptor.droppableId===c){const N=b?{render:b,dragging:n(p.descriptor)}:null,j={isDraggingOver:f,draggingOverWith:f?y:null,draggingFromThisWith:y,isUsingPlaceholder:!0};return{placeholder:p.placeholder,shouldAnimatePlaceholder:!1,snapshot:j,useClone:N}}if(!d)return e;if(!h)return t;const v={isDraggingOver:f,draggingOverWith:y,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:p.placeholder,shouldAnimatePlaceholder:!0,snapshot:v,useClone:null}});return(c,d)=>{const f=ij(d),h=f.droppableId,p=f.type,b=!f.isDropDisabled,y=f.renderClone;if(Eo(c)){const x=c.critical;if(!vp(p,x))return e;const v=Yv(x,c.dimensions),N=Cn(c.impact)===h;return r(h,b,N,N,v,y)}if(c.phase==="DROP_ANIMATING"){const x=c.completed;if(!vp(p,x.critical))return e;const v=Yv(x.critical,c.dimensions);return r(h,b,tj(x.result)===h,Cn(x.impact)===h,v,y)}if(c.phase==="IDLE"&&c.completed&&!c.shouldFlush){const x=c.completed;if(!vp(p,x.critical))return e;const v=Cn(x.impact)===h,N=!!(x.impact.at&&x.impact.at.type==="COMBINE"),j=x.critical.droppable.id===h;return v?N?t:e:j?t:e}return e}},iM={updateViewportMaxScroll:yk},ti=rE(lM,iM,(t,e,n)=>({...ij(n),...t,...e}),{context:em,areStatePropsEqual:ej})(sM),oM=["VO","SL","IV","IM","SC","Tópico","Inalatória","Colírio","Nasal"],cM=["1x/dia","2x/dia","3x/dia","4x/dia","6/6h","8/8h","12/12h","24/24h","Dose única","Se necessário"],dM=["1 dia","2 dias","3 dias","5 dias","7 dias","10 dias","14 dias","21 dias","30 dias","Contínuo"],Np={medicamento:"",dose:"",via:"VO",frequencia:"8/8h",duracao:"7 dias",instrucoes:""},Qv=({item:t,onChange:e,onSave:n,onCancel:r})=>{const i="w-full border border-gray-200 rounded-lg px-3 py-2 text-xs focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none bg-white",c=i+" appearance-none";return s.jsxs("div",{className:"bg-blue-50 border border-blue-100 rounded-xl p-3 space-y-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Medicamento"}),s.jsx("input",{autoFocus:!0,value:t.medicamento,onChange:d=>e({...t,medicamento:d.target.value.toUpperCase()}),placeholder:"EX: AMOXICILINA 500MG",className:i})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Dose"}),s.jsx("input",{value:t.dose,onChange:d=>e({...t,dose:d.target.value}),placeholder:"EX: 500mg",className:i})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Via"}),s.jsx("select",{value:t.via,onChange:d=>e({...t,via:d.target.value}),className:c,children:oM.map(d=>s.jsx("option",{children:d},d))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Frequência"}),s.jsx("select",{value:t.frequencia,onChange:d=>e({...t,frequencia:d.target.value}),className:c,children:cM.map(d=>s.jsx("option",{children:d},d))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Duração"}),s.jsx("select",{value:t.duracao,onChange:d=>e({...t,duracao:d.target.value}),className:c,children:dM.map(d=>s.jsx("option",{children:d},d))})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-500 uppercase tracking-wider",children:"Instruções extras (opcional)"}),s.jsx("input",{value:t.instrucoes||"",onChange:d=>e({...t,instrucoes:d.target.value}),placeholder:"EX: TOMAR APÓS AS REFEIÇÕES",className:i})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[s.jsx("button",{onClick:r,className:"px-3 py-1.5 bg-white border border-gray-200 text-gray-600 rounded-lg text-xs font-bold hover:bg-gray-50",children:"Cancelar"}),s.jsxs("button",{onClick:n,disabled:!t.medicamento.trim(),className:"px-3 py-1.5 bg-blue-600 text-white rounded-lg text-xs font-bold hover:bg-blue-700 disabled:opacity-40 flex items-center gap-1",children:[s.jsx(Po,{size:12})," Confirmar"]})]})]})},uM=({modelo:t,especialidades:e,onSave:n,onBack:r})=>{var ne;const i=$e(),[c,d]=A.useState((t==null?void 0:t.nome)||""),[f,h]=A.useState((t==null?void 0:t.especialidadeId)||""),[p,b]=A.useState((t==null?void 0:t.instrucoes)||""),[y,x]=A.useState((t==null?void 0:t.items)||[]),[v,N]=A.useState(null),[j,S]=A.useState(Np),[R,w]=A.useState(!1),[D,C]=A.useState(!1),I=((ne=e.find(ee=>ee.id===f))==null?void 0:ne.nome)||"",L=ee=>{if(!ee.destination)return;const he=[...y],[pe]=he.splice(ee.source.index,1);he.splice(ee.destination.index,0,pe),x(he.map((z,oe)=>({...z,ordem:oe})))},F=()=>{j.medicamento.trim()&&(x(ee=>[...ee,{...j,id:`new_${Date.now()}`,ordem:ee.length}]),S(Np),w(!1))},Y=(ee,he)=>{x(pe=>pe.map((z,oe)=>oe===ee?{...z,...he}:z))},$=ee=>x(he=>he.filter((pe,z)=>z!==ee)),M=async()=>{if(!c.trim()){i.error("NOME DO MODELO OBRIGATÓRIO");return}C(!0);try{const ee={nome:c.toUpperCase(),especialidadeId:f||void 0,especialidadeNome:I||void 0,instrucoes:p||void 0,items:y};if(t!=null&&t.id)await K.updateModeloReceita({...ee,id:t.id});else{const he=await K.saveModeloReceita(ee);n({...ee,id:he.id,items:y});return}n({...ee,id:t.id,items:y})}catch{i.error("ERRO AO SALVAR MODELO")}finally{C(!1)}},H="w-full border border-gray-200 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none bg-white";return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center gap-3",children:[s.jsx("button",{onClick:r,className:"text-gray-400 hover:text-gray-700 flex-shrink-0",children:s.jsx($a,{size:18})}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase",children:t?"Editar Modelo":"Novo Modelo"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Nome do Modelo *"}),s.jsx("input",{value:c,onChange:ee=>d(ee.target.value.toUpperCase()),className:H,placeholder:"EX: ANTIBIÓTICO PÓS-CIRÚRGICO"})]}),s.jsx("div",{className:"grid grid-cols-2 gap-3",children:s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Especialidade"}),s.jsxs("select",{value:f,onChange:ee=>h(ee.target.value),className:H+" text-sm",children:[s.jsx("option",{value:"",children:"— Geral —"}),e.map(ee=>s.jsx("option",{value:ee.id,children:ee.nome},ee.id))]})]})}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Instrução Geral (opcional)"}),s.jsx("input",{value:p,onChange:ee=>b(ee.target.value),className:H,placeholder:"EX: USO EM CASO DE INFECÇÃO ODONTOGÊNICA"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("label",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider",children:["Medicamentos (",y.length,")"]}),!R&&s.jsxs("button",{onClick:()=>w(!0),className:"flex items-center gap-1 text-xs font-bold text-blue-600 hover:text-blue-800",children:[s.jsx(gt,{size:13})," Adicionar"]})]}),R&&s.jsx("div",{className:"mb-2",children:s.jsx(Qv,{item:j,onChange:S,onSave:F,onCancel:()=>{w(!1),S(Np)}})}),s.jsx(Jl,{onDragEnd:L,children:s.jsx(ti,{droppableId:"items-receita",children:ee=>s.jsxs("div",{ref:ee.innerRef,...ee.droppableProps,className:"space-y-1.5",children:[y.map((he,pe)=>s.jsx(ei,{draggableId:he.id,index:pe,children:(z,oe)=>s.jsx("div",{ref:z.innerRef,...z.draggableProps,className:`rounded-xl border transition-shadow ${oe.isDragging?"shadow-lg border-blue-300 bg-blue-50":"border-gray-200 bg-white"}`,children:v===pe?s.jsx("div",{className:"p-2",children:s.jsx(Qv,{item:{medicamento:he.medicamento,dose:he.dose,via:he.via,frequencia:he.frequencia,duracao:he.duracao,instrucoes:he.instrucoes},onChange:G=>Y(pe,G),onSave:()=>N(null),onCancel:()=>N(null)})}):s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[s.jsx("span",{...z.dragHandleProps,className:"text-gray-300 hover:text-gray-500 cursor-grab flex-shrink-0",children:s.jsx(Ql,{size:15})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs font-bold text-gray-800 uppercase truncate",children:he.medicamento}),s.jsx("p",{className:"text-[10px] text-gray-400",children:[he.dose,he.via,he.frequencia,he.duracao].filter(Boolean).join(" · ")}),he.instrucoes&&s.jsx("p",{className:"text-[10px] text-blue-500 italic",children:he.instrucoes})]}),s.jsx("button",{onClick:()=>N(pe),className:"text-gray-300 hover:text-blue-500 flex-shrink-0",children:s.jsx(zo,{size:13})}),s.jsx("button",{onClick:()=>$(pe),className:"text-gray-300 hover:text-red-500 flex-shrink-0",children:s.jsx(Qt,{size:13})})]})})},he.id)),ee.placeholder,y.length===0&&!R&&s.jsx("div",{className:"text-center py-6 text-xs text-gray-400 border-2 border-dashed border-gray-200 rounded-xl",children:"Nenhum medicamento adicionado ainda"})]})})})]})]}),s.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-end gap-2",children:[s.jsx("button",{onClick:r,className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase",children:"Cancelar"}),s.jsxs("button",{onClick:M,disabled:D||!c.trim(),className:"px-5 py-2 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5 disabled:opacity-40",children:[s.jsx(Po,{size:14})," ",D?"Salvando...":"Salvar Modelo"]})]})]})},fM=({modelo:t,paciente:e,dentista:n,onClose:r})=>{const i=new Date().toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"});return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between print:hidden",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:r,className:"text-gray-400 hover:text-gray-700",children:s.jsx($a,{size:18})}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase",children:"Pré-visualização"})]}),s.jsxs("button",{onClick:()=>window.print(),className:"flex items-center gap-2 px-4 py-2 bg-gray-900 text-white rounded-lg text-xs font-bold hover:bg-black",children:[s.jsx(Ya,{size:14})," Imprimir / Salvar PDF"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-100 p-6 print:p-0 print:bg-white",children:s.jsxs("div",{id:"receita-print",className:"max-w-xl mx-auto bg-white rounded-2xl shadow-sm border border-gray-200 p-8 print:shadow-none print:rounded-none print:border-0 print:max-w-full",children:[s.jsxs("div",{className:"text-center border-b-2 border-gray-800 pb-4 mb-6",children:[s.jsx("h1",{className:"text-lg font-black text-gray-900 uppercase",children:"RECEITUÁRIO"}),n&&s.jsxs("p",{className:"text-sm font-bold text-gray-700 mt-1",children:[n.nome," — CRO: ",n.cro||"—","/",n.cro_uf||"—"]})]}),s.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500 text-xs uppercase font-bold",children:"Paciente"}),s.jsx("p",{className:"font-bold text-gray-900 uppercase",children:e.nome})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500 text-xs uppercase font-bold",children:"Data"}),s.jsx("p",{className:"font-bold text-gray-900",children:i})]})]}),t.instrucoes&&s.jsx("div",{className:"mb-5 p-3 bg-amber-50 border border-amber-200 rounded-lg text-xs text-amber-800 font-medium italic",children:t.instrucoes}),s.jsx("div",{className:"space-y-4",children:t.items.map((c,d)=>s.jsxs("div",{className:"border-b border-gray-100 pb-3 last:border-0 last:pb-0",children:[s.jsxs("p",{className:"font-black text-gray-900 text-sm",children:[d+1,". ",c.medicamento]}),s.jsx("p",{className:"text-gray-700 text-sm ml-4",children:[c.dose,c.via,c.frequencia,`por ${c.duracao}`].filter(Boolean).join(" — ")}),c.instrucoes&&s.jsx("p",{className:"text-gray-500 text-xs ml-4 italic mt-0.5",children:c.instrucoes})]},c.id))}),s.jsxs("div",{className:"mt-12 pt-6 border-t-2 border-gray-800 flex justify-between items-end",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500",children:"Assinatura e Carimbo"}),s.jsx("div",{className:"h-10"})]}),s.jsx("p",{className:"text-xs text-gray-400",children:i})]})]})})]})},hM=({paciente:t,onClose:e})=>{const n=$e(),{data:r}=Ie(K.getEspecialidades),i=r??[],{data:c}=Ie(K.getDentistas),d=c??[],[f,h]=A.useState([]),[p,b]=A.useState(!0),[y,x]=A.useState(""),[v,N]=A.useState(""),[j,S]=A.useState("lista"),[R,w]=A.useState(null),[D,C]=A.useState(null),I=d[0],L=A.useCallback(async()=>{b(!0);try{h(await K.getModelosReceita())}catch{n.error("Erro ao carregar modelos")}finally{b(!1)}},[]);A.useEffect(()=>{L()},[L]),A.useEffect(()=>{const $=M=>{M.key==="Escape"&&(j!=="lista"?S("lista"):e())};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[j,e]);const F=async $=>{confirm("Excluir este modelo?")&&(await K.deleteModeloReceita($),h(M=>M.filter(H=>H.id!==$)))},Y=f.filter($=>{const M=!y||$.especialidadeId===y,H=!v||$.nome.toLowerCase().includes(v.toLowerCase());return M&&H});return s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[j==="lista"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-red-100 rounded-lg flex items-center justify-center",children:s.jsx(Ba,{size:15,className:"text-red-600"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-black text-gray-800 uppercase",children:"Modelos de Receita"}),s.jsx("p",{className:"text-[10px] text-gray-400 uppercase",children:t.nome})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>{w(null),S("editor")},className:"flex items-center gap-1.5 px-3 py-2 bg-green-600 hover:bg-green-700 text-white text-xs font-bold rounded-lg",children:[s.jsx(gt,{size:13})," Novo Modelo"]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]})]}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsxs("div",{className:"w-44 border-r border-gray-100 flex-shrink-0 overflow-y-auto bg-gray-50 p-2",children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase px-2 mb-2 tracking-wider",children:"Especialidade"}),s.jsx("button",{onClick:()=>x(""),className:`w-full text-left px-2.5 py-1.5 rounded-lg text-xs font-bold mb-0.5 transition-colors ${y?"text-gray-600 hover:bg-gray-100":"bg-blue-600 text-white"}`,children:"Todas"}),i.map($=>s.jsx("button",{onClick:()=>x($.id),className:`w-full text-left px-2.5 py-1.5 rounded-lg text-xs font-bold mb-0.5 transition-colors truncate ${y===$.id?"bg-blue-600 text-white":"text-gray-600 hover:bg-gray-100"}`,children:$.nome},$.id))]}),s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsx("div",{className:"p-3 border-b border-gray-100",children:s.jsxs("div",{className:"relative",children:[s.jsx(Qn,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400"}),s.jsx("input",{value:v,onChange:$=>N($.target.value),placeholder:"Buscar modelo...",className:"w-full pl-8 pr-3 py-2 border border-gray-200 rounded-lg text-xs focus:ring-2 focus:ring-blue-100 outline-none"})]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[p&&s.jsx("div",{className:"text-center py-8 text-xs text-gray-400",children:"Carregando..."}),!p&&Y.length===0&&s.jsxs("div",{className:"text-center py-10",children:[s.jsx(oo,{size:28,className:"text-gray-200 mx-auto mb-2"}),s.jsx("p",{className:"text-xs text-gray-400",children:"Nenhum modelo encontrado"}),s.jsx("button",{onClick:()=>{w(null),S("editor")},className:"mt-3 text-xs font-bold text-blue-600 hover:underline",children:"+ Criar primeiro modelo"})]}),Y.map($=>s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-3 hover:border-blue-200 hover:shadow-sm transition-all group",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase truncate",children:$.nome}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[$.especialidadeNome&&s.jsx("span",{className:"text-[9px] bg-blue-50 text-blue-600 px-1.5 py-0.5 rounded-full font-bold uppercase",children:$.especialidadeNome}),s.jsxs("span",{className:"text-[9px] text-gray-400",children:[$.items.length," medicamento",$.items.length!==1?"s":""]})]}),$.instrucoes&&s.jsx("p",{className:"text-[10px] text-gray-400 italic mt-1 truncate",children:$.instrucoes})]}),s.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:[s.jsx("button",{onClick:()=>{C($),S("print")},title:"Prescrever para este paciente",className:"p-1.5 text-gray-400 hover:text-green-600 hover:bg-green-50 rounded-lg",children:s.jsx(Ya,{size:13})}),s.jsx("button",{onClick:()=>{w($),S("editor")},className:"p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg",children:s.jsx(zo,{size:13})}),s.jsx("button",{onClick:()=>F($.id),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg",children:s.jsx(Qt,{size:13})})]})]}),$.items.length>0&&s.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-50 space-y-0.5",children:[$.items.slice(0,3).map(M=>s.jsxs("p",{className:"text-[10px] text-gray-500 truncate",children:["• ",M.medicamento," — ",M.dose," ",M.frequencia]},M.id)),$.items.length>3&&s.jsxs("p",{className:"text-[10px] text-gray-400",children:["+",$.items.length-3," mais..."]})]})]},$.id))]})]})]})]}),j==="editor"&&s.jsx(uM,{modelo:R,especialidades:i,onSave:$=>{L(),S("lista"),n.success("MODELO SALVO!")},onBack:()=>S("lista")}),j==="print"&&D&&s.jsx(fM,{modelo:D,paciente:t,dentista:I,onClose:()=>S("lista")})]})})},Wd=[{categoria:"RAIO-X",icon:s.jsx(bD,{size:14}),cor:"blue",items:[{nome:"Periapical"},{nome:"Interproximal (Bite-Wing)"},{nome:"Panorâmica"},{nome:"Oclusal Superior"},{nome:"Oclusal Inferior"},{nome:"Cefalométrica Lateral"},{nome:"P.A. de Face"}]},{categoria:"TOMOGRAFIA",icon:s.jsx($l,{size:14}),cor:"purple",items:[{nome:"Cone Beam — Dente Único",regiao:""},{nome:"Cone Beam — Terço Anterior"},{nome:"Cone Beam — Arcada Completa Superior"},{nome:"Cone Beam — Arcada Completa Inferior"},{nome:"Cone Beam — Ambas Arcadas"},{nome:"ATM (Articulação Temporomandibular)"}]},{categoria:"OUTROS",icon:s.jsx(ID,{size:14}),cor:"green",items:[{nome:"Cefalometria Analítica"},{nome:"Fotografia Clínica Extraoral"},{nome:"Fotografia Clínica Intraoral"},{nome:"Modelos de Gesso / Escaneamento"},{nome:"Biópsia"},{nome:"Exame Laboratorial"}]}],Kp={blue:{bg:"bg-blue-50",text:"text-blue-700",border:"border-blue-200",chip:"bg-blue-100 text-blue-700"},purple:{bg:"bg-purple-50",text:"text-purple-700",border:"border-purple-200",chip:"bg-purple-100 text-purple-700"},green:{bg:"bg-green-50",text:"text-green-700",border:"border-green-200",chip:"bg-green-100 text-green-700"}},pM=({pedido:t,dentista:e,onClose:n})=>{const r=new Date().toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"}),i=Wd.map(c=>({...c,selecionados:t.items.filter(d=>d.categoria===c.categoria)})).filter(c=>c.selecionados.length>0);return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between print:hidden",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-700",children:s.jsx($a,{size:18})}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase",children:"Pré-visualização"})]}),s.jsxs("button",{onClick:()=>window.print(),className:"flex items-center gap-2 px-4 py-2 bg-gray-900 text-white rounded-lg text-xs font-bold hover:bg-black",children:[s.jsx(Ya,{size:14})," Imprimir / Salvar PDF"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-100 p-6 print:p-0 print:bg-white",children:s.jsxs("div",{className:"max-w-xl mx-auto bg-white rounded-2xl shadow-sm border border-gray-200 p-8 print:shadow-none print:rounded-none print:border-0 print:max-w-full",children:[s.jsxs("div",{className:"text-center border-b-2 border-gray-800 pb-4 mb-6",children:[s.jsx("h1",{className:"text-lg font-black text-gray-900 uppercase",children:"PEDIDO DE EXAMES"}),e&&s.jsxs("p",{className:"text-sm font-bold text-gray-700 mt-1",children:[e.nome," — CRO: ",e.cro||"—","/",e.cro_uf||"—"]})]}),s.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500 text-xs uppercase font-bold",children:"Paciente"}),s.jsx("p",{className:"font-bold text-gray-900 uppercase",children:t.pacienteNome})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500 text-xs uppercase font-bold",children:"Data"}),s.jsx("p",{className:"font-bold text-gray-900",children:r})]})]}),s.jsx("div",{className:"space-y-5",children:i.map(c=>s.jsxs("div",{children:[s.jsx("h3",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-2 border-b border-gray-100 pb-1",children:c.categoria}),s.jsx("ul",{className:"space-y-1.5",children:c.selecionados.map((d,f)=>s.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-800",children:[s.jsxs("span",{className:"font-black text-gray-400 w-5 flex-shrink-0",children:[f+1,"."]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-bold",children:d.nome}),d.regiao&&s.jsxs("span",{className:"text-gray-500",children:[" — Região: ",d.regiao]}),d.observacao&&s.jsx("p",{className:"text-xs text-gray-500 italic mt-0.5",children:d.observacao})]})]},d.id))})]},c.categoria))}),t.observacoes&&s.jsxs("div",{className:"mt-5 p-3 bg-amber-50 border border-amber-200 rounded-lg text-xs text-amber-800 italic",children:[s.jsx("span",{className:"font-black not-italic uppercase",children:"Obs: "}),t.observacoes]}),s.jsxs("div",{className:"mt-12 pt-6 border-t-2 border-gray-800 flex justify-between items-end",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500",children:"Assinatura e Carimbo"}),s.jsx("div",{className:"h-10"})]}),s.jsx("p",{className:"text-xs text-gray-400",children:r})]})]})})]})},gM=({item:t,onChange:e,onRemove:n,dragHandle:r,isDragging:i})=>{const[c,d]=A.useState(!1),f=Wd.find(p=>p.categoria===t.categoria),h=Kp[(f==null?void 0:f.cor)||"blue"];return s.jsxs("div",{className:`rounded-xl border transition-all ${i?"shadow-lg":""} ${h.border} bg-white`,children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[s.jsx("span",{className:"text-gray-300 hover:text-gray-500 cursor-grab flex-shrink-0",children:r}),s.jsx("span",{className:`text-[9px] font-black px-1.5 py-0.5 rounded-full flex-shrink-0 ${h.chip}`,children:t.categoria}),s.jsx("p",{className:"flex-1 text-xs font-bold text-gray-800 truncate",children:t.nome}),s.jsx("button",{onClick:()=>d(p=>!p),className:`text-[9px] font-bold px-2 py-0.5 rounded-full border flex-shrink-0 ${c?"bg-gray-100 text-gray-600 border-gray-200":"text-gray-400 border-gray-200 hover:bg-gray-50"}`,children:c?"fechar":"detalhe"}),s.jsx("button",{onClick:n,className:"text-gray-300 hover:text-red-500 flex-shrink-0",children:s.jsx(Qt,{size:13})})]}),c&&s.jsxs("div",{className:"px-3 pb-3 pt-0 grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase",children:"Região / Dente"}),s.jsx("input",{value:t.regiao||"",onChange:p=>e({regiao:p.target.value}),placeholder:"ex: dente 16, arcada inf.",className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-xs focus:ring-2 focus:ring-blue-100 outline-none"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase",children:"Observação"}),s.jsx("input",{value:t.observacao||"",onChange:p=>e({observacao:p.target.value}),placeholder:"ex: urgente, pós-cirúrgico",className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-xs focus:ring-2 focus:ring-blue-100 outline-none"})]})]})]})},mM=({paciente:t,onClose:e})=>{const n=$e(),{data:r}=Ie(K.getDentistas),i=r??[],[c,d]=A.useState([]),[f,h]=A.useState(""),[p,b]=A.useState(""),[y,x]=A.useState(null),[v,N]=A.useState("editor"),[j,S]=A.useState(!1),R=i[0];A.useEffect(()=>{const $=M=>{M.key==="Escape"&&(v!=="editor"?N("editor"):e())};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[v,e]);const w=Wd.map($=>({...$,items:$.items.filter(M=>!(y&&$.categoria!==y||p&&!M.nome.toLowerCase().includes(p.toLowerCase())))})).filter($=>$.items.length>0),D=($,M,H)=>{if(c.some(ne=>ne.nome===M&&ne.categoria===$)){n.error("EXAME JÁ ADICIONADO");return}d(ne=>[...ne,{id:`ex_${Date.now()}_${Math.random()}`,nome:M,categoria:$,regiao:H||"",observacao:"",ordem:ne.length}])},C=($,M)=>{d(H=>H.map(ne=>ne.id===$?{...ne,...M}:ne))},I=$=>d(M=>M.filter(H=>H.id!==$)),L=$=>{if(!$.destination)return;const M=[...c],[H]=M.splice($.source.index,1);M.splice($.destination.index,0,H),d(M.map((ne,ee)=>({...ne,ordem:ee})))},F=async()=>{if(c.length===0){n.error("ADICIONE AO MENOS UM EXAME");return}S(!0);try{await K.savePedidoExame({pacienteId:t.id,pacienteNome:t.nome,profissionalId:R==null?void 0:R.id,profissionalNome:R==null?void 0:R.nome,data:new Date().toISOString().slice(0,10),observacoes:f||void 0,items:c}),N("print")}catch{n.error("ERRO AO SALVAR PEDIDO")}finally{S(!1)}},Y={id:"preview",pacienteId:t.id,pacienteNome:t.nome,profissionalId:R==null?void 0:R.id,profissionalNome:R==null?void 0:R.nome,data:new Date().toISOString().slice(0,10),observacoes:f,items:c};return v==="print"?s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsx("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col overflow-hidden",children:s.jsx(pM,{pedido:Y,dentista:R,onClose:()=>N("editor")})})}):s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between flex-shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-indigo-100 rounded-lg flex items-center justify-center",children:s.jsx(av,{size:15,className:"text-indigo-600"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-black text-gray-800 uppercase",children:"Pedido de Exames"}),s.jsx("p",{className:"text-[10px] text-gray-400 uppercase",children:t.nome})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsxs("div",{className:"w-80 flex-shrink-0 border-r border-gray-100 flex flex-col",children:[s.jsxs("div",{className:"p-3 border-b border-gray-100 space-y-2",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Qn,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400"}),s.jsx("input",{value:p,onChange:$=>b($.target.value),placeholder:"Buscar exame...",className:"w-full pl-8 pr-3 py-2 border border-gray-200 rounded-lg text-xs focus:ring-2 focus:ring-blue-100 outline-none"})]}),s.jsxs("div",{className:"flex gap-1 flex-wrap",children:[s.jsx("button",{onClick:()=>x(null),className:`text-[10px] font-bold px-2 py-0.5 rounded-full border transition-colors ${y?"text-gray-500 border-gray-200 hover:bg-gray-50":"bg-gray-800 text-white border-gray-800"}`,children:"Todos"}),Wd.map($=>{const M=Kp[$.cor];return s.jsx("button",{onClick:()=>x(H=>H===$.categoria?null:$.categoria),className:`text-[10px] font-bold px-2 py-0.5 rounded-full border transition-colors ${y===$.categoria?M.chip+" border-transparent":"text-gray-500 border-gray-200 hover:bg-gray-50"}`,children:$.categoria},$.categoria)})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-4",children:[w.map($=>{const M=Kp[$.cor];return s.jsxs("div",{children:[s.jsxs("div",{className:`flex items-center gap-1.5 mb-2 ${M.text}`,children:[$.icon,s.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider",children:$.categoria})]}),s.jsx("div",{className:"space-y-1",children:$.items.map(H=>{const ne=c.some(ee=>ee.nome===H.nome&&ee.categoria===$.categoria);return s.jsxs("button",{onClick:()=>D($.categoria,H.nome,H.regiao),disabled:ne,className:`w-full text-left px-3 py-2 rounded-lg text-xs transition-all flex items-center justify-between group ${ne?`${M.bg} ${M.text} font-bold opacity-60 cursor-default`:`border border-gray-100 hover:${M.bg} hover:${M.border} hover:${M.text} text-gray-600 font-medium`}`,children:[s.jsx("span",{children:H.nome}),ne?s.jsx("span",{className:"text-[9px] font-black opacity-70",children:"✓"}):s.jsx(gt,{size:12,className:"opacity-0 group-hover:opacity-100 flex-shrink-0"})]},H.nome)})})]},$.categoria)}),w.length===0&&s.jsx("p",{className:"text-xs text-gray-400 text-center py-6",children:"Nenhum exame encontrado"})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"p-3 border-b border-gray-100 flex items-center justify-between",children:[s.jsxs("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider",children:["Exames Selecionados ",c.length>0&&s.jsxs("span",{className:"text-blue-600 ml-1",children:["(",c.length,")"]})]}),c.length>0&&s.jsx("button",{onClick:()=>d([]),className:"text-[10px] text-red-500 hover:text-red-700 font-bold",children:"Limpar tudo"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-2xl flex items-center justify-center mb-3",children:s.jsx(av,{size:24,className:"text-gray-300"})}),s.jsx("p",{className:"text-sm font-bold text-gray-400",children:"Nenhum exame selecionado"}),s.jsx("p",{className:"text-xs text-gray-300 mt-1",children:"Clique nos exames ao lado para adicionar"})]}):s.jsx(Jl,{onDragEnd:L,children:s.jsx(ti,{droppableId:"exames-selecionados",children:$=>s.jsxs("div",{ref:$.innerRef,...$.droppableProps,className:"space-y-2",children:[c.map((M,H)=>s.jsx(ei,{draggableId:M.id,index:H,children:(ne,ee)=>s.jsx("div",{ref:ne.innerRef,...ne.draggableProps,children:s.jsx(gM,{item:M,isDragging:ee.isDragging,dragHandle:s.jsx("span",{...ne.dragHandleProps,children:s.jsx(Ql,{size:15})}),onChange:he=>C(M.id,he),onRemove:()=>I(M.id)})})},M.id)),$.placeholder]})})})}),s.jsxs("div",{className:"p-3 border-t border-gray-100 space-y-3 flex-shrink-0",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[9px] font-black text-gray-400 uppercase tracking-wider mb-1",children:"Observações (opcional)"}),s.jsx("input",{value:f,onChange:$=>h($.target.value),placeholder:"ex: urgente, pós-cirúrgico, encaminhar para...",className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-xs focus:ring-2 focus:ring-blue-100 outline-none"})]}),s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsx("button",{onClick:e,className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase",children:"Cancelar"}),s.jsxs("button",{onClick:F,disabled:c.length===0||j,className:"flex items-center gap-2 px-5 py-2 bg-indigo-600 hover:bg-indigo-700 text-white font-bold rounded-lg text-xs uppercase disabled:opacity-40",children:[s.jsx(Ya,{size:14})," ",j?"Salvando...":"Gerar Pedido"]})]})]})]})]})]})})},Wv=t=>{let e;const n=new Set,r=(p,b)=>{const y=typeof p=="function"?p(e):p;if(!Object.is(y,e)){const x=e;e=b??(typeof y!="object"||y===null)?y:Object.assign({},e,y),n.forEach(v=>v(e,x))}},i=()=>e,f={setState:r,getState:i,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=e=t(r,i,f);return f},xM=(t=>t?Wv(t):Wv),bM=t=>t;function yM(t,e=bM){const n=qe.useSyncExternalStore(t.subscribe,qe.useCallback(()=>e(t.getState()),[t,e]),qe.useCallback(()=>e(t.getInitialState()),[t,e]));return qe.useDebugValue(n),n}const Xv=t=>{const e=xM(t),n=r=>yM(e,r);return Object.assign(n,e),n},vM=(t=>t?Xv(t):Xv),sm=vM(t=>({paciente:null,dentista:null,credenciada:"CASSEMS - SEDE CENTRAL",items:[],pendingSearch:"",setPaciente:e=>t({paciente:e}),setDentista:e=>t({dentista:e}),setCredenciada:e=>t({credenciada:e}),addItem:e=>t(n=>({items:[...n.items,e].slice(0,20)})),removeItem:e=>t(n=>({items:n.items.filter(r=>r.id!==e)})),updateItem:(e,n)=>t(r=>({items:r.items.map(i=>i.id===e?{...i,...n}:i)})),clear:()=>t({paciente:null,dentista:null,items:[]}),setPendingSearch:e=>t({pendingSearch:e})})),qt={q1:[14,13,12,11,18,17,16,15],q2:[21,22,23,24,25,26,27,28],q4:[44,43,42,41,48,47,46,45],q3:[31,32,33,34,35,36,37,38],extras:{q1:19,q2:29,q4:49,q3:39}},Ns={q1:[null,53,52,51,null,null,55,54],q2:[61,62,63,null,64,65,null,null],q4:[null,83,82,81,null,null,85,84],q3:[71,72,73,null,74,75,null,null]},NM=["O","M","D","V","L","P"],md=t=>t.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().trim(),EM=()=>{var fe;const t=sm(),e=$e(),[n,r]=A.useState([]),[i,c]=A.useState([]),[d,f]=A.useState([]),[h,p]=A.useState([]),[b,y]=A.useState(""),[x,v]=A.useState(null),[N,j]=A.useState("ADULTO"),[S,R]=A.useState(!1),[w,D]=A.useState([]),[C,I]=A.useState(null),[L,F]=A.useState(""),[Y,$]=A.useState(""),[M,H]=A.useState(1),[ne,ee]=A.useState(!1),[he,pe]=A.useState("");A.useEffect(()=>{(async()=>{const de=await K.getPacientes(),ye=await K.getDentistas(),Me=await K.getEspecialidades(),Wn=await K.getProcedimentos();r(Array.isArray(de)?de:(de==null?void 0:de.data)??[]),c(ye??[]),f(Me??[]),p(Wn??[])})()},[]);const z=A.useMemo(()=>b?h.filter(W=>W.especialidadeId===b):[],[b,h]),oe=A.useMemo(()=>{if(!he)return n.slice(0,30);const W=md(he);return n.filter(de=>md(de.nome).includes(W)||de.cpf&&de.cpf.includes(he.replace(/\D/g,""))).slice(0,30)},[n,he]);A.useEffect(()=>{const{pendingSearch:W}=t;if(!W||n.length===0)return;const de=md(W),ye=n.filter(Me=>{const Wn=md(Me.nome);return Wn===de||Wn.includes(de)||de.includes(Wn)});ye.length===1?t.setPaciente(ye[0]):(ye.length>1&&pe(W),ee(!0)),t.setPendingSearch("")},[n,t.pendingSearch]);const G=W=>{if(!x){e.error("SELECIONE UM PROCEDIMENTO ANTES DE ESCOLHER O DENTE.");return}if(x.tipo_regiao!=="DENTE"){e.error("ESTE PROCEDIMENTO NÃO PERMITE SELEÇÃO DE DENTE INDIVIDUAL.");return}const de=t.items.find(ye=>ye.dente===W&&ye.procedimentoId===x.id);if(de)t.removeItem(de.id),D(ye=>ye.filter(Me=>Me!==W));else{if(t.items.length>=20){e.error("LIMITE DE 20 ITENS ATINGIDO.");return}t.addItem({id:Math.random().toString(36).substring(7),procedimentoId:x.id,codigoTUSS:x.codigo||"000000",codigoInterno:x.codigoInterno||"",descricao:x.descricao_mobile||x.nome,dente:W,face:"",quantidade:1,valorUnitario:x.valorParticular||0,valorTotal:x.valorParticular||0}),D(ye=>[...ye,W]),I(null)}},te=W=>{if((x==null?void 0:x.tipo_regiao)!=="ARCO"){e.error("ESTE PROCEDIMENTO NÃO PERMITE SELEÇÃO DE ARCO.");return}D([]),I(W)},re=()=>{if(!x){e.error("SELECIONE UM PROCEDIMENTO PRIMEIRO.");return}if(x.tipo_regiao==="ARCO"&&!C){e.error("SELECIONE UM ARCO (AI/AS).");return}if(x.exige_face&&!L.trim()){e.error("A FACE É OBRIGATÓRIA PARA ESTE PROCEDIMENTO.");return}t.addItem({id:Math.random().toString(36).substring(7),procedimentoId:x.id,codigoTUSS:x.codigo||"000000",codigoInterno:x.codigoInterno||"",descricao:x.nome,arco:C||void 0,face:L,quantidade:1,valorUnitario:x.valorParticular||0,valorTotal:x.valorParticular||0,observacao:Y||void 0}),e.success("ADICIONADO AO RASCUNHO."),I(null),F(""),$("")},T=async()=>{if(!t.paciente||!t.dentista||t.items.length===0){e.error("PACIENTE, DENTISTA E PELO MENOS 1 ITEM SÃO OBRIGATÓRIOS.");return}const W=t.items.filter(de=>{if(!de.dente)return!1;const ye=h.find(Me=>Me.id===de.procedimentoId);return(ye==null?void 0:ye.exige_face)&&!de.face});if(W.length>0){e.error(`FACE OBRIGATÓRIA PARA ${W.map(de=>`DENTE ${de.dente}`).join(", ")}`);return}try{e.success("GTO GERADA COM SUCESSO!"),t.clear(),y(""),v(null),D([]),I(null),F(""),$("")}catch{e.error("ERRO AO GERAR GTO.")}},X=t.items.reduce((W,de)=>W+de.valorTotal,0),le=()=>{S&&(N==="ADULTO"?(w.filter(de=>parseInt(de)>=50).forEach(de=>{const ye=t.items.find(Me=>Me.dente===de&&Me.procedimentoId===(x==null?void 0:x.id));ye&&t.removeItem(ye.id)}),D(de=>de.filter(ye=>parseInt(ye)<50))):(w.filter(de=>parseInt(de)<50).forEach(de=>{const ye=t.items.find(Me=>Me.dente===de&&Me.procedimentoId===(x==null?void 0:x.id));ye&&t.removeItem(ye.id)}),D(de=>de.filter(ye=>parseInt(ye)>=50)))),R(W=>!W)},se=(W,de)=>{if(W===null)return s.jsx("div",{className:"w-7 h-7 sm:w-9 sm:h-9"},`empty-${de}`);const ye=W.toString(),Me=parseInt(ye)>=50,Wn=w.includes(ye),si=!!x&&x.tipo_regiao!=="DENTE";return s.jsx("button",{onClick:()=>G(ye),disabled:si,className:`w-7 h-7 sm:w-9 sm:h-9 rounded-lg border-2 text-[9px] sm:text-[11px] font-black transition-all shadow-sm flex items-center justify-center + ${Wn?Me?"bg-amber-500 border-amber-600 text-white scale-110 z-10":"bg-blue-600 border-blue-700 text-white scale-110 z-10":si?"bg-gray-50 border-gray-100 text-gray-300 cursor-not-allowed opacity-50":Me?"bg-white border-amber-200 text-amber-700 hover:border-amber-400 hover:bg-amber-50":"bg-white border-gray-200 text-gray-700 hover:border-blue-400 hover:bg-blue-50"} + `,children:ye},ye)},Ne=s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xl space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3 text-blue-600 font-black text-base uppercase tracking-wider",children:[s.jsx(sa,{size:20,strokeWidth:3})," 01. Paciente"]}),t.paciente?s.jsxs("div",{className:"flex items-center justify-between bg-blue-50 border-2 border-blue-200 rounded-2xl px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center text-white font-black text-xs flex-shrink-0",children:t.paciente.nome.charAt(0)}),s.jsx("span",{className:"font-black text-blue-800 text-sm uppercase truncate",children:t.paciente.nome})]}),s.jsx("button",{onClick:()=>t.setPaciente(null),className:"text-xs font-bold text-blue-500 hover:text-red-500 transition-colors flex-shrink-0 ml-3 uppercase",children:"ALTERAR"})]}):s.jsxs("button",{onClick:()=>ee(!0),className:"w-full p-4 bg-gray-50 border-2 border-dashed border-blue-200 rounded-2xl font-black text-blue-400 text-sm hover:bg-blue-50 hover:border-blue-400 transition-all uppercase flex items-center justify-center gap-2",children:[s.jsx(Qn,{size:16})," SELECIONAR BENEFICIÁRIO"]})]}),Ae=s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xl space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-3 text-orange-500 font-black text-base uppercase tracking-wider",children:[s.jsx(aa,{size:20,strokeWidth:3})," 02. Especialidade"]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("select",{value:b,onChange:W=>{y(W.target.value),v(null),D([]),I(null)},className:"w-full p-4 bg-gray-50 border-2 border-gray-100 rounded-2xl font-black text-gray-700 text-sm focus:border-orange-400 outline-none transition-all uppercase",children:[s.jsx("option",{value:"",children:"ESCOLHA A ÁREA..."}),d.map(W=>s.jsx("option",{value:W.id,children:W.nome},W.id))]}),b&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("select",{value:(x==null?void 0:x.id)||"",onChange:W=>{const de=h.find(ye=>ye.id===W.target.value);v(de||null),D([]),I(null),F(""),$("")},className:"w-full p-4 bg-white border-2 border-orange-100 rounded-2xl font-black text-gray-800 text-sm shadow-inner uppercase",children:[s.jsx("option",{value:"",children:"BUSCAR PROCEDIMENTO"}),z.map(W=>s.jsx("option",{value:W.id,children:W.nome},W.id))]}),x&&s.jsxs("div",{className:"bg-orange-50 p-3 rounded-xl border border-orange-100",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-bold text-orange-800",children:[s.jsx(Pa,{size:10}),x.tipo_regiao==="DENTE"?"CLIQUE OS DENTES NO ODONTOGRAMA":x.tipo_regiao==="ARCO"?"SELECIONE O ARCO (AI/AS)":"PROCEDIMENTO GERAL — CLIQUE ADICIONAR"]}),x.exige_face&&s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-bold text-red-600 mt-1",children:[s.jsx(Pa,{size:10})," EXIGE FACE CLÍNICA"]})]})]})]})]}),Re=s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xl space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3 text-[#2d6a4f] font-black text-base uppercase tracking-wider",children:[s.jsx(jl,{size:20,strokeWidth:3,className:"bg-green-100 p-1 rounded-full text-green-700"})," 03. Dentista Executor"]}),s.jsxs("select",{value:((fe=t.dentista)==null?void 0:fe.id)||"",onChange:W=>{const de=i.find(ye=>ye.id===W.target.value);t.setDentista(de||null)},className:"w-full p-4 bg-gray-50 border-2 border-gray-100 rounded-2xl font-black text-gray-800 text-sm focus:border-green-500 outline-none transition-all uppercase",children:[s.jsx("option",{value:"",children:"SELECIONE O PROFISSIONAL"}),i.map(W=>s.jsx("option",{value:W.id,children:W.nome},W.id))]})]}),ft=x&&x.tipo_regiao!=="DENTE"?s.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-gray-100 shadow-xl space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"04. Face & Observações"}),x.exige_face&&s.jsx("span",{className:"text-red-500 text-[9px] font-black animate-pulse",children:"* OBRIGATÓRIO"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-400 uppercase tracking-widest mb-2",children:"Face (O, M, D, V, L, P)"}),s.jsx("input",{type:"text",value:L,onChange:W=>F(W.target.value.toUpperCase()),className:`w-full p-4 border-2 rounded-2xl text-sm font-black outline-none transition-all + ${x.exige_face?"bg-red-50 border-red-100 focus:border-red-400":"bg-gray-50 border-gray-100 focus:border-amber-400"}`,placeholder:x.exige_face?"FACE OBRIGATÓRIA...":"OPCIONAL"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-400 uppercase tracking-widest mb-2 italic",children:"Observações"}),s.jsx("textarea",{value:Y,onChange:W=>$(W.target.value),rows:3,className:"w-full p-4 bg-gray-50 border-2 border-gray-100 rounded-2xl text-[11px] focus:border-amber-400 outline-none transition-all resize-none"})]}),s.jsxs("button",{onClick:re,className:"w-full bg-[#2d6a4f] text-white py-4 rounded-2xl font-black text-sm uppercase shadow-lg shadow-green-100 hover:bg-[#1b4332] active:scale-95 transition-all flex items-center justify-center gap-2 group",children:["ADICIONAR ITEM ",s.jsx(Pa,{size:16,className:"group-hover:translate-x-1 transition-transform"})]})]}):null,Le=s.jsx("div",{className:"p-2",children:s.jsxs("button",{onClick:T,className:"w-full bg-gray-900 text-white py-5 rounded-3xl font-black text-lg uppercase shadow-xl hover:bg-black active:scale-95 transition-all flex items-center justify-center gap-3",children:[s.jsx(jl,{size:22,strokeWidth:3})," FINALIZAR GTO"]})}),St=s.jsxs("div",{className:"bg-white rounded-3xl border border-gray-100 shadow-xl p-3 sm:p-8 space-y-4 sm:space-y-6",children:[s.jsx("div",{className:"flex justify-center mb-2 sm:mb-4",children:s.jsxs("div",{className:"inline-flex bg-gray-100 p-1 rounded-xl shadow-inner",children:[s.jsx("button",{onClick:()=>{j("ADULTO"),D([]),R(!1)},className:`px-5 sm:px-8 py-2 rounded-lg text-xs font-black transition-all uppercase ${N==="ADULTO"?"bg-blue-600 text-white shadow-md scale-105":"text-gray-500 hover:text-gray-800"}`,children:"Adulto"}),s.jsx("button",{onClick:()=>{j("CRIANCA"),D([]),R(!1)},className:`px-5 sm:px-8 py-2 rounded-lg text-xs font-black transition-all uppercase ${N==="CRIANCA"?"bg-blue-600 text-white shadow-md scale-105":"text-gray-500 hover:text-gray-800"}`,children:"Criança"})]})}),s.jsxs("div",{className:"relative border-t border-b border-gray-50 py-6 sm:py-10",children:[s.jsx("div",{className:"absolute left-1/2 top-4 bottom-4 w-[2px] bg-gray-200 -translate-x-1/2"}),s.jsx("div",{className:"absolute top-1/2 left-2 right-2 h-[2px] bg-gray-200 -translate-y-1/2"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-2 sm:gap-x-12 gap-y-6 sm:gap-y-16",children:[s.jsxs("div",{className:"flex justify-end items-center gap-1 sm:gap-2 pr-1 sm:pr-2",children:[N==="ADULTO"&&se(qt.extras.q1),s.jsx("div",{className:"grid grid-cols-4 gap-1 sm:gap-2",children:(N==="ADULTO"?qt.q1:Ns.q1).map((W,de)=>se(W,de))})]}),s.jsxs("div",{className:"flex justify-start items-center gap-1 sm:gap-2 pl-1 sm:pl-2",children:[s.jsx("div",{className:"grid grid-cols-4 gap-1 sm:gap-2",children:(N==="ADULTO"?qt.q2:Ns.q2).map((W,de)=>se(W,de))}),N==="ADULTO"&&se(qt.extras.q2)]}),s.jsxs("div",{className:"flex justify-end items-center gap-1 sm:gap-2 pr-1 sm:pr-2",children:[N==="ADULTO"&&se(qt.extras.q4),s.jsx("div",{className:"grid grid-cols-4 gap-1 sm:gap-2",children:(N==="ADULTO"?qt.q4:Ns.q4).map((W,de)=>se(W,de))})]}),s.jsxs("div",{className:"flex justify-start items-center gap-1 sm:gap-2 pl-1 sm:pl-2",children:[s.jsx("div",{className:"grid grid-cols-4 gap-1 sm:gap-2",children:(N==="ADULTO"?qt.q3:Ns.q3).map((W,de)=>se(W,de))}),N==="ADULTO"&&se(qt.extras.q3)]})]})]}),S&&s.jsxs("div",{className:"border-t-2 border-dashed border-amber-200 pt-4 space-y-3 animate-in fade-in slide-in-from-top-2 duration-200",children:[s.jsx("p",{className:"text-[9px] font-black text-amber-500 uppercase tracking-widest text-center",children:N==="ADULTO"?"— DENTES DECÍDUOS —":"— DENTES PERMANENTES —"}),s.jsxs("div",{className:"relative py-4 sm:py-6",children:[s.jsx("div",{className:"absolute left-1/2 top-2 bottom-2 w-[2px] bg-amber-100 -translate-x-1/2"}),s.jsx("div",{className:"absolute top-1/2 left-2 right-2 h-[2px] bg-amber-100 -translate-y-1/2"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-2 sm:gap-x-12 gap-y-6 sm:gap-y-16",children:[s.jsxs("div",{className:"flex justify-end items-center gap-1 sm:gap-2 pr-1 sm:pr-2",children:[N==="CRIANCA"&&se(qt.extras.q1),s.jsx("div",{className:"grid grid-cols-4 gap-1 sm:gap-2",children:(N==="ADULTO"?Ns.q1:qt.q1).map((W,de)=>se(W,de))})]}),s.jsxs("div",{className:"flex justify-start items-center gap-1 sm:gap-2 pl-1 sm:pl-2",children:[s.jsx("div",{className:"grid grid-cols-4 gap-1 sm:gap-2",children:(N==="ADULTO"?Ns.q2:qt.q2).map((W,de)=>se(W,de))}),N==="CRIANCA"&&se(qt.extras.q2)]}),s.jsxs("div",{className:"flex justify-end items-center gap-1 sm:gap-2 pr-1 sm:pr-2",children:[N==="CRIANCA"&&se(qt.extras.q4),s.jsx("div",{className:"grid grid-cols-4 gap-1 sm:gap-2",children:(N==="ADULTO"?Ns.q4:qt.q4).map((W,de)=>se(W,de))})]}),s.jsxs("div",{className:"flex justify-start items-center gap-1 sm:gap-2 pl-1 sm:pl-2",children:[s.jsx("div",{className:"grid grid-cols-4 gap-1 sm:gap-2",children:(N==="ADULTO"?Ns.q3:qt.q3).map((W,de)=>se(W,de))}),N==="CRIANCA"&&se(qt.extras.q3)]})]})]})]}),s.jsx("button",{onClick:le,className:`w-full py-2.5 rounded-2xl border-2 font-black text-[11px] uppercase transition-all flex items-center justify-center gap-2 + ${S?"border-amber-300 text-amber-600 bg-amber-50 hover:bg-amber-100":"border-dashed border-amber-200 text-amber-400 hover:border-amber-400 hover:bg-amber-50"}`,children:S?s.jsxs(s.Fragment,{children:[s.jsx(Qe,{size:13})," ",N==="ADULTO"?"REMOVER DECÍDUOS":"REMOVER PERMANENTES"]}):s.jsxs(s.Fragment,{children:[s.jsx(BN,{size:13})," ",N==="ADULTO"?"+ INCLUIR DENTES DECÍDUOS":"+ INCLUIR DENTES PERMANENTES"]})}),s.jsx("div",{className:"flex justify-center gap-4 pt-4",children:["AI","AS"].map(W=>s.jsx("button",{onClick:()=>te(W),disabled:!!x&&x.tipo_regiao!=="ARCO",className:`px-10 py-3 rounded-2xl border-2 font-black text-sm uppercase transition-all shadow-sm + ${C===W?"bg-amber-500 border-amber-600 text-white":x&&x.tipo_regiao!=="ARCO"?"bg-gray-50 border-gray-100 text-gray-300 cursor-not-allowed opacity-50":"bg-white border-gray-100 text-gray-500 hover:border-amber-400"}`,children:W==="AI"?"AI - Inferior":"AS - Superior"},W))})]}),Wt=s.jsxs("div",{className:"bg-white rounded-3xl border border-gray-100 overflow-hidden shadow-xl",children:[s.jsxs("div",{className:"bg-[#d49a4a] p-4 text-white font-black text-sm uppercase flex justify-between items-center tracking-widest",children:[s.jsx("span",{children:"PROCEDIMENTOS DO RASCUNHO"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"bg-white/20 px-3 py-1 rounded-full text-[10px]",children:[t.items.length,"/20"]}),s.jsxs("div",{className:"bg-white/20 px-3 py-1 rounded-full text-[10px]",children:["R$ ",X.toFixed(2)]})]})]}),s.jsxs("div",{className:"p-4 sm:p-6 space-y-3",children:[t.items.length===0&&s.jsxs("div",{className:"py-14 text-center text-gray-300 font-bold uppercase flex flex-col items-center gap-4",children:[s.jsx("div",{className:"w-16 h-16 bg-gray-50 rounded-full flex items-center justify-center outline outline-gray-100 outline-offset-4",children:s.jsx(bu,{size:32})}),s.jsxs("span",{className:"text-xs",children:["SELECIONE DENTES OU ARCOS",s.jsx("br",{}),"PARA INICIAR O RASCUNHO"]})]}),t.items.map(W=>{var ye;const de=W.dente?parseInt(W.dente)>=50:!1;return s.jsxs("div",{className:"border border-gray-100 rounded-2xl p-4 bg-gray-50/40 hover:bg-white transition-all shadow-sm",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[s.jsx("span",{className:`w-10 h-10 rounded-xl flex items-center justify-center text-[11px] font-black flex-shrink-0 border-2 + ${W.dente?de?"bg-amber-100 text-amber-700 border-amber-200":"bg-blue-100 text-blue-700 border-blue-200":"bg-amber-100 text-amber-600 border-amber-200"}`,children:W.dente||W.arco||"--"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"font-black text-xs text-gray-900 uppercase leading-tight truncate",children:W.descricao}),s.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-[9px] text-gray-400 font-bold uppercase",children:[s.jsx(aa,{size:8}),s.jsx("span",{className:"truncate",children:((ye=t.dentista)==null?void 0:ye.nome)||"SEM DENTISTA"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsxs("span",{className:"text-[10px] font-black text-green-600 whitespace-nowrap",children:["R$ ",W.valorTotal.toFixed(2)]}),s.jsx("button",{onClick:()=>{t.removeItem(W.id),W.dente&&D(Me=>Me.filter(Wn=>Wn!==W.dente))},className:"text-gray-300 hover:text-red-500 transition-colors p-0.5",children:s.jsx(Qt,{size:15})})]})]}),W.dente&&s.jsxs("div",{className:"flex items-center gap-1.5 mb-2.5 flex-wrap",children:[s.jsxs("span",{className:"text-[9px] font-black text-gray-400 uppercase tracking-wider w-full mb-1",children:["FACE CLÍNICA:",!W.face&&s.jsx("span",{className:"text-gray-300 font-normal normal-case ml-1 italic",children:"não selecionada"})]}),NM.map(Me=>s.jsx("button",{onClick:()=>t.updateItem(W.id,{face:W.face===Me?"":Me}),className:`w-9 h-9 rounded-xl border-2 text-[11px] font-black transition-all flex items-center justify-center + ${W.face===Me?"bg-blue-600 border-blue-700 text-white shadow-md":"bg-white border-gray-200 text-gray-400 hover:border-blue-300 hover:text-blue-500 hover:bg-blue-50"}`,children:Me},Me))]}),s.jsx("textarea",{value:W.observacao||"",onChange:Me=>t.updateItem(W.id,{observacao:Me.target.value}),placeholder:"OBSERVAÇÃO CLÍNICA...",rows:2,className:"w-full px-3 py-2.5 bg-white border border-gray-100 rounded-xl text-[11px] resize-none outline-none focus:border-amber-300 transition-colors placeholder:text-gray-300 leading-relaxed"})]},W.id)}),t.items.length>0&&s.jsxs("div",{className:"pt-4 border-t-2 border-dotted border-gray-200 flex justify-between items-center",children:[s.jsxs("button",{className:"flex items-center gap-2 text-blue-600 font-black text-[11px] uppercase hover:bg-blue-50 px-4 py-2 rounded-xl transition-all",children:[s.jsx(Dd,{size:16})," ANEXAR DOCUMENTOS"]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-[0.2em] mb-1",children:"TOTAL"}),s.jsxs("h3",{className:"text-2xl font-black text-gray-900 px-4 py-2 bg-gray-50 rounded-2xl border border-gray-100 shadow-inner",children:["R$ ",X.toFixed(2)]})]})]})]})]});return s.jsxs("div",{className:"space-y-6 pb-20 lg:pb-0",children:[s.jsx(fn,{title:"LANÇAR GTO",description:"MONTAGEM DINÂMICA DE GUIA ODONTOLÓGICA (GTO)."}),s.jsxs("div",{className:"hidden lg:grid grid-cols-12 gap-6 items-start",children:[s.jsxs("div",{className:"col-span-8 space-y-6",children:[St,Wt]}),s.jsxs("div",{className:"col-span-4 space-y-4 sticky top-6",children:[Ne,Ae,Re,ft,Le]})]}),s.jsxs("div",{className:"lg:hidden",children:[M===1&&s.jsxs("div",{className:"space-y-4",children:[Ne,Ae,Re]}),M===2&&St,M===3&&s.jsxs("div",{className:"space-y-4",children:[ft,Wt]})]}),s.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-40 lg:hidden bg-white/95 backdrop-blur-sm border-t border-gray-200 shadow-xl px-4 py-3 flex items-center justify-between gap-2",children:[M>1?s.jsxs("button",{onClick:()=>H(W=>W-1),className:"flex items-center gap-1.5 px-4 py-2.5 rounded-2xl border-2 border-gray-200 font-black text-xs text-gray-500 hover:bg-gray-50 transition-all uppercase",children:[s.jsx($a,{size:14})," VOLTAR"]}):s.jsx("div",{className:"w-24"}),s.jsx("div",{className:"flex items-center gap-2",children:[1,2,3].map(W=>s.jsx("button",{onClick:()=>H(W),className:`transition-all rounded-full ${M===W?"w-6 h-2.5 bg-blue-600":"w-2.5 h-2.5 bg-gray-200 hover:bg-gray-400"}`},W))}),M<3?s.jsxs("button",{onClick:()=>H(W=>W+1),className:"flex items-center gap-1.5 px-4 py-2.5 rounded-2xl bg-blue-600 text-white font-black text-xs hover:bg-blue-700 active:scale-95 transition-all uppercase shadow-md",children:["PRÓXIMO ",s.jsx(Pa,{size:14})]}):s.jsxs("button",{onClick:T,className:"flex items-center gap-1.5 px-4 py-2.5 rounded-2xl bg-gray-900 text-white font-black text-xs hover:bg-black active:scale-95 transition-all uppercase shadow-md",children:["FINALIZAR ",s.jsx(jl,{size:14})]})]}),ne&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-4",children:s.jsxs("div",{className:"bg-white rounded-3xl shadow-2xl w-full max-w-md flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex justify-between items-center",children:[s.jsxs("h3",{className:"font-black text-gray-900 uppercase tracking-wide text-sm flex items-center gap-2",children:[s.jsx(Qn,{size:16,className:"text-blue-600"})," BUSCAR PACIENTE"]}),s.jsx("button",{onClick:()=>{ee(!1),pe("")},className:"text-gray-400 hover:text-gray-600 p-1 hover:bg-gray-100 rounded-full transition-colors",children:s.jsx(Qe,{size:20})})]}),s.jsxs("div",{className:"p-5 space-y-3",children:[s.jsx("input",{autoFocus:!0,type:"text",value:he,onChange:W=>pe(W.target.value.toUpperCase()),placeholder:"NOME OU CPF...",className:"w-full p-4 bg-gray-50 border-2 border-gray-100 rounded-2xl font-black text-gray-800 text-sm focus:border-blue-500 outline-none transition-all uppercase"}),s.jsx("div",{className:"max-h-72 overflow-y-auto space-y-1",children:oe.length===0?s.jsx("div",{className:"py-10 text-center text-gray-300 font-bold uppercase text-xs",children:he?"NENHUM PACIENTE ENCONTRADO":"CARREGANDO..."}):oe.map(W=>s.jsxs("button",{onClick:()=>{t.setPaciente(W),ee(!1),pe("")},className:"w-full text-left px-4 py-3 hover:bg-blue-50 rounded-xl transition-all flex items-center gap-3 group",children:[s.jsx("div",{className:"w-9 h-9 bg-blue-100 rounded-full flex items-center justify-center text-blue-600 font-black text-sm flex-shrink-0 group-hover:bg-blue-600 group-hover:text-white transition-colors",children:W.nome.charAt(0)}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-black text-sm text-gray-800 uppercase truncate",children:W.nome}),W.cpf&&s.jsx("div",{className:"text-[10px] text-gray-400 font-bold",children:W.cpf})]})]},W.id))})]})]})})]})},jM=["V","L","M","D","O"],SM=["Superior","Inferior","Ambas"],AM=["Pix","Cartão","Dinheiro","Boleto"],wM=["Pendente","Pago","Atrasado"],Jn=t=>t.toLocaleString("pt-BR",{style:"currency",currency:"BRL"});function Zv(t,e){const n=new Date(t+"T12:00:00");return n.setMonth(n.getMonth()+e),n.toISOString().slice(0,10)}const CM=({item:t,onChange:e,onRemove:n})=>{const[r,i]=A.useState(t.proc.tipo_regiao!=="GERAL"),c="border border-gray-200 rounded-lg px-2 py-1.5 text-xs focus:ring-2 focus:ring-blue-100 outline-none w-full";return s.jsxs("div",{className:"border border-gray-200 rounded-xl bg-white overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase truncate",children:t.proc.nome}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[t.proc.especialidadeNome&&s.jsx("span",{className:"text-[9px] bg-blue-50 text-blue-600 px-1.5 py-0.5 rounded-full font-bold uppercase",children:t.proc.especialidadeNome}),s.jsx("span",{className:"text-[10px] font-bold text-green-600",children:Jn(t.valorUnit*t.quantidade)}),t.quantidade>1&&s.jsxs("span",{className:"text-[9px] text-gray-400",children:[t.quantidade,"× ",Jn(t.valorUnit)]})]})]}),s.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[s.jsx("button",{onClick:()=>e({quantidade:Math.max(1,t.quantidade-1)}),className:"w-6 h-6 rounded-full border border-gray-200 flex items-center justify-center hover:bg-gray-100",children:s.jsx(YN,{size:10})}),s.jsx("span",{className:"w-5 text-center text-xs font-bold",children:t.quantidade}),s.jsx("button",{onClick:()=>e({quantidade:t.quantidade+1}),className:"w-6 h-6 rounded-full border border-gray-200 flex items-center justify-center hover:bg-gray-100",children:s.jsx(gt,{size:10})})]}),s.jsx("button",{onClick:()=>i(d=>!d),className:"text-gray-300 hover:text-gray-600 flex-shrink-0",children:s.jsx(Lo,{size:14,className:`transition-transform ${r?"rotate-180":""}`})}),s.jsx("button",{onClick:n,className:"text-gray-300 hover:text-red-500 flex-shrink-0",children:s.jsx(Qt,{size:13})})]}),r&&s.jsxs("div",{className:"border-t border-gray-100 bg-gray-50/50 px-3 py-2.5 grid grid-cols-2 gap-2",children:[t.proc.tipo_regiao==="DENTE"&&s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Dente(s)"}),s.jsx("input",{value:t.dente,onChange:d=>e({dente:d.target.value}),className:c,placeholder:"ex: 16, 21-22"})]}),t.proc.tipo_regiao==="ARCO"&&s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Arcada"}),s.jsxs("select",{value:t.arco,onChange:d=>e({arco:d.target.value}),className:c,children:[s.jsx("option",{value:"",children:"— Selecione —"}),SM.map(d=>s.jsx("option",{children:d},d))]})]}),t.proc.exige_face&&s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Face(s)"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:jM.map(d=>s.jsx("button",{type:"button",onClick:()=>{const f=t.face.split("").filter(Boolean),h=f.includes(d)?f.filter(p=>p!==d):[...f,d];e({face:h.join("")})},className:`w-7 h-7 rounded-lg text-[10px] font-black border transition-colors ${t.face.includes(d)?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-500 border-gray-200 hover:border-blue-400"}`,children:d},d))})]}),s.jsxs("div",{className:t.proc.tipo_regiao!=="GERAL"||t.proc.exige_face?"":"col-span-2",children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Obs"}),s.jsx("input",{value:t.observacao,onChange:d=>e({observacao:d.target.value}),className:c,placeholder:"observação opcional"})]})]})]})},DM=({patient:t,onClose:e,onSaved:n})=>{const r=$e(),{data:i}=Ie(K.getProcedimentos),{data:c}=Ie(K.getEspecialidades),{data:d}=Ie(K.getPlanos),f=i??[],h=c??[],p=d??[],[b,y]=A.useState(""),[x,v]=A.useState(""),[N,j]=A.useState([]),[S,R]=A.useState(!1),[w,D]=A.useState("R$"),[C,I]=A.useState(""),[L,F]=A.useState(""),[Y,$]=A.useState(1),[M,H]=A.useState(new Date().toISOString().slice(0,10)),[ne,ee]=A.useState("Pix"),[he,pe]=A.useState("Pendente"),z=A.useMemo(()=>t.convenio?p.find(fe=>fe.nome===t.convenio)??null:null,[t.convenio,p]),oe=fe=>{var W;if(z){const de=(W=fe.valoresPlanos)==null?void 0:W.find(ye=>ye.planoId===z.id);if(de)return de.valor}return fe.valorParticular??0},G=fe=>{if(N.some(W=>W.proc.id===fe.id)){j(W=>W.map(de=>de.proc.id===fe.id?{...de,quantidade:de.quantidade+1}:de));return}j(W=>[...W,{uid:`${fe.id}_${Date.now()}`,proc:fe,quantidade:1,dente:"",face:"",arco:"",observacao:"",valorUnit:oe(fe)}])},te=(fe,W)=>j(de=>de.map(ye=>ye.uid===fe?{...ye,...W}:ye)),re=fe=>j(W=>W.filter(de=>de.uid!==fe)),T=N.reduce((fe,W)=>fe+W.valorUnit*W.quantidade,0),X=parseFloat(C)||0,le=w==="%"?T*X/100:X,se=parseFloat(L)||0,Ne=Math.max(0,T-le-se),Ae=Y>0?Ne/Y:0,Re=A.useMemo(()=>f.filter(fe=>!(x&&fe.especialidadeId!==x||b&&!fe.nome.toLowerCase().includes(b.toLowerCase()))),[f,x,b]),ft=A.useMemo(()=>{const fe={};return Re.forEach(W=>{const de=W.especialidadeId||"__geral";fe[de]||(fe[de]={esp:h.find(ye=>ye.id===W.especialidadeId)??null,procs:[]}),fe[de].procs.push(W)}),Object.values(fe).sort((W,de)=>{var ye,Me;return(((ye=W.esp)==null?void 0:ye.ordem)??99)-(((Me=de.esp)==null?void 0:Me.ordem)??99)})},[Re,h]),Le=async()=>{if(N.length===0){r.error("SELECIONE AO MENOS UM PROCEDIMENTO");return}R(!0);try{const fe=[],W=N.map(de=>{const ye=[de.dente,de.arco,de.face].filter(Boolean).join("/");return de.proc.nome+(ye?` (${ye})`:"")+(de.quantidade>1?` x${de.quantidade}`:"")}).join(", ");se>0&&fe.push({id:crypto.randomUUID(),pacienteNome:t.nome,descricao:`ENTRADA — ${W}`,valor:se,dataVencimento:M,status:"Pago",formaPagamento:ne});for(let de=0;de1?` — ${de+1}/${Y}`:"";fe.push({id:crypto.randomUUID(),pacienteNome:t.nome,descricao:W+ye,valor:parseFloat(Ae.toFixed(2)),dataVencimento:se>0?Zv(M,de+1):Zv(M,de),status:de===0&&Y===1||de===0?he:"Pendente",formaPagamento:ne})}for(const de of fe)await K.saveFinanceiro(de);r.success(`${fe.length} LANÇAMENTO(S) GERADO(S) COM SUCESSO!`),n(),e()}catch{r.error("ERRO AO SALVAR LANÇAMENTOS")}finally{R(!1)}},St="border border-gray-200 rounded-lg px-2.5 py-2 text-sm focus:ring-2 focus:ring-blue-100 outline-none w-full bg-white",Wt=fe=>N.some(W=>W.proc.id===fe);return s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[s.jsxs("div",{className:"flex-shrink-0 px-5 py-4 border-b border-gray-100 flex items-center justify-between bg-gradient-to-r from-emerald-50 to-white",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-9 h-9 bg-emerald-100 rounded-xl flex items-center justify-center",children:s.jsx(Fa,{size:18,className:"text-emerald-600"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-black text-gray-800 uppercase",children:"Lançar Procedimento"}),s.jsxs("p",{className:"text-[10px] text-gray-400 uppercase font-medium",children:[t.nome,z&&s.jsx("span",{className:"ml-2 bg-emerald-100 text-emerald-700 px-1.5 py-0.5 rounded-full font-bold",children:z.nome})]})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600 p-1.5 hover:bg-gray-100 rounded-lg transition-colors",children:s.jsx(Qe,{size:18})})]}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsxs("div",{className:"w-72 flex-shrink-0 border-r border-gray-100 flex flex-col bg-gray-50/30",children:[s.jsxs("div",{className:"p-3 space-y-2 border-b border-gray-100 flex-shrink-0",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Qn,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400"}),s.jsx("input",{value:b,onChange:fe=>y(fe.target.value),placeholder:"Buscar procedimento...",className:"w-full pl-8 pr-3 py-2 border border-gray-200 rounded-lg text-xs focus:ring-2 focus:ring-blue-100 outline-none bg-white"})]}),s.jsxs("div",{className:"flex gap-1 flex-wrap",children:[s.jsx("button",{onClick:()=>v(""),className:`text-[10px] font-bold px-2 py-0.5 rounded-full border transition-colors ${x?"text-gray-500 border-gray-200 hover:bg-gray-100":"bg-gray-800 text-white border-gray-800"}`,children:"Todas"}),h.map(fe=>s.jsx("button",{onClick:()=>v(W=>W===fe.id?"":fe.id),className:`text-[10px] font-bold px-2 py-0.5 rounded-full border transition-colors ${x===fe.id?"bg-blue-600 text-white border-blue-600":"text-gray-500 border-gray-200 hover:bg-gray-100"}`,children:fe.nome},fe.id))]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-3",children:[!i&&s.jsx("div",{className:"flex justify-center pt-8",children:s.jsx(Ot,{size:18,className:"animate-spin text-gray-300"})}),ft.map((fe,W)=>s.jsxs("div",{children:[fe.esp&&s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest px-2 mb-1",children:fe.esp.nome}),s.jsx("div",{className:"space-y-0.5",children:fe.procs.map(de=>{const ye=oe(de),Me=Wt(de.id);return s.jsxs("button",{onClick:()=>G(de),className:`w-full text-left px-2.5 py-2 rounded-lg transition-all flex items-center justify-between gap-2 group ${Me?"bg-emerald-50 border border-emerald-200":"border border-transparent hover:bg-white hover:border-gray-200 hover:shadow-sm"}`,children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:`text-xs font-bold truncate ${Me?"text-emerald-700":"text-gray-700"}`,children:de.nome}),de.codigo&&s.jsx("p",{className:"text-[9px] text-gray-400",children:de.codigo})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:`text-[10px] font-black ${Me?"text-emerald-600":"text-green-600"}`,children:Jn(ye)}),Me?s.jsx(jl,{size:13,className:"text-emerald-500"}):s.jsx(gt,{size:13,className:"text-gray-300 group-hover:text-blue-500"})]})]},de.id)})})]},W)),i&&Re.length===0&&s.jsx("p",{className:"text-xs text-gray-400 text-center pt-6",children:"Nenhum procedimento encontrado"})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-2",children:N.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-2xl flex items-center justify-center mb-3",children:s.jsx(mO,{size:24,className:"text-gray-300"})}),s.jsx("p",{className:"text-sm font-bold text-gray-400",children:"Nenhum procedimento selecionado"}),s.jsx("p",{className:"text-xs text-gray-300 mt-1",children:"Clique nos procedimentos ao lado para adicionar"})]}):N.map(fe=>s.jsx(CM,{item:fe,onChange:W=>te(fe.uid,W),onRemove:()=>re(fe.uid)},fe.uid))}),s.jsxs("div",{className:"flex-shrink-0 border-t border-gray-100 bg-gray-50/50 p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"font-bold text-gray-500 uppercase text-xs",children:"Subtotal"}),s.jsx("span",{className:"font-black text-gray-800 text-base",children:Jn(T)})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Desconto"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx("button",{onClick:()=>D(fe=>fe==="R$"?"%":"R$"),className:"px-2 py-2 border border-gray-200 rounded-lg text-[10px] font-black text-gray-500 hover:bg-gray-100 flex-shrink-0 bg-white",children:w==="R$"?s.jsx(UN,{size:12}):s.jsx(HD,{size:12})}),s.jsx("input",{type:"number",step:"0.01",value:C,onChange:fe=>I(fe.target.value),placeholder:"0",className:St+" text-sm"})]}),le>0&&s.jsxs("p",{className:"text-[10px] text-red-500 mt-0.5",children:["− ",Jn(le)]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Entrada (R$)"}),s.jsx("input",{type:"number",step:"0.01",value:L,onChange:fe=>F(fe.target.value),placeholder:"0",className:St}),se>0&&s.jsxs("p",{className:"text-[10px] text-blue-500 mt-0.5",children:["− ",Jn(se)," (marca como Pago)"]})]})]}),s.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-3 space-y-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs font-black text-gray-500 uppercase",children:"Restante a parcelar"}),s.jsx("span",{className:"text-lg font-black text-emerald-600",children:Jn(Ne)})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Parcelas"}),s.jsx("select",{value:Y,onChange:fe=>$(Number(fe.target.value)),className:St+" text-xs",children:Array.from({length:48},(fe,W)=>W+1).map(fe=>s.jsxs("option",{value:fe,children:[fe,"x — ",Jn(Ne/fe)]},fe))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"1ª Parcela"}),s.jsx("input",{type:"date",value:M,onChange:fe=>H(fe.target.value),className:St+" text-xs"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Forma"}),s.jsx("select",{value:ne,onChange:fe=>ee(fe.target.value),className:St+" text-xs",children:AM.map(fe=>s.jsx("option",{children:fe},fe))})]})]}),Y>1&&s.jsxs("div",{className:"flex items-center justify-between bg-emerald-50 rounded-lg px-3 py-2",children:[s.jsxs("span",{className:"text-xs font-bold text-emerald-700",children:[Y,"x de"]}),s.jsx("span",{className:"text-sm font-black text-emerald-700",children:Jn(Ae)})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[9px] font-black text-gray-400 uppercase block mb-1",children:"Status 1ª parcela"}),s.jsx("select",{value:he,onChange:fe=>pe(fe.target.value),className:St+" text-xs",children:wM.map(fe=>s.jsx("option",{children:fe},fe))})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs("div",{className:"w-full bg-gray-50 border border-gray-100 rounded-lg p-2 text-center",children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase",children:"Total geral"}),s.jsx("p",{className:"text-sm font-black text-gray-800",children:Jn(se+Ne)})]})})]})]}),s.jsxs("div",{className:"flex gap-2 pt-1",children:[s.jsx("button",{onClick:e,className:"px-5 py-2.5 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase flex-shrink-0",children:"Cancelar"}),s.jsxs("button",{onClick:Le,disabled:N.length===0||S,className:"flex-1 py-2.5 bg-emerald-600 hover:bg-emerald-700 text-white font-black rounded-lg text-xs uppercase disabled:opacity-40 flex items-center justify-center gap-2 transition-colors",children:[S?s.jsx(Ot,{size:14,className:"animate-spin"}):s.jsx(jl,{size:14}),S?"Salvando...":`Confirmar ${N.length>0?`— ${Jn(se+Ne)}`:""}`]})]})]})]})]})]})})};function OM(t,e){const[n,r]=A.useState(t);return A.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}function RM({label:t,placeholder:e,value:n,onSelect:r,onClear:i,fetchFn:c}){const[d,f]=A.useState(""),[h,p]=A.useState([]),[b,y]=A.useState(!1),[x,v]=A.useState(!1),N=OM(d,300),j=A.useRef(null);return A.useEffect(()=>{if(!N.trim()||n){p([]),y(!1);return}v(!0),c(N).then(S=>{const R=Array.isArray(S)?S:[];p(R),y(R.length>0)}).finally(()=>v(!1))},[N]),A.useEffect(()=>{const S=R=>{j.current&&!j.current.contains(R.target)&&y(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]),n?s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:t}),s.jsxs("div",{className:"flex items-center justify-between bg-blue-50 border border-blue-100 rounded-lg px-3 py-2",children:[s.jsx("span",{className:"text-xs font-bold text-blue-700 uppercase truncate",children:n.nome}),s.jsx("button",{type:"button",onClick:i,className:"ml-2 text-blue-300 hover:text-blue-600 flex-shrink-0",children:s.jsx(Qe,{size:13})})]})]}):s.jsxs("div",{ref:j,className:"relative",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:t}),s.jsxs("div",{className:"relative",children:[s.jsx(Qn,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),s.jsx("input",{value:d,onChange:S=>f(S.target.value),placeholder:e,className:"w-full pl-7 pr-3 py-2 border border-gray-200 rounded-lg text-xs focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none"}),x&&s.jsx(Ot,{size:12,className:"absolute right-2.5 top-1/2 -translate-y-1/2 animate-spin text-gray-400"})]}),b&&h.length>0&&s.jsx("div",{className:"absolute z-50 w-full mt-1 bg-white border border-gray-200 rounded-xl shadow-xl overflow-hidden",children:h.map(S=>s.jsxs("button",{type:"button",onClick:()=>{r(S),f(""),y(!1)},className:"w-full text-left px-3 py-2 hover:bg-blue-50 text-xs font-medium text-gray-700 flex items-center gap-2 border-b border-gray-50 last:border-0",children:[s.jsx(sa,{size:12,className:"text-gray-400 flex-shrink-0"}),S.nome]},S.id))})]})}const Kv=`CLÁUSULA 1ª – DO OBJETO +O presente contrato tem por objeto a prestação de serviços odontológicos conforme os procedimentos descritos neste instrumento, obrigando-se o profissional a realizá-los com toda a técnica e diligência necessárias. + +CLÁUSULA 2ª – DAS OBRIGAÇÕES DO CONTRATANTE +O(A) paciente obriga-se a: comparecer às consultas agendadas; comunicar cancelamentos com antecedência mínima de 24 horas; seguir as orientações clínicas do profissional; e efetuar os pagamentos nos prazos acordados. + +CLÁUSULA 3ª – DO PAGAMENTO +O valor total do tratamento, a forma de pagamento e o parcelamento estão descritos neste contrato. Em caso de atraso no pagamento, incidirão multa de 2% (dois por cento) e juros de 1% (um por cento) ao mês sobre o valor devido. + +CLÁUSULA 4ª – DA VIGÊNCIA +O presente contrato vigorará pelo período necessário à conclusão do tratamento acordado, podendo ser prorrogado mediante aditivo escrito firmado por ambas as partes. + +CLÁUSULA 5ª – DO CANCELAMENTO E DESISTÊNCIA +Em caso de desistência do tratamento pelo contratante, serão devidos os valores correspondentes aos procedimentos já realizados. Os valores pagos a maior serão restituídos no prazo de 30 dias. + +CLÁUSULA 6ª – DA PROTEÇÃO DE DADOS (LGPD) +Os dados pessoais e de saúde do contratante serão tratados em conformidade com a Lei nº 13.709/2018 (LGPD), utilizados exclusivamente para fins relacionados ao tratamento odontológico. + +CLÁUSULA 7ª – DO FORO +Fica eleito o foro da comarca do domicílio do contratado para dirimir quaisquer controvérsias oriundas do presente contrato, com renúncia expressa de qualquer outro.`,Ep=["DADOS","ITENS","CLÁUSULAS"],Sn=t=>t.toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),TM=({form:t,items:e,valorTotal:n,contratoId:r,onBack:i})=>{const c=new Date().toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"}),d=n-t.entrada,f=t.parcelas>0&&d>0?d/t.parcelas:0;return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center gap-3 print:hidden flex-shrink-0",children:[s.jsxs("button",{type:"button",onClick:i,className:"flex items-center gap-1.5 px-3 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-xs font-bold",children:[s.jsx($a,{size:14})," Voltar"]}),s.jsxs("button",{type:"button",onClick:()=>window.print(),className:"flex items-center gap-1.5 px-4 py-2 bg-gray-900 hover:bg-black text-white rounded-lg text-xs font-bold",children:[s.jsx(Ya,{size:14})," Imprimir / Salvar PDF"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-6 print:p-0 print:bg-white",children:s.jsxs("div",{className:"max-w-3xl mx-auto bg-white rounded-2xl shadow-sm border border-gray-200 p-10 print:shadow-none print:rounded-none print:border-0 print:max-w-full",children:[s.jsxs("div",{className:"text-center border-b-2 border-gray-800 pb-6 mb-6",children:[s.jsx("h1",{className:"text-xl font-black text-gray-900 uppercase tracking-wide",children:"CONTRATO DE PRESTAÇÃO DE SERVIÇOS ODONTOLÓGICOS"}),s.jsx("p",{className:"text-sm text-gray-500 mt-1 font-bold uppercase",children:"Nome da Clínica"}),r&&s.jsxs("p",{className:"text-[10px] text-gray-400 mt-0.5",children:["Contrato Nº ",r]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6 mb-6",children:[s.jsxs("div",{className:"border border-gray-200 rounded-xl p-4",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest mb-2",children:"CONTRATANTE (PACIENTE)"}),s.jsx("p",{className:"font-bold text-gray-800 uppercase",children:t.pacienteNome||"—"}),s.jsxs("div",{className:"mt-2 space-y-1",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"CPF: ___________________________________"}),s.jsx("p",{className:"text-xs text-gray-500",children:"RG: ____________________________________"}),s.jsx("p",{className:"text-xs text-gray-500",children:"Endereço: ______________________________"})]})]}),s.jsxs("div",{className:"border border-gray-200 rounded-xl p-4",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest mb-2",children:"CONTRATADO (DENTISTA)"}),s.jsx("p",{className:"font-bold text-gray-800 uppercase",children:t.dentistaNome||"—"}),s.jsxs("div",{className:"mt-2 space-y-1",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"CRO: ___________________________________"}),s.jsxs("p",{className:"text-xs text-gray-500",children:["Especialidade: ",t.especialidadeNome||"—"]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["Data de início: ",t.dataInicio?new Date(t.dataInicio+"T12:00").toLocaleDateString("pt-BR"):"—"]})]})]})]}),s.jsxs("div",{className:"mb-6",children:[s.jsxs("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:["OBJETO DO CONTRATO — ",t.titulo]}),e.length>0?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-gray-50",children:[s.jsx("th",{className:"text-left px-3 py-2 text-xs font-black text-gray-500 uppercase border border-gray-200",children:"Procedimento"}),s.jsx("th",{className:"text-center px-3 py-2 text-xs font-black text-gray-500 uppercase border border-gray-200 w-16",children:"Qtd"}),s.jsx("th",{className:"text-right px-3 py-2 text-xs font-black text-gray-500 uppercase border border-gray-200 w-28",children:"Unit."}),s.jsx("th",{className:"text-right px-3 py-2 text-xs font-black text-gray-500 uppercase border border-gray-200 w-28",children:"Total"})]})}),s.jsx("tbody",{children:e.map((h,p)=>s.jsxs("tr",{className:p%2===0?"bg-white":"bg-gray-50/50",children:[s.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 border border-gray-200 font-medium uppercase",children:h.procedimentoNome}),s.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 border border-gray-200 text-center",children:h.quantidade}),s.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 border border-gray-200 text-right",children:Sn(h.valorUnitario)}),s.jsx("td",{className:"px-3 py-2 text-xs text-gray-700 border border-gray-200 text-right font-bold",children:Sn(h.valorTotal)})]},h.id))}),s.jsx("tfoot",{children:s.jsxs("tr",{className:"bg-gray-100",children:[s.jsx("td",{colSpan:3,className:"px-3 py-2 text-xs font-black text-gray-700 uppercase border border-gray-200 text-right",children:"VALOR TOTAL"}),s.jsx("td",{className:"px-3 py-2 text-sm font-black text-gray-900 border border-gray-200 text-right",children:Sn(n)})]})})]}):s.jsx("p",{className:"text-xs text-gray-500 italic",children:"Nenhum procedimento listado."})]}),s.jsxs("div",{className:"mb-6 border border-gray-200 rounded-xl p-4",children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3",children:"RESUMO FINANCEIRO"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Valor Total"}),s.jsx("p",{className:"font-bold text-gray-800",children:Sn(n)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Forma de Pagamento"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.formaPagamento||"—"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Entrada"}),s.jsx("p",{className:"font-bold text-gray-800",children:Sn(t.entrada)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Restante"}),s.jsx("p",{className:"font-bold text-gray-800",children:Sn(d)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Parcelas"}),s.jsxs("p",{className:"font-bold text-gray-800",children:[t.parcelas,"x"]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Valor por Parcela"}),s.jsx("p",{className:"font-bold text-gray-800",children:Sn(f)})]})]})]}),t.clausulas&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:"CLÁUSULAS CONTRATUAIS"}),s.jsx("div",{className:"text-xs text-gray-700 whitespace-pre-wrap leading-relaxed",children:t.clausulas})]}),s.jsxs("div",{className:"mt-10 pt-6 border-t-2 border-gray-800",children:[s.jsx("p",{className:"text-xs text-gray-500 text-center mb-8",children:"Estando de pleno acordo com as cláusulas e condições acima, as partes assinam o presente contrato."}),s.jsxs("p",{className:"text-xs text-gray-500 text-center mb-10",children:["___________________, ",c,"."]}),s.jsx("div",{className:"grid grid-cols-3 gap-8",children:[{title:"CONTRATANTE (PACIENTE)",name:t.pacienteNome},{title:"CONTRATADO (DENTISTA)",name:t.dentistaNome},{title:"TESTEMUNHA",name:""}].map((h,p)=>s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"h-16 border-b border-gray-400 mb-2"}),s.jsx("p",{className:"text-[10px] font-black text-gray-500 uppercase",children:h.title}),h.name&&s.jsx("p",{className:"text-[10px] text-gray-400 uppercase mt-0.5",children:h.name}),s.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"CPF: __________________________"})]},p))})]}),r&&s.jsxs("div",{className:"mt-6 pt-3 border-t border-gray-100 flex justify-between items-center",children:[s.jsxs("p",{className:"text-[9px] text-gray-300",children:["ID: ",r]}),s.jsxs("p",{className:"text-[9px] text-gray-300",children:["Gerado em ",c]})]})]})})]})},oj=({contrato:t,paciente:e,onClose:n,onSaved:r})=>{var oe;const i=$e(),{data:c}=Ie(K.getDentistas),{data:d}=Ie(K.getEspecialidades),{data:f}=Ie(K.getProcedimentos),[h,p]=A.useState(0),[b,y]=A.useState("editor"),[x,v]=A.useState(!1),[N,j]=A.useState({titulo:(t==null?void 0:t.titulo)||"CONTRATO DE SERVIÇOS ODONTOLÓGICOS",status:(t==null?void 0:t.status)||"Rascunho",pacienteId:(t==null?void 0:t.pacienteId)||(e==null?void 0:e.id)||"",pacienteNome:(t==null?void 0:t.pacienteNome)||(e==null?void 0:e.nome)||"",dentistaId:(t==null?void 0:t.dentistaId)||"",dentistaNome:(t==null?void 0:t.dentistaNome)||"",especialidadeId:(t==null?void 0:t.especialidadeId)||"",especialidadeNome:(t==null?void 0:t.especialidadeNome)||"",dataInicio:(t==null?void 0:t.dataInicio)||new Date().toISOString().split("T")[0],dataFim:(t==null?void 0:t.dataFim)||"",observacoes:(t==null?void 0:t.observacoes)||"",entrada:(t==null?void 0:t.entrada)||0,parcelas:(t==null?void 0:t.parcelas)||1,formaPagamento:(t==null?void 0:t.formaPagamento)||"Pix",clausulas:(t==null?void 0:t.clausulas)||Kv}),[S,R]=A.useState(((oe=t==null?void 0:t.items)==null?void 0:oe.map((G,te)=>({id:G.id,procedimentoNome:G.procedimentoNome,quantidade:G.quantidade,valorUnitario:G.valorUnitario,valorTotal:G.valorTotal,descricao:G.descricao,ordem:G.ordem??te})))??[]),[w,D]=A.useState(e?{id:e.id,nome:e.nome}:t!=null&&t.pacienteId?{id:t.pacienteId,nome:t.pacienteNome}:null),[C,I]=A.useState(""),L=S.length>0?S.reduce((G,te)=>G+te.valorTotal,0):0,F=L-N.entrada,Y=N.parcelas>0&&F>0?F/N.parcelas:0;A.useEffect(()=>{const G=te=>{te.key==="Escape"&&n()};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[n]);const $=G=>{const te=d==null?void 0:d.find(re=>re.id===G);j(re=>({...re,especialidadeId:G,especialidadeNome:(te==null?void 0:te.nome)||"",titulo:te?`CONTRATO DE SERVIÇOS ODONTOLÓGICOS — ${te.nome.toUpperCase()}`:re.titulo}))},M=G=>{const te=S.find(T=>T.procedimentoNome===G.nome);if(te){R(T=>T.map(X=>X.id===te.id?{...X,quantidade:X.quantidade+1,valorTotal:(X.quantidade+1)*X.valorUnitario}:X));return}const re={id:Math.random().toString(36).substring(2,10),procedimentoNome:G.nome,quantidade:1,valorUnitario:G.valorParticular,valorTotal:G.valorParticular,ordem:S.length};R(T=>[...T,re])},H=()=>{const G={id:Math.random().toString(36).substring(2,10),procedimentoNome:"",quantidade:1,valorUnitario:0,valorTotal:0,ordem:S.length};R(te=>[...te,G])},ne=(G,te,re)=>{R(T=>T.map(X=>{if(X.id!==G)return X;const le={...X,[te]:re};return(te==="quantidade"||te==="valorUnitario")&&(le.valorTotal=le.quantidade*le.valorUnitario),le}))},ee=G=>R(te=>te.filter(re=>re.id!==G)),he=G=>{if(!G.destination)return;const te=[...S],[re]=te.splice(G.source.index,1);te.splice(G.destination.index,0,re),R(te.map((T,X)=>({...T,ordem:X})))},pe=async()=>{if(!N.pacienteNome&&!w){i.error("SELECIONE UM PACIENTE.");return}v(!0);try{const G={id:t==null?void 0:t.id,titulo:N.titulo,status:N.status,paciente_id:(w==null?void 0:w.id)||N.pacienteId||void 0,paciente_nome:(w==null?void 0:w.nome)||N.pacienteNome,dentista_id:N.dentistaId||void 0,dentista_nome:N.dentistaNome||void 0,especialidade_id:N.especialidadeId||void 0,especialidade_nome:N.especialidadeNome||void 0,data_inicio:N.dataInicio||void 0,data_fim:N.dataFim||void 0,valor_total:L,entrada:N.entrada,parcelas:N.parcelas,forma_pagamento:N.formaPagamento,clausulas:N.clausulas,observacoes:N.observacoes||void 0,items:S.map((te,re)=>({id:te.id,procedimento_nome:te.procedimentoNome,quantidade:te.quantidade,valor_unitario:te.valorUnitario,valor_total:te.valorTotal,descricao:te.descricao||void 0,ordem:re}))};t!=null&&t.id?await K.updateContrato({...t,...G,items:t.items}):await K.saveContrato(G),i.success("CONTRATO SALVO COM SUCESSO!"),r(),n()}catch{i.error("ERRO AO SALVAR CONTRATO.")}finally{v(!1)}},z=qe.useMemo(()=>{const G=f??[],te=C.trim()?G.filter(T=>T.nome.toLowerCase().includes(C.toLowerCase())||T.especialidadeNome.toLowerCase().includes(C.toLowerCase())):G,re={};return te.forEach(T=>{const X=T.especialidadeNome||"Outros";re[X]||(re[X]=[]),re[X].push(T)}),re},[f,C]);return b==="print"?s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200 overflow-hidden",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between flex-shrink-0 print:hidden",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ba,{size:16,className:"text-indigo-600"}),s.jsx("span",{className:"text-sm font-black text-gray-800 uppercase",children:"Visualização de Impressão"})]}),s.jsx("button",{type:"button",onClick:n,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsx(TM,{form:N,items:S,valorTotal:L,contratoId:t==null?void 0:t.id,onBack:()=>y("editor")})]})}):s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200 overflow-hidden",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between flex-shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-indigo-100 rounded-lg flex items-center justify-center",children:s.jsx(Ba,{size:16,className:"text-indigo-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase",children:t?"Editar Contrato":"Novo Contrato"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-medium uppercase",children:N.pacienteNome||"Paciente não selecionado"})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>y("print"),className:"flex items-center gap-1.5 px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-xs font-bold transition-colors",children:[s.jsx(Ya,{size:13})," Imprimir/Assinar"]}),s.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]})]}),s.jsx("div",{className:"px-6 pt-4 pb-2 flex-shrink-0",children:s.jsx("div",{className:"flex items-center",children:Ep.map((G,te)=>s.jsxs(qe.Fragment,{children:[s.jsxs("button",{type:"button",onClick:()=>p(te),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-[10px] font-black uppercase transition-all whitespace-nowrap ${h===te?"bg-indigo-600 text-white":te{D({id:G.id,nome:G.nome}),j(te=>({...te,pacienteId:G.id,pacienteNome:G.nome}))},onClear:()=>{D(null),j(G=>({...G,pacienteId:"",pacienteNome:""}))},fetchFn:G=>K.getPacientes(G).then(te=>te.data)}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Dentista"}),s.jsxs("select",{value:N.dentistaId,onChange:G=>{const te=c==null?void 0:c.find(re=>re.id===G.target.value);j(re=>({...re,dentistaId:G.target.value,dentistaNome:(te==null?void 0:te.nome)||""}))},className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",children:[s.jsx("option",{value:"",children:"— Selecionar —"}),c==null?void 0:c.map(G=>s.jsx("option",{value:G.id,children:G.nome},G.id))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Especialidade"}),s.jsxs("select",{value:N.especialidadeId,onChange:G=>$(G.target.value),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",children:[s.jsx("option",{value:"",children:"— Selecionar —"}),d==null?void 0:d.map(G=>s.jsx("option",{value:G.id,children:G.nome},G.id))]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Título do Contrato"}),s.jsx("input",{value:N.titulo,onChange:G=>j(te=>({...te,titulo:G.target.value.toUpperCase()})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",placeholder:"CONTRATO DE SERVIÇOS ODONTOLÓGICOS"})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Status"}),s.jsxs("select",{value:N.status,onChange:G=>j(te=>({...te,status:G.target.value})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",children:[s.jsx("option",{value:"Rascunho",children:"Rascunho"}),s.jsx("option",{value:"Ativo",children:"Ativo"}),s.jsx("option",{value:"Assinado",children:"Assinado"}),s.jsx("option",{value:"Encerrado",children:"Encerrado"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Data Início"}),s.jsx("input",{type:"date",value:N.dataInicio,onChange:G=>j(te=>({...te,dataInicio:G.target.value})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Data Fim (opcional)"}),s.jsx("input",{type:"date",value:N.dataFim,onChange:G=>j(te=>({...te,dataFim:G.target.value})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Observações"}),s.jsx("textarea",{value:N.observacoes,onChange:G=>j(te=>({...te,observacoes:G.target.value})),rows:3,className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none resize-none",placeholder:"Observações gerais do contrato..."})]})]}),h===1&&s.jsxs("div",{className:"flex-1 overflow-hidden flex gap-0 min-h-0",children:[s.jsxs("div",{className:"w-72 flex-shrink-0 border-r border-gray-100 flex flex-col min-h-0",children:[s.jsxs("div",{className:"p-3 border-b border-gray-100",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider mb-2",children:"Catálogo de Procedimentos"}),s.jsxs("div",{className:"relative",children:[s.jsx(Qn,{size:12,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),s.jsx("input",{value:C,onChange:G=>I(G.target.value),placeholder:"Buscar procedimento...",className:"w-full pl-7 pr-3 py-1.5 border border-gray-200 rounded-lg text-[11px] focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none"})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-3",children:[Object.entries(z).map(([G,te])=>s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest px-2 py-1",children:G}),te.map(re=>s.jsxs("button",{type:"button",onClick:()=>M(re),className:"w-full flex items-center justify-between px-2 py-1.5 hover:bg-indigo-50 rounded-lg text-left transition-colors group",children:[s.jsx("span",{className:"text-[11px] text-gray-700 font-medium flex-1 truncate",children:re.nome}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0 ml-1",children:[s.jsx("span",{className:"text-[10px] text-green-600 font-bold",children:Sn(re.valorParticular)}),s.jsx("div",{className:"w-5 h-5 rounded-full bg-indigo-100 group-hover:bg-indigo-600 text-indigo-600 group-hover:text-white flex items-center justify-center transition-colors",children:s.jsx(gt,{size:11})})]})]},re.id))]},G)),Object.keys(z).length===0&&s.jsx("p",{className:"text-center text-xs text-gray-400 py-6",children:"Nenhum procedimento encontrado."})]})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[s.jsxs("div",{className:"p-3 border-b border-gray-100 flex items-center justify-between",children:[s.jsxs("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider",children:["Itens do Contrato (",S.length,")"]}),s.jsxs("button",{type:"button",onClick:H,className:"flex items-center gap-1 px-2.5 py-1.5 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 rounded-lg text-[11px] font-bold transition-colors",children:[s.jsx(gt,{size:12})," Adicionar Item Manual"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:S.length===0?s.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400 py-10",children:[s.jsx(Ba,{size:36,className:"mb-3 opacity-30"}),s.jsx("p",{className:"text-xs font-bold uppercase",children:"Nenhum item adicionado"}),s.jsx("p",{className:"text-[10px] mt-1",children:"Clique em procedimentos no catálogo ou adicione manualmente"})]}):s.jsx(Jl,{onDragEnd:he,children:s.jsx(ti,{droppableId:"items",children:G=>s.jsxs("div",{ref:G.innerRef,...G.droppableProps,className:"space-y-2",children:[S.map((te,re)=>s.jsx(ei,{draggableId:te.id,index:re,children:(T,X)=>s.jsx("div",{ref:T.innerRef,...T.draggableProps,className:`bg-white border border-gray-200 rounded-xl p-3 ${X.isDragging?"shadow-lg border-indigo-300":""}`,children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{...T.dragHandleProps,className:"mt-1 text-gray-300 hover:text-gray-500 cursor-grab flex-shrink-0",children:s.jsx(Ql,{size:16})}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("input",{value:te.procedimentoNome,onChange:le=>ne(te.id,"procedimentoNome",le.target.value.toUpperCase()),className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-xs font-bold text-gray-800 focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",placeholder:"Nome do procedimento"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1 border border-gray-200 rounded-lg overflow-hidden",children:[s.jsx("button",{type:"button",onClick:()=>ne(te.id,"quantidade",Math.max(1,te.quantidade-1)),className:"px-2 py-1.5 hover:bg-gray-100 text-gray-600 transition-colors",children:s.jsx(YN,{size:11})}),s.jsx("span",{className:"text-xs font-bold text-gray-800 w-6 text-center",children:te.quantidade}),s.jsx("button",{type:"button",onClick:()=>ne(te.id,"quantidade",te.quantidade+1),className:"px-2 py-1.5 hover:bg-gray-100 text-gray-600 transition-colors",children:s.jsx(gt,{size:11})})]}),s.jsx("div",{className:"flex-1",children:s.jsx("input",{type:"number",step:"0.01",min:"0",value:te.valorUnitario,onChange:le=>ne(te.id,"valorUnitario",parseFloat(le.target.value)||0),className:"w-full border border-gray-200 rounded-lg px-2.5 py-1.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",placeholder:"Valor unit."})}),s.jsx("div",{className:"text-sm font-black text-indigo-600 w-24 text-right flex-shrink-0",children:Sn(te.valorTotal)}),s.jsx("button",{type:"button",onClick:()=>ee(te.id),className:"text-red-300 hover:text-red-600 flex-shrink-0 transition-colors",children:s.jsx(Qt,{size:14})})]}),s.jsx("input",{value:te.descricao||"",onChange:le=>ne(te.id,"descricao",le.target.value),className:"w-full border border-gray-100 rounded-lg px-2.5 py-1 text-[11px] text-gray-500 focus:ring-1 focus:ring-indigo-100 outline-none bg-gray-50",placeholder:"Descrição opcional..."})]})]})})},te.id)),G.placeholder]})})})}),S.length>0&&s.jsxs("div",{className:"p-3 border-t border-gray-100 flex justify-between items-center bg-indigo-50/50",children:[s.jsx("span",{className:"text-xs font-black text-gray-500 uppercase",children:"Total"}),s.jsx("span",{className:"text-lg font-black text-indigo-700",children:Sn(L)})]})]})]}),h===2&&s.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-5",children:[s.jsxs("div",{className:"bg-indigo-50/60 border border-indigo-100 rounded-2xl p-4 space-y-3",children:[s.jsx("p",{className:"text-[10px] font-black text-indigo-600 uppercase tracking-widest",children:"Financeiro"}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Valor Total"}),s.jsx("div",{className:"w-full border border-gray-200 rounded-lg p-2.5 text-sm font-black text-indigo-700 bg-white",children:Sn(L)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Entrada (R$)"}),s.jsx("input",{type:"number",step:"0.01",min:"0",value:N.entrada||"",onChange:G=>j(te=>({...te,entrada:parseFloat(G.target.value)||0})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",placeholder:"0,00"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Parcelas"}),s.jsx("select",{value:N.parcelas,onChange:G=>j(te=>({...te,parcelas:parseInt(G.target.value)})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",children:Array.from({length:48},(G,te)=>te+1).map(G=>s.jsxs("option",{value:G,children:[G,"x"]},G))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Forma de Pagamento"}),s.jsx("select",{value:N.formaPagamento,onChange:G=>j(te=>({...te,formaPagamento:G.target.value})),className:"w-full border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none",children:["Pix","Dinheiro","Cartão de Crédito","Cartão de Débito","Boleto","Transferência"].map(G=>s.jsx("option",{value:G,children:G},G))})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-4 pt-2 border-t border-indigo-100",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-[10px] text-indigo-400 font-bold uppercase",children:"Restante"}),s.jsx("p",{className:"text-sm font-black text-indigo-700",children:Sn(F)})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-[10px] text-indigo-400 font-bold uppercase",children:"Valor por Parcela"}),s.jsx("p",{className:"text-sm font-black text-indigo-700",children:Sn(Y)})]})]})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider",children:"Cláusulas Contratuais"}),s.jsx("button",{type:"button",onClick:()=>j(G=>({...G,clausulas:Kv})),className:"text-[10px] text-indigo-500 hover:text-indigo-700 font-bold uppercase transition-colors",children:"Restaurar padrão"})]}),s.jsx("textarea",{value:N.clausulas,onChange:G=>j(te=>({...te,clausulas:G.target.value})),rows:18,className:"w-full border border-gray-200 rounded-xl p-3 text-xs font-mono focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none resize-none leading-relaxed"})]})]})]}),s.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-between items-center flex-shrink-0",children:[s.jsxs("button",{type:"button",onClick:()=>h>0?p(G=>G-1):n(),className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:[s.jsx($a,{size:14})," ",h===0?"Cancelar":"Voltar"]}),s.jsx("div",{className:"flex items-center gap-2",children:hp(G=>G+1),className:"px-5 py-2 bg-indigo-600 hover:bg-indigo-700 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:["Próximo ",s.jsx(Pa,{size:14})]}):s.jsxs("button",{type:"button",onClick:pe,disabled:x,className:"px-5 py-2 bg-green-600 hover:bg-green-700 disabled:opacity-60 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:[x?s.jsx(Ot,{size:14,className:"animate-spin"}):s.jsx(Po,{size:14}),x?"Salvando...":"Salvar Contrato"]})})]})]})})},cj=["MÃE","PAI","FILHO","FILHA","IRMÃO","IRMÃ","CÔNJUGE","AVÔ","AVÓ","NETO","NETA","TIO","TIA","SOBRINHO","SOBRINHA","PRIMO","PRIMA","PADRASTO","MADRASTA","ENTEADO","ENTEADA"];function kM(t){if(!t)return"";if(/^\d{4}-\d{2}-\d{2}$/.test(t))return t;const e=t.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);return e?`${e[3]}-${e[2]}-${e[1]}`:""}function dj(t,e){const[n,r]=A.useState(t);return A.useEffect(()=>{const i=setTimeout(()=>{r(t)},e);return()=>clearTimeout(i)},[t,e]),n}function Xd({label:t,placeholder:e,value:n,onSelect:r,onClear:i,fetchFn:c,renderOption:d,extraAction:f}){const[h,p]=A.useState(""),[b,y]=A.useState([]),[x,v]=A.useState(!1),[N,j]=A.useState(!1),S=dj(h,300),R=A.useRef(null);return A.useEffect(()=>{if(!S.trim()||n){y([]),v(!1);return}j(!0),c(S).then(w=>{const D=Array.isArray(w)?w:[];y(D),v(D.length>0)}).finally(()=>j(!1))},[S]),A.useEffect(()=>{const w=D=>{R.current&&!R.current.contains(D.target)&&v(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]),n?s.jsxs("div",{className:"flex items-center justify-between bg-blue-50 border border-blue-100 rounded-lg px-3 py-2",children:[s.jsx("span",{className:"text-xs font-bold text-blue-700 uppercase truncate",children:n.nome}),s.jsx("button",{onClick:i,className:"ml-2 text-blue-300 hover:text-blue-600 flex-shrink-0",children:s.jsx(Qe,{size:13})})]}):s.jsxs("div",{ref:R,className:"relative",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:t}),s.jsxs("div",{className:"flex gap-1",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Qn,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),s.jsx("input",{value:h,onChange:w=>p(w.target.value),placeholder:e,className:"w-full pl-7 pr-3 py-2 border border-gray-200 rounded-lg text-xs focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none"}),N&&s.jsx(Ot,{size:12,className:"absolute right-2.5 top-1/2 -translate-y-1/2 animate-spin text-gray-400"})]}),f]}),x&&b.length>0&&s.jsx("div",{className:"absolute z-50 w-full mt-1 bg-white border border-gray-200 rounded-xl shadow-xl overflow-hidden",children:b.map(w=>s.jsx("button",{onClick:()=>{r(w),p(""),v(!1)},className:"w-full text-left px-3 py-2 hover:bg-blue-50 text-xs font-medium text-gray-700 flex items-center gap-2 border-b border-gray-50 last:border-0",children:d?d(w):w.nome},w.id))})]})}const _M=({paciente:t,onClose:e})=>(A.useEffect(()=>{const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[e]),s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-indigo-100 rounded-lg flex items-center justify-center",children:s.jsx(sa,{size:16,className:"text-indigo-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase",children:"Vínculo Familiar"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-medium uppercase",children:t.nome})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsx("div",{className:"p-4",children:t.grupoFamiliarId?s.jsxs("div",{className:"flex items-center gap-3 p-3 bg-indigo-50 rounded-xl border border-indigo-100",children:[s.jsx("div",{className:"w-9 h-9 rounded-full bg-indigo-200 flex items-center justify-center flex-shrink-0",children:s.jsx(Wl,{size:15,className:"text-indigo-700"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-bold text-gray-800 uppercase",children:t.grupoFamiliarNome}),s.jsx("p",{className:"text-[10px] text-indigo-500 font-bold uppercase",children:t.grupoFamiliarRelacao||"Familiar"})]})]}):s.jsx("p",{className:"text-center text-xs text-gray-400 py-4",children:"Nenhum familiar vinculado."})}),s.jsx("div",{className:"p-4 border-t border-gray-100 flex justify-end",children:s.jsx("button",{onClick:e,className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 text-xs font-bold rounded-lg uppercase",children:"Fechar"})})]})})),MM=({patient:t,onClose:e})=>{const{data:n}=Ie(K.getDentistas),{data:r,refresh:i}=Ie(K.getAgendamentos),c=$e(),[d,f]=A.useState(30),[h,p]=A.useState(new Date().toISOString().split("T")[0]),[b,y]=A.useState(""),[x,v]=A.useState(void 0),[N,j]=A.useState("");A.useEffect(()=>{var C;n&&!x&&v((C=n[0])==null?void 0:C.id)},[n,x]),A.useEffect(()=>{const C=I=>{I.key==="Escape"&&e()};return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[e]);const S=n==null?void 0:n.find(C=>C.id===x),w=A.useCallback(()=>{const C=[];if(!x||!h)return C;const I=480,L=1080,F=720,Y=840,$=(r??[]).filter(M=>M.dentistaId===x&&new Date(M.start).toISOString().split("T")[0]===h).map(M=>({start:new Date(M.start).getHours()*60+new Date(M.start).getMinutes(),end:new Date(M.end).getHours()*60+new Date(M.end).getMinutes()}));for(let M=I;ML||H>=F&&HF&&ne<=Y||HY)continue;if(!$.some(pe=>H>=pe.start&&Hpe.start&&ne<=pe.end||Hpe.end)){const pe=Math.floor(H/60),z=H%60;C.push({time:`${String(pe).padStart(2,"0")}:${String(z).padStart(2,"0")}`,available:!0})}}return C},[x,h,r,d])(),D=async C=>{if(C.preventDefault(),!h||!b||!x||!N){c.error("PREENCHA TODOS OS CAMPOS PARA AGENDAR.");return}const I=new Date(`${h}T${b}:00`),L=new Date(I.getTime()+d*6e4);try{await K.salvarAgendamento({pacienteNome:t.nome,dentistaId:x,start:I.toISOString(),end:L.toISOString(),status:"Pendente",procedimento:N.toUpperCase()}),c.success(`AGENDAMENTO PARA ${t.nome} SALVO!`),i(),e()}catch{c.error("ERRO AO SALVAR AGENDAMENTO.")}};return s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("form",{onSubmit:D,className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsx("div",{className:"p-5 border-b border-gray-200",children:s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[s.jsx(jt,{size:20,className:"text-orange-500"})," AGENDAR CONSULTA"]}),s.jsx("button",{type:"button",onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:20})})]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"PACIENTE"}),s.jsx("div",{className:"w-full bg-gray-100 p-3 rounded-lg mt-1 font-bold text-gray-800 uppercase",children:t.nome})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"DENTISTA RESPONSÁVEL"}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx("select",{value:x,onChange:C=>v(C.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select",children:n==null?void 0:n.map(C=>s.jsx("option",{value:C.id,children:C.nome},C.id))}),s.jsx("div",{className:"w-7 h-7 rounded-full border-2 border-white shadow flex-shrink-0",style:{backgroundColor:(S==null?void 0:S.corAgenda)||"#ccc"}})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"DATA"}),s.jsx("input",{type:"date",value:h,onChange:C=>p(C.target.value),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"TEMPO"}),s.jsxs("select",{value:d,onChange:C=>f(Number(C.target.value)),className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select",children:[s.jsx("option",{value:15,children:"15 MIN"}),s.jsx("option",{value:30,children:"30 MIN"}),s.jsx("option",{value:45,children:"45 MIN"}),s.jsx("option",{value:60,children:"60 MIN"})]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"HORÁRIOS"}),s.jsxs("div",{className:"grid grid-cols-6 gap-2 mt-2",children:[w.map(C=>s.jsx("button",{type:"button",onClick:()=>y(C.time),className:`py-2 rounded-lg text-sm font-bold border transition-colors ${b===C.time?"bg-blue-600 text-white border-blue-600":"bg-white border-gray-300 hover:border-blue-500"}`,children:C.time},C.time)),w.length===0&&s.jsx("p",{className:"col-span-6 text-center text-xs text-gray-500 p-4 bg-gray-50 rounded-lg",children:"NENHUM HORÁRIO DISPONÍVEL PARA ESTA DATA/DURAÇÃO."})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"PROCEDIMENTO"}),s.jsx("input",{type:"text",value:N,onChange:C=>j(C.target.value.toUpperCase()),placeholder:"EX: AVALIAÇÃO...",className:"w-full mt-1 border border-gray-300 rounded-lg p-2.5 uppercase-input"})]})]}),s.jsxs("div",{className:"p-4 bg-gray-50 border-t border-gray-200 flex justify-end gap-3",children:[s.jsx("button",{type:"button",onClick:e,className:"px-6 py-2 bg-gray-200 hover:bg-gray-300 text-gray-700 font-bold rounded-lg transition-colors text-sm uppercase",children:"CANCELAR"}),s.jsx("button",{type:"submit",className:"px-6 py-2 bg-orange-500 hover:bg-orange-600 text-white font-bold rounded-lg shadow-sm transition-colors text-sm uppercase",children:"CONFIRMAR"})]})]})})},IM=({onClose:t,onSaved:e})=>{const n=$e(),[r,i]=A.useState({nome:"",cpf:"",telefone:"",dataNascimento:"",convenio:"",email:""}),[c,d]=A.useState(null),[f,h]=A.useState(""),[p,b]=A.useState(null),{data:y}=Ie(K.getPlanos);A.useEffect(()=>{const N=j=>{j.key==="Escape"&&t()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[t]);const x=async N=>{if(N.preventDefault(),!r.nome||!r.cpf){n.error("PREENCHA NOME E CPF.");return}try{const j=Date.now().toString();await K.savePaciente({...r,id:j,grupoFamiliarId:c==null?void 0:c.id,grupoFamiliarRelacao:f||void 0,indicadoPorId:p==null?void 0:p.id}),n.success("PACIENTE CADASTRADO!"),e(),t()}catch{n.error("ERRO AO CADASTRAR PACIENTE.")}},v="w-full border border-gray-200 rounded-lg p-2.5 text-sm focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none";return s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex justify-between items-center",children:[s.jsxs("h2",{className:"text-sm font-black text-gray-800 uppercase flex items-center gap-2",children:[s.jsx(gt,{size:16,className:"text-green-500"})," Novo Paciente"]}),s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsxs("form",{onSubmit:x,className:"flex-1 overflow-y-auto p-5 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Nome Completo *"}),s.jsx("input",{required:!0,value:r.nome,onChange:N=>i(j=>({...j,nome:N.target.value.toUpperCase()})),className:v,placeholder:"NOME COMPLETO"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"CPF *"}),s.jsx("input",{required:!0,value:r.cpf,onChange:N=>i(j=>({...j,cpf:N.target.value})),className:v,placeholder:"000.000.000-00"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Telefone"}),s.jsx("input",{value:r.telefone,onChange:N=>i(j=>({...j,telefone:N.target.value})),className:v,placeholder:"(67) 99999-9999"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Nascimento"}),s.jsx("input",{type:"date",value:r.dataNascimento,onChange:N=>i(j=>({...j,dataNascimento:N.target.value})),className:v})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Convênio"}),s.jsxs("select",{value:r.convenio,onChange:N=>i(j=>({...j,convenio:N.target.value})),className:v,children:[s.jsx("option",{value:"",children:"— Particular —"}),y==null?void 0:y.map(N=>s.jsx("option",{value:N.nome,children:N.nome},N.id))]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"E-mail"}),s.jsx("input",{type:"email",value:r.email,onChange:N=>i(j=>({...j,email:N.target.value})),className:v,placeholder:"email@exemplo.com"})]}),s.jsxs("div",{className:"border-t border-gray-100 pt-3 space-y-3",children:[s.jsx(Xd,{label:"Familiar (vínculo)",placeholder:"Buscar paciente familiar...",value:c,onSelect:N=>{d({id:N.id,nome:N.nome})},onClear:()=>{d(null),h("")},fetchFn:N=>K.getPacientes(N).then(j=>j.data),renderOption:N=>s.jsxs("span",{className:"flex items-center gap-2 w-full",children:[s.jsx(sa,{size:12,className:"text-indigo-400 flex-shrink-0"}),s.jsx("span",{className:"font-bold flex-1",children:N.nome}),s.jsx("span",{className:"text-[10px] text-gray-400",children:N.cpf})]})}),c&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Parentesco"}),s.jsx("input",{list:"relacoes-list-novo",value:f,onChange:N=>h(N.target.value.toUpperCase()),placeholder:"EX: MÃE, PAI, IRMÃO...",className:v}),s.jsx("datalist",{id:"relacoes-list-novo",children:cj.map(N=>s.jsx("option",{value:N},N))})]}),s.jsx(Xd,{label:"Indicado por",placeholder:"Buscar paciente que indicou...",value:p,onSelect:N=>b({id:N.id,nome:N.nome}),onClear:()=>b(null),fetchFn:N=>K.getPacientes(N).then(j=>j.data),renderOption:N=>s.jsxs("span",{className:"flex items-center gap-2 w-full",children:[s.jsx(Wl,{size:12,className:"text-green-400 flex-shrink-0"}),s.jsx("span",{className:"font-bold flex-1",children:N.nome}),s.jsx("span",{className:"text-[10px] text-gray-400",children:N.cpf})]})})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[s.jsx("button",{type:"button",onClick:t,className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase",children:"Cancelar"}),s.jsxs("button",{type:"submit",className:"px-5 py-2 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:[s.jsx(gt,{size:14})," Cadastrar"]})]})]})]})})},LM=({patient:t,onClose:e})=>{const{data:n,isLoading:r}=Ie(K.getAgendamentos),i=(n==null?void 0:n.filter(c=>c.pacienteNome===t.nome))||[];return A.useEffect(()=>{const c=d=>{d.key==="Escape"&&e()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e]),s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-200 flex justify-between items-center",children:[s.jsxs("h2",{className:"text-base font-bold text-gray-800 uppercase",children:["HISTÓRICO — ",t.nome]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:20})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2",children:[r&&s.jsx("p",{className:"text-center text-gray-400 text-sm",children:"CARREGANDO..."}),!r&&i.length===0&&s.jsx("p",{className:"text-center text-gray-400 text-sm py-6",children:"NENHUM AGENDAMENTO ENCONTRADO."}),i.map(c=>s.jsxs("div",{className:"flex items-center justify-between border border-gray-100 rounded-lg p-3 bg-gray-50",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-bold text-gray-800 text-sm uppercase",children:c.procedimento}),s.jsx("p",{className:"text-xs text-gray-500",children:new Date(c.start).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})})]}),s.jsx("span",{className:`text-xs font-bold px-2 py-1 rounded-full uppercase ${c.status==="Confirmado"?"bg-green-100 text-green-700":c.status==="Pendente"?"bg-amber-100 text-amber-700":"bg-gray-100 text-gray-600"}`,children:c.status})]},c.id))]}),s.jsx("div",{className:"p-4 border-t border-gray-200 flex justify-end",children:s.jsx("button",{onClick:e,className:"px-6 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-sm uppercase",children:"FECHAR"})})]})})},zM=["AC","AL","AP","AM","BA","CE","DF","ES","GO","MA","MT","MS","MG","PA","PB","PR","PE","PI","RJ","RN","RS","RO","RR","SC","SP","SE","TO"],jp=["Dados","Família","Endereço","Histórico"],PM=({patient:t,onClose:e,onSaved:n})=>{const r=$e(),{data:i}=Ie(K.getPlanos),{data:c}=Ie(K.getAgendamentos),[d,f]=A.useState(0),[h,p]=A.useState({...t,dataNascimento:kM(t.dataNascimento)}),[b,y]=A.useState(t.grupoFamiliarId?{id:t.grupoFamiliarId,nome:t.grupoFamiliarNome||""}:null),[x,v]=A.useState(t.grupoFamiliarRelacao||""),[N,j]=A.useState(t.indicadoPorId?{id:t.indicadoPorId,nome:t.indicadoPorNome||""}:null),S=(c??[]).filter(D=>D.pacienteNome===t.nome);A.useEffect(()=>{const D=C=>{C.key==="Escape"&&e()};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[e]);const R=async()=>{try{const{grupoFamiliarNome:D,indicadoPorNome:C,...I}=h;await K.updatePaciente({...I,grupoFamiliarId:b==null?void 0:b.id,grupoFamiliarRelacao:x||void 0,indicadoPorId:N==null?void 0:N.id}),r.success("PACIENTE ATUALIZADO!"),n(),e()}catch{r.error("ERRO AO SALVAR.")}},w="w-full border border-gray-200 rounded-lg p-2.5 text-sm focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none";return s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex justify-between items-center flex-shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(zo,{size:15,className:"text-blue-500"}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-black text-gray-800 uppercase",children:"Editar Paciente"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-medium uppercase",children:t.nome})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsx("div",{className:"px-6 pt-4 pb-0 flex-shrink-0",children:s.jsx("div",{className:"flex items-center",children:jp.map((D,C)=>s.jsxs(qe.Fragment,{children:[s.jsxs("button",{onClick:()=>f(C),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-[10px] font-black uppercase transition-all whitespace-nowrap ${d===C?"bg-blue-600 text-white":Cp(C=>({...C,nome:D.target.value.toUpperCase()})),className:w})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"CPF"}),s.jsx("input",{value:h.cpf,onChange:D=>p(C=>({...C,cpf:D.target.value})),className:w})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Telefone"}),s.jsx("input",{value:h.telefone,onChange:D=>p(C=>({...C,telefone:D.target.value})),className:w})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Nascimento"}),s.jsx("input",{type:"date",value:h.dataNascimento,onChange:D=>p(C=>({...C,dataNascimento:D.target.value})),className:w})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Convênio"}),s.jsxs("select",{value:h.convenio||"",onChange:D=>p(C=>({...C,convenio:D.target.value})),className:w,children:[s.jsx("option",{value:"",children:"— Particular —"}),i==null?void 0:i.map(D=>s.jsx("option",{value:D.nome,children:D.nome},D.id))]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"E-mail"}),s.jsx("input",{type:"email",value:h.email||"",onChange:D=>p(C=>({...C,email:D.target.value})),className:w})]})]}),d===1&&s.jsxs("div",{className:"space-y-4",children:[s.jsx(Xd,{label:"Familiar (vínculo)",placeholder:"Buscar paciente familiar...",value:b,onSelect:D=>{y({id:D.id,nome:D.nome})},onClear:()=>{y(null),v("")},fetchFn:D=>K.getPacientes(D).then(C=>C.data),renderOption:D=>s.jsxs("span",{className:"flex items-center gap-2 w-full",children:[s.jsx(sa,{size:12,className:"text-indigo-400 flex-shrink-0"}),s.jsx("span",{className:"font-bold flex-1",children:D.nome}),s.jsx("span",{className:"text-[10px] text-gray-400",children:D.cpf})]})}),b&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Parentesco"}),s.jsx("input",{list:"relacoes-list-editar",value:x,onChange:D=>v(D.target.value.toUpperCase()),placeholder:"EX: MÃE, PAI, IRMÃO...",className:w}),s.jsx("datalist",{id:"relacoes-list-editar",children:cj.map(D=>s.jsx("option",{value:D},D))})]}),s.jsx(Xd,{label:"Indicado por",placeholder:"Buscar paciente que indicou...",value:N,onSelect:D=>j({id:D.id,nome:D.nome}),onClear:()=>j(null),fetchFn:D=>K.getPacientes(D).then(C=>C.data),renderOption:D=>s.jsxs("span",{className:"flex items-center gap-2 w-full",children:[s.jsx(Wl,{size:12,className:"text-green-400 flex-shrink-0"}),s.jsx("span",{className:"font-bold flex-1",children:D.nome}),s.jsx("span",{className:"text-[10px] text-gray-400",children:D.cpf})]})})]}),d===2&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"CEP"}),s.jsx("input",{value:h.cep||"",onChange:D=>p(C=>({...C,cep:D.target.value})),className:w,placeholder:"00000-000",maxLength:9})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Logradouro"}),s.jsx("input",{value:h.logradouro||"",onChange:D=>p(C=>({...C,logradouro:D.target.value.toUpperCase()})),className:w,placeholder:"RUA, AV, TRAVESSA..."})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Número"}),s.jsx("input",{value:h.numero||"",onChange:D=>p(C=>({...C,numero:D.target.value})),className:w,placeholder:"123"})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Complemento"}),s.jsx("input",{value:h.complemento||"",onChange:D=>p(C=>({...C,complemento:D.target.value.toUpperCase()})),className:w,placeholder:"APTO, BLOCO..."})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"col-span-2",children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Bairro"}),s.jsx("input",{value:h.bairro||"",onChange:D=>p(C=>({...C,bairro:D.target.value.toUpperCase()})),className:w,placeholder:"BAIRRO"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"UF"}),s.jsxs("select",{value:h.estado||"",onChange:D=>p(C=>({...C,estado:D.target.value})),className:w,children:[s.jsx("option",{value:"",children:"—"}),zM.map(D=>s.jsx("option",{children:D},D))]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Cidade"}),s.jsx("input",{value:h.cidade||"",onChange:D=>p(C=>({...C,cidade:D.target.value.toUpperCase()})),className:w,placeholder:"CIDADE"})]})]}),d===3&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1",children:"Observações Clínicas"}),s.jsx("textarea",{rows:4,value:h.observacoes||"",onChange:D=>p(C=>({...C,observacoes:D.target.value})),className:w+" resize-none",placeholder:"ALERGIAS, HISTÓRICO MÉDICO, OBSERVAÇÕES..."})]}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider mb-2",children:["Histórico de Atendimentos ",s.jsxs("span",{className:"text-blue-600",children:["(",S.length,")"]})]}),S.length===0&&s.jsx("p",{className:"text-xs text-gray-400 text-center py-4 border-2 border-dashed border-gray-100 rounded-xl",children:"Nenhum atendimento registrado."}),s.jsx("div",{className:"space-y-1.5 max-h-52 overflow-y-auto",children:S.map(D=>s.jsxs("div",{className:"flex items-center justify-between border border-gray-100 rounded-lg p-2.5 bg-gray-50/70",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-bold text-gray-800 text-xs uppercase",children:D.procedimento}),s.jsx("p",{className:"text-[10px] text-gray-400",children:new Date(D.start).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),s.jsx("span",{className:`text-[9px] font-black px-2 py-0.5 rounded-full uppercase ${D.status==="Confirmado"?"bg-green-100 text-green-700":D.status==="Pendente"?"bg-amber-100 text-amber-700":D.status==="Faltou"?"bg-red-100 text-red-600":"bg-gray-100 text-gray-600"}`,children:D.status})]},D.id))})]})]})]}),s.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-between items-center flex-shrink-0",children:[s.jsxs("button",{type:"button",onClick:()=>d>0?f(D=>D-1):e(),className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:[s.jsx($a,{size:14})," ",d===0?"Cancelar":"Voltar"]}),df(D=>D+1),className:"px-5 py-2 bg-blue-600 hover:bg-blue-700 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:["Próximo ",s.jsx(Pa,{size:14})]}):s.jsxs("button",{type:"button",onClick:R,className:"px-5 py-2 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg text-xs uppercase flex items-center gap-1.5",children:[s.jsx(Po,{size:14})," Salvar Tudo"]})]})]})})},UM=({patient:t,onClose:e})=>{const{data:n,isLoading:r}=Ie(K.getAgendamentos),i=(n??[]).filter(h=>h.pacienteNome===t.nome),c=i.filter(h=>h.status==="Concluido"),d=i.filter(h=>h.status==="Faltou"),f=c.reduce((h,p)=>(h[p.procedimento]=(h[p.procedimento]||0)+1,h),{});return A.useEffect(()=>{const h=p=>{p.key==="Escape"&&e()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e]),s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between flex-shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-teal-100 rounded-lg flex items-center justify-center",children:s.jsx(aa,{size:16,className:"text-teal-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase",children:"Tratamentos"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-medium uppercase",children:t.nome})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3 p-5 flex-shrink-0",children:[s.jsxs("div",{className:"bg-blue-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-2xl font-black text-blue-600",children:i.length}),s.jsx("p",{className:"text-[10px] font-bold text-blue-400 uppercase",children:"Total Consultas"})]}),s.jsxs("div",{className:"bg-green-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-2xl font-black text-green-600",children:c.length}),s.jsx("p",{className:"text-[10px] font-bold text-green-400 uppercase",children:"Concluídas"})]}),s.jsxs("div",{className:"bg-red-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-2xl font-black text-red-600",children:d.length}),s.jsx("p",{className:"text-[10px] font-bold text-red-400 uppercase",children:"Faltas"})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-5 space-y-5",children:[Object.keys(f).length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider mb-2",children:"Procedimentos Realizados"}),s.jsx("div",{className:"space-y-1.5",children:Object.entries(f).sort(([,h],[,p])=>p-h).map(([h,p])=>s.jsxs("div",{className:"flex items-center justify-between bg-gray-50 rounded-lg px-3 py-2",children:[s.jsx("p",{className:"text-xs font-bold text-gray-700 uppercase",children:h}),s.jsxs("span",{className:"text-[10px] font-black bg-blue-100 text-blue-700 px-2 py-0.5 rounded-full",children:[p,"x"]})]},h))})]}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-[10px] font-black text-gray-500 uppercase tracking-wider mb-2",children:["Histórico Cronológico (",i.length,")"]}),r&&s.jsx("p",{className:"text-xs text-gray-400 text-center py-4",children:"Carregando..."}),!r&&i.length===0&&s.jsx("p",{className:"text-xs text-gray-400 text-center py-4 border-2 border-dashed border-gray-100 rounded-xl",children:"Nenhum atendimento registrado."}),s.jsx("div",{className:"space-y-1.5",children:[...i].sort((h,p)=>new Date(p.start).getTime()-new Date(h.start).getTime()).map(h=>s.jsxs("div",{className:"flex items-center justify-between border border-gray-100 rounded-lg p-2.5",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-bold text-gray-800 text-xs uppercase truncate",children:h.procedimento}),s.jsx("p",{className:"text-[10px] text-gray-400",children:new Date(h.start).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),s.jsx("span",{className:`text-[9px] font-black px-2 py-0.5 rounded-full uppercase flex-shrink-0 ml-2 ${h.status==="Concluido"?"bg-green-100 text-green-700":h.status==="Confirmado"?"bg-blue-100 text-blue-700":h.status==="Pendente"?"bg-amber-100 text-amber-700":"bg-red-100 text-red-600"}`,children:h.status})]},h.id))})]})]}),s.jsx("div",{className:"p-4 border-t border-gray-100 flex justify-end flex-shrink-0",children:s.jsx("button",{onClick:e,className:"px-5 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 text-xs font-bold rounded-lg uppercase",children:"Fechar"})})]})})},BM=({patient:t,onClose:e})=>{const{data:n}=Ie(K.getAgendamentos),r=(n??[]).filter(f=>f.pacienteNome===t.nome),i=r.filter(f=>f.status==="Concluido").length,c=r.filter(f=>f.status==="Faltou").length,d=new Date().toLocaleDateString("pt-BR",{day:"2-digit",month:"long",year:"numeric"});return A.useEffect(()=>{const f=h=>{h.key==="Escape"&&e()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e]),s.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between flex-shrink-0 print:hidden",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-violet-100 rounded-lg flex items-center justify-center",children:s.jsx(Io,{size:16,className:"text-violet-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase",children:"Relatório do Paciente"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-medium uppercase",children:t.nome})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>window.print(),className:"flex items-center gap-1.5 px-3 py-2 bg-gray-900 text-white rounded-lg text-xs font-bold hover:bg-black",children:[s.jsx(Ya,{size:13})," Imprimir"]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:18})})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50 p-6 print:p-0 print:bg-white",children:s.jsxs("div",{className:"max-w-2xl mx-auto bg-white rounded-2xl shadow-sm border border-gray-200 p-8 print:shadow-none print:rounded-none print:border-0 print:max-w-full space-y-6",children:[s.jsxs("div",{className:"border-b-2 border-gray-800 pb-4",children:[s.jsx("h1",{className:"text-lg font-black text-gray-900 uppercase",children:"Relatório do Paciente"}),s.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Gerado em ",d]})]}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:"Dados Pessoais"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Nome"}),s.jsx("p",{className:"font-bold text-gray-800 uppercase",children:t.nome})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"CPF"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.cpf||"—"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Telefone"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.telefone||"—"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"E-mail"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.email||"—"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Nascimento"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.dataNascimento||"—"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Convênio"}),s.jsx("p",{className:"font-bold text-gray-800",children:t.convenio||"Particular"})]})]})]}),(t.logradouro||t.cidade)&&s.jsxs("div",{children:[s.jsxs("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1 flex items-center gap-1",children:[s.jsx(VN,{size:11})," Endereço"]}),s.jsxs("p",{className:"text-sm text-gray-700",children:[[t.logradouro,t.numero,t.complemento].filter(Boolean).join(", "),t.bairro&&s.jsxs("span",{className:"block",children:[t.bairro,t.cidade&&` — ${t.cidade}/${t.estado}`]}),t.cep&&s.jsxs("span",{className:"block text-gray-400 text-xs",children:["CEP ",t.cep]})]})]}),(t.grupoFamiliarNome||t.indicadoPorNome)&&s.jsxs("div",{children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:"Vínculos"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[t.grupoFamiliarNome&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Familiar"}),s.jsxs("p",{className:"font-bold text-gray-800 uppercase",children:[t.grupoFamiliarNome," ",t.grupoFamiliarRelacao&&`(${t.grupoFamiliarRelacao})`]})]}),t.indicadoPorNome&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 text-xs font-bold uppercase block",children:"Indicado por"}),s.jsx("p",{className:"font-bold text-gray-800 uppercase",children:t.indicadoPorNome})]})]})]}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:"Resumo de Atendimentos"}),s.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[s.jsxs("div",{className:"bg-blue-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-xl font-black text-blue-600",children:r.length}),s.jsx("p",{className:"text-[10px] font-bold text-blue-400 uppercase",children:"Total"})]}),s.jsxs("div",{className:"bg-green-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-xl font-black text-green-600",children:i}),s.jsx("p",{className:"text-[10px] font-bold text-green-400 uppercase",children:"Concluídos"})]}),s.jsxs("div",{className:"bg-red-50 rounded-xl p-3 text-center",children:[s.jsx("p",{className:"text-xl font-black text-red-600",children:c}),s.jsx("p",{className:"text-[10px] font-bold text-red-400 uppercase",children:"Faltas"})]})]}),s.jsx("div",{className:"space-y-1.5 max-h-48 overflow-y-auto",children:[...r].sort((f,h)=>new Date(h.start).getTime()-new Date(f.start).getTime()).slice(0,20).map(f=>s.jsxs("div",{className:"flex items-center justify-between border border-gray-100 rounded-lg px-3 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-bold text-gray-800 uppercase",children:f.procedimento}),s.jsx("p",{className:"text-[10px] text-gray-400",children:new Date(f.start).toLocaleDateString("pt-BR")})]}),s.jsx("span",{className:`text-[9px] font-black px-2 py-0.5 rounded-full uppercase ${f.status==="Concluido"?"bg-green-100 text-green-700":f.status==="Faltou"?"bg-red-100 text-red-600":"bg-amber-100 text-amber-700"}`,children:f.status})]},f.id))})]}),t.observacoes&&s.jsxs("div",{children:[s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest mb-3 border-b border-gray-100 pb-1",children:"Observações Clínicas"}),s.jsx("p",{className:"text-sm text-gray-700 italic",children:t.observacoes})]}),s.jsxs("div",{className:"pt-6 border-t-2 border-gray-800 flex justify-between items-end",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500",children:"Assinatura / Responsável"}),s.jsx("div",{className:"h-8"})]}),s.jsx("p",{className:"text-xs text-gray-400",children:d})]})]})})]})})},xd=({label:t,value:e})=>{const[n,r]=A.useState(!1),i=()=>{e&&navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return s.jsxs("div",{className:"flex items-center justify-between bg-gray-50/70 border border-gray-200/50 rounded-lg px-2 py-1.5 gap-1 min-w-0",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-gray-400 text-[9px] font-bold uppercase leading-none mb-0.5",children:t}),s.jsx("p",{className:"text-gray-800 font-semibold text-xs truncate leading-tight",children:e||"—"})]}),e&&s.jsx("button",{onClick:i,className:"flex-shrink-0 text-gray-300 hover:text-blue-500 transition-colors ml-1",title:`Copiar ${t}`,children:n?s.jsx(pa,{size:13,className:"text-green-500"}):s.jsx(YC,{size:13})})]})},HM=[{key:"recentes",label:"Recentes"},{key:"az",label:"A→Z"},{key:"za",label:"Z→A"},{key:"convenio",label:"Convênio"}],GM=()=>{const[t,e]=A.useState(""),[n,r]=A.useState("recentes"),i=dj(t,500),c=A.useCallback(()=>K.getPacientes(i,n),[i,n]),{data:d,isLoading:f,error:h,refresh:p}=Ie(c,[i,n]),b=(d==null?void 0:d.data)??[];d==null||d.total;const y=$e(),[x,v]=A.useState({type:null,patient:null}),[N,j]=A.useState(null),[S,R]=A.useState(!1),w=A.useCallback(()=>v({type:null,patient:null}),[]);A.useEffect(()=>{if(!(x.type!==null&&x.type!=="agendamento"&&x.type!=="historico"&&x.type!=="editar"))return;const he=pe=>{pe.key==="Escape"&&w()};return document.addEventListener("keydown",he),()=>{document.removeEventListener("keydown",he)}},[x.type,w]);const[D,C]=A.useState({tratamento:"",valorTotal:"",desconto:"",entrada:"",parcelas:1,vencimento:new Date().toISOString().split("T")[0]});A.useEffect(()=>{x.type==="asaas"&&C({tratamento:"",valorTotal:"",desconto:"",entrada:"",parcelas:1,vencimento:new Date().toISOString().split("T")[0]})},[x.type,x.patient]);const I=ee=>{const{name:he,value:pe}=ee.target;C(z=>({...z,[he]:pe}))},L=parseFloat(D.valorTotal)||0,F=parseFloat(D.desconto)||0,Y=parseFloat(D.entrada)||0,$=L-F-Y,M=$>0&&D.parcelas>0?$/Number(D.parcelas):0,H=ee=>{var he;ee.preventDefault(),y.success(`COBRANÇA GERADA NO ASAAS PARA ${(he=x.patient)==null?void 0:he.nome}!`),w()},ne=b;return s.jsxs("div",{className:"h-full flex flex-col relative",children:[s.jsx(fn,{title:"PACIENTES",children:s.jsxs("button",{onClick:()=>R(!0),className:"bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-colors uppercase font-bold text-sm shadow-sm",children:[s.jsx(gt,{size:18}),"NOVO PACIENTE"]})}),s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none",size:16}),s.jsx("input",{type:"text",placeholder:"Nome ou CPF...",className:"w-full pl-9 pr-3 py-2 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none bg-white",value:t,onChange:ee=>e(ee.target.value.toUpperCase())})]}),s.jsx("div",{className:"flex items-center gap-1 bg-gray-100 rounded-lg p-1",children:HM.map(ee=>s.jsx("button",{onClick:()=>r(ee.key),className:`px-2.5 py-1 rounded-md text-[11px] font-bold transition-all whitespace-nowrap ${n===ee.key?"bg-white text-gray-800 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:ee.label},ee.key))})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3 overflow-y-auto pb-6",children:[f&&s.jsxs("div",{className:"col-span-3 text-center p-10 text-gray-500 uppercase font-bold flex justify-center items-center gap-2",children:[s.jsx(Ot,{className:"animate-spin"})," CARREGANDO DADOS DO POSTGRESQL..."]}),h&&s.jsxs("div",{className:"col-span-3 text-center p-10 text-red-600 uppercase font-bold",children:["ERRO AO CARREGAR: ",h.message]}),ne&&ne.map(ee=>s.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-all duration-200 flex flex-col",children:[s.jsxs("div",{className:"px-3 pt-3 pb-2 flex-grow flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[s.jsx("h3",{className:"font-bold text-blue-700 text-[11px] leading-snug uppercase break-words flex-1",children:ee.nome}),ee.convenio&&s.jsx("span",{className:"bg-green-100 text-green-700 text-[9px] font-black px-1.5 py-0.5 rounded-full uppercase shrink-0",children:ee.convenio})]}),(ee.grupoFamiliarNome||ee.indicadoPorNome)&&s.jsxs("div",{className:"flex flex-wrap gap-1",children:[ee.grupoFamiliarNome&&s.jsxs("button",{onClick:()=>j(ee),className:"flex items-center gap-1 bg-indigo-50 hover:bg-indigo-100 text-indigo-600 px-1.5 py-0.5 rounded-full text-[9px] font-bold uppercase transition-colors",children:[s.jsx(sa,{size:9}),ee.grupoFamiliarRelacao?`${ee.grupoFamiliarRelacao}: ${ee.grupoFamiliarNome}`:ee.grupoFamiliarNome]}),ee.indicadoPorNome&&s.jsxs("span",{className:"flex items-center gap-1 bg-emerald-50 text-emerald-600 px-1.5 py-0.5 rounded-full text-[9px] font-bold uppercase",children:[s.jsx(Wl,{size:9}),ee.indicadoPorNome]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-1",children:[s.jsx(xd,{label:"CPF",value:ee.cpf}),s.jsx(xd,{label:"Telefone",value:ee.telefone}),s.jsx(xd,{label:"Nascimento",value:ee.dataNascimento}),s.jsx(xd,{label:"Convênio",value:ee.convenio})]})]}),s.jsxs("div",{className:"flex border-t border-gray-100",children:[s.jsxs("button",{onClick:()=>v({type:"clinical",patient:ee}),className:"w-1/2 flex items-center justify-center gap-1.5 py-2 text-blue-600 hover:bg-blue-50 rounded-bl-xl text-[10px] font-bold transition-colors uppercase",children:[s.jsx(sv,{size:12})," Clínico"]}),s.jsx("div",{className:"border-l border-gray-100"}),s.jsxs("button",{onClick:()=>v({type:"financial",patient:ee}),className:"w-1/2 flex items-center justify-center gap-1.5 py-2 text-green-700 hover:bg-green-50 rounded-br-xl text-[10px] font-bold transition-colors uppercase",children:[s.jsx(Fa,{size:12})," Financeiro"]})]})]},ee.id))]}),N&&s.jsx(_M,{paciente:N,onClose:()=>j(null)}),S&&s.jsx(IM,{onClose:()=>R(!1),onSaved:p}),x.type==="editar"&&x.patient&&s.jsx(PM,{patient:x.patient,onClose:w,onSaved:p}),x.type==="historico"&&x.patient&&s.jsx(LM,{patient:x.patient,onClose:w}),x.type==="clinical"&&x.patient&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col p-6 animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"flex justify-between items-center mb-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-gray-700 font-bold text-xl",children:[s.jsx(sv,{size:28,className:"text-gray-400"}),"Menu Clínico"]}),s.jsx("button",{onClick:w,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:20})})]}),s.jsx("p",{className:"text-gray-500 text-sm mb-6 font-bold uppercase",children:x.patient.nome}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 flex-1 content-start",children:[s.jsxs("button",{onClick:()=>v({type:"agendamento",patient:x.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-orange-400 hover:bg-orange-50/50 transition-all group shadow-sm",children:[s.jsx(SC,{size:32,className:"text-orange-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"AGENDAR"})]}),s.jsxs("button",{onClick:()=>v({type:"historico",patient:x.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-sky-400 hover:bg-sky-50/50 transition-all group shadow-sm",children:[s.jsx(jt,{size:32,className:"text-sky-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"AGENDAMENTOS"})]}),s.jsxs("button",{onClick:()=>v({type:"tratamentos",patient:x.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-teal-400 hover:bg-teal-50/50 transition-all group shadow-sm",children:[s.jsx(aa,{size:32,className:"text-teal-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"TRATAMENTOS"})]}),s.jsxs("button",{onClick:()=>{sm.getState().setPaciente(x.patient),w(),window.location.hash="#/lancargto"},className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-yellow-400 hover:bg-yellow-50/50 transition-all group shadow-sm",children:[s.jsx(oo,{size:32,className:"text-yellow-600 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"GTOs"})]}),s.jsxs("button",{onClick:()=>v({type:"doc-receita",patient:x.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-red-400 hover:bg-red-50/50 transition-all group shadow-sm",children:[s.jsx(Ba,{size:32,className:"text-red-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"RECEITA"})]}),s.jsxs("button",{onClick:()=>v({type:"doc-raiox",patient:x.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-purple-400 hover:bg-purple-50/50 transition-all group shadow-sm",children:[s.jsx(QD,{size:32,className:"text-purple-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"RAIO-X"})]}),s.jsxs("button",{onClick:()=>v({type:"relatorio-paciente",patient:x.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-violet-400 hover:bg-violet-50/50 transition-all group shadow-sm",children:[s.jsx(Io,{size:32,className:"text-violet-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"RELATÓRIOS"})]}),s.jsxs("button",{onClick:()=>v({type:"editar",patient:x.patient}),className:"flex flex-col items-center justify-center p-5 bg-white border border-gray-200 rounded-xl hover:border-blue-400 hover:bg-blue-50/50 transition-all group shadow-sm",children:[s.jsx(zo,{size:32,className:"text-blue-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm text-center",children:"EDITAR DADOS"})]})]})]})}),x.type==="agendamento"&&x.patient&&s.jsx(MM,{patient:x.patient,onClose:w}),x.type==="doc-receita"&&x.patient&&s.jsx(hM,{paciente:x.patient,onClose:w}),x.type==="doc-raiox"&&x.patient&&s.jsx(mM,{paciente:x.patient,onClose:w}),x.type==="tratamentos"&&x.patient&&s.jsx(UM,{patient:x.patient,onClose:w}),x.type==="relatorio-paciente"&&x.patient&&s.jsx(BM,{patient:x.patient,onClose:w}),x.type==="lancar"&&x.patient&&s.jsx(DM,{patient:x.patient,onClose:w,onSaved:p}),x.type==="contrato"&&x.patient&&s.jsx(oj,{paciente:x.patient,onClose:w,onSaved:p}),x.type==="financial"&&x.patient&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col p-6 animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"flex justify-between items-center mb-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-gray-700 font-bold text-xl",children:[s.jsx(RO,{size:28,className:"text-gray-400"}),"Menu Financeiro"]}),s.jsx("button",{onClick:w,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:20})})]}),s.jsx("p",{className:"text-gray-500 text-sm mb-8 font-bold uppercase",children:x.patient.nome}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[s.jsxs("button",{onClick:()=>v({type:"lancar",patient:x.patient}),className:"flex flex-col items-center justify-center p-6 bg-white border border-gray-200 rounded-xl hover:border-green-400 hover:bg-green-50/50 transition-all group shadow-sm",children:[s.jsx(BN,{size:32,className:"text-green-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm",children:"LANÇAR"})]}),s.jsxs("button",{onClick:()=>v({type:"asaas",patient:x.patient}),className:"flex flex-col items-center justify-center p-6 bg-white border border-gray-200 rounded-xl hover:border-blue-400 hover:bg-blue-50/50 transition-all group shadow-sm",children:[s.jsx(UN,{size:32,className:"text-blue-600 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm",children:"ASAAS"})]}),s.jsxs("button",{onClick:()=>v({type:"historico",patient:x.patient}),className:"flex flex-col items-center justify-center p-6 bg-white border border-gray-200 rounded-xl hover:border-gray-400 hover:bg-gray-50/50 transition-all group shadow-sm",children:[s.jsx(mD,{size:32,className:"text-gray-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm",children:"HISTÓRICO"})]}),s.jsxs("button",{onClick:()=>v({type:"contrato",patient:x.patient}),className:"flex flex-col items-center justify-center p-6 bg-white border border-gray-200 rounded-xl hover:border-indigo-400 hover:bg-indigo-50/50 transition-all group shadow-sm",children:[s.jsx(Ba,{size:32,className:"text-indigo-500 mb-2 group-hover:scale-110 transition-transform"}),s.jsx("span",{className:"font-bold text-gray-700 text-sm",children:"CONTRATOS"})]})]})]})}),x.type==="asaas"&&x.patient&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-40 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsx("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col animate-in fade-in zoom-in-50 duration-200",children:s.jsxs("form",{onSubmit:H,children:[s.jsx("div",{className:"p-6 border-b border-gray-200",children:s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[s.jsx("span",{className:"w-6 h-4 bg-yellow-400 rounded-sm flex items-center justify-center text-yellow-800",children:s.jsx(WC,{size:14})}),"PARCELAMENTO INTELIGENTE (ASAAS)"]}),s.jsxs("p",{className:"text-sm text-gray-500 mt-2",children:["Cliente: ",s.jsx("span",{className:"font-bold uppercase",children:x.patient.nome})]})]}),s.jsx("button",{type:"button",onClick:w,className:"text-gray-400 hover:text-gray-600",children:s.jsx(Qe,{size:20})})]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"TRATAMENTO"}),s.jsx("input",{type:"text",name:"tratamento",value:D.tratamento,onChange:I,placeholder:"EX: ORTODONTIA COMPLETA",className:"w-full border border-gray-300 rounded-md p-2 text-sm uppercase-input"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"VALOR TOTAL (R$)"}),s.jsx("input",{type:"number",step:"0.01",name:"valorTotal",value:D.valorTotal,onChange:I,placeholder:"0,00",className:"w-full border border-gray-300 rounded-md p-2 text-sm"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"DESCONTO (R$)"}),s.jsx("input",{type:"number",step:"0.01",name:"desconto",value:D.desconto,onChange:I,placeholder:"0,00",className:"w-full border border-gray-300 rounded-md p-2 text-sm"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"ENTRADA (R$)"}),s.jsx("input",{type:"number",step:"0.01",name:"entrada",value:D.entrada,onChange:I,placeholder:"0,00",className:"w-full border border-gray-300 rounded-md p-2 text-sm"})]}),s.jsxs("div",{className:"bg-blue-50/70 p-3 rounded-md flex justify-between items-center border border-blue-100/50",children:[s.jsx("span",{className:"font-semibold text-blue-700 text-sm",children:"SALDO A PARCELAR:"}),s.jsx("span",{className:"font-bold text-blue-700 text-lg",children:$.toLocaleString("pt-BR",{style:"currency",currency:"BRL"})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"PARCELAS (ATÉ 48X)"}),s.jsx("select",{name:"parcelas",value:D.parcelas,onChange:I,className:"w-full border border-gray-300 rounded-md p-2 text-sm bg-white",children:Array.from({length:48},(ee,he)=>he+1).map(ee=>s.jsxs("option",{value:ee,children:[ee,"x"]},ee))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"VENCIMENTO 1ª PARCELA"}),s.jsx("input",{type:"date",name:"vencimento",value:D.vencimento,onChange:I,className:"w-full border border-gray-300 rounded-md p-2 text-sm"})]})]}),s.jsxs("div",{className:"text-center text-blue-600 font-bold text-lg py-2",children:[D.parcelas,"x DE ",M.toLocaleString("pt-BR",{style:"currency",currency:"BRL"})]})]}),s.jsxs("div",{className:"p-6 bg-gray-50 border-t border-gray-200 flex justify-end gap-3",children:[s.jsx("button",{type:"button",onClick:w,className:"px-6 py-2 bg-gray-200 hover:bg-gray-300 text-gray-700 font-bold rounded-lg transition-colors text-sm uppercase",children:"CANCELAR"}),s.jsxs("button",{type:"submit",className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white font-bold rounded-lg shadow-sm flex items-center justify-center gap-2 transition-colors text-sm uppercase",children:[s.jsx(ZD,{size:16}),"GERAR CARNÊ/PIX"]})]})]})})})]})};var Du,Ce,uj,fj,Fl,hr,Jv,hj,pj,Zd={},gj=[],FM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function ks(t,e){for(var n in e)t[n]=e[n];return t}function mj(t){var e=t.parentNode;e&&e.removeChild(t)}function _(t,e,n){var r,i,c,d={};for(c in e)c=="key"?r=e[c]:c=="ref"?i=e[c]:d[c]=e[c];if(arguments.length>2&&(d.children=arguments.length>3?Du.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(c in t.defaultProps)d[c]===void 0&&(d[c]=t.defaultProps[c]);return Rd(t,d,r,i,null)}function Rd(t,e,n,r,i){var c={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:i??++uj};return i==null&&Ce.vnode!=null&&Ce.vnode(c),c}function en(){return{current:null}}function ot(t){return t.children}function VM(t,e,n,r,i){var c;for(c in n)c==="children"||c==="key"||c in e||Kd(t,c,null,n[c],r);for(c in e)i&&typeof e[c]!="function"||c==="children"||c==="key"||c==="value"||c==="checked"||n[c]===e[c]||Kd(t,c,e[c],n[c],r)}function e1(t,e,n){e[0]==="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||FM.test(e)?n:n+"px"}function Kd(t,e,n,r,i){var c;e:if(e==="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||e1(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||e1(t.style,e,n[e])}else if(e[0]==="o"&&e[1]==="n")c=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+c]=n,n?r||t.addEventListener(e,c?n1:t1,c):t.removeEventListener(e,c?n1:t1,c);else if(e!=="dangerouslySetInnerHTML"){if(i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e.indexOf("-")==-1?t.removeAttribute(e):t.setAttribute(e,n))}}function t1(t){Fl=!0;try{return this.l[t.type+!1](Ce.event?Ce.event(t):t)}finally{Fl=!1}}function n1(t){Fl=!0;try{return this.l[t.type+!0](Ce.event?Ce.event(t):t)}finally{Fl=!1}}function On(t,e){this.props=t,this.context=e}function jo(t,e){if(e==null)return t.__?jo(t.__,t.__.__k.indexOf(t)+1):null;for(var n;ee&&hr.sort(function(h,p){return h.__v.__b-p.__v.__b}));Jd.__r=0}function bj(t,e,n,r,i,c,d,f,h,p){var b,y,x,v,N,j,S,R=r&&r.__k||gj,w=R.length;for(n.__k=[],b=0;b0?Rd(v.type,v.props,v.key,v.ref?v.ref:null,v.__v):v)!=null){if(v.__=n,v.__b=n.__b+1,(x=R[b])===null||x&&v.key==x.key&&v.type===x.type)R[b]=void 0;else for(y=0;y=0;e--)if((n=t.__k[e])&&(r=Nj(n)))return r}return null}function rm(t,e,n,r,i,c,d,f,h){var p,b,y,x,v,N,j,S,R,w,D,C,I,L,F,Y=e.type;if(e.constructor!==void 0)return null;n.__h!=null&&(h=n.__h,f=e.__e=n.__e,e.__h=null,c=[f]),(p=Ce.__b)&&p(e);try{e:if(typeof Y=="function"){if(S=e.props,R=(p=Y.contextType)&&r[p.__c],w=p?R?R.props.value:p.__:r,n.__c?j=(b=e.__c=n.__c).__=b.__E:("prototype"in Y&&Y.prototype.render?e.__c=b=new Y(S,w):(e.__c=b=new On(S,w),b.constructor=Y,b.render=YM),R&&R.sub(b),b.props=S,b.state||(b.state={}),b.context=w,b.__n=r,y=b.__d=!0,b.__h=[],b._sb=[]),b.__s==null&&(b.__s=b.state),Y.getDerivedStateFromProps!=null&&(b.__s==b.state&&(b.__s=ks({},b.__s)),ks(b.__s,Y.getDerivedStateFromProps(S,b.__s))),x=b.props,v=b.state,b.__v=e,y)Y.getDerivedStateFromProps==null&&b.componentWillMount!=null&&b.componentWillMount(),b.componentDidMount!=null&&b.__h.push(b.componentDidMount);else{if(Y.getDerivedStateFromProps==null&&S!==x&&b.componentWillReceiveProps!=null&&b.componentWillReceiveProps(S,w),!b.__e&&b.shouldComponentUpdate!=null&&b.shouldComponentUpdate(S,b.__s,w)===!1||e.__v===n.__v){for(e.__v!==n.__v&&(b.props=S,b.state=b.__s,b.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.forEach(function($){$&&($.__=e)}),D=0;D3;)n.pop()();if(n[1]>>1,1),e.i.removeChild(r)}}),So(_(JM,{context:e.context},t.__v),e.l)):e.l&&e.componentWillUnmount()}function tI(t,e){var n=_(eI,{__v:t,i:e});return n.containerInfo=e,n}(bd.prototype=new On).__a=function(t){var e=this,n=Dj(e.__v),r=e.o.get(t);return r[0]++,function(i){var c=function(){e.props.revealOrder?(r.push(i),p1(e,t,r)):i()};n?n(c):c()}},bd.prototype.render=function(t){this.u=null,this.o=new Map;var e=eu(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},bd.prototype.componentDidUpdate=bd.prototype.componentDidMount=function(){var t=this;this.o.forEach(function(e,n){p1(t,n,e)})};var nI=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,aI=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,sI=typeof document<"u",rI=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(t)};On.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(On.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var g1=Ce.event;function lI(){}function iI(){return this.cancelBubble}function oI(){return this.defaultPrevented}Ce.event=function(t){return g1&&(t=g1(t)),t.persist=lI,t.isPropagationStopped=iI,t.isDefaultPrevented=oI,t.nativeEvent=t};var m1={configurable:!0,get:function(){return this.class}},x1=Ce.vnode;Ce.vnode=function(t){var e=t.type,n=t.props,r=n;if(typeof e=="string"){var i=e.indexOf("-")===-1;for(var c in r={},n){var d=n[c];sI&&c==="children"&&e==="noscript"||c==="value"&&"defaultValue"in n&&d==null||(c==="defaultValue"&&"value"in n&&n.value==null?c="value":c==="download"&&d===!0?d="":/ondoubleclick/i.test(c)?c="ondblclick":/^onchange(textarea|input)/i.test(c+e)&&!rI(n.type)?c="oninput":/^onfocus$/i.test(c)?c="onfocusin":/^onblur$/i.test(c)?c="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(c)?c=c.toLowerCase():i&&aI.test(c)?c=c.replace(/[A-Z0-9]/g,"-$&").toLowerCase():d===null&&(d=void 0),/^oninput$/i.test(c)&&(c=c.toLowerCase(),r[c]&&(c="oninputCapture")),r[c]=d)}e=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=eu(n.children).forEach(function(f){f.props.selected=r.value.indexOf(f.props.value)!=-1})),e=="select"&&r.defaultValue!=null&&(r.value=eu(n.children).forEach(function(f){f.props.selected=r.multiple?r.defaultValue.indexOf(f.props.value)!=-1:r.defaultValue==f.props.value})),t.props=r,n.class!=n.className&&(m1.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",m1))}t.$$typeof=nI,x1&&x1(t)};var b1=Ce.__r;Ce.__r=function(t){b1&&b1(t),t.__c};const Oj=[],tg=new Map;function lm(t){Oj.push(t),tg.forEach(e=>{Tj(e,t)})}function cI(t){t.isConnected&&t.getRootNode&&Rj(t.getRootNode())}function Rj(t){let e=tg.get(t);if(!e||!e.isConnected){if(e=t.querySelector("style[data-fullcalendar]"),!e){e=document.createElement("style"),e.setAttribute("data-fullcalendar","");const n=uI();n&&(e.nonce=n);const r=t===document?document.head:t,i=t===document?r.querySelector("script,link[rel=stylesheet],link[as=style],style"):r.firstChild;r.insertBefore(e,i)}tg.set(t,e),dI(e)}}function dI(t){for(const e of Oj)Tj(t,e)}function Tj(t,e){const{sheet:n}=t,r=n.cssRules.length;e.split("}").forEach((i,c)=>{i=i.trim(),i&&n.insertRule(i+"}",r+c)})}let Cp;function uI(){return Cp===void 0&&(Cp=fI()),Cp}function fI(){const t=document.querySelector('meta[name="csp-nonce"]');if(t&&t.hasAttribute("content"))return t.getAttribute("content");const e=document.querySelector("script[nonce]");return e&&e.nonce||""}typeof document<"u"&&Rj(document);var hI=':root{--fc-small-font-size:.85em;--fc-page-bg-color:#fff;--fc-neutral-bg-color:hsla(0,0%,82%,.3);--fc-neutral-text-color:grey;--fc-border-color:#ddd;--fc-button-text-color:#fff;--fc-button-bg-color:#2c3e50;--fc-button-border-color:#2c3e50;--fc-button-hover-bg-color:#1e2b37;--fc-button-hover-border-color:#1a252f;--fc-button-active-bg-color:#1a252f;--fc-button-active-border-color:#151e27;--fc-event-bg-color:#3788d8;--fc-event-border-color:#3788d8;--fc-event-text-color:#fff;--fc-event-selected-overlay-color:rgba(0,0,0,.25);--fc-more-link-bg-color:#d0d0d0;--fc-more-link-text-color:inherit;--fc-event-resizer-thickness:8px;--fc-event-resizer-dot-total-width:8px;--fc-event-resizer-dot-border-width:1px;--fc-non-business-color:hsla(0,0%,84%,.3);--fc-bg-event-color:#8fdf82;--fc-bg-event-opacity:0.3;--fc-highlight-color:rgba(188,232,241,.3);--fc-today-bg-color:rgba(255,220,40,.15);--fc-now-indicator-color:red}.fc-not-allowed,.fc-not-allowed .fc-event{cursor:not-allowed}.fc{display:flex;flex-direction:column;font-size:1em}.fc,.fc *,.fc :after,.fc :before{box-sizing:border-box}.fc table{border-collapse:collapse;border-spacing:0;font-size:1em}.fc th{text-align:center}.fc td,.fc th{padding:0;vertical-align:top}.fc a[data-navlink]{cursor:pointer}.fc a[data-navlink]:hover{text-decoration:underline}.fc-direction-ltr{direction:ltr;text-align:left}.fc-direction-rtl{direction:rtl;text-align:right}.fc-theme-standard td,.fc-theme-standard th{border:1px solid var(--fc-border-color)}.fc-liquid-hack td,.fc-liquid-hack th{position:relative}@font-face{font-family:fcicons;font-style:normal;font-weight:400;src:url("data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBfAAAAC8AAAAYGNtYXAXVtKNAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZgYydxIAAAF4AAAFNGhlYWQUJ7cIAAAGrAAAADZoaGVhB20DzAAABuQAAAAkaG10eCIABhQAAAcIAAAALGxvY2ED4AU6AAAHNAAAABhtYXhwAA8AjAAAB0wAAAAgbmFtZXsr690AAAdsAAABhnBvc3QAAwAAAAAI9AAAACAAAwPAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpBgPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6Qb//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAWIAjQKeAskAEwAAJSc3NjQnJiIHAQYUFwEWMjc2NCcCnuLiDQ0MJAz/AA0NAQAMJAwNDcni4gwjDQwM/wANIwz/AA0NDCMNAAAAAQFiAI0CngLJABMAACUBNjQnASYiBwYUHwEHBhQXFjI3AZ4BAA0N/wAMJAwNDeLiDQ0MJAyNAQAMIw0BAAwMDSMM4uINIwwNDQAAAAIA4gC3Ax4CngATACcAACUnNzY0JyYiDwEGFB8BFjI3NjQnISc3NjQnJiIPAQYUHwEWMjc2NCcB87e3DQ0MIw3VDQ3VDSMMDQ0BK7e3DQ0MJAzVDQ3VDCQMDQ3zuLcMJAwNDdUNIwzWDAwNIwy4twwkDA0N1Q0jDNYMDA0jDAAAAgDiALcDHgKeABMAJwAAJTc2NC8BJiIHBhQfAQcGFBcWMjchNzY0LwEmIgcGFB8BBwYUFxYyNwJJ1Q0N1Q0jDA0Nt7cNDQwjDf7V1Q0N1QwkDA0Nt7cNDQwkDLfWDCMN1Q0NDCQMt7gMIw0MDNYMIw3VDQ0MJAy3uAwjDQwMAAADAFUAAAOrA1UAMwBoAHcAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMhMjY1NCYjISIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAAVYRGRkR/qoRGRkRA1UFBAUOCQkVDAsZDf2rDRkLDBUJCA4FBQUFBQUOCQgVDAsZDQJVDRkLDBUJCQ4FBAVVAgECBQMCBwQECAX9qwQJAwQHAwMFAQICAgIBBQMDBwQDCQQCVQUIBAQHAgMFAgEC/oAZEhEZGRESGQAAAAADAFUAAAOrA1UAMwBoAIkAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMzFRQWMzI2PQEzMjY1NCYrATU0JiMiBh0BIyIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAgBkSEhmAERkZEYAZEhIZgBEZGREDVQUEBQ4JCRUMCxkN/asNGQsMFQkIDgUFBQUFBQ4JCBUMCxkNAlUNGQsMFQkJDgUEBVUCAQIFAwIHBAQIBf2rBAkDBAcDAwUBAgICAgEFAwMHBAMJBAJVBQgEBAcCAwUCAQL+gIASGRkSgBkSERmAEhkZEoAZERIZAAABAOIAjQMeAskAIAAAExcHBhQXFjI/ARcWMjc2NC8BNzY0JyYiDwEnJiIHBhQX4uLiDQ0MJAzi4gwkDA0N4uINDQwkDOLiDCQMDQ0CjeLiDSMMDQ3h4Q0NDCMN4uIMIw0MDOLiDAwNIwwAAAABAAAAAQAAa5n0y18PPPUACwQAAAAAANivOVsAAAAA2K85WwAAAAADqwNVAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAOrAAEAAAAAAAAAAAAAAAAAAAALBAAAAAAAAAAAAAAAAgAAAAQAAWIEAAFiBAAA4gQAAOIEAABVBAAAVQQAAOIAAAAAAAoAFAAeAEQAagCqAOoBngJkApoAAQAAAAsAigADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGZjaWNvbnMAZgBjAGkAYwBvAG4Ac1ZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGZjaWNvbnMAZgBjAGkAYwBvAG4Ac2ZjaWNvbnMAZgBjAGkAYwBvAG4Ac1JlZ3VsYXIAUgBlAGcAdQBsAGEAcmZjaWNvbnMAZgBjAGkAYwBvAG4Ac0ZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format("truetype")}.fc-icon{speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;font-family:fcicons!important;font-style:normal;font-variant:normal;font-weight:400;height:1em;line-height:1;text-align:center;text-transform:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1em}.fc-icon-chevron-left:before{content:"\\e900"}.fc-icon-chevron-right:before{content:"\\e901"}.fc-icon-chevrons-left:before{content:"\\e902"}.fc-icon-chevrons-right:before{content:"\\e903"}.fc-icon-minus-square:before{content:"\\e904"}.fc-icon-plus-square:before{content:"\\e905"}.fc-icon-x:before{content:"\\e906"}.fc .fc-button{border-radius:0;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;overflow:visible;text-transform:none}.fc .fc-button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}.fc .fc-button{-webkit-appearance:button}.fc .fc-button:not(:disabled){cursor:pointer}.fc .fc-button{background-color:transparent;border:1px solid transparent;border-radius:.25em;display:inline-block;font-size:1em;font-weight:400;line-height:1.5;padding:.4em .65em;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle}.fc .fc-button:hover{text-decoration:none}.fc .fc-button:focus{box-shadow:0 0 0 .2rem rgba(44,62,80,.25);outline:0}.fc .fc-button:disabled{opacity:.65}.fc .fc-button-primary{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:hover{background-color:var(--fc-button-hover-bg-color);border-color:var(--fc-button-hover-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:disabled{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button-primary:not(:disabled).fc-button-active,.fc .fc-button-primary:not(:disabled):active{background-color:var(--fc-button-active-bg-color);border-color:var(--fc-button-active-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:not(:disabled).fc-button-active:focus,.fc .fc-button-primary:not(:disabled):active:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button .fc-icon{font-size:1.5em;vertical-align:middle}.fc .fc-button-group{display:inline-flex;position:relative;vertical-align:middle}.fc .fc-button-group>.fc-button{flex:1 1 auto;position:relative}.fc .fc-button-group>.fc-button.fc-button-active,.fc .fc-button-group>.fc-button:active,.fc .fc-button-group>.fc-button:focus,.fc .fc-button-group>.fc-button:hover{z-index:1}.fc-direction-ltr .fc-button-group>.fc-button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-1px}.fc-direction-ltr .fc-button-group>.fc-button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.fc-direction-rtl .fc-button-group>.fc-button:not(:first-child){border-bottom-right-radius:0;border-top-right-radius:0;margin-right:-1px}.fc-direction-rtl .fc-button-group>.fc-button:not(:last-child){border-bottom-left-radius:0;border-top-left-radius:0}.fc .fc-toolbar{align-items:center;display:flex;justify-content:space-between}.fc .fc-toolbar.fc-header-toolbar{margin-bottom:1.5em}.fc .fc-toolbar.fc-footer-toolbar{margin-top:1.5em}.fc .fc-toolbar-title{font-size:1.75em;margin:0}.fc-direction-ltr .fc-toolbar>*>:not(:first-child){margin-left:.75em}.fc-direction-rtl .fc-toolbar>*>:not(:first-child){margin-right:.75em}.fc-direction-rtl .fc-toolbar-ltr{flex-direction:row-reverse}.fc .fc-scroller{-webkit-overflow-scrolling:touch;position:relative}.fc .fc-scroller-liquid{height:100%}.fc .fc-scroller-liquid-absolute{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-scroller-harness{direction:ltr;overflow:hidden;position:relative}.fc .fc-scroller-harness-liquid{height:100%}.fc-direction-rtl .fc-scroller-harness>.fc-scroller{direction:rtl}.fc-theme-standard .fc-scrollgrid{border:1px solid var(--fc-border-color)}.fc .fc-scrollgrid,.fc .fc-scrollgrid table{table-layout:fixed;width:100%}.fc .fc-scrollgrid table{border-left-style:hidden;border-right-style:hidden;border-top-style:hidden}.fc .fc-scrollgrid{border-bottom-width:0;border-collapse:separate;border-right-width:0}.fc .fc-scrollgrid-liquid{height:100%}.fc .fc-scrollgrid-section,.fc .fc-scrollgrid-section table,.fc .fc-scrollgrid-section>td{height:1px}.fc .fc-scrollgrid-section-liquid>td{height:100%}.fc .fc-scrollgrid-section>*{border-left-width:0;border-top-width:0}.fc .fc-scrollgrid-section-footer>*,.fc .fc-scrollgrid-section-header>*{border-bottom-width:0}.fc .fc-scrollgrid-section-body table,.fc .fc-scrollgrid-section-footer table{border-bottom-style:hidden}.fc .fc-scrollgrid-section-sticky>*{background:var(--fc-page-bg-color);position:sticky;z-index:3}.fc .fc-scrollgrid-section-header.fc-scrollgrid-section-sticky>*{top:0}.fc .fc-scrollgrid-section-footer.fc-scrollgrid-section-sticky>*{bottom:0}.fc .fc-scrollgrid-sticky-shim{height:1px;margin-bottom:-1px}.fc-sticky{position:sticky}.fc .fc-view-harness{flex-grow:1;position:relative}.fc .fc-view-harness-active>.fc-view{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-col-header-cell-cushion{display:inline-block;padding:2px 4px}.fc .fc-bg-event,.fc .fc-highlight,.fc .fc-non-business{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-non-business{background:var(--fc-non-business-color)}.fc .fc-bg-event{background:var(--fc-bg-event-color);opacity:var(--fc-bg-event-opacity)}.fc .fc-bg-event .fc-event-title{font-size:var(--fc-small-font-size);font-style:italic;margin:.5em}.fc .fc-highlight{background:var(--fc-highlight-color)}.fc .fc-cell-shaded,.fc .fc-day-disabled{background:var(--fc-neutral-bg-color)}a.fc-event,a.fc-event:hover{text-decoration:none}.fc-event.fc-event-draggable,.fc-event[href]{cursor:pointer}.fc-event .fc-event-main{position:relative;z-index:2}.fc-event-dragging:not(.fc-event-selected){opacity:.75}.fc-event-dragging.fc-event-selected{box-shadow:0 2px 7px rgba(0,0,0,.3)}.fc-event .fc-event-resizer{display:none;position:absolute;z-index:4}.fc-event-selected .fc-event-resizer,.fc-event:hover .fc-event-resizer{display:block}.fc-event-selected .fc-event-resizer{background:var(--fc-page-bg-color);border-color:inherit;border-radius:calc(var(--fc-event-resizer-dot-total-width)/2);border-style:solid;border-width:var(--fc-event-resizer-dot-border-width);height:var(--fc-event-resizer-dot-total-width);width:var(--fc-event-resizer-dot-total-width)}.fc-event-selected .fc-event-resizer:before{bottom:-20px;content:"";left:-20px;position:absolute;right:-20px;top:-20px}.fc-event-selected,.fc-event:focus{box-shadow:0 2px 5px rgba(0,0,0,.2)}.fc-event-selected:before,.fc-event:focus:before{bottom:0;content:"";left:0;position:absolute;right:0;top:0;z-index:3}.fc-event-selected:after,.fc-event:focus:after{background:var(--fc-event-selected-overlay-color);bottom:-1px;content:"";left:-1px;position:absolute;right:-1px;top:-1px;z-index:1}.fc-h-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-h-event .fc-event-main{color:var(--fc-event-text-color)}.fc-h-event .fc-event-main-frame{display:flex}.fc-h-event .fc-event-time{max-width:100%;overflow:hidden}.fc-h-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-width:0}.fc-h-event .fc-event-title{display:inline-block;left:0;max-width:100%;overflow:hidden;right:0;vertical-align:top}.fc-h-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-start),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-end){border-bottom-left-radius:0;border-left-width:0;border-top-left-radius:0}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-end),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-start){border-bottom-right-radius:0;border-right-width:0;border-top-right-radius:0}.fc-h-event:not(.fc-event-selected) .fc-event-resizer{bottom:0;top:0;width:var(--fc-event-resizer-thickness)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end{cursor:w-resize;left:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start{cursor:e-resize;right:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-h-event.fc-event-selected .fc-event-resizer{margin-top:calc(var(--fc-event-resizer-dot-total-width)*-.5);top:50%}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-start,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-end{left:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-end,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-start{right:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc .fc-popover{box-shadow:0 2px 6px rgba(0,0,0,.15);position:absolute;z-index:9999}.fc .fc-popover-header{align-items:center;display:flex;flex-direction:row;justify-content:space-between;padding:3px 4px}.fc .fc-popover-title{margin:0 2px}.fc .fc-popover-close{cursor:pointer;font-size:1.1em;opacity:.65}.fc-theme-standard .fc-popover{background:var(--fc-page-bg-color);border:1px solid var(--fc-border-color)}.fc-theme-standard .fc-popover-header{background:var(--fc-neutral-bg-color)}';lm(hI);class im{constructor(e){this.drainedOption=e,this.isRunning=!1,this.isDirty=!1,this.pauseDepths={},this.timeoutId=0}request(e){this.isDirty=!0,this.isPaused()||(this.clearTimeout(),e==null?this.tryDrain():this.timeoutId=setTimeout(this.tryDrain.bind(this),e))}pause(e=""){let{pauseDepths:n}=this;n[e]=(n[e]||0)+1,this.clearTimeout()}resume(e="",n){let{pauseDepths:r}=this;e in r&&(n?delete r[e]:(r[e]-=1,r[e]<=0&&delete r[e]),this.tryDrain())}isPaused(){return Object.keys(this.pauseDepths).length}tryDrain(){if(!this.isRunning&&!this.isPaused()){for(this.isRunning=!0;this.isDirty;)this.isDirty=!1,this.drained();this.isRunning=!1}}clear(){this.clearTimeout(),this.isDirty=!1,this.pauseDepths={}}clearTimeout(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=0)}drained(){this.drainedOption&&this.drainedOption()}}function om(t){t.parentNode&&t.parentNode.removeChild(t)}function Yt(t,e){if(t.closest)return t.closest(e);if(!document.documentElement.contains(t))return null;do{if(pI(t,e))return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType===1);return null}function pI(t,e){return(t.matches||t.matchesSelector||t.msMatchesSelector).call(t,e)}function gI(t,e){let n=t instanceof HTMLElement?[t]:t,r=[];for(let i=0;i{let r=Yt(n.target,t);r&&e.call(r,n,r)}}function Mj(t,e,n,r){let i=xI(n,r);return t.addEventListener(e,i),()=>{t.removeEventListener(e,i)}}function bI(t,e,n,r){let i;return Mj(t,"mouseover",e,(c,d)=>{if(d!==i){i=d,n(c,d);let f=h=>{i=null,r(h,d),d.removeEventListener("mouseleave",f)};d.addEventListener("mouseleave",f)}})}const v1=["webkitTransitionEnd","otransitionend","oTransitionEnd","msTransitionEnd","transitionend"];function yI(t,e){let n=r=>{e(r),v1.forEach(i=>{t.removeEventListener(i,n)})};v1.forEach(r=>{t.addEventListener(r,n)})}function Ij(t){return Object.assign({onClick:t},Lj(t))}function Lj(t){return{tabIndex:0,onKeyDown(e){(e.key==="Enter"||e.key===" ")&&(t(e),e.preventDefault())}}}let N1=0;function _r(){return N1+=1,String(N1)}function cm(){document.body.classList.add("fc-not-allowed")}function dm(){document.body.classList.remove("fc-not-allowed")}function vI(t){t.style.userSelect="none",t.style.webkitUserSelect="none",t.addEventListener("selectstart",Ru)}function NI(t){t.style.userSelect="",t.style.webkitUserSelect="",t.removeEventListener("selectstart",Ru)}function EI(t){t.addEventListener("contextmenu",Ru)}function jI(t){t.removeEventListener("contextmenu",Ru)}function SI(t){let e=[],n=[],r,i;for(typeof t=="string"?n=t.split(/\s*,\s*/):typeof t=="function"?n=[t]:Array.isArray(t)&&(n=t),r=0;rr.replace("$"+c,i||""),t):n}function DI(t,e){return t-e}function kd(t){return t%1===0}function OI(t){let e=t.querySelector(".fc-scrollgrid-shrink-frame"),n=t.querySelector(".fc-scrollgrid-shrink-cushion");if(!e)throw new Error("needs fc-scrollgrid-shrink-frame className");if(!n)throw new Error("needs fc-scrollgrid-shrink-cushion className");return t.getBoundingClientRect().width-e.getBoundingClientRect().width+n.getBoundingClientRect().width}const E1=["years","months","days","milliseconds"],RI=/^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/;function Ve(t,e){return typeof t=="string"?TI(t):typeof t=="object"&&t?j1(t):typeof t=="number"?j1({[e||"milliseconds"]:t}):null}function TI(t){let e=RI.exec(t);if(e){let n=e[1]?-1:1;return{years:0,months:0,days:n*(e[2]?parseInt(e[2],10):0),milliseconds:n*((e[3]?parseInt(e[3],10):0)*60*60*1e3+(e[4]?parseInt(e[4],10):0)*60*1e3+(e[5]?parseInt(e[5],10):0)*1e3+(e[6]?parseInt(e[6],10):0))}}return null}function j1(t){let e={years:t.years||t.year||0,months:t.months||t.month||0,days:t.days||t.day||0,milliseconds:(t.hours||t.hour||0)*60*60*1e3+(t.minutes||t.minute||0)*60*1e3+(t.seconds||t.second||0)*1e3+(t.milliseconds||t.millisecond||t.ms||0)},n=t.weeks||t.week;return n&&(e.days+=n*7,e.specifiedWeeks=!0),e}function kI(t,e){return t.years===e.years&&t.months===e.months&&t.days===e.days&&t.milliseconds===e.milliseconds}function ng(t,e){return{years:t.years+e.years,months:t.months+e.months,days:t.days+e.days,milliseconds:t.milliseconds+e.milliseconds}}function _I(t,e){return{years:t.years-e.years,months:t.months-e.months,days:t.days-e.days,milliseconds:t.milliseconds-e.milliseconds}}function MI(t,e){return{years:t.years*e,months:t.months*e,days:t.days*e,milliseconds:t.milliseconds*e}}function II(t){return Al(t)/365}function LI(t){return Al(t)/30}function Al(t){return na(t)/864e5}function na(t){return t.years*(365*864e5)+t.months*(30*864e5)+t.days*864e5+t.milliseconds}function um(t,e){let n=null;for(let r=0;r=1?Math.min(i,c):i}function Dp(t,e,n,r){let i=un([e,0,1+QI(e,n,r)]),c=ct(t),d=Math.round(Mr(i,c));return Math.floor(d/7)+1}function QI(t,e,n){let r=7+e-n;return-((7+un([t,0,r]).getUTCDay()-e)%7)+r-1}function A1(t){return[t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]}function w1(t){return new Date(t[0],t[1]||0,t[2]==null?1:t[2],t[3]||0,t[4]||0,t[5]||0)}function _s(t){return[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()]}function un(t){return t.length===1&&(t=t.concat([0])),new Date(Date.UTC(...t))}function zj(t){return!isNaN(t.valueOf())}function Ms(t){return t.getUTCHours()*1e3*60*60+t.getUTCMinutes()*1e3*60+t.getUTCSeconds()*1e3+t.getUTCMilliseconds()}function Pj(t,e,n=!1){let r=t.toISOString();return r=r.replace(".000",""),n&&(r=r.replace("T00:00:00Z","")),r.length>10&&(e==null?r=r.replace("Z",""):e!==0&&(r=r.replace("Z",hm(e,!0)))),r}function fm(t){return t.toISOString().replace(/T.*$/,"")}function WI(t){return t.toISOString().match(/^\d{4}-\d{2}/)[0]}function XI(t){return Sl(t.getUTCHours(),2)+":"+Sl(t.getUTCMinutes(),2)+":"+Sl(t.getUTCSeconds(),2)}function hm(t,e=!1){let n=t<0?"-":"+",r=Math.abs(t),i=Math.floor(r/60),c=Math.round(r%60);return e?`${n+Sl(i,2)}:${Sl(c,2)}`:`GMT${n}${i}${c?`:${Sl(c,2)}`:""}`}function Oe(t,e,n){let r,i;return function(...c){if(!r)i=t.apply(this,c);else if(!Hs(r,c)){let d=t.apply(this,c);(!e||!e(d,i))&&(i=d)}return r=c,i}}function _d(t,e,n){let r,i;return c=>(r?ra(r,c)||(i=t.call(this,c)):i=t.call(this,c),r=c,i)}const Op={week:3,separator:9,omitZeroMinute:9,meridiem:9,omitCommas:9},nu={timeZoneName:7,era:6,year:5,month:4,day:2,weekday:2,hour:1,minute:1,second:1},yd=/\s*([ap])\.?m\.?/i,ZI=/,/g,KI=/\s+/g,JI=/\u200e/g,e4=/UTC|GMT/;class t4{constructor(e){let n={},r={},i=9;for(let c in e)c in Op?(r[c]=e[c],Op[c]<9&&(i=Math.min(Op[c],i))):(n[c]=e[c],c in nu&&(i=Math.min(nu[c],i)));this.standardDateProps=n,this.extendedSettings=r,this.smallestUnitNum=i,this.buildFormattingFunc=Oe(C1)}format(e,n){return this.buildFormattingFunc(this.standardDateProps,this.extendedSettings,n)(e)}formatRange(e,n,r,i){let{standardDateProps:c,extendedSettings:d}=this,f=i4(e.marker,n.marker,r.calendarSystem);if(!f)return this.format(e,r);let h=f;h>1&&(c.year==="numeric"||c.year==="2-digit")&&(c.month==="numeric"||c.month==="2-digit")&&(c.day==="numeric"||c.day==="2-digit")&&(h=1);let p=this.format(e,r),b=this.format(n,r);if(p===b)return p;let y=o4(c,h),x=C1(y,d,r),v=x(e),N=x(n),j=c4(p,v,b,N),S=d.separator||i||r.defaultSeparator||"";return j?j.before+v+S+N+j.after:p+S+b}getSmallestUnit(){switch(this.smallestUnitNum){case 7:case 6:case 5:return"year";case 4:return"month";case 3:return"week";case 2:return"day";default:return"time"}}}function C1(t,e,n){let r=Object.keys(t).length;return r===1&&t.timeZoneName==="short"?i=>hm(i.timeZoneOffset):r===0&&e.week?i=>l4(n.computeWeekNumber(i.marker),n.weekText,n.weekTextLong,n.locale,e.week):n4(t,e,n)}function n4(t,e,n){t=Object.assign({},t),e=Object.assign({},e),a4(t,e),t.timeZone="UTC";let r=new Intl.DateTimeFormat(n.locale.codes,t),i;if(e.omitZeroMinute){let c=Object.assign({},t);delete c.minute,i=new Intl.DateTimeFormat(n.locale.codes,c)}return c=>{let{marker:d}=c,f;i&&!d.getUTCMinutes()?f=i:f=r;let h=f.format(d);return s4(h,c,t,e,n)}}function a4(t,e){t.timeZoneName&&(t.hour||(t.hour="2-digit"),t.minute||(t.minute="2-digit")),t.timeZoneName==="long"&&(t.timeZoneName="short"),e.omitZeroMinute&&(t.second||t.millisecond)&&delete e.omitZeroMinute}function s4(t,e,n,r,i){return t=t.replace(JI,""),n.timeZoneName==="short"&&(t=r4(t,i.timeZone==="UTC"||e.timeZoneOffset==null?"UTC":hm(e.timeZoneOffset))),r.omitCommas&&(t=t.replace(ZI,"").trim()),r.omitZeroMinute&&(t=t.replace(":00","")),r.meridiem===!1?t=t.replace(yd,"").trim():r.meridiem==="narrow"?t=t.replace(yd,(c,d)=>d.toLocaleLowerCase()):r.meridiem==="short"?t=t.replace(yd,(c,d)=>`${d.toLocaleLowerCase()}m`):r.meridiem==="lowercase"&&(t=t.replace(yd,c=>c.toLocaleLowerCase())),t=t.replace(KI," "),t=t.trim(),t}function r4(t,e){let n=!1;return t=t.replace(e4,()=>(n=!0,e)),n||(t+=` ${e}`),t}function l4(t,e,n,r,i){let c=[];return i==="long"?c.push(n):(i==="short"||i==="narrow")&&c.push(e),(i==="long"||i==="short")&&c.push(" "),c.push(r.simpleNumberFormat.format(t)),r.options.direction==="rtl"&&c.reverse(),c.join("")}function i4(t,e,n){return n.getMarkerYear(t)!==n.getMarkerYear(e)?5:n.getMarkerMonth(t)!==n.getMarkerMonth(e)?4:n.getMarkerDay(t)!==n.getMarkerDay(e)?2:Ms(t)!==Ms(e)?1:0}function o4(t,e){let n={};for(let r in t)(!(r in nu)||nu[r]<=e)&&(n[r]=t[r]);return n}function c4(t,e,n,r){let i=0;for(;i=0;c-=1){let d=t[c][r];if(typeof d=="object"&&d)i.unshift(d);else if(d!==void 0){n[r]=d;break}}i.length&&(n[r]=gm(i))}}for(let r=t.length-1;r>=0;r-=1){let i=t[r];for(let c in i)c in n||(n[c]=i[c])}return n}function Rr(t,e){let n={};for(let r in t)e(t[r],r)&&(n[r]=t[r]);return n}function Va(t,e){let n={};for(let r in t)n[r]=e(t[r],r);return n}function Uj(t){let e={};for(let n of t)e[n]=!0;return e}function mm(t){let e=[];for(let n in t)e.push(t[n]);return e}function ra(t,e){if(t===e)return!0;for(let n in t)if(su.call(t,n)&&!(n in e))return!1;for(let n in e)if(su.call(e,n)&&t[n]!==e[n])return!1;return!0}const h4=/^on[A-Z]/;function p4(t,e){const n=g4(t,e);for(let r of n)if(!h4.test(r))return!1;return!0}function g4(t,e){let n=[];for(let r in t)su.call(t,r)&&(r in e||n.push(r));for(let r in e)su.call(e,r)&&t[r]!==e[r]&&n.push(r);return n}function Tp(t,e,n={}){if(t===e)return!0;for(let r in e)if(!(r in t&&m4(t[r],e[r],n[r])))return!1;for(let r in t)if(!(r in e))return!1;return!0}function m4(t,e,n){return t===e||n===!0?!0:n?n(t,e):!1}function x4(t,e=0,n,r=1){let i=[];n==null&&(n=Object.keys(t).length);for(let c=e;c{this.props.value!==d.value&&c.forEach(f=>{f.context=d.value,f.forceUpdate()})},this.sub=d=>{c.push(d);let f=d.componentWillUnmount;d.componentWillUnmount=()=>{c.splice(c.indexOf(d),1),f&&f.call(d)}}}return i},e}class A4{constructor(e,n,r,i){this.execFunc=e,this.emitter=n,this.scrollTime=r,this.scrollTimeReset=i,this.handleScrollRequest=c=>{this.queuedRequest=Object.assign({},this.queuedRequest||{},c),this.drain()},n.on("_scrollRequest",this.handleScrollRequest),this.fireInitialScroll()}detach(){this.emitter.off("_scrollRequest",this.handleScrollRequest)}update(e){e&&this.scrollTimeReset?this.fireInitialScroll():this.drain()}fireInitialScroll(){this.handleScrollRequest({time:this.scrollTime})}drain(){this.queuedRequest&&this.execFunc(this.queuedRequest)&&(this.queuedRequest=null)}}const Qa=Hj({});function w4(t,e,n,r,i,c,d,f,h,p,b,y,x,v){return{dateEnv:i,nowManager:c,options:n,pluginHooks:f,emitter:b,dispatch:h,getCurrentData:p,calendarApi:y,viewSpec:t,viewApi:e,dateProfileGenerator:r,theme:d,isRtl:n.direction==="rtl",addResizeHandler(N){b.on("_resize",N)},removeResizeHandler(N){b.off("_resize",N)},createScrollResponder(N){return new A4(N,b,Ve(n.scrollTime),n.scrollTimeReset)},registerInteractiveComponent:x,unregisterInteractiveComponent:v}}class Ir extends On{shouldComponentUpdate(e,n){return!Tp(this.props,e,this.propEquality)||!Tp(this.state,n,this.stateEquality)}safeSetState(e){Tp(this.state,Object.assign(Object.assign({},this.state),e),this.stateEquality)||this.setState(e)}}Ir.addPropsEquality=C4;Ir.addStateEquality=D4;Ir.contextType=Qa;Ir.prototype.propEquality={};Ir.prototype.stateEquality={};class et extends Ir{}et.contextType=Qa;function C4(t){let e=Object.create(this.prototype.propEquality);Object.assign(e,t),this.prototype.propEquality=e}function D4(t){let e=Object.create(this.prototype.stateEquality);Object.assign(e,t),this.prototype.stateEquality=e}function ga(t,e){typeof t=="function"?t(e):t&&(t.current=e)}class xm extends et{constructor(){super(...arguments),this.id=_r(),this.queuedDomNodes=[],this.currentDomNodes=[],this.handleEl=e=>{const{options:n}=this.context,{generatorName:r}=this.props;(!n.customRenderingReplaces||!sg(r,n))&&this.updateElRef(e)},this.updateElRef=e=>{this.props.elRef&&ga(this.props.elRef,e)}}render(){const{props:e,context:n}=this,{options:r}=n,{customGenerator:i,defaultGenerator:c,renderProps:d}=e,f=Gj(e,[],this.handleEl);let h=!1,p,b=[],y;if(i!=null){const x=typeof i=="function"?i(d,_):i;if(x===!0)h=!0;else{const v=x&&typeof x=="object";v&&"html"in x?f.dangerouslySetInnerHTML={__html:x.html}:v&&"domNodes"in x?b=Array.prototype.slice.call(x.domNodes):(v?fj(x):typeof x!="function")?p=x:y=x}}else h=!sg(e.generatorName,r);return h&&c&&(p=c(d)),this.queuedDomNodes=b,this.currentGeneratorMeta=y,_(e.elTag,f,p)}componentDidMount(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentDidUpdate(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentWillUnmount(){this.triggerCustomRendering(!1)}triggerCustomRendering(e){var n;const{props:r,context:i}=this,{handleCustomRendering:c,customRenderingMetaMap:d}=i.options;if(c){const f=(n=this.currentGeneratorMeta)!==null&&n!==void 0?n:d==null?void 0:d[r.generatorName];f&&c(Object.assign(Object.assign({id:this.id,isActive:e,containerEl:this.base,reportNewContainerEl:this.updateElRef,generatorMeta:f},r),{elClasses:(r.elClasses||[]).filter(O4)}))}}applyQueueudDomNodes(){const{queuedDomNodes:e,currentDomNodes:n}=this,r=this.base;if(!Hs(e,n)){n.forEach(om);for(let i of e)r.appendChild(i);this.currentDomNodes=e}}}xm.addPropsEquality({elClasses:Hs,elStyle:ra,elAttrs:p4,renderProps:ra});function sg(t,e){var n;return!!(e.handleCustomRendering&&t&&(!((n=e.customRenderingMetaMap)===null||n===void 0)&&n[t]))}function Gj(t,e,n){const r=Object.assign(Object.assign({},t.elAttrs),{ref:n});return(t.elClasses||e)&&(r.className=(t.elClasses||[]).concat(e||[]).concat(r.className||[]).filter(Boolean).join(" ")),t.elStyle&&(r.style=t.elStyle),r}function O4(t){return!!t}const Fj=Hj(0);class kn extends On{constructor(){super(...arguments),this.InnerContent=R4.bind(void 0,this),this.handleEl=e=>{this.el=e,this.props.elRef&&(ga(this.props.elRef,e),e&&this.didMountMisfire&&this.componentDidMount())}}render(){const{props:e}=this,n=T4(e.classNameGenerator,e.renderProps);if(e.children){const r=Gj(e,n,this.handleEl),i=e.children(this.InnerContent,e.renderProps,r);return e.elTag?_(e.elTag,r,i):i}else return _(xm,Object.assign(Object.assign({},e),{elRef:this.handleEl,elTag:e.elTag||"div",elClasses:(e.elClasses||[]).concat(n),renderId:this.context}))}componentDidMount(){var e,n;this.el?(n=(e=this.props).didMount)===null||n===void 0||n.call(e,Object.assign(Object.assign({},this.props.renderProps),{el:this.el})):this.didMountMisfire=!0}componentWillUnmount(){var e,n;(n=(e=this.props).willUnmount)===null||n===void 0||n.call(e,Object.assign(Object.assign({},this.props.renderProps),{el:this.el}))}}kn.contextType=Fj;function R4(t,e){const n=t.props;return _(xm,Object.assign({renderProps:n.renderProps,generatorName:n.generatorName,customGenerator:n.customGenerator,defaultGenerator:n.defaultGenerator,renderId:t.context},e))}function T4(t,e){const n=typeof t=="function"?t(e):t||[];return typeof n=="string"?[n]:n}class lu extends et{render(){let{props:e,context:n}=this,{options:r}=n,i={view:n.viewApi};return _(kn,{elRef:e.elRef,elTag:e.elTag||"div",elAttrs:e.elAttrs,elClasses:[...Vj(e.viewSpec),...e.elClasses||[]],elStyle:e.elStyle,renderProps:i,classNameGenerator:r.viewClassNames,generatorName:void 0,didMount:r.viewDidMount,willUnmount:r.viewWillUnmount},()=>e.children)}}function Vj(t){return[`fc-${t.type}-view`,"fc-view"]}function k4(t,e){let n=null,r=null;return t.start&&(n=e.createMarker(t.start)),t.end&&(r=e.createMarker(t.end)),!n&&!r||n&&r&&rr&&n.push({start:r,end:c.start}),c.end>r&&(r=c.end);return re.start)&&(t.start===null||e.end===null||t.start=t.start)&&(t.end===null||e.end!==null&&e.end<=t.end)}function Ha(t,e){return(t.start===null||e>=t.start)&&(t.end===null||e=e.end?new Date(e.end.valueOf()-1):t}function qj(t){let e=Math.floor(Mr(t.start,t.end))||1,n=ct(t.start),r=It(n,e);return{start:n,end:r}}function $j(t,e=Ve(0)){let n=null,r=null;if(t.end){r=ct(t.end);let i=t.end.valueOf()-r.valueOf();i&&i>=na(e)&&(r=It(r,1))}return t.start&&(n=ct(t.start),r&&r<=n&&(r=It(n,1))),{start:n,end:r}}function El(t,e,n,r){return r==="year"?Ve(n.diffWholeYears(t,e),"year"):r==="month"?Ve(n.diffWholeMonths(t,e),"month"):GI(t,e)}class Yj{constructor(e){this.props=e,this.initHiddenDays()}buildPrev(e,n,r){let{dateEnv:i}=this.props,c=i.subtract(i.startOf(n,e.currentRangeUnit),e.dateIncrement);return this.build(c,-1,r)}buildNext(e,n,r){let{dateEnv:i}=this.props,c=i.add(i.startOf(n,e.currentRangeUnit),e.dateIncrement);return this.build(c,1,r)}build(e,n,r=!0){let{props:i}=this,c,d,f,h,p,b;return c=this.buildValidRange(),c=this.trimHiddenDays(c),r&&(e=I4(e,c)),d=this.buildCurrentRangeInfo(e,n),f=/^(year|month|week|day)$/.test(d.unit),h=this.buildRenderRange(this.trimHiddenDays(d.range),d.unit,f),h=this.trimHiddenDays(h),p=h,i.showNonCurrentDates||(p=Tr(p,d.range)),p=this.adjustActiveRange(p),p=Tr(p,c),b=bm(d.range,c),Ha(h,e)||(e=h.start),{currentDate:e,validRange:c,currentRange:d.range,currentRangeUnit:d.unit,isRangeAllDay:f,activeRange:p,renderRange:h,slotMinTime:i.slotMinTime,slotMaxTime:i.slotMaxTime,isValid:b,dateIncrement:this.buildDateIncrement(d.duration)}}buildValidRange(){let e=this.props.validRangeInput,n=typeof e=="function"?e.call(this.props.calendarApi,this.props.dateEnv.toDate(this.props.nowManager.getDateMarker())):e;return this.refineRange(n)||{start:null,end:null}}buildCurrentRangeInfo(e,n){let{props:r}=this,i=null,c=null,d=null,f;return r.duration?(i=r.duration,c=r.durationUnit,d=this.buildRangeFromDuration(e,n,i,c)):(f=this.props.dayCount)?(c="day",d=this.buildRangeFromDayCount(e,n,f)):(d=this.buildCustomVisibleRange(e))?c=r.dateEnv.greatestWholeUnit(d.start,d.end).unit:(i=this.getFallbackDuration(),c=ag(i).unit,d=this.buildRangeFromDuration(e,n,i,c)),{duration:i,unit:c,range:d}}getFallbackDuration(){return Ve({day:1})}adjustActiveRange(e){let{dateEnv:n,usesMinMaxTime:r,slotMinTime:i,slotMaxTime:c}=this.props,{start:d,end:f}=e;return r&&(Al(i)<0&&(d=ct(d),d=n.add(d,i)),Al(c)>1&&(f=ct(f),f=It(f,-1),f=n.add(f,c))),{start:d,end:f}}buildRangeFromDuration(e,n,r,i){let{dateEnv:c,dateAlignment:d}=this.props,f,h,p;if(!d){let{dateIncrement:y}=this.props;y&&na(y)!d[h.defId].recurringDef);for(let h in d){let p=d[h];if(p.recurringDef){let{duration:b}=p.recurringDef;b||(b=p.allDay?c.defaultAllDayEventDuration:c.defaultTimedEventDuration);let y=z4(p,b,e,r,i.recurringTypes);for(let x of y){let v=ym(h,{start:x,end:r.add(x,b)});f[v.instanceId]=v}}}return{defs:d,instances:f}}function z4(t,e,n,r,i){let d=i[t.recurringDef.typeId].expand(t.recurringDef.typeData,{start:r.subtract(n.start,e),end:n.end},r);return t.allDay&&(d=d.map(ct)),d}const Md={id:String,groupId:String,title:String,url:String,interactive:Boolean},Qj={start:Z,end:Z,date:Z,allDay:Boolean},P4=Object.assign(Object.assign(Object.assign({},Md),Qj),{extendedProps:Z});function Wj(t,e,n,r,i=vm(n),c,d){let{refined:f,extra:h}=Xj(t,n,i),p=B4(e,n),b=L4(f,p,n.dateEnv,n.pluginHooks.recurringTypes);if(b){let x=rg(f,h,e?e.sourceId:"",b.allDay,!!b.duration,n,c);return x.recurringDef={typeId:b.typeId,typeData:b.typeData,duration:b.duration},{def:x,instance:null}}let y=U4(f,p,n,r);if(y){let x=rg(f,h,e?e.sourceId:"",y.allDay,y.hasEnd,n,c),v=ym(x.defId,y.range,y.forcedStartTzo,y.forcedEndTzo);return d&&x.publicId&&d[x.publicId]&&(v.instanceId=d[x.publicId]),{def:x,instance:v}}return null}function Xj(t,e,n=vm(e)){return pm(t,n)}function vm(t){return Object.assign(Object.assign(Object.assign({},iu),P4),t.pluginHooks.eventRefiners)}function rg(t,e,n,r,i,c,d){let f={title:t.title||"",groupId:t.groupId||"",publicId:t.id||"",url:t.url||"",recurringDef:null,defId:(d&&t.id?d[t.id]:"")||_r(),sourceId:n,allDay:r,hasEnd:i,interactive:t.interactive,ui:ou(t,c),extendedProps:Object.assign(Object.assign({},t.extendedProps||{}),e)};for(let h of c.pluginHooks.eventDefMemberAdders)Object.assign(f,h(t));return Object.freeze(f.ui.classNames),Object.freeze(f.extendedProps),f}function U4(t,e,n,r){let{allDay:i}=t,c,d=null,f=!1,h,p=null,b=t.start!=null?t.start:t.date;if(c=n.dateEnv.createMarkerMeta(b),c)d=c.marker;else if(!r)return null;return t.end!=null&&(h=n.dateEnv.createMarkerMeta(t.end)),i==null&&(e!=null?i=e:i=(!c||c.isTimeUnspecified)&&(!h||h.isTimeUnspecified)),i&&d&&(d=ct(d)),h&&(p=h.marker,i&&(p=ct(p)),d&&p<=d&&(p=null)),p?f=!0:r||(f=n.options.forceEventDuration||!1,p=n.dateEnv.add(d,i?n.options.defaultAllDayEventDuration:n.options.defaultTimedEventDuration)),{allDay:i,hasEnd:f,range:{start:d,end:p},forcedStartTzo:c?c.forcedTzo:null,forcedEndTzo:h?h.forcedTzo:null}}function B4(t,e){let n=null;return t&&(n=t.defaultAllDay),n==null&&(n=e.options.defaultAllDay),n}function Ao(t,e,n,r,i,c){let d=Rn(),f=vm(n);for(let h of t){let p=Wj(h,e,n,r,f,i,c);p&&lg(p,d)}return d}function lg(t,e=Rn()){return e.defs[t.def.defId]=t.def,t.instance&&(e.instances[t.instance.instanceId]=t.instance),e}function Nm(t,e){let n=t.instances[e];if(n){let r=t.defs[n.defId],i=ku(t,c=>H4(r,c));return i.defs[r.defId]=r,i.instances[n.instanceId]=n,i}return Rn()}function H4(t,e){return!!(t.groupId&&t.groupId===e.groupId)}function Rn(){return{defs:{},instances:{}}}function Em(t,e){return{defs:Object.assign(Object.assign({},t.defs),e.defs),instances:Object.assign(Object.assign({},t.instances),e.instances)}}function ku(t,e){let n=Rr(t.defs,e),r=Rr(t.instances,i=>n[i.defId]);return{defs:n,instances:r}}function G4(t,e){let{defs:n,instances:r}=t,i={},c={};for(let d in n)e.defs[d]||(i[d]=n[d]);for(let d in r)!e.instances[d]&&i[r[d].defId]&&(c[d]=r[d]);return{defs:i,instances:c}}function F4(t,e){return Array.isArray(t)?Ao(t,null,e,!0):typeof t=="object"&&t?Ao([t],null,e,!0):t!=null?String(t):null}function _1(t){return Array.isArray(t)?t:typeof t=="string"?t.split(/\s+/):[]}const iu={display:String,editable:Boolean,startEditable:Boolean,durationEditable:Boolean,constraint:Z,overlap:Z,allow:Z,className:_1,classNames:_1,color:String,backgroundColor:String,borderColor:String,textColor:String},V4={display:null,startEditable:null,durationEditable:null,constraints:[],overlap:null,allows:[],backgroundColor:"",borderColor:"",textColor:"",classNames:[]};function ou(t,e){let n=F4(t.constraint,e);return{display:t.display||null,startEditable:t.startEditable!=null?t.startEditable:t.editable,durationEditable:t.durationEditable!=null?t.durationEditable:t.editable,constraints:n!=null?[n]:[],overlap:t.overlap!=null?t.overlap:null,allows:t.allow!=null?[t.allow]:[],backgroundColor:t.backgroundColor||t.color||"",borderColor:t.borderColor||t.color||"",textColor:t.textColor||"",classNames:(t.className||[]).concat(t.classNames||[])}}function Zj(t){return t.reduce(q4,V4)}function q4(t,e){return{display:e.display!=null?e.display:t.display,startEditable:e.startEditable!=null?e.startEditable:t.startEditable,durationEditable:e.durationEditable!=null?e.durationEditable:t.durationEditable,constraints:t.constraints.concat(e.constraints),overlap:typeof e.overlap=="boolean"?e.overlap:t.overlap,allows:t.allows.concat(e.allows),backgroundColor:e.backgroundColor||t.backgroundColor,borderColor:e.borderColor||t.borderColor,textColor:e.textColor||t.textColor,classNames:t.classNames.concat(e.classNames)}}const $4={id:String,defaultAllDay:Boolean,url:String,format:String,events:Z,eventDataTransform:Z,success:Z,failure:Z};function Kj(t,e,n=Jj(e)){let r;if(typeof t=="string"?r={url:t}:typeof t=="function"||Array.isArray(t)?r={events:t}:typeof t=="object"&&t&&(r=t),r){let{refined:i,extra:c}=pm(r,n),d=Y4(i,e);if(d)return{_raw:t,isFetching:!1,latestFetchId:"",fetchRange:null,defaultAllDay:i.defaultAllDay,eventDataTransform:i.eventDataTransform,success:i.success,failure:i.failure,publicId:i.id||"",sourceId:_r(),sourceDefId:d.sourceDefId,meta:d.meta,ui:ou(i,e),extendedProps:c}}return null}function Jj(t){return Object.assign(Object.assign(Object.assign({},iu),$4),t.pluginHooks.eventSourceRefiners)}function Y4(t,e){let n=e.pluginHooks.eventSourceDefs;for(let r=n.length-1;r>=0;r-=1){let c=n[r].parseMeta(t);if(c)return{sourceDefId:r,meta:c}}return null}function Q4(t,e,n,r,i){switch(e.type){case"RECEIVE_EVENTS":return W4(t,n[e.sourceId],e.fetchId,e.fetchRange,e.rawEvents,i);case"RESET_RAW_EVENTS":return X4(t,n[e.sourceId],e.rawEvents,r.activeRange,i);case"ADD_EVENTS":return Z4(t,e.eventStore,r?r.activeRange:null,i);case"RESET_EVENTS":return e.eventStore;case"MERGE_EVENTS":return Em(t,e.eventStore);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return r?kr(t,r.activeRange,i):t;case"REMOVE_EVENTS":return G4(t,e.eventStore);case"REMOVE_EVENT_SOURCE":return tS(t,e.sourceId);case"REMOVE_ALL_EVENT_SOURCES":return ku(t,c=>!c.sourceId);case"REMOVE_ALL_EVENTS":return Rn();default:return t}}function W4(t,e,n,r,i,c){if(e&&n===e.latestFetchId){let d=Ao(eS(i,e,c),e,c);return r&&(d=kr(d,r,c)),Em(tS(t,e.sourceId),d)}return t}function X4(t,e,n,r,i){const{defIdMap:c,instanceIdMap:d}=J4(t);let f=Ao(eS(n,e,i),e,i,!1,c,d);return kr(f,r,i)}function eS(t,e,n){let r=n.options.eventDataTransform,i=e?e.eventDataTransform:null;return i&&(t=M1(t,i)),r&&(t=M1(t,r)),t}function M1(t,e){let n;if(!e)n=t;else{n=[];for(let r of t){let i=e(r);i?n.push(i):i==null&&n.push(r)}}return n}function Z4(t,e,n,r){return n&&(e=kr(e,n,r)),Em(t,e)}function I1(t,e,n){let{defs:r}=t,i=Va(t.instances,c=>r[c.defId].allDay?c:Object.assign(Object.assign({},c),{range:{start:n.createMarker(e.toDate(c.range.start,c.forcedStartTzo)),end:n.createMarker(e.toDate(c.range.end,c.forcedEndTzo))},forcedStartTzo:n.canComputeOffset?null:c.forcedStartTzo,forcedEndTzo:n.canComputeOffset?null:c.forcedEndTzo}));return{defs:r,instances:i}}function tS(t,e){return ku(t,n=>n.sourceId!==e)}function K4(t,e){return{defs:t.defs,instances:Rr(t.instances,n=>!e[n.instanceId])}}function J4(t){const{defs:e,instances:n}=t,r={},i={};for(let c in e){const d=e[c],{publicId:f}=d;f&&(r[f]=c)}for(let c in n){const d=n[c],f=e[d.defId],{publicId:h}=f;h&&(i[h]=c)}return{defIdMap:r,instanceIdMap:i}}class _u{constructor(){this.handlers={},this.thisContext=null}setThisContext(e){this.thisContext=e}setOptions(e){this.options=e}on(e,n){e3(this.handlers,e,n)}off(e,n){t3(this.handlers,e,n)}trigger(e,...n){let r=this.handlers[e]||[],i=this.options&&this.options[e],c=[].concat(i||[],r);for(let d of c)d.apply(this.thisContext,n)}hasHandlers(e){return!!(this.handlers[e]&&this.handlers[e].length||this.options&&this.options[e])}}function e3(t,e,n){(t[e]||(t[e]=[])).push(n)}function t3(t,e,n){n?t[e]&&(t[e]=t[e].filter(r=>r!==n)):delete t[e]}const n3={startTime:"09:00",endTime:"17:00",daysOfWeek:[1,2,3,4,5],display:"inverse-background",classNames:"fc-non-business",groupId:"_businessHours"};function a3(t,e){return Ao(s3(t),null,e)}function s3(t){let e;return t===!0?e=[{}]:Array.isArray(t)?e=t.filter(n=>n.daysOfWeek):typeof t=="object"&&t?e=[t]:e=[],e=e.map(n=>Object.assign(Object.assign({},n3),n)),e}function nS(t,e,n){n.emitter.trigger("select",Object.assign(Object.assign({},jm(t,n)),{jsEvent:e?e.origEvent:null,view:n.viewApi||n.calendarApi.view}))}function r3(t,e){e.emitter.trigger("unselect",{jsEvent:t?t.origEvent:null,view:e.viewApi||e.calendarApi.view})}function jm(t,e){let n={};for(let r of e.pluginHooks.dateSpanTransforms)Object.assign(n,r(t,e));return Object.assign(n,y3(t,e.dateEnv)),n}function L1(t,e,n){let{dateEnv:r,options:i}=n,c=e;return t?(c=ct(c),c=r.add(c,i.defaultAllDayEventDuration)):c=r.add(c,i.defaultTimedEventDuration),c}function Sm(t,e,n,r){let i=cu(t.defs,e),c=Rn();for(let d in t.defs){let f=t.defs[d];c.defs[d]=l3(f,i[d],n,r)}for(let d in t.instances){let f=t.instances[d],h=c.defs[f.defId];c.instances[d]=i3(f,h,i[f.defId],n,r)}return c}function l3(t,e,n,r){let i=n.standardProps||{};i.hasEnd==null&&e.durationEditable&&(n.startDelta||n.endDelta)&&(i.hasEnd=!0);let c=Object.assign(Object.assign(Object.assign({},t),i),{ui:Object.assign(Object.assign({},t.ui),i.ui)});n.extendedProps&&(c.extendedProps=Object.assign(Object.assign({},c.extendedProps),n.extendedProps));for(let d of r.pluginHooks.eventDefMutationAppliers)d(c,n,r);return!c.hasEnd&&r.options.forceEventDuration&&(c.hasEnd=!0),c}function i3(t,e,n,r,i){let{dateEnv:c}=i,d=r.standardProps&&r.standardProps.allDay===!0,f=r.standardProps&&r.standardProps.hasEnd===!1,h=Object.assign({},t);return d&&(h.range=qj(h.range)),r.datesDelta&&n.startEditable&&(h.range={start:c.add(h.range.start,r.datesDelta),end:c.add(h.range.end,r.datesDelta)}),r.startDelta&&n.durationEditable&&(h.range={start:c.add(h.range.start,r.startDelta),end:h.range.end}),r.endDelta&&n.durationEditable&&(h.range={start:h.range.start,end:c.add(h.range.end,r.endDelta)}),f&&(h.range={start:h.range.start,end:L1(e.allDay,h.range.start,i)}),e.allDay&&(h.range={start:ct(h.range.start),end:ct(h.range.end)}),h.range.endsS(n,e))}function sS(t,e){let n=[];return e[""]&&n.push(e[""]),e[t.defId]&&n.push(e[t.defId]),n.push(t.ui),Zj(n)}function rS(t,e){let n=t.map(c3);return n.sort((r,i)=>AI(r,i,e)),n.map(r=>r._seg)}function c3(t){let{eventRange:e}=t,n=e.def,r=e.instance?e.instance.range:e.range,i=r.start?r.start.valueOf():0,c=r.end?r.end.valueOf():0;return Object.assign(Object.assign(Object.assign({},n.extendedProps),n),{id:n.publicId,start:i,end:c,duration:c-i,allDay:Number(n.allDay),_seg:t})}function d3(t,e){let{pluginHooks:n}=e,r=n.isDraggableTransformers,{def:i,ui:c}=t.eventRange,d=c.startEditable;for(let f of r)d=f(d,i,c,e);return d}function u3(t,e){return t.isStart&&t.eventRange.ui.durationEditable&&e.options.eventResizableFromStart}function f3(t,e){return t.isEnd&&t.eventRange.ui.durationEditable}function lS(t,e,n,r,i,c,d){let{dateEnv:f,options:h}=n,{displayEventTime:p,displayEventEnd:b}=h,y=t.eventRange.def,x=t.eventRange.instance;p==null&&(p=r!==!1),b==null&&(b=i!==!1);let v=x.range.start,N=x.range.end,j=t.start||t.eventRange.range.start,S=t.end||t.eventRange.range.end,R=ct(v).valueOf()===ct(j).valueOf(),w=ct(Gs(N,-1)).valueOf()===ct(Gs(S,-1)).valueOf();return p&&!y.allDay&&(R||w)?(j=R?v:j,S=w?N:S,b&&y.hasEnd?f.formatRange(j,S,e,{forcedStartTzo:x.forcedStartTzo,forcedEndTzo:x.forcedEndTzo}):f.format(j,e,{forcedTzo:x.forcedStartTzo})):""}function zs(t,e,n){let r=t.eventRange.range;return{isPast:r.end<=(n||e.start),isFuture:r.start>=(n||e.end),isToday:e&&Ha(e,r.start)}}function h3(t){let e=["fc-event"];return t.isMirror&&e.push("fc-event-mirror"),t.isDraggable&&e.push("fc-event-draggable"),(t.isStartResizable||t.isEndResizable)&&e.push("fc-event-resizable"),t.isDragging&&e.push("fc-event-dragging"),t.isResizing&&e.push("fc-event-resizing"),t.isSelected&&e.push("fc-event-selected"),t.isStart&&e.push("fc-event-start"),t.isEnd&&e.push("fc-event-end"),t.isPast&&e.push("fc-event-past"),t.isToday&&e.push("fc-event-today"),t.isFuture&&e.push("fc-event-future"),e}function iS(t){return t.instance?t.instance.instanceId:`${t.def.defId}:${t.range.start.toISOString()}`}function oS(t,e){let{def:n,instance:r}=t.eventRange,{url:i}=n;if(i)return{href:i};let{emitter:c,options:d}=e,{eventInteractive:f}=d;return f==null&&(f=n.interactive,f==null&&(f=!!c.hasHandlers("eventClick"))),f?Lj(h=>{c.trigger("eventClick",{el:h.target,event:new pt(e,n,r),jsEvent:h,view:e.viewApi})}):{}}const p3={start:Z,end:Z,allDay:Boolean};function g3(t,e,n){let r=m3(t,e),{range:i}=r;if(!i.start)return null;if(!i.end){if(n==null)return null;i.end=e.add(i.start,n)}return r}function m3(t,e){let{refined:n,extra:r}=pm(t,p3),i=n.start?e.createMarkerMeta(n.start):null,c=n.end?e.createMarkerMeta(n.end):null,{allDay:d}=n;return d==null&&(d=i&&i.isTimeUnspecified&&(!c||c.isTimeUnspecified)),Object.assign({range:{start:i?i.marker:null,end:c?c.marker:null},allDay:d},r)}function x3(t,e){return M4(t.range,e.range)&&t.allDay===e.allDay&&b3(t,e)}function b3(t,e){for(let n in e)if(n!=="range"&&n!=="allDay"&&t[n]!==e[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}function y3(t,e){return Object.assign(Object.assign({},dS(t.range,e,t.allDay)),{allDay:t.allDay})}function cS(t,e,n){return Object.assign(Object.assign({},dS(t,e,n)),{timeZone:e.timeZone})}function dS(t,e,n){return{start:e.toDate(t.start),end:e.toDate(t.end),startStr:e.formatIso(t.start,{omitTime:n}),endStr:e.formatIso(t.end,{omitTime:n})}}function v3(t,e,n){let r=Xj({editable:!1},n),i=rg(r.refined,r.extra,"",t.allDay,!0,n);return{def:i,ui:sS(i,e),instance:ym(i.defId,t.range),range:t.range,isStart:!0,isEnd:!0}}function N3(t,e,n){let r=!1,i=function(f){r||(r=!0,e(f))},c=function(f){r||(r=!0,n(f))},d=t(i,c);d&&typeof d.then=="function"&&d.then(i,c)}class U1 extends Error{constructor(e,n){super(e),this.response=n}}function E3(t,e,n){t=t.toUpperCase();const r={method:t};return t==="GET"?e+=(e.indexOf("?")===-1?"?":"&")+new URLSearchParams(n):(r.body=new URLSearchParams(n),r.headers={"Content-Type":"application/x-www-form-urlencoded"}),fetch(e,r).then(i=>{if(i.ok)return i.json().then(c=>[c,i],()=>{throw new U1("Failure parsing JSON",i)});throw new U1("Request failed",i)})}let kp;function uS(){return kp==null&&(kp=j3()),kp}function j3(){if(typeof document>"u")return!0;let t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.innerHTML="
",t.querySelector("table").style.height="100px",t.querySelector("div").style.height="100%",document.body.appendChild(t);let n=t.querySelector("div").offsetHeight>0;return document.body.removeChild(t),n}class S3 extends et{constructor(){super(...arguments),this.state={forPrint:!1},this.handleBeforePrint=()=>{ru(()=>{this.setState({forPrint:!0})})},this.handleAfterPrint=()=>{ru(()=>{this.setState({forPrint:!1})})}}render(){let{props:e}=this,{options:n}=e,{forPrint:r}=this.state,i=r||n.height==="auto"||n.contentHeight==="auto",c=!i&&n.height!=null?n.height:"",d=["fc",r?"fc-media-print":"fc-media-screen",`fc-direction-${n.direction}`,e.theme.getClass("root")];return uS()||d.push("fc-liquid-hack"),e.children(d,c,i,r)}componentDidMount(){let{emitter:e}=this.props;e.on("_beforeprint",this.handleBeforePrint),e.on("_afterprint",this.handleAfterPrint)}componentWillUnmount(){let{emitter:e}=this.props;e.off("_beforeprint",this.handleBeforePrint),e.off("_afterprint",this.handleAfterPrint)}}class ni{constructor(e){this.component=e.component,this.isHitComboAllowed=e.isHitComboAllowed||null}destroy(){}}function A3(t,e){return{component:t,el:e.el,useEventCenter:e.useEventCenter!=null?e.useEventCenter:!0,isHitComboAllowed:e.isHitComboAllowed||null}}function Am(t){return{[t.component.uid]:t}}const ig={};class ai extends On{constructor(e,n){super(e,n),this.handleRefresh=()=>{let r=this.computeTiming();r.state.nowDate.valueOf()!==this.state.nowDate.valueOf()&&this.setState(r.state),this.clearTimeout(),this.setTimeout(r.waitMs)},this.handleVisibilityChange=()=>{document.hidden||this.handleRefresh()},this.state=this.computeTiming().state}render(){let{props:e,state:n}=this;return e.children(n.nowDate,n.todayRange)}componentDidMount(){this.setTimeout(),this.context.nowManager.addResetListener(this.handleRefresh),document.addEventListener("visibilitychange",this.handleVisibilityChange)}componentDidUpdate(e){e.unit!==this.props.unit&&(this.clearTimeout(),this.setTimeout())}componentWillUnmount(){this.clearTimeout(),this.context.nowManager.removeResetListener(this.handleRefresh),document.removeEventListener("visibilitychange",this.handleVisibilityChange)}computeTiming(){let{props:e,context:n}=this,r=n.nowManager.getDateMarker(),{nowIndicatorSnap:i}=n.options;i==="auto"&&(i=/year|month|week|day/.test(e.unit)||(e.unitValue||1)===1);let c,d;return i?(c=n.dateEnv.startOf(r,e.unit),d=n.dateEnv.add(c,Ve(1,e.unit)).valueOf()-r.valueOf()):(c=r,d=1e3*60),d=Math.min(1e3*60*60*24,d),{state:{nowDate:c,todayRange:w3(c)},waitMs:d}}setTimeout(e=this.computeTiming().waitMs){this.timeoutId=setTimeout(()=>{const n=this.computeTiming();this.setState(n.state,()=>{this.setTimeout(n.waitMs)})},e)}clearTimeout(){this.timeoutId&&clearTimeout(this.timeoutId)}}ai.contextType=Qa;function w3(t){let e=ct(t),n=It(e,1);return{start:e,end:n}}class C3{getCurrentData(){return this.currentDataManager.getCurrentData()}dispatch(e){this.currentDataManager.dispatch(e)}get view(){return this.getCurrentData().viewApi}batchRendering(e){e()}updateSize(){this.trigger("_resize",!0)}setOption(e,n){this.dispatch({type:"SET_OPTION",optionName:e,rawOptionValue:n})}getOption(e){return this.currentDataManager.currentCalendarOptionsInput[e]}getAvailableLocaleCodes(){return Object.keys(this.getCurrentData().availableRawLocales)}on(e,n){let{currentDataManager:r}=this;r.currentCalendarOptionsRefiners[e]?r.emitter.on(e,n):console.warn(`Unknown listener name '${e}'`)}off(e,n){this.currentDataManager.emitter.off(e,n)}trigger(e,...n){this.currentDataManager.emitter.trigger(e,...n)}changeView(e,n){this.batchRendering(()=>{if(this.unselect(),n)if(n.start&&n.end)this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e}),this.dispatch({type:"SET_OPTION",optionName:"visibleRange",rawOptionValue:n});else{let{dateEnv:r}=this.getCurrentData();this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e,dateMarker:r.createMarker(n)})}else this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e})})}zoomTo(e,n){let r=this.getCurrentData(),i;n=n||"day",i=r.viewSpecs[n]||this.getUnitViewSpec(n),this.unselect(),i?this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:i.type,dateMarker:e}):this.dispatch({type:"CHANGE_DATE",dateMarker:e})}getUnitViewSpec(e){let{viewSpecs:n,toolbarConfig:r}=this.getCurrentData(),i=[].concat(r.header?r.header.viewsWithButtons:[],r.footer?r.footer.viewsWithButtons:[]),c,d;for(let f in n)i.push(f);for(c=0;c{this.dispatch({type:"REMOVE_EVENTS",eventStore:aS(e)})}})}getEventById(e){let n=this.getCurrentData(),{defs:r,instances:i}=n.eventStore;e=String(e);for(let c in r){let d=r[c];if(d.publicId===e){if(d.recurringDef)return new pt(n,d,null);for(let f in i){let h=i[f];if(h.defId===d.defId)return new pt(n,d,h)}}}return null}getEvents(){let e=this.getCurrentData();return wr(e.eventStore,e)}removeAllEvents(){this.dispatch({type:"REMOVE_ALL_EVENTS"})}getEventSources(){let e=this.getCurrentData(),n=e.eventSources,r=[];for(let i in n)r.push(new Nl(e,n[i]));return r}getEventSourceById(e){let n=this.getCurrentData(),r=n.eventSources;e=String(e);for(let i in r)if(r[i].publicId===e)return new Nl(n,r[i]);return null}addEventSource(e){let n=this.getCurrentData();if(e instanceof Nl)return n.eventSources[e.internalEventSource.sourceId]||this.dispatch({type:"ADD_EVENT_SOURCES",sources:[e.internalEventSource]}),e;let r=Kj(e,n);return r?(this.dispatch({type:"ADD_EVENT_SOURCES",sources:[r]}),new Nl(n,r)):null}removeAllEventSources(){this.dispatch({type:"REMOVE_ALL_EVENT_SOURCES"})}refetchEvents(){this.dispatch({type:"FETCH_EVENT_SOURCES",isRefetch:!0})}scrollToTime(e){let n=Ve(e);n&&this.trigger("_scrollRequest",{time:n})}}function D3(t,e){return t.left>=e.left&&t.left=e.top&&t.topthis.eventUiBuilders[y]||Oe(_3));for(let b in n){let y=n[b],x=d[b]||_p,v=this.eventUiBuilders[b];p[b]={businessHours:y.businessHours||e.businessHours,dateSelection:i[b]||null,eventStore:x,eventUiBases:v(e.eventUiBases[""],y.ui,c[b]),eventSelection:x.instances[e.eventSelection]?e.eventSelection:"",eventDrag:f[b]||null,eventResize:h[b]||null}}return p}_splitDateSpan(e){let n={};if(e){let r=this.getKeysForDateSpan(e);for(let i of r)n[i]=e}return n}_getKeysForEventDefs(e){return Va(e.defs,n=>this.getKeysForEventDef(n))}_splitEventStore(e,n){let{defs:r,instances:i}=e,c={};for(let d in r)for(let f of n[d])c[f]||(c[f]=Rn()),c[f].defs[d]=r[d];for(let d in i){let f=i[d];for(let h of n[f.defId])c[h]&&(c[h].instances[d]=f)}return c}_splitIndividualUi(e,n){let r={};for(let i in e)if(i)for(let c of n[i])r[c]||(r[c]={}),r[c][i]=e[i];return r}_splitInteraction(e){let n={};if(e){let r=this._splitEventStore(e.affectedEvents,this._getKeysForEventDefs(e.affectedEvents)),i=this._getKeysForEventDefs(e.mutatedEvents),c=this._splitEventStore(e.mutatedEvents,i),d=f=>{n[f]||(n[f]={affectedEvents:r[f]||_p,mutatedEvents:c[f]||_p,isEvent:e.isEvent})};for(let f in r)d(f);for(let f in c)d(f)}return n}}function _3(t,e,n){let r=[];t&&r.push(t),e&&r.push(e);let i={"":Zj(r)};return n&&Object.assign(i,n),i}function hS(t,e,n,r){return{dow:t.getUTCDay(),isDisabled:!!(r&&(!r.activeRange||!Ha(r.activeRange,t))),isOther:!!(r&&!Ha(r.currentRange,t)),isToday:!!(e&&Ha(e,t)),isPast:!!(e&&t=e.end)}}function wm(t,e){let n=["fc-day",`fc-day-${zI[t.dow]}`];return t.isDisabled?n.push("fc-day-disabled"):(t.isToday&&(n.push("fc-day-today"),n.push(e.getClass("today"))),t.isPast&&n.push("fc-day-past"),t.isFuture&&n.push("fc-day-future"),t.isOther&&n.push("fc-day-other")),n}const M3=mt({year:"numeric",month:"long",day:"numeric"}),I3=mt({week:"long"});function du(t,e,n="day",r=!0){const{dateEnv:i,options:c,calendarApi:d}=t;let f=i.format(e,n==="week"?I3:M3);if(c.navLinks){let h=i.toDate(e);const p=b=>{let y=n==="day"?c.navLinkDayClick:n==="week"?c.navLinkWeekClick:null;typeof y=="function"?y.call(d,i.toDate(e),b):(typeof y=="string"&&(n=y),d.zoomTo(e,n))};return Object.assign({title:ho(c.navLinkHint,[f,h],f),"data-navlink":""},r?Ij(p):{onClick:p})}return{"aria-label":f}}let Mp=null;function L3(){return Mp===null&&(Mp=z3()),Mp}function z3(){let t=document.createElement("div");fo(t,{position:"absolute",top:-1e3,left:0,border:0,padding:0,overflow:"scroll",direction:"rtl"}),t.innerHTML="
",document.body.appendChild(t);let n=t.firstChild.getBoundingClientRect().left>t.getBoundingClientRect().left;return om(t),n}let Ip;function P3(){return Ip||(Ip=U3()),Ip}function U3(){let t=document.createElement("div");t.style.overflow="scroll",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",document.body.appendChild(t);let e=pS(t);return document.body.removeChild(t),e}function pS(t){return{x:t.offsetHeight-t.clientHeight,y:t.offsetWidth-t.clientWidth}}function B3(t,e=!1){let n=window.getComputedStyle(t),r=parseInt(n.borderLeftWidth,10)||0,i=parseInt(n.borderRightWidth,10)||0,c=parseInt(n.borderTopWidth,10)||0,d=parseInt(n.borderBottomWidth,10)||0,f=pS(t),h=f.y-r-i,p=f.x-c-d,b={borderLeft:r,borderRight:i,borderTop:c,borderBottom:d,scrollbarBottom:p,scrollbarLeft:0,scrollbarRight:0};return L3()&&n.direction==="rtl"?b.scrollbarLeft=h:b.scrollbarRight=h,e&&(b.paddingLeft=parseInt(n.paddingLeft,10)||0,b.paddingRight=parseInt(n.paddingRight,10)||0,b.paddingTop=parseInt(n.paddingTop,10)||0,b.paddingBottom=parseInt(n.paddingBottom,10)||0),b}function H3(t,e=!1,n){let r=Cm(t),i=B3(t,e),c={left:r.left+i.borderLeft+i.scrollbarLeft,right:r.right-i.borderRight-i.scrollbarRight,top:r.top+i.borderTop,bottom:r.bottom-i.borderBottom-i.scrollbarBottom};return e&&(c.left+=i.paddingLeft,c.right-=i.paddingRight,c.top+=i.paddingTop,c.bottom-=i.paddingBottom),c}function Cm(t){let e=t.getBoundingClientRect();return{left:e.left+window.scrollX,top:e.top+window.scrollY,right:e.right+window.scrollX,bottom:e.bottom+window.scrollY}}function G3(t){let e=gS(t),n=t.getBoundingClientRect();for(let r of e){let i=fS(n,r.getBoundingClientRect());if(i)n=i;else return null}return n}function gS(t){let e=[];for(;t instanceof HTMLElement;){let n=window.getComputedStyle(t);if(n.position==="fixed")break;/(auto|scroll)/.test(n.overflow+n.overflowY+n.overflowX)&&e.push(t),t=t.parentNode}return e}class ql{constructor(e,n,r,i){this.els=n;let c=this.originClientRect=e.getBoundingClientRect();r&&this.buildElHorizontals(c.left),i&&this.buildElVerticals(c.top)}buildElHorizontals(e){let n=[],r=[];for(let i of this.els){let c=i.getBoundingClientRect();n.push(c.left-e),r.push(c.right-e)}this.lefts=n,this.rights=r}buildElVerticals(e){let n=[],r=[];for(let i of this.els){let c=i.getBoundingClientRect();n.push(c.top-e),r.push(c.bottom-e)}this.tops=n,this.bottoms=r}leftToIndex(e){let{lefts:n,rights:r}=this,i=n.length,c;for(c=0;c=n[c]&&e=n[c]&&e0}canScrollHorizontally(){return this.getMaxScrollLeft()>0}canScrollUp(){return this.getScrollTop()>0}canScrollDown(){return this.getScrollTop()0}canScrollRight(){return this.getScrollLeft()n.thickness||1){this.getEntryThickness=e,this.strictOrder=!1,this.allowReslicing=!1,this.maxCoord=-1,this.maxStackCnt=-1,this.levelCoords=[],this.entriesByLevel=[],this.stackCnts={}}addSegs(e){let n=[];for(let r of e)this.insertEntry(r,n);return n}insertEntry(e,n){let r=this.findInsertion(e);this.isInsertionValid(r,e)?this.insertEntryAt(e,r):this.handleInvalidInsertion(r,e,n)}isInsertionValid(e,n){return(this.maxCoord===-1||e.levelCoord+this.getEntryThickness(n)<=this.maxCoord)&&(this.maxStackCnt===-1||e.stackCntc.end&&this.insertEntry({index:e.index,thickness:e.thickness,span:{start:c.end,end:i.end}},r)}insertEntryAt(e,n){let{entriesByLevel:r,levelCoords:i}=this;n.lateral===-1?(Lp(i,n.level,n.levelCoord),Lp(r,n.level,[e])):Lp(r[n.level],n.lateral,e),this.stackCnts[Cr(e)]=n.stackCnt}findInsertion(e){let{levelCoords:n,entriesByLevel:r,strictOrder:i,stackCnts:c}=this,d=n.length,f=0,h=-1,p=-1,b=null,y=0;for(let N=0;N=f+this.getEntryThickness(e))break;let S=r[N],R,w=cg(S,e.span.start,og),D=w[0]+w[1];for(;(R=S[D])&&R.span.startf&&(f=C,b=R,h=N,p=D),C===f&&(y=Math.max(y,c[Cr(R)]+1)),D+=1}}let x=0;if(b)for(x=h+1;xn(t[i-1]))return[i,0];for(;rd)r=c+1;else return[c,1]}return[r,0]}class Y3{constructor(e,n){this.emitter=new _u}destroy(){}setMirrorIsVisible(e){}setMirrorNeedsRevert(e){}setAutoScrollEnabled(e){}}const Rm={};function Q3(t,e){return!t||e>10?mt({weekday:"short"}):e>1?mt({weekday:"short",month:"numeric",day:"numeric",omitCommas:!0}):mt({weekday:"long"})}const xS="fc-col-header-cell";function bS(t){return t.text}class W3 extends et{render(){let{dateEnv:e,options:n,theme:r,viewApi:i}=this.context,{props:c}=this,{date:d,dateProfile:f}=c,h=hS(d,c.todayRange,null,f),p=[xS].concat(wm(h,r)),b=e.format(d,c.dayHeaderFormat),y=!h.isDisabled&&c.colCnt>1?du(this.context,d):{},x=e.toDate(d);e.namedTimeZoneImpl&&(x=Gs(x,36e5));let v=Object.assign(Object.assign(Object.assign({date:x,view:i},c.extraRenderProps),{text:b}),h);return _(kn,{elTag:"th",elClasses:p,elAttrs:Object.assign({role:"columnheader",colSpan:c.colSpan,"data-date":h.isDisabled?void 0:fm(d)},c.extraDataAttrs),renderProps:v,generatorName:"dayHeaderContent",customGenerator:n.dayHeaderContent,defaultGenerator:bS,classNameGenerator:n.dayHeaderClassNames,didMount:n.dayHeaderDidMount,willUnmount:n.dayHeaderWillUnmount},N=>_("div",{className:"fc-scrollgrid-sync-inner"},!h.isDisabled&&_(N,{elTag:"a",elAttrs:y,elClasses:["fc-col-header-cell-cushion",c.isSticky&&"fc-sticky"]})))}}const X3=mt({weekday:"long"});class Z3 extends et{render(){let{props:e}=this,{dateEnv:n,theme:r,viewApi:i,options:c}=this.context,d=It(new Date(2592e5),e.dow),f={dow:e.dow,isDisabled:!1,isFuture:!1,isPast:!1,isToday:!1,isOther:!1},h=n.format(d,e.dayHeaderFormat),p=Object.assign(Object.assign(Object.assign(Object.assign({date:d},f),{view:i}),e.extraRenderProps),{text:h});return _(kn,{elTag:"th",elClasses:[xS,...wm(f,r),...e.extraClassNames||[]],elAttrs:Object.assign({role:"columnheader",colSpan:e.colSpan},e.extraDataAttrs),renderProps:p,generatorName:"dayHeaderContent",customGenerator:c.dayHeaderContent,defaultGenerator:bS,classNameGenerator:c.dayHeaderClassNames,didMount:c.dayHeaderDidMount,willUnmount:c.dayHeaderWillUnmount},b=>_("div",{className:"fc-scrollgrid-sync-inner"},_(b,{elTag:"a",elClasses:["fc-col-header-cell-cushion",e.isSticky&&"fc-sticky"],elAttrs:{"aria-label":n.format(d,X3)}})))}}class yS extends et{constructor(){super(...arguments),this.createDayHeaderFormatter=Oe(K3)}render(){let{context:e}=this,{dates:n,dateProfile:r,datesRepDistinctDays:i,renderIntro:c}=this.props,d=this.createDayHeaderFormatter(e.options.dayHeaderFormat,i,n.length);return _(ai,{unit:"day"},(f,h)=>_("tr",{role:"row"},c&&c("day"),n.map(p=>i?_(W3,{key:p.toISOString(),date:p,dateProfile:r,todayRange:h,colCnt:n.length,dayHeaderFormat:d}):_(Z3,{key:p.getUTCDay(),dow:p.getUTCDay(),dayHeaderFormat:d}))))}}function K3(t,e,n){return t||Q3(e,n)}class vS{constructor(e,n){let r=e.start,{end:i}=e,c=[],d=[],f=-1;for(;r=n.length?n[n.length-1]+1:n[r]}}class NS{constructor(e,n){let{dates:r}=e,i,c,d;if(n){for(c=r[0].getUTCDay(),i=1;ic.groupId===t)):typeof t=="object"&&t?zp(kr(t,e,i)):[]}function zp(t){let{instances:e}=t,n=[];for(let r in e)n.push(e[r].range);return n}function s6(t,e){for(let n of t)if(Tu(n,e))return!0;return!1}const jd=/^(visible|hidden)$/;class r6 extends et{constructor(){super(...arguments),this.handleEl=e=>{this.el=e,ga(this.props.elRef,e)}}render(){let{props:e}=this,{liquid:n,liquidIsAbsolute:r}=e,i=n&&r,c=["fc-scroller"];return n&&(r?c.push("fc-scroller-liquid-absolute"):c.push("fc-scroller-liquid")),_("div",{ref:this.handleEl,className:c.join(" "),style:{overflowX:e.overflowX,overflowY:e.overflowY,left:i&&-(e.overcomeLeft||0)||"",right:i&&-(e.overcomeRight||0)||"",bottom:i&&-(e.overcomeBottom||0)||"",marginLeft:!i&&-(e.overcomeLeft||0)||"",marginRight:!i&&-(e.overcomeRight||0)||"",marginBottom:!i&&-(e.overcomeBottom||0)||"",maxHeight:e.maxHeight||""}},e.children)}needsXScrolling(){if(jd.test(this.props.overflowX))return!1;let{el:e}=this,n=this.el.getBoundingClientRect().width-this.getYScrollbarWidth(),{children:r}=e;for(let i=0;in)return!0;return!1}needsYScrolling(){if(jd.test(this.props.overflowY))return!1;let{el:e}=this,n=this.el.getBoundingClientRect().height-this.getXScrollbarWidth(),{children:r}=e;for(let i=0;in)return!0;return!1}getXScrollbarWidth(){return jd.test(this.props.overflowX)?0:this.el.offsetHeight-this.el.clientHeight}getYScrollbarWidth(){return jd.test(this.props.overflowY)?0:this.el.offsetWidth-this.el.clientWidth}}class Ua{constructor(e){this.masterCallback=e,this.currentMap={},this.depths={},this.callbackMap={},this.handleValue=(n,r)=>{let{depths:i,currentMap:c}=this,d=!1,f=!1;n!==null?(d=r in c,c[r]=n,i[r]=(i[r]||0)+1,f=!0):(i[r]-=1,i[r]||(delete c[r],delete this.callbackMap[r],d=!0)),this.masterCallback&&(d&&this.masterCallback(null,String(r)),f&&this.masterCallback(n,String(r)))}}createRef(e){let n=this.callbackMap[e];return n||(n=this.callbackMap[e]=r=>{this.handleValue(r,String(e))}),n}collect(e,n,r){return x4(this.currentMap,e,n,r)}getAll(){return mm(this.currentMap)}}function l6(t){let e=gI(t,".fc-scrollgrid-shrink"),n=0;for(let r of e)n=Math.max(n,OI(r));return Math.ceil(n)}function wS(t,e){return t.liquid&&e.liquid}function i6(t,e){return e.maxHeight!=null||wS(t,e)}function o6(t,e,n,r){let{expandRows:i}=n;return typeof e.content=="function"?e.content(n):_("table",{role:"presentation",className:[e.tableClassName,t.syncRowHeights?"fc-scrollgrid-sync-table":""].join(" "),style:{minWidth:n.tableMinWidth,width:n.clientWidth,height:i?n.clientHeight:""}},n.tableColGroupNode,_(r?"thead":"tbody",{role:"presentation"},typeof e.rowContent=="function"?e.rowContent(n):e.rowContent))}function c6(t,e){return Hs(t,e,ra)}function d6(t,e){let n=[];for(let r of t){let i=r.span||1;for(let c=0;ce,c6),this.renderMicroColGroup=Oe(d6),this.scrollerRefs=new Ua,this.scrollerElRefs=new Ua(this._handleScrollerEl.bind(this)),this.state={shrinkWidth:null,forceYScrollbars:!1,scrollerClientWidths:{},scrollerClientHeights:{}},this.handleSizing=()=>{this.safeSetState(Object.assign({shrinkWidth:this.computeShrinkWidth()},this.computeScrollerDims()))}}render(){let{props:e,state:n,context:r}=this,i=e.sections||[],c=this.processCols(e.cols),d=this.renderMicroColGroup(c,n.shrinkWidth),f=h6(e.liquid,r);e.collapsibleWidth&&f.push("fc-scrollgrid-collapsible");let h=i.length,p=0,b,y=[],x=[],v=[];for(;p{}},i);return _(i?"th":"td",{ref:r.elRef,role:"presentation"},_("div",{className:`fc-scroller-harness${b?" fc-scroller-harness-liquid":""}`},_(r6,{ref:this.scrollerRefs.createRef(x),elRef:this.scrollerElRefs.createRef(x),overflowY:y,overflowX:c.liquid?"hidden":"visible",maxHeight:e.maxHeight,liquid:b,liquidIsAbsolute:!0},v)))}_handleScrollerEl(e,n){let r=g6(this.props.sections,n);r&&ga(r.chunk.scrollerElRef,e)}componentDidMount(){this.handleSizing(),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(){this.handleSizing()}componentWillUnmount(){this.context.removeResizeHandler(this.handleSizing)}computeShrinkWidth(){return f6(this.props.cols)?l6(this.scrollerElRefs.getAll()):0}computeScrollerDims(){let e=P3(),{scrollerRefs:n,scrollerElRefs:r}=this,i=!1,c={},d={};for(let f in n.currentMap){let h=n.currentMap[f];if(h&&h.needsYScrolling()){i=!0;break}}for(let f of this.props.sections){let h=f.key,p=r.currentMap[h];if(p){let b=p.parentNode;c[h]=Math.floor(b.getBoundingClientRect().width-(i?e.y:0)),d[h]=Math.floor(b.getBoundingClientRect().height)}}return{forceYScrollbars:i,scrollerClientWidths:c,scrollerClientHeights:d}}}Tm.addStateEquality({scrollerClientWidths:ra,scrollerClientHeights:ra});function g6(t,e){for(let n of t)if(n.key===e)return n;return null}class km extends et{constructor(){super(...arguments),this.buildPublicEvent=Oe((e,n,r)=>new pt(e,n,r)),this.handleEl=e=>{this.el=e,ga(this.props.elRef,e),e&&P1(e,this.props.seg)}}render(){const{props:e,context:n}=this,{options:r}=n,{seg:i}=e,{eventRange:c}=i,{ui:d}=c,f={event:this.buildPublicEvent(n,c.def,c.instance),view:n.viewApi,timeText:e.timeText,textColor:d.textColor,backgroundColor:d.backgroundColor,borderColor:d.borderColor,isDraggable:!e.disableDragging&&d3(i,n),isStartResizable:!e.disableResizing&&u3(i,n),isEndResizable:!e.disableResizing&&f3(i),isMirror:!!(e.isDragging||e.isResizing||e.isDateSelecting),isStart:!!i.isStart,isEnd:!!i.isEnd,isPast:!!e.isPast,isFuture:!!e.isFuture,isToday:!!e.isToday,isSelected:!!e.isSelected,isDragging:!!e.isDragging,isResizing:!!e.isResizing};return _(kn,{elRef:this.handleEl,elTag:e.elTag,elAttrs:e.elAttrs,elClasses:[...h3(f),...i.eventRange.ui.classNames,...e.elClasses||[]],elStyle:e.elStyle,renderProps:f,generatorName:"eventContent",customGenerator:r.eventContent,defaultGenerator:e.defaultGenerator,classNameGenerator:r.eventClassNames,didMount:r.eventDidMount,willUnmount:r.eventWillUnmount},e.children)}componentDidUpdate(e){this.el&&this.props.seg!==e.seg&&P1(this.el,this.props.seg)}}class _m extends et{render(){let{props:e,context:n}=this,{options:r}=n,{seg:i}=e,{ui:c}=i.eventRange,d=r.eventTimeFormat||e.defaultTimeFormat,f=lS(i,d,n,e.defaultDisplayEventTime,e.defaultDisplayEventEnd);return _(km,Object.assign({},e,{elTag:"a",elStyle:{borderColor:c.borderColor,backgroundColor:c.backgroundColor},elAttrs:oS(i,n),defaultGenerator:m6,timeText:f}),(h,p)=>_(ot,null,_(h,{elTag:"div",elClasses:["fc-event-main"],elStyle:{color:p.textColor}}),!!p.isStartResizable&&_("div",{className:"fc-event-resizer fc-event-resizer-start"}),!!p.isEndResizable&&_("div",{className:"fc-event-resizer fc-event-resizer-end"})))}}_m.addPropsEquality({seg:ra});function m6(t){return _("div",{className:"fc-event-main-frame"},t.timeText&&_("div",{className:"fc-event-time"},t.timeText),_("div",{className:"fc-event-title-container"},_("div",{className:"fc-event-title fc-sticky"},t.event.title||_(ot,null," "))))}const Mm=t=>_(Qa.Consumer,null,e=>{let{options:n}=e,r={isAxis:t.isAxis,date:e.dateEnv.toDate(t.date),view:e.viewApi};return _(kn,{elRef:t.elRef,elTag:t.elTag||"div",elAttrs:t.elAttrs,elClasses:t.elClasses,elStyle:t.elStyle,renderProps:r,generatorName:"nowIndicatorContent",customGenerator:n.nowIndicatorContent,classNameGenerator:n.nowIndicatorClassNames,didMount:n.nowIndicatorDidMount,willUnmount:n.nowIndicatorWillUnmount},t.children)}),x6=mt({day:"numeric"});class Im extends et{constructor(){super(...arguments),this.refineRenderProps=_d(b6)}render(){let{props:e,context:n}=this,{options:r}=n,i=this.refineRenderProps({date:e.date,dateProfile:e.dateProfile,todayRange:e.todayRange,isMonthStart:e.isMonthStart||!1,showDayNumber:e.showDayNumber,extraRenderProps:e.extraRenderProps,viewApi:n.viewApi,dateEnv:n.dateEnv,monthStartFormat:r.monthStartFormat});return _(kn,{elRef:e.elRef,elTag:e.elTag,elAttrs:Object.assign(Object.assign({},e.elAttrs),i.isDisabled?{}:{"data-date":fm(e.date)}),elClasses:[...wm(i,n.theme),...e.elClasses||[]],elStyle:e.elStyle,renderProps:i,generatorName:"dayCellContent",customGenerator:r.dayCellContent,defaultGenerator:e.defaultGenerator,classNameGenerator:i.isDisabled?void 0:r.dayCellClassNames,didMount:r.dayCellDidMount,willUnmount:r.dayCellWillUnmount},e.children)}}function Lm(t){return!!(t.dayCellContent||sg("dayCellContent",t))}function b6(t){let{date:e,dateEnv:n,dateProfile:r,isMonthStart:i}=t,c=hS(e,t.todayRange,null,r),d=t.showDayNumber?n.format(e,i?t.monthStartFormat:x6):"";return Object.assign(Object.assign(Object.assign({date:n.toDate(e),view:t.viewApi},c),{isMonthStart:i,dayNumberText:d}),t.extraRenderProps)}class DS extends et{render(){let{props:e}=this,{seg:n}=e;return _(km,{elTag:"div",elClasses:["fc-bg-event"],elStyle:{backgroundColor:n.eventRange.ui.backgroundColor},defaultGenerator:y6,seg:n,timeText:"",isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:!1,isPast:e.isPast,isFuture:e.isFuture,isToday:e.isToday,disableDragging:!0,disableResizing:!0})}}function y6(t){let{title:e}=t.event;return e&&_("div",{className:"fc-event-title"},t.event.title)}function OS(t){return _("div",{className:`fc-${t}`})}const RS=t=>_(Qa.Consumer,null,e=>{let{dateEnv:n,options:r}=e,{date:i}=t,c=r.weekNumberFormat||t.defaultFormat,d=n.computeWeekNumber(i),f=n.format(i,c),h={num:d,text:f,date:i};return _(kn,{elRef:t.elRef,elTag:t.elTag,elAttrs:t.elAttrs,elClasses:t.elClasses,elStyle:t.elStyle,renderProps:h,generatorName:"weekNumberContent",customGenerator:r.weekNumberContent,defaultGenerator:v6,classNameGenerator:r.weekNumberClassNames,didMount:r.weekNumberDidMount,willUnmount:r.weekNumberWillUnmount},t.children)});function v6(t){return t.text}const Pp=10;class N6 extends et{constructor(){super(...arguments),this.state={titleId:Ou()},this.handleRootEl=e=>{this.rootEl=e,this.props.elRef&&ga(this.props.elRef,e)},this.handleDocumentMouseDown=e=>{const n=_j(e);this.rootEl.contains(n)||this.handleCloseClick()},this.handleDocumentKeyDown=e=>{e.key==="Escape"&&this.handleCloseClick()},this.handleCloseClick=()=>{let{onClose:e}=this.props;e&&e()}}render(){let{theme:e,options:n}=this.context,{props:r,state:i}=this,c=["fc-popover",e.getClass("popover")].concat(r.extraClassNames||[]);return tI(_("div",Object.assign({},r.extraAttrs,{id:r.id,className:c.join(" "),"aria-labelledby":i.titleId,ref:this.handleRootEl}),_("div",{className:"fc-popover-header "+e.getClass("popoverHeader")},_("span",{className:"fc-popover-title",id:i.titleId},r.title),_("span",{className:"fc-popover-close "+e.getIconClass("close"),title:n.closeHint,onClick:this.handleCloseClick})),_("div",{className:"fc-popover-body "+e.getClass("popoverContent")},r.children)),r.parentEl)}componentDidMount(){document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleDocumentKeyDown),this.updateSize()}componentWillUnmount(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleDocumentKeyDown)}updateSize(){let{isRtl:e}=this.context,{alignmentEl:n,alignGridTop:r}=this.props,{rootEl:i}=this,c=G3(n);if(c){let d=i.getBoundingClientRect(),f=r?Yt(n,".fc-scrollgrid").getBoundingClientRect().top:c.top,h=e?c.right-d.width:c.left;f=Math.max(f,Pp),h=Math.min(h,document.documentElement.clientWidth-Pp-d.width),h=Math.max(h,Pp);let p=i.offsetParent.getBoundingClientRect();fo(i,{top:f-p.top,left:h-p.left})}}}class E6 extends ma{constructor(){super(...arguments),this.handleRootEl=e=>{this.rootEl=e,e?this.context.registerInteractiveComponent(this,{el:e,useEventCenter:!1}):this.context.unregisterInteractiveComponent(this)}}render(){let{options:e,dateEnv:n}=this.context,{props:r}=this,{startDate:i,todayRange:c,dateProfile:d}=r,f=n.format(i,e.dayPopoverFormat);return _(Im,{elRef:this.handleRootEl,date:i,dateProfile:d,todayRange:c},(h,p,b)=>_(N6,{elRef:b.ref,id:r.id,title:f,extraClassNames:["fc-more-popover"].concat(b.className||[]),extraAttrs:b,parentEl:r.parentEl,alignmentEl:r.alignmentEl,alignGridTop:r.alignGridTop,onClose:r.onClose},Lm(e)&&_(h,{elTag:"div",elClasses:["fc-more-popover-misc"]}),r.children))}queryHit(e,n,r,i){let{rootEl:c,props:d}=this;return e>=0&&e=0&&n{this.linkEl=e,this.props.elRef&&ga(this.props.elRef,e)},this.handleClick=e=>{let{props:n,context:r}=this,{moreLinkClick:i}=r.options,c=B1(n).start;function d(f){let{def:h,instance:p,range:b}=f.eventRange;return{event:new pt(r,h,p),start:r.dateEnv.toDate(b.start),end:r.dateEnv.toDate(b.end),isStart:f.isStart,isEnd:f.isEnd}}typeof i=="function"&&(i=i({date:c,allDay:!!n.allDayDate,allSegs:n.allSegs.map(d),hiddenSegs:n.hiddenSegs.map(d),jsEvent:e,view:r.viewApi})),!i||i==="popover"?this.setState({isPopoverOpen:!0}):typeof i=="string"&&r.calendarApi.zoomTo(c,i)},this.handlePopoverClose=()=>{this.setState({isPopoverOpen:!1})}}render(){let{props:e,state:n}=this;return _(Qa.Consumer,null,r=>{let{viewApi:i,options:c,calendarApi:d}=r,{moreLinkText:f}=c,{moreCnt:h}=e,p=B1(e),b=typeof f=="function"?f.call(d,h):`+${h} ${f}`,y=ho(c.moreLinkHint,[h],b),x={num:h,shortText:`+${h}`,text:b,view:i};return _(ot,null,!!e.moreCnt&&_(kn,{elTag:e.elTag||"a",elRef:this.handleLinkEl,elClasses:[...e.elClasses||[],"fc-more-link"],elStyle:e.elStyle,elAttrs:Object.assign(Object.assign(Object.assign({},e.elAttrs),Ij(this.handleClick)),{title:y,"aria-expanded":n.isPopoverOpen,"aria-controls":n.isPopoverOpen?n.popoverId:""}),renderProps:x,generatorName:"moreLinkContent",customGenerator:c.moreLinkContent,defaultGenerator:e.defaultGenerator||j6,classNameGenerator:c.moreLinkClassNames,didMount:c.moreLinkDidMount,willUnmount:c.moreLinkWillUnmount},e.children),n.isPopoverOpen&&_(E6,{id:n.popoverId,startDate:p.start,endDate:p.end,dateProfile:e.dateProfile,todayRange:e.todayRange,extraDateSpan:e.extraDateSpan,parentEl:this.parentEl,alignmentEl:e.alignmentElRef?e.alignmentElRef.current:this.linkEl,alignGridTop:e.alignGridTop,forceTimed:e.forceTimed,onClose:this.handlePopoverClose},e.popoverContent()))})}componentDidMount(){this.updateParentEl()}componentDidUpdate(){this.updateParentEl()}updateParentEl(){this.linkEl&&(this.parentEl=Yt(this.linkEl,".fc-view-harness"))}}function j6(t){return t.text}function B1(t){if(t.allDayDate)return{start:t.allDayDate,end:It(t.allDayDate,1)};let{hiddenSegs:e}=t;return{start:kS(e),end:A6(e)}}function kS(t){return t.reduce(S6).eventRange.range.start}function S6(t,e){return t.eventRange.range.starte.eventRange.range.end?t:e}class C6{constructor(){this.handlers=[]}set(e){this.currentValue=e;for(let n of this.handlers)n(e)}subscribe(e){this.handlers.push(e),this.currentValue!==void 0&&e(this.currentValue)}}class D6 extends C6{constructor(){super(...arguments),this.map=new Map}handle(e){const{map:n}=this;let r=!1;e.isActive?(n.set(e.id,e),r=!0):n.has(e.id)&&(n.delete(e.id),r=!0),r&&this.set(n)}}const O6=[],_S={code:"en",week:{dow:0,doy:4},direction:"ltr",buttonText:{prev:"prev",next:"next",prevYear:"prev year",nextYear:"next year",year:"year",today:"today",month:"month",week:"week",day:"day",list:"list"},weekText:"W",weekTextLong:"Week",closeHint:"Close",timeHint:"Time",eventHint:"Event",allDayText:"all-day",moreLinkText:"more",noEventsText:"No events to display"},MS=Object.assign(Object.assign({},_S),{buttonHints:{prev:"Previous $0",next:"Next $0",today(t,e){return e==="day"?"Today":`This ${t}`}},viewHint:"$0 view",navLinkHint:"Go to $0",moreLinkHint(t){return`Show ${t} more event${t===1?"":"s"}`}});function R6(t){let e=t.length>0?t[0].code:"en",n=O6.concat(t),r={en:MS};for(let i of n)r[i.code]=i;return{map:r,defaultCode:e}}function IS(t,e){return typeof t=="object"&&!Array.isArray(t)?LS(t.code,[t.code],t):T6(t,e)}function T6(t,e){let n=[].concat(t||[]),r=k6(n,e)||MS;return LS(t,n,r)}function k6(t,e){for(let n=0;n0;i-=1){let c=r.slice(0,i).join("-");if(e[c])return e[c]}}return null}function LS(t,e,n){let r=gm([_S,n],["buttonText"]);delete r.code;let{week:i}=r;return delete r.week,{codeArg:t,codes:e,week:i,simpleNumberFormat:new Intl.NumberFormat(t),options:r}}function Wa(t){return{id:_r(),name:t.name,premiumReleaseDate:t.premiumReleaseDate?new Date(t.premiumReleaseDate):void 0,deps:t.deps||[],reducers:t.reducers||[],isLoadingFuncs:t.isLoadingFuncs||[],contextInit:[].concat(t.contextInit||[]),eventRefiners:t.eventRefiners||{},eventDefMemberAdders:t.eventDefMemberAdders||[],eventSourceRefiners:t.eventSourceRefiners||{},isDraggableTransformers:t.isDraggableTransformers||[],eventDragMutationMassagers:t.eventDragMutationMassagers||[],eventDefMutationAppliers:t.eventDefMutationAppliers||[],dateSelectionTransformers:t.dateSelectionTransformers||[],datePointTransforms:t.datePointTransforms||[],dateSpanTransforms:t.dateSpanTransforms||[],views:t.views||{},viewPropsTransformers:t.viewPropsTransformers||[],isPropsValid:t.isPropsValid||null,externalDefTransforms:t.externalDefTransforms||[],viewContainerAppends:t.viewContainerAppends||[],eventDropTransformers:t.eventDropTransformers||[],componentInteractions:t.componentInteractions||[],calendarInteractions:t.calendarInteractions||[],themeClasses:t.themeClasses||{},eventSourceDefs:t.eventSourceDefs||[],cmdFormatter:t.cmdFormatter,recurringTypes:t.recurringTypes||[],namedTimeZonedImpl:t.namedTimeZonedImpl,initialView:t.initialView||"",elementDraggingImpl:t.elementDraggingImpl,optionChangeHandlers:t.optionChangeHandlers||{},scrollGridImpl:t.scrollGridImpl||null,listenerRefiners:t.listenerRefiners||{},optionRefiners:t.optionRefiners||{},propSetHandlers:t.propSetHandlers||{}}}function _6(t,e){let n={},r={premiumReleaseDate:void 0,reducers:[],isLoadingFuncs:[],contextInit:[],eventRefiners:{},eventDefMemberAdders:[],eventSourceRefiners:{},isDraggableTransformers:[],eventDragMutationMassagers:[],eventDefMutationAppliers:[],dateSelectionTransformers:[],datePointTransforms:[],dateSpanTransforms:[],views:{},viewPropsTransformers:[],isPropsValid:null,externalDefTransforms:[],viewContainerAppends:[],eventDropTransformers:[],componentInteractions:[],calendarInteractions:[],themeClasses:{},eventSourceDefs:[],cmdFormatter:null,recurringTypes:[],namedTimeZonedImpl:null,initialView:"",elementDraggingImpl:null,optionChangeHandlers:{},scrollGridImpl:null,listenerRefiners:{},optionRefiners:{},propSetHandlers:{}};function i(c){for(let d of c){const f=d.name,h=n[f];h===void 0?(n[f]=d.id,i(d.deps),r=I6(r,d)):h!==d.id&&console.warn(`Duplicate plugin '${f}'`)}}return t&&i(t),i(e),r}function M6(){let t=[],e=[],n;return(r,i)=>((!n||!Hs(r,t)||!Hs(i,e))&&(n=_6(r,i)),t=r,e=i,n)}function I6(t,e){return{premiumReleaseDate:L6(t.premiumReleaseDate,e.premiumReleaseDate),reducers:t.reducers.concat(e.reducers),isLoadingFuncs:t.isLoadingFuncs.concat(e.isLoadingFuncs),contextInit:t.contextInit.concat(e.contextInit),eventRefiners:Object.assign(Object.assign({},t.eventRefiners),e.eventRefiners),eventDefMemberAdders:t.eventDefMemberAdders.concat(e.eventDefMemberAdders),eventSourceRefiners:Object.assign(Object.assign({},t.eventSourceRefiners),e.eventSourceRefiners),isDraggableTransformers:t.isDraggableTransformers.concat(e.isDraggableTransformers),eventDragMutationMassagers:t.eventDragMutationMassagers.concat(e.eventDragMutationMassagers),eventDefMutationAppliers:t.eventDefMutationAppliers.concat(e.eventDefMutationAppliers),dateSelectionTransformers:t.dateSelectionTransformers.concat(e.dateSelectionTransformers),datePointTransforms:t.datePointTransforms.concat(e.datePointTransforms),dateSpanTransforms:t.dateSpanTransforms.concat(e.dateSpanTransforms),views:Object.assign(Object.assign({},t.views),e.views),viewPropsTransformers:t.viewPropsTransformers.concat(e.viewPropsTransformers),isPropsValid:e.isPropsValid||t.isPropsValid,externalDefTransforms:t.externalDefTransforms.concat(e.externalDefTransforms),viewContainerAppends:t.viewContainerAppends.concat(e.viewContainerAppends),eventDropTransformers:t.eventDropTransformers.concat(e.eventDropTransformers),calendarInteractions:t.calendarInteractions.concat(e.calendarInteractions),componentInteractions:t.componentInteractions.concat(e.componentInteractions),themeClasses:Object.assign(Object.assign({},t.themeClasses),e.themeClasses),eventSourceDefs:t.eventSourceDefs.concat(e.eventSourceDefs),cmdFormatter:e.cmdFormatter||t.cmdFormatter,recurringTypes:t.recurringTypes.concat(e.recurringTypes),namedTimeZonedImpl:e.namedTimeZonedImpl||t.namedTimeZonedImpl,initialView:t.initialView||e.initialView,elementDraggingImpl:t.elementDraggingImpl||e.elementDraggingImpl,optionChangeHandlers:Object.assign(Object.assign({},t.optionChangeHandlers),e.optionChangeHandlers),scrollGridImpl:e.scrollGridImpl||t.scrollGridImpl,listenerRefiners:Object.assign(Object.assign({},t.listenerRefiners),e.listenerRefiners),optionRefiners:Object.assign(Object.assign({},t.optionRefiners),e.optionRefiners),propSetHandlers:Object.assign(Object.assign({},t.propSetHandlers),e.propSetHandlers)}}function L6(t,e){return t===void 0?e:e===void 0?t:new Date(Math.max(t.valueOf(),e.valueOf()))}class Fs extends Fo{}Fs.prototype.classes={root:"fc-theme-standard",tableCellShaded:"fc-cell-shaded",buttonGroup:"fc-button-group",button:"fc-button fc-button-primary",buttonActive:"fc-button-active"};Fs.prototype.baseIconClass="fc-icon";Fs.prototype.iconClasses={close:"fc-icon-x",prev:"fc-icon-chevron-left",next:"fc-icon-chevron-right",prevYear:"fc-icon-chevrons-left",nextYear:"fc-icon-chevrons-right"};Fs.prototype.rtlIconClasses={prev:"fc-icon-chevron-right",next:"fc-icon-chevron-left",prevYear:"fc-icon-chevrons-right",nextYear:"fc-icon-chevrons-left"};Fs.prototype.iconOverrideOption="buttonIcons";Fs.prototype.iconOverrideCustomButtonOption="icon";Fs.prototype.iconOverridePrefix="fc-icon-";function z6(t,e){let n={},r;for(r in t)ug(r,n,t,e);for(r in e)ug(r,n,t,e);return n}function ug(t,e,n,r){if(e[t])return e[t];let i=P6(t,e,n,r);return i&&(e[t]=i),i}function P6(t,e,n,r){let i=n[t],c=r[t],d=b=>i&&i[b]!==null?i[b]:c&&c[b]!==null?c[b]:null,f=d("component"),h=d("superType"),p=null;if(h){if(h===t)throw new Error("Can't have a custom view type that references itself");p=ug(h,e,n,r)}return!f&&p&&(f=p.component),f?{type:t,component:f,defaults:Object.assign(Object.assign({},p?p.defaults:{}),i?i.rawOptions:{}),overrides:Object.assign(Object.assign({},p?p.overrides:{}),c?c.rawOptions:{})}:null}function H1(t){return Va(t,U6)}function U6(t){let e=typeof t=="function"?{component:t}:t,{component:n}=e;return e.content?n=G1(e):n&&!(n.prototype instanceof et)&&(n=G1(Object.assign(Object.assign({},e),{content:n}))),{superType:e.type,component:n,rawOptions:e}}function G1(t){return e=>_(Qa.Consumer,null,n=>_(kn,{elTag:"div",elClasses:Vj(n.viewSpec),renderProps:Object.assign(Object.assign({},e),{nextDayThreshold:n.options.nextDayThreshold}),generatorName:void 0,customGenerator:t.content,classNameGenerator:t.classNames,didMount:t.didMount,willUnmount:t.willUnmount}))}function B6(t,e,n,r){let i=H1(t),c=H1(e.views),d=z6(i,c);return Va(d,f=>H6(f,c,e,n,r))}function H6(t,e,n,r,i){let c=t.overrides.duration||t.defaults.duration||r.duration||n.duration,d=null,f="",h="",p={};if(c&&(d=G6(c),d)){let x=ag(d);f=x.unit,x.value===1&&(h=f,p=e[f]?e[f].rawOptions:{})}let b=x=>{let v=x.buttonText||{},N=t.defaults.buttonTextKey;return N!=null&&v[N]!=null?v[N]:v[t.type]!=null?v[t.type]:v[h]!=null?v[h]:null},y=x=>{let v=x.buttonHints||{},N=t.defaults.buttonTextKey;return N!=null&&v[N]!=null?v[N]:v[t.type]!=null?v[t.type]:v[h]!=null?v[h]:null};return{type:t.type,component:t.component,duration:d,durationUnit:f,singleUnit:h,optionDefaults:t.defaults,optionOverrides:Object.assign(Object.assign({},p),t.overrides),buttonTextOverride:b(r)||b(n)||t.overrides.buttonText,buttonTextDefault:b(i)||t.defaults.buttonText||b(po)||t.type,buttonTitleOverride:y(r)||y(n)||t.overrides.buttonHint,buttonTitleDefault:y(i)||t.defaults.buttonHint||y(po)}}let F1={};function G6(t){let e=JSON.stringify(t),n=F1[e];return n===void 0&&(n=Ve(t),F1[e]=n),n}function F6(t,e){switch(e.type){case"CHANGE_VIEW_TYPE":t=e.viewType}return t}function V6(t,e){switch(e.type){case"CHANGE_DATE":return e.dateMarker;default:return t}}function q6(t,e,n){let r=t.initialDate;return r!=null?e.createMarker(r):n.getDateMarker()}function $6(t,e){switch(e.type){case"SET_OPTION":return Object.assign(Object.assign({},t),{[e.optionName]:e.rawOptionValue});default:return t}}function Y6(t,e,n,r){let i;switch(e.type){case"CHANGE_VIEW_TYPE":return r.build(e.dateMarker||n);case"CHANGE_DATE":return r.build(e.dateMarker);case"PREV":if(i=r.buildPrev(t,n),i.isValid)return i;break;case"NEXT":if(i=r.buildNext(t,n),i.isValid)return i;break}return t}function Q6(t,e,n){let r=e?e.activeRange:null;return PS({},tL(t,n),r,n)}function W6(t,e,n,r){let i=n?n.activeRange:null;switch(e.type){case"ADD_EVENT_SOURCES":return PS(t,e.sources,i,r);case"REMOVE_EVENT_SOURCE":return Z6(t,e.sourceId);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return n?US(t,i,r):t;case"FETCH_EVENT_SOURCES":return zm(t,e.sourceIds?Uj(e.sourceIds):BS(t,r),i,e.isRefetch||!1,r);case"RECEIVE_EVENTS":case"RECEIVE_EVENT_ERROR":return eL(t,e.sourceId,e.fetchId,e.fetchRange);case"REMOVE_ALL_EVENT_SOURCES":return{};default:return t}}function X6(t,e,n){let r=e?e.activeRange:null;return zm(t,BS(t,n),r,!0,n)}function zS(t){for(let e in t)if(t[e].isFetching)return!0;return!1}function PS(t,e,n,r){let i={};for(let c of e)i[c.sourceId]=c;return n&&(i=US(i,n,r)),Object.assign(Object.assign({},t),i)}function Z6(t,e){return Rr(t,n=>n.sourceId!==e)}function US(t,e,n){return zm(t,Rr(t,r=>K6(r,e,n)),e,!1,n)}function K6(t,e,n){return HS(t,n)?!n.options.lazyFetching||!t.fetchRange||t.isFetching||e.startt.fetchRange.end:!t.latestFetchId}function zm(t,e,n,r,i){let c={};for(let d in t){let f=t[d];e[d]?c[d]=J6(f,n,r,i):c[d]=f}return c}function J6(t,e,n,r){let{options:i,calendarApi:c}=r,d=r.pluginHooks.eventSourceDefs[t.sourceDefId],f=_r();return d.fetch({eventSource:t,range:e,isRefetch:n,context:r},h=>{let{rawEvents:p}=h;i.eventSourceSuccess&&(p=i.eventSourceSuccess.call(c,p,h.response)||p),t.success&&(p=t.success.call(c,p,h.response)||p),r.dispatch({type:"RECEIVE_EVENTS",sourceId:t.sourceId,fetchId:f,fetchRange:e,rawEvents:p})},h=>{let p=!1;i.eventSourceFailure&&(i.eventSourceFailure.call(c,h),p=!0),t.failure&&(t.failure(h),p=!0),p||console.warn(h.message,h),r.dispatch({type:"RECEIVE_EVENT_ERROR",sourceId:t.sourceId,fetchId:f,fetchRange:e,error:h})}),Object.assign(Object.assign({},t),{isFetching:!0,latestFetchId:f})}function eL(t,e,n,r){let i=t[e];return i&&n===i.latestFetchId?Object.assign(Object.assign({},t),{[e]:Object.assign(Object.assign({},i),{isFetching:!1,fetchRange:r})}):t}function BS(t,e){return Rr(t,n=>HS(n,e))}function tL(t,e){let n=Jj(e),r=[].concat(t.eventSources||[]),i=[];t.initialEvents&&r.unshift(t.initialEvents),t.events&&r.unshift(t.events);for(let c of r){let d=Kj(c,e,n);d&&i.push(d)}return i}function HS(t,e){return!e.pluginHooks.eventSourceDefs[t.sourceDefId].ignoreRange}function nL(t,e){switch(e.type){case"UNSELECT_DATES":return null;case"SELECT_DATES":return e.selection;default:return t}}function aL(t,e){switch(e.type){case"UNSELECT_EVENT":return"";case"SELECT_EVENT":return e.eventInstanceId;default:return t}}function sL(t,e){let n;switch(e.type){case"UNSET_EVENT_DRAG":return null;case"SET_EVENT_DRAG":return n=e.state,{affectedEvents:n.affectedEvents,mutatedEvents:n.mutatedEvents,isEvent:n.isEvent};default:return t}}function rL(t,e){let n;switch(e.type){case"UNSET_EVENT_RESIZE":return null;case"SET_EVENT_RESIZE":return n=e.state,{affectedEvents:n.affectedEvents,mutatedEvents:n.mutatedEvents,isEvent:n.isEvent};default:return t}}function lL(t,e,n,r,i){let c=t.headerToolbar?V1(t.headerToolbar,t,e,n,r,i):null,d=t.footerToolbar?V1(t.footerToolbar,t,e,n,r,i):null;return{header:c,footer:d}}function V1(t,e,n,r,i,c){let d={},f=[],h=!1;for(let p in t){let b=t[p],y=iL(b,e,n,r,i,c);d[p]=y.widgets,f.push(...y.viewsWithButtons),h=h||y.hasTitle}return{sectionWidgets:d,viewsWithButtons:f,hasTitle:h}}function iL(t,e,n,r,i,c){let d=e.direction==="rtl",f=e.customButtons||{},h=n.buttonText||{},p=e.buttonText||{},b=n.buttonHints||{},y=e.buttonHints||{},x=t?t.split(" "):[],v=[],N=!1;return{widgets:x.map(S=>S.split(",").map(R=>{if(R==="title")return N=!0,{buttonName:R};let w,D,C,I,L,F;if(w=f[R])C=Y=>{w.click&&w.click.call(Y.target,Y,Y.target)},(I=r.getCustomButtonIconClass(w))||(I=r.getIconClass(R,d))||(L=w.text),F=w.hint||w.text;else if(D=i[R]){v.push(R),C=()=>{c.changeView(R)},(L=D.buttonTextOverride)||(I=r.getIconClass(R,d))||(L=D.buttonTextDefault);let Y=D.buttonTextOverride||D.buttonTextDefault;F=ho(D.buttonTitleOverride||D.buttonTitleDefault||e.viewHint,[Y,R],Y)}else if(c[R])if(C=()=>{c[R]()},(L=h[R])||(I=r.getIconClass(R,d))||(L=p[R]),R==="prevYear"||R==="nextYear"){let Y=R==="prevYear"?"prev":"next";F=ho(b[Y]||y[Y],[p.year||"year","year"],p[R])}else F=Y=>ho(b[R]||y[R],[p[Y]||Y,Y],p[R]);return{buttonName:R,buttonClick:C,buttonIcon:I,buttonText:L,buttonHint:F}})),viewsWithButtons:v,hasTitle:N}}class oL{constructor(e,n,r){this.type=e,this.getCurrentData=n,this.dateEnv=r}get calendar(){return this.getCurrentData().calendarApi}get title(){return this.getCurrentData().viewTitle}get activeStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.start)}get activeEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.end)}get currentStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.start)}get currentEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.end)}getOption(e){return this.getCurrentData().options[e]}}let cL={ignoreRange:!0,parseMeta(t){return Array.isArray(t.events)?t.events:null},fetch(t,e){e({rawEvents:t.eventSource.meta})}};const dL=Wa({name:"array-event-source",eventSourceDefs:[cL]});let uL={parseMeta(t){return typeof t.events=="function"?t.events:null},fetch(t,e,n){const{dateEnv:r}=t.context,i=t.eventSource.meta;N3(i.bind(null,cS(t.range,r)),c=>e({rawEvents:c}),n)}};const fL=Wa({name:"func-event-source",eventSourceDefs:[uL]}),hL={method:String,extraParams:Z,startParam:String,endParam:String,timeZoneParam:String};let pL={parseMeta(t){return t.url&&(t.format==="json"||!t.format)?{url:t.url,format:"json",method:(t.method||"GET").toUpperCase(),extraParams:t.extraParams,startParam:t.startParam,endParam:t.endParam,timeZoneParam:t.timeZoneParam}:null},fetch(t,e,n){const{meta:r}=t.eventSource,i=mL(r,t.range,t.context);E3(r.method,r.url,i).then(([c,d])=>{e({rawEvents:c,response:d})},n)}};const gL=Wa({name:"json-event-source",eventSourceRefiners:hL,eventSourceDefs:[pL]});function mL(t,e,n){let{dateEnv:r,options:i}=n,c,d,f,h,p={};return c=t.startParam,c==null&&(c=i.startParam),d=t.endParam,d==null&&(d=i.endParam),f=t.timeZoneParam,f==null&&(f=i.timeZoneParam),typeof t.extraParams=="function"?h=t.extraParams():h=t.extraParams||{},Object.assign(p,h),p[c]=r.formatIso(e.start),p[d]=r.formatIso(e.end),r.timeZone!=="local"&&(p[f]=r.timeZone),p}const xL={daysOfWeek:Z,startTime:Ve,endTime:Ve,duration:Ve,startRecur:Z,endRecur:Z};let bL={parse(t,e){if(t.daysOfWeek||t.startTime||t.endTime||t.startRecur||t.endRecur){let n={daysOfWeek:t.daysOfWeek||null,startTime:t.startTime||null,endTime:t.endTime||null,startRecur:t.startRecur?e.createMarker(t.startRecur):null,endRecur:t.endRecur?e.createMarker(t.endRecur):null,dateEnv:e},r;return t.duration&&(r=t.duration),!r&&t.startTime&&t.endTime&&(r=_I(t.endTime,t.startTime)),{allDayGuess:!t.startTime&&!t.endTime,duration:r,typeData:n}}return null},expand(t,e,n){let r=Tr(e,{start:t.startRecur,end:t.endRecur});return r?vL(t.daysOfWeek,t.startTime,t.dateEnv,n,r):[]}};const yL=Wa({name:"simple-recurring-event",recurringTypes:[bL],eventRefiners:xL});function vL(t,e,n,r,i){let c=t?Uj(t):null,d=ct(i.start),f=i.end,h=[];for(e&&(e.milliseconds<0?f=It(f,1):e.milliseconds>=1e3*60*60*24&&(d=It(d,-1)));dzS(t.eventSources)],propSetHandlers:{dateProfile:EL,eventStore:jL}})];class AL{constructor(e,n){this.runTaskOption=e,this.drainedOption=n,this.queue=[],this.delayedRunner=new im(this.drain.bind(this))}request(e,n){this.queue.push(e),this.delayedRunner.request(n)}pause(e){this.delayedRunner.pause(e)}resume(e,n){this.delayedRunner.resume(e,n)}drain(){let{queue:e}=this;for(;e.length;){let n=[],r;for(;r=e.shift();)this.runTask(r),n.push(r);this.drained(n)}}runTask(e){this.runTaskOption&&this.runTaskOption(e)}drained(e){this.drainedOption&&this.drainedOption(e)}}function wL(t,e,n){let r;return/^(year|month)$/.test(t.currentRangeUnit)?r=t.currentRange:r=t.activeRange,n.formatRange(r.start,r.end,mt(e.titleFormat||CL(t)),{isEndExclusive:t.isRangeAllDay,defaultSeparator:e.titleRangeSeparator})}function CL(t){let{currentRangeUnit:e}=t;if(e==="year")return{year:"numeric"};if(e==="month")return{year:"numeric",month:"long"};let n=tu(t.currentRange.start,t.currentRange.end);return n!==null&&n>1?{year:"numeric",month:"short",day:"numeric"}:{year:"numeric",month:"long",day:"numeric"}}class $1{constructor(){this.resetListeners=new Set}handleInput(e,n){const r=this.dateEnv;if(e!==r&&(typeof n=="function"?this.nowFn=n:r||(this.nowAnchorDate=e.toDate(n?e.createMarker(n):e.createNowMarker()),this.nowAnchorQueried=Date.now()),this.dateEnv=e,r))for(const i of this.resetListeners.values())i()}getDateMarker(){return this.nowAnchorDate?this.dateEnv.timestampToMarker(this.nowAnchorDate.valueOf()+(Date.now()-this.nowAnchorQueried)):this.dateEnv.createMarker(this.nowFn())}addResetListener(e){this.resetListeners.add(e)}removeResetListener(e){this.resetListeners.delete(e)}}class DL{constructor(e){this.computeCurrentViewData=Oe(this._computeCurrentViewData),this.organizeRawLocales=Oe(R6),this.buildLocale=Oe(IS),this.buildPluginHooks=M6(),this.buildDateEnv=Oe(OL),this.buildTheme=Oe(RL),this.parseToolbars=Oe(lL),this.buildViewSpecs=Oe(B6),this.buildDateProfileGenerator=_d(TL),this.buildViewApi=Oe(kL),this.buildViewUiProps=_d(IL),this.buildEventUiBySource=Oe(_L,ra),this.buildEventUiBases=Oe(ML),this.parseContextBusinessHours=_d(LL),this.buildTitle=Oe(wL),this.nowManager=new $1,this.emitter=new _u,this.actionRunner=new AL(this._handleAction.bind(this),this.updateData.bind(this)),this.currentCalendarOptionsInput={},this.currentCalendarOptionsRefined={},this.currentViewOptionsInput={},this.currentViewOptionsRefined={},this.currentCalendarOptionsRefiners={},this.optionsForRefining=[],this.optionsForHandling=[],this.getCurrentData=()=>this.data,this.dispatch=x=>{this.actionRunner.request(x)},this.props=e,this.actionRunner.pause(),this.nowManager=new $1;let n={},r=this.computeOptionsData(e.optionOverrides,n,e.calendarApi),i=r.calendarOptions.initialView||r.pluginHooks.initialView,c=this.computeCurrentViewData(i,r,e.optionOverrides,n);e.calendarApi.currentDataManager=this,this.emitter.setThisContext(e.calendarApi),this.emitter.setOptions(c.options);let d={nowManager:this.nowManager,dateEnv:r.dateEnv,options:r.calendarOptions,pluginHooks:r.pluginHooks,calendarApi:e.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData},f=q6(r.calendarOptions,r.dateEnv,this.nowManager),h=c.dateProfileGenerator.build(f);Ha(h.activeRange,f)||(f=h.currentRange.start);for(let x of r.pluginHooks.contextInit)x(d);let p=Q6(r.calendarOptions,h,d),b={dynamicOptionOverrides:n,currentViewType:i,currentDate:f,dateProfile:h,businessHours:this.parseContextBusinessHours(d),eventSources:p,eventUiBases:{},eventStore:Rn(),renderableEventStore:Rn(),dateSelection:null,eventSelection:"",eventDrag:null,eventResize:null,selectionConfig:this.buildViewUiProps(d).selectionConfig},y=Object.assign(Object.assign({},d),b);for(let x of r.pluginHooks.reducers)Object.assign(b,x(null,null,y));Up(b,d)&&this.emitter.trigger("loading",!0),this.state=b,this.updateData(),this.actionRunner.resume()}resetOptions(e,n){let{props:r}=this;n===void 0?r.optionOverrides=e:(r.optionOverrides=Object.assign(Object.assign({},r.optionOverrides||{}),e),this.optionsForRefining.push(...n)),(n===void 0||n.length)&&this.actionRunner.request({type:"NOTHING"})}_handleAction(e){let{props:n,state:r,emitter:i}=this,c=$6(r.dynamicOptionOverrides,e),d=this.computeOptionsData(n.optionOverrides,c,n.calendarApi),f=F6(r.currentViewType,e),h=this.computeCurrentViewData(f,d,n.optionOverrides,c);n.calendarApi.currentDataManager=this,i.setThisContext(n.calendarApi),i.setOptions(h.options);let p={nowManager:this.nowManager,dateEnv:d.dateEnv,options:d.calendarOptions,pluginHooks:d.pluginHooks,calendarApi:n.calendarApi,dispatch:this.dispatch,emitter:i,getCurrentData:this.getCurrentData},{currentDate:b,dateProfile:y}=r;this.data&&this.data.dateProfileGenerator!==h.dateProfileGenerator&&(y=h.dateProfileGenerator.build(b)),b=V6(b,e),y=Y6(y,e,b,h.dateProfileGenerator),(e.type==="PREV"||e.type==="NEXT"||!Ha(y.currentRange,b))&&(b=y.currentRange.start);let x=W6(r.eventSources,e,y,p),v=Q4(r.eventStore,e,x,y,p),j=zS(x)&&!h.options.progressiveEventRendering&&r.renderableEventStore||v,{eventUiSingleBase:S,selectionConfig:R}=this.buildViewUiProps(p),w=this.buildEventUiBySource(x),D=this.buildEventUiBases(j.defs,S,w),C={dynamicOptionOverrides:c,currentViewType:f,currentDate:b,dateProfile:y,eventSources:x,eventStore:v,renderableEventStore:j,selectionConfig:R,eventUiBases:D,businessHours:this.parseContextBusinessHours(p),dateSelection:nL(r.dateSelection,e),eventSelection:aL(r.eventSelection,e),eventDrag:sL(r.eventDrag,e),eventResize:rL(r.eventResize,e)},I=Object.assign(Object.assign({},p),C);for(let Y of d.pluginHooks.reducers)Object.assign(C,Y(r,e,I));let L=Up(r,p),F=Up(C,p);!L&&F?i.trigger("loading",!0):L&&!F&&i.trigger("loading",!1),this.state=C,n.onAction&&n.onAction(e)}updateData(){let{props:e,state:n}=this,r=this.data,i=this.computeOptionsData(e.optionOverrides,n.dynamicOptionOverrides,e.calendarApi),c=this.computeCurrentViewData(n.currentViewType,i,e.optionOverrides,n.dynamicOptionOverrides),d=this.data=Object.assign(Object.assign(Object.assign({nowManager:this.nowManager,viewTitle:this.buildTitle(n.dateProfile,c.options,i.dateEnv),calendarApi:e.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData},i),c),n),f=i.pluginHooks.optionChangeHandlers,h=r&&r.calendarOptions,p=i.calendarOptions;if(h&&h!==p){h.timeZone!==p.timeZone&&(n.eventSources=d.eventSources=X6(d.eventSources,n.dateProfile,d),n.eventStore=d.eventStore=I1(d.eventStore,r.dateEnv,d.dateEnv),n.renderableEventStore=d.renderableEventStore=I1(d.renderableEventStore,r.dateEnv,d.dateEnv));for(let b in f)(this.optionsForHandling.indexOf(b)!==-1||h[b]!==p[b])&&f[b](p[b],d)}this.optionsForHandling=[],e.onData&&e.onData(d)}computeOptionsData(e,n,r){if(!this.optionsForRefining.length&&e===this.stableOptionOverrides&&n===this.stableDynamicOptionOverrides)return this.stableCalendarOptionsData;let{refinedOptions:i,pluginHooks:c,localeDefaults:d,availableLocaleData:f,extra:h}=this.processRawCalendarOptions(e,n);Y1(h);let p=this.buildDateEnv(i.timeZone,i.locale,i.weekNumberCalculation,i.firstDay,i.weekText,c,f,i.defaultRangeSeparator),b=this.buildViewSpecs(c.views,this.stableOptionOverrides,this.stableDynamicOptionOverrides,d),y=this.buildTheme(i,c),x=this.parseToolbars(i,this.stableOptionOverrides,y,b,r);return this.stableCalendarOptionsData={calendarOptions:i,pluginHooks:c,dateEnv:p,viewSpecs:b,theme:y,toolbarConfig:x,localeDefaults:d,availableRawLocales:f.map}}processRawCalendarOptions(e,n){let{locales:r,locale:i}=Rp([po,e,n]),c=this.organizeRawLocales(r),d=c.map,f=this.buildLocale(i||c.defaultCode,d).options,h=this.buildPluginHooks(e.plugins||[],SL),p=this.currentCalendarOptionsRefiners=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},O1),R1),T1),h.listenerRefiners),h.optionRefiners),b={},y=Rp([po,f,e,n]),x={},v=this.currentCalendarOptionsInput,N=this.currentCalendarOptionsRefined,j=!1;for(let S in y)this.optionsForRefining.indexOf(S)===-1&&(y[S]===v[S]||dr[S]&&S in v&&dr[S](v[S],y[S]))?x[S]=N[S]:p[S]?(x[S]=p[S](y[S]),j=!0):b[S]=v[S];return j&&(this.currentCalendarOptionsInput=y,this.currentCalendarOptionsRefined=x,this.stableOptionOverrides=e,this.stableDynamicOptionOverrides=n),this.optionsForHandling.push(...this.optionsForRefining),this.optionsForRefining=[],{rawOptions:this.currentCalendarOptionsInput,refinedOptions:this.currentCalendarOptionsRefined,pluginHooks:h,availableLocaleData:c,localeDefaults:f,extra:b}}_computeCurrentViewData(e,n,r,i){let c=n.viewSpecs[e];if(!c)throw new Error(`viewType "${e}" is not available. Please make sure you've loaded all neccessary plugins`);let{refinedOptions:d,extra:f}=this.processRawViewOptions(c,n.pluginHooks,n.localeDefaults,r,i);Y1(f),this.nowManager.handleInput(n.dateEnv,d.now);let h=this.buildDateProfileGenerator({dateProfileGeneratorClass:c.optionDefaults.dateProfileGeneratorClass,nowManager:this.nowManager,duration:c.duration,durationUnit:c.durationUnit,usesMinMaxTime:c.optionDefaults.usesMinMaxTime,dateEnv:n.dateEnv,calendarApi:this.props.calendarApi,slotMinTime:d.slotMinTime,slotMaxTime:d.slotMaxTime,showNonCurrentDates:d.showNonCurrentDates,dayCount:d.dayCount,dateAlignment:d.dateAlignment,dateIncrement:d.dateIncrement,hiddenDays:d.hiddenDays,weekends:d.weekends,validRangeInput:d.validRange,visibleRangeInput:d.visibleRange,fixedWeekCount:d.fixedWeekCount}),p=this.buildViewApi(e,this.getCurrentData,n.dateEnv);return{viewSpec:c,options:d,dateProfileGenerator:h,viewApi:p}}processRawViewOptions(e,n,r,i,c){let d=Rp([po,e.optionDefaults,r,i,e.optionOverrides,c]),f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},O1),R1),T1),f4),n.listenerRefiners),n.optionRefiners),h={},p=this.currentViewOptionsInput,b=this.currentViewOptionsRefined,y=!1,x={};for(let v in d)d[v]===p[v]||dr[v]&&dr[v](d[v],p[v])?h[v]=b[v]:(d[v]===this.currentCalendarOptionsInput[v]||dr[v]&&dr[v](d[v],this.currentCalendarOptionsInput[v])?v in this.currentCalendarOptionsRefined&&(h[v]=this.currentCalendarOptionsRefined[v]):f[v]?h[v]=f[v](d[v]):x[v]=d[v],y=!0);return y&&(this.currentViewOptionsInput=d,this.currentViewOptionsRefined=h),{rawOptions:this.currentViewOptionsInput,refinedOptions:this.currentViewOptionsRefined,extra:x}}}function OL(t,e,n,r,i,c,d,f){let h=IS(e||d.defaultCode,d.map);return new j4({calendarSystem:"gregory",timeZone:t,namedTimeZoneImpl:c.namedTimeZonedImpl,locale:h,weekNumberCalculation:n,firstDay:r,weekText:i,cmdFormatter:c.cmdFormatter,defaultSeparator:f})}function RL(t,e){let n=e.themeClasses[t.themeSystem]||Fs;return new n(t)}function TL(t){let e=t.dateProfileGeneratorClass||Yj;return new e(t)}function kL(t,e,n){return new oL(t,e,n)}function _L(t){return Va(t,e=>e.ui)}function ML(t,e,n){let r={"":e};for(let i in t){let c=t[i];c.sourceId&&n[c.sourceId]&&(r[i]=n[c.sourceId])}return r}function IL(t){let{options:e}=t;return{eventUiSingleBase:ou({display:e.eventDisplay,editable:e.editable,startEditable:e.eventStartEditable,durationEditable:e.eventDurationEditable,constraint:e.eventConstraint,overlap:typeof e.eventOverlap=="boolean"?e.eventOverlap:void 0,allow:e.eventAllow,backgroundColor:e.eventBackgroundColor,borderColor:e.eventBorderColor,textColor:e.eventTextColor,color:e.eventColor},t),selectionConfig:ou({constraint:e.selectConstraint,overlap:typeof e.selectOverlap=="boolean"?e.selectOverlap:void 0,allow:e.selectAllow},t)}}function Up(t,e){for(let n of e.pluginHooks.isLoadingFuncs)if(n(t))return!0;return!1}function LL(t){return a3(t.options.businessHours,t)}function Y1(t,e){for(let n in t)console.warn(`Unknown option '${n}'`)}class zL extends et{render(){let e=this.props.widgetGroups.map(n=>this.renderWidgetGroup(n));return _("div",{className:"fc-toolbar-chunk"},...e)}renderWidgetGroup(e){let{props:n}=this,{theme:r}=this.context,i=[],c=!0;for(let d of e){let{buttonName:f,buttonClick:h,buttonText:p,buttonIcon:b,buttonHint:y}=d;if(f==="title")c=!1,i.push(_("h2",{className:"fc-toolbar-title",id:n.titleId},n.title));else{let x=f===n.activeButton,v=!n.isTodayEnabled&&f==="today"||!n.isPrevEnabled&&f==="prev"||!n.isNextEnabled&&f==="next",N=[`fc-${f}-button`,r.getClass("button")];x&&N.push(r.getClass("buttonActive")),i.push(_("button",{type:"button",title:typeof y=="function"?y(n.navUnit):y,disabled:v,"aria-pressed":x,className:N.join(" "),onClick:h},p||(b?_("span",{className:b,role:"img"}):"")))}}if(i.length>1){let d=c&&r.getClass("buttonGroup")||"";return _("div",{className:d},...i)}return i[0]}}class Q1 extends et{render(){let{model:e,extraClassName:n}=this.props,r=!1,i,c,d=e.sectionWidgets,f=d.center;return d.left?(r=!0,i=d.left):i=d.start,d.right?(r=!0,c=d.right):c=d.end,_("div",{className:[n||"","fc-toolbar",r?"fc-toolbar-ltr":""].join(" ")},this.renderSection("start",i||[]),this.renderSection("center",f||[]),this.renderSection("end",c||[]))}renderSection(e,n){let{props:r}=this;return _(zL,{key:e,widgetGroups:n,title:r.title,navUnit:r.navUnit,activeButton:r.activeButton,isTodayEnabled:r.isTodayEnabled,isPrevEnabled:r.isPrevEnabled,isNextEnabled:r.isNextEnabled,titleId:r.titleId})}}class PL extends et{constructor(){super(...arguments),this.state={availableWidth:null},this.handleEl=e=>{this.el=e,ga(this.props.elRef,e),this.updateAvailableWidth()},this.handleResize=()=>{this.updateAvailableWidth()}}render(){let{props:e,state:n}=this,{aspectRatio:r}=e,i=["fc-view-harness",r||e.liquid||e.height?"fc-view-harness-active":"fc-view-harness-passive"],c="",d="";return r?n.availableWidth!==null?c=n.availableWidth/r:d=`${1/r*100}%`:c=e.height||"",_("div",{"aria-labelledby":e.labeledById,ref:this.handleEl,className:i.join(" "),style:{height:c,paddingBottom:d}},e.children)}componentDidMount(){this.context.addResizeHandler(this.handleResize)}componentWillUnmount(){this.context.removeResizeHandler(this.handleResize)}updateAvailableWidth(){this.el&&this.props.aspectRatio&&this.setState({availableWidth:this.el.offsetWidth})}}class UL extends ni{constructor(e){super(e),this.handleSegClick=(n,r)=>{let{component:i}=this,{context:c}=i,d=Vl(r);if(d&&i.isValidSegDownEl(n.target)){let f=Yt(n.target,".fc-event-forced-url"),h=f?f.querySelector("a[href]").href:"";c.emitter.trigger("eventClick",{el:r,event:new pt(i.context,d.eventRange.def,d.eventRange.instance),jsEvent:n,view:c.viewApi}),h&&!n.defaultPrevented&&(window.location.href=h)}},this.destroy=Mj(e.el,"click",".fc-event",this.handleSegClick)}}class BL extends ni{constructor(e){super(e),this.handleEventElRemove=n=>{n===this.currentSegEl&&this.handleSegLeave(null,this.currentSegEl)},this.handleSegEnter=(n,r)=>{Vl(r)&&(this.currentSegEl=r,this.triggerEvent("eventMouseEnter",n,r))},this.handleSegLeave=(n,r)=>{this.currentSegEl&&(this.currentSegEl=null,this.triggerEvent("eventMouseLeave",n,r))},this.removeHoverListeners=bI(e.el,".fc-event",this.handleSegEnter,this.handleSegLeave)}destroy(){this.removeHoverListeners()}triggerEvent(e,n,r){let{component:i}=this,{context:c}=i,d=Vl(r);(!n||i.isValidSegDownEl(n.target))&&c.emitter.trigger(e,{el:r,event:new pt(c,d.eventRange.def,d.eventRange.instance),jsEvent:n,view:c.viewApi})}}class HL extends Ir{constructor(){super(...arguments),this.buildViewContext=Oe(w4),this.buildViewPropTransformers=Oe(FL),this.buildToolbarProps=Oe(GL),this.headerRef=en(),this.footerRef=en(),this.interactionsStore={},this.state={viewLabelId:Ou()},this.registerInteractiveComponent=(e,n)=>{let r=A3(e,n),d=[UL,BL].concat(this.props.pluginHooks.componentInteractions).map(f=>new f(r));this.interactionsStore[e.uid]=d,ig[e.uid]=r},this.unregisterInteractiveComponent=e=>{let n=this.interactionsStore[e.uid];if(n){for(let r of n)r.destroy();delete this.interactionsStore[e.uid]}delete ig[e.uid]},this.resizeRunner=new im(()=>{this.props.emitter.trigger("_resize",!0),this.props.emitter.trigger("windowResize",{view:this.props.viewApi})}),this.handleWindowResize=e=>{let{options:n}=this.props;n.handleWindowResize&&e.target===window&&this.resizeRunner.request(n.windowResizeDelay)}}render(){let{props:e}=this,{toolbarConfig:n,options:r}=e,i=!1,c="",d;e.isHeightAuto||e.forPrint?c="":r.height!=null?i=!0:r.contentHeight!=null?c=r.contentHeight:d=Math.max(r.aspectRatio,.5);let f=this.buildViewContext(e.viewSpec,e.viewApi,e.options,e.dateProfileGenerator,e.dateEnv,e.nowManager,e.theme,e.pluginHooks,e.dispatch,e.getCurrentData,e.emitter,e.calendarApi,this.registerInteractiveComponent,this.unregisterInteractiveComponent),h=n.header&&n.header.hasTitle?this.state.viewLabelId:void 0;return _(Qa.Provider,{value:f},_(ai,{unit:"day"},p=>{let b=this.buildToolbarProps(e.viewSpec,e.dateProfile,e.dateProfileGenerator,e.currentDate,p,e.viewTitle);return _(ot,null,n.header&&_(Q1,Object.assign({ref:this.headerRef,extraClassName:"fc-header-toolbar",model:n.header,titleId:h},b)),_(PL,{liquid:i,height:c,aspectRatio:d,labeledById:h},this.renderView(e),this.buildAppendContent()),n.footer&&_(Q1,Object.assign({ref:this.footerRef,extraClassName:"fc-footer-toolbar",model:n.footer,titleId:""},b)))}))}componentDidMount(){let{props:e}=this;this.calendarInteractions=e.pluginHooks.calendarInteractions.map(r=>new r(e)),window.addEventListener("resize",this.handleWindowResize);let{propSetHandlers:n}=e.pluginHooks;for(let r in n)n[r](e[r],e)}componentDidUpdate(e){let{props:n}=this,{propSetHandlers:r}=n.pluginHooks;for(let i in r)n[i]!==e[i]&&r[i](n[i],n)}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.resizeRunner.clear();for(let e of this.calendarInteractions)e.destroy();this.props.emitter.trigger("_unmount")}buildAppendContent(){let{props:e}=this,n=e.pluginHooks.viewContainerAppends.map(r=>r(e));return _(ot,{},...n)}renderView(e){let{pluginHooks:n}=e,{viewSpec:r}=e,i={dateProfile:e.dateProfile,businessHours:e.businessHours,eventStore:e.renderableEventStore,eventUiBases:e.eventUiBases,dateSelection:e.dateSelection,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,isHeightAuto:e.isHeightAuto,forPrint:e.forPrint},c=this.buildViewPropTransformers(n.viewPropsTransformers);for(let f of c)Object.assign(i,f.transform(i,e));let d=r.component;return _(d,Object.assign({},i))}}function GL(t,e,n,r,i,c){let d=n.build(i,void 0,!1),f=n.buildPrev(e,r,!1),h=n.buildNext(e,r,!1);return{title:c,activeButton:t.type,navUnit:t.singleUnit,isTodayEnabled:d.isValid&&!Ha(e.currentRange,i),isPrevEnabled:f.isValid,isNextEnabled:h.isValid}}function FL(t){return t.map(e=>new e)}class VL extends C3{constructor(e,n={}){super(),this.isRendering=!1,this.isRendered=!1,this.currentClassNames=[],this.customContentRenderId=0,this.handleAction=r=>{switch(r.type){case"SET_EVENT_DRAG":case"SET_EVENT_RESIZE":this.renderRunner.tryDrain()}},this.handleData=r=>{this.currentData=r,this.renderRunner.request(r.calendarOptions.rerenderDelay)},this.handleRenderRequest=()=>{if(this.isRendering){this.isRendered=!0;let{currentData:r}=this;ru(()=>{So(_(S3,{options:r.calendarOptions,theme:r.theme,emitter:r.emitter},(i,c,d,f)=>(this.setClassNames(i),this.setHeight(c),_(Fj.Provider,{value:this.customContentRenderId},_(HL,Object.assign({isHeightAuto:d,forPrint:f},r))))),this.el)})}else this.isRendered&&(this.isRendered=!1,So(null,this.el),this.setClassNames([]),this.setHeight(""))},cI(e),this.el=e,this.renderRunner=new im(this.handleRenderRequest),new DL({optionOverrides:n,calendarApi:this,onAction:this.handleAction,onData:this.handleData})}render(){let e=this.isRendering;e?this.customContentRenderId+=1:this.isRendering=!0,this.renderRunner.request(),e&&this.updateSize()}destroy(){this.isRendering&&(this.isRendering=!1,this.renderRunner.request())}updateSize(){ru(()=>{super.updateSize()})}batchRendering(e){this.renderRunner.pause("batchRendering"),e(),this.renderRunner.resume("batchRendering")}pauseRendering(){this.renderRunner.pause("pauseRendering")}resumeRendering(){this.renderRunner.resume("pauseRendering",!0)}resetOptions(e,n){this.currentDataManager.resetOptions(e,n)}setClassNames(e){if(!Hs(e,this.currentClassNames)){let{classList:n}=this.el;for(let r of this.currentClassNames)n.remove(r);for(let r of e)n.add(r);this.currentClassNames=e}}setHeight(e){kj(this.el,"height",e)}}const qL=parseInt(String(qe.version).split(".")[0]),$L=qL<18;class GS extends A.Component{constructor(){super(...arguments),this.elRef=A.createRef(),this.isUpdating=!1,this.isUnmounting=!1,this.state={customRenderingMap:new Map},this.requestResize=()=>{this.isUnmounting||(this.cancelResize(),this.resizeId=requestAnimationFrame(()=>{this.doResize()}))}}render(){const e=[];for(const n of this.state.customRenderingMap.values())e.push(qe.createElement(YL,{key:n.id,customRendering:n}));return qe.createElement("div",{ref:this.elRef},e)}componentDidMount(){this.isUnmounting=!1;const e=new D6;this.handleCustomRendering=e.handle.bind(e),this.calendar=new VL(this.elRef.current,Object.assign(Object.assign({},this.props),{handleCustomRendering:this.handleCustomRendering})),this.calendar.render(),this.calendar.on("_beforeprint",()=>{Dr.flushSync(()=>{})});let n;e.subscribe(r=>{const i=Date.now(),c=!n;($L||c||this.isUpdating||this.isUnmounting||i-n<100?FS:Dr.flushSync)(()=>{this.setState({customRenderingMap:r},()=>{n=i,c?this.doResize():this.requestResize()})})})}componentDidUpdate(){this.isUpdating=!0,this.calendar.resetOptions(Object.assign(Object.assign({},this.props),{handleCustomRendering:this.handleCustomRendering})),this.isUpdating=!1}componentWillUnmount(){this.isUnmounting=!0,this.cancelResize(),this.calendar.destroy()}doResize(){this.calendar.updateSize()}cancelResize(){this.resizeId!==void 0&&(cancelAnimationFrame(this.resizeId),this.resizeId=void 0)}getApi(){return this.calendar}}GS.act=FS;class YL extends A.PureComponent{render(){const{customRendering:e}=this.props,{generatorMeta:n}=e,r=typeof n=="function"?n(e.renderProps):n;return Dr.createPortal(r,e.containerEl)}}function FS(t){t()}class QL extends ma{constructor(){super(...arguments),this.headerElRef=en()}renderSimpleLayout(e,n){let{props:r,context:i}=this,c=[],d=uu(i.options);return e&&c.push({type:"header",key:"header",isSticky:d,chunk:{elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}}),c.push({type:"body",key:"body",liquid:!0,chunk:{content:n}}),_(lu,{elClasses:["fc-daygrid"],viewSpec:i.viewSpec},_(Tm,{liquid:!r.isHeightAuto&&!r.forPrint,collapsibleWidth:r.forPrint,cols:[],sections:c}))}renderHScrollLayout(e,n,r,i){let c=this.context.pluginHooks.scrollGridImpl;if(!c)throw new Error("No ScrollGrid implementation");let{props:d,context:f}=this,h=!d.forPrint&&uu(f.options),p=!d.forPrint&&CS(f.options),b=[];return e&&b.push({type:"header",key:"header",isSticky:h,chunks:[{key:"main",elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}]}),b.push({type:"body",key:"body",liquid:!0,chunks:[{key:"main",content:n}]}),p&&b.push({type:"footer",key:"footer",isSticky:!0,chunks:[{key:"main",content:dg}]}),_(lu,{elClasses:["fc-daygrid"],viewSpec:f.viewSpec},_(c,{liquid:!d.isHeightAuto&&!d.forPrint,forPrint:d.forPrint,collapsibleWidth:d.forPrint,colGroups:[{cols:[{span:r,minWidth:i}]}],sections:b}))}}function Id(t,e){let n=[];for(let r=0;r{let i=(e.eventDrag?e.eventDrag.affectedInstances:null)||(e.eventResize?e.eventResize.affectedInstances:null)||{};return _(ot,null,n.map(c=>{let d=c.eventRange.instance.instanceId;return _("div",{className:"fc-daygrid-event-harness",key:d,style:{visibility:i[d]?"hidden":""}},qS(c)?_(YS,Object.assign({seg:c,isDragging:!1,isSelected:d===e.eventSelection,defaultDisplayEventEnd:!1},zs(c,e.todayRange))):_($S,Object.assign({seg:c,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:d===e.eventSelection,defaultDisplayEventEnd:!1},zs(c,e.todayRange))))}))}})}}function ZL(t){let e=[],n=[];for(let r of t)e.push(r.seg),r.isVisible||n.push(r.seg);return{allSegs:e,invisibleSegs:n}}const KL=mt({week:"narrow"});class JL extends ma{constructor(){super(...arguments),this.rootElRef=en(),this.state={dayNumberId:Ou()},this.handleRootEl=e=>{ga(this.rootElRef,e),ga(this.props.elRef,e)}}render(){let{context:e,props:n,state:r,rootElRef:i}=this,{options:c,dateEnv:d}=e,{date:f,dateProfile:h}=n;const p=n.showDayNumber&&tz(f,h.currentRange,d);return _(Im,{elTag:"td",elRef:this.handleRootEl,elClasses:["fc-daygrid-day",...n.extraClassNames||[]],elAttrs:Object.assign(Object.assign(Object.assign({},n.extraDataAttrs),n.showDayNumber?{"aria-labelledby":r.dayNumberId}:{}),{role:"gridcell"}),defaultGenerator:ez,date:f,dateProfile:h,todayRange:n.todayRange,showDayNumber:n.showDayNumber,isMonthStart:p,extraRenderProps:n.extraRenderProps},(b,y)=>_("div",{ref:n.innerElRef,className:"fc-daygrid-day-frame fc-scrollgrid-sync-inner",style:{minHeight:n.minHeight}},n.showWeekNumber&&_(RS,{elTag:"a",elClasses:["fc-daygrid-week-number"],elAttrs:du(e,f,"week"),date:f,defaultFormat:KL}),!y.isDisabled&&(n.showDayNumber||Lm(c)||n.forceDayTop)?_("div",{className:"fc-daygrid-day-top"},_(b,{elTag:"a",elClasses:["fc-daygrid-day-number",p&&"fc-daygrid-month-start"],elAttrs:Object.assign(Object.assign({},du(e,f)),{id:r.dayNumberId})})):n.showDayNumber?_("div",{className:"fc-daygrid-day-top",style:{visibility:"hidden"}},_("a",{className:"fc-daygrid-day-number"}," ")):void 0,_("div",{className:"fc-daygrid-day-events",ref:n.fgContentElRef},n.fgContent,_("div",{className:"fc-daygrid-day-bottom",style:{marginTop:n.moreMarginTop}},_(XL,{allDayDate:f,singlePlacements:n.singlePlacements,moreCnt:n.moreCnt,alignmentElRef:i,alignGridTop:!n.showDayNumber,extraDateSpan:n.extraDateSpan,dateProfile:n.dateProfile,eventSelection:n.eventSelection,eventDrag:n.eventDrag,eventResize:n.eventResize,todayRange:n.todayRange}))),_("div",{className:"fc-daygrid-day-bg"},n.bgContent)))}}function ez(t){return t.dayNumberText||_(ot,null," ")}function tz(t,e,n){const{start:r,end:i}=e,c=Gs(i,-1),d=n.getYear(r),f=n.getMonth(r),h=n.getYear(c),p=n.getMonth(c);return!(d===h&&f===p)&&(t.valueOf()===r.valueOf()||n.getDay(t)===1&&t.valueOf(){let w=t[R.index].eventRange.instance.instanceId+":"+R.span.start+":"+(R.span.end-1);return i[w]||1});f.allowReslicing=!0,f.strictOrder=r,e===!0||n===!0?(f.maxCoord=c,f.hiddenConsumes=!0):typeof e=="number"?f.maxStackCnt=e:typeof n=="number"&&(f.maxStackCnt=n,f.hiddenConsumes=!0);let h=[],p=[];for(let R=0;R1,S=v.span.start===f;y+=v.levelCoord-b,b=v.levelCoord+v.thickness,j?(y+=v.thickness,S&&x.push({seg:wl(N,v.span.start,v.span.end,n),isVisible:!0,isAbsolute:!0,absoluteTop:v.levelCoord,marginTop:0})):S&&(x.push({seg:wl(N,v.span.start,v.span.end,n),isVisible:!0,isAbsolute:!1,absoluteTop:v.levelCoord,marginTop:y}),y=0)}i.push(p),c.push(x),d.push(y)}return{singleColPlacements:i,multiColPlacements:c,leftoverMargins:d}}function sz(t,e){let n=[];for(let r=0;r!this.forceHidden[Cr(c)];for(let c=0;c{e&&this.updateSizing(!0)}}render(){let{props:e,state:n,context:r}=this,{options:i}=r,c=e.cells.length,d=Sd(e.businessHourSegs,c),f=Sd(e.bgEventSegs,c),h=Sd(this.getHighlightSegs(),c),p=Sd(this.getMirrorSegs(),c),{singleColPlacements:b,multiColPlacements:y,moreCnts:x,moreMarginTops:v}=nz(rS(e.fgEventSegs,i.eventOrder),e.dayMaxEvents,e.dayMaxEventRows,i.eventOrderStrict,n.segHeights,n.maxContentHeight,e.cells),N=e.eventDrag&&e.eventDrag.affectedInstances||e.eventResize&&e.eventResize.affectedInstances||{};return _("tr",{ref:this.rootElRef,role:"row"},e.renderIntro&&e.renderIntro(),e.cells.map((j,S)=>{let R=this.renderFgSegs(S,e.forPrint?b[S]:y[S],e.todayRange,N),w=this.renderFgSegs(S,lz(p[S],y),e.todayRange,{},!!e.eventDrag,!!e.eventResize,!1);return _(JL,{key:j.key,elRef:this.cellElRefs.createRef(j.key),innerElRef:this.frameElRefs.createRef(j.key),dateProfile:e.dateProfile,date:j.date,showDayNumber:e.showDayNumbers,showWeekNumber:e.showWeekNumbers&&S===0,forceDayTop:e.showWeekNumbers,todayRange:e.todayRange,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,extraRenderProps:j.extraRenderProps,extraDataAttrs:j.extraDataAttrs,extraClassNames:j.extraClassNames,extraDateSpan:j.extraDateSpan,moreCnt:x[S],moreMarginTop:v[S],singlePlacements:b[S],fgContentElRef:this.fgElRefs.createRef(j.key),fgContent:_(ot,null,_(ot,null,R),_(ot,null,w)),bgContent:_(ot,null,this.renderFillSegs(h[S],"highlight"),this.renderFillSegs(d[S],"non-business"),this.renderFillSegs(f[S],"bg-event")),minHeight:e.cellMinHeight})}))}componentDidMount(){this.updateSizing(!0),this.context.addResizeHandler(this.handleResize)}componentDidUpdate(e,n){let r=this.props;this.updateSizing(!ra(e,r))}componentWillUnmount(){this.context.removeResizeHandler(this.handleResize)}getHighlightSegs(){let{props:e}=this;return e.eventDrag&&e.eventDrag.segs.length?e.eventDrag.segs:e.eventResize&&e.eventResize.segs.length?e.eventResize.segs:e.dateSelectionSegs}getMirrorSegs(){let{props:e}=this;return e.eventResize&&e.eventResize.segs.length?e.eventResize.segs:[]}renderFgSegs(e,n,r,i,c,d,f){let{context:h}=this,{eventSelection:p}=this.props,{framePositions:b}=this.state,y=this.props.cells.length===1,x=c||d||f,v=[];if(b)for(let N of n){let{seg:j}=N,{instanceId:S}=j.eventRange.instance,R=N.isVisible&&!i[S],w=N.isAbsolute,D="",C="";w&&(h.isRtl?(C=0,D=b.lefts[j.lastCol]-b.lefts[j.firstCol]):(D=0,C=b.rights[j.firstCol]-b.rights[j.lastCol])),v.push(_("div",{className:"fc-daygrid-event-harness"+(w?" fc-daygrid-event-harness-abs":""),key:QS(j),ref:x?null:this.segHarnessRefs.createRef(WS(j)),style:{visibility:R?"":"hidden",marginTop:w?"":N.marginTop,top:w?N.absoluteTop:"",left:D,right:C}},qS(j)?_(YS,Object.assign({seg:j,isDragging:c,isSelected:S===p,defaultDisplayEventEnd:y},zs(j,r))):_($S,Object.assign({seg:j,isDragging:c,isResizing:d,isDateSelecting:f,isSelected:S===p,defaultDisplayEventEnd:y},zs(j,r)))))}return v}renderFillSegs(e,n){let{isRtl:r}=this.context,{todayRange:i}=this.props,{framePositions:c}=this.state,d=[];if(c)for(let f of e){let h=r?{right:0,left:c.lefts[f.lastCol]-c.lefts[f.firstCol]}:{left:0,right:c.rights[f.firstCol]-c.rights[f.lastCol]};d.push(_("div",{key:iS(f.eventRange),className:"fc-daygrid-bg-harness",style:h},n==="bg-event"?_(DS,Object.assign({seg:f},zs(f,i))):OS(n)))}return _(ot,{},...d)}updateSizing(e){let{props:n,state:r,frameElRefs:i}=this;if(!n.forPrint&&n.clientWidth!==null){if(e){let h=n.cells.map(p=>i.currentMap[p.key]);if(h.length){let p=this.rootElRef.current,b=new ql(p,h,!0,!1);(!r.framePositions||!r.framePositions.similarTo(b))&&this.setState({framePositions:new ql(p,h,!0,!1)})}}const c=this.state.segHeights,d=this.querySegHeights(),f=n.dayMaxEvents===!0||n.dayMaxEventRows===!0;this.safeSetState({segHeights:Object.assign(Object.assign({},c),d),maxContentHeight:f?this.computeMaxContentHeight():null})}}querySegHeights(){let e=this.segHarnessRefs.currentMap,n={};for(let r in e){let i=Math.round(e[r].getBoundingClientRect().height);n[r]=Math.max(n[r]||0,i)}return n}computeMaxContentHeight(){let e=this.props.cells[0].key,n=this.cellElRefs.currentMap[e],r=this.fgElRefs.currentMap[e];return n.getBoundingClientRect().bottom-r.getBoundingClientRect().top}getCellEls(){let e=this.cellElRefs.currentMap;return this.props.cells.map(n=>e[n.key])}}XS.addStateEquality({segHeights:ra});function lz(t,e){if(!t.length)return[];let n=iz(e);return t.map(r=>({seg:r,isVisible:!0,isAbsolute:!0,absoluteTop:n[r.eventRange.instance.instanceId],marginTop:0}))}function iz(t){let e={};for(let n of t)for(let r of n)e[r.seg.eventRange.instance.instanceId]=r.absoluteTop;return e}class oz extends ma{constructor(){super(...arguments),this.splitBusinessHourSegs=Oe(Id),this.splitBgEventSegs=Oe(cz),this.splitFgEventSegs=Oe(Id),this.splitDateSelectionSegs=Oe(Id),this.splitEventDrag=Oe(W1),this.splitEventResize=Oe(W1),this.rowRefs=new Ua}render(){let{props:e,context:n}=this,r=e.cells.length,i=this.splitBusinessHourSegs(e.businessHourSegs,r),c=this.splitBgEventSegs(e.bgEventSegs,r),d=this.splitFgEventSegs(e.fgEventSegs,r),f=this.splitDateSelectionSegs(e.dateSelectionSegs,r),h=this.splitEventDrag(e.eventDrag,r),p=this.splitEventResize(e.eventResize,r),b=r>=7&&e.clientWidth?e.clientWidth/n.options.aspectRatio/6:null;return _(ai,{unit:"day"},(y,x)=>_(ot,null,e.cells.map((v,N)=>_(XS,{ref:this.rowRefs.createRef(N),key:v.length?v[0].date.toISOString():N,showDayNumbers:r>1,showWeekNumbers:e.showWeekNumbers,todayRange:x,dateProfile:e.dateProfile,cells:v,renderIntro:e.renderRowIntro,businessHourSegs:i[N],eventSelection:e.eventSelection,bgEventSegs:c[N],fgEventSegs:d[N],dateSelectionSegs:f[N],eventDrag:h[N],eventResize:p[N],dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,clientWidth:e.clientWidth,clientHeight:e.clientHeight,cellMinHeight:b,forPrint:e.forPrint}))))}componentDidMount(){this.registerInteractiveComponent()}componentDidUpdate(){this.registerInteractiveComponent()}registerInteractiveComponent(){if(!this.rootEl){const e=this.rowRefs.currentMap[0].getCellEls()[0],n=e?e.closest(".fc-daygrid-body"):null;n&&(this.rootEl=n,this.context.registerInteractiveComponent(this,{el:n,isHitComboAllowed:this.props.isHitComboAllowed}))}}componentWillUnmount(){this.rootEl&&(this.context.unregisterInteractiveComponent(this),this.rootEl=null)}prepareHits(){this.rowPositions=new ql(this.rootEl,this.rowRefs.collect().map(e=>e.getCellEls()[0]),!1,!0),this.colPositions=new ql(this.rootEl,this.rowRefs.currentMap[0].getCellEls(),!0,!1)}queryHit(e,n){let{colPositions:r,rowPositions:i}=this,c=r.leftToIndex(e),d=i.topToIndex(n);if(d!=null&&c!=null){let f=this.props.cells[d][c];return{dateProfile:this.props.dateProfile,dateSpan:Object.assign({range:this.getCellRange(d,c),allDay:!0},f.extraDateSpan),dayEl:this.getCellEl(d,c),rect:{left:r.lefts[c],right:r.rights[c],top:i.tops[d],bottom:i.bottoms[d]},layer:0}}return null}getCellEl(e,n){return this.rowRefs.currentMap[e].getCellEls()[n]}getCellRange(e,n){let r=this.props.cells[e][n].date,i=It(r,1);return{start:r,end:i}}}function cz(t,e){return Id(t.filter(dz),e)}function dz(t){return t.eventRange.def.allDay}class uz extends ma{constructor(){super(...arguments),this.elRef=en(),this.needsScrollReset=!1}render(){let{props:e}=this,{dayMaxEventRows:n,dayMaxEvents:r,expandRows:i}=e,c=r===!0||n===!0;c&&!i&&(c=!1,n=null,r=null);let d=["fc-daygrid-body",c?"fc-daygrid-body-balanced":"fc-daygrid-body-unbalanced",i?"":"fc-daygrid-body-natural"];return _("div",{ref:this.elRef,className:d.join(" "),style:{width:e.clientWidth,minWidth:e.tableMinWidth}},_("table",{role:"presentation",className:"fc-scrollgrid-sync-table",style:{width:e.clientWidth,minWidth:e.tableMinWidth,height:i?e.clientHeight:""}},e.colGroupNode,_("tbody",{role:"presentation"},_(oz,{dateProfile:e.dateProfile,cells:e.cells,renderRowIntro:e.renderRowIntro,showWeekNumbers:e.showWeekNumbers,clientWidth:e.clientWidth,clientHeight:e.clientHeight,businessHourSegs:e.businessHourSegs,bgEventSegs:e.bgEventSegs,fgEventSegs:e.fgEventSegs,dateSelectionSegs:e.dateSelectionSegs,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,dayMaxEvents:r,dayMaxEventRows:n,forPrint:e.forPrint,isHitComboAllowed:e.isHitComboAllowed}))))}componentDidMount(){this.requestScrollReset()}componentDidUpdate(e){e.dateProfile!==this.props.dateProfile?this.requestScrollReset():this.flushScrollReset()}requestScrollReset(){this.needsScrollReset=!0,this.flushScrollReset()}flushScrollReset(){if(this.needsScrollReset&&this.props.clientWidth){const e=fz(this.elRef.current,this.props.dateProfile);if(e){const n=e.closest(".fc-daygrid-body"),r=n.closest(".fc-scroller"),i=e.getBoundingClientRect().top-n.getBoundingClientRect().top;r.scrollTop=i?i+1:0}this.needsScrollReset=!1}}}function fz(t,e){let n;return e.currentRangeUnit.match(/year|month/)&&(n=t.querySelector(`[data-date="${WI(e.currentDate)}-01"]`)),n||(n=t.querySelector(`[data-date="${fm(e.currentDate)}"]`)),n}class hz extends ES{constructor(){super(...arguments),this.forceDayIfListItem=!0}sliceRange(e,n){return n.sliceRange(e)}}class ZS extends ma{constructor(){super(...arguments),this.slicer=new hz,this.tableRef=en()}render(){let{props:e,context:n}=this;return _(uz,Object.assign({ref:this.tableRef},this.slicer.sliceProps(e,e.dateProfile,e.nextDayThreshold,n,e.dayTableModel),{dateProfile:e.dateProfile,cells:e.dayTableModel.cells,colGroupNode:e.colGroupNode,tableMinWidth:e.tableMinWidth,renderRowIntro:e.renderRowIntro,dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,showWeekNumbers:e.showWeekNumbers,expandRows:e.expandRows,headerAlignElRef:e.headerAlignElRef,clientWidth:e.clientWidth,clientHeight:e.clientHeight,forPrint:e.forPrint}))}}class pz extends QL{constructor(){super(...arguments),this.buildDayTableModel=Oe(gz),this.headerRef=en(),this.tableRef=en()}render(){let{options:e,dateProfileGenerator:n}=this.context,{props:r}=this,i=this.buildDayTableModel(r.dateProfile,n),c=e.dayHeaders&&_(yS,{ref:this.headerRef,dateProfile:r.dateProfile,dates:i.headerDates,datesRepDistinctDays:i.rowCnt===1}),d=f=>_(ZS,{ref:this.tableRef,dateProfile:r.dateProfile,dayTableModel:i,businessHours:r.businessHours,dateSelection:r.dateSelection,eventStore:r.eventStore,eventUiBases:r.eventUiBases,eventSelection:r.eventSelection,eventDrag:r.eventDrag,eventResize:r.eventResize,nextDayThreshold:e.nextDayThreshold,colGroupNode:f.tableColGroupNode,tableMinWidth:f.tableMinWidth,dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,showWeekNumbers:e.weekNumbers,expandRows:!r.isHeightAuto,headerAlignElRef:this.headerElRef,clientWidth:f.clientWidth,clientHeight:f.clientHeight,forPrint:r.forPrint});return e.dayMinWidth?this.renderHScrollLayout(c,d,i.colCnt,e.dayMinWidth):this.renderSimpleLayout(c,d)}}function gz(t,e){let n=new vS(t.renderRange,e);return new NS(n,/year|month|week/.test(t.currentRangeUnit))}class mz extends Yj{buildRenderRange(e,n,r){let i=super.buildRenderRange(e,n,r),{props:c}=this;return xz({currentRange:i,snapToWeek:/^(year|month)$/.test(n),fixedWeekCount:c.fixedWeekCount,dateEnv:c.dateEnv})}}function xz(t){let{dateEnv:e,currentRange:n}=t,{start:r,end:i}=n,c;if(t.snapToWeek&&(r=e.startOfWeek(r),c=e.startOfWeek(i),c.valueOf()!==i.valueOf()&&(i=S1(c,1))),t.fixedWeekCount){let d=e.startOfWeek(e.startOfMonth(It(n.end,-1))),f=Math.ceil(PI(d,i));i=S1(i,6-f)}return{start:r,end:i}}var bz=':root{--fc-daygrid-event-dot-width:8px}.fc-daygrid-day-events:after,.fc-daygrid-day-events:before,.fc-daygrid-day-frame:after,.fc-daygrid-day-frame:before,.fc-daygrid-event-harness:after,.fc-daygrid-event-harness:before{clear:both;content:"";display:table}.fc .fc-daygrid-body{position:relative;z-index:1}.fc .fc-daygrid-day.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-daygrid-day-frame{min-height:100%;position:relative}.fc .fc-daygrid-day-top{display:flex;flex-direction:row-reverse}.fc .fc-day-other .fc-daygrid-day-top{opacity:.3}.fc .fc-daygrid-day-number{padding:4px;position:relative;z-index:4}.fc .fc-daygrid-month-start{font-size:1.1em;font-weight:700}.fc .fc-daygrid-day-events{margin-top:1px}.fc .fc-daygrid-body-balanced .fc-daygrid-day-events{left:0;position:absolute;right:0}.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events{min-height:2em;position:relative}.fc .fc-daygrid-body-natural .fc-daygrid-day-events{margin-bottom:1em}.fc .fc-daygrid-event-harness{position:relative}.fc .fc-daygrid-event-harness-abs{left:0;position:absolute;right:0;top:0}.fc .fc-daygrid-bg-harness{bottom:0;position:absolute;top:0}.fc .fc-daygrid-day-bg .fc-non-business{z-index:1}.fc .fc-daygrid-day-bg .fc-bg-event{z-index:2}.fc .fc-daygrid-day-bg .fc-highlight{z-index:3}.fc .fc-daygrid-event{margin-top:1px;z-index:6}.fc .fc-daygrid-event.fc-event-mirror{z-index:7}.fc .fc-daygrid-day-bottom{font-size:.85em;margin:0 2px}.fc .fc-daygrid-day-bottom:after,.fc .fc-daygrid-day-bottom:before{clear:both;content:"";display:table}.fc .fc-daygrid-more-link{border-radius:3px;cursor:pointer;line-height:1;margin-top:1px;max-width:100%;overflow:hidden;padding:2px;position:relative;white-space:nowrap;z-index:4}.fc .fc-daygrid-more-link:hover{background-color:rgba(0,0,0,.1)}.fc .fc-daygrid-week-number{background-color:var(--fc-neutral-bg-color);color:var(--fc-neutral-text-color);min-width:1.5em;padding:2px;position:absolute;text-align:center;top:0;z-index:5}.fc .fc-more-popover .fc-popover-body{min-width:220px;padding:10px}.fc-direction-ltr .fc-daygrid-event.fc-event-start,.fc-direction-rtl .fc-daygrid-event.fc-event-end{margin-left:2px}.fc-direction-ltr .fc-daygrid-event.fc-event-end,.fc-direction-rtl .fc-daygrid-event.fc-event-start{margin-right:2px}.fc-direction-ltr .fc-daygrid-more-link{float:left}.fc-direction-ltr .fc-daygrid-week-number{border-radius:0 0 3px 0;left:0}.fc-direction-rtl .fc-daygrid-more-link{float:right}.fc-direction-rtl .fc-daygrid-week-number{border-radius:0 0 0 3px;right:0}.fc-liquid-hack .fc-daygrid-day-frame{position:static}.fc-daygrid-event{border-radius:3px;font-size:var(--fc-small-font-size);position:relative;white-space:nowrap}.fc-daygrid-block-event .fc-event-time{font-weight:700}.fc-daygrid-block-event .fc-event-time,.fc-daygrid-block-event .fc-event-title{padding:1px}.fc-daygrid-dot-event{align-items:center;display:flex;padding:2px 0}.fc-daygrid-dot-event .fc-event-title{flex-grow:1;flex-shrink:1;font-weight:700;min-width:0;overflow:hidden}.fc-daygrid-dot-event.fc-event-mirror,.fc-daygrid-dot-event:hover{background:rgba(0,0,0,.1)}.fc-daygrid-dot-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-daygrid-event-dot{border:calc(var(--fc-daygrid-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-daygrid-event-dot-width)/2);box-sizing:content-box;height:0;margin:0 4px;width:0}.fc-direction-ltr .fc-daygrid-event .fc-event-time{margin-right:3px}.fc-direction-rtl .fc-daygrid-event .fc-event-time{margin-left:3px}';lm(bz);var yz=Wa({name:"@fullcalendar/daygrid",initialView:"dayGridMonth",views:{dayGrid:{component:pz,dateProfileGeneratorClass:mz},dayGridDay:{type:"dayGrid",duration:{days:1}},dayGridWeek:{type:"dayGrid",duration:{weeks:1}},dayGridMonth:{type:"dayGrid",duration:{months:1},fixedWeekCount:!0},dayGridYear:{type:"dayGrid",duration:{years:1}}}});class vz extends k3{getKeyInfo(){return{allDay:{},timed:{}}}getKeysForDateSpan(e){return e.allDay?["allDay"]:["timed"]}getKeysForEventDef(e){return e.allDay?o3(e)?["timed","allDay"]:["allDay"]:["timed"]}}const Nz=mt({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"short"});function KS(t){let e=["fc-timegrid-slot","fc-timegrid-slot-label",t.isLabeled?"fc-scrollgrid-shrink":"fc-timegrid-slot-minor"];return _(Qa.Consumer,null,n=>{if(!t.isLabeled)return _("td",{className:e.join(" "),"data-time":t.isoTimeStr});let{dateEnv:r,options:i,viewApi:c}=n,d=i.slotLabelFormat==null?Nz:Array.isArray(i.slotLabelFormat)?mt(i.slotLabelFormat[0]):mt(i.slotLabelFormat),f={level:0,time:t.time,date:r.toDate(t.date),view:c,text:r.format(t.date,d)};return _(kn,{elTag:"td",elClasses:e,elAttrs:{"data-time":t.isoTimeStr},renderProps:f,generatorName:"slotLabelContent",customGenerator:i.slotLabelContent,defaultGenerator:Ez,classNameGenerator:i.slotLabelClassNames,didMount:i.slotLabelDidMount,willUnmount:i.slotLabelWillUnmount},h=>_("div",{className:"fc-timegrid-slot-label-frame fc-scrollgrid-shrink-frame"},_(h,{elTag:"div",elClasses:["fc-timegrid-slot-label-cushion","fc-scrollgrid-shrink-cushion"]})))})}function Ez(t){return t.text}class jz extends et{render(){return this.props.slatMetas.map(e=>_("tr",{key:e.key},_(KS,Object.assign({},e))))}}const Sz=mt({week:"short"}),Az=5;class wz extends ma{constructor(){super(...arguments),this.allDaySplitter=new vz,this.headerElRef=en(),this.rootElRef=en(),this.scrollerElRef=en(),this.state={slatCoords:null},this.handleScrollTopRequest=e=>{let n=this.scrollerElRef.current;n&&(n.scrollTop=e)},this.renderHeadAxis=(e,n="")=>{let{options:r}=this.context,{dateProfile:i}=this.props,c=i.renderRange,f=Mr(c.start,c.end)===1?du(this.context,c.start,"week"):{};return r.weekNumbers&&e==="day"?_(RS,{elTag:"th",elClasses:["fc-timegrid-axis","fc-scrollgrid-shrink"],elAttrs:{"aria-hidden":!0},date:c.start,defaultFormat:Sz},h=>_("div",{className:["fc-timegrid-axis-frame","fc-scrollgrid-shrink-frame","fc-timegrid-axis-frame-liquid"].join(" "),style:{height:n}},_(h,{elTag:"a",elClasses:["fc-timegrid-axis-cushion","fc-scrollgrid-shrink-cushion","fc-scrollgrid-sync-inner"],elAttrs:f}))):_("th",{"aria-hidden":!0,className:"fc-timegrid-axis"},_("div",{className:"fc-timegrid-axis-frame",style:{height:n}}))},this.renderTableRowAxis=e=>{let{options:n,viewApi:r}=this.context,i={text:n.allDayText,view:r};return _(kn,{elTag:"td",elClasses:["fc-timegrid-axis","fc-scrollgrid-shrink"],elAttrs:{"aria-hidden":!0},renderProps:i,generatorName:"allDayContent",customGenerator:n.allDayContent,defaultGenerator:Cz,classNameGenerator:n.allDayClassNames,didMount:n.allDayDidMount,willUnmount:n.allDayWillUnmount},c=>_("div",{className:["fc-timegrid-axis-frame","fc-scrollgrid-shrink-frame",e==null?" fc-timegrid-axis-frame-liquid":""].join(" "),style:{height:e}},_(c,{elTag:"span",elClasses:["fc-timegrid-axis-cushion","fc-scrollgrid-shrink-cushion","fc-scrollgrid-sync-inner"]})))},this.handleSlatCoords=e=>{this.setState({slatCoords:e})}}renderSimpleLayout(e,n,r){let{context:i,props:c}=this,d=[],f=uu(i.options);return e&&d.push({type:"header",key:"header",isSticky:f,chunk:{elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}}),n&&(d.push({type:"body",key:"all-day",chunk:{content:n}}),d.push({type:"body",key:"all-day-divider",outerContent:_("tr",{role:"presentation",className:"fc-scrollgrid-section"},_("td",{className:"fc-timegrid-divider "+i.theme.getClass("tableCellShaded")}))})),d.push({type:"body",key:"body",liquid:!0,expandRows:!!i.options.expandRows,chunk:{scrollerElRef:this.scrollerElRef,content:r}}),_(lu,{elRef:this.rootElRef,elClasses:["fc-timegrid"],viewSpec:i.viewSpec},_(Tm,{liquid:!c.isHeightAuto&&!c.forPrint,collapsibleWidth:c.forPrint,cols:[{width:"shrink"}],sections:d}))}renderHScrollLayout(e,n,r,i,c,d,f){let h=this.context.pluginHooks.scrollGridImpl;if(!h)throw new Error("No ScrollGrid implementation");let{context:p,props:b}=this,y=!b.forPrint&&uu(p.options),x=!b.forPrint&&CS(p.options),v=[];e&&v.push({type:"header",key:"header",isSticky:y,syncRowHeights:!0,chunks:[{key:"axis",rowContent:j=>_("tr",{role:"presentation"},this.renderHeadAxis("day",j.rowSyncHeights[0]))},{key:"cols",elRef:this.headerElRef,tableClassName:"fc-col-header",rowContent:e}]}),n&&(v.push({type:"body",key:"all-day",syncRowHeights:!0,chunks:[{key:"axis",rowContent:j=>_("tr",{role:"presentation"},this.renderTableRowAxis(j.rowSyncHeights[0]))},{key:"cols",content:n}]}),v.push({key:"all-day-divider",type:"body",outerContent:_("tr",{role:"presentation",className:"fc-scrollgrid-section"},_("td",{colSpan:2,className:"fc-timegrid-divider "+p.theme.getClass("tableCellShaded")}))}));let N=p.options.nowIndicator;return v.push({type:"body",key:"body",liquid:!0,expandRows:!!p.options.expandRows,chunks:[{key:"axis",content:j=>_("div",{className:"fc-timegrid-axis-chunk"},_("table",{"aria-hidden":!0,style:{height:j.expandRows?j.clientHeight:""}},j.tableColGroupNode,_("tbody",null,_(jz,{slatMetas:d}))),_("div",{className:"fc-timegrid-now-indicator-container"},_(ai,{unit:N?"minute":"day"},S=>{let R=N&&f&&f.safeComputeTop(S);return typeof R=="number"?_(Mm,{elClasses:["fc-timegrid-now-indicator-arrow"],elStyle:{top:R},isAxis:!0,date:S}):null})))},{key:"cols",scrollerElRef:this.scrollerElRef,content:r}]}),x&&v.push({key:"footer",type:"footer",isSticky:!0,chunks:[{key:"axis",content:dg},{key:"cols",content:dg}]}),_(lu,{elRef:this.rootElRef,elClasses:["fc-timegrid"],viewSpec:p.viewSpec},_(h,{liquid:!b.isHeightAuto&&!b.forPrint,forPrint:b.forPrint,collapsibleWidth:!1,colGroups:[{width:"shrink",cols:[{width:"shrink"}]},{cols:[{span:i,minWidth:c}]}],sections:v}))}getAllDayMaxEventProps(){let{dayMaxEvents:e,dayMaxEventRows:n}=this.context.options;return(e===!0||n===!0)&&(e=void 0,n=Az),{dayMaxEvents:e,dayMaxEventRows:n}}}function Cz(t){return t.text}class Dz{constructor(e,n,r){this.positions=e,this.dateProfile=n,this.slotDuration=r}safeComputeTop(e){let{dateProfile:n}=this;if(Ha(n.currentRange,e)){let r=ct(e),i=e.valueOf()-r.valueOf();if(i>=na(n.slotMinTime)&&i{let f={time:c.time,date:n.dateEnv.toDate(c.date),view:n.viewApi};return _("tr",{key:c.key,ref:i.createRef(c.key)},e.axis&&_(KS,Object.assign({},c)),_(kn,{elTag:"td",elClasses:["fc-timegrid-slot","fc-timegrid-slot-lane",!c.isLabeled&&"fc-timegrid-slot-minor"],elAttrs:{"data-time":c.isoTimeStr},renderProps:f,generatorName:"slotLaneContent",customGenerator:r.slotLaneContent,classNameGenerator:r.slotLaneClassNames,didMount:r.slotLaneDidMount,willUnmount:r.slotLaneWillUnmount}))}))}}class Rz extends et{constructor(){super(...arguments),this.rootElRef=en(),this.slatElRefs=new Ua}render(){let{props:e,context:n}=this;return _("div",{ref:this.rootElRef,className:"fc-timegrid-slots"},_("table",{"aria-hidden":!0,className:n.theme.getClass("table"),style:{minWidth:e.tableMinWidth,width:e.clientWidth,height:e.minHeight}},e.tableColGroupNode,_(Oz,{slatElRefs:this.slatElRefs,axis:e.axis,slatMetas:e.slatMetas})))}componentDidMount(){this.updateSizing()}componentDidUpdate(){this.updateSizing()}componentWillUnmount(){this.props.onCoords&&this.props.onCoords(null)}updateSizing(){let{context:e,props:n}=this;n.onCoords&&n.clientWidth!==null&&this.rootElRef.current.offsetHeight&&n.onCoords(new Dz(new ql(this.rootElRef.current,Tz(this.slatElRefs.currentMap,n.slatMetas),!1,!0),this.props.dateProfile,e.options.slotDuration))}}function Tz(t,e){return e.map(n=>t[n.key])}function no(t,e){let n=[],r;for(r=0;reA(e.hiddenSegs,e),defaultGenerator:_z,forceTimed:!0},n=>_(n,{elTag:"div",elClasses:["fc-timegrid-more-link-inner","fc-sticky"]}))}}function _z(t){return t.shortText}function Mz(t,e,n){let r=new mS;e!=null&&(r.strictOrder=e),n!=null&&(r.maxStackCnt=n);let i=r.addSegs(t),c=q3(i),d=Iz(r);return d=Uz(d,1),{segRects:Bz(d),hiddenGroups:c}}function Iz(t){const{entriesByLevel:e}=t,n=Pm((r,i)=>r+":"+i,(r,i)=>{let c=Pz(t,r,i),d=Z1(c,n),f=e[r][i];return[Object.assign(Object.assign({},f),{nextLevelNodes:d[0]}),f.thickness+d[1]]});return Z1(e.length?{level:0,lateralStart:0,lateralEnd:e[0].length}:null,n)[0]}function Z1(t,e){if(!t)return[[],0];let{level:n,lateralStart:r,lateralEnd:i}=t,c=r,d=[];for(;cCr(r),(r,i,c)=>{let{nextLevelNodes:d,thickness:f}=r,h=f+c,p=f/h,b,y=[];if(!d.length)b=e;else for(let v of d)if(b===void 0){let N=n(v,i,h);b=N[0],y.push(N[1])}else{let N=n(v,b,0);y.push(N[1])}let x=(b-i)*p;return[b-x,Object.assign(Object.assign({},r),{thickness:x,nextLevelNodes:y})]});return t.map(r=>n(r,0,0)[1])}function Bz(t){let e=[];const n=Pm((i,c,d)=>Cr(i),(i,c,d)=>{let f=Object.assign(Object.assign({},i),{levelCoord:c,stackDepth:d,stackForward:0});return e.push(f),f.stackForward=r(i.nextLevelNodes,c+i.thickness,d+1)+1});function r(i,c,d){let f=0;for(let h of i)f=Math.max(n(h,c,d),f);return f}return r(t,0,0),e}function Pm(t,e){const n={};return(...r)=>{let i=t(...r);return i in n?n[i]:n[i]=e(...r)}}function K1(t,e,n=null,r=0){let i=[];if(n)for(let c=0;c_("div",{className:"fc-timegrid-col-frame"},_("div",{className:"fc-timegrid-col-bg"},this.renderFillSegs(e.businessHourSegs,"non-business"),this.renderFillSegs(e.bgEventSegs,"bg-event"),this.renderFillSegs(e.dateSelectionSegs,"highlight")),_("div",{className:"fc-timegrid-col-events"},this.renderFgSegs(f,d,!1,!1,!1)),_("div",{className:"fc-timegrid-col-events"},this.renderFgSegs(c,{},!!e.eventDrag,!!e.eventResize,!!i,"mirror")),_("div",{className:"fc-timegrid-now-indicator-container"},this.renderNowIndicator(e.nowIndicatorSegs)),Lm(r)&&_(h,{elTag:"div",elClasses:["fc-timegrid-col-misc"]})))}renderFgSegs(e,n,r,i,c,d){let{props:f}=this;return f.forPrint?eA(e,f):this.renderPositionedFgSegs(e,n,r,i,c,d)}renderPositionedFgSegs(e,n,r,i,c,d){let{eventMaxStack:f,eventShortHeight:h,eventOrderStrict:p,eventMinHeight:b}=this.context.options,{date:y,slatCoords:x,eventSelection:v,todayRange:N,nowDate:j}=this.props,S=r||i||c,R=K1(e,y,x,b),{segPlacements:w,hiddenGroups:D}=Hz(e,R,p,f);return _(ot,null,this.renderHiddenGroups(D,e),w.map(C=>{let{seg:I,rect:L}=C,F=I.eventRange.instance.instanceId,Y=S||!!(!n[F]&&L),$=Bp(L&&L.span),M=!S&&L?this.computeSegHStyle(L):{left:0,right:0},H=!!L&&L.stackForward>0,ne=!!L&&L.span.end-L.span.start{let y=Bp(b.span),x=Vz(b.entries,n);return _(kz,{key:Pj(kS(x)),hiddenSegs:x,top:y.top,bottom:y.bottom,extraDateSpan:r,dateProfile:i,todayRange:c,nowDate:d,eventSelection:f,eventDrag:h,eventResize:p})}))}renderFillSegs(e,n){let{props:r,context:i}=this,d=K1(e,r.date,r.slatCoords,i.options.eventMinHeight).map((f,h)=>{let p=e[h];return _("div",{key:iS(p.eventRange),className:"fc-timegrid-bg-harness",style:Bp(f)},n==="bg-event"?_(DS,Object.assign({seg:p},zs(p,r.todayRange,r.nowDate))):OS(n))});return _(ot,null,d)}renderNowIndicator(e){let{slatCoords:n,date:r}=this.props;return n?e.map((i,c)=>_(Mm,{key:c,elClasses:["fc-timegrid-now-indicator-line"],elStyle:{top:n.computeDateTop(i.start,r)},isAxis:!1,date:r})):null}computeSegHStyle(e){let{isRtl:n,options:r}=this.context,i=r.slotEventOverlap,c=e.levelCoord,d=e.levelCoord+e.thickness,f,h;i&&(d=Math.min(1,c+(d-c)*2)),n?(f=1-d,h=c):(f=c,h=1-d);let p={zIndex:e.stackDepth+1,left:f*100+"%",right:h*100+"%"};return i&&!e.stackForward&&(p[n?"marginLeft":"marginRight"]=20),p}}function eA(t,{todayRange:e,nowDate:n,eventSelection:r,eventDrag:i,eventResize:c}){let d=(i?i.affectedInstances:null)||(c?c.affectedInstances:null)||{};return _(ot,null,t.map(f=>{let h=f.eventRange.instance.instanceId;return _("div",{key:h,style:{visibility:d[h]?"hidden":""}},_(JS,Object.assign({seg:f,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:h===r,isShort:!1},zs(f,e,n))))}))}function Bp(t){return t?{top:t.start,bottom:-t.end}:{top:"",bottom:""}}function Vz(t,e){return t.map(n=>e[n.index])}class qz extends et{constructor(){super(...arguments),this.splitFgEventSegs=Oe(no),this.splitBgEventSegs=Oe(no),this.splitBusinessHourSegs=Oe(no),this.splitNowIndicatorSegs=Oe(no),this.splitDateSelectionSegs=Oe(no),this.splitEventDrag=Oe(X1),this.splitEventResize=Oe(X1),this.rootElRef=en(),this.cellElRefs=new Ua}render(){let{props:e,context:n}=this,r=n.options.nowIndicator&&e.slatCoords&&e.slatCoords.safeComputeTop(e.nowDate),i=e.cells.length,c=this.splitFgEventSegs(e.fgEventSegs,i),d=this.splitBgEventSegs(e.bgEventSegs,i),f=this.splitBusinessHourSegs(e.businessHourSegs,i),h=this.splitNowIndicatorSegs(e.nowIndicatorSegs,i),p=this.splitDateSelectionSegs(e.dateSelectionSegs,i),b=this.splitEventDrag(e.eventDrag,i),y=this.splitEventResize(e.eventResize,i);return _("div",{className:"fc-timegrid-cols",ref:this.rootElRef},_("table",{role:"presentation",style:{minWidth:e.tableMinWidth,width:e.clientWidth}},e.tableColGroupNode,_("tbody",{role:"presentation"},_("tr",{role:"row"},e.axis&&_("td",{"aria-hidden":!0,className:"fc-timegrid-col fc-timegrid-axis"},_("div",{className:"fc-timegrid-col-frame"},_("div",{className:"fc-timegrid-now-indicator-container"},typeof r=="number"&&_(Mm,{elClasses:["fc-timegrid-now-indicator-arrow"],elStyle:{top:r},isAxis:!0,date:e.nowDate})))),e.cells.map((x,v)=>_(Fz,{key:x.key,elRef:this.cellElRefs.createRef(x.key),dateProfile:e.dateProfile,date:x.date,nowDate:e.nowDate,todayRange:e.todayRange,extraRenderProps:x.extraRenderProps,extraDataAttrs:x.extraDataAttrs,extraClassNames:x.extraClassNames,extraDateSpan:x.extraDateSpan,fgEventSegs:c[v],bgEventSegs:d[v],businessHourSegs:f[v],nowIndicatorSegs:h[v],dateSelectionSegs:p[v],eventDrag:b[v],eventResize:y[v],slatCoords:e.slatCoords,eventSelection:e.eventSelection,forPrint:e.forPrint}))))))}componentDidMount(){this.updateCoords()}componentDidUpdate(){this.updateCoords()}updateCoords(){let{props:e}=this;e.onColCoords&&e.clientWidth!==null&&e.onColCoords(new ql(this.rootElRef.current,$z(this.cellElRefs.currentMap,e.cells),!0,!1))}}function $z(t,e){return e.map(n=>t[n.key])}class Yz extends ma{constructor(){super(...arguments),this.processSlotOptions=Oe(Qz),this.state={slatCoords:null},this.handleRootEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e,isHitComboAllowed:this.props.isHitComboAllowed}):this.context.unregisterInteractiveComponent(this)},this.handleScrollRequest=e=>{let{onScrollTopRequest:n}=this.props,{slatCoords:r}=this.state;if(n&&r){if(e.time){let i=r.computeTimeTop(e.time);i=Math.ceil(i),i&&(i+=1),n(i)}return!0}return!1},this.handleColCoords=e=>{this.colCoords=e},this.handleSlatCoords=e=>{this.setState({slatCoords:e}),this.props.onSlatCoords&&this.props.onSlatCoords(e)}}render(){let{props:e,state:n}=this;return _("div",{className:"fc-timegrid-body",ref:this.handleRootEl,style:{width:e.clientWidth,minWidth:e.tableMinWidth}},_(Rz,{axis:e.axis,dateProfile:e.dateProfile,slatMetas:e.slatMetas,clientWidth:e.clientWidth,minHeight:e.expandRows?e.clientHeight:"",tableMinWidth:e.tableMinWidth,tableColGroupNode:e.axis?e.tableColGroupNode:null,onCoords:this.handleSlatCoords}),_(qz,{cells:e.cells,axis:e.axis,dateProfile:e.dateProfile,businessHourSegs:e.businessHourSegs,bgEventSegs:e.bgEventSegs,fgEventSegs:e.fgEventSegs,dateSelectionSegs:e.dateSelectionSegs,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,todayRange:e.todayRange,nowDate:e.nowDate,nowIndicatorSegs:e.nowIndicatorSegs,clientWidth:e.clientWidth,tableMinWidth:e.tableMinWidth,tableColGroupNode:e.tableColGroupNode,slatCoords:n.slatCoords,onColCoords:this.handleColCoords,forPrint:e.forPrint}))}componentDidMount(){this.scrollResponder=this.context.createScrollResponder(this.handleScrollRequest)}componentDidUpdate(e){this.scrollResponder.update(e.dateProfile!==this.props.dateProfile)}componentWillUnmount(){this.scrollResponder.detach()}queryHit(e,n){let{dateEnv:r,options:i}=this.context,{colCoords:c}=this,{dateProfile:d}=this.props,{slatCoords:f}=this.state,{snapDuration:h,snapsPerSlot:p}=this.processSlotOptions(this.props.slotDuration,i.snapDuration),b=c.leftToIndex(e),y=f.positions.topToIndex(n);if(b!=null&&y!=null){let x=this.props.cells[b],v=f.positions.tops[y],N=f.positions.getHeight(y),j=(n-v)/N,S=Math.floor(j*p),R=y*p+S,w=this.props.cells[b].date,D=ng(d.slotMinTime,MI(h,R)),C=r.add(w,D),I=r.add(C,h);return{dateProfile:d,dateSpan:Object.assign({range:{start:C,end:I},allDay:!1},x.extraDateSpan),dayEl:c.els[b],rect:{left:c.lefts[b],right:c.rights[b],top:v,bottom:v+N},layer:0}}return null}}function Qz(t,e){let n=e||t,r=um(t,n);return r===null&&(n=t,r=1),{snapDuration:n,snapsPerSlot:r}}class Wz extends ES{sliceRange(e,n){let r=[];for(let i=0;i_(Yz,Object.assign({ref:this.timeColsRef},this.slicer.sliceProps(e,r,null,n,f),{forPrint:e.forPrint,axis:e.axis,dateProfile:r,slatMetas:e.slatMetas,slotDuration:e.slotDuration,cells:i.cells[0],tableColGroupNode:e.tableColGroupNode,tableMinWidth:e.tableMinWidth,clientWidth:e.clientWidth,clientHeight:e.clientHeight,expandRows:e.expandRows,nowDate:h,nowIndicatorSegs:c&&this.slicer.sliceNowDate(h,r,d,n,f),todayRange:p,onScrollTopRequest:e.onScrollTopRequest,onSlatCoords:e.onSlatCoords})))}}function Zz(t,e,n){let r=[];for(let i of t.headerDates)r.push({start:n.add(i,e.slotMinTime),end:n.add(i,e.slotMaxTime)});return r}const J1=[{hours:1},{minutes:30},{minutes:15},{seconds:30},{seconds:15}];function Kz(t,e,n,r,i){let c=new Date(0),d=t,f=Ve(0),h=n||Jz(r),p=[];for(;na(d)=0;e-=1)if(n=Ve(J1[e]),r=um(n,t),r!==null&&r>1)return n;return t}class eP extends wz{constructor(){super(...arguments),this.buildTimeColsModel=Oe(tP),this.buildSlatMetas=Oe(Kz)}render(){let{options:e,dateEnv:n,dateProfileGenerator:r}=this.context,{props:i}=this,{dateProfile:c}=i,d=this.buildTimeColsModel(c,r),f=this.allDaySplitter.splitProps(i),h=this.buildSlatMetas(c.slotMinTime,c.slotMaxTime,e.slotLabelInterval,e.slotDuration,n),{dayMinWidth:p}=e,b=!p,y=p,x=e.dayHeaders&&_(yS,{dates:d.headerDates,dateProfile:c,datesRepDistinctDays:!0,renderIntro:b?this.renderHeadAxis:null}),v=e.allDaySlot!==!1&&(j=>_(ZS,Object.assign({},f.allDay,{dateProfile:c,dayTableModel:d,nextDayThreshold:e.nextDayThreshold,tableMinWidth:j.tableMinWidth,colGroupNode:j.tableColGroupNode,renderRowIntro:b?this.renderTableRowAxis:null,showWeekNumbers:!1,expandRows:!1,headerAlignElRef:this.headerElRef,clientWidth:j.clientWidth,clientHeight:j.clientHeight,forPrint:i.forPrint},this.getAllDayMaxEventProps()))),N=j=>_(Xz,Object.assign({},f.timed,{dayTableModel:d,dateProfile:c,axis:b,slotDuration:e.slotDuration,slatMetas:h,forPrint:i.forPrint,tableColGroupNode:j.tableColGroupNode,tableMinWidth:j.tableMinWidth,clientWidth:j.clientWidth,clientHeight:j.clientHeight,onSlatCoords:this.handleSlatCoords,expandRows:j.expandRows,onScrollTopRequest:this.handleScrollTopRequest}));return y?this.renderHScrollLayout(x,v,N,d.colCnt,p,h,this.state.slatCoords):this.renderSimpleLayout(x,v,N)}}function tP(t,e){let n=new vS(t.renderRange,e);return new NS(n,!1)}var nP='.fc-v-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-v-event .fc-event-main{color:var(--fc-event-text-color);height:100%}.fc-v-event .fc-event-main-frame{display:flex;flex-direction:column;height:100%}.fc-v-event .fc-event-time{flex-grow:0;flex-shrink:0;max-height:100%;overflow:hidden}.fc-v-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-height:0}.fc-v-event .fc-event-title{bottom:0;max-height:100%;overflow:hidden;top:0}.fc-v-event:not(.fc-event-start){border-top-left-radius:0;border-top-right-radius:0;border-top-width:0}.fc-v-event:not(.fc-event-end){border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-width:0}.fc-v-event.fc-event-selected:before{left:-10px;right:-10px}.fc-v-event .fc-event-resizer-start{cursor:n-resize}.fc-v-event .fc-event-resizer-end{cursor:s-resize}.fc-v-event:not(.fc-event-selected) .fc-event-resizer{height:var(--fc-event-resizer-thickness);left:0;right:0}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-start{top:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer{left:50%;margin-left:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-start{top:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc .fc-timegrid .fc-daygrid-body{z-index:2}.fc .fc-timegrid-divider{padding:0 0 2px}.fc .fc-timegrid-body{min-height:100%;position:relative;z-index:1}.fc .fc-timegrid-axis-chunk{position:relative}.fc .fc-timegrid-axis-chunk>table,.fc .fc-timegrid-slots{position:relative;z-index:1}.fc .fc-timegrid-slot{border-bottom:0;height:1.5em}.fc .fc-timegrid-slot:empty:before{content:"\\00a0"}.fc .fc-timegrid-slot-minor{border-top-style:dotted}.fc .fc-timegrid-slot-label-cushion{display:inline-block;white-space:nowrap}.fc .fc-timegrid-slot-label{vertical-align:middle}.fc .fc-timegrid-axis-cushion,.fc .fc-timegrid-slot-label-cushion{padding:0 4px}.fc .fc-timegrid-axis-frame-liquid{height:100%}.fc .fc-timegrid-axis-frame{align-items:center;display:flex;justify-content:flex-end;overflow:hidden}.fc .fc-timegrid-axis-cushion{flex-shrink:0;max-width:60px}.fc-direction-ltr .fc-timegrid-slot-label-frame{text-align:right}.fc-direction-rtl .fc-timegrid-slot-label-frame{text-align:left}.fc-liquid-hack .fc-timegrid-axis-frame-liquid{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-timegrid-col-frame{min-height:100%;position:relative}.fc-media-screen.fc-liquid-hack .fc-timegrid-col-frame{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols{bottom:0;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols>table{height:100%}.fc-media-screen .fc-timegrid-col-bg,.fc-media-screen .fc-timegrid-col-events,.fc-media-screen .fc-timegrid-now-indicator-container{left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col-bg{z-index:2}.fc .fc-timegrid-col-bg .fc-non-business{z-index:1}.fc .fc-timegrid-col-bg .fc-bg-event{z-index:2}.fc .fc-timegrid-col-bg .fc-highlight{z-index:3}.fc .fc-timegrid-bg-harness{left:0;position:absolute;right:0}.fc .fc-timegrid-col-events{z-index:3}.fc .fc-timegrid-now-indicator-container{bottom:0;overflow:hidden}.fc-direction-ltr .fc-timegrid-col-events{margin:0 2.5% 0 2px}.fc-direction-rtl .fc-timegrid-col-events{margin:0 2px 0 2.5%}.fc-timegrid-event-harness{position:absolute}.fc-timegrid-event-harness>.fc-timegrid-event{bottom:0;left:0;position:absolute;right:0;top:0}.fc-timegrid-event-harness-inset .fc-timegrid-event,.fc-timegrid-event.fc-event-mirror,.fc-timegrid-more-link{box-shadow:0 0 0 1px var(--fc-page-bg-color)}.fc-timegrid-event,.fc-timegrid-more-link{border-radius:3px;font-size:var(--fc-small-font-size)}.fc-timegrid-event{margin-bottom:1px}.fc-timegrid-event .fc-event-main{padding:1px 1px 0}.fc-timegrid-event .fc-event-time{font-size:var(--fc-small-font-size);margin-bottom:1px;white-space:nowrap}.fc-timegrid-event-short .fc-event-main-frame{flex-direction:row;overflow:hidden}.fc-timegrid-event-short .fc-event-time:after{content:"\\00a0-\\00a0"}.fc-timegrid-event-short .fc-event-title{font-size:var(--fc-small-font-size)}.fc-timegrid-more-link{background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;margin-bottom:1px;position:absolute;z-index:9999}.fc-timegrid-more-link-inner{padding:3px 2px;top:0}.fc-direction-ltr .fc-timegrid-more-link{right:0}.fc-direction-rtl .fc-timegrid-more-link{left:0}.fc .fc-timegrid-now-indicator-arrow,.fc .fc-timegrid-now-indicator-line{pointer-events:none}.fc .fc-timegrid-now-indicator-line{border-color:var(--fc-now-indicator-color);border-style:solid;border-width:1px 0 0;left:0;position:absolute;right:0;z-index:4}.fc .fc-timegrid-now-indicator-arrow{border-color:var(--fc-now-indicator-color);border-style:solid;margin-top:-5px;position:absolute;z-index:4}.fc-direction-ltr .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 0 5px 6px;left:0}.fc-direction-rtl .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 6px 5px 0;right:0}';lm(nP);const aP={allDaySlot:Boolean};var sP=Wa({name:"@fullcalendar/timegrid",initialView:"timeGridWeek",optionRefiners:aP,views:{timeGrid:{component:eP,usesMinMaxTime:!0,allDaySlot:!0,slotDuration:"00:30:00",slotEventOverlap:!0},timeGridDay:{type:"timeGrid",duration:{days:1}},timeGridWeek:{type:"timeGrid",duration:{weeks:1}}}});Rm.touchMouseIgnoreWait=500;let fg=0,fu=0,hg=!1;class tA{constructor(e){this.subjectEl=null,this.selector="",this.handleSelector="",this.shouldIgnoreMove=!1,this.shouldWatchScroll=!0,this.isDragging=!1,this.isTouchDragging=!1,this.wasTouchScroll=!1,this.handleMouseDown=n=>{if(!this.shouldIgnoreMouse()&&rP(n)&&this.tryStart(n)){let r=this.createEventFromMouse(n,!0);this.emitter.trigger("pointerdown",r),this.initScrollWatch(r),this.shouldIgnoreMove||document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}},this.handleMouseMove=n=>{let r=this.createEventFromMouse(n);this.recordCoords(r),this.emitter.trigger("pointermove",r)},this.handleMouseUp=n=>{document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.emitter.trigger("pointerup",this.createEventFromMouse(n)),this.cleanup()},this.handleTouchStart=n=>{if(this.tryStart(n)){this.isTouchDragging=!0;let r=this.createEventFromTouch(n,!0);this.emitter.trigger("pointerdown",r),this.initScrollWatch(r);let i=n.target;this.shouldIgnoreMove||i.addEventListener("touchmove",this.handleTouchMove),i.addEventListener("touchend",this.handleTouchEnd),i.addEventListener("touchcancel",this.handleTouchEnd),window.addEventListener("scroll",this.handleTouchScroll,!0)}},this.handleTouchMove=n=>{let r=this.createEventFromTouch(n);this.recordCoords(r),this.emitter.trigger("pointermove",r)},this.handleTouchEnd=n=>{if(this.isDragging){let r=n.target;r.removeEventListener("touchmove",this.handleTouchMove),r.removeEventListener("touchend",this.handleTouchEnd),r.removeEventListener("touchcancel",this.handleTouchEnd),window.removeEventListener("scroll",this.handleTouchScroll,!0),this.emitter.trigger("pointerup",this.createEventFromTouch(n)),this.cleanup(),this.isTouchDragging=!1,lP()}},this.handleTouchScroll=()=>{this.wasTouchScroll=!0},this.handleScroll=n=>{if(!this.shouldIgnoreMove){let r=window.scrollX-this.prevScrollX+this.prevPageX,i=window.scrollY-this.prevScrollY+this.prevPageY;this.emitter.trigger("pointermove",{origEvent:n,isTouch:this.isTouchDragging,subjectEl:this.subjectEl,pageX:r,pageY:i,deltaX:r-this.origPageX,deltaY:i-this.origPageY})}},this.containerEl=e,this.emitter=new _u,e.addEventListener("mousedown",this.handleMouseDown),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),iP()}destroy(){this.containerEl.removeEventListener("mousedown",this.handleMouseDown),this.containerEl.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),oP()}tryStart(e){let n=this.querySubjectEl(e),r=e.target;return n&&(!this.handleSelector||Yt(r,this.handleSelector))?(this.subjectEl=n,this.isDragging=!0,this.wasTouchScroll=!1,!0):!1}cleanup(){hg=!1,this.isDragging=!1,this.subjectEl=null,this.destroyScrollWatch()}querySubjectEl(e){return this.selector?Yt(e.target,this.selector):this.containerEl}shouldIgnoreMouse(){return fg||this.isTouchDragging}cancelTouchScroll(){this.isDragging&&(hg=!0)}initScrollWatch(e){this.shouldWatchScroll&&(this.recordCoords(e),window.addEventListener("scroll",this.handleScroll,!0))}recordCoords(e){this.shouldWatchScroll&&(this.prevPageX=e.pageX,this.prevPageY=e.pageY,this.prevScrollX=window.scrollX,this.prevScrollY=window.scrollY)}destroyScrollWatch(){this.shouldWatchScroll&&window.removeEventListener("scroll",this.handleScroll,!0)}createEventFromMouse(e,n){let r=0,i=0;return n?(this.origPageX=e.pageX,this.origPageY=e.pageY):(r=e.pageX-this.origPageX,i=e.pageY-this.origPageY),{origEvent:e,isTouch:!1,subjectEl:this.subjectEl,pageX:e.pageX,pageY:e.pageY,deltaX:r,deltaY:i}}createEventFromTouch(e,n){let r=e.touches,i,c,d=0,f=0;return r&&r.length?(i=r[0].pageX,c=r[0].pageY):(i=e.pageX,c=e.pageY),n?(this.origPageX=i,this.origPageY=c):(d=i-this.origPageX,f=c-this.origPageY),{origEvent:e,isTouch:!0,subjectEl:this.subjectEl,pageX:i,pageY:c,deltaX:d,deltaY:f}}}function rP(t){return t.button===0&&!t.ctrlKey}function lP(){fg+=1,setTimeout(()=>{fg-=1},Rm.touchMouseIgnoreWait)}function iP(){fu+=1,fu===1&&window.addEventListener("touchmove",nA,{passive:!1})}function oP(){fu-=1,fu||window.removeEventListener("touchmove",nA,{passive:!1})}function nA(t){hg&&t.preventDefault()}class cP{constructor(){this.isVisible=!1,this.sourceEl=null,this.mirrorEl=null,this.sourceElRect=null,this.parentNode=document.body,this.zIndex=9999,this.revertDuration=0}start(e,n,r){this.sourceEl=e,this.sourceElRect=this.sourceEl.getBoundingClientRect(),this.origScreenX=n-window.scrollX,this.origScreenY=r-window.scrollY,this.deltaX=0,this.deltaY=0,this.updateElPosition()}handleMove(e,n){this.deltaX=e-window.scrollX-this.origScreenX,this.deltaY=n-window.scrollY-this.origScreenY,this.updateElPosition()}setIsVisible(e){e?this.isVisible||(this.mirrorEl&&(this.mirrorEl.style.display=""),this.isVisible=e,this.updateElPosition()):this.isVisible&&(this.mirrorEl&&(this.mirrorEl.style.display="none"),this.isVisible=e)}stop(e,n){let r=()=>{this.cleanup(),n()};e&&this.mirrorEl&&this.isVisible&&this.revertDuration&&(this.deltaX||this.deltaY)?this.doRevertAnimation(r,this.revertDuration):setTimeout(r,0)}doRevertAnimation(e,n){let r=this.mirrorEl,i=this.sourceEl.getBoundingClientRect();r.style.transition="top "+n+"ms,left "+n+"ms",fo(r,{left:i.left,top:i.top}),yI(r,()=>{r.style.transition="",e()})}cleanup(){this.mirrorEl&&(om(this.mirrorEl),this.mirrorEl=null),this.sourceEl=null}updateElPosition(){this.sourceEl&&this.isVisible&&fo(this.getMirrorEl(),{left:this.sourceElRect.left+this.deltaX,top:this.sourceElRect.top+this.deltaY})}getMirrorEl(){let e=this.sourceElRect,n=this.mirrorEl;return n||(n=this.mirrorEl=this.sourceEl.cloneNode(!0),n.style.userSelect="none",n.style.webkitUserSelect="none",n.style.pointerEvents="none",n.classList.add("fc-event-dragging"),fo(n,{position:"fixed",zIndex:this.zIndex,visibility:"",boxSizing:"border-box",width:e.right-e.left,height:e.bottom-e.top,right:"auto",bottom:"auto",margin:0}),this.parentNode.appendChild(n)),n}}class aA extends Dm{constructor(e,n){super(),this.handleScroll=()=>{this.scrollTop=this.scrollController.getScrollTop(),this.scrollLeft=this.scrollController.getScrollLeft(),this.handleScrollChange()},this.scrollController=e,this.doesListening=n,this.scrollTop=this.origScrollTop=e.getScrollTop(),this.scrollLeft=this.origScrollLeft=e.getScrollLeft(),this.scrollWidth=e.getScrollWidth(),this.scrollHeight=e.getScrollHeight(),this.clientWidth=e.getClientWidth(),this.clientHeight=e.getClientHeight(),this.clientRect=this.computeClientRect(),this.doesListening&&this.getEventTarget().addEventListener("scroll",this.handleScroll)}destroy(){this.doesListening&&this.getEventTarget().removeEventListener("scroll",this.handleScroll)}getScrollTop(){return this.scrollTop}getScrollLeft(){return this.scrollLeft}setScrollTop(e){this.scrollController.setScrollTop(e),this.doesListening||(this.scrollTop=Math.max(Math.min(e,this.getMaxScrollTop()),0),this.handleScrollChange())}setScrollLeft(e){this.scrollController.setScrollLeft(e),this.doesListening||(this.scrollLeft=Math.max(Math.min(e,this.getMaxScrollLeft()),0),this.handleScrollChange())}getClientWidth(){return this.clientWidth}getClientHeight(){return this.clientHeight}getScrollWidth(){return this.scrollWidth}getScrollHeight(){return this.scrollHeight}handleScrollChange(){}}class sA extends aA{constructor(e,n){super(new F3(e),n)}getEventTarget(){return this.scrollController.el}computeClientRect(){return H3(this.scrollController.el)}}class dP extends aA{constructor(e){super(new V3,e)}getEventTarget(){return window}computeClientRect(){return{left:this.scrollLeft,right:this.scrollLeft+this.clientWidth,top:this.scrollTop,bottom:this.scrollTop+this.clientHeight}}handleScrollChange(){this.clientRect=this.computeClientRect()}}const eN=typeof performance=="function"?performance.now:Date.now;class uP{constructor(){this.isEnabled=!0,this.scrollQuery=[window,".fc-scroller"],this.edgeThreshold=50,this.maxVelocity=300,this.pointerScreenX=null,this.pointerScreenY=null,this.isAnimating=!1,this.scrollCaches=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.animate=()=>{if(this.isAnimating){let e=this.computeBestEdge(this.pointerScreenX+window.scrollX,this.pointerScreenY+window.scrollY);if(e){let n=eN();this.handleSide(e,(n-this.msSinceRequest)/1e3),this.requestAnimation(n)}else this.isAnimating=!1}}}start(e,n,r){this.isEnabled&&(this.scrollCaches=this.buildCaches(r),this.pointerScreenX=null,this.pointerScreenY=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.handleMove(e,n))}handleMove(e,n){if(this.isEnabled){let r=e-window.scrollX,i=n-window.scrollY,c=this.pointerScreenY===null?0:i-this.pointerScreenY,d=this.pointerScreenX===null?0:r-this.pointerScreenX;c<0?this.everMovedUp=!0:c>0&&(this.everMovedDown=!0),d<0?this.everMovedLeft=!0:d>0&&(this.everMovedRight=!0),this.pointerScreenX=r,this.pointerScreenY=i,this.isAnimating||(this.isAnimating=!0,this.requestAnimation(eN()))}}stop(){if(this.isEnabled){this.isAnimating=!1;for(let e of this.scrollCaches)e.destroy();this.scrollCaches=null}}requestAnimation(e){this.msSinceRequest=e,requestAnimationFrame(this.animate)}handleSide(e,n){let{scrollCache:r}=e,{edgeThreshold:i}=this,c=i-e.distance,d=c*c/(i*i)*this.maxVelocity*n,f=1;switch(e.name){case"left":f=-1;case"right":r.setScrollLeft(r.getScrollLeft()+d*f);break;case"top":f=-1;case"bottom":r.setScrollTop(r.getScrollTop()+d*f);break}}computeBestEdge(e,n){let{edgeThreshold:r}=this,i=null,c=this.scrollCaches||[];for(let d of c){let f=d.clientRect,h=e-f.left,p=f.right-e,b=n-f.top,y=f.bottom-n;h>=0&&p>=0&&b>=0&&y>=0&&(b<=r&&this.everMovedUp&&d.canScrollUp()&&(!i||i.distance>b)&&(i={scrollCache:d,name:"top",distance:b}),y<=r&&this.everMovedDown&&d.canScrollDown()&&(!i||i.distance>y)&&(i={scrollCache:d,name:"bottom",distance:y}),h<=r&&this.everMovedLeft&&d.canScrollLeft()&&(!i||i.distance>h)&&(i={scrollCache:d,name:"left",distance:h}),p<=r&&this.everMovedRight&&d.canScrollRight()&&(!i||i.distance>p)&&(i={scrollCache:d,name:"right",distance:p}))}return i}buildCaches(e){return this.queryScrollEls(e).map(n=>n===window?new dP(!1):new sA(n,!1))}queryScrollEls(e){let n=[];for(let r of this.scrollQuery)typeof r=="object"?n.push(r):n.push(...Array.prototype.slice.call(e.getRootNode().querySelectorAll(r)));return n}}class Vo extends Y3{constructor(e,n){super(e),this.containerEl=e,this.delay=null,this.minDistance=0,this.touchScrollAllowed=!0,this.mirrorNeedsRevert=!1,this.isInteracting=!1,this.isDragging=!1,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,this.delayTimeoutId=null,this.onPointerDown=i=>{this.isDragging||(this.isInteracting=!0,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,vI(document.body),EI(document.body),i.isTouch||i.origEvent.preventDefault(),this.emitter.trigger("pointerdown",i),this.isInteracting&&!this.pointer.shouldIgnoreMove&&(this.mirror.setIsVisible(!1),this.mirror.start(i.subjectEl,i.pageX,i.pageY),this.startDelay(i),this.minDistance||this.handleDistanceSurpassed(i)))},this.onPointerMove=i=>{if(this.isInteracting){if(this.emitter.trigger("pointermove",i),!this.isDistanceSurpassed){let c=this.minDistance,d,{deltaX:f,deltaY:h}=i;d=f*f+h*h,d>=c*c&&this.handleDistanceSurpassed(i)}this.isDragging&&(i.origEvent.type!=="scroll"&&(this.mirror.handleMove(i.pageX,i.pageY),this.autoScroller.handleMove(i.pageX,i.pageY)),this.emitter.trigger("dragmove",i))}},this.onPointerUp=i=>{this.isInteracting&&(this.isInteracting=!1,NI(document.body),jI(document.body),this.emitter.trigger("pointerup",i),this.isDragging&&(this.autoScroller.stop(),this.tryStopDrag(i)),this.delayTimeoutId&&(clearTimeout(this.delayTimeoutId),this.delayTimeoutId=null))};let r=this.pointer=new tA(e);r.emitter.on("pointerdown",this.onPointerDown),r.emitter.on("pointermove",this.onPointerMove),r.emitter.on("pointerup",this.onPointerUp),n&&(r.selector=n),this.mirror=new cP,this.autoScroller=new uP}destroy(){this.pointer.destroy(),this.onPointerUp({})}startDelay(e){typeof this.delay=="number"?this.delayTimeoutId=setTimeout(()=>{this.delayTimeoutId=null,this.handleDelayEnd(e)},this.delay):this.handleDelayEnd(e)}handleDelayEnd(e){this.isDelayEnded=!0,this.tryStartDrag(e)}handleDistanceSurpassed(e){this.isDistanceSurpassed=!0,this.tryStartDrag(e)}tryStartDrag(e){this.isDelayEnded&&this.isDistanceSurpassed&&(!this.pointer.wasTouchScroll||this.touchScrollAllowed)&&(this.isDragging=!0,this.mirrorNeedsRevert=!1,this.autoScroller.start(e.pageX,e.pageY,this.containerEl),this.emitter.trigger("dragstart",e),this.touchScrollAllowed===!1&&this.pointer.cancelTouchScroll())}tryStopDrag(e){this.mirror.stop(this.mirrorNeedsRevert,this.stopDrag.bind(this,e))}stopDrag(e){this.isDragging=!1,this.emitter.trigger("dragend",e)}setIgnoreMove(e){this.pointer.shouldIgnoreMove=e}setMirrorIsVisible(e){this.mirror.setIsVisible(e)}setMirrorNeedsRevert(e){this.mirrorNeedsRevert=e}setAutoScrollEnabled(e){this.autoScroller.isEnabled=e}}class fP{constructor(e){this.el=e,this.origRect=Cm(e),this.scrollCaches=gS(e).map(n=>new sA(n,!0))}destroy(){for(let e of this.scrollCaches)e.destroy()}computeLeft(){let e=this.origRect.left;for(let n of this.scrollCaches)e+=n.origScrollLeft-n.getScrollLeft();return e}computeTop(){let e=this.origRect.top;for(let n of this.scrollCaches)e+=n.origScrollTop-n.getScrollTop();return e}isWithinClipping(e,n){let r={left:e,top:n};for(let i of this.scrollCaches)if(!hP(i.getEventTarget())&&!D3(r,i.clientRect))return!1;return!0}}function hP(t){let e=t.tagName;return e==="HTML"||e==="BODY"}class Mu{constructor(e,n){this.useSubjectCenter=!1,this.requireInitial=!0,this.disablePointCheck=!1,this.initialHit=null,this.movingHit=null,this.finalHit=null,this.handlePointerDown=r=>{let{dragging:i}=this;this.initialHit=null,this.movingHit=null,this.finalHit=null,this.prepareHits(),this.processFirstCoord(r),this.initialHit||!this.requireInitial?(i.setIgnoreMove(!1),this.emitter.trigger("pointerdown",r)):i.setIgnoreMove(!0)},this.handleDragStart=r=>{this.emitter.trigger("dragstart",r),this.handleMove(r,!0)},this.handleDragMove=r=>{this.emitter.trigger("dragmove",r),this.handleMove(r)},this.handlePointerUp=r=>{this.releaseHits(),this.emitter.trigger("pointerup",r)},this.handleDragEnd=r=>{this.movingHit&&this.emitter.trigger("hitupdate",null,!0,r),this.finalHit=this.movingHit,this.movingHit=null,this.emitter.trigger("dragend",r)},this.droppableStore=n,e.emitter.on("pointerdown",this.handlePointerDown),e.emitter.on("dragstart",this.handleDragStart),e.emitter.on("dragmove",this.handleDragMove),e.emitter.on("pointerup",this.handlePointerUp),e.emitter.on("dragend",this.handleDragEnd),this.dragging=e,this.emitter=new _u}processFirstCoord(e){let n={left:e.pageX,top:e.pageY},r=n,i=e.subjectEl,c;i instanceof HTMLElement&&(c=Cm(i),r=O3(r,c));let d=this.initialHit=this.queryHitForOffset(r.left,r.top);if(d){if(this.useSubjectCenter&&c){let f=fS(c,d.rect);f&&(r=R3(f))}this.coordAdjust=T3(r,n)}else this.coordAdjust={left:0,top:0}}handleMove(e,n){let r=this.queryHitForOffset(e.pageX+this.coordAdjust.left,e.pageY+this.coordAdjust.top);(n||!Iu(this.movingHit,r))&&(this.movingHit=r,this.emitter.trigger("hitupdate",r,!1,e))}prepareHits(){this.offsetTrackers=Va(this.droppableStore,e=>(e.component.prepareHits(),new fP(e.el)))}releaseHits(){let{offsetTrackers:e}=this;for(let n in e)e[n].destroy();this.offsetTrackers={}}queryHitForOffset(e,n){let{droppableStore:r,offsetTrackers:i}=this,c=null;for(let d in r){let f=r[d].component,h=i[d];if(h&&h.isWithinClipping(e,n)){let p=h.computeLeft(),b=h.computeTop(),y=e-p,x=n-b,{origRect:v}=h,N=v.right-v.left,j=v.bottom-v.top;if(y>=0&&y=0&&xc.layer)&&(S.componentId=d,S.context=f.context,S.rect.left+=p,S.rect.right+=p,S.rect.top+=b,S.rect.bottom+=b,c=S)}}}return c}}function Iu(t,e){return!t&&!e?!0:!!t!=!!e?!1:x3(t.dateSpan,e.dateSpan)}function rA(t,e){let n={};for(let r of e.pluginHooks.datePointTransforms)Object.assign(n,r(t,e));return Object.assign(n,pP(t,e.dateEnv)),n}function pP(t,e){return{date:e.toDate(t.range.start),dateStr:e.formatIso(t.range.start,{omitTime:t.allDay}),allDay:t.allDay}}class gP extends ni{constructor(e){super(e),this.handlePointerDown=r=>{let{dragging:i}=this,c=r.origEvent.target;i.setIgnoreMove(!this.component.isValidDateDownEl(c))},this.handleDragEnd=r=>{let{component:i}=this,{pointer:c}=this.dragging;if(!c.wasTouchScroll){let{initialHit:d,finalHit:f}=this.hitDragging;if(d&&f&&Iu(d,f)){let{context:h}=i,p=Object.assign(Object.assign({},rA(d.dateSpan,h)),{dayEl:d.dayEl,jsEvent:r.origEvent,view:h.viewApi||h.calendarApi.view});h.emitter.trigger("dateClick",p)}}},this.dragging=new Vo(e.el),this.dragging.autoScroller.isEnabled=!1;let n=this.hitDragging=new Mu(this.dragging,Am(e));n.emitter.on("pointerdown",this.handlePointerDown),n.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}}class mP extends ni{constructor(e){super(e),this.dragSelection=null,this.handlePointerDown=d=>{let{component:f,dragging:h}=this,{options:p}=f.context,b=p.selectable&&f.isValidDateDownEl(d.origEvent.target);h.setIgnoreMove(!b),h.delay=d.isTouch?xP(f):null},this.handleDragStart=d=>{this.component.context.calendarApi.unselect(d)},this.handleHitUpdate=(d,f)=>{let{context:h}=this.component,p=null,b=!1;if(d){let y=this.hitDragging.initialHit;d.componentId===y.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(y,d)||(p=bP(y,d,h.pluginHooks.dateSelectionTransformers)),(!p||!J3(p,d.dateProfile,h))&&(b=!0,p=null)}p?h.dispatch({type:"SELECT_DATES",selection:p}):f||h.dispatch({type:"UNSELECT_DATES"}),b?cm():dm(),f||(this.dragSelection=p)},this.handlePointerUp=d=>{this.dragSelection&&(nS(this.dragSelection,d,this.component.context),this.dragSelection=null)};let{component:n}=e,{options:r}=n.context,i=this.dragging=new Vo(e.el);i.touchScrollAllowed=!1,i.minDistance=r.selectMinDistance||0,i.autoScroller.isEnabled=r.dragScroll;let c=this.hitDragging=new Mu(this.dragging,Am(e));c.emitter.on("pointerdown",this.handlePointerDown),c.emitter.on("dragstart",this.handleDragStart),c.emitter.on("hitupdate",this.handleHitUpdate),c.emitter.on("pointerup",this.handlePointerUp)}destroy(){this.dragging.destroy()}}function xP(t){let{options:e}=t.context,n=e.selectLongPressDelay;return n==null&&(n=e.longPressDelay),n}function bP(t,e,n){let r=t.dateSpan,i=e.dateSpan,c=[r.range.start,r.range.end,i.range.start,i.range.end];c.sort(DI);let d={};for(let f of n){let h=f(t,e);if(h===!1)return null;h&&Object.assign(d,h)}return d.range={start:c[0],end:c[3]},d.allDay=r.allDay,d}class qo extends ni{constructor(e){super(e),this.subjectEl=null,this.subjectSeg=null,this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=d=>{let f=d.origEvent.target,{component:h,dragging:p}=this,{mirror:b}=p,{options:y}=h.context,x=h.context;this.subjectEl=d.subjectEl;let v=this.subjectSeg=Vl(d.subjectEl),j=(this.eventRange=v.eventRange).instance.instanceId;this.relevantEvents=Nm(x.getCurrentData().eventStore,j),p.minDistance=d.isTouch?0:y.eventDragMinDistance,p.delay=d.isTouch&&j!==h.props.eventSelection?vP(h):null,y.fixedMirrorParent?b.parentNode=y.fixedMirrorParent:b.parentNode=Yt(f,".fc"),b.revertDuration=y.dragRevertDuration;let S=h.isValidSegDownEl(f)&&!Yt(f,".fc-event-resizer");p.setIgnoreMove(!S),this.isDragging=S&&d.subjectEl.classList.contains("fc-event-draggable")},this.handleDragStart=d=>{let f=this.component.context,h=this.eventRange,p=h.instance.instanceId;d.isTouch?p!==this.component.props.eventSelection&&f.dispatch({type:"SELECT_EVENT",eventInstanceId:p}):f.dispatch({type:"UNSELECT_EVENT"}),this.isDragging&&(f.calendarApi.unselect(d),f.emitter.trigger("eventDragStart",{el:this.subjectEl,event:new pt(f,h.def,h.instance),jsEvent:d.origEvent,view:f.viewApi}))},this.handleHitUpdate=(d,f)=>{if(!this.isDragging)return;let h=this.relevantEvents,p=this.hitDragging.initialHit,b=this.component.context,y=null,x=null,v=null,N=!1,j={affectedEvents:h,mutatedEvents:Rn(),isEvent:!0};if(d){y=d.context;let S=y.options;b===y||S.editable&&S.droppable?(x=yP(p,d,this.eventRange.instance.range.start,y.getCurrentData().pluginHooks.eventDragMutationMassagers),x&&(v=Sm(h,y.getCurrentData().eventUiBases,x,y),j.mutatedEvents=v,jS(j,d.dateProfile,y)||(N=!0,x=null,v=null,j.mutatedEvents=Rn()))):y=null}this.displayDrag(y,j),N?cm():dm(),f||(b===y&&Iu(p,d)&&(x=null),this.dragging.setMirrorNeedsRevert(!x),this.dragging.setMirrorIsVisible(!d||!this.subjectEl.getRootNode().querySelector(".fc-event-mirror")),this.receivingContext=y,this.validMutation=x,this.mutatedRelevantEvents=v)},this.handlePointerUp=()=>{this.isDragging||this.cleanup()},this.handleDragEnd=d=>{if(this.isDragging){let f=this.component.context,h=f.viewApi,{receivingContext:p,validMutation:b}=this,y=this.eventRange.def,x=this.eventRange.instance,v=new pt(f,y,x),N=this.relevantEvents,j=this.mutatedRelevantEvents,{finalHit:S}=this.hitDragging;if(this.clearDrag(),f.emitter.trigger("eventDragStop",{el:this.subjectEl,event:v,jsEvent:d.origEvent,view:h}),b){if(p===f){let R=new pt(f,j.defs[y.defId],x?j.instances[x.instanceId]:null);f.dispatch({type:"MERGE_EVENTS",eventStore:j});let w={oldEvent:v,event:R,relatedEvents:wr(j,f,x),revert(){f.dispatch({type:"MERGE_EVENTS",eventStore:N})}},D={};for(let C of f.getCurrentData().pluginHooks.eventDropTransformers)Object.assign(D,C(b,f));f.emitter.trigger("eventDrop",Object.assign(Object.assign(Object.assign({},w),D),{el:d.subjectEl,delta:b.datesDelta,jsEvent:d.origEvent,view:h})),f.emitter.trigger("eventChange",w)}else if(p){let R={event:v,relatedEvents:wr(N,f,x),revert(){f.dispatch({type:"MERGE_EVENTS",eventStore:N})}};f.emitter.trigger("eventLeave",Object.assign(Object.assign({},R),{draggedEl:d.subjectEl,view:h})),f.dispatch({type:"REMOVE_EVENTS",eventStore:N}),f.emitter.trigger("eventRemove",R);let w=j.defs[y.defId],D=j.instances[x.instanceId],C=new pt(p,w,D);p.dispatch({type:"MERGE_EVENTS",eventStore:j});let I={event:C,relatedEvents:wr(j,p,D),revert(){p.dispatch({type:"REMOVE_EVENTS",eventStore:j})}};p.emitter.trigger("eventAdd",I),d.isTouch&&p.dispatch({type:"SELECT_EVENT",eventInstanceId:x.instanceId}),p.emitter.trigger("drop",Object.assign(Object.assign({},rA(S.dateSpan,p)),{draggedEl:d.subjectEl,jsEvent:d.origEvent,view:S.context.viewApi})),p.emitter.trigger("eventReceive",Object.assign(Object.assign({},I),{draggedEl:d.subjectEl,view:S.context.viewApi}))}}else f.emitter.trigger("_noEventDrop")}this.cleanup()};let{component:n}=this,{options:r}=n.context,i=this.dragging=new Vo(e.el);i.pointer.selector=qo.SELECTOR,i.touchScrollAllowed=!1,i.autoScroller.isEnabled=r.dragScroll;let c=this.hitDragging=new Mu(this.dragging,ig);c.useSubjectCenter=e.useEventCenter,c.emitter.on("pointerdown",this.handlePointerDown),c.emitter.on("dragstart",this.handleDragStart),c.emitter.on("hitupdate",this.handleHitUpdate),c.emitter.on("pointerup",this.handlePointerUp),c.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}displayDrag(e,n){let r=this.component.context,i=this.receivingContext;i&&i!==e&&(i===r?i.dispatch({type:"SET_EVENT_DRAG",state:{affectedEvents:n.affectedEvents,mutatedEvents:Rn(),isEvent:!0}}):i.dispatch({type:"UNSET_EVENT_DRAG"})),e&&e.dispatch({type:"SET_EVENT_DRAG",state:n})}clearDrag(){let e=this.component.context,{receivingContext:n}=this;n&&n.dispatch({type:"UNSET_EVENT_DRAG"}),e!==n&&e.dispatch({type:"UNSET_EVENT_DRAG"})}cleanup(){this.subjectSeg=null,this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null}}qo.SELECTOR=".fc-event-draggable, .fc-event-resizable";function yP(t,e,n,r){let i=t.dateSpan,c=e.dateSpan,d=i.range.start,f=c.range.start,h={};i.allDay!==c.allDay&&(h.allDay=c.allDay,h.hasEnd=e.context.options.allDayMaintainDuration,c.allDay?d=ct(n):d=n);let p=El(d,f,t.context.dateEnv,t.componentId===e.componentId?t.largeUnit:null);p.milliseconds&&(h.allDay=!1);let b={datesDelta:p,standardProps:h};for(let y of r)y(b,t,e);return b}function vP(t){let{options:e}=t.context,n=e.eventLongPressDelay;return n==null&&(n=e.longPressDelay),n}class NP extends ni{constructor(e){super(e),this.draggingSegEl=null,this.draggingSeg=null,this.eventRange=null,this.relevantEvents=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=c=>{let{component:d}=this,f=this.querySegEl(c),h=Vl(f),p=this.eventRange=h.eventRange;this.dragging.minDistance=d.context.options.eventDragMinDistance,this.dragging.setIgnoreMove(!this.component.isValidSegDownEl(c.origEvent.target)||c.isTouch&&this.component.props.eventSelection!==p.instance.instanceId)},this.handleDragStart=c=>{let{context:d}=this.component,f=this.eventRange;this.relevantEvents=Nm(d.getCurrentData().eventStore,this.eventRange.instance.instanceId);let h=this.querySegEl(c);this.draggingSegEl=h,this.draggingSeg=Vl(h),d.calendarApi.unselect(),d.emitter.trigger("eventResizeStart",{el:h,event:new pt(d,f.def,f.instance),jsEvent:c.origEvent,view:d.viewApi})},this.handleHitUpdate=(c,d,f)=>{let{context:h}=this.component,p=this.relevantEvents,b=this.hitDragging.initialHit,y=this.eventRange.instance,x=null,v=null,N=!1,j={affectedEvents:p,mutatedEvents:Rn(),isEvent:!0};c&&(c.componentId===b.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(b,c)||(x=EP(b,c,f.subjectEl.classList.contains("fc-event-resizer-start"),y.range))),x&&(v=Sm(p,h.getCurrentData().eventUiBases,x,h),j.mutatedEvents=v,jS(j,c.dateProfile,h)||(N=!0,x=null,v=null,j.mutatedEvents=null)),v?h.dispatch({type:"SET_EVENT_RESIZE",state:j}):h.dispatch({type:"UNSET_EVENT_RESIZE"}),N?cm():dm(),d||(x&&Iu(b,c)&&(x=null),this.validMutation=x,this.mutatedRelevantEvents=v)},this.handleDragEnd=c=>{let{context:d}=this.component,f=this.eventRange.def,h=this.eventRange.instance,p=new pt(d,f,h),b=this.relevantEvents,y=this.mutatedRelevantEvents;if(d.emitter.trigger("eventResizeStop",{el:this.draggingSegEl,event:p,jsEvent:c.origEvent,view:d.viewApi}),this.validMutation){let x=new pt(d,y.defs[f.defId],h?y.instances[h.instanceId]:null);d.dispatch({type:"MERGE_EVENTS",eventStore:y});let v={oldEvent:p,event:x,relatedEvents:wr(y,d,h),revert(){d.dispatch({type:"MERGE_EVENTS",eventStore:b})}};d.emitter.trigger("eventResize",Object.assign(Object.assign({},v),{el:this.draggingSegEl,startDelta:this.validMutation.startDelta||Ve(0),endDelta:this.validMutation.endDelta||Ve(0),jsEvent:c.origEvent,view:d.viewApi})),d.emitter.trigger("eventChange",v)}else d.emitter.trigger("_noEventResize");this.draggingSeg=null,this.relevantEvents=null,this.validMutation=null};let{component:n}=e,r=this.dragging=new Vo(e.el);r.pointer.selector=".fc-event-resizer",r.touchScrollAllowed=!1,r.autoScroller.isEnabled=n.context.options.dragScroll;let i=this.hitDragging=new Mu(this.dragging,Am(e));i.emitter.on("pointerdown",this.handlePointerDown),i.emitter.on("dragstart",this.handleDragStart),i.emitter.on("hitupdate",this.handleHitUpdate),i.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}querySegEl(e){return Yt(e.subjectEl,".fc-event")}}function EP(t,e,n,r){let i=t.context.dateEnv,c=t.dateSpan.range.start,d=e.dateSpan.range.start,f=El(c,d,i,t.largeUnit);if(n){if(i.add(r.start,f)r.start)return{endDelta:f};return null}class jP{constructor(e){this.context=e,this.isRecentPointerDateSelect=!1,this.matchesCancel=!1,this.matchesEvent=!1,this.onSelect=r=>{r.jsEvent&&(this.isRecentPointerDateSelect=!0)},this.onDocumentPointerDown=r=>{let i=this.context.options.unselectCancel,c=_j(r.origEvent);this.matchesCancel=!!Yt(c,i),this.matchesEvent=!!Yt(c,qo.SELECTOR)},this.onDocumentPointerUp=r=>{let{context:i}=this,{documentPointer:c}=this,d=i.getCurrentData();if(!c.wasTouchScroll){if(d.dateSelection&&!this.isRecentPointerDateSelect){let f=i.options.unselectAuto;f&&(!f||!this.matchesCancel)&&i.calendarApi.unselect(r)}d.eventSelection&&!this.matchesEvent&&i.dispatch({type:"UNSELECT_EVENT"})}this.isRecentPointerDateSelect=!1};let n=this.documentPointer=new tA(document);n.shouldIgnoreMove=!0,n.shouldWatchScroll=!1,n.emitter.on("pointerdown",this.onDocumentPointerDown),n.emitter.on("pointerup",this.onDocumentPointerUp),e.emitter.on("select",this.onSelect)}destroy(){this.context.emitter.off("select",this.onSelect),this.documentPointer.destroy()}}const SP={fixedMirrorParent:Z},AP={dateClick:Z,eventDragStart:Z,eventDragStop:Z,eventDrop:Z,eventResizeStart:Z,eventResizeStop:Z,eventResize:Z,drop:Z,eventReceive:Z,eventLeave:Z};Rm.dataAttrPrefix="";var wP=Wa({name:"@fullcalendar/interaction",componentInteractions:[gP,mP,qo,NP],calendarInteractions:[jP],elementDraggingImpl:Vo,optionRefiners:SP,listenerRefiners:AP});const hu=({ownerId:t,isConnected:e,onStatusChange:n})=>{const[r,i]=A.useState(!1),c=async()=>{i(!0);try{const f=await fetch(`/api/auth/google/url?dentistId=${t}`),h=await f.json();if(!f.ok||h.error){alert(`Erro: ${h.error||"Falha ao obter URL de autenticação"}`),i(!1);return}const{url:p}=h,b=600,y=700,x=window.screen.width/2-b/2,v=window.screen.height/2-y/2,N=window.open(p,"google-auth",`width=${b},height=${y},left=${x},top=${v}`),j=setInterval(()=>{(!N||N.closed)&&(clearInterval(j),i(!1),n&&n())},1e3)}catch(f){console.error("Erro ao conectar Google Agenda:",f),i(!1)}},d=async()=>{if(confirm("Deseja realmente desconectar esta agenda?")){i(!0);try{await fetch(`/api/auth/google/${t}`,{method:"DELETE"}),n&&n()}catch(f){console.error("Erro ao desconectar:",f)}finally{i(!1)}}};return e?s.jsxs("div",{className:"flex items-center gap-3 bg-emerald-50 border border-emerald-100 p-4 rounded-2xl",children:[s.jsx("div",{className:"p-2 bg-emerald-500 rounded-xl",children:s.jsx(pa,{size:18,className:"text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-[10px] font-black text-emerald-800 uppercase tracking-tight",children:"Google Agenda Conectada"}),s.jsx("p",{className:"text-[9px] text-emerald-600 font-bold uppercase tracking-widest mt-0.5",children:"Sincronização Ativa"})]}),s.jsx("button",{onClick:d,disabled:r,className:"text-[9px] font-black text-red-500 hover:text-red-700 uppercase tracking-widest px-3 py-1 bg-white border border-red-100 rounded-lg shadow-sm transition-all",children:r?s.jsx(Ot,{size:12,className:"animate-spin"}):"Desconectar"})]}):s.jsxs("button",{onClick:c,disabled:r,className:"w-full group relative overflow-hidden flex items-center gap-4 bg-white border-2 border-gray-100 p-4 rounded-2xl hover:border-blue-500 hover:shadow-xl hover:shadow-blue-50/50 transition-all duration-300",children:[s.jsx("div",{className:"p-3 bg-gray-50 group-hover:bg-blue-600 rounded-xl transition-colors duration-300",children:s.jsx(jt,{size:20,className:"text-gray-400 group-hover:text-white transition-colors duration-300"})}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"text-xs font-black text-gray-800 uppercase tracking-tight group-hover:text-blue-600",children:"Conectar Google Agenda"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-widest",children:"Sincronize horários externos"})]}),r&&s.jsx("div",{className:"absolute right-4",children:s.jsx(Ot,{size:18,className:"text-blue-600 animate-spin"})})]})},CP=({isOpen:t,onClose:e,dentists:n})=>{const[r,i]=A.useState(1),[c,d]=A.useState({clinicEmail:"",clinicCalendarId:"",googleApiKey:"",googleCalendarIds:{}}),[f,h]=A.useState(!1),[p,b]=A.useState([]),y=$e(),x=async()=>{try{const R=await(await fetch("/api/auth/google/status")).json();b(R)}catch(S){console.error("Erro ao buscar status do Google:",S)}};A.useEffect(()=>{t&&((async()=>{try{const R=await K.getSettings();d({clinicEmail:R.clinicEmail||"",clinicCalendarId:R.clinicCalendarId||"",googleApiKey:R.googleApiKey||"",googleCalendarIds:R.googleCalendarIds||{}})}catch(R){console.error("Erro ao carregar configurações:",R)}})(),x(),i(1))},[t]);const v=S=>{const R=`/api/auth/google/url?dentistId=${S}`;navigator.clipboard.writeText(R),y.success("LINK DE CONVITE COPIADO!")},N=async()=>{h(!0);try{await K.saveSettings(c),y.success("CONFIGURAÇÕES SALVAS COM SUCESSO!"),e()}catch{y.error("ERRO AO SALVAR CONFIGURAÇÕES.")}finally{h(!1)}};if(!t)return null;const j=3;return s.jsxs("div",{className:"fixed inset-0 bg-black/60 z-[60] flex items-center justify-center backdrop-blur-md p-0",children:[s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-[2.5rem] flex flex-col overflow-hidden border border-gray-100 animate-in fade-in zoom-in-95 duration-300",children:[s.jsxs("div",{className:"px-10 py-8 border-b border-gray-50 flex justify-between items-center bg-gradient-to-br from-gray-50 to-white",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-blue-600 rounded-2xl shadow-lg shadow-blue-200",children:s.jsx(zd,{size:24,className:"text-white animate-spin-slow"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-black text-gray-900 uppercase tracking-tighter",children:"Configurações da Agenda"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-0.5",children:"Integrações e Comunicação"})]})]}),s.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-xl transition-colors text-gray-400",children:s.jsx(Qe,{size:24})})]}),s.jsx("div",{className:"h-1.5 w-full bg-gray-100 flex",children:s.jsx("div",{className:"h-full bg-blue-600 transition-all duration-500 ease-out shadow-[0_0_10px_rgba(37,99,235,0.5)]",style:{width:`${r/j*100}%`}})}),s.jsx("div",{className:"flex-1 relative overflow-hidden bg-white",children:s.jsxs("div",{className:"absolute inset-0 flex transition-transform duration-500 ease-in-out transform-gpu",style:{transform:`translateX(-${(r-1)*100}%)`},children:[s.jsxs("div",{className:"w-full shrink-0 p-10 animate-in fade-in duration-700",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[s.jsx(_g,{className:"text-blue-600",size:24}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase tracking-tight",children:"E-mails da Clínica"})]}),s.jsx("div",{className:"space-y-6",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-[0.2em] ml-1",children:"E-mail para Notificações"}),s.jsx("input",{type:"email",placeholder:"EX: CONTATO@CLINICA.COM",className:"w-full bg-gray-50 border-2 border-transparent focus:border-blue-600 focus:bg-white rounded-2xl p-4 font-bold text-gray-800 outline-none transition-all shadow-sm",value:c.clinicEmail,onChange:S=>d({...c,clinicEmail:S.target.value.toUpperCase()})}),s.jsx("p",{className:"text-[10px] text-gray-400 italic ml-1",children:"* Este e-mail será usado para alertas de sistema e envio de comprovantes."})]})})]}),s.jsxs("div",{className:"w-full shrink-0 p-10 animate-in fade-in duration-700 overflow-y-auto custom-scrollbar",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(jt,{className:"text-emerald-600",size:24}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase tracking-tight",children:"Configuração Google Agenda"})]}),s.jsx("a",{href:"https://console.cloud.google.com/apis/library/calendar-json.googleapis.com",target:"_blank",rel:"noreferrer",className:"text-[9px] font-black text-white bg-black px-3 py-1.5 rounded-lg hover:opacity-80 transition-all uppercase tracking-widest",children:"1. Ativar API"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6 mb-8",children:[s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"bg-emerald-50 rounded-2xl p-4 border border-emerald-100",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("div",{className:"w-5 h-5 bg-emerald-600 text-white text-[10px] font-black flex items-center justify-center rounded-full",children:"1"}),s.jsx("span",{className:"text-[10px] font-black text-emerald-800 uppercase",children:"Google API Key"})]}),s.jsx("input",{type:"password",placeholder:"COLE A CHAVE AQUI",className:"w-full bg-white border border-emerald-200 rounded-xl px-4 py-2 text-xs font-bold text-gray-700 outline-none focus:ring-2 focus:ring-emerald-100",value:c.googleApiKey,onChange:S=>d({...c,googleApiKey:S.target.value})}),s.jsx("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noreferrer",className:"text-[8px] font-black text-emerald-600 hover:underline mt-2 inline-block uppercase",children:"Criar Credenciais ➔"})]})}),s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"bg-blue-50 rounded-2xl p-4 border border-blue-100",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("div",{className:"w-5 h-5 bg-blue-600 text-white text-[10px] font-black flex items-center justify-center rounded-full",children:"2"}),s.jsx("span",{className:"text-[10px] font-black text-blue-800 uppercase",children:"ID Agenda Clínica"})]}),s.jsx("input",{type:"text",placeholder:"ID DA AGENDA",className:"w-full bg-white border border-blue-200 rounded-xl px-4 py-2 text-xs font-bold text-gray-700 outline-none focus:ring-2 focus:ring-blue-100",value:c.clinicCalendarId,onChange:S=>d({...c,clinicCalendarId:S.target.value})}),s.jsx("a",{href:"https://calendar.google.com/calendar/r/settings",target:"_blank",rel:"noreferrer",className:"text-[8px] font-black text-blue-600 hover:underline mt-2 inline-block uppercase",children:"Pegar ID nas Configs ➔"})]})})]}),s.jsxs("div",{className:"bg-gray-900 rounded-3xl p-6 text-white",children:[s.jsx("h4",{className:"text-[10px] font-black text-blue-400 uppercase tracking-[0.2em] mb-4",children:"Guia de Integração"}),s.jsxs("ul",{className:"space-y-3",children:[s.jsxs("li",{className:"flex gap-3 text-xs",children:[s.jsx(pa,{size:16,className:"text-emerald-500 shrink-0"}),s.jsxs("span",{className:"text-gray-300",children:["Crie um projeto no ",s.jsx("strong",{children:"Google Cloud Console"}),"."]})]}),s.jsxs("li",{className:"flex gap-3 text-xs",children:[s.jsx(pa,{size:16,className:"text-emerald-500 shrink-0"}),s.jsxs("span",{className:"text-gray-300",children:["No menu 'Biblioteca', ative a ",s.jsx("strong",{children:"Google Calendar API"}),"."]})]}),s.jsxs("li",{className:"flex gap-3 text-xs",children:[s.jsx(pa,{size:16,className:"text-emerald-500 shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("span",{className:"text-gray-300",children:["Pegue o ",s.jsx("strong",{children:"ID da Agenda"})," nas configurações (Integrar agenda)."]}),s.jsx("a",{href:"https://calendar.google.com/calendar/r/settings",target:"_blank",rel:"noreferrer",className:"text-[9px] font-black text-blue-400 hover:underline flex items-center gap-1 uppercase",children:"Abrir Configurações de Agenda ➔"})]})]}),s.jsxs("li",{className:"flex gap-3 text-xs",children:[s.jsx(pa,{size:16,className:"text-emerald-500 shrink-0"}),s.jsxs("span",{className:"text-gray-300",children:["No Google Agenda, torne a agenda ",s.jsx("strong",{children:"Pública"})," nas autorizações de acesso."]})]})]})]})]}),s.jsxs("div",{className:"w-full shrink-0 p-10 animate-in fade-in duration-700 overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(jt,{className:"text-emerald-600",size:24}),s.jsx("h3",{className:"text-sm font-black text-gray-800 uppercase tracking-tight",children:"Agendas dos Dentistas"})]}),s.jsx("a",{href:"https://calendar.google.com/calendar/u/0/r/settings",target:"_blank",rel:"noreferrer",className:"text-[9px] font-black text-white bg-gray-900 px-3 py-1.5 rounded-lg hover:bg-black transition-colors uppercase tracking-widest",children:"Abrir Google Calendar"})]}),s.jsxs("div",{className:"space-y-4 flex-1 overflow-y-auto pr-4 custom-scrollbar",children:[s.jsxs("div",{className:"bg-blue-50/50 p-4 rounded-2xl border border-blue-100 mb-2",children:[s.jsx("p",{className:"text-[10px] text-blue-800 font-bold mb-1 uppercase tracking-wider",children:"Nova Integração Inteligente (OAuth2)"}),s.jsx("p",{className:"text-[10px] text-blue-600 italic",children:"Agora você pode conectar agendas sem precisar torná-las públicas ou usar API Keys."})]}),s.jsxs("div",{className:"space-y-3 mb-6",children:[s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1",children:"Sua Conta (Administrador)"}),s.jsx(hu,{ownerId:"admin",isConnected:p.some(S=>S.owner_id==="admin"||S.owner_id.includes("@")),onStatusChange:x})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1",children:"Contas dos Dentistas"}),n!=null&&n.length?n.map(S=>{var w;const R=p.some(D=>D.owner_id===S.id);return s.jsxs("div",{className:"bg-gray-50 rounded-2xl p-4 border border-transparent hover:border-gray-200 transition-all",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.corAgenda}}),s.jsx("span",{className:"text-xs font-black text-gray-800 uppercase",children:S.nome})]}),R?s.jsx("span",{className:"text-[9px] font-black text-emerald-600 bg-emerald-100 px-2 py-1 rounded-lg uppercase",children:"Conectado"}):s.jsx("span",{className:"text-[9px] font-black text-gray-400 uppercase",children:"Não Vinculado"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx(hu,{ownerId:S.id,isConnected:R,onStatusChange:x})}),!R&&s.jsx("button",{onClick:()=>v(S.id),className:"p-4 bg-gray-100 text-gray-600 rounded-2xl hover:bg-gray-200 transition-all flex items-center justify-center group",title:"Gerar Link para o Dentista",children:s.jsx(WN,{size:18,className:"group-hover:scale-110 transition-transform"})})]}),s.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200/50",children:[s.jsx("label",{className:"text-[9px] font-bold text-gray-400 uppercase ml-1",children:"ID Alternativo (API Key/Legado)"}),s.jsx("input",{type:"text",placeholder:"ID DA AGENDA GOOGLE (SE NÃO USAR OAUTH2)",className:"w-full bg-white/50 border border-gray-200 rounded-xl px-4 py-2 text-[10px] font-bold text-gray-500 outline-none focus:ring-1 focus:ring-blue-100 mt-1",value:((w=c.googleCalendarIds)==null?void 0:w[S.id])||"",onChange:D=>d({...c,googleCalendarIds:{...c.googleCalendarIds,[S.id]:D.target.value}})})]})]},S.id)}):s.jsx("p",{className:"text-center text-xs text-gray-400 py-10 uppercase font-bold",children:"Nenhum dentista cadastrado."})]})]})]})]})}),s.jsxs("div",{className:"px-10 py-8 bg-gray-50/50 border-t border-gray-100 flex justify-between items-center",children:[s.jsx("div",{className:"flex gap-2",children:r>1&&s.jsxs("button",{onClick:()=>i(r-1),className:"flex items-center gap-2 px-6 py-3 text-xs font-black text-gray-500 hover:text-gray-900 bg-white rounded-2xl border border-gray-200 hover:shadow-md transition-all uppercase tracking-widest",children:[s.jsx($a,{size:16})," Anterior"]})}),s.jsx("div",{className:"flex gap-4",children:ri(r+1),className:"flex items-center gap-2 px-8 py-4 bg-blue-600 text-white rounded-[1.5rem] text-xs font-black uppercase tracking-widest hover:bg-blue-700 hover:shadow-xl hover:shadow-blue-200 transition-all shadow-lg shadow-blue-100",children:["Próximo ",s.jsx(Pa,{size:16})]}):s.jsx("button",{onClick:N,disabled:f,className:"flex items-center gap-2 px-10 py-4 bg-emerald-600 text-white rounded-[1.5rem] text-xs font-black uppercase tracking-widest hover:bg-emerald-700 hover:shadow-xl hover:shadow-emerald-200 transition-all shadow-lg shadow-emerald-100 disabled:bg-gray-400",children:f?"Salvando...":s.jsxs(s.Fragment,{children:[s.jsx(Po,{size:16})," Salvar Tudo"]})})})]})]}),s.jsx("style",{children:` + .animate-spin-slow { + animation: spin 8s linear infinite; + } + @keyframes spin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } + } + .custom-scrollbar::-webkit-scrollbar { + width: 4px; + } + .custom-scrollbar::-webkit-scrollbar-track { + background: #f1f1f1; + border-radius: 10px; + } + .custom-scrollbar::-webkit-scrollbar-thumb { + background: #cbd5e1; + border-radius: 10px; + } + .custom-scrollbar::-webkit-scrollbar-thumb:hover { + background: #94a3b8; + } + `})]})};function DP(t,e){const[n,r]=A.useState(t);return A.useEffect(()=>{const i=setTimeout(()=>{r(t)},e);return()=>clearTimeout(i)},[t,e]),n}const OP=({isOpen:t,onClose:e,onSave:n,dentists:r,initialDate:i,initialAppointment:c})=>{var te;const[d,f]=A.useState(null),[h,p]=A.useState(""),[b,y]=A.useState(15),[x,v]=A.useState(i?i.split("T")[0]:new Date().toISOString().split("T")[0]),[N,j]=A.useState(i?new Date(i).toTimeString().substring(0,5):""),[S,R]=A.useState((te=r==null?void 0:r[0])==null?void 0:te.id),[w,D]=A.useState(""),[C,I]=A.useState(!1),L=DP(h,400),F=A.useCallback(()=>K.getPacientes(L).then(re=>Array.isArray(re.data)?re.data:[]),[L]),{data:Y,isLoading:$}=Ie(F,[L]),{data:M,refresh:H}=Ie(K.getAgendamentos),ne=K.getActiveWorkspace(),{data:ee}=Ie(()=>S&&ne?K.getHorariosByDentista(S,ne.id):Promise.resolve([]),[S,ne==null?void 0:ne.id]),he=$e();A.useEffect(()=>{if(t)if(c){f({nome:c.pacienteNome,cpf:"",id:"temp"});const re=new Date(c.start),T=new Date(c.end);v(re.toISOString().split("T")[0]),j(re.toTimeString().substring(0,5)),y((T.getTime()-re.getTime())/6e4),R(c.dentistaId),D(c.procedimento)}else f(null),p(""),v(i?i.split("T")[0]:new Date().toISOString().split("T")[0]),j(i?new Date(i).toTimeString().substring(0,5):""),D(""),y(15),r&&r.length>0&&R(r[0].id)},[t,i,r,c]),A.useEffect(()=>{if(!t)return;const re=T=>{T.key==="Escape"&&e()};return document.addEventListener("keydown",re),()=>document.removeEventListener("keydown",re)},[t,e]);const pe=r==null?void 0:r.find(re=>re.id===S),z=A.useCallback(()=>{const re=[];if(!S||!x)return re;const T=(M??[]).filter(se=>se.dentistaId===S&&new Date(se.start).toISOString().split("T")[0]===x&&se.id!==(c==null?void 0:c.id)).map(se=>({start:new Date(se.start).getHours()*60+new Date(se.start).getMinutes(),end:new Date(se.end).getHours()*60+new Date(se.end).getMinutes()})),X=new Date(x).getUTCDay(),le=(ee==null?void 0:ee.filter(se=>se.dia_semana===X&&se.ativo))||[];if(le.length===0){for(let se=480;se<1080;se+=15)if(!T.some(Ae=>se>=Ae.start&&seLe>=Wt.start&&Le{f(re),p(""),I(!1)},G=async re=>{if(re.preventDefault(),!d||!x||!N||!S||!w){he.error("PREENCHA TODOS OS CAMPOS PARA AGENDAR.");return}const T=new Date(`${x}T${N}:00`),X=new Date(T.getTime()+b*6e4);try{const le={pacienteNome:d.nome,dentistaId:S,start:T.toISOString(),end:X.toISOString(),status:(c==null?void 0:c.status)||"Pendente",procedimento:w.toUpperCase()};c!=null&&c.id?(await K.atualizarAgendamento(c.id,le),he.success(`AGENDAMENTO DE ${d.nome} ATUALIZADO!`)):(await K.salvarAgendamento(le),he.success(`AGENDAMENTO PARA ${d.nome} SALVO!`)),H(),n()}catch{he.error("ERRO AO SALVAR AGENDAMENTO.")}};return t?s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("form",{onSubmit:G,className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-orange-50 to-white",children:[s.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2 uppercase",children:[s.jsx(jt,{size:22,className:"text-orange-500"})," AGENDAR CONSULTA"]}),s.jsx("button",{type:"button",onClick:e,className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"PACIENTE"}),d?s.jsxs("div",{className:"w-full lg:w-1/2 bg-green-50 border border-green-200 p-3 lg:p-4 rounded-lg mt-2 flex justify-between items-center",children:[s.jsx("span",{className:"font-bold text-green-800 uppercase text-sm lg:text-base",children:d.nome}),s.jsx("button",{type:"button",onClick:()=>f(null),className:"text-xs font-bold bg-blue-100 text-blue-700 hover:bg-blue-200 px-3 py-1.5 rounded-md transition-colors",children:"ALTERAR"})]}):s.jsxs("div",{className:"relative mt-2",children:[s.jsx("input",{type:"text",value:h,onChange:re=>p(re.target.value.toUpperCase()),onFocus:()=>I(!0),onBlur:()=>setTimeout(()=>I(!1),200),placeholder:"DIGITE O NOME OU CPF...",className:"w-full lg:w-1/2 bg-gray-100 p-3 lg:p-4 rounded-lg font-bold text-gray-800 uppercase focus:border-blue-500 outline-none border-2 border-transparent focus:border-2 text-sm lg:text-base"}),C&&L&&s.jsxs("ul",{className:"absolute z-10 w-full lg:w-1/2 bg-white border border-gray-300 rounded-lg mt-1 max-h-48 overflow-y-auto shadow-lg",children:[$&&s.jsx("li",{className:"p-3 text-sm text-gray-500",children:"BUSCANDO..."}),Y==null?void 0:Y.map(re=>s.jsxs("li",{onMouseDown:()=>oe(re),className:"p-3 hover:bg-gray-100 cursor-pointer uppercase font-semibold text-sm",children:[re.nome," (",re.cpf,")"]},re.id))]})]})]}),d&&s.jsx("div",{className:"animate-in fade-in space-y-6 lg:space-y-0",children:s.jsxs("div",{className:"lg:grid lg:grid-cols-3 lg:gap-x-8 lg:gap-y-6 space-y-5 lg:space-y-0",children:[s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"DENTISTA RESPONSÁVEL"}),s.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[s.jsx("select",{value:S,onChange:re=>R(re.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 lg:p-3 bg-white uppercase-select text-sm",children:r==null?void 0:r.map(re=>s.jsx("option",{value:re.id,children:re.nome},re.id))}),s.jsx("div",{className:"w-7 h-7 rounded-full flex-shrink-0 border-2 border-white shadow-md",style:{backgroundColor:(pe==null?void 0:pe.corAgenda)||"#ccc"}})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"DATA"}),s.jsx("input",{type:"date",value:x,onChange:re=>v(re.target.value),className:"w-full mt-2 border border-gray-300 bg-white text-gray-800 rounded-lg p-2.5 lg:p-3 text-sm"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"DURAÇÃO"}),s.jsxs("select",{value:b,onChange:re=>y(Number(re.target.value)),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 bg-white uppercase-select text-sm",children:[s.jsx("option",{value:15,children:"15 MIN"}),s.jsx("option",{value:30,children:"30 MIN"}),s.jsx("option",{value:45,children:"45 MIN"}),s.jsx("option",{value:60,children:"60 MIN"})]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"PROCEDIMENTO"}),s.jsx("input",{type:"text",value:w,onChange:re=>D(re.target.value.toUpperCase()),placeholder:"EX: AVALIAÇÃO, LIMPEZA...",className:"w-full mt-2 border border-gray-300 bg-white text-gray-800 rounded-lg p-2.5 lg:p-3 uppercase-input placeholder-gray-400 text-sm"})]})]}),s.jsxs("div",{className:"lg:col-span-2",children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"HORÁRIOS DISPONÍVEIS"}),s.jsxs("div",{className:"grid grid-cols-6 lg:grid-cols-8 xl:grid-cols-10 gap-2 mt-3",children:[z.map(re=>s.jsx("button",{type:"button",onClick:()=>j(re),className:`py-2.5 lg:py-3 rounded-lg text-sm font-bold border transition-all duration-150 ${N===re?"bg-blue-600 text-white border-blue-600 shadow-md scale-105":"bg-white text-gray-800 border-gray-300 hover:border-blue-400 hover:bg-blue-50"}`,children:re},re)),z.length===0&&s.jsx("p",{className:"col-span-6 lg:col-span-8 xl:col-span-10 text-center text-sm text-gray-400 p-8 bg-gray-50 rounded-lg border border-dashed border-gray-200 uppercase font-bold",children:"NENHUM HORÁRIO DISPONÍVEL."})]})]})]})})]}),s.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-t border-gray-200 flex justify-end gap-3 flex-shrink-0",children:[s.jsx("button",{type:"button",onClick:e,className:"px-8 py-2.5 bg-gray-200 hover:bg-gray-300 text-gray-800 font-bold rounded-lg transition-colors text-sm uppercase",children:"CANCELAR"}),s.jsxs("button",{type:"submit",disabled:!d,className:"px-10 py-2.5 bg-orange-500 hover:bg-orange-600 text-white font-bold rounded-lg shadow-sm transition-colors text-sm uppercase disabled:bg-gray-400 disabled:cursor-not-allowed flex items-center gap-2",children:[s.jsx(jt,{size:16})," CONFIRMAR"]})]})]})}):null},RP=({onNavigate:t})=>{var pe;const{data:e,refresh:n}=Ie(K.getAgendamentos),{data:r,refresh:i}=Ie(K.getDentistas),{data:c,refresh:d}=Ie(K.getGoogleEvents),[f,h]=A.useState([]),[p,b]=A.useState(!1),[y,x]=A.useState(!1),[v,N]=A.useState(null),[j,S]=A.useState(null),[R,w]=A.useState(!1),D=$e();A.useEffect(()=>{var z;if(e&&r){const oe=K.getCurrentRole(),G=K.getCurrentUser(),te=oe==="dentista",re=(z=r.find(le=>le.email===G))==null?void 0:z.id;let T=e;te&&(T=e.filter(le=>le.dentistaId===re));const X=T.map(le=>{const se=r.find(Ne=>Ne.id===le.dentistaId);return{id:le.id,title:`${le.pacienteNome} - ${le.procedimento}`,start:le.start,end:le.end,backgroundColor:le.status==="Faltou"?"#ef4444":se?se.corAgenda:"#94a3b8",borderColor:le.status==="Faltou"?"#ef4444":se?se.corAgenda:"#94a3b8",extendedProps:{...le,isGoogle:!1,dentistaNome:se==null?void 0:se.nome}}});if(c&&c.length>0){let le=c;te&&(le=c.filter(se=>se.extendedProps.owner_id===G)),X.push(...le)}h(X)}},[e,r,c]);const C=z=>{N(z),b(!0)},I=z=>{if(z.event.extendedProps.isGoogle){D.info(`EVENTO DO GOOGLE CALENDAR: ${z.event.title}`);return}const oe=z.event.extendedProps;S(oe),w(!0)},L=async(z,oe)=>{try{await K.atualizarAgendamento(z,{status:oe}),D.success(`STATUS ATUALIZADO PARA ${oe.toUpperCase()}`),n(),w(!1)}catch{D.error("ERRO AO ATUALIZAR STATUS.")}},F=async z=>{if(confirm("DESEJA REALMENTE EXCLUIR ESTE AGENDAMENTO?"))try{await K.excluirAgendamento(z),D.success("AGENDAMENTO EXCLUÍDO!"),n(),w(!1)}catch{D.error("ERRO AO EXCLUIR AGENDAMENTO.")}},Y=()=>{n(),d(),b(!1),S(null)},$=async z=>{if(!z.destination||!r)return;const oe=Array.from(r),[G]=oe.splice(z.source.index,1);oe.splice(z.destination.index,0,G);const te=oe.map((re,T)=>({id:re.id,ordem:T}));try{await K.reorderDentistas(te),D.success("ORDEM DOS DENTISTAS ATUALIZADA!"),i()}catch{D.error("ERRO AO REORDENAR DENTISTAS.")}},M=K.getCurrentRole(),H=K.getCurrentUser(),ne=sm(),ee=async()=>{if(!(!j||!t)){try{const z=await K.getPacientes(j.pacienteNome),oe=Array.isArray(z)?z:(z==null?void 0:z.data)??[];oe.length>0?ne.setPaciente(oe[0]):ne.setPendingSearch(j.pacienteNome)}catch{ne.setPendingSearch(j.pacienteNome)}w(!1),t("lancar-gto")}},he=r==null?void 0:r.filter(z=>M==="admin"||M==="donoclinica"||M==="funcionario"?!0:M==="dentista"?z.email===H:!1);return s.jsxs("div",{className:"space-y-6",children:[s.jsx(fn,{title:"AGENDA CLÍNICA",children:s.jsxs("div",{className:"flex gap-4 items-center",children:[s.jsx(Jl,{onDragEnd:$,children:s.jsx(ti,{droppableId:"dentists-legend",direction:"horizontal",children:z=>s.jsxs("div",{...z.droppableProps,ref:z.innerRef,className:"hidden lg:flex gap-2 items-center",children:[he==null?void 0:he.map((oe,G)=>s.jsx(ei,{draggableId:oe.id,index:G,isDragDisabled:M==="dentista",children:(te,re)=>s.jsxs("div",{ref:te.innerRef,...te.draggableProps,...te.dragHandleProps,className:`flex items-center gap-1.5 text-[10px] text-gray-700 bg-white border border-gray-200 px-3 py-1.5 rounded-full uppercase font-bold shadow-sm transition-all ${M!=="dentista"?"cursor-grab active:cursor-grabbing hover:border-gray-300":""} ${re.isDragging?"ring-2 ring-blue-500 scale-105 shadow-lg":""}`,children:[M!=="dentista"&&s.jsx(Ql,{size:12,className:"text-gray-400"}),s.jsx("div",{className:"w-2.5 h-2.5 rounded-full shadow-inner",style:{backgroundColor:oe.corAgenda}}),oe.nome]})},oe.id)),z.placeholder]})})}),(M==="admin"||M==="donoclinica")&&s.jsx("button",{onClick:()=>x(!0),className:"p-2.5 bg-white text-gray-400 hover:text-blue-600 border border-gray-200 rounded-xl transition-all hover:border-blue-200 hover:shadow-sm",children:s.jsx(zd,{size:20})}),M!=="paciente"&&s.jsxs("button",{onClick:()=>{N({dateStr:new Date().toISOString()}),b(!0)},className:"bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-bold uppercase flex items-center gap-2 hover:bg-blue-700 shadow-sm transition-colors",children:[s.jsx(gt,{size:16})," NOVO AGENDAMENTO"]})]})}),s.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-4 relative",style:{height:"750px"},children:s.jsx(GS,{plugins:[yz,sP,wP],initialView:"timeGridWeek",headerToolbar:{left:"prev,next today",center:"title",right:"dayGridMonth,timeGridWeek,timeGridDay"},locale:"pt-br",buttonText:{today:"HOJE",month:"MÊS",week:"SEMANA",day:"DIA"},slotMinTime:"08:00:00",slotMaxTime:"19:00:00",allDaySlot:!1,events:f,dateClick:C,eventClick:I,height:"100%",slotLabelFormat:{hour:"2-digit",minute:"2-digit",hour12:!1},eventContent:z=>{const oe=z.event.extendedProps.isGoogle;return s.jsxs("div",{className:"p-0.5 overflow-hidden uppercase h-full",children:[s.jsx("div",{className:"text-[10px] font-bold",children:z.timeText}),oe?s.jsx("div",{className:"text-[10px] font-black leading-tight break-words",children:z.event.title}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-xs truncate font-bold",children:z.event.extendedProps.pacienteNome}),s.jsx("div",{className:"text-[10px] truncate opacity-90",children:z.event.extendedProps.procedimento})]})]})}})}),R&&j&&s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[70] flex items-center justify-center backdrop-blur-sm p-0 animate-in fade-in duration-200",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-[2rem] flex flex-col overflow-hidden border border-gray-100",children:[s.jsxs("div",{className:"px-8 py-6 border-b border-gray-50 flex justify-between items-center bg-gray-50/30",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>{w(!1),b(!0)},className:"p-2.5 bg-white text-gray-400 hover:text-blue-600 rounded-xl border border-gray-100 hover:shadow-md transition-all group",title:"EDITAR",children:s.jsx(Uo,{size:18,className:"group-hover:scale-110 transition-transform"})}),s.jsx("button",{onClick:()=>F(j.id),className:"p-2.5 bg-white text-gray-400 hover:text-red-600 rounded-xl border border-gray-100 hover:shadow-md transition-all group",title:"EXCLUIR",children:s.jsx(Qt,{size:18,className:"group-hover:scale-110 transition-transform"})})]}),s.jsx("button",{onClick:()=>w(!1),className:"p-2 hover:bg-gray-100 rounded-full transition-colors text-gray-400",children:s.jsx(Qe,{size:24})})]}),s.jsxs("div",{className:"p-10 space-y-8",children:[s.jsxs("div",{className:"flex items-start gap-5",children:[s.jsx("div",{className:"p-4 bg-blue-50 rounded-2xl",children:s.jsx(Bo,{size:28,className:"text-blue-600"})}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("h3",{className:"text-xl font-black text-gray-900 leading-none uppercase tracking-tighter",children:j.pacienteNome}),s.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-2 bg-gray-100 px-3 py-1 rounded-full w-fit",children:[s.jsx(aa,{size:12,className:"text-blue-400"})," ",j.procedimento]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-8 py-6 border-y border-gray-50",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Data e Hora"}),s.jsxs("div",{className:"flex items-center gap-2 text-sm font-bold text-gray-700",children:[s.jsx(wC,{size:16,className:"text-blue-500"}),new Date(j.start).toLocaleDateString("pt-BR",{weekday:"long",day:"numeric",month:"long"})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm font-bold text-gray-700",children:[s.jsx(Yl,{size:16,className:"text-blue-500"}),new Date(j.start).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Profissional"}),s.jsxs("div",{className:"flex items-center gap-2 text-sm font-bold text-gray-700",children:[s.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow-sm",style:{backgroundColor:(pe=r==null?void 0:r.find(z=>z.id===j.dentistaId))==null?void 0:pe.corAgenda}}),j.dentistaNome]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1",children:"Status do Atendimento"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("button",{onClick:()=>L(j.id,"Faltou"),className:`flex items-center justify-center gap-2 py-4 rounded-2xl text-xs font-black uppercase tracking-widest transition-all border-2 ${j.status==="Faltou"?"bg-red-50 text-red-600 border-red-200":"bg-white border-gray-100 text-gray-500 hover:border-red-200 hover:text-red-500"}`,children:[s.jsx(bu,{size:16})," Marcar Falta"]}),s.jsxs("button",{onClick:()=>L(j.id,"Confirmado"),className:`flex items-center justify-center gap-2 py-4 rounded-2xl text-xs font-black uppercase tracking-widest transition-all border-2 ${j.status==="Confirmado"?"bg-emerald-50 text-emerald-600 border-emerald-200":"bg-white border-gray-100 text-gray-500 hover:border-emerald-200 hover:text-emerald-500"}`,children:[s.jsx(pa,{size:16})," Confirmar"]})]})]})]}),s.jsxs("div",{className:"px-10 py-8 bg-gray-50/50 border-t border-gray-100 flex gap-4",children:[t&&M!=="paciente"&&s.jsx("button",{onClick:ee,className:"flex-1 py-4 bg-emerald-600 text-white rounded-2xl text-xs font-black uppercase tracking-widest hover:bg-emerald-700 hover:shadow-xl hover:shadow-emerald-200 transition-all shadow-lg shadow-emerald-100",children:"ATENDER PACIENTE"}),s.jsx("button",{onClick:()=>{w(!1),b(!0)},className:"flex-1 py-4 bg-blue-600 text-white rounded-2xl text-xs font-black uppercase tracking-widest hover:bg-blue-700 hover:shadow-xl hover:shadow-blue-200 transition-all shadow-lg shadow-blue-100",children:"Reagendar Consulta"})]})]})}),s.jsx("style",{children:` + .animate-in { animation: animate-in 0.2s ease-out; } + @keyframes animate-in { + from { opacity: 0; transform: scale(0.95); } + to { opacity: 1; transform: scale(1); } + } + .custom-scrollbar::-webkit-scrollbar { width: 4px; } + .custom-scrollbar::-webkit-scrollbar-track { background: #f1f1f1; } + .custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; } + `}),s.jsx(OP,{isOpen:p,onClose:()=>{b(!1),S(null)},onSave:Y,dentists:r,initialDate:v==null?void 0:v.dateStr,initialAppointment:j}),s.jsx(CP,{isOpen:y,onClose:()=>x(!1),dentists:r})]})};function lA(t){if(!t)return null;const e=new Date(t),n=new Date;let r=n.getFullYear()-e.getFullYear();const i=n.getMonth()-e.getMonth();return(i<0||i===0&&n.getDate(){var r;const e=lA(t.dataNascimento),n=TP(e);return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-5 shadow-sm",children:[s.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-14 h-14 bg-purple-100 text-purple-600 rounded-full flex items-center justify-center font-bold text-lg flex-shrink-0",children:t.pacienteNome.substring(0,2)}),s.jsxs("div",{children:[s.jsxs("h2",{className:"text-xl font-bold text-gray-900 uppercase",children:[t.pacienteNome," ",e!==null&&s.jsxs("span",{className:"text-gray-500 font-normal",children:["— ",e," ANOS"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 mt-1",children:[n&&s.jsx("span",{className:"text-[10px] font-bold bg-purple-100 text-purple-700 px-2 py-0.5 rounded-full uppercase",children:n}),s.jsx("span",{className:"text-[10px] font-bold bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full uppercase",children:t.classificacao||((r=t.diagnostico)==null?void 0:r.classeAngle)}),s.jsxs("span",{className:"text-[10px] font-bold bg-blue-100 text-blue-600 px-2 py-0.5 rounded-full uppercase",children:["FASE: ",t.faseAtual]}),s.jsxs("span",{className:"text-[10px] font-bold bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full uppercase",children:["FIO ",t.fioAtual]}),t.cooperacao&&s.jsxs("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full uppercase ${Um[t.cooperacao]||""}`,children:["COOPERAÇÃO ",t.cooperacao.toUpperCase()]})]})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-4 text-xs uppercase font-bold text-gray-500",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(jt,{size:14})," ÚLTIMA: ",t.ultimaConsulta?new Date(t.ultimaConsulta).toLocaleDateString():"—"]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(jt,{size:14,className:"text-blue-500"})," PRÓX: ",t.proximaConsulta?new Date(t.proximaConsulta).toLocaleDateString():"—"]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Yl,{size:14})," ",t.mesesRestantes??"?"," MESES RESTANTES"]})]})]}),t.percentualConcluido!=null&&s.jsxs("div",{className:"mt-4",children:[s.jsxs("div",{className:"flex justify-between text-[10px] font-bold text-gray-500 uppercase mb-1",children:[s.jsx("span",{children:"PROGRESSO DO TRATAMENTO"}),s.jsxs("span",{children:[t.percentualConcluido,"%"]})]}),s.jsx("div",{className:"w-full bg-gray-100 rounded-full h-2.5",children:s.jsx("div",{className:"bg-blue-500 h-2.5 rounded-full transition-all duration-500",style:{width:`${t.percentualConcluido}%`}})})]}),t.flags&&t.flags.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mt-3",children:t.flags.map((i,c)=>{const d=pu[i.tipo]||pu.info;return s.jsxs("div",{className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg border text-xs font-bold uppercase ${d.bg} ${d.text}`,children:[d.icon," ",i.mensagem]},c)})}),t.responsavel&&s.jsxs("p",{className:"mt-2 text-[10px] text-gray-400 font-bold uppercase",children:["RESPONSÁVEL: ",t.responsavel]})]})},MP=({t})=>{const[e,n]=A.useState(!1),r=t.triagem;if(!r)return null;const i=lA(t.dataNascimento),c=i!==null&&i>=18;return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[s.jsxs("button",{onClick:()=>n(!e),className:"w-full px-5 py-3 flex justify-between items-center bg-gray-50 hover:bg-gray-100 transition-colors",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2",children:[s.jsx(aa,{size:16,className:"text-purple-500"})," TRIAGEM CLÍNICA"]}),e?s.jsx(Tg,{size:18,className:"text-gray-400"}):s.jsx(Lo,{size:18,className:"text-gray-400"})]}),e&&s.jsxs("div",{className:"p-5 grid grid-cols-1 md:grid-cols-2 gap-4 text-sm animate-in fade-in",children:[s.jsx(vt,{label:"QUEIXA PRINCIPAL",value:r.queixaPrincipal}),s.jsx(vt,{label:"HISTÓRICO MÉDICO",value:r.historicoMedico}),s.jsx(vt,{label:"MEDICAÇÃO",value:r.medicacao}),s.jsx(vt,{label:"ALERGIAS",value:r.alergias}),s.jsx(vt,{label:"RESPIRAÇÃO BUCAL",value:r.respiracaoBucal?"SIM":"NÃO"}),s.jsx(vt,{label:"HÁBITOS",value:r.habitos}),c&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"col-span-full border-t pt-3 mt-1",children:s.jsx("span",{className:"text-[10px] font-bold text-purple-500 uppercase",children:"CAMPOS ADULTO"})}),s.jsx(vt,{label:"PERIODONTO",value:r.periodonto}),s.jsx(vt,{label:"IMPLANTES",value:r.implantes}),s.jsx(vt,{label:"RECESSÕES",value:r.recessoes}),s.jsx(vt,{label:"MOBILIDADE",value:r.mobilidade})]})]})]})},IP=({t})=>{const[e,n]=A.useState(!1),r=t.diagnostico;return r?s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[s.jsxs("button",{onClick:()=>n(!e),className:"w-full px-5 py-3 flex justify-between items-center bg-gray-50 hover:bg-gray-100 transition-colors",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2",children:[s.jsx(Ba,{size:16,className:"text-blue-500"})," DIAGNÓSTICO ORTODÔNTICO"]}),e?s.jsx(Tg,{size:18,className:"text-gray-400"}):s.jsx(Lo,{size:18,className:"text-gray-400"})]}),e&&s.jsxs("div",{className:"p-5 grid grid-cols-2 md:grid-cols-3 gap-4 text-sm animate-in fade-in",children:[s.jsx(vt,{label:"CLASSE ANGLE",value:r.classeAngle,highlight:!0}),s.jsx(vt,{label:"PERFIL",value:r.perfil}),s.jsx(vt,{label:"APINHAMENTO",value:r.apinhamento,highlight:r.apinhamento==="Severo"}),s.jsx(vt,{label:"MORDIDA",value:r.mordida}),s.jsx(vt,{label:"LINHA MÉDIA",value:r.linhaMedia})]})]}):null},LP=({t})=>{const[e,n]=A.useState(!0);return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[s.jsxs("button",{onClick:()=>n(!e),className:"w-full px-5 py-3 flex justify-between items-center bg-gray-50 hover:bg-gray-100 transition-colors",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2",children:[s.jsx(pD,{size:16,className:"text-pink-500"})," PLANO DE TRATAMENTO"]}),e?s.jsx(Tg,{size:18,className:"text-gray-400"}):s.jsx(Lo,{size:18,className:"text-gray-400"})]}),e&&s.jsxs("div",{className:"p-5 space-y-3 text-sm animate-in fade-in",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[s.jsx(vt,{label:"APARELHO",value:t.tipoAparelho,highlight:!0}),s.jsx(vt,{label:"EXTRAÇÕES",value:t.extracoes}),s.jsx(vt,{label:"ELÁSTICOS",value:t.elasticos}),s.jsx(vt,{label:"IPR PLANEJADO",value:t.iprPlanejado}),s.jsx(vt,{label:"TEMPO ESTIMADO",value:t.tempoEstimado}),t.valor!=null&&s.jsx(vt,{label:"VALOR",value:`R$ ${t.valor.toLocaleString("pt-BR",{minimumFractionDigits:2})}`}),t.formaPagamento&&s.jsx(vt,{label:"PAGAMENTO",value:t.formaPagamento})]}),t.sequenciaFios&&s.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 border border-gray-100 mt-2",children:[s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"SEQUÊNCIA DE FIOS"}),s.jsx("p",{className:"font-bold text-gray-800 mt-1 tracking-wide",children:t.sequenciaFios})]})]})]})},zP=({evolucoes:t})=>{const e=[...t].sort((n,r)=>new Date(r.data).getTime()-new Date(n.data).getTime());return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx($l,{size:16,className:"text-blue-500"})," LINHA DO TEMPO — ",t.length," EVENTO",t.length!==1&&"S"]}),s.jsx("div",{className:"space-y-4 relative before:absolute before:left-[7px] before:top-2 before:bottom-2 before:w-0.5 before:bg-gray-200",children:e.map(n=>{var r;return s.jsxs("div",{className:"relative pl-7",children:[s.jsx("div",{className:`absolute left-0 top-1.5 w-3.5 h-3.5 rounded-full z-10 border-2 ${n.tipo==="Falta"?"bg-red-500 border-red-300":n.tipo==="Colagem"?"bg-green-500 border-green-300":"bg-white border-blue-500"}`}),s.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 border border-gray-100",children:[s.jsxs("div",{className:"flex flex-wrap justify-between items-start gap-2 mb-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-bold text-gray-900 text-sm",children:new Date(n.data).toLocaleDateString()}),s.jsx("span",{className:"text-[9px] font-bold bg-gray-200 text-gray-600 px-2 py-0.5 rounded-full uppercase",children:n.tipo})]}),s.jsxs("span",{className:"text-[10px] text-blue-600 flex items-center gap-1 font-bold uppercase",children:["PRÓX: ",new Date(n.proximoRetorno).toLocaleDateString()," ",s.jsx(Us,{size:10})]})]}),s.jsx("p",{className:"text-xs text-gray-700 uppercase font-medium",children:n.procedimento}),s.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[n.fio&&s.jsxs("span",{className:"text-[9px] font-bold bg-blue-50 text-blue-600 px-2 py-0.5 rounded-full uppercase",children:["FIO: ",n.fio]}),n.elastico&&s.jsxs("span",{className:"text-[9px] font-bold bg-purple-50 text-purple-600 px-2 py-0.5 rounded-full uppercase",children:["ELÁSTICO: ",n.elastico]}),(r=n.procedimentos)==null?void 0:r.map((i,c)=>s.jsx("span",{className:"text-[9px] font-bold bg-green-50 text-green-600 px-2 py-0.5 rounded-full uppercase",children:i},c)),n.higiene!=null&&s.jsxs("span",{className:`text-[9px] font-bold px-2 py-0.5 rounded-full uppercase ${n.higiene>=7?"bg-green-50 text-green-600":n.higiene>=5?"bg-amber-50 text-amber-600":"bg-red-50 text-red-600"}`,children:["HIGIENE: ",n.higiene,"/10"]}),n.cooperacao&&s.jsxs("span",{className:`text-[9px] font-bold px-2 py-0.5 rounded-full uppercase ${Um[n.cooperacao]||""}`,children:["COOP: ",n.cooperacao.toUpperCase()]})]}),n.observacoes&&s.jsx("p",{className:"text-[10px] text-gray-500 mt-2 italic uppercase",children:n.observacoes})]})]},n.id)})})]})},PP=({tratamentoId:t,currentFio:e,onSaved:n})=>{const r=$e(),[i,c]=A.useState("Manutenção"),[d,f]=A.useState(e||""),[h,p]=A.useState(""),[b,y]=A.useState([]),[x,v]=A.useState(7),[N,j]=A.useState("Boa"),[S,R]=A.useState(""),[w,D]=A.useState(""),C=L=>{y(F=>F.includes(L)?F.filter(Y=>Y!==L):[...F,L])},I=async()=>{const L=[i,d&&`FIO ${d}`,h&&`ELÁSTICO ${h}`,...b].filter(Boolean).join(" + ");try{await K.saveEvolucaoOrto(t,{tipo:i,procedimento:L.toUpperCase(),proximoRetorno:w,fio:d||void 0,elastico:h||void 0,procedimentos:b.length>0?b:void 0,higiene:x,cooperacao:N,observacoes:S.toUpperCase()||void 0}),r.success("EVOLUÇÃO SALVA COM SUCESSO!"),c("Manutenção"),p(""),y([]),v(7),j("Boa"),R(""),D(""),n()}catch{r.error("ERRO AO SALVAR EVOLUÇÃO.")}};return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(gt,{size:16,className:"text-green-500"})," NOVA EVOLUÇÃO"]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"TIPO EVENTO"}),s.jsxs("select",{value:i,onChange:L=>c(L.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1",children:[s.jsx("option",{children:"Manutenção"}),s.jsx("option",{children:"Troca de fio"}),s.jsx("option",{children:"Colagem"}),s.jsx("option",{children:"Emergência"}),s.jsx("option",{children:"Falta"}),s.jsx("option",{children:"Finalização"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"FIO"}),s.jsxs("select",{value:d,onChange:L=>f(L.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1",children:[s.jsx("option",{value:"",children:"— MANTER ATUAL —"}),s.jsx("option",{children:"0.12"}),s.jsx("option",{children:"0.14"}),s.jsx("option",{children:"0.16"}),s.jsx("option",{children:"0.18"}),s.jsx("option",{children:"0.20x0.25"}),s.jsx("option",{children:"0.19x0.25"}),s.jsx("option",{children:"0.21x0.25"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"ELÁSTICO"}),s.jsxs("select",{value:h,onChange:L=>p(L.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1",children:[s.jsx("option",{value:"",children:"— NENHUM —"}),s.jsx("option",{children:"CLASSE II"}),s.jsx("option",{children:"CLASSE III"}),s.jsx("option",{children:"VERTICAL"}),s.jsx("option",{children:"CRUZADO"})]})]})]}),s.jsxs("div",{className:"mt-4",children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"PROCEDIMENTOS REALIZADOS"}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:kP.map(L=>s.jsxs("button",{type:"button",onClick:()=>C(L.label),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-bold uppercase border transition-all ${b.includes(L.label)?"bg-green-600 text-white border-green-600 shadow-sm":"bg-white text-gray-600 border-gray-300 hover:border-green-400 hover:bg-green-50"}`,children:[L.icon," ",L.label]},L.label))})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"HIGIENE (1–10)"}),s.jsx("input",{type:"range",min:1,max:10,value:x,onChange:L=>v(Number(L.target.value)),className:"w-full mt-2"}),s.jsxs("div",{className:"text-center font-bold text-lg mt-1",children:[x,s.jsx("span",{className:"text-gray-400 text-xs",children:"/10"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"COOPERAÇÃO"}),s.jsxs("select",{value:N,onChange:L=>j(L.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1",children:[s.jsx("option",{children:"Boa"}),s.jsx("option",{children:"Média"}),s.jsx("option",{children:"Ruim"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"PRÓXIMO RETORNO"}),s.jsx("input",{type:"date",value:w,onChange:L=>D(L.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white mt-1"})]})]}),s.jsxs("div",{className:"mt-4",children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"OBSERVAÇÕES CLÍNICAS"}),s.jsx("textarea",{value:S,onChange:L=>R(L.target.value.toUpperCase()),placeholder:"ANOTAÇÕES LIVRES...",className:"w-full border border-gray-300 rounded-lg p-3 mt-1 h-20 uppercase-textarea text-sm"})]}),s.jsxs("button",{onClick:I,className:"mt-4 w-full bg-green-600 hover:bg-green-700 text-white py-3 rounded-lg font-bold uppercase text-sm transition-colors shadow-sm flex items-center justify-center gap-2",children:[s.jsx(Ga,{size:16})," SALVAR EVOLUÇÃO"]})]})},UP=({t})=>{var e,n,r,i;return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(Dd,{size:16,className:"text-indigo-500"})," COMPARATIVO FOTOGRÁFICO"]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"border-2 border-dashed border-gray-200 rounded-xl p-8 flex flex-col items-center justify-center text-center bg-gray-50 min-h-[160px]",children:[s.jsx(Dd,{size:32,className:"text-gray-300 mb-2"}),s.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase",children:"INÍCIO"}),((n=(e=t.fotos)==null?void 0:e.find(c=>c.tipo==="inicio"))==null?void 0:n.data)&&s.jsx("span",{className:"text-[10px] text-gray-400 mt-1",children:new Date(t.fotos.find(c=>c.tipo==="inicio").data).toLocaleDateString()})]}),s.jsxs("div",{className:"border-2 border-dashed border-gray-200 rounded-xl p-8 flex flex-col items-center justify-center text-center bg-gray-50 min-h-[160px]",children:[s.jsx(Dd,{size:32,className:"text-gray-300 mb-2"}),s.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase",children:"ATUAL"}),((i=(r=t.fotos)==null?void 0:r.find(c=>c.tipo==="atual"))==null?void 0:i.data)&&s.jsx("span",{className:"text-[10px] text-gray-400 mt-1",children:new Date(t.fotos.find(c=>c.tipo==="atual").data).toLocaleDateString()})]})]}),s.jsxs("button",{className:"mt-4 w-full border-2 border-dashed border-gray-300 hover:border-blue-400 hover:bg-blue-50 py-3 rounded-lg text-xs font-bold text-gray-500 hover:text-blue-600 uppercase transition-colors flex items-center justify-center gap-2",children:[s.jsx(SO,{size:16})," UPLOAD FOTOS"]})]})},BP=({t,onFinalize:e})=>{const n=$e(),[r,i]=A.useState({alinhamento:!1,oclusao:!1,raizes:!1,estetica:!1}),[c,d]=A.useState("CONTENÇÃO FIXA INFERIOR"),[f,h]=A.useState(!1),[p,b]=A.useState(!0),[y,x]=A.useState("PERMANENTE"),v=Object.values(r).every(Boolean),N=async()=>{if(!v){n.error("PREENCHA TODOS OS CRITÉRIOS DO CHECKLIST.");return}try{await K.finalizarTratamentoOrto(t.id,{tipo:c,superior:f,inferior:p,tempoUso:y}),n.success("TRATAMENTO FINALIZADO COM SUCESSO!"),e()}catch{n.error("ERRO AO FINALIZAR TRATAMENTO.")}};return t.status==="Finalizado"?s.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-xl p-5 text-center",children:[s.jsx(Ga,{size:32,className:"text-green-500 mx-auto mb-2"}),s.jsx("h3",{className:"font-bold text-green-700 uppercase",children:"TRATAMENTO FINALIZADO"}),t.contencaoTipo&&s.jsxs("p",{className:"text-xs text-green-600 mt-1 uppercase",children:["CONTENÇÃO: ",t.contencaoTipo]})]}):s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(Ar,{size:16,className:"text-green-500"})," FINALIZAÇÃO E CONTENÇÃO"]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"CHECKLIST OBRIGATÓRIO"}),s.jsx("div",{className:"space-y-2 mt-2",children:Object.entries({alinhamento:"ALINHAMENTO OK",oclusao:"OCLUSÃO OK",raizes:"RAÍZES PARALELAS",estetica:"ESTÉTICA ACEITA"}).map(([j,S])=>s.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:r[j],onChange:()=>i(R=>({...R,[j]:!R[j]})),className:"w-4 h-4 rounded border-gray-300 text-green-600"}),s.jsx("span",{className:"font-bold uppercase text-gray-700",children:S})]},j))})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"TIPO CONTENÇÃO"}),s.jsxs("select",{value:c,onChange:j=>d(j.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1 text-sm",children:[s.jsx("option",{children:"CONTENÇÃO FIXA INFERIOR"}),s.jsx("option",{children:"CONTENÇÃO FIXA SUPERIOR E INFERIOR"}),s.jsx("option",{children:"PLACA DE CONTENÇÃO REMOVÍVEL"}),s.jsx("option",{children:"ESSIX (ALINHADOR)"})]})]}),s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:f,onChange:()=>h(!f),className:"w-4 h-4 rounded"}),s.jsx("span",{className:"font-bold uppercase text-gray-700",children:"SUPERIOR"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:p,onChange:()=>b(!p),className:"w-4 h-4 rounded"}),s.jsx("span",{className:"font-bold uppercase text-gray-700",children:"INFERIOR"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"TEMPO DE USO"}),s.jsxs("select",{value:y,onChange:j=>x(j.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white uppercase-select mt-1 text-sm",children:[s.jsx("option",{children:"PERMANENTE"}),s.jsx("option",{children:"6 MESES"}),s.jsx("option",{children:"12 MESES"}),s.jsx("option",{children:"24 MESES"})]})]})]})]}),s.jsxs("button",{onClick:N,disabled:!v,className:`mt-5 w-full py-3 rounded-lg font-bold uppercase text-sm transition-colors flex items-center justify-center gap-2 ${v?"bg-green-600 hover:bg-green-700 text-white shadow-sm":"bg-gray-200 text-gray-400 cursor-not-allowed"}`,children:[s.jsx(Ga,{size:16})," FINALIZAR TRATAMENTO"]})]})},HP=({t})=>{$e();const[e,n]=A.useState(350),[r,i]=A.useState(!1);return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(HN,{size:16,className:"text-orange-500"})," CONTENÇÃO — TERMO E VALOR"]}),s.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 mb-4",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(bu,{size:18,className:"text-amber-600 flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-bold text-amber-700 uppercase mb-1",children:"TERMO DE CIÊNCIA"}),s.jsxs("p",{className:"text-xs text-amber-800 leading-relaxed",children:["O PACIENTE DECLARA ESTAR CIENTE DE QUE A ",s.jsx("strong",{children:"CONTENÇÃO ORTODÔNTICA"})," (FIXA E/OU REMOVÍVEL) É UM PROCEDIMENTO ",s.jsx("strong",{children:"SEPARADO DO TRATAMENTO ORTODÔNTICO"})," E ",s.jsx("strong",{children:"NÃO ESTÁ INCLUÍDA NO VALOR DA MANUTENÇÃO MENSAL"}),". O CUSTO DA CONTENÇÃO SERÁ COBRADO À PARTE, CONFORME VALORES ABAIXO INFORMADOS."]})]})]})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"VALOR DA CONTENÇÃO (R$)"}),s.jsx("input",{type:"number",value:e,onChange:c=>n(Number(c.target.value)),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white mt-1 text-sm font-bold",min:0,step:50}),s.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"VALOR COBRADO SEPARADAMENTE DA MENSALIDADE"})]}),s.jsx("div",{className:"flex flex-col justify-end",children:s.jsxs("label",{className:"flex items-start gap-2 cursor-pointer bg-gray-50 border border-gray-200 rounded-lg p-3",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:()=>i(!r),className:"w-4 h-4 rounded border-gray-300 text-orange-600 mt-0.5"}),s.jsx("span",{className:"text-xs font-bold uppercase text-gray-700 leading-relaxed",children:"PACIENTE CIENTE E DE ACORDO COM A COBRANÇA SEPARADA DA CONTENÇÃO"})]})})]}),r&&s.jsxs("div",{className:"mt-3 bg-green-50 border border-green-200 rounded-lg p-3 flex items-center gap-2",children:[s.jsx(Ga,{size:16,className:"text-green-500"}),s.jsxs("span",{className:"text-xs font-bold text-green-700 uppercase",children:["TERMO ACEITO — R$ ",e.toLocaleString("pt-BR",{minimumFractionDigits:2})]})]})]})},GP=({t})=>{const e=$e(),[n,r]=A.useState([]),[i,c]=A.useState("LIMPEZA / PROFILAXIA"),[d,f]=A.useState(""),[h,p]=A.useState(""),b=["LIMPEZA / PROFILAXIA","DENTE COM CÁRIE","DENTE PARA EXTRAIR","RASPAGEM PERIODONTAL"],y=()=>{r(v=>[...v,{tipo:i,dente:d.toUpperCase()||void 0,obs:h.toUpperCase()||void 0}]),f(""),p(""),e.success("SOLICITAÇÃO ADICIONADA!")},x=v=>{r(N=>N.filter((j,S)=>S!==v))};return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(aa,{size:16,className:"text-red-500"})," SOLICITAÇÕES CLÍNICAS"]}),n.length>0&&s.jsx("div",{className:"space-y-2 mb-4",children:n.map((v,N)=>s.jsxs("div",{className:"flex items-center justify-between bg-gray-50 border border-gray-200 rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${v.tipo.includes("CÁRIE")?"bg-red-500":v.tipo.includes("EXTRAIR")?"bg-orange-500":v.tipo.includes("RASPAGEM")?"bg-purple-500":"bg-blue-500"}`}),s.jsxs("div",{children:[s.jsx("span",{className:"text-xs font-bold text-gray-800 uppercase",children:v.tipo}),v.dente&&s.jsxs("span",{className:"text-[10px] text-gray-500 ml-2",children:["DENTE: ",v.dente]}),v.obs&&s.jsx("p",{className:"text-[10px] text-gray-400 italic",children:v.obs})]})]}),s.jsx("button",{onClick:()=>x(N),className:"text-gray-400 hover:text-red-500 transition-colors",children:s.jsx(Qe,{size:16})})]},N))}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"TIPO"}),s.jsx("select",{value:i,onChange:v=>c(v.target.value),className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white mt-1 text-sm",children:b.map(v=>s.jsx("option",{children:v},v))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"DENTE (OPCIONAL)"}),s.jsx("input",{type:"text",value:d,onChange:v=>f(v.target.value),placeholder:"EX: 36, 14",className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white mt-1 text-sm uppercase"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"OBSERVAÇÃO"}),s.jsx("input",{type:"text",value:h,onChange:v=>p(v.target.value),placeholder:"DETALHES...",className:"w-full border border-gray-300 rounded-lg p-2.5 bg-white mt-1 text-sm uppercase"})]})]}),s.jsxs("button",{onClick:y,className:"mt-3 w-full border-2 border-dashed border-gray-300 hover:border-blue-400 hover:bg-blue-50 py-2.5 rounded-lg text-xs font-bold text-gray-500 hover:text-blue-600 uppercase transition-colors flex items-center justify-center gap-2",children:[s.jsx(gt,{size:14})," ADICIONAR SOLICITAÇÃO"]})]})},FP=({t})=>{const e=$e(),n=()=>{const c=[...t.evolucoes].sort((f,h)=>new Date(f.data).getTime()-new Date(h.data).getTime()),d=["════════════════════════════════════════════════════════"," RELATÓRIO DE MANUTENÇÕES ORTODÔNTICAS","════════════════════════════════════════════════════════","",`PACIENTE: ${t.pacienteNome}`,`APARELHO: ${t.tipoAparelho}`,`INÍCIO: ${new Date(t.dataInicio).toLocaleDateString()}`,`STATUS: ${t.status}`,`FASE ATUAL: ${t.faseAtual||"—"}`,`FIO ATUAL: ${t.fioAtual||"—"}`,`PROGRESSO: ${t.percentualConcluido??"—"}%`,"","────────────────────────────────────────────────────────",` TOTAL DE ATENDIMENTOS: ${c.length}`,"────────────────────────────────────────────────────────",""];return c.forEach((f,h)=>{var p;d.push(` #${h+1} | ${new Date(f.data).toLocaleDateString()} | ${f.tipo}`),d.push(` ${f.procedimento}`),f.fio&&d.push(` FIO: ${f.fio}`),f.elastico&&d.push(` ELÁSTICO: ${f.elastico}`),(p=f.procedimentos)!=null&&p.length&&d.push(` PROC: ${f.procedimentos.join(", ")}`),f.higiene!=null&&d.push(` HIGIENE: ${f.higiene}/10`),f.cooperacao&&d.push(` COOPERAÇÃO: ${f.cooperacao}`),f.observacoes&&d.push(` OBS: ${f.observacoes}`),d.push(` PRÓXIMO RETORNO: ${new Date(f.proximoRetorno).toLocaleDateString()}`),d.push("")}),d.push("────────────────────────────────────────────────────────"),d.push(` GERADO EM: ${new Date().toLocaleString()}`),d.push(" SCOREODONTO — GESTÃO ORTODÔNTICA"),d.push("════════════════════════════════════════════════════════"),d.join(` +`)},r=()=>{const c=n(),d=new Blob([c],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(d),h=document.createElement("a");h.href=f,h.download=`RELATORIO_ORTO_${t.pacienteNome.replace(/\s+/g,"_")}_${new Date().toISOString().split("T")[0]}.txt`,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(f),e.success("RELATÓRIO EXPORTADO COM SUCESSO!")},i=()=>{const c=n();navigator.clipboard.writeText(c).then(()=>{e.success("RELATÓRIO COPIADO PARA ÁREA DE TRANSFERÊNCIA!")})};return s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm p-5",children:[s.jsxs("h3",{className:"font-bold text-gray-700 uppercase text-sm flex items-center gap-2 mb-4",children:[s.jsx(nv,{size:16,className:"text-teal-500"})," RELATÓRIO DE MANUTENÇÕES"]}),s.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 mb-4",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-center",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-gray-800",children:t.evolucoes.length}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"ATENDIMENTOS"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-gray-800",children:new Date(t.dataInicio).toLocaleDateString()}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"INÍCIO"})]}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-2xl font-bold text-gray-800",children:[t.percentualConcluido??"—","%"]}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"PROGRESSO"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-gray-800",children:t.mesesRestantes??"—"}),s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"MESES REST."})]})]})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[s.jsxs("button",{onClick:r,className:"bg-teal-600 hover:bg-teal-700 text-white py-3 rounded-lg font-bold uppercase text-sm transition-colors shadow-sm flex items-center justify-center gap-2",children:[s.jsx(nv,{size:16})," EXPORTAR RELATÓRIO (.TXT)"]}),s.jsxs("button",{onClick:i,className:"bg-gray-600 hover:bg-gray-700 text-white py-3 rounded-lg font-bold uppercase text-sm transition-colors shadow-sm flex items-center justify-center gap-2",children:[s.jsx(HN,{size:16})," COPIAR PARA ÁREA DE TRANSFERÊNCIA"]})]})]})},vt=({label:t,value:e,highlight:n})=>s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:t}),s.jsx("p",{className:`font-bold uppercase mt-0.5 ${n?"text-blue-600":"text-gray-800"}`,children:e||"—"})]}),VP=({treatment:t,onClose:e})=>{const[n,r]=A.useState(t),{refresh:i}=Ie(K.getOrtoTreatments),c=A.useCallback(()=>{K.getOrtoTreatments().then(d=>{const f=d.find(h=>h.id===n.id);f&&r(f)})},[n.id]);return A.useEffect(()=>{const d=f=>{f.key==="Escape"&&e()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e]),s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-gray-50 shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-3 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-white",children:[s.jsxs("button",{onClick:e,className:"flex items-center gap-2 text-gray-500 hover:text-gray-800 text-xs font-bold uppercase transition-colors",children:[s.jsx(zN,{size:16})," VOLTAR À LISTA"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`px-3 py-1 rounded-full text-[10px] font-bold uppercase ${n.status==="Finalizado"?"bg-green-100 text-green-700":n.status==="Contenção"?"bg-blue-100 text-blue-700":"bg-amber-100 text-amber-700"}`,children:n.status}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:20})})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 lg:p-6 space-y-5",children:[s.jsx(_P,{t:n}),s.jsx(MP,{t:n}),s.jsx(IP,{t:n}),s.jsx(LP,{t:n}),s.jsx(zP,{evolucoes:n.evolucoes}),s.jsx(PP,{tratamentoId:n.id,currentFio:n.fioAtual,onSaved:c}),s.jsx(UP,{t:n}),s.jsx(HP,{t:n}),s.jsx(GP,{t:n}),s.jsx(FP,{t:n}),s.jsx(BP,{t:n,onFinalize:()=>{i(),e()}})]})]})})},qP=()=>{const{data:t,refresh:e}=Ie(K.getOrtoTreatments),[n,r]=A.useState(null);return s.jsxs("div",{className:"space-y-6",children:[s.jsx(fn,{title:"GESTÃO ORTODÔNTICA",children:s.jsxs("button",{className:"bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 hover:bg-blue-700 text-xs font-bold uppercase transition-colors shadow-sm",children:[s.jsx(gt,{size:18})," NOVO TRATAMENTO"]})}),s.jsx("div",{className:"grid grid-cols-1 gap-6",children:t==null?void 0:t.map(i=>s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-shadow cursor-pointer",onClick:()=>r(i),children:[s.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50 flex justify-between items-center",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 bg-purple-100 text-purple-600 rounded-full flex items-center justify-center font-bold text-sm",children:i.pacienteNome.substring(0,2).toUpperCase()}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-gray-900 uppercase",children:i.pacienteNome}),s.jsxs("p",{className:"text-[10px] text-gray-500 uppercase font-bold",children:[i.tipoAparelho," • INÍCIO: ",new Date(i.dataInicio).toLocaleDateString(),i.faseAtual&&` • FASE: ${i.faseAtual}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[i.percentualConcluido!=null&&s.jsxs("div",{className:"hidden md:flex items-center gap-2",children:[s.jsx("div",{className:"w-24 bg-gray-200 rounded-full h-1.5",children:s.jsx("div",{className:"bg-blue-500 h-1.5 rounded-full",style:{width:`${i.percentualConcluido}%`}})}),s.jsxs("span",{className:"text-[10px] font-bold text-gray-500",children:[i.percentualConcluido,"%"]})]}),i.cooperacao&&s.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full uppercase hidden lg:inline-block ${Um[i.cooperacao]||""}`,children:i.cooperacao}),s.jsx("span",{className:`px-3 py-1 rounded-full text-[10px] font-bold uppercase ${i.status==="Finalizado"?"bg-green-100 text-green-700":i.status==="Contenção"?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"}`,children:i.status})]})]}),s.jsxs("div",{className:"p-4",children:[s.jsxs("h4",{className:"text-xs font-bold text-gray-500 mb-3 flex items-center gap-2 uppercase",children:[s.jsx($l,{size:14})," ÚLTIMAS EVOLUÇÕES"]}),s.jsx("div",{className:"space-y-2",children:i.evolucoes.slice(-2).map(c=>s.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[s.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full flex-shrink-0"}),s.jsx("span",{className:"font-bold text-gray-700",children:new Date(c.data).toLocaleDateString()}),s.jsx("span",{className:"text-gray-500 truncate uppercase",children:c.procedimento})]},c.id))}),i.flags&&i.flags.length>0&&s.jsx("div",{className:"flex gap-2 mt-3 pt-3 border-t border-gray-100",children:i.flags.map((c,d)=>{const f=pu[c.tipo]||pu.info;return s.jsx("span",{className:`text-[9px] font-bold px-2 py-1 rounded-lg border uppercase ${f.bg} ${f.text}`,children:c.mensagem},d)})})]})]},i.id))}),n&&s.jsx(VP,{treatment:n,onClose:()=>{r(null),e()}})]})};function $P(t,e){const[n,r]=A.useState(t);return A.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}const YP=({onClose:t,onSaved:e})=>{const n=$e(),[r,i]=A.useState(null),[c,d]=A.useState(""),[f,h]=A.useState(!1),p=$P(c,400),[b,y]=A.useState([]),[x,v]=A.useState(!1);A.useEffect(()=>{if(!p){y([]);return}v(!0),K.getPacientes(p).then(w=>{y(w),v(!1)})},[p]);const N=w=>{i(w),d(""),h(!1)},[j,S]=A.useState({id:crypto.randomUUID(),descricao:"",valor:"",dataVencimento:new Date().toISOString().split("T")[0],status:"Pendente",formaPagamento:"Pix"});A.useEffect(()=>{const w=D=>{D.key==="Escape"&&t()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[t]);const R=async w=>{if(w.preventDefault(),!r||!j.descricao||!j.valor){n.error("PREENCHA TODOS OS CAMPOS OBRIGATÓRIOS.");return}try{await K.saveFinanceiro({...j,pacienteNome:r.nome,valor:parseFloat(j.valor)}),n.success("LANÇAMENTO SALVO COM SUCESSO!"),e(),t()}catch{n.error("ERRO AO SALVAR LANÇAMENTO.")}};return s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("form",{onSubmit:R,className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-green-50 to-white",children:[s.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[s.jsx(Fa,{size:22,className:"text-green-600"})," NOVO LANÇAMENTO"]}),s.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"PACIENTE *"}),r?s.jsxs("div",{className:"w-full lg:w-1/2 bg-green-50 border border-green-200 p-3 lg:p-4 rounded-lg mt-2 flex justify-between items-center",children:[s.jsx("span",{className:"font-bold text-green-800 uppercase text-sm lg:text-base",children:r.nome}),s.jsx("button",{type:"button",onClick:()=>i(null),className:"text-xs font-bold bg-blue-100 text-blue-700 hover:bg-blue-200 px-3 py-1.5 rounded-md transition-colors",children:"ALTERAR"})]}):s.jsxs("div",{className:"relative mt-2",children:[s.jsx("input",{type:"text",value:c,onChange:w=>d(w.target.value.toUpperCase()),onFocus:()=>h(!0),onBlur:()=>setTimeout(()=>h(!1),200),placeholder:"DIGITE O NOME OU CPF...",className:"w-full lg:w-1/2 bg-gray-100 p-3 lg:p-4 rounded-lg font-bold text-gray-800 uppercase focus:border-blue-500 outline-none border-2 border-transparent focus:border-2 text-sm lg:text-base"}),f&&p&&s.jsxs("ul",{className:"absolute z-10 w-full lg:w-1/2 bg-white border border-gray-300 rounded-lg mt-1 max-h-48 overflow-y-auto shadow-lg",children:[x&&s.jsx("li",{className:"p-3 text-sm text-gray-500",children:"BUSCANDO..."}),b.map(w=>s.jsxs("li",{onMouseDown:()=>N(w),className:"p-3 hover:bg-gray-100 cursor-pointer uppercase font-semibold text-sm",children:[w.nome," (",w.cpf,")"]},w.id)),!x&&b.length===0&&s.jsx("li",{className:"p-3 text-sm text-gray-500",children:"NENHUM PACIENTE ENCONTRADO."})]})]})]}),s.jsxs("div",{className:"lg:grid lg:grid-cols-2 lg:gap-x-8 lg:gap-y-5 space-y-5 lg:space-y-0",children:[s.jsxs("div",{className:"lg:col-span-2",children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"DESCRIÇÃO *"}),s.jsx("input",{type:"text",required:!0,value:j.descricao,onChange:w=>S(D=>({...D,descricao:w.target.value.toUpperCase()})),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 uppercase-input text-sm",placeholder:"EX: CONSULTA AVALIAÇÃO, LIMPEZA..."})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"VALOR (R$) *"}),s.jsx("input",{type:"number",step:"0.01",required:!0,value:j.valor,onChange:w=>S(D=>({...D,valor:w.target.value})),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 text-sm",placeholder:"0,00"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"DATA VENCIMENTO"}),s.jsx("input",{type:"date",value:j.dataVencimento,onChange:w=>S(D=>({...D,dataVencimento:w.target.value})),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 text-sm"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"STATUS"}),s.jsxs("select",{value:j.status,onChange:w=>S(D=>({...D,status:w.target.value})),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 bg-white text-sm uppercase-select",children:[s.jsx("option",{value:"Pendente",children:"PENDENTE"}),s.jsx("option",{value:"Pago",children:"PAGO"}),s.jsx("option",{value:"Atrasado",children:"ATRASADO"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"FORMA DE PAGAMENTO"}),s.jsxs("select",{value:j.formaPagamento,onChange:w=>S(D=>({...D,formaPagamento:w.target.value})),className:"w-full mt-2 border border-gray-300 rounded-lg p-2.5 lg:p-3 bg-white text-sm uppercase-select",children:[s.jsx("option",{value:"Pix",children:"PIX"}),s.jsx("option",{value:"Boleto",children:"BOLETO"}),s.jsx("option",{value:"Cartão",children:"CARTÃO"}),s.jsx("option",{value:"Dinheiro",children:"DINHEIRO"})]})]})]})]}),s.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-t border-gray-200 flex justify-end gap-3 flex-shrink-0",children:[s.jsx("button",{type:"button",onClick:t,className:"px-6 py-2.5 bg-gray-200 hover:bg-gray-300 text-gray-700 font-bold rounded-lg text-sm uppercase transition-colors",children:"CANCELAR"}),s.jsxs("button",{type:"submit",className:"px-8 py-2.5 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg shadow-sm text-sm uppercase flex items-center gap-2 transition-colors",children:[s.jsx(gt,{size:16})," SALVAR"]})]})]})})},QP=()=>{const[t,e]=A.useState([]),[n,r]=A.useState(!0),[i,c]=A.useState("TODOS"),[d,f]=A.useState(!1),[h,p]=A.useState(!1),b=$e(),y=A.useCallback(()=>{r(!0),K.getFinanceiro().then(C=>{e(C),r(!1)})},[]);A.useEffect(()=>{y()},[y]);const x=i==="TODOS"?t:t.filter(C=>C.status===i),v=t.filter(C=>C.status==="Pago").reduce((C,I)=>C+Number(I.valor),0),N=t.filter(C=>C.status==="Pendente").reduce((C,I)=>C+Number(I.valor),0),j=t.filter(C=>C.status==="Atrasado").reduce((C,I)=>C+Number(I.valor),0),S=async C=>{if(window.confirm(`CONFIRMAR PAGAMENTO DE R$ ${Number(C.valor).toFixed(2)} DE ${C.pacienteNome}?`))try{await K.updateFinanceiro({...C,status:"Pago"}),b.success(`PAGAMENTO DE ${C.pacienteNome} CONFIRMADO!`),y()}catch{b.error("ERRO AO CONFIRMAR PAGAMENTO.")}},R=async C=>{if(window.confirm(`TEM CERTEZA QUE DESEJA EXCLUIR O LANÇAMENTO DE ${C.pacienteNome}? ESTA AÇÃO NÃO PODE SER DESFEITA.`))try{await K.deleteFinanceiro(C.id),b.success("LANÇAMENTO EXCLUÍDO!"),y()}catch{b.error("ERRO AO EXCLUIR LANÇAMENTO.")}},w=C=>{b.success(`RECIBO DE ${C.pacienteNome} GERADO COM SUCESSO!`)},D=i==="TODOS"?"FILTRAR":i.toUpperCase();return s.jsxs("div",{className:"space-y-6",children:[s.jsx(fn,{title:"FINANCEIRO & FATURAMENTO",children:s.jsxs("div",{className:"flex gap-2 relative",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>f(!d),className:`border px-3 py-2 rounded-lg flex items-center gap-2 font-bold text-xs uppercase transition-colors ${i!=="TODOS"?"bg-blue-50 border-blue-300 text-blue-700":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50"}`,children:[s.jsx(yu,{size:18})," ",D]}),d&&s.jsx("div",{className:"absolute right-0 top-full mt-1 bg-white border border-gray-200 rounded-lg shadow-xl z-20 min-w-[160px] overflow-hidden",children:["TODOS","Pago","Pendente","Atrasado"].map(C=>s.jsxs("button",{onClick:()=>{c(C),f(!1)},className:`w-full text-left px-4 py-2.5 text-sm font-bold uppercase hover:bg-gray-50 transition-colors flex items-center justify-between ${i===C?"text-blue-700 bg-blue-50":"text-gray-700"}`,children:[C.toUpperCase(),i===C&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-600"})]},C))})]}),s.jsxs("button",{onClick:()=>p(!0),className:"bg-green-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 hover:bg-green-700 font-bold text-xs uppercase shadow-sm transition-colors",children:[s.jsx(gt,{size:18})," NOVO LANÇAMENTO"]})]})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"bg-white p-6 rounded-xl border border-gray-200 shadow-sm flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 font-bold mb-1 uppercase",children:"RECEBIDO (MÊS)"}),s.jsxs("h3",{className:"text-2xl font-bold text-green-600",children:["R$ ",v.toLocaleString("pt-BR",{minimumFractionDigits:2})]})]}),s.jsx("div",{className:"bg-green-100 p-3 rounded-full text-green-600",children:s.jsx(XN,{size:24})})]}),s.jsxs("div",{className:"bg-white p-6 rounded-xl border border-gray-200 shadow-sm flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 font-bold mb-1 uppercase",children:"A RECEBER / PENDENTE"}),s.jsxs("h3",{className:"text-2xl font-bold text-yellow-600",children:["R$ ",N.toLocaleString("pt-BR",{minimumFractionDigits:2})]})]}),s.jsx("div",{className:"bg-yellow-100 p-3 rounded-full text-yellow-600",children:s.jsx(Yl,{size:24})})]}),s.jsxs("div",{className:"bg-white p-6 rounded-xl border border-gray-200 shadow-sm flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 font-bold mb-1 uppercase",children:"EM ATRASO"}),s.jsxs("h3",{className:"text-2xl font-bold text-red-600",children:["R$ ",j.toLocaleString("pt-BR",{minimumFractionDigits:2})]})]}),s.jsx("div",{className:"bg-red-100 p-3 rounded-full text-red-600",children:s.jsx(vO,{size:24})})]})]}),s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:[s.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gray-50 flex justify-between items-center",children:[s.jsxs("h3",{className:"font-bold text-gray-800 uppercase",children:["LANÇAMENTOS ",i!=="TODOS"&&s.jsxs("span",{className:"text-blue-600 text-sm",children:["(",i.toUpperCase(),")"]})]}),s.jsxs("span",{className:"text-xs text-gray-400 font-bold uppercase",children:[x.length," REGISTRO(S)"]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm text-left",children:[s.jsx("thead",{className:"bg-gray-50 text-gray-500 uppercase text-xs font-bold",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-6 py-3",children:"PACIENTE"}),s.jsx("th",{className:"px-6 py-3",children:"DESCRIÇÃO"}),s.jsx("th",{className:"px-6 py-3",children:"VENCIMENTO"}),s.jsx("th",{className:"px-6 py-3",children:"VALOR"}),s.jsx("th",{className:"px-6 py-3",children:"STATUS"}),s.jsx("th",{className:"px-6 py-3 text-right",children:"AÇÕES"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-100",children:n?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"p-6 text-center text-gray-500 uppercase font-bold",children:s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(Ot,{className:"animate-spin",size:18})," CARREGANDO..."]})})}):x.length===0?s.jsx("tr",{children:s.jsxs("td",{colSpan:6,className:"p-10 text-center text-gray-400 uppercase font-bold text-sm",children:["NENHUM LANÇAMENTO ENCONTRADO ",i!=="TODOS"&&`COM STATUS "${i.toUpperCase()}"`,"."]})}):x.map(C=>{var I;return s.jsxs("tr",{className:"hover:bg-gray-50 transition-colors",children:[s.jsx("td",{className:"px-6 py-4 font-bold text-gray-900 uppercase",children:C.pacienteNome}),s.jsxs("td",{className:"px-6 py-4 text-gray-600 font-medium uppercase",children:[C.descricao,s.jsx("span",{className:"text-[10px] text-gray-400 block font-bold",children:(I=C.formaPagamento)==null?void 0:I.toUpperCase()})]}),s.jsx("td",{className:"px-6 py-4 text-gray-600 font-medium",children:new Date(C.dataVencimento).toLocaleDateString("pt-BR")}),s.jsxs("td",{className:"px-6 py-4 font-bold text-gray-800",children:["R$ ",Number(C.valor).toLocaleString("pt-BR",{minimumFractionDigits:2})]}),s.jsx("td",{className:"px-6 py-4",children:s.jsx("span",{className:`px-2.5 py-1 rounded-full text-[10px] font-bold uppercase + ${C.status==="Pago"?"bg-green-100 text-green-700":C.status==="Atrasado"?"bg-red-100 text-red-700":"bg-yellow-100 text-yellow-700"}`,children:C.status})}),s.jsx("td",{className:"px-6 py-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-1",children:[C.status!=="Pago"&&s.jsx("button",{onClick:()=>S(C),title:"CONFIRMAR PAGAMENTO",className:"p-1.5 text-green-600 hover:bg-green-50 rounded-lg transition-colors",children:s.jsx(Ga,{size:18})}),s.jsx("button",{onClick:()=>w(C),title:"GERAR RECIBO",className:"p-1.5 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",children:s.jsx(kg,{size:18})}),s.jsx("button",{onClick:()=>R(C),title:"EXCLUIR",className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors",children:s.jsx(Qt,{size:18})})]})})]},C.id)})})]})})]}),d&&s.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>f(!1)}),h&&s.jsx(YP,{onClose:()=>p(!1),onSaved:y})]})};var $o=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},gr,Ss,Cl,jN,WP=(jN=class extends $o{constructor(){super();we(this,gr);we(this,Ss);we(this,Cl);me(this,Cl,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){U(this,Ss)||this.setEventListener(U(this,Cl))}onUnsubscribe(){var e;this.hasListeners()||((e=U(this,Ss))==null||e.call(this),me(this,Ss,void 0))}setEventListener(e){var n;me(this,Cl,e),(n=U(this,Ss))==null||n.call(this),me(this,Ss,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){U(this,gr)!==e&&(me(this,gr,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof U(this,gr)=="boolean"?U(this,gr):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},gr=new WeakMap,Ss=new WeakMap,Cl=new WeakMap,jN),Bm=new WP,XP={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},As,Og,SN,ZP=(SN=class{constructor(){we(this,As,XP);we(this,Og,!1)}setTimeoutProvider(t){me(this,As,t)}setTimeout(t,e){return U(this,As).setTimeout(t,e)}clearTimeout(t){U(this,As).clearTimeout(t)}setInterval(t,e){return U(this,As).setInterval(t,e)}clearInterval(t){U(this,As).clearInterval(t)}},As=new WeakMap,Og=new WeakMap,SN),pr=new ZP;function KP(t){setTimeout(t,0)}var JP=typeof window>"u"||"Deno"in globalThis;function dn(){}function eU(t,e){return typeof t=="function"?t(e):t}function pg(t){return typeof t=="number"&&t>=0&&t!==1/0}function iA(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Ps(t,e){return typeof t=="function"?t(e):t}function An(t,e){return typeof t=="function"?t(e):t}function tN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:c,queryKey:d,stale:f}=t;if(d){if(r){if(e.queryHash!==Hm(d,e.options))return!1}else if(!Co(e.queryKey,d))return!1}if(n!=="all"){const h=e.isActive();if(n==="active"&&!h||n==="inactive"&&h)return!1}return!(typeof f=="boolean"&&e.isStale()!==f||i&&i!==e.state.fetchStatus||c&&!c(e))}function nN(t,e){const{exact:n,status:r,predicate:i,mutationKey:c}=t;if(c){if(!e.options.mutationKey)return!1;if(n){if(wo(e.options.mutationKey)!==wo(c))return!1}else if(!Co(e.options.mutationKey,c))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Hm(t,e){return((e==null?void 0:e.queryKeyHashFn)||wo)(t)}function wo(t){return JSON.stringify(t,(e,n)=>mg(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Co(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Co(t[n],e[n])):!1}var tU=Object.prototype.hasOwnProperty;function oA(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=aN(t)&&aN(e);if(!r&&!(mg(t)&&mg(e)))return e;const c=(r?t:Object.keys(t)).length,d=r?e:Object.keys(e),f=d.length,h=r?new Array(f):{};let p=0;for(let b=0;b{pr.setTimeout(e,t)})}function xg(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?oA(t,e):e}function aU(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function sU(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Gm=Symbol();function cA(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Gm?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function dA(t,e){return typeof t=="function"?t(...e):!!t}function rU(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var Do=(()=>{let t=()=>JP;return{isServer(){return t()},setIsServer(e){t=e}}})();function bg(){let t,e;const n=new Promise((i,c)=>{t=i,e=c});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var lU=KP;function iU(){let t=[],e=0,n=f=>{f()},r=f=>{f()},i=lU;const c=f=>{e?t.push(f):i(()=>{n(f)})},d=()=>{const f=t;t=[],f.length&&i(()=>{r(()=>{f.forEach(h=>{n(h)})})})};return{batch:f=>{let h;e++;try{h=f()}finally{e--,e||d()}return h},batchCalls:f=>(...h)=>{c(()=>{f(...h)})},schedule:c,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{r=f},setScheduler:f=>{i=f}}}var Gt=iU(),Dl,ws,Ol,AN,oU=(AN=class extends $o{constructor(){super();we(this,Dl,!0);we(this,ws);we(this,Ol);me(this,Ol,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){U(this,ws)||this.setEventListener(U(this,Ol))}onUnsubscribe(){var e;this.hasListeners()||((e=U(this,ws))==null||e.call(this),me(this,ws,void 0))}setEventListener(e){var n;me(this,Ol,e),(n=U(this,ws))==null||n.call(this),me(this,ws,e(this.setOnline.bind(this)))}setOnline(e){U(this,Dl)!==e&&(me(this,Dl,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return U(this,Dl)}},Dl=new WeakMap,ws=new WeakMap,Ol=new WeakMap,AN),gu=new oU;function cU(t){return Math.min(1e3*2**t,3e4)}function uA(t){return(t??"online")==="online"?gu.isOnline():!0}var yg=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function fA(t){let e=!1,n=0,r;const i=bg(),c=()=>i.status!=="pending",d=j=>{var S;if(!c()){const R=new yg(j);x(R),(S=t.onCancel)==null||S.call(t,R)}},f=()=>{e=!0},h=()=>{e=!1},p=()=>Bm.isFocused()&&(t.networkMode==="always"||gu.isOnline())&&t.canRun(),b=()=>uA(t.networkMode)&&t.canRun(),y=j=>{c()||(r==null||r(),i.resolve(j))},x=j=>{c()||(r==null||r(),i.reject(j))},v=()=>new Promise(j=>{var S;r=R=>{(c()||p())&&j(R)},(S=t.onPause)==null||S.call(t)}).then(()=>{var j;r=void 0,c()||(j=t.onContinue)==null||j.call(t)}),N=()=>{if(c())return;let j;const S=n===0?t.initialPromise:void 0;try{j=S??t.fn()}catch(R){j=Promise.reject(R)}Promise.resolve(j).then(y).catch(R=>{var L;if(c())return;const w=t.retry??(Do.isServer()?0:3),D=t.retryDelay??cU,C=typeof D=="function"?D(n,R):D,I=w===!0||typeof w=="number"&&np()?void 0:v()).then(()=>{e?x(R):N()})})};return{promise:i,status:()=>i.status,cancel:d,continue:()=>(r==null||r(),i),cancelRetry:f,continueRetry:h,canStart:b,start:()=>(b()?N():v().then(N),i)}}var mr,wN,hA=(wN=class{constructor(){we(this,mr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),pg(this.gcTime)&&me(this,mr,pr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Do.isServer()?1/0:300*1e3))}clearGcTimeout(){U(this,mr)!==void 0&&(pr.clearTimeout(U(this,mr)),me(this,mr,void 0))}},mr=new WeakMap,wN);function dU(t){return{onFetch:(e,n)=>{var b,y,x,v,N;const r=e.options,i=(x=(y=(b=e.fetchOptions)==null?void 0:b.meta)==null?void 0:y.fetchMore)==null?void 0:x.direction,c=((v=e.state.data)==null?void 0:v.pages)||[],d=((N=e.state.data)==null?void 0:N.pageParams)||[];let f={pages:[],pageParams:[]},h=0;const p=async()=>{let j=!1;const S=D=>{rU(D,()=>e.signal,()=>j=!0)},R=cA(e.options,e.fetchOptions),w=async(D,C,I)=>{if(j)return Promise.reject(e.signal.reason);if(C==null&&D.pages.length)return Promise.resolve(D);const F=(()=>{const H={client:e.client,queryKey:e.queryKey,pageParam:C,direction:I?"backward":"forward",meta:e.options.meta};return S(H),H})(),Y=await R(F),{maxPages:$}=e.options,M=I?sU:aU;return{pages:M(D.pages,Y,$),pageParams:M(D.pageParams,C,$)}};if(i&&c.length){const D=i==="backward",C=D?uU:rN,I={pages:c,pageParams:d},L=C(r,I);f=await w(I,L,D)}else{const D=t??c.length;do{const C=h===0?d[0]??r.initialPageParam:rN(r,f);if(h>0&&C==null)break;f=await w(f,C),h++}while(h{var j,S;return(S=(j=e.options).persister)==null?void 0:S.call(j,p,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=p}}}function rN(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function uU(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Rl,xr,Tl,qn,br,_t,Ro,yr,jn,pA,Ia,CN,fU=(CN=class extends hA{constructor(e){super();we(this,jn);we(this,Rl);we(this,xr);we(this,Tl);we(this,qn);we(this,br);we(this,_t);we(this,Ro);we(this,yr);me(this,yr,!1),me(this,Ro,e.defaultOptions),this.setOptions(e.options),this.observers=[],me(this,br,e.client),me(this,qn,U(this,br).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,me(this,xr,iN(this.options)),this.state=e.state??U(this,xr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return U(this,Rl)}get promise(){var e;return(e=U(this,_t))==null?void 0:e.promise}setOptions(e){if(this.options={...U(this,Ro),...e},e!=null&&e._type&&me(this,Rl,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=iN(this.options);n.data!==void 0&&(this.setState(lN(n.data,n.dataUpdatedAt)),me(this,xr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&U(this,qn).remove(this)}setData(e,n){const r=xg(this.state.data,e,this.options);return He(this,jn,Ia).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){He(this,jn,Ia).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=U(this,_t))==null?void 0:r.promise;return(i=U(this,_t))==null||i.cancel(e),n?n.then(dn).catch(dn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return U(this,xr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>An(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Gm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ps(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!iA(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=U(this,_t))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=U(this,_t))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),U(this,qn).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(U(this,_t)&&(U(this,yr)||He(this,jn,pA).call(this)?U(this,_t).cancel({revert:!0}):U(this,_t).cancelRetry()),this.scheduleGc()),U(this,qn).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||He(this,jn,Ia).call(this,{type:"invalidate"})}async fetch(e,n){var p,b,y,x,v,N,j,S,R,w,D;if(this.state.fetchStatus!=="idle"&&((p=U(this,_t))==null?void 0:p.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(U(this,_t))return U(this,_t).continueRetry(),U(this,_t).promise}if(e&&this.setOptions(e),!this.options.queryFn){const C=this.observers.find(I=>I.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,i=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(me(this,yr,!0),r.signal)})},c=()=>{const C=cA(this.options,n),L=(()=>{const F={client:U(this,br),queryKey:this.queryKey,meta:this.meta};return i(F),F})();return me(this,yr,!1),this.options.persister?this.options.persister(C,L,this):C(L)},f=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:U(this,br),state:this.state,fetchFn:c};return i(C),C})(),h=U(this,Rl)==="infinite"?dU(this.options.pages):this.options.behavior;h==null||h.onFetch(f,this),me(this,Tl,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((b=f.fetchOptions)==null?void 0:b.meta))&&He(this,jn,Ia).call(this,{type:"fetch",meta:(y=f.fetchOptions)==null?void 0:y.meta}),me(this,_t,fA({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:C=>{C instanceof yg&&C.revert&&this.setState({...U(this,Tl),fetchStatus:"idle"}),r.abort()},onFail:(C,I)=>{He(this,jn,Ia).call(this,{type:"failed",failureCount:C,error:I})},onPause:()=>{He(this,jn,Ia).call(this,{type:"pause"})},onContinue:()=>{He(this,jn,Ia).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const C=await U(this,_t).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(v=(x=U(this,qn).config).onSuccess)==null||v.call(x,C,this),(j=(N=U(this,qn).config).onSettled)==null||j.call(N,C,this.state.error,this),C}catch(C){if(C instanceof yg){if(C.silent)return U(this,_t).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw He(this,jn,Ia).call(this,{type:"error",error:C}),(R=(S=U(this,qn).config).onError)==null||R.call(S,C,this),(D=(w=U(this,qn).config).onSettled)==null||D.call(w,this.state.data,C,this),C}finally{this.scheduleGc()}}},Rl=new WeakMap,xr=new WeakMap,Tl=new WeakMap,qn=new WeakMap,br=new WeakMap,_t=new WeakMap,Ro=new WeakMap,yr=new WeakMap,jn=new WeakSet,pA=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Ia=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...gA(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...lN(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return me(this,Tl,e.manual?i:void 0),i;case"error":const c=e.error;return{...r,error:c,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:c,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Gt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),U(this,qn).notify({query:this,type:"updated",action:e})})},CN);function gA(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uA(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function lN(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function iN(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var cn,Fe,To,Jt,vr,kl,La,Cs,ko,_l,Ml,Nr,Er,Ds,Il,Je,io,vg,Ng,Eg,jg,Sg,Ag,wg,mA,DN,hU=(DN=class extends $o{constructor(e,n){super();we(this,Je);we(this,cn);we(this,Fe);we(this,To);we(this,Jt);we(this,vr);we(this,kl);we(this,La);we(this,Cs);we(this,ko);we(this,_l);we(this,Ml);we(this,Nr);we(this,Er);we(this,Ds);we(this,Il,new Set);this.options=n,me(this,cn,e),me(this,Cs,null),me(this,La,bg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(U(this,Fe).addObserver(this),oN(U(this,Fe),this.options)?He(this,Je,io).call(this):this.updateResult(),He(this,Je,jg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Cg(U(this,Fe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Cg(U(this,Fe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,He(this,Je,Sg).call(this),He(this,Je,Ag).call(this),U(this,Fe).removeObserver(this)}setOptions(e){const n=this.options,r=U(this,Fe);if(this.options=U(this,cn).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof An(this.options.enabled,U(this,Fe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");He(this,Je,wg).call(this),U(this,Fe).setOptions(this.options),n._defaulted&&!gg(this.options,n)&&U(this,cn).getQueryCache().notify({type:"observerOptionsUpdated",query:U(this,Fe),observer:this});const i=this.hasListeners();i&&cN(U(this,Fe),r,this.options,n)&&He(this,Je,io).call(this),this.updateResult(),i&&(U(this,Fe)!==r||An(this.options.enabled,U(this,Fe))!==An(n.enabled,U(this,Fe))||Ps(this.options.staleTime,U(this,Fe))!==Ps(n.staleTime,U(this,Fe)))&&He(this,Je,vg).call(this);const c=He(this,Je,Ng).call(this);i&&(U(this,Fe)!==r||An(this.options.enabled,U(this,Fe))!==An(n.enabled,U(this,Fe))||c!==U(this,Ds))&&He(this,Je,Eg).call(this,c)}getOptimisticResult(e){const n=U(this,cn).getQueryCache().build(U(this,cn),e),r=this.createResult(n,e);return gU(this,r)&&(me(this,Jt,r),me(this,kl,this.options),me(this,vr,U(this,Fe).state)),r}getCurrentResult(){return U(this,Jt)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&U(this,La).status==="pending"&&U(this,La).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){U(this,Il).add(e)}getCurrentQuery(){return U(this,Fe)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=U(this,cn).defaultQueryOptions(e),r=U(this,cn).getQueryCache().build(U(this,cn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return He(this,Je,io).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),U(this,Jt)))}createResult(e,n){var $;const r=U(this,Fe),i=this.options,c=U(this,Jt),d=U(this,vr),f=U(this,kl),p=e!==r?e.state:U(this,To),{state:b}=e;let y={...b},x=!1,v;if(n._optimisticResults){const M=this.hasListeners(),H=!M&&oN(e,n),ne=M&&cN(e,r,n,i);(H||ne)&&(y={...y,...gA(b.data,e.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:N,errorUpdatedAt:j,status:S}=y;v=y.data;let R=!1;if(n.placeholderData!==void 0&&v===void 0&&S==="pending"){let M;c!=null&&c.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(M=c.data,R=!0):M=typeof n.placeholderData=="function"?n.placeholderData(($=U(this,Ml))==null?void 0:$.state.data,U(this,Ml)):n.placeholderData,M!==void 0&&(S="success",v=xg(c==null?void 0:c.data,M,n),x=!0)}if(n.select&&v!==void 0&&!R)if(c&&v===(d==null?void 0:d.data)&&n.select===U(this,ko))v=U(this,_l);else try{me(this,ko,n.select),v=n.select(v),v=xg(c==null?void 0:c.data,v,n),me(this,_l,v),me(this,Cs,null)}catch(M){me(this,Cs,M)}U(this,Cs)&&(N=U(this,Cs),v=U(this,_l),j=Date.now(),S="error");const w=y.fetchStatus==="fetching",D=S==="pending",C=S==="error",I=D&&w,L=v!==void 0,Y={status:S,fetchStatus:y.fetchStatus,isPending:D,isSuccess:S==="success",isError:C,isInitialLoading:I,isLoading:I,data:v,dataUpdatedAt:y.dataUpdatedAt,error:N,errorUpdatedAt:j,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>p.dataUpdateCount||y.errorUpdateCount>p.errorUpdateCount,isFetching:w,isRefetching:w&&!D,isLoadingError:C&&!L,isPaused:y.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:C&&L,isStale:Fm(e,n),refetch:this.refetch,promise:U(this,La),isEnabled:An(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const M=Y.data!==void 0,H=Y.status==="error"&&!M,ne=pe=>{H?pe.reject(Y.error):M&&pe.resolve(Y.data)},ee=()=>{const pe=me(this,La,Y.promise=bg());ne(pe)},he=U(this,La);switch(he.status){case"pending":e.queryHash===r.queryHash&&ne(he);break;case"fulfilled":(H||Y.data!==he.value)&&ee();break;case"rejected":(!H||Y.error!==he.reason)&&ee();break}}return Y}updateResult(){const e=U(this,Jt),n=this.createResult(U(this,Fe),this.options);if(me(this,vr,U(this,Fe).state),me(this,kl,this.options),U(this,vr).data!==void 0&&me(this,Ml,U(this,Fe)),gg(n,e))return;me(this,Jt,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,c=typeof i=="function"?i():i;if(c==="all"||!c&&!U(this,Il).size)return!0;const d=new Set(c??U(this,Il));return this.options.throwOnError&&d.add("error"),Object.keys(U(this,Jt)).some(f=>{const h=f;return U(this,Jt)[h]!==e[h]&&d.has(h)})};He(this,Je,mA).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&He(this,Je,jg).call(this)}},cn=new WeakMap,Fe=new WeakMap,To=new WeakMap,Jt=new WeakMap,vr=new WeakMap,kl=new WeakMap,La=new WeakMap,Cs=new WeakMap,ko=new WeakMap,_l=new WeakMap,Ml=new WeakMap,Nr=new WeakMap,Er=new WeakMap,Ds=new WeakMap,Il=new WeakMap,Je=new WeakSet,io=function(e){He(this,Je,wg).call(this);let n=U(this,Fe).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(dn)),n},vg=function(){He(this,Je,Sg).call(this);const e=Ps(this.options.staleTime,U(this,Fe));if(Do.isServer()||U(this,Jt).isStale||!pg(e))return;const r=iA(U(this,Jt).dataUpdatedAt,e)+1;me(this,Nr,pr.setTimeout(()=>{U(this,Jt).isStale||this.updateResult()},r))},Ng=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(U(this,Fe)):this.options.refetchInterval)??!1},Eg=function(e){He(this,Je,Ag).call(this),me(this,Ds,e),!(Do.isServer()||An(this.options.enabled,U(this,Fe))===!1||!pg(U(this,Ds))||U(this,Ds)===0)&&me(this,Er,pr.setInterval(()=>{(this.options.refetchIntervalInBackground||Bm.isFocused())&&He(this,Je,io).call(this)},U(this,Ds)))},jg=function(){He(this,Je,vg).call(this),He(this,Je,Eg).call(this,He(this,Je,Ng).call(this))},Sg=function(){U(this,Nr)!==void 0&&(pr.clearTimeout(U(this,Nr)),me(this,Nr,void 0))},Ag=function(){U(this,Er)!==void 0&&(pr.clearInterval(U(this,Er)),me(this,Er,void 0))},wg=function(){const e=U(this,cn).getQueryCache().build(U(this,cn),this.options);if(e===U(this,Fe))return;const n=U(this,Fe);me(this,Fe,e),me(this,To,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},mA=function(e){Gt.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(U(this,Jt))}),U(this,cn).getQueryCache().notify({query:U(this,Fe),type:"observerResultsUpdated"})})},DN);function pU(t,e){return An(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&An(e.retryOnMount,t)===!1)}function oN(t,e){return pU(t,e)||t.state.data!==void 0&&Cg(t,e,e.refetchOnMount)}function Cg(t,e,n){if(An(e.enabled,t)!==!1&&Ps(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Fm(t,e)}return!1}function cN(t,e,n,r){return(t!==e||An(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Fm(t,n)}function Fm(t,e){return An(e.enabled,t)!==!1&&t.isStaleByTime(Ps(e.staleTime,t))}function gU(t,e){return!gg(t.getCurrentResult(),e)}var _o,da,$t,jr,ua,js,ON,mU=(ON=class extends hA{constructor(e){super();we(this,ua);we(this,_o);we(this,da);we(this,$t);we(this,jr);me(this,_o,e.client),this.mutationId=e.mutationId,me(this,$t,e.mutationCache),me(this,da,[]),this.state=e.state||xU(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){U(this,da).includes(e)||(U(this,da).push(e),this.clearGcTimeout(),U(this,$t).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){me(this,da,U(this,da).filter(n=>n!==e)),this.scheduleGc(),U(this,$t).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){U(this,da).length||(this.state.status==="pending"?this.scheduleGc():U(this,$t).remove(this))}continue(){var e;return((e=U(this,jr))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var d,f,h,p,b,y,x,v,N,j,S,R,w,D,C,I,L,F;const n=()=>{He(this,ua,js).call(this,{type:"continue"})},r={client:U(this,_o),meta:this.options.meta,mutationKey:this.options.mutationKey};me(this,jr,fA({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(Y,$)=>{He(this,ua,js).call(this,{type:"failed",failureCount:Y,error:$})},onPause:()=>{He(this,ua,js).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>U(this,$t).canRun(this)}));const i=this.state.status==="pending",c=!U(this,jr).canStart();try{if(i)n();else{He(this,ua,js).call(this,{type:"pending",variables:e,isPaused:c}),U(this,$t).config.onMutate&&await U(this,$t).config.onMutate(e,this,r);const $=await((f=(d=this.options).onMutate)==null?void 0:f.call(d,e,r));$!==this.state.context&&He(this,ua,js).call(this,{type:"pending",context:$,variables:e,isPaused:c})}const Y=await U(this,jr).start();return await((p=(h=U(this,$t).config).onSuccess)==null?void 0:p.call(h,Y,e,this.state.context,this,r)),await((y=(b=this.options).onSuccess)==null?void 0:y.call(b,Y,e,this.state.context,r)),await((v=(x=U(this,$t).config).onSettled)==null?void 0:v.call(x,Y,null,this.state.variables,this.state.context,this,r)),await((j=(N=this.options).onSettled)==null?void 0:j.call(N,Y,null,e,this.state.context,r)),He(this,ua,js).call(this,{type:"success",data:Y}),Y}catch(Y){try{await((R=(S=U(this,$t).config).onError)==null?void 0:R.call(S,Y,e,this.state.context,this,r))}catch($){Promise.reject($)}try{await((D=(w=this.options).onError)==null?void 0:D.call(w,Y,e,this.state.context,r))}catch($){Promise.reject($)}try{await((I=(C=U(this,$t).config).onSettled)==null?void 0:I.call(C,void 0,Y,this.state.variables,this.state.context,this,r))}catch($){Promise.reject($)}try{await((F=(L=this.options).onSettled)==null?void 0:F.call(L,void 0,Y,e,this.state.context,r))}catch($){Promise.reject($)}throw He(this,ua,js).call(this,{type:"error",error:Y}),Y}finally{U(this,$t).runNext(this)}}},_o=new WeakMap,da=new WeakMap,$t=new WeakMap,jr=new WeakMap,ua=new WeakSet,js=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Gt.batch(()=>{U(this,da).forEach(r=>{r.onMutationUpdate(e)}),U(this,$t).notify({mutation:this,type:"updated",action:e})})},ON);function xU(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var za,ea,Mo,RN,bU=(RN=class extends $o{constructor(e={}){super();we(this,za);we(this,ea);we(this,Mo);this.config=e,me(this,za,new Set),me(this,ea,new Map),me(this,Mo,0)}build(e,n,r){const i=new mU({client:e,mutationCache:this,mutationId:++dd(this,Mo)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){U(this,za).add(e);const n=Ad(e);if(typeof n=="string"){const r=U(this,ea).get(n);r?r.push(e):U(this,ea).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(U(this,za).delete(e)){const n=Ad(e);if(typeof n=="string"){const r=U(this,ea).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&U(this,ea).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Ad(e);if(typeof n=="string"){const r=U(this,ea).get(n),i=r==null?void 0:r.find(c=>c.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=Ad(e);if(typeof n=="string"){const i=(r=U(this,ea).get(n))==null?void 0:r.find(c=>c!==e&&c.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Gt.batch(()=>{U(this,za).forEach(e=>{this.notify({type:"removed",mutation:e})}),U(this,za).clear(),U(this,ea).clear()})}getAll(){return Array.from(U(this,za))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>nN(n,r))}findAll(e={}){return this.getAll().filter(n=>nN(e,n))}notify(e){Gt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Gt.batch(()=>Promise.all(e.map(n=>n.continue().catch(dn))))}},za=new WeakMap,ea=new WeakMap,Mo=new WeakMap,RN);function Ad(t){var e;return(e=t.options.scope)==null?void 0:e.id}var fa,TN,yU=(TN=class extends $o{constructor(e={}){super();we(this,fa);this.config=e,me(this,fa,new Map)}build(e,n,r){const i=n.queryKey,c=n.queryHash??Hm(i,n);let d=this.get(c);return d||(d=new fU({client:e,queryKey:i,queryHash:c,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(d)),d}add(e){U(this,fa).has(e.queryHash)||(U(this,fa).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=U(this,fa).get(e.queryHash);n&&(e.destroy(),n===e&&U(this,fa).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Gt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return U(this,fa).get(e)}getAll(){return[...U(this,fa).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>tN(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>tN(e,r)):n}notify(e){Gt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Gt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Gt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},fa=new WeakMap,TN),yt,Os,Rs,Ll,zl,Ts,Pl,Ul,kN,vU=(kN=class{constructor(t={}){we(this,yt);we(this,Os);we(this,Rs);we(this,Ll);we(this,zl);we(this,Ts);we(this,Pl);we(this,Ul);me(this,yt,t.queryCache||new yU),me(this,Os,t.mutationCache||new bU),me(this,Rs,t.defaultOptions||{}),me(this,Ll,new Map),me(this,zl,new Map),me(this,Ts,0)}mount(){dd(this,Ts)._++,U(this,Ts)===1&&(me(this,Pl,Bm.subscribe(async t=>{t&&(await this.resumePausedMutations(),U(this,yt).onFocus())})),me(this,Ul,gu.subscribe(async t=>{t&&(await this.resumePausedMutations(),U(this,yt).onOnline())})))}unmount(){var t,e;dd(this,Ts)._--,U(this,Ts)===0&&((t=U(this,Pl))==null||t.call(this),me(this,Pl,void 0),(e=U(this,Ul))==null||e.call(this),me(this,Ul,void 0))}isFetching(t){return U(this,yt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return U(this,Os).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=U(this,yt).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=U(this,yt).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Ps(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return U(this,yt).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=U(this,yt).get(r.queryHash),c=i==null?void 0:i.state.data,d=eU(e,c);if(d!==void 0)return U(this,yt).build(this,r).setData(d,{...n,manual:!0})}setQueriesData(t,e,n){return Gt.batch(()=>U(this,yt).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=U(this,yt).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=U(this,yt);Gt.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=U(this,yt);return Gt.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Gt.batch(()=>U(this,yt).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(dn).catch(dn)}invalidateQueries(t,e={}){return Gt.batch(()=>(U(this,yt).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Gt.batch(()=>U(this,yt).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let c=i.fetch(void 0,n);return n.throwOnError||(c=c.catch(dn)),i.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(r).then(dn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=U(this,yt).build(this,e);return n.isStaleByTime(Ps(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(dn).catch(dn)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(dn).catch(dn)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return gu.isOnline()?U(this,Os).resumePausedMutations():Promise.resolve()}getQueryCache(){return U(this,yt)}getMutationCache(){return U(this,Os)}getDefaultOptions(){return U(this,Rs)}setDefaultOptions(t){me(this,Rs,t)}setQueryDefaults(t,e){U(this,Ll).set(wo(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...U(this,Ll).values()],n={};return e.forEach(r=>{Co(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){U(this,zl).set(wo(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...U(this,zl).values()],n={};return e.forEach(r=>{Co(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...U(this,Rs).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Hm(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Gm&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...U(this,Rs).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){U(this,yt).clear(),U(this,Os).clear()}},yt=new WeakMap,Os=new WeakMap,Rs=new WeakMap,Ll=new WeakMap,zl=new WeakMap,Ts=new WeakMap,Pl=new WeakMap,Ul=new WeakMap,kN),xA=A.createContext(void 0),NU=t=>{const e=A.useContext(xA);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},EU=({client:t,children:e})=>(A.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),s.jsx(xA.Provider,{value:t,children:e})),bA=A.createContext(!1),jU=()=>A.useContext(bA);bA.Provider;function SU(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var AU=A.createContext(SU()),wU=()=>A.useContext(AU),CU=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?dA(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},DU=t=>{A.useEffect(()=>{t.clearReset()},[t])},OU=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||dA(n,[t.error,r])),RU=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},TU=(t,e)=>t.isLoading&&t.isFetching&&!e,kU=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,dN=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function _U(t,e,n){var x,v,N,j;const r=jU(),i=wU(),c=NU(),d=c.defaultQueryOptions(t);(v=(x=c.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||v.call(x,d);const f=c.getQueryCache().get(d.queryHash);d._optimisticResults=r?"isRestoring":"optimistic",RU(d),CU(d,i,f),DU(i);const h=!c.getQueryCache().get(d.queryHash),[p]=A.useState(()=>new e(c,d)),b=p.getOptimisticResult(d),y=!r&&t.subscribed!==!1;if(A.useSyncExternalStore(A.useCallback(S=>{const R=y?p.subscribe(Gt.batchCalls(S)):dn;return p.updateResult(),R},[p,y]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),A.useEffect(()=>{p.setOptions(d)},[d,p]),kU(d,b))throw dN(d,p,i);if(OU({result:b,errorResetBoundary:i,throwOnError:d.throwOnError,query:f,suspense:d.suspense}))throw b.error;if((j=(N=c.getDefaultOptions().queries)==null?void 0:N._experimental_afterQuery)==null||j.call(N,d,b),d.experimental_prefetchInRender&&!Do.isServer()&&TU(b,r)){const S=h?dN(d,p,i):f==null?void 0:f.promise;S==null||S.catch(dn).finally(()=>{p.updateResult()})}return d.notifyOnChangeProps?b:p.trackResult(b)}function MU(t,e){return _U(t,hU)}const yA=6048e5,IU=864e5,vA=6e4,NA=36e5,uN=Symbol.for("constructDateFrom");function qa(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&uN in t?t[uN](e):t instanceof Date?new t.constructor(e):new Date(e)}function Tn(t,e){return qa(e||t,t)}let LU={};function Lu(){return LU}function Oo(t,e){var f,h,p,b;const n=Lu(),r=(e==null?void 0:e.weekStartsOn)??((h=(f=e==null?void 0:e.locale)==null?void 0:f.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((b=(p=n.locale)==null?void 0:p.options)==null?void 0:b.weekStartsOn)??0,i=Tn(t,e==null?void 0:e.in),c=i.getDay(),d=(c=c.getTime()?r+1:n.getTime()>=f.getTime()?r:r-1}function fN(t){const e=Tn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function zU(t,...e){const n=qa.bind(null,e.find(r=>typeof r=="object"));return e.map(n)}function hN(t,e){const n=Tn(t,e==null?void 0:e.in);return n.setHours(0,0,0,0),n}function PU(t,e,n){const[r,i]=zU(n==null?void 0:n.in,t,e),c=hN(r),d=hN(i),f=+c-fN(c),h=+d-fN(d);return Math.round((f-h)/IU)}function UU(t,e){const n=EA(t,e),r=qa(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),mu(r)}function BU(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function HU(t){return!(!BU(t)&&typeof t!="number"||isNaN(+Tn(t)))}function GU(t,e){const n=Tn(t,e==null?void 0:e.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const FU={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},VU=(t,e,n)=>{let r;const i=FU[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Hp(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const qU={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},$U={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},YU={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},QU={date:Hp({formats:qU,defaultWidth:"full"}),time:Hp({formats:$U,defaultWidth:"full"}),dateTime:Hp({formats:YU,defaultWidth:"full"})},WU={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},XU=(t,e,n,r)=>WU[t];function ao(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const d=t.defaultFormattingWidth||t.defaultWidth,f=n!=null&&n.width?String(n.width):d;i=t.formattingValues[f]||t.formattingValues[d]}else{const d=t.defaultWidth,f=n!=null&&n.width?String(n.width):t.defaultWidth;i=t.values[f]||t.values[d]}const c=t.argumentCallback?t.argumentCallback(e):e;return i[c]}}const ZU={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},KU={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},JU={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},e8={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},t8={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},n8={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},a8=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},s8={ordinalNumber:a8,era:ao({values:ZU,defaultWidth:"wide"}),quarter:ao({values:KU,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ao({values:JU,defaultWidth:"wide"}),day:ao({values:e8,defaultWidth:"wide"}),dayPeriod:ao({values:t8,defaultWidth:"wide",formattingValues:n8,defaultFormattingWidth:"wide"})};function so(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],c=e.match(i);if(!c)return null;const d=c[0],f=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],h=Array.isArray(f)?l8(f,y=>y.test(d)):r8(f,y=>y.test(d));let p;p=t.valueCallback?t.valueCallback(h):h,p=n.valueCallback?n.valueCallback(p):p;const b=e.slice(d.length);return{value:p,rest:b}}}function r8(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function l8(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],c=e.match(t.parsePattern);if(!c)return null;let d=t.valueCallback?t.valueCallback(c[0]):c[0];d=n.valueCallback?n.valueCallback(d):d;const f=e.slice(i.length);return{value:d,rest:f}}}const o8=/^(\d+)(th|st|nd|rd)?/i,c8=/\d+/i,d8={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},u8={any:[/^b/i,/^(a|c)/i]},f8={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},h8={any:[/1/i,/2/i,/3/i,/4/i]},p8={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},g8={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},m8={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},x8={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},b8={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},y8={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},v8={ordinalNumber:i8({matchPattern:o8,parsePattern:c8,valueCallback:t=>parseInt(t,10)}),era:so({matchPatterns:d8,defaultMatchWidth:"wide",parsePatterns:u8,defaultParseWidth:"any"}),quarter:so({matchPatterns:f8,defaultMatchWidth:"wide",parsePatterns:h8,defaultParseWidth:"any",valueCallback:t=>t+1}),month:so({matchPatterns:p8,defaultMatchWidth:"wide",parsePatterns:g8,defaultParseWidth:"any"}),day:so({matchPatterns:m8,defaultMatchWidth:"wide",parsePatterns:x8,defaultParseWidth:"any"}),dayPeriod:so({matchPatterns:b8,defaultMatchWidth:"any",parsePatterns:y8,defaultParseWidth:"any"})},N8={code:"en-US",formatDistance:VU,formatLong:QU,formatRelative:XU,localize:s8,match:v8,options:{weekStartsOn:0,firstWeekContainsDate:1}};function E8(t,e){const n=Tn(t,e==null?void 0:e.in);return PU(n,GU(n))+1}function j8(t,e){const n=Tn(t,e==null?void 0:e.in),r=+mu(n)-+UU(n);return Math.round(r/yA)+1}function jA(t,e){var b,y,x,v;const n=Tn(t,e==null?void 0:e.in),r=n.getFullYear(),i=Lu(),c=(e==null?void 0:e.firstWeekContainsDate)??((y=(b=e==null?void 0:e.locale)==null?void 0:b.options)==null?void 0:y.firstWeekContainsDate)??i.firstWeekContainsDate??((v=(x=i.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??1,d=qa((e==null?void 0:e.in)||t,0);d.setFullYear(r+1,0,c),d.setHours(0,0,0,0);const f=Oo(d,e),h=qa((e==null?void 0:e.in)||t,0);h.setFullYear(r,0,c),h.setHours(0,0,0,0);const p=Oo(h,e);return+n>=+f?r+1:+n>=+p?r:r-1}function S8(t,e){var f,h,p,b;const n=Lu(),r=(e==null?void 0:e.firstWeekContainsDate)??((h=(f=e==null?void 0:e.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((b=(p=n.locale)==null?void 0:p.options)==null?void 0:b.firstWeekContainsDate)??1,i=jA(t,e),c=qa((e==null?void 0:e.in)||t,0);return c.setFullYear(i,0,r),c.setHours(0,0,0,0),Oo(c,e)}function A8(t,e){const n=Tn(t,e==null?void 0:e.in),r=+Oo(n,e)-+S8(n,e);return Math.round(r/yA)+1}function at(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Es={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return at(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):at(n+1,2)},d(t,e){return at(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return at(t.getHours()%12||12,e.length)},H(t,e){return at(t.getHours(),e.length)},m(t,e){return at(t.getMinutes(),e.length)},s(t,e){return at(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return at(i,e.length)}},vl={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},pN={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return Es.y(t,e)},Y:function(t,e,n,r){const i=jA(t,r),c=i>0?i:1-i;if(e==="YY"){const d=c%100;return at(d,2)}return e==="Yo"?n.ordinalNumber(c,{unit:"year"}):at(c,e.length)},R:function(t,e){const n=EA(t);return at(n,e.length)},u:function(t,e){const n=t.getFullYear();return at(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return at(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return at(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Es.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return at(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=A8(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):at(i,e.length)},I:function(t,e,n){const r=j8(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):at(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Es.d(t,e)},D:function(t,e,n){const r=E8(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):at(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),c=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(c);case"ee":return at(c,2);case"eo":return n.ordinalNumber(c,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),c=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(c);case"cc":return at(c,e.length);case"co":return n.ordinalNumber(c,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return at(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=vl.noon:r===0?i=vl.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=vl.evening:r>=12?i=vl.afternoon:r>=4?i=vl.morning:i=vl.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Es.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Es.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):at(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):at(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Es.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Es.s(t,e)},S:function(t,e){return Es.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return mN(r);case"XXXX":case"XX":return fr(r);case"XXXXX":case"XXX":default:return fr(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return mN(r);case"xxxx":case"xx":return fr(r);case"xxxxx":case"xxx":default:return fr(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+gN(r,":");case"OOOO":default:return"GMT"+fr(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+gN(r,":");case"zzzz":default:return"GMT"+fr(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return at(r,e.length)},T:function(t,e,n){return at(+t,e.length)}};function gN(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),c=r%60;return c===0?n+String(i):n+String(i)+e+at(c,2)}function mN(t,e){return t%60===0?(t>0?"-":"+")+at(Math.abs(t)/60,2):fr(t,e)}function fr(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=at(Math.trunc(r/60),2),c=at(r%60,2);return n+i+e+c}const xN=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},SA=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},w8=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return xN(t,e);let c;switch(r){case"P":c=e.dateTime({width:"short"});break;case"PP":c=e.dateTime({width:"medium"});break;case"PPP":c=e.dateTime({width:"long"});break;case"PPPP":default:c=e.dateTime({width:"full"});break}return c.replace("{{date}}",xN(r,e)).replace("{{time}}",SA(i,e))},C8={p:SA,P:w8},D8=/^D+$/,O8=/^Y+$/,R8=["D","DD","YY","YYYY"];function T8(t){return D8.test(t)}function k8(t){return O8.test(t)}function _8(t,e,n){const r=M8(t,e,n);if(console.warn(r),R8.includes(t))throw new RangeError(r)}function M8(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const I8=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,L8=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,z8=/^'([^]*?)'?$/,P8=/''/g,U8=/[a-zA-Z]/;function Gp(t,e,n){var b,y,x,v;const r=Lu(),i=r.locale??N8,c=r.firstWeekContainsDate??((y=(b=r.locale)==null?void 0:b.options)==null?void 0:y.firstWeekContainsDate)??1,d=r.weekStartsOn??((v=(x=r.locale)==null?void 0:x.options)==null?void 0:v.weekStartsOn)??0,f=Tn(t,n==null?void 0:n.in);if(!HU(f))throw new RangeError("Invalid time value");let h=e.match(L8).map(N=>{const j=N[0];if(j==="p"||j==="P"){const S=C8[j];return S(N,i.formatLong)}return N}).join("").match(I8).map(N=>{if(N==="''")return{isToken:!1,value:"'"};const j=N[0];if(j==="'")return{isToken:!1,value:B8(N)};if(pN[j])return{isToken:!0,value:N};if(j.match(U8))throw new RangeError("Format string contains an unescaped latin alphabet character `"+j+"`");return{isToken:!1,value:N}});i.localize.preprocessor&&(h=i.localize.preprocessor(f,h));const p={firstWeekContainsDate:c,weekStartsOn:d,locale:i};return h.map(N=>{if(!N.isToken)return N.value;const j=N.value;(k8(j)||T8(j))&&_8(j,e,String(t));const S=pN[j[0]];return S(f,j,i.localize,p)}).join("")}function B8(t){const e=t.match(z8);return e?e[1].replace(P8,"'"):t}function bN(t,e){const n=()=>qa(e==null?void 0:e.in,NaN),i=V8(t);let c;if(i.date){const p=q8(i.date,2);c=$8(p.restDateString,p.year)}if(!c||isNaN(+c))return n();const d=+c;let f=0,h;if(i.time&&(f=Y8(i.time),isNaN(f)))return n();if(i.timezone){if(h=Q8(i.timezone),isNaN(h))return n()}else{const p=new Date(d+f),b=Tn(0,e==null?void 0:e.in);return b.setFullYear(p.getUTCFullYear(),p.getUTCMonth(),p.getUTCDate()),b.setHours(p.getUTCHours(),p.getUTCMinutes(),p.getUTCSeconds(),p.getUTCMilliseconds()),b}return Tn(d+f+h,e==null?void 0:e.in)}const wd={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},H8=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,G8=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,F8=/^([+-])(\d{2})(?::?(\d{2}))?$/;function V8(t){const e={},n=t.split(wd.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],wd.timeZoneDelimiter.test(e.date)&&(e.date=t.split(wd.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const i=wd.timezone.exec(r);i?(e.time=r.replace(i[1],""),e.timezone=i[1]):e.time=r}return e}function q8(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const i=r[1]?parseInt(r[1]):null,c=r[2]?parseInt(r[2]):null;return{year:c===null?i:c*100,restDateString:t.slice((r[1]||r[2]).length)}}function $8(t,e){if(e===null)return new Date(NaN);const n=t.match(H8);if(!n)return new Date(NaN);const r=!!n[4],i=ro(n[1]),c=ro(n[2])-1,d=ro(n[3]),f=ro(n[4]),h=ro(n[5])-1;if(r)return J8(e,f,h)?W8(e,f,h):new Date(NaN);{const p=new Date(0);return!Z8(e,c,d)||!K8(e,i)?new Date(NaN):(p.setUTCFullYear(e,c,Math.max(i,d)),p)}}function ro(t){return t?parseInt(t):1}function Y8(t){const e=t.match(G8);if(!e)return NaN;const n=Fp(e[1]),r=Fp(e[2]),i=Fp(e[3]);return eB(n,r,i)?n*NA+r*vA+i*1e3:NaN}function Fp(t){return t&&parseFloat(t.replace(",","."))||0}function Q8(t){if(t==="Z")return 0;const e=t.match(F8);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return tB(r,i)?n*(r*NA+i*vA):NaN}function W8(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const i=r.getUTCDay()||7,c=(e-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+c),r}const X8=[31,null,31,30,31,30,31,31,30,31,30,31];function AA(t){return t%400===0||t%4===0&&t%100!==0}function Z8(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(X8[e]||(AA(t)?29:28))}function K8(t,e){return e>=1&&e<=(AA(t)?366:365)}function J8(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function eB(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function tB(t,e){return e>=0&&e<=59}function yN(t,e){const[n,r]=qe.useState(t);return qe.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}const nB=({status:t})=>{const e={AUTORIZADO:{label:"Autorizado",color:"bg-green-100 text-green-700 border-green-200"},AUTORIZADO_PARCIAL:{label:"Autorizado Parcialmente",color:"bg-yellow-100 text-yellow-700 border-yellow-200"},NEGADO:{label:"Negado",color:"bg-red-100 text-red-700 border-red-200"},EM_ANALISE:{label:"Em Análise",color:"bg-blue-100 text-blue-700 border-blue-200"},CANCELADO:{label:"Cancelado",color:"bg-gray-100 text-gray-700 border-gray-200"}},n=e[t]||e.EM_ANALISE;return s.jsx("span",{className:`px-2 py-1 rounded-full text-[10px] font-bold border uppercase ${n.color}`,children:n.label})},aB=()=>{const[t,e]=A.useState(1),[n]=A.useState(10),[r,i]=A.useState(""),[c,d]=A.useState(""),[f,h]=A.useState(""),[p,b]=A.useState(""),[y,x]=A.useState(""),[v,N]=A.useState("dataSolicitacao"),[j,S]=A.useState("DESC"),R=yN(r,500),w=yN(c,500),D=async()=>{const H=new URLSearchParams({page:t.toString(),pageSize:n.toString(),search:R,gto:w,status:f,dataInicio:p,dataFim:y,sortField:v,sortOrder:j}),ne=localStorage.getItem("SCOREODONTO_AUTH_TOKEN"),ee=await fetch(`/api/guias?${H}`,{headers:ne?{Authorization:`Bearer ${ne}`}:{}});if(!ee.ok)throw new Error("Falha ao carregar guias");return ee.json()},{data:C,isLoading:I,isError:L,refetch:F}=MU({queryKey:["guias",t,R,w,f,p,y,v,j],queryFn:D,placeholderData:H=>H}),Y=H=>{v===H?S(j==="ASC"?"DESC":"ASC"):(N(H),S("DESC"))},$=C?Math.ceil(C.total/n):0,M=()=>{if(!(C!=null&&C.data))return;const H=["Data Solicitação","Identificação","Beneficiário","Tipo Tratamento","GTO","Situação"],ne=C.data.map(z=>[Gp(bN(z.dataSolicitacao),"dd/MM/yyyy"),z.beneficiarioIdentificacao,z.beneficiarioNome,z.tipoTratamento,z.numeroGuiaPrestador,z.status]),ee="data:text/csv;charset=utf-8,"+H.join(",")+` +`+ne.map(z=>z.join(",")).join(` +`),he=encodeURI(ee),pe=document.createElement("a");pe.setAttribute("href",he),pe.setAttribute("download",`tratamentos_${Gp(new Date,"yyyyMMdd")}.csv`),document.body.appendChild(pe),pe.click(),document.body.removeChild(pe)};return s.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[s.jsx(fn,{title:"Meus Tratamentos",description:"LISTAGEM E GESTÃO DE GUIAS DE TRATAMENTO ODONTOLÓGICO (GTO).",children:s.jsxs("button",{onClick:M,className:"flex items-center gap-2 px-4 py-2 bg-gray-800 text-white rounded-lg hover:bg-gray-700 transition-colors text-sm font-bold uppercase shadow-sm",children:[s.jsx(kg,{size:18})," Exportar CSV"]})}),s.jsxs("div",{className:"bg-white p-6 rounded-xl border border-gray-200 shadow-sm space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[s.jsxs("div",{className:"flex-1 min-w-[200px]",children:[s.jsx("label",{className:"block text-[10px] font-bold text-gray-400 uppercase mb-1",children:"Status da Guia"}),s.jsxs("select",{value:f,onChange:H=>{h(H.target.value),e(1)},className:"w-full px-4 py-2 bg-gray-50 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none text-sm font-semibold uppercase",children:[s.jsx("option",{value:"",children:"TODOS OS STATUS"}),s.jsx("option",{value:"AUTORIZADO",children:"AUTORIZADO"}),s.jsx("option",{value:"AUTORIZADO_PARCIAL",children:"AUTORIZADO PARCIALMENTE"}),s.jsx("option",{value:"NEGADO",children:"NEGADO"}),s.jsx("option",{value:"EM_ANALISE",children:"EM ANÁLISE"}),s.jsx("option",{value:"CANCELADO",children:"CANCELADO"})]})]}),s.jsxs("div",{className:"w-48",children:[s.jsx("label",{className:"block text-[10px] font-bold text-gray-400 uppercase mb-1",children:"GTO (Número)"}),s.jsxs("div",{className:"relative",children:[s.jsx(yu,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:16}),s.jsx("input",{type:"text",placeholder:"EX: 177903",value:c,onChange:H=>{d(H.target.value),e(1)},className:"w-full pl-10 pr-4 py-2 bg-gray-50 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none text-sm font-semibold uppercase"})]})]}),s.jsxs("div",{className:"flex-1 min-w-[300px]",children:[s.jsx("label",{className:"block text-[10px] font-bold text-gray-400 uppercase mb-1",children:"Pesquisar Beneficiário"}),s.jsxs("div",{className:"relative",children:[s.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:16}),s.jsx("input",{type:"text",placeholder:"DIGITE NOME OU IDENTIFICAÇÃO...",value:r,onChange:H=>{i(H.target.value.toUpperCase()),e(1)},className:"w-full pl-10 pr-4 py-2 bg-gray-50 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none text-sm font-semibold uppercase"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 pt-2 border-t border-gray-50",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(jt,{size:16,className:"text-gray-400"}),s.jsx("input",{type:"date",value:p,onChange:H=>{b(H.target.value),e(1)},className:"px-3 py-1.5 bg-gray-50 border border-gray-200 rounded-lg text-xs font-semibold"}),s.jsx("span",{className:"text-gray-400 font-bold text-xs uppercase",children:"até"}),s.jsx("input",{type:"date",value:y,onChange:H=>{x(H.target.value),e(1)},className:"px-3 py-1.5 bg-gray-50 border border-gray-200 rounded-lg text-xs font-semibold"})]}),s.jsx("button",{onClick:()=>{i(""),d(""),h(""),b(""),x(""),e(1)},className:"text-[10px] font-bold text-blue-600 hover:text-blue-800 uppercase",children:"Limpar Filtros"})]})]}),s.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden flex-1 flex flex-col min-h-[400px]",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[s.jsx("th",{className:"px-6 py-4",children:s.jsxs("button",{onClick:()=>Y("dataSolicitacao"),className:"flex items-center gap-2 text-[11px] font-extrabold text-gray-500 uppercase tracking-wider hover:text-blue-600 transition-colors",children:["Data Solicitação ",s.jsx(ud,{size:14})]})}),s.jsx("th",{className:"px-6 py-4",children:s.jsx("span",{className:"text-[11px] font-extrabold text-gray-500 uppercase tracking-wider",children:"Identificação do Beneficiário"})}),s.jsx("th",{className:"px-6 py-4",children:s.jsxs("button",{onClick:()=>Y("beneficiarioNome"),className:"flex items-center gap-2 text-[11px] font-extrabold text-gray-500 uppercase tracking-wider hover:text-blue-600 transition-colors",children:["Nome Beneficiário ",s.jsx(ud,{size:14})]})}),s.jsx("th",{className:"px-6 py-4",children:s.jsx("span",{className:"text-[11px] font-extrabold text-gray-500 uppercase tracking-wider",children:"Tipo Tratamento"})}),s.jsx("th",{className:"px-6 py-4",children:s.jsxs("button",{onClick:()=>Y("numeroGuiaPrestador"),className:"flex items-center gap-2 text-[11px] font-extrabold text-gray-500 uppercase tracking-wider hover:text-blue-600 transition-colors",children:["GTO ",s.jsx(ud,{size:14})]})}),s.jsx("th",{className:"px-6 py-4",children:s.jsxs("button",{onClick:()=>Y("status"),className:"flex items-center gap-2 text-[11px] font-extrabold text-gray-500 uppercase tracking-wider hover:text-blue-600 transition-colors",children:["Situação da GTO ",s.jsx(ud,{size:14})]})})]})}),s.jsx("tbody",{className:"divide-y divide-gray-100",children:I?Array.from({length:5}).map((H,ne)=>s.jsx("tr",{className:"animate-pulse",children:s.jsx("td",{colSpan:6,className:"px-6 py-4 h-16 bg-gray-50/30"})},ne)):L?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-red-500 font-bold uppercase",children:"Erro ao carregar dados."})}):(C==null?void 0:C.data.length)===0?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-gray-400 font-bold uppercase",children:"Nenhum tratamento encontrado."})}):C==null?void 0:C.data.map(H=>s.jsxs("tr",{className:"hover:bg-blue-50/50 transition-colors cursor-pointer group",children:[s.jsx("td",{className:"px-6 py-4 text-sm font-semibold text-gray-700",children:Gp(bN(H.dataSolicitacao),"dd/MM/yyyy")}),s.jsx("td",{className:"px-6 py-4 text-sm font-bold text-blue-600 group-hover:underline",children:H.beneficiarioIdentificacao}),s.jsx("td",{className:"px-6 py-4",children:s.jsx("p",{className:"text-sm font-bold text-gray-900 uppercase",children:H.beneficiarioNome})}),s.jsx("td",{className:"px-6 py-4 text-sm text-gray-600",children:H.tipoTratamento}),s.jsx("td",{className:"px-6 py-4 text-sm font-bold text-gray-800",children:H.numeroGuiaPrestador}),s.jsx("td",{className:"px-6 py-4",children:s.jsx(nB,{status:H.status})})]},H.id))})]})}),s.jsxs("div",{className:"mt-auto bg-gray-50 px-6 py-4 border-t border-gray-200 flex items-center justify-between",children:[s.jsxs("div",{className:"text-xs font-bold text-gray-500 uppercase",children:["Mostrando ",s.jsx("span",{className:"text-gray-900",children:(C==null?void 0:C.data.length)||0})," de ",s.jsx("span",{className:"text-gray-900",children:(C==null?void 0:C.total)||0})," resultados"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{disabled:t===1,onClick:()=>e(H=>Math.max(1,H-1)),className:"p-2 border border-gray-300 rounded-lg hover:bg-white disabled:opacity-30 disabled:hover:bg-transparent transition-colors shadow-sm",children:s.jsx($a,{size:16})}),s.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:$},(H,ne)=>ne+1).map(H=>s.jsx("button",{onClick:()=>e(H),className:`w-8 h-8 rounded-lg text-xs font-bold transition-all ${H===t?"bg-blue-600 text-white shadow-md":"text-gray-600 hover:bg-white border border-transparent hover:border-gray-200"}`,children:H},H))}),s.jsx("button",{disabled:t===$,onClick:()=>e(H=>Math.min($,H+1)),className:"p-2 border border-gray-300 rounded-lg hover:bg-white disabled:opacity-30 disabled:hover:bg-transparent transition-colors shadow-sm",children:s.jsx(Pa,{size:16})})]})]})]})]})},Dg="V1.0.10",sB=({onLoginSuccess:t})=>{const[e,n]=A.useState(""),[r,i]=A.useState(""),[c,d]=A.useState(!1),[f,h]=A.useState(""),[p,b]=A.useState(!0);if(A.useEffect(()=>{const x=setTimeout(()=>b(!1),3e3);return()=>clearTimeout(x)},[]),p)return s.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col items-center justify-center p-4",children:[s.jsx(Ot,{className:"animate-spin text-blue-600 mb-4",size:48}),s.jsx("h2",{className:"text-gray-500 font-bold uppercase tracking-widest text-sm",children:"Inicializando Sistema..."}),s.jsx("span",{className:"text-gray-400 text-xs mt-2 font-mono font-bold bg-gray-200 px-2 py-1 rounded",children:Dg})]});const y=async x=>{x.preventDefault(),d(!0),h("");try{await K.login(e,r)?t():h("CREDENCIAIS INVÁLIDAS. VERIFIQUE EMAIL E SENHA.")}catch{h("ERRO DE CONEXÃO. TENTE NOVAMENTE.")}finally{d(!1)}};return s.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:s.jsxs("div",{className:"max-w-md w-full bg-white rounded-2xl shadow-xl overflow-hidden border border-gray-100",children:[s.jsxs("div",{className:"bg-blue-600 p-8 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-white/20 rounded-xl flex items-center justify-center text-white mx-auto backdrop-blur-sm mb-4",children:s.jsx(Sr,{size:32})}),s.jsx("h1",{className:"text-2xl font-bold text-white uppercase tracking-wide",children:"SCOREODONTO"}),s.jsx("p",{className:"text-blue-100 text-xs font-bold uppercase mt-1",children:"SISTEMA INTEGRADO POSTGRESQL + GOOGLE"})]}),s.jsxs("div",{className:"p-8",children:[s.jsxs("h2",{className:"text-lg font-bold text-gray-800 uppercase mb-6 text-center flex items-center justify-center gap-2",children:[s.jsx(Ld,{size:18,className:"text-blue-600"})," ACESSO RESTRITO"]}),s.jsxs("form",{onSubmit:y,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"USUÁRIO / EMAIL"}),s.jsxs("div",{className:"relative",children:[s.jsx(Bo,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400",size:18}),s.jsx("input",{type:"email",required:!0,value:e,onChange:x=>n(x.target.value),className:"w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none transition-all text-sm font-medium",placeholder:"ex: usuario@email.com"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1 uppercase",children:"SENHA DE ACESSO"}),s.jsxs("div",{className:"relative",children:[s.jsx(Ld,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400",size:18}),s.jsx("input",{type:"password",required:!0,value:r,onChange:x=>i(x.target.value),className:"w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none transition-all text-sm font-medium",placeholder:"••••••••"})]})]}),f&&s.jsx("div",{className:"p-3 bg-red-50 text-red-600 text-xs font-bold uppercase rounded-lg border border-red-100 text-center",children:f}),s.jsx("button",{type:"submit",disabled:c,className:"w-full bg-blue-600 hover:bg-blue-700 text-white py-3 rounded-lg font-bold uppercase flex items-center justify-center gap-2 transition-all shadow-lg hover:shadow-xl disabled:opacity-70 disabled:cursor-not-allowed mt-4",children:c?s.jsx("span",{children:"VERIFICANDO..."}):s.jsxs(s.Fragment,{children:["ENTRAR NO SISTEMA ",s.jsx(Us,{size:18})]})})]}),s.jsxs("div",{className:"mt-8 flex flex-col items-center justify-center gap-2 text-gray-400 text-[10px] font-bold uppercase",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Ar,{size:12})," AMBIENTE SEGURO E CRIPTOGRAFADO"]}),s.jsx("span",{className:"bg-gray-100 text-gray-500 px-2 py-1 rounded font-mono",children:Dg})]})]})]})})},Cd=({icon:t,title:e,description:n})=>s.jsxs("div",{className:"bg-white/70 backdrop-blur-md p-8 rounded-3xl border border-white/50 shadow-[0_8px_30px_rgb(0,0,0,0.04)] hover:shadow-[0_20px_50px_rgba(8,112,184,0.1)] transition-all duration-500 group",children:[s.jsx("div",{className:"w-14 h-14 bg-blue-600/10 rounded-2xl flex items-center justify-center mb-6 group-hover:bg-blue-600 group-hover:text-white transition-all duration-500 text-blue-600",children:t}),s.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-3 uppercase tracking-tight",children:e}),s.jsx("p",{className:"text-gray-600 leading-relaxed text-sm",children:n})]}),rB=({onGetStarted:t})=>{const[e,n]=A.useState(!1),[r,i]=A.useState(!1);return A.useEffect(()=>{const c=()=>n(window.scrollY>20);return window.addEventListener("scroll",c),()=>window.removeEventListener("scroll",c)},[]),s.jsxs("div",{className:"min-h-screen bg-[#F8FAFC] font-sans selection:bg-blue-100 selection:text-blue-900 overflow-x-hidden",children:[s.jsx("nav",{className:`fixed top-0 left-0 right-0 z-[100] transition-all duration-500 ${e?"bg-white/80 backdrop-blur-xl border-b border-gray-100 py-3 shadow-sm":"bg-transparent py-6"}`,children:s.jsxs("div",{className:"max-w-7xl mx-auto px-6 flex justify-between items-center",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-10 h-10 bg-gradient-to-tr from-blue-600 to-indigo-600 rounded-xl flex items-center justify-center shadow-lg shadow-blue-200",children:s.jsx(aa,{className:"text-white",size:24})}),s.jsxs("span",{className:"text-2xl font-black text-gray-900 tracking-tighter uppercase italic",children:["Score",s.jsx("span",{className:"text-blue-600",children:"Odonto"})]})]}),s.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[s.jsx("a",{href:"#features",className:"text-sm font-bold text-gray-600 hover:text-blue-600 transition-colors uppercase tracking-widest",children:"Recursos"}),s.jsx("a",{href:"#solutions",className:"text-sm font-bold text-gray-600 hover:text-blue-600 transition-colors uppercase tracking-widest",children:"Soluções"}),s.jsx("a",{href:"#mobile",className:"text-sm font-bold text-gray-600 hover:text-blue-600 transition-colors uppercase tracking-widest",children:"Mobile"}),s.jsx("button",{onClick:t,className:"bg-gray-900 text-white px-6 py-3 rounded-full text-xs font-black uppercase tracking-widest hover:bg-blue-600 hover:shadow-xl hover:shadow-blue-200 transition-all active:scale-95",children:"Começar Agora"})]}),s.jsx("button",{className:"md:hidden p-2 text-gray-900",onClick:()=>i(!r),children:r?s.jsx(Qe,{size:28}):s.jsx($N,{size:28})})]})}),s.jsxs("section",{className:"relative pt-32 pb-20 lg:pt-48 lg:pb-40 overflow-hidden",children:[s.jsx("div",{className:"absolute top-0 right-0 w-1/2 h-full bg-gradient-to-l from-blue-50/50 to-transparent -z-10 translate-x-20 skew-x-12"}),s.jsx("div",{className:"absolute top-40 left-10 w-72 h-72 bg-blue-400/10 rounded-full blur-3xl -z-10"}),s.jsx("div",{className:"max-w-7xl mx-auto px-6",children:s.jsxs("div",{className:"grid lg:grid-cols-2 gap-16 items-center",children:[s.jsxs("div",{className:"space-y-8",children:[s.jsxs("h1",{className:"text-6xl lg:text-7xl font-black text-gray-900 leading-[1.05] tracking-tighter",children:["O Futuro da Sua Clínica é ",s.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-indigo-600 underline decoration-blue-200 underline-offset-8",children:"Inteligente"})]}),s.jsx("p",{className:"text-xl text-gray-600 leading-relaxed max-w-lg font-medium",children:"Maximize a produtividade com gestão financeira, agenda com arraste e solte, e controle absoluto de tratamentos em uma plataforma única e elegante."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[s.jsxs("button",{onClick:t,className:"bg-blue-600 text-white px-10 py-5 rounded-2xl text-sm font-black uppercase tracking-widest shadow-2xl shadow-blue-200 hover:bg-blue-700 hover:-translate-y-1 transition-all flex items-center justify-center gap-3 group",children:["Acessar Plataforma ",s.jsx(Us,{size:18,className:"group-hover:translate-x-1 transition-transform"})]}),s.jsxs("div",{className:"flex items-center gap-4 py-2 px-4",children:[s.jsx("div",{className:"flex -space-x-3",children:[1,2,3,4].map(c=>s.jsx("div",{className:"w-10 h-10 rounded-full border-2 border-white bg-gray-200 flex items-center justify-center text-[10px] font-bold overflow-hidden shadow-sm",children:s.jsx("img",{src:`https://i.pravatar.cc/100?img=${c+10}`,alt:"User"})},c))}),s.jsxs("div",{className:"text-xs text-gray-500 font-bold uppercase tracking-tight",children:[s.jsx("span",{className:"text-gray-900",children:"+400 Clínicas"})," ",s.jsx("br",{})," que já otimizaram processos"]})]})]})]}),s.jsxs("div",{className:"relative",children:[s.jsxs("div",{className:"relative z-10 rounded-[3rem] overflow-hidden shadow-[0_50px_100px_-20px_rgba(0,0,0,0.2)] border-8 border-white group",children:[s.jsx("img",{src:"/dental_landing_hero.png",alt:"Interface ScoreOdonto",className:"w-full h-auto transform group-hover:scale-105 transition-all duration-700",onError:c=>{c.target.src="https://images.unsplash.com/photo-1594832284143-588b813ed334?q=80&w=2070&auto=format&fit=crop"}}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/40 to-transparent flex items-bottom p-10 opacity-0 group-hover:opacity-100 transition-opacity duration-500",children:s.jsx("p",{className:"mt-auto text-white font-bold uppercase text-xs tracking-widest",children:"Interface Real: Dashboard Analítico"})})]}),s.jsx("div",{className:"absolute -top-10 -right-10 z-20 bg-white p-6 rounded-3xl shadow-2xl border border-blue-50 animate-bounce transition-all duration-1000 hidden md:block",style:{animationDelay:"0.2s"},children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-blue-100 text-blue-600 rounded-2xl",children:s.jsx(jt,{size:24})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Sincronização Total"}),s.jsx("div",{className:"text-lg font-black text-gray-900 tracking-tight",children:"Google Agenda"})]})]})}),s.jsx("div",{className:"absolute -bottom-10 -left-10 z-20 bg-white p-6 rounded-3xl shadow-2xl border border-green-50 animate-bounce transition-all duration-1000",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-green-100 text-green-600 rounded-2xl",children:s.jsx(kD,{size:24})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Comunicação"}),s.jsx("div",{className:"text-lg font-black text-gray-900 tracking-tight",children:"CRM WhatsApp"})]})]})})]})]})})]}),s.jsx("div",{className:"bg-white border-y border-gray-100 py-10",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-6 overflow-hidden",children:[s.jsx("p",{className:"text-center text-[10px] font-black text-gray-400 uppercase tracking-[0.3em] mb-10",children:"Conectado com os principais convênios"}),s.jsxs("div",{className:"flex justify-between items-center opacity-30 grayscale gap-10",children:[s.jsx("span",{className:"text-2xl font-black italic",children:"CASSEMS"}),s.jsx("span",{className:"text-2xl font-black italic",children:"UNIMED"}),s.jsx("span",{className:"text-2xl font-black italic",children:"BRADESCO"}),s.jsx("span",{className:"text-2xl font-black italic",children:"SULAMÉRICA"}),s.jsx("span",{className:"text-2xl font-black italic",children:"AMIL DENTAL"}),s.jsx("span",{className:"text-2xl font-black italic",children:"REDE DENTAL"})]})]})}),s.jsx("section",{id:"features",className:"py-32 px-6",children:s.jsxs("div",{className:"max-w-7xl mx-auto",children:[s.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-20 space-y-4",children:[s.jsx("h2",{className:"text-4xl lg:text-5xl font-black text-gray-900 leading-tight tracking-tighter uppercase",children:"Todo o Controle na Sua Mão"}),s.jsx("p",{className:"text-lg text-gray-600 font-medium",children:"Focamos na tecnologia para que você foque no que mais importa: o sorriso do seu paciente."})]}),s.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-8",children:[s.jsx(Cd,{icon:s.jsx(jt,{size:28}),title:"Agenda 4.0",description:"Controle total com arraste e solte, cores por profissional e sincronização em tempo real."}),s.jsx(Cd,{icon:s.jsx(Ar,{size:28}),title:"GTO Segura",description:"Lançamento simplificado de guias de convênio com validação automática de erros."}),s.jsx(Cd,{icon:s.jsx(sa,{size:28}),title:"Gestão de Pacientes",description:"CRM odontológico completo com histórico clínico, anexos e ortodontia avançada."}),s.jsx(Cd,{icon:s.jsx(Io,{size:28}),title:"BI Financeiro",description:"Gráficos de produtividade, fluxo de caixa e gestão de taxas de operadoras."})]})]})}),s.jsx("section",{className:"py-20 px-6",children:s.jsxs("div",{className:"max-w-7xl mx-auto bg-gradient-to-br from-blue-600 to-indigo-700 rounded-[3rem] p-12 lg:p-24 overflow-hidden relative shadow-2xl shadow-blue-300",children:[s.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2 blur-3xl"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-64 h-64 bg-black/10 rounded-full translate-y-1/2 -translate-x-1/2 blur-3xl"}),s.jsxs("div",{className:"relative z-10 text-center space-y-8 max-w-3xl mx-auto",children:[s.jsxs("h2",{className:"text-4xl lg:text-6xl font-black text-white leading-tight tracking-tighter uppercase italic",children:["Sua Clínica Elevada ao ",s.jsx("span",{className:"bg-white text-blue-600 px-4 py-1 rounded-2xl not-italic",children:"Próximo Nível"})]}),s.jsx("p",{className:"text-blue-100 text-xl font-medium",children:"Junte-se a centenas de profissionais que já transformaram a gestão de seus consultórios. Comece agora gratuitamente."}),s.jsx("div",{className:"pt-6",children:s.jsx("button",{onClick:t,className:"bg-white text-blue-600 px-12 py-6 rounded-3xl text-sm font-black uppercase tracking-widest shadow-xl hover:bg-gray-50 hover:-translate-y-1 transition-all active:scale-95",children:"Testar Demonstrativo"})})]})]})}),s.jsxs("footer",{className:"py-20 border-t border-gray-100 bg-white",children:[s.jsxs("div",{className:"max-w-7xl mx-auto px-6 grid md:grid-cols-4 gap-12",children:[s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center",children:s.jsx(aa,{className:"text-white",size:18})}),s.jsxs("span",{className:"text-xl font-black text-gray-900 tracking-tighter uppercase italic",children:["Score",s.jsx("span",{className:"text-blue-600",children:"Odonto"})]})]}),s.jsx("p",{className:"text-gray-500 text-sm leading-relaxed",children:"A plataforma líder em gestão odontológica para clínicas que buscam excelência e eficiência."}),s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"w-8 h-8 bg-gray-100 rounded-full hover:bg-blue-600 hover:text-white transition-all flex items-center justify-center cursor-pointer",children:s.jsx(dO,{size:16})}),s.jsx("div",{className:"w-8 h-8 bg-gray-100 rounded-full hover:bg-blue-600 hover:text-white transition-all flex items-center justify-center cursor-pointer",children:s.jsx(sa,{size:16})}),s.jsx("div",{className:"w-8 h-8 bg-gray-100 rounded-full hover:bg-blue-600 hover:text-white transition-all flex items-center justify-center cursor-pointer",children:s.jsx(IO,{size:16})})]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx("h4",{className:"text-xs font-black text-gray-900 uppercase tracking-widest",children:"Produto"}),s.jsxs("ul",{className:"space-y-3 text-sm text-gray-500 font-bold uppercase tracking-tight",children:[s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Funcionalidades"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Segurança"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"API"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Mobile"})]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx("h4",{className:"text-xs font-black text-gray-900 uppercase tracking-widest",children:"Empresa"}),s.jsxs("ul",{className:"space-y-3 text-sm text-gray-500 font-bold uppercase tracking-tight",children:[s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Sobre Nós"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Blog"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Carreiras"}),s.jsx("li",{className:"hover:text-blue-600 cursor-pointer transition-colors",children:"Contato"})]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx("h4",{className:"text-xs font-black text-gray-900 uppercase tracking-widest",children:"Suporte"}),s.jsxs("div",{className:"p-4 bg-gray-50 rounded-2xl border border-gray-100",children:[s.jsx("p",{className:"text-xs text-gray-500 font-bold uppercase mb-2",children:"Central de Ajuda"}),s.jsx("a",{href:"mailto:suporte@scoreodonto.com",className:"text-sm font-black text-blue-600 hover:underline",children:"suporte@scoreodonto.com"})]})]})]}),s.jsxs("div",{className:"max-w-7xl mx-auto px-6 mt-20 pt-10 border-t border-gray-50 flex flex-col md:flex-row justify-between items-center gap-6",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"© 2026 ScoreOdonto. Todos os direitos reservados."}),s.jsxs("div",{className:"flex gap-8 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:[s.jsx("span",{className:"hover:text-gray-900 cursor-pointer",children:"Termos"}),s.jsx("span",{className:"hover:text-gray-900 cursor-pointer",children:"Privacidade"}),s.jsx("span",{className:"hover:text-gray-900 cursor-pointer",children:"Cookies"})]})]})]})]})},lB=()=>{const[t,e]=A.useState(!1),[n,r]=A.useState([]),[i,c]=A.useState(!1),d=async()=>{e(!0),r([]),c(!1),await K.runInstallScript(h=>{r(p=>[...p,h])}),c(!0),e(!1)},f=()=>{window.location.href="./"};return s.jsx("div",{className:"min-h-screen bg-gray-900 flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-2xl bg-white rounded-xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"bg-gray-100 p-6 border-b border-gray-200 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 bg-blue-600 rounded-lg flex items-center justify-center text-white",children:s.jsx(Sr,{size:24})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold text-gray-900 uppercase",children:"SCOREODONTO ADMIN"}),s.jsx("p",{className:"text-gray-500 text-xs font-bold uppercase",children:"FERRAMENTA DE ATUALIZAÇÃO DE BANCO"})]})]}),s.jsxs("button",{onClick:f,className:"text-gray-500 hover:text-gray-800 flex items-center gap-1 text-xs font-bold uppercase",children:[s.jsx(zN,{size:16})," VOLTAR AO SISTEMA"]})]}),s.jsx("div",{className:"p-8",children:!t&&n.length===0?s.jsxs("div",{className:"text-center space-y-6",children:[s.jsx("div",{className:"w-20 h-20 bg-amber-100 text-amber-600 rounded-full flex items-center justify-center mx-auto",children:s.jsx(ov,{size:40})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-bold text-gray-800 uppercase",children:"SCRIPT DE ATUALIZAÇÃO (SH/UPDATE_DB.SH)"}),s.jsx("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto uppercase",children:'ESTA AÇÃO IRÁ LER A PLANILHA "DADOS PACIENTES", GERAR UM BACKUP SQL E ATUALIZAR AS TABELAS DO POSTGRESQL.'})]}),s.jsx("div",{className:"bg-gray-800 text-green-400 p-4 rounded-lg font-mono text-sm text-left max-w-md mx-auto shadow-inner",children:"$ ./sh/update_db.sh --force-sync"}),s.jsxs("button",{onClick:d,className:"bg-blue-600 hover:bg-blue-700 text-white px-8 py-4 rounded-lg font-bold uppercase flex items-center gap-3 mx-auto transition-all hover:scale-105 shadow-lg",children:[s.jsx(VD,{size:20,fill:"currentColor"}),"EXECUTAR ATUALIZAÇÃO"]})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex justify-between items-center mb-2",children:[s.jsxs("h3",{className:"font-bold text-gray-800 uppercase flex items-center gap-2",children:[s.jsx(ov,{size:18})," TERMINAL DE SAÍDA"]}),i&&s.jsxs("span",{className:"text-green-600 text-xs font-bold uppercase flex items-center gap-1",children:[s.jsx(Ga,{size:14})," PROCESSO FINALIZADO"]})]}),s.jsxs("div",{className:"bg-gray-900 text-green-500 font-mono text-xs p-6 rounded-lg h-80 overflow-y-auto shadow-inner border-4 border-gray-800",children:[n.map((h,p)=>s.jsx("div",{className:"mb-1",children:h},p)),t&&s.jsx("div",{className:"animate-pulse mt-2",children:"_"})]}),i&&s.jsx("button",{onClick:f,className:"w-full py-3 bg-gray-200 hover:bg-gray-300 text-gray-800 font-bold rounded-lg uppercase transition-colors",children:"VOLTAR PARA O LOGIN"})]})})]})})},vN=[{name:"Azul Score",value:"#2563eb"},{name:"Verde Esmeralda",value:"#059669"},{name:"Indigo Premium",value:"#4f46e5"},{name:"Vinho Elegante",value:"#9f1239"},{name:"Slate Moderno",value:"#334155"},{name:"Laranja Vibrante",value:"#ea580c"},{name:"Teal Clínico",value:"#0d9488"},{name:"Roxo Nobre",value:"#7c3aed"}],iB=()=>{const t=K.getWorkspaces(),e=K.getActiveWorkspace(),n=$e(),r=K.getCurrentRole(),i=r==="admin"||r==="donoclinica",[c,d]=A.useState(null),[f,h]=A.useState(!1),p=y=>{if((e==null?void 0:e.id)===y){n.info("VOCÊ JÁ ESTÁ NESTA UNIDADE.");return}K.switchWorkspace(y),n.success("TROCANDO DE UNIDADE...")},b=async(y,x)=>{h(!0);try{const v=localStorage.getItem("SCOREODONTO_AUTH_TOKEN");if((await fetch(`/api/clinicas/${y}/color`,{method:"PUT",headers:{"Content-Type":"application/json",...v?{Authorization:`Bearer ${v}`}:{}},body:JSON.stringify({cor:x})})).ok){n.success("COR DA UNIDADE ATUALIZADA!");const j=t.map(S=>S.id===y?{...S,cor:x}:S);localStorage.setItem("SCOREODONTO_WORKSPACES",JSON.stringify(j)),(e==null?void 0:e.id)===y&&localStorage.setItem("SCOREODONTO_ACTIVE_WORKSPACE",JSON.stringify({...e,cor:x})),d(null),setTimeout(()=>window.location.reload(),1e3)}else n.error("ERRO AO SALVAR COR.")}catch{n.error("ERRO DE CONEXÃO.")}finally{h(!1)}};return s.jsxs("div",{className:"space-y-10 animate-in fade-in duration-500",children:[s.jsx(fn,{title:"GESTÃO DE UNIDADES",description:"Configure a identidade visual e selecione a clínica para gerenciar atendimentos."}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:t.map(y=>{const x=(e==null?void 0:e.id)===y.id,v=y.cor||"#2563eb";return s.jsx("div",{className:`group relative bg-white rounded-[2.5rem] p-1 border-2 transition-all duration-500 ${x?"shadow-[0_20px_50px_-15px_rgba(0,0,0,0.1)]":"border-transparent hover:border-gray-100 shadow-[0_10px_40px_-15px_rgba(0,0,0,0.05)]"}`,style:{borderColor:x?v:"transparent"},children:s.jsxs("div",{className:"px-8 py-10 rounded-[2.2rem] bg-white h-full flex flex-col",children:[s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center transition-all duration-500 group-hover:scale-110 shadow-lg",style:{backgroundColor:v,color:"#fff",boxShadow:`0 10px 20px -5px ${v}44`},children:s.jsx(Rg,{size:32})}),s.jsxs("div",{className:"flex flex-col items-end gap-2",children:[x&&s.jsx("span",{className:"text-white text-[9px] font-black px-4 py-1.5 rounded-full uppercase tracking-widest shadow-sm",style:{backgroundColor:v},children:"ATIVA"}),i&&s.jsx("button",{onClick:()=>d(c===y.id?null:y.id),className:"p-2 text-gray-400 hover:text-gray-600 bg-gray-50 rounded-xl transition-colors",title:"Mudar Cor",children:s.jsx(PD,{size:16})})]})]}),s.jsxs("div",{className:"space-y-2 flex-grow",children:[s.jsx("h3",{className:"text-2xl font-black text-gray-900 uppercase tracking-tighter leading-tight",children:y.nome}),c===y.id?s.jsxs("div",{className:"mt-4 p-4 bg-gray-50 rounded-2xl border border-gray-100 animate-in slide-in-from-top-2 duration-300",children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest mb-3",children:"Escolha a cor da marca"}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:vN.map(N=>s.jsx("button",{onClick:()=>b(y.id,N.value),disabled:f,className:`w-full h-8 rounded-lg border-2 transition-all ${y.cor===N.value?"border-white ring-2 ring-gray-300":"border-transparent hover:scale-110"}`,style:{backgroundColor:N.value},title:N.name,children:f&&y.cor===N.value&&s.jsx(Ot,{size:12,className:"animate-spin text-white mx-auto"})},N.value))})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 text-gray-400",children:[s.jsx(VN,{size:14}),s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest",children:"Unidade Operacional"})]}),s.jsxs("div",{className:"mt-6 pt-6 border-t border-gray-50 flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center",style:{backgroundColor:`${v}11`,color:v},children:s.jsx(oO,{size:16})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest leading-none mb-1",children:"Seu Perfil"}),s.jsx("p",{className:"text-xs font-bold text-gray-700 uppercase",children:y.role})]})]})]})]}),s.jsx("button",{onClick:()=>p(y.id),disabled:x||c===y.id,className:"mt-10 w-full py-4 rounded-2xl text-xs font-black uppercase tracking-widest transition-all duration-300 flex items-center justify-center gap-3 group/btn shadow-lg",style:{backgroundColor:x?"#f3f4f6":v,color:x?"#9ca3af":"#fff",boxShadow:x?"none":`0 10px 20px -10px ${v}66`},children:x?s.jsxs(s.Fragment,{children:["UNIDADE ATUAL ",s.jsx(xC,{size:18})]}):s.jsxs(s.Fragment,{children:["ACESSAR UNIDADE ",s.jsx(Us,{size:18,className:"group-hover/btn:translate-x-1 transition-transform"})]})})]})},y.id)})}),s.jsxs("div",{className:"bg-white rounded-[2rem] p-10 border border-gray-100 flex flex-col md:flex-row items-center justify-between gap-6 shadow-sm",children:[s.jsxs("div",{className:"text-center md:text-left",children:[s.jsx("h4",{className:"text-lg font-black text-gray-900 uppercase tracking-tight italic",children:"Identidade Visual Dinâmica"}),s.jsx("p",{className:"text-sm text-gray-500 font-medium",children:"A cor escolhida será aplicada automaticamente em toda a interface desta clínica."})]}),s.jsx("div",{className:"flex gap-2",children:vN.slice(0,4).map(y=>s.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:y.value}},y.value))})]})]})},oB=()=>{const[t,e]=A.useState(1),[n,r]=A.useState(!1),i=$e(),c=new URLSearchParams(window.location.search),d=c.get("clinica"),f=c.get("nome"),h=c.get("token"),[p,b]=A.useState({nome:f||"",email:"",senha:"",cro:"",cro_uf:"MS",celular:"",especialidade:""});if(!h||!d)return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 p-4",children:s.jsxs("div",{className:"text-center space-y-4",children:[s.jsx("div",{className:"w-20 h-20 bg-red-50 text-red-500 rounded-full flex items-center justify-center mx-auto shadow-sm",children:s.jsx(Ld,{size:40})}),s.jsx("h2",{className:"text-2xl font-black text-gray-900 uppercase",children:"LINK INVÁLIDO OU EXPIRADO"}),s.jsx("p",{className:"text-gray-500 max-w-sm mx-auto font-medium",children:"Por favor, solicite um novo convite ao administrador da clínica."})]})});const y=async x=>{x.preventDefault(),r(!0);try{(await fetch("/api/dentistas/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...p,id:"d_"+Math.random().toString(36).substring(2,9),clinicaId:d})})).ok?(i.success("CADASTRO REALIZADO COM SUCESSO!"),e(3)):i.error("ERRO AO REALIZAR CADASTRO.")}catch{i.error("FALHA DE CONEXÃO.")}finally{r(!1)}};return s.jsx("div",{className:"min-h-screen bg-[#F8FAFC] flex items-center justify-center p-4",children:s.jsxs("div",{className:"max-w-xl w-full",children:[s.jsxs("div",{className:"mb-10 text-center space-y-2",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-1.5 bg-blue-50 text-blue-600 rounded-full text-[10px] font-black uppercase tracking-widest border border-blue-100 mb-4",children:[s.jsx(Ar,{size:14})," Convite de Profissional"]}),s.jsx("h1",{className:"text-4xl font-black text-gray-900 tracking-tighter uppercase leading-none",children:"Complete seu Perfil"}),s.jsxs("p",{className:"text-gray-500 font-medium",children:["Bem-vindo ao SCOREODONTO. Você está sendo convidado para a unidade: ",s.jsx("span",{className:"text-blue-600 font-bold uppercase",children:d})]})]}),s.jsxs("div",{className:"bg-white rounded-[2.5rem] shadow-[0_50px_100px_-20px_rgba(0,0,0,0.08)] border border-gray-100 overflow-hidden relative",children:[s.jsx("div",{className:"h-2 bg-gray-100 w-full",children:s.jsx("div",{className:"h-full bg-blue-600 transition-all duration-700",style:{width:`${t/3*100}%`}})}),t===1&&s.jsx("div",{className:"p-10 animate-in fade-in slide-in-from-right-10 duration-500",children:s.jsxs("form",{className:"space-y-6",onSubmit:x=>{x.preventDefault(),e(2)},children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Seu Nome Profissional"}),s.jsxs("div",{className:"relative group",children:[s.jsx(Bo,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-blue-500 transition-colors",size:20}),s.jsx("input",{required:!0,value:p.nome,onChange:x=>b({...p,nome:x.target.value.toUpperCase()}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800 uppercase",placeholder:"NOME COMPLETO"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Email de Acesso"}),s.jsxs("div",{className:"relative group",children:[s.jsx(_g,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:20}),s.jsx("input",{type:"email",required:!0,value:p.email,onChange:x=>b({...p,email:x.target.value}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800",placeholder:"seu@email.com"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Senha de Acesso"}),s.jsxs("div",{className:"relative group",children:[s.jsx(Ld,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:20}),s.jsx("input",{type:"password",required:!0,value:p.senha,onChange:x=>b({...p,senha:x.target.value}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800",placeholder:"••••••••"})]})]})]})]}),s.jsxs("button",{type:"submit",className:"w-full bg-gray-900 text-white py-5 rounded-2xl font-black uppercase tracking-widest hover:bg-blue-600 hover:shadow-2xl hover:shadow-blue-200 transition-all flex items-center justify-center gap-3 active:scale-95",children:["Próximo Passo ",s.jsx(Us,{size:20})]})]})}),t===2&&s.jsx("div",{className:"p-10 animate-in fade-in slide-in-from-right-10 duration-500",children:s.jsxs("form",{className:"space-y-6",onSubmit:y,children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Inscrição CRO"}),s.jsxs("div",{className:"relative group",children:[s.jsx(Sr,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:20}),s.jsx("input",{required:!0,value:p.cro,onChange:x=>b({...p,cro:x.target.value}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800 uppercase",placeholder:"00000"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Estado CRO"}),s.jsxs("select",{value:p.cro_uf,onChange:x=>b({...p,cro_uf:x.target.value}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-6 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800",children:[s.jsx("option",{children:"MS"}),s.jsx("option",{children:"SP"}),s.jsx("option",{children:"RJ"}),s.jsx("option",{children:"MG"}),s.jsx("option",{children:"PR"}),s.jsx("option",{children:"SC"})]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"Especialidade Principal"}),s.jsxs("div",{className:"relative group",children:[s.jsx(aa,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:20}),s.jsx("input",{required:!0,value:p.especialidade,onChange:x=>b({...p,especialidade:x.target.value.toUpperCase()}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800 uppercase",placeholder:"EX: ORTODONTIA"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest ml-1 mb-2 block",children:"WhatsApp de Contato"}),s.jsxs("div",{className:"relative group",children:[s.jsx(QN,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-gray-400",size:20}),s.jsx("input",{required:!0,value:p.celular,onChange:x=>b({...p,celular:x.target.value}),className:"w-full bg-gray-50 border border-transparent focus:border-blue-500 focus:bg-white px-12 py-4 rounded-2xl outline-none transition-all font-bold text-gray-800 uppercase",placeholder:"(00) 00000-0000"})]})]})]}),s.jsxs("div",{className:"flex gap-4 pt-4",children:[s.jsx("button",{type:"button",onClick:()=>e(1),className:"flex-1 bg-gray-100 text-gray-600 py-5 rounded-2xl font-black uppercase tracking-widest hover:bg-gray-200 transition-all font-bold",children:"Voltar"}),s.jsx("button",{type:"submit",disabled:n,className:"flex-[2] bg-blue-600 text-white py-5 rounded-2xl font-black uppercase tracking-widest hover:bg-blue-700 shadow-xl shadow-blue-200 transition-all flex items-center justify-center gap-3 disabled:opacity-50",children:n?s.jsx(Ot,{className:"animate-spin"}):s.jsxs(s.Fragment,{children:["Finalizar e Entrar ",s.jsx(Us,{size:20})]})})]})]})}),t===3&&s.jsxs("div",{className:"p-16 text-center animate-in zoom-in duration-500",children:[s.jsx("div",{className:"w-24 h-24 bg-green-50 text-green-500 rounded-[2rem] flex items-center justify-center mx-auto mb-8 shadow-inner ring-1 ring-green-100",children:s.jsx(Ar,{size:48})}),s.jsx("h2",{className:"text-3xl font-black text-gray-900 uppercase tracking-tight mb-4",children:"Tudo Pronto!"}),s.jsxs("p",{className:"text-gray-500 font-medium mb-10",children:["Seu perfil foi criado e você já está vinculado à unidade ",s.jsx("br",{})," ",s.jsx("span",{className:"text-blue-600 font-bold",children:d}),"."]}),s.jsx("button",{onClick:()=>{history.pushState({},"","/login"),window.location.reload()},className:"w-full bg-gray-900 text-white py-5 rounded-2xl font-black uppercase tracking-widest hover:bg-blue-600 shadow-2xl transition-all",children:"Ir para o Login"})]})]}),s.jsxs("div",{className:"mt-8 flex items-center justify-center gap-2 text-gray-400 text-[10px] font-black uppercase tracking-widest",children:[s.jsx(Ar,{size:14})," Ambiente Seguro e Auditorado por Administradores"]})]})})},zu=({title:t,buttonLabel:e,onButtonClick:n,children:r})=>s.jsxs("div",{className:"space-y-6",children:[s.jsx(fn,{title:t,children:s.jsxs("button",{onClick:n,className:"bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 hover:bg-blue-700 font-bold text-xs uppercase transition-colors shadow-sm",children:[s.jsx(gt,{size:18})," ",e]})}),r]}),cB=({dentist:t,clinicaId:e,onClose:n})=>{const{data:r,refresh:i}=Ie(()=>K.getHorariosByDentista(t.id,e)),c=$e(),d=["DOMINGO","SEGUNDA","TERÇA","QUARTA","QUINTA","SEXTA","SÁBADO"],f=async h=>{h.preventDefault();const p=new FormData(h.target);await K.saveHorario({dentista_id:t.id,clinica_id:e,dia_semana:parseInt(p.get("dia")),hora_inicio:p.get("inicio"),hora_fim:p.get("fim"),ativo:!0}),c.success("HORÁRIO ADICIONADO!"),i()};return s.jsx("div",{className:"fixed inset-0 bg-black/60 z-[60] flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",children:[s.jsxs("div",{className:"px-6 py-4 border-b border-gray-100 flex justify-between items-center bg-gray-50",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-black text-gray-900 uppercase leading-tight",children:"ESCALA DE ATENDIMENTO"}),s.jsx("p",{className:"text-[10px] text-blue-600 font-bold uppercase",children:t.nome})]}),s.jsx("button",{onClick:n,className:"p-2 hover:bg-gray-200 rounded-xl transition-colors",children:s.jsx(Qe,{size:20})})]}),s.jsxs("div",{className:"p-6 space-y-6",children:[s.jsxs("form",{onSubmit:f,className:"grid grid-cols-1 md:grid-cols-4 gap-3 bg-blue-50/50 p-4 rounded-xl border border-blue-100",children:[s.jsx("select",{name:"dia",className:"bg-white border-blue-200 border rounded-lg p-2 text-xs font-bold uppercase",required:!0,children:d.map((h,p)=>s.jsx("option",{value:p,children:h},p))}),s.jsx("input",{name:"inicio",type:"time",className:"bg-white border-blue-200 border rounded-lg p-2 text-xs font-bold",required:!0}),s.jsx("input",{name:"fim",type:"time",className:"bg-white border-blue-200 border rounded-lg p-2 text-xs font-bold",required:!0}),s.jsxs("button",{type:"submit",className:"bg-blue-600 text-white rounded-lg font-black text-[10px] uppercase hover:bg-blue-700 transition-all flex items-center justify-center gap-2",children:[s.jsx(gt,{size:14})," ADICIONAR"]})]}),s.jsx("div",{className:"space-y-2 flex-1 overflow-y-auto pr-2",children:r==null?void 0:r.map(h=>s.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-xl border border-gray-100 hover:border-blue-200 transition-all group",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-10 h-10 bg-white rounded-lg flex items-center justify-center shadow-sm text-blue-600 border border-gray-100 font-black text-[10px]",children:d[h.dia_semana].substring(0,3)}),s.jsxs("div",{className:"flex items-center gap-2 text-xs font-black text-gray-700",children:[s.jsx(Yl,{size:14,className:"text-gray-400"}),s.jsx("span",{children:h.hora_inicio.substring(0,5)}),s.jsx(Us,{size:12,className:"text-gray-300"}),s.jsx("span",{children:h.hora_fim.substring(0,5)})]})]}),s.jsx("button",{onClick:async()=>{await K.deleteHorario(h.id),i(),c.success("REMOVIDO!")},className:"p-2 text-gray-300 hover:text-red-500 hover:bg-red-50 rounded-lg transition-all opacity-0 group-hover:opacity-100",children:s.jsx(Qt,{size:16})})]},h.id))})]})]})})},dB=()=>{const t=K.getActiveWorkspace(),{data:e,isLoading:n,error:r,refresh:i}=Ie(()=>K.getDentistas(t==null?void 0:t.id)),[c,d]=A.useState(!1),[f,h]=A.useState(null),[p,b]=A.useState(!1),[y,x]=A.useState(null),[v,N]=A.useState([]),j=$e(),S=async()=>{try{const F=await(await fetch("/api/auth/google/status")).json();N(F)}catch(L){console.error("Erro ao buscar status do Google:",L)}};A.useEffect(()=>{S()},[]),A.useEffect(()=>{if(!c)return;const L=F=>{F.key==="Escape"&&d(!1)};return document.addEventListener("keydown",L),()=>{document.removeEventListener("keydown",L)}},[c]);const R=async L=>{L.preventDefault();const F=new FormData(L.target),Y=Object.fromEntries(F);try{f&&f.id?(await K.updateDentista({...f,...Y}),j.success("DENTISTA ATUALIZADO!")):(await K.saveDentista({...Y,ativo:!0}),j.success("DENTISTA CADASTRADO!")),d(!1),i()}catch{j.error("ERRO AO SALVAR DENTISTA.")}},w=async L=>{window.confirm("TEM CERTEZA QUE DESEJA EXCLUIR ESTE DENTISTA?")&&(await K.deleteDentista(L),j.success("Dentista excluído."),i())},[D,C]=A.useState(null),I=async L=>{try{const F=K.getActiveWorkspace(),Y=await fetch("/api/dentistas/magic-link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clinicaId:F.id,dentistName:L.nome})}),{link:$}=await Y.json();await navigator.clipboard.writeText($),C(L.id),j.success("LINK MÁGICO COPIADO!"),setTimeout(()=>C(null),2e3)}catch{j.error("ERRO AO GERAR LINK.")}};return s.jsxs(zu,{title:"DENTISTAS & ESPECIALISTAS",buttonLabel:"NOVO DENTISTA",onButtonClick:()=>{h({}),d(!0)},children:[n&&s.jsx(Ot,{className:"animate-spin text-blue-500"}),r&&s.jsxs("p",{className:"text-red-500",children:["Erro: ",r.message]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e==null?void 0:e.map(L=>s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm hover:shadow-md transition-shadow flex flex-col",children:[s.jsxs("div",{className:"p-5 flex-grow",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-gray-900 uppercase",children:L.nome}),s.jsx("span",{className:"text-xs font-bold text-blue-600 bg-blue-50 px-2 py-0.5 rounded-full uppercase",children:L.especialidade})]}),s.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow",style:{backgroundColor:L.corAgenda}})]}),s.jsxs("div",{className:"mt-4 space-y-2 text-xs text-gray-500",children:[s.jsxs("p",{className:"flex items-center gap-2 font-medium",children:[s.jsx(_g,{size:14})," ",L.email]}),s.jsxs("p",{className:"flex items-center gap-2 font-medium",children:[s.jsx(QN,{size:14})," ",L.telefone]})]}),s.jsxs("div",{className:"mt-5 border-t border-gray-50 pt-4 flex items-center gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx(hu,{ownerId:L.id,isConnected:v.some(F=>F.owner_id===L.id),onStatusChange:S})}),s.jsx("button",{onClick:()=>I(L),title:"COMPARTILHAR LINK DE CADASTRO",className:`p-2.5 rounded-xl border transition-all ${D===L.id?"bg-green-50 text-green-600 border-green-200":"bg-gray-50 text-gray-400 border-gray-100 hover:bg-blue-50 hover:text-blue-600 hover:border-blue-100"}`,children:D===L.id?s.jsx(jl,{size:18}):s.jsx(WN,{size:18})})]})]}),s.jsxs("div",{className:"border-t border-gray-100 p-2 grid grid-cols-3 gap-1",children:[s.jsxs("button",{onClick:()=>{h(L),d(!0)},className:"text-[10px] uppercase font-bold text-gray-600 hover:bg-gray-100 py-2 rounded-md flex items-center justify-center gap-1",children:[s.jsx(Uo,{size:12})," EDITAR"]}),s.jsxs("button",{onClick:()=>{x(L),b(!0)},className:"text-[10px] uppercase font-bold text-blue-600 hover:bg-blue-50 py-2 rounded-md flex items-center justify-center gap-1",children:[s.jsx(Yl,{size:12})," ESCALA"]}),s.jsxs("button",{onClick:()=>w(L.id),className:"text-[10px] uppercase font-bold text-red-500 hover:bg-red-50 py-2 rounded-md flex items-center justify-center gap-1",children:[s.jsx(Qt,{size:12})," EXCLUIR"]})]})]},L.id))}),c&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-blue-50 to-white",children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-800 uppercase",children:[f!=null&&f.id?"EDITAR":"NOVO"," DENTISTA"]}),s.jsx("button",{onClick:()=>d(!1),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:R,className:"space-y-4 max-w-2xl mx-auto",children:[s.jsx("input",{id:"dentista-nome",type:"text",name:"nome",placeholder:"NOME COMPLETO",defaultValue:f==null?void 0:f.nome,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input",required:!0}),s.jsx("input",{id:"dentista-email",type:"email",name:"email",placeholder:"EMAIL",defaultValue:f==null?void 0:f.email,className:"w-full border border-gray-300 rounded-lg p-2",required:!0}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx("input",{id:"dentista-telefone",type:"text",name:"telefone",placeholder:"TELEFONE",defaultValue:f==null?void 0:f.telefone,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input"}),s.jsx("input",{id:"dentista-celular",type:"text",name:"celular",placeholder:"WHATSAPP / CELULAR",defaultValue:f==null?void 0:f.celular,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx("input",{id:"dentista-cro",type:"text",name:"cro",placeholder:"NÚMERO CRO",defaultValue:f==null?void 0:f.cro,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input"}),s.jsxs("select",{id:"dentista-cro-uf",name:"cro_uf",defaultValue:(f==null?void 0:f.cro_uf)||"MS",className:"w-full border border-gray-300 rounded-lg p-2",children:[s.jsx("option",{value:"MS",children:"MS"}),s.jsx("option",{value:"SP",children:"SP"}),s.jsx("option",{value:"RJ",children:"RJ"}),s.jsx("option",{value:"MG",children:"MG"}),s.jsx("option",{value:"PR",children:"PR"}),s.jsx("option",{value:"SC",children:"SC"})]})]}),s.jsx("input",{id:"dentista-especialidade",type:"text",name:"especialidade",placeholder:"ESPECIALIDADE PRINCIPAL",defaultValue:f==null?void 0:f.especialidade,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input",required:!0}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"dentista-cor",className:"text-xs font-bold text-gray-500 uppercase",children:"COR NA AGENDA"}),s.jsx("input",{id:"dentista-cor",type:"color",name:"corAgenda",defaultValue:(f==null?void 0:f.corAgenda)||"#3B82F6",className:"w-full h-10 border border-gray-300 rounded-lg p-1"})]}),s.jsx("button",{type:"submit",className:"w-full bg-green-600 text-white py-2 rounded-lg font-bold hover:bg-green-700 uppercase",children:"SALVAR"})]})})]})}),p&&y&&t&&s.jsx(cB,{dentist:y,clinicaId:t.id,onClose:()=>{b(!1),x(null)}})]})},uB=()=>{const{data:t,isLoading:e,error:n,refresh:r}=Ie(K.getEspecialidades),[i,c]=A.useState(!1),[d,f]=A.useState(null),h=$e();A.useEffect(()=>{if(!i)return;const x=v=>{v.key==="Escape"&&c(!1)};return document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x)}},[i]);const p=async x=>{x.preventDefault();const v=new FormData(x.target),N=Object.fromEntries(v);try{d&&d.id?(await K.updateEspecialidade({...d,...N}),h.success("ESPECIALIDADE ATUALIZADA!")):(await K.saveEspecialidade(N),h.success("ESPECIALIDADE SALVA!")),c(!1),r()}catch{h.error("ERRO AO SALVAR ESPECIALIDADE.")}},b=async x=>{window.confirm("TEM CERTEZA QUE DESEJA EXCLUIR ESTA ESPECIALIDADE?")&&(await K.deleteEspecialidade(x),h.success("Especialidade excluída."),r())},y=async x=>{if(!x.destination||!t)return;const v=Array.from(t),[N]=v.splice(x.source.index,1);v.splice(x.destination.index,0,N);const j=v.map((S,R)=>({id:S.id,ordem:R}));try{await K.reorderEspecialidades(j),h.success("ORDEM ATUALIZADA!"),r()}catch{h.error("ERRO AO REORDENAR.")}};return s.jsxs(zu,{title:"ESPECIALIDADES CLÍNICAS",buttonLabel:"NOVA ESPECIALIDADE",onButtonClick:()=>{f({}),c(!0)},children:[s.jsx("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-gray-50 text-gray-500 uppercase text-xs font-bold",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-6 py-3 text-left w-10"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"NOME"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"DESCRIÇÃO"}),s.jsx("th",{className:"px-6 py-3 text-right",children:"AÇÕES"})]})}),s.jsx(Jl,{onDragEnd:y,children:s.jsx(ti,{droppableId:"especialidades",children:x=>s.jsxs("tbody",{...x.droppableProps,ref:x.innerRef,className:"divide-y divide-gray-100",children:[e&&s.jsx("tr",{children:s.jsx("td",{colSpan:4,className:"p-6 text-center",children:s.jsx(Ot,{className:"animate-spin text-blue-500 mx-auto"})})}),n&&s.jsx("tr",{children:s.jsx("td",{colSpan:4,className:"p-6 text-center text-red-500",children:n.message})}),t==null?void 0:t.map((v,N)=>s.jsx(ei,{draggableId:v.id,index:N,children:(j,S)=>s.jsxs("tr",{ref:j.innerRef,...j.draggableProps,className:`${S.isDragging?"bg-blue-50 shadow-md ring-1 ring-blue-200":"bg-white"} transition-shadow`,children:[s.jsx("td",{className:"px-6 py-4 text-gray-400 cursor-grab active:cursor-grabbing",...j.dragHandleProps,children:s.jsx(Ql,{size:18})}),s.jsx("td",{className:"px-6 py-4 font-bold text-gray-800",children:v.nome}),s.jsx("td",{className:"px-6 py-4 text-gray-600",children:v.descricao}),s.jsx("td",{className:"px-6 py-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:()=>{f(v),c(!0)},className:"p-2 text-gray-500 hover:bg-gray-100 rounded-md",children:s.jsx(Uo,{size:16})}),s.jsx("button",{onClick:()=>b(v.id),className:"p-2 text-gray-500 hover:bg-red-50 hover:text-red-600 rounded-md",children:s.jsx(Qt,{size:16})})]})})]})},v.id)),x.placeholder]})})})]})}),i&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-blue-50 to-white",children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-800 uppercase",children:[d!=null&&d.id?"EDITAR":"NOVA"," ESPECIALIDADE"]}),s.jsx("button",{onClick:()=>c(!1),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:p,className:"space-y-4 max-w-2xl mx-auto",children:[s.jsx("input",{id:"esp-nome",name:"nome",placeholder:"NOME DA ESPECIALIDADE",defaultValue:d==null?void 0:d.nome,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input",required:!0}),s.jsx("textarea",{id:"esp-desc",name:"descricao",placeholder:"BREVE DESCRIÇÃO",defaultValue:d==null?void 0:d.descricao,className:"w-full border border-gray-300 rounded-lg p-2 h-24 uppercase-textarea"}),s.jsx("button",{type:"submit",className:"w-full bg-green-600 text-white py-2 rounded-lg font-bold hover:bg-green-700 uppercase",children:"SALVAR"})]})})]})})]})},fB=()=>{var $;const{data:t,isLoading:e,error:n,refresh:r}=Ie(K.getProcedimentos),{data:i}=Ie(K.getEspecialidades),{data:c}=Ie(K.getPlanos),[d,f]=A.useState(!1),[h,p]=A.useState(null),[b,y]=A.useState([]),x=$e();A.useEffect(()=>{if(!d)return;const M=H=>{H.key==="Escape"&&f(!1)};return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M)}},[d]),A.useEffect(()=>{h&&(y(h.valoresPlanos||[]),!h.id&&!h.categoria&&p(M=>({...M,categoria:"Particular"})))},[h]);const v=()=>{const M=((t==null?void 0:t.length)||0)+1;p(H=>({...H,codigoInterno:M.toString()}))},N=async M=>{M.preventDefault();const H=new FormData(M.target),ne=Object.fromEntries(H.entries()),ee=i==null?void 0:i.find(pe=>pe.id===ne.especialidadeId),he={id:h==null?void 0:h.id,nome:ne.nome,codigo:ne.codigo,codigoInterno:ne.codigoInterno,categoria:ne.categoria,descricao:ne.descricao,descricao_mobile:ne.descricao_mobile||void 0,especialidadeId:ne.especialidadeId,especialidadeNome:(ee==null?void 0:ee.nome)||"",valorParticular:parseFloat(ne.valorParticular),tipo_regiao:(h==null?void 0:h.tipo_regiao)||"GERAL",exige_face:(h==null?void 0:h.tipo_regiao)==="DENTE"?!!(h!=null&&h.exige_face):!1,num_faces:(h==null?void 0:h.num_faces)||void 0,num_raizes:(h==null?void 0:h.num_raizes)||void 0,valoresPlanos:b.map(pe=>{var z;return{planoId:pe.planoId,planoNome:((z=c==null?void 0:c.find(oe=>oe.id===pe.planoId))==null?void 0:z.nome)||"",valor:parseFloat(pe.valor),codigoPlano:pe.codigoPlano||""}})};try{he.id?(await K.updateProcedimento(he),x.success("PROCEDIMENTO ATUALIZADO!")):(await K.saveProcedimento(he),x.success("PROCEDIMENTO SALVO!")),f(!1),r()}catch{x.error("ERRO AO SALVAR PROCEDIMENTO.")}},j=async M=>{window.confirm("TEM CERTEZA QUE DESEJA EXCLUIR ESTE PROCEDIMENTO?")&&(await K.deleteProcedimento(M),x.success("Procedimento excluído."),r())},S=()=>y(M=>[...M,{planoId:"",valor:0,codigoPlano:""}]),R=M=>y(H=>H.filter((ne,ee)=>ee!==M)),w=(M,H,ne)=>{const ee=[...b];ee[M]={...ee[M],[H]:ne},y(ee)},D=async M=>{if(!M.destination||!t)return;const H=Array.from(t),[ne]=H.splice(M.source.index,1);H.splice(M.destination.index,0,ne);const ee=H.map((he,pe)=>({id:he.id,ordem:pe}));try{await K.reorderProcedimentos(ee),x.success("ORDEM DOS PROCEDIMENTOS ATUALIZADA!"),r()}catch{x.error("ERRO AO REORDENAR PROCEDIMENTOS.")}},C=M=>M.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase(),I=C((($=i==null?void 0:i.find(M=>M.id===(h==null?void 0:h.especialidadeId)))==null?void 0:$.nome)||""),L=I.includes("dentistic"),F=I.includes("endodont"),Y=L||F;return s.jsxs(zu,{title:"PROCEDIMENTOS E VALORES",buttonLabel:"NOVO PROCEDIMENTO",onButtonClick:()=>{p({}),f(!0)},children:[s.jsx("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-gray-50 text-gray-500 uppercase text-xs font-bold",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-6 py-3 text-left w-10"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"NOME"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"CÓDIGO (TUSS/INT)"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"CATEGORIA"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"ESPECIALIDADE"}),s.jsx("th",{className:"px-6 py-3 text-left",children:"VALOR PARTICULAR"}),s.jsx("th",{className:"px-6 py-3 text-right",children:"AÇÕES"})]})}),s.jsx(Jl,{onDragEnd:D,children:s.jsx(ti,{droppableId:"procedimentos",children:M=>s.jsxs("tbody",{...M.droppableProps,ref:M.innerRef,className:"divide-y divide-gray-100",children:[e&&s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"p-6 text-center",children:s.jsx(Ot,{className:"animate-spin text-blue-500 mx-auto"})})}),n&&s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"p-6 text-center text-red-500",children:n.message})}),t==null?void 0:t.map((H,ne)=>s.jsx(ei,{draggableId:H.id,index:ne,children:(ee,he)=>s.jsxs("tr",{ref:ee.innerRef,...ee.draggableProps,className:`${he.isDragging?"bg-blue-50 shadow-md ring-1 ring-blue-200":"bg-white"} transition-shadow`,children:[s.jsx("td",{className:"px-6 py-4 text-gray-400 cursor-grab active:cursor-grabbing",...ee.dragHandleProps,children:s.jsx(Ql,{size:18})}),s.jsx("td",{className:"px-6 py-4 font-bold text-gray-800",children:H.nome}),s.jsx("td",{className:"px-6 py-4",children:s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:["TUSS: ",H.codigo||"---"]}),s.jsxs("span",{className:"text-[10px] font-bold text-blue-600 uppercase bg-blue-50 px-1.5 py-0.5 rounded w-fit",children:["INT: ",H.codigoInterno||"---"]})]})}),s.jsx("td",{className:"px-6 py-4",children:s.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded-full bg-gray-100 text-gray-600 uppercase",children:H.categoria})}),s.jsx("td",{className:"px-6 py-4 text-gray-600",children:H.especialidadeNome}),s.jsxs("td",{className:"px-6 py-4 font-semibold text-gray-700",children:["R$ ",Number(H.valorParticular).toFixed(2)]}),s.jsx("td",{className:"px-6 py-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:()=>{p(H),f(!0)},className:"p-2 text-gray-500 hover:bg-gray-100 rounded-md",children:s.jsx(Uo,{size:16})}),s.jsx("button",{onClick:()=>j(H.id),className:"p-2 text-gray-500 hover:bg-red-50 hover:text-red-600 rounded-md",children:s.jsx(Qt,{size:16})})]})})]})},H.id)),M.placeholder]})})})]})}),d&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-blue-50 to-white",children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-800 uppercase",children:[h!=null&&h.id?"EDITAR":"NOVO"," PROCEDIMENTO"]}),s.jsx("button",{onClick:()=>f(!1),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:N,className:"space-y-4 max-w-2xl mx-auto pb-4",children:[s.jsx("input",{name:"nome",placeholder:"NOME DO PROCEDIMENTO",defaultValue:h==null?void 0:h.nome,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input",required:!0}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"CATEGORIA"}),s.jsxs("select",{name:"categoria",value:(h==null?void 0:h.categoria)||"Particular",onChange:M=>{const H=M.target.value;p(ne=>({...ne,categoria:H})),H==="Particular"&&!(h!=null&&h.codigoInterno)&&v()},className:"w-full border border-gray-300 rounded-lg p-2 bg-white uppercase-select",required:!0,children:[s.jsx("option",{value:"Particular",children:"Particular"}),s.jsx("option",{value:"Plano",children:"Plano"}),s.jsx("option",{value:"Convênio",children:"Convênio"}),s.jsx("option",{value:"Outros",children:"Outros"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"CÓDIGO TUSS"}),s.jsx("input",{name:"codigo",placeholder:(h==null?void 0:h.categoria)==="Plano"?"00000000":"OPCIONAL",defaultValue:h==null?void 0:h.codigo,className:`w-full border border-gray-300 rounded-lg p-2 uppercase-input ${(h==null?void 0:h.categoria)!=="Plano"?"bg-gray-50":""}`,required:(h==null?void 0:h.categoria)==="Plano"})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"text-xs font-bold text-gray-500 uppercase flex justify-between",children:["CÓDIGO INTERNO",(h==null?void 0:h.categoria)!=="Particular"&&s.jsx("button",{type:"button",onClick:v,className:"text-blue-600 hover:text-blue-800",children:s.jsx(vu,{size:12})})]}),s.jsx("input",{name:"codigoInterno",placeholder:(h==null?void 0:h.categoria)==="Particular"?"AUTO (CONTAGEM + 1)":"EX: 101",value:(h==null?void 0:h.codigoInterno)||"",onChange:M=>p(H=>({...H,codigoInterno:M.target.value})),className:`w-full border border-gray-300 rounded-lg p-2 uppercase-input ${(h==null?void 0:h.categoria)==="Particular"?"bg-gray-50 text-blue-600 font-bold":""}`,required:(h==null?void 0:h.categoria)!=="Particular"})]})]}),s.jsx("textarea",{name:"descricao",placeholder:"BREVE DESCRIÇÃO",defaultValue:h==null?void 0:h.descricao,className:"w-full border border-gray-300 rounded-lg p-2 h-20 uppercase-textarea"}),s.jsxs("div",{children:[s.jsxs("label",{className:"text-xs font-bold text-gray-500 uppercase flex items-center gap-2",children:["DESCRIÇÃO MOBILE ",s.jsx("span",{className:"text-[10px] text-blue-500 font-normal normal-case",children:"(versão curta para celular)"})]}),s.jsx("input",{name:"descricao_mobile",placeholder:"EX: RESTAURAÇÃO COMP.",defaultValue:h==null?void 0:h.descricao_mobile,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"ESPECIALIDADE"}),s.jsxs("select",{name:"especialidadeId",value:(h==null?void 0:h.especialidadeId)||"",onChange:M=>{var he;const H=M.target.value,ne=C(((he=i==null?void 0:i.find(pe=>pe.id===H))==null?void 0:he.nome)||""),ee=ne.includes("dentistic")||ne.includes("endodont");p(pe=>({...pe,especialidadeId:H,tipo_regiao:ee&&(pe==null?void 0:pe.tipo_regiao)==="ARCO"?"DENTE":pe==null?void 0:pe.tipo_regiao,num_faces:void 0,num_raizes:void 0}))},className:"w-full border border-gray-300 rounded-lg p-2 bg-white uppercase-select",required:!0,children:[s.jsx("option",{value:"",children:"SELECIONE UMA ESPECIALIDADE"}),i==null?void 0:i.map(M=>s.jsx("option",{value:M.id,children:M.nome},M.id))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"VALOR PARTICULAR (R$)"}),s.jsx("input",{type:"number",step:"0.01",name:"valorParticular",placeholder:"0.00",defaultValue:h==null?void 0:h.valorParticular,className:"w-full border border-gray-300 rounded-lg p-2",required:!0})]})]}),s.jsxs("div",{className:"bg-blue-50/50 p-4 rounded-xl border border-blue-100 space-y-4",children:[s.jsxs("h4",{className:"text-[10px] font-black text-blue-600 uppercase tracking-widest flex items-center gap-2",children:[s.jsx($l,{size:12})," REGRA DO ODONTOGRAMA (GTO)"]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("label",{className:"text-xs font-bold text-gray-700 uppercase",children:"EXIGÊNCIA DE REGIÃO NO LANÇAMENTO"}),s.jsx("div",{className:`grid gap-2 ${Y?"grid-cols-2":"grid-cols-3"}`,children:[{id:"GERAL",label:"PROCED. GERAL",desc:"SEM ODONTOGRAMA"},{id:"DENTE",label:"DENTE ESPECÍFICO",desc:"LIBERA NÚMEROS"},...Y?[]:[{id:"ARCO",label:"ARCO COMPLETO",desc:"LIBERA AI / AS"}]].map(M=>s.jsxs("label",{className:` + relative flex flex-col p-3 rounded-lg border-2 cursor-pointer transition-all + ${((h==null?void 0:h.tipo_regiao)||"GERAL")===M.id?"border-blue-600 bg-blue-50 ring-2 ring-blue-100":"border-gray-200 bg-white hover:border-gray-300"} + `,children:[s.jsx("input",{type:"radio",name:"tipo_regiao",value:M.id,checked:((h==null?void 0:h.tipo_regiao)||"GERAL")===M.id,onChange:H=>p(ne=>({...ne,tipo_regiao:H.target.value})),className:"sr-only"}),s.jsx("span",{className:"text-[10px] font-black uppercase text-gray-900 leading-tight",children:M.label}),s.jsx("span",{className:"text-[9px] font-bold text-gray-400 mt-1 uppercase",children:M.desc})]},M.id))})]}),(h==null?void 0:h.tipo_regiao)==="DENTE"&&s.jsx("div",{className:"pt-2 animate-in slide-in-from-top-2 duration-200",children:s.jsxs("label",{className:"flex items-center gap-3 p-3 bg-white rounded-lg border border-blue-200 cursor-pointer hover:bg-blue-50/50 transition-colors",children:[s.jsx("div",{className:"relative flex items-center",children:s.jsx("input",{type:"checkbox",name:"exige_face",checked:!!(h!=null&&h.exige_face),onChange:M=>p(H=>({...H,exige_face:M.target.checked})),className:"w-5 h-5 rounded border-gray-300 text-blue-600 focus:ring-blue-500"})}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-[11px] font-black text-gray-800 uppercase",children:"Exigir preenchimento de Face?"}),s.jsx("span",{className:"text-[9px] font-bold text-gray-400 uppercase",children:"(O, M, D, V, L, P) será obrigatório na GTO"})]})]})}),L&&s.jsxs("div",{className:"pt-2 animate-in slide-in-from-top-2 duration-200",children:[s.jsx("label",{className:"text-[10px] font-black text-blue-700 uppercase tracking-widest mb-1.5 block",children:"Nº de Faces (Dentística)"}),s.jsxs("select",{value:(h==null?void 0:h.num_faces)||"",onChange:M=>p(H=>({...H,num_faces:M.target.value?parseInt(M.target.value):void 0})),className:"w-full border border-blue-200 rounded-lg p-2.5 bg-white text-sm font-bold text-gray-700 focus:border-blue-500 outline-none",children:[s.jsx("option",{value:"",children:"NÃO DEFINIDO"}),[1,2,3,4,5].map(M=>s.jsxs("option",{value:M,children:[M," ",M===1?"face":"faces"]},M))]})]}),F&&s.jsxs("div",{className:"pt-2 animate-in slide-in-from-top-2 duration-200",children:[s.jsx("label",{className:"text-[10px] font-black text-blue-700 uppercase tracking-widest mb-1.5 block",children:"Nº de Raízes (Endodontia)"}),s.jsxs("select",{value:(h==null?void 0:h.num_raizes)||"",onChange:M=>p(H=>({...H,num_raizes:M.target.value?parseInt(M.target.value):void 0})),className:"w-full border border-blue-200 rounded-lg p-2.5 bg-white text-sm font-bold text-gray-700 focus:border-blue-500 outline-none",children:[s.jsx("option",{value:"",children:"NÃO DEFINIDO"}),[1,2,3,4,5].map(M=>s.jsxs("option",{value:M,children:[M," ",M===1?"raiz":"raízes"]},M))]})]})]}),s.jsxs("div",{className:"pt-4",children:[s.jsx("h4",{className:"font-bold text-gray-700 uppercase mb-2",children:"VALORES PARA PLANOS / CONVÊNIOS"}),s.jsx("div",{className:"space-y-2",children:b.map((M,H)=>s.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-2 bg-gray-50 p-2 rounded-lg border",children:[s.jsxs("select",{value:M.planoId,onChange:ne=>w(H,"planoId",ne.target.value),className:"flex-1 border border-gray-300 rounded-lg p-2 bg-white uppercase-select",children:[s.jsx("option",{value:"",children:"SELECIONE UM PLANO"}),c==null?void 0:c.filter(ne=>ne.tipo!=="Particular").map(ne=>s.jsx("option",{value:ne.id,children:ne.nome},ne.id))]}),s.jsx("input",{type:"number",step:"0.01",placeholder:"VALOR (R$)",value:M.valor,onChange:ne=>w(H,"valor",ne.target.value),className:"w-32 border border-gray-300 rounded-lg p-2"}),s.jsx("input",{type:"text",placeholder:"CÓD. PLANO",value:M.codigoPlano,onChange:ne=>w(H,"codigoPlano",ne.target.value),className:"w-32 border border-gray-300 rounded-lg p-2 uppercase-input"}),s.jsx("button",{type:"button",onClick:()=>R(H),className:"p-2 text-red-500 hover:bg-red-100 rounded-md",children:s.jsx(Qt,{size:16})})]},H))}),s.jsxs("button",{type:"button",onClick:S,className:"mt-2 text-xs font-bold text-blue-600 hover:underline uppercase flex items-center gap-1",children:[s.jsx(gt,{size:14})," ADICIONAR VALOR DE PLANO"]})]}),s.jsx("div",{className:"pt-4 flex-shrink-0",children:s.jsx("button",{type:"submit",className:"w-full bg-green-600 text-white py-4 rounded-xl font-black hover:bg-green-700 uppercase text-xs shadow-lg shadow-green-100 transition-all active:scale-[0.98]",children:"SALVAR PROCEDIMENTO"})})]})})]})})]})},hB=()=>{const{data:t,isLoading:e,error:n,refresh:r}=Ie(K.getPlanos),[i,c]=A.useState(!1),[d,f]=A.useState(null),h=$e();A.useEffect(()=>{if(!i)return;const y=x=>{x.key==="Escape"&&c(!1)};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[i]);const p=async y=>{y.preventDefault();const x=new FormData(y.target),v=Object.fromEntries(x);try{d&&d.id?(await K.updatePlano({...d,...v}),h.success("PLANO ATUALIZADO!")):(await K.savePlano(v),h.success("PLANO SALVO!")),c(!1),r()}catch{h.error("ERRO AO SALVAR PLANO.")}},b=async y=>{window.confirm("TEM CERTEZA QUE DESEJA EXCLUIR ESTE PLANO?")&&(await K.deletePlano(y),h.success("Plano excluído."),r())};return s.jsxs(zu,{title:"PLANOS E CONVÊNIOS",buttonLabel:"NOVO PLANO",onButtonClick:()=>{f({}),c(!0)},children:[e&&s.jsx(Ot,{className:"animate-spin text-blue-500"}),n&&s.jsxs("p",{className:"text-red-500",children:["Erro: ",n.message]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:t==null?void 0:t.map(y=>s.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm hover:shadow-md transition-shadow flex flex-col overflow-hidden",style:{borderTop:`4px solid ${y.corCartao}`},children:[s.jsxs("div",{className:"p-5 flex-grow",children:[s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("h3",{className:"font-bold text-gray-900 uppercase",children:y.nome}),s.jsx("span",{className:"text-xs font-bold text-gray-500 bg-gray-100 px-2 py-0.5 rounded-full uppercase",children:y.tipo})]}),s.jsxs("p",{className:"text-sm text-gray-600 mt-2",children:["DESCONTO PADRÃO: ",s.jsxs("span",{className:"font-bold",children:[y.descontoPadrao,"%"]})]})]}),s.jsxs("div",{className:"border-t border-gray-100 p-2 flex gap-2 bg-gray-50/50",children:[s.jsxs("button",{onClick:()=>{f(y),c(!0)},className:"flex-1 text-xs uppercase font-bold text-gray-600 hover:bg-gray-100 py-2 rounded-md flex items-center justify-center gap-2",children:[s.jsx(Uo,{size:14})," EDITAR"]}),s.jsxs("button",{onClick:()=>b(y.id),className:"flex-1 text-xs uppercase font-bold text-red-500 hover:bg-red-50 py-2 rounded-md flex items-center justify-center gap-2",children:[s.jsx(Qt,{size:14})," EXCLUIR"]})]})]},y.id))}),i&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center backdrop-blur-sm p-0",children:s.jsxs("div",{className:"bg-white shadow-2xl w-full h-dvh md:w-[96vw] md:h-[98vh] rounded-none md:rounded-xl flex flex-col overflow-hidden animate-in fade-in zoom-in-50 duration-200",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center flex-shrink-0 bg-gradient-to-r from-blue-50 to-white",children:[s.jsxs("h3",{className:"text-lg font-bold text-gray-800 uppercase",children:[d!=null&&d.id?"EDITAR":"NOVO"," PLANO"]}),s.jsx("button",{onClick:()=>c(!1),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg p-1.5 transition-colors",children:s.jsx(Qe,{size:22})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 lg:p-8",children:s.jsxs("form",{onSubmit:p,className:"space-y-4 max-w-2xl mx-auto",children:[s.jsx("input",{name:"nome",placeholder:"NOME DO PLANO/CONVÊNIO",defaultValue:d==null?void 0:d.nome,className:"w-full border border-gray-300 rounded-lg p-2 uppercase-input",required:!0}),s.jsxs("select",{name:"tipo",defaultValue:(d==null?void 0:d.tipo)||"Convenio",className:"w-full border border-gray-300 rounded-lg p-2 bg-white uppercase-select",required:!0,children:[s.jsx("option",{children:"Convenio"}),s.jsx("option",{children:"Particular"}),s.jsx("option",{children:"Parceria"})]}),s.jsx("input",{type:"number",name:"descontoPadrao",placeholder:"DESCONTO PADRÃO (%)",defaultValue:d==null?void 0:d.descontoPadrao,className:"w-full border border-gray-300 rounded-lg p-2"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-bold text-gray-500 uppercase",children:"COR DO CARTÃO"}),s.jsx("input",{type:"color",name:"corCartao",defaultValue:(d==null?void 0:d.corCartao)||"#1f2937",className:"w-full h-10 border border-gray-300 rounded-lg p-1"})]}),s.jsx("button",{type:"submit",className:"w-full bg-green-600 text-white py-2 rounded-lg font-bold hover:bg-green-700 uppercase",children:"SALVAR"})]})})]})})]})},pB=["pacientes","agendamentos","financeiro","leads","guias"],gB=()=>{const[t,e]=A.useState([]),[n,r]=A.useState(null),[i,c]=A.useState(null),d=$e(),f={Authorization:`Bearer ${localStorage.getItem("SCOREODONTO_AUTH_TOKEN")}`,"Content-Type":"application/json"},h=async()=>{try{const y=await fetch("/api/sync/status",{headers:f});y.ok&&c(await y.json())}catch{}};A.useEffect(()=>{h()},[]);const p=async y=>{r(y),e([`>>> ${{push:"BACKUP PostgreSQL → Google Sheets",pull:"RESTAURAR Google Sheets → PostgreSQL","import-legacy":"IMPORTAR PACIENTES (aba PACIENTES-CONSULTT-CLINIC)..."}[y]}...`]);try{const N=await(await fetch(`/api/sync/${y}`,{method:"POST",headers:f})).json();if(e(N.logs||[]),N.success){const j={push:"BACKUP REALIZADO!",pull:"DADOS RESTAURADOS!","import-legacy":`${N.imported??0} PACIENTES IMPORTADOS!`};d.success(j[y]),h()}else d.error("ERRO NA SINCRONIZAÇÃO. VERIFIQUE OS LOGS.")}catch(v){e(N=>[...N,`[ERRO] ${v.message}`]),d.error("FALHA NA CONEXÃO.")}finally{r(null)}},b=y=>y?new Date(y).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"—";return s.jsxs("div",{className:"max-w-5xl mx-auto space-y-6",children:[s.jsx(fn,{title:"BACKUP & SINCRONIZAÇÃO",description:"POSTGRESQL ↔ GOOGLE SHEETS",children:s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("button",{onClick:()=>p("push"),disabled:!!n,className:`px-4 py-2 rounded-xl flex items-center gap-2 text-xs font-black uppercase transition-all shadow-sm ${n?"bg-gray-200 text-gray-400 cursor-not-allowed":"bg-green-600 hover:bg-green-700 text-white shadow-green-100"}`,children:[s.jsx(vu,{size:15,className:n==="push"?"animate-spin":""}),n==="push"?"ENVIANDO...":"BACKUP AGORA"]}),s.jsxs("button",{onClick:()=>p("pull"),disabled:!!n,className:`px-4 py-2 rounded-xl flex items-center gap-2 text-xs font-black uppercase transition-all shadow-sm ${n?"bg-gray-200 text-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700 text-white shadow-blue-100"}`,children:[s.jsx(Sr,{size:15,className:n==="pull"?"animate-spin":""}),n==="pull"?"IMPORTANDO...":"RESTAURAR DO BACKUP"]}),s.jsxs("button",{onClick:()=>p("import-legacy"),disabled:!!n,title:"Importa pacientes da aba PACIENTES-CONSULTT-CLINIC (Apps Script)",className:`px-4 py-2 rounded-xl flex items-center gap-2 text-xs font-black uppercase transition-all shadow-sm ${n?"bg-gray-200 text-gray-400 cursor-not-allowed":"bg-amber-500 hover:bg-amber-600 text-white shadow-amber-100"}`,children:[s.jsx(Sr,{size:15,className:n==="import-legacy"?"animate-spin":""}),n==="import-legacy"?"IMPORTANDO...":"IMPORTAR PLANILHA LEGADA"]})]})}),s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-gray-50",children:s.jsx("h3",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"ESTADO DAS TABELAS"})}),s.jsx("div",{className:"divide-y divide-gray-50",children:pB.map(y=>{var N,j;const x=(N=i==null?void 0:i.syncStatus)==null?void 0:N[y],v=(j=i==null?void 0:i.counts)==null?void 0:j[y];return s.jsxs("div",{className:"flex items-center justify-between px-6 py-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:`w-2 h-2 rounded-full ${x!=null&&x.lastPush?"bg-green-400":"bg-gray-200"}`}),s.jsx("span",{className:"text-sm font-black uppercase text-gray-700",children:y})]}),s.jsxs("div",{className:"flex items-center gap-8 text-right",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase",children:"No banco"}),s.jsx("p",{className:"text-sm font-black text-gray-800",children:v??"—"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase",children:"Último backup"}),s.jsx("p",{className:"text-xs font-bold text-gray-600",children:b(x==null?void 0:x.lastPush)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[9px] font-bold text-gray-400 uppercase",children:"Registros no backup"}),s.jsx("p",{className:"text-xs font-bold text-gray-600",children:(x==null?void 0:x.count)??"—"})]})]})]},y)})}),(i==null?void 0:i.spreadsheetId)&&s.jsxs("div",{className:"px-6 py-3 bg-gray-50 border-t border-gray-100 flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase",children:"PLANILHA:"}),s.jsx("span",{className:"text-[10px] font-mono text-blue-600 truncate",children:i.spreadsheetId})]})]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsxs("div",{className:"px-6 py-4 border-b border-gray-50 flex items-center justify-between",children:[s.jsx("h3",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"LOG DE OPERAÇÃO"}),t.length>0&&s.jsx("button",{onClick:()=>e([]),className:"text-[10px] font-bold text-gray-400 hover:text-gray-600 uppercase",children:"LIMPAR"})]}),s.jsx("div",{className:"p-4",children:s.jsxs("div",{className:"bg-gray-950 rounded-xl p-4 font-mono text-xs text-green-400 min-h-[160px] max-h-80 overflow-y-auto",children:[t.length===0?s.jsx("span",{className:"text-gray-600",children:"AGUARDANDO OPERAÇÃO..."}):t.map((y,x)=>s.jsx("div",{className:`mb-1 pl-2 border-l-2 ${y.startsWith("[ERRO]")?"border-red-500 text-red-400":y.startsWith("[✓]")?"border-green-400 text-green-300":"border-gray-700"}`,children:y},x)),n&&s.jsx("div",{className:"animate-pulse text-green-500 mt-1",children:"▋"})]})}),s.jsxs("div",{className:"bg-amber-50 border-t border-amber-100 px-6 py-3 flex items-start gap-3",children:[s.jsx(Sr,{size:14,className:"text-amber-600 mt-0.5 flex-shrink-0"}),s.jsx("p",{className:"text-[10px] text-amber-700 font-bold uppercase leading-relaxed",children:'BACKUP AUTOMÁTICO: cada alteração de paciente, agendamento, financeiro ou lead é enviada para a planilha automaticamente (com delay de 5s para agrupar alterações). Use "Restaurar" para recuperar dados da planilha caso o banco seja reiniciado.'})]})]})]})},mB=()=>{const[t,e]=A.useState([]),[n,r]=A.useState(!0),[i,c]=A.useState(""),[d,f]=A.useState("all"),[h,p]=A.useState("all"),b=$e(),y=async()=>{r(!0);try{const w=await K.getNotifications();e(w.sort((D,C)=>new Date(C.data).getTime()-new Date(D.data).getTime()))}catch{b.error("Erro ao carregar notificações")}finally{r(!1)}};A.useEffect(()=>{y()},[]);const x=async w=>{try{await K.markNotificationRead(w),e(D=>D.map(C=>C.id===w?{...C,lida:!0}:C)),b.success("Notificação marcada como lida")}catch{b.error("Erro ao atualizar notificação")}},v=async()=>{if(t.filter(D=>!D.lida).length!==0)try{await K.markAllNotificationsRead(),e(D=>D.map(C=>({...C,lida:!0}))),b.success("Todas as notificações foram marcadas como lidas")}catch{b.error("Erro ao atualizar notificações")}},N=async w=>{try{await K.deleteNotification(w),e(D=>D.filter(C=>C.id!==w)),b.success("Notificação removida")}catch{b.error("Erro ao excluir notificação")}},j=w=>{switch(w){case"agenda":return s.jsx(jt,{size:20,className:"text-blue-500"});case"financeiro":return s.jsx(Fa,{size:20,className:"text-emerald-500"});case"lead":return s.jsx(Wl,{size:20,className:"text-amber-500"});case"sistema":return s.jsx(Pd,{size:20,className:"text-red-500"});default:return s.jsx(Mg,{size:20,className:"text-gray-500"})}},S=t.filter(w=>{const D=w.titulo.toLowerCase().includes(i.toLowerCase())||w.mensagem.toLowerCase().includes(i.toLowerCase()),C=d==="all"||d==="unread"&&!w.lida||d==="important"&&w.tipo==="sistema",I=h==="all"||w.tipo===h;return D&&C&&I}),R=t.filter(w=>!w.lida).length;return s.jsxs("div",{className:"space-y-6 animate-in fade-in duration-500",children:[s.jsx(fn,{title:"CENTRO DE NOTIFICAÇÕES",children:s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("button",{onClick:v,className:"flex items-center gap-2 px-4 py-2 bg-white border border-slate-200 text-slate-600 hover:text-blue-600 hover:border-blue-200 rounded-xl font-bold text-xs uppercase tracking-wider transition-all shadow-sm",children:[s.jsx(pa,{size:16})," Marcar todas como lidas"]}),s.jsxs("button",{onClick:y,className:"flex items-center gap-2 px-4 py-2 bg-blue-600 text-white hover:bg-blue-700 rounded-xl font-bold text-xs uppercase tracking-wider transition-all shadow-md active:scale-95",children:[s.jsx(go,{size:16})," Atualizar"]})]})}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[{label:"Total",count:t.length,icon:rv,color:"text-slate-600",bg:"bg-slate-100"},{label:"Não Lidas",count:R,icon:go,color:"text-blue-600",bg:"bg-blue-50"},{label:"Sistema",count:t.filter(w=>w.tipo==="sistema").length,icon:Pd,color:"text-red-600",bg:"bg-red-50"},{label:"Financeiro",count:t.filter(w=>w.tipo==="financeiro").length,icon:Fa,color:"text-emerald-600",bg:"bg-emerald-50"}].map((w,D)=>s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-slate-100 shadow-sm flex items-center gap-4 group hover:shadow-md transition-all",children:[s.jsx("div",{className:`p-3 rounded-xl ${w.bg} ${w.color} group-hover:scale-110 transition-transform`,children:s.jsx(w.icon,{size:24})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:w.label}),s.jsx("h4",{className:"text-2xl font-black text-slate-800 tracking-tighter",children:w.count})]})]},D))}),s.jsxs("div",{className:"bg-white rounded-[2.5rem] border border-slate-100 shadow-sm overflow-hidden min-h-[600px] flex flex-col",children:[s.jsxs("div",{className:"p-8 border-b border-slate-50 flex flex-col lg:flex-row lg:items-center justify-between gap-6 bg-slate-50/30",children:[s.jsx("div",{className:"flex p-1.5 bg-slate-100 rounded-2xl w-fit",children:[{id:"all",label:"Todas"},{id:"unread",label:"Não Lidas"},{id:"important",label:"Importantes"}].map(w=>s.jsxs("button",{onClick:()=>f(w.id),className:`px-6 py-2.5 rounded-xl text-xs font-black uppercase tracking-widest transition-all ${d===w.id?"bg-white text-blue-600 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:[w.label,w.id==="unread"&&R>0&&s.jsx("span",{className:"ml-2 bg-blue-600 text-white px-1.5 py-0.5 rounded-md text-[9px]",children:R})]},w.id))}),s.jsxs("div",{className:"flex flex-1 max-w-2xl gap-3",children:[s.jsxs("div",{className:"relative flex-1 group",children:[s.jsx(Qn,{className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400 group-focus-within:text-blue-500 transition-colors",size:18}),s.jsx("input",{type:"text",placeholder:"Pesquisar notificações...",value:i,onChange:w=>c(w.target.value),className:"w-full pl-12 pr-4 py-3.5 bg-white border border-slate-200 rounded-2xl text-sm font-bold uppercase tracking-tight focus:ring-4 focus:ring-blue-50 focus:border-blue-500 outline-none transition-all placeholder:text-slate-300"})]}),s.jsxs("select",{value:h,onChange:w=>p(w.target.value),className:"px-4 py-3.5 bg-white border border-slate-200 rounded-2xl text-xs font-black uppercase tracking-widest focus:ring-4 focus:ring-blue-50 outline-none cursor-pointer",children:[s.jsx("option",{value:"all",children:"Filtro: Todos"}),s.jsx("option",{value:"lead",children:"Novos Leads"}),s.jsx("option",{value:"agenda",children:"Agendamentos"}),s.jsx("option",{value:"financeiro",children:"Financeiro"}),s.jsx("option",{value:"sistema",children:"Alertas de Sistema"})]})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:n?s.jsxs("div",{className:"flex flex-col items-center justify-center h-[400px]",children:[s.jsx("div",{className:"w-12 h-12 border-4 border-blue-100 border-t-blue-600 rounded-full animate-spin mb-4"}),s.jsx("p",{className:"text-slate-400 font-black uppercase tracking-widest text-xs",children:"Carregando Histórico..."})]}):S.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center p-20 text-center",children:[s.jsx("div",{className:"w-32 h-32 bg-slate-50 rounded-[3rem] flex items-center justify-center mb-6",children:s.jsx(rv,{size:48,className:"text-slate-200"})}),s.jsx("h3",{className:"text-xl font-black text-slate-800 uppercase tracking-tighter",children:"Nenhuma notificação encontrada"}),s.jsx("p",{className:"text-slate-400 text-sm mt-2 max-w-sm",children:"Não existem registros que correspondam aos seus filtros ou pesquisa no momento."})]}):s.jsx("div",{className:"divide-y divide-slate-50",children:S.map((w,D)=>s.jsxs("div",{className:`group p-8 transition-all hover:bg-slate-50/50 flex flex-col md:flex-row md:items-center gap-6 relative ${w.lida?"":"bg-blue-50/20"}`,style:{animationDelay:`${D*50}ms`},children:[!w.lida&&s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1.5 bg-blue-600 rounded-r-full shadow-[2px_0_10px_rgba(37,99,235,0.3)]"}),s.jsx("div",{className:`p-4 rounded-[1.5rem] flex-shrink-0 shadow-sm border border-white transition-transform group-hover:scale-110 ${w.tipo==="agenda"?"bg-blue-100/50 text-blue-600":w.tipo==="financeiro"?"bg-emerald-100/50 text-emerald-600":w.tipo==="lead"?"bg-amber-100/50 text-amber-600":"bg-red-100/50 text-red-600"}`,children:j(w.tipo)}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("span",{className:`text-[10px] font-black uppercase tracking-[0.2em] px-3 py-1 rounded-full ${w.tipo==="agenda"?"bg-blue-100 text-blue-600":w.tipo==="financeiro"?"bg-emerald-100 text-emerald-600":w.tipo==="lead"?"bg-amber-100 text-amber-600":"bg-red-100 text-red-600"}`,children:w.tipo}),s.jsxs("span",{className:"text-[11px] font-bold text-slate-300 flex items-center gap-1.5 uppercase tracking-wider",children:[s.jsx(jt,{size:12}),new Date(w.data).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",year:"numeric"})]}),s.jsxs("span",{className:"text-[11px] font-bold text-slate-300 flex items-center gap-1.5 uppercase tracking-wider",children:[s.jsx(xB,{size:12,className:"ml-2"}),new Date(w.data).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})]})]}),s.jsx("h3",{className:`text-lg font-black tracking-tighter uppercase ${w.lida?"text-slate-600":"text-slate-900"}`,children:w.titulo}),s.jsx("p",{className:"text-slate-500 text-sm leading-relaxed max-w-4xl",children:w.mensagem})]}),s.jsxs("div",{className:"flex items-center gap-3 opacity-0 group-hover:opacity-100 transition-all transform translate-x-4 group-hover:translate-x-0",children:[!w.lida&&s.jsx("button",{onClick:()=>x(w.id),className:"p-3 bg-blue-600 text-white rounded-xl shadow-lg shadow-blue-100 hover:bg-blue-700 hover:-translate-y-1 transition-all",title:"Marcar como lida",children:s.jsx(pa,{size:20})}),s.jsx("button",{onClick:()=>N(w.id),className:"p-3 bg-white text-slate-400 border border-slate-100 rounded-xl shadow-sm hover:text-red-600 hover:border-red-100 hover:-translate-y-1 transition-all",title:"Excluir",children:s.jsx(Qt,{size:20})}),s.jsx("button",{className:"p-3 bg-white text-slate-400 border border-slate-100 rounded-xl shadow-sm hover:text-slate-600 hover:-translate-y-1 transition-all",children:s.jsx(nD,{size:20})})]})]},w.id))})}),s.jsxs("div",{className:"p-6 bg-slate-50 border-t border-slate-100 flex items-center justify-between",children:[s.jsxs("p",{className:"text-[11px] font-bold text-slate-400 uppercase tracking-widest",children:["Mostrando ",S.length," de ",t.length," registros"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{className:"px-5 py-2 rounded-xl bg-white border border-slate-200 text-[11px] font-black uppercase tracking-wider text-slate-500 hover:bg-slate-50 transition-colors",children:"Voltar"}),s.jsx("button",{className:"px-5 py-2 rounded-xl bg-white border border-slate-200 text-[11px] font-black uppercase tracking-wider text-slate-500 hover:bg-slate-50 transition-colors",children:"Próximo"})]})]})]})]})},xB=({size:t,className:e})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),bB=()=>{var x,v,N;const t=K.getActiveWorkspace(),[e,n]=A.useState(new Date(new Date().getFullYear(),new Date().getMonth(),1).toISOString().split("T")[0]),[r,i]=A.useState(new Date().toISOString().split("T")[0]),{data:c,isLoading:d,refresh:f}=Ie(()=>t?K.getProductivityReport(t.id,e,r):Promise.resolve(null),[t==null?void 0:t.id,e,r]),h=((x=c==null?void 0:c.financeiro)==null?void 0:x.receita)||0,p=((v=c==null?void 0:c.financeiro)==null?void 0:v.despesa)||0,b=h-p,y=()=>{if(!c)return;let j=`Dentista,Total,Concluidos,Faltas,Taxa Ocupacao +`;c.producao.forEach(D=>{const C=D.totalAgendamentos>0?(D.concluidos/D.totalAgendamentos*100).toFixed(1):0;j+=`${D.dentista},${D.totalAgendamentos},${D.concluidos},${D.faltas},${C}% +`});const S=new Blob([j],{type:"text/csv"}),R=window.URL.createObjectURL(S),w=document.createElement("a");w.href=R,w.download=`relatorio_producao_${e}_${r}.csv`,w.click()};return s.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500 pb-10",children:[s.jsx(fn,{title:"RELATÓRIOS & PERFORMANCE",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("button",{onClick:()=>window.print(),className:"bg-white border border-gray-200 text-gray-600 p-2 rounded-lg hover:bg-gray-50 flex items-center gap-2 text-xs font-bold transition-all shadow-sm",children:[s.jsx(Ya,{size:16})," ",s.jsx("span",{className:"hidden sm:inline",children:"IMPRIMIR"})]}),s.jsxs("button",{onClick:y,className:"bg-white border border-gray-200 text-gray-600 p-2 rounded-lg hover:bg-gray-50 flex items-center gap-2 text-xs font-bold transition-all shadow-sm",children:[s.jsx(kg,{size:16})," ",s.jsx("span",{className:"hidden sm:inline",children:"EXPORTAR"})]})]})}),s.jsxs("div",{className:"bg-white p-6 rounded-2xl shadow-sm border border-gray-100 flex flex-wrap items-end gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest flex items-center gap-2",children:[s.jsx(jt,{size:12})," INÍCIO DO PERÍODO"]}),s.jsx("input",{type:"date",value:e,onChange:j=>n(j.target.value),className:"bg-gray-50 border border-gray-200 rounded-xl px-4 py-2.5 text-sm font-bold text-gray-700 focus:ring-2 focus:ring-blue-100 outline-none transition-all"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest flex items-center gap-2",children:[s.jsx(jt,{size:12})," FIM DO PERÍODO"]}),s.jsx("input",{type:"date",value:r,onChange:j=>i(j.target.value),className:"bg-gray-50 border border-gray-200 rounded-xl px-4 py-2.5 text-sm font-bold text-gray-700 focus:ring-2 focus:ring-blue-100 outline-none transition-all"})]}),s.jsxs("button",{onClick:f,className:"bg-blue-600 text-white px-6 py-3 rounded-xl font-black text-xs uppercase hover:bg-blue-700 transition-all shadow-lg shadow-blue-200 flex items-center gap-2",children:[s.jsx(yu,{size:16})," FILTRAR"]})]}),d?s.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-4",children:[s.jsx(Ot,{className:"animate-spin text-blue-600",size:40}),s.jsx("p",{className:"text-xs font-black text-gray-400 uppercase tracking-widest",children:"Processando dados clínicos..."})]}):s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[s.jsxs("div",{className:"bg-white p-6 rounded-2xl border border-gray-100 shadow-sm overflow-hidden relative group",children:[s.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:scale-110 transition-transform",children:s.jsx(Fa,{size:80,className:"text-green-600"})}),s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"RECEITA NO PERÍODO"}),s.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-2xl font-black text-gray-900",children:["R$ ",h.toLocaleString("pt-BR",{minimumFractionDigits:2})]}),s.jsxs("span",{className:"text-green-500 text-[10px] font-black flex items-center",children:[s.jsx(PN,{size:12})," +2.4%"]})]}),s.jsx("div",{className:"mt-4 w-full bg-gray-50 h-1.5 rounded-full overflow-hidden",children:s.jsx("div",{className:"bg-green-500 h-full w-[70%]"})})]}),s.jsxs("div",{className:"bg-white p-6 rounded-2xl border border-gray-100 shadow-sm overflow-hidden relative group",children:[s.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:scale-110 transition-transform",children:s.jsx(XN,{size:80,className:"text-red-600"})}),s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"DESPESA NO PERÍODO"}),s.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-2xl font-black text-gray-900",children:["R$ ",p.toLocaleString("pt-BR",{minimumFractionDigits:2})]}),s.jsxs("span",{className:"text-red-500 text-[10px] font-black flex items-center",children:[s.jsx(LN,{size:12})," -1.2%"]})]}),s.jsx("div",{className:"mt-4 w-full bg-gray-50 h-1.5 rounded-full overflow-hidden",children:s.jsx("div",{className:"bg-red-500 h-full w-[30%]"})})]}),s.jsxs("div",{className:"bg-white p-6 rounded-2xl border border-gray-100 shadow-sm overflow-hidden relative group",children:[s.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:scale-110 transition-transform",children:s.jsx($l,{size:80,className:"text-blue-600"})}),s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"SALDO OPERACIONAL"}),s.jsx("div",{className:"mt-2",children:s.jsxs("span",{className:`text-2xl font-black ${b>=0?"text-blue-600":"text-red-600"}`,children:["R$ ",b.toLocaleString("pt-BR",{minimumFractionDigits:2})]})}),s.jsx("p",{className:"mt-4 text-[10px] font-bold text-gray-400",children:"LIQUIDEZ ATUAL DA UNIDADE"})]}),s.jsxs("div",{className:"bg-white p-6 rounded-2xl border border-gray-100 shadow-sm overflow-hidden relative group",children:[s.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:scale-110 transition-transform",children:s.jsx(sa,{size:80,className:"text-purple-600"})}),s.jsx("h4",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"TRANSAÇÕES"}),s.jsx("div",{className:"mt-2",children:s.jsx("span",{className:"text-2xl font-black text-gray-900",children:((N=c==null?void 0:c.financeiro)==null?void 0:N.totalTransacoes)||0})}),s.jsx("p",{className:"mt-4 text-[10px] font-bold text-gray-400",children:"MOVIMENTAÇÕES FINANCEIRAS"})]})]}),s.jsxs("div",{className:"bg-white rounded-3xl border border-gray-100 shadow-xl overflow-hidden",children:[s.jsxs("div",{className:"px-8 py-6 bg-gradient-to-r from-gray-50 to-white border-b border-gray-100 flex justify-between items-center",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 bg-blue-600 rounded-xl flex items-center justify-center text-white shadow-lg shadow-blue-200",children:s.jsx(Io,{size:20})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-black text-gray-900 uppercase",children:"PRODUTIVIDADE POR DENTISTA"}),s.jsx("p",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-widest",children:"DESEMPENHO CLÍNICO NO PERÍODO"})]})]}),s.jsxs("div",{className:"hidden sm:flex items-center gap-2 px-4 py-2 bg-blue-50 rounded-full",children:[s.jsx(TC,{size:16,className:"text-blue-600"}),s.jsx("span",{className:"text-[10px] font-black text-blue-600 uppercase",children:"Visão por Especialista"})]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left",children:[s.jsx("thead",{className:"bg-gray-50/50",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"ESPECIALISTA"}),s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"TOTAL APPTS"}),s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"EFETIVADOS"}),s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"FALTAS"}),s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"TAXA OCUPAÇÃO"}),s.jsx("th",{className:"px-8 py-5 text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"STATUS"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-100",children:((c==null?void 0:c.producao)||[]).map((j,S)=>{const R=j.totalAgendamentos>0?j.concluidos/j.totalAgendamentos*100:0;return s.jsxs("tr",{className:"hover:bg-blue-50/30 transition-colors group",children:[s.jsx("td",{className:"px-8 py-5",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-100 flex items-center justify-center text-gray-400 font-black text-xs group-hover:bg-blue-600 group-hover:text-white transition-all",children:j.dentista.substring(0,2).toUpperCase()}),s.jsx("span",{className:"font-bold text-gray-900 uppercase text-xs",children:j.dentista})]})}),s.jsx("td",{className:"px-8 py-5 font-bold text-gray-600 text-xs",children:j.totalAgendamentos}),s.jsx("td",{className:"px-8 py-5 font-bold text-green-600 text-xs",children:j.concluidos}),s.jsx("td",{className:"px-8 py-5 font-bold text-red-500 text-xs",children:j.faltas}),s.jsx("td",{className:"px-8 py-5",children:s.jsxs("div",{className:"flex items-center gap-3 min-w-[120px]",children:[s.jsx("div",{className:"flex-1 h-2 bg-gray-100 rounded-full overflow-hidden shadow-inner",children:s.jsx("div",{className:`h-full transition-all duration-1000 ${R>70?"bg-green-500":R>40?"bg-blue-500":"bg-orange-400"}`,style:{width:`${R}%`}})}),s.jsxs("span",{className:"text-[10px] font-black text-gray-400",children:[R.toFixed(0),"%"]})]})}),s.jsx("td",{className:"px-8 py-5",children:R>75?s.jsx("span",{className:"px-2 py-1 bg-green-50 text-green-600 text-[9px] font-black rounded-lg uppercase border border-green-100",children:"Alta Performance"}):R>30?s.jsx("span",{className:"px-2 py-1 bg-blue-50 text-blue-600 text-[9px] font-black rounded-lg uppercase border border-blue-100",children:"Estável"}):s.jsx("span",{className:"px-2 py-1 bg-gray-50 text-gray-400 text-[9px] font-black rounded-lg uppercase border border-gray-100",children:"Baixa Ocupação"})})]},S)})})]})})]})]})]})},yB=()=>{const[t,e]=A.useState([]),[n,r]=A.useState(null),[i,c]=A.useState(""),[d,f]=A.useState(""),[h,p]=A.useState(!1),[b,y]=A.useState(!1),x=K.getCurrentRole(),v=K.getCurrentUserName(),N=K.getCurrentUser(),j=K.getActiveWorkspace(),S=(j==null?void 0:j.cor)||"#2563eb",R=$e(),w={Authorization:`Bearer ${localStorage.getItem("SCOREODONTO_AUTH_TOKEN")}`,"Content-Type":"application/json"},D=async()=>{try{const F=await fetch("/api/auth/google/status");e(await F.json())}catch{}},C=async()=>{try{const F=await fetch("/api/settings/google-credentials",{headers:w});F.ok&&r(await F.json())}catch{}};A.useEffect(()=>{D(),x==="admin"&&C()},[]);const I=async()=>{if(!i.trim()||!d.trim()){R.error("PREENCHA OS DOIS CAMPOS.");return}y(!0);try{const F=await fetch("/api/settings/google-credentials",{method:"POST",headers:w,body:JSON.stringify({clientId:i.trim(),clientSecret:d.trim()})});if(F.ok)R.success("CREDENCIAIS SALVAS!"),c(""),f(""),await C();else{const Y=await F.json();R.error(Y.error||"ERRO AO SALVAR.")}}catch{R.error("FALHA NA CONEXÃO.")}finally{y(!1)}},L=()=>{window.confirm("TEM CERTEZA QUE DESEJA SAIR DO SISTEMA?")&&K.logout()};return s.jsxs("div",{className:"space-y-8 max-w-2xl",children:[s.jsxs("div",{className:"flex items-end justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-black text-gray-900 uppercase tracking-tight",children:"Configurações"}),s.jsx("p",{className:"text-sm text-gray-400 font-medium mt-1",children:"Gerencie seu perfil e integrações"})]}),s.jsx("span",{className:"bg-gray-100 text-gray-400 text-[11px] font-mono font-bold px-3 py-1 rounded-full border border-gray-200 mb-1",children:Dg})]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-gray-50",children:s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"Perfil"})}),s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-14 h-14 bg-gray-100 rounded-full flex items-center justify-center text-gray-500 border border-gray-200 flex-shrink-0",children:s.jsx(Bo,{size:24})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-base font-black text-gray-800 uppercase truncate leading-none mb-1",children:v||"—"}),s.jsx("p",{className:"text-sm font-medium text-gray-400 truncate",children:N||"—"}),s.jsx("span",{className:"inline-block mt-2 text-[10px] font-black uppercase tracking-widest px-2 py-0.5 rounded-full",style:{backgroundColor:`${S}18`,color:S},children:x})]})]})})]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-gray-50",children:s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"Unidade Ativa"})}),s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center text-white flex-shrink-0",style:{backgroundColor:S},children:s.jsx(Rg,{size:20})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-black text-gray-800 uppercase",children:(j==null?void 0:j.nome)||"Sem unidade vinculada"}),(j==null?void 0:j.id)&&s.jsxs("p",{className:"text-[11px] text-gray-400 font-mono mt-0.5",children:["ID: ",j.id]})]}),s.jsx("div",{className:"ml-auto w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:S}})]})})]}),x==="admin"&&s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-gray-50",children:s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"Integrações Google"})}),s.jsxs("div",{className:"p-6 space-y-4 border-b border-gray-50",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(lv,{size:15,className:"text-gray-400"}),s.jsx("span",{className:"text-xs font-black text-gray-700 uppercase tracking-wide",children:"Credenciais OAuth 2.0"})]}),n!=null&&n.configured?s.jsxs("div",{className:"flex items-center gap-1.5 text-green-600 bg-green-50 px-3 py-1 rounded-full border border-green-100",children:[s.jsx(pa,{size:12}),s.jsx("span",{className:"text-[10px] font-black uppercase",children:n.fromEnv?"Via ENV":"Configurado"})]}):s.jsxs("div",{className:"flex items-center gap-1.5 text-amber-600 bg-amber-50 px-3 py-1 rounded-full border border-amber-100",children:[s.jsx(bu,{size:12}),s.jsx("span",{className:"text-[10px] font-black uppercase",children:"Não configurado"})]})]}),(n==null?void 0:n.configured)&&n.clientIdHint&&!n.fromEnv&&s.jsxs("div",{className:"bg-gray-50 rounded-xl px-4 py-3 border border-gray-100",children:[s.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase mb-1",children:"Client ID atual"}),s.jsx("p",{className:"text-xs font-mono text-gray-600",children:n.clientIdHint})]}),(n==null?void 0:n.fromEnv)&&s.jsx("p",{className:"text-[11px] text-gray-400 font-medium",children:"Credenciais carregadas via variável de ambiente. Para substituir, preencha os campos abaixo."}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1.5",children:"Client ID"}),s.jsx("input",{type:"text",value:i,onChange:F=>c(F.target.value),placeholder:n!=null&&n.configured?"Deixe vazio para manter atual":"xxxxxxxxxxxx.apps.googleusercontent.com",className:"w-full border border-gray-200 rounded-xl px-4 py-2.5 text-sm font-mono focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none transition-all"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-black text-gray-500 uppercase tracking-wider mb-1.5",children:"Client Secret"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:h?"text":"password",value:d,onChange:F=>f(F.target.value),placeholder:n!=null&&n.configured?"Deixe vazio para manter atual":"GOCSPX-...",className:"w-full border border-gray-200 rounded-xl px-4 py-2.5 pr-10 text-sm font-mono focus:ring-2 focus:ring-blue-100 focus:border-blue-300 outline-none transition-all"}),s.jsx("button",{type:"button",onClick:()=>p(F=>!F),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:h?s.jsx(sD,{size:15}):s.jsx(lD,{size:15})})]})]}),s.jsxs("button",{onClick:I,disabled:b||!i.trim()&&!d.trim(),className:"w-full flex items-center justify-center gap-2 py-2.5 rounded-xl text-xs font-black uppercase tracking-widest transition-all disabled:opacity-40 disabled:cursor-not-allowed bg-gray-900 text-white hover:bg-gray-700",children:[b?s.jsx(Ot,{size:14,className:"animate-spin"}):s.jsx(lv,{size:14}),b?"Salvando...":"Salvar Credenciais"]})]}),s.jsxs("p",{className:"text-[10px] text-gray-400 leading-relaxed",children:["Obtenha as credenciais em"," ",s.jsx("span",{className:"font-mono text-blue-500",children:"console.cloud.google.com"})," ","→ APIs & Services → Credentials → OAuth 2.0 Client ID. Adicione"," ",s.jsx("span",{className:"font-mono text-gray-600",children:"https://scoreodonto.com/api/oauth2callback"})," ","como URI de redirecionamento autorizado."]})]}),s.jsxs("div",{className:"p-6",children:[s.jsx("p",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest mb-3",children:"Conta conectada"}),s.jsx(hu,{ownerId:"admin",isConnected:t.some(F=>F.owner_id==="admin"||F.owner_id===N),onStatusChange:D})]})]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-gray-50",children:s.jsx("h2",{className:"text-xs font-black text-gray-500 uppercase tracking-widest",children:"Segurança"})}),s.jsxs("div",{className:"p-6 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3 text-green-600 bg-green-50 px-4 py-3 rounded-xl border border-green-100",children:[s.jsx(Ar,{size:16}),s.jsx("span",{className:"text-xs font-bold uppercase tracking-wide",children:"Sessão ativa e autenticada"})]}),s.jsxs("button",{onClick:L,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-red-50 text-red-600 hover:bg-red-100 rounded-xl text-xs font-black uppercase tracking-widest transition-all border border-red-100",children:[s.jsx(FN,{size:16}),"Sair do Sistema"]})]})]})]})},vB=["TODOS","Ativo","Rascunho","Assinado","Encerrado"],NB={Ativo:"bg-green-100 text-green-700",Rascunho:"bg-amber-100 text-amber-700",Assinado:"bg-blue-100 text-blue-700",Encerrado:"bg-gray-100 text-gray-600"},EB=t=>t.toLocaleString("pt-BR",{style:"currency",currency:"BRL"}),jB=()=>{const t=$e(),{data:e,isLoading:n,refresh:r}=Ie(K.getContratos),i=e??[],[c,d]=A.useState(""),[f,h]=A.useState("TODOS"),[p,b]=A.useState(!1),[y,x]=A.useState(null),[v,N]=A.useState(null),j=i.filter(I=>{const L=!c.trim()||I.pacienteNome.toLowerCase().includes(c.toLowerCase())||I.titulo.toLowerCase().includes(c.toLowerCase()),F=f==="TODOS"||I.status===f;return L&&F}),S={total:i.length,ativos:i.filter(I=>I.status==="Ativo").length,rascunhos:i.filter(I=>I.status==="Rascunho").length,encerrados:i.filter(I=>I.status==="Encerrado"||I.status==="Assinado").length},R=async(I,L)=>{if(confirm(`EXCLUIR o contrato de ${L}?`))try{await K.deleteContrato(I),t.success("CONTRATO EXCLUÍDO."),r()}catch{t.error("ERRO AO EXCLUIR CONTRATO.")}},w=()=>{x(null),b(!0)},D=I=>{x(I),b(!0)},C=I=>{N(I),b(!0)};return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsx(fn,{title:"CONTRATOS",description:"Gestão de contratos de serviços odontológicos",children:s.jsxs("button",{onClick:w,className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-colors uppercase font-bold text-sm shadow-sm",children:[s.jsx(gt,{size:18})," NOVO CONTRATO"]})}),s.jsx("div",{className:"grid grid-cols-4 gap-3 mb-4",children:[{label:"Total",value:S.total,color:"bg-indigo-50 text-indigo-700"},{label:"Ativos",value:S.ativos,color:"bg-green-50 text-green-700"},{label:"Rascunhos",value:S.rascunhos,color:"bg-amber-50 text-amber-700"},{label:"Encerrados/Assinados",value:S.encerrados,color:"bg-gray-50 text-gray-600"}].map(I=>s.jsxs("div",{className:`${I.color} rounded-xl p-3 text-center`,children:[s.jsx("p",{className:"text-2xl font-black",children:I.value}),s.jsx("p",{className:"text-[10px] font-bold uppercase opacity-70",children:I.label})]},I.label))}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none",size:16}),s.jsx("input",{type:"text",placeholder:"Buscar por paciente ou título...",className:"w-full pl-9 pr-3 py-2 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-indigo-100 focus:border-indigo-300 outline-none bg-white",value:c,onChange:I=>d(I.target.value)})]}),s.jsx("div",{className:"flex items-center gap-1 bg-gray-100 rounded-lg p-1 overflow-x-auto",children:vB.map(I=>s.jsx("button",{onClick:()=>h(I),className:`px-2.5 py-1 rounded-md text-[11px] font-bold transition-all whitespace-nowrap ${f===I?"bg-white text-gray-800 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:I},I))})]}),n&&s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx(Ot,{className:"animate-spin text-indigo-400",size:32})}),!n&&j.length===0&&s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-400 py-20",children:[s.jsx(Ba,{size:48,className:"mb-4 opacity-30"}),s.jsx("p",{className:"text-sm font-bold uppercase",children:"Nenhum contrato encontrado"}),s.jsx("p",{className:"text-xs mt-1",children:c||f!=="TODOS"?"Tente limpar os filtros.":'Clique em "NOVO CONTRATO" para começar.'}),!c&&f==="TODOS"&&s.jsxs("button",{onClick:w,className:"mt-4 flex items-center gap-2 px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg text-sm font-bold transition-colors",children:[s.jsx(gt,{size:16})," Criar Primeiro Contrato"]})]}),!n&&j.length>0&&s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 overflow-y-auto pb-6",children:j.map(I=>{var L;return s.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-all duration-200 flex flex-col",children:[s.jsxs("div",{className:"p-4 flex-1",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[s.jsx("h3",{className:"font-black text-gray-800 text-sm uppercase leading-tight flex-1",children:I.pacienteNome}),s.jsx("span",{className:`text-[9px] font-black px-2 py-0.5 rounded-full uppercase flex-shrink-0 ${NB[I.status]||"bg-gray-100 text-gray-600"}`,children:I.status})]}),s.jsx("p",{className:"text-[11px] text-gray-500 font-medium uppercase truncate mb-2",children:I.titulo}),s.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[I.especialidadeNome&&s.jsx("span",{className:"bg-indigo-50 text-indigo-600 text-[9px] font-bold px-2 py-0.5 rounded-full uppercase",children:I.especialidadeNome}),I.dentistaNome&&s.jsx("span",{className:"bg-gray-50 text-gray-500 text-[9px] font-bold px-2 py-0.5 rounded-full uppercase",children:I.dentistaNome})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px]",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 font-bold uppercase block",children:"Valor Total"}),s.jsx("span",{className:"font-black text-indigo-700 text-sm",children:EB(I.valorTotal)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 font-bold uppercase block",children:"Itens"}),s.jsxs("span",{className:"font-bold text-gray-700",children:[((L=I.items)==null?void 0:L.length)??0," proc."]})]}),I.dataInicio&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 font-bold uppercase block",children:"Início"}),s.jsx("span",{className:"font-bold text-gray-700",children:new Date(I.dataInicio+"T12:00").toLocaleDateString("pt-BR")})]}),I.dataFim&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-400 font-bold uppercase block",children:"Fim"}),s.jsx("span",{className:"font-bold text-gray-700",children:new Date(I.dataFim+"T12:00").toLocaleDateString("pt-BR")})]})]})]}),s.jsxs("div",{className:"flex border-t border-gray-100",children:[s.jsxs("button",{onClick:()=>D(I),className:"flex-1 flex items-center justify-center gap-1.5 py-2 text-indigo-600 hover:bg-indigo-50 rounded-bl-xl text-[10px] font-bold transition-colors uppercase",children:[s.jsx(zo,{size:12})," Editar"]}),s.jsx("div",{className:"border-l border-gray-100"}),s.jsxs("button",{onClick:()=>C(I),className:"flex-1 flex items-center justify-center gap-1.5 py-2 text-gray-600 hover:bg-gray-50 text-[10px] font-bold transition-colors uppercase",children:[s.jsx(Ya,{size:12})," Imprimir"]}),s.jsx("div",{className:"border-l border-gray-100"}),s.jsxs("button",{onClick:()=>R(I.id,I.pacienteNome),className:"flex-1 flex items-center justify-center gap-1.5 py-2 text-red-500 hover:bg-red-50 rounded-br-xl text-[10px] font-bold transition-colors uppercase",children:[s.jsx(Qt,{size:12})," Excluir"]})]})]},I.id)})}),p&&s.jsx(oj,{contrato:y,onClose:()=>{b(!1),x(null),N(null)},onSaved:r})]})},SB={"/":"landing","/dashboard":"dashboard","/landing":"landing","/leads":"leads","/contato":"public","/pacientes":"pacientes","/agenda":"agenda","/ortodontia":"ortodontia","/financeiro":"financeiro","/login":"login","/update":"update","/clinicas":"clinicas","/admin/dentistas":"dentistas","/admin/especialidades":"especialidades","/admin/procedimentos":"procedimentos","/admin/planos":"planos","/admin/sync":"sync","/tratamentos":"tratamentos","/lancar-gto":"lancar-gto","/notificacoes":"notificacoes","/relatorios":"relatorios","/cadastro-dentista":"cadastro-dentista","/configuracoes":"configuracoes","/contratos":"contratos"},AB={landing:"/",dashboard:"/dashboard",leads:"/leads",public:"/contato",pacientes:"/pacientes",agenda:"/agenda",ortodontia:"/ortodontia",financeiro:"/financeiro",login:"/login",update:"/update",clinicas:"/clinicas",dentistas:"/admin/dentistas",especialidades:"/admin/especialidades",procedimentos:"/admin/procedimentos",planos:"/admin/planos",tratamentos:"/tratamentos","lancar-gto":"/lancar-gto",notificacoes:"/notificacoes",relatorios:"/relatorios",sync:"/admin/sync","cadastro-dentista":"/cadastro-dentista",configuracoes:"/configuracoes",contratos:"/contratos"};function NN(){const t=window.location.pathname||"/";return SB[t]??"dashboard"}function lo(t){const e=AB[t];history.pushState({},"",e)}const wB=()=>{const[t,e]=A.useState(!1);K.getCurrentRole();const n=K.getActiveWorkspace(),r=(n==null?void 0:n.cor)||"#2563eb",i=(x,v)=>{var j;return["landing","login","public","update"].includes(x)||v==="admin"||v==="donoclinica"?!0:((j={paciente:["tratamentos","notificacoes","configuracoes"],dentista:["dashboard","pacientes","agenda","ortodontia","tratamentos","lancar-gto","notificacoes","clinicas","configuracoes","contratos"],funcionario:["dashboard","leads","pacientes","agenda","financeiro","tratamentos","lancar-gto","relatorios","notificacoes","clinicas","configuracoes","contratos"]}[v])==null?void 0:j.includes(x))||!1},c=x=>x==="paciente"?"tratamentos":"dashboard",d=()=>{const x=NN(),v=K.getCurrentRole();return K.isAuthenticated()&&["landing","login"].includes(x)?c(v):!["landing","login","public"].includes(x)&&!K.isAuthenticated()?"landing":K.isAuthenticated()&&!i(x,v)?c(v):x},[f,h]=A.useState(d),p=x=>{const v=K.getCurrentRole();i(x,v)&&(h(x),lo(x),e(!1))};A.useEffect(()=>{const x=()=>{const v=NN(),N=K.getCurrentRole();if(!["landing","login","public"].includes(v)&&!K.isAuthenticated()){h("landing"),lo("landing");return}if(K.isAuthenticated()&&!i(v,N)){const S=c(N);h(S),lo(S);return}h(v)};return window.addEventListener("popstate",x),()=>window.removeEventListener("popstate",x)},[]),A.useEffect(()=>{document.documentElement.style.setProperty("--brand-color",r),document.documentElement.style.setProperty("--brand-color-soft",`${r}11`)},[r]),A.useEffect(()=>{lo(f)},[]);const b=()=>{switch(f){case"landing":return s.jsx(rB,{onGetStarted:()=>p("login")});case"dashboard":return s.jsx(FO,{});case"leads":return s.jsx(YO,{});case"public":return s.jsx(QO,{});case"pacientes":return s.jsx(GM,{});case"agenda":return s.jsx(RP,{onNavigate:p});case"ortodontia":return s.jsx(qP,{});case"financeiro":return s.jsx(QP,{});case"dentistas":return s.jsx(dB,{});case"especialidades":return s.jsx(uB,{});case"procedimentos":return s.jsx(fB,{});case"planos":return s.jsx(hB,{});case"sync":return s.jsx(gB,{});case"tratamentos":return s.jsx(aB,{});case"lancar-gto":return s.jsx(EM,{});case"update":return s.jsx(lB,{});case"clinicas":return s.jsx(iB,{});case"notificacoes":return s.jsx(mB,{});case"relatorios":return s.jsx(bB,{});case"cadastro-dentista":return s.jsx(oB,{});case"configuracoes":return s.jsx(yB,{});case"contratos":return s.jsx(jB,{});case"login":default:return s.jsx(sB,{onLoginSuccess:()=>{const x=K.getCurrentRole(),v=c(x);h(v),lo(v)}})}},y=["landing","login","public","update","cadastro-dentista"].includes(f);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex h-screen bg-gray-50 text-gray-800 overflow-hidden relative",children:[s.jsx("style",{children:` + :root { --brand-color: ${r}; } + .bg-brand { background-color: var(--brand-color); } + .text-brand { color: var(--brand-color); } + .border-brand { border-color: var(--brand-color); } + .hover\\:bg-brand:hover { background-color: var(--brand-color); } + .focus\\:ring-brand:focus { --tw-ring-color: var(--brand-color); } + `}),!y&&s.jsxs(s.Fragment,{children:[t&&s.jsx("div",{className:"fixed inset-0 bg-black/50 z-20 md:hidden backdrop-blur-sm transition-opacity",onClick:()=>e(!1)}),s.jsx("div",{className:`fixed inset-y-0 left-0 z-30 transform transition-transform duration-300 md:relative md:translate-x-0 ${t?"translate-x-0":"-translate-x-full"}`,children:s.jsx(LO,{activeTab:f,setActiveTab:x=>p(x)})})]}),s.jsxs("main",{className:"flex-1 h-full relative flex flex-col min-w-0",children:[!y&&s.jsx(s.Fragment,{children:s.jsxs("div",{className:"md:hidden flex items-center justify-between px-4 py-3 bg-white border-b border-gray-200",children:[s.jsx("button",{onClick:()=>e(!0),className:"p-2 text-gray-600 hover:bg-gray-100 rounded-lg transition-colors",children:s.jsx($N,{size:24})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 rounded flex items-center justify-center text-white font-bold text-sm shadow-sm",style:{backgroundColor:r},children:"S"}),s.jsx("span",{className:"font-bold text-gray-800 text-sm tracking-tight uppercase",children:"SCOREODONTO"})]}),s.jsx("div",{className:"w-8"})]})}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4 md:p-8 pb-20 scroll-smooth",children:s.jsx("div",{className:"max-w-7xl mx-auto h-full",children:b()})})]})]}),s.jsx(HO,{})]})};class CB extends qe.Component{constructor(e){super(e),this.handleReload=()=>{window.location.reload()},this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e,errorInfo:null}}componentDidCatch(e,n){console.error("Uncaught error:",e,n),this.setState({errorInfo:n})}render(){var e;return this.state.hasError?s.jsx("div",{className:"min-h-screen bg-red-50 flex items-center justify-center p-6 font-sans",children:s.jsxs("div",{className:"max-w-3xl w-full bg-white rounded-2xl shadow-2xl overflow-hidden border border-red-100",children:[s.jsxs("div",{className:"bg-red-600 p-6 flex items-center gap-4",children:[s.jsx("div",{className:"bg-white/20 p-3 rounded-full text-white",children:s.jsx(GC,{size:32})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white uppercase",children:"ERRO CRÍTICO NO SISTEMA"}),s.jsx("p",{className:"text-red-100 text-xs font-bold uppercase mt-1",children:"O APLICATIVO ENCONTROU UM PROBLEMA INESPERADO"})]})]}),s.jsxs("div",{className:"p-8",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("p",{className:"text-gray-700 font-bold uppercase mb-2",children:"O QUE ACONTECEU?"}),s.jsx("p",{className:"text-gray-600 text-sm",children:"Ocorreu uma falha durante a renderização da interface. Tente recarregar a página. Se o problema persistir, envie o log abaixo para o suporte técnico."})]}),this.state.error&&s.jsxs("div",{className:"bg-gray-900 rounded-lg p-4 mb-6 overflow-x-auto border-l-4 border-red-500",children:[s.jsxs("div",{className:"flex items-center gap-2 text-red-400 font-bold text-xs uppercase mb-2",children:[s.jsx(Ig,{size:14})," Stack Trace / Log Técnico"]}),s.jsxs("pre",{className:"text-green-400 font-mono text-xs leading-relaxed whitespace-pre-wrap break-words",children:[this.state.error.toString(),s.jsx("br",{}),(e=this.state.errorInfo)==null?void 0:e.componentStack]})]}),s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("button",{onClick:this.handleReload,className:"bg-red-600 hover:bg-red-700 text-white px-6 py-3 rounded-lg font-bold uppercase flex items-center gap-2 transition-colors shadow-lg",children:[s.jsx(vu,{size:18})," RECARREGAR SISTEMA"]}),s.jsx("button",{onClick:()=>{localStorage.clear(),window.location.reload()},className:"bg-gray-200 hover:bg-gray-300 text-gray-700 px-6 py-3 rounded-lg font-bold uppercase flex items-center gap-2 transition-colors",children:"LIMPAR CACHE E REINICIAR"})]})]})]})}):this.props.children}}const DB=new vU,EN=document.getElementById("root");if(EN)nC.createRoot(EN).render(s.jsx(qe.StrictMode,{children:s.jsx(EU,{client:DB,children:s.jsx(CB,{children:s.jsx(PO,{children:s.jsx(wB,{})})})})}));else{console.error("CRITICAL: Root element #root not found. App could not be mounted.");const t=document.getElementById("global-error-display");t&&(t.style.display="block",t.innerText="ERRO CRÍTICO: O ELEMENTO #ROOT NÃO FOI ENCONTRADO NO HTML.")} diff --git a/frontend/dist/assets/index-VV5qCksm.css b/frontend/dist/assets/index-VV5qCksm.css deleted file mode 100644 index ef70179..0000000 --- a/frontend/dist/assets/index-VV5qCksm.css +++ /dev/null @@ -1 +0,0 @@ -/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-800:oklch(47% .157 37.304);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-teal-50:oklch(98.4% .014 180.72);--color-teal-100:oklch(95.3% .051 180.801);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-teal-600:oklch(60% .118 184.704);--color-teal-700:oklch(51.1% .096 186.391);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-violet-50:oklch(96.9% .016 293.756);--color-violet-100:oklch(94.3% .029 294.588);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:oklch(60.6% .25 292.717);--color-violet-600:oklch(54.1% .281 293.009);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-purple-800:oklch(43.8% .218 303.724);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-600:oklch(58.6% .253 17.585);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-gray-950:oklch(13% .028 261.692);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--animate-bounce:bounce 1s infinite;--blur-sm:8px;--blur-md:12px;--blur-lg:16px;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}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;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.-top-1\.5{top:calc(var(--spacing) * -1.5)}.-top-10{top:calc(var(--spacing) * -10)}.top-0{top:calc(var(--spacing) * 0)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-4{top:calc(var(--spacing) * 4)}.top-6{top:calc(var(--spacing) * 6)}.top-40{top:calc(var(--spacing) * 40)}.top-full{top:100%}.-right-1\.5{right:calc(var(--spacing) * -1.5)}.-right-10{right:calc(var(--spacing) * -10)}.right-0{right:calc(var(--spacing) * 0)}.right-2{right:calc(var(--spacing) * 2)}.right-2\.5{right:calc(var(--spacing) * 2.5)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.right-6{right:calc(var(--spacing) * 6)}.-bottom-10{bottom:calc(var(--spacing) * -10)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-4{bottom:calc(var(--spacing) * 4)}.-left-10{left:calc(var(--spacing) * -10)}.left-0{left:calc(var(--spacing) * 0)}.left-1\/2{left:50%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-4{left:calc(var(--spacing) * 4)}.left-10{left:calc(var(--spacing) * 10)}.-z-10{z-index:-10}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[60\]{z-index:60}.z-\[70\]{z-index:70}.z-\[100\]{z-index:100}.z-\[1002\]{z-index:1002}.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-6{grid-column:span 6/span 6}.col-span-12{grid-column:span 12/span 12}.col-span-full{grid-column:1/-1}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-auto{margin-inline:auto}.-mt-8{margin-top:calc(var(--spacing) * -8)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mt-10{margin-top:calc(var(--spacing) * 10)}.mt-12{margin-top:calc(var(--spacing) * 12)}.mt-20{margin-top:calc(var(--spacing) * 20)}.mt-auto{margin-top:auto}.-mr-8{margin-right:calc(var(--spacing) * -8)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.mb-20{margin-bottom:calc(var(--spacing) * 20)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-32{height:calc(var(--spacing) * 32)}.h-64{height:calc(var(--spacing) * 64)}.h-72{height:calc(var(--spacing) * 72)}.h-80{height:calc(var(--spacing) * 80)}.h-96{height:calc(var(--spacing) * 96)}.h-\[2px\]{height:2px}.h-\[200px\]{height:200px}.h-\[400px\]{height:400px}.h-auto{height:auto}.h-dvh{height:100dvh}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-52{max-height:calc(var(--spacing) * 52)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\[450px\]{max-height:450px}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\[160px\]{min-height:160px}.min-h-\[400px\]{min-height:400px}.min-h-\[600px\]{min-height:600px}.min-h-screen{min-height:100vh}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-1\/2{width:50%}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-44{width:calc(var(--spacing) * 44)}.w-48{width:calc(var(--spacing) * 48)}.w-64{width:calc(var(--spacing) * 64)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-96{width:calc(var(--spacing) * 96)}.w-\[2px\]{width:2px}.w-\[30\%\]{width:30%}.w-\[70\%\]{width:70%}.w-\[380px\]{width:380px}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[120px\]{max-width:120px}.max-w-\[200px\]{max-width:200px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[160px\]{min-width:160px}.min-w-\[200px\]{min-width:200px}.min-w-\[300px\]{min-width:300px}.flex-1{flex:1}.flex-\[2\]{flex:2}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.border-collapse{border-collapse:collapse}.origin-bottom{transform-origin:bottom}.origin-top-right{transform-origin:100% 0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing) * 4);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-20{--tw-translate-x:calc(var(--spacing) * 20);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-1\/2{--tw-translate-y: 50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.rotate-180{rotate:180deg}.skew-x-12{--tw-skew-x:skewX(12deg);transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.transform-gpu{transform:translateZ(0) var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-bounce{animation:var(--animate-bounce)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.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))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-start{align-content:flex-start}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing) * 0)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-10{gap:calc(var(--spacing) * 10)}.gap-12{gap:calc(var(--spacing) * 12)}.gap-16{gap:calc(var(--spacing) * 16)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-10>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 10) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 10) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-12{column-gap:calc(var(--spacing) * 12)}:where(.-space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * -3) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * -3) * calc(1 - var(--tw-space-x-reverse)))}.gap-y-16{row-gap:calc(var(--spacing) * 16)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-50>:not(:last-child)){border-color:var(--color-gray-50)}:where(.divide-gray-100>:not(:last-child)){border-color:var(--color-gray-100)}:where(.divide-slate-50>:not(:last-child)){border-color:var(--color-slate-50)}:where(.divide-slate-100>:not(:last-child)){border-color:var(--color-slate-100)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.scroll-smooth{scroll-behavior:smooth}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\[1\.5rem\]{border-radius:1.5rem}.rounded-\[2\.2rem\]{border-radius:2.2rem}.rounded-\[2\.5rem\]{border-radius:2.5rem}.rounded-\[2rem\]{border-radius:2rem}.rounded-\[3rem\]{border-radius:3rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-r-full{border-top-right-radius:3.40282e38px;border-bottom-right-radius:3.40282e38px}.rounded-br-xl{border-bottom-right-radius:var(--radius-xl)}.rounded-bl-xl{border-bottom-left-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-8{border-style:var(--tw-border-style);border-width:8px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-none{--tw-border-style:none;border-style:none}.border-amber-100{border-color:var(--color-amber-100)}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-600{border-color:var(--color-amber-600)}.border-amber-700{border-color:var(--color-amber-700)}.border-amber-800{border-color:var(--color-amber-800)}.border-blue-50{border-color:var(--color-blue-50)}.border-blue-100{border-color:var(--color-blue-100)}.border-blue-100\/50{border-color:#dbeafe80}@supports (color:color-mix(in lab,red,red)){.border-blue-100\/50{border-color:color-mix(in oklab,var(--color-blue-100) 50%,transparent)}}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-300{border-color:var(--color-blue-300)}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-600{border-color:var(--color-blue-600)}.border-blue-700{border-color:var(--color-blue-700)}.border-emerald-100{border-color:var(--color-emerald-100)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-50{border-color:var(--color-gray-50)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-200\/50{border-color:#e5e7eb80}@supports (color:color-mix(in lab,red,red)){.border-gray-200\/50{border-color:color-mix(in oklab,var(--color-gray-200) 50%,transparent)}}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-400{border-color:var(--color-gray-400)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-800{border-color:var(--color-gray-800)}.border-green-50{border-color:var(--color-green-50)}.border-green-100{border-color:var(--color-green-100)}.border-green-200{border-color:var(--color-green-200)}.border-green-300{border-color:var(--color-green-300)}.border-green-400{border-color:var(--color-green-400)}.border-green-600{border-color:var(--color-green-600)}.border-indigo-100{border-color:var(--color-indigo-100)}.border-indigo-300{border-color:var(--color-indigo-300)}.border-orange-100{border-color:var(--color-orange-100)}.border-purple-200{border-color:var(--color-purple-200)}.border-purple-600{border-color:var(--color-purple-600)}.border-purple-800{border-color:var(--color-purple-800)}.border-red-100{border-color:var(--color-red-100)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-red-500{border-color:var(--color-red-500)}.border-slate-50{border-color:var(--color-slate-50)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-transparent{border-color:#0000}.border-white{border-color:var(--color-white)}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.border-white\/50{border-color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.border-white\/50{border-color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.border-yellow-200{border-color:var(--color-yellow-200)}.border-t-blue-600{border-top-color:var(--color-blue-600)}.border-t-transparent{border-top-color:#0000}.bg-\[\#2d6a4f\]{background-color:#2d6a4f}.bg-\[\#F8FAFC\]{background-color:#f8fafc}.bg-\[\#d49a4a\]{background-color:#d49a4a}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-50\/30{background-color:#fffbeb4d}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/30{background-color:color-mix(in oklab,var(--color-amber-50) 30%,transparent)}}.bg-amber-100{background-color:var(--color-amber-100)}.bg-amber-100\/50{background-color:#fef3c680}@supports (color:color-mix(in lab,red,red)){.bg-amber-100\/50{background-color:color-mix(in oklab,var(--color-amber-100) 50%,transparent)}}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-600{background-color:var(--color-amber-600)}.bg-amber-800{background-color:var(--color-amber-800)}.bg-black{background-color:var(--color-black)}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-50\/20{background-color:#eff6ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/20{background-color:color-mix(in oklab,var(--color-blue-50) 20%,transparent)}}.bg-blue-50\/40{background-color:#eff6ff66}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/40{background-color:color-mix(in oklab,var(--color-blue-50) 40%,transparent)}}.bg-blue-50\/50{background-color:#eff6ff80}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/50{background-color:color-mix(in oklab,var(--color-blue-50) 50%,transparent)}}.bg-blue-50\/70{background-color:#eff6ffb3}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/70{background-color:color-mix(in oklab,var(--color-blue-50) 70%,transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-100\/50{background-color:#dbeafe80}@supports (color:color-mix(in lab,red,red)){.bg-blue-100\/50{background-color:color-mix(in oklab,var(--color-blue-100) 50%,transparent)}}.bg-blue-400\/10{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-400\/10{background-color:color-mix(in oklab,var(--color-blue-400) 10%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-blue-600\/10{background-color:#155dfc1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-600\/10{background-color:color-mix(in oklab,var(--color-blue-600) 10%,transparent)}}.bg-blue-600\/20{background-color:#155dfc33}@supports (color:color-mix(in lab,red,red)){.bg-blue-600\/20{background-color:color-mix(in oklab,var(--color-blue-600) 20%,transparent)}}.bg-current{background-color:currentColor}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-emerald-100\/50{background-color:#d0fae580}@supports (color:color-mix(in lab,red,red)){.bg-emerald-100\/50{background-color:color-mix(in oklab,var(--color-emerald-100) 50%,transparent)}}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-50\/30{background-color:#f9fafb4d}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/30{background-color:color-mix(in oklab,var(--color-gray-50) 30%,transparent)}}.bg-gray-50\/50{background-color:#f9fafb80}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/50{background-color:color-mix(in oklab,var(--color-gray-50) 50%,transparent)}}.bg-gray-50\/70{background-color:#f9fafbb3}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/70{background-color:color-mix(in oklab,var(--color-gray-50) 70%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-gray-950{background-color:var(--color-gray-950)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-300{background-color:var(--color-green-300)}.bg-green-400{background-color:var(--color-green-400)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-600{background-color:var(--color-green-600)}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-50\/50{background-color:#eef2ff80}@supports (color:color-mix(in lab,red,red)){.bg-indigo-50\/50{background-color:color-mix(in oklab,var(--color-indigo-50) 50%,transparent)}}.bg-indigo-50\/60{background-color:#eef2ff99}@supports (color:color-mix(in lab,red,red)){.bg-indigo-50\/60{background-color:color-mix(in oklab,var(--color-indigo-50) 60%,transparent)}}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-200{background-color:var(--color-indigo-200)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-orange-50{background-color:var(--color-orange-50)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-orange-400{background-color:var(--color-orange-400)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-purple-50{background-color:var(--color-purple-50)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-purple-500{background-color:var(--color-purple-500)}.bg-purple-600{background-color:var(--color-purple-600)}.bg-purple-800{background-color:var(--color-purple-800)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-100\/50{background-color:#ffe2e280}@supports (color:color-mix(in lab,red,red)){.bg-red-100\/50{background-color:color-mix(in oklab,var(--color-red-100) 50%,transparent)}}.bg-red-400{background-color:var(--color-red-400)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-600{background-color:var(--color-red-600)}.bg-rose-100{background-color:var(--color-rose-100)}.bg-rose-200{background-color:var(--color-rose-200)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-50\/30{background-color:#f8fafc4d}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/30{background-color:color-mix(in oklab,var(--color-slate-50) 30%,transparent)}}.bg-slate-50\/50{background-color:#f8fafc80}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/50{background-color:color-mix(in oklab,var(--color-slate-50) 50%,transparent)}}.bg-slate-100{background-color:var(--color-slate-100)}.bg-teal-100{background-color:var(--color-teal-100)}.bg-teal-600{background-color:var(--color-teal-600)}.bg-transparent{background-color:#0000}.bg-violet-100{background-color:var(--color-violet-100)}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.bg-white\/50{background-color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.bg-white\/50{background-color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.bg-white\/70{background-color:color-mix(in oklab,var(--color-white) 70%,transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.bg-white\/95{background-color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.bg-white\/95{background-color:color-mix(in oklab,var(--color-white) 95%,transparent)}}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-yellow-400{background-color:var(--color-yellow-400)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-l{--tw-gradient-position:to left in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-tr{--tw-gradient-position:to top right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-black\/40{--tw-gradient-from:#0006}@supports (color:color-mix(in lab,red,red)){.from-black\/40{--tw-gradient-from:color-mix(in oklab, var(--color-black) 40%, transparent)}}.from-black\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-50\/50{--tw-gradient-from:#eff6ff80}@supports (color:color-mix(in lab,red,red)){.from-blue-50\/50{--tw-gradient-from:color-mix(in oklab, var(--color-blue-50) 50%, transparent)}}.from-blue-50\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-600{--tw-gradient-from:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-50{--tw-gradient-from:var(--color-emerald-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-gray-50{--tw-gradient-from:var(--color-gray-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-green-50{--tw-gradient-from:var(--color-green-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-50{--tw-gradient-from:var(--color-orange-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-slate-50{--tw-gradient-from:var(--color-slate-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-600{--tw-gradient-to:var(--color-indigo-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-700{--tw-gradient-to:var(--color-indigo-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-white{--tw-gradient-to:var(--color-white);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-10{padding:calc(var(--spacing) * 10)}.p-12{padding:calc(var(--spacing) * 12)}.p-16{padding:calc(var(--spacing) * 16)}.p-20{padding:calc(var(--spacing) * 20)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.px-10{padding-inline:calc(var(--spacing) * 10)}.px-12{padding-inline:calc(var(--spacing) * 12)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-16{padding-block:calc(var(--spacing) * 16)}.py-20{padding-block:calc(var(--spacing) * 20)}.py-32{padding-block:calc(var(--spacing) * 32)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-10{padding-top:calc(var(--spacing) * 10)}.pt-32{padding-top:calc(var(--spacing) * 32)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-0{padding-bottom:calc(var(--spacing) * 0)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-10{padding-bottom:calc(var(--spacing) * 10)}.pb-20{padding-bottom:calc(var(--spacing) * 20)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.pl-10{padding-left:calc(var(--spacing) * 10)}.pl-12{padding-left:calc(var(--spacing) * 12)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-\[1\.05\]{--tw-leading:1.05;line-height:1.05}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-\[0\.3em\]{--tw-tracking:.3em;letter-spacing:.3em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-tighter{--tw-tracking:var(--tracking-tighter);letter-spacing:var(--tracking-tighter)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#2d6a4f\]{color:#2d6a4f}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-900{color:var(--color-amber-900)}.text-black{color:var(--color-black)}.text-blue-100{color:var(--color-blue-100)}.text-blue-300{color:var(--color-blue-300)}.text-blue-400{color:var(--color-blue-400)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-indigo-400{color:var(--color-indigo-400)}.text-indigo-500{color:var(--color-indigo-500)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-orange-500{color:var(--color-orange-500)}.text-orange-600{color:var(--color-orange-600)}.text-orange-800{color:var(--color-orange-800)}.text-pink-500{color:var(--color-pink-500)}.text-purple-500{color:var(--color-purple-500)}.text-purple-600{color:var(--color-purple-600)}.text-purple-700{color:var(--color-purple-700)}.text-purple-800{color:var(--color-purple-800)}.text-red-100{color:var(--color-red-100)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-rose-600{color:var(--color-rose-600)}.text-sky-500{color:var(--color-sky-500)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-teal-500{color:var(--color-teal-500)}.text-teal-600{color:var(--color-teal-600)}.text-transparent{color:#0000}.text-violet-500{color:var(--color-violet-500)}.text-violet-600{color:var(--color-violet-600)}.text-white{color:var(--color-white)}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white) 70%,transparent)}}.text-yellow-600{color:var(--color-yellow-600)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.underline{text-decoration-line:underline}.decoration-blue-200{-webkit-text-decoration-color:var(--color-blue-200);text-decoration-color:var(--color-blue-200)}.underline-offset-8{text-underline-offset:8px}.placeholder-gray-400::placeholder{color:var(--color-gray-400)}.placeholder-gray-500::placeholder{color:var(--color-gray-500)}.opacity-0{opacity:0}.opacity-10{opacity:.1}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.opacity-\[0\.03\]{opacity:.03}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_10px_rgba\(37\,99\,235\,0\.5\)\]{--tw-shadow:0 0 10px var(--tw-shadow-color,#2563eb80);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_8px_30px_rgb\(0\,0\,0\,0\.04\)\]{--tw-shadow:0 8px 30px var(--tw-shadow-color,#0000000a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_8px_32px_rgba\(0\,0\,0\,0\.06\)\]{--tw-shadow:0 8px 32px var(--tw-shadow-color,#0000000f);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_10px_40px_-15px_rgba\(0\,0\,0\,0\.05\)\]{--tw-shadow:0 10px 40px -15px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_20px_50px_-15px_rgba\(0\,0\,0\,0\.1\)\]{--tw-shadow:0 20px 50px -15px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_20px_50px_-15px_rgba\(0\,0\,0\,0\.03\)\]{--tw-shadow:0 20px 50px -15px var(--tw-shadow-color,#00000008);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_20px_50px_rgba\(0\,0\,0\,0\.15\)\]{--tw-shadow:0 20px 50px var(--tw-shadow-color,#00000026);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_50px_100px_-20px_rgba\(0\,0\,0\,0\.2\)\]{--tw-shadow:0 50px 100px -20px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_50px_100px_-20px_rgba\(0\,0\,0\,0\.08\)\]{--tw-shadow:0 50px 100px -20px var(--tw-shadow-color,#00000014);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[2px_0_10px_rgba\(37\,99\,235\,0\.3\)\]{--tw-shadow:2px 0 10px var(--tw-shadow-color,#2563eb4d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-100{--tw-shadow-color:oklch(96.2% .059 95.617)}@supports (color:color-mix(in lab,red,red)){.shadow-amber-100{--tw-shadow-color:color-mix(in oklab, var(--color-amber-100) var(--tw-shadow-alpha), transparent)}}.shadow-blue-100{--tw-shadow-color:oklch(93.2% .032 255.585)}@supports (color:color-mix(in lab,red,red)){.shadow-blue-100{--tw-shadow-color:color-mix(in oklab, var(--color-blue-100) var(--tw-shadow-alpha), transparent)}}.shadow-blue-200{--tw-shadow-color:oklch(88.2% .059 254.128)}@supports (color:color-mix(in lab,red,red)){.shadow-blue-200{--tw-shadow-color:color-mix(in oklab, var(--color-blue-200) var(--tw-shadow-alpha), transparent)}}.shadow-blue-300{--tw-shadow-color:oklch(80.9% .105 251.813)}@supports (color:color-mix(in lab,red,red)){.shadow-blue-300{--tw-shadow-color:color-mix(in oklab, var(--color-blue-300) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-100{--tw-shadow-color:oklch(95% .052 163.051)}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-100{--tw-shadow-color:color-mix(in oklab, var(--color-emerald-100) var(--tw-shadow-alpha), transparent)}}.shadow-green-100{--tw-shadow-color:oklch(96.2% .044 156.743)}@supports (color:color-mix(in lab,red,red)){.shadow-green-100{--tw-shadow-color:color-mix(in oklab, var(--color-green-100) var(--tw-shadow-alpha), transparent)}}.shadow-green-200{--tw-shadow-color:oklch(92.5% .084 155.995)}@supports (color:color-mix(in lab,red,red)){.shadow-green-200{--tw-shadow-color:color-mix(in oklab, var(--color-green-200) var(--tw-shadow-alpha), transparent)}}.ring-blue-100{--tw-ring-color:var(--color-blue-100)}.ring-blue-200{--tw-ring-color:var(--color-blue-200)}.ring-blue-500{--tw-ring-color:var(--color-blue-500)}.ring-gray-300{--tw-ring-color:var(--color-gray-300)}.ring-green-100{--tw-ring-color:var(--color-green-100)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-offset-4{outline-offset:4px}.outline-gray-100{outline-color:var(--color-gray-100)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));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,)}.blur-\[80px\]{--tw-blur:blur(80px);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,)}.backdrop-blur-lg{--tw-backdrop-blur:blur(var(--blur-lg));-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-md{--tw-backdrop-blur:blur(var(--blur-md));-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(var(--blur-sm));-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(var(--blur-xl));-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-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-700{--tw-duration:.7s;transition-duration:.7s}.duration-1000{--tw-duration:1s;transition-duration:1s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.group-focus-within\:text-blue-500:is(:where(.group):focus-within *){color:var(--color-blue-500)}@media(hover:hover){.group-hover\:translate-x-0:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:translate-x-1:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:scale-105:is(:where(.group):hover *){--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.group-hover\:scale-110:is(:where(.group):hover *){--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.group-hover\:bg-blue-600:is(:where(.group):hover *){background-color:var(--color-blue-600)}.group-hover\:bg-indigo-600:is(:where(.group):hover *){background-color:var(--color-indigo-600)}.group-hover\:bg-rose-300:is(:where(.group):hover *){background-color:var(--color-rose-300)}.group-hover\:text-blue-500:is(:where(.group):hover *){color:var(--color-blue-500)}.group-hover\:text-blue-600:is(:where(.group):hover *){color:var(--color-blue-600)}.group-hover\:text-gray-600:is(:where(.group):hover *){color:var(--color-gray-600)}.group-hover\:text-white:is(:where(.group):hover *){color:var(--color-white)}.group-hover\:underline:is(:where(.group):hover *){text-decoration-line:underline}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.group-hover\:shadow-blue-200:is(:where(.group):hover *){--tw-shadow-color:oklch(88.2% .059 254.128)}@supports (color:color-mix(in lab,red,red)){.group-hover\:shadow-blue-200:is(:where(.group):hover *){--tw-shadow-color:color-mix(in oklab, var(--color-blue-200) var(--tw-shadow-alpha), transparent)}}.group-hover\/btn\:translate-x-1:is(:where(.group\/btn):hover *){--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}}.selection\:bg-blue-100 ::selection{background-color:var(--color-blue-100)}.selection\:bg-blue-100::selection{background-color:var(--color-blue-100)}.selection\:text-blue-900 ::selection{color:var(--color-blue-900)}.selection\:text-blue-900::selection{color:var(--color-blue-900)}.placeholder\:text-slate-300::placeholder{color:var(--color-slate-300)}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:top-2:before{content:var(--tw-content);top:calc(var(--spacing) * 2)}.before\:bottom-2:before{content:var(--tw-content);bottom:calc(var(--spacing) * 2)}.before\:left-\[7px\]:before{content:var(--tw-content);left:7px}.before\:w-0\.5:before{content:var(--tw-content);width:calc(var(--spacing) * .5)}.before\:bg-gray-200:before{content:var(--tw-content);background-color:var(--color-gray-200)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:pb-0:last-child{padding-bottom:calc(var(--spacing) * 0)}@media(hover:hover){.hover\:-translate-y-1:hover{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:border-amber-400:hover{border-color:var(--color-amber-400)}.hover\:border-blue-100:hover{border-color:var(--color-blue-100)}.hover\:border-blue-200:hover{border-color:var(--color-blue-200)}.hover\:border-blue-400:hover{border-color:var(--color-blue-400)}.hover\:border-blue-400\/50:hover{border-color:#54a2ff80}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-400\/50:hover{border-color:color-mix(in oklab,var(--color-blue-400) 50%,transparent)}}.hover\:border-blue-500:hover{border-color:var(--color-blue-500)}.hover\:border-emerald-200:hover{border-color:var(--color-emerald-200)}.hover\:border-gray-100:hover{border-color:var(--color-gray-100)}.hover\:border-gray-200:hover{border-color:var(--color-gray-200)}.hover\:border-gray-300:hover{border-color:var(--color-gray-300)}.hover\:border-gray-400:hover{border-color:var(--color-gray-400)}.hover\:border-green-400:hover{border-color:var(--color-green-400)}.hover\:border-indigo-400:hover{border-color:var(--color-indigo-400)}.hover\:border-orange-400:hover{border-color:var(--color-orange-400)}.hover\:border-purple-400:hover{border-color:var(--color-purple-400)}.hover\:border-red-100:hover{border-color:var(--color-red-100)}.hover\:border-red-200:hover{border-color:var(--color-red-200)}.hover\:border-red-400:hover{border-color:var(--color-red-400)}.hover\:border-sky-400:hover{border-color:var(--color-sky-400)}.hover\:border-teal-400:hover{border-color:var(--color-teal-400)}.hover\:border-violet-400:hover{border-color:var(--color-violet-400)}.hover\:border-yellow-400:hover{border-color:var(--color-yellow-400)}.hover\:bg-\[\#1b4332\]:hover{background-color:#1b4332}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-amber-700:hover{background-color:var(--color-amber-700)}.hover\:bg-black:hover{background-color:var(--color-black)}.hover\:bg-blue-50:hover{background-color:var(--color-blue-50)}.hover\:bg-blue-50\/30:hover{background-color:#eff6ff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-50\/30:hover{background-color:color-mix(in oklab,var(--color-blue-50) 30%,transparent)}}.hover\:bg-blue-50\/50:hover{background-color:#eff6ff80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-50\/50:hover{background-color:color-mix(in oklab,var(--color-blue-50) 50%,transparent)}}.hover\:bg-blue-200:hover{background-color:var(--color-blue-200)}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-emerald-700:hover{background-color:var(--color-emerald-700)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-50\/50:hover{background-color:#f9fafb80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-50\/50:hover{background-color:color-mix(in oklab,var(--color-gray-50) 50%,transparent)}}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-green-50:hover{background-color:var(--color-green-50)}.hover\:bg-green-50\/50:hover{background-color:#f0fdf480}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-50\/50:hover{background-color:color-mix(in oklab,var(--color-green-50) 50%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-indigo-50:hover{background-color:var(--color-indigo-50)}.hover\:bg-indigo-50\/50:hover{background-color:#eef2ff80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-50\/50:hover{background-color:color-mix(in oklab,var(--color-indigo-50) 50%,transparent)}}.hover\:bg-indigo-100:hover{background-color:var(--color-indigo-100)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}.hover\:bg-orange-50\/50:hover{background-color:#fff7ed80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-50\/50:hover{background-color:color-mix(in oklab,var(--color-orange-50) 50%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-50\/50:hover{background-color:#faf5ff80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-50\/50:hover{background-color:color-mix(in oklab,var(--color-purple-50) 50%,transparent)}}.hover\:bg-purple-700:hover{background-color:var(--color-purple-700)}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-50\/50:hover{background-color:#fef2f280}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-50\/50:hover{background-color:color-mix(in oklab,var(--color-red-50) 50%,transparent)}}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-sky-50\/50:hover{background-color:#f0f9ff80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-sky-50\/50:hover{background-color:color-mix(in oklab,var(--color-sky-50) 50%,transparent)}}.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-50\/50:hover{background-color:#f8fafc80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-50\/50:hover{background-color:color-mix(in oklab,var(--color-slate-50) 50%,transparent)}}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-teal-50\/50:hover{background-color:#f0fdfa80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-teal-50\/50:hover{background-color:color-mix(in oklab,var(--color-teal-50) 50%,transparent)}}.hover\:bg-teal-700:hover{background-color:var(--color-teal-700)}.hover\:bg-violet-50\/50:hover{background-color:#f5f3ff80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-violet-50\/50:hover{background-color:color-mix(in oklab,var(--color-violet-50) 50%,transparent)}}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.hover\:bg-yellow-50\/50:hover{background-color:#fefce880}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-50\/50:hover{background-color:color-mix(in oklab,var(--color-yellow-50) 50%,transparent)}}.hover\:text-blue-500:hover{color:var(--color-blue-500)}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-blue-800:hover{color:var(--color-blue-800)}.hover\:text-emerald-500:hover{color:var(--color-emerald-500)}.hover\:text-gray-500:hover{color:var(--color-gray-500)}.hover\:text-gray-600:hover{color:var(--color-gray-600)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}.hover\:text-gray-900:hover{color:var(--color-gray-900)}.hover\:text-green-600:hover{color:var(--color-green-600)}.hover\:text-indigo-700:hover{color:var(--color-indigo-700)}.hover\:text-red-500:hover{color:var(--color-red-500)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:text-red-700:hover{color:var(--color-red-700)}.hover\:text-slate-600:hover{color:var(--color-slate-600)}.hover\:text-slate-700:hover{color:var(--color-slate-700)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-2xl:hover{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-\[0_8px_32px_rgba\(59\,130\,246\,0\.15\)\]:hover{--tw-shadow:0 8px 32px var(--tw-shadow-color,#3b82f626);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-\[0_20px_50px_-20px_rgba\(0\,0\,0\,0\.1\)\]:hover{--tw-shadow:0 20px 50px -20px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-\[0_20px_50px_rgba\(8\,112\,184\,0\.1\)\]:hover{--tw-shadow:0 20px 50px var(--tw-shadow-color,#0870b81a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-sm:hover{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-blue-50\/50:hover{--tw-shadow-color:#eff6ff80}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-blue-50\/50:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-blue-50) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-blue-200:hover{--tw-shadow-color:oklch(88.2% .059 254.128)}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-blue-200:hover{--tw-shadow-color:color-mix(in oklab, var(--color-blue-200) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-emerald-200:hover{--tw-shadow-color:oklch(90.5% .093 164.15)}@supports (color:color-mix(in lab,red,red)){.hover\:shadow-emerald-200:hover{--tw-shadow-color:color-mix(in oklab, var(--color-emerald-200) var(--tw-shadow-alpha), transparent)}}}.focus\:border-2:focus{border-style:var(--tw-border-style);border-width:2px}.focus\:border-amber-400:focus{border-color:var(--color-amber-400)}.focus\:border-blue-300:focus{border-color:var(--color-blue-300)}.focus\:border-blue-500:focus{border-color:var(--color-blue-500)}.focus\:border-blue-600:focus{border-color:var(--color-blue-600)}.focus\:border-green-500:focus{border-color:var(--color-green-500)}.focus\:border-indigo-300:focus{border-color:var(--color-indigo-300)}.focus\:border-orange-400:focus{border-color:var(--color-orange-400)}.focus\:border-red-400:focus{border-color:var(--color-red-400)}.focus\:border-transparent:focus{border-color:#0000}.focus\:bg-white:focus{background-color:var(--color-white)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-4:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-amber-500:focus{--tw-ring-color:var(--color-amber-500)}.focus\:ring-blue-50:focus{--tw-ring-color:var(--color-blue-50)}.focus\:ring-blue-100:focus{--tw-ring-color:var(--color-blue-100)}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-emerald-100:focus{--tw-ring-color:var(--color-emerald-100)}.focus\:ring-indigo-100:focus{--tw-ring-color:var(--color-indigo-100)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:scale-\[0\.98\]:active{scale:.98}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-400:disabled{background-color:var(--color-gray-400)}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.disabled\:opacity-70:disabled{opacity:.7}@media(hover:hover){.disabled\:hover\:bg-transparent:disabled:hover{background-color:#0000}}@media(min-width:40rem){.sm\:block{display:block}.sm\:flex{display:flex}.sm\:inline{display:inline}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}}@media(min-width:48rem){.md\:relative{position:relative}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-\[98vh\]{height:98vh}.md\:w-\[96vw\]{width:96vw}.md\:max-w-\[300px\]{max-width:300px}.md\:translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:items-end{align-items:flex-end}.md\:gap-4{gap:calc(var(--spacing) * 4)}.md\:rounded-2xl{border-radius:var(--radius-2xl)}.md\:rounded-\[2\.5rem\]{border-radius:2.5rem}.md\:rounded-\[2rem\]{border-radius:2rem}.md\:rounded-xl{border-radius:var(--radius-xl)}.md\:p-8{padding:calc(var(--spacing) * 8)}.md\:px-8{padding-inline:calc(var(--spacing) * 8)}.md\:text-left{text-align:left}.md\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}@media(min-width:64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:col-span-4{grid-column:span 4/span 4}.lg\:col-span-8{grid-column:span 8/span 8}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:inline-block{display:inline-block}.lg\:w-1\/2{width:50%}.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))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:justify-between{justify-content:space-between}:where(.lg\:space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 0) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 0) * calc(1 - var(--tw-space-y-reverse)))}.lg\:gap-x-8{column-gap:calc(var(--spacing) * 8)}.lg\:gap-y-5{row-gap:calc(var(--spacing) * 5)}.lg\:gap-y-6{row-gap:calc(var(--spacing) * 6)}.lg\:p-3{padding:calc(var(--spacing) * 3)}.lg\:p-4{padding:calc(var(--spacing) * 4)}.lg\:p-6{padding:calc(var(--spacing) * 6)}.lg\:p-8{padding:calc(var(--spacing) * 8)}.lg\:p-24{padding:calc(var(--spacing) * 24)}.lg\:py-3{padding-block:calc(var(--spacing) * 3)}.lg\:pt-48{padding-top:calc(var(--spacing) * 48)}.lg\:pb-40{padding-bottom:calc(var(--spacing) * 40)}.lg\:text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.lg\:text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.lg\:text-7xl{font-size:var(--text-7xl);line-height:var(--tw-leading,var(--text-7xl--line-height))}.lg\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}}@media(min-width:80rem){.xl\:col-span-10{grid-column:span 10/span 10}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}}@media print{.print\:hidden{display:none}.print\:max-w-full{max-width:100%}.print\:rounded-none{border-radius:0}.print\:border-0{border-style:var(--tw-border-style);border-width:0}.print\:bg-white{background-color:var(--color-white)}.print\:p-0{padding:calc(var(--spacing) * 0)}.print\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}}body{background-color:#f3f4f6;font-family:Inter,sans-serif}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#f1f1f1}::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.fc{font-family:Inter,sans-serif}.fc-toolbar-title{color:#1f2937;font-size:1.25rem!important;font-weight:600!important}.fc-button-primary{background-color:#2563eb!important;border-color:#2563eb!important}.fc-daygrid-event{border-radius:4px;font-size:.75rem;font-weight:500}.uppercase-input,.uppercase-textarea,.uppercase-select{text-transform:uppercase}.dark-date-input::-webkit-calendar-picker-indicator{filter:invert();cursor:pointer}.fc{max-height:100%}.fc-theme-standard td,.fc-theme-standard th{border:1px solid #e5e7eb!important}.fc-timegrid-slot{height:3em!important}.fc-col-header-cell{background-color:#f9fafb;padding:8px 0!important}.fc-scrollgrid{border-radius:8px;overflow:hidden}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}} diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 06ad8b2..b7a41e4 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -22,8 +22,8 @@ - - + + diff --git a/nginx/default-staging.conf b/nginx/default-staging.conf new file mode 100644 index 0000000..4b3667d --- /dev/null +++ b/nginx/default-staging.conf @@ -0,0 +1,52 @@ +server { + listen 80; + server_name _; + + # Limite de upload para mídias do WhatsApp + client_max_body_size 100M; + + # Resolver DNS interno do Docker para resolução dinâmica + resolver 127.0.0.11 valid=30s; + + # Proxy para o Backend (Express API) + location /api/ { + set $backend_upstream http://scoreodonto-backend-staging:8018; + rewrite ^/api/api/(.*)$ /api/$1 break; + proxy_pass $backend_upstream; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Proxy para o Socket.io (Realtime Events) + location /socket.io/ { + set $backend_upstream http://scoreodonto-backend-staging:8018; + proxy_pass $backend_upstream; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Proxy para o Frontend (Vite React SPA) + location / { + set $frontend_upstream http://scoreodonto-frontend-staging:3013; + proxy_pass $frontend_upstream; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +}