componentes-exagono 0.2.73 → 0.2.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -19718,12 +19718,12 @@ const H4 = /* @__PURE__ */ ht(V4), Y4 = "data:image/png;base64,iVBORw0KGgoAAAANS
19718
19718
  fh,
19719
19719
  {
19720
19720
  component: Su,
19721
- to: `${nr.url}${pr?.solID}`,
19721
+ to: `${nr?.url}${pr?.solID}`,
19722
19722
  replace: !0,
19723
19723
  state: {
19724
19724
  // <--- Aquí envías tus parámetros "invisibles"
19725
- tipoSOL: nr.tipo,
19726
- pag: nr.pag,
19725
+ tipoSOL: nr?.tipo,
19726
+ pag: nr?.pag,
19727
19727
  modulo: "Consulta"
19728
19728
  },
19729
19729
  sx: {
package/dist/index.umd.js CHANGED
@@ -185,7 +185,7 @@ const theme2 = createTheme({ palette: {
185
185
  * @license MIT
186
186
  */function Yt(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function en(e,r){if(!e){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function zl({pathname:e="/",search:r="",hash:t=""}){return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),t&&t!=="#"&&(e+=t.charAt(0)==="#"?t:"#"+t),e}function Bl(e){let r={};if(e){let t=e.indexOf("#");t>=0&&(r.hash=e.substring(t),e=e.substring(0,t));let n=e.indexOf("?");n>=0&&(r.search=e.substring(n),e=e.substring(0,n)),e&&(r.pathname=e)}return r}function rh(e,r,t="/"){return DD(e,r,t,!1)}function DD(e,r,t,n){let o=typeof r=="string"?Bl(r):r,a=mn(o.pathname||"/",t);if(a==null)return null;let s=nh(e);AD(s);let i=null;for(let l=0;i==null&&l<s.length;++l){let d=$D(a);i=ND(s[l],d,n)}return i}function nh(e,r=[],t=[],n="",o=!1){let a=(s,i,l=o,d)=>{let u={relativePath:d===void 0?s.path||"":d,caseSensitive:s.caseSensitive===!0,childrenIndex:i,route:s};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(n)&&l)return;Yt(u.relativePath.startsWith(n),`Absolute route path "${u.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(n.length)}let f=qr([n,u.relativePath]),h=t.concat(u);s.children&&s.children.length>0&&(Yt(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),nh(s.children,r,h,f,l)),!(s.path==null&&!s.index)&&r.push({path:f,score:jD(f,s.index),routesMeta:h})};return e.forEach((s,i)=>{if(s.path===""||!s.path?.includes("?"))a(s,i);else for(let l of oh(s.path))a(s,i,!0,l)}),r}function oh(e){let r=e.split("/");if(r.length===0)return[];let[t,...n]=r,o=t.endsWith("?"),a=t.replace(/\?$/,"");if(n.length===0)return o?[a,""]:[a];let s=oh(n.join("/")),i=[];return i.push(...s.map(l=>l===""?a:[a,l].join("/"))),o&&i.push(...s),i.map(l=>e.startsWith("/")&&l===""?"/":l)}function AD(e){e.sort((r,t)=>r.score!==t.score?t.score-r.score:RD(r.routesMeta.map(n=>n.childrenIndex),t.routesMeta.map(n=>n.childrenIndex)))}var kD=/^:[\w-]+$/,TD=3,MD=2,ID=1,OD=10,PD=-2,ah=e=>e==="*";function jD(e,r){let t=e.split("/"),n=t.length;return t.some(ah)&&(n+=PD),r&&(n+=MD),t.filter(o=>!ah(o)).reduce((o,a)=>o+(kD.test(a)?TD:a===""?ID:OD),n)}function RD(e,r){return e.length===r.length&&e.slice(0,-1).every((n,o)=>n===r[o])?e[e.length-1]-r[r.length-1]:0}function ND(e,r,t=!1){let{routesMeta:n}=e,o={},a="/",s=[];for(let i=0;i<n.length;++i){let l=n[i],d=i===n.length-1,u=a==="/"?r:r.slice(a.length)||"/",f=qs({path:l.relativePath,caseSensitive:l.caseSensitive,end:d},u),h=l.route;if(!f&&d&&t&&!n[n.length-1].route.index&&(f=qs({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!f)return null;Object.assign(o,f.params),s.push({params:o,pathname:qr([a,f.pathname]),pathnameBase:UD(qr([a,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(a=qr([a,f.pathnameBase]))}return s}function qs(e,r){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[t,n]=LD(e.path,e.caseSensitive,e.end),o=r.match(t);if(!o)return null;let a=o[0],s=a.replace(/(.)\/+$/,"$1"),i=o.slice(1);return{params:n.reduce((d,{paramName:u,isOptional:f},h)=>{if(u==="*"){let v=i[h]||"";s=a.slice(0,a.length-v.length).replace(/(.)\/+$/,"$1")}const g=i[h];return f&&!g?d[u]=void 0:d[u]=(g||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:s,pattern:e}}function LD(e,r=!1,t=!0){en(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,i,l,d,u)=>{if(n.push({paramName:i,isOptional:l!=null}),l){let f=u.charAt(d+s.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,r?void 0:"i"),n]}function $D(e){try{return e.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return en(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),e}}function mn(e,r){if(r==="/")return e;if(!e.toLowerCase().startsWith(r.toLowerCase()))return null;let t=r.endsWith("/")?r.length-1:r.length,n=e.charAt(t);return n&&n!=="/"?null:e.slice(t)||"/"}var zD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function BD(e,r="/"){let{pathname:t,search:n="",hash:o=""}=typeof e=="string"?Bl(e):e,a;return t?(t=t.replace(/\/\/+/g,"/"),t.startsWith("/")?a=sh(t.substring(1),"/"):a=sh(t,r)):a=r,{pathname:a,search:WD(n),hash:VD(o)}}function sh(e,r){let t=r.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?t.length>1&&t.pop():o!=="."&&t.push(o)}),t.length>1?t.join("/"):"/"}function Fl(e,r,t,n){return`Cannot include a '${e}' character in a manually specified \`to.${r}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function FD(e){return e.filter((r,t)=>t===0||r.route.path&&r.route.path.length>0)}function ih(e){let r=FD(e);return r.map((t,n)=>n===r.length-1?t.pathname:t.pathnameBase)}function Ul(e,r,t,n=!1){let o;typeof e=="string"?o=Bl(e):(o={...e},Yt(!o.pathname||!o.pathname.includes("?"),Fl("?","pathname","search",o)),Yt(!o.pathname||!o.pathname.includes("#"),Fl("#","pathname","hash",o)),Yt(!o.search||!o.search.includes("#"),Fl("#","search","hash",o)));let a=e===""||o.pathname==="",s=a?"/":o.pathname,i;if(s==null)i=t;else{let f=r.length-1;if(!n&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;o.pathname=h.join("/")}i=f>=0?r[f]:"/"}let l=BD(o,i),d=s&&s!=="/"&&s.endsWith("/"),u=(a||s===".")&&t.endsWith("/");return!l.pathname.endsWith("/")&&(d||u)&&(l.pathname+="/"),l}var qr=e=>e.join("/").replace(/\/\/+/g,"/"),UD=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),WD=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,VD=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,HD=class{constructor(e,r,t,n=!1){this.status=e,this.statusText=r||"",this.internal=n,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}};function YD(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function qD(e){return e.map(r=>r.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var lh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ch(e,r){let t=e;if(typeof t!="string"||!zD.test(t))return{absoluteURL:void 0,isExternal:!1,to:t};let n=t,o=!1;if(lh)try{let a=new URL(window.location.href),s=t.startsWith("//")?new URL(a.protocol+t):new URL(t),i=mn(s.pathname,r);s.origin===a.origin&&i!=null?t=i+s.search+s.hash:o=!0}catch{en(!1,`<Link to="${t}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:o,to:t}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var uh=["POST","PUT","PATCH","DELETE"];new Set(uh);var ZD=["GET",...uh];new Set(ZD);var ro=M.createContext(null);ro.displayName="DataRouter";var Zs=M.createContext(null);Zs.displayName="DataRouterState";var dh=M.createContext(!1);function GD(){return M.useContext(dh)}var fh=M.createContext({isTransitioning:!1});fh.displayName="ViewTransition";var KD=M.createContext(new Map);KD.displayName="Fetchers";var QD=M.createContext(null);QD.displayName="Await";var Mr=M.createContext(null);Mr.displayName="Navigation";var Wl=M.createContext(null);Wl.displayName="Location";var tn=M.createContext({outlet:null,matches:[],isDataRoute:!1});tn.displayName="Route";var Vl=M.createContext(null);Vl.displayName="RouteError";var ph="REACT_ROUTER_ERROR",JD="REDIRECT",XD="ROUTE_ERROR_RESPONSE";function eA(e){if(e.startsWith(`${ph}:${JD}:{`))try{let r=JSON.parse(e.slice(28));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.location=="string"&&typeof r.reloadDocument=="boolean"&&typeof r.replace=="boolean")return r}catch{}}function tA(e){if(e.startsWith(`${ph}:${XD}:{`))try{let r=JSON.parse(e.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new HD(r.status,r.statusText,r.data)}catch{}}function rA(e,{relative:r}={}){Yt(Gs(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:n}=M.useContext(Mr),{hash:o,pathname:a,search:s}=Go(e,{relative:r}),i=a;return t!=="/"&&(i=a==="/"?t:qr([t,a])),n.createHref({pathname:i,search:s,hash:o})}function Gs(){return M.useContext(Wl)!=null}function rn(){return Yt(Gs(),"useLocation() may be used only in the context of a <Router> component."),M.useContext(Wl).location}var hh="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function mh(e){M.useContext(Mr).static||M.useLayoutEffect(e)}function nA(){let{isDataRoute:e}=M.useContext(tn);return e?gA():oA()}function oA(){Yt(Gs(),"useNavigate() may be used only in the context of a <Router> component.");let e=M.useContext(ro),{basename:r,navigator:t}=M.useContext(Mr),{matches:n}=M.useContext(tn),{pathname:o}=rn(),a=JSON.stringify(ih(n)),s=M.useRef(!1);return mh(()=>{s.current=!0}),M.useCallback((l,d={})=>{if(en(s.current,hh),!s.current)return;if(typeof l=="number"){t.go(l);return}let u=Ul(l,JSON.parse(a),o,d.relative==="path");e==null&&r!=="/"&&(u.pathname=u.pathname==="/"?r:qr([r,u.pathname])),(d.replace?t.replace:t.push)(u,d.state,d)},[r,t,a,o,e])}M.createContext(null);function Go(e,{relative:r}={}){let{matches:t}=M.useContext(tn),{pathname:n}=rn(),o=JSON.stringify(ih(t));return M.useMemo(()=>Ul(e,JSON.parse(o),n,r==="path"),[e,o,n,r])}function aA(e,r,t){Yt(Gs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=M.useContext(Mr),{matches:o}=M.useContext(tn),a=o[o.length-1],s=a?a.params:{},i=a?a.pathname:"/",l=a?a.pathnameBase:"/",d=a&&a.route;{let y=d&&d.path||"";yh(i,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${i}" (under <Route path="${y}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
187
187
 
188
- Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let u=rn(),f;f=u;let h=f.pathname||"/",g=h;if(l!=="/"){let y=l.replace(/^\//,"").split("/");g="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let v=rh(e,{pathname:g});return en(d||v!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),en(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),uA(v&&v.map(y=>Object.assign({},y,{params:Object.assign({},s,y.params),pathname:qr([l,n.encodeLocation?n.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:qr([l,n.encodeLocation?n.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),o,t)}function sA(){let e=mA(),r=YD(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),t=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:n},a={padding:"2px 4px",backgroundColor:n},s=null;return console.error("Error handled by React Router default ErrorBoundary:",e),s=M.createElement(M.Fragment,null,M.createElement("p",null,"💿 Hey developer 👋"),M.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",M.createElement("code",{style:a},"ErrorBoundary")," or"," ",M.createElement("code",{style:a},"errorElement")," prop on your route.")),M.createElement(M.Fragment,null,M.createElement("h2",null,"Unexpected Application Error!"),M.createElement("h3",{style:{fontStyle:"italic"}},r),t?M.createElement("pre",{style:o},t):null,s)}var iA=M.createElement(sA,null),gh=class extends M.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){this.props.onError?this.props.onError(e,r):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const t=tA(e.digest);t&&(e=t)}let r=e!==void 0?M.createElement(tn.Provider,{value:this.props.routeContext},M.createElement(Vl.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?M.createElement(lA,{error:e},r):r}};gh.contextType=dh;var Hl=new WeakMap;function lA({children:e,error:r}){let{basename:t}=M.useContext(Mr);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let n=eA(r.digest);if(n){let o=Hl.get(r);if(o)throw o;let a=ch(n.location,t);if(lh&&!Hl.get(r))if(a.isExternal||n.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const s=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:n.replace}));throw Hl.set(r,s),s}return M.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function cA({routeContext:e,match:r,children:t}){let n=M.useContext(ro);return n&&n.static&&n.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=r.route.id),M.createElement(tn.Provider,{value:e},t)}function uA(e,r=[],t){let n=t?.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(r.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=n?.errors;if(a!=null){let u=o.findIndex(f=>f.route.id&&a?.[f.route.id]!==void 0);Yt(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,u+1))}let s=!1,i=-1;if(t&&n){s=n.renderFallback;for(let u=0;u<o.length;u++){let f=o[u];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(i=u),f.route.id){let{loaderData:h,errors:g}=n,v=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!g||g[f.route.id]===void 0);if(f.route.lazy||v){t.isStatic&&(s=!0),i>=0?o=o.slice(0,i+1):o=[o[0]];break}}}}let l=t?.onError,d=n&&l?(u,f)=>{l(u,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:qD(n.matches),errorInfo:f})}:void 0;return o.reduceRight((u,f,h)=>{let g,v=!1,p=null,y=null;n&&(g=a&&f.route.id?a[f.route.id]:void 0,p=f.route.errorElement||iA,s&&(i<0&&h===0?(yh("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,y=null):i===h&&(v=!0,y=f.route.hydrateFallbackElement||null)));let _=r.concat(o.slice(0,h+1)),S=()=>{let C;return g?C=p:v?C=y:f.route.Component?C=M.createElement(f.route.Component,null):f.route.element?C=f.route.element:C=u,M.createElement(cA,{match:f,routeContext:{outlet:u,matches:_,isDataRoute:n!=null},children:C})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?M.createElement(gh,{location:n.location,revalidation:n.revalidation,component:p,error:g,children:S(),routeContext:{outlet:null,matches:_,isDataRoute:!0},onError:d}):S()},null)}function Yl(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dA(e){let r=M.useContext(ro);return Yt(r,Yl(e)),r}function fA(e){let r=M.useContext(Zs);return Yt(r,Yl(e)),r}function pA(e){let r=M.useContext(tn);return Yt(r,Yl(e)),r}function ql(e){let r=pA(e),t=r.matches[r.matches.length-1];return Yt(t.route.id,`${e} can only be used on routes that contain a unique "id"`),t.route.id}function hA(){return ql("useRouteId")}function mA(){let e=M.useContext(Vl),r=fA("useRouteError"),t=ql("useRouteError");return e!==void 0?e:r.errors?.[t]}function gA(){let{router:e}=dA("useNavigate"),r=ql("useNavigate"),t=M.useRef(!1);return mh(()=>{t.current=!0}),M.useCallback(async(o,a={})=>{en(t.current,hh),t.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:r,...a}))},[e,r])}var vh={};function yh(e,r,t){!r&&!vh[e]&&(vh[e]=!0,en(!1,t))}M.memo(vA);function vA({routes:e,future:r,state:t,isStatic:n,onError:o}){return aA(e,void 0,{state:t,isStatic:n,onError:o})}var Ks="get",Qs="application/x-www-form-urlencoded";function Js(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function yA(e){return Js(e)&&e.tagName.toLowerCase()==="button"}function bA(e){return Js(e)&&e.tagName.toLowerCase()==="form"}function xA(e){return Js(e)&&e.tagName.toLowerCase()==="input"}function wA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function _A(e,r){return e.button===0&&(!r||r==="_self")&&!wA(e)}var Xs=null;function SA(){if(Xs===null)try{new FormData(document.createElement("form"),0),Xs=!1}catch{Xs=!0}return Xs}var CA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Zl(e){return e!=null&&!CA.has(e)?(en(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Qs}"`),null):e}function EA(e,r){let t,n,o,a,s;if(bA(e)){let i=e.getAttribute("action");n=i?mn(i,r):null,t=e.getAttribute("method")||Ks,o=Zl(e.getAttribute("enctype"))||Qs,a=new FormData(e)}else if(yA(e)||xA(e)&&(e.type==="submit"||e.type==="image")){let i=e.form;if(i==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||i.getAttribute("action");if(n=l?mn(l,r):null,t=e.getAttribute("formmethod")||i.getAttribute("method")||Ks,o=Zl(e.getAttribute("formenctype"))||Zl(i.getAttribute("enctype"))||Qs,a=new FormData(i,e),!SA()){let{name:d,type:u,value:f}=e;if(u==="image"){let h=d?`${d}.`:"";a.append(`${h}x`,"0"),a.append(`${h}y`,"0")}else d&&a.append(d,f)}}else{if(Js(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=Ks,n=null,o=Qs,s=e}return a&&o==="text/plain"&&(s=a,a=void 0),{action:n,method:t.toLowerCase(),encType:o,formData:a,body:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Gl(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function bh(e,r,t,n){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return t?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${n}`:o.pathname=`${o.pathname}.${n}`:o.pathname==="/"?o.pathname=`_root.${n}`:r&&mn(o.pathname,r)==="/"?o.pathname=`${r.replace(/\/$/,"")}/_root.${n}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${n}`,o}async function DA(e,r){if(e.id in r)return r[e.id];try{let t=await import(e.module);return r[e.id]=t,t}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function AA(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function kA(e,r,t){let n=await Promise.all(e.map(async o=>{let a=r.routes[o.route.id];if(a){let s=await DA(a,t);return s.links?s.links():[]}return[]}));return OA(n.flat(1).filter(AA).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function xh(e,r,t,n,o,a){let s=(l,d)=>t[d]?l.route.id!==t[d].route.id:!0,i=(l,d)=>t[d].pathname!==l.pathname||t[d].route.path?.endsWith("*")&&t[d].params["*"]!==l.params["*"];return a==="assets"?r.filter((l,d)=>s(l,d)||i(l,d)):a==="data"?r.filter((l,d)=>{let u=n.routes[l.route.id];if(!u||!u.hasLoader)return!1;if(s(l,d)||i(l,d))return!0;if(l.route.shouldRevalidate){let f=l.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:t[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function TA(e,r,{includeHydrateFallback:t}={}){return MA(e.map(n=>{let o=r.routes[n.route.id];if(!o)return[];let a=[o.module];return o.clientActionModule&&(a=a.concat(o.clientActionModule)),o.clientLoaderModule&&(a=a.concat(o.clientLoaderModule)),t&&o.hydrateFallbackModule&&(a=a.concat(o.hydrateFallbackModule)),o.imports&&(a=a.concat(o.imports)),a}).flat(1))}function MA(e){return[...new Set(e)]}function IA(e){let r={},t=Object.keys(e).sort();for(let n of t)r[n]=e[n];return r}function OA(e,r){let t=new Set;return new Set(r),e.reduce((n,o)=>{let a=JSON.stringify(IA(o));return t.has(a)||(t.add(a),n.push({key:a,link:o})),n},[])}function Kl(){let e=M.useContext(ro);return Gl(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function PA(){let e=M.useContext(Zs);return Gl(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ql=M.createContext(void 0);Ql.displayName="FrameworkContext";function Jl(){let e=M.useContext(Ql);return Gl(e,"You must render this element inside a <HydratedRouter> element"),e}function jA(e,r){let t=M.useContext(Ql),[n,o]=M.useState(!1),[a,s]=M.useState(!1),{onFocus:i,onBlur:l,onMouseEnter:d,onMouseLeave:u,onTouchStart:f}=r,h=M.useRef(null);M.useEffect(()=>{if(e==="render"&&s(!0),e==="viewport"){let p=_=>{_.forEach(S=>{s(S.isIntersecting)})},y=new IntersectionObserver(p,{threshold:.5});return h.current&&y.observe(h.current),()=>{y.disconnect()}}},[e]),M.useEffect(()=>{if(n){let p=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(p)}}},[n]);let g=()=>{o(!0)},v=()=>{o(!1),s(!1)};return t?e!=="intent"?[a,h,{}]:[a,h,{onFocus:Ko(i,g),onBlur:Ko(l,v),onMouseEnter:Ko(d,g),onMouseLeave:Ko(u,v),onTouchStart:Ko(f,g)}]:[!1,h,{}]}function Ko(e,r){return t=>{e&&e(t),t.defaultPrevented||r(t)}}function RA({page:e,...r}){let t=GD(),{router:n}=Kl(),o=M.useMemo(()=>rh(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?t?M.createElement(LA,{page:e,matches:o,...r}):M.createElement($A,{page:e,matches:o,...r}):null}function NA(e){let{manifest:r,routeModules:t}=Jl(),[n,o]=M.useState([]);return M.useEffect(()=>{let a=!1;return kA(e,r,t).then(s=>{a||o(s)}),()=>{a=!0}},[e,r,t]),n}function LA({page:e,matches:r,...t}){let n=rn(),{future:o}=Jl(),{basename:a}=Kl(),s=M.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let i=bh(e,a,o.unstable_trailingSlashAwareDataRequests,"rsc"),l=!1,d=[];for(let u of r)typeof u.route.shouldRevalidate=="function"?l=!0:d.push(u.route.id);return l&&d.length>0&&i.searchParams.set("_routes",d.join(",")),[i.pathname+i.search]},[a,o.unstable_trailingSlashAwareDataRequests,e,n,r]);return M.createElement(M.Fragment,null,s.map(i=>M.createElement("link",{key:i,rel:"prefetch",as:"fetch",href:i,...t})))}function $A({page:e,matches:r,...t}){let n=rn(),{future:o,manifest:a,routeModules:s}=Jl(),{basename:i}=Kl(),{loaderData:l,matches:d}=PA(),u=M.useMemo(()=>xh(e,r,d,a,n,"data"),[e,r,d,a,n]),f=M.useMemo(()=>xh(e,r,d,a,n,"assets"),[e,r,d,a,n]),h=M.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let p=new Set,y=!1;if(r.forEach(S=>{let C=a.routes[S.route.id];!C||!C.hasLoader||(!u.some(E=>E.route.id===S.route.id)&&S.route.id in l&&s[S.route.id]?.shouldRevalidate||C.hasClientLoader?y=!0:p.add(S.route.id))}),p.size===0)return[];let _=bh(e,i,o.unstable_trailingSlashAwareDataRequests,"data");return y&&p.size>0&&_.searchParams.set("_routes",r.filter(S=>p.has(S.route.id)).map(S=>S.route.id).join(",")),[_.pathname+_.search]},[i,o.unstable_trailingSlashAwareDataRequests,l,n,a,u,r,e,s]),g=M.useMemo(()=>TA(f,a),[f,a]),v=NA(f);return M.createElement(M.Fragment,null,h.map(p=>M.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...t})),g.map(p=>M.createElement("link",{key:p,rel:"modulepreload",href:p,...t})),v.map(({key:p,link:y})=>M.createElement("link",{key:p,nonce:t.nonce,...y,crossOrigin:y.crossOrigin??t.crossOrigin})))}function zA(...e){return r=>{e.forEach(t=>{typeof t=="function"?t(r):t!=null&&(t.current=r)})}}var BA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{BA&&(window.__reactRouterVersion="7.14.0")}catch{}var wh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xl=M.forwardRef(function({onClick:r,discover:t="render",prefetch:n="none",relative:o,reloadDocument:a,replace:s,unstable_mask:i,state:l,target:d,to:u,preventScrollReset:f,viewTransition:h,unstable_defaultShouldRevalidate:g,...v},p){let{basename:y,navigator:_,unstable_useTransitions:S}=M.useContext(Mr),C=typeof u=="string"&&wh.test(u),E=ch(u,y);u=E.to;let w=rA(u,{relative:o}),N=rn(),D=null;if(i){let J=Ul(i,[],N.unstable_mask?N.unstable_mask.pathname:"/",!0);y!=="/"&&(J.pathname=J.pathname==="/"?y:qr([y,J.pathname])),D=_.createHref(J)}let[k,O,I]=jA(n,v),Y=VA(u,{replace:s,unstable_mask:i,state:l,target:d,preventScrollReset:f,relative:o,viewTransition:h,unstable_defaultShouldRevalidate:g,unstable_useTransitions:S});function V(J){r&&r(J),J.defaultPrevented||Y(J)}let W=!(E.isExternal||a),Z=M.createElement("a",{...v,...I,href:(W?D:void 0)||E.absoluteURL||w,onClick:W?V:r,ref:zA(p,O),target:d,"data-discover":!C&&t==="render"?"true":void 0});return k&&!C?M.createElement(M.Fragment,null,Z,M.createElement(RA,{page:w})):Z});Xl.displayName="Link";var FA=M.forwardRef(function({"aria-current":r="page",caseSensitive:t=!1,className:n="",end:o=!1,style:a,to:s,viewTransition:i,children:l,...d},u){let f=Go(s,{relative:d.relative}),h=rn(),g=M.useContext(Zs),{navigator:v,basename:p}=M.useContext(Mr),y=g!=null&&GA(f)&&i===!0,_=v.encodeLocation?v.encodeLocation(f).pathname:f.pathname,S=h.pathname,C=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;t||(S=S.toLowerCase(),C=C?C.toLowerCase():null,_=_.toLowerCase()),C&&p&&(C=mn(C,p)||C);const E=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let w=S===_||!o&&S.startsWith(_)&&S.charAt(E)==="/",N=C!=null&&(C===_||!o&&C.startsWith(_)&&C.charAt(_.length)==="/"),D={isActive:w,isPending:N,isTransitioning:y},k=w?r:void 0,O;typeof n=="function"?O=n(D):O=[n,w?"active":null,N?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let I=typeof a=="function"?a(D):a;return M.createElement(Xl,{...d,"aria-current":k,className:O,ref:u,style:I,to:s,viewTransition:i},typeof l=="function"?l(D):l)});FA.displayName="NavLink";var UA=M.forwardRef(({discover:e="render",fetcherKey:r,navigate:t,reloadDocument:n,replace:o,state:a,method:s=Ks,action:i,onSubmit:l,relative:d,preventScrollReset:u,viewTransition:f,unstable_defaultShouldRevalidate:h,...g},v)=>{let{unstable_useTransitions:p}=M.useContext(Mr),y=qA(),_=ZA(i,{relative:d}),S=s.toLowerCase()==="get"?"get":"post",C=typeof i=="string"&&wh.test(i),E=w=>{if(l&&l(w),w.defaultPrevented)return;w.preventDefault();let N=w.nativeEvent.submitter,D=N?.getAttribute("formmethod")||s,k=()=>y(N||w.currentTarget,{fetcherKey:r,method:D,navigate:t,replace:o,state:a,relative:d,preventScrollReset:u,viewTransition:f,unstable_defaultShouldRevalidate:h});p&&t!==!1?M.startTransition(()=>k()):k()};return M.createElement("form",{ref:v,method:S,action:_,onSubmit:n?l:E,...g,"data-discover":!C&&e==="render"?"true":void 0})});UA.displayName="Form";function WA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function _h(e){let r=M.useContext(ro);return Yt(r,WA(e)),r}function VA(e,{target:r,replace:t,unstable_mask:n,state:o,preventScrollReset:a,relative:s,viewTransition:i,unstable_defaultShouldRevalidate:l,unstable_useTransitions:d}={}){let u=nA(),f=rn(),h=Go(e,{relative:s});return M.useCallback(g=>{if(_A(g,r)){g.preventDefault();let v=t!==void 0?t:zl(f)===zl(h),p=()=>u(e,{replace:v,unstable_mask:n,state:o,preventScrollReset:a,relative:s,viewTransition:i,unstable_defaultShouldRevalidate:l});d?M.startTransition(()=>p()):p()}},[f,u,h,t,n,o,r,e,a,s,i,l,d])}var HA=0,YA=()=>`__${String(++HA)}__`;function qA(){let{router:e}=_h("useSubmit"),{basename:r}=M.useContext(Mr),t=hA(),n=e.fetch,o=e.navigate;return M.useCallback(async(a,s={})=>{let{action:i,method:l,encType:d,formData:u,body:f}=EA(a,r);if(s.navigate===!1){let h=s.fetcherKey||YA();await n(h,t,s.action||i,{unstable_defaultShouldRevalidate:s.unstable_defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,formData:u,body:f,formMethod:s.method||l,formEncType:s.encType||d,flushSync:s.flushSync})}else await o(s.action||i,{unstable_defaultShouldRevalidate:s.unstable_defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,formData:u,body:f,formMethod:s.method||l,formEncType:s.encType||d,replace:s.replace,state:s.state,fromRouteId:t,flushSync:s.flushSync,viewTransition:s.viewTransition})},[n,o,r,t])}function ZA(e,{relative:r}={}){let{basename:t}=M.useContext(Mr),n=M.useContext(tn);Yt(n,"useFormAction must be used inside a RouteContext");let[o]=n.matches.slice(-1),a={...Go(e||".",{relative:r})},s=rn();if(e==null){a.search=s.search;let i=new URLSearchParams(a.search),l=i.getAll("index");if(l.some(u=>u==="")){i.delete("index"),l.filter(f=>f).forEach(f=>i.append("index",f));let u=i.toString();a.search=u?`?${u}`:""}}return(!e||e===".")&&o.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(a.pathname=a.pathname==="/"?t:qr([t,a.pathname])),zl(a)}function GA(e,{relative:r}={}){let t=M.useContext(fh);Yt(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=_h("useViewTransitionState"),o=Go(e,{relative:r});if(!t.isTransitioning)return!1;let a=mn(t.currentLocation.pathname,n)||t.currentLocation.pathname,s=mn(t.nextLocation.pathname,n)||t.nextLocation.pathname;return qs(o.pathname,s)!=null||qs(o.pathname,a)!=null}var Qo=e=>e.type==="checkbox",On=e=>e instanceof Date,tr=e=>e==null;const Sh=e=>typeof e=="object";var Lt=e=>!tr(e)&&!Array.isArray(e)&&Sh(e)&&!On(e),Ch=e=>Lt(e)&&e.target?Qo(e.target)?e.target.checked:e.target.value:e,KA=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Eh=(e,r)=>e.has(KA(r)),QA=e=>{const r=e.constructor&&e.constructor.prototype;return Lt(r)&&r.hasOwnProperty("isPrototypeOf")},ec=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ft(e){let r;const t=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(!(ec&&(e instanceof Blob||n))&&(t||Lt(e)))if(r=t?[]:Object.create(Object.getPrototypeOf(e)),!t&&!QA(e))r=e;else for(const o in e)e.hasOwnProperty(o)&&(r[o]=Ft(e[o]));else return e;return r}var ei=e=>/^\w*$/.test(e),$t=e=>e===void 0,tc=e=>Array.isArray(e)?e.filter(Boolean):[],rc=e=>tc(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ue=(e,r,t)=>{if(!r||!Lt(e))return t;const n=(ei(r)?[r]:rc(r)).reduce((o,a)=>tr(o)?o:o[a],e);return $t(n)||n===e?$t(e[r])?t:e[r]:n},mr=e=>typeof e=="boolean",ct=(e,r,t)=>{let n=-1;const o=ei(r)?[r]:rc(r),a=o.length,s=a-1;for(;++n<a;){const i=o[n];let l=t;if(n!==s){const d=e[i];l=Lt(d)||Array.isArray(d)?d:isNaN(+o[n+1])?{}:[]}if(i==="__proto__"||i==="constructor"||i==="prototype")return;e[i]=l,e=e[i]}};const ti={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ir={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},nn={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},nc=b.createContext(null);nc.displayName="HookFormContext";const oc=()=>b.useContext(nc),JA=e=>{const{children:r,...t}=e;return b.createElement(nc.Provider,{value:t},r)};var Dh=(e,r,t,n=!0)=>{const o={defaultValues:r._defaultValues};for(const a in e)Object.defineProperty(o,a,{get:()=>{const s=a;return r._proxyFormState[s]!==Ir.all&&(r._proxyFormState[s]=!n||Ir.all),t&&(t[s]=!0),e[s]}});return o};const ac=typeof window<"u"?b.useLayoutEffect:b.useEffect;function XA(e){const r=oc(),{control:t=r.control,disabled:n,name:o,exact:a}=e||{},[s,i]=b.useState(t._formState),l=b.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ac(()=>t._subscribe({name:o,formState:l.current,exact:a,callback:d=>{!n&&i({...t._formState,...d})}}),[o,n,a]),b.useEffect(()=>{l.current.isValid&&t._setValid(!0)},[t]),b.useMemo(()=>Dh(s,t,l.current,!1),[s,t])}var Zr=e=>typeof e=="string",Ah=(e,r,t,n,o)=>Zr(e)?(n&&r.watch.add(e),ue(t,e,o)):Array.isArray(e)?e.map(a=>(n&&r.watch.add(a),ue(t,a))):(n&&(r.watchAll=!0),t),sc=e=>tr(e)||!Sh(e);function on(e,r,t=new WeakSet){if(sc(e)||sc(r))return e===r;if(On(e)&&On(r))return e.getTime()===r.getTime();const n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const a of n){const s=e[a];if(!o.includes(a))return!1;if(a!=="ref"){const i=r[a];if(On(s)&&On(i)||Lt(s)&&Lt(i)||Array.isArray(s)&&Array.isArray(i)?!on(s,i,t):s!==i)return!1}}return!0}function kh(e){const r=oc(),{control:t=r.control,name:n,defaultValue:o,disabled:a,exact:s,compute:i}=e||{},l=b.useRef(o),d=b.useRef(i),u=b.useRef(void 0);d.current=i;const f=b.useMemo(()=>t._getWatch(n,l.current),[t,n]),[h,g]=b.useState(d.current?d.current(f):f);return ac(()=>t._subscribe({name:n,formState:{values:!0},exact:s,callback:v=>{if(!a){const p=Ah(n,t._names,v.values||t._formValues,!1,l.current);if(d.current){const y=d.current(p);on(y,u.current)||(g(y),u.current=y)}else g(p)}}}),[t,a,n,s]),b.useEffect(()=>t._removeUnmounted()),h}function ek(e){const r=oc(),{name:t,disabled:n,control:o=r.control,shouldUnregister:a,defaultValue:s}=e,i=Eh(o._names.array,t),l=b.useMemo(()=>ue(o._formValues,t,ue(o._defaultValues,t,s)),[o,t,s]),d=kh({control:o,name:t,defaultValue:l,exact:!0}),u=XA({control:o,name:t,exact:!0}),f=b.useRef(e),h=b.useRef(o.register(t,{...e.rules,value:d,...mr(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const g=b.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(u.errors,t)},isDirty:{enumerable:!0,get:()=>!!ue(u.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!ue(u.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!ue(u.validatingFields,t)},error:{enumerable:!0,get:()=>ue(u.errors,t)}}),[u,t]),v=b.useCallback(S=>h.current.onChange({target:{value:Ch(S),name:t},type:ti.CHANGE}),[t]),p=b.useCallback(()=>h.current.onBlur({target:{value:ue(o._formValues,t),name:t},type:ti.BLUR}),[t,o._formValues]),y=b.useCallback(S=>{const C=ue(o._fields,t);C&&S&&(C._f.ref={focus:()=>S.focus&&S.focus(),select:()=>S.select&&S.select(),setCustomValidity:E=>S.setCustomValidity(E),reportValidity:()=>S.reportValidity()})},[o._fields,t]),_=b.useMemo(()=>({name:t,value:d,...mr(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:v,onBlur:p,ref:y}),[t,n,u.disabled,v,p,y,d]);return b.useEffect(()=>{const S=o._options.shouldUnregister||a;o.register(t,{...f.current.rules,...mr(f.current.disabled)?{disabled:f.current.disabled}:{}});const C=(E,w)=>{const N=ue(o._fields,E);N&&N._f&&(N._f.mount=w)};if(C(t,!0),S){const E=Ft(ue(o._options.defaultValues,t));ct(o._defaultValues,t,E),$t(ue(o._formValues,t))&&ct(o._formValues,t,E)}return!i&&o.register(t),()=>{(i?S&&!o._state.action:S)?o.unregister(t):C(t,!1)}},[t,o,i,a]),b.useEffect(()=>{o._setDisabledField({disabled:n,name:t})},[n,t,o]),b.useMemo(()=>({field:_,formState:u,fieldState:g}),[_,u,g])}const Or=e=>e.render(ek(e));var ic=(e,r,t,n,o)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[n]:o||!0}}:{},Jo=e=>Array.isArray(e)?e:[e],Th=()=>{let e=[];return{get observers(){return e},next:o=>{for(const a of e)a.next&&a.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(a=>a!==o)}}),unsubscribe:()=>{e=[]}}},lr=e=>Lt(e)&&!Object.keys(e).length,lc=e=>e.type==="file",Pr=e=>typeof e=="function",ri=e=>{if(!ec)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Mh=e=>e.type==="select-multiple",cc=e=>e.type==="radio",tk=e=>cc(e)||Qo(e),uc=e=>ri(e)&&e.isConnected;function rk(e,r){const t=r.slice(0,-1).length;let n=0;for(;n<t;)e=$t(e)?n++:e[r[n++]];return e}function nk(e){for(const r in e)if(e.hasOwnProperty(r)&&!$t(e[r]))return!1;return!0}function Bt(e,r){const t=Array.isArray(r)?r:ei(r)?[r]:rc(r),n=t.length===1?e:rk(e,t),o=t.length-1,a=t[o];return n&&delete n[a],o!==0&&(Lt(n)&&lr(n)||Array.isArray(n)&&nk(n))&&Bt(e,t.slice(0,-1)),e}var Ih=e=>{for(const r in e)if(Pr(e[r]))return!0;return!1};function ni(e,r={}){const t=Array.isArray(e);if(Lt(e)||t)for(const n in e)Array.isArray(e[n])||Lt(e[n])&&!Ih(e[n])?(r[n]=Array.isArray(e[n])?[]:{},ni(e[n],r[n])):tr(e[n])||(r[n]=!0);return r}function Oh(e,r,t){const n=Array.isArray(e);if(Lt(e)||n)for(const o in e)Array.isArray(e[o])||Lt(e[o])&&!Ih(e[o])?$t(r)||sc(t[o])?t[o]=Array.isArray(e[o])?ni(e[o],[]):{...ni(e[o])}:Oh(e[o],tr(r)?{}:r[o],t[o]):t[o]=!on(e[o],r[o]);return t}var Xo=(e,r)=>Oh(e,r,ni(r));const Ph={value:!1,isValid:!1},jh={value:!0,isValid:!0};var Rh=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!$t(e[0].attributes.value)?$t(e[0].value)||e[0].value===""?jh:{value:e[0].value,isValid:!0}:jh:Ph}return Ph},Nh=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:n})=>$t(e)?e:r?e===""?NaN:e&&+e:t&&Zr(e)?new Date(e):n?n(e):e;const Lh={isValid:!1,value:null};var $h=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,Lh):Lh;function zh(e){const r=e.ref;return lc(r)?r.files:cc(r)?$h(e.refs).value:Mh(r)?[...r.selectedOptions].map(({value:t})=>t):Qo(r)?Rh(e.refs).value:Nh($t(r.value)?e.ref.value:r.value,e)}var ok=(e,r,t,n)=>{const o={};for(const a of e){const s=ue(r,a);s&&ct(o,a,s._f)}return{criteriaMode:t,names:[...e],fields:o,shouldUseNativeValidation:n}},oi=e=>e instanceof RegExp,ea=e=>$t(e)?e:oi(e)?e.source:Lt(e)?oi(e.value)?e.value.source:e.value:e,Bh=e=>({isOnSubmit:!e||e===Ir.onSubmit,isOnBlur:e===Ir.onBlur,isOnChange:e===Ir.onChange,isOnAll:e===Ir.all,isOnTouch:e===Ir.onTouched});const Fh="AsyncFunction";var ak=e=>!!e&&!!e.validate&&!!(Pr(e.validate)&&e.validate.constructor.name===Fh||Lt(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===Fh)),sk=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Uh=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const ta=(e,r,t,n)=>{for(const o of t||Object.keys(e)){const a=ue(e,o);if(a){const{_f:s,...i}=a;if(s){if(s.refs&&s.refs[0]&&r(s.refs[0],o)&&!n)return!0;if(s.ref&&r(s.ref,s.name)&&!n)return!0;if(ta(i,r))break}else if(Lt(i)&&ta(i,r))break}}};function Wh(e,r,t){const n=ue(e,t);if(n||ei(t))return{error:n,name:t};const o=t.split(".");for(;o.length;){const a=o.join("."),s=ue(r,a),i=ue(e,a);if(s&&!Array.isArray(s)&&t!==a)return{name:t};if(i&&i.type)return{name:a,error:i};if(i&&i.root&&i.root.type)return{name:`${a}.root`,error:i.root};o.pop()}return{name:t}}var ik=(e,r,t,n)=>{t(e);const{name:o,...a}=e;return lr(a)||Object.keys(a).length>=Object.keys(r).length||Object.keys(a).find(s=>r[s]===(!n||Ir.all))},lk=(e,r,t)=>!e||!r||e===r||Jo(e).some(n=>n&&(t?n===r:n.startsWith(r)||r.startsWith(n))),ck=(e,r,t,n,o)=>o.isOnAll?!1:!t&&o.isOnTouch?!(r||e):(t?n.isOnBlur:o.isOnBlur)?!e:(t?n.isOnChange:o.isOnChange)?e:!0,uk=(e,r)=>!tc(ue(e,r)).length&&Bt(e,r),dk=(e,r,t)=>{const n=Jo(ue(e,t));return ct(n,"root",r[t]),ct(e,t,n),e},ai=e=>Zr(e);function Vh(e,r,t="validate"){if(ai(e)||Array.isArray(e)&&e.every(ai)||mr(e)&&!e)return{type:t,message:ai(e)?e:"",ref:r}}var no=e=>Lt(e)&&!oi(e)?e:{value:e,message:""},Hh=async(e,r,t,n,o,a)=>{const{ref:s,refs:i,required:l,maxLength:d,minLength:u,min:f,max:h,pattern:g,validate:v,name:p,valueAsNumber:y,mount:_}=e._f,S=ue(t,p);if(!_||r.has(p))return{};const C=i?i[0]:s,E=V=>{o&&C.reportValidity&&(C.setCustomValidity(mr(V)?"":V||""),C.reportValidity())},w={},N=cc(s),D=Qo(s),k=N||D,O=(y||lc(s))&&$t(s.value)&&$t(S)||ri(s)&&s.value===""||S===""||Array.isArray(S)&&!S.length,I=ic.bind(null,p,n,w),Y=(V,W,Z,J=nn.maxLength,H=nn.minLength)=>{const z=V?W:Z;w[p]={type:V?J:H,message:z,ref:s,...I(V?J:H,z)}};if(a?!Array.isArray(S)||!S.length:l&&(!k&&(O||tr(S))||mr(S)&&!S||D&&!Rh(i).isValid||N&&!$h(i).isValid)){const{value:V,message:W}=ai(l)?{value:!!l,message:l}:no(l);if(V&&(w[p]={type:nn.required,message:W,ref:C,...I(nn.required,W)},!n))return E(W),w}if(!O&&(!tr(f)||!tr(h))){let V,W;const Z=no(h),J=no(f);if(!tr(S)&&!isNaN(S)){const H=s.valueAsNumber||S&&+S;tr(Z.value)||(V=H>Z.value),tr(J.value)||(W=H<J.value)}else{const H=s.valueAsDate||new Date(S),z=$=>new Date(new Date().toDateString()+" "+$),ae=s.type=="time",ce=s.type=="week";Zr(Z.value)&&S&&(V=ae?z(S)>z(Z.value):ce?S>Z.value:H>new Date(Z.value)),Zr(J.value)&&S&&(W=ae?z(S)<z(J.value):ce?S<J.value:H<new Date(J.value))}if((V||W)&&(Y(!!V,Z.message,J.message,nn.max,nn.min),!n))return E(w[p].message),w}if((d||u)&&!O&&(Zr(S)||a&&Array.isArray(S))){const V=no(d),W=no(u),Z=!tr(V.value)&&S.length>+V.value,J=!tr(W.value)&&S.length<+W.value;if((Z||J)&&(Y(Z,V.message,W.message),!n))return E(w[p].message),w}if(g&&!O&&Zr(S)){const{value:V,message:W}=no(g);if(oi(V)&&!S.match(V)&&(w[p]={type:nn.pattern,message:W,ref:s,...I(nn.pattern,W)},!n))return E(W),w}if(v){if(Pr(v)){const V=await v(S,t),W=Vh(V,C);if(W&&(w[p]={...W,...I(nn.validate,W.message)},!n))return E(W.message),w}else if(Lt(v)){let V={};for(const W in v){if(!lr(V)&&!n)break;const Z=Vh(await v[W](S,t),C,W);Z&&(V={...Z,...I(W,Z.message)},E(Z.message),n&&(w[p]=V))}if(!lr(V)&&(w[p]={ref:C,...V},!n))return w}}return E(!0),w};const fk={mode:Ir.onSubmit,reValidateMode:Ir.onChange,shouldFocusError:!0};function pk(e={}){let r={...fk,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:Pr(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},n={},o=Lt(r.defaultValues)||Lt(r.values)?Ft(r.defaultValues||r.values)||{}:{},a=r.shouldUnregister?{}:Ft(o),s={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...u};const h={array:Th(),state:Th()},g=r.criteriaMode===Ir.all,v=A=>j=>{clearTimeout(d),d=setTimeout(A,j)},p=async A=>{if(!r.disabled&&(u.isValid||f.isValid||A)){const j=r.resolver?lr((await D()).errors):await O(n,!0);j!==t.isValid&&h.state.next({isValid:j})}},y=(A,j)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((A||Array.from(i.mount)).forEach(U=>{U&&(j?ct(t.validatingFields,U,j):Bt(t.validatingFields,U))}),h.state.next({validatingFields:t.validatingFields,isValidating:!lr(t.validatingFields)}))},_=(A,j=[],U,le,oe=!0,P=!0)=>{if(le&&U&&!r.disabled){if(s.action=!0,P&&Array.isArray(ue(n,A))){const K=U(ue(n,A),le.argA,le.argB);oe&&ct(n,A,K)}if(P&&Array.isArray(ue(t.errors,A))){const K=U(ue(t.errors,A),le.argA,le.argB);oe&&ct(t.errors,A,K),uk(t.errors,A)}if((u.touchedFields||f.touchedFields)&&P&&Array.isArray(ue(t.touchedFields,A))){const K=U(ue(t.touchedFields,A),le.argA,le.argB);oe&&ct(t.touchedFields,A,K)}(u.dirtyFields||f.dirtyFields)&&(t.dirtyFields=Xo(o,a)),h.state.next({name:A,isDirty:Y(A,j),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else ct(a,A,j)},S=(A,j)=>{ct(t.errors,A,j),h.state.next({errors:t.errors})},C=A=>{t.errors=A,h.state.next({errors:t.errors,isValid:!1})},E=(A,j,U,le)=>{const oe=ue(n,A);if(oe){const P=ue(a,A,$t(U)?ue(o,A):U);$t(P)||le&&le.defaultChecked||j?ct(a,A,j?P:zh(oe._f)):Z(A,P),s.mount&&p()}},w=(A,j,U,le,oe)=>{let P=!1,K=!1;const ve={name:A};if(!r.disabled){if(!U||le){(u.isDirty||f.isDirty)&&(K=t.isDirty,t.isDirty=ve.isDirty=Y(),P=K!==ve.isDirty);const ke=on(ue(o,A),j);K=!!ue(t.dirtyFields,A),ke?Bt(t.dirtyFields,A):ct(t.dirtyFields,A,!0),ve.dirtyFields=t.dirtyFields,P=P||(u.dirtyFields||f.dirtyFields)&&K!==!ke}if(U){const ke=ue(t.touchedFields,A);ke||(ct(t.touchedFields,A,U),ve.touchedFields=t.touchedFields,P=P||(u.touchedFields||f.touchedFields)&&ke!==U)}P&&oe&&h.state.next(ve)}return P?ve:{}},N=(A,j,U,le)=>{const oe=ue(t.errors,A),P=(u.isValid||f.isValid)&&mr(j)&&t.isValid!==j;if(r.delayError&&U?(l=v(()=>S(A,U)),l(r.delayError)):(clearTimeout(d),l=null,U?ct(t.errors,A,U):Bt(t.errors,A)),(U?!on(oe,U):oe)||!lr(le)||P){const K={...le,...P&&mr(j)?{isValid:j}:{},errors:t.errors,name:A};t={...t,...K},h.state.next(K)}},D=async A=>{y(A,!0);const j=await r.resolver(a,r.context,ok(A||i.mount,n,r.criteriaMode,r.shouldUseNativeValidation));return y(A),j},k=async A=>{const{errors:j}=await D(A);if(A)for(const U of A){const le=ue(j,U);le?ct(t.errors,U,le):Bt(t.errors,U)}else t.errors=j;return j},O=async(A,j,U={valid:!0})=>{for(const le in A){const oe=A[le];if(oe){const{_f:P,...K}=oe;if(P){const ve=i.array.has(P.name),ke=oe._f&&ak(oe._f);ke&&u.validatingFields&&y([le],!0);const L=await Hh(oe,i.disabled,a,g,r.shouldUseNativeValidation&&!j,ve);if(ke&&u.validatingFields&&y([le]),L[P.name]&&(U.valid=!1,j))break;!j&&(ue(L,P.name)?ve?dk(t.errors,L,P.name):ct(t.errors,P.name,L[P.name]):Bt(t.errors,P.name))}!lr(K)&&await O(K,j,U)}}return U.valid},I=()=>{for(const A of i.unMount){const j=ue(n,A);j&&(j._f.refs?j._f.refs.every(U=>!uc(U)):!uc(j._f.ref))&&ie(A)}i.unMount=new Set},Y=(A,j)=>!r.disabled&&(A&&j&&ct(a,A,j),!on($(),o)),V=(A,j,U)=>Ah(A,i,{...s.mount?a:$t(j)?o:Zr(A)?{[A]:j}:j},U,j),W=A=>tc(ue(s.mount?a:o,A,r.shouldUnregister?ue(o,A,[]):[])),Z=(A,j,U={})=>{const le=ue(n,A);let oe=j;if(le){const P=le._f;P&&(!P.disabled&&ct(a,A,Nh(j,P)),oe=ri(P.ref)&&tr(j)?"":j,Mh(P.ref)?[...P.ref.options].forEach(K=>K.selected=oe.includes(K.value)):P.refs?Qo(P.ref)?P.refs.forEach(K=>{(!K.defaultChecked||!K.disabled)&&(Array.isArray(oe)?K.checked=!!oe.find(ve=>ve===K.value):K.checked=oe===K.value||!!oe)}):P.refs.forEach(K=>K.checked=K.value===oe):lc(P.ref)?P.ref.value="":(P.ref.value=oe,P.ref.type||h.state.next({name:A,values:Ft(a)})))}(U.shouldDirty||U.shouldTouch)&&w(A,oe,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&ce(A)},J=(A,j,U)=>{for(const le in j){if(!j.hasOwnProperty(le))return;const oe=j[le],P=A+"."+le,K=ue(n,P);(i.array.has(A)||Lt(oe)||K&&!K._f)&&!On(oe)?J(P,oe,U):Z(P,oe,U)}},H=(A,j,U={})=>{const le=ue(n,A),oe=i.array.has(A),P=Ft(j);ct(a,A,P),oe?(h.array.next({name:A,values:Ft(a)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&U.shouldDirty&&h.state.next({name:A,dirtyFields:Xo(o,a),isDirty:Y(A,P)})):le&&!le._f&&!tr(P)?J(A,P,U):Z(A,P,U),Uh(A,i)&&h.state.next({...t,name:A}),h.state.next({name:s.mount?A:void 0,values:Ft(a)})},z=async A=>{s.mount=!0;const j=A.target;let U=j.name,le=!0;const oe=ue(n,U),P=ke=>{le=Number.isNaN(ke)||On(ke)&&isNaN(ke.getTime())||on(ke,ue(a,U,ke))},K=Bh(r.mode),ve=Bh(r.reValidateMode);if(oe){let ke,L;const te=j.type?zh(oe._f):Ch(A),ye=A.type===ti.BLUR||A.type===ti.FOCUS_OUT,Ze=!sk(oe._f)&&!r.resolver&&!ue(t.errors,U)&&!oe._f.deps||ck(ye,ue(t.touchedFields,U),t.isSubmitted,ve,K),mt=Uh(U,i,ye);ct(a,U,te),ye?(!j||!j.readOnly)&&(oe._f.onBlur&&oe._f.onBlur(A),l&&l(0)):oe._f.onChange&&oe._f.onChange(A);const Ct=w(U,te,ye),Qt=!lr(Ct)||mt;if(!ye&&h.state.next({name:U,type:A.type,values:Ft(a)}),Ze)return(u.isValid||f.isValid)&&(r.mode==="onBlur"?ye&&p():ye||p()),Qt&&h.state.next({name:U,...mt?{}:Ct});if(!ye&&mt&&h.state.next({...t}),r.resolver){const{errors:rr}=await D([U]);if(P(te),le){const Jt=Wh(t.errors,n,U),ee=Wh(rr,n,Jt.name||U);ke=ee.error,U=ee.name,L=lr(rr)}}else y([U],!0),ke=(await Hh(oe,i.disabled,a,g,r.shouldUseNativeValidation))[U],y([U]),P(te),le&&(ke?L=!1:(u.isValid||f.isValid)&&(L=await O(n,!0)));le&&(oe._f.deps&&ce(oe._f.deps),N(U,L,ke,Ct))}},ae=(A,j)=>{if(ue(t.errors,j)&&A.focus)return A.focus(),1},ce=async(A,j={})=>{let U,le;const oe=Jo(A);if(r.resolver){const P=await k($t(A)?A:oe);U=lr(P),le=A?!oe.some(K=>ue(P,K)):U}else A?(le=(await Promise.all(oe.map(async P=>{const K=ue(n,P);return await O(K&&K._f?{[P]:K}:K)}))).every(Boolean),!(!le&&!t.isValid)&&p()):le=U=await O(n);return h.state.next({...!Zr(A)||(u.isValid||f.isValid)&&U!==t.isValid?{}:{name:A},...r.resolver||!A?{isValid:U}:{},errors:t.errors}),j.shouldFocus&&!le&&ta(n,ae,A?oe:i.mount),le},$=A=>{const j={...s.mount?a:o};return $t(A)?j:Zr(A)?ue(j,A):A.map(U=>ue(j,U))},X=(A,j)=>({invalid:!!ue((j||t).errors,A),isDirty:!!ue((j||t).dirtyFields,A),error:ue((j||t).errors,A),isValidating:!!ue(t.validatingFields,A),isTouched:!!ue((j||t).touchedFields,A)}),we=A=>{A&&Jo(A).forEach(j=>Bt(t.errors,j)),h.state.next({errors:A?t.errors:{}})},_e=(A,j,U)=>{const le=(ue(n,A,{_f:{}})._f||{}).ref,oe=ue(t.errors,A)||{},{ref:P,message:K,type:ve,...ke}=oe;ct(t.errors,A,{...ke,...j,ref:le}),h.state.next({name:A,errors:t.errors,isValid:!1}),U&&U.shouldFocus&&le&&le.focus&&le.focus()},Se=(A,j)=>Pr(A)?h.state.subscribe({next:U=>"values"in U&&A(V(void 0,j),U)}):V(A,j,!0),ne=A=>h.state.subscribe({next:j=>{lk(A.name,j.name,A.exact)&&ik(j,A.formState||u,Me,A.reRenderRoot)&&A.callback({values:{...a},...t,...j,defaultValues:o})}}).unsubscribe,se=A=>(s.mount=!0,f={...f,...A.formState},ne({...A,formState:f})),ie=(A,j={})=>{for(const U of A?Jo(A):i.mount)i.mount.delete(U),i.array.delete(U),j.keepValue||(Bt(n,U),Bt(a,U)),!j.keepError&&Bt(t.errors,U),!j.keepDirty&&Bt(t.dirtyFields,U),!j.keepTouched&&Bt(t.touchedFields,U),!j.keepIsValidating&&Bt(t.validatingFields,U),!r.shouldUnregister&&!j.keepDefaultValue&&Bt(o,U);h.state.next({values:Ft(a)}),h.state.next({...t,...j.keepDirty?{isDirty:Y()}:{}}),!j.keepIsValid&&p()},pe=({disabled:A,name:j})=>{(mr(A)&&s.mount||A||i.disabled.has(j))&&(A?i.disabled.add(j):i.disabled.delete(j))},Ce=(A,j={})=>{let U=ue(n,A);const le=mr(j.disabled)||mr(r.disabled);return ct(n,A,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:A}},name:A,mount:!0,...j}}),i.mount.add(A),U?pe({disabled:mr(j.disabled)?j.disabled:r.disabled,name:A}):E(A,!0,j.value),{...le?{disabled:j.disabled||r.disabled}:{},...r.progressive?{required:!!j.required,min:ea(j.min),max:ea(j.max),minLength:ea(j.minLength),maxLength:ea(j.maxLength),pattern:ea(j.pattern)}:{},name:A,onChange:z,onBlur:z,ref:oe=>{if(oe){Ce(A,j),U=ue(n,A);const P=$t(oe.value)&&oe.querySelectorAll&&oe.querySelectorAll("input,select,textarea")[0]||oe,K=tk(P),ve=U._f.refs||[];if(K?ve.find(ke=>ke===P):P===U._f.ref)return;ct(n,A,{_f:{...U._f,...K?{refs:[...ve.filter(uc),P,...Array.isArray(ue(o,A))?[{}]:[]],ref:{type:P.type,name:A}}:{ref:P}}}),E(A,!1,void 0,P)}else U=ue(n,A,{}),U._f&&(U._f.mount=!1),(r.shouldUnregister||j.shouldUnregister)&&!(Eh(i.array,A)&&s.action)&&i.unMount.add(A)}}},de=()=>r.shouldFocusError&&ta(n,ae,i.mount),Ne=A=>{mr(A)&&(h.state.next({disabled:A}),ta(n,(j,U)=>{const le=ue(n,U);le&&(j.disabled=le._f.disabled||A,Array.isArray(le._f.refs)&&le._f.refs.forEach(oe=>{oe.disabled=le._f.disabled||A}))},0,!1))},R=(A,j)=>async U=>{let le;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let oe=Ft(a);if(h.state.next({isSubmitting:!0}),r.resolver){const{errors:P,values:K}=await D();t.errors=P,oe=Ft(K)}else await O(n);if(i.disabled.size)for(const P of i.disabled)Bt(oe,P);if(Bt(t.errors,"root"),lr(t.errors)){h.state.next({errors:{}});try{await A(oe,U)}catch(P){le=P}}else j&&await j({...t.errors},U),de(),setTimeout(de);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:lr(t.errors)&&!le,submitCount:t.submitCount+1,errors:t.errors}),le)throw le},We=(A,j={})=>{ue(n,A)&&($t(j.defaultValue)?H(A,Ft(ue(o,A))):(H(A,j.defaultValue),ct(o,A,Ft(j.defaultValue))),j.keepTouched||Bt(t.touchedFields,A),j.keepDirty||(Bt(t.dirtyFields,A),t.isDirty=j.defaultValue?Y(A,Ft(ue(o,A))):Y()),j.keepError||(Bt(t.errors,A),u.isValid&&p()),h.state.next({...t}))},st=(A,j={})=>{const U=A?Ft(A):o,le=Ft(U),oe=lr(A),P=oe?o:le;if(j.keepDefaultValues||(o=U),!j.keepValues){if(j.keepDirtyValues){const K=new Set([...i.mount,...Object.keys(Xo(o,a))]);for(const ve of Array.from(K))ue(t.dirtyFields,ve)?ct(P,ve,ue(a,ve)):H(ve,ue(P,ve))}else{if(ec&&$t(A))for(const K of i.mount){const ve=ue(n,K);if(ve&&ve._f){const ke=Array.isArray(ve._f.refs)?ve._f.refs[0]:ve._f.ref;if(ri(ke)){const L=ke.closest("form");if(L){L.reset();break}}}}if(j.keepFieldsRef)for(const K of i.mount)H(K,ue(P,K));else n={}}a=r.shouldUnregister?j.keepDefaultValues?Ft(o):{}:Ft(P),h.array.next({values:{...P}}),h.state.next({values:{...P}})}i={mount:j.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!j.keepIsValid||!!j.keepDirtyValues,s.watch=!!r.shouldUnregister,h.state.next({submitCount:j.keepSubmitCount?t.submitCount:0,isDirty:oe?!1:j.keepDirty?t.isDirty:!!(j.keepDefaultValues&&!on(A,o)),isSubmitted:j.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:oe?{}:j.keepDirtyValues?j.keepDefaultValues&&a?Xo(o,a):t.dirtyFields:j.keepDefaultValues&&A?Xo(o,A):j.keepDirty?t.dirtyFields:{},touchedFields:j.keepTouched?t.touchedFields:{},errors:j.keepErrors?t.errors:{},isSubmitSuccessful:j.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Le=(A,j)=>st(Pr(A)?A(a):A,j),Fe=(A,j={})=>{const U=ue(n,A),le=U&&U._f;if(le){const oe=le.refs?le.refs[0]:le.ref;oe.focus&&(oe.focus(),j.shouldSelect&&Pr(oe.select)&&oe.select())}},Me=A=>{t={...t,...A}},Xe={control:{register:Ce,unregister:ie,getFieldState:X,handleSubmit:R,setError:_e,_subscribe:ne,_runSchema:D,_focusError:de,_getWatch:V,_getDirty:Y,_setValid:p,_setFieldArray:_,_setDisabledField:pe,_setErrors:C,_getFieldArray:W,_reset:st,_resetDefaultValues:()=>Pr(r.defaultValues)&&r.defaultValues().then(A=>{Le(A,r.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:I,_disableForm:Ne,_subjects:h,_proxyFormState:u,get _fields(){return n},get _formValues(){return a},get _state(){return s},set _state(A){s=A},get _defaultValues(){return o},get _names(){return i},set _names(A){i=A},get _formState(){return t},get _options(){return r},set _options(A){r={...r,...A}}},subscribe:se,trigger:ce,register:Ce,handleSubmit:R,watch:Se,setValue:H,getValues:$,reset:Le,resetField:We,clearErrors:we,unregister:ie,setError:_e,setFocus:Fe,getFieldState:X};return{...Xe,formControl:Xe}}function Yh(e={}){const r=b.useRef(void 0),t=b.useRef(void 0),[n,o]=b.useState({isDirty:!1,isValidating:!1,isLoading:Pr(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Pr(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:n},e.defaultValues&&!Pr(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...i}=pk(e);r.current={...i,formState:n}}const a=r.current.control;return a._options=e,ac(()=>{const s=a._subscribe({formState:a._proxyFormState,callback:()=>o({...a._formState}),reRenderRoot:!0});return o(i=>({...i,isReady:!0})),a._formState.isReady=!0,s},[a]),b.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),b.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),b.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),b.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),b.useEffect(()=>{if(a._proxyFormState.isDirty){const s=a._getDirty();s!==n.isDirty&&a._subjects.state.next({isDirty:s})}},[a,n.isDirty]),b.useEffect(()=>{e.values&&!on(e.values,t.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),t.current=e.values,o(s=>({...s}))):a._resetDefaultValues()},[a,e.values]),b.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),r.current.formState=Dh(n,a),r.current}const qh=(e,r,t)=>{if(e&&"reportValidity"in e){const n=ue(t,r);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},dc=(e,r)=>{for(const t in r.fields){const n=r.fields[t];n&&n.ref&&"reportValidity"in n.ref?qh(n.ref,t,e):n&&n.refs&&n.refs.forEach(o=>qh(o,t,e))}},Zh=(e,r)=>{r.shouldUseNativeValidation&&dc(e,r);const t={};for(const n in e){const o=ue(r.fields,n),a=Object.assign(e[n]||{},{ref:o&&o.ref});if(hk(r.names||Object.keys(e),n)){const s=Object.assign({},ue(t,n));ct(s,"root",a),ct(t,n,s)}else ct(t,n,a)}return t},hk=(e,r)=>{const t=Gh(r);return e.some(n=>Gh(n).match(`^${t}\\.\\d+`))};function Gh(e){return e.replace(/\]|\[/g,"")}function Kh(e,r){try{var t=e()}catch(n){return r(n)}return t&&t.then?t.then(void 0,r):t}function mk(e,r){for(var t={};e.length;){var n=e[0],o=n.code,a=n.message,s=n.path.join(".");if(!t[s])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];t[s]={message:i.message,type:i.code}}else t[s]={message:a,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(u){return u.errors.forEach(function(f){return e.push(f)})}),r){var l=t[s].types,d=l&&l[n.code];t[s]=ic(s,r,t,o,d?[].concat(d,n.message):n.message)}e.shift()}return t}function gk(e,r){for(var t={};e.length;){var n=e[0],o=n.code,a=n.message,s=n.path.join(".");if(!t[s])if(n.code==="invalid_union"&&n.errors.length>0){var i=n.errors[0][0];t[s]={message:i.message,type:i.code}}else t[s]={message:a,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(u){return u.forEach(function(f){return e.push(f)})}),r){var l=t[s].types,d=l&&l[n.code];t[s]=ic(s,r,t,o,d?[].concat(d,n.message):n.message)}e.shift()}return t}function vk(e,r,t){if(t===void 0&&(t={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,a){try{return Promise.resolve(Kh(function(){return Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](n,r)).then(function(s){return a.shouldUseNativeValidation&&dc({},a),{errors:{},values:t.raw?Object.assign({},n):s}})},function(s){if((function(i){return Array.isArray(i?.issues)})(s))return{values:{},errors:Zh(mk(s.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw s}))}catch(s){return Promise.reject(s)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,a){try{return Promise.resolve(Kh(function(){return Promise.resolve((t.mode==="sync"?A_:k_)(e,n,r)).then(function(s){return a.shouldUseNativeValidation&&dc({},a),{errors:{},values:t.raw?Object.assign({},n):s}})},function(s){if((function(i){return i instanceof Il})(s))return{values:{},errors:Zh(gk(s.issues,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw s}))}catch(s){return Promise.reject(s)}};throw new Error("Invalid input: not a Zod schema")}const Qh=/^((1[0-2]|0?[1-9]):[0-5][0-9]\s?([AaPp]\.?[Mm]\.?))|^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/,Jh=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),a=t.replace(/[a-z]/g,""),[s,i]=a.split(":");if(!s||!i)return null;let l=parseInt(s,10);const d=parseInt(i,10);n&&l<12&&(l+=12),o&&l===12&&(l=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,l,d);return x.isValid(g)?g:null},yk=Zp({UsuarioID:Ys().nullable().optional(),disID:Ys().nullable().optional(),EsOrganizador:qo().default(!1),Correo:_r().email("Formato de correo inválido"),StatusInvitacion:Gp(["PENDIENTE","CONFIRMADA","RECHAZADA"]).default("PENDIENTE")}),bk=Zp({titulo:_r().min(1,"El campo Título es requerido.").refine(e=>!e.startsWith(" "),{message:"El título no puede empezar con un espacio en blanco"}),fechaInicio:_r().min(1,"El campo fecha inicio es requerido."),horaInicio:_r().min(1,"La hora de inicio es requerida.").regex(Qh,{message:"Formato inválido (ej: 10:30am o 13:30)"}),horaFin:_r().min(1,"La hora fin es requerida.").regex(Qh,{message:"Formato inválido"}),todoElDia:qo(),fechaFin:_r().optional(),showEndDate:qo().optional(),horaInicio2:_r().optional(),TodoElDia2:qo().optional(),client:_r().nullable().optional(),repetir:_r().optional(),incluirMeet:qo().default(!1),link:_r().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(iD("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:_r().optional(),invitados:qp(yk).optional().default([]),color:_r().optional(),solID:Ys().nullable().optional(),disID:Ys().nullable().optional()}).refine(e=>e.showEndDate?e.fechaFin&&e.fechaFin.length>0:!0,{message:"La fecha de fin es requerida.",path:["fechaFin"]}).refine(e=>e.fechaFin!==void 0?!!e.fechaFin&&!!e.horaInicio2:!0,{message:"La hora de fin son requeridas.",path:["horaInicio2"]}).refine(e=>{if(e.todoElDia||!e.fechaInicio||!e.horaInicio||!e.fechaFin||!e.horaInicio2)return!0;const r=Jh(e.fechaInicio,e.horaInicio),t=Jh(e.fechaFin,e.horaFin);return!r||!t?!1:x.isAfter(t,r)},{message:"",path:["horaFin"]}),xk=e=>M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},M.createElement("path",{fill:"#333",d:"M12 24C5.38 24 0 18.608 0 12S5.38 0 12 0s12 5.38 12 12-5.38 12-12 12"}),M.createElement("path",{fill:"#fff",d:"M16.703 7.275c.52.52.541 1.345.046 1.84l-2.874 2.874 2.874 2.873c.495.496.475 1.32-.046 1.841-.52.52-1.344.54-1.84.045l-2.873-2.873-2.874 2.873c-.496.496-1.32.475-1.84-.045-.521-.521-.541-1.345-.046-1.84l2.874-2.874L7.23 9.116c-.495-.496-.475-1.32.045-1.84.521-.521 1.345-.542 1.841-.046l2.874 2.873 2.873-2.873c.496-.496 1.32-.476 1.84.045"})),wk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cg%20fill='%23404756'%20clip-path='url(%23a)'%3e%3cpath%20d='M7.288%2022.986h-.147a6.2%206.2%200%200%201-4.28-1.85c-2.404-2.404-2.478-6.24-.16-8.557L4.28%2011a1.228%201.228%200%201%201%201.739%201.739L4.44%2014.317c-1.356%201.357-1.282%203.626.16%205.068a3.82%203.82%200%200%200%202.602%201.135c.95%200%201.825-.32%202.479-.974l1.578-1.579a1.23%201.23%200%200%201%201.739%200c.48.481.48%201.258%200%201.739l-1.579%201.578c-1.097%201.098-2.552%201.69-4.13%201.69zM17.98%2012.998a1.23%201.23%200%200%201%200-1.739l1.578-1.578c.654-.654.986-1.53.974-2.466a3.78%203.78%200%200%200-1.134-2.602c-1.443-1.443-3.712-1.517-5.068-.16L12.75%206.03c-.48.48-1.258.48-1.739%200a1.23%201.23%200%200%201%200-1.739l1.579-1.578c2.318-2.319%206.153-2.245%208.558.16a6.23%206.23%200%200%201%201.85%204.279%205.84%205.84%200%200%201-1.69%204.279l-1.578%201.578c-.481.481-1.258.481-1.74%200z'/%3e%3cpath%20d='M14.172%208.11%208.07%2014.214a1.233%201.233%200%200%200%201.743%201.744l6.104-6.104a1.233%201.233%200%201%200-1.744-1.744'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",_k=e=>M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},M.createElement("g",{clipPath:"url(#a)"},M.createElement("path",{fill:"#404756",d:"M21.24 5.72a2.98 2.98 0 0 0-2.97-2.96l-5.19-.06c-1.06-.03-2.12.41-2.87 1.17l-7.49 7.49c-.66.66-1.03 1.54-1.03 2.47s.36 1.81 1.03 2.47l4.97 4.97a3.5 3.5 0 0 0 2.47 1.02c.89 0 1.79-.34 2.47-1.02l7.49-7.49c.76-.76 1.18-1.81 1.17-2.88l-.06-5.19zm-4.2 4.43c-.44.44-1.02.66-1.6.66a2.256 2.256 0 1 1 0-4.51 2.256 2.256 0 0 1 1.6 3.85"})),M.createElement("defs",null,M.createElement("clipPath",{id:"a"},M.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),Xh="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23E40B1C'%20d='M20.36%204.14H16c0-1.65-1.35-3-3-3h-2c-1.65%200-3%201.35-3%203H3.64c-.55%200-1%20.45-1%201s.45%201%201%201h1.04l.84%2013.91a3%203%200%200%200%202.99%202.82h6.98c1.58%200%202.9-1.24%203-2.82l.84-13.91h1.04c.55%200%201-.45%201-1s-.45-1-1-1zm-9.36-1h2c.55%200%201%20.45%201%201h-4c0-.55.45-1%201-1m-.39%2014.9c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201zm4.78%200c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201z'/%3e%3c/svg%3e",Sk=e=>M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},M.createElement("g",{fill:"#2571D6",clipPath:"url(#a)"},M.createElement("path",{d:"M13.085 7.331a1.096 1.096 0 1 0-2.192 0v9.316a1.096 1.096 0 0 0 2.192 0z"}),M.createElement("path",{d:"M16.647 10.893H7.33a1.096 1.096 0 1 0 0 2.192h9.316a1.096 1.096 0 0 0 0-2.192"}),M.createElement("path",{d:"M12 24C5.38 24 0 18.608 0 12S5.38 0 12 0s12 5.38 12 12-5.38 12-12 12m0-21.808c-5.414 0-9.808 4.394-9.808 9.808S6.586 21.808 12 21.808s9.808-4.394 9.808-9.808S17.403 2.192 12 2.192"})),M.createElement("defs",null,M.createElement("clipPath",{id:"a"},M.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),Ck="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cg%20fill='%23404756'%20clip-path='url(%23a)'%3e%3cpath%20d='M13.789%2017H3.21C2.542%2017%202%2017.56%202%2018.25s.542%201.25%201.211%201.25H13.79c.669%200%201.211-.56%201.211-1.25S14.458%2017%2013.789%2017M20.718%204H3.282C2.574%204%202%204.56%202%205.25S2.574%206.5%203.282%206.5h17.436C21.426%206.5%2022%205.94%2022%205.25S21.426%204%2020.718%204M20.718%2010.5H3.282C2.574%2010.5%202%2011.06%202%2011.75S2.574%2013%203.282%2013h17.436c.708%200%201.282-.56%201.282-1.25s-.574-1.25-1.282-1.25'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";var ra={},e0;function Ek(){if(e0)return ra;e0=1;var e=lt();Object.defineProperty(ra,"__esModule",{value:!0}),ra.default=void 0;var r=e(ht()),t=dt();return ra.default=(0,r.default)((0,t.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),ra}var Dk=Ek();const t0=it(Dk);var na={},r0;function Ak(){if(r0)return na;r0=1;var e=lt();Object.defineProperty(na,"__esModule",{value:!0}),na.default=void 0;var r=e(ht()),t=dt();return na.default=(0,r.default)((0,t.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),na}var kk=Ak();const Tk=it(kk),n0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC",o0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",Mk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAGFBMVEUAAAAAfFQAflYAfVYAfVUAfFQAcFAAfVbb6xt6AAAAB3RSTlMAIN98m0wQyLlfvgAAAE1JREFUGNNjoAgwmiJxhMoDEBLq5QZIEkUCSBKKeCXYYBJgMQeEBHN5CUIHa3m5A8Io8/ISiAREHRAAJWBSSHYwgyXgUjAJsIGGpPkcAJCLE29yhAT7AAAAAElFTkSuQmCC",Ik=e=>{const r=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],t=e.charCodeAt(0)%r.length;return r[t]},Ok=(e,r,t,n,o,a)=>{if(r)return c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[c.jsx("img",{src:o0,width:15,style:{marginRight:"5px"}}),c.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return c.jsx(m.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return a?c.jsx(m.Button,{onClick:()=>{n(t),o()},variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"}):null;case"CONFIRMADA":return c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[c.jsx("img",{src:Mk,width:15,style:{marginRight:"5px"}}),c.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Asistiré"})]});default:return null}};function Pk({open:e,handleClose:r,guests:t,onReenviar:n,esOrganizador:o}){const a=t.filter(u=>u.estatus==="CONFIRMADA"||u.isHost),s=t.filter(u=>u.estatus==="PENDIENTE"&&!u.isHost),i=t.filter(u=>u.estatus==="RECHAZADA"&&!u.isHost),l=u=>c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[c.jsxs(m.Box,{sx:{position:"relative",mr:2},children:[c.jsx(m.Avatar,{sx:{bgcolor:Ik(u.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:u.iniciales}),u.estatus==="PENDIENTE"&&c.jsx(m.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:c.jsx($l,{sx:{fontSize:14,color:"#546E7A"}})})]}),c.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:u.nombre}),Ok(u.estatus,u.isHost,u.usrID,n,r,o)]},u.nombre),d=({title:u,count:f,badgeColor:h})=>c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[c.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:u}),h&&c.jsx(m.Box,{sx:{ml:1,bgcolor:h,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:f})]});return c.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[c.jsxs(m.Box,{sx:{p:"16px 8px"},children:[c.jsx(m.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),c.jsx(m.Button,{onClick:r,startIcon:c.jsx("img",{src:n0,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),c.jsx(m.IconButton,{onClick:r,sx:{position:"absolute",right:8,top:12},children:c.jsx(Tr,{})})]}),c.jsxs(m.DialogContent,{sx:{p:2},children:[s.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(m.Divider,{sx:{backgroundColor:"black"}}),c.jsxs(m.Box,{sx:{mb:3},children:[c.jsx(d,{title:"Invitados",count:s.length}),s.map(l)]})]}),a.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),c.jsxs(m.Box,{sx:{mb:3},children:[c.jsx(d,{title:"Confirmados",count:a.length,badgeColor:"#1976D2"}),a.map(l)]})]}),i.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),c.jsxs(m.Box,{children:[c.jsx(d,{title:"No asistirán",count:i.length,badgeColor:"#1976D2"}),i.map(l)]})]})]})]})}const jk=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function Rk({guests:e,onReenviar:r,esOrganizador:t}){const[n,o]=b.useState(!1),a=()=>o(!0),s=()=>o(!1);return c.jsxs(c.Fragment,{children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[c.jsx(m.AvatarGroup,{max:9,sx:{"& .MuiAvatar-root":{width:32,height:32,fontSize:13,fontWeight:"bold",border:"2px solid #fff",marginLeft:"-8px !important"},"& .MuiBadge-root":{borderRadius:"50%"}},children:e.map((i,l)=>c.jsx(m.Tooltip,{title:i.nombre,arrow:!0,placement:"top",children:c.jsx(m.Box,{children:c.jsx(m.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:i.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:c.jsx(m.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:c.jsx("img",{src:op})}),children:c.jsx(m.Avatar,{sx:{bgcolor:jk(i.iniciales)},children:i.iniciales})})})},l))}),c.jsx(m.Box,{sx:{flexGrow:1}}),c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:a,children:[c.jsx(m.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),c.jsx(Tk,{sx:{fontSize:18,ml:.5}})]})]}),c.jsx(Pk,{open:n,handleClose:s,guests:e,onReenviar:r,esOrganizador:t})]})}var oa={},a0;function Nk(){if(a0)return oa;a0=1;var e=lt();Object.defineProperty(oa,"__esModule",{value:!0}),oa.default=void 0;var r=e(ht()),t=dt();return oa.default=(0,r.default)((0,t.jsx)("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"AddCircleOutline"),oa}var Lk=Nk();const $k=it(Lk),zk=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),s0=e=>{const[r,t]=e.split(":"),n=parseInt(r),o=n>=12?"pm":"am";return`${n%12||12}:${t} ${o}`},i0=e=>e.split(":").slice(0,2).join(":"),Bk=({slot:e,onClick:r})=>c.jsxs(m.Box,{onClick:r,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #000000",textAlign:"center",transition:"0.2s",backgroundColor:"#fff","&:hover":{transform:"translateY(-3px)",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",borderColor:"#1976d2"}},children:[c.jsx(m.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:c.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:zk(e.Fecha)})}),c.jsxs(m.Box,{sx:{py:1.5},children:[c.jsx(m.Typography,{sx:{fontSize:"12px"},children:s0(e.HoraInicio)}),c.jsxs(m.Typography,{sx:{fontSize:"12px"},children:["a ",s0(e.HoraFin)]})]})]});function Fk({open:e,handleClose:r,suggestions:t,onSelectSlot:n}){const[o,a]=b.useState(16),i=t.slice(0,o).reduce((u,f)=>{const h=f.Fecha;return u[h]||(u[h]=[]),u[h].push(f),u},{}),l=Object.keys(i),d=u=>{const f={...u,HoraInicio:i0(u.HoraInicio),HoraFin:i0(u.HoraFin)};n(f),r()};return b.useEffect(()=>{a(16)},[e]),c.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[c.jsxs(m.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[c.jsx(m.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),c.jsx(m.Box,{children:c.jsx(m.Button,{startIcon:c.jsx("img",{src:n0,width:20}),onClick:r,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"1rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),c.jsx(m.Divider,{sx:{backgroundColor:"black"}}),c.jsx(m.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:l.length===0?c.jsx(m.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):c.jsxs(c.Fragment,{children:[l.map((u,f)=>c.jsxs(b.Fragment,{children:[" ",c.jsxs(m.Box,{sx:{mb:3},children:[c.jsxs(m.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:2,display:"flex",alignItems:"center",color:f===0?"#1976d2":"text.primary",fontSize:"0.9rem"},children:[f===0?"Mismo día ":"Próximas fechas",f===0&&c.jsx("img",{src:o0,width:15,style:{marginLeft:5}})]}),c.jsx(m.Grid,{container:!0,spacing:2,children:i[u].map((h,g)=>c.jsx(m.Grid,{item:!0,xs:6,sm:3,children:c.jsx(Bk,{slot:h,onClick:()=>d(h)})},`${u}-${g}`))})]}),f===0&&l.length>1&&c.jsx(m.Divider,{sx:{mb:4,mt:1,borderBottomWidth:2,backgroundColor:"#000000"}})]},u)),t.length>o&&c.jsx(m.Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:c.jsx(m.Button,{onClick:()=>a(u=>u+12),startIcon:c.jsx($k,{}),sx:{textTransform:"none",fontWeight:"bold",color:"#1976d2","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Mostrar más horarios disponibles"})})]})})]})}const Uk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",Wk=e=>{const r=["brown","purple","orange","blue","green","yellow","red","grey"],t=e.charCodeAt(0)%r.length;return r[t]};function Vk({onSelectGuest:e,availableSuggestions:r,onInputTextChange:t}){const[n,o]=b.useState(null),[a,s]=b.useState(""),i=(d,u)=>{u?(e(u),o(null),s("")):(o(null),s(""))},l=(d,u)=>{s(u),t(u)};return c.jsx(m.Autocomplete,{options:r,value:n,inputValue:a,getOptionLabel:d=>d.correo,onChange:i,onInputChange:l,isOptionEqualToValue:(d,u)=>d.correo===u.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:d=>c.jsx(m.TextField,{...d,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...d.InputProps,startAdornment:c.jsx(m.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:c.jsx("img",{src:Uk,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(d,u)=>b.createElement(m.Box,{component:"li",...d,key:u.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},c.jsx(m.Avatar,{sx:{bgcolor:Wk(u.iniciales),mr:2,width:32,height:32,fontSize:14},children:u.iniciales}),c.jsx(m.Typography,{children:u.nombre}))},"guest-autocomplete-field")}var aa={},l0;function Hk(){if(l0)return aa;l0=1;var e=lt();Object.defineProperty(aa,"__esModule",{value:!0}),aa.default=void 0;var r=e(ht()),t=dt();return aa.default=(0,r.default)((0,t.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline"),aa}var Yk=Hk();const qk=it(Yk);var sa={},c0;function Zk(){if(c0)return sa;c0=1;var e=lt();Object.defineProperty(sa,"__esModule",{value:!0}),sa.default=void 0;var r=e(ht()),t=dt();return sa.default=(0,r.default)((0,t.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline"),sa}var Gk=Zk();const fc=it(Gk),Kk=e=>e.tieneConflicto?{icon:c.jsx(fc,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:c.jsx(qk,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},Qk=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function Jk({guests:e,conflictCount:r,onViewSuggestions:t,onDeleteGuest:n}){const o=s=>i=>{i.stopPropagation(),n(s)},a=s=>s?s.trim().split(/\s+/).slice(0,2).join(" "):"";return c.jsxs(m.Box,{sx:{p:1},children:[c.jsx(m.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((s,i)=>{const l=Kk(s),d=Qk(s.iniciales),u=s.email||s.correo||s.nombre;return c.jsx(m.Chip,{label:c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[c.jsx(m.Tooltip,{title:u,arrow:!0,placement:"top",children:c.jsx(m.Typography,{variant:"body2",sx:{color:l.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:a(s?.nombre)})}),c.jsx(m.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:l.icon})]}),avatar:c.jsx(m.Avatar,{sx:{bgcolor:d,width:24,height:24,fontSize:"10px",fontWeight:"bold",color:"#ffffff !important",ml:"4px !important"},children:s.iniciales}),sx:{backgroundColor:l.fillColor,height:"32px",borderRadius:"100px",border:"1px solid rgba(0,0,0,0.04)",transition:"all 0.2s ease-in-out",cursor:"pointer","&:hover":{backgroundColor:l.fillColor,filter:"brightness(0.97)","& .status-icon-wrapper":{display:"none"},"& .MuiChip-deleteIcon":{display:"inline-block"}},"& .MuiChip-label":{paddingLeft:"4px",paddingRight:"8px",width:"100%",display:"flex"},"& .MuiChip-deleteIcon":{display:"none",fontSize:"18px",color:"#000000",ml:"auto",mr:"4px","&:hover":{color:"#000000"}}},onDelete:o(s.nombre)},i)})}),r>0&&c.jsxs(m.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[c.jsx(fc,{sx:{mr:1,fontSize:22}}),c.jsxs(m.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",c.jsxs("strong",{children:[r," invitado"]}),r!==1?"s":""]})]}),c.jsx(m.Link,{component:"button",type:"button",variant:"body2",onClick:s=>{s.preventDefault(),s.stopPropagation(),t()},sx:{ml:4,textAlign:"left",textDecoration:"underline",fontWeight:700,fontSize:"15px",color:"#1976D2",border:"none",background:"none",padding:0,cursor:"pointer","&:hover":{color:"#1565C0"}},children:"Ver sugerencias de horario"})]})]})}function Xk(e,r){const[t,n]=b.useState(e);return b.useEffect(()=>{const o=setTimeout(()=>{n(e)},r);return()=>{clearTimeout(o)}},[e,r]),t}var ia={},u0;function e3(){if(u0)return ia;u0=1;var e=lt();Object.defineProperty(ia,"__esModule",{value:!0}),ia.default=void 0;var r=e(ht()),t=dt();return ia.default=(0,r.default)((0,t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search"),ia}var t3=e3();const r3=it(t3),n3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAgCAYAAACYTcH3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAMwSURBVFhH7ZZdSFRpGMd/1TrIHNZxglqYymLaDdmLscWBOBIzEUowN97owvZBElKbWLM4smNUSESkhG3SbvQh7S5rX4xI3sxFSWBEXqREc2FaroTuDrUik8YRG7G6aEbnPDPnDEFsXfiDF+Z9/s8Zfry873vOkslXr9/ymbBUFj4lizJGLMoYsShjRFaZ+LMemoK11B7pIKLJ9OOyxOzS0wavcaQxzMhcopBXQsPZ/ahzA4Su3ufFG/EAQO4KXN4teNbbZJIVQ5k0kSQJoeLxDoLBrvQ8gd3r57cDbhQZmJBRxlAkSVJoLMzFO1F9FntKz8MocayUHb1AbZE+NiNdZqKbYM2fDBqJJMkr5fil3biWyQB6z+yi6R4opYe4+uO3MjYkbQNHOkNCxIpT9aKut6YWYaqbK7cm9bUEqloCgNb7gIgMTRAyUYYeT+tLBT4CgWoaDlXhWWXFkhINDj1NmaVQtJHiZYB2n5sdvdy9N8CLWdmUTtrK6FhXzi/N5awGyFcJtDbyfYFsykCuG9UFME3/9XO0nDnJ3mPdxGSf4AtZWMBB5cEKnDlRbp9o5cqohj1f4Z9R2ddHS0Urd2VZMhMnLmsCk5Wxsjwv+XsWbWKSkb+jWf8wE05fDc0/+/hKBgITmWHCncNoOCg7fJpQezOBrQ7dnjHCkmfDnp8zP5+1rqVwpa4lIyYyMBY+RpW/jZuPxonnOvDUNHN0mzhVKSheP6EbfxG6/Ct/tNXgSdTHnou7yABTGYD4vz38fryOHaf6iAMu10bZMk/hd0VYkvfOjMaHvspMZZzbfmCnz4uquin3fIMFiI3/J9vm6T+7j6p9te9HdRv9siELJjIOist8VO6ppiHgZ+cmG/FnYU53DsvGBeZmiU1Mvh8zMsyOiUyUUP0uKuu7GAEY7aCu/hqRKdn38RDvpiihuiDt4i6xb3CzZqqPyHN9nc1+un4qQns5rT/yfZeoOv9I9LlTOzIiVkZByXBYYk8yiACKYgVyUPJt2FPHlx/y4bCAkLHh27ub4pULd4QRloJSGrYbvJFXr6UwNznJwfm1Q58bkP4J8Qkx2cD/P4syRnxWMu8A780N97kmJqMAAAAASUVORK5CYII=",o3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAbCAYAAABr/T8RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAP4SURBVEhLxZZdSJtXGMd/XZYgCUYdJErmZpc668Qtg2QXcaO2UBFCIUESpO0KWpCWaS/W2SrMKm1F6srcZA66TlzH3KRL6QeygCiIZZus0wtlqOuqa+oHflxYLSmtEraL9zV5c/JGLYzud3XO8z/v+eecPOc8Z8fKo6f/8D/wghh4Xux4lhWvra4w8/cYM4+AZAtvvmYhzagVh22LrY0fBum9fgV/7z0W1kUR0JrILXJzrKQQa6ooJiaxcXiF0asXOX89yJqoqaLFWlJNfWkeaRpRi0fdOHSPznNN+CflJSZZcHo8eN6zYc3QowNgndB8kOGff+LHm0NMP5GG6na5OV/vJdegmE+FeOPwHP6aGjrvs/1ViLuz08uXzW4yN/kmLqtHO87Kpnrslc18dmgLUwBNCm8daqSt0oYB4P41TneMiaNiiDWevcXlnscAvOJtoH6fKUbeivR91XzitQAQ6vkW/6w4IkqM8Wh3gGkAs4uTPmmCZyXT9wEeM8AcN7oTrzpqHB6it19arcHxDlaV7V2bH6StpoqyY1WU1bRze17lfGmyyM2RmqH+AQbD4gCJaHJNdlFWE2AZQGPC6XNTkCHlLwCLd+i4OsSyciJNCs7SwxSYo6Gn83fw+4dYCAOk4Gluo3yX4huZqPFgK+5Ph0RdQI+9opHa4lSWe1r58OsRQuIQAedH31HrFKOKrZ6ZnYtVVHmbomITOrSkF+/FLsoqJJo3Ypz58kYymSg61cKV9jYuN1VT7somPXId/8XohPS/hn77neGNsNaCveQg9U3yd6cKSZel6LyxvBhpJadiAELoycwykZYKpNrw5NjwHAnirztL5+QSgbqj9Bm1rK1KP8CQf5DGj11YlbUiyyKdZ/SkJSviCqJZnb2TXACCjI4L2arNwtdUjcsodTdMMbtoPCOYAmvjY0wB8DrW7Fhtg6hxUgF7HVJzuLdXym4lmjzKj9hiQvZSr8qxm+NW94jUdLxLYZKoSyguEC17DuyXtuhuF1/IZ1qJ7o08rJFeNg5bfC0O9f9A5wMAPa4DTrmgxBN7Zeb7OOHUAzB8qYlvJgTzDDOZkY5ZygMFoYku6i5JqzU4K3g/P1ZXIhQJPc7jFewxAuEgNxtOc6FvaRv1eJ2FvlYqGwJMhQFjASeOO+QEUye+LAIsDnCutp3hVamrM2ez3+Wj0PQrLRcHWADAgutMBc7pX/g+MMDEopxwRhtVF6opUtxmaqgbIz0G/C2f0zmyIioJSbN5qT3p3vIRwKbGMst/BPiq4xqDD1QKgozuVQeHj5bhyU8RpYRsaRzhyWOm/hxhZmmR8bsPeSknh3STBfvuLAwJjsxmbN/4Pybu6fO8+BfHjFz+tNVn6wAAAABJRU5ErkJggg==",a3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAXCAYAAAAcP/9qAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJJSURBVEhL5ZVPSJNhHMc/NuZBo7VkLCJT1ogRoYm7TF7oMi+7uMMGMwixQ1EYLfpDRiSkkIJm0i7rZNQhyMvoVhcVcYcMDKKQYGzNoiG19y0Uaow6vHPvu2dr72CUhz6n5/k+3/f98vs9z/O+Dcr3H7/YAXaJwr/i/wtuMN7jHJmlGNFn8yRkca2c3bbjeENB/Mcs4lIJBsFbxO9fY3xBERcMcYQmmA4cEOUi1YOTc5y5EiMDWI+4cR9sFh1lfF1b5tXHHOBkMDqCv0V0qFQNTjwa4lJMgRYf09F+HKKhEvm3RE7f4cUmtIYmiPyh6iqHK8XCktpiq9RTWyiA6SjdXeowvfySdXG9QHlwbousrJB9PU/8C0ATnq420VUVj6dHHXxYJZ5UyMpb/MyXeoRWp3g8dJOnn3WOZi+jDwfo0EmG5FeYOjnDoj7MNcDsmBdrYSoErzAVmGFRE8Bkxrq3Sa/UxKasCFX2cH3uHJ7CTAjOkXgyye3n78l+y2lynTTuseDqu8Fon3bQhD024wgNM+azlcp1YveVhlIerJJe/1QYWei9fJfZyAi3wv34Dldvub2zj8HweUYnIzy44Gb71mvv06gYrNGM/ZAN634n3ZKPs8NBXKKlSCfBqwH8koeOdgt2Zzv7RIsOg2CZd29S6vWSFTJrSbKipcgGibWNojexskpatOio+OWK3zvF+JKo1oF0kVjYXSIZVPz32LHg2lpdoVXVqOX5Hau4YnCrs43G7YnJQq/UWWowoFs6gdW0PTPjcJb/Gn8DgFjOhT2aaY4AAAAASUVORK5CYII=",s3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAXCAYAAAD+4+QTAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJrSURBVEhLxZVLSFRRGIA/tRGZC02XiEAdCRUXIW2apTSbHtimTQPZgzFSgkpULCyZEEqUIWkWNplopDC0aeNA6qIhEypJciGIuUnKRDAZrpPcS3obbHGd8T7GV4P07c45//m/c/5z7rkZseWVNfaYTHPHXvAfJfIUr5728WbWPKBHYfp1H13D8+YBC6klkyOE3kYIj22VYIqB3giDz8KMm4dMZCQP/udnQt39RGaXQFWQfqmQ40AUzFMSqMhRhVVsCAftZOccwnXKw6Xyo4hZxkhNEo3QeKOP6bhxcLcIrioCd9wcNkkyARbev0tbILpr6b5rFZCQqKpq7t8VheeaCda4EAB+K0iyMV/qg98xdo5d8xO4UowAyJ86qfRep9J7iwfDi8moNCR2jt9s4WF5LgDSaCfVjz4ixQEUxoM+uia1yH36ac4Lfp6c1ybthoXhduqDE8iGXoWZHzEodaSzE43UAsguqqDmtAPSKxfMDbWlFAilXgKtZ8lfv2n/LJkL+6h/PmUVuKoI3D+ZFGA+k62Qv40Q6hlkdFGGuIK0ZL32QlktwRqX5Yvf0U7mhtqovt3D4PQ8UjS2qaC7zipgR5JohI5ea1n0iG5NsNkzt61EGvuQfHLEkmIKD9iMAUUV+BNf+yZsK5FlBdZXG2xtJtDTgidPF6CqWItnxCj5Y2gBkO88gvPMvY23KQ7o616QR76umYqM2PLK2upIO56OCbDZEfdr5RBLPDTUubUEiaTxefqbfLz4mlh7Lp7Hfi4XJNKlJhMgu+wiV4ts2s8qGkOKxpgZfcnAF51A/U6osXFDkOXgREPTtgKAv71g3h2chXDUAAAAAElFTkSuQmCC",i3=({open:e,onClose:r,clientOptions:t,isClientsLoading:n,setClientSearchTerm:o,onSelectClient:a,setFiltroPadre:s})=>{const[i,l]=b.useState("COT"),d=f=>{l(f),s(f)},u=[{id:"COT",label:"Nuevo",icon:a3},{id:"SEMI",label:"Seminuevo",icon:n3},{id:"PM",label:"Prueba de manejo",icon:o3},{id:"SER",label:"Cita de servicio",icon:s3}];return c.jsx(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"12px",maxHeight:"85vh",position:"relative"}},children:c.jsxs(m.DialogContent,{sx:{p:0,display:"flex",flexDirection:"column"},children:[c.jsxs(m.Box,{sx:{p:2,pb:1},children:[c.jsx(m.Typography,{variant:"h6",fontWeight:"bold",sx:{mb:1,fontSize:"1.1rem"},children:"Vincular cliente"}),c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",mb:2,width:"fit-content","&:hover":{opacity:.7}},onClick:r,children:[c.jsx(td,{sx:{color:"#666",ml:-1}}),c.jsx(m.Typography,{variant:"body2",color:"text.secondary",fontWeight:"500",children:"Volver al evento"})]}),c.jsx(m.TextField,{fullWidth:!0,placeholder:"Buscar cliente, correo electrónico, teléfono...",size:"small",onChange:f=>o(f.target.value),InputProps:{startAdornment:c.jsx(m.InputAdornment,{position:"start",children:c.jsx(r3,{sx:{color:"#999"}})}),endAdornment:n&&c.jsx(m.InputAdornment,{position:"end",children:c.jsx(m.CircularProgress,{size:20,color:"inherit"})}),sx:{borderRadius:"8px",backgroundColor:"#f5f5f5","& fieldset":{border:"none"}}}}),c.jsx(m.Box,{sx:{display:"flex",gap:1,mt:2,pb:1,overflowX:"auto",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:u.map(f=>{const h=i===f.id;return c.jsx(m.Chip,{label:f.label,icon:c.jsx("img",{src:f.icon,alt:f.label,style:{width:"20px",height:"20px",borderRadius:"50%",objectFit:"cover"}}),onClick:()=>d(String(f.id)),sx:{borderRadius:"16px",fontSize:"13px",transition:"all 0.2s",backgroundColor:h?"#1976d2":"#f0f2f5",color:h?"#fff !important":"#5f6368",fontWeight:h?"bold":"normal",border:"none","&:hover":{backgroundColor:h?"#1565c0":"#e0e2e5"},"& .MuiChip-icon":{color:h?"#fff":"inherit"}}},f.id)})})]}),c.jsxs(m.Box,{sx:{flexGrow:1,overflowY:"auto",minHeight:"300px"},children:[t.map((f,h)=>c.jsxs(m.Box,{onClick:()=>{a(f,i),r()},sx:{p:"14px 20px",borderTop:"1px solid #f0f0f0",cursor:"pointer",transition:"background-color 0.2s","&:hover":{backgroundColor:"#f9f9f9"},"&:active":{backgroundColor:"#f0f0f0"}},children:[c.jsx(m.Typography,{fontWeight:"600",sx:{fontSize:"14px",color:"#333"},children:f.nombreCliente||"Sin nombre registrado"}),c.jsxs(m.Typography,{variant:"body2",sx:{fontSize:"12px",color:"#666",mt:.5},children:[f.email||"Sin correo"," • ",f.tel||"Sin teléfono"]})]},f.clienteID||h)),!n&&t.length===0&&c.jsx(m.Box,{sx:{p:4,textAlign:"center"},children:c.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"No se encontraron resultados para tu búsqueda."})})]})]})})},l3={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:{xs:"90%",sm:450,md:500},bgcolor:"background.paper",boxShadow:24,p:{xs:2,sm:3},borderRadius:2,maxHeight:"90vh",overflowY:"auto"},d0=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],c3=()=>{const e=[];for(let r=0;r<24;r++)for(let t=0;t<60;t+=15){const n=new Date;n.setHours(r,t),e.push(x.format(n,"h:mmaaaa"))}return e},f0=[],si=c3(),gn=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),a=t.replace(/[a-z]/g,""),[s,i]=a.split(":");if(!s||!i)return null;let l=parseInt(s,10);const d=parseInt(i,10);n&&l<12&&(l+=12),o&&l===12&&(l=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,l,d);return x.isValid(g)?g:null},u3=({isVisible:e,onClose:r,onSave:t,onDelete:n,selectedDate:o,initialEvent:a,userId:s,masNombreBD:i,disId:l,gmail:d,onReenviar:u})=>{const[f,h]=b.useState(!1),[g,v]=b.useState(!1),p=x.format(new Date,"yyyy-MM-dd"),[y,_]=b.useState(""),[S,C]=b.useState([]),[E,w]=b.useState(!1),N=Ll(),[D,k]=b.useState(""),[O,I]=b.useState(f0),[Y,V]=b.useState(!1),[W,Z]=b.useState(""),[J,H]=b.useState(!1),[z,ae]=b.useState([]),[ce,$]=b.useState(!1),[X,we]=b.useState(null),_e=(q,ge)=>{console.log("client",q),we(q),Ee("client",q.nombreCliente||""),Ee("solID",null),$(!1)},[Se,ne]=b.useState([]),se=Xk(W,300),ie=O.filter(q=>q.tieneConflicto).length,[pe,Ce]=b.useState(!1),[de,Ne]=b.useState("COT"),{control:R,handleSubmit:We,reset:st,formState:{errors:Le,isValid:Fe},watch:Me,setValue:Ee}=Yh({resolver:vk(bk),defaultValues:{titulo:a?.titulo||"",fechaInicio:x.format(new Date,"yyyy-MM-dd"),horaInicio:x.format(new Date,"h:mmaaaa"),horaFin:x.format(x.addHours(new Date,1),"h:mmaaaa"),todoElDia:!1,client:a?.client||null,repetir:"No repetir",link:a?.link||"",descripcion:a?.descripcion||"",solID:a?.solID??null,invitados:[],incluirMeet:!1},mode:"onChange"}),Xe=Me("fechaInicio"),A=Me("fechaFin"),j=Me("todoElDia");b.useEffect(()=>{if(y.trim()===""||!s||!l||!i){C([]),Ee("solID",null),w(!1),k("");return}w(!0);const q=setTimeout(()=>{N.getClients(y,l,i,s,de).then(ge=>{w(!1);const Pe=Array.from(new Map(ge.map(me=>[me.nombreCliente,me])).values());if(console.log("uniqueClients",Pe),Pe.length>0)C(Pe),k("");else if(a?.client&&a.solID!==null){const me=[{solID:a.solID,nombreCliente:a.client}];C(me),k("Sin resultados")}else C([]),k("Sin resultados")}).catch(ge=>{console.error("Error al buscar clientes:",ge),w(!1)})},500);return()=>clearTimeout(q)},[y,s,l,i,de]),b.useEffect(()=>{if(a){const q=a?.solicitudRelacionada&&a?.solicitudRelacionada[0];if(q){const ge={nombreCliente:a?.client||"",tel:q.tel||"",email:q.email||"",marca:q.marca||"",modelo:q.modelo||"",solID:Number(q.solID)};we(ge),C([ge]),Ee("client",q.nombreCliente),Ee("solID",q?.solID)}}},[a]),b.useEffect(()=>{if(Xe&&A){const q=new Date(Xe),ge=new Date(A);(q===ge||q>ge)&&Ee("fechaFin",Xe)}},[Xe,A,Ee]),b.useEffect(()=>{Xe&&Ee("fechaFin",Xe)},[Xe]),b.useEffect(()=>{Ee("showEndDate",f)},[f,Ee]),b.useEffect(()=>{if(console.log("initialEvent",a),a){const q=x.format(a.fechaInicio,"yyyy-MM-dd")===x.format(a.fechaFin,"yyyy-MM-dd");if(h(!q),Ee("titulo",a?.titulo),Ee("fechaInicio",x.format(a.fechaInicio,"yyyy-MM-dd")),Ee("fechaFin",x.format(a.fechaFin,"yyyy-MM-dd")),Ee("horaInicio",x.format(a.fechaInicio,"h:mmaaaa")),Ee("horaFin",x.format(a.fechaFin,"h:mmaaaa")),Ee("horaInicio2",x.format(a.fechaFin,"h:mmaaaa")),Ee("descripcion",a.descripcion),Ee("link",a.link),Ee("repetir","false"),Ee("color",a.color),Ee("todoElDia",a.todoElDia),Ee("solID",a.solID),Ee("client",a.client),a.invitados&&a.invitados.length>0){const ge=(a?.invitados||[]).map(me=>{const je=me.usrNombre?.trim()||"",Ue=je.split(/\s+/),xt=Ue.length>1?(Ue[0][0]+Ue[1][0]).toUpperCase():je.substring(0,2).toUpperCase();return{nombre:me.usrNombre||"Sin nombre",correo:me.correo||"",iniciales:xt||"--",usrID:me.usuarioID??null,isHost:me.esOrganizador||!1,estatus:me.statusInvitacion,tieneConflicto:!1,disID:me.disID}}),Pe={nombre:a?.nombreAnfitrion?a?.nombreAnfitrion:"Anfitrion",correo:"",iniciales:(a?.nombreAnfitrion?a?.nombreAnfitrion:"Anfitrion").substring(0,2).toUpperCase(),usrID:s??0,isHost:!0,estatus:"CONFIRMADA",tieneConflicto:!1};I([Pe,...ge])}else I(f0);a.solID?v(!0):v(!1)}else{const q=o||new Date,ge=new Date,Pe=new Date(q.getFullYear(),q.getMonth(),q.getDate(),ge.getHours(),ge.getMinutes()),me=x.addHours(Pe,1);console.log("defaultEndTime",me),st({titulo:"",fechaInicio:x.format(Pe,"yyyy-MM-dd"),fechaFin:x.format(me,"yyyy-MM-dd"),horaFin:x.format(me,"h:mmaaaa"),horaInicio:x.format(Pe,"h:mmaaaa"),horaInicio2:x.format(me,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:d0[0],solID:null}),h(!1),v(!1)}},[a,e,o]);const U=q=>({UsuarioID:q.usrID??null,Correo:q.correo,EsOrganizador:q.usrID==s,StatusInvitacion:q.estatus,disID:l??null}),le=We(q=>{const ge=O.map(me=>U(me)),Pe={...q,invitados:ge};t(Pe,a?.eventoID),r(),st(),h(!1)},q=>{console.log("Errores de validación:",q)});b.useEffect(()=>{j&&(Ee("horaInicio","00:00"),Ee("horaFin","23:59"))},[j,Ee,Me]);const oe=()=>{const q=Me("fechaInicio");if(q){const ge=new Date(`${q}T00:00:00`),Pe=x.addDays(ge,1);Ee("fechaFin",x.format(Pe,"yyyy-MM-dd"))}h(!0)},P=Me("fechaInicio"),K=Me("horaInicio"),ve=Me("fechaFin"),ke=Me("horaFin"),[L,te]=b.useState(null),[ye,Ze]=b.useState(null);b.useEffect(()=>{(L===null||L!==K)&&te(K)},[K,L]),b.useEffect(()=>{(ye===null||ye!==ke)&&Ze(ke??"")},[ke,ye]);const mt=Me("todoElDia");b.useEffect(()=>{if(mt||!K||!ke||!P||!ve)return;const q=gn(P,K),ge=gn(ve,ke);if(!q||!ge||!x.isValid(q)||!x.isValid(ge))return;const Pe=x.isSameDay(q,ge),me=Pe&&(x.isAfter(q,ge)||q.getTime()===ge.getTime()),je=x.isBefore(ge,q)&&!Pe;(me||je)&&(Ee("horaFin",""),Ze(""))},[K,P]);const Ct=b.useMemo(()=>{if(!K||!P)return si;const q=gn(P,K);return q?si.map(ge=>{const Pe=gn(ve||P,ge);if(Pe&&x.isAfter(Pe,q)){const me=(Pe.getTime()-q.getTime())/6e4,je=Math.floor(me/60),Ue=me%60,xt=je>0?`${je} h${Ue>0?` ${Ue} min`:""}`:`${Ue} min`;return{value:ge,label:`${ge} (${xt})`}}return ge}).filter(ge=>{const Pe=typeof ge=="string"?ge:ge.value,me=gn(ve||P,Pe);return me?x.isAfter(me,q):!1}):si},[K,P,ve]),Qt=b.useMemo(()=>si,[]);b.useEffect(()=>{if(!a&&K&&P){const q=gn(P,K);if(q){const ge=x.addMinutes(q,15),Pe=K.toLowerCase(),me=Pe.includes("pm")||Pe.includes("p.m."),je=Pe.includes(".");let Ue=x.format(ge,"h:mm"),xt=me?"pm":"am";je&&(xt=me?"p.m.":"a.m.");const Sr=`${Ue}${xt}`,Rr=(ke||"").toLowerCase();(ke!==Sr||me&&(Rr.includes("am")||Rr.includes("a.m.")))&&Ee("horaFin",Sr,{shouldValidate:!0})}}},[K,Ee,P]);const rr=async q=>{const ge=Me("fechaInicio"),Pe=Me("horaInicio"),me=Me("horaFin");if(console.log("currentGuests",q),!l||!ge||!Pe||!me||q.length===0)return;const je=await Promise.all(q.map(async Ue=>{if(Ue.isHost||!Ue.correo)return Ue;try{const xt=await N.VerificarConflicto(l,Ue.correo,ge,Pe+":00",me+":00"),Sr=Array.isArray(xt)?xt[0]:xt;if(console.log("conflictResult",xt),Sr){const Rr=await N.getDisponibilidadUsuario(l,Ue.correo,ge,"60");ae(Rr)}return{...Ue,tieneConflicto:String(Sr.tieneConflicto).toLowerCase()==="true"}}catch{return{...Ue,tieneConflicto:!1}}}));I(je)};b.useEffect(()=>{O.filter(ge=>!ge.isHost).length>0&&P&&K&&ke&&rr(O)},[P,K,ke]);const Jt=async q=>{if(O.some(Ue=>Ue.correo===q.correo))return;H(!0);const Pe=Me("fechaInicio"),me=Me("horaInicio"),je=Me("horaFin");if(!l||!q.correo||!Pe||!me||!je){I(Ue=>[...Ue,{...q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:!1}]);return}try{const Ue=await N.VerificarConflicto(l,q.correo,Pe,me+":00",je+":00"),xt=Array.isArray(Ue)?Ue[0]:Ue,Sr=String(xt?.tieneConflicto).toLowerCase()==="true",Rr={...q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:Sr};if(Sr){const T=await N.getDisponibilidadUsuario(l,q.correo,Pe,"60");ae(T)}I(T=>[...T,Rr])}catch(Ue){console.error("Error al verificar conflicto:",Ue),I(xt=>[...xt,{...q,tieneConflicto:!1,isHost:!1}])}},ee=q=>{I(ge=>ge.filter(Pe=>Pe.nombre!==q))},Oe=()=>{V(!1)},Ae=q=>{const me=(q.usrNombre??"").split(" ").map(je=>je.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:q.usrNombre??"",correo:q.usrMail??"",iniciales:me,usrID:q.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};b.useEffect(()=>{console.log("debouncedSearchText.length",se.length),se.length>2&&l?(async()=>{const ge=await N.getUsuariosInvitados(l,se),Pe=ge.map(Ae).filter(me=>me.usrID!==s&&!O.some(je=>je.correo===me.correo));console.log("sugerencias",ge),ne(Pe)})():ne([])},[se,O]);const $e=q=>{Z(q)},qt=q=>{const{Fecha:ge,HoraInicio:Pe,HoraFin:me}=q,je=Ue=>Ue.split(":").slice(0,2).join(":");Ee("fechaInicio",ge),Ee("fechaFin",ge),Ee("horaInicio",je(Pe)),Ee("horaFin",je(me)),h(!1),Oe()},nr=async()=>{const q=Me(),ge=gn(q.fechaInicio,q.horaInicio),Pe=gn(q.fechaFin||q.fechaInicio,q.horaFin);if(!ge||!Pe)return;if(!l||!d){console.error("Faltan datos requeridos (disId, userMail o calendarId)");return}Ce(!0);const me={summary:q.titulo||"Sin título",description:q.descripcion||"",start:{dateTime:x.format(ge,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"},end:{dateTime:x.format(Pe,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"}};try{const je=await N.insertarEventoGoogle(l,d,!0,me);je?.hangoutLink&&(Ee("link",je.hangoutLink),Ee("incluirMeet",!1))}catch(je){console.error("Error al generar Meet",je)}finally{Ce(!1)}},cr=a?.solicitudRelacionada?.[0],ur=cr?.tipoSol||"",Xt={COT:{url:"/netcar/cotizaciones/",pag:10,tipo:"COT"},SEMI:{url:"/netcar/seminuevos/",pag:12,tipo:"SEMI"},SER:{url:"/netcar/servicio/",pag:14,tipo:"SER"},PM:{url:"/netcar/pruebademanejo/",pag:16,tipo:"PM"}}[ur];return c.jsx(c.Fragment,{children:c.jsx(m.Modal,{open:e,onClose:r,children:c.jsxs("form",{onSubmit:le,children:[c.jsxs(m.Box,{sx:l3,children:[c.jsx(m.IconButton,{"aria-label":"close",onClick:r,sx:{position:"absolute",right:8,top:12},children:c.jsx(Tr,{})}),c.jsx(m.Typography,{variant:"h6",mb:2,children:a?.isGoogleEvent||a?.isOutlookEvent?c.jsx(c.Fragment,{children:a?.titulo||"Evento de Google"}):!a&&"Agregar evento"}),c.jsx(m.Typography,{style:{fontSize:18,fontWeight:600},mb:2,children:a?.client&&a?.solicitudRelacionada?.[0]?c.jsxs(c.Fragment,{children:["Evento para el cliente:"," ",c.jsx(m.Link,{component:Xl,to:`${Xt.url}${cr?.solID}`,replace:!0,state:{tipoSOL:Xt.tipo,pag:Xt.pag,modulo:"Consulta"},sx:{color:"#1976d2",cursor:"pointer",fontWeight:700,textDecoration:"underline",fontSize:"14px",display:"inline-flex",alignItems:"baseline"},children:`${a.client} / ${cr?.marca} ${cr?.modelo}`})]}):"Editar Evento"}),c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(Or,{name:"titulo",control:R,render:({field:q})=>c.jsx(m.TextField,{...q,label:"Título",fullWidth:!0,variant:"outlined",size:"small",error:!!Le.titulo,helperText:Le.titulo?.message,inputProps:{maxLength:100},sx:{"& .MuiInputLabel-root.Mui-focused":{color:"black"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"black"},"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}})})})}),c.jsxs("div",{className:`row g-2 ${f?"mb-1":"mb-2"}`,children:[c.jsx("div",{className:"col-12 col-md-4",children:c.jsx(Or,{name:"fechaInicio",control:R,render:({field:q})=>c.jsx(m.TextField,{fullWidth:!0,...q,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!Le.fechaInicio,helperText:Le.fechaInicio?.message})})}),f?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"col-md-3 d-none d-md-block"}),c.jsx("div",{className:"col-10 col-md-4",children:c.jsx(Or,{name:"fechaFin",control:R,render:({field:q})=>c.jsx(m.TextField,{...q,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:Xe||p},error:!!Le.fechaFin,helperText:Le.fechaFin?.message})})}),!a&&c.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:c.jsx(m.IconButton,{onClick:()=>h(!1),sx:{fontSize:18},children:c.jsx(xk,{})})})]}):c.jsx("div",{className:"col-md-8"})]}),f&&c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12 d-flex justify-content-center",children:c.jsx(t0,{sx:{color:"#757575",my:1}})})}),c.jsxs("div",{className:"row g-2 mb-2",children:[c.jsx("div",{className:"col-12 col-md-4",children:c.jsx(Or,{name:"horaInicio",control:R,render:({field:{onChange:q,value:ge,...Pe}})=>c.jsx(m.Autocomplete,{freeSolo:!0,options:Qt,value:ge||"",getOptionLabel:me=>typeof me=="string"?me:me.value,onChange:(me,je)=>{const Ue=typeof je=="string"?je:je?.value;if(Ue){const xt=Ue.split(" (")[0].trim();q(xt)}else q("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},onInputChange:(me,je)=>q(je),renderInput:me=>c.jsx(m.TextField,{...me,...Pe,size:"small",error:!!Le.horaInicio,helperText:Le.horaInicio?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...me.InputProps}}),popupIcon:c.jsx($l,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:mt})})}),!f&&c.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:Le.horaInicio?"5px":"0px"},children:c.jsx(t0,{sx:{color:"#757575"}})}),f&&c.jsx("div",{className:"col-md-3 d-none d-md-block"}),c.jsx("div",{className:"col-12 col-md-4",children:c.jsx(Or,{name:"horaFin",control:R,render:({field:{onChange:q,value:ge,...Pe}})=>c.jsx(m.Autocomplete,{freeSolo:!0,options:Ct,getOptionLabel:me=>typeof me=="string"?me:me.value,value:ge||"",onChange:(me,je)=>{const Ue=typeof je=="string"?je:je?.value;if(Ue){const xt=Ue.split(" (")[0].trim();q(xt)}else q("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},renderOption:(me,je)=>b.createElement(m.Box,{component:"li",...me,key:typeof je=="string"?je:je.value},c.jsx(m.Typography,{children:typeof je=="string"?je:je.label})),onInputChange:(me,je)=>q(je),renderInput:me=>c.jsx(m.TextField,{...me,...Pe,size:"small",error:!!Le.horaFin,helperText:Le.horaFin?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...me.InputProps}}),popupIcon:c.jsx($l,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:mt})})}),!f&&c.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:c.jsx(Or,{name:"todoElDia",control:R,render:({field:q})=>c.jsx(m.FormControlLabel,{control:c.jsx(m.Checkbox,{checked:q.value,onChange:ge=>q.onChange(ge.target.checked)}),label:c.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!a?.isGoogleEvent||a?.isOutlookEvent)&&!f&&c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsxs(m.Button,{onClick:oe,size:"small",sx:{textTransform:"none",fontSize:16},children:[c.jsx(Sk,{}),"  Agregar fecha final"]})})}),c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(Or,{name:"link",control:R,render:({field:q})=>c.jsx(m.TextField,{...q,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!Le.link,helperText:Le.link?.message,InputProps:{startAdornment:c.jsx("img",{src:wk,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(Or,{name:"descripcion",control:R,render:({field:q})=>c.jsx(m.TextField,{...q,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:c.jsx("img",{src:Ck,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),a?.solicitudRelacionada===null&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(Vk,{onSelectGuest:Jt,availableSuggestions:Se,onInputTextChange:$e})})}),(J||ie>0)&&c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(Jk,{guests:O,conflictCount:ie,onViewSuggestions:()=>V(!0),onDeleteGuest:ee})})}),a?.invitados&&a?.invitados?.length>0&&c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(m.Box,{children:c.jsx(Rk,{guests:O,onReenviar:u,esOrganizador:a?.esOrganizador})})})}),c.jsx(Fk,{open:Y,handleClose:Oe,suggestions:z,onSelectSlot:qt})]}),c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1,px:0},children:[c.jsx(m.Box,{sx:{minWidth:40,display:"flex",justifyContent:"flex-start"},children:c.jsx("img",{src:"https://fonts.gstatic.com/s/i/productlogos/meet_2020q4/v1/web-512dp/logo_meet_2020q4_color_2x_web_512dp.png",alt:"Meet",style:{width:22,height:22}})}),c.jsx(m.Box,{sx:{flex:1},children:!Me("link")&&!Me("incluirMeet")?c.jsx(m.Button,{fullWidth:!0,disabled:pe||!l||!d,onClick:nr,sx:{justifyContent:"flex-start",textTransform:"none",bgcolor:"#f1f3f4",color:"#3c4043","&:hover":{bgcolor:"#e8eaed",boxShadow:"none"},borderRadius:"4px",fontWeight:400,fontSize:"14px",py:1,px:2,border:"none",boxShadow:"none"},children:pe?c.jsxs(c.Fragment,{children:[c.jsx(m.CircularProgress,{size:18,sx:{mr:1.5,color:"#5f6368"}}),c.jsx(m.Typography,{variant:"body2",sx:{fontSize:"14px",color:"#5f6368"},children:"Generando enlace..."})]}):"Añadir videoconferencia de Google Meet"}):c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#f1f3f4",p:"6px 12px",borderRadius:"4px",border:"1px solid #dadce0"},children:[c.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[c.jsx(m.Typography,{variant:"body2",sx:{color:"#1a73e8",fontWeight:500,cursor:Me("link")?"pointer":"default",textDecoration:"none","&:hover":{textDecoration:Me("link")?"underline":"none"},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},onClick:()=>Me("link")&&window.open(Me("link"),"_blank"),children:Me("link")?Me("link"):"Se añadirá Google Meet al guardar"}),c.jsx(m.Typography,{variant:"caption",sx:{color:"#70757a"},children:"Google Meet"})]}),c.jsx(m.IconButton,{size:"small",onClick:()=>{Ee("incluirMeet",!1),Ee("link","")},sx:{color:"#5f6368"},children:c.jsx(Tr,{sx:{fontSize:18}})})]})})]}),c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[c.jsx(_k,{}),d0.map(q=>c.jsx(Or,{name:"color",control:R,render:({field:ge})=>c.jsx(m.IconButton,{onClick:()=>ge.onChange(q),sx:{width:24,height:24,borderRadius:"50%",bgcolor:q,border:ge.value===q?"2px solid":"none",borderColor:ge.value===q?"primary.main":"transparent"}})},q))]})})}),c.jsx("div",{className:"row",children:c.jsxs("div",{className:"col-12 d-flex gap-2",style:{width:"100%",marginTop:"20px"},children:[a&&!a?.isGoogleEvent&&!a?.isOutlookEvent&&c.jsx(m.Button,{onClick:n,variant:"outlined",startIcon:c.jsx("img",{src:Xh,width:15}),hidden:a?a?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",backgroundColor:"#FFF5F5",color:"#d32f2f",borderColor:"red",borderRadius:"8px",fontWeight:700,fontSize:"14px",padding:"8px 0","&:hover":{backgroundColor:"#FEE2E2",borderColor:"red"}},children:"Eliminar"}),c.jsx(m.Button,{onClick:r,variant:"outlined",sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",color:"#1976D2",borderColor:"#1976D2","&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)",borderColor:"#115293"}},children:"Cancelar"}),c.jsx(m.Button,{onClick:le,variant:"contained",disabled:!Fe,hidden:a?a?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",backgroundColor:"#1976D2",boxShadow:"none","&:hover":{backgroundColor:"#115293",boxShadow:"0px 2px 4px rgba(0,0,0,0.2)"}},children:"Guardar"})]})})]}),c.jsx(i3,{open:ce,onClose:()=>$(!1),clientOptions:S,isClientsLoading:E,setClientSearchTerm:_,onSelectClient:_e,setFiltroPadre:Ne})]})})})},d3={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:450,bgcolor:"background.paper",boxShadow:24,p:2,borderRadius:2,maxHeight:"80vh",overflowY:"auto"},f3=({isOpen:e,onClose:r,events:t,date:n,onEventClick:o})=>{if(!n)return null;const a=i=>{o(i),r()},s=i=>i.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:i.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return c.jsx(m.Modal,{open:e,onClose:r,children:c.jsxs(m.Box,{sx:d3,children:[c.jsxs(m.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[c.jsxs(m.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),c.jsx(m.IconButton,{onClick:r,size:"small",children:c.jsx(Tr,{})})]}),c.jsx(m.Divider,{}),c.jsx(m.List,{sx:{mt:1},children:t.map(i=>{const l=s(i);return c.jsx(m.ListItem,{disablePadding:!0,sx:{mb:1},children:c.jsx(m.ListItemButton,{onClick:()=>a(i),sx:{py:1,borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.02)",borderLeft:`5px solid ${l?.borderColor}`,"&:hover":{backgroundColor:"rgba(0,0,0,0.04)"}},children:c.jsxs(m.Box,{sx:{flexGrow:1},children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[c.jsx(m.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:l?.borderColor,color:"white",textTransform:"uppercase"},children:l?.label}),c.jsx(m.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:i.titulo})]}),c.jsx(m.Typography,{sx:{fontSize:"12px",color:"#666"},children:i.todoElDia?"Todo el día":`${x.format(i.fechaInicio,"hh:mm aa").toLowerCase()} - ${x.format(i.fechaFin,"hh:mm aa").toLowerCase()}`})]})})},i.eventoID)})})]})})};var la={},p0;function p3(){if(p0)return la;p0=1;var e=lt();Object.defineProperty(la,"__esModule",{value:!0}),la.default=void 0;var r=e(ht()),t=dt();return la.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),la}var h3=p3();const m3=it(h3);var ca={},h0;function g3(){if(h0)return ca;h0=1;var e=lt();Object.defineProperty(ca,"__esModule",{value:!0}),ca.default=void 0;var r=e(ht()),t=dt();return ca.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),ca}var v3=g3();const y3=it(v3),b3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23fff'%20d='M19.378%204.405a1.813%201.813%200%201%201%202.565%202.565L9.571%2019.342a1.813%201.813%200%200%201-2.565%200l-4.949-4.949a1.814%201.814%200%200%201%202.428-2.69l.137.126%203.666%203.666z'/%3e%3c/svg%3e",x3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAALVBMVEVHcEzfEBfjCxzkChvkChvkChzkCxvlChv////96uv60dT1o6ryho/mGyvkCxypwAsrAAAACHRSTlMAECtdiKDJ5DEbuTIAAAHoSURBVHjatdlbjsMgDAVQ87JJKHf/y51pf9CIp+vJ/SzSkUloAZc2cSEkFgEAYU7RO/o+zkdBF07hO9QnwSzJq4uLgmUkGDgzGTrORHrGcZLXlmcvMkKZaJxuH/YLTwB9ZCo6AUyivb4m7uuziwxDeLtezKsnwJiwfCH2x5hgDi8mbJ+0APaI6wo0Ju4KrIBqQNyqwFqufL3qYOD1O1DqqkQZeVd+567dwJ3fuUai0Cceg5Scm9h5v3lhED9fgzk3ceTlC4Ok+YxzLzbvk+lrCRjl6sTmzSuEn80Yr9yJzZs+Q6Tp72C9/4jdRwXDCJEDTsQzD3DkcSaeeQgUcSZuvAYmnIlnHhIxVqLWAxNjKSo9CAl0YsEGBFRiwSYEhdh5dvCuBrB5GlH3UvaikOw8ncjbha0UeffV04qJwplX7jMxUjjzUM9ET+7Mw6HoiOTIOxR5ehYunXe8SfndNlpwvo2G2XWidl4nYhQ3PYpczVMfRfxqoy9QHZbWx7nm9eK9OM5RnB84h8VPTqJA6G55toj5WtYX+K8lypMXH2KYkx64PD55vbVfwJ9pEZgfo70tYm/c2FtLds/eTHu23WdvSG7jk2a6zzV17aRER4oEUXDm1r0kT18lJB5o5n8sErN8JOEUtv9U/ACrTv/qOzhclQAAAABJRU5ErkJggg==",pc=b.forwardRef(({id:e,message:r,variant:t},n)=>{const{closeSnackbar:o}=wa.useSnackbar(),a={success:{color:"#fff",icon:c.jsx("img",{width:25,src:b3,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:c.jsx(m3,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:c.jsx(y3,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:c.jsx("img",{src:Xh,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:c.jsx("img",{src:x3,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},s=a[t]||a.info;return c.jsx(wa.SnackbarContent,{ref:n,children:c.jsxs(m.Box,{sx:{backgroundColor:"white",color:"#333",padding:"8px 16px",borderRadius:"8px",boxShadow:"0 3px 10px rgba(0,0,0,0.2)",display:"flex",alignItems:"center",width:{xs:"90%",sm:"auto"},minWidth:"300px",borderLeft:`5px solid ${s.color}`},children:[c.jsx(m.Box,{sx:{mr:1.5},children:s.icon}),c.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1},children:r}),c.jsx(m.IconButton,{size:"small",onClick:()=>o(e),children:c.jsx(Tr,{fontSize:"small"})})]})})}),m0=b.createContext(void 0),w3=({children:e})=>{const[r,t]=b.useState([]),[n,o]=b.useState([]),[a,s]=b.useState(!1);return c.jsx(m0.Provider,{value:{googleEvents:r,setGoogleEvents:t,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:a,setIsLoadingGoogleEvents:s},children:e})},_3=()=>{const e=b.useContext(m0);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},S3=(e,r,t)=>{const n=(s,i)=>i?new Date(i):s?new Date(s.replace(/-/g,"/")):new Date,o=n(e.start.date,e.start.dateTime);let a=n(e.end.date,e.end.dateTime);return e.end.date&&!e.end.dateTime&&a.setDate(a.getDate()-1),{eventoID:Math.abs(C3(e.id)),titulo:e.summary||"(Sin título)",descripcion:e.description,fechaInicio:o,fechaFin:a,todoElDia:!!(e.start.date&&!e.start.dateTime),color:"#4285F4C",hasVideoCall:!!e.conferenceData,link:e.htmlLink,repetir:void 0,solID:null,disID:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!0}};function C3(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}function E3(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}const D3=(e,r,t)=>{const n=new Date(e.start.dateTime);let o=new Date(e.end.dateTime);return e.isAllDay&&o.setDate(o.getDate()-1),{eventoID:Math.abs(E3(e.id)),titulo:e?.summary||"(Sin título)",descripcion:e.body?.content||"",fechaInicio:n,fechaFin:o,todoElDia:e.isAllDay,color:"#0078D4",hasVideoCall:!!e.onlineMeetingUrl,link:e.webLink,repetir:void 0,solID:null,disID:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!1,isOutlookEvent:!0}},g0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='49'%20fill='none'%3e%3cpath%20fill='%23E40B1C'%20d='M34.559%2048.077c-7.413%200-13.44-6.039-13.44-13.44s6.027-13.44%2013.44-13.44%2013.44%206.027%2013.44%2013.44c0%207.414-6.027%2013.44-13.44%2013.44'/%3e%3cpath%20fill='%23fff'%20d='M39.827%2029.346c.583.583.605%201.505.05%202.06l-3.218%203.219%203.219%203.218c.555.556.532%201.48-.051%202.062-.584.583-1.506.605-2.062.05l-3.218-3.218-3.218%203.218c-.556.555-1.478.533-2.061-.05s-.606-1.506-.05-2.062l3.217-3.218-3.218-3.218c-.555-.555-.533-1.478.05-2.061.583-.584%201.507-.606%202.063-.05l3.217%203.217%203.218-3.218c.556-.555%201.478-.533%202.062.05'/%3e%3cpath%20fill='%23404756'%20d='M30.367.078c1.112%200%202.001.868%202.001%201.954v1.195h.979c4.913%200%208.892%203.887%208.892%208.686v9.237a15.4%2015.4%200%200%200-4.424-1.691v-1.312H4.468V33.63c0%202.389%202%204.343%204.446%204.343H19.4a15.4%2015.4%200%200%200%201.676%204.343H8.892C3.979%2042.317%200%2038.43%200%2033.631V11.913c0-4.8%203.979-8.686%208.892-8.686h1V2.032c0-1.086.89-1.954%202.002-1.954s2%20.868%202%201.954v1.195h14.473V2.032c0-1.085.889-1.954%202-1.954'/%3e%3c/svg%3e",A3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23fff'%20d='M20.36%204.14H16c0-1.65-1.35-3-3-3h-2c-1.65%200-3%201.35-3%203H3.64c-.55%200-1%20.45-1%201s.45%201%201%201h1.04l.84%2013.91a3%203%200%200%200%202.99%202.82h6.98c1.58%200%202.9-1.24%203-2.82l.84-13.91h1.04c.55%200%201-.45%201-1s-.45-1-1-1zm-9.36-1h2c.55%200%201%20.45%201%201h-4c0-.55.45-1%201-1m-.39%2014.9c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201zm4.78%200c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201z'/%3e%3c/svg%3e",k3=({open:e,onClose:r,onConfirm:t,title:n,description:o,icon:a,confirmText:s,confirmColor:i="#d32f2f",loading:l=!1})=>c.jsxs(m.Dialog,{open:e,onClose:r,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[c.jsx(m.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:c.jsx(m.IconButton,{onClick:r,size:"small",children:c.jsx(Tr,{fontSize:"small"})})}),c.jsxs(m.DialogContent,{sx:{textAlign:"center",pt:0},children:[c.jsx(m.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:a}),c.jsx(m.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),c.jsx(m.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),c.jsxs(m.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[c.jsx(m.Button,{variant:"outlined",onClick:r,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),c.jsxs(m.Button,{variant:"contained",onClick:t,disabled:l,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:i,"&:hover":{bgcolor:"#b71c1c"}},children:[s=="Eliminar"&&c.jsx("img",{src:A3,width:15,style:{marginRight:6,marginBottom:2}}),l?"Procesando...":s]})]})]})]}),ii=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),a=t.replace(/[a-z]/g,""),[s,i]=a.split(":");if(!s||!i)return null;let l=parseInt(s,10);const d=parseInt(i,10);n&&l<12&&(l+=12),o&&l===12&&(l=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,l,d);return x.isValid(g)?g:null},T3=({userId:e,leads30Days:r,leads90Days:t,disId:n,masNombreBD:o,usrNombre:a})=>{const[s,i]=b.useState(new Date),[l,d]=b.useState([]),[u,f]=b.useState(!1),[h,g]=b.useState(null),[v,p]=b.useState(null),[y,_]=b.useState([]),{enqueueSnackbar:S}=wa.useSnackbar(),C=Ll(),E=Is(),w=Cl(),[N,D]=b.useState(!1),[k,O]=b.useState([]),[I,Y]=b.useState(null),{session:V,sessionoutlook:W}=ul(),{googleEvents:Z,setGoogleEvents:J,outlookEvents:H,setOutlookEvents:z}=_3(),[ae,ce]=b.useState([]),[$,X]=b.useState([]),[we,_e]=b.useState([]),[Se,ne]=b.useState(!1),[se,ie]=b.useState([]),[pe,Ce]=b.useState(),de=(ee,Oe)=>{O(ee),Y(Oe),D(!0)},Ne=async()=>{if(e===void 0||n===void 0)return;const ee=await C.getNotificacionesXUsuario(e,n);a?localStorage.setItem("nombreAnfitrion",a):localStorage.setItem("nombreAnfitrion","Anfitrion"),ie(ee)};b.useEffect(()=>{const ee=new Date,Oe=x.startOfDay(ee),Ae=x.endOfDay(x.addDays(Oe,6)),$e={start:Oe,end:Ae},qt=l.filter(nr=>{const cr={start:nr.fechaInicio,end:nr.fechaFin};return tf(cr,$e)}).sort((nr,cr)=>nr.fechaInicio.getTime()-cr.fechaInicio.getTime());_(qt)},[l]),b.useEffect(()=>{const ee=async()=>{try{if(e&&n){const Ae=await C.getEventsByUser(e,n);Ne(),d(Ae)}}catch(Ae){console.log("Error al cargar eventos locales:",Ae)}};ee();const Oe=setInterval(ee,4e3);return()=>clearInterval(Oe)},[e]),b.useEffect(()=>{if(!n||!e)return;const ee=[...l];if(Z.length>0&&V?.userEmail){const Oe=Z.map(Ae=>S3(Ae,n,e));ee.push(...Oe)}if(H.length>0&&W?.userEmail){const Oe=H.map(Ae=>D3(Ae,n,e));ee.push(...Oe)}ce(ee)},[l,Z,H,n,e,V?.userEmail,W?.userEmail]);const R=async ee=>{try{if(ee?.isGoogleEvent||ee.isOutlookEvent)g(ee),f(!0);else{const Oe=await C.getEventById(ee.eventoID);g(Oe),f(!0)}}catch(Oe){console.error(Oe)}},We=()=>{f(!1),g(null)},st=async(ee,Oe)=>{let Ae,$e;if(ee.todoElDia)Ae=ii(ee.fechaInicio,ee.horaInicio),$e=ii(ee.fechaInicio,ee.horaFin);else{Ae=ii(ee.fechaInicio,ee.horaInicio);const ur=ee.fechaFin||ee.fechaInicio;$e=ii(ur,ee.horaFin)}if(!Ae||!$e){console.error("No se pudieron procesar las fechas. Revisa el formato de hora:",{inicio:ee.horaInicio,fin:ee.horaFin});return}const qt=x.format(Ae,"yyyy-MM-dd HH:mm:ss.SSS"),nr=x.format($e,"yyyy-MM-dd HH:mm:ss.SSS");if(Oe){const ur={...ee,eventoID:Oe,fechaInicio:qt,fechaFin:nr,solID:ee.solID??null,disID:n??null,client:ee.client,invitados:ee.invitados.map(Ge=>({usrNombre:Ge.nombre||Ge.usrNombre,Correo:Ge.correo||Ge.Correo,EsOrganizador:Ge.isHost||Ge.EsOrganizador,StatusInvitacion:Ge.StatusInvitacion,UsuarioID:Ge.usrID||Ge.UsuarioID,disID:Ge.disID||n}))};try{const Ge=await C.updateEvent(ur);var cr=l.map(Xt=>Xt.eventoID===Ge.eventoID?Ge:Xt);d(cr),S("El evento se ha actualizado correctamente.",{variant:"success"}),We()}catch{S("Error al actualizar Evento",{variant:"error"})}}else{const ur={...ee,fechaInicio:qt,fechaFin:nr,todoElDia:ee.todoElDia,solID:ee.solID??null,disID:n??null,client:ee.client,invitados:ee.invitados.map(Ge=>({usrNombre:Ge.nombre||Ge.usrNombre,Correo:Ge.correo||Ge.Correo,EsOrganizador:Ge.isHost||Ge.EsOrganizador,StatusInvitacion:Ge.StatusInvitacion,UsuarioID:Ge.usrID||Ge.UsuarioID,disID:Ge.disID||n}))};try{const Ge=await C.createEvent(ur,e);d(Xt=>[...Xt,Ge]),S("El evento se ha creado con éxito",{variant:"success"}),We()}catch{S("Error al guardar Evento",{variant:"error"})}}if(e&&n){const ur=await C.getEventsByUser(e,n);d(ur)}},Le=()=>{i(ee=>new Date(ee.getFullYear(),ee.getMonth()-1,1))},Fe=()=>{i(ee=>new Date(ee.getFullYear(),ee.getMonth()+1,1))},Me=()=>{Ct("ELIMINAR")},Ee=()=>{Ct("RECHAZAR")},Xe=()=>{p(new Date),f(!0)},A=ee=>{ee&&i(ee)},j=ee=>{p(ee),f(!0),g(null)},U=async()=>{if(h)try{await C.deleteEvent(h.eventoID),d(l.filter(ee=>ee.eventoID!==h.eventoID)),S("El evento se ha eliminado de tu calendario",{content:(ee,Oe)=>c.jsx(pc,{id:ee,message:String(Oe),variant:"delete"})})}catch{S("Error al eliminar Evento",{variant:"error"})}finally{We(),Qt()}},le=async()=>{if(!(!V?.userEmail||!n)){ne(!0);try{const Oe=(await E.getGoogleCalendars(V.userEmail,n)).map($e=>({...$e,selected:!0}));X(Oe);const Ae=Oe.map($e=>$e.id);ve(Ae)}catch(ee){console.error("Error Google Cals:",ee)}finally{ne(!1)}}},oe=async ee=>{const Oe=$.map($e=>$e.id===ee?{...$e,selected:!$e.selected}:$e);X(Oe);const Ae=Oe.filter($e=>$e.selected).map($e=>$e.id);ve(Ae)},P=async()=>{if(!(!W?.userEmail||!n)){ne(!0);try{const Oe=(await w.getOutlookCalendars(W.userEmail,n)).map($e=>({...$e,selected:!0}));_e(Oe);const Ae=Oe.map($e=>$e.id);ke(Ae)}catch(ee){console.error("Error Outlook Cals:",ee)}finally{ne(!1)}}},K=async ee=>{const Oe=we.map($e=>$e.id===ee?{...$e,selected:!$e.selected}:$e);_e(Oe);const Ae=Oe.filter($e=>$e.selected).map($e=>$e.id);ke(Ae)};b.useEffect(()=>{le()},[V?.userEmail,n]),b.useEffect(()=>{P()},[W?.userEmail,n]);const ve=async ee=>{if(!V?.userEmail||!n)return;const Oe=ee||$.filter(Ae=>Ae.selected).map(Ae=>Ae.id);try{const Ae={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:V.userEmail,calendarIds:Oe},$e=await E.getGoogleEventsByMonth(Ae);J($e)}catch(Ae){console.error("Error al obtener eventos de Google:",Ae)}},ke=async ee=>{if(!W?.userEmail||!n)return;const Oe=ee||we.filter(Ae=>Ae.selected).map(Ae=>Ae.id);try{const Ae={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:W.userEmail,calendarIds:Oe},$e=await w.getOutlookEventsByMonth(Ae);z($e)}catch(Ae){console.error("Error al obtener eventos de Outlook:",Ae)}};if(n===void 0||e===void 0)return c.jsx("div",{children:"Cargando configuración de usuario..."});const L=async(ee,Oe)=>{await C.UpdateStatusEvento(ee.evento.eventoID,e,Oe)&&(await C.MarcarLeido(ee.notificacionID,e),S(ee?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},te=async()=>{pe&&C.UpdateStatusEvento(pe.evento.eventoID,e,"RECHAZADA")&&(await C.MarcarLeido(pe.notificacionID,e),await C.MarcarLeido(pe.notificacionID,e),S("Haz rechazado la Invitación a "+pe?.evento?.titulo,{content:(Oe,Ae)=>c.jsx(pc,{id:Oe,message:String(Ae),variant:"rechazar"})}),Qt())},ye=async(ee,Oe)=>{try{if(!e)return;Ce(ee),Oe=="RECHAZADA"?(Ee(),console.log("noti",ee)):L(ee,Oe)}catch{S("Error al procesar la invitación",{variant:"error"})}},Ze=async ee=>{try{if(!h)return;await C.ReenviarNotificacion(h?.eventoID,ee),S("Invitación enviada con éxito",{variant:"success"})}catch(Oe){console.error("Error al conectar con la API",Oe)}},[mt,Ct]=b.useState(null),Qt=()=>Ct(null),rr={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:c.jsxs(c.Fragment,{children:["Estás a punto de declinar la invitación de ",c.jsx("strong",{children:pe?.evento?.nombreAnfitrion})," a ",c.jsx("strong",{children:pe?.evento?.titulo})]}),icon:c.jsx("img",{src:g0}),action:()=>pe&&te()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:c.jsx("img",{src:g0}),action:()=>U()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>U}},Jt=mt?rr[mt]:null;return c.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[c.jsx(jy,{header:c.jsx(X2,{currentDate:s,onPrevMonth:Le,onNextMonth:Fe,onAddEvent:Xe,onDateChange:A}),sidebar:c.jsx(Kw,{onEventClick:R,upcomingEvents:y,leads30Days:r,leads90Days:t,disID:n,usrID:e,onAddEvent:Xe,googleCalendars:$,outlookCalendars:we,isLoadingCalendars:Se,onToggleGoogle:oe,onToggleOutlook:K,notifications:se,unreadCount:se?.filter(ee=>!ee.leida).length,onAceppInvitacion:ye}),mainContent:c.jsx(u_,{onSeeMoreClick:de,currentDate:s,events:ae,onDayClick:j,onEventClick:R})}),u&&c.jsx(u3,{isVisible:u,onClose:We,onSave:st,onDelete:Me,selectedDate:v,initialEvent:h,userId:e,masNombreBD:o,disId:n,gmail:"llopez@exagono.net",onReenviar:Ze}),c.jsx(f3,{isOpen:N,onClose:()=>D(!1),events:k,date:I,onEventClick:R}),Jt&&c.jsx(k3,{open:!!mt,onClose:Qt,onConfirm:()=>{Jt.action()},title:Jt.title,description:Jt.description,icon:Jt.icon,confirmText:Jt.confirmText})]})},M3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%3e%3cpath%20fill='%23070c10'%20d='M18.575%203.172A10.829%2010.829%200%200%200%201.564%2016.284l-.028-.051L0%2021.843l5.739-1.506a10.7%2010.7%200%200%200%205.173%201.318%2010.83%2010.83%200%200%200%207.663-18.483m-7.658%2016.655a8.94%208.94%200%200%201-4.62-1.277l.041.023-.329-.194-3.405.894.908-3.321-.214-.34a8.9%208.9%200%200%201-1.376-4.782%209%209%200%201%201%209%209Zm4.935-6.736c-.27-.135-1.6-.789-1.848-.88s-.429-.135-.61.136-.7.879-.856%201.06-.316.2-.586.068a7.5%207.5%200%200%201-2.183-1.349l.007.007a8.2%208.2%200%200%201-1.483-1.842l-.02-.038c-.157-.27-.017-.417.118-.551s.271-.316.406-.473a1.9%201.9%200%200%200%20.267-.44v-.012a.5.5%200%200%200%20.05-.216.5.5%200%200%200-.074-.26c-.068-.135-.609-1.467-.834-2.009s-.444-.455-.609-.464-.338-.009-.519-.009a.99.99%200%200%200-.72.337%203.03%203.03%200%200%200-.947%202.2v.058a5.27%205.27%200%200%200%201.114%202.815v-.011a12.16%2012.16%200%200%200%204.553%204.053l.068.031a14%2014%200%200%200%201.434.539l.109.03a3.6%203.6%200%200%200%201.077.161%203.7%203.7%200%200%200%20.648-.057h-.023a2.8%202.8%200%200%200%201.819-1.274l.007-.012a2.2%202.2%200%200%200%20.19-.9%202.3%202.3%200%200%200-.034-.395v.014c-.067-.113-.248-.18-.519-.316Z'/%3e%3c/svg%3e",I3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='25.085'%20height='18.5'%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='none'%20d='M0%200h25.085v18.5H0z'%20data-name='Rectángulo%204598'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23a)'%20data-name='Grupo%207946'%3e%3cpath%20d='M23.12%205.809V3.226a3.2%203.2%200%200%200-.068-.656l-3.141%202.21a7.8%207.8%200%200%201%203.209%201.032'%20data-name='Trazado%2013329'/%3e%3cpath%20d='M11.847%209.791c-.1.009-.2.023-.308.023a3.78%203.78%200%200%201-2.18-.688L.067%202.58A3.2%203.2%200%200%200%200%203.227V13.98a3.23%203.23%200%200%200%203.226%203.226h9.611a7.86%207.86%200%200%201-.99-7.414'%20data-name='Trazado%2013330'/%3e%3cpath%20d='M12.478%207.369%2021.92.737A3.2%203.2%200%200%200%2019.894%200H3.226a3.2%203.2%200%200%200-2.031.74l9.4%206.628a1.64%201.64%200%200%200%201.881%200'%20data-name='Trazado%2013331'/%3e%3cpath%20d='M23.356%208.407a5.914%205.914%200%201%200%200%208.364%205.92%205.92%200%200%200%200-8.364m-1.833%204.842a.54.54%200%200%201-1.081%200v-1.164l-2.513%202.516a.54.54%200%200%201-.765-.763l2.515-2.515h-1.167a.54.54%200%201%201%200-1.081h2.471a.54.54%200%200%201%20.54.54Z'%20data-name='Trazado%2013332'/%3e%3c/g%3e%3c/svg%3e";function hc(e,r,t){return e.accessor?e.accessor(r,t):e.field?r?.[e.field]:r?.[e?.key||""]}function O3(e,r){const t=e??"",n=r??"";return t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():typeof t=="number"&&typeof n=="number"?t-n:typeof t=="boolean"&&typeof n=="boolean"?Number(t)-Number(n):String(t).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function mc(e,r,t=!0){return typeof e=="function"?e(r):e??t}function P3(e){return e.replace(/[^\d]/g,"")}function j3(e,r){return r}var ua={},v0;function R3(){if(v0)return ua;v0=1;var e=lt();Object.defineProperty(ua,"__esModule",{value:!0}),ua.default=void 0;var r=e(ht()),t=dt();return ua.default=(0,r.default)((0,t.jsx)("path",{d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAlt"),ua}var N3=R3();const L3=it(N3);var da={},y0;function $3(){if(y0)return da;y0=1;var e=lt();Object.defineProperty(da,"__esModule",{value:!0}),da.default=void 0;var r=e(ht()),t=dt();return da.default=(0,r.default)((0,t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27c1.2-1.4 1.82-3.31 1.48-5.34-.47-2.78-2.79-5-5.59-5.34-4.23-.52-7.79 3.04-7.27 7.27.34 2.8 2.56 5.12 5.34 5.59 2.03.34 3.94-.28 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"SearchRounded"),da}var z3=$3();const B3=it(z3);var fa={},b0;function F3(){if(b0)return fa;b0=1;var e=lt();Object.defineProperty(fa,"__esModule",{value:!0}),fa.default=void 0;var r=e(ht()),t=dt();return fa.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),fa}var U3=F3();const W3=it(U3);var pa={},x0;function V3(){if(x0)return pa;x0=1;var e=lt();Object.defineProperty(pa,"__esModule",{value:!0}),pa.default=void 0;var r=e(ht()),t=dt();return pa.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),pa}var H3=V3();const Y3=it(H3);function w0(e){return e==="right"?"end":e==="center"?"center":"start"}function _0(e){const r=e.filter(t=>!t.width).length||1;return e.map(t=>typeof t.width=="number"?`${t.width}px`:typeof t.width=="string"?t.width:`minmax(0, ${1/r}fr)`).join(" ")}const q3=1060,gc=(e,r)=>e.metrics.find(t=>String(t.label).toLowerCase()===r.toLowerCase())?.value??"";function Z3({sections:e,detailColumns:r,summaryWidths:t=["1fr",120,120,150],minWidth:n=q3,getDetailColumns:o,onRowClick:a}){function l(u){if(typeof u=="number")return u;if(!u)return 0;const f=/^(\d+)\s*px$/.exec(u.trim());return f?Number(f[1]):/fr$/i.test(u)?160:0}function d(u){const f=u.reduce((v,p)=>v+l(p.width),0),h=Math.max(u.length-1,0)*16;return f+h+32}return c.jsx(m.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:c.jsxs(m.Box,{children:[c.jsx(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(u=>typeof u=="number"?`${u}px`:u).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"#1E5BCE",color:"#fff",boxSizing:"border-box"},children:["Tipo","En Proceso","Finalizadas","Último seg."].map(u=>c.jsx(m.Typography,{sx:{fontSize:13,fontWeight:800},children:u},u))}),e.map((u,f)=>{const[h,g]=M.useState(!!u.initiallyOpen),v=f%2===1,p=o?o(u):r,y=Math.max(n,d(p));return c.jsxs(m.Box,{children:[c.jsxs(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(_=>typeof _=="number"?`${_}px`:_).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:v?"rgba(30,91,206,0.06)":"background.paper",borderTop:"1px solid rgba(0,0,0,0.08)","&:hover":{bgcolor:"rgba(30,91,206,0.12)"},boxSizing:"border-box",cursor:"pointer"},onClick:()=>g(_=>!_),children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[c.jsx(m.IconButton,{size:"small",disableRipple:!0,children:h?c.jsx(Y3,{}):c.jsx(W3,{})}),c.jsx(m.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(u.title),children:u.title})]}),c.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:gc(u,"En Proceso")}),c.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:gc(u,"Finalizadas")}),c.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:gc(u,"Último seg.")})]}),c.jsx(m.Collapse,{in:h,unmountOnExit:!0,children:c.jsxs(m.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[c.jsx(m.Box,{sx:{minWidth:y,display:"grid",gridTemplateColumns:_0(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"rgba(30,91,206,0.18)",color:"#1a1a1a",borderTop:"1px solid rgba(0,0,0,0.12)",boxSizing:"border-box"},children:p.map(_=>c.jsx(m.Typography,{sx:{justifySelf:w0(_.align),textAlign:_.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.header},_.key))}),(u.rows??[]).map((_,S)=>c.jsx(m.Box,{sx:{minWidth:y,display:"grid",gridTemplateColumns:_0(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:S%2===0?"background.paper":"rgba(30,91,206,0.06)",borderTop:"1px solid rgba(0,0,0,0.06)","&:hover":{bgcolor:"rgba(30,91,206,0.12)"},boxSizing:"border-box",cursor:"pointer"},onClick:()=>a?.(_,u),children:p.map((C,E)=>{const w=C.accessor?C.accessor(_,S):C.field?_[C.field]:null;return c.jsx(m.Box,{sx:{justifySelf:w0(C.align),textAlign:C.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof w=="string"||typeof w=="number"?c.jsx(m.Typography,{sx:{fontSize:13,fontWeight:/^(estatus|seg|avance|nivel|asesor|fecha)$/i.test(C.key)?700:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(w),children:w}):w},C.key??E)})},_.id??S))]})})]},u.id)})]})})}var ha={},S0;function G3(){if(S0)return ha;S0=1;var e=lt();Object.defineProperty(ha,"__esModule",{value:!0}),ha.default=void 0;var r=e(ht()),t=dt();return ha.default=(0,r.default)((0,t.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m3.3 14.71L11 12.41V7h2v4.59l3.71 3.71z"}),"AccessTimeFilled"),ha}var K3=G3();const Q3=it(K3),J3=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",X3=e=>{const r=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return r||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},e5=e=>{const r=(e||"").split(" ").filter(Boolean);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var ma={},C0;function t5(){if(C0)return ma;C0=1;var e=lt();Object.defineProperty(ma,"__esModule",{value:!0}),ma.default=void 0;var r=e(ht()),t=dt();return ma.default=(0,r.default)((0,t.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Create"),ma}var r5=t5();const n5=it(r5),vc=({current:e=0,total:r=0,color:t="#4caf50"})=>c.jsx("div",{style:{display:"flex",gap:"1px",width:"100%",height:"100%",justifyContent:"center",overflow:"hidden",minWidth:0},children:Array.from({length:r}).map((n,o)=>c.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?t:"#e0e0e0",display:"flex"}},o))});var ga={},E0;function o5(){if(E0)return ga;E0=1;var e=lt();Object.defineProperty(ga,"__esModule",{value:!0}),ga.default=void 0;var r=e(ht()),t=dt();return ga.default=(0,r.default)((0,t.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),ga}var a5=o5();const D0=it(a5);var va={},A0;function s5(){if(A0)return va;A0=1;var e=lt();Object.defineProperty(va,"__esModule",{value:!0}),va.default=void 0;var r=e(ht()),t=dt();return va.default=(0,r.default)((0,t.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),va}var i5=s5();const l5=it(i5),c5=e=>{const r=String(e??"").toLowerCase().trim();return r==="muy interesado"?{bg:"#E53935",color:"#FFFFFF"}:r==="interesado"?{bg:"#FB8C00",color:"#FFFFFF"}:r==="venta definitiva"?{bg:"#2E7D32",color:"#FFFFFF"}:r==="no sé"||r==="no se"?{bg:"#9E9E9E",color:"#FFFFFF"}:r==="algo interesado"?{bg:"#FFEB3B",color:"#000000"}:{bg:"transparent",color:"#2c2c2c"}},u5=e=>{switch(parseInt(String(e??""),10)){case 1:return"Por Asignar";case 2:return"Solicitud Asignada";case 3:return"Solicitud asignada en proceso";case 4:return"Finalizadas sin Venta";case 5:return"Finalizadas con Venta";case 6:return"Rechazadas";case 7:return"Finalizada por sistema";case 8:return"";case 9:return"";case 10:return"Prospección";case 11:return"Interés Real";case 12:return"Proceso de Compra";case 13:return"";case 14:return"En espera de Unidad";case 15:return"Auto Facturado";case 16:return"";case 17:return"";case 18:return"Compró otra Marca";case 19:return"No comprará";default:return null}},d5=e=>{switch(parseInt(String(e??""),10)){case 1:return"Por asignar";case 2:return"Solicitud Asignada";case 3:return"En seguimiento";case 6:return"Rechazada";case 7:return"Finalizada sin enviar a Ventas";case 8:return"Finalizada enviado a Ventas";default:return null}},f5=e=>{switch(parseInt(String(e??""),10)){case 0:return"Sin asignar";case 1:return"Confirmado";case 2:return"Solicitud Asignada";case 3:return"En seguimiento";case 4:return"Confirmado";case 5:return"Finalizada";case 6:return"Rechazada";case 10:return"Reagendado";case 20:return"Seguimiento [Cita Finalizada]";case 30:return"Reenvio";case 40:return"Seguimiento [Mecanico]";case 50:return"Seguimiento";default:return null}};function p5(e){const r=new Date(e),t=r.toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),n=r.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"});return`${t.replace(".","")} • ${n}`}function h5(e){return e.replace(/<br\s*\/?>/gi,`
188
+ Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let u=rn(),f;f=u;let h=f.pathname||"/",g=h;if(l!=="/"){let y=l.replace(/^\//,"").split("/");g="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let v=rh(e,{pathname:g});return en(d||v!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),en(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),uA(v&&v.map(y=>Object.assign({},y,{params:Object.assign({},s,y.params),pathname:qr([l,n.encodeLocation?n.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:qr([l,n.encodeLocation?n.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),o,t)}function sA(){let e=mA(),r=YD(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),t=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:n},a={padding:"2px 4px",backgroundColor:n},s=null;return console.error("Error handled by React Router default ErrorBoundary:",e),s=M.createElement(M.Fragment,null,M.createElement("p",null,"💿 Hey developer 👋"),M.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",M.createElement("code",{style:a},"ErrorBoundary")," or"," ",M.createElement("code",{style:a},"errorElement")," prop on your route.")),M.createElement(M.Fragment,null,M.createElement("h2",null,"Unexpected Application Error!"),M.createElement("h3",{style:{fontStyle:"italic"}},r),t?M.createElement("pre",{style:o},t):null,s)}var iA=M.createElement(sA,null),gh=class extends M.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){this.props.onError?this.props.onError(e,r):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const t=tA(e.digest);t&&(e=t)}let r=e!==void 0?M.createElement(tn.Provider,{value:this.props.routeContext},M.createElement(Vl.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?M.createElement(lA,{error:e},r):r}};gh.contextType=dh;var Hl=new WeakMap;function lA({children:e,error:r}){let{basename:t}=M.useContext(Mr);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let n=eA(r.digest);if(n){let o=Hl.get(r);if(o)throw o;let a=ch(n.location,t);if(lh&&!Hl.get(r))if(a.isExternal||n.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const s=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:n.replace}));throw Hl.set(r,s),s}return M.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function cA({routeContext:e,match:r,children:t}){let n=M.useContext(ro);return n&&n.static&&n.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=r.route.id),M.createElement(tn.Provider,{value:e},t)}function uA(e,r=[],t){let n=t?.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(r.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=n?.errors;if(a!=null){let u=o.findIndex(f=>f.route.id&&a?.[f.route.id]!==void 0);Yt(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,u+1))}let s=!1,i=-1;if(t&&n){s=n.renderFallback;for(let u=0;u<o.length;u++){let f=o[u];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(i=u),f.route.id){let{loaderData:h,errors:g}=n,v=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!g||g[f.route.id]===void 0);if(f.route.lazy||v){t.isStatic&&(s=!0),i>=0?o=o.slice(0,i+1):o=[o[0]];break}}}}let l=t?.onError,d=n&&l?(u,f)=>{l(u,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:qD(n.matches),errorInfo:f})}:void 0;return o.reduceRight((u,f,h)=>{let g,v=!1,p=null,y=null;n&&(g=a&&f.route.id?a[f.route.id]:void 0,p=f.route.errorElement||iA,s&&(i<0&&h===0?(yh("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,y=null):i===h&&(v=!0,y=f.route.hydrateFallbackElement||null)));let _=r.concat(o.slice(0,h+1)),S=()=>{let C;return g?C=p:v?C=y:f.route.Component?C=M.createElement(f.route.Component,null):f.route.element?C=f.route.element:C=u,M.createElement(cA,{match:f,routeContext:{outlet:u,matches:_,isDataRoute:n!=null},children:C})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?M.createElement(gh,{location:n.location,revalidation:n.revalidation,component:p,error:g,children:S(),routeContext:{outlet:null,matches:_,isDataRoute:!0},onError:d}):S()},null)}function Yl(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dA(e){let r=M.useContext(ro);return Yt(r,Yl(e)),r}function fA(e){let r=M.useContext(Zs);return Yt(r,Yl(e)),r}function pA(e){let r=M.useContext(tn);return Yt(r,Yl(e)),r}function ql(e){let r=pA(e),t=r.matches[r.matches.length-1];return Yt(t.route.id,`${e} can only be used on routes that contain a unique "id"`),t.route.id}function hA(){return ql("useRouteId")}function mA(){let e=M.useContext(Vl),r=fA("useRouteError"),t=ql("useRouteError");return e!==void 0?e:r.errors?.[t]}function gA(){let{router:e}=dA("useNavigate"),r=ql("useNavigate"),t=M.useRef(!1);return mh(()=>{t.current=!0}),M.useCallback(async(o,a={})=>{en(t.current,hh),t.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:r,...a}))},[e,r])}var vh={};function yh(e,r,t){!r&&!vh[e]&&(vh[e]=!0,en(!1,t))}M.memo(vA);function vA({routes:e,future:r,state:t,isStatic:n,onError:o}){return aA(e,void 0,{state:t,isStatic:n,onError:o})}var Ks="get",Qs="application/x-www-form-urlencoded";function Js(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function yA(e){return Js(e)&&e.tagName.toLowerCase()==="button"}function bA(e){return Js(e)&&e.tagName.toLowerCase()==="form"}function xA(e){return Js(e)&&e.tagName.toLowerCase()==="input"}function wA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function _A(e,r){return e.button===0&&(!r||r==="_self")&&!wA(e)}var Xs=null;function SA(){if(Xs===null)try{new FormData(document.createElement("form"),0),Xs=!1}catch{Xs=!0}return Xs}var CA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Zl(e){return e!=null&&!CA.has(e)?(en(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Qs}"`),null):e}function EA(e,r){let t,n,o,a,s;if(bA(e)){let i=e.getAttribute("action");n=i?mn(i,r):null,t=e.getAttribute("method")||Ks,o=Zl(e.getAttribute("enctype"))||Qs,a=new FormData(e)}else if(yA(e)||xA(e)&&(e.type==="submit"||e.type==="image")){let i=e.form;if(i==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||i.getAttribute("action");if(n=l?mn(l,r):null,t=e.getAttribute("formmethod")||i.getAttribute("method")||Ks,o=Zl(e.getAttribute("formenctype"))||Zl(i.getAttribute("enctype"))||Qs,a=new FormData(i,e),!SA()){let{name:d,type:u,value:f}=e;if(u==="image"){let h=d?`${d}.`:"";a.append(`${h}x`,"0"),a.append(`${h}y`,"0")}else d&&a.append(d,f)}}else{if(Js(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=Ks,n=null,o=Qs,s=e}return a&&o==="text/plain"&&(s=a,a=void 0),{action:n,method:t.toLowerCase(),encType:o,formData:a,body:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Gl(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function bh(e,r,t,n){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return t?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${n}`:o.pathname=`${o.pathname}.${n}`:o.pathname==="/"?o.pathname=`_root.${n}`:r&&mn(o.pathname,r)==="/"?o.pathname=`${r.replace(/\/$/,"")}/_root.${n}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${n}`,o}async function DA(e,r){if(e.id in r)return r[e.id];try{let t=await import(e.module);return r[e.id]=t,t}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function AA(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function kA(e,r,t){let n=await Promise.all(e.map(async o=>{let a=r.routes[o.route.id];if(a){let s=await DA(a,t);return s.links?s.links():[]}return[]}));return OA(n.flat(1).filter(AA).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function xh(e,r,t,n,o,a){let s=(l,d)=>t[d]?l.route.id!==t[d].route.id:!0,i=(l,d)=>t[d].pathname!==l.pathname||t[d].route.path?.endsWith("*")&&t[d].params["*"]!==l.params["*"];return a==="assets"?r.filter((l,d)=>s(l,d)||i(l,d)):a==="data"?r.filter((l,d)=>{let u=n.routes[l.route.id];if(!u||!u.hasLoader)return!1;if(s(l,d)||i(l,d))return!0;if(l.route.shouldRevalidate){let f=l.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:t[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function TA(e,r,{includeHydrateFallback:t}={}){return MA(e.map(n=>{let o=r.routes[n.route.id];if(!o)return[];let a=[o.module];return o.clientActionModule&&(a=a.concat(o.clientActionModule)),o.clientLoaderModule&&(a=a.concat(o.clientLoaderModule)),t&&o.hydrateFallbackModule&&(a=a.concat(o.hydrateFallbackModule)),o.imports&&(a=a.concat(o.imports)),a}).flat(1))}function MA(e){return[...new Set(e)]}function IA(e){let r={},t=Object.keys(e).sort();for(let n of t)r[n]=e[n];return r}function OA(e,r){let t=new Set;return new Set(r),e.reduce((n,o)=>{let a=JSON.stringify(IA(o));return t.has(a)||(t.add(a),n.push({key:a,link:o})),n},[])}function Kl(){let e=M.useContext(ro);return Gl(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function PA(){let e=M.useContext(Zs);return Gl(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ql=M.createContext(void 0);Ql.displayName="FrameworkContext";function Jl(){let e=M.useContext(Ql);return Gl(e,"You must render this element inside a <HydratedRouter> element"),e}function jA(e,r){let t=M.useContext(Ql),[n,o]=M.useState(!1),[a,s]=M.useState(!1),{onFocus:i,onBlur:l,onMouseEnter:d,onMouseLeave:u,onTouchStart:f}=r,h=M.useRef(null);M.useEffect(()=>{if(e==="render"&&s(!0),e==="viewport"){let p=_=>{_.forEach(S=>{s(S.isIntersecting)})},y=new IntersectionObserver(p,{threshold:.5});return h.current&&y.observe(h.current),()=>{y.disconnect()}}},[e]),M.useEffect(()=>{if(n){let p=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(p)}}},[n]);let g=()=>{o(!0)},v=()=>{o(!1),s(!1)};return t?e!=="intent"?[a,h,{}]:[a,h,{onFocus:Ko(i,g),onBlur:Ko(l,v),onMouseEnter:Ko(d,g),onMouseLeave:Ko(u,v),onTouchStart:Ko(f,g)}]:[!1,h,{}]}function Ko(e,r){return t=>{e&&e(t),t.defaultPrevented||r(t)}}function RA({page:e,...r}){let t=GD(),{router:n}=Kl(),o=M.useMemo(()=>rh(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?t?M.createElement(LA,{page:e,matches:o,...r}):M.createElement($A,{page:e,matches:o,...r}):null}function NA(e){let{manifest:r,routeModules:t}=Jl(),[n,o]=M.useState([]);return M.useEffect(()=>{let a=!1;return kA(e,r,t).then(s=>{a||o(s)}),()=>{a=!0}},[e,r,t]),n}function LA({page:e,matches:r,...t}){let n=rn(),{future:o}=Jl(),{basename:a}=Kl(),s=M.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let i=bh(e,a,o.unstable_trailingSlashAwareDataRequests,"rsc"),l=!1,d=[];for(let u of r)typeof u.route.shouldRevalidate=="function"?l=!0:d.push(u.route.id);return l&&d.length>0&&i.searchParams.set("_routes",d.join(",")),[i.pathname+i.search]},[a,o.unstable_trailingSlashAwareDataRequests,e,n,r]);return M.createElement(M.Fragment,null,s.map(i=>M.createElement("link",{key:i,rel:"prefetch",as:"fetch",href:i,...t})))}function $A({page:e,matches:r,...t}){let n=rn(),{future:o,manifest:a,routeModules:s}=Jl(),{basename:i}=Kl(),{loaderData:l,matches:d}=PA(),u=M.useMemo(()=>xh(e,r,d,a,n,"data"),[e,r,d,a,n]),f=M.useMemo(()=>xh(e,r,d,a,n,"assets"),[e,r,d,a,n]),h=M.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let p=new Set,y=!1;if(r.forEach(S=>{let C=a.routes[S.route.id];!C||!C.hasLoader||(!u.some(E=>E.route.id===S.route.id)&&S.route.id in l&&s[S.route.id]?.shouldRevalidate||C.hasClientLoader?y=!0:p.add(S.route.id))}),p.size===0)return[];let _=bh(e,i,o.unstable_trailingSlashAwareDataRequests,"data");return y&&p.size>0&&_.searchParams.set("_routes",r.filter(S=>p.has(S.route.id)).map(S=>S.route.id).join(",")),[_.pathname+_.search]},[i,o.unstable_trailingSlashAwareDataRequests,l,n,a,u,r,e,s]),g=M.useMemo(()=>TA(f,a),[f,a]),v=NA(f);return M.createElement(M.Fragment,null,h.map(p=>M.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...t})),g.map(p=>M.createElement("link",{key:p,rel:"modulepreload",href:p,...t})),v.map(({key:p,link:y})=>M.createElement("link",{key:p,nonce:t.nonce,...y,crossOrigin:y.crossOrigin??t.crossOrigin})))}function zA(...e){return r=>{e.forEach(t=>{typeof t=="function"?t(r):t!=null&&(t.current=r)})}}var BA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{BA&&(window.__reactRouterVersion="7.14.0")}catch{}var wh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xl=M.forwardRef(function({onClick:r,discover:t="render",prefetch:n="none",relative:o,reloadDocument:a,replace:s,unstable_mask:i,state:l,target:d,to:u,preventScrollReset:f,viewTransition:h,unstable_defaultShouldRevalidate:g,...v},p){let{basename:y,navigator:_,unstable_useTransitions:S}=M.useContext(Mr),C=typeof u=="string"&&wh.test(u),E=ch(u,y);u=E.to;let w=rA(u,{relative:o}),N=rn(),D=null;if(i){let J=Ul(i,[],N.unstable_mask?N.unstable_mask.pathname:"/",!0);y!=="/"&&(J.pathname=J.pathname==="/"?y:qr([y,J.pathname])),D=_.createHref(J)}let[k,O,I]=jA(n,v),Y=VA(u,{replace:s,unstable_mask:i,state:l,target:d,preventScrollReset:f,relative:o,viewTransition:h,unstable_defaultShouldRevalidate:g,unstable_useTransitions:S});function V(J){r&&r(J),J.defaultPrevented||Y(J)}let W=!(E.isExternal||a),Z=M.createElement("a",{...v,...I,href:(W?D:void 0)||E.absoluteURL||w,onClick:W?V:r,ref:zA(p,O),target:d,"data-discover":!C&&t==="render"?"true":void 0});return k&&!C?M.createElement(M.Fragment,null,Z,M.createElement(RA,{page:w})):Z});Xl.displayName="Link";var FA=M.forwardRef(function({"aria-current":r="page",caseSensitive:t=!1,className:n="",end:o=!1,style:a,to:s,viewTransition:i,children:l,...d},u){let f=Go(s,{relative:d.relative}),h=rn(),g=M.useContext(Zs),{navigator:v,basename:p}=M.useContext(Mr),y=g!=null&&GA(f)&&i===!0,_=v.encodeLocation?v.encodeLocation(f).pathname:f.pathname,S=h.pathname,C=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;t||(S=S.toLowerCase(),C=C?C.toLowerCase():null,_=_.toLowerCase()),C&&p&&(C=mn(C,p)||C);const E=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let w=S===_||!o&&S.startsWith(_)&&S.charAt(E)==="/",N=C!=null&&(C===_||!o&&C.startsWith(_)&&C.charAt(_.length)==="/"),D={isActive:w,isPending:N,isTransitioning:y},k=w?r:void 0,O;typeof n=="function"?O=n(D):O=[n,w?"active":null,N?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let I=typeof a=="function"?a(D):a;return M.createElement(Xl,{...d,"aria-current":k,className:O,ref:u,style:I,to:s,viewTransition:i},typeof l=="function"?l(D):l)});FA.displayName="NavLink";var UA=M.forwardRef(({discover:e="render",fetcherKey:r,navigate:t,reloadDocument:n,replace:o,state:a,method:s=Ks,action:i,onSubmit:l,relative:d,preventScrollReset:u,viewTransition:f,unstable_defaultShouldRevalidate:h,...g},v)=>{let{unstable_useTransitions:p}=M.useContext(Mr),y=qA(),_=ZA(i,{relative:d}),S=s.toLowerCase()==="get"?"get":"post",C=typeof i=="string"&&wh.test(i),E=w=>{if(l&&l(w),w.defaultPrevented)return;w.preventDefault();let N=w.nativeEvent.submitter,D=N?.getAttribute("formmethod")||s,k=()=>y(N||w.currentTarget,{fetcherKey:r,method:D,navigate:t,replace:o,state:a,relative:d,preventScrollReset:u,viewTransition:f,unstable_defaultShouldRevalidate:h});p&&t!==!1?M.startTransition(()=>k()):k()};return M.createElement("form",{ref:v,method:S,action:_,onSubmit:n?l:E,...g,"data-discover":!C&&e==="render"?"true":void 0})});UA.displayName="Form";function WA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function _h(e){let r=M.useContext(ro);return Yt(r,WA(e)),r}function VA(e,{target:r,replace:t,unstable_mask:n,state:o,preventScrollReset:a,relative:s,viewTransition:i,unstable_defaultShouldRevalidate:l,unstable_useTransitions:d}={}){let u=nA(),f=rn(),h=Go(e,{relative:s});return M.useCallback(g=>{if(_A(g,r)){g.preventDefault();let v=t!==void 0?t:zl(f)===zl(h),p=()=>u(e,{replace:v,unstable_mask:n,state:o,preventScrollReset:a,relative:s,viewTransition:i,unstable_defaultShouldRevalidate:l});d?M.startTransition(()=>p()):p()}},[f,u,h,t,n,o,r,e,a,s,i,l,d])}var HA=0,YA=()=>`__${String(++HA)}__`;function qA(){let{router:e}=_h("useSubmit"),{basename:r}=M.useContext(Mr),t=hA(),n=e.fetch,o=e.navigate;return M.useCallback(async(a,s={})=>{let{action:i,method:l,encType:d,formData:u,body:f}=EA(a,r);if(s.navigate===!1){let h=s.fetcherKey||YA();await n(h,t,s.action||i,{unstable_defaultShouldRevalidate:s.unstable_defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,formData:u,body:f,formMethod:s.method||l,formEncType:s.encType||d,flushSync:s.flushSync})}else await o(s.action||i,{unstable_defaultShouldRevalidate:s.unstable_defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,formData:u,body:f,formMethod:s.method||l,formEncType:s.encType||d,replace:s.replace,state:s.state,fromRouteId:t,flushSync:s.flushSync,viewTransition:s.viewTransition})},[n,o,r,t])}function ZA(e,{relative:r}={}){let{basename:t}=M.useContext(Mr),n=M.useContext(tn);Yt(n,"useFormAction must be used inside a RouteContext");let[o]=n.matches.slice(-1),a={...Go(e||".",{relative:r})},s=rn();if(e==null){a.search=s.search;let i=new URLSearchParams(a.search),l=i.getAll("index");if(l.some(u=>u==="")){i.delete("index"),l.filter(f=>f).forEach(f=>i.append("index",f));let u=i.toString();a.search=u?`?${u}`:""}}return(!e||e===".")&&o.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(a.pathname=a.pathname==="/"?t:qr([t,a.pathname])),zl(a)}function GA(e,{relative:r}={}){let t=M.useContext(fh);Yt(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=_h("useViewTransitionState"),o=Go(e,{relative:r});if(!t.isTransitioning)return!1;let a=mn(t.currentLocation.pathname,n)||t.currentLocation.pathname,s=mn(t.nextLocation.pathname,n)||t.nextLocation.pathname;return qs(o.pathname,s)!=null||qs(o.pathname,a)!=null}var Qo=e=>e.type==="checkbox",On=e=>e instanceof Date,tr=e=>e==null;const Sh=e=>typeof e=="object";var Lt=e=>!tr(e)&&!Array.isArray(e)&&Sh(e)&&!On(e),Ch=e=>Lt(e)&&e.target?Qo(e.target)?e.target.checked:e.target.value:e,KA=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Eh=(e,r)=>e.has(KA(r)),QA=e=>{const r=e.constructor&&e.constructor.prototype;return Lt(r)&&r.hasOwnProperty("isPrototypeOf")},ec=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ft(e){let r;const t=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(!(ec&&(e instanceof Blob||n))&&(t||Lt(e)))if(r=t?[]:Object.create(Object.getPrototypeOf(e)),!t&&!QA(e))r=e;else for(const o in e)e.hasOwnProperty(o)&&(r[o]=Ft(e[o]));else return e;return r}var ei=e=>/^\w*$/.test(e),$t=e=>e===void 0,tc=e=>Array.isArray(e)?e.filter(Boolean):[],rc=e=>tc(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ue=(e,r,t)=>{if(!r||!Lt(e))return t;const n=(ei(r)?[r]:rc(r)).reduce((o,a)=>tr(o)?o:o[a],e);return $t(n)||n===e?$t(e[r])?t:e[r]:n},mr=e=>typeof e=="boolean",ct=(e,r,t)=>{let n=-1;const o=ei(r)?[r]:rc(r),a=o.length,s=a-1;for(;++n<a;){const i=o[n];let l=t;if(n!==s){const d=e[i];l=Lt(d)||Array.isArray(d)?d:isNaN(+o[n+1])?{}:[]}if(i==="__proto__"||i==="constructor"||i==="prototype")return;e[i]=l,e=e[i]}};const ti={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ir={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},nn={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},nc=b.createContext(null);nc.displayName="HookFormContext";const oc=()=>b.useContext(nc),JA=e=>{const{children:r,...t}=e;return b.createElement(nc.Provider,{value:t},r)};var Dh=(e,r,t,n=!0)=>{const o={defaultValues:r._defaultValues};for(const a in e)Object.defineProperty(o,a,{get:()=>{const s=a;return r._proxyFormState[s]!==Ir.all&&(r._proxyFormState[s]=!n||Ir.all),t&&(t[s]=!0),e[s]}});return o};const ac=typeof window<"u"?b.useLayoutEffect:b.useEffect;function XA(e){const r=oc(),{control:t=r.control,disabled:n,name:o,exact:a}=e||{},[s,i]=b.useState(t._formState),l=b.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ac(()=>t._subscribe({name:o,formState:l.current,exact:a,callback:d=>{!n&&i({...t._formState,...d})}}),[o,n,a]),b.useEffect(()=>{l.current.isValid&&t._setValid(!0)},[t]),b.useMemo(()=>Dh(s,t,l.current,!1),[s,t])}var Zr=e=>typeof e=="string",Ah=(e,r,t,n,o)=>Zr(e)?(n&&r.watch.add(e),ue(t,e,o)):Array.isArray(e)?e.map(a=>(n&&r.watch.add(a),ue(t,a))):(n&&(r.watchAll=!0),t),sc=e=>tr(e)||!Sh(e);function on(e,r,t=new WeakSet){if(sc(e)||sc(r))return e===r;if(On(e)&&On(r))return e.getTime()===r.getTime();const n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const a of n){const s=e[a];if(!o.includes(a))return!1;if(a!=="ref"){const i=r[a];if(On(s)&&On(i)||Lt(s)&&Lt(i)||Array.isArray(s)&&Array.isArray(i)?!on(s,i,t):s!==i)return!1}}return!0}function kh(e){const r=oc(),{control:t=r.control,name:n,defaultValue:o,disabled:a,exact:s,compute:i}=e||{},l=b.useRef(o),d=b.useRef(i),u=b.useRef(void 0);d.current=i;const f=b.useMemo(()=>t._getWatch(n,l.current),[t,n]),[h,g]=b.useState(d.current?d.current(f):f);return ac(()=>t._subscribe({name:n,formState:{values:!0},exact:s,callback:v=>{if(!a){const p=Ah(n,t._names,v.values||t._formValues,!1,l.current);if(d.current){const y=d.current(p);on(y,u.current)||(g(y),u.current=y)}else g(p)}}}),[t,a,n,s]),b.useEffect(()=>t._removeUnmounted()),h}function ek(e){const r=oc(),{name:t,disabled:n,control:o=r.control,shouldUnregister:a,defaultValue:s}=e,i=Eh(o._names.array,t),l=b.useMemo(()=>ue(o._formValues,t,ue(o._defaultValues,t,s)),[o,t,s]),d=kh({control:o,name:t,defaultValue:l,exact:!0}),u=XA({control:o,name:t,exact:!0}),f=b.useRef(e),h=b.useRef(o.register(t,{...e.rules,value:d,...mr(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const g=b.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(u.errors,t)},isDirty:{enumerable:!0,get:()=>!!ue(u.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!ue(u.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!ue(u.validatingFields,t)},error:{enumerable:!0,get:()=>ue(u.errors,t)}}),[u,t]),v=b.useCallback(S=>h.current.onChange({target:{value:Ch(S),name:t},type:ti.CHANGE}),[t]),p=b.useCallback(()=>h.current.onBlur({target:{value:ue(o._formValues,t),name:t},type:ti.BLUR}),[t,o._formValues]),y=b.useCallback(S=>{const C=ue(o._fields,t);C&&S&&(C._f.ref={focus:()=>S.focus&&S.focus(),select:()=>S.select&&S.select(),setCustomValidity:E=>S.setCustomValidity(E),reportValidity:()=>S.reportValidity()})},[o._fields,t]),_=b.useMemo(()=>({name:t,value:d,...mr(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:v,onBlur:p,ref:y}),[t,n,u.disabled,v,p,y,d]);return b.useEffect(()=>{const S=o._options.shouldUnregister||a;o.register(t,{...f.current.rules,...mr(f.current.disabled)?{disabled:f.current.disabled}:{}});const C=(E,w)=>{const N=ue(o._fields,E);N&&N._f&&(N._f.mount=w)};if(C(t,!0),S){const E=Ft(ue(o._options.defaultValues,t));ct(o._defaultValues,t,E),$t(ue(o._formValues,t))&&ct(o._formValues,t,E)}return!i&&o.register(t),()=>{(i?S&&!o._state.action:S)?o.unregister(t):C(t,!1)}},[t,o,i,a]),b.useEffect(()=>{o._setDisabledField({disabled:n,name:t})},[n,t,o]),b.useMemo(()=>({field:_,formState:u,fieldState:g}),[_,u,g])}const Or=e=>e.render(ek(e));var ic=(e,r,t,n,o)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[n]:o||!0}}:{},Jo=e=>Array.isArray(e)?e:[e],Th=()=>{let e=[];return{get observers(){return e},next:o=>{for(const a of e)a.next&&a.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(a=>a!==o)}}),unsubscribe:()=>{e=[]}}},lr=e=>Lt(e)&&!Object.keys(e).length,lc=e=>e.type==="file",Pr=e=>typeof e=="function",ri=e=>{if(!ec)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Mh=e=>e.type==="select-multiple",cc=e=>e.type==="radio",tk=e=>cc(e)||Qo(e),uc=e=>ri(e)&&e.isConnected;function rk(e,r){const t=r.slice(0,-1).length;let n=0;for(;n<t;)e=$t(e)?n++:e[r[n++]];return e}function nk(e){for(const r in e)if(e.hasOwnProperty(r)&&!$t(e[r]))return!1;return!0}function Bt(e,r){const t=Array.isArray(r)?r:ei(r)?[r]:rc(r),n=t.length===1?e:rk(e,t),o=t.length-1,a=t[o];return n&&delete n[a],o!==0&&(Lt(n)&&lr(n)||Array.isArray(n)&&nk(n))&&Bt(e,t.slice(0,-1)),e}var Ih=e=>{for(const r in e)if(Pr(e[r]))return!0;return!1};function ni(e,r={}){const t=Array.isArray(e);if(Lt(e)||t)for(const n in e)Array.isArray(e[n])||Lt(e[n])&&!Ih(e[n])?(r[n]=Array.isArray(e[n])?[]:{},ni(e[n],r[n])):tr(e[n])||(r[n]=!0);return r}function Oh(e,r,t){const n=Array.isArray(e);if(Lt(e)||n)for(const o in e)Array.isArray(e[o])||Lt(e[o])&&!Ih(e[o])?$t(r)||sc(t[o])?t[o]=Array.isArray(e[o])?ni(e[o],[]):{...ni(e[o])}:Oh(e[o],tr(r)?{}:r[o],t[o]):t[o]=!on(e[o],r[o]);return t}var Xo=(e,r)=>Oh(e,r,ni(r));const Ph={value:!1,isValid:!1},jh={value:!0,isValid:!0};var Rh=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!$t(e[0].attributes.value)?$t(e[0].value)||e[0].value===""?jh:{value:e[0].value,isValid:!0}:jh:Ph}return Ph},Nh=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:n})=>$t(e)?e:r?e===""?NaN:e&&+e:t&&Zr(e)?new Date(e):n?n(e):e;const Lh={isValid:!1,value:null};var $h=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,Lh):Lh;function zh(e){const r=e.ref;return lc(r)?r.files:cc(r)?$h(e.refs).value:Mh(r)?[...r.selectedOptions].map(({value:t})=>t):Qo(r)?Rh(e.refs).value:Nh($t(r.value)?e.ref.value:r.value,e)}var ok=(e,r,t,n)=>{const o={};for(const a of e){const s=ue(r,a);s&&ct(o,a,s._f)}return{criteriaMode:t,names:[...e],fields:o,shouldUseNativeValidation:n}},oi=e=>e instanceof RegExp,ea=e=>$t(e)?e:oi(e)?e.source:Lt(e)?oi(e.value)?e.value.source:e.value:e,Bh=e=>({isOnSubmit:!e||e===Ir.onSubmit,isOnBlur:e===Ir.onBlur,isOnChange:e===Ir.onChange,isOnAll:e===Ir.all,isOnTouch:e===Ir.onTouched});const Fh="AsyncFunction";var ak=e=>!!e&&!!e.validate&&!!(Pr(e.validate)&&e.validate.constructor.name===Fh||Lt(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===Fh)),sk=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Uh=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const ta=(e,r,t,n)=>{for(const o of t||Object.keys(e)){const a=ue(e,o);if(a){const{_f:s,...i}=a;if(s){if(s.refs&&s.refs[0]&&r(s.refs[0],o)&&!n)return!0;if(s.ref&&r(s.ref,s.name)&&!n)return!0;if(ta(i,r))break}else if(Lt(i)&&ta(i,r))break}}};function Wh(e,r,t){const n=ue(e,t);if(n||ei(t))return{error:n,name:t};const o=t.split(".");for(;o.length;){const a=o.join("."),s=ue(r,a),i=ue(e,a);if(s&&!Array.isArray(s)&&t!==a)return{name:t};if(i&&i.type)return{name:a,error:i};if(i&&i.root&&i.root.type)return{name:`${a}.root`,error:i.root};o.pop()}return{name:t}}var ik=(e,r,t,n)=>{t(e);const{name:o,...a}=e;return lr(a)||Object.keys(a).length>=Object.keys(r).length||Object.keys(a).find(s=>r[s]===(!n||Ir.all))},lk=(e,r,t)=>!e||!r||e===r||Jo(e).some(n=>n&&(t?n===r:n.startsWith(r)||r.startsWith(n))),ck=(e,r,t,n,o)=>o.isOnAll?!1:!t&&o.isOnTouch?!(r||e):(t?n.isOnBlur:o.isOnBlur)?!e:(t?n.isOnChange:o.isOnChange)?e:!0,uk=(e,r)=>!tc(ue(e,r)).length&&Bt(e,r),dk=(e,r,t)=>{const n=Jo(ue(e,t));return ct(n,"root",r[t]),ct(e,t,n),e},ai=e=>Zr(e);function Vh(e,r,t="validate"){if(ai(e)||Array.isArray(e)&&e.every(ai)||mr(e)&&!e)return{type:t,message:ai(e)?e:"",ref:r}}var no=e=>Lt(e)&&!oi(e)?e:{value:e,message:""},Hh=async(e,r,t,n,o,a)=>{const{ref:s,refs:i,required:l,maxLength:d,minLength:u,min:f,max:h,pattern:g,validate:v,name:p,valueAsNumber:y,mount:_}=e._f,S=ue(t,p);if(!_||r.has(p))return{};const C=i?i[0]:s,E=V=>{o&&C.reportValidity&&(C.setCustomValidity(mr(V)?"":V||""),C.reportValidity())},w={},N=cc(s),D=Qo(s),k=N||D,O=(y||lc(s))&&$t(s.value)&&$t(S)||ri(s)&&s.value===""||S===""||Array.isArray(S)&&!S.length,I=ic.bind(null,p,n,w),Y=(V,W,Z,J=nn.maxLength,H=nn.minLength)=>{const z=V?W:Z;w[p]={type:V?J:H,message:z,ref:s,...I(V?J:H,z)}};if(a?!Array.isArray(S)||!S.length:l&&(!k&&(O||tr(S))||mr(S)&&!S||D&&!Rh(i).isValid||N&&!$h(i).isValid)){const{value:V,message:W}=ai(l)?{value:!!l,message:l}:no(l);if(V&&(w[p]={type:nn.required,message:W,ref:C,...I(nn.required,W)},!n))return E(W),w}if(!O&&(!tr(f)||!tr(h))){let V,W;const Z=no(h),J=no(f);if(!tr(S)&&!isNaN(S)){const H=s.valueAsNumber||S&&+S;tr(Z.value)||(V=H>Z.value),tr(J.value)||(W=H<J.value)}else{const H=s.valueAsDate||new Date(S),z=$=>new Date(new Date().toDateString()+" "+$),ae=s.type=="time",ce=s.type=="week";Zr(Z.value)&&S&&(V=ae?z(S)>z(Z.value):ce?S>Z.value:H>new Date(Z.value)),Zr(J.value)&&S&&(W=ae?z(S)<z(J.value):ce?S<J.value:H<new Date(J.value))}if((V||W)&&(Y(!!V,Z.message,J.message,nn.max,nn.min),!n))return E(w[p].message),w}if((d||u)&&!O&&(Zr(S)||a&&Array.isArray(S))){const V=no(d),W=no(u),Z=!tr(V.value)&&S.length>+V.value,J=!tr(W.value)&&S.length<+W.value;if((Z||J)&&(Y(Z,V.message,W.message),!n))return E(w[p].message),w}if(g&&!O&&Zr(S)){const{value:V,message:W}=no(g);if(oi(V)&&!S.match(V)&&(w[p]={type:nn.pattern,message:W,ref:s,...I(nn.pattern,W)},!n))return E(W),w}if(v){if(Pr(v)){const V=await v(S,t),W=Vh(V,C);if(W&&(w[p]={...W,...I(nn.validate,W.message)},!n))return E(W.message),w}else if(Lt(v)){let V={};for(const W in v){if(!lr(V)&&!n)break;const Z=Vh(await v[W](S,t),C,W);Z&&(V={...Z,...I(W,Z.message)},E(Z.message),n&&(w[p]=V))}if(!lr(V)&&(w[p]={ref:C,...V},!n))return w}}return E(!0),w};const fk={mode:Ir.onSubmit,reValidateMode:Ir.onChange,shouldFocusError:!0};function pk(e={}){let r={...fk,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:Pr(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},n={},o=Lt(r.defaultValues)||Lt(r.values)?Ft(r.defaultValues||r.values)||{}:{},a=r.shouldUnregister?{}:Ft(o),s={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...u};const h={array:Th(),state:Th()},g=r.criteriaMode===Ir.all,v=A=>j=>{clearTimeout(d),d=setTimeout(A,j)},p=async A=>{if(!r.disabled&&(u.isValid||f.isValid||A)){const j=r.resolver?lr((await D()).errors):await O(n,!0);j!==t.isValid&&h.state.next({isValid:j})}},y=(A,j)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((A||Array.from(i.mount)).forEach(U=>{U&&(j?ct(t.validatingFields,U,j):Bt(t.validatingFields,U))}),h.state.next({validatingFields:t.validatingFields,isValidating:!lr(t.validatingFields)}))},_=(A,j=[],U,le,oe=!0,P=!0)=>{if(le&&U&&!r.disabled){if(s.action=!0,P&&Array.isArray(ue(n,A))){const K=U(ue(n,A),le.argA,le.argB);oe&&ct(n,A,K)}if(P&&Array.isArray(ue(t.errors,A))){const K=U(ue(t.errors,A),le.argA,le.argB);oe&&ct(t.errors,A,K),uk(t.errors,A)}if((u.touchedFields||f.touchedFields)&&P&&Array.isArray(ue(t.touchedFields,A))){const K=U(ue(t.touchedFields,A),le.argA,le.argB);oe&&ct(t.touchedFields,A,K)}(u.dirtyFields||f.dirtyFields)&&(t.dirtyFields=Xo(o,a)),h.state.next({name:A,isDirty:Y(A,j),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else ct(a,A,j)},S=(A,j)=>{ct(t.errors,A,j),h.state.next({errors:t.errors})},C=A=>{t.errors=A,h.state.next({errors:t.errors,isValid:!1})},E=(A,j,U,le)=>{const oe=ue(n,A);if(oe){const P=ue(a,A,$t(U)?ue(o,A):U);$t(P)||le&&le.defaultChecked||j?ct(a,A,j?P:zh(oe._f)):Z(A,P),s.mount&&p()}},w=(A,j,U,le,oe)=>{let P=!1,K=!1;const ve={name:A};if(!r.disabled){if(!U||le){(u.isDirty||f.isDirty)&&(K=t.isDirty,t.isDirty=ve.isDirty=Y(),P=K!==ve.isDirty);const ke=on(ue(o,A),j);K=!!ue(t.dirtyFields,A),ke?Bt(t.dirtyFields,A):ct(t.dirtyFields,A,!0),ve.dirtyFields=t.dirtyFields,P=P||(u.dirtyFields||f.dirtyFields)&&K!==!ke}if(U){const ke=ue(t.touchedFields,A);ke||(ct(t.touchedFields,A,U),ve.touchedFields=t.touchedFields,P=P||(u.touchedFields||f.touchedFields)&&ke!==U)}P&&oe&&h.state.next(ve)}return P?ve:{}},N=(A,j,U,le)=>{const oe=ue(t.errors,A),P=(u.isValid||f.isValid)&&mr(j)&&t.isValid!==j;if(r.delayError&&U?(l=v(()=>S(A,U)),l(r.delayError)):(clearTimeout(d),l=null,U?ct(t.errors,A,U):Bt(t.errors,A)),(U?!on(oe,U):oe)||!lr(le)||P){const K={...le,...P&&mr(j)?{isValid:j}:{},errors:t.errors,name:A};t={...t,...K},h.state.next(K)}},D=async A=>{y(A,!0);const j=await r.resolver(a,r.context,ok(A||i.mount,n,r.criteriaMode,r.shouldUseNativeValidation));return y(A),j},k=async A=>{const{errors:j}=await D(A);if(A)for(const U of A){const le=ue(j,U);le?ct(t.errors,U,le):Bt(t.errors,U)}else t.errors=j;return j},O=async(A,j,U={valid:!0})=>{for(const le in A){const oe=A[le];if(oe){const{_f:P,...K}=oe;if(P){const ve=i.array.has(P.name),ke=oe._f&&ak(oe._f);ke&&u.validatingFields&&y([le],!0);const L=await Hh(oe,i.disabled,a,g,r.shouldUseNativeValidation&&!j,ve);if(ke&&u.validatingFields&&y([le]),L[P.name]&&(U.valid=!1,j))break;!j&&(ue(L,P.name)?ve?dk(t.errors,L,P.name):ct(t.errors,P.name,L[P.name]):Bt(t.errors,P.name))}!lr(K)&&await O(K,j,U)}}return U.valid},I=()=>{for(const A of i.unMount){const j=ue(n,A);j&&(j._f.refs?j._f.refs.every(U=>!uc(U)):!uc(j._f.ref))&&ie(A)}i.unMount=new Set},Y=(A,j)=>!r.disabled&&(A&&j&&ct(a,A,j),!on($(),o)),V=(A,j,U)=>Ah(A,i,{...s.mount?a:$t(j)?o:Zr(A)?{[A]:j}:j},U,j),W=A=>tc(ue(s.mount?a:o,A,r.shouldUnregister?ue(o,A,[]):[])),Z=(A,j,U={})=>{const le=ue(n,A);let oe=j;if(le){const P=le._f;P&&(!P.disabled&&ct(a,A,Nh(j,P)),oe=ri(P.ref)&&tr(j)?"":j,Mh(P.ref)?[...P.ref.options].forEach(K=>K.selected=oe.includes(K.value)):P.refs?Qo(P.ref)?P.refs.forEach(K=>{(!K.defaultChecked||!K.disabled)&&(Array.isArray(oe)?K.checked=!!oe.find(ve=>ve===K.value):K.checked=oe===K.value||!!oe)}):P.refs.forEach(K=>K.checked=K.value===oe):lc(P.ref)?P.ref.value="":(P.ref.value=oe,P.ref.type||h.state.next({name:A,values:Ft(a)})))}(U.shouldDirty||U.shouldTouch)&&w(A,oe,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&ce(A)},J=(A,j,U)=>{for(const le in j){if(!j.hasOwnProperty(le))return;const oe=j[le],P=A+"."+le,K=ue(n,P);(i.array.has(A)||Lt(oe)||K&&!K._f)&&!On(oe)?J(P,oe,U):Z(P,oe,U)}},H=(A,j,U={})=>{const le=ue(n,A),oe=i.array.has(A),P=Ft(j);ct(a,A,P),oe?(h.array.next({name:A,values:Ft(a)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&U.shouldDirty&&h.state.next({name:A,dirtyFields:Xo(o,a),isDirty:Y(A,P)})):le&&!le._f&&!tr(P)?J(A,P,U):Z(A,P,U),Uh(A,i)&&h.state.next({...t,name:A}),h.state.next({name:s.mount?A:void 0,values:Ft(a)})},z=async A=>{s.mount=!0;const j=A.target;let U=j.name,le=!0;const oe=ue(n,U),P=ke=>{le=Number.isNaN(ke)||On(ke)&&isNaN(ke.getTime())||on(ke,ue(a,U,ke))},K=Bh(r.mode),ve=Bh(r.reValidateMode);if(oe){let ke,L;const te=j.type?zh(oe._f):Ch(A),ye=A.type===ti.BLUR||A.type===ti.FOCUS_OUT,Ze=!sk(oe._f)&&!r.resolver&&!ue(t.errors,U)&&!oe._f.deps||ck(ye,ue(t.touchedFields,U),t.isSubmitted,ve,K),mt=Uh(U,i,ye);ct(a,U,te),ye?(!j||!j.readOnly)&&(oe._f.onBlur&&oe._f.onBlur(A),l&&l(0)):oe._f.onChange&&oe._f.onChange(A);const Ct=w(U,te,ye),Qt=!lr(Ct)||mt;if(!ye&&h.state.next({name:U,type:A.type,values:Ft(a)}),Ze)return(u.isValid||f.isValid)&&(r.mode==="onBlur"?ye&&p():ye||p()),Qt&&h.state.next({name:U,...mt?{}:Ct});if(!ye&&mt&&h.state.next({...t}),r.resolver){const{errors:rr}=await D([U]);if(P(te),le){const Jt=Wh(t.errors,n,U),ee=Wh(rr,n,Jt.name||U);ke=ee.error,U=ee.name,L=lr(rr)}}else y([U],!0),ke=(await Hh(oe,i.disabled,a,g,r.shouldUseNativeValidation))[U],y([U]),P(te),le&&(ke?L=!1:(u.isValid||f.isValid)&&(L=await O(n,!0)));le&&(oe._f.deps&&ce(oe._f.deps),N(U,L,ke,Ct))}},ae=(A,j)=>{if(ue(t.errors,j)&&A.focus)return A.focus(),1},ce=async(A,j={})=>{let U,le;const oe=Jo(A);if(r.resolver){const P=await k($t(A)?A:oe);U=lr(P),le=A?!oe.some(K=>ue(P,K)):U}else A?(le=(await Promise.all(oe.map(async P=>{const K=ue(n,P);return await O(K&&K._f?{[P]:K}:K)}))).every(Boolean),!(!le&&!t.isValid)&&p()):le=U=await O(n);return h.state.next({...!Zr(A)||(u.isValid||f.isValid)&&U!==t.isValid?{}:{name:A},...r.resolver||!A?{isValid:U}:{},errors:t.errors}),j.shouldFocus&&!le&&ta(n,ae,A?oe:i.mount),le},$=A=>{const j={...s.mount?a:o};return $t(A)?j:Zr(A)?ue(j,A):A.map(U=>ue(j,U))},X=(A,j)=>({invalid:!!ue((j||t).errors,A),isDirty:!!ue((j||t).dirtyFields,A),error:ue((j||t).errors,A),isValidating:!!ue(t.validatingFields,A),isTouched:!!ue((j||t).touchedFields,A)}),we=A=>{A&&Jo(A).forEach(j=>Bt(t.errors,j)),h.state.next({errors:A?t.errors:{}})},_e=(A,j,U)=>{const le=(ue(n,A,{_f:{}})._f||{}).ref,oe=ue(t.errors,A)||{},{ref:P,message:K,type:ve,...ke}=oe;ct(t.errors,A,{...ke,...j,ref:le}),h.state.next({name:A,errors:t.errors,isValid:!1}),U&&U.shouldFocus&&le&&le.focus&&le.focus()},Se=(A,j)=>Pr(A)?h.state.subscribe({next:U=>"values"in U&&A(V(void 0,j),U)}):V(A,j,!0),ne=A=>h.state.subscribe({next:j=>{lk(A.name,j.name,A.exact)&&ik(j,A.formState||u,Me,A.reRenderRoot)&&A.callback({values:{...a},...t,...j,defaultValues:o})}}).unsubscribe,se=A=>(s.mount=!0,f={...f,...A.formState},ne({...A,formState:f})),ie=(A,j={})=>{for(const U of A?Jo(A):i.mount)i.mount.delete(U),i.array.delete(U),j.keepValue||(Bt(n,U),Bt(a,U)),!j.keepError&&Bt(t.errors,U),!j.keepDirty&&Bt(t.dirtyFields,U),!j.keepTouched&&Bt(t.touchedFields,U),!j.keepIsValidating&&Bt(t.validatingFields,U),!r.shouldUnregister&&!j.keepDefaultValue&&Bt(o,U);h.state.next({values:Ft(a)}),h.state.next({...t,...j.keepDirty?{isDirty:Y()}:{}}),!j.keepIsValid&&p()},pe=({disabled:A,name:j})=>{(mr(A)&&s.mount||A||i.disabled.has(j))&&(A?i.disabled.add(j):i.disabled.delete(j))},Ce=(A,j={})=>{let U=ue(n,A);const le=mr(j.disabled)||mr(r.disabled);return ct(n,A,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:A}},name:A,mount:!0,...j}}),i.mount.add(A),U?pe({disabled:mr(j.disabled)?j.disabled:r.disabled,name:A}):E(A,!0,j.value),{...le?{disabled:j.disabled||r.disabled}:{},...r.progressive?{required:!!j.required,min:ea(j.min),max:ea(j.max),minLength:ea(j.minLength),maxLength:ea(j.maxLength),pattern:ea(j.pattern)}:{},name:A,onChange:z,onBlur:z,ref:oe=>{if(oe){Ce(A,j),U=ue(n,A);const P=$t(oe.value)&&oe.querySelectorAll&&oe.querySelectorAll("input,select,textarea")[0]||oe,K=tk(P),ve=U._f.refs||[];if(K?ve.find(ke=>ke===P):P===U._f.ref)return;ct(n,A,{_f:{...U._f,...K?{refs:[...ve.filter(uc),P,...Array.isArray(ue(o,A))?[{}]:[]],ref:{type:P.type,name:A}}:{ref:P}}}),E(A,!1,void 0,P)}else U=ue(n,A,{}),U._f&&(U._f.mount=!1),(r.shouldUnregister||j.shouldUnregister)&&!(Eh(i.array,A)&&s.action)&&i.unMount.add(A)}}},de=()=>r.shouldFocusError&&ta(n,ae,i.mount),Ne=A=>{mr(A)&&(h.state.next({disabled:A}),ta(n,(j,U)=>{const le=ue(n,U);le&&(j.disabled=le._f.disabled||A,Array.isArray(le._f.refs)&&le._f.refs.forEach(oe=>{oe.disabled=le._f.disabled||A}))},0,!1))},R=(A,j)=>async U=>{let le;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let oe=Ft(a);if(h.state.next({isSubmitting:!0}),r.resolver){const{errors:P,values:K}=await D();t.errors=P,oe=Ft(K)}else await O(n);if(i.disabled.size)for(const P of i.disabled)Bt(oe,P);if(Bt(t.errors,"root"),lr(t.errors)){h.state.next({errors:{}});try{await A(oe,U)}catch(P){le=P}}else j&&await j({...t.errors},U),de(),setTimeout(de);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:lr(t.errors)&&!le,submitCount:t.submitCount+1,errors:t.errors}),le)throw le},We=(A,j={})=>{ue(n,A)&&($t(j.defaultValue)?H(A,Ft(ue(o,A))):(H(A,j.defaultValue),ct(o,A,Ft(j.defaultValue))),j.keepTouched||Bt(t.touchedFields,A),j.keepDirty||(Bt(t.dirtyFields,A),t.isDirty=j.defaultValue?Y(A,Ft(ue(o,A))):Y()),j.keepError||(Bt(t.errors,A),u.isValid&&p()),h.state.next({...t}))},st=(A,j={})=>{const U=A?Ft(A):o,le=Ft(U),oe=lr(A),P=oe?o:le;if(j.keepDefaultValues||(o=U),!j.keepValues){if(j.keepDirtyValues){const K=new Set([...i.mount,...Object.keys(Xo(o,a))]);for(const ve of Array.from(K))ue(t.dirtyFields,ve)?ct(P,ve,ue(a,ve)):H(ve,ue(P,ve))}else{if(ec&&$t(A))for(const K of i.mount){const ve=ue(n,K);if(ve&&ve._f){const ke=Array.isArray(ve._f.refs)?ve._f.refs[0]:ve._f.ref;if(ri(ke)){const L=ke.closest("form");if(L){L.reset();break}}}}if(j.keepFieldsRef)for(const K of i.mount)H(K,ue(P,K));else n={}}a=r.shouldUnregister?j.keepDefaultValues?Ft(o):{}:Ft(P),h.array.next({values:{...P}}),h.state.next({values:{...P}})}i={mount:j.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!j.keepIsValid||!!j.keepDirtyValues,s.watch=!!r.shouldUnregister,h.state.next({submitCount:j.keepSubmitCount?t.submitCount:0,isDirty:oe?!1:j.keepDirty?t.isDirty:!!(j.keepDefaultValues&&!on(A,o)),isSubmitted:j.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:oe?{}:j.keepDirtyValues?j.keepDefaultValues&&a?Xo(o,a):t.dirtyFields:j.keepDefaultValues&&A?Xo(o,A):j.keepDirty?t.dirtyFields:{},touchedFields:j.keepTouched?t.touchedFields:{},errors:j.keepErrors?t.errors:{},isSubmitSuccessful:j.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Le=(A,j)=>st(Pr(A)?A(a):A,j),Fe=(A,j={})=>{const U=ue(n,A),le=U&&U._f;if(le){const oe=le.refs?le.refs[0]:le.ref;oe.focus&&(oe.focus(),j.shouldSelect&&Pr(oe.select)&&oe.select())}},Me=A=>{t={...t,...A}},Xe={control:{register:Ce,unregister:ie,getFieldState:X,handleSubmit:R,setError:_e,_subscribe:ne,_runSchema:D,_focusError:de,_getWatch:V,_getDirty:Y,_setValid:p,_setFieldArray:_,_setDisabledField:pe,_setErrors:C,_getFieldArray:W,_reset:st,_resetDefaultValues:()=>Pr(r.defaultValues)&&r.defaultValues().then(A=>{Le(A,r.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:I,_disableForm:Ne,_subjects:h,_proxyFormState:u,get _fields(){return n},get _formValues(){return a},get _state(){return s},set _state(A){s=A},get _defaultValues(){return o},get _names(){return i},set _names(A){i=A},get _formState(){return t},get _options(){return r},set _options(A){r={...r,...A}}},subscribe:se,trigger:ce,register:Ce,handleSubmit:R,watch:Se,setValue:H,getValues:$,reset:Le,resetField:We,clearErrors:we,unregister:ie,setError:_e,setFocus:Fe,getFieldState:X};return{...Xe,formControl:Xe}}function Yh(e={}){const r=b.useRef(void 0),t=b.useRef(void 0),[n,o]=b.useState({isDirty:!1,isValidating:!1,isLoading:Pr(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Pr(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:n},e.defaultValues&&!Pr(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...i}=pk(e);r.current={...i,formState:n}}const a=r.current.control;return a._options=e,ac(()=>{const s=a._subscribe({formState:a._proxyFormState,callback:()=>o({...a._formState}),reRenderRoot:!0});return o(i=>({...i,isReady:!0})),a._formState.isReady=!0,s},[a]),b.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),b.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),b.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),b.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),b.useEffect(()=>{if(a._proxyFormState.isDirty){const s=a._getDirty();s!==n.isDirty&&a._subjects.state.next({isDirty:s})}},[a,n.isDirty]),b.useEffect(()=>{e.values&&!on(e.values,t.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),t.current=e.values,o(s=>({...s}))):a._resetDefaultValues()},[a,e.values]),b.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),r.current.formState=Dh(n,a),r.current}const qh=(e,r,t)=>{if(e&&"reportValidity"in e){const n=ue(t,r);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},dc=(e,r)=>{for(const t in r.fields){const n=r.fields[t];n&&n.ref&&"reportValidity"in n.ref?qh(n.ref,t,e):n&&n.refs&&n.refs.forEach(o=>qh(o,t,e))}},Zh=(e,r)=>{r.shouldUseNativeValidation&&dc(e,r);const t={};for(const n in e){const o=ue(r.fields,n),a=Object.assign(e[n]||{},{ref:o&&o.ref});if(hk(r.names||Object.keys(e),n)){const s=Object.assign({},ue(t,n));ct(s,"root",a),ct(t,n,s)}else ct(t,n,a)}return t},hk=(e,r)=>{const t=Gh(r);return e.some(n=>Gh(n).match(`^${t}\\.\\d+`))};function Gh(e){return e.replace(/\]|\[/g,"")}function Kh(e,r){try{var t=e()}catch(n){return r(n)}return t&&t.then?t.then(void 0,r):t}function mk(e,r){for(var t={};e.length;){var n=e[0],o=n.code,a=n.message,s=n.path.join(".");if(!t[s])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];t[s]={message:i.message,type:i.code}}else t[s]={message:a,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(u){return u.errors.forEach(function(f){return e.push(f)})}),r){var l=t[s].types,d=l&&l[n.code];t[s]=ic(s,r,t,o,d?[].concat(d,n.message):n.message)}e.shift()}return t}function gk(e,r){for(var t={};e.length;){var n=e[0],o=n.code,a=n.message,s=n.path.join(".");if(!t[s])if(n.code==="invalid_union"&&n.errors.length>0){var i=n.errors[0][0];t[s]={message:i.message,type:i.code}}else t[s]={message:a,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(u){return u.forEach(function(f){return e.push(f)})}),r){var l=t[s].types,d=l&&l[n.code];t[s]=ic(s,r,t,o,d?[].concat(d,n.message):n.message)}e.shift()}return t}function vk(e,r,t){if(t===void 0&&(t={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,a){try{return Promise.resolve(Kh(function(){return Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](n,r)).then(function(s){return a.shouldUseNativeValidation&&dc({},a),{errors:{},values:t.raw?Object.assign({},n):s}})},function(s){if((function(i){return Array.isArray(i?.issues)})(s))return{values:{},errors:Zh(mk(s.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw s}))}catch(s){return Promise.reject(s)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,a){try{return Promise.resolve(Kh(function(){return Promise.resolve((t.mode==="sync"?A_:k_)(e,n,r)).then(function(s){return a.shouldUseNativeValidation&&dc({},a),{errors:{},values:t.raw?Object.assign({},n):s}})},function(s){if((function(i){return i instanceof Il})(s))return{values:{},errors:Zh(gk(s.issues,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw s}))}catch(s){return Promise.reject(s)}};throw new Error("Invalid input: not a Zod schema")}const Qh=/^((1[0-2]|0?[1-9]):[0-5][0-9]\s?([AaPp]\.?[Mm]\.?))|^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/,Jh=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),a=t.replace(/[a-z]/g,""),[s,i]=a.split(":");if(!s||!i)return null;let l=parseInt(s,10);const d=parseInt(i,10);n&&l<12&&(l+=12),o&&l===12&&(l=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,l,d);return x.isValid(g)?g:null},yk=Zp({UsuarioID:Ys().nullable().optional(),disID:Ys().nullable().optional(),EsOrganizador:qo().default(!1),Correo:_r().email("Formato de correo inválido"),StatusInvitacion:Gp(["PENDIENTE","CONFIRMADA","RECHAZADA"]).default("PENDIENTE")}),bk=Zp({titulo:_r().min(1,"El campo Título es requerido.").refine(e=>!e.startsWith(" "),{message:"El título no puede empezar con un espacio en blanco"}),fechaInicio:_r().min(1,"El campo fecha inicio es requerido."),horaInicio:_r().min(1,"La hora de inicio es requerida.").regex(Qh,{message:"Formato inválido (ej: 10:30am o 13:30)"}),horaFin:_r().min(1,"La hora fin es requerida.").regex(Qh,{message:"Formato inválido"}),todoElDia:qo(),fechaFin:_r().optional(),showEndDate:qo().optional(),horaInicio2:_r().optional(),TodoElDia2:qo().optional(),client:_r().nullable().optional(),repetir:_r().optional(),incluirMeet:qo().default(!1),link:_r().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(iD("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:_r().optional(),invitados:qp(yk).optional().default([]),color:_r().optional(),solID:Ys().nullable().optional(),disID:Ys().nullable().optional()}).refine(e=>e.showEndDate?e.fechaFin&&e.fechaFin.length>0:!0,{message:"La fecha de fin es requerida.",path:["fechaFin"]}).refine(e=>e.fechaFin!==void 0?!!e.fechaFin&&!!e.horaInicio2:!0,{message:"La hora de fin son requeridas.",path:["horaInicio2"]}).refine(e=>{if(e.todoElDia||!e.fechaInicio||!e.horaInicio||!e.fechaFin||!e.horaInicio2)return!0;const r=Jh(e.fechaInicio,e.horaInicio),t=Jh(e.fechaFin,e.horaFin);return!r||!t?!1:x.isAfter(t,r)},{message:"",path:["horaFin"]}),xk=e=>M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},M.createElement("path",{fill:"#333",d:"M12 24C5.38 24 0 18.608 0 12S5.38 0 12 0s12 5.38 12 12-5.38 12-12 12"}),M.createElement("path",{fill:"#fff",d:"M16.703 7.275c.52.52.541 1.345.046 1.84l-2.874 2.874 2.874 2.873c.495.496.475 1.32-.046 1.841-.52.52-1.344.54-1.84.045l-2.873-2.873-2.874 2.873c-.496.496-1.32.475-1.84-.045-.521-.521-.541-1.345-.046-1.84l2.874-2.874L7.23 9.116c-.495-.496-.475-1.32.045-1.84.521-.521 1.345-.542 1.841-.046l2.874 2.873 2.873-2.873c.496-.496 1.32-.476 1.84.045"})),wk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cg%20fill='%23404756'%20clip-path='url(%23a)'%3e%3cpath%20d='M7.288%2022.986h-.147a6.2%206.2%200%200%201-4.28-1.85c-2.404-2.404-2.478-6.24-.16-8.557L4.28%2011a1.228%201.228%200%201%201%201.739%201.739L4.44%2014.317c-1.356%201.357-1.282%203.626.16%205.068a3.82%203.82%200%200%200%202.602%201.135c.95%200%201.825-.32%202.479-.974l1.578-1.579a1.23%201.23%200%200%201%201.739%200c.48.481.48%201.258%200%201.739l-1.579%201.578c-1.097%201.098-2.552%201.69-4.13%201.69zM17.98%2012.998a1.23%201.23%200%200%201%200-1.739l1.578-1.578c.654-.654.986-1.53.974-2.466a3.78%203.78%200%200%200-1.134-2.602c-1.443-1.443-3.712-1.517-5.068-.16L12.75%206.03c-.48.48-1.258.48-1.739%200a1.23%201.23%200%200%201%200-1.739l1.579-1.578c2.318-2.319%206.153-2.245%208.558.16a6.23%206.23%200%200%201%201.85%204.279%205.84%205.84%200%200%201-1.69%204.279l-1.578%201.578c-.481.481-1.258.481-1.74%200z'/%3e%3cpath%20d='M14.172%208.11%208.07%2014.214a1.233%201.233%200%200%200%201.743%201.744l6.104-6.104a1.233%201.233%200%201%200-1.744-1.744'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",_k=e=>M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},M.createElement("g",{clipPath:"url(#a)"},M.createElement("path",{fill:"#404756",d:"M21.24 5.72a2.98 2.98 0 0 0-2.97-2.96l-5.19-.06c-1.06-.03-2.12.41-2.87 1.17l-7.49 7.49c-.66.66-1.03 1.54-1.03 2.47s.36 1.81 1.03 2.47l4.97 4.97a3.5 3.5 0 0 0 2.47 1.02c.89 0 1.79-.34 2.47-1.02l7.49-7.49c.76-.76 1.18-1.81 1.17-2.88l-.06-5.19zm-4.2 4.43c-.44.44-1.02.66-1.6.66a2.256 2.256 0 1 1 0-4.51 2.256 2.256 0 0 1 1.6 3.85"})),M.createElement("defs",null,M.createElement("clipPath",{id:"a"},M.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),Xh="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23E40B1C'%20d='M20.36%204.14H16c0-1.65-1.35-3-3-3h-2c-1.65%200-3%201.35-3%203H3.64c-.55%200-1%20.45-1%201s.45%201%201%201h1.04l.84%2013.91a3%203%200%200%200%202.99%202.82h6.98c1.58%200%202.9-1.24%203-2.82l.84-13.91h1.04c.55%200%201-.45%201-1s-.45-1-1-1zm-9.36-1h2c.55%200%201%20.45%201%201h-4c0-.55.45-1%201-1m-.39%2014.9c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201zm4.78%200c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201z'/%3e%3c/svg%3e",Sk=e=>M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},M.createElement("g",{fill:"#2571D6",clipPath:"url(#a)"},M.createElement("path",{d:"M13.085 7.331a1.096 1.096 0 1 0-2.192 0v9.316a1.096 1.096 0 0 0 2.192 0z"}),M.createElement("path",{d:"M16.647 10.893H7.33a1.096 1.096 0 1 0 0 2.192h9.316a1.096 1.096 0 0 0 0-2.192"}),M.createElement("path",{d:"M12 24C5.38 24 0 18.608 0 12S5.38 0 12 0s12 5.38 12 12-5.38 12-12 12m0-21.808c-5.414 0-9.808 4.394-9.808 9.808S6.586 21.808 12 21.808s9.808-4.394 9.808-9.808S17.403 2.192 12 2.192"})),M.createElement("defs",null,M.createElement("clipPath",{id:"a"},M.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),Ck="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cg%20fill='%23404756'%20clip-path='url(%23a)'%3e%3cpath%20d='M13.789%2017H3.21C2.542%2017%202%2017.56%202%2018.25s.542%201.25%201.211%201.25H13.79c.669%200%201.211-.56%201.211-1.25S14.458%2017%2013.789%2017M20.718%204H3.282C2.574%204%202%204.56%202%205.25S2.574%206.5%203.282%206.5h17.436C21.426%206.5%2022%205.94%2022%205.25S21.426%204%2020.718%204M20.718%2010.5H3.282C2.574%2010.5%202%2011.06%202%2011.75S2.574%2013%203.282%2013h17.436c.708%200%201.282-.56%201.282-1.25s-.574-1.25-1.282-1.25'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";var ra={},e0;function Ek(){if(e0)return ra;e0=1;var e=lt();Object.defineProperty(ra,"__esModule",{value:!0}),ra.default=void 0;var r=e(ht()),t=dt();return ra.default=(0,r.default)((0,t.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),ra}var Dk=Ek();const t0=it(Dk);var na={},r0;function Ak(){if(r0)return na;r0=1;var e=lt();Object.defineProperty(na,"__esModule",{value:!0}),na.default=void 0;var r=e(ht()),t=dt();return na.default=(0,r.default)((0,t.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),na}var kk=Ak();const Tk=it(kk),n0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC",o0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",Mk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAGFBMVEUAAAAAfFQAflYAfVYAfVUAfFQAcFAAfVbb6xt6AAAAB3RSTlMAIN98m0wQyLlfvgAAAE1JREFUGNNjoAgwmiJxhMoDEBLq5QZIEkUCSBKKeCXYYBJgMQeEBHN5CUIHa3m5A8Io8/ISiAREHRAAJWBSSHYwgyXgUjAJsIGGpPkcAJCLE29yhAT7AAAAAElFTkSuQmCC",Ik=e=>{const r=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],t=e.charCodeAt(0)%r.length;return r[t]},Ok=(e,r,t,n,o,a)=>{if(r)return c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[c.jsx("img",{src:o0,width:15,style:{marginRight:"5px"}}),c.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return c.jsx(m.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return a?c.jsx(m.Button,{onClick:()=>{n(t),o()},variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"}):null;case"CONFIRMADA":return c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[c.jsx("img",{src:Mk,width:15,style:{marginRight:"5px"}}),c.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Asistiré"})]});default:return null}};function Pk({open:e,handleClose:r,guests:t,onReenviar:n,esOrganizador:o}){const a=t.filter(u=>u.estatus==="CONFIRMADA"||u.isHost),s=t.filter(u=>u.estatus==="PENDIENTE"&&!u.isHost),i=t.filter(u=>u.estatus==="RECHAZADA"&&!u.isHost),l=u=>c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[c.jsxs(m.Box,{sx:{position:"relative",mr:2},children:[c.jsx(m.Avatar,{sx:{bgcolor:Ik(u.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:u.iniciales}),u.estatus==="PENDIENTE"&&c.jsx(m.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:c.jsx($l,{sx:{fontSize:14,color:"#546E7A"}})})]}),c.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:u.nombre}),Ok(u.estatus,u.isHost,u.usrID,n,r,o)]},u.nombre),d=({title:u,count:f,badgeColor:h})=>c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[c.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:u}),h&&c.jsx(m.Box,{sx:{ml:1,bgcolor:h,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:f})]});return c.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[c.jsxs(m.Box,{sx:{p:"16px 8px"},children:[c.jsx(m.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),c.jsx(m.Button,{onClick:r,startIcon:c.jsx("img",{src:n0,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),c.jsx(m.IconButton,{onClick:r,sx:{position:"absolute",right:8,top:12},children:c.jsx(Tr,{})})]}),c.jsxs(m.DialogContent,{sx:{p:2},children:[s.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(m.Divider,{sx:{backgroundColor:"black"}}),c.jsxs(m.Box,{sx:{mb:3},children:[c.jsx(d,{title:"Invitados",count:s.length}),s.map(l)]})]}),a.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),c.jsxs(m.Box,{sx:{mb:3},children:[c.jsx(d,{title:"Confirmados",count:a.length,badgeColor:"#1976D2"}),a.map(l)]})]}),i.length>0&&c.jsxs(c.Fragment,{children:[c.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),c.jsxs(m.Box,{children:[c.jsx(d,{title:"No asistirán",count:i.length,badgeColor:"#1976D2"}),i.map(l)]})]})]})]})}const jk=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function Rk({guests:e,onReenviar:r,esOrganizador:t}){const[n,o]=b.useState(!1),a=()=>o(!0),s=()=>o(!1);return c.jsxs(c.Fragment,{children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[c.jsx(m.AvatarGroup,{max:9,sx:{"& .MuiAvatar-root":{width:32,height:32,fontSize:13,fontWeight:"bold",border:"2px solid #fff",marginLeft:"-8px !important"},"& .MuiBadge-root":{borderRadius:"50%"}},children:e.map((i,l)=>c.jsx(m.Tooltip,{title:i.nombre,arrow:!0,placement:"top",children:c.jsx(m.Box,{children:c.jsx(m.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:i.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:c.jsx(m.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:c.jsx("img",{src:op})}),children:c.jsx(m.Avatar,{sx:{bgcolor:jk(i.iniciales)},children:i.iniciales})})})},l))}),c.jsx(m.Box,{sx:{flexGrow:1}}),c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:a,children:[c.jsx(m.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),c.jsx(Tk,{sx:{fontSize:18,ml:.5}})]})]}),c.jsx(Pk,{open:n,handleClose:s,guests:e,onReenviar:r,esOrganizador:t})]})}var oa={},a0;function Nk(){if(a0)return oa;a0=1;var e=lt();Object.defineProperty(oa,"__esModule",{value:!0}),oa.default=void 0;var r=e(ht()),t=dt();return oa.default=(0,r.default)((0,t.jsx)("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"AddCircleOutline"),oa}var Lk=Nk();const $k=it(Lk),zk=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),s0=e=>{const[r,t]=e.split(":"),n=parseInt(r),o=n>=12?"pm":"am";return`${n%12||12}:${t} ${o}`},i0=e=>e.split(":").slice(0,2).join(":"),Bk=({slot:e,onClick:r})=>c.jsxs(m.Box,{onClick:r,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #000000",textAlign:"center",transition:"0.2s",backgroundColor:"#fff","&:hover":{transform:"translateY(-3px)",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",borderColor:"#1976d2"}},children:[c.jsx(m.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:c.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:zk(e.Fecha)})}),c.jsxs(m.Box,{sx:{py:1.5},children:[c.jsx(m.Typography,{sx:{fontSize:"12px"},children:s0(e.HoraInicio)}),c.jsxs(m.Typography,{sx:{fontSize:"12px"},children:["a ",s0(e.HoraFin)]})]})]});function Fk({open:e,handleClose:r,suggestions:t,onSelectSlot:n}){const[o,a]=b.useState(16),i=t.slice(0,o).reduce((u,f)=>{const h=f.Fecha;return u[h]||(u[h]=[]),u[h].push(f),u},{}),l=Object.keys(i),d=u=>{const f={...u,HoraInicio:i0(u.HoraInicio),HoraFin:i0(u.HoraFin)};n(f),r()};return b.useEffect(()=>{a(16)},[e]),c.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[c.jsxs(m.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[c.jsx(m.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),c.jsx(m.Box,{children:c.jsx(m.Button,{startIcon:c.jsx("img",{src:n0,width:20}),onClick:r,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"1rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),c.jsx(m.Divider,{sx:{backgroundColor:"black"}}),c.jsx(m.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:l.length===0?c.jsx(m.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):c.jsxs(c.Fragment,{children:[l.map((u,f)=>c.jsxs(b.Fragment,{children:[" ",c.jsxs(m.Box,{sx:{mb:3},children:[c.jsxs(m.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:2,display:"flex",alignItems:"center",color:f===0?"#1976d2":"text.primary",fontSize:"0.9rem"},children:[f===0?"Mismo día ":"Próximas fechas",f===0&&c.jsx("img",{src:o0,width:15,style:{marginLeft:5}})]}),c.jsx(m.Grid,{container:!0,spacing:2,children:i[u].map((h,g)=>c.jsx(m.Grid,{item:!0,xs:6,sm:3,children:c.jsx(Bk,{slot:h,onClick:()=>d(h)})},`${u}-${g}`))})]}),f===0&&l.length>1&&c.jsx(m.Divider,{sx:{mb:4,mt:1,borderBottomWidth:2,backgroundColor:"#000000"}})]},u)),t.length>o&&c.jsx(m.Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:c.jsx(m.Button,{onClick:()=>a(u=>u+12),startIcon:c.jsx($k,{}),sx:{textTransform:"none",fontWeight:"bold",color:"#1976d2","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Mostrar más horarios disponibles"})})]})})]})}const Uk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",Wk=e=>{const r=["brown","purple","orange","blue","green","yellow","red","grey"],t=e.charCodeAt(0)%r.length;return r[t]};function Vk({onSelectGuest:e,availableSuggestions:r,onInputTextChange:t}){const[n,o]=b.useState(null),[a,s]=b.useState(""),i=(d,u)=>{u?(e(u),o(null),s("")):(o(null),s(""))},l=(d,u)=>{s(u),t(u)};return c.jsx(m.Autocomplete,{options:r,value:n,inputValue:a,getOptionLabel:d=>d.correo,onChange:i,onInputChange:l,isOptionEqualToValue:(d,u)=>d.correo===u.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:d=>c.jsx(m.TextField,{...d,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...d.InputProps,startAdornment:c.jsx(m.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:c.jsx("img",{src:Uk,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(d,u)=>b.createElement(m.Box,{component:"li",...d,key:u.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},c.jsx(m.Avatar,{sx:{bgcolor:Wk(u.iniciales),mr:2,width:32,height:32,fontSize:14},children:u.iniciales}),c.jsx(m.Typography,{children:u.nombre}))},"guest-autocomplete-field")}var aa={},l0;function Hk(){if(l0)return aa;l0=1;var e=lt();Object.defineProperty(aa,"__esModule",{value:!0}),aa.default=void 0;var r=e(ht()),t=dt();return aa.default=(0,r.default)((0,t.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline"),aa}var Yk=Hk();const qk=it(Yk);var sa={},c0;function Zk(){if(c0)return sa;c0=1;var e=lt();Object.defineProperty(sa,"__esModule",{value:!0}),sa.default=void 0;var r=e(ht()),t=dt();return sa.default=(0,r.default)((0,t.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline"),sa}var Gk=Zk();const fc=it(Gk),Kk=e=>e.tieneConflicto?{icon:c.jsx(fc,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:c.jsx(qk,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},Qk=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function Jk({guests:e,conflictCount:r,onViewSuggestions:t,onDeleteGuest:n}){const o=s=>i=>{i.stopPropagation(),n(s)},a=s=>s?s.trim().split(/\s+/).slice(0,2).join(" "):"";return c.jsxs(m.Box,{sx:{p:1},children:[c.jsx(m.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((s,i)=>{const l=Kk(s),d=Qk(s.iniciales),u=s.email||s.correo||s.nombre;return c.jsx(m.Chip,{label:c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[c.jsx(m.Tooltip,{title:u,arrow:!0,placement:"top",children:c.jsx(m.Typography,{variant:"body2",sx:{color:l.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:a(s?.nombre)})}),c.jsx(m.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:l.icon})]}),avatar:c.jsx(m.Avatar,{sx:{bgcolor:d,width:24,height:24,fontSize:"10px",fontWeight:"bold",color:"#ffffff !important",ml:"4px !important"},children:s.iniciales}),sx:{backgroundColor:l.fillColor,height:"32px",borderRadius:"100px",border:"1px solid rgba(0,0,0,0.04)",transition:"all 0.2s ease-in-out",cursor:"pointer","&:hover":{backgroundColor:l.fillColor,filter:"brightness(0.97)","& .status-icon-wrapper":{display:"none"},"& .MuiChip-deleteIcon":{display:"inline-block"}},"& .MuiChip-label":{paddingLeft:"4px",paddingRight:"8px",width:"100%",display:"flex"},"& .MuiChip-deleteIcon":{display:"none",fontSize:"18px",color:"#000000",ml:"auto",mr:"4px","&:hover":{color:"#000000"}}},onDelete:o(s.nombre)},i)})}),r>0&&c.jsxs(m.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[c.jsx(fc,{sx:{mr:1,fontSize:22}}),c.jsxs(m.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",c.jsxs("strong",{children:[r," invitado"]}),r!==1?"s":""]})]}),c.jsx(m.Link,{component:"button",type:"button",variant:"body2",onClick:s=>{s.preventDefault(),s.stopPropagation(),t()},sx:{ml:4,textAlign:"left",textDecoration:"underline",fontWeight:700,fontSize:"15px",color:"#1976D2",border:"none",background:"none",padding:0,cursor:"pointer","&:hover":{color:"#1565C0"}},children:"Ver sugerencias de horario"})]})]})}function Xk(e,r){const[t,n]=b.useState(e);return b.useEffect(()=>{const o=setTimeout(()=>{n(e)},r);return()=>{clearTimeout(o)}},[e,r]),t}var ia={},u0;function e3(){if(u0)return ia;u0=1;var e=lt();Object.defineProperty(ia,"__esModule",{value:!0}),ia.default=void 0;var r=e(ht()),t=dt();return ia.default=(0,r.default)((0,t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search"),ia}var t3=e3();const r3=it(t3),n3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAgCAYAAACYTcH3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAMwSURBVFhH7ZZdSFRpGMd/1TrIHNZxglqYymLaDdmLscWBOBIzEUowN97owvZBElKbWLM4smNUSESkhG3SbvQh7S5rX4xI3sxFSWBEXqREc2FaroTuDrUik8YRG7G6aEbnPDPnDEFsXfiDF+Z9/s8Zfry873vOkslXr9/ymbBUFj4lizJGLMoYsShjRFaZ+LMemoK11B7pIKLJ9OOyxOzS0wavcaQxzMhcopBXQsPZ/ahzA4Su3ufFG/EAQO4KXN4teNbbZJIVQ5k0kSQJoeLxDoLBrvQ8gd3r57cDbhQZmJBRxlAkSVJoLMzFO1F9FntKz8MocayUHb1AbZE+NiNdZqKbYM2fDBqJJMkr5fil3biWyQB6z+yi6R4opYe4+uO3MjYkbQNHOkNCxIpT9aKut6YWYaqbK7cm9bUEqloCgNb7gIgMTRAyUYYeT+tLBT4CgWoaDlXhWWXFkhINDj1NmaVQtJHiZYB2n5sdvdy9N8CLWdmUTtrK6FhXzi/N5awGyFcJtDbyfYFsykCuG9UFME3/9XO0nDnJ3mPdxGSf4AtZWMBB5cEKnDlRbp9o5cqohj1f4Z9R2ddHS0Urd2VZMhMnLmsCk5Wxsjwv+XsWbWKSkb+jWf8wE05fDc0/+/hKBgITmWHCncNoOCg7fJpQezOBrQ7dnjHCkmfDnp8zP5+1rqVwpa4lIyYyMBY+RpW/jZuPxonnOvDUNHN0mzhVKSheP6EbfxG6/Ct/tNXgSdTHnou7yABTGYD4vz38fryOHaf6iAMu10bZMk/hd0VYkvfOjMaHvspMZZzbfmCnz4uquin3fIMFiI3/J9vm6T+7j6p9te9HdRv9siELJjIOist8VO6ppiHgZ+cmG/FnYU53DsvGBeZmiU1Mvh8zMsyOiUyUUP0uKuu7GAEY7aCu/hqRKdn38RDvpiihuiDt4i6xb3CzZqqPyHN9nc1+un4qQns5rT/yfZeoOv9I9LlTOzIiVkZByXBYYk8yiACKYgVyUPJt2FPHlx/y4bCAkLHh27ub4pULd4QRloJSGrYbvJFXr6UwNznJwfm1Q58bkP4J8Qkx2cD/P4syRnxWMu8A780N97kmJqMAAAAASUVORK5CYII=",o3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAbCAYAAABr/T8RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAP4SURBVEhLxZZdSJtXGMd/XZYgCUYdJErmZpc668Qtg2QXcaO2UBFCIUESpO0KWpCWaS/W2SrMKm1F6srcZA66TlzH3KRL6QeygCiIZZus0wtlqOuqa+oHflxYLSmtEraL9zV5c/JGLYzud3XO8z/v+eecPOc8Z8fKo6f/8D/wghh4Xux4lhWvra4w8/cYM4+AZAtvvmYhzagVh22LrY0fBum9fgV/7z0W1kUR0JrILXJzrKQQa6ooJiaxcXiF0asXOX89yJqoqaLFWlJNfWkeaRpRi0fdOHSPznNN+CflJSZZcHo8eN6zYc3QowNgndB8kOGff+LHm0NMP5GG6na5OV/vJdegmE+FeOPwHP6aGjrvs/1ViLuz08uXzW4yN/kmLqtHO87Kpnrslc18dmgLUwBNCm8daqSt0oYB4P41TneMiaNiiDWevcXlnscAvOJtoH6fKUbeivR91XzitQAQ6vkW/6w4IkqM8Wh3gGkAs4uTPmmCZyXT9wEeM8AcN7oTrzpqHB6it19arcHxDlaV7V2bH6StpoqyY1WU1bRze17lfGmyyM2RmqH+AQbD4gCJaHJNdlFWE2AZQGPC6XNTkCHlLwCLd+i4OsSyciJNCs7SwxSYo6Gn83fw+4dYCAOk4Gluo3yX4huZqPFgK+5Ph0RdQI+9opHa4lSWe1r58OsRQuIQAedH31HrFKOKrZ6ZnYtVVHmbomITOrSkF+/FLsoqJJo3Ypz58kYymSg61cKV9jYuN1VT7somPXId/8XohPS/hn77neGNsNaCveQg9U3yd6cKSZel6LyxvBhpJadiAELoycwykZYKpNrw5NjwHAnirztL5+QSgbqj9Bm1rK1KP8CQf5DGj11YlbUiyyKdZ/SkJSviCqJZnb2TXACCjI4L2arNwtdUjcsodTdMMbtoPCOYAmvjY0wB8DrW7Fhtg6hxUgF7HVJzuLdXym4lmjzKj9hiQvZSr8qxm+NW94jUdLxLYZKoSyguEC17DuyXtuhuF1/IZ1qJ7o08rJFeNg5bfC0O9f9A5wMAPa4DTrmgxBN7Zeb7OOHUAzB8qYlvJgTzDDOZkY5ZygMFoYku6i5JqzU4K3g/P1ZXIhQJPc7jFewxAuEgNxtOc6FvaRv1eJ2FvlYqGwJMhQFjASeOO+QEUye+LAIsDnCutp3hVamrM2ez3+Wj0PQrLRcHWADAgutMBc7pX/g+MMDEopxwRhtVF6opUtxmaqgbIz0G/C2f0zmyIioJSbN5qT3p3vIRwKbGMst/BPiq4xqDD1QKgozuVQeHj5bhyU8RpYRsaRzhyWOm/hxhZmmR8bsPeSknh3STBfvuLAwJjsxmbN/4Pybu6fO8+BfHjFz+tNVn6wAAAABJRU5ErkJggg==",a3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAXCAYAAAAcP/9qAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJJSURBVEhL5ZVPSJNhHMc/NuZBo7VkLCJT1ogRoYm7TF7oMi+7uMMGMwixQ1EYLfpDRiSkkIJm0i7rZNQhyMvoVhcVcYcMDKKQYGzNoiG19y0Uaow6vHPvu2dr72CUhz6n5/k+3/f98vs9z/O+Dcr3H7/YAXaJwr/i/wtuMN7jHJmlGNFn8yRkca2c3bbjeENB/Mcs4lIJBsFbxO9fY3xBERcMcYQmmA4cEOUi1YOTc5y5EiMDWI+4cR9sFh1lfF1b5tXHHOBkMDqCv0V0qFQNTjwa4lJMgRYf09F+HKKhEvm3RE7f4cUmtIYmiPyh6iqHK8XCktpiq9RTWyiA6SjdXeowvfySdXG9QHlwbousrJB9PU/8C0ATnq420VUVj6dHHXxYJZ5UyMpb/MyXeoRWp3g8dJOnn3WOZi+jDwfo0EmG5FeYOjnDoj7MNcDsmBdrYSoErzAVmGFRE8Bkxrq3Sa/UxKasCFX2cH3uHJ7CTAjOkXgyye3n78l+y2lynTTuseDqu8Fon3bQhD024wgNM+azlcp1YveVhlIerJJe/1QYWei9fJfZyAi3wv34Dldvub2zj8HweUYnIzy44Gb71mvv06gYrNGM/ZAN634n3ZKPs8NBXKKlSCfBqwH8koeOdgt2Zzv7RIsOg2CZd29S6vWSFTJrSbKipcgGibWNojexskpatOio+OWK3zvF+JKo1oF0kVjYXSIZVPz32LHg2lpdoVXVqOX5Hau4YnCrs43G7YnJQq/UWWowoFs6gdW0PTPjcJb/Gn8DgFjOhT2aaY4AAAAASUVORK5CYII=",s3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAXCAYAAAD+4+QTAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJrSURBVEhLxZVLSFRRGIA/tRGZC02XiEAdCRUXIW2apTSbHtimTQPZgzFSgkpULCyZEEqUIWkWNplopDC0aeNA6qIhEypJciGIuUnKRDAZrpPcS3obbHGd8T7GV4P07c45//m/c/5z7rkZseWVNfaYTHPHXvAfJfIUr5728WbWPKBHYfp1H13D8+YBC6klkyOE3kYIj22VYIqB3giDz8KMm4dMZCQP/udnQt39RGaXQFWQfqmQ40AUzFMSqMhRhVVsCAftZOccwnXKw6Xyo4hZxkhNEo3QeKOP6bhxcLcIrioCd9wcNkkyARbev0tbILpr6b5rFZCQqKpq7t8VheeaCda4EAB+K0iyMV/qg98xdo5d8xO4UowAyJ86qfRep9J7iwfDi8moNCR2jt9s4WF5LgDSaCfVjz4ixQEUxoM+uia1yH36ac4Lfp6c1ybthoXhduqDE8iGXoWZHzEodaSzE43UAsguqqDmtAPSKxfMDbWlFAilXgKtZ8lfv2n/LJkL+6h/PmUVuKoI3D+ZFGA+k62Qv40Q6hlkdFGGuIK0ZL32QlktwRqX5Yvf0U7mhtqovt3D4PQ8UjS2qaC7zipgR5JohI5ea1n0iG5NsNkzt61EGvuQfHLEkmIKD9iMAUUV+BNf+yZsK5FlBdZXG2xtJtDTgidPF6CqWItnxCj5Y2gBkO88gvPMvY23KQ7o616QR76umYqM2PLK2upIO56OCbDZEfdr5RBLPDTUubUEiaTxefqbfLz4mlh7Lp7Hfi4XJNKlJhMgu+wiV4ts2s8qGkOKxpgZfcnAF51A/U6osXFDkOXgREPTtgKAv71g3h2chXDUAAAAAElFTkSuQmCC",i3=({open:e,onClose:r,clientOptions:t,isClientsLoading:n,setClientSearchTerm:o,onSelectClient:a,setFiltroPadre:s})=>{const[i,l]=b.useState("COT"),d=f=>{l(f),s(f)},u=[{id:"COT",label:"Nuevo",icon:a3},{id:"SEMI",label:"Seminuevo",icon:n3},{id:"PM",label:"Prueba de manejo",icon:o3},{id:"SER",label:"Cita de servicio",icon:s3}];return c.jsx(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"12px",maxHeight:"85vh",position:"relative"}},children:c.jsxs(m.DialogContent,{sx:{p:0,display:"flex",flexDirection:"column"},children:[c.jsxs(m.Box,{sx:{p:2,pb:1},children:[c.jsx(m.Typography,{variant:"h6",fontWeight:"bold",sx:{mb:1,fontSize:"1.1rem"},children:"Vincular cliente"}),c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",mb:2,width:"fit-content","&:hover":{opacity:.7}},onClick:r,children:[c.jsx(td,{sx:{color:"#666",ml:-1}}),c.jsx(m.Typography,{variant:"body2",color:"text.secondary",fontWeight:"500",children:"Volver al evento"})]}),c.jsx(m.TextField,{fullWidth:!0,placeholder:"Buscar cliente, correo electrónico, teléfono...",size:"small",onChange:f=>o(f.target.value),InputProps:{startAdornment:c.jsx(m.InputAdornment,{position:"start",children:c.jsx(r3,{sx:{color:"#999"}})}),endAdornment:n&&c.jsx(m.InputAdornment,{position:"end",children:c.jsx(m.CircularProgress,{size:20,color:"inherit"})}),sx:{borderRadius:"8px",backgroundColor:"#f5f5f5","& fieldset":{border:"none"}}}}),c.jsx(m.Box,{sx:{display:"flex",gap:1,mt:2,pb:1,overflowX:"auto",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:u.map(f=>{const h=i===f.id;return c.jsx(m.Chip,{label:f.label,icon:c.jsx("img",{src:f.icon,alt:f.label,style:{width:"20px",height:"20px",borderRadius:"50%",objectFit:"cover"}}),onClick:()=>d(String(f.id)),sx:{borderRadius:"16px",fontSize:"13px",transition:"all 0.2s",backgroundColor:h?"#1976d2":"#f0f2f5",color:h?"#fff !important":"#5f6368",fontWeight:h?"bold":"normal",border:"none","&:hover":{backgroundColor:h?"#1565c0":"#e0e2e5"},"& .MuiChip-icon":{color:h?"#fff":"inherit"}}},f.id)})})]}),c.jsxs(m.Box,{sx:{flexGrow:1,overflowY:"auto",minHeight:"300px"},children:[t.map((f,h)=>c.jsxs(m.Box,{onClick:()=>{a(f,i),r()},sx:{p:"14px 20px",borderTop:"1px solid #f0f0f0",cursor:"pointer",transition:"background-color 0.2s","&:hover":{backgroundColor:"#f9f9f9"},"&:active":{backgroundColor:"#f0f0f0"}},children:[c.jsx(m.Typography,{fontWeight:"600",sx:{fontSize:"14px",color:"#333"},children:f.nombreCliente||"Sin nombre registrado"}),c.jsxs(m.Typography,{variant:"body2",sx:{fontSize:"12px",color:"#666",mt:.5},children:[f.email||"Sin correo"," • ",f.tel||"Sin teléfono"]})]},f.clienteID||h)),!n&&t.length===0&&c.jsx(m.Box,{sx:{p:4,textAlign:"center"},children:c.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"No se encontraron resultados para tu búsqueda."})})]})]})})},l3={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:{xs:"90%",sm:450,md:500},bgcolor:"background.paper",boxShadow:24,p:{xs:2,sm:3},borderRadius:2,maxHeight:"90vh",overflowY:"auto"},d0=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],c3=()=>{const e=[];for(let r=0;r<24;r++)for(let t=0;t<60;t+=15){const n=new Date;n.setHours(r,t),e.push(x.format(n,"h:mmaaaa"))}return e},f0=[],si=c3(),gn=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),a=t.replace(/[a-z]/g,""),[s,i]=a.split(":");if(!s||!i)return null;let l=parseInt(s,10);const d=parseInt(i,10);n&&l<12&&(l+=12),o&&l===12&&(l=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,l,d);return x.isValid(g)?g:null},u3=({isVisible:e,onClose:r,onSave:t,onDelete:n,selectedDate:o,initialEvent:a,userId:s,masNombreBD:i,disId:l,gmail:d,onReenviar:u})=>{const[f,h]=b.useState(!1),[g,v]=b.useState(!1),p=x.format(new Date,"yyyy-MM-dd"),[y,_]=b.useState(""),[S,C]=b.useState([]),[E,w]=b.useState(!1),N=Ll(),[D,k]=b.useState(""),[O,I]=b.useState(f0),[Y,V]=b.useState(!1),[W,Z]=b.useState(""),[J,H]=b.useState(!1),[z,ae]=b.useState([]),[ce,$]=b.useState(!1),[X,we]=b.useState(null),_e=(q,ge)=>{console.log("client",q),we(q),Ee("client",q.nombreCliente||""),Ee("solID",null),$(!1)},[Se,ne]=b.useState([]),se=Xk(W,300),ie=O.filter(q=>q.tieneConflicto).length,[pe,Ce]=b.useState(!1),[de,Ne]=b.useState("COT"),{control:R,handleSubmit:We,reset:st,formState:{errors:Le,isValid:Fe},watch:Me,setValue:Ee}=Yh({resolver:vk(bk),defaultValues:{titulo:a?.titulo||"",fechaInicio:x.format(new Date,"yyyy-MM-dd"),horaInicio:x.format(new Date,"h:mmaaaa"),horaFin:x.format(x.addHours(new Date,1),"h:mmaaaa"),todoElDia:!1,client:a?.client||null,repetir:"No repetir",link:a?.link||"",descripcion:a?.descripcion||"",solID:a?.solID??null,invitados:[],incluirMeet:!1},mode:"onChange"}),Xe=Me("fechaInicio"),A=Me("fechaFin"),j=Me("todoElDia");b.useEffect(()=>{if(y.trim()===""||!s||!l||!i){C([]),Ee("solID",null),w(!1),k("");return}w(!0);const q=setTimeout(()=>{N.getClients(y,l,i,s,de).then(ge=>{w(!1);const Pe=Array.from(new Map(ge.map(me=>[me.nombreCliente,me])).values());if(console.log("uniqueClients",Pe),Pe.length>0)C(Pe),k("");else if(a?.client&&a.solID!==null){const me=[{solID:a.solID,nombreCliente:a.client}];C(me),k("Sin resultados")}else C([]),k("Sin resultados")}).catch(ge=>{console.error("Error al buscar clientes:",ge),w(!1)})},500);return()=>clearTimeout(q)},[y,s,l,i,de]),b.useEffect(()=>{if(a){const q=a?.solicitudRelacionada&&a?.solicitudRelacionada[0];if(q){const ge={nombreCliente:a?.client||"",tel:q.tel||"",email:q.email||"",marca:q.marca||"",modelo:q.modelo||"",solID:Number(q.solID)};we(ge),C([ge]),Ee("client",q.nombreCliente),Ee("solID",q?.solID)}}},[a]),b.useEffect(()=>{if(Xe&&A){const q=new Date(Xe),ge=new Date(A);(q===ge||q>ge)&&Ee("fechaFin",Xe)}},[Xe,A,Ee]),b.useEffect(()=>{Xe&&Ee("fechaFin",Xe)},[Xe]),b.useEffect(()=>{Ee("showEndDate",f)},[f,Ee]),b.useEffect(()=>{if(console.log("initialEvent",a),a){const q=x.format(a.fechaInicio,"yyyy-MM-dd")===x.format(a.fechaFin,"yyyy-MM-dd");if(h(!q),Ee("titulo",a?.titulo),Ee("fechaInicio",x.format(a.fechaInicio,"yyyy-MM-dd")),Ee("fechaFin",x.format(a.fechaFin,"yyyy-MM-dd")),Ee("horaInicio",x.format(a.fechaInicio,"h:mmaaaa")),Ee("horaFin",x.format(a.fechaFin,"h:mmaaaa")),Ee("horaInicio2",x.format(a.fechaFin,"h:mmaaaa")),Ee("descripcion",a.descripcion),Ee("link",a.link),Ee("repetir","false"),Ee("color",a.color),Ee("todoElDia",a.todoElDia),Ee("solID",a.solID),Ee("client",a.client),a.invitados&&a.invitados.length>0){const ge=(a?.invitados||[]).map(me=>{const je=me.usrNombre?.trim()||"",Ue=je.split(/\s+/),xt=Ue.length>1?(Ue[0][0]+Ue[1][0]).toUpperCase():je.substring(0,2).toUpperCase();return{nombre:me.usrNombre||"Sin nombre",correo:me.correo||"",iniciales:xt||"--",usrID:me.usuarioID??null,isHost:me.esOrganizador||!1,estatus:me.statusInvitacion,tieneConflicto:!1,disID:me.disID}}),Pe={nombre:a?.nombreAnfitrion?a?.nombreAnfitrion:"Anfitrion",correo:"",iniciales:(a?.nombreAnfitrion?a?.nombreAnfitrion:"Anfitrion").substring(0,2).toUpperCase(),usrID:s??0,isHost:!0,estatus:"CONFIRMADA",tieneConflicto:!1};I([Pe,...ge])}else I(f0);a.solID?v(!0):v(!1)}else{const q=o||new Date,ge=new Date,Pe=new Date(q.getFullYear(),q.getMonth(),q.getDate(),ge.getHours(),ge.getMinutes()),me=x.addHours(Pe,1);console.log("defaultEndTime",me),st({titulo:"",fechaInicio:x.format(Pe,"yyyy-MM-dd"),fechaFin:x.format(me,"yyyy-MM-dd"),horaFin:x.format(me,"h:mmaaaa"),horaInicio:x.format(Pe,"h:mmaaaa"),horaInicio2:x.format(me,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:d0[0],solID:null}),h(!1),v(!1)}},[a,e,o]);const U=q=>({UsuarioID:q.usrID??null,Correo:q.correo,EsOrganizador:q.usrID==s,StatusInvitacion:q.estatus,disID:l??null}),le=We(q=>{const ge=O.map(me=>U(me)),Pe={...q,invitados:ge};t(Pe,a?.eventoID),r(),st(),h(!1)},q=>{console.log("Errores de validación:",q)});b.useEffect(()=>{j&&(Ee("horaInicio","00:00"),Ee("horaFin","23:59"))},[j,Ee,Me]);const oe=()=>{const q=Me("fechaInicio");if(q){const ge=new Date(`${q}T00:00:00`),Pe=x.addDays(ge,1);Ee("fechaFin",x.format(Pe,"yyyy-MM-dd"))}h(!0)},P=Me("fechaInicio"),K=Me("horaInicio"),ve=Me("fechaFin"),ke=Me("horaFin"),[L,te]=b.useState(null),[ye,Ze]=b.useState(null);b.useEffect(()=>{(L===null||L!==K)&&te(K)},[K,L]),b.useEffect(()=>{(ye===null||ye!==ke)&&Ze(ke??"")},[ke,ye]);const mt=Me("todoElDia");b.useEffect(()=>{if(mt||!K||!ke||!P||!ve)return;const q=gn(P,K),ge=gn(ve,ke);if(!q||!ge||!x.isValid(q)||!x.isValid(ge))return;const Pe=x.isSameDay(q,ge),me=Pe&&(x.isAfter(q,ge)||q.getTime()===ge.getTime()),je=x.isBefore(ge,q)&&!Pe;(me||je)&&(Ee("horaFin",""),Ze(""))},[K,P]);const Ct=b.useMemo(()=>{if(!K||!P)return si;const q=gn(P,K);return q?si.map(ge=>{const Pe=gn(ve||P,ge);if(Pe&&x.isAfter(Pe,q)){const me=(Pe.getTime()-q.getTime())/6e4,je=Math.floor(me/60),Ue=me%60,xt=je>0?`${je} h${Ue>0?` ${Ue} min`:""}`:`${Ue} min`;return{value:ge,label:`${ge} (${xt})`}}return ge}).filter(ge=>{const Pe=typeof ge=="string"?ge:ge.value,me=gn(ve||P,Pe);return me?x.isAfter(me,q):!1}):si},[K,P,ve]),Qt=b.useMemo(()=>si,[]);b.useEffect(()=>{if(!a&&K&&P){const q=gn(P,K);if(q){const ge=x.addMinutes(q,15),Pe=K.toLowerCase(),me=Pe.includes("pm")||Pe.includes("p.m."),je=Pe.includes(".");let Ue=x.format(ge,"h:mm"),xt=me?"pm":"am";je&&(xt=me?"p.m.":"a.m.");const Sr=`${Ue}${xt}`,Rr=(ke||"").toLowerCase();(ke!==Sr||me&&(Rr.includes("am")||Rr.includes("a.m.")))&&Ee("horaFin",Sr,{shouldValidate:!0})}}},[K,Ee,P]);const rr=async q=>{const ge=Me("fechaInicio"),Pe=Me("horaInicio"),me=Me("horaFin");if(console.log("currentGuests",q),!l||!ge||!Pe||!me||q.length===0)return;const je=await Promise.all(q.map(async Ue=>{if(Ue.isHost||!Ue.correo)return Ue;try{const xt=await N.VerificarConflicto(l,Ue.correo,ge,Pe+":00",me+":00"),Sr=Array.isArray(xt)?xt[0]:xt;if(console.log("conflictResult",xt),Sr){const Rr=await N.getDisponibilidadUsuario(l,Ue.correo,ge,"60");ae(Rr)}return{...Ue,tieneConflicto:String(Sr.tieneConflicto).toLowerCase()==="true"}}catch{return{...Ue,tieneConflicto:!1}}}));I(je)};b.useEffect(()=>{O.filter(ge=>!ge.isHost).length>0&&P&&K&&ke&&rr(O)},[P,K,ke]);const Jt=async q=>{if(O.some(Ue=>Ue.correo===q.correo))return;H(!0);const Pe=Me("fechaInicio"),me=Me("horaInicio"),je=Me("horaFin");if(!l||!q.correo||!Pe||!me||!je){I(Ue=>[...Ue,{...q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:!1}]);return}try{const Ue=await N.VerificarConflicto(l,q.correo,Pe,me+":00",je+":00"),xt=Array.isArray(Ue)?Ue[0]:Ue,Sr=String(xt?.tieneConflicto).toLowerCase()==="true",Rr={...q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:Sr};if(Sr){const T=await N.getDisponibilidadUsuario(l,q.correo,Pe,"60");ae(T)}I(T=>[...T,Rr])}catch(Ue){console.error("Error al verificar conflicto:",Ue),I(xt=>[...xt,{...q,tieneConflicto:!1,isHost:!1}])}},ee=q=>{I(ge=>ge.filter(Pe=>Pe.nombre!==q))},Oe=()=>{V(!1)},Ae=q=>{const me=(q.usrNombre??"").split(" ").map(je=>je.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:q.usrNombre??"",correo:q.usrMail??"",iniciales:me,usrID:q.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};b.useEffect(()=>{console.log("debouncedSearchText.length",se.length),se.length>2&&l?(async()=>{const ge=await N.getUsuariosInvitados(l,se),Pe=ge.map(Ae).filter(me=>me.usrID!==s&&!O.some(je=>je.correo===me.correo));console.log("sugerencias",ge),ne(Pe)})():ne([])},[se,O]);const $e=q=>{Z(q)},qt=q=>{const{Fecha:ge,HoraInicio:Pe,HoraFin:me}=q,je=Ue=>Ue.split(":").slice(0,2).join(":");Ee("fechaInicio",ge),Ee("fechaFin",ge),Ee("horaInicio",je(Pe)),Ee("horaFin",je(me)),h(!1),Oe()},nr=async()=>{const q=Me(),ge=gn(q.fechaInicio,q.horaInicio),Pe=gn(q.fechaFin||q.fechaInicio,q.horaFin);if(!ge||!Pe)return;if(!l||!d){console.error("Faltan datos requeridos (disId, userMail o calendarId)");return}Ce(!0);const me={summary:q.titulo||"Sin título",description:q.descripcion||"",start:{dateTime:x.format(ge,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"},end:{dateTime:x.format(Pe,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"}};try{const je=await N.insertarEventoGoogle(l,d,!0,me);je?.hangoutLink&&(Ee("link",je.hangoutLink),Ee("incluirMeet",!1))}catch(je){console.error("Error al generar Meet",je)}finally{Ce(!1)}},cr=a?.solicitudRelacionada?.[0],ur=cr?.tipoSol||"",Xt={COT:{url:"/netcar/cotizaciones/",pag:10,tipo:"COT"},SEMI:{url:"/netcar/seminuevos/",pag:12,tipo:"SEMI"},SER:{url:"/netcar/servicio/",pag:14,tipo:"SER"},PM:{url:"/netcar/pruebademanejo/",pag:16,tipo:"PM"}}[ur];return c.jsx(c.Fragment,{children:c.jsx(m.Modal,{open:e,onClose:r,children:c.jsxs("form",{onSubmit:le,children:[c.jsxs(m.Box,{sx:l3,children:[c.jsx(m.IconButton,{"aria-label":"close",onClick:r,sx:{position:"absolute",right:8,top:12},children:c.jsx(Tr,{})}),c.jsx(m.Typography,{variant:"h6",mb:2,children:a?.isGoogleEvent||a?.isOutlookEvent?c.jsx(c.Fragment,{children:a?.titulo||"Evento de Google"}):!a&&"Agregar evento"}),c.jsx(m.Typography,{style:{fontSize:18,fontWeight:600},mb:2,children:a?.client&&a?.solicitudRelacionada?.[0]?c.jsxs(c.Fragment,{children:["Evento para el cliente:"," ",c.jsx(m.Link,{component:Xl,to:`${Xt?.url}${cr?.solID}`,replace:!0,state:{tipoSOL:Xt?.tipo,pag:Xt?.pag,modulo:"Consulta"},sx:{color:"#1976d2",cursor:"pointer",fontWeight:700,textDecoration:"underline",fontSize:"14px",display:"inline-flex",alignItems:"baseline"},children:`${a.client} / ${cr?.marca} ${cr?.modelo}`})]}):"Editar Evento"}),c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(Or,{name:"titulo",control:R,render:({field:q})=>c.jsx(m.TextField,{...q,label:"Título",fullWidth:!0,variant:"outlined",size:"small",error:!!Le.titulo,helperText:Le.titulo?.message,inputProps:{maxLength:100},sx:{"& .MuiInputLabel-root.Mui-focused":{color:"black"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"black"},"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}})})})}),c.jsxs("div",{className:`row g-2 ${f?"mb-1":"mb-2"}`,children:[c.jsx("div",{className:"col-12 col-md-4",children:c.jsx(Or,{name:"fechaInicio",control:R,render:({field:q})=>c.jsx(m.TextField,{fullWidth:!0,...q,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!Le.fechaInicio,helperText:Le.fechaInicio?.message})})}),f?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"col-md-3 d-none d-md-block"}),c.jsx("div",{className:"col-10 col-md-4",children:c.jsx(Or,{name:"fechaFin",control:R,render:({field:q})=>c.jsx(m.TextField,{...q,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:Xe||p},error:!!Le.fechaFin,helperText:Le.fechaFin?.message})})}),!a&&c.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:c.jsx(m.IconButton,{onClick:()=>h(!1),sx:{fontSize:18},children:c.jsx(xk,{})})})]}):c.jsx("div",{className:"col-md-8"})]}),f&&c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12 d-flex justify-content-center",children:c.jsx(t0,{sx:{color:"#757575",my:1}})})}),c.jsxs("div",{className:"row g-2 mb-2",children:[c.jsx("div",{className:"col-12 col-md-4",children:c.jsx(Or,{name:"horaInicio",control:R,render:({field:{onChange:q,value:ge,...Pe}})=>c.jsx(m.Autocomplete,{freeSolo:!0,options:Qt,value:ge||"",getOptionLabel:me=>typeof me=="string"?me:me.value,onChange:(me,je)=>{const Ue=typeof je=="string"?je:je?.value;if(Ue){const xt=Ue.split(" (")[0].trim();q(xt)}else q("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},onInputChange:(me,je)=>q(je),renderInput:me=>c.jsx(m.TextField,{...me,...Pe,size:"small",error:!!Le.horaInicio,helperText:Le.horaInicio?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...me.InputProps}}),popupIcon:c.jsx($l,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:mt})})}),!f&&c.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:Le.horaInicio?"5px":"0px"},children:c.jsx(t0,{sx:{color:"#757575"}})}),f&&c.jsx("div",{className:"col-md-3 d-none d-md-block"}),c.jsx("div",{className:"col-12 col-md-4",children:c.jsx(Or,{name:"horaFin",control:R,render:({field:{onChange:q,value:ge,...Pe}})=>c.jsx(m.Autocomplete,{freeSolo:!0,options:Ct,getOptionLabel:me=>typeof me=="string"?me:me.value,value:ge||"",onChange:(me,je)=>{const Ue=typeof je=="string"?je:je?.value;if(Ue){const xt=Ue.split(" (")[0].trim();q(xt)}else q("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},renderOption:(me,je)=>b.createElement(m.Box,{component:"li",...me,key:typeof je=="string"?je:je.value},c.jsx(m.Typography,{children:typeof je=="string"?je:je.label})),onInputChange:(me,je)=>q(je),renderInput:me=>c.jsx(m.TextField,{...me,...Pe,size:"small",error:!!Le.horaFin,helperText:Le.horaFin?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...me.InputProps}}),popupIcon:c.jsx($l,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:mt})})}),!f&&c.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:c.jsx(Or,{name:"todoElDia",control:R,render:({field:q})=>c.jsx(m.FormControlLabel,{control:c.jsx(m.Checkbox,{checked:q.value,onChange:ge=>q.onChange(ge.target.checked)}),label:c.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!a?.isGoogleEvent||a?.isOutlookEvent)&&!f&&c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsxs(m.Button,{onClick:oe,size:"small",sx:{textTransform:"none",fontSize:16},children:[c.jsx(Sk,{}),"  Agregar fecha final"]})})}),c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(Or,{name:"link",control:R,render:({field:q})=>c.jsx(m.TextField,{...q,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!Le.link,helperText:Le.link?.message,InputProps:{startAdornment:c.jsx("img",{src:wk,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(Or,{name:"descripcion",control:R,render:({field:q})=>c.jsx(m.TextField,{...q,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:c.jsx("img",{src:Ck,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),a?.solicitudRelacionada===null&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(Vk,{onSelectGuest:Jt,availableSuggestions:Se,onInputTextChange:$e})})}),(J||ie>0)&&c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(Jk,{guests:O,conflictCount:ie,onViewSuggestions:()=>V(!0),onDeleteGuest:ee})})}),a?.invitados&&a?.invitados?.length>0&&c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsx(m.Box,{children:c.jsx(Rk,{guests:O,onReenviar:u,esOrganizador:a?.esOrganizador})})})}),c.jsx(Fk,{open:Y,handleClose:Oe,suggestions:z,onSelectSlot:qt})]}),c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1,px:0},children:[c.jsx(m.Box,{sx:{minWidth:40,display:"flex",justifyContent:"flex-start"},children:c.jsx("img",{src:"https://fonts.gstatic.com/s/i/productlogos/meet_2020q4/v1/web-512dp/logo_meet_2020q4_color_2x_web_512dp.png",alt:"Meet",style:{width:22,height:22}})}),c.jsx(m.Box,{sx:{flex:1},children:!Me("link")&&!Me("incluirMeet")?c.jsx(m.Button,{fullWidth:!0,disabled:pe||!l||!d,onClick:nr,sx:{justifyContent:"flex-start",textTransform:"none",bgcolor:"#f1f3f4",color:"#3c4043","&:hover":{bgcolor:"#e8eaed",boxShadow:"none"},borderRadius:"4px",fontWeight:400,fontSize:"14px",py:1,px:2,border:"none",boxShadow:"none"},children:pe?c.jsxs(c.Fragment,{children:[c.jsx(m.CircularProgress,{size:18,sx:{mr:1.5,color:"#5f6368"}}),c.jsx(m.Typography,{variant:"body2",sx:{fontSize:"14px",color:"#5f6368"},children:"Generando enlace..."})]}):"Añadir videoconferencia de Google Meet"}):c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#f1f3f4",p:"6px 12px",borderRadius:"4px",border:"1px solid #dadce0"},children:[c.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[c.jsx(m.Typography,{variant:"body2",sx:{color:"#1a73e8",fontWeight:500,cursor:Me("link")?"pointer":"default",textDecoration:"none","&:hover":{textDecoration:Me("link")?"underline":"none"},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},onClick:()=>Me("link")&&window.open(Me("link"),"_blank"),children:Me("link")?Me("link"):"Se añadirá Google Meet al guardar"}),c.jsx(m.Typography,{variant:"caption",sx:{color:"#70757a"},children:"Google Meet"})]}),c.jsx(m.IconButton,{size:"small",onClick:()=>{Ee("incluirMeet",!1),Ee("link","")},sx:{color:"#5f6368"},children:c.jsx(Tr,{sx:{fontSize:18}})})]})})]}),c.jsx("div",{className:"row mb-2",children:c.jsx("div",{className:"col-12",children:c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[c.jsx(_k,{}),d0.map(q=>c.jsx(Or,{name:"color",control:R,render:({field:ge})=>c.jsx(m.IconButton,{onClick:()=>ge.onChange(q),sx:{width:24,height:24,borderRadius:"50%",bgcolor:q,border:ge.value===q?"2px solid":"none",borderColor:ge.value===q?"primary.main":"transparent"}})},q))]})})}),c.jsx("div",{className:"row",children:c.jsxs("div",{className:"col-12 d-flex gap-2",style:{width:"100%",marginTop:"20px"},children:[a&&!a?.isGoogleEvent&&!a?.isOutlookEvent&&c.jsx(m.Button,{onClick:n,variant:"outlined",startIcon:c.jsx("img",{src:Xh,width:15}),hidden:a?a?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",backgroundColor:"#FFF5F5",color:"#d32f2f",borderColor:"red",borderRadius:"8px",fontWeight:700,fontSize:"14px",padding:"8px 0","&:hover":{backgroundColor:"#FEE2E2",borderColor:"red"}},children:"Eliminar"}),c.jsx(m.Button,{onClick:r,variant:"outlined",sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",color:"#1976D2",borderColor:"#1976D2","&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)",borderColor:"#115293"}},children:"Cancelar"}),c.jsx(m.Button,{onClick:le,variant:"contained",disabled:!Fe,hidden:a?a?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",backgroundColor:"#1976D2",boxShadow:"none","&:hover":{backgroundColor:"#115293",boxShadow:"0px 2px 4px rgba(0,0,0,0.2)"}},children:"Guardar"})]})})]}),c.jsx(i3,{open:ce,onClose:()=>$(!1),clientOptions:S,isClientsLoading:E,setClientSearchTerm:_,onSelectClient:_e,setFiltroPadre:Ne})]})})})},d3={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:450,bgcolor:"background.paper",boxShadow:24,p:2,borderRadius:2,maxHeight:"80vh",overflowY:"auto"},f3=({isOpen:e,onClose:r,events:t,date:n,onEventClick:o})=>{if(!n)return null;const a=i=>{o(i),r()},s=i=>i.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:i.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return c.jsx(m.Modal,{open:e,onClose:r,children:c.jsxs(m.Box,{sx:d3,children:[c.jsxs(m.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[c.jsxs(m.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),c.jsx(m.IconButton,{onClick:r,size:"small",children:c.jsx(Tr,{})})]}),c.jsx(m.Divider,{}),c.jsx(m.List,{sx:{mt:1},children:t.map(i=>{const l=s(i);return c.jsx(m.ListItem,{disablePadding:!0,sx:{mb:1},children:c.jsx(m.ListItemButton,{onClick:()=>a(i),sx:{py:1,borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.02)",borderLeft:`5px solid ${l?.borderColor}`,"&:hover":{backgroundColor:"rgba(0,0,0,0.04)"}},children:c.jsxs(m.Box,{sx:{flexGrow:1},children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[c.jsx(m.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:l?.borderColor,color:"white",textTransform:"uppercase"},children:l?.label}),c.jsx(m.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:i.titulo})]}),c.jsx(m.Typography,{sx:{fontSize:"12px",color:"#666"},children:i.todoElDia?"Todo el día":`${x.format(i.fechaInicio,"hh:mm aa").toLowerCase()} - ${x.format(i.fechaFin,"hh:mm aa").toLowerCase()}`})]})})},i.eventoID)})})]})})};var la={},p0;function p3(){if(p0)return la;p0=1;var e=lt();Object.defineProperty(la,"__esModule",{value:!0}),la.default=void 0;var r=e(ht()),t=dt();return la.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),la}var h3=p3();const m3=it(h3);var ca={},h0;function g3(){if(h0)return ca;h0=1;var e=lt();Object.defineProperty(ca,"__esModule",{value:!0}),ca.default=void 0;var r=e(ht()),t=dt();return ca.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),ca}var v3=g3();const y3=it(v3),b3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23fff'%20d='M19.378%204.405a1.813%201.813%200%201%201%202.565%202.565L9.571%2019.342a1.813%201.813%200%200%201-2.565%200l-4.949-4.949a1.814%201.814%200%200%201%202.428-2.69l.137.126%203.666%203.666z'/%3e%3c/svg%3e",x3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAALVBMVEVHcEzfEBfjCxzkChvkChvkChzkCxvlChv////96uv60dT1o6ryho/mGyvkCxypwAsrAAAACHRSTlMAECtdiKDJ5DEbuTIAAAHoSURBVHjatdlbjsMgDAVQ87JJKHf/y51pf9CIp+vJ/SzSkUloAZc2cSEkFgEAYU7RO/o+zkdBF07hO9QnwSzJq4uLgmUkGDgzGTrORHrGcZLXlmcvMkKZaJxuH/YLTwB9ZCo6AUyivb4m7uuziwxDeLtezKsnwJiwfCH2x5hgDi8mbJ+0APaI6wo0Ju4KrIBqQNyqwFqufL3qYOD1O1DqqkQZeVd+567dwJ3fuUai0Cceg5Scm9h5v3lhED9fgzk3ceTlC4Ok+YxzLzbvk+lrCRjl6sTmzSuEn80Yr9yJzZs+Q6Tp72C9/4jdRwXDCJEDTsQzD3DkcSaeeQgUcSZuvAYmnIlnHhIxVqLWAxNjKSo9CAl0YsEGBFRiwSYEhdh5dvCuBrB5GlH3UvaikOw8ncjbha0UeffV04qJwplX7jMxUjjzUM9ET+7Mw6HoiOTIOxR5ehYunXe8SfndNlpwvo2G2XWidl4nYhQ3PYpczVMfRfxqoy9QHZbWx7nm9eK9OM5RnB84h8VPTqJA6G55toj5WtYX+K8lypMXH2KYkx64PD55vbVfwJ9pEZgfo70tYm/c2FtLds/eTHu23WdvSG7jk2a6zzV17aRER4oEUXDm1r0kT18lJB5o5n8sErN8JOEUtv9U/ACrTv/qOzhclQAAAABJRU5ErkJggg==",pc=b.forwardRef(({id:e,message:r,variant:t},n)=>{const{closeSnackbar:o}=wa.useSnackbar(),a={success:{color:"#fff",icon:c.jsx("img",{width:25,src:b3,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:c.jsx(m3,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:c.jsx(y3,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:c.jsx("img",{src:Xh,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:c.jsx("img",{src:x3,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},s=a[t]||a.info;return c.jsx(wa.SnackbarContent,{ref:n,children:c.jsxs(m.Box,{sx:{backgroundColor:"white",color:"#333",padding:"8px 16px",borderRadius:"8px",boxShadow:"0 3px 10px rgba(0,0,0,0.2)",display:"flex",alignItems:"center",width:{xs:"90%",sm:"auto"},minWidth:"300px",borderLeft:`5px solid ${s.color}`},children:[c.jsx(m.Box,{sx:{mr:1.5},children:s.icon}),c.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1},children:r}),c.jsx(m.IconButton,{size:"small",onClick:()=>o(e),children:c.jsx(Tr,{fontSize:"small"})})]})})}),m0=b.createContext(void 0),w3=({children:e})=>{const[r,t]=b.useState([]),[n,o]=b.useState([]),[a,s]=b.useState(!1);return c.jsx(m0.Provider,{value:{googleEvents:r,setGoogleEvents:t,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:a,setIsLoadingGoogleEvents:s},children:e})},_3=()=>{const e=b.useContext(m0);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},S3=(e,r,t)=>{const n=(s,i)=>i?new Date(i):s?new Date(s.replace(/-/g,"/")):new Date,o=n(e.start.date,e.start.dateTime);let a=n(e.end.date,e.end.dateTime);return e.end.date&&!e.end.dateTime&&a.setDate(a.getDate()-1),{eventoID:Math.abs(C3(e.id)),titulo:e.summary||"(Sin título)",descripcion:e.description,fechaInicio:o,fechaFin:a,todoElDia:!!(e.start.date&&!e.start.dateTime),color:"#4285F4C",hasVideoCall:!!e.conferenceData,link:e.htmlLink,repetir:void 0,solID:null,disID:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!0}};function C3(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}function E3(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}const D3=(e,r,t)=>{const n=new Date(e.start.dateTime);let o=new Date(e.end.dateTime);return e.isAllDay&&o.setDate(o.getDate()-1),{eventoID:Math.abs(E3(e.id)),titulo:e?.summary||"(Sin título)",descripcion:e.body?.content||"",fechaInicio:n,fechaFin:o,todoElDia:e.isAllDay,color:"#0078D4",hasVideoCall:!!e.onlineMeetingUrl,link:e.webLink,repetir:void 0,solID:null,disID:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!1,isOutlookEvent:!0}},g0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='49'%20fill='none'%3e%3cpath%20fill='%23E40B1C'%20d='M34.559%2048.077c-7.413%200-13.44-6.039-13.44-13.44s6.027-13.44%2013.44-13.44%2013.44%206.027%2013.44%2013.44c0%207.414-6.027%2013.44-13.44%2013.44'/%3e%3cpath%20fill='%23fff'%20d='M39.827%2029.346c.583.583.605%201.505.05%202.06l-3.218%203.219%203.219%203.218c.555.556.532%201.48-.051%202.062-.584.583-1.506.605-2.062.05l-3.218-3.218-3.218%203.218c-.556.555-1.478.533-2.061-.05s-.606-1.506-.05-2.062l3.217-3.218-3.218-3.218c-.555-.555-.533-1.478.05-2.061.583-.584%201.507-.606%202.063-.05l3.217%203.217%203.218-3.218c.556-.555%201.478-.533%202.062.05'/%3e%3cpath%20fill='%23404756'%20d='M30.367.078c1.112%200%202.001.868%202.001%201.954v1.195h.979c4.913%200%208.892%203.887%208.892%208.686v9.237a15.4%2015.4%200%200%200-4.424-1.691v-1.312H4.468V33.63c0%202.389%202%204.343%204.446%204.343H19.4a15.4%2015.4%200%200%200%201.676%204.343H8.892C3.979%2042.317%200%2038.43%200%2033.631V11.913c0-4.8%203.979-8.686%208.892-8.686h1V2.032c0-1.086.89-1.954%202.002-1.954s2%20.868%202%201.954v1.195h14.473V2.032c0-1.085.889-1.954%202-1.954'/%3e%3c/svg%3e",A3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23fff'%20d='M20.36%204.14H16c0-1.65-1.35-3-3-3h-2c-1.65%200-3%201.35-3%203H3.64c-.55%200-1%20.45-1%201s.45%201%201%201h1.04l.84%2013.91a3%203%200%200%200%202.99%202.82h6.98c1.58%200%202.9-1.24%203-2.82l.84-13.91h1.04c.55%200%201-.45%201-1s-.45-1-1-1zm-9.36-1h2c.55%200%201%20.45%201%201h-4c0-.55.45-1%201-1m-.39%2014.9c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201zm4.78%200c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201z'/%3e%3c/svg%3e",k3=({open:e,onClose:r,onConfirm:t,title:n,description:o,icon:a,confirmText:s,confirmColor:i="#d32f2f",loading:l=!1})=>c.jsxs(m.Dialog,{open:e,onClose:r,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[c.jsx(m.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:c.jsx(m.IconButton,{onClick:r,size:"small",children:c.jsx(Tr,{fontSize:"small"})})}),c.jsxs(m.DialogContent,{sx:{textAlign:"center",pt:0},children:[c.jsx(m.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:a}),c.jsx(m.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),c.jsx(m.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),c.jsxs(m.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[c.jsx(m.Button,{variant:"outlined",onClick:r,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),c.jsxs(m.Button,{variant:"contained",onClick:t,disabled:l,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:i,"&:hover":{bgcolor:"#b71c1c"}},children:[s=="Eliminar"&&c.jsx("img",{src:A3,width:15,style:{marginRight:6,marginBottom:2}}),l?"Procesando...":s]})]})]})]}),ii=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),a=t.replace(/[a-z]/g,""),[s,i]=a.split(":");if(!s||!i)return null;let l=parseInt(s,10);const d=parseInt(i,10);n&&l<12&&(l+=12),o&&l===12&&(l=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,l,d);return x.isValid(g)?g:null},T3=({userId:e,leads30Days:r,leads90Days:t,disId:n,masNombreBD:o,usrNombre:a})=>{const[s,i]=b.useState(new Date),[l,d]=b.useState([]),[u,f]=b.useState(!1),[h,g]=b.useState(null),[v,p]=b.useState(null),[y,_]=b.useState([]),{enqueueSnackbar:S}=wa.useSnackbar(),C=Ll(),E=Is(),w=Cl(),[N,D]=b.useState(!1),[k,O]=b.useState([]),[I,Y]=b.useState(null),{session:V,sessionoutlook:W}=ul(),{googleEvents:Z,setGoogleEvents:J,outlookEvents:H,setOutlookEvents:z}=_3(),[ae,ce]=b.useState([]),[$,X]=b.useState([]),[we,_e]=b.useState([]),[Se,ne]=b.useState(!1),[se,ie]=b.useState([]),[pe,Ce]=b.useState(),de=(ee,Oe)=>{O(ee),Y(Oe),D(!0)},Ne=async()=>{if(e===void 0||n===void 0)return;const ee=await C.getNotificacionesXUsuario(e,n);a?localStorage.setItem("nombreAnfitrion",a):localStorage.setItem("nombreAnfitrion","Anfitrion"),ie(ee)};b.useEffect(()=>{const ee=new Date,Oe=x.startOfDay(ee),Ae=x.endOfDay(x.addDays(Oe,6)),$e={start:Oe,end:Ae},qt=l.filter(nr=>{const cr={start:nr.fechaInicio,end:nr.fechaFin};return tf(cr,$e)}).sort((nr,cr)=>nr.fechaInicio.getTime()-cr.fechaInicio.getTime());_(qt)},[l]),b.useEffect(()=>{const ee=async()=>{try{if(e&&n){const Ae=await C.getEventsByUser(e,n);Ne(),d(Ae)}}catch(Ae){console.log("Error al cargar eventos locales:",Ae)}};ee();const Oe=setInterval(ee,4e3);return()=>clearInterval(Oe)},[e]),b.useEffect(()=>{if(!n||!e)return;const ee=[...l];if(Z.length>0&&V?.userEmail){const Oe=Z.map(Ae=>S3(Ae,n,e));ee.push(...Oe)}if(H.length>0&&W?.userEmail){const Oe=H.map(Ae=>D3(Ae,n,e));ee.push(...Oe)}ce(ee)},[l,Z,H,n,e,V?.userEmail,W?.userEmail]);const R=async ee=>{try{if(ee?.isGoogleEvent||ee.isOutlookEvent)g(ee),f(!0);else{const Oe=await C.getEventById(ee.eventoID);g(Oe),f(!0)}}catch(Oe){console.error(Oe)}},We=()=>{f(!1),g(null)},st=async(ee,Oe)=>{let Ae,$e;if(ee.todoElDia)Ae=ii(ee.fechaInicio,ee.horaInicio),$e=ii(ee.fechaInicio,ee.horaFin);else{Ae=ii(ee.fechaInicio,ee.horaInicio);const ur=ee.fechaFin||ee.fechaInicio;$e=ii(ur,ee.horaFin)}if(!Ae||!$e){console.error("No se pudieron procesar las fechas. Revisa el formato de hora:",{inicio:ee.horaInicio,fin:ee.horaFin});return}const qt=x.format(Ae,"yyyy-MM-dd HH:mm:ss.SSS"),nr=x.format($e,"yyyy-MM-dd HH:mm:ss.SSS");if(Oe){const ur={...ee,eventoID:Oe,fechaInicio:qt,fechaFin:nr,solID:ee.solID??null,disID:n??null,client:ee.client,invitados:ee.invitados.map(Ge=>({usrNombre:Ge.nombre||Ge.usrNombre,Correo:Ge.correo||Ge.Correo,EsOrganizador:Ge.isHost||Ge.EsOrganizador,StatusInvitacion:Ge.StatusInvitacion,UsuarioID:Ge.usrID||Ge.UsuarioID,disID:Ge.disID||n}))};try{const Ge=await C.updateEvent(ur);var cr=l.map(Xt=>Xt.eventoID===Ge.eventoID?Ge:Xt);d(cr),S("El evento se ha actualizado correctamente.",{variant:"success"}),We()}catch{S("Error al actualizar Evento",{variant:"error"})}}else{const ur={...ee,fechaInicio:qt,fechaFin:nr,todoElDia:ee.todoElDia,solID:ee.solID??null,disID:n??null,client:ee.client,invitados:ee.invitados.map(Ge=>({usrNombre:Ge.nombre||Ge.usrNombre,Correo:Ge.correo||Ge.Correo,EsOrganizador:Ge.isHost||Ge.EsOrganizador,StatusInvitacion:Ge.StatusInvitacion,UsuarioID:Ge.usrID||Ge.UsuarioID,disID:Ge.disID||n}))};try{const Ge=await C.createEvent(ur,e);d(Xt=>[...Xt,Ge]),S("El evento se ha creado con éxito",{variant:"success"}),We()}catch{S("Error al guardar Evento",{variant:"error"})}}if(e&&n){const ur=await C.getEventsByUser(e,n);d(ur)}},Le=()=>{i(ee=>new Date(ee.getFullYear(),ee.getMonth()-1,1))},Fe=()=>{i(ee=>new Date(ee.getFullYear(),ee.getMonth()+1,1))},Me=()=>{Ct("ELIMINAR")},Ee=()=>{Ct("RECHAZAR")},Xe=()=>{p(new Date),f(!0)},A=ee=>{ee&&i(ee)},j=ee=>{p(ee),f(!0),g(null)},U=async()=>{if(h)try{await C.deleteEvent(h.eventoID),d(l.filter(ee=>ee.eventoID!==h.eventoID)),S("El evento se ha eliminado de tu calendario",{content:(ee,Oe)=>c.jsx(pc,{id:ee,message:String(Oe),variant:"delete"})})}catch{S("Error al eliminar Evento",{variant:"error"})}finally{We(),Qt()}},le=async()=>{if(!(!V?.userEmail||!n)){ne(!0);try{const Oe=(await E.getGoogleCalendars(V.userEmail,n)).map($e=>({...$e,selected:!0}));X(Oe);const Ae=Oe.map($e=>$e.id);ve(Ae)}catch(ee){console.error("Error Google Cals:",ee)}finally{ne(!1)}}},oe=async ee=>{const Oe=$.map($e=>$e.id===ee?{...$e,selected:!$e.selected}:$e);X(Oe);const Ae=Oe.filter($e=>$e.selected).map($e=>$e.id);ve(Ae)},P=async()=>{if(!(!W?.userEmail||!n)){ne(!0);try{const Oe=(await w.getOutlookCalendars(W.userEmail,n)).map($e=>({...$e,selected:!0}));_e(Oe);const Ae=Oe.map($e=>$e.id);ke(Ae)}catch(ee){console.error("Error Outlook Cals:",ee)}finally{ne(!1)}}},K=async ee=>{const Oe=we.map($e=>$e.id===ee?{...$e,selected:!$e.selected}:$e);_e(Oe);const Ae=Oe.filter($e=>$e.selected).map($e=>$e.id);ke(Ae)};b.useEffect(()=>{le()},[V?.userEmail,n]),b.useEffect(()=>{P()},[W?.userEmail,n]);const ve=async ee=>{if(!V?.userEmail||!n)return;const Oe=ee||$.filter(Ae=>Ae.selected).map(Ae=>Ae.id);try{const Ae={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:V.userEmail,calendarIds:Oe},$e=await E.getGoogleEventsByMonth(Ae);J($e)}catch(Ae){console.error("Error al obtener eventos de Google:",Ae)}},ke=async ee=>{if(!W?.userEmail||!n)return;const Oe=ee||we.filter(Ae=>Ae.selected).map(Ae=>Ae.id);try{const Ae={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:W.userEmail,calendarIds:Oe},$e=await w.getOutlookEventsByMonth(Ae);z($e)}catch(Ae){console.error("Error al obtener eventos de Outlook:",Ae)}};if(n===void 0||e===void 0)return c.jsx("div",{children:"Cargando configuración de usuario..."});const L=async(ee,Oe)=>{await C.UpdateStatusEvento(ee.evento.eventoID,e,Oe)&&(await C.MarcarLeido(ee.notificacionID,e),S(ee?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},te=async()=>{pe&&C.UpdateStatusEvento(pe.evento.eventoID,e,"RECHAZADA")&&(await C.MarcarLeido(pe.notificacionID,e),await C.MarcarLeido(pe.notificacionID,e),S("Haz rechazado la Invitación a "+pe?.evento?.titulo,{content:(Oe,Ae)=>c.jsx(pc,{id:Oe,message:String(Ae),variant:"rechazar"})}),Qt())},ye=async(ee,Oe)=>{try{if(!e)return;Ce(ee),Oe=="RECHAZADA"?(Ee(),console.log("noti",ee)):L(ee,Oe)}catch{S("Error al procesar la invitación",{variant:"error"})}},Ze=async ee=>{try{if(!h)return;await C.ReenviarNotificacion(h?.eventoID,ee),S("Invitación enviada con éxito",{variant:"success"})}catch(Oe){console.error("Error al conectar con la API",Oe)}},[mt,Ct]=b.useState(null),Qt=()=>Ct(null),rr={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:c.jsxs(c.Fragment,{children:["Estás a punto de declinar la invitación de ",c.jsx("strong",{children:pe?.evento?.nombreAnfitrion})," a ",c.jsx("strong",{children:pe?.evento?.titulo})]}),icon:c.jsx("img",{src:g0}),action:()=>pe&&te()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:c.jsx("img",{src:g0}),action:()=>U()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>U}},Jt=mt?rr[mt]:null;return c.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[c.jsx(jy,{header:c.jsx(X2,{currentDate:s,onPrevMonth:Le,onNextMonth:Fe,onAddEvent:Xe,onDateChange:A}),sidebar:c.jsx(Kw,{onEventClick:R,upcomingEvents:y,leads30Days:r,leads90Days:t,disID:n,usrID:e,onAddEvent:Xe,googleCalendars:$,outlookCalendars:we,isLoadingCalendars:Se,onToggleGoogle:oe,onToggleOutlook:K,notifications:se,unreadCount:se?.filter(ee=>!ee.leida).length,onAceppInvitacion:ye}),mainContent:c.jsx(u_,{onSeeMoreClick:de,currentDate:s,events:ae,onDayClick:j,onEventClick:R})}),u&&c.jsx(u3,{isVisible:u,onClose:We,onSave:st,onDelete:Me,selectedDate:v,initialEvent:h,userId:e,masNombreBD:o,disId:n,gmail:"llopez@exagono.net",onReenviar:Ze}),c.jsx(f3,{isOpen:N,onClose:()=>D(!1),events:k,date:I,onEventClick:R}),Jt&&c.jsx(k3,{open:!!mt,onClose:Qt,onConfirm:()=>{Jt.action()},title:Jt.title,description:Jt.description,icon:Jt.icon,confirmText:Jt.confirmText})]})},M3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%3e%3cpath%20fill='%23070c10'%20d='M18.575%203.172A10.829%2010.829%200%200%200%201.564%2016.284l-.028-.051L0%2021.843l5.739-1.506a10.7%2010.7%200%200%200%205.173%201.318%2010.83%2010.83%200%200%200%207.663-18.483m-7.658%2016.655a8.94%208.94%200%200%201-4.62-1.277l.041.023-.329-.194-3.405.894.908-3.321-.214-.34a8.9%208.9%200%200%201-1.376-4.782%209%209%200%201%201%209%209Zm4.935-6.736c-.27-.135-1.6-.789-1.848-.88s-.429-.135-.61.136-.7.879-.856%201.06-.316.2-.586.068a7.5%207.5%200%200%201-2.183-1.349l.007.007a8.2%208.2%200%200%201-1.483-1.842l-.02-.038c-.157-.27-.017-.417.118-.551s.271-.316.406-.473a1.9%201.9%200%200%200%20.267-.44v-.012a.5.5%200%200%200%20.05-.216.5.5%200%200%200-.074-.26c-.068-.135-.609-1.467-.834-2.009s-.444-.455-.609-.464-.338-.009-.519-.009a.99.99%200%200%200-.72.337%203.03%203.03%200%200%200-.947%202.2v.058a5.27%205.27%200%200%200%201.114%202.815v-.011a12.16%2012.16%200%200%200%204.553%204.053l.068.031a14%2014%200%200%200%201.434.539l.109.03a3.6%203.6%200%200%200%201.077.161%203.7%203.7%200%200%200%20.648-.057h-.023a2.8%202.8%200%200%200%201.819-1.274l.007-.012a2.2%202.2%200%200%200%20.19-.9%202.3%202.3%200%200%200-.034-.395v.014c-.067-.113-.248-.18-.519-.316Z'/%3e%3c/svg%3e",I3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='25.085'%20height='18.5'%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='none'%20d='M0%200h25.085v18.5H0z'%20data-name='Rectángulo%204598'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23a)'%20data-name='Grupo%207946'%3e%3cpath%20d='M23.12%205.809V3.226a3.2%203.2%200%200%200-.068-.656l-3.141%202.21a7.8%207.8%200%200%201%203.209%201.032'%20data-name='Trazado%2013329'/%3e%3cpath%20d='M11.847%209.791c-.1.009-.2.023-.308.023a3.78%203.78%200%200%201-2.18-.688L.067%202.58A3.2%203.2%200%200%200%200%203.227V13.98a3.23%203.23%200%200%200%203.226%203.226h9.611a7.86%207.86%200%200%201-.99-7.414'%20data-name='Trazado%2013330'/%3e%3cpath%20d='M12.478%207.369%2021.92.737A3.2%203.2%200%200%200%2019.894%200H3.226a3.2%203.2%200%200%200-2.031.74l9.4%206.628a1.64%201.64%200%200%200%201.881%200'%20data-name='Trazado%2013331'/%3e%3cpath%20d='M23.356%208.407a5.914%205.914%200%201%200%200%208.364%205.92%205.92%200%200%200%200-8.364m-1.833%204.842a.54.54%200%200%201-1.081%200v-1.164l-2.513%202.516a.54.54%200%200%201-.765-.763l2.515-2.515h-1.167a.54.54%200%201%201%200-1.081h2.471a.54.54%200%200%201%20.54.54Z'%20data-name='Trazado%2013332'/%3e%3c/g%3e%3c/svg%3e";function hc(e,r,t){return e.accessor?e.accessor(r,t):e.field?r?.[e.field]:r?.[e?.key||""]}function O3(e,r){const t=e??"",n=r??"";return t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():typeof t=="number"&&typeof n=="number"?t-n:typeof t=="boolean"&&typeof n=="boolean"?Number(t)-Number(n):String(t).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function mc(e,r,t=!0){return typeof e=="function"?e(r):e??t}function P3(e){return e.replace(/[^\d]/g,"")}function j3(e,r){return r}var ua={},v0;function R3(){if(v0)return ua;v0=1;var e=lt();Object.defineProperty(ua,"__esModule",{value:!0}),ua.default=void 0;var r=e(ht()),t=dt();return ua.default=(0,r.default)((0,t.jsx)("path",{d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAlt"),ua}var N3=R3();const L3=it(N3);var da={},y0;function $3(){if(y0)return da;y0=1;var e=lt();Object.defineProperty(da,"__esModule",{value:!0}),da.default=void 0;var r=e(ht()),t=dt();return da.default=(0,r.default)((0,t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27c1.2-1.4 1.82-3.31 1.48-5.34-.47-2.78-2.79-5-5.59-5.34-4.23-.52-7.79 3.04-7.27 7.27.34 2.8 2.56 5.12 5.34 5.59 2.03.34 3.94-.28 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"SearchRounded"),da}var z3=$3();const B3=it(z3);var fa={},b0;function F3(){if(b0)return fa;b0=1;var e=lt();Object.defineProperty(fa,"__esModule",{value:!0}),fa.default=void 0;var r=e(ht()),t=dt();return fa.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),fa}var U3=F3();const W3=it(U3);var pa={},x0;function V3(){if(x0)return pa;x0=1;var e=lt();Object.defineProperty(pa,"__esModule",{value:!0}),pa.default=void 0;var r=e(ht()),t=dt();return pa.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),pa}var H3=V3();const Y3=it(H3);function w0(e){return e==="right"?"end":e==="center"?"center":"start"}function _0(e){const r=e.filter(t=>!t.width).length||1;return e.map(t=>typeof t.width=="number"?`${t.width}px`:typeof t.width=="string"?t.width:`minmax(0, ${1/r}fr)`).join(" ")}const q3=1060,gc=(e,r)=>e.metrics.find(t=>String(t.label).toLowerCase()===r.toLowerCase())?.value??"";function Z3({sections:e,detailColumns:r,summaryWidths:t=["1fr",120,120,150],minWidth:n=q3,getDetailColumns:o,onRowClick:a}){function l(u){if(typeof u=="number")return u;if(!u)return 0;const f=/^(\d+)\s*px$/.exec(u.trim());return f?Number(f[1]):/fr$/i.test(u)?160:0}function d(u){const f=u.reduce((v,p)=>v+l(p.width),0),h=Math.max(u.length-1,0)*16;return f+h+32}return c.jsx(m.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:c.jsxs(m.Box,{children:[c.jsx(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(u=>typeof u=="number"?`${u}px`:u).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"#1E5BCE",color:"#fff",boxSizing:"border-box"},children:["Tipo","En Proceso","Finalizadas","Último seg."].map(u=>c.jsx(m.Typography,{sx:{fontSize:13,fontWeight:800},children:u},u))}),e.map((u,f)=>{const[h,g]=M.useState(!!u.initiallyOpen),v=f%2===1,p=o?o(u):r,y=Math.max(n,d(p));return c.jsxs(m.Box,{children:[c.jsxs(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(_=>typeof _=="number"?`${_}px`:_).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:v?"rgba(30,91,206,0.06)":"background.paper",borderTop:"1px solid rgba(0,0,0,0.08)","&:hover":{bgcolor:"rgba(30,91,206,0.12)"},boxSizing:"border-box",cursor:"pointer"},onClick:()=>g(_=>!_),children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[c.jsx(m.IconButton,{size:"small",disableRipple:!0,children:h?c.jsx(Y3,{}):c.jsx(W3,{})}),c.jsx(m.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(u.title),children:u.title})]}),c.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:gc(u,"En Proceso")}),c.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:gc(u,"Finalizadas")}),c.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:gc(u,"Último seg.")})]}),c.jsx(m.Collapse,{in:h,unmountOnExit:!0,children:c.jsxs(m.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[c.jsx(m.Box,{sx:{minWidth:y,display:"grid",gridTemplateColumns:_0(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"rgba(30,91,206,0.18)",color:"#1a1a1a",borderTop:"1px solid rgba(0,0,0,0.12)",boxSizing:"border-box"},children:p.map(_=>c.jsx(m.Typography,{sx:{justifySelf:w0(_.align),textAlign:_.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.header},_.key))}),(u.rows??[]).map((_,S)=>c.jsx(m.Box,{sx:{minWidth:y,display:"grid",gridTemplateColumns:_0(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:S%2===0?"background.paper":"rgba(30,91,206,0.06)",borderTop:"1px solid rgba(0,0,0,0.06)","&:hover":{bgcolor:"rgba(30,91,206,0.12)"},boxSizing:"border-box",cursor:"pointer"},onClick:()=>a?.(_,u),children:p.map((C,E)=>{const w=C.accessor?C.accessor(_,S):C.field?_[C.field]:null;return c.jsx(m.Box,{sx:{justifySelf:w0(C.align),textAlign:C.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof w=="string"||typeof w=="number"?c.jsx(m.Typography,{sx:{fontSize:13,fontWeight:/^(estatus|seg|avance|nivel|asesor|fecha)$/i.test(C.key)?700:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(w),children:w}):w},C.key??E)})},_.id??S))]})})]},u.id)})]})})}var ha={},S0;function G3(){if(S0)return ha;S0=1;var e=lt();Object.defineProperty(ha,"__esModule",{value:!0}),ha.default=void 0;var r=e(ht()),t=dt();return ha.default=(0,r.default)((0,t.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m3.3 14.71L11 12.41V7h2v4.59l3.71 3.71z"}),"AccessTimeFilled"),ha}var K3=G3();const Q3=it(K3),J3=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",X3=e=>{const r=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return r||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},e5=e=>{const r=(e||"").split(" ").filter(Boolean);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var ma={},C0;function t5(){if(C0)return ma;C0=1;var e=lt();Object.defineProperty(ma,"__esModule",{value:!0}),ma.default=void 0;var r=e(ht()),t=dt();return ma.default=(0,r.default)((0,t.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Create"),ma}var r5=t5();const n5=it(r5),vc=({current:e=0,total:r=0,color:t="#4caf50"})=>c.jsx("div",{style:{display:"flex",gap:"1px",width:"100%",height:"100%",justifyContent:"center",overflow:"hidden",minWidth:0},children:Array.from({length:r}).map((n,o)=>c.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?t:"#e0e0e0",display:"flex"}},o))});var ga={},E0;function o5(){if(E0)return ga;E0=1;var e=lt();Object.defineProperty(ga,"__esModule",{value:!0}),ga.default=void 0;var r=e(ht()),t=dt();return ga.default=(0,r.default)((0,t.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),ga}var a5=o5();const D0=it(a5);var va={},A0;function s5(){if(A0)return va;A0=1;var e=lt();Object.defineProperty(va,"__esModule",{value:!0}),va.default=void 0;var r=e(ht()),t=dt();return va.default=(0,r.default)((0,t.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),va}var i5=s5();const l5=it(i5),c5=e=>{const r=String(e??"").toLowerCase().trim();return r==="muy interesado"?{bg:"#E53935",color:"#FFFFFF"}:r==="interesado"?{bg:"#FB8C00",color:"#FFFFFF"}:r==="venta definitiva"?{bg:"#2E7D32",color:"#FFFFFF"}:r==="no sé"||r==="no se"?{bg:"#9E9E9E",color:"#FFFFFF"}:r==="algo interesado"?{bg:"#FFEB3B",color:"#000000"}:{bg:"transparent",color:"#2c2c2c"}},u5=e=>{switch(parseInt(String(e??""),10)){case 1:return"Por Asignar";case 2:return"Solicitud Asignada";case 3:return"Solicitud asignada en proceso";case 4:return"Finalizadas sin Venta";case 5:return"Finalizadas con Venta";case 6:return"Rechazadas";case 7:return"Finalizada por sistema";case 8:return"";case 9:return"";case 10:return"Prospección";case 11:return"Interés Real";case 12:return"Proceso de Compra";case 13:return"";case 14:return"En espera de Unidad";case 15:return"Auto Facturado";case 16:return"";case 17:return"";case 18:return"Compró otra Marca";case 19:return"No comprará";default:return null}},d5=e=>{switch(parseInt(String(e??""),10)){case 1:return"Por asignar";case 2:return"Solicitud Asignada";case 3:return"En seguimiento";case 6:return"Rechazada";case 7:return"Finalizada sin enviar a Ventas";case 8:return"Finalizada enviado a Ventas";default:return null}},f5=e=>{switch(parseInt(String(e??""),10)){case 0:return"Sin asignar";case 1:return"Confirmado";case 2:return"Solicitud Asignada";case 3:return"En seguimiento";case 4:return"Confirmado";case 5:return"Finalizada";case 6:return"Rechazada";case 10:return"Reagendado";case 20:return"Seguimiento [Cita Finalizada]";case 30:return"Reenvio";case 40:return"Seguimiento [Mecanico]";case 50:return"Seguimiento";default:return null}};function p5(e){const r=new Date(e),t=r.toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),n=r.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"});return`${t.replace(".","")} • ${n}`}function h5(e){return e.replace(/<br\s*\/?>/gi,`
189
189
  `).replace(/\r\n/g,`
190
190
  `).replace(/\r/g,`
191
191
  `)}const m5={Todos:[],"Sin Asignar":["Sin Asignar"],"En prospección":["Prospección"],"Proceso de Compra":["Proceso de Compra"],"En espera de Unidad":["En Espera de Unidad"],"Auto Facturado":["Auto Facturado"],Rechazadas:["Rechazada","Rechazadas"],"Finalizadas sin Venta":["Sin Venta"],"Finalizadas con Venta":["Con Venta"],"En Proceso":["Asignada","Prospección","Sin Asignar","Proceso de Compra","En Espera de Unidad","Auto Facturado","Sin Atender"]},g5={Todos:[],"Selección y presentación de vehículos":["Selección y presentación de vehículos"],"Prueba de Manejo":["Prueba de Manejo"],"Valoración del Auto a cuenta y/o enganche":["Valoración del Auto a cuenta y/o enganche"],"Entrega de vehículo":["Entrega de vehículo"],"Negociación y Cierre":["Negociación y Cierre"]},v5={Todos:[],"Algo interesado":["Algo interesado"],Interesado:["Interesado"],"Muy interesado":["Muy interesado"],"Venta definitiva":["Venta definitiva"],"No sé":["No sé"]};function y5(e,r){switch(e){case"pruebas":return d5(r)??"—";case"servicio":return f5(r)??"—";case"nuevos":case"seminuevos":default:return u5(r)??"—"}}function b5({open:e,onClose:r,customer:t,fields:n=[],header:o,extraSections:a,normalTable:s,normalTableColumns:i=[],history:l=[],advisorHistory:d=[],onRequestEdit:u,searchFilter:f,urlsQA:h,solicitudesNuevos:g=[],solicitudesPrueba:v=[],solicitudesServicio:p=[],solicitudesSeminuevos:y=[],onCreateSolicitud:_,isCrmMode:S=!1,onSolicitudBaseUrl:C,onIframeClose:E,reloadInfo:w,idAdminSistemas:N}){if(!t)return null;const D=3,[k,O]=b.useState(null),I=!!k,[Y,V]=b.useState(!1),[W,Z]=b.useState(null),[J,H]=b.useState(l??[]),[z,ae]=b.useState(null),ce=b.useMemo(()=>[...d].sort((B,Q)=>new Date(Q.FechaAsignacion).getTime()-new Date(B.FechaAsignacion).getTime()),[d]);b.useEffect(()=>{l&&l.length&&H(l)},[l]);const $=l?.length?l:J,X=o?.title??(B=>B?.Nombre||B?.name||"Sin título"),we=o?.infoItems??[],_e=B=>B.nombreAsesor?.trim()||(B.Email?B.Email:"Sistema"),Se=B=>{const Q=B||"",be=Q.split(" ").filter(Boolean);return be.length>=2?(be[0][0]+be[1][0]).toUpperCase():(Q[0]||"?").toUpperCase()},ne=B=>B?.SolID??B?.solID??B?.SolId??B?.SOLID??null,se=b.useMemo(()=>{const B=$??[];return Array.isArray(B?.[0])?B.flat():B},[$]),ie=b.useMemo(()=>{const B=se;return!z||W==null?B:B.filter(Q=>{const be=ne(Q);return be!=null&&String(be)===String(W)})},[se,z,W]),pe=b.useMemo(()=>[...ie].sort((B,Q)=>new Date(Q.fecAlta).getTime()-new Date(B.fecAlta).getTime()),[ie]),[Ce,de]=b.useState(!1),Ne=b.useMemo(()=>Ce?pe:pe.slice(0,D),[Ce,pe]),R=Math.max(pe.length-D,0),We=B=>String(B??"").normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim(),st=(B,Q)=>We(JSON.stringify(B)).includes(We(Q)),Le=(B,Q)=>f?f(B,Q):st(B,Q),Fe=(B,Q)=>{const be=We(Q).split(/\s+/).filter(Boolean);return be.length?be.every(Ie=>Le(B,Ie)):!0},[Me,Ee]=b.useState(""),[Xe,A]=b.useState([]);b.useMemo(()=>s??[],[s]),b.useMemo(()=>{const B=Me.trim();return B?(s??[]).filter(Q=>Fe(Q,B)):s??[]},[s,Me]);const j=m.useTheme(),U=m.useMediaQuery(j.breakpoints.down("md")),[le,oe]=b.useState(""),[P,K]=b.useState(!0),[ve,ke]=b.useState(!1),L=new Date().toISOString().slice(0,10),te=new Date(Date.now()-720*3600*1e3).toISOString().slice(0,10),[ye,Ze]=b.useState(te),[mt,Ct]=b.useState(L),[Qt,rr]=b.useState(null),Jt=!!Qt,[ee,Oe]=b.useState("En Proceso"),[Ae,$e]=b.useState("Todos"),[qt,nr]=b.useState("Todos"),cr=["Algo interesado","Interesado","Muy interesado","Venta definitiva","No sé"],ur=["Selección y presentación de vehículos","Prueba de Manejo","Valoración del Auto a cuenta y/o enganche","Entrega de vehículo","Negociación y Cierre"],Ge=()=>{oe(""),K(!1),ke(!1),Ze(te),Ct(L),Oe("Todos"),$e("Todos"),nr("Todos")},Xt=b.useMemo(()=>(le??"").trim()!==""||ee!=="Todos"||Ae!=="Todos"||P||ve||qt!=="Todos",[le,ee,Ae,P,ve,qt]);function q(B){if(!B)return"";const Q=new Date(B);if(isNaN(Q.getTime()))return"";const be=String(Q.getDate()).padStart(2,"0"),Ie=String(Q.getMonth()+1).padStart(2,"0"),kt=String(Q.getFullYear()).slice(-2);return`${be}/${Ie}/${kt}`}function ge(B){const Q=B?new Date(B):null;return Q&&!isNaN(Q.getTime())?Q:null}function Pe(B,Q){let be=null;for(const Ie of B){const kt=ge(Q(Ie));if(kt){const Et=kt.getTime();(be===null||Et>be)&&(be=Et)}}return be?new Date(be):null}function me(B){const Q=Pe(B,be=>be.UltimoSeguimiento||be.FechaCita);return Q?q(Q.toISOString()):"—"}function je(B){const Q=(B??"").toLowerCase().trim();return Q==="sin venta"||Q==="con venta"||Q==="rechazada"||Q==="rechazadas"}function Ue(B){return B.filter(Q=>je(Q.EstatusDescripcion)).length}function xt(B){return B.filter(Q=>!je(Q.EstatusDescripcion)).length}const Sr=({progress:B,color:Q})=>{if(!B)return c.jsx(vc,{current:0,total:0,color:Q});const be=B.split("/").map(Number);if(be.length!==2||be.some(Et=>Number.isNaN(Et)))return c.jsx(vc,{current:0,total:0,color:Q});const[Ie,kt]=be;return c.jsx(vc,{current:Ie,total:kt,color:Q})};function Rr(B){return[{key:"fecha",header:"Fecha",accessor:Q=>q(Q.Fecha),width:110},{key:"vehiculo",header:"Vehículo",accessor:Q=>c.jsx(m.Tooltip,{title:Q.Vehiculo??"",placement:"top",arrow:!0,children:c.jsx(m.Typography,{component:"span",sx:{fontSize:13,fontWeight:500,display:"block",maxWidth:260,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:"default"},children:Q.Vehiculo??"—"})}),width:260},{key:"estatus",header:"Estatus",accessor:Q=>c.jsx(m.Typography,{sx:{fontWeight:800,fontSize:13},children:y5(B,Q.IdEstatus)}),width:170},{key:"nivel",header:"Nivel de Interés",accessor:Q=>{const{bg:be,color:Ie}=c5(Q.NivelInteres);return c.jsx(m.Box,{sx:{display:"inline-block",px:1,py:.25,borderRadius:9999,bgcolor:be,color:Ie,fontSize:12,fontWeight:Q.NivelInteres?800:500},children:Q.NivelInteres??"—"})},width:150},{key:"asesor",header:"Asesor",accessor:Q=>{const be=(Q.Asesor??"").trim(),Ie=wc=>{if(!wc)return"";const W5=wc[0]?.toUpperCase()??"",V5=wc[1]?.toLowerCase()??"";return`${W5}${V5}`};if(!be)return c.jsx(m.Tooltip,{title:"",placement:"top",children:c.jsx(m.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:"—"})});const kt=be.split(/\s+/),Et=kt[0]??"",Nr=kt[1]??"",Cr=Ie(Et),Pn=Ie(Nr),U5=`${Cr}${Pn}`||"—";return c.jsx(m.Tooltip,{title:be,placement:"top",children:c.jsx(m.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:U5})})},width:120,align:"center"},{key:"origen",header:"Origen",accessor:Q=>Q.Origen??"—",width:120,align:"center"},{key:"actividad",header:"Actividad",accessor:Q=>c.jsx(m.Tooltip,{title:Q.Actividad??"",placement:"top",arrow:!0,children:c.jsxs(m.Box,{sx:{maxWidth:160,overflow:"hidden",display:"flex",gap:.5,alignItems:"center"},children:[Q.Icon&&c.jsx("span",{style:{color:"#fff",backgroundColor:Q.Color,borderRadius:100,alignItems:"center",justifyContent:"center",display:"flex",padding:3},children:c.jsx("i",{className:Q.Icon})}),c.jsx(m.Typography,{component:"span",noWrap:!0,sx:{fontSize:13,fontWeight:500,display:"block",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:(Q.Actividad??"").length?"default":"inherit"},children:Q.Actividad??"—"})]})}),width:180},{key:"avance",header:"Avance",accessor:Q=>c.jsx(Sr,{progress:Q.Avance,color:Q.Color}),width:200,align:"left"}]}function T(B){const be=Rr(B).slice(1);return[{key:"fecha",header:"Fecha",accessor:Ie=>q(Ie.Fecha),width:110},{key:"fechaCita",header:"Fecha Cita",accessor:Ie=>q(Ie.FechaCita),width:120},{key:"horaCita",header:"Hora Cita",accessor:Ie=>Ie.HoraCita??"—",width:110},...be]}function re(B){const Q=B.kind;switch(Q){case"pruebas":case"servicio":return T(Q);case"nuevos":case"seminuevos":default:return Rr(Q)}}function he(B,Q,be,Ie){return{id:B,kind:be,title:Q,metrics:[{label:"En Proceso",value:xt(Ie)},{label:"Finalizadas",value:Ue(Ie)},{label:"Último seg.",value:me(Ie)}],rows:Ie,initiallyOpen:!1}}const Re=[he("n-1","Cotización de nuevos","nuevos",g),he("p-1","Prueba de Manejo","pruebas",v),he("s-1","Cita de Servicio","servicio",p),he("sn-1","Cotización para Seminuevos","seminuevos",y)],Ke=b.useMemo(()=>{const B=(le??"").trim().toLowerCase(),Q=(be,Ie)=>{if(B&&!(be.Vehiculo??"").toLowerCase().includes(B))return!1;const kt=ve?be.FechaCita:be.Fecha;if(P&&kt){const Et=ge(kt??"");if(!Et)return!1;const Nr=ye?new Date(`${ye}T00:00:00`):null,Cr=mt?new Date(`${mt}T00:00:00`):null;if(Cr&&Cr.setDate(Cr.getDate()+1),Nr&&Et<Nr||Cr&&Et>=Cr)return!1}if(ee!=="Todos"){const Et=(be.EstatusDescripcion??"").toLowerCase();if(!(m5[ee]??[]).some(Pn=>Et===Pn.toLowerCase()))return!1}if(Ae!=="Todos"){const Et=(be.Actividad??"").toLowerCase();if(!(g5[Ae]??[]).some(Pn=>Et===Pn.toLowerCase()))return!1}if(qt!=="Todos"){const Et=(be.NivelInteres??"").toLowerCase();if(!(v5[qt]??[]).some(Pn=>Et===Pn.toLowerCase()))return!1}return!0};return Re.map(be=>{const Ie=(be.rows??[]).filter(Et=>Q(Et,be.kind)),kt=[{label:"En Proceso",value:xt(Ie)},{label:"Finalizadas",value:Ue(Ie)},{label:"Último seg.",value:me(Ie)}];return{...be,rows:Ie,metrics:kt}})},[Re,le,P,ye,mt,ve,ee,Ae,qt]),ut={nuevos:"cotizaciones",pruebas:"pruebademanejo",servicio:"citasservicio",seminuevos:"seminuevos"},qe=(B,Q)=>{const be=B.SolID;if(!be)return;const Ie=Q.kind,kt=ut[Ie]??"cotizaciones",Et=h?`https://qa2.crm.netcar.com.mx/netcar/${kt}/${be}`:`https://crmxs.netcar.com.mx/netcar/${kt}/${be}`,Nr=C?.({row:B,section:Q,slug:kt,solId:be,baseUrl:Et});if(!S){const Cr=Nr??Et;Z(be),ae(Cr),V(!0)}},Ve=()=>{E?.(t),Z(null),ae(null),V(!1)},Ut=b.useRef(!1),gt=b.useRef(null),Ot=b.useCallback(()=>{if(!Ut.current){Ut.current=!0;return}gt.current&&window.clearTimeout(gt.current),gt.current=window.setTimeout(()=>{w?.(t)},500)},[w,t]);return b.useEffect(()=>{Ut.current=!1,gt.current&&window.clearTimeout(gt.current)},[z,W]),c.jsx(m.Dialog,{open:e,onClose:r,fullWidth:!0,fullScreen:U,PaperProps:{sx:{height:{xs:"100dvh",md:"90vh"},maxWidth:{xs:"100vw",md:"92vw"},overflow:"hidden",display:"flex",flexDirection:"column",borderRadius:{xs:0,md:3}}},children:c.jsxs(m.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},height:"100%",minHeight:0,overflow:"auto",position:"relative"},children:[c.jsxs(m.Box,{sx:{width:{xs:"100%",md:405},maxWidth:{xs:"100%",md:405},bgcolor:{xs:"transparent",md:"#40404024"},display:"flex",flexDirection:"column",height:{xs:"auto",md:"100%"},borderRight:{xs:"none",md:"1px solid #EBEEF0"}},children:[c.jsxs(m.Box,{children:[c.jsx(m.Stack,{direction:"row",spacing:2,alignItems:"center",mb:1,sx:{px:2.5,pt:2.5},children:c.jsxs(m.Box,{display:"flex",flexDirection:"column",gap:1,width:"100%",children:[c.jsx(m.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:c.jsx(m.Box,{sx:{flex:1,minWidth:0,pr:1},children:c.jsxs(m.Typography,{component:"span",fontWeight:700,sx:{display:"inline",lineHeight:1.2,wordBreak:"break-word",pr:.5},children:[X(t)," ",c.jsx(m.IconButton,{component:"span",size:"small",disableRipple:!0,onClick:()=>{r?.(),t&&u?.(t)},sx:{p:0,ml:.5,verticalAlign:"text-bottom",color:"#336BE1","&:hover":{bgcolor:"transparent"},"&:focus-visible":{outline:"none"}},"aria-label":"Editar nombre",children:c.jsx(n5,{sx:{fontSize:"1em"}})})]})})}),we.map((B,Q)=>c.jsxs(m.Box,{sx:{display:"flex",gap:1.2,alignItems:"center",cursor:B.onClick?"pointer":"default"},onClick:()=>{B.onClick&&B.onClick(t)},children:[B.icon,c.jsx(m.Typography,{variant:"body2",sx:{color:B.inLink?"#336BE1":"#070C10"},style:{},children:B.value(t)})]},Q))]})}),c.jsx(m.Stack,{mb:2,sx:{px:2.5,pt:0,gap:2},children:n.map((B,Q)=>{const be=B.label?.toLowerCase().startsWith("asesor");return c.jsxs(m.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[c.jsx(m.Box,{sx:{width:"50%"},children:c.jsx(m.Typography,{variant:"body2",color:"text.secondary",sx:{color:"#5C6372"},children:B.label})}),c.jsxs(m.Box,{sx:{width:"50%",display:"flex",alignItems:"center",gap:1},children:[c.jsx("div",{children:B?.avatar?B.avatar(t):null}),c.jsx(m.Typography,{variant:"body2",color:"textPrimary",children:B?.value(t)}),be&&!N&&c.jsx(m.Tooltip,{title:"Historial asesores",placement:"top",arrow:!0,children:c.jsx(m.IconButton,{size:"small",onClick:Ie=>O(Ie.currentTarget),sx:{ml:.5},disableRipple:!0,children:c.jsx(Q3,{fontSize:"small",sx:{color:"#5C6372"}})})})]})]},Q)})}),c.jsx(m.Divider,{sx:{my:2}})]}),c.jsx(m.Box,{px:2.5,pb:.5,children:c.jsxs(m.Typography,{children:[c.jsx("span",{style:{fontWeight:800},children:"Última actividad"}),!z&&" por solicitud",":"]})}),c.jsxs(m.Box,{sx:{px:2.5,pt:0,gap:2,flex:1,overflowY:"auto",display:"flex",flexDirection:"column",pb:6,maxHeight:{xs:"140px",md:"100%"}},children:[Ne.length===0&&c.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"Sin actividad registrada."}),c.jsxs(m.Box,{children:[Ne?.map((B,Q)=>{const be=_e(B),Ie=h5(B.comentario||"");return c.jsxs(m.Box,{sx:{pb:1.5},children:[c.jsxs(m.Stack,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",sx:{mb:.75},children:[c.jsx(m.Typography,{variant:"subtitle2",sx:{color:"#5C6372"},children:B.tipo||"Evento"}),c.jsx(m.Chip,{size:"small",label:B.auto!=null?`${B.auto}`:"—",sx:{bgcolor:"#336be1",color:"#fff",height:20}})]}),Ie?c.jsx(m.Typography,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.5,mb:.75},children:Ie}):null,c.jsxs(m.Stack,{direction:"row",spacing:1.25,alignItems:"center",children:[B?.ImgAsesor!=null?c.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},alt:Se(be),src:B?.ImgAsesor}):c.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},children:Se(be)}),c.jsxs(m.Stack,{spacing:0,children:[c.jsx(m.Typography,{variant:"body2",fontWeight:600,children:be}),c.jsx(m.Typography,{variant:"caption",color:"text.secondary",children:p5(B.fecAlta)})]})]}),Q<Ne.length-1&&c.jsx(m.Divider,{sx:{mt:1.25}})]},B.segID??Q)}),pe.length>D&&c.jsx(m.Box,{sx:{mt:1},children:c.jsx(m.Button,{onClick:()=>de(B=>!B),size:"small",sx:{textTransform:"none",px:0,color:"#336BE1","&:hover":{background:"transparent",textDecoration:"underline"}},children:Ce?"Ver menos":`Ver más (${R})`})})]})]}),c.jsx(m.Menu,{anchorEl:k,open:I,onClose:()=>O(null),TransitionComponent:m.Fade,MenuListProps:{disablePadding:!0},PaperProps:{sx:{width:320,p:0,overflow:"hidden"}},anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:c.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[c.jsx(m.Box,{sx:{position:"sticky",top:0,zIndex:1,px:1.5,py:1,fontWeight:700,bgcolor:"background.paper",borderBottom:"1px solid",borderColor:"divider"},children:"Historial asesores"}),c.jsxs(m.Box,{sx:{overflowY:"auto",py:.5,maxHeight:200},children:[ce.length===0&&c.jsx(m.Box,{sx:{px:1.5,py:1},children:c.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"Sin registros"})}),ce.map((B,Q)=>{const be=X3(B),Ie=J3(B.FechaBaja??B.FechaAsignacion);return c.jsx(m.Box,{sx:{px:1,py:.75},children:c.jsxs(m.Stack,{direction:"row",alignItems:"center",spacing:1,children:[c.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},src:B?.ImgAsesor??void 0,children:e5(be)}),c.jsx(m.Box,{sx:{flex:1,minWidth:0},children:c.jsx(m.Typography,{variant:"body2",noWrap:!0,children:be})}),c.jsx(m.Typography,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:Ie})]})},Q)})]})]})})]}),Y?c.jsxs(m.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",position:"relative"},children:[c.jsx(m.Box,{sx:{position:"absolute",top:18,left:24,zIndex:10,pointerEvents:"auto"},children:c.jsx(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:c.jsx(m.Button,{onClick:Ve,sx:{backgroundColor:"#2571d6",minWidth:36,minHeight:36,p:.5,borderRadius:"8px",color:"#fff",boxShadow:3,"&:hover":{backgroundColor:"#2074e3"}},children:c.jsx(l5,{fontSize:"medium"})})})}),z&&c.jsx("iframe",{src:z,width:"100%",height:"100%",onLoad:Ot,style:{border:0}})]}):c.jsxs(m.Box,{sx:{width:"100%",minHeight:0,overflowY:"auto"},children:[c.jsx(m.Box,{sx:{mt:{xs:1.5,md:3}},children:c.jsxs(m.Box,{sx:{mt:3,display:"flex",flexDirection:"column",gap:4,padding:"0 20px 0 20px"},children:[c.jsx(m.Typography,{variant:"h4",sx:{fontWeight:800,textAlign:"center",mb:1,letterSpacing:.2},children:"Solicitudes"}),c.jsxs(m.Stack,{direction:{xs:"column",md:"column"},spacing:1.5,alignItems:{xs:"stretch",md:"center"},justifyContent:"space-between",sx:{mb:1.5},children:[c.jsxs(m.Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",sx:{flexWrap:"wrap"},children:[c.jsx(m.TextField,{size:"small",placeholder:"Buscar por vehículo",value:le,onChange:B=>oe(B.target.value),InputProps:{endAdornment:c.jsx(B3,{fontSize:"small",sx:{color:"#b6afaf"}})},sx:{minWidth:220}}),c.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,position:"relative"},children:[c.jsxs(m.Stack,{direction:"row",spacing:1.1,position:"absolute",bottom:48,left:0,alignItems:"center",children:[c.jsx(m.FormControlLabel,{label:c.jsx(m.Typography,{sx:{fontSize:15,fontWeight:600,marginLeft:0},children:"Por fecha"}),labelPlacement:"start",control:c.jsx(m.Checkbox,{checked:P,onChange:B=>K(B.target.checked),size:"small",sx:{p:.3,"& .MuiSvgIcon-root":{fontSize:19},color:"#bab4b4"}}),sx:{ml:0,"& .MuiFormControlLabel-label":{marginRight:0}}}),c.jsx(m.Typography,{sx:{fontSize:15,paddingLeft:.4},children:"De cita"})]}),c.jsxs(m.Stack,{direction:"row",spacing:1,children:[c.jsx(m.TextField,{size:"small",type:"date",label:"Desde",InputLabelProps:{shrink:!0},value:ye,onChange:B=>Ze(B.target.value),disabled:!P,sx:{width:170}}),c.jsx(m.TextField,{size:"small",type:"date",label:"Hasta",InputLabelProps:{shrink:!0},value:mt,onChange:B=>Ct(B.target.value),disabled:!P,sx:{width:170}})]})]}),c.jsx(m.IconButton,{onClick:B=>rr(B.currentTarget),disableRipple:!0,sx:{border:"1px solid #d4d7de",borderRadius:2,width:40,height:40,mt:2},children:c.jsx(L3,{})}),Xt&&c.jsx(m.Button,{variant:"outlined",onClick:Ge,disableRipple:!0,sx:{height:40,textTransform:"none",borderColor:"#d4d7de",color:"#333",mt:2},children:"Limpiar filtros"}),c.jsx(m.Tooltip,{title:Xt&&"Crear Solicitud",arrow:!0,placement:"top",disableHoverListener:!Xt,children:c.jsx("span",{children:c.jsxs(m.Button,{variant:"outlined",sx:{height:40,textTransform:"none",borderColor:"none",color:"#fff",backgroundColor:"#1e5bce","&:hover":{backgroundColor:"#1e5bce",boxShadow:"none"}},onClick:()=>{_?.(t)},disableRipple:!0,children:[c.jsx(D0,{sx:{color:"#fff",fontSize:24,paddingRight:.6}}),!Xt&&"Crear Solicitud"]})})})]}),c.jsx(Z3,{sections:Ke,detailColumns:[],getDetailColumns:re,onRowClick:qe})]})]})}),c.jsx(m.Menu,{anchorEl:Qt,open:Jt,onClose:()=>rr(null),TransitionComponent:m.Fade,PaperProps:{sx:{p:1.5,width:260,borderRadius:2,boxShadow:3}},anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:c.jsxs(m.Stack,{spacing:1.5,paddingX:1.5,paddingY:1,children:[c.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:700,color:"#070C10"},children:"Filtro"}),c.jsxs(m.Box,{children:[c.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Estatus"}),c.jsx(m.RadioGroup,{value:ee,onChange:B=>Oe(B.target.value),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos","Sin Asignar","En prospección","Proceso de Compra","En espera de Unidad","Auto Facturado","Rechazadas","Finalizadas sin Venta","Finalizadas con Venta","En Proceso"].map(B=>c.jsx(m.FormControlLabel,{value:B,control:c.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:B},B))})]}),c.jsxs(m.Box,{children:[c.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Actividades"}),c.jsx(m.RadioGroup,{value:Ae,onChange:(B,Q)=>$e(Q),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...ur].map(B=>c.jsx(m.FormControlLabel,{value:B,sx:{alignItems:"start"},control:c.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:B},B))})]}),c.jsxs(m.Box,{children:[c.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Nivel de interés"}),c.jsx(m.RadioGroup,{value:qt,onChange:(B,Q)=>nr(Q),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...cr].map(B=>c.jsx(m.FormControlLabel,{value:B,control:c.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:B},B))})]})]})})]})]})})}const k0={tableClientes:"_tableClientes_acwe7_1",tableResponsive:"_tableResponsive_acwe7_1"};function T0(e,r,t){const{fields:n,order:o=["nombreCliente","email","acciones"],header:a={},cells:s={},hide:i={},actions:l}=r,d=l??{},u=d.show??{},f=d.handlers??{},h=d.accessors??{},g=d.icons??{},v=d.className??"d-flex flex-row gap-2 align-items-center ",p=d.tooltip??{},y=g.view??c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",style:{fill:"#070c10"},children:[c.jsx("path",{d:"M18.6,6.3c-3.9-3-9.3-3-13.2,0-1.9,1.5-3.2,3.5-3.9,5.7.7,2.3,2,4.3,3.9,5.7,1.9,1.5,4.2,2.3,6.6,2.3,2.4,0,4.7-.8,6.6-2.3,1.9-1.5,3.2-3.5,3.9-5.7-.7-2.3-2-4.3-3.9-5.7ZM17.2,12.1c0,2.9-2.5,5.3-5.4,5.2-2.9,0-5.3-2.5-5.2-5.4,0-2.9,2.5-5.3,5.4-5.2,2.9,0,5.3,2.4,5.2,5.3,0,0,0,0,0,0Z"}),c.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),_={nombreCliente:{key:"nombreCliente",header:a.nombreCliente??"Cliente",accessor:I=>I[n.nombreCliente],cell:s.nombreCliente,width:190},email:{key:"email",header:a.email??"Correo",accessor:I=>I[n.email],cell:s.email??(I=>{const Y=String(I[n.email]??"");return Y?c.jsx("a",{href:`mailto:${Y}`,children:Y}):c.jsx("span",{className:"text-muted",children:"—"})}),width:230},acciones:i.acciones?void 0:{key:"acciones",header:"",cell:s.acciones??(I=>{const Y=mc(u.whatsapp,I,!0),V=mc(u.email,I,!0),W=mc(u.view,I,!0),Z=h.phone?.(I),J=h.email?.(I),H=ce=>{if(ce.stopPropagation(),f.onWhatsApp)return f.onWhatsApp(I);if(!Z)return;const $=h.countryCode??"52",X=P3(String(Z));typeof window<"u"&&window.open(`https://wa.me/${$}${X}`,"_blank")},z=ce=>{if(ce.stopPropagation(),f.onEmail)return f.onEmail(I);J&&typeof window<"u"&&(window.location.href=`mailto:${J}`)},ae=ce=>{ce.stopPropagation(),f.onView&&f.onView(I)};return c.jsxs("div",{className:v,children:[Y&&c.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.whatsapp??"WhatsApp",onClick:H,style:{width:24,height:24},children:c.jsx("img",{src:M3,alt:"WhatsApp"})}),V&&c.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.email??"Email",onClick:z,style:{width:24,height:24},children:c.jsx("img",{src:I3,alt:"Email"})}),W&&c.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.view??"Ver detalle",onClick:ae,style:{width:24,height:24},children:y})]})}),width:120}},S=Object.values(_).filter(I=>!!I),C=(e??[]).filter(I=>!!I?.key),E=new Map;for(const I of S)E.set(String(I.key),I);for(const I of C)E.set(String(I.key),I);const w=[...S.map(I=>String(I.key)),...C.map(I=>String(I.key))],N=Array.from(new Set(o.map(I=>String(I)).filter(I=>E.has(I)))),D=w.filter(I=>!N.includes(I)),k=[...N,...D],O="acciones";if(E.has(O)){const I=k.filter(Y=>Y!==O);k.splice(0,k.length,...I,O)}return k.map(I=>E.get(I))}function x5(e){const{rows:r,columns:t,clientSort:n=!0,urlsQA:o=!0,defaultSort:a,minWidth:s=1100,rowKey:i=j3,haveOpenDetailFor:l=!0,defaults:d,detailConfig:u,normalTable:f,onRowClick:h,activityHistory:g,advisorHistory:v,forceOpenDetailFor:p,closeDetailFor:y,onRequestEdit:_,searchFilter:S,solicitudesNuevos:C,solicitudesPrueba:E,solicitudesServicio:w,solicitudesSeminuevos:N,onCreateSolicitud:D,isCrmMode:k,onSolicitudBaseUrl:O,onIframeClose:I,reloadInfo:Y,idAdminSistemas:V=!1}=e,[W,Z]=b.useState(a??null),[J,H]=b.useState({open:!1,customer:null}),[z,ae]=b.useState([]),ce=ne=>{H({open:!0,customer:ne})},$=ne=>{l&&(h?.(ne),H({open:!0,customer:ne}))},X=()=>{H({open:!1,customer:null}),y?.()},we=b.useMemo(()=>d?T0(t??[],d):T0(t??[],{fields:{},order:[]}),[t,d]),_e=b.useMemo(()=>{if(!n||!W)return r;const ne=we.find(ie=>ie.key===W.key);if(!ne)return r;const se=[...r];return se.sort((ie,pe)=>{const Ce=hc(ne,ie,0),de=hc(ne,pe,0),Ne=O3(Ce,de);return W.direction==="asc"?Ne:-Ne}),se},[r,we,W,n]),Se=b.useMemo(()=>{const ne=u?.getCustomerId;return se=>{const ie=ne?.(se)??se?.Id_cliente??se?.CliID??se?.id??se?.ID??se?.Id??"";return String(ie)}},[u]);return b.useEffect(()=>{if(!J.open||!J.customer)return;const ne=Se(J.customer);if(!ne)return;const se=(r??[]).find(ie=>Se(ie)===ne);se&&se!==J.customer&&H(ie=>({...ie,customer:se}))},[r,J.open,J.customer,Se]),b.useEffect(()=>{p&&ce(p)},[p]),c.jsxs("div",{children:[c.jsx("div",{className:`${k0.tableClientes} back-white rounded-3 shadow-main mt-4 mb-4`,children:c.jsx("div",{className:`${k0.tableResponsive} table-responsive`,children:c.jsxs("table",{className:"table table-hover align-middle mb-0",children:[c.jsx("thead",{children:c.jsx("tr",{children:we.map(ne=>c.jsx("th",{style:{fontWeight:600,width:ne.width,paddingTop:"20px",paddingBottom:"20px",textAlign:ne.align??"left"},children:ne.header},ne.key))})}),c.jsx("tbody",{children:_e.map((ne,se)=>c.jsx("tr",{onClick:()=>$?.(ne),role:"button",tabIndex:0,onKeyDown:ie=>{(ie.key==="Enter"||ie.key===" ")&&$?.(ne)},style:{cursor:"pointer"},children:we.map((ie,pe)=>{const Ce=ie.Component?c.jsx(ie.Component,{row:ne,index:se}):ie.cell?ie.cell(ne,se):(()=>{const de=hc(ie,ne,se);return de==null||de===""?"":String(de)})();return c.jsx("td",{style:{paddingTop:"20px",paddingBottom:"20px",textAlign:ie.align??"left"},children:Ce},`${String(ie.key)}-${pe}`)})},i(ne,se)))})]})})}),J.open&&c.jsx(b5,{open:J.open,onClose:X,customer:J.customer,fields:u?.dynamicFields,header:u?.header,normalTable:f,history:g,advisorHistory:v,urlsQA:o,onRequestEdit:ne=>{X(),_?.(ne)},searchFilter:S,solicitudesNuevos:C,solicitudesPrueba:E,solicitudesServicio:w,solicitudesSeminuevos:N,onCreateSolicitud:D,isCrmMode:k,onSolicitudBaseUrl:O,onIframeClose:I,reloadInfo:Y,idAdminSistemas:V})]})}const M0=M.forwardRef(({sx:e,...r},t)=>c.jsx(m.InputBase,{inputRef:t,...r,sx:{height:48,px:1.5,width:"100%",maxWidth:"none",bgcolor:"#EBEEF0",borderRadius:2,border:"1px solid transparent","&:hover":{borderColor:"transparent"},"& .MuiInputBase-input::placeholder":{opacity:.7},...e}}));M0.displayName="SoftInput";function w5({message:e}){return e?c.jsxs(m.Box,{role:"alert",sx:{mt:1,display:"flex",alignItems:"center",gap:1,bgcolor:"#fdeaea",border:"1px solid rgb(253, 237, 237)",color:"#842029",borderRadius:1,px:2,py:1.25},children:[c.jsx(fc,{fontSize:"small",sx:{color:"rgb(211, 47, 47)"}}),c.jsx("span",{style:{color:"rgb(95, 33, 32)",fontSize:14,fontWeight:"500"},children:e})]}):null}function _5(e){if(e.required)return e.required===!0?"El campo es obligatorio.":e.required}function yc(e,r){const t=_5(e);return t?r?.isArray?{required:t,validate:n=>Array.isArray(n)&&n.length>0||t}:{required:t,validate:n=>n!==""&&n!==null&&n!==void 0||t}:{}}const I0={"& .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline":{borderColor:"transparent"},"& .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline":{borderColor:"transparent"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"transparent"},"& .MuiOutlinedInput-root.Mui-error .MuiOutlinedInput-notchedOutline":{borderColor:"transparent"},width:"100%"},S5={mb:1,fontWeight:600,color:"#1C1C1D","&.Mui-focused":{color:"#1C1C1D !important"},"&.Mui-error":{color:"#1C1C1D !important"}};function bc({label:e,errorMsg:r,helperText:t,children:n,sx:o}){return c.jsxs(m.FormControl,{fullWidth:!0,error:!!r,sx:o,className:"1- FieldWrapper",children:[c.jsx(m.FormLabel,{sx:S5,children:e}),n,c.jsx(w5,{message:r||t})]})}function C5(e,r){const{register:t,formState:{errors:n}}=r,o={...yc(e)};e.minLength&&(o.minLength={value:e.minLength,message:`El campo espera minimo ${e.minLength} caracteres`}),e.maxLength&&(o.maxLength={value:e.maxLength,message:`El campo espera maximo ${e.maxLength} caracteres`}),e.pattern&&(o.pattern={value:e.pattern,message:"Formato inválido"});const a=e.type==="email";a&&!o.pattern&&(o.pattern={value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:"Correo electrónico inválido"});const s=/[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]/g,i=/[0-9]/g,l=new Set(["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Home","End","Escape","Enter"]),d=E=>e.onlyNumbers?(E.match(i)??[]).join(""):e.onlyLetters?(E.match(s)??[]).join(""):E,u=(E,w)=>l.has(E)||w?!0:e.onlyNumbers?/^[0-9]$/.test(E):e.onlyLetters?/^[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]$/.test(E):!0,f=n[e.name]?.message,h=t(e.name,o),g=(e.inputProps&&typeof e.inputProps.maxLength=="number"?e.inputProps.maxLength:void 0)??e.maxLength,v=E=>{u(E.key,E.ctrlKey||E.metaKey)||E.preventDefault()},p=E=>{const w=E.data??null;w!=null&&(e.onlyNumbers&&/[^0-9]/.test(w)&&E.preventDefault(),e.onlyLetters&&/[^A-Za-zÁÉÍÓÚÜÑáéíóúüñ ]/.test(w)&&E.preventDefault())},y=E=>{const w=E.clipboardData.getData("text"),N=d(w);if(N!==w){E.preventDefault();const D=E.target,k=D.selectionStart??D.value.length,O=D.selectionEnd??D.value.length;D.setRangeText(N,k,O,"end"),D.dispatchEvent(new Event("input",{bubbles:!0}))}},_=E=>{const w=d(E.target.value);w!==E.target.value&&(E.target.value=w),g&&E.target.value.length>g&&(E.target.value=E.target.value.slice(0,g)),h.onChange(E)},S={...e.inputProps,...a?{inputMode:"email",autoComplete:"email"}:{},maxLength:g,onKeyDown:v,onBeforeInput:p,onPaste:y,onInvalid:E=>E.preventDefault()},C=e.onlyNumbers||a?"text":e.type??"text";return c.jsx(bc,{label:e.label,errorMsg:f,helperText:e.helperText,sx:I0,children:c.jsx(M0,{placeholder:e.placeholder,type:C,inputProps:S,...h,onChange:_,sx:{width:"100%",maxWidth:"none"},className:"SoftInputData"})})}function E5(e,r){const{control:t}=r,n=!!e.multiple;return c.jsx(Or,{name:e.name,control:t,rules:yc(e,{isArray:n}),render:({field:o,fieldState:a})=>c.jsx(bc,{label:e.label,errorMsg:a.error?.message,helperText:e.helperText,sx:I0,children:c.jsxs(m.Select,{...o,multiple:n,displayEmpty:!0,sx:{height:48,backgroundColor:"#EBEEF0","& .MuiSelect-select":{display:"flex",alignItems:"center",py:0}},className:"2-SoftInputData",children:[!n&&c.jsx(m.MenuItem,{value:"",disabled:!0,children:"Selecciona…"}),e.options.map(s=>c.jsx(m.MenuItem,{value:s.value,children:s.label},String(s.value)))]})})})}function D5(e,r){return c.jsx(Or,{name:e.name,control:r.control,rules:yc(e),render:({field:t,fieldState:n})=>c.jsx(bc,{label:e.label,errorMsg:n.error?.message,helperText:e.helperText,children:c.jsx(m.RadioGroup,{row:!0,...t,className:"3-RadioFieldRender",children:e.options.map(o=>c.jsx(m.FormControlLabel,{value:o.value,control:c.jsx(m.Radio,{}),label:o.label},String(o.value)))})})})}function O0(e,r){if(e.render)return e.render(r);switch(e.kind){case"text":return C5(e,r);case"select":return E5(e,r);case"radio":return D5(e,r);default:return null}}function A5(e,{initialPerPage:r=25,perPageOptions:t=[10,25,50,100,"Todos"],onPageChange:n,onPerPageChange:o,scrollTop:a,deps:s=[]}={}){const i=Array.isArray(e)?e:[],[l,d]=b.useState(1),[u,f]=b.useState(r),{currentItems:h,totalPages:g,showingFrom:v,showingTo:p,totalItems:y}=b.useMemo(()=>{const C=i.length,E=u==="Todos"?1/0:Number(u),w=E===1/0?1:Math.max(1,Math.ceil(C/E)),N=Math.min(l,w),D=E===1/0?C:N*E,k=E===1/0?0:D-E;return{currentItems:E===1/0?i:i.slice(k,D),totalPages:w,showingFrom:C===0?0:k+1,showingTo:E===1/0?C:Math.min(D,C),totalItems:C}},[i,l,u]),_=C=>{const E=Math.max(1,Math.min(C,g||1));d(E),n?.(E),a?.()};return{currentItems:h,totalPages:g,showingFrom:v,showingTo:p,totalItems:y,currentPage:l,itemsPerPage:u,perPageOptions:t,goTo:_,next:()=>_(l+1),prev:()=>_(l-1),setItemsPerPage:C=>{f(C),o?.(C),d(1),a?.()},setCurrentPage:_}}var ya={},P0;function k5(){if(P0)return ya;P0=1;var e=lt();Object.defineProperty(ya,"__esModule",{value:!0}),ya.default=void 0;var r=e(ht()),t=dt();return ya.default=(0,r.default)((0,t.jsx)("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"NavigateBefore"),ya}var T5=k5();const M5=it(T5);var ba={},j0;function I5(){if(j0)return ba;j0=1;var e=lt();Object.defineProperty(ba,"__esModule",{value:!0}),ba.default=void 0;var r=e(ht()),t=dt();return ba.default=(0,r.default)((0,t.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"NavigateNext"),ba}var O5=I5();const P5=it(O5),j5=({currentPage:e,totalPages:r,onPageChange:t,itemsPerPage:n,onItemsPerPageChange:o,itemsPerPageOptions:a,showingFrom:s,showingTo:i,totalItems:l})=>{const d=m.useTheme(),u=m.useMediaQuery(d.breakpoints.down("sm")),f=()=>{if(r<=1)return[1];const v=u?0:2,p=[],y=1,_=r,S=Math.max(y+1,e-v),C=Math.min(_-1,e+v);p.push(y),S>y+1&&p.push("...");for(let E=S;E<=C;E++)E>=y+1&&E<=_-1&&p.push(E);return C<_-1&&p.push("..."),p.push(_),p},h=v=>{const p=v.target.value;o(p)},g=Math.max(1,r);return c.jsxs(m.Box,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},alignItems:"center",justifyContent:{xs:"center",sm:"space-between"},gap:2,my:0,py:2,borderTop:"#D3D4D5 1px solid",px:3},children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"center"},children:[c.jsx(m.IconButton,{onClick:()=>t(e-1),disabled:e<=1,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página anterior",children:c.jsx(M5,{fontSize:"large"})}),f().map((v,p)=>v==="..."?c.jsx(m.Box,{sx:{px:1,display:"flex",alignItems:"center",fontSize:"1.1rem"},children:". . ."},`dots-${p}`):c.jsx(m.Button,{onClick:()=>t(v),size:"small",sx:{minWidth:36,height:36,fontSize:"1.05rem",p:1,borderRadius:"10px",backgroundColor:e===v?"primary.main":"transparent",fontWeight:e===v?700:400,color:e===v?"#fff":"#5C6372","&:hover":{backgroundColor:e===v?"primary.dark":"action.hover"},boxShadow:"none",border:"none",mx:.5},children:v},`p-${v}`)),c.jsx(m.IconButton,{onClick:()=>t(e+1),disabled:e>=g,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página siguiente",children:c.jsx(P5,{fontSize:"large"})})]}),c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1.25,justifyContent:{xs:"center",sm:"flex-start"},mt:{xs:1,sm:0}},children:[c.jsx(m.Typography,{variant:"body2",children:"Mostrar"}),c.jsx(m.FormControl,{size:"small",sx:{minWidth:72},children:c.jsx(m.Select,{value:n,onChange:h,renderValue:v=>v==="Todos"?"Todos":String(v),children:a.map(v=>c.jsx(m.MenuItem,{value:v,children:v==="Todos"?"Todos":v},String(v)))})}),c.jsx(m.Typography,{variant:"body2",children:"por página"})]})]})};function R5(e){const{open:r,dataAdd:t,fields:n,onSubmit:o,onCancel:a,defaultValues:s,txtBtnGuardar:i,haveId:l=!1,itemsTable:d,filter:u,getId:f,renderRow:h,selectedIds:g,onSelectedChange:v,onSubmitAddData:p,initialSelectedIds:y=[],showAutosPanel:_}=e,S=Yh({mode:"onSubmit",reValidateMode:"onChange",criteriaMode:"all",shouldUnregister:!1,defaultValues:s});b.useEffect(()=>{s&&S.reset(s)},[s,S]);const[C,E]=b.useState(""),[w,N]=b.useState(y),D=Array.isArray(g)&&!!v,k=D?g:w,O=P=>{const K=typeof P=="function"?P(k):P;D?v(K):N(K)},I=b.useCallback(P=>f?f(P):P?.IdAuto,[f]),Y=b.useMemo(()=>{const P=new Map;return(d??[]).forEach((K,ve)=>P.set(I(K),ve)),P},[d,I]),V=b.useRef(new Set),W=b.useMemo(()=>{const P=new Map;return(d??[]).forEach(K=>P.set(f?f(K):K?.IdAuto,K)),P},[d,f]),Z=b.useMemo(()=>(n??[]).filter(P=>!!P.required).map(P=>P.name),[n]),J=kh({control:S.control,name:Z}),H=P=>P==null?!1:typeof P=="string"?P.trim().length>0:Array.isArray(P)?P.length>0:typeof P=="number"?!Number.isNaN(P):typeof P=="object"?Object.keys(P).length>0:!0,z=b.useMemo(()=>Z.length?J?.every(H)??!1:!0,[J,Z]),{handleSubmit:ae,formState:{isSubmitting:ce,isDirty:$,isValid:X}}=S,we=u??((P,K)=>JSON.stringify(P).toLowerCase().includes(K.toLowerCase())),_e=b.useMemo(()=>C.trim()?d?.filter(P=>we(P,C)):d,[d,C,we]),Se=b.useMemo(()=>{if(!_e)return _e;const P=V.current,K=[..._e];return K.sort((ve,ke)=>{const L=P.has(I(ve))?0:1,te=P.has(I(ke))?0:1;if(L!==te)return L-te;const ye=Y.get(I(ve))??0,Ze=Y.get(I(ke))??0;return ye-Ze}),K},[_e,Y,I]),{currentItems:ne,totalPages:se,showingFrom:ie,showingTo:pe,totalItems:Ce,currentPage:de,itemsPerPage:Ne,perPageOptions:R,goTo:We,setItemsPerPage:st}=A5(Se,{initialPerPage:25,perPageOptions:[10,25,50,100,"Todos"],deps:[C],scrollTop:()=>{}}),Le=P=>{const K=W.get(P)??null;O([P]),p?.({items:K})},Fe=P=>k.includes(P),Me=async P=>{try{await o?.(P),S.reset(S.getValues())}catch(K){console.error("Error al enviar AddCliente:",K)}},Ee=b.useMemo(()=>{const P=new Map;return(n??[]).forEach(K=>P.set(String(K.name),K)),P},[n]),Xe=(P,K)=>{const ve=Ee.get(String(P));if(!ve)return null;const ke={xs:12,...ve.grid,...K||{}};return c.jsx(m.Grid,{item:!0,...ke,children:ve.render?ve.render(S):O0(ve,S)},`fld-${String(P)}`)},A=_??(e.haveId?"edit":"new"),j=A!=="onlyCars",U=A==="new"||A==="onlyCars",le=k?.length>0,oe=A==="onlyCars"?le:e.haveId?z&&$||le:z&&le;return c.jsx(m.Dialog,{open:r,onClose:a,maxWidth:"lg",fullWidth:!0,PaperProps:{sx:{height:{xs:"100dvh",md:U?"90vw":"auto"},maxWidth:{xs:"100vw",md:U?"98vw":"50%"},overflow:"hidden",display:"flex",flexDirection:"column",borderRadius:{xs:0,md:3}}},children:c.jsx(JA,{...S,children:c.jsxs(m.Box,{component:"form",noValidate:!0,onSubmit:ae(Me),display:"flex",flexDirection:{xs:"column",md:"row"},width:"100%",height:"100%",minHeight:0,overflow:"hidden",position:"relative",children:[j&&c.jsxs(m.Box,{sx:{width:{xs:"100%",md:l?"100%":394},maxWidth:{xs:"100%",md:l?"100%":394},boxShadow:{xs:"none",md:l?"none":"2px 0px 8px #40404024"},borderRight:{xs:"none",md:l?"none":"1px solid #EBEEF0"},bgcolor:"background.paper",paddingBottom:3,mx:{xs:0,md:l?"auto":0},position:"relative"},children:[c.jsxs(m.Box,{p:{xs:2,md:2},height:"100%",width:"100%",children:[c.jsx(m.Typography,{fontWeight:700,fontSize:20,children:t.title}),c.jsxs(m.Box,{sx:{flex:1,height:"100%",overflowY:"auto",paddingBottom:10},children:[c.jsx(m.Typography,{fontSize:"18px",mt:2.5,fontWeight:500,children:t.subTitle}),c.jsx(m.Box,{mt:2,display:"flex",flexDirection:"column",width:"100%",gap:2,children:Array.isArray(e.formLayout)&&l?e.formLayout.map((P,K)=>c.jsx(m.Grid,{container:!0,spacing:2,alignItems:"flex-start",wrap:"wrap",width:"100%",children:P.map((ve,ke)=>{const L=typeof ve=="string"?{name:ve}:ve;return L.hidden?.(S)?null:Xe(L.name,L.grid)})},`row-${K}`)):c.jsx(m.Grid,{container:!0,spacing:2,width:"100%",children:n?.map((P,K)=>{const ve=P.grid??{xs:12,md:12};return c.jsx(m.Grid,{item:!0,...ve,children:P.render?P.render(S):O0(P,S)},`${String(P.name)}-${K}`)})})})]})]}),c.jsx(m.Box,{sx:{position:"absolute",zIndex:P=>P.zIndex.modal+1,bottom:0,width:"100%",borderRadius:2,boxShadow:{xs:"0",md:"0 -8px 8px -6px #0003"},p:1,backgroundColor:"#fff"},children:c.jsx(m.Box,{display:"flex",alignItems:"center",children:c.jsx(m.Box,{display:"flex",gap:1.5,width:"100%",justifyContent:l?"flex-end":"center",children:c.jsx(m.Button,{type:"submit",variant:"contained",disabled:ce||!oe,sx:{backgroundColor:"#336BE1",color:"#fff",borderColor:"transparent",height:48,fontSize:15,textTransform:"none",fontWeight:"400",paddingX:5,width:l?"160px":"100%"},children:i})})})})]}),U&&c.jsx(m.Box,{flex:1,display:"flex",flexDirection:"column",minWidth:0,sx:{height:"100%"},children:c.jsx(m.Box,{mt:1,sx:{flex:1,display:"flex",flexDirection:"column",height:"100%"},children:c.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[c.jsxs(m.Box,{p:3,sx:{borderBottom:1,borderBottomColor:"#D3D4D5",position:"sticky",top:0,zIndex:1,bgcolor:"#fff",flexDirection:{sm:"row",xs:"column"}},display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingTop:4,children:[c.jsx(m.TextField,{value:C,onChange:P=>E(P.target.value),placeholder:"Buscar marca, modelo, vin...",InputProps:{endAdornment:c.jsx(m.InputAdornment,{position:"start",children:c.jsx(ib,{})}),disableUnderline:!0},variant:"standard",sx:{maxWidth:360,width:"100%",backgroundColor:"#EBEEF0",paddingX:"16px",paddingY:"10px"}}),c.jsx(m.Box,{display:"flex",gap:2,alignItems:"center",sx:{marginTop:{sm:0,xs:2}},children:c.jsx(m.Box,{onClick:a,sx:{cursor:"pointer",position:"absolute",top:0,right:10},display:{xs:"none",md:"block"},children:c.jsx(Tr,{sx:{color:"#070C10",fontSize:24}})})}),_=="onlyCars"&&c.jsx(m.Box,{display:"flex",alignItems:"center",justifyContent:"center",children:c.jsx(m.Box,{display:"flex",gap:1.5,width:"100%",children:c.jsxs(m.Button,{type:"submit",variant:"contained",disabled:ce||!oe,sx:{backgroundColor:"#336BE1",color:"#fff",borderColor:"transparent",height:48,fontSize:15,textTransform:"none",fontWeight:"400",paddingX:5,width:"100%"},children:[c.jsx(D0,{sx:{color:ce||!oe?"gray":"#fff",fontSize:26,paddingRight:.6}}),"Crear Solicitud"]})})})]}),c.jsx(m.Box,{sx:{flex:1,minHeight:0,overflowY:"auto",overflowX:"auto",padding:0,height:"100%","&::-webkit-scrollbar:horizontal":{display:"none"},"&::-webkit-scrollbar:vertical":{width:8}},children:c.jsx(m.Box,{sx:{minWidth:1150,width:"max(1150px, 100%)",paddingBottom:10},children:c.jsxs(m.List,{disablePadding:!0,sx:{borderColor:"transparent",padding:0},children:[ne?.map((P,K)=>{const ve=f?f(P):K,ke=Fe(ve);return c.jsx(m.Box,{sx:{borderBottom:"1px solid #D3D4D5",padding:0},children:c.jsx(m.ListItem,{disableGutters:!0,sx:{paddingTop:0,padding:0,m:0},children:c.jsx(m.ListItemButton,{onClick:()=>Le(ve),disableRipple:!0,sx:{padding:0},children:c.jsx(m.ListItemText,{disableTypography:!0,primary:h?h({item:P,selected:ke,toggle:()=>Le(ve),index:K}):null})})})},`${String(ve)}`)}),!ne?.length&&c.jsx(m.Box,{p:3,children:c.jsxs(m.Typography,{fontSize:14,color:"#5C6372",children:["Sin resultados para “",C,"”."]})})]})})}),c.jsx(m.Box,{sx:{position:"sticky",bottom:0,bgcolor:"#fff"},children:c.jsx(j5,{currentPage:de,totalPages:se,onPageChange:We,itemsPerPage:Ne,onItemsPerPageChange:st,itemsPerPageOptions:R,showingFrom:ie,showingTo:pe,totalItems:Ce})})]})})})]})})})}var xa={},R0;function N5(){if(R0)return xa;R0=1;var e=lt();Object.defineProperty(xa,"__esModule",{value:!0}),xa.default=void 0;var r=e(ht()),t=dt();return xa.default=(0,r.default)((0,t.jsx)("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6z"}),"AttachFile"),xa}var L5=N5();const $5=it(L5),xc=/^[^\s@]+@[^\s@]+\.[^\s@]+$/i,li=/[,\s;]+/g,vn=e=>e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase(),yn=(e,r)=>Array.from(new Set([...e,...r.map(t=>t.trim()).filter(Boolean)])),N0=(e,r)=>r?e.filter(t=>vn(t)!==vn(r)):e,z5=(e,r)=>e.filter(t=>!r.some(n=>vn(n)===vn(t)));function jr(e,r,t){if(t)return typeof t=="function"?t(e,r):e[t]}function B5(e,r){if(r)return!e||/^https?:\/\//i.test(r)?r:e+r}function F5({open:e,onClose:r,value:t,onChange:n,onRequestSend:o,customer:a,itemsSelects:s,renderItem:i,filterFields:l=[],multiSelectAutos:d=!0,imgCorreoSrc:u,baseURLImages:f,itemProps:h,defaultItemImageSrc:g}){const v=b.useRef(null),[p,y]=b.useState("idle"),_=b.useRef(e);b.useEffect(()=>{const L=_.current;e&&!L&&y("entering"),!e&&L&&y("exiting"),_.current=e},[e]),b.useEffect(()=>{if(p==="entering"){const ye=setTimeout(()=>y("idle"),320);return()=>clearTimeout(ye)}if(p==="exiting"){const ye=setTimeout(()=>y("idle"),220);return()=>clearTimeout(ye)}},[p]);const[S,C]=b.useState(""),[E,w]=b.useState(!1),[N,D]=b.useState(!1),[k,O]=b.useState(!1),[I,Y]=b.useState(""),[V,W]=b.useState([]),Z=k?V:t.selectedIds,J=()=>{W([...t.selectedIds]),Y(""),O(!0)},H=()=>{O(!1),W([])},z=()=>{const L=new Set(Ee.map((ye,Ze)=>String(jr(ye,Ze,h.id)))),te=V.filter(ye=>L.has(String(ye)));n({...t,selectedIds:te}),O(!1)},ae=(L,te)=>vn(L??"")===vn(te??"");function ce(L,te,ye,Ze,mt){const Ct=te?L.some(rr=>ae(rr,te)):!1,Qt=ye.length>0?ye.some(rr=>L.some(Jt=>ae(Jt,rr))):!1;Ze(Ct),mt(Qt)}const $=L=>{const te=typeof L=="function"?L(t.recipients):L;n({...t,recipients:te}),ce(te,ne,ie,w,D)},X=L=>n({...t,message:L}),we=L=>n({...t,attachments:[...t.attachments,...L]}),_e=L=>n({...t,attachments:t.attachments.filter(te=>te.name!==L)}),Se=L=>{if(k)if(d){const te=new Set(V);te.has(L)?te.delete(L):te.add(L),W(Array.from(te))}else{const te=V.includes(L);W(te?[]:[L])}else if(d){const te=new Set(t.selectedIds);te.has(L)?te.delete(L):te.add(L),n({...t,selectedIds:Array.from(te)})}else{const te=t.selectedIds.includes(L);n({...t,selectedIds:te?[]:[L]})}},ne=b.useMemo(()=>(a?.Correo??"").trim(),[a]),se=b.useMemo(()=>Array.isArray(a?.Asesores)?a.Asesores.filter(L=>L?.EmailAsesor&&L?.Activo):[],[a]),ie=b.useMemo(()=>se.map(L=>(L.EmailAsesor??"").trim()).filter(Boolean),[se]),pe=b.useRef(!1);b.useEffect(()=>{if(e&&!pe.current){let L=[];E&&ne&&(L=yn(L,[ne])),N&&ie.length&&(L=yn(L,ie)),$(te=>yn(te,L)),ce(t.recipients,ne,ie,w,D),C(""),pe.current=!0}e||(pe.current=!1)},[e,E,N,ne,ie]);const Ce=L=>{const te=se.find(ye=>vn(ye.EmailAsesor??"")===vn(L));if(te){if(te.ImgAsesor)return c.jsx(m.Avatar,{src:te.ImgAsesor,alt:te.NombreAsesor});const ye=(te.NombreAsesor||"").trim(),Ze=(te.ApellidosAsesor||"").trim();return c.jsx(m.Avatar,{children:`${ye[0]??""}${Ze[0]??""}`.toUpperCase()})}return c.jsx(m.Avatar,{children:L[0]?.toUpperCase()})},de=()=>{const L=S.trim();if(!L)return;const ye=L.split(li).filter(Boolean).filter(Ze=>xc.test(Ze));ye.length>0&&$(Ze=>yn(Ze,ye)),C("")},Ne=L=>{w(L),$(te=>L&&ne?yn(te,[ne]):N0(te,ne))},R=L=>{D(L),$(te=>L?yn(te,ie):z5(te,ie))},We=L=>{const te=Array.from(L.target.files||[]);we(te.map(ye=>({name:ye.name,size:ye.size,file:ye}))),L.target.value=""},st=Z[0],Le=b.useMemo(()=>!s||st===void 0?void 0:s.find((te,ye)=>String(jr(te,ye,h.id))===String(st)),[s,st,h.id]),Fe=b.useMemo(()=>{if(!(!Le||!h.distributorId))return jr(Le,0,h.distributorId)},[Le,h.distributorId]);console.log("lockedDisId",Fe);const Me=b.useMemo(()=>Le?(h.distributorTitle?jr(Le,0,h.distributorTitle):void 0)??(Fe!=null?String(Fe):void 0):void 0,[Le,h.distributorTitle,Fe]),Ee=b.useMemo(()=>{const L=s??[];return Fe==null||!h.distributorId?L:L.filter((te,ye)=>jr(te,ye,h.distributorId)==Fe)},[s,Fe,h.distributorId]),Xe=b.useMemo(()=>{if(!I.trim())return Ee;const L=I.toLowerCase();return Ee.filter(te=>(l??[]).some(ye=>String(te?.[ye]??"").toLowerCase().includes(L)))},[Ee,I,l]),A=b.useMemo(()=>{if(!s||!t.selectedIds.length)return[];const L=new Map;return s.forEach((te,ye)=>{L.set(String(jr(te,ye,h.id)),te)}),t.selectedIds.map(te=>L.get(String(te))).filter(Boolean)},[s,t.selectedIds,h.id]),j=L=>n({...t,selectedIds:t.selectedIds.filter(te=>String(te)!==String(L))}),U=()=>{let L=t.recipients;if(S.trim()){const Ct=S.split(li).filter(Qt=>xc.test(Qt));L=yn(L,Ct),$(L),C("")}const te=E?ne:"",ye=se.find(Ct=>Ct?.Activo&&Ct?.EmailAsesor)?.EmailAsesor?.trim()??"";o?.({recipients:L,toClient:E,toAdvisor:N,tipoInt:E&&N?2:1,correoCliente:te,correoAsesor:N?ye:"",disIdLocked:Fe}),r?.()},le=b.useMemo(()=>{const te=S.split(li).filter(Boolean).some(ye=>xc.test(ye));return t.recipients.length>0||te},[t.recipients,S]),oe=(t.selectedIds?.length??0)>0,P=t.message.trim().length>0,K=le&&oe&&P,ve=m.useTheme(),ke=m.useMediaQuery(ve.breakpoints.down("sm"));return c.jsxs(m.Drawer,{anchor:ke?"bottom":"right",open:e,onClose:r,ModalProps:{keepMounted:!0,BackdropProps:{invisible:!ke}},transitionDuration:{enter:320,exit:220},SlideProps:{direction:ke?"up":"left",timeout:{enter:320,exit:220},easing:{enter:"cubic-bezier(0.22, 1, 0.36, 1)",exit:"cubic-bezier(0.4, 0, 1, 1)"}},PaperProps:{sx:{width:{xs:"100vw",sm:420},height:{xs:"85vh",sm:"auto"},maxHeight:{xs:"85vh",sm:"calc(100vh - 32px)"},left:{xs:0,sm:"auto"},right:{xs:0,sm:16},bottom:{xs:0,sm:16},top:{xs:"auto",sm:"auto"},borderRadius:{xs:"12px 12px 0 0",sm:2},boxShadow:6,overflow:"hidden"}},children:[c.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",height:{xs:"100%",sm:"auto"},position:"relative",overflow:"auto"},children:[c.jsxs(m.Box,{sx:{p:2,pb:1,position:"sticky",top:0,zIndex:1,bgcolor:"#fff",borderBottom:"1px solid #E5E7EB"},children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:2},children:[u?c.jsx("img",{src:u,alt:"Correo",style:{width:24,height:18}}):null,c.jsxs(m.Typography,{fontWeight:700,children:["Mensaje a"," ",a?`${a.Nombre??""} ${a.ApellidoP??""} ${a.ApellidoM??""}`.trim():"—"]})]}),c.jsx(m.IconButton,{onClick:r,size:"small",children:c.jsx(Tr,{})})]}),c.jsx("div",{children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 10px",backgroundColor:"#EBEEF0",border:"1px solid #E5E7EB",borderRadius:8,flexWrap:"wrap"},children:[c.jsx("label",{style:{fontSize:14,fontWeight:600,marginRight:4},children:"Para:"}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",flex:1},children:[t.recipients.map(L=>c.jsx(m.Chip,{avatar:Ce(L),label:L,onDelete:()=>$(te=>N0(te,L)),size:"small",variant:"outlined",sx:{borderRadius:999,height:28}},L)),c.jsx("input",{type:"text",value:S,onChange:L=>C(L.target.value),onKeyDown:L=>{const te=L.key;te==="Enter"||te===","||te===";"||te===" "||te==="Tab"?(L.preventDefault(),de()):te==="Backspace"&&!S&&t.recipients.length&&$(Ze=>Ze.slice(0,-1))},onBlur:de,onPaste:L=>{const ye=L.clipboardData.getData("text").split(li).filter(Boolean);ye.length>1&&(L.preventDefault(),$(Ze=>yn(Ze,ye)),C(""))},placeholder:t.recipients.length?"":"correo@ejemplo.com",style:{flex:1,minWidth:140,border:"none",outline:"none",background:"transparent",fontSize:14,color:"#111827",padding:"4px 0"}})]})]})}),c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:2,mb:1.5},children:[c.jsx(m.FormControlLabel,{control:c.jsx(m.Checkbox,{checked:E,onChange:L=>Ne(L.target.checked),size:"small"}),label:"Cliente"}),se.length!==0&&c.jsx(m.FormControlLabel,{control:c.jsx(m.Checkbox,{checked:N,onChange:L=>R(L.target.checked),size:"small"}),label:`Asesor${se.length>1?"es":""}`})]})]}),c.jsx(m.Divider,{}),c.jsxs(m.Box,{p:2,children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},onClick:J,children:[c.jsx(m.Typography,{fontSize:12,fontWeight:600,sx:{textDecorationLine:"underline",cursor:"pointer"},children:"Selecciona el auto de seguimiento"}),Me!=null&&c.jsx(m.Chip,{size:"small",label:`Distribuidora: ${Me}`})]}),A.length>0?c.jsx(m.Box,{sx:{mt:1.5,display:"flex",gap:1,flexWrap:"wrap"},children:A.map((L,te)=>{const ye=jr(L,te,h.id),Ze=jr(L,te,h.title)??"",mt=jr(L,te,h.image),Ct=B5(f,mt);return c.jsx(m.Chip,{onDelete:()=>j(ye),label:c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[c.jsx(m.Box,{sx:{width:28,height:20,borderRadius:.8,bgcolor:"#e5e6e8",overflow:"hidden",flex:"0 0 auto"},children:Ct?c.jsx("img",{src:Ct,alt:Ze,style:{width:"100%",height:"100%",objectFit:"cover"}}):c.jsx("img",{src:g,alt:Ze,style:{width:"100%",height:"100%",objectFit:"cover"}})}),c.jsx("span",{style:{fontSize:12},children:c.jsx("b",{children:Ze})})]}),sx:{pl:.5,pr:.3,py:.2,borderRadius:2,".MuiChip-deleteIcon":{fontSize:18}},variant:"outlined"},String(ye))})}):c.jsx(m.Typography,{fontSize:13,color:"#5C6372",sx:{mt:.5},children:"Aún no has seleccionado autos."})]}),c.jsx(m.Divider,{}),c.jsxs(m.Box,{sx:{p:2},children:[c.jsx(m.TextField,{placeholder:"Escribe aquí tu mensaje...",value:t.message,onChange:L=>X(L.target.value),multiline:!0,minRows:6,fullWidth:!0,sx:{mb:1.5}}),t.attachments.length>0&&c.jsx(m.List,{dense:!0,sx:{display:"flex",flexDirection:"column",gap:2,border:"none"},children:t.attachments.map(L=>c.jsxs(m.ListItem,{sx:{px:0,background:"#EAEBF2",borderRadius:2,paddingX:1},children:[c.jsx(m.ListItemText,{style:{gap:10,fontSize:15,color:"#5285F7",display:"flex",flexWrap:"wrap",flex:"none"},primary:L.name,secondary:L.size<1024?`${L.size} b`:L.size<1024*1024?`${(L.size/1024).toFixed(0)} kb`:`${(L.size/(1024*1024)).toFixed(1)} MB`,secondaryTypographyProps:{sx:{fontSize:12,color:"#64748B",fontWeight:500,mt:.25}},primaryTypographyProps:{noWrap:!0,width:"auto"}}),c.jsx(m.Tooltip,{title:"Quitar",children:c.jsx(m.IconButton,{edge:"end",onClick:()=>_e(L.name),size:"small",children:c.jsx(Tr,{fontSize:"small"})})})]},L.name))})]}),c.jsxs(m.Box,{sx:{position:{xs:"sticky",sm:"sticky"},bottom:0,bgcolor:"#fff",borderTop:"1px solid #E5E7EB",p:2,display:"flex",alignItems:"center",gap:2},children:[c.jsx("input",{ref:v,hidden:!0,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.mp4,.pdf,.xlsx,.csv,.docx,.pptx,.txt",onChange:We}),c.jsx(m.Button,{startIcon:c.jsx($5,{}),variant:"text",onClick:()=>v.current?.click(),sx:{color:"#5C6372"},children:"Adjuntar archivo"}),c.jsx(m.Box,{sx:{flex:1}}),c.jsx(m.Button,{variant:"contained",onClick:U,disabled:!K,sx:{maxWidth:146,width:"100%",height:53,backgroundColor:"#336BE1"},children:"Enviar"})]})]}),c.jsxs(m.Dialog,{fullWidth:!0,maxWidth:"sm",fullScreen:ke,open:k,onClose:H,children:[c.jsxs(m.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:1},children:["Selecciona tu auto de seguimiento",c.jsx(m.IconButton,{onClick:H,size:"small",children:c.jsx(Tr,{})})]}),c.jsxs(m.DialogContent,{children:[c.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[c.jsx(m.TextField,{placeholder:"Buscar...",fullWidth:!0,size:"small",value:I,onChange:L=>Y(L.target.value),sx:{mb:2}}),Me!=null&&c.jsx(m.Chip,{size:"small",label:`Distribuidora: ${Me}`})]}),c.jsxs(m.Typography,{variant:"caption",fontWeight:600,children:["RESULTADOS (",Xe.length,")"]}),c.jsxs(m.List,{sx:{p:0},children:[Xe.map((L,te)=>{const ye=jr(L,te,h.id),Ze=Z.includes(String(ye))||Z.includes(ye),mt=Fe==null||jr(L,te,h.distributorId)==Fe;return c.jsx(m.ListItem,{disableGutters:!0,sx:{p:0,opacity:mt?1:.5},children:c.jsx(m.Box,{onClick:()=>mt&&Se(ye),sx:{cursor:mt?"pointer":"not-allowed",p:.5,backgroundColor:Ze?"#e5f0ff":"transparent",width:"100%",borderBottom:"solid 1px #D3D4D5"},children:i?i(L,te):c.jsx("pre",{style:{margin:0},children:JSON.stringify(L,null,2)})})},String(ye))}),Xe.length===0&&c.jsx(m.Box,{p:2,children:c.jsx(m.Typography,{children:"Tu búsqueda no generó resultados"})})]})]}),c.jsxs(m.DialogActions,{sx:{px:3,pb:2},children:[c.jsx(m.Button,{variant:"text",onClick:H,sx:{color:"#5C6372"},children:"Cancelar"}),c.jsx(m.Button,{variant:"contained",onClick:z,sx:{backgroundColor:"#336BE1"},children:"Guardar selección"})]})]})]})}Pt.AddCliente=R5,Pt.ApiProvider=sw,Pt.AuthProvider=Rb,Pt.Clientes=x5,Pt.CustomSnackbar=pc,Pt.EventsProvider=w3,Pt.ModalCorreo=F5,Pt.MyCalendar=T3,Pt.useAuth=ul,Pt.useAuthRepository=Is,Pt.useEventRepository=Ll,Object.defineProperty(Pt,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "componentes-exagono",
3
3
  "private": false,
4
- "version": "0.2.73",
4
+ "version": "0.2.74",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",