componentes-exagono 0.2.75 → 0.2.76

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
@@ -18303,6 +18303,8 @@ const _5 = /* @__PURE__ */ pt(w5), S5 = "data:image/png;base64,iVBORw0KGgoAAAANS
18303
18303
  label: "Título",
18304
18304
  fullWidth: !0,
18305
18305
  variant: "outlined",
18306
+ multiline: !0,
18307
+ maxRows: 4,
18306
18308
  size: "small",
18307
18309
  error: !!Oe.titulo,
18308
18310
  helperText: Oe.titulo?.message,
package/dist/index.umd.js CHANGED
@@ -174,7 +174,7 @@ const theme2 = createTheme({ palette: {
174
174
  } else {
175
175
  newResult[${w}] = ${S}.value;
176
176
  }
177
- `)}g.write("payload.value = newResult;"),g.write("return payload;");const C=g.compile();return(E,S)=>C(h,E,S)};let s;const i=wi,a=!Of.jitless,d=a&&mw.value,u=r.catchall;let f;e._zod.parse=(h,g)=>{f??(f=n.value);const y=h.value;return i(y)?a&&d&&g?.async===!1&&g.jitless!==!0?(s||(s=o(r.shape)),h=s(h,g),u?Kf([],y,h,g,f,e):h):t(h,g):(h.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),h)}});function Qf(e,r,t,n){for(const s of e)if(s.issues.length===0)return r.value=s.value,r;const o=e.filter(s=>!Hn(s));return o.length===1?(r.value=o[0].value,o[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:t,errors:e.map(s=>s.issues.map(i=>_n(i,n,wn())))}),r)}const sS=q("$ZodUnion",(e,r)=>{Mt.init(e,r),mt(e._zod,"optin",()=>r.options.some(o=>o._zod.optin==="optional")?"optional":void 0),mt(e._zod,"optout",()=>r.options.some(o=>o._zod.optout==="optional")?"optional":void 0),mt(e._zod,"values",()=>{if(r.options.every(o=>o._zod.values))return new Set(r.options.flatMap(o=>Array.from(o._zod.values)))}),mt(e._zod,"pattern",()=>{if(r.options.every(o=>o._zod.pattern)){const o=r.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>dc(s.source)).join("|")})$`)}});const t=r.options.length===1,n=r.options[0]._zod.run;e._zod.parse=(o,s)=>{if(t)return n(o,s);let i=!1;const a=[];for(const c of r.options){const d=c._zod.run({value:o.value,issues:[]},s);if(d instanceof Promise)a.push(d),i=!0;else{if(d.issues.length===0)return d;a.push(d)}}return i?Promise.all(a).then(c=>Qf(c,o,e,s)):Qf(a,o,e,s)}}),iS=q("$ZodIntersection",(e,r)=>{Mt.init(e,r),e._zod.parse=(t,n)=>{const o=t.value,s=r.left._zod.run({value:o,issues:[]},n),i=r.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,d])=>Jf(t,c,d)):Jf(t,s,i)}});function mc(e,r){if(e===r)return{valid:!0,data:e};if(e instanceof Date&&r instanceof Date&&+e==+r)return{valid:!0,data:e};if(Po(e)&&Po(r)){const t=Object.keys(r),n=Object.keys(e).filter(s=>t.indexOf(s)!==-1),o={...e,...r};for(const s of n){const i=mc(e[s],r[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(r)){if(e.length!==r.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let n=0;n<e.length;n++){const o=e[n],s=r[n],i=mc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};t.push(i.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Jf(e,r,t){if(r.issues.length&&e.issues.push(...r.issues),t.issues.length&&e.issues.push(...t.issues),Hn(e))return e;const n=mc(r.value,t.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const aS=q("$ZodEnum",(e,r)=>{Mt.init(e,r);const t=fw(r.entries),n=new Set(t);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.filter(o=>gw.has(typeof o)).map(o=>typeof o=="string"?Yn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t,input:i,inst:e}),o}}),cS=q("$ZodLiteral",(e,r)=>{if(Mt.init(e,r),r.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(r.values),e._zod.pattern=new RegExp(`^(${r.values.map(t=>typeof t=="string"?Yn(t):t?Yn(t.toString()):String(t)).join("|")})$`),e._zod.parse=(t,n)=>{const o=t.value;return e._zod.values.has(o)||t.issues.push({code:"invalid_value",values:r.values,input:o,inst:e}),t}}),lS=q("$ZodTransform",(e,r)=>{Mt.init(e,r),e._zod.parse=(t,n)=>{if(n.direction==="backward")throw new If(e.constructor.name);const o=r.transform(t.value,t);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(t.value=i,t));if(o instanceof Promise)throw new Un;return t.value=o,t}});function Xf(e,r){return e.issues.length&&r===void 0?{issues:[],value:void 0}:e}const uS=q("$ZodOptional",(e,r)=>{Mt.init(e,r),e._zod.optin="optional",e._zod.optout="optional",mt(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,void 0]):void 0),mt(e._zod,"pattern",()=>{const t=r.innerType._zod.pattern;return t?new RegExp(`^(${dc(t.source)})?$`):void 0}),e._zod.parse=(t,n)=>{if(r.innerType._zod.optin==="optional"){const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Xf(s,t.value)):Xf(o,t.value)}return t.value===void 0?t:r.innerType._zod.run(t,n)}}),dS=q("$ZodNullable",(e,r)=>{Mt.init(e,r),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),mt(e._zod,"pattern",()=>{const t=r.innerType._zod.pattern;return t?new RegExp(`^(${dc(t.source)}|null)$`):void 0}),mt(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,null]):void 0),e._zod.parse=(t,n)=>t.value===null?t:r.innerType._zod.run(t,n)}),fS=q("$ZodDefault",(e,r)=>{Mt.init(e,r),e._zod.optin="optional",mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);if(t.value===void 0)return t.value=r.defaultValue,t;const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>ep(s,r)):ep(o,r)}});function ep(e,r){return e.value===void 0&&(e.value=r.defaultValue),e}const pS=q("$ZodPrefault",(e,r)=>{Mt.init(e,r),e._zod.optin="optional",mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>(n.direction==="backward"||t.value===void 0&&(t.value=r.defaultValue),r.innerType._zod.run(t,n))}),hS=q("$ZodNonOptional",(e,r)=>{Mt.init(e,r),mt(e._zod,"values",()=>{const t=r.innerType._zod.values;return t?new Set([...t].filter(n=>n!==void 0)):void 0}),e._zod.parse=(t,n)=>{const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>tp(s,e)):tp(o,e)}});function tp(e,r){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:r}),e}const mS=q("$ZodCatch",(e,r)=>{Mt.init(e,r),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>(t.value=s.value,s.issues.length&&(t.value=r.catchValue({...t,error:{issues:s.issues.map(i=>_n(i,n,wn()))},input:t.value}),t.issues=[]),t)):(t.value=o.value,o.issues.length&&(t.value=r.catchValue({...t,error:{issues:o.issues.map(s=>_n(s,n,wn()))},input:t.value}),t.issues=[]),t)}}),gS=q("$ZodPipe",(e,r)=>{Mt.init(e,r),mt(e._zod,"values",()=>r.in._zod.values),mt(e._zod,"optin",()=>r.in._zod.optin),mt(e._zod,"optout",()=>r.out._zod.optout),mt(e._zod,"propValues",()=>r.in._zod.propValues),e._zod.parse=(t,n)=>{if(n.direction==="backward"){const s=r.out._zod.run(t,n);return s instanceof Promise?s.then(i=>Mi(i,r.in,n)):Mi(s,r.in,n)}const o=r.in._zod.run(t,n);return o instanceof Promise?o.then(s=>Mi(s,r.out,n)):Mi(o,r.out,n)}});function Mi(e,r,t){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:e.value,issues:e.issues},t)}const vS=q("$ZodReadonly",(e,r)=>{Mt.init(e,r),mt(e._zod,"propValues",()=>r.innerType._zod.propValues),mt(e._zod,"values",()=>r.innerType._zod.values),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(rp):rp(o)}});function rp(e){return e.value=Object.freeze(e.value),e}const yS=q("$ZodCustom",(e,r)=>{rr.init(e,r),Mt.init(e,r),e._zod.parse=(t,n)=>t,e._zod.check=t=>{const n=t.value,o=r.fn(n);if(o instanceof Promise)return o.then(s=>np(s,t,n,e));np(o,t,n,e)}});function np(e,r,t,n){if(!e){const o={code:"custom",input:t,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),r.issues.push(Ro(o))}}class bS{constructor(){this._map=new Map,this._idmap=new Map}add(r,...t){const n=t[0];if(this._map.set(r,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,r)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(r){const t=this._map.get(r);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(r),this}get(r){const t=r._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(r)};return Object.keys(o).length?o:void 0}return this._map.get(r)}has(r){return this._map.has(r)}}function xS(){return new bS}const Ii=xS();function wS(e,r){return new e({type:"string",...Te(r)})}function _S(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(r)})}function op(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(r)})}function SS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(r)})}function CS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(r)})}function ES(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(r)})}function AS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(r)})}function DS(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(r)})}function kS(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(r)})}function TS(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(r)})}function MS(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(r)})}function IS(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(r)})}function OS(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(r)})}function jS(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(r)})}function PS(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(r)})}function RS(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(r)})}function NS(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(r)})}function zS(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(r)})}function LS(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(r)})}function $S(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(r)})}function BS(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(r)})}function FS(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(r)})}function VS(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(r)})}function US(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(r)})}function WS(e,r){return new e({type:"string",format:"date",check:"string_format",...Te(r)})}function YS(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(r)})}function HS(e,r){return new e({type:"string",format:"duration",check:"string_format",...Te(r)})}function qS(e,r){return new e({type:"number",checks:[],...Te(r)})}function ZS(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(r)})}function GS(e,r){return new e({type:"boolean",...Te(r)})}function KS(e){return new e({type:"unknown"})}function QS(e,r){return new e({type:"never",...Te(r)})}function sp(e,r){return new Wf({check:"less_than",...Te(r),value:e,inclusive:!1})}function gc(e,r){return new Wf({check:"less_than",...Te(r),value:e,inclusive:!0})}function ip(e,r){return new Yf({check:"greater_than",...Te(r),value:e,inclusive:!1})}function vc(e,r){return new Yf({check:"greater_than",...Te(r),value:e,inclusive:!0})}function ap(e,r){return new p_({check:"multiple_of",...Te(r),value:e})}function cp(e,r){return new m_({check:"max_length",...Te(r),maximum:e})}function Oi(e,r){return new g_({check:"min_length",...Te(r),minimum:e})}function lp(e,r){return new v_({check:"length_equals",...Te(r),length:e})}function JS(e,r){return new y_({check:"string_format",format:"regex",...Te(r),pattern:e})}function XS(e){return new b_({check:"string_format",format:"lowercase",...Te(e)})}function eC(e){return new x_({check:"string_format",format:"uppercase",...Te(e)})}function tC(e,r){return new w_({check:"string_format",format:"includes",...Te(r),includes:e})}function rC(e,r){return new __({check:"string_format",format:"starts_with",...Te(r),prefix:e})}function nC(e,r){return new S_({check:"string_format",format:"ends_with",...Te(r),suffix:e})}function No(e){return new C_({check:"overwrite",tx:e})}function oC(e){return No(r=>r.normalize(e))}function sC(){return No(e=>e.trim())}function iC(){return No(e=>e.toLowerCase())}function aC(){return No(e=>e.toUpperCase())}function cC(e,r,t){return new e({type:"array",element:r,...Te(t)})}function lC(e,r,t){return new e({type:"custom",check:"custom",fn:r,...Te(t)})}function uC(e){const r=dC(t=>(t.addIssue=n=>{if(typeof n=="string")t.issues.push(Ro(n,t.value,r._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),t.issues.push(Ro(o))}},e(t.value,t)));return r}function dC(e,r){const t=new rr({check:"custom",...Te(r)});return t._zod.check=e,t}const fC=q("ZodISODateTime",(e,r)=>{L_.init(e,r),At.init(e,r)});function pC(e){return US(fC,e)}const hC=q("ZodISODate",(e,r)=>{$_.init(e,r),At.init(e,r)});function mC(e){return WS(hC,e)}const gC=q("ZodISOTime",(e,r)=>{B_.init(e,r),At.init(e,r)});function vC(e){return YS(gC,e)}const yC=q("ZodISODuration",(e,r)=>{F_.init(e,r),At.init(e,r)});function bC(e){return HS(yC,e)}const gr=q("ZodError",(e,r)=>{pc.init(e,r),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>Dw(e,t)},flatten:{value:t=>Aw(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,cc,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,cc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),xC=Ci(gr),wC=Ei(gr),_C=Ai(gr),SC=Di(gr),CC=Ow(gr),EC=jw(gr),AC=Pw(gr),DC=Rw(gr),kC=Nw(gr),TC=zw(gr),MC=Lw(gr),IC=$w(gr),Nt=q("ZodType",(e,r)=>(Mt.init(e,r),e.def=r,e.type=r.type,Object.defineProperty(e,"_def",{value:r}),e.check=(...t)=>e.clone({...r,checks:[...r.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(t,n)=>sn(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>xC(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>_C(e,t,n),e.parseAsync=async(t,n)=>wC(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>SC(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>CC(e,t,n),e.decode=(t,n)=>EC(e,t,n),e.encodeAsync=async(t,n)=>AC(e,t,n),e.decodeAsync=async(t,n)=>DC(e,t,n),e.safeEncode=(t,n)=>kC(e,t,n),e.safeDecode=(t,n)=>TC(e,t,n),e.safeEncodeAsync=async(t,n)=>MC(e,t,n),e.safeDecodeAsync=async(t,n)=>IC(e,t,n),e.refine=(t,n)=>e.check(SE(t,n)),e.superRefine=t=>e.check(CE(t)),e.overwrite=t=>e.check(No(t)),e.optional=()=>bp(e),e.nullable=()=>xp(e),e.nullish=()=>bp(xp(e)),e.nonoptional=t=>gE(e,t),e.array=()=>mp(e),e.or=t=>oE([e,t]),e.and=t=>iE(e,t),e.transform=t=>_p(e,uE(t)),e.default=t=>pE(e,t),e.prefault=t=>mE(e,t),e.catch=t=>yE(e,t),e.pipe=t=>_p(e,t),e.readonly=()=>wE(e),e.describe=t=>{const n=e.clone();return Ii.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return Ii.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Ii.get(e);const n=e.clone();return Ii.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),up=q("_ZodString",(e,r)=>{hc.init(e,r),Nt.init(e,r);const t=e._zod.bag;e.format=t.format??null,e.minLength=t.minimum??null,e.maxLength=t.maximum??null,e.regex=(...n)=>e.check(JS(...n)),e.includes=(...n)=>e.check(tC(...n)),e.startsWith=(...n)=>e.check(rC(...n)),e.endsWith=(...n)=>e.check(nC(...n)),e.min=(...n)=>e.check(Oi(...n)),e.max=(...n)=>e.check(cp(...n)),e.length=(...n)=>e.check(lp(...n)),e.nonempty=(...n)=>e.check(Oi(1,...n)),e.lowercase=n=>e.check(XS(n)),e.uppercase=n=>e.check(eC(n)),e.trim=()=>e.check(sC()),e.normalize=(...n)=>e.check(oC(...n)),e.toLowerCase=()=>e.check(iC()),e.toUpperCase=()=>e.check(aC())}),OC=q("ZodString",(e,r)=>{hc.init(e,r),up.init(e,r),e.email=t=>e.check(_S(jC,t)),e.url=t=>e.check(DS(PC,t)),e.jwt=t=>e.check(VS(GC,t)),e.emoji=t=>e.check(kS(RC,t)),e.guid=t=>e.check(op(dp,t)),e.uuid=t=>e.check(SS(ji,t)),e.uuidv4=t=>e.check(CS(ji,t)),e.uuidv6=t=>e.check(ES(ji,t)),e.uuidv7=t=>e.check(AS(ji,t)),e.nanoid=t=>e.check(TS(NC,t)),e.guid=t=>e.check(op(dp,t)),e.cuid=t=>e.check(MS(zC,t)),e.cuid2=t=>e.check(IS(LC,t)),e.ulid=t=>e.check(OS($C,t)),e.base64=t=>e.check($S(HC,t)),e.base64url=t=>e.check(BS(qC,t)),e.xid=t=>e.check(jS(BC,t)),e.ksuid=t=>e.check(PS(FC,t)),e.ipv4=t=>e.check(RS(VC,t)),e.ipv6=t=>e.check(NS(UC,t)),e.cidrv4=t=>e.check(zS(WC,t)),e.cidrv6=t=>e.check(LS(YC,t)),e.e164=t=>e.check(FS(ZC,t)),e.datetime=t=>e.check(pC(t)),e.date=t=>e.check(mC(t)),e.time=t=>e.check(vC(t)),e.duration=t=>e.check(bC(t))});function vr(e){return wS(OC,e)}const At=q("ZodStringFormat",(e,r)=>{_t.init(e,r),up.init(e,r)}),jC=q("ZodEmail",(e,r)=>{T_.init(e,r),At.init(e,r)}),dp=q("ZodGUID",(e,r)=>{D_.init(e,r),At.init(e,r)}),ji=q("ZodUUID",(e,r)=>{k_.init(e,r),At.init(e,r)}),PC=q("ZodURL",(e,r)=>{M_.init(e,r),At.init(e,r)}),RC=q("ZodEmoji",(e,r)=>{I_.init(e,r),At.init(e,r)}),NC=q("ZodNanoID",(e,r)=>{O_.init(e,r),At.init(e,r)}),zC=q("ZodCUID",(e,r)=>{j_.init(e,r),At.init(e,r)}),LC=q("ZodCUID2",(e,r)=>{P_.init(e,r),At.init(e,r)}),$C=q("ZodULID",(e,r)=>{R_.init(e,r),At.init(e,r)}),BC=q("ZodXID",(e,r)=>{N_.init(e,r),At.init(e,r)}),FC=q("ZodKSUID",(e,r)=>{z_.init(e,r),At.init(e,r)}),VC=q("ZodIPv4",(e,r)=>{V_.init(e,r),At.init(e,r)}),UC=q("ZodIPv6",(e,r)=>{U_.init(e,r),At.init(e,r)}),WC=q("ZodCIDRv4",(e,r)=>{W_.init(e,r),At.init(e,r)}),YC=q("ZodCIDRv6",(e,r)=>{Y_.init(e,r),At.init(e,r)}),HC=q("ZodBase64",(e,r)=>{H_.init(e,r),At.init(e,r)}),qC=q("ZodBase64URL",(e,r)=>{Z_.init(e,r),At.init(e,r)}),ZC=q("ZodE164",(e,r)=>{G_.init(e,r),At.init(e,r)}),GC=q("ZodJWT",(e,r)=>{Q_.init(e,r),At.init(e,r)}),fp=q("ZodNumber",(e,r)=>{qf.init(e,r),Nt.init(e,r),e.gt=(n,o)=>e.check(ip(n,o)),e.gte=(n,o)=>e.check(vc(n,o)),e.min=(n,o)=>e.check(vc(n,o)),e.lt=(n,o)=>e.check(sp(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(pp(n)),e.safe=n=>e.check(pp(n)),e.positive=n=>e.check(ip(0,n)),e.nonnegative=n=>e.check(vc(0,n)),e.negative=n=>e.check(sp(0,n)),e.nonpositive=n=>e.check(gc(0,n)),e.multipleOf=(n,o)=>e.check(ap(n,o)),e.step=(n,o)=>e.check(ap(n,o)),e.finite=()=>e;const t=e._zod.bag;e.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),e.isFinite=!0,e.format=t.format??null});function Pi(e){return qS(fp,e)}const KC=q("ZodNumberFormat",(e,r)=>{J_.init(e,r),fp.init(e,r)});function pp(e){return ZS(KC,e)}const QC=q("ZodBoolean",(e,r)=>{X_.init(e,r),Nt.init(e,r)});function zo(e){return GS(QC,e)}const JC=q("ZodUnknown",(e,r)=>{eS.init(e,r),Nt.init(e,r)});function hp(){return KS(JC)}const XC=q("ZodNever",(e,r)=>{tS.init(e,r),Nt.init(e,r)});function eE(e){return QS(XC,e)}const tE=q("ZodArray",(e,r)=>{rS.init(e,r),Nt.init(e,r),e.element=r.element,e.min=(t,n)=>e.check(Oi(t,n)),e.nonempty=t=>e.check(Oi(1,t)),e.max=(t,n)=>e.check(cp(t,n)),e.length=(t,n)=>e.check(lp(t,n)),e.unwrap=()=>e.element});function mp(e,r){return cC(tE,e,r)}const rE=q("ZodObject",(e,r)=>{oS.init(e,r),Nt.init(e,r),mt(e,"shape",()=>r.shape),e.keyof=()=>vp(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:hp()}),e.loose=()=>e.clone({...e._zod.def,catchall:hp()}),e.strict=()=>e.clone({...e._zod.def,catchall:eE()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ww(e,t),e.safeExtend=t=>_w(e,t),e.merge=t=>Sw(e,t),e.pick=t=>bw(e,t),e.omit=t=>xw(e,t),e.partial=(...t)=>Cw(yp,e,t[0]),e.required=(...t)=>Ew(wp,e,t[0])});function gp(e,r){const t={type:"object",get shape(){return on(this,"shape",e?hw(e):{}),this.shape},...Te(r)};return new rE(t)}const nE=q("ZodUnion",(e,r)=>{sS.init(e,r),Nt.init(e,r),e.options=r.options});function oE(e,r){return new nE({type:"union",options:e,...Te(r)})}const sE=q("ZodIntersection",(e,r)=>{iS.init(e,r),Nt.init(e,r)});function iE(e,r){return new sE({type:"intersection",left:e,right:r})}const yc=q("ZodEnum",(e,r)=>{aS.init(e,r),Nt.init(e,r),e.enum=r.entries,e.options=Object.values(r.entries);const t=new Set(Object.keys(r.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(t.has(i))s[i]=r.entries[i];else throw new Error(`Key ${i} not found in enum`);return new yc({...r,checks:[],...Te(o),entries:s})},e.exclude=(n,o)=>{const s={...r.entries};for(const i of n)if(t.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new yc({...r,checks:[],...Te(o),entries:s})}});function vp(e,r){const t=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new yc({type:"enum",entries:t,...Te(r)})}const aE=q("ZodLiteral",(e,r)=>{cS.init(e,r),Nt.init(e,r),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function cE(e,r){return new aE({type:"literal",values:Array.isArray(e)?e:[e],...Te(r)})}const lE=q("ZodTransform",(e,r)=>{lS.init(e,r),Nt.init(e,r),e._zod.parse=(t,n)=>{if(n.direction==="backward")throw new If(e.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(Ro(s,t.value,r));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),t.issues.push(Ro(i))}};const o=r.transform(t.value,t);return o instanceof Promise?o.then(s=>(t.value=s,t)):(t.value=o,t)}});function uE(e){return new lE({type:"transform",transform:e})}const yp=q("ZodOptional",(e,r)=>{uS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function bp(e){return new yp({type:"optional",innerType:e})}const dE=q("ZodNullable",(e,r)=>{dS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function xp(e){return new dE({type:"nullable",innerType:e})}const fE=q("ZodDefault",(e,r)=>{fS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pE(e,r){return new fE({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():Nf(r)}})}const hE=q("ZodPrefault",(e,r)=>{pS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function mE(e,r){return new hE({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():Nf(r)}})}const wp=q("ZodNonOptional",(e,r)=>{hS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function gE(e,r){return new wp({type:"nonoptional",innerType:e,...Te(r)})}const vE=q("ZodCatch",(e,r)=>{mS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yE(e,r){return new vE({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}const bE=q("ZodPipe",(e,r)=>{gS.init(e,r),Nt.init(e,r),e.in=r.in,e.out=r.out});function _p(e,r){return new bE({type:"pipe",in:e,out:r})}const xE=q("ZodReadonly",(e,r)=>{vS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function wE(e){return new xE({type:"readonly",innerType:e})}const _E=q("ZodCustom",(e,r)=>{yS.init(e,r),Nt.init(e,r)});function SE(e,r={}){return lC(_E,e,r)}function CE(e){return uC(e)}const bc=()=>{const{calendarApiUrl:e}=sc(),r=async(p,b)=>{try{return(await bt.get(`${e}/api/Calendario/v1/local/ListarEventosXUsuario/${p}/${b}`)).data.map(C=>{const E=new Date(C.fechaInicio),S=new Date(C.fechaFin),w=C.solicitudRelacionada?.[0]?.nombreCliente??null;return{...C,fechaInicio:E,fechaFin:S,client:w}})}catch(_){return console.error("Error events:",_),[]}},t=async(p,b)=>{try{const _=await bt.post(`${e}/api/Calendario/v1/local/InsertarEvento/${b}`,p);return{..._.data,fechaInicio:new Date(_.data.fechaInicio),fechaFin:new Date(_.data.fechaFin)}}catch(_){throw console.log("Error creating event:",_),_}},n=async p=>{try{const b=await bt.post(`${e}/api/Calendario/v1/local/ActualizarEvento/${p.eventoID}`,p);return{eventoID:b.data.eventoID,titulo:b.data.titulo,descripcion:b.data.descripcion,fechaInicio:new Date(b.data.fechaInicio),fechaFin:new Date(b.data.fechaFin),todoElDia:b.data.todoElDia,color:b.data.color,repetir:b.data.repetir,link:b.data.link,solID:b.data.solID,disID:b.data.disID,client:b.data.client,esOrganizador:b.data.esOrganizador}}catch(b){throw console.log("Error updating event:",b),b}},o=async p=>{try{const b=await bt.get(`${e}/api/Calendario/v1/local/ObtenerEvento/${p}`),_=b.data[0].solicitudRelacionada?.[0]?.nombreCliente||null;return{...b.data[0],fechaInicio:b.data[0].fechaInicio,fechaFin:b.data[0].fechaFin,client:_}}catch(b){throw console.error(`Error fetching event with ID ${p}:`,b),b}},s=async p=>{try{await bt.post(`${e}/api/Calendario/v1/local/EliminarEvento/${p}`)}catch(b){throw console.log(`Error ID ${p}:`,b),b}},i=v.useCallback(async(p,b,_,C,E)=>{try{const S={masNombreBD:_,usrID:C,disID:b,nombreCliente:p,tiposSolicitud:E},B=(await bt.post(`${e}/api/Calendario/v1/local/ConsultaClientesXUsuariologgeado/`,S)).data?.data;return Array.isArray(B)?B.map(A=>({clienteID:A.clienteID,solID:A.solID,marca:A?.marca,modelo:A?.modelo,nombreCliente:A?.nombreCliente,email:A?.email,tel:A?.tel})):[]}catch(S){return console.error("Error clientes:",S),[]}},[e]),a=async(p,b)=>{try{const _={disID:p,usrMail:b},E=(await bt.post(`${e}/api/Calendario/v1/Consulta_UsuariosInvitados/`,_)).data?.data;return Array.isArray(E)?E.map(S=>({usrID:S.usrID,usrNombre:S.usrNombre,usrMail:S?.usrMail,disID:S?.disID})):[]}catch(_){return console.error("Error usuarios:",_),[]}},c=async(p,b,_,C,E)=>{const S={tieneConflicto:!1,usrMail:""};try{const w={disID:p,usrMail:b,startDate:_,horaInicio:C,horaFin:E};return(await bt.post(`${e}/api/Calendario/v1/local/ConsultaConflictoInvitados`,w)).data?.data}catch(w){return console.error("Error al verificar conflicto:",w),S}},d=async(p,b,_,C)=>{try{const E={disID:p,usrMail:b,startDate:_,DuracionEvento:C},w=(await bt.post(`${e}/api/Calendario/v1/local/ConsultaDisponibilidadUsuario`,E)).data?.data;return Array.isArray(w)?w.map(B=>({Fecha:B.fecha,HoraInicio:B.horaInicio,HoraFin:B.horaFin})):[]}catch(E){return console.error("Error usuarios:",E),[]}},u=v.useCallback(async(p,b)=>{try{return(await bt.post(`${e}/api/Notificaciones/v1/local/ObtenerNotificacionesPorUsuarioAsync/${p}/${b}?soloNoLeidas=true`)).data}catch(_){return console.error("Error usuarios:",_),[]}},[e]);return{getEventsByUser:r,createEvent:t,updateEvent:n,getEventById:o,deleteEvent:s,getClients:i,getUsuariosInvitados:a,VerificarConflicto:c,getDisponibilidadUsuario:d,getNotificacionesXUsuario:u,UpdateStatusEvento:async(p,b,_)=>{try{const C={EventoID:p,UsuarioID:b,status:_};return(await bt.post(`${e}/api/Calendario/v1/local/ActualizarEstadoInvitacionAsync/`,C)).data}catch(C){return console.error("Error Actualizar estatus:",C),{}}},MarcarLeido:async(p,b)=>{try{return(await bt.post(`${e}/api/Notificaciones/v1/local/MarcarComoLeidaAsync/${p}?usuarioId=${b}&marcarComoLeida=true`)).data?.data}catch(_){return console.error("Error Actualizar estatus:",_),{}}},ReenviarNotificacion:async(p,b)=>{try{return(await bt.post(`${e}/api/Calendario/v1/local/ReenviarNotificacion/${b}/${p}`)).data?.data}catch(_){return console.error("Error Actualizar estatus:",_),{}}},insertarEventoGoogle:async(p,b,_,C)=>{try{const E=`api/Calendario/v1/google/InsertarEvento?disID=${p}&usrMail=${b}&incluirMeet=${_}`;return(await bt.post(`${e}/${E}`,C)).data}catch(E){throw console.error("Error al insertar evento en Google:",E),E}}}};var Lo={},Sp;function EE(){if(Sp)return Lo;Sp=1;var e=at();Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.default=void 0;var r=e(pt()),t=ut();return Lo.default=(0,r.default)([(0,t.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,t.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime"),Lo}var AE=EE();const xc=it(AE);var $o=e=>e.type==="checkbox",Sn=e=>e instanceof Date,Jt=e=>e==null;const Cp=e=>typeof e=="object";var zt=e=>!Jt(e)&&!Array.isArray(e)&&Cp(e)&&!Sn(e),Ep=e=>zt(e)&&e.target?$o(e.target)?e.target.checked:e.target.value:e,DE=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ap=(e,r)=>e.has(DE(r)),kE=e=>{const r=e.constructor&&e.constructor.prototype;return zt(r)&&r.hasOwnProperty("isPrototypeOf")},wc=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ft(e){let r;const t=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(!(wc&&(e instanceof Blob||n))&&(t||zt(e)))if(r=t?[]:Object.create(Object.getPrototypeOf(e)),!t&&!kE(e))r=e;else for(const o in e)e.hasOwnProperty(o)&&(r[o]=Ft(e[o]));else return e;return r}var Ri=e=>/^\w*$/.test(e),Lt=e=>e===void 0,_c=e=>Array.isArray(e)?e.filter(Boolean):[],Sc=e=>_c(e.replace(/["|']|\]/g,"").split(/\.|\[/)),he=(e,r,t)=>{if(!r||!zt(e))return t;const n=(Ri(r)?[r]:Sc(r)).reduce((o,s)=>Jt(o)?o:o[s],e);return Lt(n)||n===e?Lt(e[r])?t:e[r]:n},lr=e=>typeof e=="boolean",ct=(e,r,t)=>{let n=-1;const o=Ri(r)?[r]:Sc(r),s=o.length,i=s-1;for(;++n<s;){const a=o[n];let c=t;if(n!==i){const d=e[a];c=zt(d)||Array.isArray(d)?d:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const Ni={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Er={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Zr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Cc=v.createContext(null);Cc.displayName="HookFormContext";const Ec=()=>v.useContext(Cc),TE=e=>{const{children:r,...t}=e;return v.createElement(Cc.Provider,{value:t},r)};var Dp=(e,r,t,n=!0)=>{const o={defaultValues:r._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return r._proxyFormState[i]!==Er.all&&(r._proxyFormState[i]=!n||Er.all),t&&(t[i]=!0),e[i]}});return o};const Ac=typeof window<"u"?v.useLayoutEffect:v.useEffect;function ME(e){const r=Ec(),{control:t=r.control,disabled:n,name:o,exact:s}=e||{},[i,a]=v.useState(t._formState),c=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ac(()=>t._subscribe({name:o,formState:c.current,exact:s,callback:d=>{!n&&a({...t._formState,...d})}}),[o,n,s]),v.useEffect(()=>{c.current.isValid&&t._setValid(!0)},[t]),v.useMemo(()=>Dp(i,t,c.current,!1),[i,t])}var Vr=e=>typeof e=="string",kp=(e,r,t,n,o)=>Vr(e)?(n&&r.watch.add(e),he(t,e,o)):Array.isArray(e)?e.map(s=>(n&&r.watch.add(s),he(t,s))):(n&&(r.watchAll=!0),t),Dc=e=>Jt(e)||!Cp(e);function Gr(e,r,t=new WeakSet){if(Dc(e)||Dc(r))return e===r;if(Sn(e)&&Sn(r))return e.getTime()===r.getTime();const n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const s of n){const i=e[s];if(!o.includes(s))return!1;if(s!=="ref"){const a=r[s];if(Sn(i)&&Sn(a)||zt(i)&&zt(a)||Array.isArray(i)&&Array.isArray(a)?!Gr(i,a,t):i!==a)return!1}}return!0}function Tp(e){const r=Ec(),{control:t=r.control,name:n,defaultValue:o,disabled:s,exact:i,compute:a}=e||{},c=v.useRef(o),d=v.useRef(a),u=v.useRef(void 0);d.current=a;const f=v.useMemo(()=>t._getWatch(n,c.current),[t,n]),[h,g]=v.useState(d.current?d.current(f):f);return Ac(()=>t._subscribe({name:n,formState:{values:!0},exact:i,callback:y=>{if(!s){const p=kp(n,t._names,y.values||t._formValues,!1,c.current);if(d.current){const b=d.current(p);Gr(b,u.current)||(g(b),u.current=b)}else g(p)}}}),[t,s,n,i]),v.useEffect(()=>t._removeUnmounted()),h}function IE(e){const r=Ec(),{name:t,disabled:n,control:o=r.control,shouldUnregister:s,defaultValue:i}=e,a=Ap(o._names.array,t),c=v.useMemo(()=>he(o._formValues,t,he(o._defaultValues,t,i)),[o,t,i]),d=Tp({control:o,name:t,defaultValue:c,exact:!0}),u=ME({control:o,name:t,exact:!0}),f=v.useRef(e),h=v.useRef(o.register(t,{...e.rules,value:d,...lr(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const g=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!he(u.errors,t)},isDirty:{enumerable:!0,get:()=>!!he(u.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!he(u.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!he(u.validatingFields,t)},error:{enumerable:!0,get:()=>he(u.errors,t)}}),[u,t]),y=v.useCallback(C=>h.current.onChange({target:{value:Ep(C),name:t},type:Ni.CHANGE}),[t]),p=v.useCallback(()=>h.current.onBlur({target:{value:he(o._formValues,t),name:t},type:Ni.BLUR}),[t,o._formValues]),b=v.useCallback(C=>{const E=he(o._fields,t);E&&C&&(E._f.ref={focus:()=>C.focus&&C.focus(),select:()=>C.select&&C.select(),setCustomValidity:S=>C.setCustomValidity(S),reportValidity:()=>C.reportValidity()})},[o._fields,t]),_=v.useMemo(()=>({name:t,value:d,...lr(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:y,onBlur:p,ref:b}),[t,n,u.disabled,y,p,b,d]);return v.useEffect(()=>{const C=o._options.shouldUnregister||s;o.register(t,{...f.current.rules,...lr(f.current.disabled)?{disabled:f.current.disabled}:{}});const E=(S,w)=>{const B=he(o._fields,S);B&&B._f&&(B._f.mount=w)};if(E(t,!0),C){const S=Ft(he(o._options.defaultValues,t));ct(o._defaultValues,t,S),Lt(he(o._formValues,t))&&ct(o._formValues,t,S)}return!a&&o.register(t),()=>{(a?C&&!o._state.action:C)?o.unregister(t):E(t,!1)}},[t,o,a,s]),v.useEffect(()=>{o._setDisabledField({disabled:n,name:t})},[n,t,o]),v.useMemo(()=>({field:_,formState:u,fieldState:g}),[_,u,g])}const Ar=e=>e.render(IE(e));var kc=(e,r,t,n,o)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[n]:o||!0}}:{},Bo=e=>Array.isArray(e)?e:[e],Mp=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},nr=e=>zt(e)&&!Object.keys(e).length,Tc=e=>e.type==="file",Dr=e=>typeof e=="function",zi=e=>{if(!wc)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Ip=e=>e.type==="select-multiple",Mc=e=>e.type==="radio",OE=e=>Mc(e)||$o(e),Ic=e=>zi(e)&&e.isConnected;function jE(e,r){const t=r.slice(0,-1).length;let n=0;for(;n<t;)e=Lt(e)?n++:e[r[n++]];return e}function PE(e){for(const r in e)if(e.hasOwnProperty(r)&&!Lt(e[r]))return!1;return!0}function Bt(e,r){const t=Array.isArray(r)?r:Ri(r)?[r]:Sc(r),n=t.length===1?e:jE(e,t),o=t.length-1,s=t[o];return n&&delete n[s],o!==0&&(zt(n)&&nr(n)||Array.isArray(n)&&PE(n))&&Bt(e,t.slice(0,-1)),e}var Op=e=>{for(const r in e)if(Dr(e[r]))return!0;return!1};function Li(e,r={}){const t=Array.isArray(e);if(zt(e)||t)for(const n in e)Array.isArray(e[n])||zt(e[n])&&!Op(e[n])?(r[n]=Array.isArray(e[n])?[]:{},Li(e[n],r[n])):Jt(e[n])||(r[n]=!0);return r}function jp(e,r,t){const n=Array.isArray(e);if(zt(e)||n)for(const o in e)Array.isArray(e[o])||zt(e[o])&&!Op(e[o])?Lt(r)||Dc(t[o])?t[o]=Array.isArray(e[o])?Li(e[o],[]):{...Li(e[o])}:jp(e[o],Jt(r)?{}:r[o],t[o]):t[o]=!Gr(e[o],r[o]);return t}var Fo=(e,r)=>jp(e,r,Li(r));const Pp={value:!1,isValid:!1},Rp={value:!0,isValid:!0};var Np=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Lt(e[0].attributes.value)?Lt(e[0].value)||e[0].value===""?Rp:{value:e[0].value,isValid:!0}:Rp:Pp}return Pp},zp=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:n})=>Lt(e)?e:r?e===""?NaN:e&&+e:t&&Vr(e)?new Date(e):n?n(e):e;const Lp={isValid:!1,value:null};var $p=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,Lp):Lp;function Bp(e){const r=e.ref;return Tc(r)?r.files:Mc(r)?$p(e.refs).value:Ip(r)?[...r.selectedOptions].map(({value:t})=>t):$o(r)?Np(e.refs).value:zp(Lt(r.value)?e.ref.value:r.value,e)}var RE=(e,r,t,n)=>{const o={};for(const s of e){const i=he(r,s);i&&ct(o,s,i._f)}return{criteriaMode:t,names:[...e],fields:o,shouldUseNativeValidation:n}},$i=e=>e instanceof RegExp,Vo=e=>Lt(e)?e:$i(e)?e.source:zt(e)?$i(e.value)?e.value.source:e.value:e,Fp=e=>({isOnSubmit:!e||e===Er.onSubmit,isOnBlur:e===Er.onBlur,isOnChange:e===Er.onChange,isOnAll:e===Er.all,isOnTouch:e===Er.onTouched});const Vp="AsyncFunction";var NE=e=>!!e&&!!e.validate&&!!(Dr(e.validate)&&e.validate.constructor.name===Vp||zt(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===Vp)),zE=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Up=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Uo=(e,r,t,n)=>{for(const o of t||Object.keys(e)){const s=he(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&r(i.refs[0],o)&&!n)return!0;if(i.ref&&r(i.ref,i.name)&&!n)return!0;if(Uo(a,r))break}else if(zt(a)&&Uo(a,r))break}}};function Wp(e,r,t){const n=he(e,t);if(n||Ri(t))return{error:n,name:t};const o=t.split(".");for(;o.length;){const s=o.join("."),i=he(r,s),a=he(e,s);if(i&&!Array.isArray(i)&&t!==s)return{name:t};if(a&&a.type)return{name:s,error:a};if(a&&a.root&&a.root.type)return{name:`${s}.root`,error:a.root};o.pop()}return{name:t}}var LE=(e,r,t,n)=>{t(e);const{name:o,...s}=e;return nr(s)||Object.keys(s).length>=Object.keys(r).length||Object.keys(s).find(i=>r[i]===(!n||Er.all))},$E=(e,r,t)=>!e||!r||e===r||Bo(e).some(n=>n&&(t?n===r:n.startsWith(r)||r.startsWith(n))),BE=(e,r,t,n,o)=>o.isOnAll?!1:!t&&o.isOnTouch?!(r||e):(t?n.isOnBlur:o.isOnBlur)?!e:(t?n.isOnChange:o.isOnChange)?e:!0,FE=(e,r)=>!_c(he(e,r)).length&&Bt(e,r),VE=(e,r,t)=>{const n=Bo(he(e,t));return ct(n,"root",r[t]),ct(e,t,n),e},Bi=e=>Vr(e);function Yp(e,r,t="validate"){if(Bi(e)||Array.isArray(e)&&e.every(Bi)||lr(e)&&!e)return{type:t,message:Bi(e)?e:"",ref:r}}var qn=e=>zt(e)&&!$i(e)?e:{value:e,message:""},Hp=async(e,r,t,n,o,s)=>{const{ref:i,refs:a,required:c,maxLength:d,minLength:u,min:f,max:h,pattern:g,validate:y,name:p,valueAsNumber:b,mount:_}=e._f,C=he(t,p);if(!_||r.has(p))return{};const E=a?a[0]:i,S=Z=>{o&&E.reportValidity&&(E.setCustomValidity(lr(Z)?"":Z||""),E.reportValidity())},w={},B=Mc(i),A=$o(i),T=B||A,I=(b||Tc(i))&&Lt(i.value)&&Lt(C)||zi(i)&&i.value===""||C===""||Array.isArray(C)&&!C.length,M=kc.bind(null,p,n,w),W=(Z,V,H,te=Zr.maxLength,Y=Zr.minLength)=>{const N=Z?V:H;w[p]={type:Z?te:Y,message:N,ref:i,...M(Z?te:Y,N)}};if(s?!Array.isArray(C)||!C.length:c&&(!T&&(I||Jt(C))||lr(C)&&!C||A&&!Np(a).isValid||B&&!$p(a).isValid)){const{value:Z,message:V}=Bi(c)?{value:!!c,message:c}:qn(c);if(Z&&(w[p]={type:Zr.required,message:V,ref:E,...M(Zr.required,V)},!n))return S(V),w}if(!I&&(!Jt(f)||!Jt(h))){let Z,V;const H=qn(h),te=qn(f);if(!Jt(C)&&!isNaN(C)){const Y=i.valueAsNumber||C&&+C;Jt(H.value)||(Z=Y>H.value),Jt(te.value)||(V=Y<te.value)}else{const Y=i.valueAsDate||new Date(C),N=z=>new Date(new Date().toDateString()+" "+z),ie=i.type=="time",de=i.type=="week";Vr(H.value)&&C&&(Z=ie?N(C)>N(H.value):de?C>H.value:Y>new Date(H.value)),Vr(te.value)&&C&&(V=ie?N(C)<N(te.value):de?C<te.value:Y<new Date(te.value))}if((Z||V)&&(W(!!Z,H.message,te.message,Zr.max,Zr.min),!n))return S(w[p].message),w}if((d||u)&&!I&&(Vr(C)||s&&Array.isArray(C))){const Z=qn(d),V=qn(u),H=!Jt(Z.value)&&C.length>+Z.value,te=!Jt(V.value)&&C.length<+V.value;if((H||te)&&(W(H,Z.message,V.message),!n))return S(w[p].message),w}if(g&&!I&&Vr(C)){const{value:Z,message:V}=qn(g);if($i(Z)&&!C.match(Z)&&(w[p]={type:Zr.pattern,message:V,ref:i,...M(Zr.pattern,V)},!n))return S(V),w}if(y){if(Dr(y)){const Z=await y(C,t),V=Yp(Z,E);if(V&&(w[p]={...V,...M(Zr.validate,V.message)},!n))return S(V.message),w}else if(zt(y)){let Z={};for(const V in y){if(!nr(Z)&&!n)break;const H=Yp(await y[V](C,t),E,V);H&&(Z={...H,...M(V,H.message)},S(H.message),n&&(w[p]=Z))}if(!nr(Z)&&(w[p]={ref:E,...Z},!n))return w}}return S(!0),w};const UE={mode:Er.onSubmit,reValidateMode:Er.onChange,shouldFocusError:!0};function WE(e={}){let r={...UE,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:Dr(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},n={},o=zt(r.defaultValues)||zt(r.values)?Ft(r.defaultValues||r.values)||{}:{},s=r.shouldUnregister?{}:Ft(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...u};const h={array:Mp(),state:Mp()},g=r.criteriaMode===Er.all,y=D=>O=>{clearTimeout(d),d=setTimeout(D,O)},p=async D=>{if(!r.disabled&&(u.isValid||f.isValid||D)){const O=r.resolver?nr((await A()).errors):await I(n,!0);O!==t.isValid&&h.state.next({isValid:O})}},b=(D,O)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((D||Array.from(a.mount)).forEach(F=>{F&&(O?ct(t.validatingFields,F,O):Bt(t.validatingFields,F))}),h.state.next({validatingFields:t.validatingFields,isValidating:!nr(t.validatingFields)}))},_=(D,O=[],F,ce,ne=!0,j=!0)=>{if(ce&&F&&!r.disabled){if(i.action=!0,j&&Array.isArray(he(n,D))){const G=F(he(n,D),ce.argA,ce.argB);ne&&ct(n,D,G)}if(j&&Array.isArray(he(t.errors,D))){const G=F(he(t.errors,D),ce.argA,ce.argB);ne&&ct(t.errors,D,G),FE(t.errors,D)}if((u.touchedFields||f.touchedFields)&&j&&Array.isArray(he(t.touchedFields,D))){const G=F(he(t.touchedFields,D),ce.argA,ce.argB);ne&&ct(t.touchedFields,D,G)}(u.dirtyFields||f.dirtyFields)&&(t.dirtyFields=Fo(o,s)),h.state.next({name:D,isDirty:W(D,O),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else ct(s,D,O)},C=(D,O)=>{ct(t.errors,D,O),h.state.next({errors:t.errors})},E=D=>{t.errors=D,h.state.next({errors:t.errors,isValid:!1})},S=(D,O,F,ce)=>{const ne=he(n,D);if(ne){const j=he(s,D,Lt(F)?he(o,D):F);Lt(j)||ce&&ce.defaultChecked||O?ct(s,D,O?j:Bp(ne._f)):H(D,j),i.mount&&p()}},w=(D,O,F,ce,ne)=>{let j=!1,G=!1;const pe={name:D};if(!r.disabled){if(!F||ce){(u.isDirty||f.isDirty)&&(G=t.isDirty,t.isDirty=pe.isDirty=W(),j=G!==pe.isDirty);const Oe=Gr(he(o,D),O);G=!!he(t.dirtyFields,D),Oe?Bt(t.dirtyFields,D):ct(t.dirtyFields,D,!0),pe.dirtyFields=t.dirtyFields,j=j||(u.dirtyFields||f.dirtyFields)&&G!==!Oe}if(F){const Oe=he(t.touchedFields,D);Oe||(ct(t.touchedFields,D,F),pe.touchedFields=t.touchedFields,j=j||(u.touchedFields||f.touchedFields)&&Oe!==F)}j&&ne&&h.state.next(pe)}return j?pe:{}},B=(D,O,F,ce)=>{const ne=he(t.errors,D),j=(u.isValid||f.isValid)&&lr(O)&&t.isValid!==O;if(r.delayError&&F?(c=y(()=>C(D,F)),c(r.delayError)):(clearTimeout(d),c=null,F?ct(t.errors,D,F):Bt(t.errors,D)),(F?!Gr(ne,F):ne)||!nr(ce)||j){const G={...ce,...j&&lr(O)?{isValid:O}:{},errors:t.errors,name:D};t={...t,...G},h.state.next(G)}},A=async D=>{b(D,!0);const O=await r.resolver(s,r.context,RE(D||a.mount,n,r.criteriaMode,r.shouldUseNativeValidation));return b(D),O},T=async D=>{const{errors:O}=await A(D);if(D)for(const F of D){const ce=he(O,F);ce?ct(t.errors,F,ce):Bt(t.errors,F)}else t.errors=O;return O},I=async(D,O,F={valid:!0})=>{for(const ce in D){const ne=D[ce];if(ne){const{_f:j,...G}=ne;if(j){const pe=a.array.has(j.name),Oe=ne._f&&NE(ne._f);Oe&&u.validatingFields&&b([ce],!0);const P=await Hp(ne,a.disabled,s,g,r.shouldUseNativeValidation&&!O,pe);if(Oe&&u.validatingFields&&b([ce]),P[j.name]&&(F.valid=!1,O))break;!O&&(he(P,j.name)?pe?VE(t.errors,P,j.name):ct(t.errors,j.name,P[j.name]):Bt(t.errors,j.name))}!nr(G)&&await I(G,O,F)}}return F.valid},M=()=>{for(const D of a.unMount){const O=he(n,D);O&&(O._f.refs?O._f.refs.every(F=>!Ic(F)):!Ic(O._f.ref))&&re(D)}a.unMount=new Set},W=(D,O)=>!r.disabled&&(D&&O&&ct(s,D,O),!Gr(z(),o)),Z=(D,O,F)=>kp(D,a,{...i.mount?s:Lt(O)?o:Vr(D)?{[D]:O}:O},F,O),V=D=>_c(he(i.mount?s:o,D,r.shouldUnregister?he(o,D,[]):[])),H=(D,O,F={})=>{const ce=he(n,D);let ne=O;if(ce){const j=ce._f;j&&(!j.disabled&&ct(s,D,zp(O,j)),ne=zi(j.ref)&&Jt(O)?"":O,Ip(j.ref)?[...j.ref.options].forEach(G=>G.selected=ne.includes(G.value)):j.refs?$o(j.ref)?j.refs.forEach(G=>{(!G.defaultChecked||!G.disabled)&&(Array.isArray(ne)?G.checked=!!ne.find(pe=>pe===G.value):G.checked=ne===G.value||!!ne)}):j.refs.forEach(G=>G.checked=G.value===ne):Tc(j.ref)?j.ref.value="":(j.ref.value=ne,j.ref.type||h.state.next({name:D,values:Ft(s)})))}(F.shouldDirty||F.shouldTouch)&&w(D,ne,F.shouldTouch,F.shouldDirty,!0),F.shouldValidate&&de(D)},te=(D,O,F)=>{for(const ce in O){if(!O.hasOwnProperty(ce))return;const ne=O[ce],j=D+"."+ce,G=he(n,j);(a.array.has(D)||zt(ne)||G&&!G._f)&&!Sn(ne)?te(j,ne,F):H(j,ne,F)}},Y=(D,O,F={})=>{const ce=he(n,D),ne=a.array.has(D),j=Ft(O);ct(s,D,j),ne?(h.array.next({name:D,values:Ft(s)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&F.shouldDirty&&h.state.next({name:D,dirtyFields:Fo(o,s),isDirty:W(D,j)})):ce&&!ce._f&&!Jt(j)?te(D,j,F):H(D,j,F),Up(D,a)&&h.state.next({...t,name:D}),h.state.next({name:i.mount?D:void 0,values:Ft(s)})},N=async D=>{i.mount=!0;const O=D.target;let F=O.name,ce=!0;const ne=he(n,F),j=Oe=>{ce=Number.isNaN(Oe)||Sn(Oe)&&isNaN(Oe.getTime())||Gr(Oe,he(s,F,Oe))},G=Fp(r.mode),pe=Fp(r.reValidateMode);if(ne){let Oe,P;const X=O.type?Bp(ne._f):Ep(D),we=D.type===Ni.BLUR||D.type===Ni.FOCUS_OUT,qe=!zE(ne._f)&&!r.resolver&&!he(t.errors,F)&&!ne._f.deps||BE(we,he(t.touchedFields,F),t.isSubmitted,pe,G),St=Up(F,a,we);ct(s,F,X),we?(!O||!O.readOnly)&&(ne._f.onBlur&&ne._f.onBlur(D),c&&c(0)):ne._f.onChange&&ne._f.onChange(D);const gt=w(F,X,we),Kt=!nr(gt)||St;if(!we&&h.state.next({name:F,type:D.type,values:Ft(s)}),qe)return(u.isValid||f.isValid)&&(r.mode==="onBlur"?we&&p():we||p()),Kt&&h.state.next({name:F,...St?{}:gt});if(!we&&St&&h.state.next({...t}),r.resolver){const{errors:Ht}=await A([F]);if(j(X),ce){const Tr=Wp(t.errors,n,F),It=Wp(Ht,n,Tr.name||F);Oe=It.error,F=It.name,P=nr(Ht)}}else b([F],!0),Oe=(await Hp(ne,a.disabled,s,g,r.shouldUseNativeValidation))[F],b([F]),j(X),ce&&(Oe?P=!1:(u.isValid||f.isValid)&&(P=await I(n,!0)));ce&&(ne._f.deps&&de(ne._f.deps),B(F,P,Oe,gt))}},ie=(D,O)=>{if(he(t.errors,O)&&D.focus)return D.focus(),1},de=async(D,O={})=>{let F,ce;const ne=Bo(D);if(r.resolver){const j=await T(Lt(D)?D:ne);F=nr(j),ce=D?!ne.some(G=>he(j,G)):F}else D?(ce=(await Promise.all(ne.map(async j=>{const G=he(n,j);return await I(G&&G._f?{[j]:G}:G)}))).every(Boolean),!(!ce&&!t.isValid)&&p()):ce=F=await I(n);return h.state.next({...!Vr(D)||(u.isValid||f.isValid)&&F!==t.isValid?{}:{name:D},...r.resolver||!D?{isValid:F}:{},errors:t.errors}),O.shouldFocus&&!ce&&Uo(n,ie,D?ne:a.mount),ce},z=D=>{const O={...i.mount?s:o};return Lt(D)?O:Vr(D)?he(O,D):D.map(F=>he(O,F))},Q=(D,O)=>({invalid:!!he((O||t).errors,D),isDirty:!!he((O||t).dirtyFields,D),error:he((O||t).errors,D),isValidating:!!he(t.validatingFields,D),isTouched:!!he((O||t).touchedFields,D)}),Ee=D=>{D&&Bo(D).forEach(O=>Bt(t.errors,O)),h.state.next({errors:D?t.errors:{}})},xe=(D,O,F)=>{const ce=(he(n,D,{_f:{}})._f||{}).ref,ne=he(t.errors,D)||{},{ref:j,message:G,type:pe,...Oe}=ne;ct(t.errors,D,{...Oe,...O,ref:ce}),h.state.next({name:D,errors:t.errors,isValid:!1}),F&&F.shouldFocus&&ce&&ce.focus&&ce.focus()},_e=(D,O)=>Dr(D)?h.state.subscribe({next:F=>"values"in F&&D(Z(void 0,O),F)}):Z(D,O,!0),oe=D=>h.state.subscribe({next:O=>{$E(D.name,O.name,D.exact)&&LE(O,D.formState||u,st,D.reRenderRoot)&&D.callback({values:{...s},...t,...O,defaultValues:o})}}).unsubscribe,ae=D=>(i.mount=!0,f={...f,...D.formState},oe({...D,formState:f})),re=(D,O={})=>{for(const F of D?Bo(D):a.mount)a.mount.delete(F),a.array.delete(F),O.keepValue||(Bt(n,F),Bt(s,F)),!O.keepError&&Bt(t.errors,F),!O.keepDirty&&Bt(t.dirtyFields,F),!O.keepTouched&&Bt(t.touchedFields,F),!O.keepIsValidating&&Bt(t.validatingFields,F),!r.shouldUnregister&&!O.keepDefaultValue&&Bt(o,F);h.state.next({values:Ft(s)}),h.state.next({...t,...O.keepDirty?{isDirty:W()}:{}}),!O.keepIsValid&&p()},Se=({disabled:D,name:O})=>{(lr(D)&&i.mount||D||a.disabled.has(O))&&(D?a.disabled.add(O):a.disabled.delete(O))},Ce=(D,O={})=>{let F=he(n,D);const ce=lr(O.disabled)||lr(r.disabled);return ct(n,D,{...F||{},_f:{...F&&F._f?F._f:{ref:{name:D}},name:D,mount:!0,...O}}),a.mount.add(D),F?Se({disabled:lr(O.disabled)?O.disabled:r.disabled,name:D}):S(D,!0,O.value),{...ce?{disabled:O.disabled||r.disabled}:{},...r.progressive?{required:!!O.required,min:Vo(O.min),max:Vo(O.max),minLength:Vo(O.minLength),maxLength:Vo(O.maxLength),pattern:Vo(O.pattern)}:{},name:D,onChange:N,onBlur:N,ref:ne=>{if(ne){Ce(D,O),F=he(n,D);const j=Lt(ne.value)&&ne.querySelectorAll&&ne.querySelectorAll("input,select,textarea")[0]||ne,G=OE(j),pe=F._f.refs||[];if(G?pe.find(Oe=>Oe===j):j===F._f.ref)return;ct(n,D,{_f:{...F._f,...G?{refs:[...pe.filter(Ic),j,...Array.isArray(he(o,D))?[{}]:[]],ref:{type:j.type,name:D}}:{ref:j}}}),S(D,!1,void 0,j)}else F=he(n,D,{}),F._f&&(F._f.mount=!1),(r.shouldUnregister||O.shouldUnregister)&&!(Ap(a.array,D)&&i.action)&&a.unMount.add(D)}}},me=()=>r.shouldFocusError&&Uo(n,ie,a.mount),ze=D=>{lr(D)&&(h.state.next({disabled:D}),Uo(n,(O,F)=>{const ce=he(n,F);ce&&(O.disabled=ce._f.disabled||D,Array.isArray(ce._f.refs)&&ce._f.refs.forEach(ne=>{ne.disabled=ce._f.disabled||D}))},0,!1))},R=(D,O)=>async F=>{let ce;F&&(F.preventDefault&&F.preventDefault(),F.persist&&F.persist());let ne=Ft(s);if(h.state.next({isSubmitting:!0}),r.resolver){const{errors:j,values:G}=await A();t.errors=j,ne=Ft(G)}else await I(n);if(a.disabled.size)for(const j of a.disabled)Bt(ne,j);if(Bt(t.errors,"root"),nr(t.errors)){h.state.next({errors:{}});try{await D(ne,F)}catch(j){ce=j}}else O&&await O({...t.errors},F),me(),setTimeout(me);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nr(t.errors)&&!ce,submitCount:t.submitCount+1,errors:t.errors}),ce)throw ce},Le=(D,O={})=>{he(n,D)&&(Lt(O.defaultValue)?Y(D,Ft(he(o,D))):(Y(D,O.defaultValue),ct(o,D,Ft(O.defaultValue))),O.keepTouched||Bt(t.touchedFields,D),O.keepDirty||(Bt(t.dirtyFields,D),t.isDirty=O.defaultValue?W(D,Ft(he(o,D))):W()),O.keepError||(Bt(t.errors,D),u.isValid&&p()),h.state.next({...t}))},Ge=(D,O={})=>{const F=D?Ft(D):o,ce=Ft(F),ne=nr(D),j=ne?o:ce;if(O.keepDefaultValues||(o=F),!O.keepValues){if(O.keepDirtyValues){const G=new Set([...a.mount,...Object.keys(Fo(o,s))]);for(const pe of Array.from(G))he(t.dirtyFields,pe)?ct(j,pe,he(s,pe)):Y(pe,he(j,pe))}else{if(wc&&Lt(D))for(const G of a.mount){const pe=he(n,G);if(pe&&pe._f){const Oe=Array.isArray(pe._f.refs)?pe._f.refs[0]:pe._f.ref;if(zi(Oe)){const P=Oe.closest("form");if(P){P.reset();break}}}}if(O.keepFieldsRef)for(const G of a.mount)Y(G,he(j,G));else n={}}s=r.shouldUnregister?O.keepDefaultValues?Ft(o):{}:Ft(j),h.array.next({values:{...j}}),h.state.next({values:{...j}})}a={mount:O.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!O.keepIsValid||!!O.keepDirtyValues,i.watch=!!r.shouldUnregister,h.state.next({submitCount:O.keepSubmitCount?t.submitCount:0,isDirty:ne?!1:O.keepDirty?t.isDirty:!!(O.keepDefaultValues&&!Gr(D,o)),isSubmitted:O.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:ne?{}:O.keepDirtyValues?O.keepDefaultValues&&s?Fo(o,s):t.dirtyFields:O.keepDefaultValues&&D?Fo(o,D):O.keepDirty?t.dirtyFields:{},touchedFields:O.keepTouched?t.touchedFields:{},errors:O.keepErrors?t.errors:{},isSubmitSuccessful:O.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Ze=(D,O)=>Ge(Dr(D)?D(s):D,O),Ie=(D,O={})=>{const F=he(n,D),ce=F&&F._f;if(ce){const ne=ce.refs?ce.refs[0]:ce.ref;ne.focus&&(ne.focus(),O.shouldSelect&&Dr(ne.select)&&ne.select())}},st=D=>{t={...t,...D}},De={control:{register:Ce,unregister:re,getFieldState:Q,handleSubmit:R,setError:xe,_subscribe:oe,_runSchema:A,_focusError:me,_getWatch:Z,_getDirty:W,_setValid:p,_setFieldArray:_,_setDisabledField:Se,_setErrors:E,_getFieldArray:V,_reset:Ge,_resetDefaultValues:()=>Dr(r.defaultValues)&&r.defaultValues().then(D=>{Ze(D,r.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:M,_disableForm:ze,_subjects:h,_proxyFormState:u,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(D){i=D},get _defaultValues(){return o},get _names(){return a},set _names(D){a=D},get _formState(){return t},get _options(){return r},set _options(D){r={...r,...D}}},subscribe:ae,trigger:de,register:Ce,handleSubmit:R,watch:_e,setValue:Y,getValues:z,reset:Ze,resetField:Le,clearErrors:Ee,unregister:re,setError:xe,setFocus:Ie,getFieldState:Q};return{...De,formControl:De}}function qp(e={}){const r=v.useRef(void 0),t=v.useRef(void 0),[n,o]=v.useState({isDirty:!1,isValidating:!1,isLoading:Dr(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Dr(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:n},e.defaultValues&&!Dr(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=WE(e);r.current={...a,formState:n}}const s=r.current.control;return s._options=e,Ac(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),s._formState.isReady=!0,i},[s]),v.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),v.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),v.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),v.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),v.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),v.useEffect(()=>{e.values&&!Gr(e.values,t.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),t.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[s,e.values]),v.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),r.current.formState=Dp(n,s),r.current}const Zp=(e,r,t)=>{if(e&&"reportValidity"in e){const n=he(t,r);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Oc=(e,r)=>{for(const t in r.fields){const n=r.fields[t];n&&n.ref&&"reportValidity"in n.ref?Zp(n.ref,t,e):n&&n.refs&&n.refs.forEach(o=>Zp(o,t,e))}},Gp=(e,r)=>{r.shouldUseNativeValidation&&Oc(e,r);const t={};for(const n in e){const o=he(r.fields,n),s=Object.assign(e[n]||{},{ref:o&&o.ref});if(YE(r.names||Object.keys(e),n)){const i=Object.assign({},he(t,n));ct(i,"root",s),ct(t,n,i)}else ct(t,n,s)}return t},YE=(e,r)=>{const t=Kp(r);return e.some(n=>Kp(n).match(`^${t}\\.\\d+`))};function Kp(e){return e.replace(/\]|\[/g,"")}function Qp(e,r){try{var t=e()}catch(n){return r(n)}return t&&t.then?t.then(void 0,r):t}function HE(e,r){for(var t={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!t[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];t[i]={message:a.message,type:a.code}}else t[i]={message:s,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(u){return u.errors.forEach(function(f){return e.push(f)})}),r){var c=t[i].types,d=c&&c[n.code];t[i]=kc(i,r,t,o,d?[].concat(d,n.message):n.message)}e.shift()}return t}function qE(e,r){for(var t={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!t[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];t[i]={message:a.message,type:a.code}}else t[i]={message:s,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(u){return u.forEach(function(f){return e.push(f)})}),r){var c=t[i].types,d=c&&c[n.code];t[i]=kc(i,r,t,o,d?[].concat(d,n.message):n.message)}e.shift()}return t}function ZE(e,r,t){if(t===void 0&&(t={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,s){try{return Promise.resolve(Qp(function(){return Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](n,r)).then(function(i){return s.shouldUseNativeValidation&&Oc({},s),{errors:{},values:t.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:Gp(HE(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(Qp(function(){return Promise.resolve((t.mode==="sync"?kw:Tw)(e,n,r)).then(function(i){return s.shouldUseNativeValidation&&Oc({},s),{errors:{},values:t.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof pc})(i))return{values:{},errors:Gp(qE(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 Jp=/^((1[0-2]|0?[1-9]):[0-5][0-9]\s?([AaPp]\.?[Mm]\.?))|^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/,Xp=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),s=t.replace(/[a-z]/g,""),[i,a]=s.split(":");if(!i||!a)return null;let c=parseInt(i,10);const d=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,c,d);return x.isValid(g)?g:null},GE=gp({UsuarioID:Pi().nullable().optional(),disID:Pi().nullable().optional(),EsOrganizador:zo().default(!1),Correo:vr().email("Formato de correo inválido"),StatusInvitacion:vp(["PENDIENTE","CONFIRMADA","RECHAZADA"]).default("PENDIENTE")}),KE=gp({titulo:vr().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:vr().min(1,"El campo fecha inicio es requerido."),horaInicio:vr().min(1,"La hora de inicio es requerida.").regex(Jp,{message:"Formato inválido (ej: 10:30am o 13:30)"}),horaFin:vr().min(1,"La hora fin es requerida.").regex(Jp,{message:"Formato inválido"}),todoElDia:zo(),fechaFin:vr().optional(),showEndDate:zo().optional(),horaInicio2:vr().optional(),TodoElDia2:zo().optional(),client:vr().nullable().optional(),repetir:vr().optional(),incluirMeet:zo().default(!1),link:vr().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(cE("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:vr().optional(),invitados:mp(GE).optional().default([]),color:vr().optional(),solID:Pi().nullable().optional(),disID:Pi().nullable().optional()}).refine(e=>e.showEndDate?e.fechaFin&&e.fechaFin.length>0:!0,{message:"La fecha de fin es requerida.",path:["fechaFin"]}).refine(e=>e.fechaFin!==void 0?!!e.fechaFin&&!!e.horaInicio2:!0,{message:"La hora de fin son requeridas.",path:["horaInicio2"]}).refine(e=>{if(e.todoElDia||!e.fechaInicio||!e.horaInicio||!e.fechaFin||!e.horaInicio2)return!0;const r=Xp(e.fechaInicio,e.horaInicio),t=Xp(e.fechaFin,e.horaFin);return!r||!t?!1:x.isAfter(t,r)},{message:"",path:["horaFin"]}),QE=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"})),JE="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",XE=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"})))),eh="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",eA=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"})))),tA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cg%20fill='%23404756'%20clip-path='url(%23a)'%3e%3cpath%20d='M13.789%2017H3.21C2.542%2017%202%2017.56%202%2018.25s.542%201.25%201.211%201.25H13.79c.669%200%201.211-.56%201.211-1.25S14.458%2017%2013.789%2017M20.718%204H3.282C2.574%204%202%204.56%202%205.25S2.574%206.5%203.282%206.5h17.436C21.426%206.5%2022%205.94%2022%205.25S21.426%204%2020.718%204M20.718%2010.5H3.282C2.574%2010.5%202%2011.06%202%2011.75S2.574%2013%203.282%2013h17.436c.708%200%201.282-.56%201.282-1.25s-.574-1.25-1.282-1.25'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";var Wo={},th;function rA(){if(th)return Wo;th=1;var e=at();Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.default=void 0;var r=e(pt()),t=ut();return Wo.default=(0,r.default)((0,t.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),Wo}var nA=rA();const rh=it(nA);var Yo={},nh;function oA(){if(nh)return Yo;nh=1;var e=at();Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.default=void 0;var r=e(pt()),t=ut();return Yo.default=(0,r.default)((0,t.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),Yo}var sA=oA();const iA=it(sA),oh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC",sh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",aA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAGFBMVEUAAAAAfFQAflYAfVYAfVUAfFQAcFAAfVbb6xt6AAAAB3RSTlMAIN98m0wQyLlfvgAAAE1JREFUGNNjoAgwmiJxhMoDEBLq5QZIEkUCSBKKeCXYYBJgMQeEBHN5CUIHa3m5A8Io8/ISiAREHRAAJWBSSHYwgyXgUjAJsIGGpPkcAJCLE29yhAT7AAAAAElFTkSuQmCC",cA=e=>{const r=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],t=e.charCodeAt(0)%r.length;return r[t]},lA=(e,r,t,n,o,s)=>{if(r)return l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[l.jsx("img",{src:sh,width:15,style:{marginRight:"5px"}}),l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return l.jsx(m.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return s?l.jsx(m.Button,{onClick:()=>{n(t),o()},variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"}):null;case"CONFIRMADA":return l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[l.jsx("img",{src:aA,width:15,style:{marginRight:"5px"}}),l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Asistiré"})]});default:return null}};function uA({open:e,handleClose:r,guests:t,onReenviar:n,esOrganizador:o}){const s=t.filter(u=>u.estatus==="CONFIRMADA"||u.isHost),i=t.filter(u=>u.estatus==="PENDIENTE"&&!u.isHost),a=t.filter(u=>u.estatus==="RECHAZADA"&&!u.isHost),c=u=>l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[l.jsxs(m.Box,{sx:{position:"relative",mr:2},children:[l.jsx(m.Avatar,{sx:{bgcolor:cA(u.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:u.iniciales}),u.estatus==="PENDIENTE"&&l.jsx(m.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:l.jsx(xc,{sx:{fontSize:14,color:"#546E7A"}})})]}),l.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:u.nombre}),lA(u.estatus,u.isHost,u.usrID,n,r,o)]},u.nombre),d=({title:u,count:f,badgeColor:h})=>l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[l.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:u}),h&&l.jsx(m.Box,{sx:{ml:1,bgcolor:h,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:f})]});return l.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[l.jsxs(m.Box,{sx:{p:"16px 8px"},children:[l.jsx(m.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),l.jsx(m.Button,{onClick:r,startIcon:l.jsx("img",{src:oh,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),l.jsx(m.IconButton,{onClick:r,sx:{position:"absolute",right:8,top:12},children:l.jsx(Cr,{})})]}),l.jsxs(m.DialogContent,{sx:{p:2},children:[i.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{backgroundColor:"black"}}),l.jsxs(m.Box,{sx:{mb:3},children:[l.jsx(d,{title:"Invitados",count:i.length}),i.map(c)]})]}),s.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),l.jsxs(m.Box,{sx:{mb:3},children:[l.jsx(d,{title:"Confirmados",count:s.length,badgeColor:"#1976D2"}),s.map(c)]})]}),a.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),l.jsxs(m.Box,{children:[l.jsx(d,{title:"No asistirán",count:a.length,badgeColor:"#1976D2"}),a.map(c)]})]})]})]})}const dA=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function fA({guests:e,onReenviar:r,esOrganizador:t}){const[n,o]=v.useState(!1),s=()=>o(!0),i=()=>o(!1);return l.jsxs(l.Fragment,{children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[l.jsx(m.AvatarGroup,{max:9,sx:{"& .MuiAvatar-root":{width:32,height:32,fontSize:13,fontWeight:"bold",border:"2px solid #fff",marginLeft:"-8px !important"},"& .MuiBadge-root":{borderRadius:"50%"}},children:e.map((a,c)=>l.jsx(m.Tooltip,{title:a.nombre,arrow:!0,placement:"top",children:l.jsx(m.Box,{children:l.jsx(m.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:a.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:l.jsx(m.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:l.jsx("img",{src:Af})}),children:l.jsx(m.Avatar,{sx:{bgcolor:dA(a.iniciales)},children:a.iniciales})})})},c))}),l.jsx(m.Box,{sx:{flexGrow:1}}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:s,children:[l.jsx(m.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),l.jsx(iA,{sx:{fontSize:18,ml:.5}})]})]}),l.jsx(uA,{open:n,handleClose:i,guests:e,onReenviar:r,esOrganizador:t})]})}var Ho={},ih;function pA(){if(ih)return Ho;ih=1;var e=at();Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.default=void 0;var r=e(pt()),t=ut();return Ho.default=(0,r.default)((0,t.jsx)("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"AddCircleOutline"),Ho}var hA=pA();const mA=it(hA),gA=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),ah=e=>{const[r,t]=e.split(":"),n=parseInt(r),o=n>=12?"pm":"am";return`${n%12||12}:${t} ${o}`},ch=e=>e.split(":").slice(0,2).join(":"),vA=({slot:e,onClick:r})=>l.jsxs(m.Box,{onClick:r,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #000000",textAlign:"center",transition:"0.2s",backgroundColor:"#fff","&:hover":{transform:"translateY(-3px)",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",borderColor:"#1976d2"}},children:[l.jsx(m.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:gA(e.Fecha)})}),l.jsxs(m.Box,{sx:{py:1.5},children:[l.jsx(m.Typography,{sx:{fontSize:"12px"},children:ah(e.HoraInicio)}),l.jsxs(m.Typography,{sx:{fontSize:"12px"},children:["a ",ah(e.HoraFin)]})]})]});function yA({open:e,handleClose:r,suggestions:t,onSelectSlot:n}){const[o,s]=v.useState(16),a=t.slice(0,o).reduce((u,f)=>{const h=f.Fecha;return u[h]||(u[h]=[]),u[h].push(f),u},{}),c=Object.keys(a),d=u=>{const f={...u,HoraInicio:ch(u.HoraInicio),HoraFin:ch(u.HoraFin)};n(f),r()};return v.useEffect(()=>{s(16)},[e]),l.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[l.jsxs(m.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[l.jsx(m.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),l.jsx(m.Box,{children:l.jsx(m.Button,{startIcon:l.jsx("img",{src:oh,width:20}),onClick:r,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"1rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),l.jsx(m.Divider,{sx:{backgroundColor:"black"}}),l.jsx(m.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:c.length===0?l.jsx(m.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):l.jsxs(l.Fragment,{children:[c.map((u,f)=>l.jsxs(v.Fragment,{children:[" ",l.jsxs(m.Box,{sx:{mb:3},children:[l.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&&l.jsx("img",{src:sh,width:15,style:{marginLeft:5}})]}),l.jsx(m.Grid,{container:!0,spacing:2,children:a[u].map((h,g)=>l.jsx(m.Grid,{item:!0,xs:6,sm:3,children:l.jsx(vA,{slot:h,onClick:()=>d(h)})},`${u}-${g}`))})]}),f===0&&c.length>1&&l.jsx(m.Divider,{sx:{mb:4,mt:1,borderBottomWidth:2,backgroundColor:"#000000"}})]},u)),t.length>o&&l.jsx(m.Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:l.jsx(m.Button,{onClick:()=>s(u=>u+12),startIcon:l.jsx(mA,{}),sx:{textTransform:"none",fontWeight:"bold",color:"#1976d2","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Mostrar más horarios disponibles"})})]})})]})}const bA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",xA=e=>{const r=["brown","purple","orange","blue","green","yellow","red","grey"],t=e.charCodeAt(0)%r.length;return r[t]};function wA({onSelectGuest:e,availableSuggestions:r,onInputTextChange:t}){const[n,o]=v.useState(null),[s,i]=v.useState(""),a=(d,u)=>{u?(e(u),o(null),i("")):(o(null),i(""))},c=(d,u)=>{i(u),t(u)};return l.jsx(m.Autocomplete,{options:r,value:n,inputValue:s,getOptionLabel:d=>d.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(d,u)=>d.correo===u.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:d=>l.jsx(m.TextField,{...d,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...d.InputProps,startAdornment:l.jsx(m.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:l.jsx("img",{src:bA,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(d,u)=>v.createElement(m.Box,{component:"li",...d,key:u.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},l.jsx(m.Avatar,{sx:{bgcolor:xA(u.iniciales),mr:2,width:32,height:32,fontSize:14},children:u.iniciales}),l.jsx(m.Typography,{children:u.nombre}))},"guest-autocomplete-field")}var qo={},lh;function _A(){if(lh)return qo;lh=1;var e=at();Object.defineProperty(qo,"__esModule",{value:!0}),qo.default=void 0;var r=e(pt()),t=ut();return qo.default=(0,r.default)((0,t.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline"),qo}var SA=_A();const CA=it(SA);var Zo={},uh;function EA(){if(uh)return Zo;uh=1;var e=at();Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.default=void 0;var r=e(pt()),t=ut();return Zo.default=(0,r.default)((0,t.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline"),Zo}var AA=EA();const jc=it(AA),DA=e=>e.tieneConflicto?{icon:l.jsx(jc,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:l.jsx(CA,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},kA=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function TA({guests:e,conflictCount:r,onViewSuggestions:t,onDeleteGuest:n}){const o=i=>a=>{a.stopPropagation(),n(i)},s=i=>i?i.trim().split(/\s+/).slice(0,2).join(" "):"";return l.jsxs(m.Box,{sx:{p:1},children:[l.jsx(m.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((i,a)=>{const c=DA(i),d=kA(i.iniciales),u=i.email||i.correo||i.nombre;return l.jsx(m.Chip,{label:l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[l.jsx(m.Tooltip,{title:u,arrow:!0,placement:"top",children:l.jsx(m.Typography,{variant:"body2",sx:{color:c.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:s(i?.nombre)})}),l.jsx(m.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:c.icon})]}),avatar:l.jsx(m.Avatar,{sx:{bgcolor:d,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"}}},onDelete:o(i.nombre)},a)})}),r>0&&l.jsxs(m.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[l.jsx(jc,{sx:{mr:1,fontSize:22}}),l.jsxs(m.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",l.jsxs("strong",{children:[r," invitado"]}),r!==1?"s":""]})]}),l.jsx(m.Link,{component:"button",type:"button",variant:"body2",onClick:i=>{i.preventDefault(),i.stopPropagation(),t()},sx:{ml:4,textAlign:"left",textDecoration:"underline",fontWeight:700,fontSize:"15px",color:"#1976D2",border:"none",background:"none",padding:0,cursor:"pointer","&:hover":{color:"#1565C0"}},children:"Ver sugerencias de horario"})]})]})}function MA(e,r){const[t,n]=v.useState(e);return v.useEffect(()=>{const o=setTimeout(()=>{n(e)},r);return()=>{clearTimeout(o)}},[e,r]),t}var Go={},dh;function IA(){if(dh)return Go;dh=1;var e=at();Object.defineProperty(Go,"__esModule",{value:!0}),Go.default=void 0;var r=e(pt()),t=ut();return Go.default=(0,r.default)((0,t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search"),Go}var OA=IA();const jA=it(OA),PA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAgCAYAAACYTcH3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAMwSURBVFhH7ZZdSFRpGMd/1TrIHNZxglqYymLaDdmLscWBOBIzEUowN97owvZBElKbWLM4smNUSESkhG3SbvQh7S5rX4xI3sxFSWBEXqREc2FaroTuDrUik8YRG7G6aEbnPDPnDEFsXfiDF+Z9/s8Zfry873vOkslXr9/ymbBUFj4lizJGLMoYsShjRFaZ+LMemoK11B7pIKLJ9OOyxOzS0wavcaQxzMhcopBXQsPZ/ahzA4Su3ufFG/EAQO4KXN4teNbbZJIVQ5k0kSQJoeLxDoLBrvQ8gd3r57cDbhQZmJBRxlAkSVJoLMzFO1F9FntKz8MocayUHb1AbZE+NiNdZqKbYM2fDBqJJMkr5fil3biWyQB6z+yi6R4opYe4+uO3MjYkbQNHOkNCxIpT9aKut6YWYaqbK7cm9bUEqloCgNb7gIgMTRAyUYYeT+tLBT4CgWoaDlXhWWXFkhINDj1NmaVQtJHiZYB2n5sdvdy9N8CLWdmUTtrK6FhXzi/N5awGyFcJtDbyfYFsykCuG9UFME3/9XO0nDnJ3mPdxGSf4AtZWMBB5cEKnDlRbp9o5cqohj1f4Z9R2ddHS0Urd2VZMhMnLmsCk5Wxsjwv+XsWbWKSkb+jWf8wE05fDc0/+/hKBgITmWHCncNoOCg7fJpQezOBrQ7dnjHCkmfDnp8zP5+1rqVwpa4lIyYyMBY+RpW/jZuPxonnOvDUNHN0mzhVKSheP6EbfxG6/Ct/tNXgSdTHnou7yABTGYD4vz38fryOHaf6iAMu10bZMk/hd0VYkvfOjMaHvspMZZzbfmCnz4uquin3fIMFiI3/J9vm6T+7j6p9te9HdRv9siELJjIOist8VO6ppiHgZ+cmG/FnYU53DsvGBeZmiU1Mvh8zMsyOiUyUUP0uKuu7GAEY7aCu/hqRKdn38RDvpiihuiDt4i6xb3CzZqqPyHN9nc1+un4qQns5rT/yfZeoOv9I9LlTOzIiVkZByXBYYk8yiACKYgVyUPJt2FPHlx/y4bCAkLHh27ub4pULd4QRloJSGrYbvJFXr6UwNznJwfm1Q58bkP4J8Qkx2cD/P4syRnxWMu8A780N97kmJqMAAAAASUVORK5CYII=",RA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAbCAYAAABr/T8RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAP4SURBVEhLxZZdSJtXGMd/XZYgCUYdJErmZpc668Qtg2QXcaO2UBFCIUESpO0KWpCWaS/W2SrMKm1F6srcZA66TlzH3KRL6QeygCiIZZus0wtlqOuqa+oHflxYLSmtEraL9zV5c/JGLYzud3XO8z/v+eecPOc8Z8fKo6f/8D/wghh4Xux4lhWvra4w8/cYM4+AZAtvvmYhzagVh22LrY0fBum9fgV/7z0W1kUR0JrILXJzrKQQa6ooJiaxcXiF0asXOX89yJqoqaLFWlJNfWkeaRpRi0fdOHSPznNN+CflJSZZcHo8eN6zYc3QowNgndB8kOGff+LHm0NMP5GG6na5OV/vJdegmE+FeOPwHP6aGjrvs/1ViLuz08uXzW4yN/kmLqtHO87Kpnrslc18dmgLUwBNCm8daqSt0oYB4P41TneMiaNiiDWevcXlnscAvOJtoH6fKUbeivR91XzitQAQ6vkW/6w4IkqM8Wh3gGkAs4uTPmmCZyXT9wEeM8AcN7oTrzpqHB6it19arcHxDlaV7V2bH6StpoqyY1WU1bRze17lfGmyyM2RmqH+AQbD4gCJaHJNdlFWE2AZQGPC6XNTkCHlLwCLd+i4OsSyciJNCs7SwxSYo6Gn83fw+4dYCAOk4Gluo3yX4huZqPFgK+5Ph0RdQI+9opHa4lSWe1r58OsRQuIQAedH31HrFKOKrZ6ZnYtVVHmbomITOrSkF+/FLsoqJJo3Ypz58kYymSg61cKV9jYuN1VT7somPXId/8XohPS/hn77neGNsNaCveQg9U3yd6cKSZel6LyxvBhpJadiAELoycwykZYKpNrw5NjwHAnirztL5+QSgbqj9Bm1rK1KP8CQf5DGj11YlbUiyyKdZ/SkJSviCqJZnb2TXACCjI4L2arNwtdUjcsodTdMMbtoPCOYAmvjY0wB8DrW7Fhtg6hxUgF7HVJzuLdXym4lmjzKj9hiQvZSr8qxm+NW94jUdLxLYZKoSyguEC17DuyXtuhuF1/IZ1qJ7o08rJFeNg5bfC0O9f9A5wMAPa4DTrmgxBN7Zeb7OOHUAzB8qYlvJgTzDDOZkY5ZygMFoYku6i5JqzU4K3g/P1ZXIhQJPc7jFewxAuEgNxtOc6FvaRv1eJ2FvlYqGwJMhQFjASeOO+QEUye+LAIsDnCutp3hVamrM2ez3+Wj0PQrLRcHWADAgutMBc7pX/g+MMDEopxwRhtVF6opUtxmaqgbIz0G/C2f0zmyIioJSbN5qT3p3vIRwKbGMst/BPiq4xqDD1QKgozuVQeHj5bhyU8RpYRsaRzhyWOm/hxhZmmR8bsPeSknh3STBfvuLAwJjsxmbN/4Pybu6fO8+BfHjFz+tNVn6wAAAABJRU5ErkJggg==",NA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAXCAYAAAAcP/9qAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJJSURBVEhL5ZVPSJNhHMc/NuZBo7VkLCJT1ogRoYm7TF7oMi+7uMMGMwixQ1EYLfpDRiSkkIJm0i7rZNQhyMvoVhcVcYcMDKKQYGzNoiG19y0Uaow6vHPvu2dr72CUhz6n5/k+3/f98vs9z/O+Dcr3H7/YAXaJwr/i/wtuMN7jHJmlGNFn8yRkca2c3bbjeENB/Mcs4lIJBsFbxO9fY3xBERcMcYQmmA4cEOUi1YOTc5y5EiMDWI+4cR9sFh1lfF1b5tXHHOBkMDqCv0V0qFQNTjwa4lJMgRYf09F+HKKhEvm3RE7f4cUmtIYmiPyh6iqHK8XCktpiq9RTWyiA6SjdXeowvfySdXG9QHlwbousrJB9PU/8C0ATnq420VUVj6dHHXxYJZ5UyMpb/MyXeoRWp3g8dJOnn3WOZi+jDwfo0EmG5FeYOjnDoj7MNcDsmBdrYSoErzAVmGFRE8Bkxrq3Sa/UxKasCFX2cH3uHJ7CTAjOkXgyye3n78l+y2lynTTuseDqu8Fon3bQhD024wgNM+azlcp1YveVhlIerJJe/1QYWei9fJfZyAi3wv34Dldvub2zj8HweUYnIzy44Gb71mvv06gYrNGM/ZAN634n3ZKPs8NBXKKlSCfBqwH8koeOdgt2Zzv7RIsOg2CZd29S6vWSFTJrSbKipcgGibWNojexskpatOio+OWK3zvF+JKo1oF0kVjYXSIZVPz32LHg2lpdoVXVqOX5Hau4YnCrs43G7YnJQq/UWWowoFs6gdW0PTPjcJb/Gn8DgFjOhT2aaY4AAAAASUVORK5CYII=",zA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAXCAYAAAD+4+QTAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJrSURBVEhLxZVLSFRRGIA/tRGZC02XiEAdCRUXIW2apTSbHtimTQPZgzFSgkpULCyZEEqUIWkWNplopDC0aeNA6qIhEypJciGIuUnKRDAZrpPcS3obbHGd8T7GV4P07c45//m/c/5z7rkZseWVNfaYTHPHXvAfJfIUr5728WbWPKBHYfp1H13D8+YBC6klkyOE3kYIj22VYIqB3giDz8KMm4dMZCQP/udnQt39RGaXQFWQfqmQ40AUzFMSqMhRhVVsCAftZOccwnXKw6Xyo4hZxkhNEo3QeKOP6bhxcLcIrioCd9wcNkkyARbev0tbILpr6b5rFZCQqKpq7t8VheeaCda4EAB+K0iyMV/qg98xdo5d8xO4UowAyJ86qfRep9J7iwfDi8moNCR2jt9s4WF5LgDSaCfVjz4ixQEUxoM+uia1yH36ac4Lfp6c1ybthoXhduqDE8iGXoWZHzEodaSzE43UAsguqqDmtAPSKxfMDbWlFAilXgKtZ8lfv2n/LJkL+6h/PmUVuKoI3D+ZFGA+k62Qv40Q6hlkdFGGuIK0ZL32QlktwRqX5Yvf0U7mhtqovt3D4PQ8UjS2qaC7zipgR5JohI5ea1n0iG5NsNkzt61EGvuQfHLEkmIKD9iMAUUV+BNf+yZsK5FlBdZXG2xtJtDTgidPF6CqWItnxCj5Y2gBkO88gvPMvY23KQ7o616QR76umYqM2PLK2upIO56OCbDZEfdr5RBLPDTUubUEiaTxefqbfLz4mlh7Lp7Hfi4XJNKlJhMgu+wiV4ts2s8qGkOKxpgZfcnAF51A/U6osXFDkOXgREPTtgKAv71g3h2chXDUAAAAAElFTkSuQmCC",LA=({open:e,onClose:r,clientOptions:t,isClientsLoading:n,setClientSearchTerm:o,onSelectClient:s,setFiltroPadre:i})=>{const[a,c]=v.useState("COT"),d=f=>{c(f),i(f)},u=[{id:"COT",label:"Nuevo",icon:NA},{id:"SEMI",label:"Seminuevo",icon:PA},{id:"PM",label:"Prueba de manejo",icon:RA},{id:"SER",label:"Cita de servicio",icon:zA}];return l.jsx(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"12px",maxHeight:"85vh",position:"relative"}},children:l.jsxs(m.DialogContent,{sx:{p:0,display:"flex",flexDirection:"column"},children:[l.jsxs(m.Box,{sx:{p:2,pb:1},children:[l.jsx(m.Typography,{variant:"h6",fontWeight:"bold",sx:{mb:1,fontSize:"1.1rem"},children:"Vincular cliente"}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",mb:2,width:"fit-content","&:hover":{opacity:.7}},onClick:r,children:[l.jsx(Su,{sx:{color:"#666",ml:-1}}),l.jsx(m.Typography,{variant:"body2",color:"text.secondary",fontWeight:"500",children:"Volver al evento"})]}),l.jsx(m.TextField,{fullWidth:!0,placeholder:"Buscar cliente, correo electrónico, teléfono...",size:"small",onChange:f=>o(f.target.value),InputProps:{startAdornment:l.jsx(m.InputAdornment,{position:"start",children:l.jsx(jA,{sx:{color:"#999"}})}),endAdornment:n&&l.jsx(m.InputAdornment,{position:"end",children:l.jsx(m.CircularProgress,{size:20,color:"inherit"})}),sx:{borderRadius:"8px",backgroundColor:"#f5f5f5","& fieldset":{border:"none"}}}}),l.jsx(m.Box,{sx:{display:"flex",gap:1,mt:2,pb:1,overflowX:"auto",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:u.map(f=>{const h=a===f.id;return l.jsx(m.Chip,{label:f.label,icon:l.jsx("img",{src:f.icon,alt:f.label,style:{width:"20px",height:"20px",borderRadius:"50%",objectFit:"cover"}}),onClick:()=>d(String(f.id)),sx:{borderRadius:"16px",fontSize:"13px",transition:"all 0.2s",backgroundColor:h?"#1976d2":"#f0f2f5",color:h?"#fff !important":"#5f6368",fontWeight:h?"bold":"normal",border:"none","&:hover":{backgroundColor:h?"#1565c0":"#e0e2e5"},"& .MuiChip-icon":{color:h?"#fff":"inherit"}}},f.id)})})]}),l.jsxs(m.Box,{sx:{flexGrow:1,overflowY:"auto",minHeight:"300px"},children:[t.map((f,h)=>l.jsxs(m.Box,{onClick:()=>{s(f,a),r()},sx:{p:"14px 20px",borderTop:"1px solid #f0f0f0",cursor:"pointer",transition:"background-color 0.2s","&:hover":{backgroundColor:"#f9f9f9"},"&:active":{backgroundColor:"#f0f0f0"}},children:[l.jsx(m.Typography,{fontWeight:"600",sx:{fontSize:"14px",color:"#333"},children:f.nombreCliente||"Sin nombre registrado"}),l.jsxs(m.Typography,{variant:"body2",sx:{fontSize:"12px",color:"#666",mt:.5},children:[f.email||"Sin correo"," • ",f.tel||"Sin teléfono"]})]},f.clienteID||h)),!n&&t.length===0&&l.jsx(m.Box,{sx:{p:4,textAlign:"center"},children:l.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"No se encontraron resultados para tu búsqueda."})})]})]})})},$A={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"},fh=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],BA=()=>{const e=[];for(let r=0;r<24;r++)for(let t=0;t<60;t+=15){const n=new Date;n.setHours(r,t),e.push(x.format(n,"h:mmaaaa"))}return e},ph=[],Fi=BA(),an=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),s=t.replace(/[a-z]/g,""),[i,a]=s.split(":");if(!i||!a)return null;let c=parseInt(i,10);const d=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,c,d);return x.isValid(g)?g:null},FA=({isVisible:e,onClose:r,onSave:t,onDelete:n,selectedDate:o,initialEvent:s,userId:i,masNombreBD:a,disId:c,gmail:d,onReenviar:u,onNavigate:f})=>{const[h,g]=v.useState(!1),[y,p]=v.useState(!1),b=x.format(new Date,"yyyy-MM-dd"),[_,C]=v.useState(""),[E,S]=v.useState([]),[w,B]=v.useState(!1),A=bc(),[T,I]=v.useState(""),[M,W]=v.useState(ph),[Z,V]=v.useState(!1),[H,te]=v.useState(""),[Y,N]=v.useState(!1),[ie,de]=v.useState([]),[z,Q]=v.useState(!1),[Ee,xe]=v.useState(null),_e=(U,fe)=>{console.log("client",U),xe(U),De("client",U.nombreCliente||""),De("solID",null),Q(!1)},[oe,ae]=v.useState([]),re=MA(H,300),Se=M.filter(U=>U.tieneConflicto).length,[Ce,me]=v.useState(!1),[ze,R]=v.useState("COT"),{control:Le,handleSubmit:Ge,reset:Ze,formState:{errors:Ie,isValid:st},watch:$e,setValue:De}=qp({resolver:ZE(KE),defaultValues:{titulo:s?.titulo||"",fechaInicio:x.format(new Date,"yyyy-MM-dd"),horaInicio:x.format(new Date,"h:mmaaaa"),horaFin:x.format(x.addHours(new Date,1),"h:mmaaaa"),todoElDia:!1,client:s?.client||null,repetir:"No repetir",link:s?.link||"",descripcion:s?.descripcion||"",solID:s?.solID??null,invitados:[],incluirMeet:!1},mode:"onChange"}),D=$e("fechaInicio"),O=$e("fechaFin"),F=$e("todoElDia");v.useEffect(()=>{if(_.trim()===""||!i||!c||!a){S([]),De("solID",null),B(!1),I("");return}B(!0);const U=setTimeout(()=>{A.getClients(_,c,a,i,ze).then(fe=>{B(!1);const le=Array.from(new Map(fe.map(ue=>[ue.nombreCliente,ue])).values());if(console.log("uniqueClients",le),le.length>0)S(le),I("");else if(s?.client&&s.solID!==null){const ue=[{solID:s.solID,nombreCliente:s.client}];S(ue),I("Sin resultados")}else S([]),I("Sin resultados")}).catch(fe=>{console.error("Error al buscar clientes:",fe),B(!1)})},500);return()=>clearTimeout(U)},[_,i,c,a,ze]),v.useEffect(()=>{if(s){const U=s?.solicitudRelacionada&&s?.solicitudRelacionada[0];if(U){const fe={nombreCliente:s?.client||"",tel:U.tel||"",email:U.email||"",marca:U.marca||"",modelo:U.modelo||"",solID:Number(U.solID)};xe(fe),S([fe]),De("client",U.nombreCliente),De("solID",U?.solID)}}},[s]),v.useEffect(()=>{if(D&&O){const U=new Date(D),fe=new Date(O);(U===fe||U>fe)&&De("fechaFin",D)}},[D,O,De]),v.useEffect(()=>{D&&De("fechaFin",D)},[D]),v.useEffect(()=>{De("showEndDate",h)},[h,De]),v.useEffect(()=>{if(console.log("initialEvent",s),s){const U=x.format(s.fechaInicio,"yyyy-MM-dd")===x.format(s.fechaFin,"yyyy-MM-dd");if(g(!U),De("titulo",s?.titulo),De("fechaInicio",x.format(s.fechaInicio,"yyyy-MM-dd")),De("fechaFin",x.format(s.fechaFin,"yyyy-MM-dd")),De("horaInicio",x.format(s.fechaInicio,"h:mmaaaa")),De("horaFin",x.format(s.fechaFin,"h:mmaaaa")),De("horaInicio2",x.format(s.fechaFin,"h:mmaaaa")),De("descripcion",s.descripcion),De("link",s.link),De("repetir","false"),De("color",s.color),De("todoElDia",s.todoElDia),De("solID",s.solID),De("client",s.client),s.invitados&&s.invitados.length>0){const fe=(s?.invitados||[]).map(ue=>{const Pe=ue.usrNombre?.trim()||"",Ve=Pe.split(/\s+/),vt=Ve.length>1?(Ve[0][0]+Ve[1][0]).toUpperCase():Pe.substring(0,2).toUpperCase();return{nombre:ue.usrNombre||"Sin nombre",correo:ue.correo||"",iniciales:vt||"--",usrID:ue.usuarioID??null,isHost:ue.esOrganizador||!1,estatus:ue.statusInvitacion,tieneConflicto:!1,disID:ue.disID}}),le={nombre:s?.nombreAnfitrion?s?.nombreAnfitrion:"Anfitrion",correo:"",iniciales:(s?.nombreAnfitrion?s?.nombreAnfitrion:"Anfitrion").substring(0,2).toUpperCase(),usrID:i??0,isHost:!0,estatus:"CONFIRMADA",tieneConflicto:!1};W([le,...fe])}else W(ph);s.solID?p(!0):p(!1)}else{const U=o||new Date,fe=new Date,le=new Date(U.getFullYear(),U.getMonth(),U.getDate(),fe.getHours(),fe.getMinutes()),ue=x.addHours(le,1);console.log("defaultEndTime",ue),Ze({titulo:"",fechaInicio:x.format(le,"yyyy-MM-dd"),fechaFin:x.format(ue,"yyyy-MM-dd"),horaFin:x.format(ue,"h:mmaaaa"),horaInicio:x.format(le,"h:mmaaaa"),horaInicio2:x.format(ue,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:fh[0],solID:null}),g(!1),p(!1)}},[s,e,o]);const ce=U=>({UsuarioID:U.usrID??null,Correo:U.correo,EsOrganizador:U.usrID==i,StatusInvitacion:U.estatus,disID:c??null}),ne=Ge(U=>{const fe=M.map(ue=>ce(ue)),le={...U,invitados:fe};t(le,s?.eventoID),r(),Ze(),g(!1)},U=>{console.log("Errores de validación:",U)});v.useEffect(()=>{F&&(De("horaInicio","00:00"),De("horaFin","23:59"))},[F,De,$e]);const j=()=>{const U=$e("fechaInicio");if(U){const fe=new Date(`${U}T00:00:00`),le=x.addDays(fe,1);De("fechaFin",x.format(le,"yyyy-MM-dd"))}g(!0)},G=$e("fechaInicio"),pe=$e("horaInicio"),Oe=$e("fechaFin"),P=$e("horaFin"),[X,we]=v.useState(null),[qe,St]=v.useState(null);v.useEffect(()=>{(X===null||X!==pe)&&we(pe)},[pe,X]),v.useEffect(()=>{(qe===null||qe!==P)&&St(P??"")},[P,qe]);const gt=$e("todoElDia");v.useEffect(()=>{if(gt||!pe||!P||!G||!Oe)return;const U=an(G,pe),fe=an(Oe,P);if(!U||!fe||!x.isValid(U)||!x.isValid(fe))return;const le=x.isSameDay(U,fe),ue=le&&(x.isAfter(U,fe)||U.getTime()===fe.getTime()),Pe=x.isBefore(fe,U)&&!le;(ue||Pe)&&(De("horaFin",""),St(""))},[pe,G]);const Kt=v.useMemo(()=>{if(!pe||!G)return Fi;const U=an(G,pe);return U?Fi.map(fe=>{const le=an(Oe||G,fe);if(le&&x.isAfter(le,U)){const ue=(le.getTime()-U.getTime())/6e4,Pe=Math.floor(ue/60),Ve=ue%60,vt=Pe>0?`${Pe} h${Ve>0?` ${Ve} min`:""}`:`${Ve} min`;return{value:fe,label:`${fe} (${vt})`}}return fe}).filter(fe=>{const le=typeof fe=="string"?fe:fe.value,ue=an(Oe||G,le);return ue?x.isAfter(ue,U):!1}):Fi},[pe,G,Oe]),Ht=v.useMemo(()=>Fi,[]);v.useEffect(()=>{if(!s&&pe&&G){const U=an(G,pe);if(U){const fe=x.addMinutes(U,15),le=pe.toLowerCase(),ue=le.includes("pm")||le.includes("p.m."),Pe=le.includes(".");let Ve=x.format(fe,"h:mm"),vt=ue?"pm":"am";Pe&&(vt=ue?"p.m.":"a.m.");const or=`${Ve}${vt}`,Mr=(P||"").toLowerCase();(P!==or||ue&&(Mr.includes("am")||Mr.includes("a.m.")))&&De("horaFin",or,{shouldValidate:!0})}}},[pe,De,G]);const Tr=async U=>{const fe=$e("fechaInicio"),le=$e("horaInicio"),ue=$e("horaFin");if(console.log("currentGuests",U),!c||!fe||!le||!ue||U.length===0)return;const Pe=await Promise.all(U.map(async Ve=>{if(Ve.isHost||!Ve.correo)return Ve;try{const vt=await A.VerificarConflicto(c,Ve.correo,fe,le+":00",ue+":00"),or=Array.isArray(vt)?vt[0]:vt;if(console.log("conflictResult",vt),or){const Mr=await A.getDisponibilidadUsuario(c,Ve.correo,fe,"60");de(Mr)}return{...Ve,tieneConflicto:String(or.tieneConflicto).toLowerCase()==="true"}}catch{return{...Ve,tieneConflicto:!1}}}));W(Pe)};v.useEffect(()=>{M.filter(fe=>!fe.isHost).length>0&&G&&pe&&P&&Tr(M)},[G,pe,P]);const It=async U=>{if(M.some(Ve=>Ve.correo===U.correo))return;N(!0);const le=$e("fechaInicio"),ue=$e("horaInicio"),Pe=$e("horaFin");if(!c||!U.correo||!le||!ue||!Pe){W(Ve=>[...Ve,{...U,estatus:"PENDIENTE",isHost:!1,tieneConflicto:!1}]);return}try{const Ve=await A.VerificarConflicto(c,U.correo,le,ue+":00",Pe+":00"),vt=Array.isArray(Ve)?Ve[0]:Ve,or=String(vt?.tieneConflicto).toLowerCase()==="true",Mr={...U,estatus:"PENDIENTE",isHost:!1,tieneConflicto:or};if(or){const Kr=await A.getDisponibilidadUsuario(c,U.correo,le,"60");de(Kr)}W(Kr=>[...Kr,Mr])}catch(Ve){console.error("Error al verificar conflicto:",Ve),W(vt=>[...vt,{...U,tieneConflicto:!1,isHost:!1}])}},se=U=>{W(fe=>fe.filter(le=>le.nombre!==U))},Ae=()=>{V(!1)},je=U=>{const ue=(U.usrNombre??"").split(" ").map(Pe=>Pe.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:U.usrNombre??"",correo:U.usrMail??"",iniciales:ue,usrID:U.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};v.useEffect(()=>{console.log("debouncedSearchText.length",re.length),re.length>2&&c?(async()=>{const fe=await A.getUsuariosInvitados(c,re),le=fe.map(je).filter(ue=>ue.usrID!==i&&!M.some(Pe=>Pe.correo===ue.correo));console.log("sugerencias",fe),ae(le)})():ae([])},[re,M]);const Re=U=>{te(U)},yr=U=>{const{Fecha:fe,HoraInicio:le,HoraFin:ue}=U,Pe=Ve=>Ve.split(":").slice(0,2).join(":");De("fechaInicio",fe),De("fechaFin",fe),De("horaInicio",Pe(le)),De("horaFin",Pe(ue)),g(!1),Ae()},ur=async()=>{const U=$e(),fe=an(U.fechaInicio,U.horaInicio),le=an(U.fechaFin||U.fechaInicio,U.horaFin);if(!fe||!le)return;if(!c||!d){console.error("Faltan datos requeridos (disId, userMail o calendarId)");return}me(!0);const ue={summary:U.titulo||"Sin título",description:U.descripcion||"",start:{dateTime:x.format(fe,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"},end:{dateTime:x.format(le,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"}};try{const Pe=await A.insertarEventoGoogle(c,d,!0,ue);Pe?.hangoutLink&&(De("link",Pe.hangoutLink),De("incluirMeet",!1))}catch(Pe){console.error("Error al generar Meet",Pe)}finally{me(!1)}};return l.jsx(l.Fragment,{children:l.jsx(m.Modal,{open:e,onClose:r,children:l.jsxs("form",{onSubmit:ne,children:[l.jsxs(m.Box,{sx:$A,children:[l.jsx(m.IconButton,{"aria-label":"close",onClick:r,sx:{position:"absolute",right:8,top:12},children:l.jsx(Cr,{})}),l.jsx(m.Typography,{variant:"h6",mb:2,children:s?.isGoogleEvent||s?.isOutlookEvent?l.jsx(l.Fragment,{children:s?.titulo||"Evento de Google"}):!s&&"Agregar evento"}),l.jsx(m.Typography,{style:{fontSize:18,fontWeight:600},mb:2,children:s?.client&&s?.solicitudRelacionada?.[0]?l.jsxs(l.Fragment,{children:["Evento para el cliente:"," ",l.jsx(m.Link,{component:"button",variant:"inherit",type:"button",onClick:()=>{const U=s?.solicitudRelacionada?.[0];if(U&&U.tipoSol){const fe=U?.tipoSol,ue={COT:{url:"/netcar/cotizaciones/",pag:10,tipo:"COT"},SEMI:{url:"/netcar/seminuevos/",pag:12,tipo:"SEMI"},SER:{url:"/netcar/servicio/",pag:14,tipo:"SER"},PM:{url:"/netcar/pruebademanejo/",pag:16,tipo:"PM"}}[fe];ue&&f(`${ue.url}${U?.solID}`,{replace:!0,state:{tipoSOL:ue.tipo,pag:ue.pag,modulo:"Consulta"}})}},sx:{color:"#1976d2",cursor:"pointer",fontWeight:700,textDecoration:"underline",verticalAlign:"baseline",p:0,border:"none",backgroundColor:"transparent",fontSize:"14px"},children:`${s.client} / ${s.solicitudRelacionada[0].marca} ${s.solicitudRelacionada[0].modelo}`})]}):"Editar Evento"}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(Ar,{name:"titulo",control:Le,render:({field:U})=>l.jsx(m.TextField,{...U,label:"Título",fullWidth:!0,variant:"outlined",size:"small",error:!!Ie.titulo,helperText:Ie.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"}}})})})}),l.jsxs("div",{className:`row g-2 ${h?"mb-1":"mb-2"}`,children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(Ar,{name:"fechaInicio",control:Le,render:({field:U})=>l.jsx(m.TextField,{fullWidth:!0,...U,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!Ie.fechaInicio,helperText:Ie.fechaInicio?.message})})}),h?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-10 col-md-4",children:l.jsx(Ar,{name:"fechaFin",control:Le,render:({field:U})=>l.jsx(m.TextField,{...U,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:D||b},error:!!Ie.fechaFin,helperText:Ie.fechaFin?.message})})}),!s&&l.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:l.jsx(m.IconButton,{onClick:()=>g(!1),sx:{fontSize:18},children:l.jsx(QE,{})})})]}):l.jsx("div",{className:"col-md-8"})]}),h&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12 d-flex justify-content-center",children:l.jsx(rh,{sx:{color:"#757575",my:1}})})}),l.jsxs("div",{className:"row g-2 mb-2",children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(Ar,{name:"horaInicio",control:Le,render:({field:{onChange:U,value:fe,...le}})=>l.jsx(m.Autocomplete,{freeSolo:!0,options:Ht,value:fe||"",getOptionLabel:ue=>typeof ue=="string"?ue:ue.value,onChange:(ue,Pe)=>{const Ve=typeof Pe=="string"?Pe:Pe?.value;if(Ve){const vt=Ve.split(" (")[0].trim();U(vt)}else U("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},onInputChange:(ue,Pe)=>U(Pe),renderInput:ue=>l.jsx(m.TextField,{...ue,...le,size:"small",error:!!Ie.horaInicio,helperText:Ie.horaInicio?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...ue.InputProps}}),popupIcon:l.jsx(xc,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:gt})})}),!h&&l.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:Ie.horaInicio?"5px":"0px"},children:l.jsx(rh,{sx:{color:"#757575"}})}),h&&l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(Ar,{name:"horaFin",control:Le,render:({field:{onChange:U,value:fe,...le}})=>l.jsx(m.Autocomplete,{freeSolo:!0,options:Kt,getOptionLabel:ue=>typeof ue=="string"?ue:ue.value,value:fe||"",onChange:(ue,Pe)=>{const Ve=typeof Pe=="string"?Pe:Pe?.value;if(Ve){const vt=Ve.split(" (")[0].trim();U(vt)}else U("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},renderOption:(ue,Pe)=>v.createElement(m.Box,{component:"li",...ue,key:typeof Pe=="string"?Pe:Pe.value},l.jsx(m.Typography,{children:typeof Pe=="string"?Pe:Pe.label})),onInputChange:(ue,Pe)=>U(Pe),renderInput:ue=>l.jsx(m.TextField,{...ue,...le,size:"small",error:!!Ie.horaFin,helperText:Ie.horaFin?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...ue.InputProps}}),popupIcon:l.jsx(xc,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:gt})})}),!h&&l.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:l.jsx(Ar,{name:"todoElDia",control:Le,render:({field:U})=>l.jsx(m.FormControlLabel,{control:l.jsx(m.Checkbox,{checked:U.value,onChange:fe=>U.onChange(fe.target.checked)}),label:l.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&!h&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(m.Button,{onClick:j,size:"small",sx:{textTransform:"none",fontSize:16},children:[l.jsx(eA,{}),"  Agregar fecha final"]})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(Ar,{name:"link",control:Le,render:({field:U})=>l.jsx(m.TextField,{...U,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!Ie.link,helperText:Ie.link?.message,InputProps:{startAdornment:l.jsx("img",{src:JE,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(Ar,{name:"descripcion",control:Le,render:({field:U})=>l.jsx(m.TextField,{...U,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:l.jsx("img",{src:tA,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),s?.solicitudRelacionada===null&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(wA,{onSelectGuest:It,availableSuggestions:oe,onInputTextChange:Re})})}),(Y||Se>0)&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(TA,{guests:M,conflictCount:Se,onViewSuggestions:()=>V(!0),onDeleteGuest:se})})}),s?.invitados&&s?.invitados?.length>0&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(m.Box,{children:l.jsx(fA,{guests:M,onReenviar:u,esOrganizador:s?.esOrganizador})})})}),l.jsx(yA,{open:Z,handleClose:Ae,suggestions:ie,onSelectSlot:yr})]}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1,px:0},children:[l.jsx(m.Box,{sx:{minWidth:40,display:"flex",justifyContent:"flex-start"},children:l.jsx("img",{src:"https://fonts.gstatic.com/s/i/productlogos/meet_2020q4/v1/web-512dp/logo_meet_2020q4_color_2x_web_512dp.png",alt:"Meet",style:{width:22,height:22}})}),l.jsx(m.Box,{sx:{flex:1},children:!$e("link")&&!$e("incluirMeet")?l.jsx(m.Button,{fullWidth:!0,disabled:Ce||!c||!d,onClick:ur,sx:{justifyContent:"flex-start",textTransform:"none",bgcolor:"#f1f3f4",color:"#3c4043","&:hover":{bgcolor:"#e8eaed",boxShadow:"none"},borderRadius:"4px",fontWeight:400,fontSize:"14px",py:1,px:2,border:"none",boxShadow:"none"},children:Ce?l.jsxs(l.Fragment,{children:[l.jsx(m.CircularProgress,{size:18,sx:{mr:1.5,color:"#5f6368"}}),l.jsx(m.Typography,{variant:"body2",sx:{fontSize:"14px",color:"#5f6368"},children:"Generando enlace..."})]}):"Añadir videoconferencia de Google Meet"}):l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#f1f3f4",p:"6px 12px",borderRadius:"4px",border:"1px solid #dadce0"},children:[l.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[l.jsx(m.Typography,{variant:"body2",sx:{color:"#1a73e8",fontWeight:500,cursor:$e("link")?"pointer":"default",textDecoration:"none","&:hover":{textDecoration:$e("link")?"underline":"none"},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},onClick:()=>$e("link")&&window.open($e("link"),"_blank"),children:$e("link")?$e("link"):"Se añadirá Google Meet al guardar"}),l.jsx(m.Typography,{variant:"caption",sx:{color:"#70757a"},children:"Google Meet"})]}),l.jsx(m.IconButton,{size:"small",onClick:()=>{De("incluirMeet",!1),De("link","")},sx:{color:"#5f6368"},children:l.jsx(Cr,{sx:{fontSize:18}})})]})})]}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[l.jsx(XE,{}),fh.map(U=>l.jsx(Ar,{name:"color",control:Le,render:({field:fe})=>l.jsx(m.IconButton,{onClick:()=>fe.onChange(U),sx:{width:24,height:24,borderRadius:"50%",bgcolor:U,border:fe.value===U?"2px solid":"none",borderColor:fe.value===U?"primary.main":"transparent"}})},U))]})})}),l.jsx("div",{className:"row",children:l.jsxs("div",{className:"col-12 d-flex gap-2",style:{width:"100%",marginTop:"20px"},children:[s&&!s?.isGoogleEvent&&!s?.isOutlookEvent&&l.jsx(m.Button,{onClick:n,variant:"outlined",startIcon:l.jsx("img",{src:eh,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"}),l.jsx(m.Button,{onClick:r,variant:"outlined",sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",color:"#1976D2",borderColor:"#1976D2","&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)",borderColor:"#115293"}},children:"Cancelar"}),l.jsx(m.Button,{onClick:ne,variant:"contained",disabled:!st,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"})]})})]}),l.jsx(LA,{open:z,onClose:()=>Q(!1),clientOptions:E,isClientsLoading:w,setClientSearchTerm:C,onSelectClient:_e,setFiltroPadre:R})]})})})},VA={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"},UA=({isOpen:e,onClose:r,events:t,date:n,onEventClick:o})=>{if(!n)return null;const s=a=>{o(a),r()},i=a=>a.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:a.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return l.jsx(m.Modal,{open:e,onClose:r,children:l.jsxs(m.Box,{sx:VA,children:[l.jsxs(m.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[l.jsxs(m.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),l.jsx(m.IconButton,{onClick:r,size:"small",children:l.jsx(Cr,{})})]}),l.jsx(m.Divider,{}),l.jsx(m.List,{sx:{mt:1},children:t.map(a=>{const c=i(a);return l.jsx(m.ListItem,{disablePadding:!0,sx:{mb:1},children:l.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:l.jsxs(m.Box,{sx:{flexGrow:1},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[l.jsx(m.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),l.jsx(m.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),l.jsx(m.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${x.format(a.fechaInicio,"hh:mm aa").toLowerCase()} - ${x.format(a.fechaFin,"hh:mm aa").toLowerCase()}`})]})})},a.eventoID)})})]})})};var Ko={},hh;function WA(){if(hh)return Ko;hh=1;var e=at();Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.default=void 0;var r=e(pt()),t=ut();return Ko.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),Ko}var YA=WA();const HA=it(YA);var Qo={},mh;function qA(){if(mh)return Qo;mh=1;var e=at();Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.default=void 0;var r=e(pt()),t=ut();return Qo.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),Qo}var ZA=qA();const GA=it(ZA),KA="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",QA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAALVBMVEVHcEzfEBfjCxzkChvkChvkChzkCxvlChv////96uv60dT1o6ryho/mGyvkCxypwAsrAAAACHRSTlMAECtdiKDJ5DEbuTIAAAHoSURBVHjatdlbjsMgDAVQ87JJKHf/y51pf9CIp+vJ/SzSkUloAZc2cSEkFgEAYU7RO/o+zkdBF07hO9QnwSzJq4uLgmUkGDgzGTrORHrGcZLXlmcvMkKZaJxuH/YLTwB9ZCo6AUyivb4m7uuziwxDeLtezKsnwJiwfCH2x5hgDi8mbJ+0APaI6wo0Ju4KrIBqQNyqwFqufL3qYOD1O1DqqkQZeVd+567dwJ3fuUai0Cceg5Scm9h5v3lhED9fgzk3ceTlC4Ok+YxzLzbvk+lrCRjl6sTmzSuEn80Yr9yJzZs+Q6Tp72C9/4jdRwXDCJEDTsQzD3DkcSaeeQgUcSZuvAYmnIlnHhIxVqLWAxNjKSo9CAl0YsEGBFRiwSYEhdh5dvCuBrB5GlH3UvaikOw8ncjbha0UeffV04qJwplX7jMxUjjzUM9ET+7Mw6HoiOTIOxR5ehYunXe8SfndNlpwvo2G2XWidl4nYhQ3PYpczVMfRfxqoy9QHZbWx7nm9eK9OM5RnB84h8VPTqJA6G55toj5WtYX+K8lypMXH2KYkx64PD55vbVfwJ9pEZgfo70tYm/c2FtLds/eTHu23WdvSG7jk2a6zzV17aRER4oEUXDm1r0kT18lJB5o5n8sErN8JOEUtv9U/ACrTv/qOzhclQAAAABJRU5ErkJggg==",Pc=v.forwardRef(({id:e,message:r,variant:t},n)=>{const{closeSnackbar:o}=ls.useSnackbar(),s={success:{color:"#fff",icon:l.jsx("img",{width:25,src:KA,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:l.jsx(HA,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:l.jsx(GA,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:l.jsx("img",{src:eh,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:l.jsx("img",{src:QA,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},i=s[t]||s.info;return l.jsx(ls.SnackbarContent,{ref:n,children:l.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:[l.jsx(m.Box,{sx:{mr:1.5},children:i.icon}),l.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1},children:r}),l.jsx(m.IconButton,{size:"small",onClick:()=>o(e),children:l.jsx(Cr,{fontSize:"small"})})]})})}),gh=v.createContext(void 0),JA=({children:e})=>{const[r,t]=v.useState([]),[n,o]=v.useState([]),[s,i]=v.useState(!1);return l.jsx(gh.Provider,{value:{googleEvents:r,setGoogleEvents:t,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:s,setIsLoadingGoogleEvents:i},children:e})},XA=()=>{const e=v.useContext(gh);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},eD=(e,r,t)=>{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(tD(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:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!0}};function tD(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}function rD(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}const nD=(e,r,t)=>{const n=new Date(e.start.dateTime);let o=new Date(e.end.dateTime);return e.isAllDay&&o.setDate(o.getDate()-1),{eventoID:Math.abs(rD(e.id)),titulo:e?.summary||"(Sin título)",descripcion:e.body?.content||"",fechaInicio:n,fechaFin:o,todoElDia:e.isAllDay,color:"#0078D4",hasVideoCall:!!e.onlineMeetingUrl,link:e.webLink,repetir:void 0,solID:null,disID:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!1,isOutlookEvent:!0}},vh="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",oD="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",sD=({open:e,onClose:r,onConfirm:t,title:n,description:o,icon:s,confirmText:i,confirmColor:a="#d32f2f",loading:c=!1})=>l.jsxs(m.Dialog,{open:e,onClose:r,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[l.jsx(m.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:l.jsx(m.IconButton,{onClick:r,size:"small",children:l.jsx(Cr,{fontSize:"small"})})}),l.jsxs(m.DialogContent,{sx:{textAlign:"center",pt:0},children:[l.jsx(m.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:s}),l.jsx(m.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),l.jsx(m.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),l.jsxs(m.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[l.jsx(m.Button,{variant:"outlined",onClick:r,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),l.jsxs(m.Button,{variant:"contained",onClick:t,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:[i=="Eliminar"&&l.jsx("img",{src:oD,width:15,style:{marginRight:6,marginBottom:2}}),c?"Procesando...":i]})]})]})]}),Vi=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),s=t.replace(/[a-z]/g,""),[i,a]=s.split(":");if(!i||!a)return null;let c=parseInt(i,10);const d=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,c,d);return x.isValid(g)?g:null},iD=({userId:e,leads30Days:r,leads90Days:t,disId:n,masNombreBD:o,usrNombre:s,onNavigate:i})=>{const[a,c]=v.useState(new Date),[d,u]=v.useState([]),[f,h]=v.useState(!1),[g,y]=v.useState(null),[p,b]=v.useState(null),[_,C]=v.useState([]),{enqueueSnackbar:E}=ls.useSnackbar(),S=bc(),w=bi(),B=ic(),[A,T]=v.useState(!1),[I,M]=v.useState([]),[W,Z]=v.useState(null),{session:V,sessionoutlook:H}=Ha(),{googleEvents:te,setGoogleEvents:Y,outlookEvents:N,setOutlookEvents:ie}=XA(),[de,z]=v.useState([]),[Q,Ee]=v.useState([]),[xe,_e]=v.useState([]),[oe,ae]=v.useState(!1),[re,Se]=v.useState([]),[Ce,me]=v.useState(),ze=(se,Ae)=>{M(se),Z(Ae),T(!0)},R=async()=>{if(e===void 0||n===void 0)return;const se=await S.getNotificacionesXUsuario(e,n);s?localStorage.setItem("nombreAnfitrion",s):localStorage.setItem("nombreAnfitrion","Anfitrion"),Se(se)};v.useEffect(()=>{const se=new Date,Ae=x.startOfDay(se),je=x.endOfDay(x.addDays(Ae,6)),Re={start:Ae,end:je},yr=d.filter(ur=>{const U={start:ur.fechaInicio,end:ur.fechaFin};return Sd(U,Re)}).sort((ur,U)=>ur.fechaInicio.getTime()-U.fechaInicio.getTime());C(yr)},[d]),v.useEffect(()=>{const se=async()=>{try{if(e&&n){const je=await S.getEventsByUser(e,n);R(),u(je)}}catch(je){console.log("Error al cargar eventos locales:",je)}};se();const Ae=setInterval(se,4e3);return()=>clearInterval(Ae)},[e]),v.useEffect(()=>{if(!n||!e)return;const se=[...d];if(te.length>0&&V?.userEmail){const Ae=te.map(je=>eD(je,n,e));se.push(...Ae)}if(N.length>0&&H?.userEmail){const Ae=N.map(je=>nD(je,n,e));se.push(...Ae)}z(se)},[d,te,N,n,e,V?.userEmail,H?.userEmail]);const Le=async se=>{try{if(se?.isGoogleEvent||se.isOutlookEvent)y(se),h(!0);else{const Ae=await S.getEventById(se.eventoID);y(Ae),h(!0)}}catch(Ae){console.error(Ae)}},Ge=()=>{h(!1),y(null)},Ze=async(se,Ae)=>{let je,Re;if(se.todoElDia)je=Vi(se.fechaInicio,se.horaInicio),Re=Vi(se.fechaInicio,se.horaFin);else{je=Vi(se.fechaInicio,se.horaInicio);const fe=se.fechaFin||se.fechaInicio;Re=Vi(fe,se.horaFin)}if(!je||!Re){console.error("No se pudieron procesar las fechas. Revisa el formato de hora:",{inicio:se.horaInicio,fin:se.horaFin});return}const yr=x.format(je,"yyyy-MM-dd HH:mm:ss.SSS"),ur=x.format(Re,"yyyy-MM-dd HH:mm:ss.SSS");if(Ae){const fe={...se,eventoID:Ae,fechaInicio:yr,fechaFin:ur,solID:se.solID??null,disID:n??null,client:se.client,invitados:se.invitados.map(le=>({usrNombre:le.nombre||le.usrNombre,Correo:le.correo||le.Correo,EsOrganizador:le.isHost||le.EsOrganizador,StatusInvitacion:le.StatusInvitacion,UsuarioID:le.usrID||le.UsuarioID,disID:le.disID||n}))};try{const le=await S.updateEvent(fe);var U=d.map(ue=>ue.eventoID===le.eventoID?le:ue);u(U),E("El evento se ha actualizado correctamente.",{variant:"success"}),Ge()}catch{E("Error al actualizar Evento",{variant:"error"})}}else{const fe={...se,fechaInicio:yr,fechaFin:ur,todoElDia:se.todoElDia,solID:se.solID??null,disID:n??null,client:se.client,invitados:se.invitados.map(le=>({usrNombre:le.nombre||le.usrNombre,Correo:le.correo||le.Correo,EsOrganizador:le.isHost||le.EsOrganizador,StatusInvitacion:le.StatusInvitacion,UsuarioID:le.usrID||le.UsuarioID,disID:le.disID||n}))};try{const le=await S.createEvent(fe,e);u(ue=>[...ue,le]),E("El evento se ha creado con éxito",{variant:"success"}),Ge()}catch{E("Error al guardar Evento",{variant:"error"})}}if(e&&n){const fe=await S.getEventsByUser(e,n);u(fe)}},Ie=()=>{c(se=>new Date(se.getFullYear(),se.getMonth()-1,1))},st=()=>{c(se=>new Date(se.getFullYear(),se.getMonth()+1,1))},$e=()=>{Kt("ELIMINAR")},De=()=>{Kt("RECHAZAR")},D=()=>{b(new Date),h(!0)},O=se=>{se&&c(se)},F=se=>{b(se),h(!0),y(null)},ce=async()=>{if(g)try{await S.deleteEvent(g.eventoID),u(d.filter(se=>se.eventoID!==g.eventoID)),E("El evento se ha eliminado de tu calendario",{content:(se,Ae)=>l.jsx(Pc,{id:se,message:String(Ae),variant:"delete"})})}catch{E("Error al eliminar Evento",{variant:"error"})}finally{Ge(),Ht()}},ne=async()=>{if(!(!V?.userEmail||!n)){ae(!0);try{const Ae=(await w.getGoogleCalendars(V.userEmail,n)).map(Re=>({...Re,selected:!0}));Ee(Ae);const je=Ae.map(Re=>Re.id);Oe(je)}catch(se){console.error("Error Google Cals:",se)}finally{ae(!1)}}},j=async se=>{const Ae=Q.map(Re=>Re.id===se?{...Re,selected:!Re.selected}:Re);Ee(Ae);const je=Ae.filter(Re=>Re.selected).map(Re=>Re.id);Oe(je)},G=async()=>{if(!(!H?.userEmail||!n)){ae(!0);try{const Ae=(await B.getOutlookCalendars(H.userEmail,n)).map(Re=>({...Re,selected:!0}));_e(Ae);const je=Ae.map(Re=>Re.id);P(je)}catch(se){console.error("Error Outlook Cals:",se)}finally{ae(!1)}}},pe=async se=>{const Ae=xe.map(Re=>Re.id===se?{...Re,selected:!Re.selected}:Re);_e(Ae);const je=Ae.filter(Re=>Re.selected).map(Re=>Re.id);P(je)};v.useEffect(()=>{ne()},[V?.userEmail,n]),v.useEffect(()=>{G()},[H?.userEmail,n]);const Oe=async se=>{if(!V?.userEmail||!n)return;const Ae=se||Q.filter(je=>je.selected).map(je=>je.id);try{const je={disID:n,year:a.getFullYear(),month:a.getMonth()+1,usrMail:V.userEmail,calendarIds:Ae},Re=await w.getGoogleEventsByMonth(je);Y(Re)}catch(je){console.error("Error al obtener eventos de Google:",je)}},P=async se=>{if(!H?.userEmail||!n)return;const Ae=se||xe.filter(je=>je.selected).map(je=>je.id);try{const je={disID:n,year:a.getFullYear(),month:a.getMonth()+1,usrMail:H.userEmail,calendarIds:Ae},Re=await B.getOutlookEventsByMonth(je);ie(Re)}catch(je){console.error("Error al obtener eventos de Outlook:",je)}};if(n===void 0||e===void 0)return l.jsx("div",{children:"Cargando configuración de usuario..."});const X=async(se,Ae)=>{await S.UpdateStatusEvento(se.evento.eventoID,e,Ae)&&(await S.MarcarLeido(se.notificacionID,e),E(se?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},we=async()=>{Ce&&S.UpdateStatusEvento(Ce.evento.eventoID,e,"RECHAZADA")&&(await S.MarcarLeido(Ce.notificacionID,e),await S.MarcarLeido(Ce.notificacionID,e),E("Haz rechazado la Invitación a "+Ce?.evento?.titulo,{content:(Ae,je)=>l.jsx(Pc,{id:Ae,message:String(je),variant:"rechazar"})}),Ht())},qe=async(se,Ae)=>{try{if(!e)return;me(se),Ae=="RECHAZADA"?(De(),console.log("noti",se)):X(se,Ae)}catch{E("Error al procesar la invitación",{variant:"error"})}},St=async se=>{try{if(!g)return;await S.ReenviarNotificacion(g?.eventoID,se),E("Invitación enviada con éxito",{variant:"success"})}catch(Ae){console.error("Error al conectar con la API",Ae)}},[gt,Kt]=v.useState(null),Ht=()=>Kt(null),Tr={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:l.jsxs(l.Fragment,{children:["Estás a punto de declinar la invitación de ",l.jsx("strong",{children:Ce?.evento?.nombreAnfitrion})," a ",l.jsx("strong",{children:Ce?.evento?.titulo})]}),icon:l.jsx("img",{src:vh}),action:()=>Ce&&we()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:l.jsx("img",{src:vh}),action:()=>ce()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>ce}},It=gt?Tr[gt]:null;return l.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[l.jsx(Rv,{header:l.jsx(e2,{currentDate:a,onPrevMonth:Ie,onNextMonth:st,onAddEvent:D,onDateChange:O}),sidebar:l.jsx(Qx,{onEventClick:Le,upcomingEvents:_,leads30Days:r,leads90Days:t,disID:n,usrID:e,onAddEvent:D,googleCalendars:Q,outlookCalendars:xe,isLoadingCalendars:oe,onToggleGoogle:j,onToggleOutlook:pe,notifications:re,unreadCount:re?.filter(se=>!se.leida).length,onAceppInvitacion:qe}),mainContent:l.jsx(dw,{onSeeMoreClick:ze,currentDate:a,events:de,onDayClick:F,onEventClick:Le})}),f&&l.jsx(FA,{isVisible:f,onClose:Ge,onSave:Ze,onDelete:$e,selectedDate:p,initialEvent:g,userId:e,masNombreBD:o,disId:n,gmail:"llopez@exagono.net",onReenviar:St,onNavigate:i}),l.jsx(UA,{isOpen:A,onClose:()=>T(!1),events:I,date:W,onEventClick:Le}),It&&l.jsx(sD,{open:!!gt,onClose:Ht,onConfirm:()=>{It.action()},title:It.title,description:It.description,icon:It.icon,confirmText:It.confirmText})]})},aD="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",cD="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 Rc(e,r,t){return e.accessor?e.accessor(r,t):e.field?r?.[e.field]:r?.[e?.key||""]}function lD(e,r){const t=e??"",n=r??"";return t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():typeof t=="number"&&typeof n=="number"?t-n:typeof t=="boolean"&&typeof n=="boolean"?Number(t)-Number(n):String(t).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function Nc(e,r,t=!0){return typeof e=="function"?e(r):e??t}function uD(e){return e.replace(/[^\d]/g,"")}function dD(e,r){return r}var Jo={},yh;function fD(){if(yh)return Jo;yh=1;var e=at();Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.default=void 0;var r=e(pt()),t=ut();return Jo.default=(0,r.default)((0,t.jsx)("path",{d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAlt"),Jo}var pD=fD();const hD=it(pD);var Xo={},bh;function mD(){if(bh)return Xo;bh=1;var e=at();Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.default=void 0;var r=e(pt()),t=ut();return Xo.default=(0,r.default)((0,t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27c1.2-1.4 1.82-3.31 1.48-5.34-.47-2.78-2.79-5-5.59-5.34-4.23-.52-7.79 3.04-7.27 7.27.34 2.8 2.56 5.12 5.34 5.59 2.03.34 3.94-.28 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"SearchRounded"),Xo}var gD=mD();const vD=it(gD);var es={},xh;function yD(){if(xh)return es;xh=1;var e=at();Object.defineProperty(es,"__esModule",{value:!0}),es.default=void 0;var r=e(pt()),t=ut();return es.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),es}var bD=yD();const xD=it(bD);var ts={},wh;function wD(){if(wh)return ts;wh=1;var e=at();Object.defineProperty(ts,"__esModule",{value:!0}),ts.default=void 0;var r=e(pt()),t=ut();return ts.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),ts}var _D=wD();const SD=it(_D);function _h(e){return e==="right"?"end":e==="center"?"center":"start"}function Sh(e){const r=e.filter(t=>!t.width).length||1;return e.map(t=>typeof t.width=="number"?`${t.width}px`:typeof t.width=="string"?t.width:`minmax(0, ${1/r}fr)`).join(" ")}const CD=1060,zc=(e,r)=>e.metrics.find(t=>String(t.label).toLowerCase()===r.toLowerCase())?.value??"";function ED({sections:e,detailColumns:r,summaryWidths:t=["1fr",120,120,150],minWidth:n=CD,getDetailColumns:o,onRowClick:s}){function c(u){if(typeof u=="number")return u;if(!u)return 0;const f=/^(\d+)\s*px$/.exec(u.trim());return f?Number(f[1]):/fr$/i.test(u)?160:0}function d(u){const f=u.reduce((y,p)=>y+c(p.width),0),h=Math.max(u.length-1,0)*16;return f+h+32}return l.jsx(m.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:l.jsxs(m.Box,{children:[l.jsx(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(u=>typeof u=="number"?`${u}px`:u).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"#1E5BCE",color:"#fff",boxSizing:"border-box"},children:["Tipo","En Proceso","Finalizadas","Último seg."].map(u=>l.jsx(m.Typography,{sx:{fontSize:13,fontWeight:800},children:u},u))}),e.map((u,f)=>{const[h,g]=K.useState(!!u.initiallyOpen),y=f%2===1,p=o?o(u):r,b=Math.max(n,d(p));return l.jsxs(m.Box,{children:[l.jsxs(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(_=>typeof _=="number"?`${_}px`:_).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:y?"rgba(30,91,206,0.06)":"background.paper",borderTop:"1px solid rgba(0,0,0,0.08)","&:hover":{bgcolor:"rgba(30,91,206,0.12)"},boxSizing:"border-box",cursor:"pointer"},onClick:()=>g(_=>!_),children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[l.jsx(m.IconButton,{size:"small",disableRipple:!0,children:h?l.jsx(SD,{}):l.jsx(xD,{})}),l.jsx(m.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(u.title),children:u.title})]}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:zc(u,"En Proceso")}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:zc(u,"Finalizadas")}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:zc(u,"Último seg.")})]}),l.jsx(m.Collapse,{in:h,unmountOnExit:!0,children:l.jsxs(m.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[l.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Sh(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(_=>l.jsx(m.Typography,{sx:{justifySelf:_h(_.align),textAlign:_.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.header},_.key))}),(u.rows??[]).map((_,C)=>l.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Sh(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:C%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?.(_,u),children:p.map((E,S)=>{const w=E.accessor?E.accessor(_,C):E.field?_[E.field]:null;return l.jsx(m.Box,{sx:{justifySelf:_h(E.align),textAlign:E.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof w=="string"||typeof w=="number"?l.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(w),children:w}):w},E.key??S)})},_.id??C))]})})]},u.id)})]})})}var rs={},Ch;function AD(){if(Ch)return rs;Ch=1;var e=at();Object.defineProperty(rs,"__esModule",{value:!0}),rs.default=void 0;var r=e(pt()),t=ut();return rs.default=(0,r.default)((0,t.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m3.3 14.71L11 12.41V7h2v4.59l3.71 3.71z"}),"AccessTimeFilled"),rs}var DD=AD();const kD=it(DD),TD=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",MD=e=>{const r=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return r||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},ID=e=>{const r=(e||"").split(" ").filter(Boolean);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var ns={},Eh;function OD(){if(Eh)return ns;Eh=1;var e=at();Object.defineProperty(ns,"__esModule",{value:!0}),ns.default=void 0;var r=e(pt()),t=ut();return ns.default=(0,r.default)((0,t.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Create"),ns}var jD=OD();const PD=it(jD),Lc=({current:e=0,total:r=0,color:t="#4caf50"})=>l.jsx("div",{style:{display:"flex",gap:"1px",width:"100%",height:"100%",justifyContent:"center",overflow:"hidden",minWidth:0},children:Array.from({length:r}).map((n,o)=>l.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?t:"#e0e0e0",display:"flex"}},o))});var os={},Ah;function RD(){if(Ah)return os;Ah=1;var e=at();Object.defineProperty(os,"__esModule",{value:!0}),os.default=void 0;var r=e(pt()),t=ut();return os.default=(0,r.default)((0,t.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),os}var ND=RD();const Dh=it(ND);var ss={},kh;function zD(){if(kh)return ss;kh=1;var e=at();Object.defineProperty(ss,"__esModule",{value:!0}),ss.default=void 0;var r=e(pt()),t=ut();return ss.default=(0,r.default)((0,t.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),ss}var LD=zD();const $D=it(LD),BD=e=>{const r=String(e??"").toLowerCase().trim();return r==="muy interesado"?{bg:"#E53935",color:"#FFFFFF"}:r==="interesado"?{bg:"#FB8C00",color:"#FFFFFF"}:r==="venta definitiva"?{bg:"#2E7D32",color:"#FFFFFF"}:r==="no sé"||r==="no se"?{bg:"#9E9E9E",color:"#FFFFFF"}:r==="algo interesado"?{bg:"#FFEB3B",color:"#000000"}:{bg:"transparent",color:"#2c2c2c"}},FD=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}},VD=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}},UD=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 WD(e){const r=new Date(e),t=r.toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),n=r.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"});return`${t.replace(".","")} • ${n}`}function YD(e){return e.replace(/<br\s*\/?>/gi,`
177
+ `)}g.write("payload.value = newResult;"),g.write("return payload;");const C=g.compile();return(E,S)=>C(h,E,S)};let s;const i=wi,a=!Of.jitless,d=a&&mw.value,u=r.catchall;let f;e._zod.parse=(h,g)=>{f??(f=n.value);const y=h.value;return i(y)?a&&d&&g?.async===!1&&g.jitless!==!0?(s||(s=o(r.shape)),h=s(h,g),u?Kf([],y,h,g,f,e):h):t(h,g):(h.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),h)}});function Qf(e,r,t,n){for(const s of e)if(s.issues.length===0)return r.value=s.value,r;const o=e.filter(s=>!Hn(s));return o.length===1?(r.value=o[0].value,o[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:t,errors:e.map(s=>s.issues.map(i=>_n(i,n,wn())))}),r)}const sS=q("$ZodUnion",(e,r)=>{Mt.init(e,r),mt(e._zod,"optin",()=>r.options.some(o=>o._zod.optin==="optional")?"optional":void 0),mt(e._zod,"optout",()=>r.options.some(o=>o._zod.optout==="optional")?"optional":void 0),mt(e._zod,"values",()=>{if(r.options.every(o=>o._zod.values))return new Set(r.options.flatMap(o=>Array.from(o._zod.values)))}),mt(e._zod,"pattern",()=>{if(r.options.every(o=>o._zod.pattern)){const o=r.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>dc(s.source)).join("|")})$`)}});const t=r.options.length===1,n=r.options[0]._zod.run;e._zod.parse=(o,s)=>{if(t)return n(o,s);let i=!1;const a=[];for(const c of r.options){const d=c._zod.run({value:o.value,issues:[]},s);if(d instanceof Promise)a.push(d),i=!0;else{if(d.issues.length===0)return d;a.push(d)}}return i?Promise.all(a).then(c=>Qf(c,o,e,s)):Qf(a,o,e,s)}}),iS=q("$ZodIntersection",(e,r)=>{Mt.init(e,r),e._zod.parse=(t,n)=>{const o=t.value,s=r.left._zod.run({value:o,issues:[]},n),i=r.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,d])=>Jf(t,c,d)):Jf(t,s,i)}});function mc(e,r){if(e===r)return{valid:!0,data:e};if(e instanceof Date&&r instanceof Date&&+e==+r)return{valid:!0,data:e};if(Po(e)&&Po(r)){const t=Object.keys(r),n=Object.keys(e).filter(s=>t.indexOf(s)!==-1),o={...e,...r};for(const s of n){const i=mc(e[s],r[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(r)){if(e.length!==r.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let n=0;n<e.length;n++){const o=e[n],s=r[n],i=mc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};t.push(i.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Jf(e,r,t){if(r.issues.length&&e.issues.push(...r.issues),t.issues.length&&e.issues.push(...t.issues),Hn(e))return e;const n=mc(r.value,t.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const aS=q("$ZodEnum",(e,r)=>{Mt.init(e,r);const t=fw(r.entries),n=new Set(t);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.filter(o=>gw.has(typeof o)).map(o=>typeof o=="string"?Yn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t,input:i,inst:e}),o}}),cS=q("$ZodLiteral",(e,r)=>{if(Mt.init(e,r),r.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(r.values),e._zod.pattern=new RegExp(`^(${r.values.map(t=>typeof t=="string"?Yn(t):t?Yn(t.toString()):String(t)).join("|")})$`),e._zod.parse=(t,n)=>{const o=t.value;return e._zod.values.has(o)||t.issues.push({code:"invalid_value",values:r.values,input:o,inst:e}),t}}),lS=q("$ZodTransform",(e,r)=>{Mt.init(e,r),e._zod.parse=(t,n)=>{if(n.direction==="backward")throw new If(e.constructor.name);const o=r.transform(t.value,t);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(t.value=i,t));if(o instanceof Promise)throw new Un;return t.value=o,t}});function Xf(e,r){return e.issues.length&&r===void 0?{issues:[],value:void 0}:e}const uS=q("$ZodOptional",(e,r)=>{Mt.init(e,r),e._zod.optin="optional",e._zod.optout="optional",mt(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,void 0]):void 0),mt(e._zod,"pattern",()=>{const t=r.innerType._zod.pattern;return t?new RegExp(`^(${dc(t.source)})?$`):void 0}),e._zod.parse=(t,n)=>{if(r.innerType._zod.optin==="optional"){const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Xf(s,t.value)):Xf(o,t.value)}return t.value===void 0?t:r.innerType._zod.run(t,n)}}),dS=q("$ZodNullable",(e,r)=>{Mt.init(e,r),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),mt(e._zod,"pattern",()=>{const t=r.innerType._zod.pattern;return t?new RegExp(`^(${dc(t.source)}|null)$`):void 0}),mt(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,null]):void 0),e._zod.parse=(t,n)=>t.value===null?t:r.innerType._zod.run(t,n)}),fS=q("$ZodDefault",(e,r)=>{Mt.init(e,r),e._zod.optin="optional",mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);if(t.value===void 0)return t.value=r.defaultValue,t;const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>ep(s,r)):ep(o,r)}});function ep(e,r){return e.value===void 0&&(e.value=r.defaultValue),e}const pS=q("$ZodPrefault",(e,r)=>{Mt.init(e,r),e._zod.optin="optional",mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>(n.direction==="backward"||t.value===void 0&&(t.value=r.defaultValue),r.innerType._zod.run(t,n))}),hS=q("$ZodNonOptional",(e,r)=>{Mt.init(e,r),mt(e._zod,"values",()=>{const t=r.innerType._zod.values;return t?new Set([...t].filter(n=>n!==void 0)):void 0}),e._zod.parse=(t,n)=>{const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>tp(s,e)):tp(o,e)}});function tp(e,r){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:r}),e}const mS=q("$ZodCatch",(e,r)=>{Mt.init(e,r),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>(t.value=s.value,s.issues.length&&(t.value=r.catchValue({...t,error:{issues:s.issues.map(i=>_n(i,n,wn()))},input:t.value}),t.issues=[]),t)):(t.value=o.value,o.issues.length&&(t.value=r.catchValue({...t,error:{issues:o.issues.map(s=>_n(s,n,wn()))},input:t.value}),t.issues=[]),t)}}),gS=q("$ZodPipe",(e,r)=>{Mt.init(e,r),mt(e._zod,"values",()=>r.in._zod.values),mt(e._zod,"optin",()=>r.in._zod.optin),mt(e._zod,"optout",()=>r.out._zod.optout),mt(e._zod,"propValues",()=>r.in._zod.propValues),e._zod.parse=(t,n)=>{if(n.direction==="backward"){const s=r.out._zod.run(t,n);return s instanceof Promise?s.then(i=>Mi(i,r.in,n)):Mi(s,r.in,n)}const o=r.in._zod.run(t,n);return o instanceof Promise?o.then(s=>Mi(s,r.out,n)):Mi(o,r.out,n)}});function Mi(e,r,t){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:e.value,issues:e.issues},t)}const vS=q("$ZodReadonly",(e,r)=>{Mt.init(e,r),mt(e._zod,"propValues",()=>r.innerType._zod.propValues),mt(e._zod,"values",()=>r.innerType._zod.values),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(rp):rp(o)}});function rp(e){return e.value=Object.freeze(e.value),e}const yS=q("$ZodCustom",(e,r)=>{rr.init(e,r),Mt.init(e,r),e._zod.parse=(t,n)=>t,e._zod.check=t=>{const n=t.value,o=r.fn(n);if(o instanceof Promise)return o.then(s=>np(s,t,n,e));np(o,t,n,e)}});function np(e,r,t,n){if(!e){const o={code:"custom",input:t,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),r.issues.push(Ro(o))}}class bS{constructor(){this._map=new Map,this._idmap=new Map}add(r,...t){const n=t[0];if(this._map.set(r,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,r)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(r){const t=this._map.get(r);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(r),this}get(r){const t=r._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(r)};return Object.keys(o).length?o:void 0}return this._map.get(r)}has(r){return this._map.has(r)}}function xS(){return new bS}const Ii=xS();function wS(e,r){return new e({type:"string",...Te(r)})}function _S(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(r)})}function op(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(r)})}function SS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(r)})}function CS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(r)})}function ES(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(r)})}function AS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(r)})}function DS(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(r)})}function kS(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(r)})}function TS(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(r)})}function MS(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(r)})}function IS(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(r)})}function OS(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(r)})}function jS(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(r)})}function PS(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(r)})}function RS(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(r)})}function NS(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(r)})}function zS(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(r)})}function LS(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(r)})}function $S(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(r)})}function BS(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(r)})}function FS(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(r)})}function VS(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(r)})}function US(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(r)})}function WS(e,r){return new e({type:"string",format:"date",check:"string_format",...Te(r)})}function YS(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(r)})}function HS(e,r){return new e({type:"string",format:"duration",check:"string_format",...Te(r)})}function qS(e,r){return new e({type:"number",checks:[],...Te(r)})}function ZS(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(r)})}function GS(e,r){return new e({type:"boolean",...Te(r)})}function KS(e){return new e({type:"unknown"})}function QS(e,r){return new e({type:"never",...Te(r)})}function sp(e,r){return new Wf({check:"less_than",...Te(r),value:e,inclusive:!1})}function gc(e,r){return new Wf({check:"less_than",...Te(r),value:e,inclusive:!0})}function ip(e,r){return new Yf({check:"greater_than",...Te(r),value:e,inclusive:!1})}function vc(e,r){return new Yf({check:"greater_than",...Te(r),value:e,inclusive:!0})}function ap(e,r){return new p_({check:"multiple_of",...Te(r),value:e})}function cp(e,r){return new m_({check:"max_length",...Te(r),maximum:e})}function Oi(e,r){return new g_({check:"min_length",...Te(r),minimum:e})}function lp(e,r){return new v_({check:"length_equals",...Te(r),length:e})}function JS(e,r){return new y_({check:"string_format",format:"regex",...Te(r),pattern:e})}function XS(e){return new b_({check:"string_format",format:"lowercase",...Te(e)})}function eC(e){return new x_({check:"string_format",format:"uppercase",...Te(e)})}function tC(e,r){return new w_({check:"string_format",format:"includes",...Te(r),includes:e})}function rC(e,r){return new __({check:"string_format",format:"starts_with",...Te(r),prefix:e})}function nC(e,r){return new S_({check:"string_format",format:"ends_with",...Te(r),suffix:e})}function No(e){return new C_({check:"overwrite",tx:e})}function oC(e){return No(r=>r.normalize(e))}function sC(){return No(e=>e.trim())}function iC(){return No(e=>e.toLowerCase())}function aC(){return No(e=>e.toUpperCase())}function cC(e,r,t){return new e({type:"array",element:r,...Te(t)})}function lC(e,r,t){return new e({type:"custom",check:"custom",fn:r,...Te(t)})}function uC(e){const r=dC(t=>(t.addIssue=n=>{if(typeof n=="string")t.issues.push(Ro(n,t.value,r._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),t.issues.push(Ro(o))}},e(t.value,t)));return r}function dC(e,r){const t=new rr({check:"custom",...Te(r)});return t._zod.check=e,t}const fC=q("ZodISODateTime",(e,r)=>{L_.init(e,r),At.init(e,r)});function pC(e){return US(fC,e)}const hC=q("ZodISODate",(e,r)=>{$_.init(e,r),At.init(e,r)});function mC(e){return WS(hC,e)}const gC=q("ZodISOTime",(e,r)=>{B_.init(e,r),At.init(e,r)});function vC(e){return YS(gC,e)}const yC=q("ZodISODuration",(e,r)=>{F_.init(e,r),At.init(e,r)});function bC(e){return HS(yC,e)}const gr=q("ZodError",(e,r)=>{pc.init(e,r),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>Dw(e,t)},flatten:{value:t=>Aw(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,cc,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,cc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),xC=Ci(gr),wC=Ei(gr),_C=Ai(gr),SC=Di(gr),CC=Ow(gr),EC=jw(gr),AC=Pw(gr),DC=Rw(gr),kC=Nw(gr),TC=zw(gr),MC=Lw(gr),IC=$w(gr),Nt=q("ZodType",(e,r)=>(Mt.init(e,r),e.def=r,e.type=r.type,Object.defineProperty(e,"_def",{value:r}),e.check=(...t)=>e.clone({...r,checks:[...r.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(t,n)=>sn(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>xC(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>_C(e,t,n),e.parseAsync=async(t,n)=>wC(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>SC(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>CC(e,t,n),e.decode=(t,n)=>EC(e,t,n),e.encodeAsync=async(t,n)=>AC(e,t,n),e.decodeAsync=async(t,n)=>DC(e,t,n),e.safeEncode=(t,n)=>kC(e,t,n),e.safeDecode=(t,n)=>TC(e,t,n),e.safeEncodeAsync=async(t,n)=>MC(e,t,n),e.safeDecodeAsync=async(t,n)=>IC(e,t,n),e.refine=(t,n)=>e.check(SE(t,n)),e.superRefine=t=>e.check(CE(t)),e.overwrite=t=>e.check(No(t)),e.optional=()=>bp(e),e.nullable=()=>xp(e),e.nullish=()=>bp(xp(e)),e.nonoptional=t=>gE(e,t),e.array=()=>mp(e),e.or=t=>oE([e,t]),e.and=t=>iE(e,t),e.transform=t=>_p(e,uE(t)),e.default=t=>pE(e,t),e.prefault=t=>mE(e,t),e.catch=t=>yE(e,t),e.pipe=t=>_p(e,t),e.readonly=()=>wE(e),e.describe=t=>{const n=e.clone();return Ii.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return Ii.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Ii.get(e);const n=e.clone();return Ii.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),up=q("_ZodString",(e,r)=>{hc.init(e,r),Nt.init(e,r);const t=e._zod.bag;e.format=t.format??null,e.minLength=t.minimum??null,e.maxLength=t.maximum??null,e.regex=(...n)=>e.check(JS(...n)),e.includes=(...n)=>e.check(tC(...n)),e.startsWith=(...n)=>e.check(rC(...n)),e.endsWith=(...n)=>e.check(nC(...n)),e.min=(...n)=>e.check(Oi(...n)),e.max=(...n)=>e.check(cp(...n)),e.length=(...n)=>e.check(lp(...n)),e.nonempty=(...n)=>e.check(Oi(1,...n)),e.lowercase=n=>e.check(XS(n)),e.uppercase=n=>e.check(eC(n)),e.trim=()=>e.check(sC()),e.normalize=(...n)=>e.check(oC(...n)),e.toLowerCase=()=>e.check(iC()),e.toUpperCase=()=>e.check(aC())}),OC=q("ZodString",(e,r)=>{hc.init(e,r),up.init(e,r),e.email=t=>e.check(_S(jC,t)),e.url=t=>e.check(DS(PC,t)),e.jwt=t=>e.check(VS(GC,t)),e.emoji=t=>e.check(kS(RC,t)),e.guid=t=>e.check(op(dp,t)),e.uuid=t=>e.check(SS(ji,t)),e.uuidv4=t=>e.check(CS(ji,t)),e.uuidv6=t=>e.check(ES(ji,t)),e.uuidv7=t=>e.check(AS(ji,t)),e.nanoid=t=>e.check(TS(NC,t)),e.guid=t=>e.check(op(dp,t)),e.cuid=t=>e.check(MS(zC,t)),e.cuid2=t=>e.check(IS(LC,t)),e.ulid=t=>e.check(OS($C,t)),e.base64=t=>e.check($S(HC,t)),e.base64url=t=>e.check(BS(qC,t)),e.xid=t=>e.check(jS(BC,t)),e.ksuid=t=>e.check(PS(FC,t)),e.ipv4=t=>e.check(RS(VC,t)),e.ipv6=t=>e.check(NS(UC,t)),e.cidrv4=t=>e.check(zS(WC,t)),e.cidrv6=t=>e.check(LS(YC,t)),e.e164=t=>e.check(FS(ZC,t)),e.datetime=t=>e.check(pC(t)),e.date=t=>e.check(mC(t)),e.time=t=>e.check(vC(t)),e.duration=t=>e.check(bC(t))});function vr(e){return wS(OC,e)}const At=q("ZodStringFormat",(e,r)=>{_t.init(e,r),up.init(e,r)}),jC=q("ZodEmail",(e,r)=>{T_.init(e,r),At.init(e,r)}),dp=q("ZodGUID",(e,r)=>{D_.init(e,r),At.init(e,r)}),ji=q("ZodUUID",(e,r)=>{k_.init(e,r),At.init(e,r)}),PC=q("ZodURL",(e,r)=>{M_.init(e,r),At.init(e,r)}),RC=q("ZodEmoji",(e,r)=>{I_.init(e,r),At.init(e,r)}),NC=q("ZodNanoID",(e,r)=>{O_.init(e,r),At.init(e,r)}),zC=q("ZodCUID",(e,r)=>{j_.init(e,r),At.init(e,r)}),LC=q("ZodCUID2",(e,r)=>{P_.init(e,r),At.init(e,r)}),$C=q("ZodULID",(e,r)=>{R_.init(e,r),At.init(e,r)}),BC=q("ZodXID",(e,r)=>{N_.init(e,r),At.init(e,r)}),FC=q("ZodKSUID",(e,r)=>{z_.init(e,r),At.init(e,r)}),VC=q("ZodIPv4",(e,r)=>{V_.init(e,r),At.init(e,r)}),UC=q("ZodIPv6",(e,r)=>{U_.init(e,r),At.init(e,r)}),WC=q("ZodCIDRv4",(e,r)=>{W_.init(e,r),At.init(e,r)}),YC=q("ZodCIDRv6",(e,r)=>{Y_.init(e,r),At.init(e,r)}),HC=q("ZodBase64",(e,r)=>{H_.init(e,r),At.init(e,r)}),qC=q("ZodBase64URL",(e,r)=>{Z_.init(e,r),At.init(e,r)}),ZC=q("ZodE164",(e,r)=>{G_.init(e,r),At.init(e,r)}),GC=q("ZodJWT",(e,r)=>{Q_.init(e,r),At.init(e,r)}),fp=q("ZodNumber",(e,r)=>{qf.init(e,r),Nt.init(e,r),e.gt=(n,o)=>e.check(ip(n,o)),e.gte=(n,o)=>e.check(vc(n,o)),e.min=(n,o)=>e.check(vc(n,o)),e.lt=(n,o)=>e.check(sp(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(pp(n)),e.safe=n=>e.check(pp(n)),e.positive=n=>e.check(ip(0,n)),e.nonnegative=n=>e.check(vc(0,n)),e.negative=n=>e.check(sp(0,n)),e.nonpositive=n=>e.check(gc(0,n)),e.multipleOf=(n,o)=>e.check(ap(n,o)),e.step=(n,o)=>e.check(ap(n,o)),e.finite=()=>e;const t=e._zod.bag;e.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),e.isFinite=!0,e.format=t.format??null});function Pi(e){return qS(fp,e)}const KC=q("ZodNumberFormat",(e,r)=>{J_.init(e,r),fp.init(e,r)});function pp(e){return ZS(KC,e)}const QC=q("ZodBoolean",(e,r)=>{X_.init(e,r),Nt.init(e,r)});function zo(e){return GS(QC,e)}const JC=q("ZodUnknown",(e,r)=>{eS.init(e,r),Nt.init(e,r)});function hp(){return KS(JC)}const XC=q("ZodNever",(e,r)=>{tS.init(e,r),Nt.init(e,r)});function eE(e){return QS(XC,e)}const tE=q("ZodArray",(e,r)=>{rS.init(e,r),Nt.init(e,r),e.element=r.element,e.min=(t,n)=>e.check(Oi(t,n)),e.nonempty=t=>e.check(Oi(1,t)),e.max=(t,n)=>e.check(cp(t,n)),e.length=(t,n)=>e.check(lp(t,n)),e.unwrap=()=>e.element});function mp(e,r){return cC(tE,e,r)}const rE=q("ZodObject",(e,r)=>{oS.init(e,r),Nt.init(e,r),mt(e,"shape",()=>r.shape),e.keyof=()=>vp(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:hp()}),e.loose=()=>e.clone({...e._zod.def,catchall:hp()}),e.strict=()=>e.clone({...e._zod.def,catchall:eE()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ww(e,t),e.safeExtend=t=>_w(e,t),e.merge=t=>Sw(e,t),e.pick=t=>bw(e,t),e.omit=t=>xw(e,t),e.partial=(...t)=>Cw(yp,e,t[0]),e.required=(...t)=>Ew(wp,e,t[0])});function gp(e,r){const t={type:"object",get shape(){return on(this,"shape",e?hw(e):{}),this.shape},...Te(r)};return new rE(t)}const nE=q("ZodUnion",(e,r)=>{sS.init(e,r),Nt.init(e,r),e.options=r.options});function oE(e,r){return new nE({type:"union",options:e,...Te(r)})}const sE=q("ZodIntersection",(e,r)=>{iS.init(e,r),Nt.init(e,r)});function iE(e,r){return new sE({type:"intersection",left:e,right:r})}const yc=q("ZodEnum",(e,r)=>{aS.init(e,r),Nt.init(e,r),e.enum=r.entries,e.options=Object.values(r.entries);const t=new Set(Object.keys(r.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(t.has(i))s[i]=r.entries[i];else throw new Error(`Key ${i} not found in enum`);return new yc({...r,checks:[],...Te(o),entries:s})},e.exclude=(n,o)=>{const s={...r.entries};for(const i of n)if(t.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new yc({...r,checks:[],...Te(o),entries:s})}});function vp(e,r){const t=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new yc({type:"enum",entries:t,...Te(r)})}const aE=q("ZodLiteral",(e,r)=>{cS.init(e,r),Nt.init(e,r),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function cE(e,r){return new aE({type:"literal",values:Array.isArray(e)?e:[e],...Te(r)})}const lE=q("ZodTransform",(e,r)=>{lS.init(e,r),Nt.init(e,r),e._zod.parse=(t,n)=>{if(n.direction==="backward")throw new If(e.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(Ro(s,t.value,r));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),t.issues.push(Ro(i))}};const o=r.transform(t.value,t);return o instanceof Promise?o.then(s=>(t.value=s,t)):(t.value=o,t)}});function uE(e){return new lE({type:"transform",transform:e})}const yp=q("ZodOptional",(e,r)=>{uS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function bp(e){return new yp({type:"optional",innerType:e})}const dE=q("ZodNullable",(e,r)=>{dS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function xp(e){return new dE({type:"nullable",innerType:e})}const fE=q("ZodDefault",(e,r)=>{fS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pE(e,r){return new fE({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():Nf(r)}})}const hE=q("ZodPrefault",(e,r)=>{pS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function mE(e,r){return new hE({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():Nf(r)}})}const wp=q("ZodNonOptional",(e,r)=>{hS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function gE(e,r){return new wp({type:"nonoptional",innerType:e,...Te(r)})}const vE=q("ZodCatch",(e,r)=>{mS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yE(e,r){return new vE({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}const bE=q("ZodPipe",(e,r)=>{gS.init(e,r),Nt.init(e,r),e.in=r.in,e.out=r.out});function _p(e,r){return new bE({type:"pipe",in:e,out:r})}const xE=q("ZodReadonly",(e,r)=>{vS.init(e,r),Nt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function wE(e){return new xE({type:"readonly",innerType:e})}const _E=q("ZodCustom",(e,r)=>{yS.init(e,r),Nt.init(e,r)});function SE(e,r={}){return lC(_E,e,r)}function CE(e){return uC(e)}const bc=()=>{const{calendarApiUrl:e}=sc(),r=async(p,b)=>{try{return(await bt.get(`${e}/api/Calendario/v1/local/ListarEventosXUsuario/${p}/${b}`)).data.map(C=>{const E=new Date(C.fechaInicio),S=new Date(C.fechaFin),w=C.solicitudRelacionada?.[0]?.nombreCliente??null;return{...C,fechaInicio:E,fechaFin:S,client:w}})}catch(_){return console.error("Error events:",_),[]}},t=async(p,b)=>{try{const _=await bt.post(`${e}/api/Calendario/v1/local/InsertarEvento/${b}`,p);return{..._.data,fechaInicio:new Date(_.data.fechaInicio),fechaFin:new Date(_.data.fechaFin)}}catch(_){throw console.log("Error creating event:",_),_}},n=async p=>{try{const b=await bt.post(`${e}/api/Calendario/v1/local/ActualizarEvento/${p.eventoID}`,p);return{eventoID:b.data.eventoID,titulo:b.data.titulo,descripcion:b.data.descripcion,fechaInicio:new Date(b.data.fechaInicio),fechaFin:new Date(b.data.fechaFin),todoElDia:b.data.todoElDia,color:b.data.color,repetir:b.data.repetir,link:b.data.link,solID:b.data.solID,disID:b.data.disID,client:b.data.client,esOrganizador:b.data.esOrganizador}}catch(b){throw console.log("Error updating event:",b),b}},o=async p=>{try{const b=await bt.get(`${e}/api/Calendario/v1/local/ObtenerEvento/${p}`),_=b.data[0].solicitudRelacionada?.[0]?.nombreCliente||null;return{...b.data[0],fechaInicio:b.data[0].fechaInicio,fechaFin:b.data[0].fechaFin,client:_}}catch(b){throw console.error(`Error fetching event with ID ${p}:`,b),b}},s=async p=>{try{await bt.post(`${e}/api/Calendario/v1/local/EliminarEvento/${p}`)}catch(b){throw console.log(`Error ID ${p}:`,b),b}},i=v.useCallback(async(p,b,_,C,E)=>{try{const S={masNombreBD:_,usrID:C,disID:b,nombreCliente:p,tiposSolicitud:E},B=(await bt.post(`${e}/api/Calendario/v1/local/ConsultaClientesXUsuariologgeado/`,S)).data?.data;return Array.isArray(B)?B.map(A=>({clienteID:A.clienteID,solID:A.solID,marca:A?.marca,modelo:A?.modelo,nombreCliente:A?.nombreCliente,email:A?.email,tel:A?.tel})):[]}catch(S){return console.error("Error clientes:",S),[]}},[e]),a=async(p,b)=>{try{const _={disID:p,usrMail:b},E=(await bt.post(`${e}/api/Calendario/v1/Consulta_UsuariosInvitados/`,_)).data?.data;return Array.isArray(E)?E.map(S=>({usrID:S.usrID,usrNombre:S.usrNombre,usrMail:S?.usrMail,disID:S?.disID})):[]}catch(_){return console.error("Error usuarios:",_),[]}},c=async(p,b,_,C,E)=>{const S={tieneConflicto:!1,usrMail:""};try{const w={disID:p,usrMail:b,startDate:_,horaInicio:C,horaFin:E};return(await bt.post(`${e}/api/Calendario/v1/local/ConsultaConflictoInvitados`,w)).data?.data}catch(w){return console.error("Error al verificar conflicto:",w),S}},d=async(p,b,_,C)=>{try{const E={disID:p,usrMail:b,startDate:_,DuracionEvento:C},w=(await bt.post(`${e}/api/Calendario/v1/local/ConsultaDisponibilidadUsuario`,E)).data?.data;return Array.isArray(w)?w.map(B=>({Fecha:B.fecha,HoraInicio:B.horaInicio,HoraFin:B.horaFin})):[]}catch(E){return console.error("Error usuarios:",E),[]}},u=v.useCallback(async(p,b)=>{try{return(await bt.post(`${e}/api/Notificaciones/v1/local/ObtenerNotificacionesPorUsuarioAsync/${p}/${b}?soloNoLeidas=true`)).data}catch(_){return console.error("Error usuarios:",_),[]}},[e]);return{getEventsByUser:r,createEvent:t,updateEvent:n,getEventById:o,deleteEvent:s,getClients:i,getUsuariosInvitados:a,VerificarConflicto:c,getDisponibilidadUsuario:d,getNotificacionesXUsuario:u,UpdateStatusEvento:async(p,b,_)=>{try{const C={EventoID:p,UsuarioID:b,status:_};return(await bt.post(`${e}/api/Calendario/v1/local/ActualizarEstadoInvitacionAsync/`,C)).data}catch(C){return console.error("Error Actualizar estatus:",C),{}}},MarcarLeido:async(p,b)=>{try{return(await bt.post(`${e}/api/Notificaciones/v1/local/MarcarComoLeidaAsync/${p}?usuarioId=${b}&marcarComoLeida=true`)).data?.data}catch(_){return console.error("Error Actualizar estatus:",_),{}}},ReenviarNotificacion:async(p,b)=>{try{return(await bt.post(`${e}/api/Calendario/v1/local/ReenviarNotificacion/${b}/${p}`)).data?.data}catch(_){return console.error("Error Actualizar estatus:",_),{}}},insertarEventoGoogle:async(p,b,_,C)=>{try{const E=`api/Calendario/v1/google/InsertarEvento?disID=${p}&usrMail=${b}&incluirMeet=${_}`;return(await bt.post(`${e}/${E}`,C)).data}catch(E){throw console.error("Error al insertar evento en Google:",E),E}}}};var Lo={},Sp;function EE(){if(Sp)return Lo;Sp=1;var e=at();Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.default=void 0;var r=e(pt()),t=ut();return Lo.default=(0,r.default)([(0,t.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,t.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime"),Lo}var AE=EE();const xc=it(AE);var $o=e=>e.type==="checkbox",Sn=e=>e instanceof Date,Jt=e=>e==null;const Cp=e=>typeof e=="object";var zt=e=>!Jt(e)&&!Array.isArray(e)&&Cp(e)&&!Sn(e),Ep=e=>zt(e)&&e.target?$o(e.target)?e.target.checked:e.target.value:e,DE=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ap=(e,r)=>e.has(DE(r)),kE=e=>{const r=e.constructor&&e.constructor.prototype;return zt(r)&&r.hasOwnProperty("isPrototypeOf")},wc=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ft(e){let r;const t=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(!(wc&&(e instanceof Blob||n))&&(t||zt(e)))if(r=t?[]:Object.create(Object.getPrototypeOf(e)),!t&&!kE(e))r=e;else for(const o in e)e.hasOwnProperty(o)&&(r[o]=Ft(e[o]));else return e;return r}var Ri=e=>/^\w*$/.test(e),Lt=e=>e===void 0,_c=e=>Array.isArray(e)?e.filter(Boolean):[],Sc=e=>_c(e.replace(/["|']|\]/g,"").split(/\.|\[/)),he=(e,r,t)=>{if(!r||!zt(e))return t;const n=(Ri(r)?[r]:Sc(r)).reduce((o,s)=>Jt(o)?o:o[s],e);return Lt(n)||n===e?Lt(e[r])?t:e[r]:n},lr=e=>typeof e=="boolean",ct=(e,r,t)=>{let n=-1;const o=Ri(r)?[r]:Sc(r),s=o.length,i=s-1;for(;++n<s;){const a=o[n];let c=t;if(n!==i){const d=e[a];c=zt(d)||Array.isArray(d)?d:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const Ni={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Er={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Zr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Cc=v.createContext(null);Cc.displayName="HookFormContext";const Ec=()=>v.useContext(Cc),TE=e=>{const{children:r,...t}=e;return v.createElement(Cc.Provider,{value:t},r)};var Dp=(e,r,t,n=!0)=>{const o={defaultValues:r._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return r._proxyFormState[i]!==Er.all&&(r._proxyFormState[i]=!n||Er.all),t&&(t[i]=!0),e[i]}});return o};const Ac=typeof window<"u"?v.useLayoutEffect:v.useEffect;function ME(e){const r=Ec(),{control:t=r.control,disabled:n,name:o,exact:s}=e||{},[i,a]=v.useState(t._formState),c=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ac(()=>t._subscribe({name:o,formState:c.current,exact:s,callback:d=>{!n&&a({...t._formState,...d})}}),[o,n,s]),v.useEffect(()=>{c.current.isValid&&t._setValid(!0)},[t]),v.useMemo(()=>Dp(i,t,c.current,!1),[i,t])}var Vr=e=>typeof e=="string",kp=(e,r,t,n,o)=>Vr(e)?(n&&r.watch.add(e),he(t,e,o)):Array.isArray(e)?e.map(s=>(n&&r.watch.add(s),he(t,s))):(n&&(r.watchAll=!0),t),Dc=e=>Jt(e)||!Cp(e);function Gr(e,r,t=new WeakSet){if(Dc(e)||Dc(r))return e===r;if(Sn(e)&&Sn(r))return e.getTime()===r.getTime();const n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const s of n){const i=e[s];if(!o.includes(s))return!1;if(s!=="ref"){const a=r[s];if(Sn(i)&&Sn(a)||zt(i)&&zt(a)||Array.isArray(i)&&Array.isArray(a)?!Gr(i,a,t):i!==a)return!1}}return!0}function Tp(e){const r=Ec(),{control:t=r.control,name:n,defaultValue:o,disabled:s,exact:i,compute:a}=e||{},c=v.useRef(o),d=v.useRef(a),u=v.useRef(void 0);d.current=a;const f=v.useMemo(()=>t._getWatch(n,c.current),[t,n]),[h,g]=v.useState(d.current?d.current(f):f);return Ac(()=>t._subscribe({name:n,formState:{values:!0},exact:i,callback:y=>{if(!s){const p=kp(n,t._names,y.values||t._formValues,!1,c.current);if(d.current){const b=d.current(p);Gr(b,u.current)||(g(b),u.current=b)}else g(p)}}}),[t,s,n,i]),v.useEffect(()=>t._removeUnmounted()),h}function IE(e){const r=Ec(),{name:t,disabled:n,control:o=r.control,shouldUnregister:s,defaultValue:i}=e,a=Ap(o._names.array,t),c=v.useMemo(()=>he(o._formValues,t,he(o._defaultValues,t,i)),[o,t,i]),d=Tp({control:o,name:t,defaultValue:c,exact:!0}),u=ME({control:o,name:t,exact:!0}),f=v.useRef(e),h=v.useRef(o.register(t,{...e.rules,value:d,...lr(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const g=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!he(u.errors,t)},isDirty:{enumerable:!0,get:()=>!!he(u.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!he(u.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!he(u.validatingFields,t)},error:{enumerable:!0,get:()=>he(u.errors,t)}}),[u,t]),y=v.useCallback(C=>h.current.onChange({target:{value:Ep(C),name:t},type:Ni.CHANGE}),[t]),p=v.useCallback(()=>h.current.onBlur({target:{value:he(o._formValues,t),name:t},type:Ni.BLUR}),[t,o._formValues]),b=v.useCallback(C=>{const E=he(o._fields,t);E&&C&&(E._f.ref={focus:()=>C.focus&&C.focus(),select:()=>C.select&&C.select(),setCustomValidity:S=>C.setCustomValidity(S),reportValidity:()=>C.reportValidity()})},[o._fields,t]),_=v.useMemo(()=>({name:t,value:d,...lr(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:y,onBlur:p,ref:b}),[t,n,u.disabled,y,p,b,d]);return v.useEffect(()=>{const C=o._options.shouldUnregister||s;o.register(t,{...f.current.rules,...lr(f.current.disabled)?{disabled:f.current.disabled}:{}});const E=(S,w)=>{const B=he(o._fields,S);B&&B._f&&(B._f.mount=w)};if(E(t,!0),C){const S=Ft(he(o._options.defaultValues,t));ct(o._defaultValues,t,S),Lt(he(o._formValues,t))&&ct(o._formValues,t,S)}return!a&&o.register(t),()=>{(a?C&&!o._state.action:C)?o.unregister(t):E(t,!1)}},[t,o,a,s]),v.useEffect(()=>{o._setDisabledField({disabled:n,name:t})},[n,t,o]),v.useMemo(()=>({field:_,formState:u,fieldState:g}),[_,u,g])}const Ar=e=>e.render(IE(e));var kc=(e,r,t,n,o)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[n]:o||!0}}:{},Bo=e=>Array.isArray(e)?e:[e],Mp=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},nr=e=>zt(e)&&!Object.keys(e).length,Tc=e=>e.type==="file",Dr=e=>typeof e=="function",zi=e=>{if(!wc)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Ip=e=>e.type==="select-multiple",Mc=e=>e.type==="radio",OE=e=>Mc(e)||$o(e),Ic=e=>zi(e)&&e.isConnected;function jE(e,r){const t=r.slice(0,-1).length;let n=0;for(;n<t;)e=Lt(e)?n++:e[r[n++]];return e}function PE(e){for(const r in e)if(e.hasOwnProperty(r)&&!Lt(e[r]))return!1;return!0}function Bt(e,r){const t=Array.isArray(r)?r:Ri(r)?[r]:Sc(r),n=t.length===1?e:jE(e,t),o=t.length-1,s=t[o];return n&&delete n[s],o!==0&&(zt(n)&&nr(n)||Array.isArray(n)&&PE(n))&&Bt(e,t.slice(0,-1)),e}var Op=e=>{for(const r in e)if(Dr(e[r]))return!0;return!1};function Li(e,r={}){const t=Array.isArray(e);if(zt(e)||t)for(const n in e)Array.isArray(e[n])||zt(e[n])&&!Op(e[n])?(r[n]=Array.isArray(e[n])?[]:{},Li(e[n],r[n])):Jt(e[n])||(r[n]=!0);return r}function jp(e,r,t){const n=Array.isArray(e);if(zt(e)||n)for(const o in e)Array.isArray(e[o])||zt(e[o])&&!Op(e[o])?Lt(r)||Dc(t[o])?t[o]=Array.isArray(e[o])?Li(e[o],[]):{...Li(e[o])}:jp(e[o],Jt(r)?{}:r[o],t[o]):t[o]=!Gr(e[o],r[o]);return t}var Fo=(e,r)=>jp(e,r,Li(r));const Pp={value:!1,isValid:!1},Rp={value:!0,isValid:!0};var Np=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Lt(e[0].attributes.value)?Lt(e[0].value)||e[0].value===""?Rp:{value:e[0].value,isValid:!0}:Rp:Pp}return Pp},zp=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:n})=>Lt(e)?e:r?e===""?NaN:e&&+e:t&&Vr(e)?new Date(e):n?n(e):e;const Lp={isValid:!1,value:null};var $p=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,Lp):Lp;function Bp(e){const r=e.ref;return Tc(r)?r.files:Mc(r)?$p(e.refs).value:Ip(r)?[...r.selectedOptions].map(({value:t})=>t):$o(r)?Np(e.refs).value:zp(Lt(r.value)?e.ref.value:r.value,e)}var RE=(e,r,t,n)=>{const o={};for(const s of e){const i=he(r,s);i&&ct(o,s,i._f)}return{criteriaMode:t,names:[...e],fields:o,shouldUseNativeValidation:n}},$i=e=>e instanceof RegExp,Vo=e=>Lt(e)?e:$i(e)?e.source:zt(e)?$i(e.value)?e.value.source:e.value:e,Fp=e=>({isOnSubmit:!e||e===Er.onSubmit,isOnBlur:e===Er.onBlur,isOnChange:e===Er.onChange,isOnAll:e===Er.all,isOnTouch:e===Er.onTouched});const Vp="AsyncFunction";var NE=e=>!!e&&!!e.validate&&!!(Dr(e.validate)&&e.validate.constructor.name===Vp||zt(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===Vp)),zE=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Up=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Uo=(e,r,t,n)=>{for(const o of t||Object.keys(e)){const s=he(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&r(i.refs[0],o)&&!n)return!0;if(i.ref&&r(i.ref,i.name)&&!n)return!0;if(Uo(a,r))break}else if(zt(a)&&Uo(a,r))break}}};function Wp(e,r,t){const n=he(e,t);if(n||Ri(t))return{error:n,name:t};const o=t.split(".");for(;o.length;){const s=o.join("."),i=he(r,s),a=he(e,s);if(i&&!Array.isArray(i)&&t!==s)return{name:t};if(a&&a.type)return{name:s,error:a};if(a&&a.root&&a.root.type)return{name:`${s}.root`,error:a.root};o.pop()}return{name:t}}var LE=(e,r,t,n)=>{t(e);const{name:o,...s}=e;return nr(s)||Object.keys(s).length>=Object.keys(r).length||Object.keys(s).find(i=>r[i]===(!n||Er.all))},$E=(e,r,t)=>!e||!r||e===r||Bo(e).some(n=>n&&(t?n===r:n.startsWith(r)||r.startsWith(n))),BE=(e,r,t,n,o)=>o.isOnAll?!1:!t&&o.isOnTouch?!(r||e):(t?n.isOnBlur:o.isOnBlur)?!e:(t?n.isOnChange:o.isOnChange)?e:!0,FE=(e,r)=>!_c(he(e,r)).length&&Bt(e,r),VE=(e,r,t)=>{const n=Bo(he(e,t));return ct(n,"root",r[t]),ct(e,t,n),e},Bi=e=>Vr(e);function Yp(e,r,t="validate"){if(Bi(e)||Array.isArray(e)&&e.every(Bi)||lr(e)&&!e)return{type:t,message:Bi(e)?e:"",ref:r}}var qn=e=>zt(e)&&!$i(e)?e:{value:e,message:""},Hp=async(e,r,t,n,o,s)=>{const{ref:i,refs:a,required:c,maxLength:d,minLength:u,min:f,max:h,pattern:g,validate:y,name:p,valueAsNumber:b,mount:_}=e._f,C=he(t,p);if(!_||r.has(p))return{};const E=a?a[0]:i,S=Z=>{o&&E.reportValidity&&(E.setCustomValidity(lr(Z)?"":Z||""),E.reportValidity())},w={},B=Mc(i),A=$o(i),T=B||A,I=(b||Tc(i))&&Lt(i.value)&&Lt(C)||zi(i)&&i.value===""||C===""||Array.isArray(C)&&!C.length,M=kc.bind(null,p,n,w),W=(Z,V,H,te=Zr.maxLength,Y=Zr.minLength)=>{const N=Z?V:H;w[p]={type:Z?te:Y,message:N,ref:i,...M(Z?te:Y,N)}};if(s?!Array.isArray(C)||!C.length:c&&(!T&&(I||Jt(C))||lr(C)&&!C||A&&!Np(a).isValid||B&&!$p(a).isValid)){const{value:Z,message:V}=Bi(c)?{value:!!c,message:c}:qn(c);if(Z&&(w[p]={type:Zr.required,message:V,ref:E,...M(Zr.required,V)},!n))return S(V),w}if(!I&&(!Jt(f)||!Jt(h))){let Z,V;const H=qn(h),te=qn(f);if(!Jt(C)&&!isNaN(C)){const Y=i.valueAsNumber||C&&+C;Jt(H.value)||(Z=Y>H.value),Jt(te.value)||(V=Y<te.value)}else{const Y=i.valueAsDate||new Date(C),N=z=>new Date(new Date().toDateString()+" "+z),ie=i.type=="time",de=i.type=="week";Vr(H.value)&&C&&(Z=ie?N(C)>N(H.value):de?C>H.value:Y>new Date(H.value)),Vr(te.value)&&C&&(V=ie?N(C)<N(te.value):de?C<te.value:Y<new Date(te.value))}if((Z||V)&&(W(!!Z,H.message,te.message,Zr.max,Zr.min),!n))return S(w[p].message),w}if((d||u)&&!I&&(Vr(C)||s&&Array.isArray(C))){const Z=qn(d),V=qn(u),H=!Jt(Z.value)&&C.length>+Z.value,te=!Jt(V.value)&&C.length<+V.value;if((H||te)&&(W(H,Z.message,V.message),!n))return S(w[p].message),w}if(g&&!I&&Vr(C)){const{value:Z,message:V}=qn(g);if($i(Z)&&!C.match(Z)&&(w[p]={type:Zr.pattern,message:V,ref:i,...M(Zr.pattern,V)},!n))return S(V),w}if(y){if(Dr(y)){const Z=await y(C,t),V=Yp(Z,E);if(V&&(w[p]={...V,...M(Zr.validate,V.message)},!n))return S(V.message),w}else if(zt(y)){let Z={};for(const V in y){if(!nr(Z)&&!n)break;const H=Yp(await y[V](C,t),E,V);H&&(Z={...H,...M(V,H.message)},S(H.message),n&&(w[p]=Z))}if(!nr(Z)&&(w[p]={ref:E,...Z},!n))return w}}return S(!0),w};const UE={mode:Er.onSubmit,reValidateMode:Er.onChange,shouldFocusError:!0};function WE(e={}){let r={...UE,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:Dr(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},n={},o=zt(r.defaultValues)||zt(r.values)?Ft(r.defaultValues||r.values)||{}:{},s=r.shouldUnregister?{}:Ft(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...u};const h={array:Mp(),state:Mp()},g=r.criteriaMode===Er.all,y=D=>O=>{clearTimeout(d),d=setTimeout(D,O)},p=async D=>{if(!r.disabled&&(u.isValid||f.isValid||D)){const O=r.resolver?nr((await A()).errors):await I(n,!0);O!==t.isValid&&h.state.next({isValid:O})}},b=(D,O)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((D||Array.from(a.mount)).forEach(F=>{F&&(O?ct(t.validatingFields,F,O):Bt(t.validatingFields,F))}),h.state.next({validatingFields:t.validatingFields,isValidating:!nr(t.validatingFields)}))},_=(D,O=[],F,ce,ne=!0,j=!0)=>{if(ce&&F&&!r.disabled){if(i.action=!0,j&&Array.isArray(he(n,D))){const G=F(he(n,D),ce.argA,ce.argB);ne&&ct(n,D,G)}if(j&&Array.isArray(he(t.errors,D))){const G=F(he(t.errors,D),ce.argA,ce.argB);ne&&ct(t.errors,D,G),FE(t.errors,D)}if((u.touchedFields||f.touchedFields)&&j&&Array.isArray(he(t.touchedFields,D))){const G=F(he(t.touchedFields,D),ce.argA,ce.argB);ne&&ct(t.touchedFields,D,G)}(u.dirtyFields||f.dirtyFields)&&(t.dirtyFields=Fo(o,s)),h.state.next({name:D,isDirty:W(D,O),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else ct(s,D,O)},C=(D,O)=>{ct(t.errors,D,O),h.state.next({errors:t.errors})},E=D=>{t.errors=D,h.state.next({errors:t.errors,isValid:!1})},S=(D,O,F,ce)=>{const ne=he(n,D);if(ne){const j=he(s,D,Lt(F)?he(o,D):F);Lt(j)||ce&&ce.defaultChecked||O?ct(s,D,O?j:Bp(ne._f)):H(D,j),i.mount&&p()}},w=(D,O,F,ce,ne)=>{let j=!1,G=!1;const pe={name:D};if(!r.disabled){if(!F||ce){(u.isDirty||f.isDirty)&&(G=t.isDirty,t.isDirty=pe.isDirty=W(),j=G!==pe.isDirty);const Oe=Gr(he(o,D),O);G=!!he(t.dirtyFields,D),Oe?Bt(t.dirtyFields,D):ct(t.dirtyFields,D,!0),pe.dirtyFields=t.dirtyFields,j=j||(u.dirtyFields||f.dirtyFields)&&G!==!Oe}if(F){const Oe=he(t.touchedFields,D);Oe||(ct(t.touchedFields,D,F),pe.touchedFields=t.touchedFields,j=j||(u.touchedFields||f.touchedFields)&&Oe!==F)}j&&ne&&h.state.next(pe)}return j?pe:{}},B=(D,O,F,ce)=>{const ne=he(t.errors,D),j=(u.isValid||f.isValid)&&lr(O)&&t.isValid!==O;if(r.delayError&&F?(c=y(()=>C(D,F)),c(r.delayError)):(clearTimeout(d),c=null,F?ct(t.errors,D,F):Bt(t.errors,D)),(F?!Gr(ne,F):ne)||!nr(ce)||j){const G={...ce,...j&&lr(O)?{isValid:O}:{},errors:t.errors,name:D};t={...t,...G},h.state.next(G)}},A=async D=>{b(D,!0);const O=await r.resolver(s,r.context,RE(D||a.mount,n,r.criteriaMode,r.shouldUseNativeValidation));return b(D),O},T=async D=>{const{errors:O}=await A(D);if(D)for(const F of D){const ce=he(O,F);ce?ct(t.errors,F,ce):Bt(t.errors,F)}else t.errors=O;return O},I=async(D,O,F={valid:!0})=>{for(const ce in D){const ne=D[ce];if(ne){const{_f:j,...G}=ne;if(j){const pe=a.array.has(j.name),Oe=ne._f&&NE(ne._f);Oe&&u.validatingFields&&b([ce],!0);const P=await Hp(ne,a.disabled,s,g,r.shouldUseNativeValidation&&!O,pe);if(Oe&&u.validatingFields&&b([ce]),P[j.name]&&(F.valid=!1,O))break;!O&&(he(P,j.name)?pe?VE(t.errors,P,j.name):ct(t.errors,j.name,P[j.name]):Bt(t.errors,j.name))}!nr(G)&&await I(G,O,F)}}return F.valid},M=()=>{for(const D of a.unMount){const O=he(n,D);O&&(O._f.refs?O._f.refs.every(F=>!Ic(F)):!Ic(O._f.ref))&&re(D)}a.unMount=new Set},W=(D,O)=>!r.disabled&&(D&&O&&ct(s,D,O),!Gr(z(),o)),Z=(D,O,F)=>kp(D,a,{...i.mount?s:Lt(O)?o:Vr(D)?{[D]:O}:O},F,O),V=D=>_c(he(i.mount?s:o,D,r.shouldUnregister?he(o,D,[]):[])),H=(D,O,F={})=>{const ce=he(n,D);let ne=O;if(ce){const j=ce._f;j&&(!j.disabled&&ct(s,D,zp(O,j)),ne=zi(j.ref)&&Jt(O)?"":O,Ip(j.ref)?[...j.ref.options].forEach(G=>G.selected=ne.includes(G.value)):j.refs?$o(j.ref)?j.refs.forEach(G=>{(!G.defaultChecked||!G.disabled)&&(Array.isArray(ne)?G.checked=!!ne.find(pe=>pe===G.value):G.checked=ne===G.value||!!ne)}):j.refs.forEach(G=>G.checked=G.value===ne):Tc(j.ref)?j.ref.value="":(j.ref.value=ne,j.ref.type||h.state.next({name:D,values:Ft(s)})))}(F.shouldDirty||F.shouldTouch)&&w(D,ne,F.shouldTouch,F.shouldDirty,!0),F.shouldValidate&&de(D)},te=(D,O,F)=>{for(const ce in O){if(!O.hasOwnProperty(ce))return;const ne=O[ce],j=D+"."+ce,G=he(n,j);(a.array.has(D)||zt(ne)||G&&!G._f)&&!Sn(ne)?te(j,ne,F):H(j,ne,F)}},Y=(D,O,F={})=>{const ce=he(n,D),ne=a.array.has(D),j=Ft(O);ct(s,D,j),ne?(h.array.next({name:D,values:Ft(s)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&F.shouldDirty&&h.state.next({name:D,dirtyFields:Fo(o,s),isDirty:W(D,j)})):ce&&!ce._f&&!Jt(j)?te(D,j,F):H(D,j,F),Up(D,a)&&h.state.next({...t,name:D}),h.state.next({name:i.mount?D:void 0,values:Ft(s)})},N=async D=>{i.mount=!0;const O=D.target;let F=O.name,ce=!0;const ne=he(n,F),j=Oe=>{ce=Number.isNaN(Oe)||Sn(Oe)&&isNaN(Oe.getTime())||Gr(Oe,he(s,F,Oe))},G=Fp(r.mode),pe=Fp(r.reValidateMode);if(ne){let Oe,P;const X=O.type?Bp(ne._f):Ep(D),we=D.type===Ni.BLUR||D.type===Ni.FOCUS_OUT,qe=!zE(ne._f)&&!r.resolver&&!he(t.errors,F)&&!ne._f.deps||BE(we,he(t.touchedFields,F),t.isSubmitted,pe,G),St=Up(F,a,we);ct(s,F,X),we?(!O||!O.readOnly)&&(ne._f.onBlur&&ne._f.onBlur(D),c&&c(0)):ne._f.onChange&&ne._f.onChange(D);const gt=w(F,X,we),Kt=!nr(gt)||St;if(!we&&h.state.next({name:F,type:D.type,values:Ft(s)}),qe)return(u.isValid||f.isValid)&&(r.mode==="onBlur"?we&&p():we||p()),Kt&&h.state.next({name:F,...St?{}:gt});if(!we&&St&&h.state.next({...t}),r.resolver){const{errors:Ht}=await A([F]);if(j(X),ce){const Tr=Wp(t.errors,n,F),It=Wp(Ht,n,Tr.name||F);Oe=It.error,F=It.name,P=nr(Ht)}}else b([F],!0),Oe=(await Hp(ne,a.disabled,s,g,r.shouldUseNativeValidation))[F],b([F]),j(X),ce&&(Oe?P=!1:(u.isValid||f.isValid)&&(P=await I(n,!0)));ce&&(ne._f.deps&&de(ne._f.deps),B(F,P,Oe,gt))}},ie=(D,O)=>{if(he(t.errors,O)&&D.focus)return D.focus(),1},de=async(D,O={})=>{let F,ce;const ne=Bo(D);if(r.resolver){const j=await T(Lt(D)?D:ne);F=nr(j),ce=D?!ne.some(G=>he(j,G)):F}else D?(ce=(await Promise.all(ne.map(async j=>{const G=he(n,j);return await I(G&&G._f?{[j]:G}:G)}))).every(Boolean),!(!ce&&!t.isValid)&&p()):ce=F=await I(n);return h.state.next({...!Vr(D)||(u.isValid||f.isValid)&&F!==t.isValid?{}:{name:D},...r.resolver||!D?{isValid:F}:{},errors:t.errors}),O.shouldFocus&&!ce&&Uo(n,ie,D?ne:a.mount),ce},z=D=>{const O={...i.mount?s:o};return Lt(D)?O:Vr(D)?he(O,D):D.map(F=>he(O,F))},Q=(D,O)=>({invalid:!!he((O||t).errors,D),isDirty:!!he((O||t).dirtyFields,D),error:he((O||t).errors,D),isValidating:!!he(t.validatingFields,D),isTouched:!!he((O||t).touchedFields,D)}),Ee=D=>{D&&Bo(D).forEach(O=>Bt(t.errors,O)),h.state.next({errors:D?t.errors:{}})},xe=(D,O,F)=>{const ce=(he(n,D,{_f:{}})._f||{}).ref,ne=he(t.errors,D)||{},{ref:j,message:G,type:pe,...Oe}=ne;ct(t.errors,D,{...Oe,...O,ref:ce}),h.state.next({name:D,errors:t.errors,isValid:!1}),F&&F.shouldFocus&&ce&&ce.focus&&ce.focus()},_e=(D,O)=>Dr(D)?h.state.subscribe({next:F=>"values"in F&&D(Z(void 0,O),F)}):Z(D,O,!0),oe=D=>h.state.subscribe({next:O=>{$E(D.name,O.name,D.exact)&&LE(O,D.formState||u,st,D.reRenderRoot)&&D.callback({values:{...s},...t,...O,defaultValues:o})}}).unsubscribe,ae=D=>(i.mount=!0,f={...f,...D.formState},oe({...D,formState:f})),re=(D,O={})=>{for(const F of D?Bo(D):a.mount)a.mount.delete(F),a.array.delete(F),O.keepValue||(Bt(n,F),Bt(s,F)),!O.keepError&&Bt(t.errors,F),!O.keepDirty&&Bt(t.dirtyFields,F),!O.keepTouched&&Bt(t.touchedFields,F),!O.keepIsValidating&&Bt(t.validatingFields,F),!r.shouldUnregister&&!O.keepDefaultValue&&Bt(o,F);h.state.next({values:Ft(s)}),h.state.next({...t,...O.keepDirty?{isDirty:W()}:{}}),!O.keepIsValid&&p()},Se=({disabled:D,name:O})=>{(lr(D)&&i.mount||D||a.disabled.has(O))&&(D?a.disabled.add(O):a.disabled.delete(O))},Ce=(D,O={})=>{let F=he(n,D);const ce=lr(O.disabled)||lr(r.disabled);return ct(n,D,{...F||{},_f:{...F&&F._f?F._f:{ref:{name:D}},name:D,mount:!0,...O}}),a.mount.add(D),F?Se({disabled:lr(O.disabled)?O.disabled:r.disabled,name:D}):S(D,!0,O.value),{...ce?{disabled:O.disabled||r.disabled}:{},...r.progressive?{required:!!O.required,min:Vo(O.min),max:Vo(O.max),minLength:Vo(O.minLength),maxLength:Vo(O.maxLength),pattern:Vo(O.pattern)}:{},name:D,onChange:N,onBlur:N,ref:ne=>{if(ne){Ce(D,O),F=he(n,D);const j=Lt(ne.value)&&ne.querySelectorAll&&ne.querySelectorAll("input,select,textarea")[0]||ne,G=OE(j),pe=F._f.refs||[];if(G?pe.find(Oe=>Oe===j):j===F._f.ref)return;ct(n,D,{_f:{...F._f,...G?{refs:[...pe.filter(Ic),j,...Array.isArray(he(o,D))?[{}]:[]],ref:{type:j.type,name:D}}:{ref:j}}}),S(D,!1,void 0,j)}else F=he(n,D,{}),F._f&&(F._f.mount=!1),(r.shouldUnregister||O.shouldUnregister)&&!(Ap(a.array,D)&&i.action)&&a.unMount.add(D)}}},me=()=>r.shouldFocusError&&Uo(n,ie,a.mount),ze=D=>{lr(D)&&(h.state.next({disabled:D}),Uo(n,(O,F)=>{const ce=he(n,F);ce&&(O.disabled=ce._f.disabled||D,Array.isArray(ce._f.refs)&&ce._f.refs.forEach(ne=>{ne.disabled=ce._f.disabled||D}))},0,!1))},R=(D,O)=>async F=>{let ce;F&&(F.preventDefault&&F.preventDefault(),F.persist&&F.persist());let ne=Ft(s);if(h.state.next({isSubmitting:!0}),r.resolver){const{errors:j,values:G}=await A();t.errors=j,ne=Ft(G)}else await I(n);if(a.disabled.size)for(const j of a.disabled)Bt(ne,j);if(Bt(t.errors,"root"),nr(t.errors)){h.state.next({errors:{}});try{await D(ne,F)}catch(j){ce=j}}else O&&await O({...t.errors},F),me(),setTimeout(me);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nr(t.errors)&&!ce,submitCount:t.submitCount+1,errors:t.errors}),ce)throw ce},Le=(D,O={})=>{he(n,D)&&(Lt(O.defaultValue)?Y(D,Ft(he(o,D))):(Y(D,O.defaultValue),ct(o,D,Ft(O.defaultValue))),O.keepTouched||Bt(t.touchedFields,D),O.keepDirty||(Bt(t.dirtyFields,D),t.isDirty=O.defaultValue?W(D,Ft(he(o,D))):W()),O.keepError||(Bt(t.errors,D),u.isValid&&p()),h.state.next({...t}))},Ge=(D,O={})=>{const F=D?Ft(D):o,ce=Ft(F),ne=nr(D),j=ne?o:ce;if(O.keepDefaultValues||(o=F),!O.keepValues){if(O.keepDirtyValues){const G=new Set([...a.mount,...Object.keys(Fo(o,s))]);for(const pe of Array.from(G))he(t.dirtyFields,pe)?ct(j,pe,he(s,pe)):Y(pe,he(j,pe))}else{if(wc&&Lt(D))for(const G of a.mount){const pe=he(n,G);if(pe&&pe._f){const Oe=Array.isArray(pe._f.refs)?pe._f.refs[0]:pe._f.ref;if(zi(Oe)){const P=Oe.closest("form");if(P){P.reset();break}}}}if(O.keepFieldsRef)for(const G of a.mount)Y(G,he(j,G));else n={}}s=r.shouldUnregister?O.keepDefaultValues?Ft(o):{}:Ft(j),h.array.next({values:{...j}}),h.state.next({values:{...j}})}a={mount:O.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!O.keepIsValid||!!O.keepDirtyValues,i.watch=!!r.shouldUnregister,h.state.next({submitCount:O.keepSubmitCount?t.submitCount:0,isDirty:ne?!1:O.keepDirty?t.isDirty:!!(O.keepDefaultValues&&!Gr(D,o)),isSubmitted:O.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:ne?{}:O.keepDirtyValues?O.keepDefaultValues&&s?Fo(o,s):t.dirtyFields:O.keepDefaultValues&&D?Fo(o,D):O.keepDirty?t.dirtyFields:{},touchedFields:O.keepTouched?t.touchedFields:{},errors:O.keepErrors?t.errors:{},isSubmitSuccessful:O.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Ze=(D,O)=>Ge(Dr(D)?D(s):D,O),Ie=(D,O={})=>{const F=he(n,D),ce=F&&F._f;if(ce){const ne=ce.refs?ce.refs[0]:ce.ref;ne.focus&&(ne.focus(),O.shouldSelect&&Dr(ne.select)&&ne.select())}},st=D=>{t={...t,...D}},De={control:{register:Ce,unregister:re,getFieldState:Q,handleSubmit:R,setError:xe,_subscribe:oe,_runSchema:A,_focusError:me,_getWatch:Z,_getDirty:W,_setValid:p,_setFieldArray:_,_setDisabledField:Se,_setErrors:E,_getFieldArray:V,_reset:Ge,_resetDefaultValues:()=>Dr(r.defaultValues)&&r.defaultValues().then(D=>{Ze(D,r.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:M,_disableForm:ze,_subjects:h,_proxyFormState:u,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(D){i=D},get _defaultValues(){return o},get _names(){return a},set _names(D){a=D},get _formState(){return t},get _options(){return r},set _options(D){r={...r,...D}}},subscribe:ae,trigger:de,register:Ce,handleSubmit:R,watch:_e,setValue:Y,getValues:z,reset:Ze,resetField:Le,clearErrors:Ee,unregister:re,setError:xe,setFocus:Ie,getFieldState:Q};return{...De,formControl:De}}function qp(e={}){const r=v.useRef(void 0),t=v.useRef(void 0),[n,o]=v.useState({isDirty:!1,isValidating:!1,isLoading:Dr(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Dr(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:n},e.defaultValues&&!Dr(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=WE(e);r.current={...a,formState:n}}const s=r.current.control;return s._options=e,Ac(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),s._formState.isReady=!0,i},[s]),v.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),v.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),v.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),v.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),v.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),v.useEffect(()=>{e.values&&!Gr(e.values,t.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),t.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[s,e.values]),v.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),r.current.formState=Dp(n,s),r.current}const Zp=(e,r,t)=>{if(e&&"reportValidity"in e){const n=he(t,r);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Oc=(e,r)=>{for(const t in r.fields){const n=r.fields[t];n&&n.ref&&"reportValidity"in n.ref?Zp(n.ref,t,e):n&&n.refs&&n.refs.forEach(o=>Zp(o,t,e))}},Gp=(e,r)=>{r.shouldUseNativeValidation&&Oc(e,r);const t={};for(const n in e){const o=he(r.fields,n),s=Object.assign(e[n]||{},{ref:o&&o.ref});if(YE(r.names||Object.keys(e),n)){const i=Object.assign({},he(t,n));ct(i,"root",s),ct(t,n,i)}else ct(t,n,s)}return t},YE=(e,r)=>{const t=Kp(r);return e.some(n=>Kp(n).match(`^${t}\\.\\d+`))};function Kp(e){return e.replace(/\]|\[/g,"")}function Qp(e,r){try{var t=e()}catch(n){return r(n)}return t&&t.then?t.then(void 0,r):t}function HE(e,r){for(var t={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!t[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];t[i]={message:a.message,type:a.code}}else t[i]={message:s,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(u){return u.errors.forEach(function(f){return e.push(f)})}),r){var c=t[i].types,d=c&&c[n.code];t[i]=kc(i,r,t,o,d?[].concat(d,n.message):n.message)}e.shift()}return t}function qE(e,r){for(var t={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!t[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];t[i]={message:a.message,type:a.code}}else t[i]={message:s,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(u){return u.forEach(function(f){return e.push(f)})}),r){var c=t[i].types,d=c&&c[n.code];t[i]=kc(i,r,t,o,d?[].concat(d,n.message):n.message)}e.shift()}return t}function ZE(e,r,t){if(t===void 0&&(t={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,s){try{return Promise.resolve(Qp(function(){return Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](n,r)).then(function(i){return s.shouldUseNativeValidation&&Oc({},s),{errors:{},values:t.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:Gp(HE(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(Qp(function(){return Promise.resolve((t.mode==="sync"?kw:Tw)(e,n,r)).then(function(i){return s.shouldUseNativeValidation&&Oc({},s),{errors:{},values:t.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof pc})(i))return{values:{},errors:Gp(qE(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 Jp=/^((1[0-2]|0?[1-9]):[0-5][0-9]\s?([AaPp]\.?[Mm]\.?))|^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/,Xp=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),s=t.replace(/[a-z]/g,""),[i,a]=s.split(":");if(!i||!a)return null;let c=parseInt(i,10);const d=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,c,d);return x.isValid(g)?g:null},GE=gp({UsuarioID:Pi().nullable().optional(),disID:Pi().nullable().optional(),EsOrganizador:zo().default(!1),Correo:vr().email("Formato de correo inválido"),StatusInvitacion:vp(["PENDIENTE","CONFIRMADA","RECHAZADA"]).default("PENDIENTE")}),KE=gp({titulo:vr().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:vr().min(1,"El campo fecha inicio es requerido."),horaInicio:vr().min(1,"La hora de inicio es requerida.").regex(Jp,{message:"Formato inválido (ej: 10:30am o 13:30)"}),horaFin:vr().min(1,"La hora fin es requerida.").regex(Jp,{message:"Formato inválido"}),todoElDia:zo(),fechaFin:vr().optional(),showEndDate:zo().optional(),horaInicio2:vr().optional(),TodoElDia2:zo().optional(),client:vr().nullable().optional(),repetir:vr().optional(),incluirMeet:zo().default(!1),link:vr().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(cE("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:vr().optional(),invitados:mp(GE).optional().default([]),color:vr().optional(),solID:Pi().nullable().optional(),disID:Pi().nullable().optional()}).refine(e=>e.showEndDate?e.fechaFin&&e.fechaFin.length>0:!0,{message:"La fecha de fin es requerida.",path:["fechaFin"]}).refine(e=>e.fechaFin!==void 0?!!e.fechaFin&&!!e.horaInicio2:!0,{message:"La hora de fin son requeridas.",path:["horaInicio2"]}).refine(e=>{if(e.todoElDia||!e.fechaInicio||!e.horaInicio||!e.fechaFin||!e.horaInicio2)return!0;const r=Xp(e.fechaInicio,e.horaInicio),t=Xp(e.fechaFin,e.horaFin);return!r||!t?!1:x.isAfter(t,r)},{message:"",path:["horaFin"]}),QE=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"})),JE="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",XE=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"})))),eh="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",eA=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"})))),tA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cg%20fill='%23404756'%20clip-path='url(%23a)'%3e%3cpath%20d='M13.789%2017H3.21C2.542%2017%202%2017.56%202%2018.25s.542%201.25%201.211%201.25H13.79c.669%200%201.211-.56%201.211-1.25S14.458%2017%2013.789%2017M20.718%204H3.282C2.574%204%202%204.56%202%205.25S2.574%206.5%203.282%206.5h17.436C21.426%206.5%2022%205.94%2022%205.25S21.426%204%2020.718%204M20.718%2010.5H3.282C2.574%2010.5%202%2011.06%202%2011.75S2.574%2013%203.282%2013h17.436c.708%200%201.282-.56%201.282-1.25s-.574-1.25-1.282-1.25'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";var Wo={},th;function rA(){if(th)return Wo;th=1;var e=at();Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.default=void 0;var r=e(pt()),t=ut();return Wo.default=(0,r.default)((0,t.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),Wo}var nA=rA();const rh=it(nA);var Yo={},nh;function oA(){if(nh)return Yo;nh=1;var e=at();Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.default=void 0;var r=e(pt()),t=ut();return Yo.default=(0,r.default)((0,t.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),Yo}var sA=oA();const iA=it(sA),oh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC",sh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",aA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAGFBMVEUAAAAAfFQAflYAfVYAfVUAfFQAcFAAfVbb6xt6AAAAB3RSTlMAIN98m0wQyLlfvgAAAE1JREFUGNNjoAgwmiJxhMoDEBLq5QZIEkUCSBKKeCXYYBJgMQeEBHN5CUIHa3m5A8Io8/ISiAREHRAAJWBSSHYwgyXgUjAJsIGGpPkcAJCLE29yhAT7AAAAAElFTkSuQmCC",cA=e=>{const r=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],t=e.charCodeAt(0)%r.length;return r[t]},lA=(e,r,t,n,o,s)=>{if(r)return l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[l.jsx("img",{src:sh,width:15,style:{marginRight:"5px"}}),l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return l.jsx(m.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return s?l.jsx(m.Button,{onClick:()=>{n(t),o()},variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"}):null;case"CONFIRMADA":return l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[l.jsx("img",{src:aA,width:15,style:{marginRight:"5px"}}),l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Asistiré"})]});default:return null}};function uA({open:e,handleClose:r,guests:t,onReenviar:n,esOrganizador:o}){const s=t.filter(u=>u.estatus==="CONFIRMADA"||u.isHost),i=t.filter(u=>u.estatus==="PENDIENTE"&&!u.isHost),a=t.filter(u=>u.estatus==="RECHAZADA"&&!u.isHost),c=u=>l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[l.jsxs(m.Box,{sx:{position:"relative",mr:2},children:[l.jsx(m.Avatar,{sx:{bgcolor:cA(u.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:u.iniciales}),u.estatus==="PENDIENTE"&&l.jsx(m.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:l.jsx(xc,{sx:{fontSize:14,color:"#546E7A"}})})]}),l.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:u.nombre}),lA(u.estatus,u.isHost,u.usrID,n,r,o)]},u.nombre),d=({title:u,count:f,badgeColor:h})=>l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[l.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:u}),h&&l.jsx(m.Box,{sx:{ml:1,bgcolor:h,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:f})]});return l.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[l.jsxs(m.Box,{sx:{p:"16px 8px"},children:[l.jsx(m.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),l.jsx(m.Button,{onClick:r,startIcon:l.jsx("img",{src:oh,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),l.jsx(m.IconButton,{onClick:r,sx:{position:"absolute",right:8,top:12},children:l.jsx(Cr,{})})]}),l.jsxs(m.DialogContent,{sx:{p:2},children:[i.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{backgroundColor:"black"}}),l.jsxs(m.Box,{sx:{mb:3},children:[l.jsx(d,{title:"Invitados",count:i.length}),i.map(c)]})]}),s.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),l.jsxs(m.Box,{sx:{mb:3},children:[l.jsx(d,{title:"Confirmados",count:s.length,badgeColor:"#1976D2"}),s.map(c)]})]}),a.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),l.jsxs(m.Box,{children:[l.jsx(d,{title:"No asistirán",count:a.length,badgeColor:"#1976D2"}),a.map(c)]})]})]})]})}const dA=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function fA({guests:e,onReenviar:r,esOrganizador:t}){const[n,o]=v.useState(!1),s=()=>o(!0),i=()=>o(!1);return l.jsxs(l.Fragment,{children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[l.jsx(m.AvatarGroup,{max:9,sx:{"& .MuiAvatar-root":{width:32,height:32,fontSize:13,fontWeight:"bold",border:"2px solid #fff",marginLeft:"-8px !important"},"& .MuiBadge-root":{borderRadius:"50%"}},children:e.map((a,c)=>l.jsx(m.Tooltip,{title:a.nombre,arrow:!0,placement:"top",children:l.jsx(m.Box,{children:l.jsx(m.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:a.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:l.jsx(m.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:l.jsx("img",{src:Af})}),children:l.jsx(m.Avatar,{sx:{bgcolor:dA(a.iniciales)},children:a.iniciales})})})},c))}),l.jsx(m.Box,{sx:{flexGrow:1}}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:s,children:[l.jsx(m.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),l.jsx(iA,{sx:{fontSize:18,ml:.5}})]})]}),l.jsx(uA,{open:n,handleClose:i,guests:e,onReenviar:r,esOrganizador:t})]})}var Ho={},ih;function pA(){if(ih)return Ho;ih=1;var e=at();Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.default=void 0;var r=e(pt()),t=ut();return Ho.default=(0,r.default)((0,t.jsx)("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"AddCircleOutline"),Ho}var hA=pA();const mA=it(hA),gA=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),ah=e=>{const[r,t]=e.split(":"),n=parseInt(r),o=n>=12?"pm":"am";return`${n%12||12}:${t} ${o}`},ch=e=>e.split(":").slice(0,2).join(":"),vA=({slot:e,onClick:r})=>l.jsxs(m.Box,{onClick:r,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #000000",textAlign:"center",transition:"0.2s",backgroundColor:"#fff","&:hover":{transform:"translateY(-3px)",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",borderColor:"#1976d2"}},children:[l.jsx(m.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:gA(e.Fecha)})}),l.jsxs(m.Box,{sx:{py:1.5},children:[l.jsx(m.Typography,{sx:{fontSize:"12px"},children:ah(e.HoraInicio)}),l.jsxs(m.Typography,{sx:{fontSize:"12px"},children:["a ",ah(e.HoraFin)]})]})]});function yA({open:e,handleClose:r,suggestions:t,onSelectSlot:n}){const[o,s]=v.useState(16),a=t.slice(0,o).reduce((u,f)=>{const h=f.Fecha;return u[h]||(u[h]=[]),u[h].push(f),u},{}),c=Object.keys(a),d=u=>{const f={...u,HoraInicio:ch(u.HoraInicio),HoraFin:ch(u.HoraFin)};n(f),r()};return v.useEffect(()=>{s(16)},[e]),l.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[l.jsxs(m.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[l.jsx(m.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),l.jsx(m.Box,{children:l.jsx(m.Button,{startIcon:l.jsx("img",{src:oh,width:20}),onClick:r,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"1rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),l.jsx(m.Divider,{sx:{backgroundColor:"black"}}),l.jsx(m.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:c.length===0?l.jsx(m.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):l.jsxs(l.Fragment,{children:[c.map((u,f)=>l.jsxs(v.Fragment,{children:[" ",l.jsxs(m.Box,{sx:{mb:3},children:[l.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&&l.jsx("img",{src:sh,width:15,style:{marginLeft:5}})]}),l.jsx(m.Grid,{container:!0,spacing:2,children:a[u].map((h,g)=>l.jsx(m.Grid,{item:!0,xs:6,sm:3,children:l.jsx(vA,{slot:h,onClick:()=>d(h)})},`${u}-${g}`))})]}),f===0&&c.length>1&&l.jsx(m.Divider,{sx:{mb:4,mt:1,borderBottomWidth:2,backgroundColor:"#000000"}})]},u)),t.length>o&&l.jsx(m.Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:l.jsx(m.Button,{onClick:()=>s(u=>u+12),startIcon:l.jsx(mA,{}),sx:{textTransform:"none",fontWeight:"bold",color:"#1976d2","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Mostrar más horarios disponibles"})})]})})]})}const bA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",xA=e=>{const r=["brown","purple","orange","blue","green","yellow","red","grey"],t=e.charCodeAt(0)%r.length;return r[t]};function wA({onSelectGuest:e,availableSuggestions:r,onInputTextChange:t}){const[n,o]=v.useState(null),[s,i]=v.useState(""),a=(d,u)=>{u?(e(u),o(null),i("")):(o(null),i(""))},c=(d,u)=>{i(u),t(u)};return l.jsx(m.Autocomplete,{options:r,value:n,inputValue:s,getOptionLabel:d=>d.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(d,u)=>d.correo===u.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:d=>l.jsx(m.TextField,{...d,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...d.InputProps,startAdornment:l.jsx(m.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:l.jsx("img",{src:bA,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(d,u)=>v.createElement(m.Box,{component:"li",...d,key:u.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},l.jsx(m.Avatar,{sx:{bgcolor:xA(u.iniciales),mr:2,width:32,height:32,fontSize:14},children:u.iniciales}),l.jsx(m.Typography,{children:u.nombre}))},"guest-autocomplete-field")}var qo={},lh;function _A(){if(lh)return qo;lh=1;var e=at();Object.defineProperty(qo,"__esModule",{value:!0}),qo.default=void 0;var r=e(pt()),t=ut();return qo.default=(0,r.default)((0,t.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline"),qo}var SA=_A();const CA=it(SA);var Zo={},uh;function EA(){if(uh)return Zo;uh=1;var e=at();Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.default=void 0;var r=e(pt()),t=ut();return Zo.default=(0,r.default)((0,t.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline"),Zo}var AA=EA();const jc=it(AA),DA=e=>e.tieneConflicto?{icon:l.jsx(jc,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:l.jsx(CA,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},kA=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function TA({guests:e,conflictCount:r,onViewSuggestions:t,onDeleteGuest:n}){const o=i=>a=>{a.stopPropagation(),n(i)},s=i=>i?i.trim().split(/\s+/).slice(0,2).join(" "):"";return l.jsxs(m.Box,{sx:{p:1},children:[l.jsx(m.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((i,a)=>{const c=DA(i),d=kA(i.iniciales),u=i.email||i.correo||i.nombre;return l.jsx(m.Chip,{label:l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[l.jsx(m.Tooltip,{title:u,arrow:!0,placement:"top",children:l.jsx(m.Typography,{variant:"body2",sx:{color:c.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:s(i?.nombre)})}),l.jsx(m.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:c.icon})]}),avatar:l.jsx(m.Avatar,{sx:{bgcolor:d,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"}}},onDelete:o(i.nombre)},a)})}),r>0&&l.jsxs(m.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[l.jsx(jc,{sx:{mr:1,fontSize:22}}),l.jsxs(m.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",l.jsxs("strong",{children:[r," invitado"]}),r!==1?"s":""]})]}),l.jsx(m.Link,{component:"button",type:"button",variant:"body2",onClick:i=>{i.preventDefault(),i.stopPropagation(),t()},sx:{ml:4,textAlign:"left",textDecoration:"underline",fontWeight:700,fontSize:"15px",color:"#1976D2",border:"none",background:"none",padding:0,cursor:"pointer","&:hover":{color:"#1565C0"}},children:"Ver sugerencias de horario"})]})]})}function MA(e,r){const[t,n]=v.useState(e);return v.useEffect(()=>{const o=setTimeout(()=>{n(e)},r);return()=>{clearTimeout(o)}},[e,r]),t}var Go={},dh;function IA(){if(dh)return Go;dh=1;var e=at();Object.defineProperty(Go,"__esModule",{value:!0}),Go.default=void 0;var r=e(pt()),t=ut();return Go.default=(0,r.default)((0,t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search"),Go}var OA=IA();const jA=it(OA),PA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAgCAYAAACYTcH3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAMwSURBVFhH7ZZdSFRpGMd/1TrIHNZxglqYymLaDdmLscWBOBIzEUowN97owvZBElKbWLM4smNUSESkhG3SbvQh7S5rX4xI3sxFSWBEXqREc2FaroTuDrUik8YRG7G6aEbnPDPnDEFsXfiDF+Z9/s8Zfry873vOkslXr9/ymbBUFj4lizJGLMoYsShjRFaZ+LMemoK11B7pIKLJ9OOyxOzS0wavcaQxzMhcopBXQsPZ/ahzA4Su3ufFG/EAQO4KXN4teNbbZJIVQ5k0kSQJoeLxDoLBrvQ8gd3r57cDbhQZmJBRxlAkSVJoLMzFO1F9FntKz8MocayUHb1AbZE+NiNdZqKbYM2fDBqJJMkr5fil3biWyQB6z+yi6R4opYe4+uO3MjYkbQNHOkNCxIpT9aKut6YWYaqbK7cm9bUEqloCgNb7gIgMTRAyUYYeT+tLBT4CgWoaDlXhWWXFkhINDj1NmaVQtJHiZYB2n5sdvdy9N8CLWdmUTtrK6FhXzi/N5awGyFcJtDbyfYFsykCuG9UFME3/9XO0nDnJ3mPdxGSf4AtZWMBB5cEKnDlRbp9o5cqohj1f4Z9R2ddHS0Urd2VZMhMnLmsCk5Wxsjwv+XsWbWKSkb+jWf8wE05fDc0/+/hKBgITmWHCncNoOCg7fJpQezOBrQ7dnjHCkmfDnp8zP5+1rqVwpa4lIyYyMBY+RpW/jZuPxonnOvDUNHN0mzhVKSheP6EbfxG6/Ct/tNXgSdTHnou7yABTGYD4vz38fryOHaf6iAMu10bZMk/hd0VYkvfOjMaHvspMZZzbfmCnz4uquin3fIMFiI3/J9vm6T+7j6p9te9HdRv9siELJjIOist8VO6ppiHgZ+cmG/FnYU53DsvGBeZmiU1Mvh8zMsyOiUyUUP0uKuu7GAEY7aCu/hqRKdn38RDvpiihuiDt4i6xb3CzZqqPyHN9nc1+un4qQns5rT/yfZeoOv9I9LlTOzIiVkZByXBYYk8yiACKYgVyUPJt2FPHlx/y4bCAkLHh27ub4pULd4QRloJSGrYbvJFXr6UwNznJwfm1Q58bkP4J8Qkx2cD/P4syRnxWMu8A780N97kmJqMAAAAASUVORK5CYII=",RA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAbCAYAAABr/T8RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAP4SURBVEhLxZZdSJtXGMd/XZYgCUYdJErmZpc668Qtg2QXcaO2UBFCIUESpO0KWpCWaS/W2SrMKm1F6srcZA66TlzH3KRL6QeygCiIZZus0wtlqOuqa+oHflxYLSmtEraL9zV5c/JGLYzud3XO8z/v+eecPOc8Z8fKo6f/8D/wghh4Xux4lhWvra4w8/cYM4+AZAtvvmYhzagVh22LrY0fBum9fgV/7z0W1kUR0JrILXJzrKQQa6ooJiaxcXiF0asXOX89yJqoqaLFWlJNfWkeaRpRi0fdOHSPznNN+CflJSZZcHo8eN6zYc3QowNgndB8kOGff+LHm0NMP5GG6na5OV/vJdegmE+FeOPwHP6aGjrvs/1ViLuz08uXzW4yN/kmLqtHO87Kpnrslc18dmgLUwBNCm8daqSt0oYB4P41TneMiaNiiDWevcXlnscAvOJtoH6fKUbeivR91XzitQAQ6vkW/6w4IkqM8Wh3gGkAs4uTPmmCZyXT9wEeM8AcN7oTrzpqHB6it19arcHxDlaV7V2bH6StpoqyY1WU1bRze17lfGmyyM2RmqH+AQbD4gCJaHJNdlFWE2AZQGPC6XNTkCHlLwCLd+i4OsSyciJNCs7SwxSYo6Gn83fw+4dYCAOk4Gluo3yX4huZqPFgK+5Ph0RdQI+9opHa4lSWe1r58OsRQuIQAedH31HrFKOKrZ6ZnYtVVHmbomITOrSkF+/FLsoqJJo3Ypz58kYymSg61cKV9jYuN1VT7somPXId/8XohPS/hn77neGNsNaCveQg9U3yd6cKSZel6LyxvBhpJadiAELoycwykZYKpNrw5NjwHAnirztL5+QSgbqj9Bm1rK1KP8CQf5DGj11YlbUiyyKdZ/SkJSviCqJZnb2TXACCjI4L2arNwtdUjcsodTdMMbtoPCOYAmvjY0wB8DrW7Fhtg6hxUgF7HVJzuLdXym4lmjzKj9hiQvZSr8qxm+NW94jUdLxLYZKoSyguEC17DuyXtuhuF1/IZ1qJ7o08rJFeNg5bfC0O9f9A5wMAPa4DTrmgxBN7Zeb7OOHUAzB8qYlvJgTzDDOZkY5ZygMFoYku6i5JqzU4K3g/P1ZXIhQJPc7jFewxAuEgNxtOc6FvaRv1eJ2FvlYqGwJMhQFjASeOO+QEUye+LAIsDnCutp3hVamrM2ez3+Wj0PQrLRcHWADAgutMBc7pX/g+MMDEopxwRhtVF6opUtxmaqgbIz0G/C2f0zmyIioJSbN5qT3p3vIRwKbGMst/BPiq4xqDD1QKgozuVQeHj5bhyU8RpYRsaRzhyWOm/hxhZmmR8bsPeSknh3STBfvuLAwJjsxmbN/4Pybu6fO8+BfHjFz+tNVn6wAAAABJRU5ErkJggg==",NA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAXCAYAAAAcP/9qAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJJSURBVEhL5ZVPSJNhHMc/NuZBo7VkLCJT1ogRoYm7TF7oMi+7uMMGMwixQ1EYLfpDRiSkkIJm0i7rZNQhyMvoVhcVcYcMDKKQYGzNoiG19y0Uaow6vHPvu2dr72CUhz6n5/k+3/f98vs9z/O+Dcr3H7/YAXaJwr/i/wtuMN7jHJmlGNFn8yRkca2c3bbjeENB/Mcs4lIJBsFbxO9fY3xBERcMcYQmmA4cEOUi1YOTc5y5EiMDWI+4cR9sFh1lfF1b5tXHHOBkMDqCv0V0qFQNTjwa4lJMgRYf09F+HKKhEvm3RE7f4cUmtIYmiPyh6iqHK8XCktpiq9RTWyiA6SjdXeowvfySdXG9QHlwbousrJB9PU/8C0ATnq420VUVj6dHHXxYJZ5UyMpb/MyXeoRWp3g8dJOnn3WOZi+jDwfo0EmG5FeYOjnDoj7MNcDsmBdrYSoErzAVmGFRE8Bkxrq3Sa/UxKasCFX2cH3uHJ7CTAjOkXgyye3n78l+y2lynTTuseDqu8Fon3bQhD024wgNM+azlcp1YveVhlIerJJe/1QYWei9fJfZyAi3wv34Dldvub2zj8HweUYnIzy44Gb71mvv06gYrNGM/ZAN634n3ZKPs8NBXKKlSCfBqwH8koeOdgt2Zzv7RIsOg2CZd29S6vWSFTJrSbKipcgGibWNojexskpatOio+OWK3zvF+JKo1oF0kVjYXSIZVPz32LHg2lpdoVXVqOX5Hau4YnCrs43G7YnJQq/UWWowoFs6gdW0PTPjcJb/Gn8DgFjOhT2aaY4AAAAASUVORK5CYII=",zA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAXCAYAAAD+4+QTAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJrSURBVEhLxZVLSFRRGIA/tRGZC02XiEAdCRUXIW2apTSbHtimTQPZgzFSgkpULCyZEEqUIWkWNplopDC0aeNA6qIhEypJciGIuUnKRDAZrpPcS3obbHGd8T7GV4P07c45//m/c/5z7rkZseWVNfaYTHPHXvAfJfIUr5728WbWPKBHYfp1H13D8+YBC6klkyOE3kYIj22VYIqB3giDz8KMm4dMZCQP/udnQt39RGaXQFWQfqmQ40AUzFMSqMhRhVVsCAftZOccwnXKw6Xyo4hZxkhNEo3QeKOP6bhxcLcIrioCd9wcNkkyARbev0tbILpr6b5rFZCQqKpq7t8VheeaCda4EAB+K0iyMV/qg98xdo5d8xO4UowAyJ86qfRep9J7iwfDi8moNCR2jt9s4WF5LgDSaCfVjz4ixQEUxoM+uia1yH36ac4Lfp6c1ybthoXhduqDE8iGXoWZHzEodaSzE43UAsguqqDmtAPSKxfMDbWlFAilXgKtZ8lfv2n/LJkL+6h/PmUVuKoI3D+ZFGA+k62Qv40Q6hlkdFGGuIK0ZL32QlktwRqX5Yvf0U7mhtqovt3D4PQ8UjS2qaC7zipgR5JohI5ea1n0iG5NsNkzt61EGvuQfHLEkmIKD9iMAUUV+BNf+yZsK5FlBdZXG2xtJtDTgidPF6CqWItnxCj5Y2gBkO88gvPMvY23KQ7o616QR76umYqM2PLK2upIO56OCbDZEfdr5RBLPDTUubUEiaTxefqbfLz4mlh7Lp7Hfi4XJNKlJhMgu+wiV4ts2s8qGkOKxpgZfcnAF51A/U6osXFDkOXgREPTtgKAv71g3h2chXDUAAAAAElFTkSuQmCC",LA=({open:e,onClose:r,clientOptions:t,isClientsLoading:n,setClientSearchTerm:o,onSelectClient:s,setFiltroPadre:i})=>{const[a,c]=v.useState("COT"),d=f=>{c(f),i(f)},u=[{id:"COT",label:"Nuevo",icon:NA},{id:"SEMI",label:"Seminuevo",icon:PA},{id:"PM",label:"Prueba de manejo",icon:RA},{id:"SER",label:"Cita de servicio",icon:zA}];return l.jsx(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"12px",maxHeight:"85vh",position:"relative"}},children:l.jsxs(m.DialogContent,{sx:{p:0,display:"flex",flexDirection:"column"},children:[l.jsxs(m.Box,{sx:{p:2,pb:1},children:[l.jsx(m.Typography,{variant:"h6",fontWeight:"bold",sx:{mb:1,fontSize:"1.1rem"},children:"Vincular cliente"}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",mb:2,width:"fit-content","&:hover":{opacity:.7}},onClick:r,children:[l.jsx(Su,{sx:{color:"#666",ml:-1}}),l.jsx(m.Typography,{variant:"body2",color:"text.secondary",fontWeight:"500",children:"Volver al evento"})]}),l.jsx(m.TextField,{fullWidth:!0,placeholder:"Buscar cliente, correo electrónico, teléfono...",size:"small",onChange:f=>o(f.target.value),InputProps:{startAdornment:l.jsx(m.InputAdornment,{position:"start",children:l.jsx(jA,{sx:{color:"#999"}})}),endAdornment:n&&l.jsx(m.InputAdornment,{position:"end",children:l.jsx(m.CircularProgress,{size:20,color:"inherit"})}),sx:{borderRadius:"8px",backgroundColor:"#f5f5f5","& fieldset":{border:"none"}}}}),l.jsx(m.Box,{sx:{display:"flex",gap:1,mt:2,pb:1,overflowX:"auto",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:u.map(f=>{const h=a===f.id;return l.jsx(m.Chip,{label:f.label,icon:l.jsx("img",{src:f.icon,alt:f.label,style:{width:"20px",height:"20px",borderRadius:"50%",objectFit:"cover"}}),onClick:()=>d(String(f.id)),sx:{borderRadius:"16px",fontSize:"13px",transition:"all 0.2s",backgroundColor:h?"#1976d2":"#f0f2f5",color:h?"#fff !important":"#5f6368",fontWeight:h?"bold":"normal",border:"none","&:hover":{backgroundColor:h?"#1565c0":"#e0e2e5"},"& .MuiChip-icon":{color:h?"#fff":"inherit"}}},f.id)})})]}),l.jsxs(m.Box,{sx:{flexGrow:1,overflowY:"auto",minHeight:"300px"},children:[t.map((f,h)=>l.jsxs(m.Box,{onClick:()=>{s(f,a),r()},sx:{p:"14px 20px",borderTop:"1px solid #f0f0f0",cursor:"pointer",transition:"background-color 0.2s","&:hover":{backgroundColor:"#f9f9f9"},"&:active":{backgroundColor:"#f0f0f0"}},children:[l.jsx(m.Typography,{fontWeight:"600",sx:{fontSize:"14px",color:"#333"},children:f.nombreCliente||"Sin nombre registrado"}),l.jsxs(m.Typography,{variant:"body2",sx:{fontSize:"12px",color:"#666",mt:.5},children:[f.email||"Sin correo"," • ",f.tel||"Sin teléfono"]})]},f.clienteID||h)),!n&&t.length===0&&l.jsx(m.Box,{sx:{p:4,textAlign:"center"},children:l.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"No se encontraron resultados para tu búsqueda."})})]})]})})},$A={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"},fh=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],BA=()=>{const e=[];for(let r=0;r<24;r++)for(let t=0;t<60;t+=15){const n=new Date;n.setHours(r,t),e.push(x.format(n,"h:mmaaaa"))}return e},ph=[],Fi=BA(),an=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),s=t.replace(/[a-z]/g,""),[i,a]=s.split(":");if(!i||!a)return null;let c=parseInt(i,10);const d=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,c,d);return x.isValid(g)?g:null},FA=({isVisible:e,onClose:r,onSave:t,onDelete:n,selectedDate:o,initialEvent:s,userId:i,masNombreBD:a,disId:c,gmail:d,onReenviar:u,onNavigate:f})=>{const[h,g]=v.useState(!1),[y,p]=v.useState(!1),b=x.format(new Date,"yyyy-MM-dd"),[_,C]=v.useState(""),[E,S]=v.useState([]),[w,B]=v.useState(!1),A=bc(),[T,I]=v.useState(""),[M,W]=v.useState(ph),[Z,V]=v.useState(!1),[H,te]=v.useState(""),[Y,N]=v.useState(!1),[ie,de]=v.useState([]),[z,Q]=v.useState(!1),[Ee,xe]=v.useState(null),_e=(U,fe)=>{console.log("client",U),xe(U),De("client",U.nombreCliente||""),De("solID",null),Q(!1)},[oe,ae]=v.useState([]),re=MA(H,300),Se=M.filter(U=>U.tieneConflicto).length,[Ce,me]=v.useState(!1),[ze,R]=v.useState("COT"),{control:Le,handleSubmit:Ge,reset:Ze,formState:{errors:Ie,isValid:st},watch:$e,setValue:De}=qp({resolver:ZE(KE),defaultValues:{titulo:s?.titulo||"",fechaInicio:x.format(new Date,"yyyy-MM-dd"),horaInicio:x.format(new Date,"h:mmaaaa"),horaFin:x.format(x.addHours(new Date,1),"h:mmaaaa"),todoElDia:!1,client:s?.client||null,repetir:"No repetir",link:s?.link||"",descripcion:s?.descripcion||"",solID:s?.solID??null,invitados:[],incluirMeet:!1},mode:"onChange"}),D=$e("fechaInicio"),O=$e("fechaFin"),F=$e("todoElDia");v.useEffect(()=>{if(_.trim()===""||!i||!c||!a){S([]),De("solID",null),B(!1),I("");return}B(!0);const U=setTimeout(()=>{A.getClients(_,c,a,i,ze).then(fe=>{B(!1);const le=Array.from(new Map(fe.map(ue=>[ue.nombreCliente,ue])).values());if(console.log("uniqueClients",le),le.length>0)S(le),I("");else if(s?.client&&s.solID!==null){const ue=[{solID:s.solID,nombreCliente:s.client}];S(ue),I("Sin resultados")}else S([]),I("Sin resultados")}).catch(fe=>{console.error("Error al buscar clientes:",fe),B(!1)})},500);return()=>clearTimeout(U)},[_,i,c,a,ze]),v.useEffect(()=>{if(s){const U=s?.solicitudRelacionada&&s?.solicitudRelacionada[0];if(U){const fe={nombreCliente:s?.client||"",tel:U.tel||"",email:U.email||"",marca:U.marca||"",modelo:U.modelo||"",solID:Number(U.solID)};xe(fe),S([fe]),De("client",U.nombreCliente),De("solID",U?.solID)}}},[s]),v.useEffect(()=>{if(D&&O){const U=new Date(D),fe=new Date(O);(U===fe||U>fe)&&De("fechaFin",D)}},[D,O,De]),v.useEffect(()=>{D&&De("fechaFin",D)},[D]),v.useEffect(()=>{De("showEndDate",h)},[h,De]),v.useEffect(()=>{if(console.log("initialEvent",s),s){const U=x.format(s.fechaInicio,"yyyy-MM-dd")===x.format(s.fechaFin,"yyyy-MM-dd");if(g(!U),De("titulo",s?.titulo),De("fechaInicio",x.format(s.fechaInicio,"yyyy-MM-dd")),De("fechaFin",x.format(s.fechaFin,"yyyy-MM-dd")),De("horaInicio",x.format(s.fechaInicio,"h:mmaaaa")),De("horaFin",x.format(s.fechaFin,"h:mmaaaa")),De("horaInicio2",x.format(s.fechaFin,"h:mmaaaa")),De("descripcion",s.descripcion),De("link",s.link),De("repetir","false"),De("color",s.color),De("todoElDia",s.todoElDia),De("solID",s.solID),De("client",s.client),s.invitados&&s.invitados.length>0){const fe=(s?.invitados||[]).map(ue=>{const Pe=ue.usrNombre?.trim()||"",Ve=Pe.split(/\s+/),vt=Ve.length>1?(Ve[0][0]+Ve[1][0]).toUpperCase():Pe.substring(0,2).toUpperCase();return{nombre:ue.usrNombre||"Sin nombre",correo:ue.correo||"",iniciales:vt||"--",usrID:ue.usuarioID??null,isHost:ue.esOrganizador||!1,estatus:ue.statusInvitacion,tieneConflicto:!1,disID:ue.disID}}),le={nombre:s?.nombreAnfitrion?s?.nombreAnfitrion:"Anfitrion",correo:"",iniciales:(s?.nombreAnfitrion?s?.nombreAnfitrion:"Anfitrion").substring(0,2).toUpperCase(),usrID:i??0,isHost:!0,estatus:"CONFIRMADA",tieneConflicto:!1};W([le,...fe])}else W(ph);s.solID?p(!0):p(!1)}else{const U=o||new Date,fe=new Date,le=new Date(U.getFullYear(),U.getMonth(),U.getDate(),fe.getHours(),fe.getMinutes()),ue=x.addHours(le,1);console.log("defaultEndTime",ue),Ze({titulo:"",fechaInicio:x.format(le,"yyyy-MM-dd"),fechaFin:x.format(ue,"yyyy-MM-dd"),horaFin:x.format(ue,"h:mmaaaa"),horaInicio:x.format(le,"h:mmaaaa"),horaInicio2:x.format(ue,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:fh[0],solID:null}),g(!1),p(!1)}},[s,e,o]);const ce=U=>({UsuarioID:U.usrID??null,Correo:U.correo,EsOrganizador:U.usrID==i,StatusInvitacion:U.estatus,disID:c??null}),ne=Ge(U=>{const fe=M.map(ue=>ce(ue)),le={...U,invitados:fe};t(le,s?.eventoID),r(),Ze(),g(!1)},U=>{console.log("Errores de validación:",U)});v.useEffect(()=>{F&&(De("horaInicio","00:00"),De("horaFin","23:59"))},[F,De,$e]);const j=()=>{const U=$e("fechaInicio");if(U){const fe=new Date(`${U}T00:00:00`),le=x.addDays(fe,1);De("fechaFin",x.format(le,"yyyy-MM-dd"))}g(!0)},G=$e("fechaInicio"),pe=$e("horaInicio"),Oe=$e("fechaFin"),P=$e("horaFin"),[X,we]=v.useState(null),[qe,St]=v.useState(null);v.useEffect(()=>{(X===null||X!==pe)&&we(pe)},[pe,X]),v.useEffect(()=>{(qe===null||qe!==P)&&St(P??"")},[P,qe]);const gt=$e("todoElDia");v.useEffect(()=>{if(gt||!pe||!P||!G||!Oe)return;const U=an(G,pe),fe=an(Oe,P);if(!U||!fe||!x.isValid(U)||!x.isValid(fe))return;const le=x.isSameDay(U,fe),ue=le&&(x.isAfter(U,fe)||U.getTime()===fe.getTime()),Pe=x.isBefore(fe,U)&&!le;(ue||Pe)&&(De("horaFin",""),St(""))},[pe,G]);const Kt=v.useMemo(()=>{if(!pe||!G)return Fi;const U=an(G,pe);return U?Fi.map(fe=>{const le=an(Oe||G,fe);if(le&&x.isAfter(le,U)){const ue=(le.getTime()-U.getTime())/6e4,Pe=Math.floor(ue/60),Ve=ue%60,vt=Pe>0?`${Pe} h${Ve>0?` ${Ve} min`:""}`:`${Ve} min`;return{value:fe,label:`${fe} (${vt})`}}return fe}).filter(fe=>{const le=typeof fe=="string"?fe:fe.value,ue=an(Oe||G,le);return ue?x.isAfter(ue,U):!1}):Fi},[pe,G,Oe]),Ht=v.useMemo(()=>Fi,[]);v.useEffect(()=>{if(!s&&pe&&G){const U=an(G,pe);if(U){const fe=x.addMinutes(U,15),le=pe.toLowerCase(),ue=le.includes("pm")||le.includes("p.m."),Pe=le.includes(".");let Ve=x.format(fe,"h:mm"),vt=ue?"pm":"am";Pe&&(vt=ue?"p.m.":"a.m.");const or=`${Ve}${vt}`,Mr=(P||"").toLowerCase();(P!==or||ue&&(Mr.includes("am")||Mr.includes("a.m.")))&&De("horaFin",or,{shouldValidate:!0})}}},[pe,De,G]);const Tr=async U=>{const fe=$e("fechaInicio"),le=$e("horaInicio"),ue=$e("horaFin");if(console.log("currentGuests",U),!c||!fe||!le||!ue||U.length===0)return;const Pe=await Promise.all(U.map(async Ve=>{if(Ve.isHost||!Ve.correo)return Ve;try{const vt=await A.VerificarConflicto(c,Ve.correo,fe,le+":00",ue+":00"),or=Array.isArray(vt)?vt[0]:vt;if(console.log("conflictResult",vt),or){const Mr=await A.getDisponibilidadUsuario(c,Ve.correo,fe,"60");de(Mr)}return{...Ve,tieneConflicto:String(or.tieneConflicto).toLowerCase()==="true"}}catch{return{...Ve,tieneConflicto:!1}}}));W(Pe)};v.useEffect(()=>{M.filter(fe=>!fe.isHost).length>0&&G&&pe&&P&&Tr(M)},[G,pe,P]);const It=async U=>{if(M.some(Ve=>Ve.correo===U.correo))return;N(!0);const le=$e("fechaInicio"),ue=$e("horaInicio"),Pe=$e("horaFin");if(!c||!U.correo||!le||!ue||!Pe){W(Ve=>[...Ve,{...U,estatus:"PENDIENTE",isHost:!1,tieneConflicto:!1}]);return}try{const Ve=await A.VerificarConflicto(c,U.correo,le,ue+":00",Pe+":00"),vt=Array.isArray(Ve)?Ve[0]:Ve,or=String(vt?.tieneConflicto).toLowerCase()==="true",Mr={...U,estatus:"PENDIENTE",isHost:!1,tieneConflicto:or};if(or){const Kr=await A.getDisponibilidadUsuario(c,U.correo,le,"60");de(Kr)}W(Kr=>[...Kr,Mr])}catch(Ve){console.error("Error al verificar conflicto:",Ve),W(vt=>[...vt,{...U,tieneConflicto:!1,isHost:!1}])}},se=U=>{W(fe=>fe.filter(le=>le.nombre!==U))},Ae=()=>{V(!1)},je=U=>{const ue=(U.usrNombre??"").split(" ").map(Pe=>Pe.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:U.usrNombre??"",correo:U.usrMail??"",iniciales:ue,usrID:U.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};v.useEffect(()=>{console.log("debouncedSearchText.length",re.length),re.length>2&&c?(async()=>{const fe=await A.getUsuariosInvitados(c,re),le=fe.map(je).filter(ue=>ue.usrID!==i&&!M.some(Pe=>Pe.correo===ue.correo));console.log("sugerencias",fe),ae(le)})():ae([])},[re,M]);const Re=U=>{te(U)},yr=U=>{const{Fecha:fe,HoraInicio:le,HoraFin:ue}=U,Pe=Ve=>Ve.split(":").slice(0,2).join(":");De("fechaInicio",fe),De("fechaFin",fe),De("horaInicio",Pe(le)),De("horaFin",Pe(ue)),g(!1),Ae()},ur=async()=>{const U=$e(),fe=an(U.fechaInicio,U.horaInicio),le=an(U.fechaFin||U.fechaInicio,U.horaFin);if(!fe||!le)return;if(!c||!d){console.error("Faltan datos requeridos (disId, userMail o calendarId)");return}me(!0);const ue={summary:U.titulo||"Sin título",description:U.descripcion||"",start:{dateTime:x.format(fe,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"},end:{dateTime:x.format(le,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"}};try{const Pe=await A.insertarEventoGoogle(c,d,!0,ue);Pe?.hangoutLink&&(De("link",Pe.hangoutLink),De("incluirMeet",!1))}catch(Pe){console.error("Error al generar Meet",Pe)}finally{me(!1)}};return l.jsx(l.Fragment,{children:l.jsx(m.Modal,{open:e,onClose:r,children:l.jsxs("form",{onSubmit:ne,children:[l.jsxs(m.Box,{sx:$A,children:[l.jsx(m.IconButton,{"aria-label":"close",onClick:r,sx:{position:"absolute",right:8,top:12},children:l.jsx(Cr,{})}),l.jsx(m.Typography,{variant:"h6",mb:2,children:s?.isGoogleEvent||s?.isOutlookEvent?l.jsx(l.Fragment,{children:s?.titulo||"Evento de Google"}):!s&&"Agregar evento"}),l.jsx(m.Typography,{style:{fontSize:18,fontWeight:600},mb:2,children:s?.client&&s?.solicitudRelacionada?.[0]?l.jsxs(l.Fragment,{children:["Evento para el cliente:"," ",l.jsx(m.Link,{component:"button",variant:"inherit",type:"button",onClick:()=>{const U=s?.solicitudRelacionada?.[0];if(U&&U.tipoSol){const fe=U?.tipoSol,ue={COT:{url:"/netcar/cotizaciones/",pag:10,tipo:"COT"},SEMI:{url:"/netcar/seminuevos/",pag:12,tipo:"SEMI"},SER:{url:"/netcar/servicio/",pag:14,tipo:"SER"},PM:{url:"/netcar/pruebademanejo/",pag:16,tipo:"PM"}}[fe];ue&&f(`${ue.url}${U?.solID}`,{replace:!0,state:{tipoSOL:ue.tipo,pag:ue.pag,modulo:"Consulta"}})}},sx:{color:"#1976d2",cursor:"pointer",fontWeight:700,textDecoration:"underline",verticalAlign:"baseline",p:0,border:"none",backgroundColor:"transparent",fontSize:"14px"},children:`${s.client} / ${s.solicitudRelacionada[0].marca} ${s.solicitudRelacionada[0].modelo}`})]}):"Editar Evento"}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(Ar,{name:"titulo",control:Le,render:({field:U})=>l.jsx(m.TextField,{...U,label:"Título",fullWidth:!0,variant:"outlined",multiline:!0,maxRows:4,size:"small",error:!!Ie.titulo,helperText:Ie.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"}}})})})}),l.jsxs("div",{className:`row g-2 ${h?"mb-1":"mb-2"}`,children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(Ar,{name:"fechaInicio",control:Le,render:({field:U})=>l.jsx(m.TextField,{fullWidth:!0,...U,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!Ie.fechaInicio,helperText:Ie.fechaInicio?.message})})}),h?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-10 col-md-4",children:l.jsx(Ar,{name:"fechaFin",control:Le,render:({field:U})=>l.jsx(m.TextField,{...U,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:D||b},error:!!Ie.fechaFin,helperText:Ie.fechaFin?.message})})}),!s&&l.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:l.jsx(m.IconButton,{onClick:()=>g(!1),sx:{fontSize:18},children:l.jsx(QE,{})})})]}):l.jsx("div",{className:"col-md-8"})]}),h&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12 d-flex justify-content-center",children:l.jsx(rh,{sx:{color:"#757575",my:1}})})}),l.jsxs("div",{className:"row g-2 mb-2",children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(Ar,{name:"horaInicio",control:Le,render:({field:{onChange:U,value:fe,...le}})=>l.jsx(m.Autocomplete,{freeSolo:!0,options:Ht,value:fe||"",getOptionLabel:ue=>typeof ue=="string"?ue:ue.value,onChange:(ue,Pe)=>{const Ve=typeof Pe=="string"?Pe:Pe?.value;if(Ve){const vt=Ve.split(" (")[0].trim();U(vt)}else U("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},onInputChange:(ue,Pe)=>U(Pe),renderInput:ue=>l.jsx(m.TextField,{...ue,...le,size:"small",error:!!Ie.horaInicio,helperText:Ie.horaInicio?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...ue.InputProps}}),popupIcon:l.jsx(xc,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:gt})})}),!h&&l.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:Ie.horaInicio?"5px":"0px"},children:l.jsx(rh,{sx:{color:"#757575"}})}),h&&l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(Ar,{name:"horaFin",control:Le,render:({field:{onChange:U,value:fe,...le}})=>l.jsx(m.Autocomplete,{freeSolo:!0,options:Kt,getOptionLabel:ue=>typeof ue=="string"?ue:ue.value,value:fe||"",onChange:(ue,Pe)=>{const Ve=typeof Pe=="string"?Pe:Pe?.value;if(Ve){const vt=Ve.split(" (")[0].trim();U(vt)}else U("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},renderOption:(ue,Pe)=>v.createElement(m.Box,{component:"li",...ue,key:typeof Pe=="string"?Pe:Pe.value},l.jsx(m.Typography,{children:typeof Pe=="string"?Pe:Pe.label})),onInputChange:(ue,Pe)=>U(Pe),renderInput:ue=>l.jsx(m.TextField,{...ue,...le,size:"small",error:!!Ie.horaFin,helperText:Ie.horaFin?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...ue.InputProps}}),popupIcon:l.jsx(xc,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:gt})})}),!h&&l.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:l.jsx(Ar,{name:"todoElDia",control:Le,render:({field:U})=>l.jsx(m.FormControlLabel,{control:l.jsx(m.Checkbox,{checked:U.value,onChange:fe=>U.onChange(fe.target.checked)}),label:l.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&!h&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(m.Button,{onClick:j,size:"small",sx:{textTransform:"none",fontSize:16},children:[l.jsx(eA,{}),"  Agregar fecha final"]})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(Ar,{name:"link",control:Le,render:({field:U})=>l.jsx(m.TextField,{...U,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!Ie.link,helperText:Ie.link?.message,InputProps:{startAdornment:l.jsx("img",{src:JE,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(Ar,{name:"descripcion",control:Le,render:({field:U})=>l.jsx(m.TextField,{...U,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:l.jsx("img",{src:tA,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),s?.solicitudRelacionada===null&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(wA,{onSelectGuest:It,availableSuggestions:oe,onInputTextChange:Re})})}),(Y||Se>0)&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(TA,{guests:M,conflictCount:Se,onViewSuggestions:()=>V(!0),onDeleteGuest:se})})}),s?.invitados&&s?.invitados?.length>0&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(m.Box,{children:l.jsx(fA,{guests:M,onReenviar:u,esOrganizador:s?.esOrganizador})})})}),l.jsx(yA,{open:Z,handleClose:Ae,suggestions:ie,onSelectSlot:yr})]}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1,px:0},children:[l.jsx(m.Box,{sx:{minWidth:40,display:"flex",justifyContent:"flex-start"},children:l.jsx("img",{src:"https://fonts.gstatic.com/s/i/productlogos/meet_2020q4/v1/web-512dp/logo_meet_2020q4_color_2x_web_512dp.png",alt:"Meet",style:{width:22,height:22}})}),l.jsx(m.Box,{sx:{flex:1},children:!$e("link")&&!$e("incluirMeet")?l.jsx(m.Button,{fullWidth:!0,disabled:Ce||!c||!d,onClick:ur,sx:{justifyContent:"flex-start",textTransform:"none",bgcolor:"#f1f3f4",color:"#3c4043","&:hover":{bgcolor:"#e8eaed",boxShadow:"none"},borderRadius:"4px",fontWeight:400,fontSize:"14px",py:1,px:2,border:"none",boxShadow:"none"},children:Ce?l.jsxs(l.Fragment,{children:[l.jsx(m.CircularProgress,{size:18,sx:{mr:1.5,color:"#5f6368"}}),l.jsx(m.Typography,{variant:"body2",sx:{fontSize:"14px",color:"#5f6368"},children:"Generando enlace..."})]}):"Añadir videoconferencia de Google Meet"}):l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#f1f3f4",p:"6px 12px",borderRadius:"4px",border:"1px solid #dadce0"},children:[l.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[l.jsx(m.Typography,{variant:"body2",sx:{color:"#1a73e8",fontWeight:500,cursor:$e("link")?"pointer":"default",textDecoration:"none","&:hover":{textDecoration:$e("link")?"underline":"none"},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},onClick:()=>$e("link")&&window.open($e("link"),"_blank"),children:$e("link")?$e("link"):"Se añadirá Google Meet al guardar"}),l.jsx(m.Typography,{variant:"caption",sx:{color:"#70757a"},children:"Google Meet"})]}),l.jsx(m.IconButton,{size:"small",onClick:()=>{De("incluirMeet",!1),De("link","")},sx:{color:"#5f6368"},children:l.jsx(Cr,{sx:{fontSize:18}})})]})})]}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[l.jsx(XE,{}),fh.map(U=>l.jsx(Ar,{name:"color",control:Le,render:({field:fe})=>l.jsx(m.IconButton,{onClick:()=>fe.onChange(U),sx:{width:24,height:24,borderRadius:"50%",bgcolor:U,border:fe.value===U?"2px solid":"none",borderColor:fe.value===U?"primary.main":"transparent"}})},U))]})})}),l.jsx("div",{className:"row",children:l.jsxs("div",{className:"col-12 d-flex gap-2",style:{width:"100%",marginTop:"20px"},children:[s&&!s?.isGoogleEvent&&!s?.isOutlookEvent&&l.jsx(m.Button,{onClick:n,variant:"outlined",startIcon:l.jsx("img",{src:eh,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"}),l.jsx(m.Button,{onClick:r,variant:"outlined",sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",color:"#1976D2",borderColor:"#1976D2","&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)",borderColor:"#115293"}},children:"Cancelar"}),l.jsx(m.Button,{onClick:ne,variant:"contained",disabled:!st,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"})]})})]}),l.jsx(LA,{open:z,onClose:()=>Q(!1),clientOptions:E,isClientsLoading:w,setClientSearchTerm:C,onSelectClient:_e,setFiltroPadre:R})]})})})},VA={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"},UA=({isOpen:e,onClose:r,events:t,date:n,onEventClick:o})=>{if(!n)return null;const s=a=>{o(a),r()},i=a=>a.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:a.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return l.jsx(m.Modal,{open:e,onClose:r,children:l.jsxs(m.Box,{sx:VA,children:[l.jsxs(m.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[l.jsxs(m.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),l.jsx(m.IconButton,{onClick:r,size:"small",children:l.jsx(Cr,{})})]}),l.jsx(m.Divider,{}),l.jsx(m.List,{sx:{mt:1},children:t.map(a=>{const c=i(a);return l.jsx(m.ListItem,{disablePadding:!0,sx:{mb:1},children:l.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:l.jsxs(m.Box,{sx:{flexGrow:1},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[l.jsx(m.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),l.jsx(m.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),l.jsx(m.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${x.format(a.fechaInicio,"hh:mm aa").toLowerCase()} - ${x.format(a.fechaFin,"hh:mm aa").toLowerCase()}`})]})})},a.eventoID)})})]})})};var Ko={},hh;function WA(){if(hh)return Ko;hh=1;var e=at();Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.default=void 0;var r=e(pt()),t=ut();return Ko.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),Ko}var YA=WA();const HA=it(YA);var Qo={},mh;function qA(){if(mh)return Qo;mh=1;var e=at();Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.default=void 0;var r=e(pt()),t=ut();return Qo.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),Qo}var ZA=qA();const GA=it(ZA),KA="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",QA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAALVBMVEVHcEzfEBfjCxzkChvkChvkChzkCxvlChv////96uv60dT1o6ryho/mGyvkCxypwAsrAAAACHRSTlMAECtdiKDJ5DEbuTIAAAHoSURBVHjatdlbjsMgDAVQ87JJKHf/y51pf9CIp+vJ/SzSkUloAZc2cSEkFgEAYU7RO/o+zkdBF07hO9QnwSzJq4uLgmUkGDgzGTrORHrGcZLXlmcvMkKZaJxuH/YLTwB9ZCo6AUyivb4m7uuziwxDeLtezKsnwJiwfCH2x5hgDi8mbJ+0APaI6wo0Ju4KrIBqQNyqwFqufL3qYOD1O1DqqkQZeVd+567dwJ3fuUai0Cceg5Scm9h5v3lhED9fgzk3ceTlC4Ok+YxzLzbvk+lrCRjl6sTmzSuEn80Yr9yJzZs+Q6Tp72C9/4jdRwXDCJEDTsQzD3DkcSaeeQgUcSZuvAYmnIlnHhIxVqLWAxNjKSo9CAl0YsEGBFRiwSYEhdh5dvCuBrB5GlH3UvaikOw8ncjbha0UeffV04qJwplX7jMxUjjzUM9ET+7Mw6HoiOTIOxR5ehYunXe8SfndNlpwvo2G2XWidl4nYhQ3PYpczVMfRfxqoy9QHZbWx7nm9eK9OM5RnB84h8VPTqJA6G55toj5WtYX+K8lypMXH2KYkx64PD55vbVfwJ9pEZgfo70tYm/c2FtLds/eTHu23WdvSG7jk2a6zzV17aRER4oEUXDm1r0kT18lJB5o5n8sErN8JOEUtv9U/ACrTv/qOzhclQAAAABJRU5ErkJggg==",Pc=v.forwardRef(({id:e,message:r,variant:t},n)=>{const{closeSnackbar:o}=ls.useSnackbar(),s={success:{color:"#fff",icon:l.jsx("img",{width:25,src:KA,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:l.jsx(HA,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:l.jsx(GA,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:l.jsx("img",{src:eh,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:l.jsx("img",{src:QA,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},i=s[t]||s.info;return l.jsx(ls.SnackbarContent,{ref:n,children:l.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:[l.jsx(m.Box,{sx:{mr:1.5},children:i.icon}),l.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1},children:r}),l.jsx(m.IconButton,{size:"small",onClick:()=>o(e),children:l.jsx(Cr,{fontSize:"small"})})]})})}),gh=v.createContext(void 0),JA=({children:e})=>{const[r,t]=v.useState([]),[n,o]=v.useState([]),[s,i]=v.useState(!1);return l.jsx(gh.Provider,{value:{googleEvents:r,setGoogleEvents:t,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:s,setIsLoadingGoogleEvents:i},children:e})},XA=()=>{const e=v.useContext(gh);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},eD=(e,r,t)=>{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(tD(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:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!0}};function tD(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}function rD(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}const nD=(e,r,t)=>{const n=new Date(e.start.dateTime);let o=new Date(e.end.dateTime);return e.isAllDay&&o.setDate(o.getDate()-1),{eventoID:Math.abs(rD(e.id)),titulo:e?.summary||"(Sin título)",descripcion:e.body?.content||"",fechaInicio:n,fechaFin:o,todoElDia:e.isAllDay,color:"#0078D4",hasVideoCall:!!e.onlineMeetingUrl,link:e.webLink,repetir:void 0,solID:null,disID:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!1,isOutlookEvent:!0}},vh="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",oD="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",sD=({open:e,onClose:r,onConfirm:t,title:n,description:o,icon:s,confirmText:i,confirmColor:a="#d32f2f",loading:c=!1})=>l.jsxs(m.Dialog,{open:e,onClose:r,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[l.jsx(m.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:l.jsx(m.IconButton,{onClick:r,size:"small",children:l.jsx(Cr,{fontSize:"small"})})}),l.jsxs(m.DialogContent,{sx:{textAlign:"center",pt:0},children:[l.jsx(m.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:s}),l.jsx(m.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),l.jsx(m.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),l.jsxs(m.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[l.jsx(m.Button,{variant:"outlined",onClick:r,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),l.jsxs(m.Button,{variant:"contained",onClick:t,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:[i=="Eliminar"&&l.jsx("img",{src:oD,width:15,style:{marginRight:6,marginBottom:2}}),c?"Procesando...":i]})]})]})]}),Vi=(e,r)=>{if(!e||!r)return null;const t=r.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=t.includes("pm"),o=t.includes("am"),s=t.replace(/[a-z]/g,""),[i,a]=s.split(":");if(!i||!a)return null;let c=parseInt(i,10);const d=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[u,f,h]=e.split("-").map(Number),g=new Date(u,f-1,h,c,d);return x.isValid(g)?g:null},iD=({userId:e,leads30Days:r,leads90Days:t,disId:n,masNombreBD:o,usrNombre:s,onNavigate:i})=>{const[a,c]=v.useState(new Date),[d,u]=v.useState([]),[f,h]=v.useState(!1),[g,y]=v.useState(null),[p,b]=v.useState(null),[_,C]=v.useState([]),{enqueueSnackbar:E}=ls.useSnackbar(),S=bc(),w=bi(),B=ic(),[A,T]=v.useState(!1),[I,M]=v.useState([]),[W,Z]=v.useState(null),{session:V,sessionoutlook:H}=Ha(),{googleEvents:te,setGoogleEvents:Y,outlookEvents:N,setOutlookEvents:ie}=XA(),[de,z]=v.useState([]),[Q,Ee]=v.useState([]),[xe,_e]=v.useState([]),[oe,ae]=v.useState(!1),[re,Se]=v.useState([]),[Ce,me]=v.useState(),ze=(se,Ae)=>{M(se),Z(Ae),T(!0)},R=async()=>{if(e===void 0||n===void 0)return;const se=await S.getNotificacionesXUsuario(e,n);s?localStorage.setItem("nombreAnfitrion",s):localStorage.setItem("nombreAnfitrion","Anfitrion"),Se(se)};v.useEffect(()=>{const se=new Date,Ae=x.startOfDay(se),je=x.endOfDay(x.addDays(Ae,6)),Re={start:Ae,end:je},yr=d.filter(ur=>{const U={start:ur.fechaInicio,end:ur.fechaFin};return Sd(U,Re)}).sort((ur,U)=>ur.fechaInicio.getTime()-U.fechaInicio.getTime());C(yr)},[d]),v.useEffect(()=>{const se=async()=>{try{if(e&&n){const je=await S.getEventsByUser(e,n);R(),u(je)}}catch(je){console.log("Error al cargar eventos locales:",je)}};se();const Ae=setInterval(se,4e3);return()=>clearInterval(Ae)},[e]),v.useEffect(()=>{if(!n||!e)return;const se=[...d];if(te.length>0&&V?.userEmail){const Ae=te.map(je=>eD(je,n,e));se.push(...Ae)}if(N.length>0&&H?.userEmail){const Ae=N.map(je=>nD(je,n,e));se.push(...Ae)}z(se)},[d,te,N,n,e,V?.userEmail,H?.userEmail]);const Le=async se=>{try{if(se?.isGoogleEvent||se.isOutlookEvent)y(se),h(!0);else{const Ae=await S.getEventById(se.eventoID);y(Ae),h(!0)}}catch(Ae){console.error(Ae)}},Ge=()=>{h(!1),y(null)},Ze=async(se,Ae)=>{let je,Re;if(se.todoElDia)je=Vi(se.fechaInicio,se.horaInicio),Re=Vi(se.fechaInicio,se.horaFin);else{je=Vi(se.fechaInicio,se.horaInicio);const fe=se.fechaFin||se.fechaInicio;Re=Vi(fe,se.horaFin)}if(!je||!Re){console.error("No se pudieron procesar las fechas. Revisa el formato de hora:",{inicio:se.horaInicio,fin:se.horaFin});return}const yr=x.format(je,"yyyy-MM-dd HH:mm:ss.SSS"),ur=x.format(Re,"yyyy-MM-dd HH:mm:ss.SSS");if(Ae){const fe={...se,eventoID:Ae,fechaInicio:yr,fechaFin:ur,solID:se.solID??null,disID:n??null,client:se.client,invitados:se.invitados.map(le=>({usrNombre:le.nombre||le.usrNombre,Correo:le.correo||le.Correo,EsOrganizador:le.isHost||le.EsOrganizador,StatusInvitacion:le.StatusInvitacion,UsuarioID:le.usrID||le.UsuarioID,disID:le.disID||n}))};try{const le=await S.updateEvent(fe);var U=d.map(ue=>ue.eventoID===le.eventoID?le:ue);u(U),E("El evento se ha actualizado correctamente.",{variant:"success"}),Ge()}catch{E("Error al actualizar Evento",{variant:"error"})}}else{const fe={...se,fechaInicio:yr,fechaFin:ur,todoElDia:se.todoElDia,solID:se.solID??null,disID:n??null,client:se.client,invitados:se.invitados.map(le=>({usrNombre:le.nombre||le.usrNombre,Correo:le.correo||le.Correo,EsOrganizador:le.isHost||le.EsOrganizador,StatusInvitacion:le.StatusInvitacion,UsuarioID:le.usrID||le.UsuarioID,disID:le.disID||n}))};try{const le=await S.createEvent(fe,e);u(ue=>[...ue,le]),E("El evento se ha creado con éxito",{variant:"success"}),Ge()}catch{E("Error al guardar Evento",{variant:"error"})}}if(e&&n){const fe=await S.getEventsByUser(e,n);u(fe)}},Ie=()=>{c(se=>new Date(se.getFullYear(),se.getMonth()-1,1))},st=()=>{c(se=>new Date(se.getFullYear(),se.getMonth()+1,1))},$e=()=>{Kt("ELIMINAR")},De=()=>{Kt("RECHAZAR")},D=()=>{b(new Date),h(!0)},O=se=>{se&&c(se)},F=se=>{b(se),h(!0),y(null)},ce=async()=>{if(g)try{await S.deleteEvent(g.eventoID),u(d.filter(se=>se.eventoID!==g.eventoID)),E("El evento se ha eliminado de tu calendario",{content:(se,Ae)=>l.jsx(Pc,{id:se,message:String(Ae),variant:"delete"})})}catch{E("Error al eliminar Evento",{variant:"error"})}finally{Ge(),Ht()}},ne=async()=>{if(!(!V?.userEmail||!n)){ae(!0);try{const Ae=(await w.getGoogleCalendars(V.userEmail,n)).map(Re=>({...Re,selected:!0}));Ee(Ae);const je=Ae.map(Re=>Re.id);Oe(je)}catch(se){console.error("Error Google Cals:",se)}finally{ae(!1)}}},j=async se=>{const Ae=Q.map(Re=>Re.id===se?{...Re,selected:!Re.selected}:Re);Ee(Ae);const je=Ae.filter(Re=>Re.selected).map(Re=>Re.id);Oe(je)},G=async()=>{if(!(!H?.userEmail||!n)){ae(!0);try{const Ae=(await B.getOutlookCalendars(H.userEmail,n)).map(Re=>({...Re,selected:!0}));_e(Ae);const je=Ae.map(Re=>Re.id);P(je)}catch(se){console.error("Error Outlook Cals:",se)}finally{ae(!1)}}},pe=async se=>{const Ae=xe.map(Re=>Re.id===se?{...Re,selected:!Re.selected}:Re);_e(Ae);const je=Ae.filter(Re=>Re.selected).map(Re=>Re.id);P(je)};v.useEffect(()=>{ne()},[V?.userEmail,n]),v.useEffect(()=>{G()},[H?.userEmail,n]);const Oe=async se=>{if(!V?.userEmail||!n)return;const Ae=se||Q.filter(je=>je.selected).map(je=>je.id);try{const je={disID:n,year:a.getFullYear(),month:a.getMonth()+1,usrMail:V.userEmail,calendarIds:Ae},Re=await w.getGoogleEventsByMonth(je);Y(Re)}catch(je){console.error("Error al obtener eventos de Google:",je)}},P=async se=>{if(!H?.userEmail||!n)return;const Ae=se||xe.filter(je=>je.selected).map(je=>je.id);try{const je={disID:n,year:a.getFullYear(),month:a.getMonth()+1,usrMail:H.userEmail,calendarIds:Ae},Re=await B.getOutlookEventsByMonth(je);ie(Re)}catch(je){console.error("Error al obtener eventos de Outlook:",je)}};if(n===void 0||e===void 0)return l.jsx("div",{children:"Cargando configuración de usuario..."});const X=async(se,Ae)=>{await S.UpdateStatusEvento(se.evento.eventoID,e,Ae)&&(await S.MarcarLeido(se.notificacionID,e),E(se?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},we=async()=>{Ce&&S.UpdateStatusEvento(Ce.evento.eventoID,e,"RECHAZADA")&&(await S.MarcarLeido(Ce.notificacionID,e),await S.MarcarLeido(Ce.notificacionID,e),E("Haz rechazado la Invitación a "+Ce?.evento?.titulo,{content:(Ae,je)=>l.jsx(Pc,{id:Ae,message:String(je),variant:"rechazar"})}),Ht())},qe=async(se,Ae)=>{try{if(!e)return;me(se),Ae=="RECHAZADA"?(De(),console.log("noti",se)):X(se,Ae)}catch{E("Error al procesar la invitación",{variant:"error"})}},St=async se=>{try{if(!g)return;await S.ReenviarNotificacion(g?.eventoID,se),E("Invitación enviada con éxito",{variant:"success"})}catch(Ae){console.error("Error al conectar con la API",Ae)}},[gt,Kt]=v.useState(null),Ht=()=>Kt(null),Tr={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:l.jsxs(l.Fragment,{children:["Estás a punto de declinar la invitación de ",l.jsx("strong",{children:Ce?.evento?.nombreAnfitrion})," a ",l.jsx("strong",{children:Ce?.evento?.titulo})]}),icon:l.jsx("img",{src:vh}),action:()=>Ce&&we()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:l.jsx("img",{src:vh}),action:()=>ce()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>ce}},It=gt?Tr[gt]:null;return l.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[l.jsx(Rv,{header:l.jsx(e2,{currentDate:a,onPrevMonth:Ie,onNextMonth:st,onAddEvent:D,onDateChange:O}),sidebar:l.jsx(Qx,{onEventClick:Le,upcomingEvents:_,leads30Days:r,leads90Days:t,disID:n,usrID:e,onAddEvent:D,googleCalendars:Q,outlookCalendars:xe,isLoadingCalendars:oe,onToggleGoogle:j,onToggleOutlook:pe,notifications:re,unreadCount:re?.filter(se=>!se.leida).length,onAceppInvitacion:qe}),mainContent:l.jsx(dw,{onSeeMoreClick:ze,currentDate:a,events:de,onDayClick:F,onEventClick:Le})}),f&&l.jsx(FA,{isVisible:f,onClose:Ge,onSave:Ze,onDelete:$e,selectedDate:p,initialEvent:g,userId:e,masNombreBD:o,disId:n,gmail:"llopez@exagono.net",onReenviar:St,onNavigate:i}),l.jsx(UA,{isOpen:A,onClose:()=>T(!1),events:I,date:W,onEventClick:Le}),It&&l.jsx(sD,{open:!!gt,onClose:Ht,onConfirm:()=>{It.action()},title:It.title,description:It.description,icon:It.icon,confirmText:It.confirmText})]})},aD="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",cD="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 Rc(e,r,t){return e.accessor?e.accessor(r,t):e.field?r?.[e.field]:r?.[e?.key||""]}function lD(e,r){const t=e??"",n=r??"";return t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():typeof t=="number"&&typeof n=="number"?t-n:typeof t=="boolean"&&typeof n=="boolean"?Number(t)-Number(n):String(t).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function Nc(e,r,t=!0){return typeof e=="function"?e(r):e??t}function uD(e){return e.replace(/[^\d]/g,"")}function dD(e,r){return r}var Jo={},yh;function fD(){if(yh)return Jo;yh=1;var e=at();Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.default=void 0;var r=e(pt()),t=ut();return Jo.default=(0,r.default)((0,t.jsx)("path",{d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAlt"),Jo}var pD=fD();const hD=it(pD);var Xo={},bh;function mD(){if(bh)return Xo;bh=1;var e=at();Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.default=void 0;var r=e(pt()),t=ut();return Xo.default=(0,r.default)((0,t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27c1.2-1.4 1.82-3.31 1.48-5.34-.47-2.78-2.79-5-5.59-5.34-4.23-.52-7.79 3.04-7.27 7.27.34 2.8 2.56 5.12 5.34 5.59 2.03.34 3.94-.28 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"SearchRounded"),Xo}var gD=mD();const vD=it(gD);var es={},xh;function yD(){if(xh)return es;xh=1;var e=at();Object.defineProperty(es,"__esModule",{value:!0}),es.default=void 0;var r=e(pt()),t=ut();return es.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),es}var bD=yD();const xD=it(bD);var ts={},wh;function wD(){if(wh)return ts;wh=1;var e=at();Object.defineProperty(ts,"__esModule",{value:!0}),ts.default=void 0;var r=e(pt()),t=ut();return ts.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),ts}var _D=wD();const SD=it(_D);function _h(e){return e==="right"?"end":e==="center"?"center":"start"}function Sh(e){const r=e.filter(t=>!t.width).length||1;return e.map(t=>typeof t.width=="number"?`${t.width}px`:typeof t.width=="string"?t.width:`minmax(0, ${1/r}fr)`).join(" ")}const CD=1060,zc=(e,r)=>e.metrics.find(t=>String(t.label).toLowerCase()===r.toLowerCase())?.value??"";function ED({sections:e,detailColumns:r,summaryWidths:t=["1fr",120,120,150],minWidth:n=CD,getDetailColumns:o,onRowClick:s}){function c(u){if(typeof u=="number")return u;if(!u)return 0;const f=/^(\d+)\s*px$/.exec(u.trim());return f?Number(f[1]):/fr$/i.test(u)?160:0}function d(u){const f=u.reduce((y,p)=>y+c(p.width),0),h=Math.max(u.length-1,0)*16;return f+h+32}return l.jsx(m.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:l.jsxs(m.Box,{children:[l.jsx(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(u=>typeof u=="number"?`${u}px`:u).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"#1E5BCE",color:"#fff",boxSizing:"border-box"},children:["Tipo","En Proceso","Finalizadas","Último seg."].map(u=>l.jsx(m.Typography,{sx:{fontSize:13,fontWeight:800},children:u},u))}),e.map((u,f)=>{const[h,g]=K.useState(!!u.initiallyOpen),y=f%2===1,p=o?o(u):r,b=Math.max(n,d(p));return l.jsxs(m.Box,{children:[l.jsxs(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(_=>typeof _=="number"?`${_}px`:_).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:y?"rgba(30,91,206,0.06)":"background.paper",borderTop:"1px solid rgba(0,0,0,0.08)","&:hover":{bgcolor:"rgba(30,91,206,0.12)"},boxSizing:"border-box",cursor:"pointer"},onClick:()=>g(_=>!_),children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[l.jsx(m.IconButton,{size:"small",disableRipple:!0,children:h?l.jsx(SD,{}):l.jsx(xD,{})}),l.jsx(m.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(u.title),children:u.title})]}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:zc(u,"En Proceso")}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:zc(u,"Finalizadas")}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:zc(u,"Último seg.")})]}),l.jsx(m.Collapse,{in:h,unmountOnExit:!0,children:l.jsxs(m.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[l.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Sh(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(_=>l.jsx(m.Typography,{sx:{justifySelf:_h(_.align),textAlign:_.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.header},_.key))}),(u.rows??[]).map((_,C)=>l.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Sh(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:C%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?.(_,u),children:p.map((E,S)=>{const w=E.accessor?E.accessor(_,C):E.field?_[E.field]:null;return l.jsx(m.Box,{sx:{justifySelf:_h(E.align),textAlign:E.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof w=="string"||typeof w=="number"?l.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(w),children:w}):w},E.key??S)})},_.id??C))]})})]},u.id)})]})})}var rs={},Ch;function AD(){if(Ch)return rs;Ch=1;var e=at();Object.defineProperty(rs,"__esModule",{value:!0}),rs.default=void 0;var r=e(pt()),t=ut();return rs.default=(0,r.default)((0,t.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m3.3 14.71L11 12.41V7h2v4.59l3.71 3.71z"}),"AccessTimeFilled"),rs}var DD=AD();const kD=it(DD),TD=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",MD=e=>{const r=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return r||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},ID=e=>{const r=(e||"").split(" ").filter(Boolean);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var ns={},Eh;function OD(){if(Eh)return ns;Eh=1;var e=at();Object.defineProperty(ns,"__esModule",{value:!0}),ns.default=void 0;var r=e(pt()),t=ut();return ns.default=(0,r.default)((0,t.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Create"),ns}var jD=OD();const PD=it(jD),Lc=({current:e=0,total:r=0,color:t="#4caf50"})=>l.jsx("div",{style:{display:"flex",gap:"1px",width:"100%",height:"100%",justifyContent:"center",overflow:"hidden",minWidth:0},children:Array.from({length:r}).map((n,o)=>l.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?t:"#e0e0e0",display:"flex"}},o))});var os={},Ah;function RD(){if(Ah)return os;Ah=1;var e=at();Object.defineProperty(os,"__esModule",{value:!0}),os.default=void 0;var r=e(pt()),t=ut();return os.default=(0,r.default)((0,t.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),os}var ND=RD();const Dh=it(ND);var ss={},kh;function zD(){if(kh)return ss;kh=1;var e=at();Object.defineProperty(ss,"__esModule",{value:!0}),ss.default=void 0;var r=e(pt()),t=ut();return ss.default=(0,r.default)((0,t.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),ss}var LD=zD();const $D=it(LD),BD=e=>{const r=String(e??"").toLowerCase().trim();return r==="muy interesado"?{bg:"#E53935",color:"#FFFFFF"}:r==="interesado"?{bg:"#FB8C00",color:"#FFFFFF"}:r==="venta definitiva"?{bg:"#2E7D32",color:"#FFFFFF"}:r==="no sé"||r==="no se"?{bg:"#9E9E9E",color:"#FFFFFF"}:r==="algo interesado"?{bg:"#FFEB3B",color:"#000000"}:{bg:"transparent",color:"#2c2c2c"}},FD=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}},VD=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}},UD=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 WD(e){const r=new Date(e),t=r.toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),n=r.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"});return`${t.replace(".","")} • ${n}`}function YD(e){return e.replace(/<br\s*\/?>/gi,`
178
178
  `).replace(/\r\n/g,`
179
179
  `).replace(/\r/g,`
180
180
  `)}const HD={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"]},qD={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"]},ZD={Todos:[],"Algo interesado":["Algo interesado"],Interesado:["Interesado"],"Muy interesado":["Muy interesado"],"Venta definitiva":["Venta definitiva"],"No sé":["No sé"]};function GD(e,r){switch(e){case"pruebas":return VD(r)??"—";case"servicio":return UD(r)??"—";case"nuevos":case"seminuevos":default:return FD(r)??"—"}}function KD({open:e,onClose:r,customer:t,fields:n=[],header:o,extraSections:s,normalTable:i,normalTableColumns:a=[],history:c=[],advisorHistory:d=[],onRequestEdit:u,searchFilter:f,urlsQA:h,solicitudesNuevos:g=[],solicitudesPrueba:y=[],solicitudesServicio:p=[],solicitudesSeminuevos:b=[],onCreateSolicitud:_,isCrmMode:C=!1,onSolicitudBaseUrl:E,onIframeClose:S,reloadInfo:w,idAdminSistemas:B}){if(!t)return null;const A=3,[T,I]=v.useState(null),M=!!T,[W,Z]=v.useState(!1),[V,H]=v.useState(null),[te,Y]=v.useState(c??[]),[N,ie]=v.useState(null),de=v.useMemo(()=>[...d].sort((L,J)=>new Date(J.FechaAsignacion).getTime()-new Date(L.FechaAsignacion).getTime()),[d]);v.useEffect(()=>{c&&c.length&&Y(c)},[c]);const z=c?.length?c:te,Q=o?.title??(L=>L?.Nombre||L?.name||"Sin título"),Ee=o?.infoItems??[],xe=L=>L.nombreAsesor?.trim()||(L.Email?L.Email:"Sistema"),_e=L=>{const J=L||"",ye=J.split(" ").filter(Boolean);return ye.length>=2?(ye[0][0]+ye[1][0]).toUpperCase():(J[0]||"?").toUpperCase()},oe=L=>L?.SolID??L?.solID??L?.SolId??L?.SOLID??null,ae=v.useMemo(()=>{const L=z??[];return Array.isArray(L?.[0])?L.flat():L},[z]),re=v.useMemo(()=>{const L=ae;return!N||V==null?L:L.filter(J=>{const ye=oe(J);return ye!=null&&String(ye)===String(V)})},[ae,N,V]),Se=v.useMemo(()=>[...re].sort((L,J)=>new Date(J.fecAlta).getTime()-new Date(L.fecAlta).getTime()),[re]),[Ce,me]=v.useState(!1),ze=v.useMemo(()=>Ce?Se:Se.slice(0,A),[Ce,Se]),R=Math.max(Se.length-A,0),Le=L=>String(L??"").normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim(),Ge=(L,J)=>Le(JSON.stringify(L)).includes(Le(J)),Ze=(L,J)=>f?f(L,J):Ge(L,J),Ie=(L,J)=>{const ye=Le(J).split(/\s+/).filter(Boolean);return ye.length?ye.every(Me=>Ze(L,Me)):!0},[st,$e]=v.useState(""),[De,D]=v.useState([]);v.useMemo(()=>i??[],[i]),v.useMemo(()=>{const L=st.trim();return L?(i??[]).filter(J=>Ie(J,L)):i??[]},[i,st]);const O=m.useTheme(),F=m.useMediaQuery(O.breakpoints.down("md")),[ce,ne]=v.useState(""),[j,G]=v.useState(!0),[pe,Oe]=v.useState(!1),P=new Date().toISOString().slice(0,10),X=new Date(Date.now()-720*3600*1e3).toISOString().slice(0,10),[we,qe]=v.useState(X),[St,gt]=v.useState(P),[Kt,Ht]=v.useState(null),Tr=!!Kt,[It,se]=v.useState("En Proceso"),[Ae,je]=v.useState("Todos"),[Re,yr]=v.useState("Todos"),ur=["Algo interesado","Interesado","Muy interesado","Venta definitiva","No sé"],U=["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"],fe=()=>{ne(""),G(!1),Oe(!1),qe(X),gt(P),se("Todos"),je("Todos"),yr("Todos")},le=v.useMemo(()=>(ce??"").trim()!==""||It!=="Todos"||Ae!=="Todos"||j||pe||Re!=="Todos",[ce,It,Ae,j,pe,Re]);function ue(L){if(!L)return"";const J=new Date(L);if(isNaN(J.getTime()))return"";const ye=String(J.getDate()).padStart(2,"0"),Me=String(J.getMonth()+1).padStart(2,"0"),Dt=String(J.getFullYear()).slice(-2);return`${ye}/${Me}/${Dt}`}function Pe(L){const J=L?new Date(L):null;return J&&!isNaN(J.getTime())?J:null}function Ve(L,J){let ye=null;for(const Me of L){const Dt=Pe(J(Me));if(Dt){const Ct=Dt.getTime();(ye===null||Ct>ye)&&(ye=Ct)}}return ye?new Date(ye):null}function vt(L){const J=Ve(L,ye=>ye.UltimoSeguimiento||ye.FechaCita);return J?ue(J.toISOString()):"—"}function or(L){const J=(L??"").toLowerCase().trim();return J==="sin venta"||J==="con venta"||J==="rechazada"||J==="rechazadas"}function Mr(L){return L.filter(J=>or(J.EstatusDescripcion)).length}function Kr(L){return L.filter(J=>!or(J.EstatusDescripcion)).length}const Vc=({progress:L,color:J})=>{if(!L)return l.jsx(Lc,{current:0,total:0,color:J});const ye=L.split("/").map(Number);if(ye.length!==2||ye.some(Ct=>Number.isNaN(Ct)))return l.jsx(Lc,{current:0,total:0,color:J});const[Me,Dt]=ye;return l.jsx(Lc,{current:Me,total:Dt,color:J})};function Wi(L){return[{key:"fecha",header:"Fecha",accessor:J=>ue(J.Fecha),width:110},{key:"vehiculo",header:"Vehículo",accessor:J=>l.jsx(m.Tooltip,{title:J.Vehiculo??"",placement:"top",arrow:!0,children:l.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:J.Vehiculo??"—"})}),width:260},{key:"estatus",header:"Estatus",accessor:J=>l.jsx(m.Typography,{sx:{fontWeight:800,fontSize:13},children:GD(L,J.IdEstatus)}),width:170},{key:"nivel",header:"Nivel de Interés",accessor:J=>{const{bg:ye,color:Me}=BD(J.NivelInteres);return l.jsx(m.Box,{sx:{display:"inline-block",px:1,py:.25,borderRadius:9999,bgcolor:ye,color:Me,fontSize:12,fontWeight:J.NivelInteres?800:500},children:J.NivelInteres??"—"})},width:150},{key:"asesor",header:"Asesor",accessor:J=>{const ye=(J.Asesor??"").trim(),Me=Uc=>{if(!Uc)return"";const xk=Uc[0]?.toUpperCase()??"",wk=Uc[1]?.toLowerCase()??"";return`${xk}${wk}`};if(!ye)return l.jsx(m.Tooltip,{title:"",placement:"top",children:l.jsx(m.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:"—"})});const Dt=ye.split(/\s+/),Ct=Dt[0]??"",Ir=Dt[1]??"",br=Me(Ct),Cn=Me(Ir),bk=`${br}${Cn}`||"—";return l.jsx(m.Tooltip,{title:ye,placement:"top",children:l.jsx(m.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:bk})})},width:120,align:"center"},{key:"origen",header:"Origen",accessor:J=>J.Origen??"—",width:120,align:"center"},{key:"actividad",header:"Actividad",accessor:J=>l.jsx(m.Tooltip,{title:J.Actividad??"",placement:"top",arrow:!0,children:l.jsxs(m.Box,{sx:{maxWidth:160,overflow:"hidden",display:"flex",gap:.5,alignItems:"center"},children:[J.Icon&&l.jsx("span",{style:{color:"#fff",backgroundColor:J.Color,borderRadius:100,alignItems:"center",justifyContent:"center",display:"flex",padding:3},children:l.jsx("i",{className:J.Icon})}),l.jsx(m.Typography,{component:"span",noWrap:!0,sx:{fontSize:13,fontWeight:500,display:"block",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:(J.Actividad??"").length?"default":"inherit"},children:J.Actividad??"—"})]})}),width:180},{key:"avance",header:"Avance",accessor:J=>l.jsx(Vc,{progress:J.Avance,color:J.Color}),width:200,align:"left"}]}function k(L){const ye=Wi(L).slice(1);return[{key:"fecha",header:"Fecha",accessor:Me=>ue(Me.Fecha),width:110},{key:"fechaCita",header:"Fecha Cita",accessor:Me=>ue(Me.FechaCita),width:120},{key:"horaCita",header:"Hora Cita",accessor:Me=>Me.HoraCita??"—",width:110},...ye]}function ee(L){const J=L.kind;switch(J){case"pruebas":case"servicio":return k(J);case"nuevos":case"seminuevos":default:return Wi(J)}}function ve(L,J,ye,Me){return{id:L,kind:ye,title:J,metrics:[{label:"En Proceso",value:Kr(Me)},{label:"Finalizadas",value:Mr(Me)},{label:"Último seg.",value:vt(Me)}],rows:Me,initiallyOpen:!1}}const Ne=[ve("n-1","Cotización de nuevos","nuevos",g),ve("p-1","Prueba de Manejo","pruebas",y),ve("s-1","Cita de Servicio","servicio",p),ve("sn-1","Cotización para Seminuevos","seminuevos",b)],Ke=v.useMemo(()=>{const L=(ce??"").trim().toLowerCase(),J=(ye,Me)=>{if(L&&!(ye.Vehiculo??"").toLowerCase().includes(L))return!1;const Dt=pe?ye.FechaCita:ye.Fecha;if(j&&Dt){const Ct=Pe(Dt??"");if(!Ct)return!1;const Ir=we?new Date(`${we}T00:00:00`):null,br=St?new Date(`${St}T00:00:00`):null;if(br&&br.setDate(br.getDate()+1),Ir&&Ct<Ir||br&&Ct>=br)return!1}if(It!=="Todos"){const Ct=(ye.EstatusDescripcion??"").toLowerCase();if(!(HD[It]??[]).some(Cn=>Ct===Cn.toLowerCase()))return!1}if(Ae!=="Todos"){const Ct=(ye.Actividad??"").toLowerCase();if(!(qD[Ae]??[]).some(Cn=>Ct===Cn.toLowerCase()))return!1}if(Re!=="Todos"){const Ct=(ye.NivelInteres??"").toLowerCase();if(!(ZD[Re]??[]).some(Cn=>Ct===Cn.toLowerCase()))return!1}return!0};return Ne.map(ye=>{const Me=(ye.rows??[]).filter(Ct=>J(Ct,ye.kind)),Dt=[{label:"En Proceso",value:Kr(Me)},{label:"Finalizadas",value:Mr(Me)},{label:"Último seg.",value:vt(Me)}];return{...ye,rows:Me,metrics:Dt}})},[Ne,ce,j,we,St,pe,It,Ae,Re]),lt={nuevos:"cotizaciones",pruebas:"pruebademanejo",servicio:"citasservicio",seminuevos:"seminuevos"},He=(L,J)=>{const ye=L.SolID;if(!ye)return;const Me=J.kind,Dt=lt[Me]??"cotizaciones",Ct=h?`https://qa2.crm.netcar.com.mx/netcar/${Dt}/${ye}`:`https://crmxs.netcar.com.mx/netcar/${Dt}/${ye}`,Ir=E?.({row:L,section:J,slug:Dt,solId:ye,baseUrl:Ct});if(!C){const br=Ir??Ct;H(ye),ie(br),Z(!0)}},Ue=()=>{S?.(t),H(null),ie(null),Z(!1)},Vt=v.useRef(!1),ht=v.useRef(null),Ot=v.useCallback(()=>{if(!Vt.current){Vt.current=!0;return}ht.current&&window.clearTimeout(ht.current),ht.current=window.setTimeout(()=>{w?.(t)},500)},[w,t]);return v.useEffect(()=>{Vt.current=!1,ht.current&&window.clearTimeout(ht.current)},[N,V]),l.jsx(m.Dialog,{open:e,onClose:r,fullWidth:!0,fullScreen:F,PaperProps:{sx:{height:{xs:"100dvh",md:"90vh"},maxWidth:{xs:"100vw",md:"92vw"},overflow:"hidden",display:"flex",flexDirection:"column",borderRadius:{xs:0,md:3}}},children:l.jsxs(m.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},height:"100%",minHeight:0,overflow:"auto",position:"relative"},children:[l.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:[l.jsxs(m.Box,{children:[l.jsx(m.Stack,{direction:"row",spacing:2,alignItems:"center",mb:1,sx:{px:2.5,pt:2.5},children:l.jsxs(m.Box,{display:"flex",flexDirection:"column",gap:1,width:"100%",children:[l.jsx(m.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:l.jsx(m.Box,{sx:{flex:1,minWidth:0,pr:1},children:l.jsxs(m.Typography,{component:"span",fontWeight:700,sx:{display:"inline",lineHeight:1.2,wordBreak:"break-word",pr:.5},children:[Q(t)," ",l.jsx(m.IconButton,{component:"span",size:"small",disableRipple:!0,onClick:()=>{r?.(),t&&u?.(t)},sx:{p:0,ml:.5,verticalAlign:"text-bottom",color:"#336BE1","&:hover":{bgcolor:"transparent"},"&:focus-visible":{outline:"none"}},"aria-label":"Editar nombre",children:l.jsx(PD,{sx:{fontSize:"1em"}})})]})})}),Ee.map((L,J)=>l.jsxs(m.Box,{sx:{display:"flex",gap:1.2,alignItems:"center",cursor:L.onClick?"pointer":"default"},onClick:()=>{L.onClick&&L.onClick(t)},children:[L.icon,l.jsx(m.Typography,{variant:"body2",sx:{color:L.inLink?"#336BE1":"#070C10"},style:{},children:L.value(t)})]},J))]})}),l.jsx(m.Stack,{mb:2,sx:{px:2.5,pt:0,gap:2},children:n.map((L,J)=>{const ye=L.label?.toLowerCase().startsWith("asesor");return l.jsxs(m.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[l.jsx(m.Box,{sx:{width:"50%"},children:l.jsx(m.Typography,{variant:"body2",color:"text.secondary",sx:{color:"#5C6372"},children:L.label})}),l.jsxs(m.Box,{sx:{width:"50%",display:"flex",alignItems:"center",gap:1},children:[l.jsx("div",{children:L?.avatar?L.avatar(t):null}),l.jsx(m.Typography,{variant:"body2",color:"textPrimary",children:L?.value(t)}),ye&&!B&&l.jsx(m.Tooltip,{title:"Historial asesores",placement:"top",arrow:!0,children:l.jsx(m.IconButton,{size:"small",onClick:Me=>I(Me.currentTarget),sx:{ml:.5},disableRipple:!0,children:l.jsx(kD,{fontSize:"small",sx:{color:"#5C6372"}})})})]})]},J)})}),l.jsx(m.Divider,{sx:{my:2}})]}),l.jsx(m.Box,{px:2.5,pb:.5,children:l.jsxs(m.Typography,{children:[l.jsx("span",{style:{fontWeight:800},children:"Última actividad"}),!N&&" por solicitud",":"]})}),l.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:[ze.length===0&&l.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"Sin actividad registrada."}),l.jsxs(m.Box,{children:[ze?.map((L,J)=>{const ye=xe(L),Me=YD(L.comentario||"");return l.jsxs(m.Box,{sx:{pb:1.5},children:[l.jsxs(m.Stack,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",sx:{mb:.75},children:[l.jsx(m.Typography,{variant:"subtitle2",sx:{color:"#5C6372"},children:L.tipo||"Evento"}),l.jsx(m.Chip,{size:"small",label:L.auto!=null?`${L.auto}`:"—",sx:{bgcolor:"#336be1",color:"#fff",height:20}})]}),Me?l.jsx(m.Typography,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.5,mb:.75},children:Me}):null,l.jsxs(m.Stack,{direction:"row",spacing:1.25,alignItems:"center",children:[L?.ImgAsesor!=null?l.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},alt:_e(ye),src:L?.ImgAsesor}):l.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},children:_e(ye)}),l.jsxs(m.Stack,{spacing:0,children:[l.jsx(m.Typography,{variant:"body2",fontWeight:600,children:ye}),l.jsx(m.Typography,{variant:"caption",color:"text.secondary",children:WD(L.fecAlta)})]})]}),J<ze.length-1&&l.jsx(m.Divider,{sx:{mt:1.25}})]},L.segID??J)}),Se.length>A&&l.jsx(m.Box,{sx:{mt:1},children:l.jsx(m.Button,{onClick:()=>me(L=>!L),size:"small",sx:{textTransform:"none",px:0,color:"#336BE1","&:hover":{background:"transparent",textDecoration:"underline"}},children:Ce?"Ver menos":`Ver más (${R})`})})]})]}),l.jsx(m.Menu,{anchorEl:T,open:M,onClose:()=>I(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:l.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[l.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"}),l.jsxs(m.Box,{sx:{overflowY:"auto",py:.5,maxHeight:200},children:[de.length===0&&l.jsx(m.Box,{sx:{px:1.5,py:1},children:l.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"Sin registros"})}),de.map((L,J)=>{const ye=MD(L),Me=TD(L.FechaBaja??L.FechaAsignacion);return l.jsx(m.Box,{sx:{px:1,py:.75},children:l.jsxs(m.Stack,{direction:"row",alignItems:"center",spacing:1,children:[l.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},src:L?.ImgAsesor??void 0,children:ID(ye)}),l.jsx(m.Box,{sx:{flex:1,minWidth:0},children:l.jsx(m.Typography,{variant:"body2",noWrap:!0,children:ye})}),l.jsx(m.Typography,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:Me})]})},J)})]})]})})]}),W?l.jsxs(m.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",position:"relative"},children:[l.jsx(m.Box,{sx:{position:"absolute",top:18,left:24,zIndex:10,pointerEvents:"auto"},children:l.jsx(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:l.jsx(m.Button,{onClick:Ue,sx:{backgroundColor:"#2571d6",minWidth:36,minHeight:36,p:.5,borderRadius:"8px",color:"#fff",boxShadow:3,"&:hover":{backgroundColor:"#2074e3"}},children:l.jsx($D,{fontSize:"medium"})})})}),N&&l.jsx("iframe",{src:N,width:"100%",height:"100%",onLoad:Ot,style:{border:0}})]}):l.jsxs(m.Box,{sx:{width:"100%",minHeight:0,overflowY:"auto"},children:[l.jsx(m.Box,{sx:{mt:{xs:1.5,md:3}},children:l.jsxs(m.Box,{sx:{mt:3,display:"flex",flexDirection:"column",gap:4,padding:"0 20px 0 20px"},children:[l.jsx(m.Typography,{variant:"h4",sx:{fontWeight:800,textAlign:"center",mb:1,letterSpacing:.2},children:"Solicitudes"}),l.jsxs(m.Stack,{direction:{xs:"column",md:"column"},spacing:1.5,alignItems:{xs:"stretch",md:"center"},justifyContent:"space-between",sx:{mb:1.5},children:[l.jsxs(m.Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",sx:{flexWrap:"wrap"},children:[l.jsx(m.TextField,{size:"small",placeholder:"Buscar por vehículo",value:ce,onChange:L=>ne(L.target.value),InputProps:{endAdornment:l.jsx(vD,{fontSize:"small",sx:{color:"#b6afaf"}})},sx:{minWidth:220}}),l.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,position:"relative"},children:[l.jsxs(m.Stack,{direction:"row",spacing:1.1,position:"absolute",bottom:48,left:0,alignItems:"center",children:[l.jsx(m.FormControlLabel,{label:l.jsx(m.Typography,{sx:{fontSize:15,fontWeight:600,marginLeft:0},children:"Por fecha"}),labelPlacement:"start",control:l.jsx(m.Checkbox,{checked:j,onChange:L=>G(L.target.checked),size:"small",sx:{p:.3,"& .MuiSvgIcon-root":{fontSize:19},color:"#bab4b4"}}),sx:{ml:0,"& .MuiFormControlLabel-label":{marginRight:0}}}),l.jsx(m.Typography,{sx:{fontSize:15,paddingLeft:.4},children:"De cita"})]}),l.jsxs(m.Stack,{direction:"row",spacing:1,children:[l.jsx(m.TextField,{size:"small",type:"date",label:"Desde",InputLabelProps:{shrink:!0},value:we,onChange:L=>qe(L.target.value),disabled:!j,sx:{width:170}}),l.jsx(m.TextField,{size:"small",type:"date",label:"Hasta",InputLabelProps:{shrink:!0},value:St,onChange:L=>gt(L.target.value),disabled:!j,sx:{width:170}})]})]}),l.jsx(m.IconButton,{onClick:L=>Ht(L.currentTarget),disableRipple:!0,sx:{border:"1px solid #d4d7de",borderRadius:2,width:40,height:40,mt:2},children:l.jsx(hD,{})}),le&&l.jsx(m.Button,{variant:"outlined",onClick:fe,disableRipple:!0,sx:{height:40,textTransform:"none",borderColor:"#d4d7de",color:"#333",mt:2},children:"Limpiar filtros"}),l.jsx(m.Tooltip,{title:le&&"Crear Solicitud",arrow:!0,placement:"top",disableHoverListener:!le,children:l.jsx("span",{children:l.jsxs(m.Button,{variant:"outlined",sx:{height:40,textTransform:"none",borderColor:"none",color:"#fff",backgroundColor:"#1e5bce","&:hover":{backgroundColor:"#1e5bce",boxShadow:"none"}},onClick:()=>{_?.(t)},disableRipple:!0,children:[l.jsx(Dh,{sx:{color:"#fff",fontSize:24,paddingRight:.6}}),!le&&"Crear Solicitud"]})})})]}),l.jsx(ED,{sections:Ke,detailColumns:[],getDetailColumns:ee,onRowClick:He})]})]})}),l.jsx(m.Menu,{anchorEl:Kt,open:Tr,onClose:()=>Ht(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:l.jsxs(m.Stack,{spacing:1.5,paddingX:1.5,paddingY:1,children:[l.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:700,color:"#070C10"},children:"Filtro"}),l.jsxs(m.Box,{children:[l.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Estatus"}),l.jsx(m.RadioGroup,{value:It,onChange:L=>se(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=>l.jsx(m.FormControlLabel,{value:L,control:l.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),l.jsxs(m.Box,{children:[l.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Actividades"}),l.jsx(m.RadioGroup,{value:Ae,onChange:(L,J)=>je(J),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...U].map(L=>l.jsx(m.FormControlLabel,{value:L,sx:{alignItems:"start"},control:l.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),l.jsxs(m.Box,{children:[l.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Nivel de interés"}),l.jsx(m.RadioGroup,{value:Re,onChange:(L,J)=>yr(J),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...ur].map(L=>l.jsx(m.FormControlLabel,{value:L,control:l.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]})]})})]})]})})}const Th={tableClientes:"_tableClientes_acwe7_1",tableResponsive:"_tableResponsive_acwe7_1"};function Mh(e,r,t){const{fields:n,order:o=["nombreCliente","email","acciones"],header:s={},cells:i={},hide:a={},actions:c}=r,d=c??{},u=d.show??{},f=d.handlers??{},h=d.accessors??{},g=d.icons??{},y=d.className??"d-flex flex-row gap-2 align-items-center ",p=d.tooltip??{},b=g.view??l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",style:{fill:"#070c10"},children:[l.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"}),l.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),_={nombreCliente:{key:"nombreCliente",header:s.nombreCliente??"Cliente",accessor:M=>M[n.nombreCliente],cell:i.nombreCliente,width:190},email:{key:"email",header:s.email??"Correo",accessor:M=>M[n.email],cell:i.email??(M=>{const W=String(M[n.email]??"");return W?l.jsx("a",{href:`mailto:${W}`,children:W}):l.jsx("span",{className:"text-muted",children:"—"})}),width:230},acciones:a.acciones?void 0:{key:"acciones",header:"",cell:i.acciones??(M=>{const W=Nc(u.whatsapp,M,!0),Z=Nc(u.email,M,!0),V=Nc(u.view,M,!0),H=h.phone?.(M),te=h.email?.(M),Y=de=>{if(de.stopPropagation(),f.onWhatsApp)return f.onWhatsApp(M);if(!H)return;const z=h.countryCode??"52",Q=uD(String(H));typeof window<"u"&&window.open(`https://wa.me/${z}${Q}`,"_blank")},N=de=>{if(de.stopPropagation(),f.onEmail)return f.onEmail(M);te&&typeof window<"u"&&(window.location.href=`mailto:${te}`)},ie=de=>{de.stopPropagation(),f.onView&&f.onView(M)};return l.jsxs("div",{className:y,children:[W&&l.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.whatsapp??"WhatsApp",onClick:Y,style:{width:24,height:24},children:l.jsx("img",{src:aD,alt:"WhatsApp"})}),Z&&l.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.email??"Email",onClick:N,style:{width:24,height:24},children:l.jsx("img",{src:cD,alt:"Email"})}),V&&l.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.view??"Ver detalle",onClick:ie,style:{width:24,height:24},children:b})]})}),width:120}},C=Object.values(_).filter(M=>!!M),E=(e??[]).filter(M=>!!M?.key),S=new Map;for(const M of C)S.set(String(M.key),M);for(const M of E)S.set(String(M.key),M);const w=[...C.map(M=>String(M.key)),...E.map(M=>String(M.key))],B=Array.from(new Set(o.map(M=>String(M)).filter(M=>S.has(M)))),A=w.filter(M=>!B.includes(M)),T=[...B,...A],I="acciones";if(S.has(I)){const M=T.filter(W=>W!==I);T.splice(0,T.length,...M,I)}return T.map(M=>S.get(M))}function QD(e){const{rows:r,columns:t,clientSort:n=!0,urlsQA:o=!0,defaultSort:s,minWidth:i=1100,rowKey:a=dD,haveOpenDetailFor:c=!0,defaults:d,detailConfig:u,normalTable:f,onRowClick:h,activityHistory:g,advisorHistory:y,forceOpenDetailFor:p,closeDetailFor:b,onRequestEdit:_,searchFilter:C,solicitudesNuevos:E,solicitudesPrueba:S,solicitudesServicio:w,solicitudesSeminuevos:B,onCreateSolicitud:A,isCrmMode:T,onSolicitudBaseUrl:I,onIframeClose:M,reloadInfo:W,idAdminSistemas:Z=!1}=e,[V,H]=v.useState(s??null),[te,Y]=v.useState({open:!1,customer:null}),[N,ie]=v.useState([]),de=oe=>{Y({open:!0,customer:oe})},z=oe=>{c&&(h?.(oe),Y({open:!0,customer:oe}))},Q=()=>{Y({open:!1,customer:null}),b?.()},Ee=v.useMemo(()=>d?Mh(t??[],d):Mh(t??[],{fields:{},order:[]}),[t,d]),xe=v.useMemo(()=>{if(!n||!V)return r;const oe=Ee.find(re=>re.key===V.key);if(!oe)return r;const ae=[...r];return ae.sort((re,Se)=>{const Ce=Rc(oe,re,0),me=Rc(oe,Se,0),ze=lD(Ce,me);return V.direction==="asc"?ze:-ze}),ae},[r,Ee,V,n]),_e=v.useMemo(()=>{const oe=u?.getCustomerId;return ae=>{const re=oe?.(ae)??ae?.Id_cliente??ae?.CliID??ae?.id??ae?.ID??ae?.Id??"";return String(re)}},[u]);return v.useEffect(()=>{if(!te.open||!te.customer)return;const oe=_e(te.customer);if(!oe)return;const ae=(r??[]).find(re=>_e(re)===oe);ae&&ae!==te.customer&&Y(re=>({...re,customer:ae}))},[r,te.open,te.customer,_e]),v.useEffect(()=>{p&&de(p)},[p]),l.jsxs("div",{children:[l.jsx("div",{className:`${Th.tableClientes} back-white rounded-3 shadow-main mt-4 mb-4`,children:l.jsx("div",{className:`${Th.tableResponsive} table-responsive`,children:l.jsxs("table",{className:"table table-hover align-middle mb-0",children:[l.jsx("thead",{children:l.jsx("tr",{children:Ee.map(oe=>l.jsx("th",{style:{fontWeight:600,width:oe.width,paddingTop:"20px",paddingBottom:"20px",textAlign:oe.align??"left"},children:oe.header},oe.key))})}),l.jsx("tbody",{children:xe.map((oe,ae)=>l.jsx("tr",{onClick:()=>z?.(oe),role:"button",tabIndex:0,onKeyDown:re=>{(re.key==="Enter"||re.key===" ")&&z?.(oe)},style:{cursor:"pointer"},children:Ee.map((re,Se)=>{const Ce=re.Component?l.jsx(re.Component,{row:oe,index:ae}):re.cell?re.cell(oe,ae):(()=>{const me=Rc(re,oe,ae);return me==null||me===""?"":String(me)})();return l.jsx("td",{style:{paddingTop:"20px",paddingBottom:"20px",textAlign:re.align??"left"},children:Ce},`${String(re.key)}-${Se}`)})},a(oe,ae)))})]})})}),te.open&&l.jsx(KD,{open:te.open,onClose:Q,customer:te.customer,fields:u?.dynamicFields,header:u?.header,normalTable:f,history:g,advisorHistory:y,urlsQA:o,onRequestEdit:oe=>{Q(),_?.(oe)},searchFilter:C,solicitudesNuevos:E,solicitudesPrueba:S,solicitudesServicio:w,solicitudesSeminuevos:B,onCreateSolicitud:A,isCrmMode:T,onSolicitudBaseUrl:I,onIframeClose:M,reloadInfo:W,idAdminSistemas:Z})]})}const Ih=K.forwardRef(({sx:e,...r},t)=>l.jsx(m.InputBase,{inputRef:t,...r,sx:{height:48,px:1.5,width:"100%",maxWidth:"none",bgcolor:"#EBEEF0",borderRadius:2,border:"1px solid transparent","&:hover":{borderColor:"transparent"},"& .MuiInputBase-input::placeholder":{opacity:.7},...e}}));Ih.displayName="SoftInput";function JD({message:e}){return e?l.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:[l.jsx(jc,{fontSize:"small",sx:{color:"rgb(211, 47, 47)"}}),l.jsx("span",{style:{color:"rgb(95, 33, 32)",fontSize:14,fontWeight:"500"},children:e})]}):null}function XD(e){if(e.required)return e.required===!0?"El campo es obligatorio.":e.required}function $c(e,r){const t=XD(e);return t?r?.isArray?{required:t,validate:n=>Array.isArray(n)&&n.length>0||t}:{required:t,validate:n=>n!==""&&n!==null&&n!==void 0||t}:{}}const Oh={"& .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%"},ek={mb:1,fontWeight:600,color:"#1C1C1D","&.Mui-focused":{color:"#1C1C1D !important"},"&.Mui-error":{color:"#1C1C1D !important"}};function Bc({label:e,errorMsg:r,helperText:t,children:n,sx:o}){return l.jsxs(m.FormControl,{fullWidth:!0,error:!!r,sx:o,className:"1- FieldWrapper",children:[l.jsx(m.FormLabel,{sx:ek,children:e}),n,l.jsx(JD,{message:r||t})]})}function tk(e,r){const{register:t,formState:{errors:n}}=r,o={...$c(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"]),d=S=>e.onlyNumbers?(S.match(a)??[]).join(""):e.onlyLetters?(S.match(i)??[]).join(""):S,u=(S,w)=>c.has(S)||w?!0:e.onlyNumbers?/^[0-9]$/.test(S):e.onlyLetters?/^[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]$/.test(S):!0,f=n[e.name]?.message,h=t(e.name,o),g=(e.inputProps&&typeof e.inputProps.maxLength=="number"?e.inputProps.maxLength:void 0)??e.maxLength,y=S=>{u(S.key,S.ctrlKey||S.metaKey)||S.preventDefault()},p=S=>{const w=S.data??null;w!=null&&(e.onlyNumbers&&/[^0-9]/.test(w)&&S.preventDefault(),e.onlyLetters&&/[^A-Za-zÁÉÍÓÚÜÑáéíóúüñ ]/.test(w)&&S.preventDefault())},b=S=>{const w=S.clipboardData.getData("text"),B=d(w);if(B!==w){S.preventDefault();const A=S.target,T=A.selectionStart??A.value.length,I=A.selectionEnd??A.value.length;A.setRangeText(B,T,I,"end"),A.dispatchEvent(new Event("input",{bubbles:!0}))}},_=S=>{const w=d(S.target.value);w!==S.target.value&&(S.target.value=w),g&&S.target.value.length>g&&(S.target.value=S.target.value.slice(0,g)),h.onChange(S)},C={...e.inputProps,...s?{inputMode:"email",autoComplete:"email"}:{},maxLength:g,onKeyDown:y,onBeforeInput:p,onPaste:b,onInvalid:S=>S.preventDefault()},E=e.onlyNumbers||s?"text":e.type??"text";return l.jsx(Bc,{label:e.label,errorMsg:f,helperText:e.helperText,sx:Oh,children:l.jsx(Ih,{placeholder:e.placeholder,type:E,inputProps:C,...h,onChange:_,sx:{width:"100%",maxWidth:"none"},className:"SoftInputData"})})}function rk(e,r){const{control:t}=r,n=!!e.multiple;return l.jsx(Ar,{name:e.name,control:t,rules:$c(e,{isArray:n}),render:({field:o,fieldState:s})=>l.jsx(Bc,{label:e.label,errorMsg:s.error?.message,helperText:e.helperText,sx:Oh,children:l.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&&l.jsx(m.MenuItem,{value:"",disabled:!0,children:"Selecciona…"}),e.options.map(i=>l.jsx(m.MenuItem,{value:i.value,children:i.label},String(i.value)))]})})})}function nk(e,r){return l.jsx(Ar,{name:e.name,control:r.control,rules:$c(e),render:({field:t,fieldState:n})=>l.jsx(Bc,{label:e.label,errorMsg:n.error?.message,helperText:e.helperText,children:l.jsx(m.RadioGroup,{row:!0,...t,className:"3-RadioFieldRender",children:e.options.map(o=>l.jsx(m.FormControlLabel,{value:o.value,control:l.jsx(m.Radio,{}),label:o.label},String(o.value)))})})})}function jh(e,r){if(e.render)return e.render(r);switch(e.kind){case"text":return tk(e,r);case"select":return rk(e,r);case"radio":return nk(e,r);default:return null}}function ok(e,{initialPerPage:r=25,perPageOptions:t=[10,25,50,100,"Todos"],onPageChange:n,onPerPageChange:o,scrollTop:s,deps:i=[]}={}){const a=Array.isArray(e)?e:[],[c,d]=v.useState(1),[u,f]=v.useState(r),{currentItems:h,totalPages:g,showingFrom:y,showingTo:p,totalItems:b}=v.useMemo(()=>{const E=a.length,S=u==="Todos"?1/0:Number(u),w=S===1/0?1:Math.max(1,Math.ceil(E/S)),B=Math.min(c,w),A=S===1/0?E:B*S,T=S===1/0?0:A-S;return{currentItems:S===1/0?a:a.slice(T,A),totalPages:w,showingFrom:E===0?0:T+1,showingTo:S===1/0?E:Math.min(A,E),totalItems:E}},[a,c,u]),_=E=>{const S=Math.max(1,Math.min(E,g||1));d(S),n?.(S),s?.()};return{currentItems:h,totalPages:g,showingFrom:y,showingTo:p,totalItems:b,currentPage:c,itemsPerPage:u,perPageOptions:t,goTo:_,next:()=>_(c+1),prev:()=>_(c-1),setItemsPerPage:E=>{f(E),o?.(E),d(1),s?.()},setCurrentPage:_}}var is={},Ph;function sk(){if(Ph)return is;Ph=1;var e=at();Object.defineProperty(is,"__esModule",{value:!0}),is.default=void 0;var r=e(pt()),t=ut();return is.default=(0,r.default)((0,t.jsx)("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"NavigateBefore"),is}var ik=sk();const ak=it(ik);var as={},Rh;function ck(){if(Rh)return as;Rh=1;var e=at();Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var r=e(pt()),t=ut();return as.default=(0,r.default)((0,t.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"NavigateNext"),as}var lk=ck();const uk=it(lk),dk=({currentPage:e,totalPages:r,onPageChange:t,itemsPerPage:n,onItemsPerPageChange:o,itemsPerPageOptions:s,showingFrom:i,showingTo:a,totalItems:c})=>{const d=m.useTheme(),u=m.useMediaQuery(d.breakpoints.down("sm")),f=()=>{if(r<=1)return[1];const y=u?0:2,p=[],b=1,_=r,C=Math.max(b+1,e-y),E=Math.min(_-1,e+y);p.push(b),C>b+1&&p.push("...");for(let S=C;S<=E;S++)S>=b+1&&S<=_-1&&p.push(S);return E<_-1&&p.push("..."),p.push(_),p},h=y=>{const p=y.target.value;o(p)},g=Math.max(1,r);return l.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:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"center"},children:[l.jsx(m.IconButton,{onClick:()=>t(e-1),disabled:e<=1,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página anterior",children:l.jsx(ak,{fontSize:"large"})}),f().map((y,p)=>y==="..."?l.jsx(m.Box,{sx:{px:1,display:"flex",alignItems:"center",fontSize:"1.1rem"},children:". . ."},`dots-${p}`):l.jsx(m.Button,{onClick:()=>t(y),size:"small",sx:{minWidth:36,height:36,fontSize:"1.05rem",p:1,borderRadius:"10px",backgroundColor:e===y?"primary.main":"transparent",fontWeight:e===y?700:400,color:e===y?"#fff":"#5C6372","&:hover":{backgroundColor:e===y?"primary.dark":"action.hover"},boxShadow:"none",border:"none",mx:.5},children:y},`p-${y}`)),l.jsx(m.IconButton,{onClick:()=>t(e+1),disabled:e>=g,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página siguiente",children:l.jsx(uk,{fontSize:"large"})})]}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1.25,justifyContent:{xs:"center",sm:"flex-start"},mt:{xs:1,sm:0}},children:[l.jsx(m.Typography,{variant:"body2",children:"Mostrar"}),l.jsx(m.FormControl,{size:"small",sx:{minWidth:72},children:l.jsx(m.Select,{value:n,onChange:h,renderValue:y=>y==="Todos"?"Todos":String(y),children:s.map(y=>l.jsx(m.MenuItem,{value:y,children:y==="Todos"?"Todos":y},String(y)))})}),l.jsx(m.Typography,{variant:"body2",children:"por página"})]})]})};function fk(e){const{open:r,dataAdd:t,fields:n,onSubmit:o,onCancel:s,defaultValues:i,txtBtnGuardar:a,haveId:c=!1,itemsTable:d,filter:u,getId:f,renderRow:h,selectedIds:g,onSelectedChange:y,onSubmitAddData:p,initialSelectedIds:b=[],showAutosPanel:_}=e,C=qp({mode:"onSubmit",reValidateMode:"onChange",criteriaMode:"all",shouldUnregister:!1,defaultValues:i});v.useEffect(()=>{i&&C.reset(i)},[i,C]);const[E,S]=v.useState(""),[w,B]=v.useState(b),A=Array.isArray(g)&&!!y,T=A?g:w,I=j=>{const G=typeof j=="function"?j(T):j;A?y(G):B(G)},M=v.useCallback(j=>f?f(j):j?.IdAuto,[f]),W=v.useMemo(()=>{const j=new Map;return(d??[]).forEach((G,pe)=>j.set(M(G),pe)),j},[d,M]),Z=v.useRef(new Set),V=v.useMemo(()=>{const j=new Map;return(d??[]).forEach(G=>j.set(f?f(G):G?.IdAuto,G)),j},[d,f]),H=v.useMemo(()=>(n??[]).filter(j=>!!j.required).map(j=>j.name),[n]),te=Tp({control:C.control,name:H}),Y=j=>j==null?!1:typeof j=="string"?j.trim().length>0:Array.isArray(j)?j.length>0:typeof j=="number"?!Number.isNaN(j):typeof j=="object"?Object.keys(j).length>0:!0,N=v.useMemo(()=>H.length?te?.every(Y)??!1:!0,[te,H]),{handleSubmit:ie,formState:{isSubmitting:de,isDirty:z,isValid:Q}}=C,Ee=u??((j,G)=>JSON.stringify(j).toLowerCase().includes(G.toLowerCase())),xe=v.useMemo(()=>E.trim()?d?.filter(j=>Ee(j,E)):d,[d,E,Ee]),_e=v.useMemo(()=>{if(!xe)return xe;const j=Z.current,G=[...xe];return G.sort((pe,Oe)=>{const P=j.has(M(pe))?0:1,X=j.has(M(Oe))?0:1;if(P!==X)return P-X;const we=W.get(M(pe))??0,qe=W.get(M(Oe))??0;return we-qe}),G},[xe,W,M]),{currentItems:oe,totalPages:ae,showingFrom:re,showingTo:Se,totalItems:Ce,currentPage:me,itemsPerPage:ze,perPageOptions:R,goTo:Le,setItemsPerPage:Ge}=ok(_e,{initialPerPage:25,perPageOptions:[10,25,50,100,"Todos"],deps:[E],scrollTop:()=>{}}),Ze=j=>{const G=V.get(j)??null;I([j]),p?.({items:G})},Ie=j=>T.includes(j),st=async j=>{try{await o?.(j),C.reset(C.getValues())}catch(G){console.error("Error al enviar AddCliente:",G)}},$e=v.useMemo(()=>{const j=new Map;return(n??[]).forEach(G=>j.set(String(G.name),G)),j},[n]),De=(j,G)=>{const pe=$e.get(String(j));if(!pe)return null;const Oe={xs:12,...pe.grid,...G||{}};return l.jsx(m.Grid,{item:!0,...Oe,children:pe.render?pe.render(C):jh(pe,C)},`fld-${String(j)}`)},D=_??(e.haveId?"edit":"new"),O=D!=="onlyCars",F=D==="new"||D==="onlyCars",ce=T?.length>0,ne=D==="onlyCars"?ce:e.haveId?N&&z||ce:N&&ce;return l.jsx(m.Dialog,{open:r,onClose:s,maxWidth:"lg",fullWidth:!0,PaperProps:{sx:{height:{xs:"100dvh",md:F?"90vw":"auto"},maxWidth:{xs:"100vw",md:F?"98vw":"50%"},overflow:"hidden",display:"flex",flexDirection:"column",borderRadius:{xs:0,md:3}}},children:l.jsx(TE,{...C,children:l.jsxs(m.Box,{component:"form",noValidate:!0,onSubmit:ie(st),display:"flex",flexDirection:{xs:"column",md:"row"},width:"100%",height:"100%",minHeight:0,overflow:"hidden",position:"relative",children:[O&&l.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:[l.jsxs(m.Box,{p:{xs:2,md:2},height:"100%",width:"100%",children:[l.jsx(m.Typography,{fontWeight:700,fontSize:20,children:t.title}),l.jsxs(m.Box,{sx:{flex:1,height:"100%",overflowY:"auto",paddingBottom:10},children:[l.jsx(m.Typography,{fontSize:"18px",mt:2.5,fontWeight:500,children:t.subTitle}),l.jsx(m.Box,{mt:2,display:"flex",flexDirection:"column",width:"100%",gap:2,children:Array.isArray(e.formLayout)&&c?e.formLayout.map((j,G)=>l.jsx(m.Grid,{container:!0,spacing:2,alignItems:"flex-start",wrap:"wrap",width:"100%",children:j.map((pe,Oe)=>{const P=typeof pe=="string"?{name:pe}:pe;return P.hidden?.(C)?null:De(P.name,P.grid)})},`row-${G}`)):l.jsx(m.Grid,{container:!0,spacing:2,width:"100%",children:n?.map((j,G)=>{const pe=j.grid??{xs:12,md:12};return l.jsx(m.Grid,{item:!0,...pe,children:j.render?j.render(C):jh(j,C)},`${String(j.name)}-${G}`)})})})]})]}),l.jsx(m.Box,{sx:{position:"absolute",zIndex:j=>j.zIndex.modal+1,bottom:0,width:"100%",borderRadius:2,boxShadow:{xs:"0",md:"0 -8px 8px -6px #0003"},p:1,backgroundColor:"#fff"},children:l.jsx(m.Box,{display:"flex",alignItems:"center",children:l.jsx(m.Box,{display:"flex",gap:1.5,width:"100%",justifyContent:c?"flex-end":"center",children:l.jsx(m.Button,{type:"submit",variant:"contained",disabled:de||!ne,sx:{backgroundColor:"#336BE1",color:"#fff",borderColor:"transparent",height:48,fontSize:15,textTransform:"none",fontWeight:"400",paddingX:5,width:c?"160px":"100%"},children:a})})})})]}),F&&l.jsx(m.Box,{flex:1,display:"flex",flexDirection:"column",minWidth:0,sx:{height:"100%"},children:l.jsx(m.Box,{mt:1,sx:{flex:1,display:"flex",flexDirection:"column",height:"100%"},children:l.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[l.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:[l.jsx(m.TextField,{value:E,onChange:j=>S(j.target.value),placeholder:"Buscar marca, modelo, vin...",InputProps:{endAdornment:l.jsx(m.InputAdornment,{position:"start",children:l.jsx(c2,{})}),disableUnderline:!0},variant:"standard",sx:{maxWidth:360,width:"100%",backgroundColor:"#EBEEF0",paddingX:"16px",paddingY:"10px"}}),l.jsx(m.Box,{display:"flex",gap:2,alignItems:"center",sx:{marginTop:{sm:0,xs:2}},children:l.jsx(m.Box,{onClick:s,sx:{cursor:"pointer",position:"absolute",top:0,right:10},display:{xs:"none",md:"block"},children:l.jsx(Cr,{sx:{color:"#070C10",fontSize:24}})})}),_=="onlyCars"&&l.jsx(m.Box,{display:"flex",alignItems:"center",justifyContent:"center",children:l.jsx(m.Box,{display:"flex",gap:1.5,width:"100%",children:l.jsxs(m.Button,{type:"submit",variant:"contained",disabled:de||!ne,sx:{backgroundColor:"#336BE1",color:"#fff",borderColor:"transparent",height:48,fontSize:15,textTransform:"none",fontWeight:"400",paddingX:5,width:"100%"},children:[l.jsx(Dh,{sx:{color:de||!ne?"gray":"#fff",fontSize:26,paddingRight:.6}}),"Crear Solicitud"]})})})]}),l.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:l.jsx(m.Box,{sx:{minWidth:1150,width:"max(1150px, 100%)",paddingBottom:10},children:l.jsxs(m.List,{disablePadding:!0,sx:{borderColor:"transparent",padding:0},children:[oe?.map((j,G)=>{const pe=f?f(j):G,Oe=Ie(pe);return l.jsx(m.Box,{sx:{borderBottom:"1px solid #D3D4D5",padding:0},children:l.jsx(m.ListItem,{disableGutters:!0,sx:{paddingTop:0,padding:0,m:0},children:l.jsx(m.ListItemButton,{onClick:()=>Ze(pe),disableRipple:!0,sx:{padding:0},children:l.jsx(m.ListItemText,{disableTypography:!0,primary:h?h({item:j,selected:Oe,toggle:()=>Ze(pe),index:G}):null})})})},`${String(pe)}`)}),!oe?.length&&l.jsx(m.Box,{p:3,children:l.jsxs(m.Typography,{fontSize:14,color:"#5C6372",children:["Sin resultados para “",E,"”."]})})]})})}),l.jsx(m.Box,{sx:{position:"sticky",bottom:0,bgcolor:"#fff"},children:l.jsx(dk,{currentPage:me,totalPages:ae,onPageChange:Le,itemsPerPage:ze,onItemsPerPageChange:Ge,itemsPerPageOptions:R,showingFrom:re,showingTo:Se,totalItems:Ce})})]})})})]})})})}var cs={},Nh;function pk(){if(Nh)return cs;Nh=1;var e=at();Object.defineProperty(cs,"__esModule",{value:!0}),cs.default=void 0;var r=e(pt()),t=ut();return cs.default=(0,r.default)((0,t.jsx)("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6z"}),"AttachFile"),cs}var hk=pk();const mk=it(hk),Fc=/^[^\s@]+@[^\s@]+\.[^\s@]+$/i,Ui=/[,\s;]+/g,cn=e=>e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase(),ln=(e,r)=>Array.from(new Set([...e,...r.map(t=>t.trim()).filter(Boolean)])),zh=(e,r)=>r?e.filter(t=>cn(t)!==cn(r)):e,gk=(e,r)=>e.filter(t=>!r.some(n=>cn(n)===cn(t)));function kr(e,r,t){if(t)return typeof t=="function"?t(e,r):e[t]}function vk(e,r){if(r)return!e||/^https?:\/\//i.test(r)?r:e+r}function yk({open:e,onClose:r,value:t,onChange:n,onRequestSend:o,customer:s,itemsSelects:i,renderItem:a,filterFields:c=[],multiSelectAutos:d=!0,imgCorreoSrc:u,baseURLImages:f,itemProps:h,defaultItemImageSrc:g}){const y=v.useRef(null),[p,b]=v.useState("idle"),_=v.useRef(e);v.useEffect(()=>{const P=_.current;e&&!P&&b("entering"),!e&&P&&b("exiting"),_.current=e},[e]),v.useEffect(()=>{if(p==="entering"){const we=setTimeout(()=>b("idle"),320);return()=>clearTimeout(we)}if(p==="exiting"){const we=setTimeout(()=>b("idle"),220);return()=>clearTimeout(we)}},[p]);const[C,E]=v.useState(""),[S,w]=v.useState(!1),[B,A]=v.useState(!1),[T,I]=v.useState(!1),[M,W]=v.useState(""),[Z,V]=v.useState([]),H=T?Z:t.selectedIds,te=()=>{V([...t.selectedIds]),W(""),I(!0)},Y=()=>{I(!1),V([])},N=()=>{const P=new Set($e.map((we,qe)=>String(kr(we,qe,h.id)))),X=Z.filter(we=>P.has(String(we)));n({...t,selectedIds:X}),I(!1)},ie=(P,X)=>cn(P??"")===cn(X??"");function de(P,X,we,qe,St){const gt=X?P.some(Ht=>ie(Ht,X)):!1,Kt=we.length>0?we.some(Ht=>P.some(Tr=>ie(Tr,Ht))):!1;qe(gt),St(Kt)}const z=P=>{const X=typeof P=="function"?P(t.recipients):P;n({...t,recipients:X}),de(X,oe,re,w,A)},Q=P=>n({...t,message:P}),Ee=P=>n({...t,attachments:[...t.attachments,...P]}),xe=P=>n({...t,attachments:t.attachments.filter(X=>X.name!==P)}),_e=P=>{if(T)if(d){const X=new Set(Z);X.has(P)?X.delete(P):X.add(P),V(Array.from(X))}else{const X=Z.includes(P);V(X?[]:[P])}else if(d){const X=new Set(t.selectedIds);X.has(P)?X.delete(P):X.add(P),n({...t,selectedIds:Array.from(X)})}else{const X=t.selectedIds.includes(P);n({...t,selectedIds:X?[]:[P]})}},oe=v.useMemo(()=>(s?.Correo??"").trim(),[s]),ae=v.useMemo(()=>Array.isArray(s?.Asesores)?s.Asesores.filter(P=>P?.EmailAsesor&&P?.Activo):[],[s]),re=v.useMemo(()=>ae.map(P=>(P.EmailAsesor??"").trim()).filter(Boolean),[ae]),Se=v.useRef(!1);v.useEffect(()=>{if(e&&!Se.current){let P=[];S&&oe&&(P=ln(P,[oe])),B&&re.length&&(P=ln(P,re)),z(X=>ln(X,P)),de(t.recipients,oe,re,w,A),E(""),Se.current=!0}e||(Se.current=!1)},[e,S,B,oe,re]);const Ce=P=>{const X=ae.find(we=>cn(we.EmailAsesor??"")===cn(P));if(X){if(X.ImgAsesor)return l.jsx(m.Avatar,{src:X.ImgAsesor,alt:X.NombreAsesor});const we=(X.NombreAsesor||"").trim(),qe=(X.ApellidosAsesor||"").trim();return l.jsx(m.Avatar,{children:`${we[0]??""}${qe[0]??""}`.toUpperCase()})}return l.jsx(m.Avatar,{children:P[0]?.toUpperCase()})},me=()=>{const P=C.trim();if(!P)return;const we=P.split(Ui).filter(Boolean).filter(qe=>Fc.test(qe));we.length>0&&z(qe=>ln(qe,we)),E("")},ze=P=>{w(P),z(X=>P&&oe?ln(X,[oe]):zh(X,oe))},R=P=>{A(P),z(X=>P?ln(X,re):gk(X,re))},Le=P=>{const X=Array.from(P.target.files||[]);Ee(X.map(we=>({name:we.name,size:we.size,file:we}))),P.target.value=""},Ge=H[0],Ze=v.useMemo(()=>!i||Ge===void 0?void 0:i.find((X,we)=>String(kr(X,we,h.id))===String(Ge)),[i,Ge,h.id]),Ie=v.useMemo(()=>{if(!(!Ze||!h.distributorId))return kr(Ze,0,h.distributorId)},[Ze,h.distributorId]);console.log("lockedDisId",Ie);const st=v.useMemo(()=>Ze?(h.distributorTitle?kr(Ze,0,h.distributorTitle):void 0)??(Ie!=null?String(Ie):void 0):void 0,[Ze,h.distributorTitle,Ie]),$e=v.useMemo(()=>{const P=i??[];return Ie==null||!h.distributorId?P:P.filter((X,we)=>kr(X,we,h.distributorId)==Ie)},[i,Ie,h.distributorId]),De=v.useMemo(()=>{if(!M.trim())return $e;const P=M.toLowerCase();return $e.filter(X=>(c??[]).some(we=>String(X?.[we]??"").toLowerCase().includes(P)))},[$e,M,c]),D=v.useMemo(()=>{if(!i||!t.selectedIds.length)return[];const P=new Map;return i.forEach((X,we)=>{P.set(String(kr(X,we,h.id)),X)}),t.selectedIds.map(X=>P.get(String(X))).filter(Boolean)},[i,t.selectedIds,h.id]),O=P=>n({...t,selectedIds:t.selectedIds.filter(X=>String(X)!==String(P))}),F=()=>{let P=t.recipients;if(C.trim()){const gt=C.split(Ui).filter(Kt=>Fc.test(Kt));P=ln(P,gt),z(P),E("")}const X=S?oe:"",we=ae.find(gt=>gt?.Activo&&gt?.EmailAsesor)?.EmailAsesor?.trim()??"";o?.({recipients:P,toClient:S,toAdvisor:B,tipoInt:S&&B?2:1,correoCliente:X,correoAsesor:B?we:"",disIdLocked:Ie}),r?.()},ce=v.useMemo(()=>{const X=C.split(Ui).filter(Boolean).some(we=>Fc.test(we));return t.recipients.length>0||X},[t.recipients,C]),ne=(t.selectedIds?.length??0)>0,j=t.message.trim().length>0,G=ce&&ne&&j,pe=m.useTheme(),Oe=m.useMediaQuery(pe.breakpoints.down("sm"));return l.jsxs(m.Drawer,{anchor:Oe?"bottom":"right",open:e,onClose:r,ModalProps:{keepMounted:!0,BackdropProps:{invisible:!Oe}},transitionDuration:{enter:320,exit:220},SlideProps:{direction:Oe?"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:[l.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",height:{xs:"100%",sm:"auto"},position:"relative",overflow:"auto"},children:[l.jsxs(m.Box,{sx:{p:2,pb:1,position:"sticky",top:0,zIndex:1,bgcolor:"#fff",borderBottom:"1px solid #E5E7EB"},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:2},children:[u?l.jsx("img",{src:u,alt:"Correo",style:{width:24,height:18}}):null,l.jsxs(m.Typography,{fontWeight:700,children:["Mensaje a"," ",s?`${s.Nombre??""} ${s.ApellidoP??""} ${s.ApellidoM??""}`.trim():"—"]})]}),l.jsx(m.IconButton,{onClick:r,size:"small",children:l.jsx(Cr,{})})]}),l.jsx("div",{children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 10px",backgroundColor:"#EBEEF0",border:"1px solid #E5E7EB",borderRadius:8,flexWrap:"wrap"},children:[l.jsx("label",{style:{fontSize:14,fontWeight:600,marginRight:4},children:"Para:"}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",flex:1},children:[t.recipients.map(P=>l.jsx(m.Chip,{avatar:Ce(P),label:P,onDelete:()=>z(X=>zh(X,P)),size:"small",variant:"outlined",sx:{borderRadius:999,height:28}},P)),l.jsx("input",{type:"text",value:C,onChange:P=>E(P.target.value),onKeyDown:P=>{const X=P.key;X==="Enter"||X===","||X===";"||X===" "||X==="Tab"?(P.preventDefault(),me()):X==="Backspace"&&!C&&t.recipients.length&&z(qe=>qe.slice(0,-1))},onBlur:me,onPaste:P=>{const we=P.clipboardData.getData("text").split(Ui).filter(Boolean);we.length>1&&(P.preventDefault(),z(qe=>ln(qe,we)),E(""))},placeholder:t.recipients.length?"":"correo@ejemplo.com",style:{flex:1,minWidth:140,border:"none",outline:"none",background:"transparent",fontSize:14,color:"#111827",padding:"4px 0"}})]})]})}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:2,mb:1.5},children:[l.jsx(m.FormControlLabel,{control:l.jsx(m.Checkbox,{checked:S,onChange:P=>ze(P.target.checked),size:"small"}),label:"Cliente"}),ae.length!==0&&l.jsx(m.FormControlLabel,{control:l.jsx(m.Checkbox,{checked:B,onChange:P=>R(P.target.checked),size:"small"}),label:`Asesor${ae.length>1?"es":""}`})]})]}),l.jsx(m.Divider,{}),l.jsxs(m.Box,{p:2,children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},onClick:te,children:[l.jsx(m.Typography,{fontSize:12,fontWeight:600,sx:{textDecorationLine:"underline",cursor:"pointer"},children:"Selecciona el auto de seguimiento"}),st!=null&&l.jsx(m.Chip,{size:"small",label:`Distribuidora: ${st}`})]}),D.length>0?l.jsx(m.Box,{sx:{mt:1.5,display:"flex",gap:1,flexWrap:"wrap"},children:D.map((P,X)=>{const we=kr(P,X,h.id),qe=kr(P,X,h.title)??"",St=kr(P,X,h.image),gt=vk(f,St);return l.jsx(m.Chip,{onDelete:()=>O(we),label:l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.jsx(m.Box,{sx:{width:28,height:20,borderRadius:.8,bgcolor:"#e5e6e8",overflow:"hidden",flex:"0 0 auto"},children:gt?l.jsx("img",{src:gt,alt:qe,style:{width:"100%",height:"100%",objectFit:"cover"}}):l.jsx("img",{src:g,alt:qe,style:{width:"100%",height:"100%",objectFit:"cover"}})}),l.jsx("span",{style:{fontSize:12},children:l.jsx("b",{children:qe})})]}),sx:{pl:.5,pr:.3,py:.2,borderRadius:2,".MuiChip-deleteIcon":{fontSize:18}},variant:"outlined"},String(we))})}):l.jsx(m.Typography,{fontSize:13,color:"#5C6372",sx:{mt:.5},children:"Aún no has seleccionado autos."})]}),l.jsx(m.Divider,{}),l.jsxs(m.Box,{sx:{p:2},children:[l.jsx(m.TextField,{placeholder:"Escribe aquí tu mensaje...",value:t.message,onChange:P=>Q(P.target.value),multiline:!0,minRows:6,fullWidth:!0,sx:{mb:1.5}}),t.attachments.length>0&&l.jsx(m.List,{dense:!0,sx:{display:"flex",flexDirection:"column",gap:2,border:"none"},children:t.attachments.map(P=>l.jsxs(m.ListItem,{sx:{px:0,background:"#EAEBF2",borderRadius:2,paddingX:1},children:[l.jsx(m.ListItemText,{style:{gap:10,fontSize:15,color:"#5285F7",display:"flex",flexWrap:"wrap",flex:"none"},primary:P.name,secondary:P.size<1024?`${P.size} b`:P.size<1024*1024?`${(P.size/1024).toFixed(0)} kb`:`${(P.size/(1024*1024)).toFixed(1)} MB`,secondaryTypographyProps:{sx:{fontSize:12,color:"#64748B",fontWeight:500,mt:.25}},primaryTypographyProps:{noWrap:!0,width:"auto"}}),l.jsx(m.Tooltip,{title:"Quitar",children:l.jsx(m.IconButton,{edge:"end",onClick:()=>xe(P.name),size:"small",children:l.jsx(Cr,{fontSize:"small"})})})]},P.name))})]}),l.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:[l.jsx("input",{ref:y,hidden:!0,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.mp4,.pdf,.xlsx,.csv,.docx,.pptx,.txt",onChange:Le}),l.jsx(m.Button,{startIcon:l.jsx(mk,{}),variant:"text",onClick:()=>y.current?.click(),sx:{color:"#5C6372"},children:"Adjuntar archivo"}),l.jsx(m.Box,{sx:{flex:1}}),l.jsx(m.Button,{variant:"contained",onClick:F,disabled:!G,sx:{maxWidth:146,width:"100%",height:53,backgroundColor:"#336BE1"},children:"Enviar"})]})]}),l.jsxs(m.Dialog,{fullWidth:!0,maxWidth:"sm",fullScreen:Oe,open:T,onClose:Y,children:[l.jsxs(m.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:1},children:["Selecciona tu auto de seguimiento",l.jsx(m.IconButton,{onClick:Y,size:"small",children:l.jsx(Cr,{})})]}),l.jsxs(m.DialogContent,{children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.jsx(m.TextField,{placeholder:"Buscar...",fullWidth:!0,size:"small",value:M,onChange:P=>W(P.target.value),sx:{mb:2}}),st!=null&&l.jsx(m.Chip,{size:"small",label:`Distribuidora: ${st}`})]}),l.jsxs(m.Typography,{variant:"caption",fontWeight:600,children:["RESULTADOS (",De.length,")"]}),l.jsxs(m.List,{sx:{p:0},children:[De.map((P,X)=>{const we=kr(P,X,h.id),qe=H.includes(String(we))||H.includes(we),St=Ie==null||kr(P,X,h.distributorId)==Ie;return l.jsx(m.ListItem,{disableGutters:!0,sx:{p:0,opacity:St?1:.5},children:l.jsx(m.Box,{onClick:()=>St&&_e(we),sx:{cursor:St?"pointer":"not-allowed",p:.5,backgroundColor:qe?"#e5f0ff":"transparent",width:"100%",borderBottom:"solid 1px #D3D4D5"},children:a?a(P,X):l.jsx("pre",{style:{margin:0},children:JSON.stringify(P,null,2)})})},String(we))}),De.length===0&&l.jsx(m.Box,{p:2,children:l.jsx(m.Typography,{children:"Tu búsqueda no generó resultados"})})]})]}),l.jsxs(m.DialogActions,{sx:{px:3,pb:2},children:[l.jsx(m.Button,{variant:"text",onClick:Y,sx:{color:"#5C6372"},children:"Cancelar"}),l.jsx(m.Button,{variant:"contained",onClick:N,sx:{backgroundColor:"#336BE1"},children:"Guardar selección"})]})]})]})}jt.AddCliente=fk,jt.ApiProvider=ax,jt.AuthProvider=N2,jt.Clientes=QD,jt.CustomSnackbar=Pc,jt.EventsProvider=JA,jt.ModalCorreo=yk,jt.MyCalendar=iD,jt.useAuth=Ha,jt.useAuthRepository=bi,jt.useEventRepository=bc,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.75",
4
+ "version": "0.2.76",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",