componentes-exagono 0.2.39 → 0.2.40

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
@@ -19568,9 +19568,9 @@ const T4 = {
19568
19568
  }, [Pe]), _t(() => {
19569
19569
  J("showEndDate", d);
19570
19570
  }, [d, J]), _t(() => {
19571
- if (s) {
19571
+ if (console.log("initialEvent", s), s) {
19572
19572
  const Y = yt(s.fechaInicio, "yyyy-MM-dd") === yt(s.fechaFin, "yyyy-MM-dd");
19573
- if (f(!Y), J("titulo", s?.titulo), J("fechaInicio", yt(s.fechaInicio, "yyyy-MM-dd")), J("fechaFin", yt(s.fechaFin, "yyyy-MM-dd")), J("horaInicio", yt(s.fechaInicio, "HH:mm")), J("horaFin", yt(s.fechaFin, "HH:mm")), J("horaInicio2", yt(s.fechaFin, "HH:mm")), J("descripcion", s.descripcion), J("link", s.link), J("repetir", "false"), J("color", s.color), J("todoElDia", s.todoElDia), J("solID", s.solID), J("client", s.client), console.log("initialEvent", s), s.invitados && s.invitados.length > 0) {
19573
+ if (f(!Y), J("titulo", s?.titulo), J("fechaInicio", yt(s.fechaInicio, "yyyy-MM-dd")), J("fechaFin", yt(s.fechaFin, "yyyy-MM-dd")), J("horaInicio", yt(s.fechaInicio, "HH:mm")), J("horaFin", yt(s.fechaFin, "HH:mm")), J("horaInicio2", yt(s.fechaFin, "HH:mm")), J("descripcion", s.descripcion), J("link", s.link), J("repetir", "false"), J("color", s.color), J("todoElDia", s.todoElDia), J("solID", s.solID), J("client", s.client), s.invitados && s.invitados.length > 0) {
19574
19574
  const de = (s?.invitados || []).map((je) => {
19575
19575
  const te = je.usrNombre?.trim() || "", we = te.split(/\s+/), Ie = we.length > 1 ? (we[0][0] + we[1][0]).toUpperCase() : te.substring(0, 2).toUpperCase();
19576
19576
  return {
@@ -20091,7 +20091,7 @@ const T4 = {
20091
20091
  onClick: n,
20092
20092
  variant: "outlined",
20093
20093
  startIcon: /* @__PURE__ */ u.jsx("img", { src: $0, width: 15 }),
20094
- hidden: !s?.esOrganizador,
20094
+ hidden: s ? s?.esOrganizador != !0 : !1,
20095
20095
  sx: {
20096
20096
  flex: 1,
20097
20097
  // Hace que el botón crezca para llenar el espacio
@@ -20141,7 +20141,7 @@ const T4 = {
20141
20141
  onClick: Ke,
20142
20142
  variant: "contained",
20143
20143
  disabled: !Ee,
20144
- hidden: !s?.esOrganizador,
20144
+ hidden: s ? s?.esOrganizador != !0 : !1,
20145
20145
  sx: {
20146
20146
  flex: 1,
20147
20147
  // Distribución equitativa
package/dist/index.umd.js CHANGED
@@ -174,7 +174,7 @@ const theme2 = createTheme({ palette: {
174
174
  } else {
175
175
  newResult[${_}] = ${C}.value;
176
176
  }
177
- `)}y.write("payload.value = newResult;"),y.write("return payload;");const S=y.compile();return(E,C)=>S(h,E,C)};let s;const i=Bi,a=!Pp.jitless,l=a&&Yw.value,d=t.catchall;let f;e._zod.parse=(h,y)=>{f??(f=n.value);const g=h.value;return i(g)?a&&l&&y?.async===!1&&y.jitless!==!0?(s||(s=o(t.shape)),h=s(h,y),d?Kp([],g,h,y,f,e):h):r(h,y):(h.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),h)}});function Qp(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Jn(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>An(i,n,kn())))}),t)}const NC=Z("$ZodUnion",(e,t)=>{Pt.init(e,t),vt(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),vt(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),vt(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),vt(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Hc(s.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let i=!1;const a=[];for(const c of t.options){const l=c._zod.run({value:o.value,issues:[]},s);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(c=>Qp(c,o,e,s)):Qp(a,o,e,s)}}),$C=Z("$ZodIntersection",(e,t)=>{Pt.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,l])=>Xp(r,c,l)):Xp(r,s,i)}});function Zc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Go(e)&&Go(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(const s of n){const i=Zc(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],s=t[n],i=Zc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Xp(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Jn(e))return e;const n=Zc(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const LC=Z("$ZodEnum",(e,t)=>{Pt.init(e,t);const r=Uw(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>qw.has(typeof o)).map(o=>typeof o=="string"?Xn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),zC=Z("$ZodLiteral",(e,t)=>{if(Pt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Xn(r):r?Xn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,n)=>{const o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),BC=Z("$ZodTransform",(e,t)=>{Pt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mp(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Kn;return r.value=o,r}});function Jp(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const FC=Z("$ZodOptional",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",vt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),vt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Hc(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Jp(s,r.value)):Jp(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),WC=Z("$ZodNullable",(e,t)=>{Pt.init(e,t),vt(e._zod,"optin",()=>t.innerType._zod.optin),vt(e._zod,"optout",()=>t.innerType._zod.optout),vt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Hc(r.source)}|null)$`):void 0}),vt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),UC=Z("$ZodDefault",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",vt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>eh(s,t)):eh(o,t)}});function eh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const HC=Z("$ZodPrefault",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",vt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),VC=Z("$ZodNonOptional",(e,t)=>{Pt.init(e,t),vt(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>th(s,e)):th(o,e)}});function th(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const YC=Z("$ZodCatch",(e,t)=>{Pt.init(e,t),vt(e._zod,"optin",()=>t.innerType._zod.optin),vt(e._zod,"optout",()=>t.innerType._zod.optout),vt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>An(i,n,kn()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>An(s,n,kn()))},input:r.value}),r.issues=[]),r)}}),qC=Z("$ZodPipe",(e,t)=>{Pt.init(e,t),vt(e._zod,"values",()=>t.in._zod.values),vt(e._zod,"optin",()=>t.in._zod.optin),vt(e._zod,"optout",()=>t.out._zod.optout),vt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Gi(i,t.in,n)):Gi(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Gi(s,t.out,n)):Gi(o,t.out,n)}});function Gi(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const ZC=Z("$ZodReadonly",(e,t)=>{Pt.init(e,t),vt(e._zod,"propValues",()=>t.innerType._zod.propValues),vt(e._zod,"values",()=>t.innerType._zod.values),vt(e._zod,"optin",()=>t.innerType._zod.optin),vt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(rh):rh(o)}});function rh(e){return e.value=Object.freeze(e.value),e}const GC=Z("$ZodCustom",(e,t)=>{ir.init(e,t),Pt.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>nh(s,r,n,e));nh(o,r,n,e)}});function nh(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ko(o))}}class KC{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function QC(){return new KC}const Ki=QC();function XC(e,t){return new e({type:"string",...Ae(t)})}function JC(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ae(t)})}function oh(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ae(t)})}function eE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ae(t)})}function tE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ae(t)})}function rE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ae(t)})}function nE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ae(t)})}function oE(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ae(t)})}function sE(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ae(t)})}function iE(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ae(t)})}function aE(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ae(t)})}function cE(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ae(t)})}function lE(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ae(t)})}function uE(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ae(t)})}function dE(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ae(t)})}function fE(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ae(t)})}function pE(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ae(t)})}function hE(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ae(t)})}function mE(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ae(t)})}function gE(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ae(t)})}function vE(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ae(t)})}function yE(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ae(t)})}function bE(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ae(t)})}function xE(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ae(t)})}function _E(e,t){return new e({type:"string",format:"date",check:"string_format",...Ae(t)})}function wE(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ae(t)})}function SE(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ae(t)})}function CE(e,t){return new e({type:"number",checks:[],...Ae(t)})}function EE(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ae(t)})}function DE(e,t){return new e({type:"boolean",...Ae(t)})}function kE(e){return new e({type:"unknown"})}function AE(e,t){return new e({type:"never",...Ae(t)})}function sh(e,t){return new Hp({check:"less_than",...Ae(t),value:e,inclusive:!1})}function Gc(e,t){return new Hp({check:"less_than",...Ae(t),value:e,inclusive:!0})}function ih(e,t){return new Vp({check:"greater_than",...Ae(t),value:e,inclusive:!1})}function Kc(e,t){return new Vp({check:"greater_than",...Ae(t),value:e,inclusive:!0})}function ah(e,t){return new HS({check:"multiple_of",...Ae(t),value:e})}function ch(e,t){return new YS({check:"max_length",...Ae(t),maximum:e})}function Qi(e,t){return new qS({check:"min_length",...Ae(t),minimum:e})}function lh(e,t){return new ZS({check:"length_equals",...Ae(t),length:e})}function TE(e,t){return new GS({check:"string_format",format:"regex",...Ae(t),pattern:e})}function IE(e){return new KS({check:"string_format",format:"lowercase",...Ae(e)})}function ME(e){return new QS({check:"string_format",format:"uppercase",...Ae(e)})}function PE(e,t){return new XS({check:"string_format",format:"includes",...Ae(t),includes:e})}function OE(e,t){return new JS({check:"string_format",format:"starts_with",...Ae(t),prefix:e})}function jE(e,t){return new eC({check:"string_format",format:"ends_with",...Ae(t),suffix:e})}function Qo(e){return new tC({check:"overwrite",tx:e})}function RE(e){return Qo(t=>t.normalize(e))}function NE(){return Qo(e=>e.trim())}function $E(){return Qo(e=>e.toLowerCase())}function LE(){return Qo(e=>e.toUpperCase())}function zE(e,t,r){return new e({type:"array",element:t,...Ae(r)})}function BE(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Ae(r)})}function FE(e){const t=WE(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ko(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Ko(o))}},e(r.value,r)));return t}function WE(e,t){const r=new ir({check:"custom",...Ae(t)});return r._zod.check=e,r}function uh(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function UE(e,t){for(var r={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:s,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=Nc(i,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function HE(e,t){for(var r={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!r[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[i]={message:a.message,type:a.code}}else r[i]={message:s,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(d){return d.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=Nc(i,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function VE(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,s){try{return Promise.resolve(uh(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(i){return s.shouldUseNativeValidation&&Bc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:Tp(UE(i.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw i}))}catch(i){return Promise.reject(i)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,s){try{return Promise.resolve(uh(function(){return Promise.resolve((r.mode==="sync"?sS:iS)(e,n,t)).then(function(i){return s.shouldUseNativeValidation&&Bc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof Yc})(i))return{values:{},errors:Tp(HE(i.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw i}))}catch(i){return Promise.reject(i)}};throw new Error("Invalid input: not a Zod schema")}const YE=Z("ZodISODateTime",(e,t)=>{mC.init(e,t),kt.init(e,t)});function qE(e){return xE(YE,e)}const ZE=Z("ZodISODate",(e,t)=>{gC.init(e,t),kt.init(e,t)});function GE(e){return _E(ZE,e)}const KE=Z("ZodISOTime",(e,t)=>{vC.init(e,t),kt.init(e,t)});function QE(e){return wE(KE,e)}const XE=Z("ZodISODuration",(e,t)=>{yC.init(e,t),kt.init(e,t)});function JE(e){return SE(XE,e)}const xr=Z("ZodError",(e,t)=>{Yc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>oS(e,r)},flatten:{value:r=>nS(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Fc,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Fc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),eD=Ui(xr),tD=Hi(xr),rD=Vi(xr),nD=Yi(xr),oD=lS(xr),sD=uS(xr),iD=dS(xr),aD=fS(xr),cD=pS(xr),lD=hS(xr),uD=mS(xr),dD=gS(xr),zt=Z("ZodType",(e,t)=>(Pt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>ln(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>eD(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>rD(e,r,n),e.parseAsync=async(r,n)=>tD(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>nD(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>oD(e,r,n),e.decode=(r,n)=>sD(e,r,n),e.encodeAsync=async(r,n)=>iD(e,r,n),e.decodeAsync=async(r,n)=>aD(e,r,n),e.safeEncode=(r,n)=>cD(e,r,n),e.safeDecode=(r,n)=>lD(e,r,n),e.safeEncodeAsync=async(r,n)=>uD(e,r,n),e.safeDecodeAsync=async(r,n)=>dD(e,r,n),e.refine=(r,n)=>e.check(nk(r,n)),e.superRefine=r=>e.check(ok(r)),e.overwrite=r=>e.check(Qo(r)),e.optional=()=>xh(e),e.nullable=()=>_h(e),e.nullish=()=>xh(_h(e)),e.nonoptional=r=>KD(e,r),e.array=()=>gh(e),e.or=r=>LD([e,r]),e.and=r=>BD(e,r),e.transform=r=>Sh(e,HD(r)),e.default=r=>qD(e,r),e.prefault=r=>GD(e,r),e.catch=r=>XD(e,r),e.pipe=r=>Sh(e,r),e.readonly=()=>tk(e),e.describe=r=>{const n=e.clone();return Ki.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ki.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ki.get(e);const n=e.clone();return Ki.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),dh=Z("_ZodString",(e,t)=>{qc.init(e,t),zt.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(TE(...n)),e.includes=(...n)=>e.check(PE(...n)),e.startsWith=(...n)=>e.check(OE(...n)),e.endsWith=(...n)=>e.check(jE(...n)),e.min=(...n)=>e.check(Qi(...n)),e.max=(...n)=>e.check(ch(...n)),e.length=(...n)=>e.check(lh(...n)),e.nonempty=(...n)=>e.check(Qi(1,...n)),e.lowercase=n=>e.check(IE(n)),e.uppercase=n=>e.check(ME(n)),e.trim=()=>e.check(NE()),e.normalize=(...n)=>e.check(RE(...n)),e.toLowerCase=()=>e.check($E()),e.toUpperCase=()=>e.check(LE())}),fD=Z("ZodString",(e,t)=>{qc.init(e,t),dh.init(e,t),e.email=r=>e.check(JC(pD,r)),e.url=r=>e.check(oE(hD,r)),e.jwt=r=>e.check(bE(TD,r)),e.emoji=r=>e.check(sE(mD,r)),e.guid=r=>e.check(oh(fh,r)),e.uuid=r=>e.check(eE(Xi,r)),e.uuidv4=r=>e.check(tE(Xi,r)),e.uuidv6=r=>e.check(rE(Xi,r)),e.uuidv7=r=>e.check(nE(Xi,r)),e.nanoid=r=>e.check(iE(gD,r)),e.guid=r=>e.check(oh(fh,r)),e.cuid=r=>e.check(aE(vD,r)),e.cuid2=r=>e.check(cE(yD,r)),e.ulid=r=>e.check(lE(bD,r)),e.base64=r=>e.check(gE(DD,r)),e.base64url=r=>e.check(vE(kD,r)),e.xid=r=>e.check(uE(xD,r)),e.ksuid=r=>e.check(dE(_D,r)),e.ipv4=r=>e.check(fE(wD,r)),e.ipv6=r=>e.check(pE(SD,r)),e.cidrv4=r=>e.check(hE(CD,r)),e.cidrv6=r=>e.check(mE(ED,r)),e.e164=r=>e.check(yE(AD,r)),e.datetime=r=>e.check(qE(r)),e.date=r=>e.check(GE(r)),e.time=r=>e.check(QE(r)),e.duration=r=>e.check(JE(r))});function _r(e){return XC(fD,e)}const kt=Z("ZodStringFormat",(e,t)=>{St.init(e,t),dh.init(e,t)}),pD=Z("ZodEmail",(e,t)=>{iC.init(e,t),kt.init(e,t)}),fh=Z("ZodGUID",(e,t)=>{oC.init(e,t),kt.init(e,t)}),Xi=Z("ZodUUID",(e,t)=>{sC.init(e,t),kt.init(e,t)}),hD=Z("ZodURL",(e,t)=>{aC.init(e,t),kt.init(e,t)}),mD=Z("ZodEmoji",(e,t)=>{cC.init(e,t),kt.init(e,t)}),gD=Z("ZodNanoID",(e,t)=>{lC.init(e,t),kt.init(e,t)}),vD=Z("ZodCUID",(e,t)=>{uC.init(e,t),kt.init(e,t)}),yD=Z("ZodCUID2",(e,t)=>{dC.init(e,t),kt.init(e,t)}),bD=Z("ZodULID",(e,t)=>{fC.init(e,t),kt.init(e,t)}),xD=Z("ZodXID",(e,t)=>{pC.init(e,t),kt.init(e,t)}),_D=Z("ZodKSUID",(e,t)=>{hC.init(e,t),kt.init(e,t)}),wD=Z("ZodIPv4",(e,t)=>{bC.init(e,t),kt.init(e,t)}),SD=Z("ZodIPv6",(e,t)=>{xC.init(e,t),kt.init(e,t)}),CD=Z("ZodCIDRv4",(e,t)=>{_C.init(e,t),kt.init(e,t)}),ED=Z("ZodCIDRv6",(e,t)=>{wC.init(e,t),kt.init(e,t)}),DD=Z("ZodBase64",(e,t)=>{SC.init(e,t),kt.init(e,t)}),kD=Z("ZodBase64URL",(e,t)=>{EC.init(e,t),kt.init(e,t)}),AD=Z("ZodE164",(e,t)=>{DC.init(e,t),kt.init(e,t)}),TD=Z("ZodJWT",(e,t)=>{AC.init(e,t),kt.init(e,t)}),ph=Z("ZodNumber",(e,t)=>{qp.init(e,t),zt.init(e,t),e.gt=(n,o)=>e.check(ih(n,o)),e.gte=(n,o)=>e.check(Kc(n,o)),e.min=(n,o)=>e.check(Kc(n,o)),e.lt=(n,o)=>e.check(sh(n,o)),e.lte=(n,o)=>e.check(Gc(n,o)),e.max=(n,o)=>e.check(Gc(n,o)),e.int=n=>e.check(hh(n)),e.safe=n=>e.check(hh(n)),e.positive=n=>e.check(ih(0,n)),e.nonnegative=n=>e.check(Kc(0,n)),e.negative=n=>e.check(sh(0,n)),e.nonpositive=n=>e.check(Gc(0,n)),e.multipleOf=(n,o)=>e.check(ah(n,o)),e.step=(n,o)=>e.check(ah(n,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Ji(e){return CE(ph,e)}const ID=Z("ZodNumberFormat",(e,t)=>{TC.init(e,t),ph.init(e,t)});function hh(e){return EE(ID,e)}const MD=Z("ZodBoolean",(e,t)=>{IC.init(e,t),zt.init(e,t)});function ea(e){return DE(MD,e)}const PD=Z("ZodUnknown",(e,t)=>{MC.init(e,t),zt.init(e,t)});function mh(){return kE(PD)}const OD=Z("ZodNever",(e,t)=>{PC.init(e,t),zt.init(e,t)});function jD(e){return AE(OD,e)}const RD=Z("ZodArray",(e,t)=>{OC.init(e,t),zt.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Qi(r,n)),e.nonempty=r=>e.check(Qi(1,r)),e.max=(r,n)=>e.check(ch(r,n)),e.length=(r,n)=>e.check(lh(r,n)),e.unwrap=()=>e.element});function gh(e,t){return zE(RD,e,t)}const ND=Z("ZodObject",(e,t)=>{RC.init(e,t),zt.init(e,t),vt(e,"shape",()=>t.shape),e.keyof=()=>yh(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:mh()}),e.loose=()=>e.clone({...e._zod.def,catchall:mh()}),e.strict=()=>e.clone({...e._zod.def,catchall:jD()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Xw(e,r),e.safeExtend=r=>Jw(e,r),e.merge=r=>eS(e,r),e.pick=r=>Kw(e,r),e.omit=r=>Qw(e,r),e.partial=(...r)=>tS(bh,e,r[0]),e.required=(...r)=>rS(wh,e,r[0])});function vh(e,t){const r={type:"object",get shape(){return cn(this,"shape",e?Vw(e):{}),this.shape},...Ae(t)};return new ND(r)}const $D=Z("ZodUnion",(e,t)=>{NC.init(e,t),zt.init(e,t),e.options=t.options});function LD(e,t){return new $D({type:"union",options:e,...Ae(t)})}const zD=Z("ZodIntersection",(e,t)=>{$C.init(e,t),zt.init(e,t)});function BD(e,t){return new zD({type:"intersection",left:e,right:t})}const Qc=Z("ZodEnum",(e,t)=>{LC.init(e,t),zt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Qc({...t,checks:[],...Ae(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Qc({...t,checks:[],...Ae(o),entries:s})}});function yh(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Qc({type:"enum",entries:r,...Ae(t)})}const FD=Z("ZodLiteral",(e,t)=>{zC.init(e,t),zt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function WD(e,t){return new FD({type:"literal",values:Array.isArray(e)?e:[e],...Ae(t)})}const UD=Z("ZodTransform",(e,t)=>{BC.init(e,t),zt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mp(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Ko(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Ko(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function HD(e){return new UD({type:"transform",transform:e})}const bh=Z("ZodOptional",(e,t)=>{FC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xh(e){return new bh({type:"optional",innerType:e})}const VD=Z("ZodNullable",(e,t)=>{WC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _h(e){return new VD({type:"nullable",innerType:e})}const YD=Z("ZodDefault",(e,t)=>{UC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qD(e,t){return new YD({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Np(t)}})}const ZD=Z("ZodPrefault",(e,t)=>{HC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function GD(e,t){return new ZD({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Np(t)}})}const wh=Z("ZodNonOptional",(e,t)=>{VC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function KD(e,t){return new wh({type:"nonoptional",innerType:e,...Ae(t)})}const QD=Z("ZodCatch",(e,t)=>{YC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function XD(e,t){return new QD({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const JD=Z("ZodPipe",(e,t)=>{qC.init(e,t),zt.init(e,t),e.in=t.in,e.out=t.out});function Sh(e,t){return new JD({type:"pipe",in:e,out:t})}const ek=Z("ZodReadonly",(e,t)=>{ZC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function tk(e){return new ek({type:"readonly",innerType:e})}const rk=Z("ZodCustom",(e,t)=>{GC.init(e,t),zt.init(e,t)});function nk(e,t={}){return BE(rk,e,t)}function ok(e){return FE(e)}const Ch=/^([01][0-9]|2[0-3]):[0-5][0-9]$/,Eh=(e,t)=>{if(!e||!t)return null;const r=e.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),o=parseInt(r[1],10)-1,s=parseInt(r[2],10),i=t.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),l=new Date(n,o,s,a,c);return isNaN(l.getTime())||!x.isValid(l)?null:l},sk=vh({UsuarioID:Ji().nullable().optional(),disID:Ji().nullable().optional(),EsOrganizador:ea().default(!1),Correo:_r().email("Formato de correo inválido"),StatusInvitacion:yh(["PENDIENTE","CONFIRMADA","RECHAZADA"]).default("PENDIENTE")}),ik=vh({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(Ch,{message:"Formato inválido"}),horaFin:_r().min(1,"La hora fin es requerida.").regex(Ch,{message:"Formato inválido"}),todoElDia:ea(),fechaFin:_r().optional(),showEndDate:ea().optional(),horaInicio2:_r().optional(),TodoElDia2:ea().optional(),client:_r().nullable().optional(),repetir:_r().optional(),link:_r().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(WD("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:_r().optional(),invitados:gh(sk).optional().default([]),color:_r().optional(),solID:Ji().nullable().optional(),disID:Ji().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 t=Eh(e.fechaInicio,e.horaInicio),r=Eh(e.fechaFin,e.horaFin);return!t||!r||!x.isValid(t)||!x.isValid(r)?!0:!(x.isBefore(r,t)&&!x.isSameDay(r,t)||x.isSameDay(t,r)&&x.isBefore(r,t))},{message:"",path:["horaFin"]}),Dh=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.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"}),K.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"})),ak="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",ck=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.createElement("g",{clipPath:"url(#a)"},K.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"})),K.createElement("defs",null,K.createElement("clipPath",{id:"a"},K.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),kh="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",lk=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.createElement("g",{fill:"#2571D6",clipPath:"url(#a)"},K.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"}),K.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"}),K.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"})),K.createElement("defs",null,K.createElement("clipPath",{id:"a"},K.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),uk="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",dk=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.createElement("path",{fill:"#2571D6",fillRule:"evenodd",d:"M17.333 11a6.34 6.34 0 0 1 6.334 6.333 6.34 6.34 0 0 1-6.334 6.334c-3.493 0-6.333-2.846-6.333-6.334A6.343 6.343 0 0 1 17.333 11m-.005 2.37c-.437 0-.79.338-.79.754v2.412h-2.414c-.416 0-.754.355-.754.792s.338.792.754.792h2.413v2.412c0 .416.354.754.791.754s.792-.338.792-.754V18.12h2.413c.416 0 .754-.355.754-.792s-.338-.792-.754-.792H18.12v-2.412c0-.416-.355-.754-.792-.754",clipRule:"evenodd"}),K.createElement("path",{fill:"#2571D6",d:"M11.12 12.297a7.97 7.97 0 0 0-1.787 5.036c0 1.763.571 3.392 1.537 4.714H3.044c-.84 0-1.523-.682-1.523-1.523 0-4.544 3.683-8.227 8.217-8.227zM10.995.139c2.925 0 5.3 2.376 5.3 5.3s-2.376 5.3-5.3 5.3v-.01a5.303 5.303 0 0 1-5.3-5.3 5.295 5.295 0 0 1 5.3-5.29"}));var Xo={},Ah;function fk(){if(Ah)return Xo;Ah=1;var e=ut();Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.default=void 0;var t=e(gt()),r=pt();return Xo.default=(0,t.default)((0,r.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),Xo}var pk=fk();const Th=lt(pk);var Jo={},Ih;function hk(){if(Ih)return Jo;Ih=1;var e=ut();Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.default=void 0;var t=e(gt()),r=pt();return Jo.default=(0,t.default)((0,r.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),Jo}var mk=hk();const gk=lt(mk),Mh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC",Ph="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",vk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAGFBMVEUAAAAAfFQAflYAfVYAfVUAfFQAcFAAfVbb6xt6AAAAB3RSTlMAIN98m0wQyLlfvgAAAE1JREFUGNNjoAgwmiJxhMoDEBLq5QZIEkUCSBKKeCXYYBJgMQeEBHN5CUIHa3m5A8Io8/ISiAREHRAAJWBSSHYwgyXgUjAJsIGGpPkcAJCLE29yhAT7AAAAAElFTkSuQmCC",yk=e=>{const t=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],r=e.charCodeAt(0)%t.length;return t[r]},bk=(e,t,r,n,o)=>{if(t)return u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[u.jsx("img",{src:Ph,width:15,style:{marginRight:"5px"}}),u.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return u.jsx(m.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return u.jsx(m.Button,{onClick:()=>{n(r),o()},variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"});case"CONFIRMADA":return u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[u.jsx("img",{src:vk,width:15,style:{marginRight:"5px"}}),u.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Asistiré"})]});default:return null}};function xk({open:e,handleClose:t,guests:r,onReenviar:n}){const o=r.filter(l=>l.estatus==="CONFIRMADA"||l.isHost),s=r.filter(l=>l.estatus==="PENDIENTE"&&!l.isHost),i=r.filter(l=>l.estatus==="RECHAZADA"&&!l.isHost),a=l=>u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[u.jsxs(m.Box,{sx:{position:"relative",mr:2},children:[u.jsx(m.Avatar,{sx:{bgcolor:yk(l.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:l.iniciales}),l.estatus==="PENDIENTE"&&u.jsx(m.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:u.jsx(Ac,{sx:{fontSize:14,color:"#546E7A"}})})]}),u.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:l.nombre}),bk(l.estatus,l.isHost,l.usrID,n,t)]},l.nombre),c=({title:l,count:d,badgeColor:f})=>u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[u.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:l}),f&&u.jsx(m.Box,{sx:{ml:1,bgcolor:f,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:d})]});return u.jsxs(m.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[u.jsxs(m.Box,{sx:{p:"16px 8px"},children:[u.jsx(m.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),u.jsx(m.Button,{onClick:t,startIcon:u.jsx("img",{src:Mh,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),u.jsx(m.IconButton,{onClick:t,sx:{position:"absolute",right:8,top:12},children:u.jsx(Hr,{})})]}),u.jsx(m.Divider,{sx:{backgroundColor:"black"}}),u.jsxs(m.DialogContent,{sx:{p:2},children:[s.length>0&&u.jsxs(m.Box,{sx:{mb:3},children:[u.jsx(c,{title:"Invitados",count:s.length}),s.map(a)]}),o.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),u.jsxs(m.Box,{sx:{mb:3},children:[u.jsx(c,{title:"Confirmados",count:o.length,badgeColor:"#1976D2"}),o.map(a)]})]}),i.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),u.jsxs(m.Box,{children:[u.jsx(c,{title:"No asistirán",count:i.length,badgeColor:"#1976D2"}),i.map(a)]})]})]})]})}const _k=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function wk({guests:e,onReenviar:t}){const[r,n]=v.useState(!1),o=()=>n(!0),s=()=>n(!1);return u.jsxs(u.Fragment,{children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[u.jsx(m.AvatarGroup,{max:6,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,a)=>u.jsx(m.Tooltip,{title:i.nombre,arrow:!0,placement:"top",children:u.jsx(m.Box,{children:u.jsx(m.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:i.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:u.jsx(m.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:u.jsx("img",{src:Xf})}),children:u.jsx(m.Avatar,{sx:{bgcolor:_k(i.iniciales)},children:i.iniciales})})})},a))}),u.jsx(m.Box,{sx:{flexGrow:1}}),u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:o,children:[u.jsx(m.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),u.jsx(gk,{sx:{fontSize:18,ml:.5}})]})]}),u.jsx(xk,{open:r,handleClose:s,guests:e,onReenviar:t})]})}var es={},Oh;function Sk(){if(Oh)return es;Oh=1;var e=ut();Object.defineProperty(es,"__esModule",{value:!0}),es.default=void 0;var t=e(gt()),r=pt();return es.default=(0,t.default)((0,r.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"),es}var Ck=Sk();const Ek=lt(Ck),Dk=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),jh=e=>{const[t,r]=e.split(":"),n=parseInt(t),o=n>=12?"pm":"am";return`${n%12||12}:${r} ${o}`},Rh=e=>e.split(":").slice(0,2).join(":"),kk=({slot:e,onClick:t})=>u.jsxs(m.Box,{onClick:t,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:[u.jsx(m.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:u.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:Dk(e.Fecha)})}),u.jsxs(m.Box,{sx:{py:1.5},children:[u.jsx(m.Typography,{sx:{fontSize:"12px"},children:jh(e.HoraInicio)}),u.jsxs(m.Typography,{sx:{fontSize:"12px"},children:["a ",jh(e.HoraFin)]})]})]});function Ak({open:e,handleClose:t,suggestions:r,onSelectSlot:n}){const[o,s]=v.useState(16),a=r.slice(0,o).reduce((d,f)=>{const h=f.Fecha;return d[h]||(d[h]=[]),d[h].push(f),d},{}),c=Object.keys(a),l=d=>{const f={...d,HoraInicio:Rh(d.HoraInicio),HoraFin:Rh(d.HoraFin)};n(f),t()};return u.jsxs(m.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[u.jsxs(m.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[u.jsx(m.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),u.jsx(m.Box,{children:u.jsx(m.Button,{startIcon:u.jsx("img",{src:Mh,width:20}),onClick:t,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"1rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),u.jsx(m.Divider,{}),u.jsx(m.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:c.length===0?u.jsx(m.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):u.jsxs(u.Fragment,{children:[c.map((d,f)=>u.jsxs(m.Box,{sx:{mb:3},children:[u.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&&u.jsx("img",{src:Ph,width:15,style:{marginLeft:5}})]}),u.jsx(m.Grid,{container:!0,spacing:2,children:a[d].map((h,y)=>u.jsx(m.Grid,{item:!0,xs:6,sm:3,children:u.jsx(kk,{slot:h,onClick:()=>l(h)})},`${d}-${y}`))})]},d)),r.length>o&&u.jsx(m.Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:u.jsx(m.Button,{onClick:()=>s(d=>d+12),startIcon:u.jsx(Ek,{}),sx:{textTransform:"none",fontWeight:"bold",color:"#1976d2","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Mostrar más horarios disponibles"})})]})})]})}const Tk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",Ik=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function Mk({onSelectGuest:e,availableSuggestions:t,onInputTextChange:r}){const[n,o]=v.useState(null),[s,i]=v.useState(""),a=(l,d)=>{d?(e(d),o(null),i("")):(o(null),i(""))},c=(l,d)=>{i(d),r(d)};return u.jsx(m.Autocomplete,{options:t,value:n,inputValue:s,getOptionLabel:l=>l.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(l,d)=>l.correo===d.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:l=>u.jsx(m.TextField,{...l,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...l.InputProps,startAdornment:u.jsx(m.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:u.jsx("img",{src:Tk,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(l,d)=>v.createElement(m.Box,{component:"li",...l,key:d.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},u.jsx(m.Avatar,{sx:{bgcolor:Ik(d.iniciales),mr:2,width:32,height:32,fontSize:14},children:d.iniciales}),u.jsx(m.Typography,{children:d.nombre}))},"guest-autocomplete-field")}var ts={},Nh;function Pk(){if(Nh)return ts;Nh=1;var e=ut();Object.defineProperty(ts,"__esModule",{value:!0}),ts.default=void 0;var t=e(gt()),r=pt();return ts.default=(0,t.default)((0,r.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"),ts}var Ok=Pk();const jk=lt(Ok);var rs={},$h;function Rk(){if($h)return rs;$h=1;var e=ut();Object.defineProperty(rs,"__esModule",{value:!0}),rs.default=void 0;var t=e(gt()),r=pt();return rs.default=(0,t.default)((0,r.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"),rs}var Nk=Rk();const Xc=lt(Nk),$k=e=>e.tieneConflicto?{icon:u.jsx(Xc,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:u.jsx(jk,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},Lk=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function zk({guests:e,conflictCount:t,onViewSuggestions:r,onDeleteGuest:n}){const o=i=>a=>{a.stopPropagation(),n(i)},s=i=>i?i.trim().split(/\s+/).slice(0,2).join(" "):"";return u.jsxs(m.Box,{sx:{p:1},children:[u.jsx(m.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((i,a)=>{const c=$k(i),l=Lk(i.iniciales);return u.jsx(m.Chip,{label:u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[u.jsx(m.Typography,{variant:"body2",sx:{color:c.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:s(i?.nombre)}),u.jsx(m.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:c.icon})]}),avatar:u.jsx(m.Avatar,{sx:{bgcolor:l,width:24,height:24,fontSize:"10px",fontWeight:"bold",color:"#ffffff !important",ml:"4px !important"},children:i.iniciales}),sx:{backgroundColor:c.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:c.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"}}},onClick:()=>console.log(`Ver perfil de ${i.nombre}`),onDelete:o(i.nombre)},a)})}),t>0&&u.jsxs(m.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[u.jsx(Xc,{sx:{mr:1,fontSize:22}}),u.jsxs(m.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",u.jsxs("strong",{children:[t," invitado"]}),t!==1?"s":""]})]}),u.jsx(m.Link,{component:"button",type:"button",variant:"body2",onClick:i=>{i.preventDefault(),i.stopPropagation(),r()},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 Bk(e,t){const[r,n]=v.useState(e);return v.useEffect(()=>{const o=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(o)}},[e,t]),r}const Fk={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"},Lh=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],Wk=()=>{const e=[];for(let t=0;t<24;t++)for(let r=0;r<60;r+=15){const n=t.toString().padStart(2,"0"),o=r.toString().padStart(2,"0");e.push(`${n}:${o}`)}return e},zh=[],eo=Wk(),ns=(e,t)=>{if(!e||!t)return null;const r=e.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),o=parseInt(r[1],10)-1,s=parseInt(r[2],10),i=t.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),l=new Date(s,o,n,a,c);return isNaN(l.getTime())||!x.isValid(l)?null:l},Uk=({isVisible:e,onClose:t,onSave:r,onDelete:n,selectedDate:o,initialEvent:s,userId:i,masNombreBD:a,disId:c,onReenviar:l})=>{const[d,f]=v.useState(!1),[h,y]=v.useState(!1),g=x.format(new Date,"yyyy-MM-dd"),[p,b]=v.useState(""),[w,S]=v.useState([]),[E,C]=v.useState(!1),_=kc(),[W,D]=v.useState([]),[T,M]=v.useState(""),[I,U]=v.useState(zh),[G,F]=v.useState(!1),[Y,se]=v.useState(""),[H,N]=v.useState(!1),[le,de]=v.useState([]),[$,Q]=v.useState([]),Se=Bk(Y,300),we=I.filter(q=>q.tieneConflicto).length,{control:he,handleSubmit:ae,reset:ue,formState:{errors:J,isValid:Ce},watch:me,setValue:ee}=kp({resolver:VE(ik),defaultValues:{titulo:s?.titulo||"",fechaInicio:x.format(new Date,"yyyy-MM-dd"),horaInicio:x.format(new Date,"HH:mm"),horaFin:x.format(x.addHours(new Date,1),"HH:mm"),todoElDia:!1,client:s?.client||null,repetir:"No repetir",link:s?.link||"",descripcion:s?.descripcion||"",solID:s?.solID??null,invitados:[]},mode:"onChange"}),Me=me("fechaInicio"),j=me("fechaFin"),Fe=me("todoElDia");v.useEffect(()=>{if(p.trim()===""||!i||!c||!a){S([]),D([]),ee("solID",null),C(!1),M("");return}C(!0);const q=setTimeout(()=>{_.getClients(p,c,a,i).then(fe=>{if(C(!1),fe){const Oe=fe.map(je=>je.solID);D([...new Set(Oe)])}else D([]);const ke=Array.from(new Map(fe.map(Oe=>[Oe.nombreCliente,Oe])).values());if(ke.length>0)S(ke),M("");else if(s?.client&&s.solID!==null){const Oe=[{solID:s.solID,nombreCliente:s.client}];S(Oe),M("Sin resultados")}else S([]),M("Sin resultados")}).catch(fe=>{console.error("Error al buscar clientes:",fe),C(!1)})},500);return()=>clearTimeout(q)},[p,i,c,a]),v.useEffect(()=>{if(Me&&j){const q=new Date(Me),fe=new Date(j);(q===fe||q>fe)&&ee("fechaFin",Me)}},[Me,j,ee]),v.useEffect(()=>{Me&&ee("fechaFin",Me)},[Me]),v.useEffect(()=>{ee("showEndDate",d)},[d,ee]),v.useEffect(()=>{if(s){const q=x.format(s.fechaInicio,"yyyy-MM-dd")===x.format(s.fechaFin,"yyyy-MM-dd");if(f(!q),ee("titulo",s?.titulo),ee("fechaInicio",x.format(s.fechaInicio,"yyyy-MM-dd")),ee("fechaFin",x.format(s.fechaFin,"yyyy-MM-dd")),ee("horaInicio",x.format(s.fechaInicio,"HH:mm")),ee("horaFin",x.format(s.fechaFin,"HH:mm")),ee("horaInicio2",x.format(s.fechaFin,"HH:mm")),ee("descripcion",s.descripcion),ee("link",s.link),ee("repetir","false"),ee("color",s.color),ee("todoElDia",s.todoElDia),ee("solID",s.solID),ee("client",s.client),console.log("initialEvent",s),s.invitados&&s.invitados.length>0){const fe=(s?.invitados||[]).map(je=>{const te=je.usrNombre?.trim()||"",_e=te.split(/\s+/),Ie=_e.length>1?(_e[0][0]+_e[1][0]).toUpperCase():te.substring(0,2).toUpperCase();return{nombre:je.usrNombre||"Sin nombre",correo:je.correo||"",iniciales:Ie||"--",usrID:je.usuarioID??null,isHost:je.esOrganizador||!1,estatus:je.statusInvitacion,tieneConflicto:!1,disID:je.disID}}),ke=localStorage.getItem("nombreAnfitrion")||"Anfitrión",Oe={nombre:ke,correo:"",iniciales:ke.substring(0,2).toUpperCase(),usrID:i??0,isHost:!0,estatus:"CONFIRMADA",tieneConflicto:!1};U([Oe,...fe])}else U(zh);s.solID?y(!0):y(!1)}else{const q=o||new Date,fe=new Date,ke=new Date(q.getFullYear(),q.getMonth(),q.getDate(),fe.getHours(),fe.getMinutes()),Oe=x.addHours(ke,1);ue({titulo:"",fechaInicio:x.format(ke,"yyyy-MM-dd"),horaInicio:x.format(ke,"HH:mm"),fechaFin:x.format(Oe,"yyyy-MM-dd"),horaFin:x.format(Oe,"HH:mm"),horaInicio2:x.format(Oe,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:Lh[0],solID:null}),f(!1),y(!1)}},[s,e,o]);const Ke=q=>({UsuarioID:q.usrID??null,Correo:q.correo,EsOrganizador:q.usrID==i,StatusInvitacion:q.estatus,disID:c??null}),Ze=ae(q=>{const fe=I.map(Oe=>Ke(Oe)),ke={...q,invitados:fe};r(ke,s?.eventoID),t(),ue(),f(!1)},q=>{console.log("Errores de validación:",q)});v.useEffect(()=>{Fe&&(ee("horaInicio","00:00"),ee("horaFin","23:59"))},[Fe,ee,me]);const Be=()=>{const q=me("fechaInicio");if(q){const fe=new Date(`${q}T00:00:00`),ke=x.addDays(fe,1);ee("fechaFin",x.format(ke,"yyyy-MM-dd"))}f(!0)},Ve=me("fechaInicio"),et=me("horaInicio"),ht=me("fechaFin"),k=me("horaFin"),[P,B]=v.useState(null),[ce,ie]=v.useState(null);v.useEffect(()=>{(P===null||P!==et)&&B(et)},[et,P]),v.useEffect(()=>{(ce===null||ce!==k)&&ie(k??"")},[k,ce]);const O=me("todoElDia");v.useEffect(()=>{if(O||!et||!k||!Ve||!ht)return;const q=ns(Ve,et),fe=ns(ht,k);if(!q||!fe||!x.isValid(q)||!x.isValid(fe))return;const ke=x.isSameDay(q,fe),Oe=ke&&(x.isAfter(q,fe)||q.getTime()===fe.getTime()),je=x.isBefore(fe,q)&&!ke;(Oe||je)&&(ee("horaFin",""),ie(""))},[et,Ve]);const oe=v.useMemo(()=>{if(!et||!Ve)return eo;const q=ns(Ve,et),fe=ns(ht,"00:00");return!q||!fe||!x.isValid(q)||!x.isValid(fe)||x.isBefore(fe,q)&&!x.isSameDay(fe,q)?eo:x.isSameDay(q,fe)?eo.filter(ke=>{const Oe=ns(ht,ke);return Oe&&x.isAfter(Oe,q)}):(x.isAfter(fe,q),eo)},[et,Ve,ht]),Ee=v.useMemo(()=>eo,[]),Ne=async q=>{const fe=I.some(Vt=>Vt.correo===q.correo);if(N(!0),fe)return;const ke=c,Oe=q.correo,je=q.usrID,te=Ve,_e=et,Ie=k;if(!ke||!Oe||!te||!_e||!Ie){U(Vt=>[...Vt,{...q,status:"pending",isHost:!1,hasConflict:!1,usrID:je,name:q.nombre}]);return}let Pe;try{Pe=await _.VerificarConflicto(ke,Oe,te,_e+":00",Ie+":00")}catch{Pe={tieneConflicto:!1,usrMail:q.correo}}const wr=Array.isArray(Pe)?Pe[0]:Pe,ar={...q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:String(wr.tieneConflicto).toLowerCase()==="true"};if(ar.tieneConflicto){const Vt=await _.getDisponibilidadUsuario(c,Oe,te,"60");de(Vt)}U(Vt=>[...Vt,ar])},R=q=>{U(fe=>fe.filter(ke=>ke.nombre!==q))},re=()=>{F(!1)},xe=q=>{const Oe=(q.usrNombre??"").split(" ").map(je=>je.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:q.usrNombre??"",correo:q.usrMail??"",iniciales:Oe,usrID:q.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};v.useEffect(()=>{Se.length>2&&c?(async()=>{const ke=(await _.getUsuariosInvitados(c,Se)).map(xe).filter(Oe=>Oe.usrID!==i&&!I.some(je=>je.correo===Oe.correo));Q(ke)})():Q([])},[Se,I]);const Ge=q=>{se(q)},At=q=>{const{Fecha:fe,HoraInicio:ke,HoraFin:Oe}=q,je=te=>te.split(":").slice(0,2).join(":");ee("fechaInicio",fe),ee("fechaFin",fe),ee("horaInicio",je(ke)),ee("horaFin",je(Oe)),f(!1),re(),console.log("Formulario actualizado con sugerencia:",{Fecha:fe,HoraInicio:ke,HoraFin:Oe})};return u.jsx(u.Fragment,{children:u.jsx(m.Modal,{open:e,onClose:t,children:u.jsx("form",{onSubmit:Ze,children:u.jsxs(m.Box,{sx:Fk,children:[u.jsx(m.IconButton,{"aria-label":"close",onClick:t,sx:{position:"absolute",right:8,top:12},children:u.jsx(Hr,{})}),u.jsx(m.Typography,{variant:"h6",mb:2,children:s?.isGoogleEvent||s?.isOutlookEvent||!s?.esOrganizador?u.jsx(u.Fragment,{children:s?.titulo||"Evento de Google"}):s?"Editar evento":"Agregar evento"}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(hr,{name:"titulo",control:he,render:({field:q})=>u.jsx(m.TextField,{...q,label:"Título",fullWidth:!0,variant:"outlined",size:"small",error:!!J.titulo,helperText:J.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"}}})})})}),u.jsxs("div",{className:`row g-2 ${d?"mb-1":"mb-2"}`,children:[u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(hr,{name:"fechaInicio",control:he,render:({field:q})=>u.jsx(m.TextField,{fullWidth:!0,...q,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!J.fechaInicio,helperText:J.fechaInicio?.message})})}),d?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"col-md-3 d-none d-md-block"}),u.jsx("div",{className:"col-10 col-md-4",children:u.jsx(hr,{name:"fechaFin",control:he,render:({field:q})=>u.jsx(m.TextField,{...q,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:Me||g},error:!!J.fechaFin,helperText:J.fechaFin?.message})})}),!s&&u.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:u.jsx(m.IconButton,{onClick:()=>f(!1),sx:{fontSize:18},children:u.jsx(Dh,{})})})]}):u.jsx("div",{className:"col-md-8"})]}),d&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12 d-flex justify-content-center",children:u.jsx(Th,{sx:{color:"#757575",my:1}})})}),u.jsxs("div",{className:"row g-2 mb-2",children:[u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(hr,{name:"horaInicio",control:he,render:({field:{onChange:q,value:fe,...ke}})=>u.jsx(m.Autocomplete,{freeSolo:!0,options:Ee,value:fe||"",onChange:(Oe,je)=>q(je||""),onInputChange:(Oe,je)=>q(je),renderInput:Oe=>u.jsx(m.TextField,{...Oe,...ke,size:"small",error:!!J.horaInicio,helperText:J.horaInicio?.message,InputProps:{...Oe.InputProps,endAdornment:u.jsx(m.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:u.jsx(Ac,{})})}}),disabled:O})})}),!d&&u.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:J.horaInicio?"5px":"0px"},children:u.jsx(Th,{sx:{color:"#757575"}})}),d&&u.jsx("div",{className:"col-md-3 d-none d-md-block"}),u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(hr,{name:"horaFin",control:he,render:({field:{onChange:q,value:fe,...ke}})=>u.jsx(m.Autocomplete,{freeSolo:!0,options:oe,value:fe||"",onChange:(Oe,je)=>q(je||""),onInputChange:(Oe,je)=>q(je),renderInput:Oe=>u.jsx(m.TextField,{...Oe,...ke,size:"small",error:!!J.horaFin,helperText:J.horaFin?.message,InputProps:{...Oe.InputProps,endAdornment:u.jsx(m.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:u.jsx(Ac,{})})}}),disabled:O})})}),!d&&u.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:u.jsx(hr,{name:"todoElDia",control:he,render:({field:q})=>u.jsx(m.FormControlLabel,{control:u.jsx(m.Checkbox,{checked:q.value,onChange:fe=>q.onChange(fe.target.checked)}),label:u.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&!d&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsxs(m.Button,{onClick:Be,size:"small",sx:{textTransform:"none",fontSize:16},children:[u.jsx(lk,{}),"  Agregar fecha final"]})})}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&u.jsx("div",{className:"row mb-2",children:u.jsxs("div",{className:"col-12",children:[!h&&u.jsxs(m.Button,{onClick:()=>y(!0),size:"small",sx:{textTransform:"none",fontSize:16},children:[u.jsx(dk,{}),"  Vincular cliente"]}),h&&u.jsxs("div",{className:"row g-2",children:[u.jsx("div",{className:"col-10 col-md-5",children:u.jsx(hr,{name:"client",control:he,render:({field:q})=>u.jsx(m.Autocomplete,{options:w,loading:E,loadingText:"Buscando coincidencias...",getOptionLabel:fe=>fe.nombreCliente?.trim()||"",value:w.find(fe=>fe.nombreCliente===q.value)||(q.value&&typeof q.value=="string"?{solID:-1,nombreCliente:q.value}:null),noOptionsText:T,onInputChange:(fe,ke)=>{b(ke)},onChange:(fe,ke)=>{q.onChange(ke?ke.nombreCliente:"")},renderInput:fe=>u.jsx(m.TextField,{...fe,placeholder:"Buscar cliente...",size:"small",InputProps:{...fe.InputProps,startAdornment:u.jsx("img",{src:Xd,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"5px"}}),endAdornment:u.jsxs(u.Fragment,{children:[E?u.jsx(m.CircularProgress,{color:"inherit",size:20}):null,fe.InputProps.endAdornment]})}})})})}),u.jsx("div",{className:"col-10 col-md-5",children:u.jsx(hr,{name:"solID",control:he,render:({field:q})=>u.jsx(m.Autocomplete,{options:W,noOptionsText:"Sin resultados",getOptionLabel:fe=>fe.toString(),value:q.value??null,onChange:(fe,ke)=>q.onChange(ke),renderInput:fe=>u.jsx(m.TextField,{...fe,label:"#Registro",variant:"outlined",size:"small",sx:{"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}}),disabled:!w.length})})}),u.jsx("div",{className:"col-2 d-flex align-items-center",children:u.jsx(m.IconButton,{onClick:()=>y(!1),sx:{fontSize:18},children:u.jsx(Dh,{})})})]})]})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(hr,{name:"link",control:he,render:({field:q})=>u.jsx(m.TextField,{...q,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!J.link,helperText:J.link?.message,InputProps:{startAdornment:u.jsx("img",{src:ak,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(hr,{name:"descripcion",control:he,render:({field:q})=>u.jsx(m.TextField,{...q,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:u.jsx("img",{src:uk,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(Mk,{onSelectGuest:Ne,availableSuggestions:$,onInputTextChange:Ge})})}),H&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(zk,{guests:I,conflictCount:we,onViewSuggestions:()=>F(!0),onDeleteGuest:R})})}),s?.invitados&&s?.invitados?.length>0&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(m.Box,{children:u.jsx(wk,{guests:I,onReenviar:l})})})}),u.jsx(Ak,{open:G,handleClose:re,suggestions:le,onSelectSlot:At}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[u.jsx(ck,{}),Lh.map(q=>u.jsx(hr,{name:"color",control:he,render:({field:fe})=>u.jsx(m.IconButton,{onClick:()=>fe.onChange(q),sx:{width:24,height:24,borderRadius:"50%",bgcolor:q,border:fe.value===q?"2px solid":"none",borderColor:fe.value===q?"primary.main":"transparent"}})},q))]})})}),u.jsx("div",{className:"row",children:u.jsxs("div",{className:"col-12 d-flex gap-2",style:{width:"100%",marginTop:"20px"},children:[s&&!s?.isGoogleEvent&&!s?.isOutlookEvent&&u.jsx(m.Button,{onClick:n,variant:"outlined",startIcon:u.jsx("img",{src:kh,width:15}),hidden:!s?.esOrganizador,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"}),u.jsx(m.Button,{onClick:t,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"}),u.jsx(m.Button,{onClick:Ze,variant:"contained",disabled:!Ce,hidden:!s?.esOrganizador,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"})]})})]})})})})},Hk={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"},Vk=({isOpen:e,onClose:t,events:r,date:n,onEventClick:o})=>{if(!n)return null;const s=a=>{o(a),t()},i=a=>a.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:a.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return u.jsx(m.Modal,{open:e,onClose:t,children:u.jsxs(m.Box,{sx:Hk,children:[u.jsxs(m.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[u.jsxs(m.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),u.jsx(m.IconButton,{onClick:t,size:"small",children:u.jsx(Hr,{})})]}),u.jsx(m.Divider,{}),u.jsx(m.List,{sx:{mt:1},children:r.map(a=>{const c=i(a);return u.jsx(m.ListItem,{disablePadding:!0,sx:{mb:1},children:u.jsx(m.ListItemButton,{onClick:()=>s(a),sx:{py:1,borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.02)",borderLeft:`5px solid ${c?.borderColor}`,"&:hover":{backgroundColor:"rgba(0,0,0,0.04)"}},children:u.jsxs(m.Box,{sx:{flexGrow:1},children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[u.jsx(m.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),u.jsx(m.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),u.jsx(m.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${x.format(a.fechaInicio,"HH:mm")} - ${x.format(a.fechaFin,"HH:mm")}`})]})})},a.eventoID)})})]})})};var os={},Bh;function Yk(){if(Bh)return os;Bh=1;var e=ut();Object.defineProperty(os,"__esModule",{value:!0}),os.default=void 0;var t=e(gt()),r=pt();return os.default=(0,t.default)((0,r.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"),os}var qk=Yk();const Zk=lt(qk);var ss={},Fh;function Gk(){if(Fh)return ss;Fh=1;var e=ut();Object.defineProperty(ss,"__esModule",{value:!0}),ss.default=void 0;var t=e(gt()),r=pt();return ss.default=(0,t.default)((0,r.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"),ss}var Kk=Gk();const Qk=lt(Kk),Xk="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",Jk="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==",Jc=v.forwardRef(({id:e,message:t,variant:r},n)=>{const{closeSnackbar:o}=bs.useSnackbar(),s={success:{color:"#fff",icon:u.jsx("img",{width:25,src:Xk,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:u.jsx(Zk,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:u.jsx(Qk,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:u.jsx("img",{src:kh,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:u.jsx("img",{src:Jk,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},i=s[r]||s.info;return u.jsx(bs.SnackbarContent,{ref:n,children:u.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 ${i.color}`},children:[u.jsx(m.Box,{sx:{mr:1.5},children:i.icon}),u.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1},children:t}),u.jsx(m.IconButton,{size:"small",onClick:()=>o(e),children:u.jsx(Hr,{fontSize:"small"})})]})})}),Wh=v.createContext(void 0),eA=({children:e})=>{const[t,r]=v.useState([]),[n,o]=v.useState([]),[s,i]=v.useState(!1);return u.jsx(Wh.Provider,{value:{googleEvents:t,setGoogleEvents:r,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:s,setIsLoadingGoogleEvents:i},children:e})},tA=()=>{const e=v.useContext(Wh);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},rA=(e,t,r)=>{const n=(i,a)=>a?new Date(a):i?new Date(i.replace(/-/g,"/")):new Date,o=n(e.start.date,e.start.dateTime);let s=n(e.end.date,e.end.dateTime);return e.end.date&&!e.end.dateTime&&s.setDate(s.getDate()-1),{eventoID:Math.abs(nA(e.id)),titulo:e.summary||"(Sin título)",descripcion:e.description,fechaInicio:o,fechaFin:s,todoElDia:!!(e.start.date&&!e.start.dateTime),color:"#4285F4C",hasVideoCall:!!e.conferenceData,link:e.htmlLink,repetir:void 0,solID:null,disID:t,client:null,usrID:r,solicitudRelacionada:[],isGoogleEvent:!0}};function nA(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t}function oA(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t}const sA=(e,t,r)=>{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(oA(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:t,client:null,usrID:r,solicitudRelacionada:[],isGoogleEvent:!1,isOutlookEvent:!0}},Uh="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",iA="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",aA=({open:e,onClose:t,onConfirm:r,title:n,description:o,icon:s,confirmText:i,confirmColor:a="#d32f2f",loading:c=!1})=>u.jsxs(m.Dialog,{open:e,onClose:t,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[u.jsx(m.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:u.jsx(m.IconButton,{onClick:t,size:"small",children:u.jsx(Hr,{fontSize:"small"})})}),u.jsxs(m.DialogContent,{sx:{textAlign:"center",pt:0},children:[u.jsx(m.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:s}),u.jsx(m.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),u.jsx(m.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),u.jsxs(m.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[u.jsx(m.Button,{variant:"outlined",onClick:t,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),u.jsxs(m.Button,{variant:"contained",onClick:r,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:[i=="Eliminar"&&u.jsx("img",{src:iA,width:15,style:{marginRight:6,marginBottom:2}}),c?"Procesando...":i]})]})]})]}),cA=({userId:e,leads30Days:t,leads90Days:r,disId:n,masNombreBD:o})=>{const[s,i]=v.useState(new Date),[a,c]=v.useState([]),[l,d]=v.useState(!1),[f,h]=v.useState(null),[y,g]=v.useState(!1),[p,b]=v.useState(null),[w,S]=v.useState([]),{enqueueSnackbar:E}=bs.useSnackbar(),C=kc(),_=Ti(),W=_c(),[D,T]=v.useState(!1),[M,I]=v.useState([]),[U,G]=v.useState(null),{session:F,sessionoutlook:Y}=ac(),{googleEvents:se,setGoogleEvents:H,outlookEvents:N,setOutlookEvents:le}=tA(),[de,$]=v.useState([]),[Q,Se]=v.useState([]),[we,he]=v.useState([]),[ae,ue]=v.useState(!1),[J,Ce]=v.useState([]),[me,ee]=v.useState(),Me=(te,_e)=>{I(te),G(_e),T(!0)},j=async()=>{if(e===void 0)return;const te=await C.getNotificacionesXUsuario(e,!1),_e=te[0].evento.nombreAnfitrion;localStorage.setItem("nombreAnfitrion",_e),Ce(te)};v.useEffect(()=>{const te=new Date,_e=x.startOfDay(te),Ie=x.endOfDay(x.addDays(_e,6)),Pe={start:_e,end:Ie},wr=a.filter(ar=>{const Vt={start:ar.fechaInicio,end:ar.fechaFin};return Wd(Vt,Pe)}).sort((ar,Vt)=>ar.fechaInicio.getTime()-Vt.fechaInicio.getTime());S(wr)},[a]),v.useEffect(()=>{const te=async()=>{try{if(e){const Ie=await C.getEventsByUser(e);j(),c(Ie)}}catch(Ie){console.log("Error al cargar eventos locales:",Ie)}};te();const _e=setInterval(te,4e3);return()=>clearInterval(_e)},[e]),v.useEffect(()=>{if(!n||!e)return;const te=[...a];if(se.length>0&&F?.userEmail){const _e=se.map(Ie=>rA(Ie,n,e));te.push(..._e)}if(N.length>0&&Y?.userEmail){const _e=N.map(Ie=>sA(Ie,n,e));te.push(..._e)}$(te)},[a,se,N,n,e,F?.userEmail,Y?.userEmail]);const Fe=async te=>{try{if(te?.isGoogleEvent||te.isOutlookEvent)h(te),d(!0);else{const _e=await C.getEventById(te.eventoID);h(_e),d(!0)}}catch(_e){console.error(_e)}},Ke=()=>{d(!1),h(null)},Ze=async(te,_e)=>{let Ie,Pe;te.todoElDia?(Ie=new Date(`${te.fechaInicio}T${te.horaInicio}`),Pe=new Date(`${te.fechaInicio}T${te.horaFin}`)):(Ie=new Date(`${te.fechaInicio}T${te.horaInicio}`),Pe=te.fechaFin&&te.horaFin?new Date(`${te.fechaFin}T${te.horaFin}`):new Date(`${te.fechaInicio}T${te.horaFin}`));const wr=x.format(Ie,"yyyy-MM-dd HH:mm:ss.SSS"),ar=x.format(Pe,"yyyy-MM-dd HH:mm:ss.SSS");if(_e){const Jr={...te,eventoID:_e,fechaInicio:wr,fechaFin:ar,solID:te.solID??null,disID:n??null,client:te.client,invitados:te.invitados.map(Ye=>({usrNombre:Ye.nombre||Ye.usrNombre,Correo:Ye.correo||Ye.Correo,EsOrganizador:Ye.isHost||Ye.EsOrganizador,StatusInvitacion:Ye.StatusInvitacion,UsuarioID:Ye.usrID||Ye.UsuarioID,disID:Ye.disID||n}))};try{const Ye=await C.updateEvent(Jr);var Vt=a.map(Sr=>Sr.eventoID===Ye.eventoID?Ye:Sr);c(Vt),E("El evento se ha actualizado correctamente.",{variant:"success"}),Ke()}catch{E("Error al actualizar Evento",{variant:"error"})}}else{const Jr={...te,fechaInicio:wr,fechaFin:ar,todoElDia:te.todoElDia,solID:te.solID??null,disID:n??null,client:te.client,invitados:te.invitados.map(Ye=>({usrNombre:Ye.nombre||Ye.usrNombre,Correo:Ye.correo||Ye.Correo,EsOrganizador:Ye.isHost||Ye.EsOrganizador,StatusInvitacion:Ye.StatusInvitacion,UsuarioID:Ye.usrID||Ye.UsuarioID,disID:Ye.disID||n}))};try{const Ye=await C.createEvent(Jr,e);c(Sr=>[...Sr,Ye]),E("El evento se ha creado con éxito",{variant:"success"}),Ke()}catch{E("Error al guardar Evento",{variant:"error"})}}if(e){const Jr=await C.getEventsByUser(e);c(Jr)}},Be=()=>{i(te=>new Date(te.getFullYear(),te.getMonth()-1,1))},Ve=()=>{i(te=>new Date(te.getFullYear(),te.getMonth()+1,1))},et=()=>{fe("ELIMINAR")},ht=()=>{fe("RECHAZAR")},k=()=>{b(new Date),d(!0)},P=te=>{te&&i(te)},B=te=>{b(te),d(!0),h(null)},ce=async()=>{if(f)try{await C.deleteEvent(f.eventoID),c(a.filter(te=>te.eventoID!==f.eventoID)),E("El evento se ha eliminado de tu calendario",{content:(te,_e)=>u.jsx(Jc,{id:te,message:String(_e),variant:"delete"})})}catch{E("Error al eliminar Evento",{variant:"error"})}finally{Ke(),ke()}},ie=async()=>{if(!(!F?.userEmail||!n)){ue(!0);try{const _e=(await _.getGoogleCalendars(F.userEmail,n)).map(Pe=>({...Pe,selected:!0}));Se(_e);const Ie=_e.map(Pe=>Pe.id);Ne(Ie)}catch(te){console.error("Error Google Cals:",te)}finally{ue(!1)}}},O=async te=>{const _e=Q.map(Pe=>Pe.id===te?{...Pe,selected:!Pe.selected}:Pe);Se(_e);const Ie=_e.filter(Pe=>Pe.selected).map(Pe=>Pe.id);Ne(Ie)},oe=async()=>{if(!(!Y?.userEmail||!n)){ue(!0);try{const _e=(await W.getOutlookCalendars(Y.userEmail,n)).map(Pe=>({...Pe,selected:!0}));he(_e);const Ie=_e.map(Pe=>Pe.id);R(Ie)}catch(te){console.error("Error Outlook Cals:",te)}finally{ue(!1)}}},Ee=async te=>{const _e=we.map(Pe=>Pe.id===te?{...Pe,selected:!Pe.selected}:Pe);he(_e);const Ie=_e.filter(Pe=>Pe.selected).map(Pe=>Pe.id);R(Ie)};v.useEffect(()=>{ie()},[F?.userEmail,n]),v.useEffect(()=>{oe()},[Y?.userEmail,n]);const Ne=async te=>{if(!F?.userEmail||!n)return;const _e=te||Q.filter(Ie=>Ie.selected).map(Ie=>Ie.id);try{const Ie={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:F.userEmail,calendarIds:_e},Pe=await _.getGoogleEventsByMonth(Ie);H(Pe)}catch(Ie){console.error("Error al obtener eventos de Google:",Ie)}},R=async te=>{if(!Y?.userEmail||!n)return;const _e=te||we.filter(Ie=>Ie.selected).map(Ie=>Ie.id);try{const Ie={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:Y.userEmail,calendarIds:_e},Pe=await W.getOutlookEventsByMonth(Ie);le(Pe)}catch(Ie){console.error("Error al obtener eventos de Outlook:",Ie)}};if(n===void 0||e===void 0)return u.jsx("div",{children:"Cargando configuración de usuario..."});const re=async(te,_e)=>{await C.UpdateStatusEvento(te.evento.eventoID,e,_e)&&(await C.MarcarLeido(te.notificacionID,e),E(te?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},xe=async()=>{me&&C.UpdateStatusEvento(me.evento.eventoID,e,"RECHAZADA")&&(await C.MarcarLeido(me.notificacionID,e),await C.MarcarLeido(me.notificacionID,e),E("Haz rechazado la Invitación a "+me?.evento?.titulo,{content:(_e,Ie)=>u.jsx(Jc,{id:_e,message:String(Ie),variant:"rechazar"})}),ke())},Ge=async(te,_e)=>{try{if(!e)return;ee(te),_e=="RECHAZADA"?(ht(),console.log("noti",te)):re(te,_e)}catch{E("Error al procesar la invitación",{variant:"error"})}},At=async te=>{try{if(!f)return;await C.ReenviarNotificacion(f?.eventoID,te),E("Invitación enviada con éxito",{variant:"success"})}catch(_e){console.error("Error al conectar con la API",_e)}},[q,fe]=v.useState(null),ke=()=>fe(null),Oe={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:u.jsxs(u.Fragment,{children:["Estás a punto de declinar la invitación de ",u.jsx("strong",{children:me?.evento?.nombreAnfitrion})," a ",u.jsx("strong",{children:me?.evento?.titulo})]}),icon:u.jsx("img",{src:Uh}),action:()=>me&&xe()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:u.jsx("img",{src:Uh}),action:()=>ce()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>ce}},je=q?Oe[q]:null;return u.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[u.jsx(cy,{header:u.jsx(k2,{currentDate:s,onPrevMonth:Be,onNextMonth:Ve,onAddEvent:k,onDateChange:P}),sidebar:u.jsx(aw,{onEventClick:Fe,upcomingEvents:w,leads30Days:t,leads90Days:r,disID:n,usrID:e,onAddEvent:k,googleCalendars:Q,outlookCalendars:we,isLoadingCalendars:ae,onToggleGoogle:O,onToggleOutlook:Ee,notifications:J,unreadCount:J?.filter(te=>!te.leida).length,onAceppInvitacion:Ge}),mainContent:u.jsx(_w,{onSeeMoreClick:Me,currentDate:s,events:de,onDayClick:B,onEventClick:Fe})}),l&&u.jsx(Uk,{isVisible:l,onClose:Ke,onSave:Ze,onDelete:et,selectedDate:p,initialEvent:f,userId:e,masNombreBD:o,disId:n,onReenviar:At}),u.jsx(Vk,{isOpen:D,onClose:()=>T(!1),events:M,date:U,onEventClick:Fe}),je&&u.jsx(aA,{open:!!q,onClose:ke,onConfirm:()=>{je.action()},title:je.title,description:je.description,icon:je.icon,confirmText:je.confirmText})]})},lA="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",uA="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 el(e,t,r){return e.accessor?e.accessor(t,r):e.field?t?.[e.field]:t?.[e?.key||""]}function dA(e,t){const r=e??"",n=t??"";return r instanceof Date&&n instanceof Date?r.getTime()-n.getTime():typeof r=="number"&&typeof n=="number"?r-n:typeof r=="boolean"&&typeof n=="boolean"?Number(r)-Number(n):String(r).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function tl(e,t,r=!0){return typeof e=="function"?e(t):e??r}function fA(e){return e.replace(/[^\d]/g,"")}function pA(e,t){return t}var is={},Hh;function hA(){if(Hh)return is;Hh=1;var e=ut();Object.defineProperty(is,"__esModule",{value:!0}),is.default=void 0;var t=e(gt()),r=pt();return is.default=(0,t.default)((0,r.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"),is}var mA=hA();const gA=lt(mA);var as={},Vh;function vA(){if(Vh)return as;Vh=1;var e=ut();Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var t=e(gt()),r=pt();return as.default=(0,t.default)((0,r.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"),as}var yA=vA();const bA=lt(yA);var cs={},Yh;function xA(){if(Yh)return cs;Yh=1;var e=ut();Object.defineProperty(cs,"__esModule",{value:!0}),cs.default=void 0;var t=e(gt()),r=pt();return cs.default=(0,t.default)((0,r.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),cs}var _A=xA();const wA=lt(_A);var ls={},qh;function SA(){if(qh)return ls;qh=1;var e=ut();Object.defineProperty(ls,"__esModule",{value:!0}),ls.default=void 0;var t=e(gt()),r=pt();return ls.default=(0,t.default)((0,r.jsx)("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),ls}var CA=SA();const EA=lt(CA);function Zh(e){return e==="right"?"end":e==="center"?"center":"start"}function Gh(e){const t=e.filter(r=>!r.width).length||1;return e.map(r=>typeof r.width=="number"?`${r.width}px`:typeof r.width=="string"?r.width:`minmax(0, ${1/t}fr)`).join(" ")}const DA=1060,rl=(e,t)=>e.metrics.find(r=>String(r.label).toLowerCase()===t.toLowerCase())?.value??"";function kA({sections:e,detailColumns:t,summaryWidths:r=["1fr",120,120,150],minWidth:n=DA,getDetailColumns:o,onRowClick:s}){function c(d){if(typeof d=="number")return d;if(!d)return 0;const f=/^(\d+)\s*px$/.exec(d.trim());return f?Number(f[1]):/fr$/i.test(d)?160:0}function l(d){const f=d.reduce((g,p)=>g+c(p.width),0),h=Math.max(d.length-1,0)*16;return f+h+32}return u.jsx(m.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:u.jsxs(m.Box,{children:[u.jsx(m.Box,{sx:{display:"grid",gridTemplateColumns:r.map(d=>typeof d=="number"?`${d}px`:d).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"#1E5BCE",color:"#fff",boxSizing:"border-box"},children:["Tipo","En Proceso","Finalizadas","Último seg."].map(d=>u.jsx(m.Typography,{sx:{fontSize:13,fontWeight:800},children:d},d))}),e.map((d,f)=>{const[h,y]=K.useState(!!d.initiallyOpen),g=f%2===1,p=o?o(d):t,b=Math.max(n,l(p));return u.jsxs(m.Box,{children:[u.jsxs(m.Box,{sx:{display:"grid",gridTemplateColumns:r.map(w=>typeof w=="number"?`${w}px`:w).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:g?"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:()=>y(w=>!w),children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[u.jsx(m.IconButton,{size:"small",disableRipple:!0,children:h?u.jsx(EA,{}):u.jsx(wA,{})}),u.jsx(m.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(d.title),children:d.title})]}),u.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:rl(d,"En Proceso")}),u.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:rl(d,"Finalizadas")}),u.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:rl(d,"Último seg.")})]}),u.jsx(m.Collapse,{in:h,unmountOnExit:!0,children:u.jsxs(m.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[u.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Gh(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(w=>u.jsx(m.Typography,{sx:{justifySelf:Zh(w.align),textAlign:w.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:w.header},w.key))}),(d.rows??[]).map((w,S)=>u.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Gh(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:()=>s?.(w,d),children:p.map((E,C)=>{const _=E.accessor?E.accessor(w,S):E.field?w[E.field]:null;return u.jsx(m.Box,{sx:{justifySelf:Zh(E.align),textAlign:E.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof _=="string"||typeof _=="number"?u.jsx(m.Typography,{sx:{fontSize:13,fontWeight:/^(estatus|seg|avance|nivel|asesor|fecha)$/i.test(E.key)?700:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(_),children:_}):_},E.key??C)})},w.id??S))]})})]},d.id)})]})})}var us={},Kh;function AA(){if(Kh)return us;Kh=1;var e=ut();Object.defineProperty(us,"__esModule",{value:!0}),us.default=void 0;var t=e(gt()),r=pt();return us.default=(0,t.default)((0,r.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"),us}var TA=AA();const IA=lt(TA),MA=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",PA=e=>{const t=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return t||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},OA=e=>{const t=(e||"").split(" ").filter(Boolean);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var ds={},Qh;function jA(){if(Qh)return ds;Qh=1;var e=ut();Object.defineProperty(ds,"__esModule",{value:!0}),ds.default=void 0;var t=e(gt()),r=pt();return ds.default=(0,t.default)((0,r.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"),ds}var RA=jA();const NA=lt(RA),nl=({current:e=0,total:t=0,color:r="#4caf50"})=>u.jsx("div",{style:{display:"flex",gap:"1px",width:"100%",height:"100%",justifyContent:"center",overflow:"hidden",minWidth:0},children:Array.from({length:t}).map((n,o)=>u.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?r:"#e0e0e0",display:"flex"}},o))});var fs={},Xh;function $A(){if(Xh)return fs;Xh=1;var e=ut();Object.defineProperty(fs,"__esModule",{value:!0}),fs.default=void 0;var t=e(gt()),r=pt();return fs.default=(0,t.default)((0,r.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),fs}var LA=$A();const Jh=lt(LA);var ps={},e0;function zA(){if(e0)return ps;e0=1;var e=ut();Object.defineProperty(ps,"__esModule",{value:!0}),ps.default=void 0;var t=e(gt()),r=pt();return ps.default=(0,t.default)((0,r.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),ps}var BA=zA();const FA=lt(BA),WA=e=>{const t=String(e??"").toLowerCase().trim();return t==="muy interesado"?{bg:"#E53935",color:"#FFFFFF"}:t==="interesado"?{bg:"#FB8C00",color:"#FFFFFF"}:t==="venta definitiva"?{bg:"#2E7D32",color:"#FFFFFF"}:t==="no sé"||t==="no se"?{bg:"#9E9E9E",color:"#FFFFFF"}:t==="algo interesado"?{bg:"#FFEB3B",color:"#000000"}:{bg:"transparent",color:"#2c2c2c"}},UA=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}},HA=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}},VA=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 YA(e){const t=new Date(e),r=t.toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),n=t.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"});return`${r.replace(".","")} • ${n}`}function qA(e){return e.replace(/<br\s*\/?>/gi,`
177
+ `)}y.write("payload.value = newResult;"),y.write("return payload;");const S=y.compile();return(E,C)=>S(h,E,C)};let s;const i=Bi,a=!Pp.jitless,l=a&&Yw.value,d=t.catchall;let f;e._zod.parse=(h,y)=>{f??(f=n.value);const g=h.value;return i(g)?a&&l&&y?.async===!1&&y.jitless!==!0?(s||(s=o(t.shape)),h=s(h,y),d?Kp([],g,h,y,f,e):h):r(h,y):(h.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),h)}});function Qp(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Jn(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>An(i,n,kn())))}),t)}const NC=Z("$ZodUnion",(e,t)=>{Pt.init(e,t),vt(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),vt(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),vt(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),vt(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Hc(s.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let i=!1;const a=[];for(const c of t.options){const l=c._zod.run({value:o.value,issues:[]},s);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(c=>Qp(c,o,e,s)):Qp(a,o,e,s)}}),$C=Z("$ZodIntersection",(e,t)=>{Pt.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,l])=>Xp(r,c,l)):Xp(r,s,i)}});function Zc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Go(e)&&Go(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(const s of n){const i=Zc(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],s=t[n],i=Zc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Xp(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Jn(e))return e;const n=Zc(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const LC=Z("$ZodEnum",(e,t)=>{Pt.init(e,t);const r=Uw(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>qw.has(typeof o)).map(o=>typeof o=="string"?Xn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),zC=Z("$ZodLiteral",(e,t)=>{if(Pt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Xn(r):r?Xn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,n)=>{const o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),BC=Z("$ZodTransform",(e,t)=>{Pt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mp(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Kn;return r.value=o,r}});function Jp(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const FC=Z("$ZodOptional",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",vt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),vt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Hc(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Jp(s,r.value)):Jp(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),WC=Z("$ZodNullable",(e,t)=>{Pt.init(e,t),vt(e._zod,"optin",()=>t.innerType._zod.optin),vt(e._zod,"optout",()=>t.innerType._zod.optout),vt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Hc(r.source)}|null)$`):void 0}),vt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),UC=Z("$ZodDefault",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",vt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>eh(s,t)):eh(o,t)}});function eh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const HC=Z("$ZodPrefault",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",vt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),VC=Z("$ZodNonOptional",(e,t)=>{Pt.init(e,t),vt(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>th(s,e)):th(o,e)}});function th(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const YC=Z("$ZodCatch",(e,t)=>{Pt.init(e,t),vt(e._zod,"optin",()=>t.innerType._zod.optin),vt(e._zod,"optout",()=>t.innerType._zod.optout),vt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>An(i,n,kn()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>An(s,n,kn()))},input:r.value}),r.issues=[]),r)}}),qC=Z("$ZodPipe",(e,t)=>{Pt.init(e,t),vt(e._zod,"values",()=>t.in._zod.values),vt(e._zod,"optin",()=>t.in._zod.optin),vt(e._zod,"optout",()=>t.out._zod.optout),vt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Gi(i,t.in,n)):Gi(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Gi(s,t.out,n)):Gi(o,t.out,n)}});function Gi(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const ZC=Z("$ZodReadonly",(e,t)=>{Pt.init(e,t),vt(e._zod,"propValues",()=>t.innerType._zod.propValues),vt(e._zod,"values",()=>t.innerType._zod.values),vt(e._zod,"optin",()=>t.innerType._zod.optin),vt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(rh):rh(o)}});function rh(e){return e.value=Object.freeze(e.value),e}const GC=Z("$ZodCustom",(e,t)=>{ir.init(e,t),Pt.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>nh(s,r,n,e));nh(o,r,n,e)}});function nh(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ko(o))}}class KC{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function QC(){return new KC}const Ki=QC();function XC(e,t){return new e({type:"string",...Ae(t)})}function JC(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ae(t)})}function oh(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ae(t)})}function eE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ae(t)})}function tE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ae(t)})}function rE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ae(t)})}function nE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ae(t)})}function oE(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ae(t)})}function sE(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ae(t)})}function iE(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ae(t)})}function aE(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ae(t)})}function cE(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ae(t)})}function lE(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ae(t)})}function uE(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ae(t)})}function dE(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ae(t)})}function fE(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ae(t)})}function pE(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ae(t)})}function hE(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ae(t)})}function mE(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ae(t)})}function gE(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ae(t)})}function vE(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ae(t)})}function yE(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ae(t)})}function bE(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ae(t)})}function xE(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ae(t)})}function _E(e,t){return new e({type:"string",format:"date",check:"string_format",...Ae(t)})}function wE(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ae(t)})}function SE(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ae(t)})}function CE(e,t){return new e({type:"number",checks:[],...Ae(t)})}function EE(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ae(t)})}function DE(e,t){return new e({type:"boolean",...Ae(t)})}function kE(e){return new e({type:"unknown"})}function AE(e,t){return new e({type:"never",...Ae(t)})}function sh(e,t){return new Hp({check:"less_than",...Ae(t),value:e,inclusive:!1})}function Gc(e,t){return new Hp({check:"less_than",...Ae(t),value:e,inclusive:!0})}function ih(e,t){return new Vp({check:"greater_than",...Ae(t),value:e,inclusive:!1})}function Kc(e,t){return new Vp({check:"greater_than",...Ae(t),value:e,inclusive:!0})}function ah(e,t){return new HS({check:"multiple_of",...Ae(t),value:e})}function ch(e,t){return new YS({check:"max_length",...Ae(t),maximum:e})}function Qi(e,t){return new qS({check:"min_length",...Ae(t),minimum:e})}function lh(e,t){return new ZS({check:"length_equals",...Ae(t),length:e})}function TE(e,t){return new GS({check:"string_format",format:"regex",...Ae(t),pattern:e})}function IE(e){return new KS({check:"string_format",format:"lowercase",...Ae(e)})}function ME(e){return new QS({check:"string_format",format:"uppercase",...Ae(e)})}function PE(e,t){return new XS({check:"string_format",format:"includes",...Ae(t),includes:e})}function OE(e,t){return new JS({check:"string_format",format:"starts_with",...Ae(t),prefix:e})}function jE(e,t){return new eC({check:"string_format",format:"ends_with",...Ae(t),suffix:e})}function Qo(e){return new tC({check:"overwrite",tx:e})}function RE(e){return Qo(t=>t.normalize(e))}function NE(){return Qo(e=>e.trim())}function $E(){return Qo(e=>e.toLowerCase())}function LE(){return Qo(e=>e.toUpperCase())}function zE(e,t,r){return new e({type:"array",element:t,...Ae(r)})}function BE(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Ae(r)})}function FE(e){const t=WE(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ko(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Ko(o))}},e(r.value,r)));return t}function WE(e,t){const r=new ir({check:"custom",...Ae(t)});return r._zod.check=e,r}function uh(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function UE(e,t){for(var r={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:s,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=Nc(i,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function HE(e,t){for(var r={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!r[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[i]={message:a.message,type:a.code}}else r[i]={message:s,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(d){return d.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=Nc(i,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function VE(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,s){try{return Promise.resolve(uh(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(i){return s.shouldUseNativeValidation&&Bc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:Tp(UE(i.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw i}))}catch(i){return Promise.reject(i)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,s){try{return Promise.resolve(uh(function(){return Promise.resolve((r.mode==="sync"?sS:iS)(e,n,t)).then(function(i){return s.shouldUseNativeValidation&&Bc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof Yc})(i))return{values:{},errors:Tp(HE(i.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw i}))}catch(i){return Promise.reject(i)}};throw new Error("Invalid input: not a Zod schema")}const YE=Z("ZodISODateTime",(e,t)=>{mC.init(e,t),kt.init(e,t)});function qE(e){return xE(YE,e)}const ZE=Z("ZodISODate",(e,t)=>{gC.init(e,t),kt.init(e,t)});function GE(e){return _E(ZE,e)}const KE=Z("ZodISOTime",(e,t)=>{vC.init(e,t),kt.init(e,t)});function QE(e){return wE(KE,e)}const XE=Z("ZodISODuration",(e,t)=>{yC.init(e,t),kt.init(e,t)});function JE(e){return SE(XE,e)}const xr=Z("ZodError",(e,t)=>{Yc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>oS(e,r)},flatten:{value:r=>nS(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Fc,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Fc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),eD=Ui(xr),tD=Hi(xr),rD=Vi(xr),nD=Yi(xr),oD=lS(xr),sD=uS(xr),iD=dS(xr),aD=fS(xr),cD=pS(xr),lD=hS(xr),uD=mS(xr),dD=gS(xr),zt=Z("ZodType",(e,t)=>(Pt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>ln(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>eD(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>rD(e,r,n),e.parseAsync=async(r,n)=>tD(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>nD(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>oD(e,r,n),e.decode=(r,n)=>sD(e,r,n),e.encodeAsync=async(r,n)=>iD(e,r,n),e.decodeAsync=async(r,n)=>aD(e,r,n),e.safeEncode=(r,n)=>cD(e,r,n),e.safeDecode=(r,n)=>lD(e,r,n),e.safeEncodeAsync=async(r,n)=>uD(e,r,n),e.safeDecodeAsync=async(r,n)=>dD(e,r,n),e.refine=(r,n)=>e.check(nk(r,n)),e.superRefine=r=>e.check(ok(r)),e.overwrite=r=>e.check(Qo(r)),e.optional=()=>xh(e),e.nullable=()=>_h(e),e.nullish=()=>xh(_h(e)),e.nonoptional=r=>KD(e,r),e.array=()=>gh(e),e.or=r=>LD([e,r]),e.and=r=>BD(e,r),e.transform=r=>Sh(e,HD(r)),e.default=r=>qD(e,r),e.prefault=r=>GD(e,r),e.catch=r=>XD(e,r),e.pipe=r=>Sh(e,r),e.readonly=()=>tk(e),e.describe=r=>{const n=e.clone();return Ki.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ki.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ki.get(e);const n=e.clone();return Ki.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),dh=Z("_ZodString",(e,t)=>{qc.init(e,t),zt.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(TE(...n)),e.includes=(...n)=>e.check(PE(...n)),e.startsWith=(...n)=>e.check(OE(...n)),e.endsWith=(...n)=>e.check(jE(...n)),e.min=(...n)=>e.check(Qi(...n)),e.max=(...n)=>e.check(ch(...n)),e.length=(...n)=>e.check(lh(...n)),e.nonempty=(...n)=>e.check(Qi(1,...n)),e.lowercase=n=>e.check(IE(n)),e.uppercase=n=>e.check(ME(n)),e.trim=()=>e.check(NE()),e.normalize=(...n)=>e.check(RE(...n)),e.toLowerCase=()=>e.check($E()),e.toUpperCase=()=>e.check(LE())}),fD=Z("ZodString",(e,t)=>{qc.init(e,t),dh.init(e,t),e.email=r=>e.check(JC(pD,r)),e.url=r=>e.check(oE(hD,r)),e.jwt=r=>e.check(bE(TD,r)),e.emoji=r=>e.check(sE(mD,r)),e.guid=r=>e.check(oh(fh,r)),e.uuid=r=>e.check(eE(Xi,r)),e.uuidv4=r=>e.check(tE(Xi,r)),e.uuidv6=r=>e.check(rE(Xi,r)),e.uuidv7=r=>e.check(nE(Xi,r)),e.nanoid=r=>e.check(iE(gD,r)),e.guid=r=>e.check(oh(fh,r)),e.cuid=r=>e.check(aE(vD,r)),e.cuid2=r=>e.check(cE(yD,r)),e.ulid=r=>e.check(lE(bD,r)),e.base64=r=>e.check(gE(DD,r)),e.base64url=r=>e.check(vE(kD,r)),e.xid=r=>e.check(uE(xD,r)),e.ksuid=r=>e.check(dE(_D,r)),e.ipv4=r=>e.check(fE(wD,r)),e.ipv6=r=>e.check(pE(SD,r)),e.cidrv4=r=>e.check(hE(CD,r)),e.cidrv6=r=>e.check(mE(ED,r)),e.e164=r=>e.check(yE(AD,r)),e.datetime=r=>e.check(qE(r)),e.date=r=>e.check(GE(r)),e.time=r=>e.check(QE(r)),e.duration=r=>e.check(JE(r))});function _r(e){return XC(fD,e)}const kt=Z("ZodStringFormat",(e,t)=>{St.init(e,t),dh.init(e,t)}),pD=Z("ZodEmail",(e,t)=>{iC.init(e,t),kt.init(e,t)}),fh=Z("ZodGUID",(e,t)=>{oC.init(e,t),kt.init(e,t)}),Xi=Z("ZodUUID",(e,t)=>{sC.init(e,t),kt.init(e,t)}),hD=Z("ZodURL",(e,t)=>{aC.init(e,t),kt.init(e,t)}),mD=Z("ZodEmoji",(e,t)=>{cC.init(e,t),kt.init(e,t)}),gD=Z("ZodNanoID",(e,t)=>{lC.init(e,t),kt.init(e,t)}),vD=Z("ZodCUID",(e,t)=>{uC.init(e,t),kt.init(e,t)}),yD=Z("ZodCUID2",(e,t)=>{dC.init(e,t),kt.init(e,t)}),bD=Z("ZodULID",(e,t)=>{fC.init(e,t),kt.init(e,t)}),xD=Z("ZodXID",(e,t)=>{pC.init(e,t),kt.init(e,t)}),_D=Z("ZodKSUID",(e,t)=>{hC.init(e,t),kt.init(e,t)}),wD=Z("ZodIPv4",(e,t)=>{bC.init(e,t),kt.init(e,t)}),SD=Z("ZodIPv6",(e,t)=>{xC.init(e,t),kt.init(e,t)}),CD=Z("ZodCIDRv4",(e,t)=>{_C.init(e,t),kt.init(e,t)}),ED=Z("ZodCIDRv6",(e,t)=>{wC.init(e,t),kt.init(e,t)}),DD=Z("ZodBase64",(e,t)=>{SC.init(e,t),kt.init(e,t)}),kD=Z("ZodBase64URL",(e,t)=>{EC.init(e,t),kt.init(e,t)}),AD=Z("ZodE164",(e,t)=>{DC.init(e,t),kt.init(e,t)}),TD=Z("ZodJWT",(e,t)=>{AC.init(e,t),kt.init(e,t)}),ph=Z("ZodNumber",(e,t)=>{qp.init(e,t),zt.init(e,t),e.gt=(n,o)=>e.check(ih(n,o)),e.gte=(n,o)=>e.check(Kc(n,o)),e.min=(n,o)=>e.check(Kc(n,o)),e.lt=(n,o)=>e.check(sh(n,o)),e.lte=(n,o)=>e.check(Gc(n,o)),e.max=(n,o)=>e.check(Gc(n,o)),e.int=n=>e.check(hh(n)),e.safe=n=>e.check(hh(n)),e.positive=n=>e.check(ih(0,n)),e.nonnegative=n=>e.check(Kc(0,n)),e.negative=n=>e.check(sh(0,n)),e.nonpositive=n=>e.check(Gc(0,n)),e.multipleOf=(n,o)=>e.check(ah(n,o)),e.step=(n,o)=>e.check(ah(n,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Ji(e){return CE(ph,e)}const ID=Z("ZodNumberFormat",(e,t)=>{TC.init(e,t),ph.init(e,t)});function hh(e){return EE(ID,e)}const MD=Z("ZodBoolean",(e,t)=>{IC.init(e,t),zt.init(e,t)});function ea(e){return DE(MD,e)}const PD=Z("ZodUnknown",(e,t)=>{MC.init(e,t),zt.init(e,t)});function mh(){return kE(PD)}const OD=Z("ZodNever",(e,t)=>{PC.init(e,t),zt.init(e,t)});function jD(e){return AE(OD,e)}const RD=Z("ZodArray",(e,t)=>{OC.init(e,t),zt.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Qi(r,n)),e.nonempty=r=>e.check(Qi(1,r)),e.max=(r,n)=>e.check(ch(r,n)),e.length=(r,n)=>e.check(lh(r,n)),e.unwrap=()=>e.element});function gh(e,t){return zE(RD,e,t)}const ND=Z("ZodObject",(e,t)=>{RC.init(e,t),zt.init(e,t),vt(e,"shape",()=>t.shape),e.keyof=()=>yh(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:mh()}),e.loose=()=>e.clone({...e._zod.def,catchall:mh()}),e.strict=()=>e.clone({...e._zod.def,catchall:jD()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Xw(e,r),e.safeExtend=r=>Jw(e,r),e.merge=r=>eS(e,r),e.pick=r=>Kw(e,r),e.omit=r=>Qw(e,r),e.partial=(...r)=>tS(bh,e,r[0]),e.required=(...r)=>rS(wh,e,r[0])});function vh(e,t){const r={type:"object",get shape(){return cn(this,"shape",e?Vw(e):{}),this.shape},...Ae(t)};return new ND(r)}const $D=Z("ZodUnion",(e,t)=>{NC.init(e,t),zt.init(e,t),e.options=t.options});function LD(e,t){return new $D({type:"union",options:e,...Ae(t)})}const zD=Z("ZodIntersection",(e,t)=>{$C.init(e,t),zt.init(e,t)});function BD(e,t){return new zD({type:"intersection",left:e,right:t})}const Qc=Z("ZodEnum",(e,t)=>{LC.init(e,t),zt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Qc({...t,checks:[],...Ae(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Qc({...t,checks:[],...Ae(o),entries:s})}});function yh(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Qc({type:"enum",entries:r,...Ae(t)})}const FD=Z("ZodLiteral",(e,t)=>{zC.init(e,t),zt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function WD(e,t){return new FD({type:"literal",values:Array.isArray(e)?e:[e],...Ae(t)})}const UD=Z("ZodTransform",(e,t)=>{BC.init(e,t),zt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mp(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Ko(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Ko(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function HD(e){return new UD({type:"transform",transform:e})}const bh=Z("ZodOptional",(e,t)=>{FC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xh(e){return new bh({type:"optional",innerType:e})}const VD=Z("ZodNullable",(e,t)=>{WC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _h(e){return new VD({type:"nullable",innerType:e})}const YD=Z("ZodDefault",(e,t)=>{UC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qD(e,t){return new YD({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Np(t)}})}const ZD=Z("ZodPrefault",(e,t)=>{HC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function GD(e,t){return new ZD({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Np(t)}})}const wh=Z("ZodNonOptional",(e,t)=>{VC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function KD(e,t){return new wh({type:"nonoptional",innerType:e,...Ae(t)})}const QD=Z("ZodCatch",(e,t)=>{YC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function XD(e,t){return new QD({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const JD=Z("ZodPipe",(e,t)=>{qC.init(e,t),zt.init(e,t),e.in=t.in,e.out=t.out});function Sh(e,t){return new JD({type:"pipe",in:e,out:t})}const ek=Z("ZodReadonly",(e,t)=>{ZC.init(e,t),zt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function tk(e){return new ek({type:"readonly",innerType:e})}const rk=Z("ZodCustom",(e,t)=>{GC.init(e,t),zt.init(e,t)});function nk(e,t={}){return BE(rk,e,t)}function ok(e){return FE(e)}const Ch=/^([01][0-9]|2[0-3]):[0-5][0-9]$/,Eh=(e,t)=>{if(!e||!t)return null;const r=e.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),o=parseInt(r[1],10)-1,s=parseInt(r[2],10),i=t.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),l=new Date(n,o,s,a,c);return isNaN(l.getTime())||!x.isValid(l)?null:l},sk=vh({UsuarioID:Ji().nullable().optional(),disID:Ji().nullable().optional(),EsOrganizador:ea().default(!1),Correo:_r().email("Formato de correo inválido"),StatusInvitacion:yh(["PENDIENTE","CONFIRMADA","RECHAZADA"]).default("PENDIENTE")}),ik=vh({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(Ch,{message:"Formato inválido"}),horaFin:_r().min(1,"La hora fin es requerida.").regex(Ch,{message:"Formato inválido"}),todoElDia:ea(),fechaFin:_r().optional(),showEndDate:ea().optional(),horaInicio2:_r().optional(),TodoElDia2:ea().optional(),client:_r().nullable().optional(),repetir:_r().optional(),link:_r().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(WD("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:_r().optional(),invitados:gh(sk).optional().default([]),color:_r().optional(),solID:Ji().nullable().optional(),disID:Ji().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 t=Eh(e.fechaInicio,e.horaInicio),r=Eh(e.fechaFin,e.horaFin);return!t||!r||!x.isValid(t)||!x.isValid(r)?!0:!(x.isBefore(r,t)&&!x.isSameDay(r,t)||x.isSameDay(t,r)&&x.isBefore(r,t))},{message:"",path:["horaFin"]}),Dh=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.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"}),K.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"})),ak="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",ck=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.createElement("g",{clipPath:"url(#a)"},K.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"})),K.createElement("defs",null,K.createElement("clipPath",{id:"a"},K.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),kh="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",lk=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.createElement("g",{fill:"#2571D6",clipPath:"url(#a)"},K.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"}),K.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"}),K.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"})),K.createElement("defs",null,K.createElement("clipPath",{id:"a"},K.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),uk="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",dk=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.createElement("path",{fill:"#2571D6",fillRule:"evenodd",d:"M17.333 11a6.34 6.34 0 0 1 6.334 6.333 6.34 6.34 0 0 1-6.334 6.334c-3.493 0-6.333-2.846-6.333-6.334A6.343 6.343 0 0 1 17.333 11m-.005 2.37c-.437 0-.79.338-.79.754v2.412h-2.414c-.416 0-.754.355-.754.792s.338.792.754.792h2.413v2.412c0 .416.354.754.791.754s.792-.338.792-.754V18.12h2.413c.416 0 .754-.355.754-.792s-.338-.792-.754-.792H18.12v-2.412c0-.416-.355-.754-.792-.754",clipRule:"evenodd"}),K.createElement("path",{fill:"#2571D6",d:"M11.12 12.297a7.97 7.97 0 0 0-1.787 5.036c0 1.763.571 3.392 1.537 4.714H3.044c-.84 0-1.523-.682-1.523-1.523 0-4.544 3.683-8.227 8.217-8.227zM10.995.139c2.925 0 5.3 2.376 5.3 5.3s-2.376 5.3-5.3 5.3v-.01a5.303 5.303 0 0 1-5.3-5.3 5.295 5.295 0 0 1 5.3-5.29"}));var Xo={},Ah;function fk(){if(Ah)return Xo;Ah=1;var e=ut();Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.default=void 0;var t=e(gt()),r=pt();return Xo.default=(0,t.default)((0,r.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),Xo}var pk=fk();const Th=lt(pk);var Jo={},Ih;function hk(){if(Ih)return Jo;Ih=1;var e=ut();Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.default=void 0;var t=e(gt()),r=pt();return Jo.default=(0,t.default)((0,r.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),Jo}var mk=hk();const gk=lt(mk),Mh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC",Ph="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",vk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAGFBMVEUAAAAAfFQAflYAfVYAfVUAfFQAcFAAfVbb6xt6AAAAB3RSTlMAIN98m0wQyLlfvgAAAE1JREFUGNNjoAgwmiJxhMoDEBLq5QZIEkUCSBKKeCXYYBJgMQeEBHN5CUIHa3m5A8Io8/ISiAREHRAAJWBSSHYwgyXgUjAJsIGGpPkcAJCLE29yhAT7AAAAAElFTkSuQmCC",yk=e=>{const t=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],r=e.charCodeAt(0)%t.length;return t[r]},bk=(e,t,r,n,o)=>{if(t)return u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[u.jsx("img",{src:Ph,width:15,style:{marginRight:"5px"}}),u.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return u.jsx(m.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return u.jsx(m.Button,{onClick:()=>{n(r),o()},variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"});case"CONFIRMADA":return u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[u.jsx("img",{src:vk,width:15,style:{marginRight:"5px"}}),u.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Asistiré"})]});default:return null}};function xk({open:e,handleClose:t,guests:r,onReenviar:n}){const o=r.filter(l=>l.estatus==="CONFIRMADA"||l.isHost),s=r.filter(l=>l.estatus==="PENDIENTE"&&!l.isHost),i=r.filter(l=>l.estatus==="RECHAZADA"&&!l.isHost),a=l=>u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[u.jsxs(m.Box,{sx:{position:"relative",mr:2},children:[u.jsx(m.Avatar,{sx:{bgcolor:yk(l.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:l.iniciales}),l.estatus==="PENDIENTE"&&u.jsx(m.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:u.jsx(Ac,{sx:{fontSize:14,color:"#546E7A"}})})]}),u.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:l.nombre}),bk(l.estatus,l.isHost,l.usrID,n,t)]},l.nombre),c=({title:l,count:d,badgeColor:f})=>u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[u.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:l}),f&&u.jsx(m.Box,{sx:{ml:1,bgcolor:f,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:d})]});return u.jsxs(m.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[u.jsxs(m.Box,{sx:{p:"16px 8px"},children:[u.jsx(m.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),u.jsx(m.Button,{onClick:t,startIcon:u.jsx("img",{src:Mh,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),u.jsx(m.IconButton,{onClick:t,sx:{position:"absolute",right:8,top:12},children:u.jsx(Hr,{})})]}),u.jsx(m.Divider,{sx:{backgroundColor:"black"}}),u.jsxs(m.DialogContent,{sx:{p:2},children:[s.length>0&&u.jsxs(m.Box,{sx:{mb:3},children:[u.jsx(c,{title:"Invitados",count:s.length}),s.map(a)]}),o.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),u.jsxs(m.Box,{sx:{mb:3},children:[u.jsx(c,{title:"Confirmados",count:o.length,badgeColor:"#1976D2"}),o.map(a)]})]}),i.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),u.jsxs(m.Box,{children:[u.jsx(c,{title:"No asistirán",count:i.length,badgeColor:"#1976D2"}),i.map(a)]})]})]})]})}const _k=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function wk({guests:e,onReenviar:t}){const[r,n]=v.useState(!1),o=()=>n(!0),s=()=>n(!1);return u.jsxs(u.Fragment,{children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[u.jsx(m.AvatarGroup,{max:6,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,a)=>u.jsx(m.Tooltip,{title:i.nombre,arrow:!0,placement:"top",children:u.jsx(m.Box,{children:u.jsx(m.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:i.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:u.jsx(m.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:u.jsx("img",{src:Xf})}),children:u.jsx(m.Avatar,{sx:{bgcolor:_k(i.iniciales)},children:i.iniciales})})})},a))}),u.jsx(m.Box,{sx:{flexGrow:1}}),u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:o,children:[u.jsx(m.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),u.jsx(gk,{sx:{fontSize:18,ml:.5}})]})]}),u.jsx(xk,{open:r,handleClose:s,guests:e,onReenviar:t})]})}var es={},Oh;function Sk(){if(Oh)return es;Oh=1;var e=ut();Object.defineProperty(es,"__esModule",{value:!0}),es.default=void 0;var t=e(gt()),r=pt();return es.default=(0,t.default)((0,r.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"),es}var Ck=Sk();const Ek=lt(Ck),Dk=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),jh=e=>{const[t,r]=e.split(":"),n=parseInt(t),o=n>=12?"pm":"am";return`${n%12||12}:${r} ${o}`},Rh=e=>e.split(":").slice(0,2).join(":"),kk=({slot:e,onClick:t})=>u.jsxs(m.Box,{onClick:t,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:[u.jsx(m.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:u.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:Dk(e.Fecha)})}),u.jsxs(m.Box,{sx:{py:1.5},children:[u.jsx(m.Typography,{sx:{fontSize:"12px"},children:jh(e.HoraInicio)}),u.jsxs(m.Typography,{sx:{fontSize:"12px"},children:["a ",jh(e.HoraFin)]})]})]});function Ak({open:e,handleClose:t,suggestions:r,onSelectSlot:n}){const[o,s]=v.useState(16),a=r.slice(0,o).reduce((d,f)=>{const h=f.Fecha;return d[h]||(d[h]=[]),d[h].push(f),d},{}),c=Object.keys(a),l=d=>{const f={...d,HoraInicio:Rh(d.HoraInicio),HoraFin:Rh(d.HoraFin)};n(f),t()};return u.jsxs(m.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[u.jsxs(m.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[u.jsx(m.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),u.jsx(m.Box,{children:u.jsx(m.Button,{startIcon:u.jsx("img",{src:Mh,width:20}),onClick:t,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"1rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),u.jsx(m.Divider,{}),u.jsx(m.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:c.length===0?u.jsx(m.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):u.jsxs(u.Fragment,{children:[c.map((d,f)=>u.jsxs(m.Box,{sx:{mb:3},children:[u.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&&u.jsx("img",{src:Ph,width:15,style:{marginLeft:5}})]}),u.jsx(m.Grid,{container:!0,spacing:2,children:a[d].map((h,y)=>u.jsx(m.Grid,{item:!0,xs:6,sm:3,children:u.jsx(kk,{slot:h,onClick:()=>l(h)})},`${d}-${y}`))})]},d)),r.length>o&&u.jsx(m.Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:u.jsx(m.Button,{onClick:()=>s(d=>d+12),startIcon:u.jsx(Ek,{}),sx:{textTransform:"none",fontWeight:"bold",color:"#1976d2","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Mostrar más horarios disponibles"})})]})})]})}const Tk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",Ik=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function Mk({onSelectGuest:e,availableSuggestions:t,onInputTextChange:r}){const[n,o]=v.useState(null),[s,i]=v.useState(""),a=(l,d)=>{d?(e(d),o(null),i("")):(o(null),i(""))},c=(l,d)=>{i(d),r(d)};return u.jsx(m.Autocomplete,{options:t,value:n,inputValue:s,getOptionLabel:l=>l.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(l,d)=>l.correo===d.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:l=>u.jsx(m.TextField,{...l,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...l.InputProps,startAdornment:u.jsx(m.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:u.jsx("img",{src:Tk,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(l,d)=>v.createElement(m.Box,{component:"li",...l,key:d.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},u.jsx(m.Avatar,{sx:{bgcolor:Ik(d.iniciales),mr:2,width:32,height:32,fontSize:14},children:d.iniciales}),u.jsx(m.Typography,{children:d.nombre}))},"guest-autocomplete-field")}var ts={},Nh;function Pk(){if(Nh)return ts;Nh=1;var e=ut();Object.defineProperty(ts,"__esModule",{value:!0}),ts.default=void 0;var t=e(gt()),r=pt();return ts.default=(0,t.default)((0,r.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"),ts}var Ok=Pk();const jk=lt(Ok);var rs={},$h;function Rk(){if($h)return rs;$h=1;var e=ut();Object.defineProperty(rs,"__esModule",{value:!0}),rs.default=void 0;var t=e(gt()),r=pt();return rs.default=(0,t.default)((0,r.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"),rs}var Nk=Rk();const Xc=lt(Nk),$k=e=>e.tieneConflicto?{icon:u.jsx(Xc,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:u.jsx(jk,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},Lk=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function zk({guests:e,conflictCount:t,onViewSuggestions:r,onDeleteGuest:n}){const o=i=>a=>{a.stopPropagation(),n(i)},s=i=>i?i.trim().split(/\s+/).slice(0,2).join(" "):"";return u.jsxs(m.Box,{sx:{p:1},children:[u.jsx(m.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((i,a)=>{const c=$k(i),l=Lk(i.iniciales);return u.jsx(m.Chip,{label:u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[u.jsx(m.Typography,{variant:"body2",sx:{color:c.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:s(i?.nombre)}),u.jsx(m.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:c.icon})]}),avatar:u.jsx(m.Avatar,{sx:{bgcolor:l,width:24,height:24,fontSize:"10px",fontWeight:"bold",color:"#ffffff !important",ml:"4px !important"},children:i.iniciales}),sx:{backgroundColor:c.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:c.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"}}},onClick:()=>console.log(`Ver perfil de ${i.nombre}`),onDelete:o(i.nombre)},a)})}),t>0&&u.jsxs(m.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[u.jsx(Xc,{sx:{mr:1,fontSize:22}}),u.jsxs(m.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",u.jsxs("strong",{children:[t," invitado"]}),t!==1?"s":""]})]}),u.jsx(m.Link,{component:"button",type:"button",variant:"body2",onClick:i=>{i.preventDefault(),i.stopPropagation(),r()},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 Bk(e,t){const[r,n]=v.useState(e);return v.useEffect(()=>{const o=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(o)}},[e,t]),r}const Fk={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"},Lh=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],Wk=()=>{const e=[];for(let t=0;t<24;t++)for(let r=0;r<60;r+=15){const n=t.toString().padStart(2,"0"),o=r.toString().padStart(2,"0");e.push(`${n}:${o}`)}return e},zh=[],eo=Wk(),ns=(e,t)=>{if(!e||!t)return null;const r=e.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),o=parseInt(r[1],10)-1,s=parseInt(r[2],10),i=t.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),l=new Date(s,o,n,a,c);return isNaN(l.getTime())||!x.isValid(l)?null:l},Uk=({isVisible:e,onClose:t,onSave:r,onDelete:n,selectedDate:o,initialEvent:s,userId:i,masNombreBD:a,disId:c,onReenviar:l})=>{const[d,f]=v.useState(!1),[h,y]=v.useState(!1),g=x.format(new Date,"yyyy-MM-dd"),[p,b]=v.useState(""),[w,S]=v.useState([]),[E,C]=v.useState(!1),_=kc(),[W,D]=v.useState([]),[T,M]=v.useState(""),[I,U]=v.useState(zh),[G,F]=v.useState(!1),[Y,se]=v.useState(""),[H,N]=v.useState(!1),[le,de]=v.useState([]),[$,Q]=v.useState([]),Se=Bk(Y,300),we=I.filter(q=>q.tieneConflicto).length,{control:he,handleSubmit:ae,reset:ue,formState:{errors:J,isValid:Ce},watch:me,setValue:ee}=kp({resolver:VE(ik),defaultValues:{titulo:s?.titulo||"",fechaInicio:x.format(new Date,"yyyy-MM-dd"),horaInicio:x.format(new Date,"HH:mm"),horaFin:x.format(x.addHours(new Date,1),"HH:mm"),todoElDia:!1,client:s?.client||null,repetir:"No repetir",link:s?.link||"",descripcion:s?.descripcion||"",solID:s?.solID??null,invitados:[]},mode:"onChange"}),Me=me("fechaInicio"),j=me("fechaFin"),Fe=me("todoElDia");v.useEffect(()=>{if(p.trim()===""||!i||!c||!a){S([]),D([]),ee("solID",null),C(!1),M("");return}C(!0);const q=setTimeout(()=>{_.getClients(p,c,a,i).then(fe=>{if(C(!1),fe){const Oe=fe.map(je=>je.solID);D([...new Set(Oe)])}else D([]);const ke=Array.from(new Map(fe.map(Oe=>[Oe.nombreCliente,Oe])).values());if(ke.length>0)S(ke),M("");else if(s?.client&&s.solID!==null){const Oe=[{solID:s.solID,nombreCliente:s.client}];S(Oe),M("Sin resultados")}else S([]),M("Sin resultados")}).catch(fe=>{console.error("Error al buscar clientes:",fe),C(!1)})},500);return()=>clearTimeout(q)},[p,i,c,a]),v.useEffect(()=>{if(Me&&j){const q=new Date(Me),fe=new Date(j);(q===fe||q>fe)&&ee("fechaFin",Me)}},[Me,j,ee]),v.useEffect(()=>{Me&&ee("fechaFin",Me)},[Me]),v.useEffect(()=>{ee("showEndDate",d)},[d,ee]),v.useEffect(()=>{if(console.log("initialEvent",s),s){const q=x.format(s.fechaInicio,"yyyy-MM-dd")===x.format(s.fechaFin,"yyyy-MM-dd");if(f(!q),ee("titulo",s?.titulo),ee("fechaInicio",x.format(s.fechaInicio,"yyyy-MM-dd")),ee("fechaFin",x.format(s.fechaFin,"yyyy-MM-dd")),ee("horaInicio",x.format(s.fechaInicio,"HH:mm")),ee("horaFin",x.format(s.fechaFin,"HH:mm")),ee("horaInicio2",x.format(s.fechaFin,"HH:mm")),ee("descripcion",s.descripcion),ee("link",s.link),ee("repetir","false"),ee("color",s.color),ee("todoElDia",s.todoElDia),ee("solID",s.solID),ee("client",s.client),s.invitados&&s.invitados.length>0){const fe=(s?.invitados||[]).map(je=>{const te=je.usrNombre?.trim()||"",_e=te.split(/\s+/),Ie=_e.length>1?(_e[0][0]+_e[1][0]).toUpperCase():te.substring(0,2).toUpperCase();return{nombre:je.usrNombre||"Sin nombre",correo:je.correo||"",iniciales:Ie||"--",usrID:je.usuarioID??null,isHost:je.esOrganizador||!1,estatus:je.statusInvitacion,tieneConflicto:!1,disID:je.disID}}),ke=localStorage.getItem("nombreAnfitrion")||"Anfitrión",Oe={nombre:ke,correo:"",iniciales:ke.substring(0,2).toUpperCase(),usrID:i??0,isHost:!0,estatus:"CONFIRMADA",tieneConflicto:!1};U([Oe,...fe])}else U(zh);s.solID?y(!0):y(!1)}else{const q=o||new Date,fe=new Date,ke=new Date(q.getFullYear(),q.getMonth(),q.getDate(),fe.getHours(),fe.getMinutes()),Oe=x.addHours(ke,1);ue({titulo:"",fechaInicio:x.format(ke,"yyyy-MM-dd"),horaInicio:x.format(ke,"HH:mm"),fechaFin:x.format(Oe,"yyyy-MM-dd"),horaFin:x.format(Oe,"HH:mm"),horaInicio2:x.format(Oe,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:Lh[0],solID:null}),f(!1),y(!1)}},[s,e,o]);const Ke=q=>({UsuarioID:q.usrID??null,Correo:q.correo,EsOrganizador:q.usrID==i,StatusInvitacion:q.estatus,disID:c??null}),Ze=ae(q=>{const fe=I.map(Oe=>Ke(Oe)),ke={...q,invitados:fe};r(ke,s?.eventoID),t(),ue(),f(!1)},q=>{console.log("Errores de validación:",q)});v.useEffect(()=>{Fe&&(ee("horaInicio","00:00"),ee("horaFin","23:59"))},[Fe,ee,me]);const Be=()=>{const q=me("fechaInicio");if(q){const fe=new Date(`${q}T00:00:00`),ke=x.addDays(fe,1);ee("fechaFin",x.format(ke,"yyyy-MM-dd"))}f(!0)},Ve=me("fechaInicio"),et=me("horaInicio"),ht=me("fechaFin"),k=me("horaFin"),[P,B]=v.useState(null),[ce,ie]=v.useState(null);v.useEffect(()=>{(P===null||P!==et)&&B(et)},[et,P]),v.useEffect(()=>{(ce===null||ce!==k)&&ie(k??"")},[k,ce]);const O=me("todoElDia");v.useEffect(()=>{if(O||!et||!k||!Ve||!ht)return;const q=ns(Ve,et),fe=ns(ht,k);if(!q||!fe||!x.isValid(q)||!x.isValid(fe))return;const ke=x.isSameDay(q,fe),Oe=ke&&(x.isAfter(q,fe)||q.getTime()===fe.getTime()),je=x.isBefore(fe,q)&&!ke;(Oe||je)&&(ee("horaFin",""),ie(""))},[et,Ve]);const oe=v.useMemo(()=>{if(!et||!Ve)return eo;const q=ns(Ve,et),fe=ns(ht,"00:00");return!q||!fe||!x.isValid(q)||!x.isValid(fe)||x.isBefore(fe,q)&&!x.isSameDay(fe,q)?eo:x.isSameDay(q,fe)?eo.filter(ke=>{const Oe=ns(ht,ke);return Oe&&x.isAfter(Oe,q)}):(x.isAfter(fe,q),eo)},[et,Ve,ht]),Ee=v.useMemo(()=>eo,[]),Ne=async q=>{const fe=I.some(Vt=>Vt.correo===q.correo);if(N(!0),fe)return;const ke=c,Oe=q.correo,je=q.usrID,te=Ve,_e=et,Ie=k;if(!ke||!Oe||!te||!_e||!Ie){U(Vt=>[...Vt,{...q,status:"pending",isHost:!1,hasConflict:!1,usrID:je,name:q.nombre}]);return}let Pe;try{Pe=await _.VerificarConflicto(ke,Oe,te,_e+":00",Ie+":00")}catch{Pe={tieneConflicto:!1,usrMail:q.correo}}const wr=Array.isArray(Pe)?Pe[0]:Pe,ar={...q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:String(wr.tieneConflicto).toLowerCase()==="true"};if(ar.tieneConflicto){const Vt=await _.getDisponibilidadUsuario(c,Oe,te,"60");de(Vt)}U(Vt=>[...Vt,ar])},R=q=>{U(fe=>fe.filter(ke=>ke.nombre!==q))},re=()=>{F(!1)},xe=q=>{const Oe=(q.usrNombre??"").split(" ").map(je=>je.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:q.usrNombre??"",correo:q.usrMail??"",iniciales:Oe,usrID:q.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};v.useEffect(()=>{Se.length>2&&c?(async()=>{const ke=(await _.getUsuariosInvitados(c,Se)).map(xe).filter(Oe=>Oe.usrID!==i&&!I.some(je=>je.correo===Oe.correo));Q(ke)})():Q([])},[Se,I]);const Ge=q=>{se(q)},At=q=>{const{Fecha:fe,HoraInicio:ke,HoraFin:Oe}=q,je=te=>te.split(":").slice(0,2).join(":");ee("fechaInicio",fe),ee("fechaFin",fe),ee("horaInicio",je(ke)),ee("horaFin",je(Oe)),f(!1),re(),console.log("Formulario actualizado con sugerencia:",{Fecha:fe,HoraInicio:ke,HoraFin:Oe})};return u.jsx(u.Fragment,{children:u.jsx(m.Modal,{open:e,onClose:t,children:u.jsx("form",{onSubmit:Ze,children:u.jsxs(m.Box,{sx:Fk,children:[u.jsx(m.IconButton,{"aria-label":"close",onClick:t,sx:{position:"absolute",right:8,top:12},children:u.jsx(Hr,{})}),u.jsx(m.Typography,{variant:"h6",mb:2,children:s?.isGoogleEvent||s?.isOutlookEvent||!s?.esOrganizador?u.jsx(u.Fragment,{children:s?.titulo||"Evento de Google"}):s?"Editar evento":"Agregar evento"}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(hr,{name:"titulo",control:he,render:({field:q})=>u.jsx(m.TextField,{...q,label:"Título",fullWidth:!0,variant:"outlined",size:"small",error:!!J.titulo,helperText:J.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"}}})})})}),u.jsxs("div",{className:`row g-2 ${d?"mb-1":"mb-2"}`,children:[u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(hr,{name:"fechaInicio",control:he,render:({field:q})=>u.jsx(m.TextField,{fullWidth:!0,...q,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!J.fechaInicio,helperText:J.fechaInicio?.message})})}),d?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"col-md-3 d-none d-md-block"}),u.jsx("div",{className:"col-10 col-md-4",children:u.jsx(hr,{name:"fechaFin",control:he,render:({field:q})=>u.jsx(m.TextField,{...q,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:Me||g},error:!!J.fechaFin,helperText:J.fechaFin?.message})})}),!s&&u.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:u.jsx(m.IconButton,{onClick:()=>f(!1),sx:{fontSize:18},children:u.jsx(Dh,{})})})]}):u.jsx("div",{className:"col-md-8"})]}),d&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12 d-flex justify-content-center",children:u.jsx(Th,{sx:{color:"#757575",my:1}})})}),u.jsxs("div",{className:"row g-2 mb-2",children:[u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(hr,{name:"horaInicio",control:he,render:({field:{onChange:q,value:fe,...ke}})=>u.jsx(m.Autocomplete,{freeSolo:!0,options:Ee,value:fe||"",onChange:(Oe,je)=>q(je||""),onInputChange:(Oe,je)=>q(je),renderInput:Oe=>u.jsx(m.TextField,{...Oe,...ke,size:"small",error:!!J.horaInicio,helperText:J.horaInicio?.message,InputProps:{...Oe.InputProps,endAdornment:u.jsx(m.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:u.jsx(Ac,{})})}}),disabled:O})})}),!d&&u.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:J.horaInicio?"5px":"0px"},children:u.jsx(Th,{sx:{color:"#757575"}})}),d&&u.jsx("div",{className:"col-md-3 d-none d-md-block"}),u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(hr,{name:"horaFin",control:he,render:({field:{onChange:q,value:fe,...ke}})=>u.jsx(m.Autocomplete,{freeSolo:!0,options:oe,value:fe||"",onChange:(Oe,je)=>q(je||""),onInputChange:(Oe,je)=>q(je),renderInput:Oe=>u.jsx(m.TextField,{...Oe,...ke,size:"small",error:!!J.horaFin,helperText:J.horaFin?.message,InputProps:{...Oe.InputProps,endAdornment:u.jsx(m.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:u.jsx(Ac,{})})}}),disabled:O})})}),!d&&u.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:u.jsx(hr,{name:"todoElDia",control:he,render:({field:q})=>u.jsx(m.FormControlLabel,{control:u.jsx(m.Checkbox,{checked:q.value,onChange:fe=>q.onChange(fe.target.checked)}),label:u.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&!d&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsxs(m.Button,{onClick:Be,size:"small",sx:{textTransform:"none",fontSize:16},children:[u.jsx(lk,{}),"  Agregar fecha final"]})})}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&u.jsx("div",{className:"row mb-2",children:u.jsxs("div",{className:"col-12",children:[!h&&u.jsxs(m.Button,{onClick:()=>y(!0),size:"small",sx:{textTransform:"none",fontSize:16},children:[u.jsx(dk,{}),"  Vincular cliente"]}),h&&u.jsxs("div",{className:"row g-2",children:[u.jsx("div",{className:"col-10 col-md-5",children:u.jsx(hr,{name:"client",control:he,render:({field:q})=>u.jsx(m.Autocomplete,{options:w,loading:E,loadingText:"Buscando coincidencias...",getOptionLabel:fe=>fe.nombreCliente?.trim()||"",value:w.find(fe=>fe.nombreCliente===q.value)||(q.value&&typeof q.value=="string"?{solID:-1,nombreCliente:q.value}:null),noOptionsText:T,onInputChange:(fe,ke)=>{b(ke)},onChange:(fe,ke)=>{q.onChange(ke?ke.nombreCliente:"")},renderInput:fe=>u.jsx(m.TextField,{...fe,placeholder:"Buscar cliente...",size:"small",InputProps:{...fe.InputProps,startAdornment:u.jsx("img",{src:Xd,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"5px"}}),endAdornment:u.jsxs(u.Fragment,{children:[E?u.jsx(m.CircularProgress,{color:"inherit",size:20}):null,fe.InputProps.endAdornment]})}})})})}),u.jsx("div",{className:"col-10 col-md-5",children:u.jsx(hr,{name:"solID",control:he,render:({field:q})=>u.jsx(m.Autocomplete,{options:W,noOptionsText:"Sin resultados",getOptionLabel:fe=>fe.toString(),value:q.value??null,onChange:(fe,ke)=>q.onChange(ke),renderInput:fe=>u.jsx(m.TextField,{...fe,label:"#Registro",variant:"outlined",size:"small",sx:{"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}}),disabled:!w.length})})}),u.jsx("div",{className:"col-2 d-flex align-items-center",children:u.jsx(m.IconButton,{onClick:()=>y(!1),sx:{fontSize:18},children:u.jsx(Dh,{})})})]})]})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(hr,{name:"link",control:he,render:({field:q})=>u.jsx(m.TextField,{...q,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!J.link,helperText:J.link?.message,InputProps:{startAdornment:u.jsx("img",{src:ak,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(hr,{name:"descripcion",control:he,render:({field:q})=>u.jsx(m.TextField,{...q,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:u.jsx("img",{src:uk,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(Mk,{onSelectGuest:Ne,availableSuggestions:$,onInputTextChange:Ge})})}),H&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(zk,{guests:I,conflictCount:we,onViewSuggestions:()=>F(!0),onDeleteGuest:R})})}),s?.invitados&&s?.invitados?.length>0&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(m.Box,{children:u.jsx(wk,{guests:I,onReenviar:l})})})}),u.jsx(Ak,{open:G,handleClose:re,suggestions:le,onSelectSlot:At}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[u.jsx(ck,{}),Lh.map(q=>u.jsx(hr,{name:"color",control:he,render:({field:fe})=>u.jsx(m.IconButton,{onClick:()=>fe.onChange(q),sx:{width:24,height:24,borderRadius:"50%",bgcolor:q,border:fe.value===q?"2px solid":"none",borderColor:fe.value===q?"primary.main":"transparent"}})},q))]})})}),u.jsx("div",{className:"row",children:u.jsxs("div",{className:"col-12 d-flex gap-2",style:{width:"100%",marginTop:"20px"},children:[s&&!s?.isGoogleEvent&&!s?.isOutlookEvent&&u.jsx(m.Button,{onClick:n,variant:"outlined",startIcon:u.jsx("img",{src:kh,width:15}),hidden:s?s?.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"}),u.jsx(m.Button,{onClick:t,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"}),u.jsx(m.Button,{onClick:Ze,variant:"contained",disabled:!Ce,hidden:s?s?.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"})]})})]})})})})},Hk={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"},Vk=({isOpen:e,onClose:t,events:r,date:n,onEventClick:o})=>{if(!n)return null;const s=a=>{o(a),t()},i=a=>a.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:a.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return u.jsx(m.Modal,{open:e,onClose:t,children:u.jsxs(m.Box,{sx:Hk,children:[u.jsxs(m.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[u.jsxs(m.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),u.jsx(m.IconButton,{onClick:t,size:"small",children:u.jsx(Hr,{})})]}),u.jsx(m.Divider,{}),u.jsx(m.List,{sx:{mt:1},children:r.map(a=>{const c=i(a);return u.jsx(m.ListItem,{disablePadding:!0,sx:{mb:1},children:u.jsx(m.ListItemButton,{onClick:()=>s(a),sx:{py:1,borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.02)",borderLeft:`5px solid ${c?.borderColor}`,"&:hover":{backgroundColor:"rgba(0,0,0,0.04)"}},children:u.jsxs(m.Box,{sx:{flexGrow:1},children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[u.jsx(m.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),u.jsx(m.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),u.jsx(m.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${x.format(a.fechaInicio,"HH:mm")} - ${x.format(a.fechaFin,"HH:mm")}`})]})})},a.eventoID)})})]})})};var os={},Bh;function Yk(){if(Bh)return os;Bh=1;var e=ut();Object.defineProperty(os,"__esModule",{value:!0}),os.default=void 0;var t=e(gt()),r=pt();return os.default=(0,t.default)((0,r.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"),os}var qk=Yk();const Zk=lt(qk);var ss={},Fh;function Gk(){if(Fh)return ss;Fh=1;var e=ut();Object.defineProperty(ss,"__esModule",{value:!0}),ss.default=void 0;var t=e(gt()),r=pt();return ss.default=(0,t.default)((0,r.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"),ss}var Kk=Gk();const Qk=lt(Kk),Xk="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",Jk="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==",Jc=v.forwardRef(({id:e,message:t,variant:r},n)=>{const{closeSnackbar:o}=bs.useSnackbar(),s={success:{color:"#fff",icon:u.jsx("img",{width:25,src:Xk,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:u.jsx(Zk,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:u.jsx(Qk,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:u.jsx("img",{src:kh,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:u.jsx("img",{src:Jk,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},i=s[r]||s.info;return u.jsx(bs.SnackbarContent,{ref:n,children:u.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 ${i.color}`},children:[u.jsx(m.Box,{sx:{mr:1.5},children:i.icon}),u.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1},children:t}),u.jsx(m.IconButton,{size:"small",onClick:()=>o(e),children:u.jsx(Hr,{fontSize:"small"})})]})})}),Wh=v.createContext(void 0),eA=({children:e})=>{const[t,r]=v.useState([]),[n,o]=v.useState([]),[s,i]=v.useState(!1);return u.jsx(Wh.Provider,{value:{googleEvents:t,setGoogleEvents:r,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:s,setIsLoadingGoogleEvents:i},children:e})},tA=()=>{const e=v.useContext(Wh);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},rA=(e,t,r)=>{const n=(i,a)=>a?new Date(a):i?new Date(i.replace(/-/g,"/")):new Date,o=n(e.start.date,e.start.dateTime);let s=n(e.end.date,e.end.dateTime);return e.end.date&&!e.end.dateTime&&s.setDate(s.getDate()-1),{eventoID:Math.abs(nA(e.id)),titulo:e.summary||"(Sin título)",descripcion:e.description,fechaInicio:o,fechaFin:s,todoElDia:!!(e.start.date&&!e.start.dateTime),color:"#4285F4C",hasVideoCall:!!e.conferenceData,link:e.htmlLink,repetir:void 0,solID:null,disID:t,client:null,usrID:r,solicitudRelacionada:[],isGoogleEvent:!0}};function nA(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t}function oA(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t}const sA=(e,t,r)=>{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(oA(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:t,client:null,usrID:r,solicitudRelacionada:[],isGoogleEvent:!1,isOutlookEvent:!0}},Uh="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",iA="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",aA=({open:e,onClose:t,onConfirm:r,title:n,description:o,icon:s,confirmText:i,confirmColor:a="#d32f2f",loading:c=!1})=>u.jsxs(m.Dialog,{open:e,onClose:t,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[u.jsx(m.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:u.jsx(m.IconButton,{onClick:t,size:"small",children:u.jsx(Hr,{fontSize:"small"})})}),u.jsxs(m.DialogContent,{sx:{textAlign:"center",pt:0},children:[u.jsx(m.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:s}),u.jsx(m.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),u.jsx(m.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),u.jsxs(m.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[u.jsx(m.Button,{variant:"outlined",onClick:t,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),u.jsxs(m.Button,{variant:"contained",onClick:r,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:[i=="Eliminar"&&u.jsx("img",{src:iA,width:15,style:{marginRight:6,marginBottom:2}}),c?"Procesando...":i]})]})]})]}),cA=({userId:e,leads30Days:t,leads90Days:r,disId:n,masNombreBD:o})=>{const[s,i]=v.useState(new Date),[a,c]=v.useState([]),[l,d]=v.useState(!1),[f,h]=v.useState(null),[y,g]=v.useState(!1),[p,b]=v.useState(null),[w,S]=v.useState([]),{enqueueSnackbar:E}=bs.useSnackbar(),C=kc(),_=Ti(),W=_c(),[D,T]=v.useState(!1),[M,I]=v.useState([]),[U,G]=v.useState(null),{session:F,sessionoutlook:Y}=ac(),{googleEvents:se,setGoogleEvents:H,outlookEvents:N,setOutlookEvents:le}=tA(),[de,$]=v.useState([]),[Q,Se]=v.useState([]),[we,he]=v.useState([]),[ae,ue]=v.useState(!1),[J,Ce]=v.useState([]),[me,ee]=v.useState(),Me=(te,_e)=>{I(te),G(_e),T(!0)},j=async()=>{if(e===void 0)return;const te=await C.getNotificacionesXUsuario(e,!1),_e=te[0].evento.nombreAnfitrion;localStorage.setItem("nombreAnfitrion",_e),Ce(te)};v.useEffect(()=>{const te=new Date,_e=x.startOfDay(te),Ie=x.endOfDay(x.addDays(_e,6)),Pe={start:_e,end:Ie},wr=a.filter(ar=>{const Vt={start:ar.fechaInicio,end:ar.fechaFin};return Wd(Vt,Pe)}).sort((ar,Vt)=>ar.fechaInicio.getTime()-Vt.fechaInicio.getTime());S(wr)},[a]),v.useEffect(()=>{const te=async()=>{try{if(e){const Ie=await C.getEventsByUser(e);j(),c(Ie)}}catch(Ie){console.log("Error al cargar eventos locales:",Ie)}};te();const _e=setInterval(te,4e3);return()=>clearInterval(_e)},[e]),v.useEffect(()=>{if(!n||!e)return;const te=[...a];if(se.length>0&&F?.userEmail){const _e=se.map(Ie=>rA(Ie,n,e));te.push(..._e)}if(N.length>0&&Y?.userEmail){const _e=N.map(Ie=>sA(Ie,n,e));te.push(..._e)}$(te)},[a,se,N,n,e,F?.userEmail,Y?.userEmail]);const Fe=async te=>{try{if(te?.isGoogleEvent||te.isOutlookEvent)h(te),d(!0);else{const _e=await C.getEventById(te.eventoID);h(_e),d(!0)}}catch(_e){console.error(_e)}},Ke=()=>{d(!1),h(null)},Ze=async(te,_e)=>{let Ie,Pe;te.todoElDia?(Ie=new Date(`${te.fechaInicio}T${te.horaInicio}`),Pe=new Date(`${te.fechaInicio}T${te.horaFin}`)):(Ie=new Date(`${te.fechaInicio}T${te.horaInicio}`),Pe=te.fechaFin&&te.horaFin?new Date(`${te.fechaFin}T${te.horaFin}`):new Date(`${te.fechaInicio}T${te.horaFin}`));const wr=x.format(Ie,"yyyy-MM-dd HH:mm:ss.SSS"),ar=x.format(Pe,"yyyy-MM-dd HH:mm:ss.SSS");if(_e){const Jr={...te,eventoID:_e,fechaInicio:wr,fechaFin:ar,solID:te.solID??null,disID:n??null,client:te.client,invitados:te.invitados.map(Ye=>({usrNombre:Ye.nombre||Ye.usrNombre,Correo:Ye.correo||Ye.Correo,EsOrganizador:Ye.isHost||Ye.EsOrganizador,StatusInvitacion:Ye.StatusInvitacion,UsuarioID:Ye.usrID||Ye.UsuarioID,disID:Ye.disID||n}))};try{const Ye=await C.updateEvent(Jr);var Vt=a.map(Sr=>Sr.eventoID===Ye.eventoID?Ye:Sr);c(Vt),E("El evento se ha actualizado correctamente.",{variant:"success"}),Ke()}catch{E("Error al actualizar Evento",{variant:"error"})}}else{const Jr={...te,fechaInicio:wr,fechaFin:ar,todoElDia:te.todoElDia,solID:te.solID??null,disID:n??null,client:te.client,invitados:te.invitados.map(Ye=>({usrNombre:Ye.nombre||Ye.usrNombre,Correo:Ye.correo||Ye.Correo,EsOrganizador:Ye.isHost||Ye.EsOrganizador,StatusInvitacion:Ye.StatusInvitacion,UsuarioID:Ye.usrID||Ye.UsuarioID,disID:Ye.disID||n}))};try{const Ye=await C.createEvent(Jr,e);c(Sr=>[...Sr,Ye]),E("El evento se ha creado con éxito",{variant:"success"}),Ke()}catch{E("Error al guardar Evento",{variant:"error"})}}if(e){const Jr=await C.getEventsByUser(e);c(Jr)}},Be=()=>{i(te=>new Date(te.getFullYear(),te.getMonth()-1,1))},Ve=()=>{i(te=>new Date(te.getFullYear(),te.getMonth()+1,1))},et=()=>{fe("ELIMINAR")},ht=()=>{fe("RECHAZAR")},k=()=>{b(new Date),d(!0)},P=te=>{te&&i(te)},B=te=>{b(te),d(!0),h(null)},ce=async()=>{if(f)try{await C.deleteEvent(f.eventoID),c(a.filter(te=>te.eventoID!==f.eventoID)),E("El evento se ha eliminado de tu calendario",{content:(te,_e)=>u.jsx(Jc,{id:te,message:String(_e),variant:"delete"})})}catch{E("Error al eliminar Evento",{variant:"error"})}finally{Ke(),ke()}},ie=async()=>{if(!(!F?.userEmail||!n)){ue(!0);try{const _e=(await _.getGoogleCalendars(F.userEmail,n)).map(Pe=>({...Pe,selected:!0}));Se(_e);const Ie=_e.map(Pe=>Pe.id);Ne(Ie)}catch(te){console.error("Error Google Cals:",te)}finally{ue(!1)}}},O=async te=>{const _e=Q.map(Pe=>Pe.id===te?{...Pe,selected:!Pe.selected}:Pe);Se(_e);const Ie=_e.filter(Pe=>Pe.selected).map(Pe=>Pe.id);Ne(Ie)},oe=async()=>{if(!(!Y?.userEmail||!n)){ue(!0);try{const _e=(await W.getOutlookCalendars(Y.userEmail,n)).map(Pe=>({...Pe,selected:!0}));he(_e);const Ie=_e.map(Pe=>Pe.id);R(Ie)}catch(te){console.error("Error Outlook Cals:",te)}finally{ue(!1)}}},Ee=async te=>{const _e=we.map(Pe=>Pe.id===te?{...Pe,selected:!Pe.selected}:Pe);he(_e);const Ie=_e.filter(Pe=>Pe.selected).map(Pe=>Pe.id);R(Ie)};v.useEffect(()=>{ie()},[F?.userEmail,n]),v.useEffect(()=>{oe()},[Y?.userEmail,n]);const Ne=async te=>{if(!F?.userEmail||!n)return;const _e=te||Q.filter(Ie=>Ie.selected).map(Ie=>Ie.id);try{const Ie={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:F.userEmail,calendarIds:_e},Pe=await _.getGoogleEventsByMonth(Ie);H(Pe)}catch(Ie){console.error("Error al obtener eventos de Google:",Ie)}},R=async te=>{if(!Y?.userEmail||!n)return;const _e=te||we.filter(Ie=>Ie.selected).map(Ie=>Ie.id);try{const Ie={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:Y.userEmail,calendarIds:_e},Pe=await W.getOutlookEventsByMonth(Ie);le(Pe)}catch(Ie){console.error("Error al obtener eventos de Outlook:",Ie)}};if(n===void 0||e===void 0)return u.jsx("div",{children:"Cargando configuración de usuario..."});const re=async(te,_e)=>{await C.UpdateStatusEvento(te.evento.eventoID,e,_e)&&(await C.MarcarLeido(te.notificacionID,e),E(te?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},xe=async()=>{me&&C.UpdateStatusEvento(me.evento.eventoID,e,"RECHAZADA")&&(await C.MarcarLeido(me.notificacionID,e),await C.MarcarLeido(me.notificacionID,e),E("Haz rechazado la Invitación a "+me?.evento?.titulo,{content:(_e,Ie)=>u.jsx(Jc,{id:_e,message:String(Ie),variant:"rechazar"})}),ke())},Ge=async(te,_e)=>{try{if(!e)return;ee(te),_e=="RECHAZADA"?(ht(),console.log("noti",te)):re(te,_e)}catch{E("Error al procesar la invitación",{variant:"error"})}},At=async te=>{try{if(!f)return;await C.ReenviarNotificacion(f?.eventoID,te),E("Invitación enviada con éxito",{variant:"success"})}catch(_e){console.error("Error al conectar con la API",_e)}},[q,fe]=v.useState(null),ke=()=>fe(null),Oe={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:u.jsxs(u.Fragment,{children:["Estás a punto de declinar la invitación de ",u.jsx("strong",{children:me?.evento?.nombreAnfitrion})," a ",u.jsx("strong",{children:me?.evento?.titulo})]}),icon:u.jsx("img",{src:Uh}),action:()=>me&&xe()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:u.jsx("img",{src:Uh}),action:()=>ce()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>ce}},je=q?Oe[q]:null;return u.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[u.jsx(cy,{header:u.jsx(k2,{currentDate:s,onPrevMonth:Be,onNextMonth:Ve,onAddEvent:k,onDateChange:P}),sidebar:u.jsx(aw,{onEventClick:Fe,upcomingEvents:w,leads30Days:t,leads90Days:r,disID:n,usrID:e,onAddEvent:k,googleCalendars:Q,outlookCalendars:we,isLoadingCalendars:ae,onToggleGoogle:O,onToggleOutlook:Ee,notifications:J,unreadCount:J?.filter(te=>!te.leida).length,onAceppInvitacion:Ge}),mainContent:u.jsx(_w,{onSeeMoreClick:Me,currentDate:s,events:de,onDayClick:B,onEventClick:Fe})}),l&&u.jsx(Uk,{isVisible:l,onClose:Ke,onSave:Ze,onDelete:et,selectedDate:p,initialEvent:f,userId:e,masNombreBD:o,disId:n,onReenviar:At}),u.jsx(Vk,{isOpen:D,onClose:()=>T(!1),events:M,date:U,onEventClick:Fe}),je&&u.jsx(aA,{open:!!q,onClose:ke,onConfirm:()=>{je.action()},title:je.title,description:je.description,icon:je.icon,confirmText:je.confirmText})]})},lA="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",uA="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 el(e,t,r){return e.accessor?e.accessor(t,r):e.field?t?.[e.field]:t?.[e?.key||""]}function dA(e,t){const r=e??"",n=t??"";return r instanceof Date&&n instanceof Date?r.getTime()-n.getTime():typeof r=="number"&&typeof n=="number"?r-n:typeof r=="boolean"&&typeof n=="boolean"?Number(r)-Number(n):String(r).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function tl(e,t,r=!0){return typeof e=="function"?e(t):e??r}function fA(e){return e.replace(/[^\d]/g,"")}function pA(e,t){return t}var is={},Hh;function hA(){if(Hh)return is;Hh=1;var e=ut();Object.defineProperty(is,"__esModule",{value:!0}),is.default=void 0;var t=e(gt()),r=pt();return is.default=(0,t.default)((0,r.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"),is}var mA=hA();const gA=lt(mA);var as={},Vh;function vA(){if(Vh)return as;Vh=1;var e=ut();Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var t=e(gt()),r=pt();return as.default=(0,t.default)((0,r.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"),as}var yA=vA();const bA=lt(yA);var cs={},Yh;function xA(){if(Yh)return cs;Yh=1;var e=ut();Object.defineProperty(cs,"__esModule",{value:!0}),cs.default=void 0;var t=e(gt()),r=pt();return cs.default=(0,t.default)((0,r.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),cs}var _A=xA();const wA=lt(_A);var ls={},qh;function SA(){if(qh)return ls;qh=1;var e=ut();Object.defineProperty(ls,"__esModule",{value:!0}),ls.default=void 0;var t=e(gt()),r=pt();return ls.default=(0,t.default)((0,r.jsx)("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),ls}var CA=SA();const EA=lt(CA);function Zh(e){return e==="right"?"end":e==="center"?"center":"start"}function Gh(e){const t=e.filter(r=>!r.width).length||1;return e.map(r=>typeof r.width=="number"?`${r.width}px`:typeof r.width=="string"?r.width:`minmax(0, ${1/t}fr)`).join(" ")}const DA=1060,rl=(e,t)=>e.metrics.find(r=>String(r.label).toLowerCase()===t.toLowerCase())?.value??"";function kA({sections:e,detailColumns:t,summaryWidths:r=["1fr",120,120,150],minWidth:n=DA,getDetailColumns:o,onRowClick:s}){function c(d){if(typeof d=="number")return d;if(!d)return 0;const f=/^(\d+)\s*px$/.exec(d.trim());return f?Number(f[1]):/fr$/i.test(d)?160:0}function l(d){const f=d.reduce((g,p)=>g+c(p.width),0),h=Math.max(d.length-1,0)*16;return f+h+32}return u.jsx(m.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:u.jsxs(m.Box,{children:[u.jsx(m.Box,{sx:{display:"grid",gridTemplateColumns:r.map(d=>typeof d=="number"?`${d}px`:d).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"#1E5BCE",color:"#fff",boxSizing:"border-box"},children:["Tipo","En Proceso","Finalizadas","Último seg."].map(d=>u.jsx(m.Typography,{sx:{fontSize:13,fontWeight:800},children:d},d))}),e.map((d,f)=>{const[h,y]=K.useState(!!d.initiallyOpen),g=f%2===1,p=o?o(d):t,b=Math.max(n,l(p));return u.jsxs(m.Box,{children:[u.jsxs(m.Box,{sx:{display:"grid",gridTemplateColumns:r.map(w=>typeof w=="number"?`${w}px`:w).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:g?"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:()=>y(w=>!w),children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[u.jsx(m.IconButton,{size:"small",disableRipple:!0,children:h?u.jsx(EA,{}):u.jsx(wA,{})}),u.jsx(m.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(d.title),children:d.title})]}),u.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:rl(d,"En Proceso")}),u.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:rl(d,"Finalizadas")}),u.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:rl(d,"Último seg.")})]}),u.jsx(m.Collapse,{in:h,unmountOnExit:!0,children:u.jsxs(m.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[u.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Gh(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(w=>u.jsx(m.Typography,{sx:{justifySelf:Zh(w.align),textAlign:w.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:w.header},w.key))}),(d.rows??[]).map((w,S)=>u.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Gh(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:()=>s?.(w,d),children:p.map((E,C)=>{const _=E.accessor?E.accessor(w,S):E.field?w[E.field]:null;return u.jsx(m.Box,{sx:{justifySelf:Zh(E.align),textAlign:E.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof _=="string"||typeof _=="number"?u.jsx(m.Typography,{sx:{fontSize:13,fontWeight:/^(estatus|seg|avance|nivel|asesor|fecha)$/i.test(E.key)?700:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(_),children:_}):_},E.key??C)})},w.id??S))]})})]},d.id)})]})})}var us={},Kh;function AA(){if(Kh)return us;Kh=1;var e=ut();Object.defineProperty(us,"__esModule",{value:!0}),us.default=void 0;var t=e(gt()),r=pt();return us.default=(0,t.default)((0,r.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"),us}var TA=AA();const IA=lt(TA),MA=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",PA=e=>{const t=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return t||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},OA=e=>{const t=(e||"").split(" ").filter(Boolean);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var ds={},Qh;function jA(){if(Qh)return ds;Qh=1;var e=ut();Object.defineProperty(ds,"__esModule",{value:!0}),ds.default=void 0;var t=e(gt()),r=pt();return ds.default=(0,t.default)((0,r.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"),ds}var RA=jA();const NA=lt(RA),nl=({current:e=0,total:t=0,color:r="#4caf50"})=>u.jsx("div",{style:{display:"flex",gap:"1px",width:"100%",height:"100%",justifyContent:"center",overflow:"hidden",minWidth:0},children:Array.from({length:t}).map((n,o)=>u.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?r:"#e0e0e0",display:"flex"}},o))});var fs={},Xh;function $A(){if(Xh)return fs;Xh=1;var e=ut();Object.defineProperty(fs,"__esModule",{value:!0}),fs.default=void 0;var t=e(gt()),r=pt();return fs.default=(0,t.default)((0,r.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),fs}var LA=$A();const Jh=lt(LA);var ps={},e0;function zA(){if(e0)return ps;e0=1;var e=ut();Object.defineProperty(ps,"__esModule",{value:!0}),ps.default=void 0;var t=e(gt()),r=pt();return ps.default=(0,t.default)((0,r.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),ps}var BA=zA();const FA=lt(BA),WA=e=>{const t=String(e??"").toLowerCase().trim();return t==="muy interesado"?{bg:"#E53935",color:"#FFFFFF"}:t==="interesado"?{bg:"#FB8C00",color:"#FFFFFF"}:t==="venta definitiva"?{bg:"#2E7D32",color:"#FFFFFF"}:t==="no sé"||t==="no se"?{bg:"#9E9E9E",color:"#FFFFFF"}:t==="algo interesado"?{bg:"#FFEB3B",color:"#000000"}:{bg:"transparent",color:"#2c2c2c"}},UA=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}},HA=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}},VA=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 YA(e){const t=new Date(e),r=t.toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),n=t.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"});return`${r.replace(".","")} • ${n}`}function qA(e){return e.replace(/<br\s*\/?>/gi,`
178
178
  `).replace(/\r\n/g,`
179
179
  `).replace(/\r/g,`
180
180
  `)}const ZA={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"]},GA={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"]},KA={Todos:[],"Algo interesado":["Algo interesado"],Interesado:["Interesado"],"Muy interesado":["Muy interesado"],"Venta definitiva":["Venta definitiva"],"No sé":["No sé"]};function QA(e,t){switch(e){case"pruebas":return HA(t)??"—";case"servicio":return VA(t)??"—";case"nuevos":case"seminuevos":default:return UA(t)??"—"}}function XA({open:e,onClose:t,customer:r,fields:n=[],header:o,extraSections:s,normalTable:i,normalTableColumns:a=[],history:c=[],advisorHistory:l=[],onRequestEdit:d,searchFilter:f,urlsQA:h,solicitudesNuevos:y=[],solicitudesPrueba:g=[],solicitudesServicio:p=[],solicitudesSeminuevos:b=[],onCreateSolicitud:w,isCrmMode:S=!1,onSolicitudBaseUrl:E,onIframeClose:C,reloadInfo:_,idAdminSistemas:W}){if(!r)return null;const D=3,[T,M]=v.useState(null),I=!!T,[U,G]=v.useState(!1),[F,Y]=v.useState(null),[se,H]=v.useState(c??[]),[N,le]=v.useState(null),de=v.useMemo(()=>[...l].sort((L,X)=>new Date(X.FechaAsignacion).getTime()-new Date(L.FechaAsignacion).getTime()),[l]);v.useEffect(()=>{c&&c.length&&H(c)},[c]);const $=c?.length?c:se,Q=o?.title??(L=>L?.Nombre||L?.name||"Sin título"),Se=o?.infoItems??[],we=L=>L.nombreAsesor?.trim()||(L.Email?L.Email:"Sistema"),he=L=>{const X=L||"",ye=X.split(" ").filter(Boolean);return ye.length>=2?(ye[0][0]+ye[1][0]).toUpperCase():(X[0]||"?").toUpperCase()},ae=L=>L?.SolID??L?.solID??L?.SolId??L?.SOLID??null,ue=v.useMemo(()=>{const L=$??[];return Array.isArray(L?.[0])?L.flat():L},[$]),J=v.useMemo(()=>{const L=ue;return!N||F==null?L:L.filter(X=>{const ye=ae(X);return ye!=null&&String(ye)===String(F)})},[ue,N,F]),Ce=v.useMemo(()=>[...J].sort((L,X)=>new Date(X.fecAlta).getTime()-new Date(L.fecAlta).getTime()),[J]),[me,ee]=v.useState(!1),Me=v.useMemo(()=>me?Ce:Ce.slice(0,D),[me,Ce]),j=Math.max(Ce.length-D,0),Fe=L=>String(L??"").normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim(),Ke=(L,X)=>Fe(JSON.stringify(L)).includes(Fe(X)),Ze=(L,X)=>f?f(L,X):Ke(L,X),Be=(L,X)=>{const ye=Fe(X).split(/\s+/).filter(Boolean);return ye.length?ye.every(Te=>Ze(L,Te)):!0},[Ve,et]=v.useState(""),[ht,k]=v.useState([]);v.useMemo(()=>i??[],[i]),v.useMemo(()=>{const L=Ve.trim();return L?(i??[]).filter(X=>Be(X,L)):i??[]},[i,Ve]);const P=m.useTheme(),B=m.useMediaQuery(P.breakpoints.down("md")),[ce,ie]=v.useState(""),[O,oe]=v.useState(!0),[Ee,Ne]=v.useState(!1),R=new Date().toISOString().slice(0,10),re=new Date(Date.now()-720*3600*1e3).toISOString().slice(0,10),[xe,Ge]=v.useState(re),[At,q]=v.useState(R),[fe,ke]=v.useState(null),Oe=!!fe,[je,te]=v.useState("En Proceso"),[_e,Ie]=v.useState("Todos"),[Pe,wr]=v.useState("Todos"),ar=["Algo interesado","Interesado","Muy interesado","Venta definitiva","No sé"],Vt=["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"],Jr=()=>{ie(""),oe(!1),Ne(!1),Ge(re),q(R),te("Todos"),Ie("Todos"),wr("Todos")},Ye=v.useMemo(()=>(ce??"").trim()!==""||je!=="Todos"||_e!=="Todos"||O||Ee||Pe!=="Todos",[ce,je,_e,O,Ee,Pe]);function Sr(L){if(!L)return"";const X=new Date(L);if(isNaN(X.getTime()))return"";const ye=String(X.getDate()).padStart(2,"0"),Te=String(X.getMonth()+1).padStart(2,"0"),Tt=String(X.getFullYear()).slice(-2);return`${ye}/${Te}/${Tt}`}function ra(L){const X=L?new Date(L):null;return X&&!isNaN(X.getTime())?X:null}function al(L,X){let ye=null;for(const Te of L){const Tt=ra(X(Te));if(Tt){const Ct=Tt.getTime();(ye===null||Ct>ye)&&(ye=Ct)}}return ye?new Date(ye):null}function vs(L){const X=al(L,ye=>ye.UltimoSeguimiento||ye.FechaCita);return X?Sr(X.toISOString()):"—"}function ys(L){const X=(L??"").toLowerCase().trim();return X==="sin venta"||X==="con venta"||X==="rechazada"||X==="rechazadas"}function na(L){return L.filter(X=>ys(X.EstatusDescripcion)).length}function oa(L){return L.filter(X=>!ys(X.EstatusDescripcion)).length}const cl=({progress:L,color:X})=>{if(!L)return u.jsx(nl,{current:0,total:0,color:X});const ye=L.split("/").map(Number);if(ye.length!==2||ye.some(Ct=>Number.isNaN(Ct)))return u.jsx(nl,{current:0,total:0,color:X});const[Te,Tt]=ye;return u.jsx(nl,{current:Te,total:Tt,color:X})};function sa(L){return[{key:"fecha",header:"Fecha",accessor:X=>Sr(X.Fecha),width:110},{key:"vehiculo",header:"Vehículo",accessor:X=>u.jsx(m.Tooltip,{title:X.Vehiculo??"",placement:"top",arrow:!0,children:u.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:X.Vehiculo??"—"})}),width:260},{key:"estatus",header:"Estatus",accessor:X=>u.jsx(m.Typography,{sx:{fontWeight:800,fontSize:13},children:QA(L,X.IdEstatus)}),width:170},{key:"nivel",header:"Nivel de Interés",accessor:X=>{const{bg:ye,color:Te}=WA(X.NivelInteres);return u.jsx(m.Box,{sx:{display:"inline-block",px:1,py:.25,borderRadius:9999,bgcolor:ye,color:Te,fontSize:12,fontWeight:X.NivelInteres?800:500},children:X.NivelInteres??"—"})},width:150},{key:"asesor",header:"Asesor",accessor:X=>{const ye=(X.Asesor??"").trim(),Te=ll=>{if(!ll)return"";const w3=ll[0]?.toUpperCase()??"",S3=ll[1]?.toLowerCase()??"";return`${w3}${S3}`};if(!ye)return u.jsx(m.Tooltip,{title:"",placement:"top",children:u.jsx(m.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:"—"})});const Tt=ye.split(/\s+/),Ct=Tt[0]??"",Or=Tt[1]??"",Cr=Te(Ct),Tn=Te(Or),_3=`${Cr}${Tn}`||"—";return u.jsx(m.Tooltip,{title:ye,placement:"top",children:u.jsx(m.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:_3})})},width:120,align:"center"},{key:"origen",header:"Origen",accessor:X=>X.Origen??"—",width:120,align:"center"},{key:"actividad",header:"Actividad",accessor:X=>u.jsx(m.Tooltip,{title:X.Actividad??"",placement:"top",arrow:!0,children:u.jsxs(m.Box,{sx:{maxWidth:160,overflow:"hidden",display:"flex",gap:.5,alignItems:"center"},children:[X.Icon&&u.jsx("span",{style:{color:"#fff",backgroundColor:X.Color,borderRadius:100,alignItems:"center",justifyContent:"center",display:"flex",padding:3},children:u.jsx("i",{className:X.Icon})}),u.jsx(m.Typography,{component:"span",noWrap:!0,sx:{fontSize:13,fontWeight:500,display:"block",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:(X.Actividad??"").length?"default":"inherit"},children:X.Actividad??"—"})]})}),width:180},{key:"avance",header:"Avance",accessor:X=>u.jsx(cl,{progress:X.Avance,color:X.Color}),width:200,align:"left"}]}function A(L){const ye=sa(L).slice(1);return[{key:"fecha",header:"Fecha",accessor:Te=>Sr(Te.Fecha),width:110},{key:"fechaCita",header:"Fecha Cita",accessor:Te=>Sr(Te.FechaCita),width:120},{key:"horaCita",header:"Hora Cita",accessor:Te=>Te.HoraCita??"—",width:110},...ye]}function ne(L){const X=L.kind;switch(X){case"pruebas":case"servicio":return A(X);case"nuevos":case"seminuevos":default:return sa(X)}}function ve(L,X,ye,Te){return{id:L,kind:ye,title:X,metrics:[{label:"En Proceso",value:oa(Te)},{label:"Finalizadas",value:na(Te)},{label:"Último seg.",value:vs(Te)}],rows:Te,initiallyOpen:!1}}const Re=[ve("n-1","Cotización de nuevos","nuevos",y),ve("p-1","Prueba de Manejo","pruebas",g),ve("s-1","Cita de Servicio","servicio",p),ve("sn-1","Cotización para Seminuevos","seminuevos",b)],Qe=v.useMemo(()=>{const L=(ce??"").trim().toLowerCase(),X=(ye,Te)=>{if(L&&!(ye.Vehiculo??"").toLowerCase().includes(L))return!1;const Tt=Ee?ye.FechaCita:ye.Fecha;if(O&&Tt){const Ct=ra(Tt??"");if(!Ct)return!1;const Or=xe?new Date(`${xe}T00:00:00`):null,Cr=At?new Date(`${At}T00:00:00`):null;if(Cr&&Cr.setDate(Cr.getDate()+1),Or&&Ct<Or||Cr&&Ct>=Cr)return!1}if(je!=="Todos"){const Ct=(ye.EstatusDescripcion??"").toLowerCase();if(!(ZA[je]??[]).some(Tn=>Ct===Tn.toLowerCase()))return!1}if(_e!=="Todos"){const Ct=(ye.Actividad??"").toLowerCase();if(!(GA[_e]??[]).some(Tn=>Ct===Tn.toLowerCase()))return!1}if(Pe!=="Todos"){const Ct=(ye.NivelInteres??"").toLowerCase();if(!(KA[Pe]??[]).some(Tn=>Ct===Tn.toLowerCase()))return!1}return!0};return Re.map(ye=>{const Te=(ye.rows??[]).filter(Ct=>X(Ct,ye.kind)),Tt=[{label:"En Proceso",value:oa(Te)},{label:"Finalizadas",value:na(Te)},{label:"Último seg.",value:vs(Te)}];return{...ye,rows:Te,metrics:Tt}})},[Re,ce,O,xe,At,Ee,je,_e,Pe]),ct={nuevos:"cotizaciones",pruebas:"pruebademanejo",servicio:"citasservicio",seminuevos:"seminuevos"},qe=(L,X)=>{const ye=L.SolID;if(!ye)return;const Te=X.kind,Tt=ct[Te]??"cotizaciones",Ct=h?`https://qa2.crm.netcar.com.mx/netcar/${Tt}/${ye}`:`https://crmxs.netcar.com.mx/netcar/${Tt}/${ye}`,Or=E?.({row:L,section:X,slug:Tt,solId:ye,baseUrl:Ct});if(!S){const Cr=Or??Ct;Y(ye),le(Cr),G(!0)}},We=()=>{C?.(r),Y(null),le(null),G(!1)},Yt=v.useRef(!1),mt=v.useRef(null),Ot=v.useCallback(()=>{if(!Yt.current){Yt.current=!0;return}mt.current&&window.clearTimeout(mt.current),mt.current=window.setTimeout(()=>{_?.(r)},500)},[_,r]);return v.useEffect(()=>{Yt.current=!1,mt.current&&window.clearTimeout(mt.current)},[N,F]),u.jsx(m.Dialog,{open:e,onClose:t,fullWidth:!0,fullScreen:B,PaperProps:{sx:{height:{xs:"100dvh",md:"90vh"},maxWidth:{xs:"100vw",md:"92vw"},overflow:"hidden",display:"flex",flexDirection:"column",borderRadius:{xs:0,md:3}}},children:u.jsxs(m.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},height:"100%",minHeight:0,overflow:"auto",position:"relative"},children:[u.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:[u.jsxs(m.Box,{children:[u.jsx(m.Stack,{direction:"row",spacing:2,alignItems:"center",mb:1,sx:{px:2.5,pt:2.5},children:u.jsxs(m.Box,{display:"flex",flexDirection:"column",gap:1,width:"100%",children:[u.jsx(m.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:u.jsx(m.Box,{sx:{flex:1,minWidth:0,pr:1},children:u.jsxs(m.Typography,{component:"span",fontWeight:700,sx:{display:"inline",lineHeight:1.2,wordBreak:"break-word",pr:.5},children:[Q(r)," ",u.jsx(m.IconButton,{component:"span",size:"small",disableRipple:!0,onClick:()=>{t?.(),r&&d?.(r)},sx:{p:0,ml:.5,verticalAlign:"text-bottom",color:"#336BE1","&:hover":{bgcolor:"transparent"},"&:focus-visible":{outline:"none"}},"aria-label":"Editar nombre",children:u.jsx(NA,{sx:{fontSize:"1em"}})})]})})}),Se.map((L,X)=>u.jsxs(m.Box,{sx:{display:"flex",gap:1.2,alignItems:"center",cursor:L.onClick?"pointer":"default"},onClick:()=>{L.onClick&&L.onClick(r)},children:[L.icon,u.jsx(m.Typography,{variant:"body2",sx:{color:L.inLink?"#336BE1":"#070C10"},style:{},children:L.value(r)})]},X))]})}),u.jsx(m.Stack,{mb:2,sx:{px:2.5,pt:0,gap:2},children:n.map((L,X)=>{const ye=L.label?.toLowerCase().startsWith("asesor");return u.jsxs(m.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[u.jsx(m.Box,{sx:{width:"50%"},children:u.jsx(m.Typography,{variant:"body2",color:"text.secondary",sx:{color:"#5C6372"},children:L.label})}),u.jsxs(m.Box,{sx:{width:"50%",display:"flex",alignItems:"center",gap:1},children:[u.jsx("div",{children:L?.avatar?L.avatar(r):null}),u.jsx(m.Typography,{variant:"body2",color:"textPrimary",children:L?.value(r)}),ye&&!W&&u.jsx(m.Tooltip,{title:"Historial asesores",placement:"top",arrow:!0,children:u.jsx(m.IconButton,{size:"small",onClick:Te=>M(Te.currentTarget),sx:{ml:.5},disableRipple:!0,children:u.jsx(IA,{fontSize:"small",sx:{color:"#5C6372"}})})})]})]},X)})}),u.jsx(m.Divider,{sx:{my:2}})]}),u.jsx(m.Box,{px:2.5,pb:.5,children:u.jsxs(m.Typography,{children:[u.jsx("span",{style:{fontWeight:800},children:"Última actividad"}),!N&&" por solicitud",":"]})}),u.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:[Me.length===0&&u.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"Sin actividad registrada."}),u.jsxs(m.Box,{children:[Me?.map((L,X)=>{const ye=we(L),Te=qA(L.comentario||"");return u.jsxs(m.Box,{sx:{pb:1.5},children:[u.jsxs(m.Stack,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",sx:{mb:.75},children:[u.jsx(m.Typography,{variant:"subtitle2",sx:{color:"#5C6372"},children:L.tipo||"Evento"}),u.jsx(m.Chip,{size:"small",label:L.auto!=null?`${L.auto}`:"—",sx:{bgcolor:"#336be1",color:"#fff",height:20}})]}),Te?u.jsx(m.Typography,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.5,mb:.75},children:Te}):null,u.jsxs(m.Stack,{direction:"row",spacing:1.25,alignItems:"center",children:[L?.ImgAsesor!=null?u.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},alt:he(ye),src:L?.ImgAsesor}):u.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},children:he(ye)}),u.jsxs(m.Stack,{spacing:0,children:[u.jsx(m.Typography,{variant:"body2",fontWeight:600,children:ye}),u.jsx(m.Typography,{variant:"caption",color:"text.secondary",children:YA(L.fecAlta)})]})]}),X<Me.length-1&&u.jsx(m.Divider,{sx:{mt:1.25}})]},L.segID??X)}),Ce.length>D&&u.jsx(m.Box,{sx:{mt:1},children:u.jsx(m.Button,{onClick:()=>ee(L=>!L),size:"small",sx:{textTransform:"none",px:0,color:"#336BE1","&:hover":{background:"transparent",textDecoration:"underline"}},children:me?"Ver menos":`Ver más (${j})`})})]})]}),u.jsx(m.Menu,{anchorEl:T,open:I,onClose:()=>M(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:u.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[u.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"}),u.jsxs(m.Box,{sx:{overflowY:"auto",py:.5,maxHeight:200},children:[de.length===0&&u.jsx(m.Box,{sx:{px:1.5,py:1},children:u.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"Sin registros"})}),de.map((L,X)=>{const ye=PA(L),Te=MA(L.FechaBaja??L.FechaAsignacion);return u.jsx(m.Box,{sx:{px:1,py:.75},children:u.jsxs(m.Stack,{direction:"row",alignItems:"center",spacing:1,children:[u.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},src:L?.ImgAsesor??void 0,children:OA(ye)}),u.jsx(m.Box,{sx:{flex:1,minWidth:0},children:u.jsx(m.Typography,{variant:"body2",noWrap:!0,children:ye})}),u.jsx(m.Typography,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:Te})]})},X)})]})]})})]}),U?u.jsxs(m.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",position:"relative"},children:[u.jsx(m.Box,{sx:{position:"absolute",top:18,left:24,zIndex:10,pointerEvents:"auto"},children:u.jsx(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:u.jsx(m.Button,{onClick:We,sx:{backgroundColor:"#2571d6",minWidth:36,minHeight:36,p:.5,borderRadius:"8px",color:"#fff",boxShadow:3,"&:hover":{backgroundColor:"#2074e3"}},children:u.jsx(FA,{fontSize:"medium"})})})}),N&&u.jsx("iframe",{src:N,width:"100%",height:"100%",onLoad:Ot,style:{border:0}})]}):u.jsxs(m.Box,{sx:{width:"100%",minHeight:0,overflowY:"auto"},children:[u.jsx(m.Box,{sx:{mt:{xs:1.5,md:3}},children:u.jsxs(m.Box,{sx:{mt:3,display:"flex",flexDirection:"column",gap:4,padding:"0 20px 0 20px"},children:[u.jsx(m.Typography,{variant:"h4",sx:{fontWeight:800,textAlign:"center",mb:1,letterSpacing:.2},children:"Solicitudes"}),u.jsxs(m.Stack,{direction:{xs:"column",md:"column"},spacing:1.5,alignItems:{xs:"stretch",md:"center"},justifyContent:"space-between",sx:{mb:1.5},children:[u.jsxs(m.Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",sx:{flexWrap:"wrap"},children:[u.jsx(m.TextField,{size:"small",placeholder:"Buscar por vehículo",value:ce,onChange:L=>ie(L.target.value),InputProps:{endAdornment:u.jsx(bA,{fontSize:"small",sx:{color:"#b6afaf"}})},sx:{minWidth:220}}),u.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,position:"relative"},children:[u.jsxs(m.Stack,{direction:"row",spacing:1.1,position:"absolute",bottom:48,left:0,alignItems:"center",children:[u.jsx(m.FormControlLabel,{label:u.jsx(m.Typography,{sx:{fontSize:15,fontWeight:600,marginLeft:0},children:"Por fecha"}),labelPlacement:"start",control:u.jsx(m.Checkbox,{checked:O,onChange:L=>oe(L.target.checked),size:"small",sx:{p:.3,"& .MuiSvgIcon-root":{fontSize:19},color:"#bab4b4"}}),sx:{ml:0,"& .MuiFormControlLabel-label":{marginRight:0}}}),u.jsx(m.Typography,{sx:{fontSize:15,paddingLeft:.4},children:"De cita"})]}),u.jsxs(m.Stack,{direction:"row",spacing:1,children:[u.jsx(m.TextField,{size:"small",type:"date",label:"Desde",InputLabelProps:{shrink:!0},value:xe,onChange:L=>Ge(L.target.value),disabled:!O,sx:{width:170}}),u.jsx(m.TextField,{size:"small",type:"date",label:"Hasta",InputLabelProps:{shrink:!0},value:At,onChange:L=>q(L.target.value),disabled:!O,sx:{width:170}})]})]}),u.jsx(m.IconButton,{onClick:L=>ke(L.currentTarget),disableRipple:!0,sx:{border:"1px solid #d4d7de",borderRadius:2,width:40,height:40,mt:2},children:u.jsx(gA,{})}),Ye&&u.jsx(m.Button,{variant:"outlined",onClick:Jr,disableRipple:!0,sx:{height:40,textTransform:"none",borderColor:"#d4d7de",color:"#333",mt:2},children:"Limpiar filtros"}),u.jsx(m.Tooltip,{title:Ye&&"Crear Solicitud",arrow:!0,placement:"top",disableHoverListener:!Ye,children:u.jsx("span",{children:u.jsxs(m.Button,{variant:"outlined",sx:{height:40,textTransform:"none",borderColor:"none",color:"#fff",backgroundColor:"#1e5bce","&:hover":{backgroundColor:"#1e5bce",boxShadow:"none"}},onClick:()=>{w?.(r)},disableRipple:!0,children:[u.jsx(Jh,{sx:{color:"#fff",fontSize:24,paddingRight:.6}}),!Ye&&"Crear Solicitud"]})})})]}),u.jsx(kA,{sections:Qe,detailColumns:[],getDetailColumns:ne,onRowClick:qe})]})]})}),u.jsx(m.Menu,{anchorEl:fe,open:Oe,onClose:()=>ke(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:u.jsxs(m.Stack,{spacing:1.5,paddingX:1.5,paddingY:1,children:[u.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:700,color:"#070C10"},children:"Filtro"}),u.jsxs(m.Box,{children:[u.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Estatus"}),u.jsx(m.RadioGroup,{value:je,onChange:L=>te(L.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(L=>u.jsx(m.FormControlLabel,{value:L,control:u.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),u.jsxs(m.Box,{children:[u.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Actividades"}),u.jsx(m.RadioGroup,{value:_e,onChange:(L,X)=>Ie(X),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...Vt].map(L=>u.jsx(m.FormControlLabel,{value:L,sx:{alignItems:"start"},control:u.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),u.jsxs(m.Box,{children:[u.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Nivel de interés"}),u.jsx(m.RadioGroup,{value:Pe,onChange:(L,X)=>wr(X),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...ar].map(L=>u.jsx(m.FormControlLabel,{value:L,control:u.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]})]})})]})]})})}const t0={tableClientes:"_tableClientes_acwe7_1",tableResponsive:"_tableResponsive_acwe7_1"};function r0(e,t,r){const{fields:n,order:o=["nombreCliente","email","acciones"],header:s={},cells:i={},hide:a={},actions:c}=t,l=c??{},d=l.show??{},f=l.handlers??{},h=l.accessors??{},y=l.icons??{},g=l.className??"d-flex flex-row gap-2 align-items-center ",p=l.tooltip??{},b=y.view??u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",style:{fill:"#070c10"},children:[u.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"}),u.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),w={nombreCliente:{key:"nombreCliente",header:s.nombreCliente??"Cliente",accessor:I=>I[n.nombreCliente],cell:i.nombreCliente,width:190},email:{key:"email",header:s.email??"Correo",accessor:I=>I[n.email],cell:i.email??(I=>{const U=String(I[n.email]??"");return U?u.jsx("a",{href:`mailto:${U}`,children:U}):u.jsx("span",{className:"text-muted",children:"—"})}),width:230},acciones:a.acciones?void 0:{key:"acciones",header:"",cell:i.acciones??(I=>{const U=tl(d.whatsapp,I,!0),G=tl(d.email,I,!0),F=tl(d.view,I,!0),Y=h.phone?.(I),se=h.email?.(I),H=de=>{if(de.stopPropagation(),f.onWhatsApp)return f.onWhatsApp(I);if(!Y)return;const $=h.countryCode??"52",Q=fA(String(Y));typeof window<"u"&&window.open(`https://wa.me/${$}${Q}`,"_blank")},N=de=>{if(de.stopPropagation(),f.onEmail)return f.onEmail(I);se&&typeof window<"u"&&(window.location.href=`mailto:${se}`)},le=de=>{de.stopPropagation(),f.onView&&f.onView(I)};return u.jsxs("div",{className:g,children:[U&&u.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.whatsapp??"WhatsApp",onClick:H,style:{width:24,height:24},children:u.jsx("img",{src:lA,alt:"WhatsApp"})}),G&&u.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.email??"Email",onClick:N,style:{width:24,height:24},children:u.jsx("img",{src:uA,alt:"Email"})}),F&&u.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.view??"Ver detalle",onClick:le,style:{width:24,height:24},children:b})]})}),width:120}},S=Object.values(w).filter(I=>!!I),E=(e??[]).filter(I=>!!I?.key),C=new Map;for(const I of S)C.set(String(I.key),I);for(const I of E)C.set(String(I.key),I);const _=[...S.map(I=>String(I.key)),...E.map(I=>String(I.key))],W=Array.from(new Set(o.map(I=>String(I)).filter(I=>C.has(I)))),D=_.filter(I=>!W.includes(I)),T=[...W,...D],M="acciones";if(C.has(M)){const I=T.filter(U=>U!==M);T.splice(0,T.length,...I,M)}return T.map(I=>C.get(I))}function JA(e){const{rows:t,columns:r,clientSort:n=!0,urlsQA:o=!0,defaultSort:s,minWidth:i=1100,rowKey:a=pA,haveOpenDetailFor:c=!0,defaults:l,detailConfig:d,normalTable:f,onRowClick:h,activityHistory:y,advisorHistory:g,forceOpenDetailFor:p,closeDetailFor:b,onRequestEdit:w,searchFilter:S,solicitudesNuevos:E,solicitudesPrueba:C,solicitudesServicio:_,solicitudesSeminuevos:W,onCreateSolicitud:D,isCrmMode:T,onSolicitudBaseUrl:M,onIframeClose:I,reloadInfo:U,idAdminSistemas:G=!1}=e,[F,Y]=v.useState(s??null),[se,H]=v.useState({open:!1,customer:null}),[N,le]=v.useState([]),de=ae=>{H({open:!0,customer:ae})},$=ae=>{c&&(h?.(ae),H({open:!0,customer:ae}))},Q=()=>{H({open:!1,customer:null}),b?.()},Se=v.useMemo(()=>l?r0(r??[],l):r0(r??[],{fields:{},order:[]}),[r,l]),we=v.useMemo(()=>{if(!n||!F)return t;const ae=Se.find(J=>J.key===F.key);if(!ae)return t;const ue=[...t];return ue.sort((J,Ce)=>{const me=el(ae,J,0),ee=el(ae,Ce,0),Me=dA(me,ee);return F.direction==="asc"?Me:-Me}),ue},[t,Se,F,n]),he=v.useMemo(()=>{const ae=d?.getCustomerId;return ue=>{const J=ae?.(ue)??ue?.Id_cliente??ue?.CliID??ue?.id??ue?.ID??ue?.Id??"";return String(J)}},[d]);return v.useEffect(()=>{if(!se.open||!se.customer)return;const ae=he(se.customer);if(!ae)return;const ue=(t??[]).find(J=>he(J)===ae);ue&&ue!==se.customer&&H(J=>({...J,customer:ue}))},[t,se.open,se.customer,he]),v.useEffect(()=>{p&&de(p)},[p]),u.jsxs("div",{children:[u.jsx("div",{className:`${t0.tableClientes} back-white rounded-3 shadow-main mt-4 mb-4`,children:u.jsx("div",{className:`${t0.tableResponsive} table-responsive`,children:u.jsxs("table",{className:"table table-hover align-middle mb-0",children:[u.jsx("thead",{children:u.jsx("tr",{children:Se.map(ae=>u.jsx("th",{style:{fontWeight:600,width:ae.width,paddingTop:"20px",paddingBottom:"20px",textAlign:ae.align??"left"},children:ae.header},ae.key))})}),u.jsx("tbody",{children:we.map((ae,ue)=>u.jsx("tr",{onClick:()=>$?.(ae),role:"button",tabIndex:0,onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&$?.(ae)},style:{cursor:"pointer"},children:Se.map((J,Ce)=>{const me=J.Component?u.jsx(J.Component,{row:ae,index:ue}):J.cell?J.cell(ae,ue):(()=>{const ee=el(J,ae,ue);return ee==null||ee===""?"":String(ee)})();return u.jsx("td",{style:{paddingTop:"20px",paddingBottom:"20px",textAlign:J.align??"left"},children:me},`${String(J.key)}-${Ce}`)})},a(ae,ue)))})]})})}),se.open&&u.jsx(XA,{open:se.open,onClose:Q,customer:se.customer,fields:d?.dynamicFields,header:d?.header,normalTable:f,history:y,advisorHistory:g,urlsQA:o,onRequestEdit:ae=>{Q(),w?.(ae)},searchFilter:S,solicitudesNuevos:E,solicitudesPrueba:C,solicitudesServicio:_,solicitudesSeminuevos:W,onCreateSolicitud:D,isCrmMode:T,onSolicitudBaseUrl:M,onIframeClose:I,reloadInfo:U,idAdminSistemas:G})]})}const n0=K.forwardRef(({sx:e,...t},r)=>u.jsx(m.InputBase,{inputRef:r,...t,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}}));n0.displayName="SoftInput";function e3({message:e}){return e?u.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:[u.jsx(Xc,{fontSize:"small",sx:{color:"rgb(211, 47, 47)"}}),u.jsx("span",{style:{color:"rgb(95, 33, 32)",fontSize:14,fontWeight:"500"},children:e})]}):null}function t3(e){if(e.required)return e.required===!0?"El campo es obligatorio.":e.required}function ol(e,t){const r=t3(e);return r?t?.isArray?{required:r,validate:n=>Array.isArray(n)&&n.length>0||r}:{required:r,validate:n=>n!==""&&n!==null&&n!==void 0||r}:{}}const o0={"& .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%"},r3={mb:1,fontWeight:600,color:"#1C1C1D","&.Mui-focused":{color:"#1C1C1D !important"},"&.Mui-error":{color:"#1C1C1D !important"}};function sl({label:e,errorMsg:t,helperText:r,children:n,sx:o}){return u.jsxs(m.FormControl,{fullWidth:!0,error:!!t,sx:o,className:"1- FieldWrapper",children:[u.jsx(m.FormLabel,{sx:r3,children:e}),n,u.jsx(e3,{message:t||r})]})}function n3(e,t){const{register:r,formState:{errors:n}}=t,o={...ol(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 s=e.type==="email";s&&!o.pattern&&(o.pattern={value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:"Correo electrónico inválido"});const i=/[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]/g,a=/[0-9]/g,c=new Set(["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Home","End","Escape","Enter"]),l=C=>e.onlyNumbers?(C.match(a)??[]).join(""):e.onlyLetters?(C.match(i)??[]).join(""):C,d=(C,_)=>c.has(C)||_?!0:e.onlyNumbers?/^[0-9]$/.test(C):e.onlyLetters?/^[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]$/.test(C):!0,f=n[e.name]?.message,h=r(e.name,o),y=(e.inputProps&&typeof e.inputProps.maxLength=="number"?e.inputProps.maxLength:void 0)??e.maxLength,g=C=>{d(C.key,C.ctrlKey||C.metaKey)||C.preventDefault()},p=C=>{const _=C.data??null;_!=null&&(e.onlyNumbers&&/[^0-9]/.test(_)&&C.preventDefault(),e.onlyLetters&&/[^A-Za-zÁÉÍÓÚÜÑáéíóúüñ ]/.test(_)&&C.preventDefault())},b=C=>{const _=C.clipboardData.getData("text"),W=l(_);if(W!==_){C.preventDefault();const D=C.target,T=D.selectionStart??D.value.length,M=D.selectionEnd??D.value.length;D.setRangeText(W,T,M,"end"),D.dispatchEvent(new Event("input",{bubbles:!0}))}},w=C=>{const _=l(C.target.value);_!==C.target.value&&(C.target.value=_),y&&C.target.value.length>y&&(C.target.value=C.target.value.slice(0,y)),h.onChange(C)},S={...e.inputProps,...s?{inputMode:"email",autoComplete:"email"}:{},maxLength:y,onKeyDown:g,onBeforeInput:p,onPaste:b,onInvalid:C=>C.preventDefault()},E=e.onlyNumbers||s?"text":e.type??"text";return u.jsx(sl,{label:e.label,errorMsg:f,helperText:e.helperText,sx:o0,children:u.jsx(n0,{placeholder:e.placeholder,type:E,inputProps:S,...h,onChange:w,sx:{width:"100%",maxWidth:"none"},className:"SoftInputData"})})}function o3(e,t){const{control:r}=t,n=!!e.multiple;return u.jsx(hr,{name:e.name,control:r,rules:ol(e,{isArray:n}),render:({field:o,fieldState:s})=>u.jsx(sl,{label:e.label,errorMsg:s.error?.message,helperText:e.helperText,sx:o0,children:u.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&&u.jsx(m.MenuItem,{value:"",disabled:!0,children:"Selecciona…"}),e.options.map(i=>u.jsx(m.MenuItem,{value:i.value,children:i.label},String(i.value)))]})})})}function s3(e,t){return u.jsx(hr,{name:e.name,control:t.control,rules:ol(e),render:({field:r,fieldState:n})=>u.jsx(sl,{label:e.label,errorMsg:n.error?.message,helperText:e.helperText,children:u.jsx(m.RadioGroup,{row:!0,...r,className:"3-RadioFieldRender",children:e.options.map(o=>u.jsx(m.FormControlLabel,{value:o.value,control:u.jsx(m.Radio,{}),label:o.label},String(o.value)))})})})}function s0(e,t){if(e.render)return e.render(t);switch(e.kind){case"text":return n3(e,t);case"select":return o3(e,t);case"radio":return s3(e,t);default:return null}}function i3(e,{initialPerPage:t=25,perPageOptions:r=[10,25,50,100,"Todos"],onPageChange:n,onPerPageChange:o,scrollTop:s,deps:i=[]}={}){const a=Array.isArray(e)?e:[],[c,l]=v.useState(1),[d,f]=v.useState(t),{currentItems:h,totalPages:y,showingFrom:g,showingTo:p,totalItems:b}=v.useMemo(()=>{const E=a.length,C=d==="Todos"?1/0:Number(d),_=C===1/0?1:Math.max(1,Math.ceil(E/C)),W=Math.min(c,_),D=C===1/0?E:W*C,T=C===1/0?0:D-C;return{currentItems:C===1/0?a:a.slice(T,D),totalPages:_,showingFrom:E===0?0:T+1,showingTo:C===1/0?E:Math.min(D,E),totalItems:E}},[a,c,d]),w=E=>{const C=Math.max(1,Math.min(E,y||1));l(C),n?.(C),s?.()};return{currentItems:h,totalPages:y,showingFrom:g,showingTo:p,totalItems:b,currentPage:c,itemsPerPage:d,perPageOptions:r,goTo:w,next:()=>w(c+1),prev:()=>w(c-1),setItemsPerPage:E=>{f(E),o?.(E),l(1),s?.()},setCurrentPage:w}}var hs={},i0;function a3(){if(i0)return hs;i0=1;var e=ut();Object.defineProperty(hs,"__esModule",{value:!0}),hs.default=void 0;var t=e(gt()),r=pt();return hs.default=(0,t.default)((0,r.jsx)("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"NavigateBefore"),hs}var c3=a3();const l3=lt(c3);var ms={},a0;function u3(){if(a0)return ms;a0=1;var e=ut();Object.defineProperty(ms,"__esModule",{value:!0}),ms.default=void 0;var t=e(gt()),r=pt();return ms.default=(0,t.default)((0,r.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"NavigateNext"),ms}var d3=u3();const f3=lt(d3),p3=({currentPage:e,totalPages:t,onPageChange:r,itemsPerPage:n,onItemsPerPageChange:o,itemsPerPageOptions:s,showingFrom:i,showingTo:a,totalItems:c})=>{const l=m.useTheme(),d=m.useMediaQuery(l.breakpoints.down("sm")),f=()=>{if(t<=1)return[1];const g=d?0:2,p=[],b=1,w=t,S=Math.max(b+1,e-g),E=Math.min(w-1,e+g);p.push(b),S>b+1&&p.push("...");for(let C=S;C<=E;C++)C>=b+1&&C<=w-1&&p.push(C);return E<w-1&&p.push("..."),p.push(w),p},h=g=>{const p=g.target.value;o(p)},y=Math.max(1,t);return u.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:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"center"},children:[u.jsx(m.IconButton,{onClick:()=>r(e-1),disabled:e<=1,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página anterior",children:u.jsx(l3,{fontSize:"large"})}),f().map((g,p)=>g==="..."?u.jsx(m.Box,{sx:{px:1,display:"flex",alignItems:"center",fontSize:"1.1rem"},children:". . ."},`dots-${p}`):u.jsx(m.Button,{onClick:()=>r(g),size:"small",sx:{minWidth:36,height:36,fontSize:"1.05rem",p:1,borderRadius:"10px",backgroundColor:e===g?"primary.main":"transparent",fontWeight:e===g?700:400,color:e===g?"#fff":"#5C6372","&:hover":{backgroundColor:e===g?"primary.dark":"action.hover"},boxShadow:"none",border:"none",mx:.5},children:g},`p-${g}`)),u.jsx(m.IconButton,{onClick:()=>r(e+1),disabled:e>=y,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página siguiente",children:u.jsx(f3,{fontSize:"large"})})]}),u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1.25,justifyContent:{xs:"center",sm:"flex-start"},mt:{xs:1,sm:0}},children:[u.jsx(m.Typography,{variant:"body2",children:"Mostrar"}),u.jsx(m.FormControl,{size:"small",sx:{minWidth:72},children:u.jsx(m.Select,{value:n,onChange:h,renderValue:g=>g==="Todos"?"Todos":String(g),children:s.map(g=>u.jsx(m.MenuItem,{value:g,children:g==="Todos"?"Todos":g},String(g)))})}),u.jsx(m.Typography,{variant:"body2",children:"por página"})]})]})};function h3(e){const{open:t,dataAdd:r,fields:n,onSubmit:o,onCancel:s,defaultValues:i,txtBtnGuardar:a,haveId:c=!1,itemsTable:l,filter:d,getId:f,renderRow:h,selectedIds:y,onSelectedChange:g,onSubmitAddData:p,initialSelectedIds:b=[],showAutosPanel:w}=e,S=kp({mode:"onSubmit",reValidateMode:"onChange",criteriaMode:"all",shouldUnregister:!1,defaultValues:i});v.useEffect(()=>{i&&S.reset(i)},[i,S]);const[E,C]=v.useState(""),[_,W]=v.useState(b),D=Array.isArray(y)&&!!g,T=D?y:_,M=O=>{const oe=typeof O=="function"?O(T):O;D?g(oe):W(oe)},I=v.useCallback(O=>f?f(O):O?.IdAuto,[f]),U=v.useMemo(()=>{const O=new Map;return(l??[]).forEach((oe,Ee)=>O.set(I(oe),Ee)),O},[l,I]),G=v.useRef(new Set),F=v.useMemo(()=>{const O=new Map;return(l??[]).forEach(oe=>O.set(f?f(oe):oe?.IdAuto,oe)),O},[l,f]),Y=v.useMemo(()=>(n??[]).filter(O=>!!O.required).map(O=>O.name),[n]),se=lp({control:S.control,name:Y}),H=O=>O==null?!1:typeof O=="string"?O.trim().length>0:Array.isArray(O)?O.length>0:typeof O=="number"?!Number.isNaN(O):typeof O=="object"?Object.keys(O).length>0:!0,N=v.useMemo(()=>Y.length?se?.every(H)??!1:!0,[se,Y]),{handleSubmit:le,formState:{isSubmitting:de,isDirty:$,isValid:Q}}=S,Se=d??((O,oe)=>JSON.stringify(O).toLowerCase().includes(oe.toLowerCase())),we=v.useMemo(()=>E.trim()?l?.filter(O=>Se(O,E)):l,[l,E,Se]),he=v.useMemo(()=>{if(!we)return we;const O=G.current,oe=[...we];return oe.sort((Ee,Ne)=>{const R=O.has(I(Ee))?0:1,re=O.has(I(Ne))?0:1;if(R!==re)return R-re;const xe=U.get(I(Ee))??0,Ge=U.get(I(Ne))??0;return xe-Ge}),oe},[we,U,I]),{currentItems:ae,totalPages:ue,showingFrom:J,showingTo:Ce,totalItems:me,currentPage:ee,itemsPerPage:Me,perPageOptions:j,goTo:Fe,setItemsPerPage:Ke}=i3(he,{initialPerPage:25,perPageOptions:[10,25,50,100,"Todos"],deps:[E],scrollTop:()=>{}}),Ze=O=>{const oe=F.get(O)??null;M([O]),p?.({items:oe})},Be=O=>T.includes(O),Ve=async O=>{try{await o?.(O),S.reset(S.getValues())}catch(oe){console.error("Error al enviar AddCliente:",oe)}},et=v.useMemo(()=>{const O=new Map;return(n??[]).forEach(oe=>O.set(String(oe.name),oe)),O},[n]),ht=(O,oe)=>{const Ee=et.get(String(O));if(!Ee)return null;const Ne={xs:12,...Ee.grid,...oe||{}};return u.jsx(m.Grid,{item:!0,...Ne,children:Ee.render?Ee.render(S):s0(Ee,S)},`fld-${String(O)}`)},k=w??(e.haveId?"edit":"new"),P=k!=="onlyCars",B=k==="new"||k==="onlyCars",ce=T?.length>0,ie=k==="onlyCars"?ce:e.haveId?N&&$||ce:N&&ce;return u.jsx(m.Dialog,{open:t,onClose:s,maxWidth:"lg",fullWidth:!0,PaperProps:{sx:{height:{xs:"100dvh",md:B?"90vw":"auto"},maxWidth:{xs:"100vw",md:B?"98vw":"50%"},overflow:"hidden",display:"flex",flexDirection:"column",borderRadius:{xs:0,md:3}}},children:u.jsx(Dw,{...S,children:u.jsxs(m.Box,{component:"form",noValidate:!0,onSubmit:le(Ve),display:"flex",flexDirection:{xs:"column",md:"row"},width:"100%",height:"100%",minHeight:0,overflow:"hidden",position:"relative",children:[P&&u.jsxs(m.Box,{sx:{width:{xs:"100%",md:c?"100%":394},maxWidth:{xs:"100%",md:c?"100%":394},boxShadow:{xs:"none",md:c?"none":"2px 0px 8px #40404024"},borderRight:{xs:"none",md:c?"none":"1px solid #EBEEF0"},bgcolor:"background.paper",paddingBottom:3,mx:{xs:0,md:c?"auto":0},position:"relative"},children:[u.jsxs(m.Box,{p:{xs:2,md:2},height:"100%",width:"100%",children:[u.jsx(m.Typography,{fontWeight:700,fontSize:20,children:r.title}),u.jsxs(m.Box,{sx:{flex:1,height:"100%",overflowY:"auto",paddingBottom:10},children:[u.jsx(m.Typography,{fontSize:"18px",mt:2.5,fontWeight:500,children:r.subTitle}),u.jsx(m.Box,{mt:2,display:"flex",flexDirection:"column",width:"100%",gap:2,children:Array.isArray(e.formLayout)&&c?e.formLayout.map((O,oe)=>u.jsx(m.Grid,{container:!0,spacing:2,alignItems:"flex-start",wrap:"wrap",width:"100%",children:O.map((Ee,Ne)=>{const R=typeof Ee=="string"?{name:Ee}:Ee;return R.hidden?.(S)?null:ht(R.name,R.grid)})},`row-${oe}`)):u.jsx(m.Grid,{container:!0,spacing:2,width:"100%",children:n?.map((O,oe)=>{const Ee=O.grid??{xs:12,md:12};return u.jsx(m.Grid,{item:!0,...Ee,children:O.render?O.render(S):s0(O,S)},`${String(O.name)}-${oe}`)})})})]})]}),u.jsx(m.Box,{sx:{position:"absolute",zIndex:O=>O.zIndex.modal+1,bottom:0,width:"100%",borderRadius:2,boxShadow:{xs:"0",md:"0 -8px 8px -6px #0003"},p:1,backgroundColor:"#fff"},children:u.jsx(m.Box,{display:"flex",alignItems:"center",children:u.jsx(m.Box,{display:"flex",gap:1.5,width:"100%",justifyContent:c?"flex-end":"center",children:u.jsx(m.Button,{type:"submit",variant:"contained",disabled:de||!ie,sx:{backgroundColor:"#336BE1",color:"#fff",borderColor:"transparent",height:48,fontSize:15,textTransform:"none",fontWeight:"400",paddingX:5,width:c?"160px":"100%"},children:a})})})})]}),B&&u.jsx(m.Box,{flex:1,display:"flex",flexDirection:"column",minWidth:0,sx:{height:"100%"},children:u.jsx(m.Box,{mt:1,sx:{flex:1,display:"flex",flexDirection:"column",height:"100%"},children:u.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[u.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:[u.jsx(m.TextField,{value:E,onChange:O=>C(O.target.value),placeholder:"Buscar marca, modelo, vin...",InputProps:{endAdornment:u.jsx(m.InputAdornment,{position:"start",children:u.jsx(R2,{})}),disableUnderline:!0},variant:"standard",sx:{maxWidth:360,width:"100%",backgroundColor:"#EBEEF0",paddingX:"16px",paddingY:"10px"}}),u.jsx(m.Box,{display:"flex",gap:2,alignItems:"center",sx:{marginTop:{sm:0,xs:2}},children:u.jsx(m.Box,{onClick:s,sx:{cursor:"pointer",position:"absolute",top:0,right:10},display:{xs:"none",md:"block"},children:u.jsx(Hr,{sx:{color:"#070C10",fontSize:24}})})}),w=="onlyCars"&&u.jsx(m.Box,{display:"flex",alignItems:"center",justifyContent:"center",children:u.jsx(m.Box,{display:"flex",gap:1.5,width:"100%",children:u.jsxs(m.Button,{type:"submit",variant:"contained",disabled:de||!ie,sx:{backgroundColor:"#336BE1",color:"#fff",borderColor:"transparent",height:48,fontSize:15,textTransform:"none",fontWeight:"400",paddingX:5,width:"100%"},children:[u.jsx(Jh,{sx:{color:de||!ie?"gray":"#fff",fontSize:26,paddingRight:.6}}),"Crear Solicitud"]})})})]}),u.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:u.jsx(m.Box,{sx:{minWidth:1150,width:"max(1150px, 100%)",paddingBottom:10},children:u.jsxs(m.List,{disablePadding:!0,sx:{borderColor:"transparent",padding:0},children:[ae?.map((O,oe)=>{const Ee=f?f(O):oe,Ne=Be(Ee);return u.jsx(m.Box,{sx:{borderBottom:"1px solid #D3D4D5",padding:0},children:u.jsx(m.ListItem,{disableGutters:!0,sx:{paddingTop:0,padding:0,m:0},children:u.jsx(m.ListItemButton,{onClick:()=>Ze(Ee),disableRipple:!0,sx:{padding:0},children:u.jsx(m.ListItemText,{disableTypography:!0,primary:h?h({item:O,selected:Ne,toggle:()=>Ze(Ee),index:oe}):null})})})},`${String(Ee)}`)}),!ae?.length&&u.jsx(m.Box,{p:3,children:u.jsxs(m.Typography,{fontSize:14,color:"#5C6372",children:["Sin resultados para “",E,"”."]})})]})})}),u.jsx(m.Box,{sx:{position:"sticky",bottom:0,bgcolor:"#fff"},children:u.jsx(p3,{currentPage:ee,totalPages:ue,onPageChange:Fe,itemsPerPage:Me,onItemsPerPageChange:Ke,itemsPerPageOptions:j,showingFrom:J,showingTo:Ce,totalItems:me})})]})})})]})})})}var gs={},c0;function m3(){if(c0)return gs;c0=1;var e=ut();Object.defineProperty(gs,"__esModule",{value:!0}),gs.default=void 0;var t=e(gt()),r=pt();return gs.default=(0,t.default)((0,r.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"),gs}var g3=m3();const v3=lt(g3),il=/^[^\s@]+@[^\s@]+\.[^\s@]+$/i,ta=/[,\s;]+/g,un=e=>e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase(),dn=(e,t)=>Array.from(new Set([...e,...t.map(r=>r.trim()).filter(Boolean)])),l0=(e,t)=>t?e.filter(r=>un(r)!==un(t)):e,y3=(e,t)=>e.filter(r=>!t.some(n=>un(n)===un(r)));function Pr(e,t,r){if(r)return typeof r=="function"?r(e,t):e[r]}function b3(e,t){if(t)return!e||/^https?:\/\//i.test(t)?t:e+t}function x3({open:e,onClose:t,value:r,onChange:n,onRequestSend:o,customer:s,itemsSelects:i,renderItem:a,filterFields:c=[],multiSelectAutos:l=!0,imgCorreoSrc:d,baseURLImages:f,itemProps:h,defaultItemImageSrc:y}){const g=v.useRef(null),[p,b]=v.useState("idle"),w=v.useRef(e);v.useEffect(()=>{const R=w.current;e&&!R&&b("entering"),!e&&R&&b("exiting"),w.current=e},[e]),v.useEffect(()=>{if(p==="entering"){const xe=setTimeout(()=>b("idle"),320);return()=>clearTimeout(xe)}if(p==="exiting"){const xe=setTimeout(()=>b("idle"),220);return()=>clearTimeout(xe)}},[p]);const[S,E]=v.useState(""),[C,_]=v.useState(!1),[W,D]=v.useState(!1),[T,M]=v.useState(!1),[I,U]=v.useState(""),[G,F]=v.useState([]),Y=T?G:r.selectedIds,se=()=>{F([...r.selectedIds]),U(""),M(!0)},H=()=>{M(!1),F([])},N=()=>{const R=new Set(et.map((xe,Ge)=>String(Pr(xe,Ge,h.id)))),re=G.filter(xe=>R.has(String(xe)));n({...r,selectedIds:re}),M(!1)},le=(R,re)=>un(R??"")===un(re??"");function de(R,re,xe,Ge,At){const q=re?R.some(ke=>le(ke,re)):!1,fe=xe.length>0?xe.some(ke=>R.some(Oe=>le(Oe,ke))):!1;Ge(q),At(fe)}const $=R=>{const re=typeof R=="function"?R(r.recipients):R;n({...r,recipients:re}),de(re,ae,J,_,D)},Q=R=>n({...r,message:R}),Se=R=>n({...r,attachments:[...r.attachments,...R]}),we=R=>n({...r,attachments:r.attachments.filter(re=>re.name!==R)}),he=R=>{if(T)if(l){const re=new Set(G);re.has(R)?re.delete(R):re.add(R),F(Array.from(re))}else{const re=G.includes(R);F(re?[]:[R])}else if(l){const re=new Set(r.selectedIds);re.has(R)?re.delete(R):re.add(R),n({...r,selectedIds:Array.from(re)})}else{const re=r.selectedIds.includes(R);n({...r,selectedIds:re?[]:[R]})}},ae=v.useMemo(()=>(s?.Correo??"").trim(),[s]),ue=v.useMemo(()=>Array.isArray(s?.Asesores)?s.Asesores.filter(R=>R?.EmailAsesor&&R?.Activo):[],[s]),J=v.useMemo(()=>ue.map(R=>(R.EmailAsesor??"").trim()).filter(Boolean),[ue]),Ce=v.useRef(!1);v.useEffect(()=>{if(e&&!Ce.current){let R=[];C&&ae&&(R=dn(R,[ae])),W&&J.length&&(R=dn(R,J)),$(re=>dn(re,R)),de(r.recipients,ae,J,_,D),E(""),Ce.current=!0}e||(Ce.current=!1)},[e,C,W,ae,J]);const me=R=>{const re=ue.find(xe=>un(xe.EmailAsesor??"")===un(R));if(re){if(re.ImgAsesor)return u.jsx(m.Avatar,{src:re.ImgAsesor,alt:re.NombreAsesor});const xe=(re.NombreAsesor||"").trim(),Ge=(re.ApellidosAsesor||"").trim();return u.jsx(m.Avatar,{children:`${xe[0]??""}${Ge[0]??""}`.toUpperCase()})}return u.jsx(m.Avatar,{children:R[0]?.toUpperCase()})},ee=()=>{const R=S.trim();if(!R)return;const xe=R.split(ta).filter(Boolean).filter(Ge=>il.test(Ge));xe.length>0&&$(Ge=>dn(Ge,xe)),E("")},Me=R=>{_(R),$(re=>R&&ae?dn(re,[ae]):l0(re,ae))},j=R=>{D(R),$(re=>R?dn(re,J):y3(re,J))},Fe=R=>{const re=Array.from(R.target.files||[]);Se(re.map(xe=>({name:xe.name,size:xe.size,file:xe}))),R.target.value=""},Ke=Y[0],Ze=v.useMemo(()=>!i||Ke===void 0?void 0:i.find((re,xe)=>String(Pr(re,xe,h.id))===String(Ke)),[i,Ke,h.id]),Be=v.useMemo(()=>{if(!(!Ze||!h.distributorId))return Pr(Ze,0,h.distributorId)},[Ze,h.distributorId]);console.log("lockedDisId",Be);const Ve=v.useMemo(()=>Ze?(h.distributorTitle?Pr(Ze,0,h.distributorTitle):void 0)??(Be!=null?String(Be):void 0):void 0,[Ze,h.distributorTitle,Be]),et=v.useMemo(()=>{const R=i??[];return Be==null||!h.distributorId?R:R.filter((re,xe)=>Pr(re,xe,h.distributorId)==Be)},[i,Be,h.distributorId]),ht=v.useMemo(()=>{if(!I.trim())return et;const R=I.toLowerCase();return et.filter(re=>(c??[]).some(xe=>String(re?.[xe]??"").toLowerCase().includes(R)))},[et,I,c]),k=v.useMemo(()=>{if(!i||!r.selectedIds.length)return[];const R=new Map;return i.forEach((re,xe)=>{R.set(String(Pr(re,xe,h.id)),re)}),r.selectedIds.map(re=>R.get(String(re))).filter(Boolean)},[i,r.selectedIds,h.id]),P=R=>n({...r,selectedIds:r.selectedIds.filter(re=>String(re)!==String(R))}),B=()=>{let R=r.recipients;if(S.trim()){const q=S.split(ta).filter(fe=>il.test(fe));R=dn(R,q),$(R),E("")}const re=C?ae:"",xe=ue.find(q=>q?.Activo&&q?.EmailAsesor)?.EmailAsesor?.trim()??"";o?.({recipients:R,toClient:C,toAdvisor:W,tipoInt:C&&W?2:1,correoCliente:re,correoAsesor:W?xe:"",disIdLocked:Be}),t?.()},ce=v.useMemo(()=>{const re=S.split(ta).filter(Boolean).some(xe=>il.test(xe));return r.recipients.length>0||re},[r.recipients,S]),ie=(r.selectedIds?.length??0)>0,O=r.message.trim().length>0,oe=ce&&ie&&O,Ee=m.useTheme(),Ne=m.useMediaQuery(Ee.breakpoints.down("sm"));return u.jsxs(m.Drawer,{anchor:Ne?"bottom":"right",open:e,onClose:t,ModalProps:{keepMounted:!0,BackdropProps:{invisible:!Ne}},transitionDuration:{enter:320,exit:220},SlideProps:{direction:Ne?"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:[u.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",height:{xs:"100%",sm:"auto"},position:"relative",overflow:"auto"},children:[u.jsxs(m.Box,{sx:{p:2,pb:1,position:"sticky",top:0,zIndex:1,bgcolor:"#fff",borderBottom:"1px solid #E5E7EB"},children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:2},children:[d?u.jsx("img",{src:d,alt:"Correo",style:{width:24,height:18}}):null,u.jsxs(m.Typography,{fontWeight:700,children:["Mensaje a"," ",s?`${s.Nombre??""} ${s.ApellidoP??""} ${s.ApellidoM??""}`.trim():"—"]})]}),u.jsx(m.IconButton,{onClick:t,size:"small",children:u.jsx(Hr,{})})]}),u.jsx("div",{children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 10px",backgroundColor:"#EBEEF0",border:"1px solid #E5E7EB",borderRadius:8,flexWrap:"wrap"},children:[u.jsx("label",{style:{fontSize:14,fontWeight:600,marginRight:4},children:"Para:"}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",flex:1},children:[r.recipients.map(R=>u.jsx(m.Chip,{avatar:me(R),label:R,onDelete:()=>$(re=>l0(re,R)),size:"small",variant:"outlined",sx:{borderRadius:999,height:28}},R)),u.jsx("input",{type:"text",value:S,onChange:R=>E(R.target.value),onKeyDown:R=>{const re=R.key;re==="Enter"||re===","||re===";"||re===" "||re==="Tab"?(R.preventDefault(),ee()):re==="Backspace"&&!S&&r.recipients.length&&$(Ge=>Ge.slice(0,-1))},onBlur:ee,onPaste:R=>{const xe=R.clipboardData.getData("text").split(ta).filter(Boolean);xe.length>1&&(R.preventDefault(),$(Ge=>dn(Ge,xe)),E(""))},placeholder:r.recipients.length?"":"correo@ejemplo.com",style:{flex:1,minWidth:140,border:"none",outline:"none",background:"transparent",fontSize:14,color:"#111827",padding:"4px 0"}})]})]})}),u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:2,mb:1.5},children:[u.jsx(m.FormControlLabel,{control:u.jsx(m.Checkbox,{checked:C,onChange:R=>Me(R.target.checked),size:"small"}),label:"Cliente"}),ue.length!==0&&u.jsx(m.FormControlLabel,{control:u.jsx(m.Checkbox,{checked:W,onChange:R=>j(R.target.checked),size:"small"}),label:`Asesor${ue.length>1?"es":""}`})]})]}),u.jsx(m.Divider,{}),u.jsxs(m.Box,{p:2,children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},onClick:se,children:[u.jsx(m.Typography,{fontSize:12,fontWeight:600,sx:{textDecorationLine:"underline",cursor:"pointer"},children:"Selecciona el auto de seguimiento"}),Ve!=null&&u.jsx(m.Chip,{size:"small",label:`Distribuidora: ${Ve}`})]}),k.length>0?u.jsx(m.Box,{sx:{mt:1.5,display:"flex",gap:1,flexWrap:"wrap"},children:k.map((R,re)=>{const xe=Pr(R,re,h.id),Ge=Pr(R,re,h.title)??"",At=Pr(R,re,h.image),q=b3(f,At);return u.jsx(m.Chip,{onDelete:()=>P(xe),label:u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[u.jsx(m.Box,{sx:{width:28,height:20,borderRadius:.8,bgcolor:"#e5e6e8",overflow:"hidden",flex:"0 0 auto"},children:q?u.jsx("img",{src:q,alt:Ge,style:{width:"100%",height:"100%",objectFit:"cover"}}):u.jsx("img",{src:y,alt:Ge,style:{width:"100%",height:"100%",objectFit:"cover"}})}),u.jsx("span",{style:{fontSize:12},children:u.jsx("b",{children:Ge})})]}),sx:{pl:.5,pr:.3,py:.2,borderRadius:2,".MuiChip-deleteIcon":{fontSize:18}},variant:"outlined"},String(xe))})}):u.jsx(m.Typography,{fontSize:13,color:"#5C6372",sx:{mt:.5},children:"Aún no has seleccionado autos."})]}),u.jsx(m.Divider,{}),u.jsxs(m.Box,{sx:{p:2},children:[u.jsx(m.TextField,{placeholder:"Escribe aquí tu mensaje...",value:r.message,onChange:R=>Q(R.target.value),multiline:!0,minRows:6,fullWidth:!0,sx:{mb:1.5}}),r.attachments.length>0&&u.jsx(m.List,{dense:!0,sx:{display:"flex",flexDirection:"column",gap:2,border:"none"},children:r.attachments.map(R=>u.jsxs(m.ListItem,{sx:{px:0,background:"#EAEBF2",borderRadius:2,paddingX:1},children:[u.jsx(m.ListItemText,{style:{gap:10,fontSize:15,color:"#5285F7",display:"flex",flexWrap:"wrap",flex:"none"},primary:R.name,secondary:R.size<1024?`${R.size} b`:R.size<1024*1024?`${(R.size/1024).toFixed(0)} kb`:`${(R.size/(1024*1024)).toFixed(1)} MB`,secondaryTypographyProps:{sx:{fontSize:12,color:"#64748B",fontWeight:500,mt:.25}},primaryTypographyProps:{noWrap:!0,width:"auto"}}),u.jsx(m.Tooltip,{title:"Quitar",children:u.jsx(m.IconButton,{edge:"end",onClick:()=>we(R.name),size:"small",children:u.jsx(Hr,{fontSize:"small"})})})]},R.name))})]}),u.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:[u.jsx("input",{ref:g,hidden:!0,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.mp4,.pdf,.xlsx,.csv,.docx,.pptx,.txt",onChange:Fe}),u.jsx(m.Button,{startIcon:u.jsx(v3,{}),variant:"text",onClick:()=>g.current?.click(),sx:{color:"#5C6372"},children:"Adjuntar archivo"}),u.jsx(m.Box,{sx:{flex:1}}),u.jsx(m.Button,{variant:"contained",onClick:B,disabled:!oe,sx:{maxWidth:146,width:"100%",height:53,backgroundColor:"#336BE1"},children:"Enviar"})]})]}),u.jsxs(m.Dialog,{fullWidth:!0,maxWidth:"sm",fullScreen:Ne,open:T,onClose:H,children:[u.jsxs(m.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:1},children:["Selecciona tu auto de seguimiento",u.jsx(m.IconButton,{onClick:H,size:"small",children:u.jsx(Hr,{})})]}),u.jsxs(m.DialogContent,{children:[u.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[u.jsx(m.TextField,{placeholder:"Buscar...",fullWidth:!0,size:"small",value:I,onChange:R=>U(R.target.value),sx:{mb:2}}),Ve!=null&&u.jsx(m.Chip,{size:"small",label:`Distribuidora: ${Ve}`})]}),u.jsxs(m.Typography,{variant:"caption",fontWeight:600,children:["RESULTADOS (",ht.length,")"]}),u.jsxs(m.List,{sx:{p:0},children:[ht.map((R,re)=>{const xe=Pr(R,re,h.id),Ge=Y.includes(String(xe))||Y.includes(xe),At=Be==null||Pr(R,re,h.distributorId)==Be;return u.jsx(m.ListItem,{disableGutters:!0,sx:{p:0,opacity:At?1:.5},children:u.jsx(m.Box,{onClick:()=>At&&he(xe),sx:{cursor:At?"pointer":"not-allowed",p:.5,backgroundColor:Ge?"#e5f0ff":"transparent",width:"100%",borderBottom:"solid 1px #D3D4D5"},children:a?a(R,re):u.jsx("pre",{style:{margin:0},children:JSON.stringify(R,null,2)})})},String(xe))}),ht.length===0&&u.jsx(m.Box,{p:2,children:u.jsx(m.Typography,{children:"Tu búsqueda no generó resultados"})})]})]}),u.jsxs(m.DialogActions,{sx:{px:3,pb:2},children:[u.jsx(m.Button,{variant:"text",onClick:H,sx:{color:"#5C6372"},children:"Cancelar"}),u.jsx(m.Button,{variant:"contained",onClick:N,sx:{backgroundColor:"#336BE1"},children:"Guardar selección"})]})]})]})}jt.AddCliente=h3,jt.ApiProvider=Ox,jt.AuthProvider=c1,jt.Clientes=JA,jt.CustomSnackbar=Jc,jt.EventsProvider=eA,jt.ModalCorreo=x3,jt.MyCalendar=cA,jt.useAuth=ac,jt.useAuthRepository=Ti,jt.useEventRepository=kc,Object.defineProperty(jt,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.39",
4
+ "version": "0.2.40",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",