import{c as ge,r as x,j as n,a as J,L as pe,t as R,g as os,u as To}from"./index-DiwDH9aE.js";import{u as Ne,U as Jn}from"./useStudentRegistration-By0cAFYN.js";import{u as Pa}from"./cycleStore-Brm22ojq.js";import{u as Le,a as Oe,h as Ze,C as Vs}from"./handleFormErrors-CaWHVJ6Q.js";import{E as U,I as oe,o as Ao,b as ko}from"./schemas-BwNPnT22.js";import{B as ne}from"./Button-Cu8l7rID.js";import{a as Do,M as Ta,b as _o,d as Eo,e as Mo,f as Vo,p as Ro,c as Io,g as Fo}from"./studentRegistrationSchemas-CVTP24QO.js";import{L as Aa,I as Rs}from"./registerService-CxQfNS19.js";import{C as Se}from"./circle-alert-B4Iu_AWZ.js";import{U as Re}from"./user-Dm-qAtiL.js";import{C as ka,G as Ct}from"./graduation-cap-B3zNhUOw.js";import{P as Zt}from"./phone-DYXWN0h8.js";import{S as Je,M as Da,P as Lo}from"./Modal-tocKJOcW.js";import{S as Is}from"./SearchableSelect-DESVOSo4.js";import{u as Qe}from"./useShared-C-dQZUur.js";import{H as ls,B as Oo,L as Bo}from"./log-out-C3ghZd_W.js";import{M as _a}from"./map-pin-C8p0ntE-.js";import{U as Fs}from"./users-BLfoITz0.js";import{T as Ls,C as zo,a as Os}from"./ConfirmModal-mJDwNEXB.js";import{S as fn}from"./school-CCnutwvi.js";import{I as pn,T as Ea,a as $o,C as Uo}from"./triangle-alert-BxjRBxgM.js";import{C as De}from"./circle-check-big-CvbUXdGb.js";import"./multiUserApiClient-CKPzIhIr.js";import{F as we}from"./file-text-DgWlhdmN.js";import{E as Gt}from"./eye-Dp7PbQrC.js";import{S as We}from"./shield-Beyfz6Tk.js";import{T as Go}from"./trending-up-CtUJlxeB.js";import{C as Wo}from"./clock-BPH_g82s.js";import{C as Qn}from"./x-D4vgwdOf.js";import"./authService-7ekyJsWC.js";import"./endpoints-BUXROgJ9.js";import"./chevron-down-4ep2ftiY.js";import"./search-h1vL1q1e.js";/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ko=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],Ho=ge("briefcase",Ko);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Yo=ge("circle-check",qo);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xo=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Xe=ge("credit-card",Xo);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zo=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Bs=ge("dollar-sign",Zo);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jo=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Qo=ge("download",Jo);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const el=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]],cs=ge("file-check",el);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tl=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],sl=ge("hash",tl);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nl=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],rl=ge("heart",nl);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const al=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],il=ge("image",al);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ol=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],ll=ge("lock-open",ol);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cl=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],dl=ge("send",cl);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ul=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],ml=ge("tag",ul);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hl=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Wt=ge("upload",hl),gn=x.createContext({});function xn(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const yn=typeof window<"u",Ma=yn?x.useLayoutEffect:x.useEffect,ns=x.createContext(null);function bn(e,t){e.indexOf(t)===-1&&e.push(t)}function vn(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}const _e=(e,t,s)=>s>t?t:s<e?e:s;let jn=()=>{};const Ee={},Va=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ra(e){return typeof e=="object"&&e!==null}const Ia=e=>/^0[^.\s]+$/u.test(e);function wn(e){let t;return()=>(t===void 0&&(t=e()),t)}const be=e=>e,fl=(e,t)=>s=>t(e(s)),Et=(...e)=>e.reduce(fl),Pt=(e,t,s)=>{const r=t-e;return r===0?1:(s-e)/r};class Nn{constructor(){this.subscriptions=[]}add(t){return bn(this.subscriptions,t),()=>vn(this.subscriptions,t)}notify(t,s,r){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](t,s,r);else for(let o=0;o<a;o++){const i=this.subscriptions[o];i&&i(t,s,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ce=e=>e*1e3,Pe=e=>e/1e3;function Fa(e,t){return t?e*(1e3/t):0}const La=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,pl=1e-7,gl=12;function xl(e,t,s,r,a){let o,i,l=0;do i=t+(s-t)/2,o=La(i,r,a)-e,o>0?s=i:t=i;while(Math.abs(o)>pl&&++l<gl);return i}function Mt(e,t,s,r){if(e===t&&s===r)return be;const a=o=>xl(o,0,1,e,s);return o=>o===0||o===1?o:La(a(o),t,r)}const Oa=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ba=e=>t=>1-e(1-t),za=Mt(.33,1.53,.69,.99),Sn=Ba(za),$a=Oa(Sn),Ua=e=>(e*=2)<1?.5*Sn(e):.5*(2-Math.pow(2,-10*(e-1))),Cn=e=>1-Math.sin(Math.acos(e)),Ga=Ba(Cn),Wa=Oa(Cn),yl=Mt(.42,0,1,1),bl=Mt(0,0,.58,1),Ka=Mt(.42,0,.58,1),vl=e=>Array.isArray(e)&&typeof e[0]!="number",Ha=e=>Array.isArray(e)&&typeof e[0]=="number",jl={linear:be,easeIn:yl,easeInOut:Ka,easeOut:bl,circIn:Cn,circInOut:Wa,circOut:Ga,backIn:Sn,backInOut:$a,backOut:za,anticipate:Ua},wl=e=>typeof e=="string",er=e=>{if(Ha(e)){jn(e.length===4);const[t,s,r,a]=e;return Mt(t,s,r,a)}else if(wl(e))return jl[e];return e},It=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Nl(e,t){let s=new Set,r=new Set,a=!1,o=!1;const i=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(d){i.has(d)&&(u.schedule(d),e()),d(l)}const u={schedule:(d,m=!1,h=!1)=>{const g=h&&a?s:r;return m&&i.add(d),g.has(d)||g.add(d),d},cancel:d=>{r.delete(d),i.delete(d)},process:d=>{if(l=d,a){o=!0;return}a=!0,[s,r]=[r,s],s.forEach(c),s.clear(),a=!1,o&&(o=!1,u.process(d))}};return u}const Sl=40;function qa(e,t){let s=!1,r=!0;const a={delta:0,timestamp:0,isProcessing:!1},o=()=>s=!0,i=It.reduce((b,A)=>(b[A]=Nl(o),b),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:m,preRender:h,render:f,postRender:g}=i,w=()=>{const b=Ee.useManualTiming?a.timestamp:performance.now();s=!1,Ee.useManualTiming||(a.delta=r?1e3/60:Math.max(Math.min(b-a.timestamp,Sl),1)),a.timestamp=b,a.isProcessing=!0,l.process(a),c.process(a),u.process(a),d.process(a),m.process(a),h.process(a),f.process(a),g.process(a),a.isProcessing=!1,s&&t&&(r=!1,e(w))},N=()=>{s=!0,r=!0,a.isProcessing||e(w)};return{schedule:It.reduce((b,A)=>{const P=i[A];return b[A]=(y,C=!1,p=!1)=>(s||N(),P.schedule(y,C,p)),b},{}),cancel:b=>{for(let A=0;A<It.length;A++)i[It[A]].cancel(b)},state:a,steps:i}}const{schedule:K,cancel:Ie,state:ie,steps:ds}=qa(typeof requestAnimationFrame<"u"?requestAnimationFrame:be,!0);let Kt;function Cl(){Kt=void 0}const fe={now:()=>(Kt===void 0&&fe.set(ie.isProcessing||Ee.useManualTiming?ie.timestamp:performance.now()),Kt),set:e=>{Kt=e,queueMicrotask(Cl)}},Ya=e=>t=>typeof t=="string"&&t.startsWith(e),Pn=Ya("--"),Pl=Ya("var(--"),Tn=e=>Pl(e)?Tl.test(e.split("/*")[0].trim()):!1,Tl=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ut={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Tt={...ut,transform:e=>_e(0,1,e)},Ft={...ut,default:1},vt=e=>Math.round(e*1e5)/1e5,An=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Al(e){return e==null}const kl=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,kn=(e,t)=>s=>!!(typeof s=="string"&&kl.test(s)&&s.startsWith(e)||t&&!Al(s)&&Object.prototype.hasOwnProperty.call(s,t)),Xa=(e,t,s)=>r=>{if(typeof r!="string")return r;const[a,o,i,l]=r.match(An);return{[e]:parseFloat(a),[t]:parseFloat(o),[s]:parseFloat(i),alpha:l!==void 0?parseFloat(l):1}},Dl=e=>_e(0,255,e),us={...ut,transform:e=>Math.round(Dl(e))},Ke={test:kn("rgb","red"),parse:Xa("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:r=1})=>"rgba("+us.transform(e)+", "+us.transform(t)+", "+us.transform(s)+", "+vt(Tt.transform(r))+")"};function _l(e){let t="",s="",r="",a="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),r=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),r=e.substring(3,4),a=e.substring(4,5),t+=t,s+=s,r+=r,a+=a),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:a?parseInt(a,16)/255:1}}const zs={test:kn("#"),parse:_l,transform:Ke.transform},Vt=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ve=Vt("deg"),Te=Vt("%"),F=Vt("px"),El=Vt("vh"),Ml=Vt("vw"),tr={...Te,parse:e=>Te.parse(e)/100,transform:e=>Te.transform(e*100)},nt={test:kn("hsl","hue"),parse:Xa("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:r=1})=>"hsla("+Math.round(e)+", "+Te.transform(vt(t))+", "+Te.transform(vt(s))+", "+vt(Tt.transform(r))+")"},te={test:e=>Ke.test(e)||zs.test(e)||nt.test(e),parse:e=>Ke.test(e)?Ke.parse(e):nt.test(e)?nt.parse(e):zs.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ke.transform(e):nt.transform(e),getAnimatableNone:e=>{const t=te.parse(e);return t.alpha=0,te.transform(t)}},Vl=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Rl(e){return isNaN(e)&&typeof e=="string"&&(e.match(An)?.length||0)+(e.match(Vl)?.length||0)>0}const Za="number",Ja="color",Il="var",Fl="var(",sr="${}",Ll=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function At(e){const t=e.toString(),s=[],r={color:[],number:[],var:[]},a=[];let o=0;const l=t.replace(Ll,c=>(te.test(c)?(r.color.push(o),a.push(Ja),s.push(te.parse(c))):c.startsWith(Fl)?(r.var.push(o),a.push(Il),s.push(c)):(r.number.push(o),a.push(Za),s.push(parseFloat(c))),++o,sr)).split(sr);return{values:s,split:l,indexes:r,types:a}}function Qa(e){return At(e).values}function ei(e){const{split:t,types:s}=At(e),r=t.length;return a=>{let o="";for(let i=0;i<r;i++)if(o+=t[i],a[i]!==void 0){const l=s[i];l===Za?o+=vt(a[i]):l===Ja?o+=te.transform(a[i]):o+=a[i]}return o}}const Ol=e=>typeof e=="number"?0:te.test(e)?te.getAnimatableNone(e):e;function Bl(e){const t=Qa(e);return ei(e)(t.map(Ol))}const Fe={test:Rl,parse:Qa,createTransformer:ei,getAnimatableNone:Bl};function ms(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function zl({hue:e,saturation:t,lightness:s,alpha:r}){e/=360,t/=100,s/=100;let a=0,o=0,i=0;if(!t)a=o=i=s;else{const l=s<.5?s*(1+t):s+t-s*t,c=2*s-l;a=ms(c,l,e+1/3),o=ms(c,l,e),i=ms(c,l,e-1/3)}return{red:Math.round(a*255),green:Math.round(o*255),blue:Math.round(i*255),alpha:r}}function Jt(e,t){return s=>s>0?t:e}const q=(e,t,s)=>e+(t-e)*s,hs=(e,t,s)=>{const r=e*e,a=s*(t*t-r)+r;return a<0?0:Math.sqrt(a)},$l=[zs,Ke,nt],Ul=e=>$l.find(t=>t.test(e));function nr(e){const t=Ul(e);if(!t)return!1;let s=t.parse(e);return t===nt&&(s=zl(s)),s}const rr=(e,t)=>{const s=nr(e),r=nr(t);if(!s||!r)return Jt(e,t);const a={...s};return o=>(a.red=hs(s.red,r.red,o),a.green=hs(s.green,r.green,o),a.blue=hs(s.blue,r.blue,o),a.alpha=q(s.alpha,r.alpha,o),Ke.transform(a))},$s=new Set(["none","hidden"]);function Gl(e,t){return $s.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function Wl(e,t){return s=>q(e,t,s)}function Dn(e){return typeof e=="number"?Wl:typeof e=="string"?Tn(e)?Jt:te.test(e)?rr:ql:Array.isArray(e)?ti:typeof e=="object"?te.test(e)?rr:Kl:Jt}function ti(e,t){const s=[...e],r=s.length,a=e.map((o,i)=>Dn(o)(o,t[i]));return o=>{for(let i=0;i<r;i++)s[i]=a[i](o);return s}}function Kl(e,t){const s={...e,...t},r={};for(const a in s)e[a]!==void 0&&t[a]!==void 0&&(r[a]=Dn(e[a])(e[a],t[a]));return a=>{for(const o in r)s[o]=r[o](a);return s}}function Hl(e,t){const s=[],r={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const o=t.types[a],i=e.indexes[o][r[o]],l=e.values[i]??0;s[a]=l,r[o]++}return s}const ql=(e,t)=>{const s=Fe.createTransformer(t),r=At(e),a=At(t);return r.indexes.var.length===a.indexes.var.length&&r.indexes.color.length===a.indexes.color.length&&r.indexes.number.length>=a.indexes.number.length?$s.has(e)&&!a.values.length||$s.has(t)&&!r.values.length?Gl(e,t):Et(ti(Hl(r,a),a.values),s):Jt(e,t)};function si(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?q(e,t,s):Dn(e)(e,t)}const Yl=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>K.update(t,s),stop:()=>Ie(t),now:()=>ie.isProcessing?ie.timestamp:fe.now()}},ni=(e,t,s=10)=>{let r="";const a=Math.max(Math.round(t/s),2);for(let o=0;o<a;o++)r+=Math.round(e(o/(a-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Qt=2e4;function _n(e){let t=0;const s=50;let r=e.next(t);for(;!r.done&&t<Qt;)t+=s,r=e.next(t);return t>=Qt?1/0:t}function Xl(e,t=100,s){const r=s({...e,keyframes:[0,t]}),a=Math.min(_n(r),Qt);return{type:"keyframes",ease:o=>r.next(a*o).value/t,duration:Pe(a)}}const Zl=5;function ri(e,t,s){const r=Math.max(t-Zl,0);return Fa(s-e(r),t-r)}const X={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},fs=.001;function Jl({duration:e=X.duration,bounce:t=X.bounce,velocity:s=X.velocity,mass:r=X.mass}){let a,o,i=1-t;i=_e(X.minDamping,X.maxDamping,i),e=_e(X.minDuration,X.maxDuration,Pe(e)),i<1?(a=u=>{const d=u*i,m=d*e,h=d-s,f=Us(u,i),g=Math.exp(-m);return fs-h/f*g},o=u=>{const m=u*i*e,h=m*s+s,f=Math.pow(i,2)*Math.pow(u,2)*e,g=Math.exp(-m),w=Us(Math.pow(u,2),i);return(-a(u)+fs>0?-1:1)*((h-f)*g)/w}):(a=u=>{const d=Math.exp(-u*e),m=(u-s)*e+1;return-fs+d*m},o=u=>{const d=Math.exp(-u*e),m=(s-u)*(e*e);return d*m});const l=5/e,c=ec(a,o,l);if(e=Ce(e),isNaN(c))return{stiffness:X.stiffness,damping:X.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:i*2*Math.sqrt(r*u),duration:e}}}const Ql=12;function ec(e,t,s){let r=s;for(let a=1;a<Ql;a++)r=r-e(r)/t(r);return r}function Us(e,t){return e*Math.sqrt(1-t*t)}const tc=["duration","bounce"],sc=["stiffness","damping","mass"];function ar(e,t){return t.some(s=>e[s]!==void 0)}function nc(e){let t={velocity:X.velocity,stiffness:X.stiffness,damping:X.damping,mass:X.mass,isResolvedFromDuration:!1,...e};if(!ar(e,sc)&&ar(e,tc))if(e.visualDuration){const s=e.visualDuration,r=2*Math.PI/(s*1.2),a=r*r,o=2*_e(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:X.mass,stiffness:a,damping:o}}else{const s=Jl(e);t={...t,...s,mass:X.mass},t.isResolvedFromDuration=!0}return t}function es(e=X.visualDuration,t=X.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:a}=s;const o=s.keyframes[0],i=s.keyframes[s.keyframes.length-1],l={done:!1,value:o},{stiffness:c,damping:u,mass:d,duration:m,velocity:h,isResolvedFromDuration:f}=nc({...s,velocity:-Pe(s.velocity||0)}),g=h||0,w=u/(2*Math.sqrt(c*d)),N=i-o,v=Pe(Math.sqrt(c/d)),S=Math.abs(N)<5;r||(r=S?X.restSpeed.granular:X.restSpeed.default),a||(a=S?X.restDelta.granular:X.restDelta.default);let b;if(w<1){const P=Us(v,w);b=y=>{const C=Math.exp(-w*v*y);return i-C*((g+w*v*N)/P*Math.sin(P*y)+N*Math.cos(P*y))}}else if(w===1)b=P=>i-Math.exp(-v*P)*(N+(g+v*N)*P);else{const P=v*Math.sqrt(w*w-1);b=y=>{const C=Math.exp(-w*v*y),p=Math.min(P*y,300);return i-C*((g+w*v*N)*Math.sinh(p)+P*N*Math.cosh(p))/P}}const A={calculatedDuration:f&&m||null,next:P=>{const y=b(P);if(f)l.done=P>=m;else{let C=P===0?g:0;w<1&&(C=P===0?Ce(g):ri(b,P,y));const p=Math.abs(C)<=r,E=Math.abs(i-y)<=a;l.done=p&&E}return l.value=l.done?i:y,l},toString:()=>{const P=Math.min(_n(A),Qt),y=ni(C=>A.next(P*C).value,P,30);return P+"ms "+y},toTransition:()=>{}};return A}es.applyToOptions=e=>{const t=Xl(e,100,es);return e.ease=t.ease,e.duration=Ce(t.duration),e.type="keyframes",e};function Gs({keyframes:e,velocity:t=0,power:s=.8,timeConstant:r=325,bounceDamping:a=10,bounceStiffness:o=500,modifyTarget:i,min:l,max:c,restDelta:u=.5,restSpeed:d}){const m=e[0],h={done:!1,value:m},f=p=>l!==void 0&&p<l||c!==void 0&&p>c,g=p=>l===void 0?c:c===void 0||Math.abs(l-p)<Math.abs(c-p)?l:c;let w=s*t;const N=m+w,v=i===void 0?N:i(N);v!==N&&(w=v-m);const S=p=>-w*Math.exp(-p/r),b=p=>v+S(p),A=p=>{const E=S(p),L=b(p);h.done=Math.abs(E)<=u,h.value=h.done?v:L};let P,y;const C=p=>{f(h.value)&&(P=p,y=es({keyframes:[h.value,g(h.value)],velocity:ri(b,p,h.value),damping:a,stiffness:o,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:p=>{let E=!1;return!y&&P===void 0&&(E=!0,A(p),C(p)),P!==void 0&&p>=P?y.next(p-P):(!E&&A(p),h)}}}function rc(e,t,s){const r=[],a=s||Ee.mix||si,o=e.length-1;for(let i=0;i<o;i++){let l=a(e[i],e[i+1]);if(t){const c=Array.isArray(t)?t[i]||be:t;l=Et(c,l)}r.push(l)}return r}function ac(e,t,{clamp:s=!0,ease:r,mixer:a}={}){const o=e.length;if(jn(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=rc(t,r,a),c=l.length,u=d=>{if(i&&d<e[0])return t[0];let m=0;if(c>1)for(;m<e.length-2&&!(d<e[m+1]);m++);const h=Pt(e[m],e[m+1],d);return l[m](h)};return s?d=>u(_e(e[0],e[o-1],d)):u}function ic(e,t){const s=e[e.length-1];for(let r=1;r<=t;r++){const a=Pt(0,t,r);e.push(q(s,1,a))}}function oc(e){const t=[0];return ic(t,e.length-1),t}function lc(e,t){return e.map(s=>s*t)}function cc(e,t){return e.map(()=>t||Ka).splice(0,e.length-1)}function jt({duration:e=300,keyframes:t,times:s,ease:r="easeInOut"}){const a=vl(r)?r.map(er):er(r),o={done:!1,value:t[0]},i=lc(s&&s.length===t.length?s:oc(t),e),l=ac(i,t,{ease:Array.isArray(a)?a:cc(t,a)});return{calculatedDuration:e,next:c=>(o.value=l(c),o.done=c>=e,o)}}const dc=e=>e!==null;function En(e,{repeat:t,repeatType:s="loop"},r,a=1){const o=e.filter(dc),l=a<0||t&&s!=="loop"&&t%2===1?0:o.length-1;return!l||r===void 0?o[l]:r}const uc={decay:Gs,inertia:Gs,tween:jt,keyframes:jt,spring:es};function ai(e){typeof e.type=="string"&&(e.type=uc[e.type])}class Mn{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,s){return this.finished.then(t,s)}}const mc=e=>e/100;class Vn extends Mn{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:s}=this.options;s&&s.updatedAt!==fe.now()&&this.tick(fe.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;ai(t);const{type:s=jt,repeat:r=0,repeatDelay:a=0,repeatType:o,velocity:i=0}=t;let{keyframes:l}=t;const c=s||jt;c!==jt&&typeof l[0]!="number"&&(this.mixKeyframes=Et(mc,si(l[0],l[1])),l=[0,100]);const u=c({...t,keyframes:l});o==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...l].reverse(),velocity:-i})),u.calculatedDuration===null&&(u.calculatedDuration=_n(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+a,this.totalDuration=this.resolvedDuration*(r+1)-a,this.generator=u}updateTime(t){const s=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(t,s=!1){const{generator:r,totalDuration:a,mixKeyframes:o,mirroredGenerator:i,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:m,repeatType:h,repeatDelay:f,type:g,onUpdate:w,finalKeyframe:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-a/this.speed,this.startTime)),s?this.currentTime=t:this.updateTime(t);const v=this.currentTime-u*(this.playbackSpeed>=0?1:-1),S=this.playbackSpeed>=0?v<0:v>a;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let b=this.currentTime,A=r;if(m){const p=Math.min(this.currentTime,a)/l;let E=Math.floor(p),L=p%1;!L&&p>=1&&(L=1),L===1&&E--,E=Math.min(E,m+1),!!(E%2)&&(h==="reverse"?(L=1-L,f&&(L-=f/l)):h==="mirror"&&(A=i)),b=_e(0,1,L)*l}const P=S?{done:!1,value:d[0]}:A.next(b);o&&(P.value=o(P.value));let{done:y}=P;!S&&c!==null&&(y=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&y);return C&&g!==Gs&&(P.value=En(d,this.options,N,this.speed)),w&&w(P.value),C&&this.finish(),P}then(t,s){return this.finished.then(t,s)}get duration(){return Pe(this.calculatedDuration)}get time(){return Pe(this.currentTime)}set time(t){t=Ce(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(fe.now());const s=this.playbackSpeed!==t;this.playbackSpeed=t,s&&(this.time=Pe(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Yl,startTime:s}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=s??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(fe.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function hc(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const He=e=>e*180/Math.PI,Ws=e=>{const t=He(Math.atan2(e[1],e[0]));return Ks(t)},fc={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ws,rotateZ:Ws,skewX:e=>He(Math.atan(e[1])),skewY:e=>He(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ks=e=>(e=e%360,e<0&&(e+=360),e),ir=Ws,or=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),lr=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),pc={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:or,scaleY:lr,scale:e=>(or(e)+lr(e))/2,rotateX:e=>Ks(He(Math.atan2(e[6],e[5]))),rotateY:e=>Ks(He(Math.atan2(-e[2],e[0]))),rotateZ:ir,rotate:ir,skewX:e=>He(Math.atan(e[4])),skewY:e=>He(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Hs(e){return e.includes("scale")?1:0}function qs(e,t){if(!e||e==="none")return Hs(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,a;if(s)r=pc,a=s;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=fc,a=l}if(!a)return Hs(t);const o=r[t],i=a[1].split(",").map(xc);return typeof o=="function"?o(i):i[o]}const gc=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return qs(s,t)};function xc(e){return parseFloat(e.trim())}const mt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ht=new Set(mt),cr=e=>e===ut||e===F,yc=new Set(["x","y","z"]),bc=mt.filter(e=>!yc.has(e));function vc(e){const t=[];return bc.forEach(s=>{const r=e.getValue(s);r!==void 0&&(t.push([s,r.get()]),r.set(s.startsWith("scale")?1:0))}),t}const qe={width:({x:e},{paddingLeft:t="0",paddingRight:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),height:({y:e},{paddingTop:t="0",paddingBottom:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>qs(t,"x"),y:(e,{transform:t})=>qs(t,"y")};qe.translateX=qe.x;qe.translateY=qe.y;const Ye=new Set;let Ys=!1,Xs=!1,Zs=!1;function ii(){if(Xs){const e=Array.from(Ye).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),s=new Map;t.forEach(r=>{const a=vc(r);a.length&&(s.set(r,a),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const a=s.get(r);a&&a.forEach(([o,i])=>{r.getValue(o)?.set(i)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Xs=!1,Ys=!1,Ye.forEach(e=>e.complete(Zs)),Ye.clear()}function oi(){Ye.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Xs=!0)})}function jc(){Zs=!0,oi(),ii(),Zs=!1}class Rn{constructor(t,s,r,a,o,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=s,this.name=r,this.motionValue=a,this.element=o,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(Ye.add(this),Ys||(Ys=!0,K.read(oi),K.resolveKeyframes(ii))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:s,element:r,motionValue:a}=this;if(t[0]===null){const o=a?.get(),i=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&s){const l=r.readValue(s,i);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=i),a&&o===void 0&&a.set(t[0])}hc(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ye.delete(this)}cancel(){this.state==="scheduled"&&(Ye.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const wc=e=>e.startsWith("--");function Nc(e,t,s){wc(t)?e.style.setProperty(t,s):e.style[t]=s}const Sc=wn(()=>window.ScrollTimeline!==void 0),Cc={};function Pc(e,t){const s=wn(e);return()=>Cc[t]??s()}const li=Pc(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),bt=([e,t,s,r])=>`cubic-bezier(${e}, ${t}, ${s}, ${r})`,dr={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:bt([0,.65,.55,1]),circOut:bt([.55,0,1,.45]),backIn:bt([.31,.01,.66,-.59]),backOut:bt([.33,1.53,.69,.99])};function ci(e,t){if(e)return typeof e=="function"?li()?ni(e,t):"ease-out":Ha(e)?bt(e):Array.isArray(e)?e.map(s=>ci(s,t)||dr.easeOut):dr[e]}function Tc(e,t,s,{delay:r=0,duration:a=300,repeat:o=0,repeatType:i="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[t]:s};c&&(d.offset=c);const m=ci(l,a);Array.isArray(m)&&(d.easing=m);const h={delay:r,duration:a,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:o+1,direction:i==="reverse"?"alternate":"normal"};return u&&(h.pseudoElement=u),e.animate(d,h)}function di(e){return typeof e=="function"&&"applyToOptions"in e}function Ac({type:e,...t}){return di(e)&&li()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class kc extends Mn{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:s,name:r,keyframes:a,pseudoElement:o,allowFlatten:i=!1,finalKeyframe:l,onComplete:c}=t;this.isPseudoElement=!!o,this.allowFlatten=i,this.options=t,jn(typeof t.type!="string");const u=Ac(t);this.animation=Tc(s,r,a,u,o),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const d=En(a,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):Nc(s,r,d),this.animation.cancel()}c?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Pe(Number(t))}get time(){return Pe(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=Ce(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Sc()?(this.animation.timeline=t,be):s(this)}}const ui={anticipate:Ua,backInOut:$a,circInOut:Wa};function Dc(e){return e in ui}function _c(e){typeof e.ease=="string"&&Dc(e.ease)&&(e.ease=ui[e.ease])}const ur=10;class Ec extends kc{constructor(t){_c(t),ai(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:s,onUpdate:r,onComplete:a,element:o,...i}=this.options;if(!s)return;if(t!==void 0){s.set(t);return}const l=new Vn({...i,autoplay:!1}),c=Ce(this.finishedTime??this.time);s.setWithVelocity(l.sample(c-ur).value,l.sample(c).value,ur),l.stop()}}const mr=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Fe.test(e)||e==="0")&&!e.startsWith("url("));function Mc(e){const t=e[0];if(e.length===1)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}function Vc(e,t,s,r){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],i=mr(a,t),l=mr(o,t);return!i||!l?!1:Mc(e)||(s==="spring"||di(s))&&r}function Js(e){e.duration=0,e.type}const Rc=new Set(["opacity","clipPath","filter","transform"]),Ic=wn(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Fc(e){const{motionValue:t,name:s,repeatDelay:r,repeatType:a,damping:o,type:i}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return Ic()&&s&&Rc.has(s)&&(s!=="transform"||!u)&&!c&&!r&&a!=="mirror"&&o!==0&&i!=="inertia"}const Lc=40;class Oc extends Mn{constructor({autoplay:t=!0,delay:s=0,type:r="keyframes",repeat:a=0,repeatDelay:o=0,repeatType:i="loop",keyframes:l,name:c,motionValue:u,element:d,...m}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=fe.now();const h={autoplay:t,delay:s,type:r,repeat:a,repeatDelay:o,repeatType:i,name:c,motionValue:u,element:d,...m},f=d?.KeyframeResolver||Rn;this.keyframeResolver=new f(l,(g,w,N)=>this.onKeyframesResolved(g,w,h,!N),c,u,d),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,r,a){this.keyframeResolver=void 0;const{name:o,type:i,velocity:l,delay:c,isHandoff:u,onUpdate:d}=r;this.resolvedAt=fe.now(),Vc(t,o,i,l)||((Ee.instantAnimations||!c)&&d?.(En(t,r,s)),t[0]=t[t.length-1],Js(r),r.repeat=0);const h={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>Lc?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...r,keyframes:t},f=!u&&Fc(h)?new Ec({...h,element:h.motionValue.owner.current}):new Vn(h);f.finished.then(()=>this.notifyFinished()).catch(be),this.pendingTimeline&&(this.stopTimeline=f.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=f}get finished(){return this._animation?this.animation.finished:this._finished}then(t,s){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),jc()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const Bc=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function zc(e){const t=Bc.exec(e);if(!t)return[,];const[,s,r,a]=t;return[`--${s??r}`,a]}function mi(e,t,s=1){const[r,a]=zc(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const i=o.trim();return Va(i)?parseFloat(i):i}return Tn(a)?mi(a,t,s+1):a}function In(e,t){return e?.[t]??e?.default??e}const hi=new Set(["width","height","top","left","right","bottom",...mt]),$c={test:e=>e==="auto",parse:e=>e},fi=e=>t=>t.test(e),pi=[ut,F,Te,Ve,Ml,El,$c],hr=e=>pi.find(fi(e));function Uc(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Ia(e):!0}const Gc=new Set(["brightness","contrast","saturate","opacity"]);function Wc(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=s.match(An)||[];if(!r)return e;const a=s.replace(r,"");let o=Gc.has(t)?1:0;return r!==s&&(o*=100),t+"("+o+a+")"}const Kc=/\b([a-z-]*)\(.*?\)/gu,Qs={...Fe,getAnimatableNone:e=>{const t=e.match(Kc);return t?t.map(Wc).join(" "):e}},fr={...ut,transform:Math.round},Hc={rotate:Ve,rotateX:Ve,rotateY:Ve,rotateZ:Ve,scale:Ft,scaleX:Ft,scaleY:Ft,scaleZ:Ft,skew:Ve,skewX:Ve,skewY:Ve,distance:F,translateX:F,translateY:F,translateZ:F,x:F,y:F,z:F,perspective:F,transformPerspective:F,opacity:Tt,originX:tr,originY:tr,originZ:F},Fn={borderWidth:F,borderTopWidth:F,borderRightWidth:F,borderBottomWidth:F,borderLeftWidth:F,borderRadius:F,radius:F,borderTopLeftRadius:F,borderTopRightRadius:F,borderBottomRightRadius:F,borderBottomLeftRadius:F,width:F,maxWidth:F,height:F,maxHeight:F,top:F,right:F,bottom:F,left:F,padding:F,paddingTop:F,paddingRight:F,paddingBottom:F,paddingLeft:F,margin:F,marginTop:F,marginRight:F,marginBottom:F,marginLeft:F,backgroundPositionX:F,backgroundPositionY:F,...Hc,zIndex:fr,fillOpacity:Tt,strokeOpacity:Tt,numOctaves:fr},qc={...Fn,color:te,backgroundColor:te,outlineColor:te,fill:te,stroke:te,borderColor:te,borderTopColor:te,borderRightColor:te,borderBottomColor:te,borderLeftColor:te,filter:Qs,WebkitFilter:Qs},gi=e=>qc[e];function xi(e,t){let s=gi(e);return s!==Qs&&(s=Fe),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const Yc=new Set(["auto","none","0"]);function Xc(e,t,s){let r=0,a;for(;r<e.length&&!a;){const o=e[r];typeof o=="string"&&!Yc.has(o)&&At(o).values.length&&(a=e[r]),r++}if(a&&s)for(const o of t)e[o]=xi(s,a)}class Zc extends Rn{constructor(t,s,r,a,o){super(t,s,r,a,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:s,name:r}=this;if(!s||!s.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let u=t[c];if(typeof u=="string"&&(u=u.trim(),Tn(u))){const d=mi(u,s.current);d!==void 0&&(t[c]=d),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!hi.has(r)||t.length!==2)return;const[a,o]=t,i=hr(a),l=hr(o);if(i!==l)if(cr(i)&&cr(l))for(let c=0;c<t.length;c++){const u=t[c];typeof u=="string"&&(t[c]=parseFloat(u))}else qe[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,r=[];for(let a=0;a<t.length;a++)(t[a]===null||Uc(t[a]))&&r.push(a);r.length&&Xc(t,r,s)}measureInitialState(){const{element:t,unresolvedKeyframes:s,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=qe[r](t.measureViewportBox(),window.getComputedStyle(t.current)),s[0]=this.measuredOrigin;const a=s[s.length-1];a!==void 0&&t.getValue(r,a).jump(a,!1)}measureEndState(){const{element:t,name:s,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const a=t.getValue(s);a&&a.jump(this.measuredOrigin,!1);const o=r.length-1,i=r[o];r[o]=qe[s](t.measureViewportBox(),window.getComputedStyle(t.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),this.removedTransforms?.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function Jc(e,t,s){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const a=s?.[e]??r.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e)}const yi=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function bi(e){return Ra(e)&&"offsetHeight"in e}const pr=30,Qc=e=>!isNaN(parseFloat(e));class ed{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const a=fe.now();if(this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=s.owner}setCurrent(t){this.current=t,this.updatedAt=fe.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Qc(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,s){this.events[t]||(this.events[t]=new Nn);const r=this.events[t].add(s);return t==="change"?()=>{r(),K.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,s){this.passiveEffect=t,this.stopPassiveEffect=s}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,s,r){this.set(s),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,s=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=fe.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>pr)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,pr);return Fa(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(t){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=t(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ct(e,t){return new ed(e,t)}const{schedule:Ln}=qa(queueMicrotask,!1),je={x:!1,y:!1};function vi(){return je.x||je.y}function td(e){return e==="x"||e==="y"?je[e]?null:(je[e]=!0,()=>{je[e]=!1}):je.x||je.y?null:(je.x=je.y=!0,()=>{je.x=je.y=!1})}function ji(e,t){const s=Jc(e),r=new AbortController,a={passive:!0,...t,signal:r.signal};return[s,a,()=>r.abort()]}function gr(e){return!(e.pointerType==="touch"||vi())}function sd(e,t,s={}){const[r,a,o]=ji(e,s),i=l=>{if(!gr(l))return;const{target:c}=l,u=t(c,l);if(typeof u!="function"||!c)return;const d=m=>{gr(m)&&(u(m),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,a)};return r.forEach(l=>{l.addEventListener("pointerenter",i,a)}),o}const wi=(e,t)=>t?e===t?!0:wi(e,t.parentElement):!1,On=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,nd=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function rd(e){return nd.has(e.tagName)||e.tabIndex!==-1}const Ht=new WeakSet;function xr(e){return t=>{t.key==="Enter"&&e(t)}}function ps(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const ad=(e,t)=>{const s=e.currentTarget;if(!s)return;const r=xr(()=>{if(Ht.has(s))return;ps(s,"down");const a=xr(()=>{ps(s,"up")}),o=()=>ps(s,"cancel");s.addEventListener("keyup",a,t),s.addEventListener("blur",o,t)});s.addEventListener("keydown",r,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),t)};function yr(e){return On(e)&&!vi()}function id(e,t,s={}){const[r,a,o]=ji(e,s),i=l=>{const c=l.currentTarget;if(!yr(l))return;Ht.add(c);const u=t(c,l),d=(f,g)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",h),Ht.has(c)&&Ht.delete(c),yr(f)&&typeof u=="function"&&u(f,{success:g})},m=f=>{d(f,c===window||c===document||s.useGlobalTarget||wi(c,f.target))},h=f=>{d(f,!1)};window.addEventListener("pointerup",m,a),window.addEventListener("pointercancel",h,a)};return r.forEach(l=>{(s.useGlobalTarget?window:l).addEventListener("pointerdown",i,a),bi(l)&&(l.addEventListener("focus",u=>ad(u,a)),!rd(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),o}function Ni(e){return Ra(e)&&"ownerSVGElement"in e}function od(e){return Ni(e)&&e.tagName==="svg"}const le=e=>!!(e&&e.getVelocity),ld=[...pi,te,Fe],cd=e=>ld.find(fi(e)),Bn=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class dd extends x.Component{getSnapshotBeforeUpdate(t){const s=this.props.childRef.current;if(s&&t.isPresent&&!this.props.isPresent){const r=s.offsetParent,a=bi(r)&&r.offsetWidth||0,o=this.props.sizeRef.current;o.height=s.offsetHeight||0,o.width=s.offsetWidth||0,o.top=s.offsetTop,o.left=s.offsetLeft,o.right=a-o.width-o.left}return null}componentDidUpdate(){}render(){return this.props.children}}function ud({children:e,isPresent:t,anchorX:s,root:r}){const a=x.useId(),o=x.useRef(null),i=x.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=x.useContext(Bn);return x.useInsertionEffect(()=>{const{width:c,height:u,top:d,left:m,right:h}=i.current;if(t||!o.current||!c||!u)return;const f=s==="left"?`left: ${m}`:`right: ${h}`;o.current.dataset.motionPopId=a;const g=document.createElement("style");l&&(g.nonce=l);const w=r??document.head;return w.appendChild(g),g.sheet&&g.sheet.insertRule(`
          [data-motion-pop-id="${a}"] {
            position: absolute !important;
            width: ${c}px !important;
            height: ${u}px !important;
            ${f}px !important;
            top: ${d}px !important;
          }
        `),()=>{w.contains(g)&&w.removeChild(g)}},[t]),n.jsx(dd,{isPresent:t,childRef:o,sizeRef:i,children:x.cloneElement(e,{ref:o})})}const md=({children:e,initial:t,isPresent:s,onExitComplete:r,custom:a,presenceAffectsLayout:o,mode:i,anchorX:l,root:c})=>{const u=xn(hd),d=x.useId();let m=!0,h=x.useMemo(()=>(m=!1,{id:d,initial:t,isPresent:s,custom:a,onExitComplete:f=>{u.set(f,!0);for(const g of u.values())if(!g)return;r&&r()},register:f=>(u.set(f,!1),()=>u.delete(f))}),[s,u,r]);return o&&m&&(h={...h}),x.useMemo(()=>{u.forEach((f,g)=>u.set(g,!1))},[s]),x.useEffect(()=>{!s&&!u.size&&r&&r()},[s]),i==="popLayout"&&(e=n.jsx(ud,{isPresent:s,anchorX:l,root:c,children:e})),n.jsx(ns.Provider,{value:h,children:e})};function hd(){return new Map}function Si(e=!0){const t=x.useContext(ns);if(t===null)return[!0,null];const{isPresent:s,onExitComplete:r,register:a}=t,o=x.useId();x.useEffect(()=>{if(e)return a(o)},[e]);const i=x.useCallback(()=>e&&r&&r(o),[o,r,e]);return!s&&r?[!1,i]:[!0]}const Lt=e=>e.key||"";function br(e){const t=[];return x.Children.forEach(e,s=>{x.isValidElement(s)&&t.push(s)}),t}const fd=({children:e,custom:t,initial:s=!0,onExitComplete:r,presenceAffectsLayout:a=!0,mode:o="sync",propagate:i=!1,anchorX:l="left",root:c})=>{const[u,d]=Si(i),m=x.useMemo(()=>br(e),[e]),h=i&&!u?[]:m.map(Lt),f=x.useRef(!0),g=x.useRef(m),w=xn(()=>new Map),[N,v]=x.useState(m),[S,b]=x.useState(m);Ma(()=>{f.current=!1,g.current=m;for(let y=0;y<S.length;y++){const C=Lt(S[y]);h.includes(C)?w.delete(C):w.get(C)!==!0&&w.set(C,!1)}},[S,h.length,h.join("-")]);const A=[];if(m!==N){let y=[...m];for(let C=0;C<S.length;C++){const p=S[C],E=Lt(p);h.includes(E)||(y.splice(C,0,p),A.push(p))}return o==="wait"&&A.length&&(y=A),b(br(y)),v(m),null}const{forceRender:P}=x.useContext(gn);return n.jsx(n.Fragment,{children:S.map(y=>{const C=Lt(y),p=i&&!u?!1:m===S||h.includes(C),E=()=>{if(w.has(C))w.set(C,!0);else return;let L=!0;w.forEach(j=>{j||(L=!1)}),L&&(P?.(),b(g.current),i&&d?.(),r&&r())};return n.jsx(md,{isPresent:p,initial:!f.current||s?void 0:!1,custom:t,presenceAffectsLayout:a,mode:o,root:c,onExitComplete:p?void 0:E,anchorX:l,children:y},C)})})},Ci=x.createContext({strict:!1}),vr={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},dt={};for(const e in vr)dt[e]={isEnabled:t=>vr[e].some(s=>!!t[s])};function pd(e){for(const t in e)dt[t]={...dt[t],...e[t]}}const gd=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ts(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||gd.has(e)}let Pi=e=>!ts(e);function xd(e){typeof e=="function"&&(Pi=t=>t.startsWith("on")?!ts(t):e(t))}try{xd(require("@emotion/is-prop-valid").default)}catch{}function yd(e,t,s){const r={};for(const a in e)a==="values"&&typeof e.values=="object"||(Pi(a)||s===!0&&ts(a)||!t&&!ts(a)||e.draggable&&a.startsWith("onDrag"))&&(r[a]=e[a]);return r}const rs=x.createContext({});function as(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function kt(e){return typeof e=="string"||Array.isArray(e)}const zn=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],$n=["initial",...zn];function is(e){return as(e.animate)||$n.some(t=>kt(e[t]))}function Ti(e){return!!(is(e)||e.variants)}function bd(e,t){if(is(e)){const{initial:s,animate:r}=e;return{initial:s===!1||kt(s)?s:void 0,animate:kt(r)?r:void 0}}return e.inherit!==!1?t:{}}function vd(e){const{initial:t,animate:s}=bd(e,x.useContext(rs));return x.useMemo(()=>({initial:t,animate:s}),[jr(t),jr(s)])}function jr(e){return Array.isArray(e)?e.join(" "):e}const Dt={};function jd(e){for(const t in e)Dt[t]=e[t],Pn(t)&&(Dt[t].isCSSVariable=!0)}function Ai(e,{layout:t,layoutId:s}){return ht.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!Dt[e]||e==="opacity")}const wd={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Nd=mt.length;function Sd(e,t,s){let r="",a=!0;for(let o=0;o<Nd;o++){const i=mt[o],l=e[i];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(i.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||s){const u=yi(l,Fn[i]);if(!c){a=!1;const d=wd[i]||i;r+=`${d}(${u}) `}s&&(t[i]=u)}}return r=r.trim(),s?r=s(t,a?"":r):a&&(r="none"),r}function Un(e,t,s){const{style:r,vars:a,transformOrigin:o}=e;let i=!1,l=!1;for(const c in t){const u=t[c];if(ht.has(c)){i=!0;continue}else if(Pn(c)){a[c]=u;continue}else{const d=yi(u,Fn[c]);c.startsWith("origin")?(l=!0,o[c]=d):r[c]=d}}if(t.transform||(i||s?r.transform=Sd(t,e.transform,s):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=o;r.transformOrigin=`${c} ${u} ${d}`}}const Gn=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ki(e,t,s){for(const r in t)!le(t[r])&&!Ai(r,s)&&(e[r]=t[r])}function Cd({transformTemplate:e},t){return x.useMemo(()=>{const s=Gn();return Un(s,t,e),Object.assign({},s.vars,s.style)},[t])}function Pd(e,t){const s=e.style||{},r={};return ki(r,s,e),Object.assign(r,Cd(e,t)),r}function Td(e,t){const s={},r=Pd(e,t);return e.drag&&e.dragListener!==!1&&(s.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(s.tabIndex=0),s.style=r,s}const Ad={offset:"stroke-dashoffset",array:"stroke-dasharray"},kd={offset:"strokeDashoffset",array:"strokeDasharray"};function Dd(e,t,s=1,r=0,a=!0){e.pathLength=1;const o=a?Ad:kd;e[o.offset]=F.transform(-r);const i=F.transform(t),l=F.transform(s);e[o.array]=`${i} ${l}`}function Di(e,{attrX:t,attrY:s,attrScale:r,pathLength:a,pathSpacing:o=1,pathOffset:i=0,...l},c,u,d){if(Un(e,l,u),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:m,style:h}=e;m.transform&&(h.transform=m.transform,delete m.transform),(h.transform||m.transformOrigin)&&(h.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),h.transform&&(h.transformBox=d?.transformBox??"fill-box",delete m.transformBox),t!==void 0&&(m.x=t),s!==void 0&&(m.y=s),r!==void 0&&(m.scale=r),a!==void 0&&Dd(m,a,o,i,!1)}const _i=()=>({...Gn(),attrs:{}}),Ei=e=>typeof e=="string"&&e.toLowerCase()==="svg";function _d(e,t,s,r){const a=x.useMemo(()=>{const o=_i();return Di(o,t,Ei(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};ki(o,e.style,e),a.style={...o,...a.style}}return a}const Ed=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Wn(e){return typeof e!="string"||e.includes("-")?!1:!!(Ed.indexOf(e)>-1||/[A-Z]/u.test(e))}function Md(e,t,s,{latestValues:r},a,o=!1){const l=(Wn(e)?_d:Td)(t,r,a,e),c=yd(t,typeof e=="string",o),u=e!==x.Fragment?{...c,...l,ref:s}:{},{children:d}=t,m=x.useMemo(()=>le(d)?d.get():d,[d]);return x.createElement(e,{...u,children:m})}function wr(e){const t=[{},{}];return e?.values.forEach((s,r)=>{t[0][r]=s.get(),t[1][r]=s.getVelocity()}),t}function Kn(e,t,s,r){if(typeof t=="function"){const[a,o]=wr(r);t=t(s!==void 0?s:e.custom,a,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[a,o]=wr(r);t=t(s!==void 0?s:e.custom,a,o)}return t}function qt(e){return le(e)?e.get():e}function Vd({scrapeMotionValuesFromProps:e,createRenderState:t},s,r,a){return{latestValues:Rd(s,r,a,e),renderState:t()}}function Rd(e,t,s,r){const a={},o=r(e,{});for(const h in o)a[h]=qt(o[h]);let{initial:i,animate:l}=e;const c=is(e),u=Ti(e);t&&u&&!c&&e.inherit!==!1&&(i===void 0&&(i=t.initial),l===void 0&&(l=t.animate));let d=s?s.initial===!1:!1;d=d||i===!1;const m=d?l:i;if(m&&typeof m!="boolean"&&!as(m)){const h=Array.isArray(m)?m:[m];for(let f=0;f<h.length;f++){const g=Kn(e,h[f]);if(g){const{transitionEnd:w,transition:N,...v}=g;for(const S in v){let b=v[S];if(Array.isArray(b)){const A=d?b.length-1:0;b=b[A]}b!==null&&(a[S]=b)}for(const S in w)a[S]=w[S]}}}return a}const Mi=e=>(t,s)=>{const r=x.useContext(rs),a=x.useContext(ns),o=()=>Vd(e,t,r,a);return s?o():xn(o)};function Hn(e,t,s){const{style:r}=e,a={};for(const o in r)(le(r[o])||t.style&&le(t.style[o])||Ai(o,e)||s?.getValue(o)?.liveStyle!==void 0)&&(a[o]=r[o]);return a}const Id=Mi({scrapeMotionValuesFromProps:Hn,createRenderState:Gn});function Vi(e,t,s){const r=Hn(e,t,s);for(const a in e)if(le(e[a])||le(t[a])){const o=mt.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;r[o]=e[a]}return r}const Fd=Mi({scrapeMotionValuesFromProps:Vi,createRenderState:_i}),Ld=Symbol.for("motionComponentSymbol");function rt(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Od(e,t,s){return x.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),s&&(typeof s=="function"?s(r):rt(s)&&(s.current=r))},[t,s])}const qn=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Bd="framerAppearId",Ri="data-"+qn(Bd),Ii=x.createContext({});function zd(e,t,s,r,a){const{visualElement:o}=x.useContext(rs),i=x.useContext(Ci),l=x.useContext(ns),c=x.useContext(Bn).reducedMotion,u=x.useRef(null);r=r||i.renderer,!u.current&&r&&(u.current=r(e,{visualState:t,parent:o,props:s,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const d=u.current,m=x.useContext(Ii);d&&!d.projection&&a&&(d.type==="html"||d.type==="svg")&&$d(u.current,s,a,m);const h=x.useRef(!1);x.useInsertionEffect(()=>{d&&h.current&&d.update(s,l)});const f=s[Ri],g=x.useRef(!!f&&!window.MotionHandoffIsComplete?.(f)&&window.MotionHasOptimisedAnimation?.(f));return Ma(()=>{d&&(h.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),g.current&&d.animationState&&d.animationState.animateChanges())}),x.useEffect(()=>{d&&(!g.current&&d.animationState&&d.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(f)}),g.current=!1),d.enteringChildren=void 0)}),d}function $d(e,t,s,r){const{layoutId:a,layout:o,drag:i,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:Fi(e.parent)),e.projection.setOptions({layoutId:a,layout:o,alwaysMeasureLayout:!!i||l&&rt(l),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:u})}function Fi(e){if(e)return e.options.allowProjection!==!1?e.projection:Fi(e.parent)}function gs(e,{forwardMotionProps:t=!1}={},s,r){s&&pd(s);const a=Wn(e)?Fd:Id;function o(l,c){let u;const d={...x.useContext(Bn),...l,layoutId:Ud(l)},{isStatic:m}=d,h=vd(l),f=a(l,m);if(!m&&yn){Gd();const g=Wd(d);u=g.MeasureLayout,h.visualElement=zd(e,f,d,r,g.ProjectionNode)}return n.jsxs(rs.Provider,{value:h,children:[u&&h.visualElement?n.jsx(u,{visualElement:h.visualElement,...d}):null,Md(e,l,Od(f,h.visualElement,c),f,m,t)]})}o.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const i=x.forwardRef(o);return i[Ld]=e,i}function Ud({layoutId:e}){const t=x.useContext(gn).id;return t&&e!==void 0?t+"-"+e:e}function Gd(e,t){x.useContext(Ci).strict}function Wd(e){const{drag:t,layout:s}=dt;if(!t&&!s)return{};const r={...t,...s};return{MeasureLayout:t?.isEnabled(e)||s?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Kd(e,t){if(typeof Proxy>"u")return gs;const s=new Map,r=(o,i)=>gs(o,i,e,t),a=(o,i)=>r(o,i);return new Proxy(a,{get:(o,i)=>i==="create"?r:(s.has(i)||s.set(i,gs(i,void 0,e,t)),s.get(i))})}function Li({top:e,left:t,right:s,bottom:r}){return{x:{min:t,max:s},y:{min:e,max:r}}}function Hd({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function qd(e,t){if(!t)return e;const s=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}function xs(e){return e===void 0||e===1}function en({scale:e,scaleX:t,scaleY:s}){return!xs(e)||!xs(t)||!xs(s)}function Ge(e){return en(e)||Oi(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Oi(e){return Nr(e.x)||Nr(e.y)}function Nr(e){return e&&e!=="0%"}function ss(e,t,s){const r=e-s,a=t*r;return s+a}function Sr(e,t,s,r,a){return a!==void 0&&(e=ss(e,a,r)),ss(e,s,r)+t}function tn(e,t=0,s=1,r,a){e.min=Sr(e.min,t,s,r,a),e.max=Sr(e.max,t,s,r,a)}function Bi(e,{x:t,y:s}){tn(e.x,t.translate,t.scale,t.originPoint),tn(e.y,s.translate,s.scale,s.originPoint)}const Cr=.999999999999,Pr=1.0000000000001;function Yd(e,t,s,r=!1){const a=s.length;if(!a)return;t.x=t.y=1;let o,i;for(let l=0;l<a;l++){o=s[l],i=o.projectionDelta;const{visualElement:c}=o.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&it(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,Bi(e,i)),r&&Ge(o.latestValues)&&it(e,o.latestValues))}t.x<Pr&&t.x>Cr&&(t.x=1),t.y<Pr&&t.y>Cr&&(t.y=1)}function at(e,t){e.min=e.min+t,e.max=e.max+t}function Tr(e,t,s,r,a=.5){const o=q(e.min,e.max,a);tn(e,t,s,o,r)}function it(e,t){Tr(e.x,t.x,t.scaleX,t.scale,t.originX),Tr(e.y,t.y,t.scaleY,t.scale,t.originY)}function zi(e,t){return Li(qd(e.getBoundingClientRect(),t))}function Xd(e,t,s){const r=zi(e,s),{scroll:a}=t;return a&&(at(r.x,a.offset.x),at(r.y,a.offset.y)),r}const Ar=()=>({translate:0,scale:1,origin:0,originPoint:0}),ot=()=>({x:Ar(),y:Ar()}),kr=()=>({min:0,max:0}),Z=()=>({x:kr(),y:kr()}),sn={current:null},$i={current:!1};function Zd(){if($i.current=!0,!!yn)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>sn.current=e.matches;e.addEventListener("change",t),t()}else sn.current=!1}const Jd=new WeakMap;function Qd(e,t,s){for(const r in t){const a=t[r],o=s[r];if(le(a))e.addValue(r,a);else if(le(o))e.addValue(r,ct(a,{owner:e}));else if(o!==a)if(e.hasValue(r)){const i=e.getValue(r);i.liveStyle===!0?i.jump(a):i.hasAnimated||i.set(a)}else{const i=e.getStaticValue(r);e.addValue(r,ct(i!==void 0?i:a,{owner:e}))}}for(const r in s)t[r]===void 0&&e.removeValue(r);return t}const Dr=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eu{scrapeMotionValuesFromProps(t,s,r){return{}}constructor({parent:t,props:s,presenceContext:r,reducedMotionConfig:a,blockInitialAnimation:o,visualState:i},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Rn,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=fe.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,K.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=i;this.latestValues=c,this.baseTarget={...c},this.initialValues=s.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=s,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=a,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=is(s),this.isVariantNode=Ti(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...m}=this.scrapeMotionValuesFromProps(s,{},this);for(const h in m){const f=m[h];c[h]!==void 0&&le(f)&&f.set(c[h])}}mount(t){this.current=t,Jd.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),$i.current||Zd(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:sn.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Ie(this.notifyUpdate),Ie(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const s=this.features[t];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,s){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=ht.has(t);r&&this.onBindTransform&&this.onBindTransform();const a=s.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&K.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,s)),this.valueSubscriptions.set(t,()=>{a(),o&&o(),s.owner&&s.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in dt){const s=dt[t];if(!s)continue;const{isEnabled:r,Feature:a}=s;if(!this.features[t]&&a&&r(this.props)&&(this.features[t]=new a(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Z()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,s){this.latestValues[t]=s}update(t,s){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let r=0;r<Dr.length;r++){const a=Dr[r];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const o="on"+a,i=t[o];i&&(this.propEventSubscriptions[a]=this.on(a,i))}this.prevMotionValues=Qd(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(t),()=>s.variantChildren.delete(t)}addValue(t,s){const r=this.values.get(t);s!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,s),this.values.set(t,s),this.latestValues[t]=s.get())}removeValue(t){this.values.delete(t);const s=this.valueSubscriptions.get(t);s&&(s(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,s){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&s!==void 0&&(r=ct(s===null?void 0:s,{owner:this}),this.addValue(t,r)),r}readValue(t,s){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(Va(r)||Ia(r))?r=parseFloat(r):!cd(r)&&Fe.test(s)&&(r=xi(t,s)),this.setBaseTarget(t,le(r)?r.get():r)),le(r)?r.get():r}setBaseTarget(t,s){this.baseTarget[t]=s}getBaseTarget(t){const{initial:s}=this.props;let r;if(typeof s=="string"||typeof s=="object"){const o=Kn(this.props,s,this.presenceContext?.custom);o&&(r=o[t])}if(s&&r!==void 0)return r;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!le(a)?a:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,s){return this.events[t]||(this.events[t]=new Nn),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){Ln.render(this.render)}}class Ui extends eu{constructor(){super(...arguments),this.KeyframeResolver=Zc}sortInstanceNodePosition(t,s){return t.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(t,s){return t.style?t.style[s]:void 0}removeValueFromRenderState(t,{vars:s,style:r}){delete s[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;le(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}function Gi(e,{style:t,vars:s},r,a){const o=e.style;let i;for(i in t)o[i]=t[i];a?.applyProjectionStyles(o,r);for(i in s)o.setProperty(i,s[i])}function tu(e){return window.getComputedStyle(e)}class su extends Ui{constructor(){super(...arguments),this.type="html",this.renderInstance=Gi}readValueFromInstance(t,s){if(ht.has(s))return this.projection?.isProjecting?Hs(s):gc(t,s);{const r=tu(t),a=(Pn(s)?r.getPropertyValue(s):r[s])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:s}){return zi(t,s)}build(t,s,r){Un(t,s,r.transformTemplate)}scrapeMotionValuesFromProps(t,s,r){return Hn(t,s,r)}}const Wi=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function nu(e,t,s,r){Gi(e,t,void 0,r);for(const a in t.attrs)e.setAttribute(Wi.has(a)?a:qn(a),t.attrs[a])}class ru extends Ui{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Z}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(ht.has(s)){const r=gi(s);return r&&r.default||0}return s=Wi.has(s)?s:qn(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,r){return Vi(t,s,r)}build(t,s,r){Di(t,s,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,s,r,a){nu(t,s,r,a)}mount(t){this.isSVGTag=Ei(t.tagName),super.mount(t)}}const au=(e,t)=>Wn(e)?new ru(t):new su(t,{allowProjection:e!==x.Fragment});function lt(e,t,s){const r=e.getProps();return Kn(r,t,s!==void 0?s:r.custom,e)}const nn=e=>Array.isArray(e);function iu(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,ct(s))}function ou(e){return nn(e)?e[e.length-1]||0:e}function lu(e,t){const s=lt(e,t);let{transitionEnd:r={},transition:a={},...o}=s||{};o={...o,...r};for(const i in o){const l=ou(o[i]);iu(e,i,l)}}function cu(e){return!!(le(e)&&e.add)}function rn(e,t){const s=e.getValue("willChange");if(cu(s))return s.add(t);if(!s&&Ee.WillChange){const r=new Ee.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Ki(e){return e.props[Ri]}const du=e=>e!==null;function uu(e,{repeat:t,repeatType:s="loop"},r){const a=e.filter(du),o=t&&s!=="loop"&&t%2===1?0:a.length-1;return a[o]}const mu={type:"spring",stiffness:500,damping:25,restSpeed:10},hu=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),fu={type:"keyframes",duration:.8},pu={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},gu=(e,{keyframes:t})=>t.length>2?fu:ht.has(e)?e.startsWith("scale")?hu(t[1]):mu:pu;function xu({when:e,delay:t,delayChildren:s,staggerChildren:r,staggerDirection:a,repeat:o,repeatType:i,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Yn=(e,t,s,r={},a,o)=>i=>{const l=In(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Ce(c);const d={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{i(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:o?void 0:a};xu(l)||Object.assign(d,gu(e,d)),d.duration&&(d.duration=Ce(d.duration)),d.repeatDelay&&(d.repeatDelay=Ce(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let m=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(Js(d),d.delay===0&&(m=!0)),(Ee.instantAnimations||Ee.skipAnimations)&&(m=!0,Js(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,m&&!o&&t.get()!==void 0){const h=uu(d.keyframes,l);if(h!==void 0){K.update(()=>{d.onUpdate(h),d.onComplete()});return}}return l.isSync?new Vn(d):new Oc(d)};function yu({protectedKeys:e,needsAnimating:t},s){const r=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,r}function Hi(e,t,{delay:s=0,transitionOverride:r,type:a}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:i,...l}=t;r&&(o=r);const c=[],u=a&&e.animationState&&e.animationState.getState()[a];for(const d in l){const m=e.getValue(d,e.latestValues[d]??null),h=l[d];if(h===void 0||u&&yu(u,d))continue;const f={delay:s,...In(o||{},d)},g=m.get();if(g!==void 0&&!m.isAnimating&&!Array.isArray(h)&&h===g&&!f.velocity)continue;let w=!1;if(window.MotionHandoffAnimation){const v=Ki(e);if(v){const S=window.MotionHandoffAnimation(v,d,K);S!==null&&(f.startTime=S,w=!0)}}rn(e,d),m.start(Yn(d,m,h,e.shouldReduceMotion&&hi.has(d)?{type:!1}:f,e,w));const N=m.animation;N&&c.push(N)}return i&&Promise.all(c).then(()=>{K.update(()=>{i&&lu(e,i)})}),c}function qi(e,t,s,r=0,a=1){const o=Array.from(e).sort((u,d)=>u.sortNodePosition(d)).indexOf(t),i=e.size,l=(i-1)*r;return typeof s=="function"?s(o,i):a===1?o*r:l-o*r}function an(e,t,s={}){const r=lt(e,t,s.type==="exit"?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=r||{};s.transitionOverride&&(a=s.transitionOverride);const o=r?()=>Promise.all(Hi(e,r,s)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:m}=a;return bu(e,t,c,u,d,m,s)}:()=>Promise.resolve(),{when:l}=a;if(l){const[c,u]=l==="beforeChildren"?[o,i]:[i,o];return c().then(()=>u())}else return Promise.all([o(),i(s.delay)])}function bu(e,t,s=0,r=0,a=0,o=1,i){const l=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),l.push(an(c,t,{...i,delay:s+(typeof r=="function"?0:r)+qi(e.variantChildren,c,r,a,o)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(l)}function vu(e,t,s={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const a=t.map(o=>an(e,o,s));r=Promise.all(a)}else if(typeof t=="string")r=an(e,t,s);else{const a=typeof t=="function"?lt(e,t,s.custom):t;r=Promise.all(Hi(e,a,s))}return r.then(()=>{e.notify("AnimationComplete",t)})}function Yi(e,t){if(!Array.isArray(t))return!1;const s=t.length;if(s!==e.length)return!1;for(let r=0;r<s;r++)if(t[r]!==e[r])return!1;return!0}const ju=$n.length;function Xi(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?Xi(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<ju;s++){const r=$n[s],a=e.props[r];(kt(a)||a===!1)&&(t[r]=a)}return t}const wu=[...zn].reverse(),Nu=zn.length;function Su(e){return t=>Promise.all(t.map(({animation:s,options:r})=>vu(e,s,r)))}function Cu(e){let t=Su(e),s=_r(),r=!0;const a=c=>(u,d)=>{const m=lt(e,d,c==="exit"?e.presenceContext?.custom:void 0);if(m){const{transition:h,transitionEnd:f,...g}=m;u={...u,...g,...f}}return u};function o(c){t=c(e)}function i(c){const{props:u}=e,d=Xi(e.parent)||{},m=[],h=new Set;let f={},g=1/0;for(let N=0;N<Nu;N++){const v=wu[N],S=s[v],b=u[v]!==void 0?u[v]:d[v],A=kt(b),P=v===c?S.isActive:null;P===!1&&(g=N);let y=b===d[v]&&b!==u[v]&&A;if(y&&r&&e.manuallyAnimateOnMount&&(y=!1),S.protectedKeys={...f},!S.isActive&&P===null||!b&&!S.prevProp||as(b)||typeof b=="boolean")continue;const C=Pu(S.prevProp,b);let p=C||v===c&&S.isActive&&!y&&A||N>g&&A,E=!1;const L=Array.isArray(b)?b:[b];let j=L.reduce(a(v),{});P===!1&&(j={});const{prevResolvedValues:O={}}=S,T={...O,...j},$=W=>{p=!0,h.has(W)&&(E=!0,h.delete(W)),S.needsAnimating[W]=!0;const k=e.getValue(W);k&&(k.liveStyle=!1)};for(const W in T){const k=j[W],ce=O[W];if(f.hasOwnProperty(W))continue;let de=!1;nn(k)&&nn(ce)?de=!Yi(k,ce):de=k!==ce,de?k!=null?$(W):h.add(W):k!==void 0&&h.has(W)?$(W):S.protectedKeys[W]=!0}S.prevProp=b,S.prevResolvedValues=j,S.isActive&&(f={...f,...j}),r&&e.blockInitialAnimation&&(p=!1);const H=y&&C;p&&(!H||E)&&m.push(...L.map(W=>{const k={type:v};if(typeof W=="string"&&r&&!H&&e.manuallyAnimateOnMount&&e.parent){const{parent:ce}=e,de=lt(ce,W);if(ce.enteringChildren&&de){const{delayChildren:Ae}=de.transition||{};k.delay=qi(ce.enteringChildren,e,Ae)}}return{animation:W,options:k}}))}if(h.size){const N={};if(typeof u.initial!="boolean"){const v=lt(e,Array.isArray(u.initial)?u.initial[0]:u.initial);v&&v.transition&&(N.transition=v.transition)}h.forEach(v=>{const S=e.getBaseTarget(v),b=e.getValue(v);b&&(b.liveStyle=!0),N[v]=S??null}),m.push({animation:N})}let w=!!m.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(w=!1),r=!1,w?t(m):Promise.resolve()}function l(c,u){if(s[c].isActive===u)return Promise.resolve();e.variantChildren?.forEach(m=>m.animationState?.setActive(c,u)),s[c].isActive=u;const d=i(c);for(const m in s)s[m].protectedKeys={};return d}return{animateChanges:i,setActive:l,setAnimateFunction:o,getState:()=>s,reset:()=>{s=_r(),r=!0}}}function Pu(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Yi(t,e):!1}function $e(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function _r(){return{animate:$e(!0),whileInView:$e(),whileHover:$e(),whileTap:$e(),whileDrag:$e(),whileFocus:$e(),exit:$e()}}class Be{constructor(t){this.isMounted=!1,this.node=t}update(){}}class Tu extends Be{constructor(t){super(t),t.animationState||(t.animationState=Cu(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();as(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:s}=this.node.prevProps||{};t!==s&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Au=0;class ku extends Be{constructor(){super(...arguments),this.id=Au++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:s}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const a=this.node.animationState.setActive("exit",!t);s&&!t&&a.then(()=>{s(this.id)})}mount(){const{register:t,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Du={animation:{Feature:Tu},exit:{Feature:ku}};function _t(e,t,s,r={passive:!0}){return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s)}function Rt(e){return{point:{x:e.pageX,y:e.pageY}}}const _u=e=>t=>On(t)&&e(t,Rt(t));function wt(e,t,s,r){return _t(e,t,_u(s),r)}const Zi=1e-4,Eu=1-Zi,Mu=1+Zi,Ji=.01,Vu=0-Ji,Ru=0+Ji;function me(e){return e.max-e.min}function Iu(e,t,s){return Math.abs(e-t)<=s}function Er(e,t,s,r=.5){e.origin=r,e.originPoint=q(t.min,t.max,e.origin),e.scale=me(s)/me(t),e.translate=q(s.min,s.max,e.origin)-e.originPoint,(e.scale>=Eu&&e.scale<=Mu||isNaN(e.scale))&&(e.scale=1),(e.translate>=Vu&&e.translate<=Ru||isNaN(e.translate))&&(e.translate=0)}function Nt(e,t,s,r){Er(e.x,t.x,s.x,r?r.originX:void 0),Er(e.y,t.y,s.y,r?r.originY:void 0)}function Mr(e,t,s){e.min=s.min+t.min,e.max=e.min+me(t)}function Fu(e,t,s){Mr(e.x,t.x,s.x),Mr(e.y,t.y,s.y)}function Vr(e,t,s){e.min=t.min-s.min,e.max=e.min+me(t)}function St(e,t,s){Vr(e.x,t.x,s.x),Vr(e.y,t.y,s.y)}function ye(e){return[e("x"),e("y")]}const Qi=({current:e})=>e?e.ownerDocument.defaultView:null,Rr=(e,t)=>Math.abs(e-t);function Lu(e,t){const s=Rr(e.x,t.x),r=Rr(e.y,t.y);return Math.sqrt(s**2+r**2)}class eo{constructor(t,s,{transformPagePoint:r,contextWindow:a=window,dragSnapToOrigin:o=!1,distanceThreshold:i=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=bs(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,g=Lu(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!f&&!g)return;const{point:w}=h,{timestamp:N}=ie;this.history.push({...w,timestamp:N});const{onStart:v,onMove:S}=this.handlers;f||(v&&v(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,h)},this.handlePointerMove=(h,f)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=ys(f,this.transformPagePoint),K.update(this.updatePoint,!0)},this.handlePointerUp=(h,f)=>{this.end();const{onEnd:g,onSessionEnd:w,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=bs(h.type==="pointercancel"?this.lastMoveEventInfo:ys(f,this.transformPagePoint),this.history);this.startEvent&&g&&g(h,v),w&&w(h,v)},!On(t))return;this.dragSnapToOrigin=o,this.handlers=s,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=a||window;const l=Rt(t),c=ys(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=ie;this.history=[{...u,timestamp:d}];const{onSessionStart:m}=s;m&&m(t,bs(c,this.history)),this.removeListeners=Et(wt(this.contextWindow,"pointermove",this.handlePointerMove),wt(this.contextWindow,"pointerup",this.handlePointerUp),wt(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ie(this.updatePoint)}}function ys(e,t){return t?{point:t(e.point)}:e}function Ir(e,t){return{x:e.x-t.x,y:e.y-t.y}}function bs({point:e},t){return{point:e,delta:Ir(e,to(t)),offset:Ir(e,Ou(t)),velocity:Bu(t,.1)}}function Ou(e){return e[0]}function to(e){return e[e.length-1]}function Bu(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,r=null;const a=to(e);for(;s>=0&&(r=e[s],!(a.timestamp-r.timestamp>Ce(t)));)s--;if(!r)return{x:0,y:0};const o=Pe(a.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const i={x:(a.x-r.x)/o,y:(a.y-r.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function zu(e,{min:t,max:s},r){return t!==void 0&&e<t?e=r?q(t,e,r.min):Math.max(e,t):s!==void 0&&e>s&&(e=r?q(s,e,r.max):Math.min(e,s)),e}function Fr(e,t,s){return{min:t!==void 0?e.min+t:void 0,max:s!==void 0?e.max+s-(e.max-e.min):void 0}}function $u(e,{top:t,left:s,bottom:r,right:a}){return{x:Fr(e.x,s,a),y:Fr(e.y,t,r)}}function Lr(e,t){let s=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,r]=[r,s]),{min:s,max:r}}function Uu(e,t){return{x:Lr(e.x,t.x),y:Lr(e.y,t.y)}}function Gu(e,t){let s=.5;const r=me(e),a=me(t);return a>r?s=Pt(t.min,t.max-r,e.min):r>a&&(s=Pt(e.min,e.max-a,t.min)),_e(0,1,s)}function Wu(e,t){const s={};return t.min!==void 0&&(s.min=t.min-e.min),t.max!==void 0&&(s.max=t.max-e.min),s}const on=.35;function Ku(e=on){return e===!1?e=0:e===!0&&(e=on),{x:Or(e,"left","right"),y:Or(e,"top","bottom")}}function Or(e,t,s){return{min:Br(e,t),max:Br(e,s)}}function Br(e,t){return typeof e=="number"?e:e[t]||0}const Hu=new WeakMap;class qu{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Z(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:s=!1,distanceThreshold:r}={}){const{presenceContext:a}=this.visualElement;if(a&&a.isPresent===!1)return;const o=m=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),s&&this.snapToCursor(Rt(m).point)},i=(m,h)=>{const{drag:f,dragPropagation:g,onDragStart:w}=this.getProps();if(f&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=td(f),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ye(v=>{let S=this.getAxisMotionValue(v).get()||0;if(Te.test(S)){const{projection:b}=this.visualElement;if(b&&b.layout){const A=b.layout.layoutBox[v];A&&(S=me(A)*(parseFloat(S)/100))}}this.originPoint[v]=S}),w&&K.postRender(()=>w(m,h)),rn(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},l=(m,h)=>{this.latestPointerEvent=m,this.latestPanInfo=h;const{dragPropagation:f,dragDirectionLock:g,onDirectionLock:w,onDrag:N}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:v}=h;if(g&&this.currentDirection===null){this.currentDirection=Yu(v),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",h.point,v),this.updateAxis("y",h.point,v),this.visualElement.render(),N&&N(m,h)},c=(m,h)=>{this.latestPointerEvent=m,this.latestPanInfo=h,this.stop(m,h),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>ye(m=>this.getAnimationState(m)==="paused"&&this.getAxisMotionValue(m).animation?.play()),{dragSnapToOrigin:d}=this.getProps();this.panSession=new eo(t,{onSessionStart:o,onStart:i,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:Qi(this.visualElement)})}stop(t,s){const r=t||this.latestPointerEvent,a=s||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!a||!r)return;const{velocity:i}=a;this.startAnimation(i);const{onDragEnd:l}=this.getProps();l&&K.postRender(()=>l(r,a))}cancel(){this.isDragging=!1;const{projection:t,animationState:s}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}updateAxis(t,s,r){const{drag:a}=this.getProps();if(!r||!Ot(t,a,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=zu(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){const{dragConstraints:t,dragElastic:s}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,a=this.constraints;t&&rt(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=$u(r.layoutBox,t):this.constraints=!1,this.elastic=Ku(s),a!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&ye(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Wu(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!rt(t))return!1;const r=t.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const o=Xd(r,a.root,this.visualElement.getTransformPagePoint());let i=Uu(a.layout.layoutBox,o);if(s){const l=s(Hd(i));this.hasMutatedConstraints=!!l,l&&(i=Li(l))}return i}startAnimation(t){const{drag:s,dragMomentum:r,dragElastic:a,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=ye(d=>{if(!Ot(d,s,this.currentDirection))return;let m=c&&c[d]||{};i&&(m={min:0,max:0});const h=a?200:1e6,f=a?40:1e7,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...o,...m};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,s){const r=this.getAxisMotionValue(t);return rn(this.visualElement,t),r.start(Yn(t,r,0,s,this.visualElement,!1))}stopAnimation(){ye(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){ye(t=>this.getAxisMotionValue(t).animation?.pause())}getAnimationState(t){return this.getAxisMotionValue(t).animation?.state}getAxisMotionValue(t){const s=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),a=r[s];return a||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){ye(s=>{const{drag:r}=this.getProps();if(!Ot(s,r,this.currentDirection))return;const{projection:a}=this.visualElement,o=this.getAxisMotionValue(s);if(a&&a.layout){const{min:i,max:l}=a.layout.layoutBox[s];o.set(t[s]-q(i,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:r}=this.visualElement;if(!rt(s)||!r||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};ye(i=>{const l=this.getAxisMotionValue(i);if(l&&this.constraints!==!1){const c=l.get();a[i]=Gu({min:c,max:c},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ye(i=>{if(!Ot(i,t,null))return;const l=this.getAxisMotionValue(i),{min:c,max:u}=this.constraints[i];l.set(q(c,u,a[i]))})}addListeners(){if(!this.visualElement.current)return;Hu.set(this.visualElement,this);const t=this.visualElement.current,s=wt(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();rt(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,o=a.addEventListener("measure",r);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),K.read(r);const i=_t(window,"resize",()=>this.scalePositionWithinConstraints()),l=a.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(ye(d=>{const m=this.getAxisMotionValue(d);m&&(this.originPoint[d]+=c[d].translate,m.set(m.get()+c[d].translate))}),this.visualElement.render())}));return()=>{i(),s(),o(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:r=!1,dragPropagation:a=!1,dragConstraints:o=!1,dragElastic:i=on,dragMomentum:l=!0}=t;return{...t,drag:s,dragDirectionLock:r,dragPropagation:a,dragConstraints:o,dragElastic:i,dragMomentum:l}}}function Ot(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function Yu(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class Xu extends Be{constructor(t){super(t),this.removeGroupControls=be,this.removeListeners=be,this.controls=new qu(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||be}unmount(){this.removeGroupControls(),this.removeListeners()}}const zr=e=>(t,s)=>{e&&K.postRender(()=>e(t,s))};class Zu extends Be{constructor(){super(...arguments),this.removePointerDownListener=be}onPointerDown(t){this.session=new eo(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Qi(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:r,onPanEnd:a}=this.node.getProps();return{onSessionStart:zr(t),onStart:zr(s),onMove:r,onEnd:(o,i)=>{delete this.session,a&&K.postRender(()=>a(o,i))}}}mount(){this.removePointerDownListener=wt(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Yt={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function $r(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const gt={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(F.test(e))e=parseFloat(e);else return e;const s=$r(e,t.target.x),r=$r(e,t.target.y);return`${s}% ${r}%`}},Ju={correct:(e,{treeScale:t,projectionDelta:s})=>{const r=e,a=Fe.parse(e);if(a.length>5)return r;const o=Fe.createTransformer(e),i=typeof a[0]!="number"?1:0,l=s.x.scale*t.x,c=s.y.scale*t.y;a[0+i]/=l,a[1+i]/=c;const u=q(l,c,.5);return typeof a[2+i]=="number"&&(a[2+i]/=u),typeof a[3+i]=="number"&&(a[3+i]/=u),o(a)}};let vs=!1;class Qu extends x.Component{componentDidMount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:r,layoutId:a}=this.props,{projection:o}=t;jd(em),o&&(s.group&&s.group.add(o),r&&r.register&&a&&r.register(o),vs&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),Yt.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:s,visualElement:r,drag:a,isPresent:o}=this.props,{projection:i}=r;return i&&(i.isPresent=o,vs=!0,a||t.layoutDependency!==s||s===void 0||t.isPresent!==o?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||K.postRender(()=>{const l=i.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Ln.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:r}=this.props,{projection:a}=t;vs=!0,a&&(a.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(a),r&&r.deregister&&r.deregister(a))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function so(e){const[t,s]=Si(),r=x.useContext(gn);return n.jsx(Qu,{...e,layoutGroup:r,switchLayoutGroup:x.useContext(Ii),isPresent:t,safeToRemove:s})}const em={borderRadius:{...gt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:gt,borderTopRightRadius:gt,borderBottomLeftRadius:gt,borderBottomRightRadius:gt,boxShadow:Ju};function tm(e,t,s){const r=le(e)?e:ct(e);return r.start(Yn("",r,t,s)),r.animation}const sm=(e,t)=>e.depth-t.depth;class nm{constructor(){this.children=[],this.isDirty=!1}add(t){bn(this.children,t),this.isDirty=!0}remove(t){vn(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(sm),this.isDirty=!1,this.children.forEach(t)}}function rm(e,t){const s=fe.now(),r=({timestamp:a})=>{const o=a-s;o>=t&&(Ie(r),e(o-t))};return K.setup(r,!0),()=>Ie(r)}const no=["TopLeft","TopRight","BottomLeft","BottomRight"],am=no.length,Ur=e=>typeof e=="string"?parseFloat(e):e,Gr=e=>typeof e=="number"||F.test(e);function im(e,t,s,r,a,o){a?(e.opacity=q(0,s.opacity??1,om(r)),e.opacityExit=q(t.opacity??1,0,lm(r))):o&&(e.opacity=q(t.opacity??1,s.opacity??1,r));for(let i=0;i<am;i++){const l=`border${no[i]}Radius`;let c=Wr(t,l),u=Wr(s,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||Gr(c)===Gr(u)?(e[l]=Math.max(q(Ur(c),Ur(u),r),0),(Te.test(u)||Te.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||s.rotate)&&(e.rotate=q(t.rotate||0,s.rotate||0,r))}function Wr(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const om=ro(0,.5,Ga),lm=ro(.5,.95,be);function ro(e,t,s){return r=>r<e?0:r>t?1:s(Pt(e,t,r))}function Kr(e,t){e.min=t.min,e.max=t.max}function xe(e,t){Kr(e.x,t.x),Kr(e.y,t.y)}function Hr(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function qr(e,t,s,r,a){return e-=t,e=ss(e,1/s,r),a!==void 0&&(e=ss(e,1/a,r)),e}function cm(e,t=0,s=1,r=.5,a,o=e,i=e){if(Te.test(t)&&(t=parseFloat(t),t=q(i.min,i.max,t/100)-i.min),typeof t!="number")return;let l=q(o.min,o.max,r);e===o&&(l-=t),e.min=qr(e.min,t,s,l,a),e.max=qr(e.max,t,s,l,a)}function Yr(e,t,[s,r,a],o,i){cm(e,t[s],t[r],t[a],t.scale,o,i)}const dm=["x","scaleX","originX"],um=["y","scaleY","originY"];function Xr(e,t,s,r){Yr(e.x,t,dm,s?s.x:void 0,r?r.x:void 0),Yr(e.y,t,um,s?s.y:void 0,r?r.y:void 0)}function Zr(e){return e.translate===0&&e.scale===1}function ao(e){return Zr(e.x)&&Zr(e.y)}function Jr(e,t){return e.min===t.min&&e.max===t.max}function mm(e,t){return Jr(e.x,t.x)&&Jr(e.y,t.y)}function Qr(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function io(e,t){return Qr(e.x,t.x)&&Qr(e.y,t.y)}function ea(e){return me(e.x)/me(e.y)}function ta(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class hm{constructor(){this.members=[]}add(t){bn(this.members,t),t.scheduleRender()}remove(t){if(vn(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(t){const s=this.members.findIndex(a=>t===a);if(s===0)return!1;let r;for(let a=s;a>=0;a--){const o=this.members[a];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,s){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,s&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:a}=t.options;a===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:s,resumingFrom:r}=t;s.onExitComplete&&s.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function fm(e,t,s){let r="";const a=e.x.translate/t.x,o=e.y.translate/t.y,i=s?.z||0;if((a||o||i)&&(r=`translate3d(${a}px, ${o}px, ${i}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:u,rotate:d,rotateX:m,rotateY:h,skewX:f,skewY:g}=s;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),m&&(r+=`rotateX(${m}deg) `),h&&(r+=`rotateY(${h}deg) `),f&&(r+=`skewX(${f}deg) `),g&&(r+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const js=["","X","Y","Z"],pm=1e3;let gm=0;function ws(e,t,s,r){const{latestValues:a}=t;a[e]&&(s[e]=a[e],t.setStaticValue(e,0),r&&(r[e]=0))}function oo(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=Ki(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:a,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",K,!(a||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&oo(r)}function lo({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:r,resetTransform:a}){return class{constructor(i={},l=t?.()){this.id=gm++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(bm),this.nodes.forEach(Nm),this.nodes.forEach(Sm),this.nodes.forEach(vm)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new nm)}addEventListener(i,l){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Nn),this.eventHandlers.get(i).add(l)}notifyListeners(i,...l){const c=this.eventHandlers.get(i);c&&c.notify(...l)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=Ni(i)&&!od(i),this.instance=i;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),e){let d,m=0;const h=()=>this.root.updateBlockedByResize=!1;K.read(()=>{m=window.innerWidth}),e(i,()=>{const f=window.innerWidth;f!==m&&(m=f,this.root.updateBlockedByResize=!0,d&&d(),d=rm(h,250),Yt.hasAnimatedSinceResize&&(Yt.hasAnimatedSinceResize=!1,this.nodes.forEach(ra)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:m,hasRelativeLayoutChanged:h,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||km,{onLayoutAnimationStart:w,onLayoutAnimationComplete:N}=u.getProps(),v=!this.targetLayout||!io(this.targetLayout,f),S=!m&&h;if(this.options.layoutRoot||this.resumeFrom||S||m&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const b={...In(g,"layout"),onPlay:w,onComplete:N};(u.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(d,S)}else m||ra(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Ie(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Cm),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&oo(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const m=this.path[d];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(sa);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(na);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(wm),this.nodes.forEach(xm),this.nodes.forEach(ym)):this.nodes.forEach(na),this.clearAllSnapshots();const l=fe.now();ie.delta=_e(0,1e3/60,l-ie.timestamp),ie.timestamp=l,ie.isProcessing=!0,ds.update.process(ie),ds.preRender.process(ie),ds.render.process(ie),ie.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ln.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(jm),this.sharedNodes.forEach(Pm)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,K.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){K.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!me(this.snapshot.measuredBox.x)&&!me(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Z(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:c,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!a)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!ao(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;i&&this.instance&&(l||Ge(this.latestValues)||d)&&(a(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return i&&(c=this.removeTransform(c)),Dm(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:i}=this.options;if(!i)return Z();const l=i.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(_m))){const{scroll:u}=this.root;u&&(at(l.x,u.offset.x),at(l.y,u.offset.y))}return l}removeElementScroll(i){const l=Z();if(xe(l,i),this.scroll?.wasRoot)return l;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:d,options:m}=u;u!==this.root&&d&&m.layoutScroll&&(d.wasRoot&&xe(l,i),at(l.x,d.offset.x),at(l.y,d.offset.y))}return l}applyTransform(i,l=!1){const c=Z();xe(c,i);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&it(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Ge(d.latestValues)&&it(c,d.latestValues)}return Ge(this.latestValues)&&it(c,this.latestValues),c}removeTransform(i){const l=Z();xe(l,i);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Ge(u.latestValues))continue;en(u.latestValues)&&u.updateSnapshot();const d=Z(),m=u.measurePageBox();xe(d,m),Xr(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Ge(this.latestValues)&&Xr(l,this.latestValues),l}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ie.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(i||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:m}=this.options;if(!(!this.layout||!(d||m))){if(this.resolvedRelativeTargetAt=ie.timestamp,!this.targetDelta&&!this.relativeTarget){const h=this.getClosestProjectingParent();h&&h.layout&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Z(),this.relativeTargetOrigin=Z(),St(this.relativeTargetOrigin,this.layout.layoutBox,h.layout.layoutBox),xe(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Z(),this.targetWithTransforms=Z()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Fu(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):xe(this.target,this.layout.layoutBox),Bi(this.target,this.targetDelta)):xe(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const h=this.getClosestProjectingParent();h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Z(),this.relativeTargetOrigin=Z(),St(this.relativeTargetOrigin,this.target,h.target),xe(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||en(this.parent.latestValues)||Oi(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){const i=this.getLead(),l=!!this.resumingFrom||this!==i;let c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===ie.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;xe(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,h=this.treeScale.y;Yd(this.layoutCorrected,this.treeScale,this.path,l),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=Z());const{target:f}=i;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Hr(this.prevProjectionDelta.x,this.projectionDelta.x),Hr(this.prevProjectionDelta.y,this.projectionDelta.y)),Nt(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==h||!ta(this.projectionDelta.x,this.prevProjectionDelta.x)||!ta(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){if(this.options.visualElement?.scheduleRender(),i){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ot(),this.projectionDelta=ot(),this.projectionDeltaWithTransform=ot()}setAnimationOrigin(i,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},m=ot();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const h=Z(),f=c?c.source:void 0,g=this.layout?this.layout.source:void 0,w=f!==g,N=this.getStack(),v=!N||N.members.length<=1,S=!!(w&&!v&&this.options.crossfade===!0&&!this.path.some(Am));this.animationProgress=0;let b;this.mixTargetDelta=A=>{const P=A/1e3;aa(m.x,i.x,P),aa(m.y,i.y,P),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(St(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Tm(this.relativeTarget,this.relativeTargetOrigin,h,P),b&&mm(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=Z()),xe(b,this.relativeTarget)),w&&(this.animationValues=d,im(d,u,this.latestValues,P,S,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=P},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Ie(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=K.update(()=>{Yt.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ct(0)),this.currentAnimation=tm(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:l=>{this.mixTargetDelta(l),i.onUpdate&&i.onUpdate(l)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(pm),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=i;if(!(!l||!c||!u)){if(this!==i&&this.layout&&u&&co(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Z();const m=me(this.layout.layoutBox.x);c.x.min=i.target.x.min,c.x.max=c.x.min+m;const h=me(this.layout.layoutBox.y);c.y.min=i.target.y.min,c.y.max=c.y.min+h}xe(l,c),it(l,d),Nt(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(i,l){this.sharedNodes.has(i)||this.sharedNodes.set(i,new hm),this.sharedNodes.get(i).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){const{layoutId:i}=this.options;return i?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:i}=this.options;return i?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),i&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let l=!1;const{latestValues:c}=i;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&ws("z",i,u,this.animationValues);for(let d=0;d<js.length;d++)ws(`rotate${js[d]}`,i,u,this.animationValues),ws(`skew${js[d]}`,i,u,this.animationValues);i.render();for(const d in u)i.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);i.scheduleRender()}applyProjectionStyles(i,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=qt(l?.pointerEvents)||"",i.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=qt(l?.pointerEvents)||""),this.hasProjected&&!Ge(this.latestValues)&&(i.transform=c?c({},""):"none",this.hasProjected=!1);return}i.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let m=fm(this.projectionDeltaWithTransform,this.treeScale,d);c&&(m=c(d,m)),i.transform=m;const{x:h,y:f}=this.projectionDelta;i.transformOrigin=`${h.origin*100}% ${f.origin*100}% 0`,u.animationValues?i.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:i.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const g in Dt){if(d[g]===void 0)continue;const{correct:w,applyTo:N,isCSSVariable:v}=Dt[g],S=m==="none"?d[g]:w(d[g],u);if(N){const b=N.length;for(let A=0;A<b;A++)i[N[A]]=S}else v?this.options.visualElement.renderState.vars[g]=S:i[g]=S}this.options.layoutId&&(i.pointerEvents=u===this?qt(l?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>i.currentAnimation?.stop()),this.root.nodes.forEach(sa),this.root.sharedNodes.clear()}}}function xm(e){e.updateLayout()}function ym(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=e.layout,{animationType:a}=e.options,o=t.source!==e.layout.source;a==="size"?ye(d=>{const m=o?t.measuredBox[d]:t.layoutBox[d],h=me(m);m.min=s[d].min,m.max=m.min+h}):co(a,t.layoutBox,s)&&ye(d=>{const m=o?t.measuredBox[d]:t.layoutBox[d],h=me(s[d]);m.max=m.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const i=ot();Nt(i,s,t.layoutBox);const l=ot();o?Nt(l,e.applyTransform(r,!0),t.measuredBox):Nt(l,s,t.layoutBox);const c=!ao(i);let u=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:m,layout:h}=d;if(m&&h){const f=Z();St(f,t.layoutBox,m.layoutBox);const g=Z();St(g,s,h.layoutBox),io(f,g)||(u=!0),d.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=f,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:l,layoutDelta:i,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function bm(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function vm(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function jm(e){e.clearSnapshot()}function sa(e){e.clearMeasurements()}function na(e){e.isLayoutDirty=!1}function wm(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function ra(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Nm(e){e.resolveTargetDelta()}function Sm(e){e.calcProjection()}function Cm(e){e.resetSkewAndRotation()}function Pm(e){e.removeLeadSnapshot()}function aa(e,t,s){e.translate=q(t.translate,0,s),e.scale=q(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function ia(e,t,s,r){e.min=q(t.min,s.min,r),e.max=q(t.max,s.max,r)}function Tm(e,t,s,r){ia(e.x,t.x,s.x,r),ia(e.y,t.y,s.y,r)}function Am(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const km={duration:.45,ease:[.4,0,.1,1]},oa=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),la=oa("applewebkit/")&&!oa("chrome/")?Math.round:be;function ca(e){e.min=la(e.min),e.max=la(e.max)}function Dm(e){ca(e.x),ca(e.y)}function co(e,t,s){return e==="position"||e==="preserve-aspect"&&!Iu(ea(t),ea(s),.2)}function _m(e){return e!==e.root&&e.scroll?.wasRoot}const Em=lo({attachResizeListener:(e,t)=>_t(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Ns={current:void 0},uo=lo({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Ns.current){const e=new Em({});e.mount(window),e.setOptions({layoutScroll:!0}),Ns.current=e}return Ns.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Mm={pan:{Feature:Zu},drag:{Feature:Xu,ProjectionNode:uo,MeasureLayout:so}};function da(e,t,s){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",s==="Start");const a="onHover"+s,o=r[a];o&&K.postRender(()=>o(t,Rt(t)))}class Vm extends Be{mount(){const{current:t}=this.node;t&&(this.unmount=sd(t,(s,r)=>(da(this.node,r,"Start"),a=>da(this.node,a,"End"))))}unmount(){}}class Rm extends Be{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Et(_t(this.node.current,"focus",()=>this.onFocus()),_t(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function ua(e,t,s){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",s==="Start");const a="onTap"+(s==="End"?"":s),o=r[a];o&&K.postRender(()=>o(t,Rt(t)))}class Im extends Be{mount(){const{current:t}=this.node;t&&(this.unmount=id(t,(s,r)=>(ua(this.node,r,"Start"),(a,{success:o})=>ua(this.node,a,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const ln=new WeakMap,Ss=new WeakMap,Fm=e=>{const t=ln.get(e.target);t&&t(e)},Lm=e=>{e.forEach(Fm)};function Om({root:e,...t}){const s=e||document;Ss.has(s)||Ss.set(s,{});const r=Ss.get(s),a=JSON.stringify(t);return r[a]||(r[a]=new IntersectionObserver(Lm,{root:e,...t})),r[a]}function Bm(e,t,s){const r=Om(t);return ln.set(e,s),r.observe(e),()=>{ln.delete(e),r.unobserve(e)}}const zm={some:0,all:1};class $m extends Be{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:s,margin:r,amount:a="some",once:o}=t,i={root:s?s.current:void 0,rootMargin:r,threshold:typeof a=="number"?a:zm[a]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:m}=this.node.getProps(),h=u?d:m;h&&h(c)};return Bm(this.node.current,i,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:s}=this.node;["amount","margin","root"].some(Um(t,s))&&this.startObserver()}unmount(){}}function Um({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const Gm={inView:{Feature:$m},tap:{Feature:Im},focus:{Feature:Rm},hover:{Feature:Vm}},Wm={layout:{ProjectionNode:uo,MeasureLayout:so}},Km={...Du,...Gm,...Mm,...Wm},st=Kd(Km,au);function mo(e){var t,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(s=mo(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function ho(){for(var e,t,s=0,r="",a=arguments.length;s<a;s++)(e=arguments[s])&&(t=mo(e))&&(r&&(r+=" "),r+=t);return r}const Xn="-",Hm=e=>{const t=Ym(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(Xn);return l[0]===""&&l.length!==1&&l.shift(),fo(l,t)||qm(i)},getConflictingClassGroupIds:(i,l)=>{const c=s[i]||[];return l&&r[i]?[...c,...r[i]]:c}}},fo=(e,t)=>{if(e.length===0)return t.classGroupId;const s=e[0],r=t.nextPart.get(s),a=r?fo(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const o=e.join(Xn);return t.validators.find(({validator:i})=>i(o))?.classGroupId},ma=/^\[(.+)\]$/,qm=e=>{if(ma.test(e)){const t=ma.exec(e)[1],s=t?.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},Ym=e=>{const{theme:t,classGroups:s}=e,r={nextPart:new Map,validators:[]};for(const a in s)cn(s[a],r,a,t);return r},cn=(e,t,s,r)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?t:ha(t,a);o.classGroupId=s;return}if(typeof a=="function"){if(Xm(a)){cn(a(r),t,s,r);return}t.validators.push({validator:a,classGroupId:s});return}Object.entries(a).forEach(([o,i])=>{cn(i,ha(t,o),s,r)})})},ha=(e,t)=>{let s=e;return t.split(Xn).forEach(r=>{s.nextPart.has(r)||s.nextPart.set(r,{nextPart:new Map,validators:[]}),s=s.nextPart.get(r)}),s},Xm=e=>e.isThemeGetter,Zm=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,r=new Map;const a=(o,i)=>{s.set(o,i),t++,t>e&&(t=0,r=s,s=new Map)};return{get(o){let i=s.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return a(o,i),i},set(o,i){s.has(o)?s.set(o,i):a(o,i)}}},dn="!",un=":",Jm=un.length,Qm=e=>{const{prefix:t,experimentalParseClassName:s}=e;let r=a=>{const o=[];let i=0,l=0,c=0,u;for(let g=0;g<a.length;g++){let w=a[g];if(i===0&&l===0){if(w===un){o.push(a.slice(c,g)),c=g+Jm;continue}if(w==="/"){u=g;continue}}w==="["?i++:w==="]"?i--:w==="("?l++:w===")"&&l--}const d=o.length===0?a:a.substring(c),m=eh(d),h=m!==d,f=u&&u>c?u-c:void 0;return{modifiers:o,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:f}};if(t){const a=t+un,o=r;r=i=>i.startsWith(a)?o(i.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(s){const a=r;r=o=>s({className:o,parseClassName:a})}return r},eh=e=>e.endsWith(dn)?e.substring(0,e.length-1):e.startsWith(dn)?e.substring(1):e,th=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const a=[];let o=[];return r.forEach(i=>{i[0]==="["||t[i]?(a.push(...o.sort(),i),o=[]):o.push(i)}),a.push(...o.sort()),a}},sh=e=>({cache:Zm(e.cacheSize),parseClassName:Qm(e),sortModifiers:th(e),...Hm(e)}),nh=/\s+/,rh=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],l=e.trim().split(nh);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:m,modifiers:h,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:w}=s(d);if(m){c=d+(c.length>0?" "+c:c);continue}let N=!!w,v=r(N?g.substring(0,w):g);if(!v){if(!N){c=d+(c.length>0?" "+c:c);continue}if(v=r(g),!v){c=d+(c.length>0?" "+c:c);continue}N=!1}const S=o(h).join(":"),b=f?S+dn:S,A=b+v;if(i.includes(A))continue;i.push(A);const P=a(v,N);for(let y=0;y<P.length;++y){const C=P[y];i.push(b+C)}c=d+(c.length>0?" "+c:c)}return c};function ah(){let e=0,t,s,r="";for(;e<arguments.length;)(t=arguments[e++])&&(s=po(t))&&(r&&(r+=" "),r+=s);return r}const po=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=po(e[r]))&&(s&&(s+=" "),s+=t);return s};function ih(e,...t){let s,r,a,o=i;function i(c){const u=t.reduce((d,m)=>m(d),e());return s=sh(u),r=s.cache.get,a=s.cache.set,o=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=rh(c,s);return a(c,d),d}return function(){return o(ah.apply(null,arguments))}}const se=e=>{const t=s=>s[e]||[];return t.isThemeGetter=!0,t},go=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xo=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oh=/^\d+\/\d+$/,lh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ch=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,dh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,uh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tt=e=>oh.test(e),z=e=>!!e&&!Number.isNaN(Number(e)),Me=e=>!!e&&Number.isInteger(Number(e)),Cs=e=>e.endsWith("%")&&z(e.slice(0,-1)),ke=e=>lh.test(e),hh=()=>!0,fh=e=>ch.test(e)&&!dh.test(e),yo=()=>!1,ph=e=>uh.test(e),gh=e=>mh.test(e),xh=e=>!D(e)&&!_(e),yh=e=>ft(e,jo,yo),D=e=>go.test(e),Ue=e=>ft(e,wo,fh),Ps=e=>ft(e,Nh,z),fa=e=>ft(e,bo,yo),bh=e=>ft(e,vo,gh),Bt=e=>ft(e,No,ph),_=e=>xo.test(e),xt=e=>pt(e,wo),vh=e=>pt(e,Sh),pa=e=>pt(e,bo),jh=e=>pt(e,jo),wh=e=>pt(e,vo),zt=e=>pt(e,No,!0),ft=(e,t,s)=>{const r=go.exec(e);return r?r[1]?t(r[1]):s(r[2]):!1},pt=(e,t,s=!1)=>{const r=xo.exec(e);return r?r[1]?t(r[1]):s:!1},bo=e=>e==="position"||e==="percentage",vo=e=>e==="image"||e==="url",jo=e=>e==="length"||e==="size"||e==="bg-size",wo=e=>e==="length",Nh=e=>e==="number",Sh=e=>e==="family-name",No=e=>e==="shadow",Ch=()=>{const e=se("color"),t=se("font"),s=se("text"),r=se("font-weight"),a=se("tracking"),o=se("leading"),i=se("breakpoint"),l=se("container"),c=se("spacing"),u=se("radius"),d=se("shadow"),m=se("inset-shadow"),h=se("text-shadow"),f=se("drop-shadow"),g=se("blur"),w=se("perspective"),N=se("aspect"),v=se("ease"),S=se("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...A(),_,D],y=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],p=()=>[_,D,c],E=()=>[tt,"full","auto",...p()],L=()=>[Me,"none","subgrid",_,D],j=()=>["auto",{span:["full",Me,_,D]},Me,_,D],O=()=>[Me,"auto",_,D],T=()=>["auto","min","max","fr",_,D],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...p()],W=()=>[tt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...p()],k=()=>[e,_,D],ce=()=>[...A(),pa,fa,{position:[_,D]}],de=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ae=()=>["auto","cover","contain",jh,yh,{size:[_,D]}],ze=()=>[Cs,xt,Ue],I=()=>["","none","full",u,_,D],B=()=>["",z,xt,Ue],ue=()=>["solid","dashed","dotted","double"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[z,Cs,pa,fa],M=()=>["","none",g,_,D],V=()=>["none",z,_,D],G=()=>["none",z,_,D],ve=()=>[z,_,D],et=()=>[tt,"full",...p()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ke],breakpoint:[ke],color:[hh],container:[ke],"drop-shadow":[ke],ease:["in","out","in-out"],font:[xh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ke],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ke],shadow:[ke],spacing:["px",z],text:[ke],"text-shadow":[ke],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",tt,D,_,N]}],container:["container"],columns:[{columns:[z,D,_,l]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:P()}],overflow:[{overflow:y()}],"overflow-x":[{"overflow-x":y()}],"overflow-y":[{"overflow-y":y()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{start:E()}],end:[{end:E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[Me,"auto",_,D]}],basis:[{basis:[tt,"full","auto",l,...p()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[z,tt,"auto","initial","none",D]}],grow:[{grow:["",z,_,D]}],shrink:[{shrink:["",z,_,D]}],order:[{order:[Me,"first","last","none",_,D]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:p()}],"gap-x":[{"gap-x":p()}],"gap-y":[{"gap-y":p()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:p()}],px:[{px:p()}],py:[{py:p()}],ps:[{ps:p()}],pe:[{pe:p()}],pt:[{pt:p()}],pr:[{pr:p()}],pb:[{pb:p()}],pl:[{pl:p()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":p()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":p()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",s,xt,Ue]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,_,Ps]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Cs,D]}],"font-family":[{font:[vh,D,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,_,D]}],"line-clamp":[{"line-clamp":[z,"none",_,Ps]}],leading:[{leading:[o,...p()]}],"list-image":[{"list-image":["none",_,D]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_,D]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ue(),"wavy"]}],"text-decoration-thickness":[{decoration:[z,"from-font","auto",_,Ue]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[z,"auto",_,D]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:p()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_,D]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",_,D]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:de()}],"bg-size":[{bg:Ae()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Me,_,D],radial:["",_,D],conic:[Me,_,D]},wh,bh]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:ze()}],"gradient-via-pos":[{via:ze()}],"gradient-to-pos":[{to:ze()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ue(),"hidden","none"]}],"divide-style":[{divide:[...ue(),"hidden","none"]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...ue(),"none","hidden"]}],"outline-offset":[{"outline-offset":[z,_,D]}],"outline-w":[{outline:["",z,xt,Ue]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","none",d,zt,Bt]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",m,zt,Bt]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[z,Ue]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",h,zt,Bt]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[z,_,D]}],"mix-blend":[{"mix-blend":[...he(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":he()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[z]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[_,D]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[z]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:de()}],"mask-size":[{mask:Ae()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_,D]}],filter:[{filter:["","none",_,D]}],blur:[{blur:M()}],brightness:[{brightness:[z,_,D]}],contrast:[{contrast:[z,_,D]}],"drop-shadow":[{"drop-shadow":["","none",f,zt,Bt]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",z,_,D]}],"hue-rotate":[{"hue-rotate":[z,_,D]}],invert:[{invert:["",z,_,D]}],saturate:[{saturate:[z,_,D]}],sepia:[{sepia:["",z,_,D]}],"backdrop-filter":[{"backdrop-filter":["","none",_,D]}],"backdrop-blur":[{"backdrop-blur":M()}],"backdrop-brightness":[{"backdrop-brightness":[z,_,D]}],"backdrop-contrast":[{"backdrop-contrast":[z,_,D]}],"backdrop-grayscale":[{"backdrop-grayscale":["",z,_,D]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[z,_,D]}],"backdrop-invert":[{"backdrop-invert":["",z,_,D]}],"backdrop-opacity":[{"backdrop-opacity":[z,_,D]}],"backdrop-saturate":[{"backdrop-saturate":[z,_,D]}],"backdrop-sepia":[{"backdrop-sepia":["",z,_,D]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":p()}],"border-spacing-x":[{"border-spacing-x":p()}],"border-spacing-y":[{"border-spacing-y":p()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_,D]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[z,"initial",_,D]}],ease:[{ease:["linear","initial",v,_,D]}],delay:[{delay:[z,_,D]}],animate:[{animate:["none",S,_,D]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,_,D]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:V()}],"rotate-x":[{"rotate-x":V()}],"rotate-y":[{"rotate-y":V()}],"rotate-z":[{"rotate-z":V()}],scale:[{scale:G()}],"scale-x":[{"scale-x":G()}],"scale-y":[{"scale-y":G()}],"scale-z":[{"scale-z":G()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[_,D,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:et()}],"translate-x":[{"translate-x":et()}],"translate-y":[{"translate-y":et()}],"translate-z":[{"translate-z":et()}],"translate-none":["translate-none"],accent:[{accent:k()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",_,D]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":p()}],"scroll-mx":[{"scroll-mx":p()}],"scroll-my":[{"scroll-my":p()}],"scroll-ms":[{"scroll-ms":p()}],"scroll-me":[{"scroll-me":p()}],"scroll-mt":[{"scroll-mt":p()}],"scroll-mr":[{"scroll-mr":p()}],"scroll-mb":[{"scroll-mb":p()}],"scroll-ml":[{"scroll-ml":p()}],"scroll-p":[{"scroll-p":p()}],"scroll-px":[{"scroll-px":p()}],"scroll-py":[{"scroll-py":p()}],"scroll-ps":[{"scroll-ps":p()}],"scroll-pe":[{"scroll-pe":p()}],"scroll-pt":[{"scroll-pt":p()}],"scroll-pr":[{"scroll-pr":p()}],"scroll-pb":[{"scroll-pb":p()}],"scroll-pl":[{"scroll-pl":p()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",_,D]}],fill:[{fill:["none",...k()]}],"stroke-w":[{stroke:[z,xt,Ue,Ps]}],stroke:[{stroke:["none",...k()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Ph=ih(Ch);function Zn(...e){return Ph(ho(e))}function Ts({className:e,...t}){return n.jsx("div",{"data-slot":"card",className:Zn("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function As({className:e,...t}){return n.jsx("div",{"data-slot":"card-content",className:Zn("px-6",e),...t})}function ga(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Th(...e){return t=>{let s=!1;const r=e.map(a=>{const o=ga(a,t);return!s&&typeof o=="function"&&(s=!0),o});if(s)return()=>{for(let a=0;a<r.length;a++){const o=r[a];typeof o=="function"?o():ga(e[a],null)}}}}function Ah(e){const t=Dh(e),s=x.forwardRef((r,a)=>{const{children:o,...i}=r,l=x.Children.toArray(o),c=l.find(Eh);if(c){const u=c.props.children,d=l.map(m=>m===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:m);return n.jsx(t,{...i,ref:a,children:x.isValidElement(u)?x.cloneElement(u,void 0,d):null})}return n.jsx(t,{...i,ref:a,children:o})});return s.displayName=`${e}.Slot`,s}var kh=Ah("Slot");function Dh(e){const t=x.forwardRef((s,r)=>{const{children:a,...o}=s;if(x.isValidElement(a)){const i=Vh(a),l=Mh(o,a.props);return a.type!==x.Fragment&&(l.ref=r?Th(r,i):i),x.cloneElement(a,l)}return x.Children.count(a)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _h=Symbol("radix.slottable");function Eh(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_h}function Mh(e,t){const s={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?s[r]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(s[r]=a):r==="style"?s[r]={...a,...o}:r==="className"&&(s[r]=[a,o].filter(Boolean).join(" "))}return{...e,...s}}function Vh(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}const xa=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ya=ho,Rh=(e,t)=>s=>{var r;if(t?.variants==null)return ya(e,s?.class,s?.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(u=>{const d=s?.[u],m=o?.[u];if(d===null)return null;const h=xa(d)||xa(m);return a[u][h]}),l=s&&Object.entries(s).reduce((u,d)=>{let[m,h]=d;return h===void 0||(u[m]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:m,className:h,...f}=d;return Object.entries(f).every(g=>{let[w,N]=g;return Array.isArray(N)?N.includes({...o,...l}[w]):{...o,...l}[w]===N})?[...u,m,h]:u},[]);return ya(e,i,c,s?.class,s?.className)},Ih=Rh("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function mn({className:e,variant:t,size:s,asChild:r=!1,...a}){const o=r?kh:"button";return n.jsx(o,{"data-slot":"button",className:Zn(Ih({variant:t,size:s,className:e})),...a})}const ks={DNI:"dni",CARNET_EXTRANJERIA:"carnet_extranjeria",PASAPORTE:"pasaporte"},ba={MALE:"male",FEMALE:"female"},Fh=[{name:"names",label:"Nombres *",placeholder:"Nombres completos"},{name:"paternal_surname",label:"Apellido Paterno *",placeholder:"Apellido paterno"},{name:"maternal_surname",label:"Apellido Materno *",placeholder:"Apellido materno"}],Lh=[{name:"phone_number",label:"Teléfono *",placeholder:"Número de teléfono",type:"tel"},{name:"whatsapp_number",label:"WhatsApp *",placeholder:"Número de WhatsApp",type:"tel"}],Oh=["names","paternal_surname","maternal_surname","birth_date","gender","phone_number","whatsapp_number","email"],Bh=()=>{const e=J(h=>h.user),t=J(h=>h.getValidatedInformation()),{loading:s,registerPersonalData:r}=Ne(),{register:a,handleSubmit:o,setError:i,clearErrors:l,setValue:c,formState:{errors:u}}=Le({resolver:Oe(Do),mode:"onChange",defaultValues:{document_type:"",document_number:"",names:"",paternal_surname:"",maternal_surname:"",birth_date:"",gender:"",phone_number:"",whatsapp_number:"",email:""}}),d=x.useMemo(()=>e?Oh.some(h=>!e[h]):!0,[e]);x.useEffect(()=>{if(!e)return;if(["document_type","document_number","names","paternal_surname","maternal_surname","gender","phone_number","whatsapp_number","email"].forEach(f=>{c(f,e[f]||"")}),e.birth_date){const g=new Date(e.birth_date).toISOString().split("T")[0];c("birth_date",g)}},[e,c]);const m=async h=>{console.log("data submited: ",h),l();const f=await r(h);if(!f.success){const g=f.error||"Error al actualizar información";R.error(g),f.fieldErrors&&Ze(f,i,g);return}R.success("Información personal actualizada correctamente")};return n.jsxs("div",{className:"w-full",children:[s&&n.jsx(pe,{message:"Guardando información..."}),t&&n.jsx("div",{className:"mb-6 bg-blue-50 border border-blue-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Aa,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-blue-900",children:"Información Validada"}),n.jsx("p",{className:"text-sm text-blue-700 mt-1",children:"Sus datos personales han sido validados. Solo puede editar información de contacto (correo, teléfono y WhatsApp)."})]})]})}),d&&n.jsx("div",{className:"mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Se,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-yellow-900",children:"Complete su información"}),n.jsx("p",{className:"text-sm text-yellow-700 mt-1",children:"Algunos campos están incompletos. Complete toda su información personal para continuar."})]})]})}),n.jsxs("form",{onSubmit:o(m),className:"space-y-6",children:[n.jsxs("section",{children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(Rs,{className:"w-5 h-5 text-blue-600"}),"Documento de Identidad"]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Tipo de Documento *"}),n.jsxs("select",{...a("document_type"),disabled:t||s,className:`w-full px-3 py-2 text-sm border rounded-lg transition-colors ${t||s?"bg-gray-100 cursor-not-allowed border-gray-300":"bg-white border-gray-300 hover:border-gray-400"}`,children:[n.jsx("option",{value:ks.DNI,children:"DNI"}),n.jsx("option",{value:ks.CARNET_EXTRANJERIA,children:"Carnet de Extranjería"}),n.jsx("option",{value:ks.PASAPORTE,children:"Pasaporte"})]}),n.jsx(U,{message:u.document_type?.message})]}),n.jsxs("div",{children:[n.jsx(oe,{...a("document_number"),type:"text",label:"Número de Documento *",placeholder:"Número de documento",icon:Rs,disabled:t,className:"bg-gray-100"}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"El número de documento no puede modificarse"})]})]})]}),n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(Re,{className:"w-5 h-5 text-blue-600"}),"Datos Personales"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:Fh.map(h=>n.jsxs("div",{children:[n.jsx(oe,{...a(h.name),type:"text",label:h.label,placeholder:h.placeholder,icon:Re,disabled:t||s,error:u[h.name]?.message}),n.jsx(U,{message:u[h.name]?.message})]},h.name))}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx(oe,{...a("birth_date"),type:"date",label:"Fecha de Nacimiento *",icon:ka,disabled:t||s,error:u.birth_date?.message}),n.jsx(U,{message:u.birth_date?.message})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Género *"}),n.jsxs("div",{className:"flex gap-6",children:[n.jsxs("label",{className:`flex items-center gap-2 text-sm ${t?"cursor-not-allowed opacity-50":"cursor-pointer hover:text-blue-600"}`,children:[n.jsx("input",{...a("gender"),type:"radio",value:ba.MALE,disabled:t||s,className:"w-4 h-4 text-blue-600"}),n.jsx("span",{children:"Masculino"})]}),n.jsxs("label",{className:`flex items-center gap-2 text-sm ${t?"cursor-not-allowed opacity-50":"cursor-pointer hover:text-blue-600"}`,children:[n.jsx("input",{...a("gender"),type:"radio",value:ba.FEMALE,disabled:t||s,className:"w-4 h-4 text-blue-600"}),n.jsx("span",{children:"Femenino"})]})]}),n.jsx(U,{message:u.gender?.message})]})]})]})]}),n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(Zt,{className:"w-5 h-5 text-blue-600"}),"Información de Contacto",t&&n.jsxs("span",{className:"ml-2 px-2 py-0.5 text-xs bg-green-100 text-green-700 rounded-full flex items-center gap-1",children:[n.jsx(ll,{className:"w-3 h-3"}),"Editable"]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:Lh.map(h=>n.jsxs("div",{children:[n.jsx(oe,{...a(h.name),type:h.type,label:h.label,placeholder:h.placeholder,icon:Zt,disabled:s,error:u[h.name]?.message}),n.jsx(U,{message:u[h.name]?.message})]},h.name))}),n.jsxs("div",{children:[n.jsx(oe,{...a("email"),type:"email",label:"Correo Electrónico *",placeholder:"correo@ejemplo.com",icon:Ta,disabled:s,error:u.email?.message}),n.jsx(U,{message:u.email?.message})]})]})]}),n.jsx("div",{className:"flex sm:justify-end pt-4",children:n.jsx(ne,{type:"submit",variant:"primary",size:"lg",text:s?"Guardando...":"Guardar Cambios",leftIcon:s?null:n.jsx(Je,{className:"w-5 h-5"}),loading:s,disabled:s,fullWidth:!0,className:"sm:w-auto"})})]})]})},zh=[{value:"",label:"Seleccione estado civil"},{value:"single",label:"Soltero/a"},{value:"married",label:"Casado/a"},{value:"divorced",label:"Divorciado/a"},{value:"cohabitant",label:"Conviviente"},{value:"widowed",label:"Viudo/a"}],$h=[{value:"español",label:"Español"},{value:"quechua",label:"Quechua"},{value:"inglés",label:"Inglés"},{value:"chino",label:"Chino"},{value:"portugués",label:"Portugués"}],Uh=()=>{const e=J(y=>y.user),{loading:t,registerAdditionalData:s}=Ne(),{fetchDistricts:r,getDistrict:a}=Qe(),o=e?.validated_information??!1,{register:i,handleSubmit:l,setError:c,clearErrors:u,setValue:d,control:m,watch:h,formState:{errors:f,isDirty:g}}=Le({resolver:Oe(_o),mode:"onChange",defaultValues:{birth_place_id:null,marital_status:"",languages:[],residence_address:"",residence_place_id:null}}),w=h("languages")||[];x.useEffect(()=>{e&&(d("birth_place_id",e.birth_place_id||null),d("marital_status",e.marital_status||""),d("languages",e.languages||[]),d("residence_address",e.residence_address||""),d("residence_place_id",e.residence_place_id||null))},[e,d]);const N=x.useMemo(()=>e?["birth_place_id","marital_status","languages","residence_address","residence_place_id"].some(C=>{const p=e[C];return Array.isArray(p)?p.length===0:!p}):!0,[e]),v=x.useCallback(async y=>{try{return(await r({search:y,include:"province.department.country"})).data||[]}catch(C){return console.error("Error buscando distritos:",C),R.error("Error al buscar distritos"),[]}},[]),S=x.useCallback(async y=>{try{return(await a(y)).data}catch(C){return console.error("Error cargando distrito:",C),null}},[]),b=x.useCallback(y=>n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"font-medium text-gray-900",children:y.name}),n.jsxs("div",{className:"text-xs text-gray-500",children:[y.province?.name,", ",y.province?.department?.name,","," ",y.province?.department?.country?.name]})]}),[]),A=x.useCallback(y=>y?[y.province?.department?.country?.name,y.province?.department?.name,y.province?.name,y.name].filter(Boolean).join(", "):"",[]),P=async y=>{u();const C=await s(y);if(!C.success){const p=C.error||"Error al actualizar información adicional";R.error(p),C.fieldErrors&&Ze(C,c,p);return}R.success("Información adicional actualizada correctamente")};return n.jsxs("div",{className:"w-full",children:[t&&n.jsx(pe,{message:"Guardando información..."}),o&&n.jsx("div",{className:"mb-6 bg-blue-50 border border-blue-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Aa,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-blue-900",children:"Información Validada"}),n.jsx("p",{className:"text-sm text-blue-700 mt-1",children:"Su lugar de nacimiento ha sido validado y no puede modificarse. Puede editar estado civil, idiomas y datos de residencia."})]})]})}),N&&n.jsx("div",{className:"mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(ls,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-yellow-900",children:"Complete su información adicional"}),n.jsx("p",{className:"text-sm text-yellow-700 mt-1",children:"Complete todos los campos para continuar con el proceso de inscripción."})]})]})}),n.jsxs("form",{onSubmit:l(P),className:"space-y-6",children:[n.jsxs("section",{children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(_a,{className:"w-5 h-5 text-blue-600"}),"Lugar de Nacimiento"]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Distrito de Nacimiento *"}),n.jsx(Vs,{name:"birth_place_id",control:m,render:({field:y})=>n.jsx(Is,{value:y.value,onChange:y.onChange,onSearch:v,onLoadSelected:S,renderOption:b,getDisplayText:A,initialItem:e?.birth_district,placeholder:"Buscar distrito de nacimiento...",searchPlaceholder:"Buscar distrito...",error:f.birth_place_id?.message,disabled:o||t,minSearchLength:3,manualSearch:!0})}),n.jsx(U,{message:f.birth_place_id?.message}),o?n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"El lugar de nacimiento está validado y no puede modificarse"}):n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:'Escriba al menos 3 letras y presione "Buscar"'})]})]}),n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(rl,{className:"w-5 h-5 text-blue-600"}),"Información Personal"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Estado Civil *"}),n.jsx("select",{...i("marital_status"),disabled:t,className:`w-full px-3 py-2 text-sm border rounded-lg transition-colors ${f.marital_status?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500"} ${t?"bg-gray-100 cursor-not-allowed":"bg-white hover:border-gray-400"}`,children:zh.map(y=>n.jsx("option",{value:y.value,children:y.label},y.value))}),n.jsx(U,{message:f.marital_status?.message})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Idiomas que domina *",w.length>0&&n.jsxs("span",{className:"ml-2 text-xs text-blue-600 font-normal",children:["(",w.length," seleccionado",w.length!==1?"s":"",")"]})]}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:$h.map(y=>n.jsxs("label",{className:`flex items-center gap-2 p-3 border rounded-lg cursor-pointer transition-colors ${t?"bg-gray-100 cursor-not-allowed opacity-50":"hover:bg-blue-50 hover:border-blue-300"}`,children:[n.jsx("input",{type:"checkbox",value:y.value,...i("languages"),disabled:t,className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500"}),n.jsx("span",{className:"text-sm",children:y.label})]},y.value))}),n.jsx(U,{message:f.languages?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Seleccione al menos un idioma"})]})]})]}),n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(ls,{className:"w-5 h-5 text-blue-600"}),"Residencia Actual"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx(oe,{...i("residence_address"),type:"text",label:"Dirección de Residencia *",placeholder:"Av. Principal 123, Referencia: Cerca al parque",icon:ls,disabled:t,error:f.residence_address?.message}),n.jsx(U,{message:f.residence_address?.message})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Distrito de Residencia *"}),n.jsx(Vs,{name:"residence_place_id",control:m,render:({field:y})=>n.jsx(Is,{value:y.value,onChange:y.onChange,onSearch:v,onLoadSelected:S,renderOption:b,getDisplayText:A,initialItem:e?.residence_district,placeholder:"Buscar distrito de residencia...",searchPlaceholder:"Buscar distrito...",error:f.residence_place_id?.message,disabled:t,minSearchLength:3,manualSearch:!0})}),n.jsx(U,{message:f.residence_place_id?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:'Escriba al menos 3 letras y presione "Buscar"'})]})]})]}),n.jsx("div",{className:"flex sm:justify-end pt-4",children:n.jsx(ne,{type:"submit",variant:"primary",size:"lg",text:t?"Guardando...":"Guardar Cambios",leftIcon:t?null:n.jsx(Je,{className:"w-5 h-5"}),loading:t,disabled:t||!g,fullWidth:!0,className:"sm:w-auto"})})]})]})},Gh=[{value:"",label:"Elige una opción"},{value:"dni",label:"DNI"},{value:"carnet_extranjeria",label:"Carnet de Extranjería"},{value:"pasaporte",label:"Pasaporte"}],Wh=[{value:"",label:"Seleccione parentesco"},{value:"padre",label:"Padre"},{value:"madre",label:"Madre"},{value:"hermano",label:"Hermano/a"},{value:"abuelo",label:"Abuelo/a"},{value:"tio",label:"Tío/a"},{value:"primo",label:"Primo/a"},{value:"conyuge",label:"Cónyuge"},{value:"hijo",label:"Hijo/a"},{value:"amigo",label:"Amigo/a"},{value:"compañero",label:"Compañero/a"},{value:"otro",label:"Otro"}],Kh=()=>{const e=J(T=>T.user),{loading:t,registerFamilyData:s,checkStudent:r}=Ne(),[a,o]=x.useState([]),[i,l]=x.useState(!1),[c,u]=x.useState(!1),[d,m]=x.useState({names:!1,paternal_surname:!1,maternal_surname:!1}),{register:h,handleSubmit:f,setError:g,clearErrors:w,reset:N,watch:v,setValue:S,formState:{errors:b}}=Le({resolver:Oe(Eo),mode:"onChange",defaultValues:{document_type:"",document_number:"",names:"",paternal_surname:"",maternal_surname:"",relationship:"",phone_number:"",email:"",occupation:"",data_source:"manual"}}),A=v("document_type"),P=v("document_number");x.useEffect(()=>{e?.family_data&&Array.isArray(e.family_data)&&e.family_data.length>0&&o(e.family_data)},[e]),x.useEffect(()=>{(d.names||d.paternal_surname||d.maternal_surname)&&(S("names",""),S("paternal_surname",""),S("maternal_surname",""),S("data_source","manual"),m({names:!1,paternal_surname:!1,maternal_surname:!1}))},[P]);const y=async()=>{if(!A||!P){R.error("Complete el tipo y número de documento");return}if(A==="dni"&&P.length!==8){R.error("El DNI debe tener 8 dígitos");return}u(!0);const T=await r({document_type:A,document_number:P});if(u(!1),T.success&&T.data){T.data.names&&S("names",T.data.names),T.data.paternal_surname&&S("paternal_surname",T.data.paternal_surname),T.data.maternal_surname&&S("maternal_surname",T.data.maternal_surname),S("data_source",T.source==="database"?"database":"reniec"),m({names:!!T.data.names,paternal_surname:!!T.data.paternal_surname,maternal_surname:!!T.data.maternal_surname});const $=T.source==="database"?"el sistema":"RENIEC";R.success(`Datos encontrados en ${$}`)}else R.info("No se encontraron datos. Complete el formulario manualmente."),S("data_source","manual"),m({names:!1,paternal_surname:!1,maternal_surname:!1})},C=x.useMemo(()=>a.length<1,[a]),p=()=>{l(!0),m({names:!1,paternal_surname:!1,maternal_surname:!1})},E=()=>{N(),l(!1),m({names:!1,paternal_surname:!1,maternal_surname:!1})},L=T=>{if(a.length>=2){R.error("Máximo 2 familiares permitidos");return}if(a.some(H=>H.document_number===T.document_number)){R.error("Ya existe un familiar con ese número de documento");return}o([...a,T]),R.success("Familiar agregado correctamente"),E()},j=T=>{const $=a.filter((H,Q)=>Q!==T);o($),R.success("Familiar eliminado")},O=async()=>{if(w(),a.length<1){R.error("Debe registrar al menos 1 familiar");return}const $=await s({family_data:a});if(!$.success){const H=$.error||"Error al actualizar información familiar";R.error(H),$.fieldErrors&&Ze($,g,H);return}R.success("Información familiar actualizada correctamente")};return n.jsxs("div",{className:"w-full",children:[t&&n.jsx(pe,{message:"Guardando información..."}),c&&n.jsx(pe,{message:"Buscando información..."}),C&&n.jsx("div",{className:"mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Se,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-yellow-900",children:"Complete la información familiar"}),n.jsxs("p",{className:"text-sm text-yellow-700 mt-1",children:["Debe registrar al menos 1 familiar para continuar con el proceso de inscripción. Actualmente tiene ",a.length," ","familiar(es) registrado(s)."]})]})]})}),n.jsxs("div",{className:"space-y-6",children:[a.length<2&&n.jsx("div",{className:"flex justify-center mb-6",children:n.jsx(ne,{type:"button",variant:"primary",size:"md",text:"Insertar Familiar",leftIcon:n.jsx(Jn,{className:"w-5 h-5"}),onClick:p,disabled:t})}),n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(Fs,{className:"w-5 h-5 text-blue-600"}),"Familiares Registrados (",a.length,")"]}),a.length===0?n.jsxs("div",{className:"text-center py-8 bg-gray-50 rounded-lg border border-gray-200",children:[n.jsx(Fs,{className:"w-12 h-12 mx-auto text-gray-400 mb-2"}),n.jsx("p",{className:"text-gray-600",children:"No hay familiares registrados"}),n.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Agregue al menos 1 familiar para continuar"})]}):n.jsx("div",{className:"overflow-x-auto border border-gray-200 rounded-lg",children:n.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[n.jsx("thead",{className:"bg-gray-50",children:n.jsxs("tr",{children:[n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Documento"}),n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Nombre"}),n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Apellidos"}),n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Teléfono"}),n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Email"}),n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Parentesco"}),n.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Acciones"})]})}),n.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:a.map((T,$)=>n.jsxs("tr",{className:"hover:bg-gray-50",children:[n.jsxs("td",{className:"px-4 py-3 text-sm text-gray-900 whitespace-nowrap",children:[T.document_type," ",T.document_number]}),n.jsx("td",{className:"px-4 py-3 text-sm text-gray-900",children:T.names}),n.jsxs("td",{className:"px-4 py-3 text-sm text-gray-900",children:[T.paternal_surname," ",T.maternal_surname]}),n.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 whitespace-nowrap",children:T.phone_number}),n.jsx("td",{className:"px-4 py-3 text-sm text-gray-900",children:T.email||"-"}),n.jsx("td",{className:"px-4 py-3 text-sm text-gray-900",children:T.relationship}),n.jsx("td",{className:"px-4 py-3 text-center",children:n.jsx("button",{type:"button",onClick:()=>j($),disabled:t,className:"inline-flex items-center justify-center w-8 h-8 text-red-600 hover:bg-red-50 rounded-lg transition-colors disabled:opacity-50",title:"Eliminar familiar",children:n.jsx(Ls,{className:"w-4 h-4"})})})]},$))})]})})]}),n.jsx("div",{className:"flex sm:justify-end pt-4 border-t",children:n.jsx(ne,{type:"button",variant:"primary",size:"lg",text:t?"Guardando...":"Guardar Cambios",leftIcon:t?null:n.jsx(Je,{className:"w-5 h-5"}),loading:t,disabled:t||a.length<1,onClick:O,fullWidth:!0,className:"sm:w-auto"})})]}),n.jsx(Da,{isOpen:i,onClose:E,title:"Registrar Familiar",size:"lg",closeOnClickOutside:!1,children:n.jsxs("form",{onSubmit:f(L),className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Tipo de Documento *"}),n.jsx("select",{...h("document_type"),disabled:t||c,className:`w-full px-3 py-2 text-sm border rounded-lg transition-colors ${b.document_type?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500"} ${t||c?"bg-gray-100 cursor-not-allowed":"bg-white hover:border-gray-400"}`,children:Gh.map(T=>n.jsx("option",{value:T.value,children:T.label},T.value))}),n.jsx(U,{message:b.document_type?.message})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Número de Documento *"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("div",{className:"flex-1",children:n.jsx("input",{...h("document_number"),type:"text",placeholder:"Número de documento",disabled:t||c,className:`w-full px-3 py-2 text-sm border rounded-lg transition-colors ${b.document_number?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500"} ${t||c?"bg-gray-100 cursor-not-allowed":"bg-white hover:border-gray-400"}`})}),A=="dni"&&n.jsx(ne,{type:"button",variant:"secondary",size:"md",text:c?"Buscando...":"Buscar",onClick:y,loading:c,disabled:t||c||!A||A!="dni"||!P,className:"whitespace-nowrap"})]}),n.jsx(U,{message:b.document_number?.message}),d.names&&n.jsxs("p",{className:"text-xs text-green-600 mt-1 flex items-center gap-1",children:[n.jsx(Rs,{className:"w-3 h-3"}),"Datos verificados"]})]})]}),n.jsxs("div",{children:[n.jsx(oe,{...h("names"),type:"text",label:"Nombres *",placeholder:"Nombres completos",icon:Re,disabled:t||c||d.names,error:b.names?.message}),n.jsx(U,{message:b.names?.message}),d.names&&n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Campo bloqueado (datos verificados)"})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx(oe,{...h("paternal_surname"),type:"text",label:"Apellido Paterno *",placeholder:"Apellido paterno",icon:Re,disabled:t||c||d.paternal_surname,error:b.paternal_surname?.message}),n.jsx(U,{message:b.paternal_surname?.message}),d.paternal_surname&&n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Campo bloqueado (datos verificados)"})]}),n.jsxs("div",{children:[n.jsx(oe,{...h("maternal_surname"),type:"text",label:"Apellido Materno *",placeholder:"Apellido materno",icon:Re,disabled:t||c||d.maternal_surname,error:b.maternal_surname?.message}),n.jsx(U,{message:b.maternal_surname?.message}),d.maternal_surname&&n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Campo bloqueado (datos verificados)"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Parentesco *"}),n.jsx("select",{...h("relationship"),disabled:t,className:`w-full px-3 py-2 text-sm border rounded-lg transition-colors ${b.relationship?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500"} ${t?"bg-gray-100 cursor-not-allowed":"bg-white hover:border-gray-400"}`,children:Wh.map(T=>n.jsx("option",{value:T.value,children:T.label},T.value))}),n.jsx(U,{message:b.relationship?.message})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx(oe,{...h("phone_number"),type:"tel",label:"Número de Celular *",placeholder:"999999999",icon:Zt,disabled:t,error:b.phone_number?.message}),n.jsx(U,{message:b.phone_number?.message})]}),n.jsxs("div",{children:[n.jsx(oe,{...h("email"),type:"email",label:"Correo Electrónico (Opcional)",placeholder:"correo@ejemplo.com",icon:Ta,disabled:t,error:b.email?.message}),n.jsx(U,{message:b.email?.message})]})]}),n.jsxs("div",{children:[n.jsx(oe,{...h("occupation"),type:"text",label:"Ocupación *",placeholder:"Profesión u ocupación",icon:Ho,disabled:t,error:b.occupation?.message}),n.jsx(U,{message:b.occupation?.message})]}),n.jsxs("div",{className:"flex gap-3 justify-end pt-4 border-t border-gray-200",children:[n.jsx(ne,{type:"button",variant:"secondary",size:"md",text:"Cancelar",onClick:E,disabled:t||c}),n.jsx(ne,{type:"submit",variant:"primary",size:"md",text:"Agregar Familiar",leftIcon:n.jsx(Jn,{className:"w-5 h-5"}),disabled:t||c})]})]})})]})},Hh=[{value:"first",label:"1RO"},{value:"second",label:"2DO"},{value:"third",label:"3RO"},{value:"fourth",label:"4TO"},{value:"fifth",label:"5TO"}],qh=()=>{const e=J(j=>j.user),t=J(j=>j.meta),{fetchSchools:s,getSchool:r}=Qe(),{loading:a,registerSchoolData:o}=Ne(),[i,l]=x.useState(null),[c,u]=x.useState([]),{register:d,handleSubmit:m,setError:h,clearErrors:f,setValue:g,control:w,watch:N,formState:{errors:v,isDirty:S}}=Le({resolver:Oe(Mo),mode:"onChange",defaultValues:{school_id:null,completed_school:null,completion_year:"",grade_school:""}}),b=N("completed_school");x.useEffect(()=>{if(!e)return;const j=t.enrollment.grade_school?String(t.enrollment.grade_school):"",O=e.school_graduation_year?String(e.school_graduation_year):"";let T=null;O?T=!0:j&&(T=!1),g("school_id",e.school_id||null),g("completed_school",T),g("completion_year",O),g("grade_school",j),e.school&&l(e.school)},[e,g]);const A=x.useMemo(()=>{if(!e||!e.school_id)return!0;const j=t.enrollment?.grade_school;return e.school_graduation_year?!1:!j},[e]),P=x.useCallback(async j=>{try{const T=(await s({search:j,include:"district.province.department.country"})).data||[];return u(T),T}catch(O){return console.error("Error buscando colegios:",O),R.error("Error al buscar colegios"),[]}},[]),y=x.useCallback(async j=>{try{return(await r(j)).data}catch(O){return console.error("Error cargando colegio:",O),null}},[]),C=x.useCallback(j=>n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"font-medium text-gray-900",children:j.name}),n.jsxs("div",{className:"text-xs text-gray-500",children:["Código: ",j.code," • ",j.level," • ",j.sector,j.district&&` • ${j.district.name}`]})]}),[]),p=x.useCallback(j=>j?`${j.name} - ${j.code}`:"",[]),E=async(j,O)=>{g("school_id",j,{shouldDirty:!0});const T=c.find($=>$.id===j);if(T)l(T);else if(O)l(O);else if(j){const $=await y(j);$&&l($)}else l(null)},L=async j=>{f();let O={};j.completed_school===!0?O={school_id:j.school_id,school_graduation_year:j.completion_year,grade_school:null}:O={school_id:j.school_id,grade_school:j.grade_school,school_graduation_year:null};const T=await o(O);if(!T.success){const $=T.error||"Error al actualizar información escolar";R.error($),T.fieldErrors&&Ze(T,h,$);return}R.success("Información escolar actualizada correctamente")};return n.jsxs("div",{className:"w-full",children:[a&&n.jsx(pe,{message:"Guardando información..."}),A&&n.jsx("div",{className:"mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Se,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-yellow-900",children:"Complete su información escolar"}),n.jsx("p",{className:"text-sm text-yellow-700 mt-1",children:"Complete todos los campos para continuar con el proceso de inscripción."})]})]})}),n.jsxs("form",{onSubmit:m(L),className:"space-y-6",children:[n.jsxs("section",{children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(fn,{className:"w-5 h-5 text-blue-600"}),"Colegio de Procedencia"]}),n.jsx("div",{className:"mt-3 bg-blue-50 border border-blue-200 rounded-lg p-3",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(pn,{className:"w-4 h-4 text-blue-600 flex-shrink-0 mt-0.5"}),n.jsx("p",{className:"text-xs text-blue-800",children:"Si no encuentras tu colegio, selecciona alguno que conozcas y acércate a la oficina para reportarlo"})]})}),n.jsxs("div",{className:"mb-6",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Buscar Colegio *"}),n.jsx(Vs,{name:"school_id",control:w,render:({field:j})=>n.jsx(Is,{value:j.value,onChange:(O,T)=>{j.onChange(O),E(O,T)},onSearch:P,onLoadSelected:y,renderOption:C,getDisplayText:p,initialItem:e?.school,placeholder:"Escribe el nombre completo de tu colegio...",searchPlaceholder:"Buscar colegio...",error:v.school_id?.message,disabled:a,minSearchLength:3,manualSearch:!0})}),n.jsx(U,{message:v.school_id?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:'Escriba al menos 3 letras y presione "Buscar"'})]}),i&&n.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[n.jsx(De,{className:"w-5 h-5 text-green-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-green-900",children:"Colegio Seleccionado"}),n.jsx("p",{className:"text-xs text-green-700",children:"Información verificada del centro educativo"})]})]}),n.jsxs("div",{className:"bg-white rounded-lg p-4 border border-green-200",children:[n.jsx("h5",{className:"text-lg font-bold text-gray-900 mb-1",children:i.name}),n.jsxs("p",{className:"text-sm text-gray-600 mb-4",children:["Código: ",i.code]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 mb-4",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-medium text-gray-500 uppercase block mb-1",children:"Nivel"}),n.jsx("p",{className:"text-sm font-medium text-gray-900",children:i.level||"No especificado"})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-medium text-gray-500 uppercase block mb-1",children:"Sector"}),n.jsx("p",{className:"text-sm font-medium text-gray-900",children:i.sector||"No especificado"})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-medium text-gray-500 uppercase block mb-1",children:"UGEL"}),n.jsx("p",{className:"text-sm font-medium text-gray-900",children:i.ugel||"No especificado"})]})]}),i.district&&n.jsx("div",{className:"pt-4 border-t border-gray-200",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(_a,{className:"w-4 h-4 text-gray-400 mt-0.5 flex-shrink-0"}),n.jsxs("div",{className:"text-sm text-gray-600",children:[n.jsx("span",{className:"text-xs font-medium text-gray-500 uppercase block mb-1",children:"Ubicación"}),[i.district.name,i.district.province?.name,i.district.province?.department?.name,i.district.province?.department?.country?.name].filter(Boolean).join(" • ")]})]})})]})]})]}),n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(De,{className:"w-5 h-5 text-blue-600"}),"Estado de Estudios"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"¿Culminó el colegio? *"}),n.jsxs("div",{className:"flex gap-6",children:[n.jsxs("label",{className:`flex items-center gap-2 text-sm ${a?"cursor-not-allowed opacity-50":"cursor-pointer hover:text-blue-600"}`,children:[n.jsx("input",{type:"radio",value:"true",checked:b===!0,onChange:()=>{g("completed_school",!0,{shouldDirty:!0}),g("grade_school","")},disabled:a,className:"w-4 h-4 text-blue-600"}),n.jsx("span",{children:"Sí"})]}),n.jsxs("label",{className:`flex items-center gap-2 text-sm ${a?"cursor-not-allowed opacity-50":"cursor-pointer hover:text-blue-600"}`,children:[n.jsx("input",{type:"radio",value:"false",checked:b===!1,onChange:()=>{g("completed_school",!1,{shouldDirty:!0}),g("completion_year","")},disabled:a,className:"w-4 h-4 text-blue-600"}),n.jsx("span",{children:"No"})]})]}),n.jsx(U,{message:v.completed_school?.message})]}),b===!0&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Año de Culminación *"}),n.jsx("input",{...d("completion_year"),type:"text",placeholder:"2020",disabled:a,maxLength:4,className:`w-full px-3 py-2 text-sm border rounded-lg transition-colors ${v.completion_year?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500"} ${a?"bg-gray-100 cursor-not-allowed":"bg-white hover:border-gray-400"}`}),v.completion_year&&n.jsx("p",{className:"text-sm text-red-600 mt-1",children:v.completion_year.message}),n.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Ingrese el año en que culminó la secundaria (entre 1950 y"," ",new Date().getFullYear(),")"]})]}),b===!1&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Grado en que se encuentra *"}),n.jsx("div",{className:"grid grid-cols-5 gap-3",children:Hh.map(j=>n.jsxs("label",{className:`flex flex-col items-center justify-center p-3 border-2 rounded-lg cursor-pointer transition-all ${N("grade_school")===j.value?"border-blue-600 bg-blue-50":"border-gray-300 hover:border-blue-300 hover:bg-blue-50"} ${v.grade_school?"border-red-500 bg-red-50":""} ${a?"opacity-50 cursor-not-allowed":""}`,children:[n.jsx("input",{...d("grade_school"),type:"radio",value:j.value,disabled:a,className:"sr-only"}),n.jsx("span",{className:"text-lg font-bold text-gray-900",children:j.label})]},j.value))}),n.jsx(U,{message:v.grade_school?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Seleccione el grado que está cursando actualmente"})]})]})]}),n.jsx("div",{className:"flex sm:justify-end pt-4",children:n.jsx(ne,{type:"submit",variant:"primary",size:"lg",text:a?"Guardando...":"Guardar Cambios",leftIcon:a?null:n.jsx(Je,{className:"w-5 h-5"}),loading:a,disabled:a||!S,fullWidth:!0,className:"sm:w-auto"})})]})]})},Yh=[{value:"facebook",label:"Facebook"},{value:"tiktok",label:"Tiktok"},{value:"whatsapp",label:"WhatsApp"},{value:"radio",label:"Radio"},{value:"recomendacion",label:"Recomendación"},{value:"otro",label:"Otro"}],Xh=()=>{const e=J(y=>y.user),t=J(y=>y.meta),{loading:s,registerCareerData:r}=Ne(),[a,o]=x.useState([]),[i,l]=x.useState(!0),{fetchCareers:c}=Qe(),{register:u,handleSubmit:d,setError:m,clearErrors:h,setValue:f,watch:g,formState:{errors:w,isDirty:N}}=Le({resolver:Oe(Vo),mode:"onChange",defaultValues:{career_id:null,information_sources:[]}}),v=g("career_id"),S=g("information_sources"),b=x.useMemo(()=>{if(!S)return[];if(Array.isArray(S))return S;if(typeof S=="string")try{const y=JSON.parse(S);return Array.isArray(y)?y:[]}catch{return[]}return[]},[S]);x.useEffect(()=>{(async()=>{l(!0);try{const C=await c();C.data&&o(C.data)}catch(C){console.error("Error buscando carreras:",C),R.error("Error al buscar carreras")}finally{l(!1)}})()},[]),x.useEffect(()=>{if(!e||i||a.length===0)return;const y=t?.enrollment?.career_id||null;let C=t?.enrollment?.information_sources||[];if(typeof C=="string")try{C=JSON.parse(C)}catch(p){console.error("Error parseando information_sources:",p),C=[]}Array.isArray(C)||(C=[]),y&&a.find(E=>E.id===y)&&f("career_id",y),f("information_sources",C)},[e,f,a,i]);const A=x.useMemo(()=>{if(!e)return!0;const y=t?.enrollment?.career_id,C=t?.enrollment?.information_sources;return!y||!C||C.length===0},[e]),P=async y=>{h();const C=await r(y);if(!C.success){const p=C.error||"Error al actualizar información de carrera";R.error(p),C.fieldErrors&&Ze(C,m,p);return}R.success("Información de carrera actualizada correctamente")};return n.jsxs("div",{className:"w-full",children:[(s||i)&&n.jsx(pe,{message:"Cargando..."}),n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 bg-orange-100 rounded-full mb-3",children:n.jsx(Ct,{className:"w-6 h-6 text-orange-600"})}),n.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"Carrera Profesional"}),n.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Selecciona la carrera y cómo te enteraste de nosotros"})]}),A&&n.jsx("div",{className:"mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Se,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-yellow-900",children:"Complete la información de carrera"}),n.jsx("p",{className:"text-sm text-yellow-700 mt-1",children:"Seleccione su carrera de interés y al menos un medio de información."})]})]})}),n.jsxs("form",{onSubmit:d(P),className:"space-y-6",children:[n.jsxs("section",{children:[n.jsx("h3",{className:"text-base font-semibold text-gray-900 mb-4",children:"Carrera de Interés"}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Carrera Profesional *"}),n.jsxs("select",{...u("career_id",{setValueAs:y=>y===""?null:parseInt(y)}),disabled:s||i,className:`w-full px-3 py-2 text-sm border rounded-lg transition-colors ${w.career_id?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500"} ${s||i?"bg-gray-100 cursor-not-allowed":"bg-white hover:border-gray-400"}`,children:[n.jsx("option",{value:"",children:"Elige una carrera"}),a.map(y=>n.jsx("option",{value:y.id,children:y.name},y.id))]}),n.jsx(U,{message:w.career_id?.message}),v&&n.jsxs("p",{className:"text-xs text-green-600 mt-1 flex items-center gap-1",children:[n.jsx(Ct,{className:"w-3 h-3"}),"Carrera seleccionada"]})||""]})]}),n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(pn,{className:"w-5 h-5 text-blue-600"}),"Medios de Información"]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["¿Cómo se enteró del inicio de la convocatoria? *",b.length>0&&n.jsxs("span",{className:"ml-2 text-xs text-blue-600 font-normal",children:["(",b.length," seleccionado",b.length!==1?"s":"",")"]})]}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:Yh.map(y=>n.jsxs("label",{className:`flex items-center gap-2 p-3 border rounded-lg cursor-pointer transition-colors ${b.includes(y.value)?"border-blue-600 bg-blue-50":"border-gray-300 hover:border-blue-300 hover:bg-blue-50"} ${s?"bg-gray-100 cursor-not-allowed opacity-50":""}`,children:[n.jsx("input",{type:"checkbox",value:y.value,checked:b.includes(y.value),onChange:C=>{const p=C.target.value,E=b||[];C.target.checked?f("information_sources",[...E,p],{shouldDirty:!0}):f("information_sources",E.filter(L=>L!==p),{shouldDirty:!0})},disabled:s,className:"w-4 h-4 text-blue-600 rounded focus:ring-blue-500"}),n.jsx("span",{className:"text-sm",children:y.label})]},y.value))}),n.jsx(U,{message:w.information_sources?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Seleccione al menos un medio por el cual se enteró de la convocatoria"})]})]}),n.jsx("div",{className:"flex sm:justify-end pt-4",children:n.jsx(ne,{type:"submit",variant:"primary",size:"lg",text:s?"Guardando...":"Guardar Cambios",leftIcon:s?null:n.jsx(Je,{className:"w-5 h-5"}),loading:s,disabled:s||i||!N,fullWidth:!0,className:"sm:w-auto"})})]})]})},So=["image/jpeg","image/jpg","image/png"],va=["application/pdf",...So],Zh=5*1024*1024,Jh=()=>{const e=J(I=>I.user),t=J(I=>I.meta),s=J(I=>I.syncAuth),{registerFileData:r}=Ne(),{showDocument:a}=Qe(),[o,i]=x.useState(null),[l,c]=x.useState(null),[u,d]=x.useState(null),[m,h]=x.useState(null),[f,g]=x.useState(null),[w,N]=x.useState(null),[v,S]=x.useState(!1),[b,A]=x.useState(!1),[P,y]=x.useState(!1),[C,p]=x.useState(!1),[E,L]=x.useState(!1),[j,O]=x.useState(!1),T=x.useMemo(()=>!!e?.school_graduation_year,[e]);x.useEffect(()=>{if(e)if(e.document_file&&h(e.document_file),e.photo_student&&g(e.photo_student),T)e.school_graduation_certificate&&N(e.school_graduation_certificate);else{const I=t?.enrollment?.file_grade_school;I&&N(I)}},[e,T]);const $=x.useMemo(()=>{if(!e)return!0;const I=!!m,B=!!f;return T?!I||!B||!!!w:!I||!B},[m,f,w,T]),H=(I,B)=>{if(!I)return!1;if(!B.includes(I.type)){const ue=B.includes("application/pdf")?"PDF o imágenes (JPG, PNG)":"imágenes (JPG, PNG)";return R.error(`El archivo debe ser ${ue}`),!1}return I.size>Zh?(R.error("El archivo no debe superar los 5MB"),!1):!0},Q=async(I,B,ue,he,Y)=>{ue(!0);const M=new FormData;M.append("file",I),M.append("type",B);try{const V=await r(M);if(V&&V.success&&V.data){V.data.user&&s(V);let G;B==="file_school"?T?G=V.data.user?.school_graduation_certificate||V.data.path:G=V.data.meta?.enrollment?.file_grade_school||V.data.path:G=V.data.user?.[B]||V.data.path,G?(he(G),Y(I),R.success("Archivo subido correctamente")):(console.error("No se recibió path del archivo. Response:",V),R.error("Error: No se recibió la ruta del archivo"))}else console.error("Respuesta inválida:",V),R.error(V?.message||"Error al subir el archivo")}catch(V){console.error("❌ Error subiendo archivo:",V),console.error("Error details:",{message:V.message,response:V.response,status:V.status}),V.status===401?R.error("No autorizado. Por favor, inicie sesión nuevamente."):V.message?R.error(`Error: ${V.message}`):R.error("Error al subir el archivo")}finally{ue(!1)}},W=async I=>{const B=I.target.files[0];B&&H(B,va)&&await Q(B,"document_file",S,h,i),I.target.value=null},k=async I=>{const B=I.target.files[0];B&&H(B,So)&&await Q(B,"photo_student",A,g,c),I.target.value=null},ce=async I=>{const B=I.target.files[0];B&&H(B,va)&&await Q(B,"file_school",y,N,d),I.target.value=null},de=async(I,B,ue)=>{ue(!0);try{if(B&&!I){const he=URL.createObjectURL(B);window.open(he,"_blank");return}if(I){const he=await a(I);he.success&&he.data?.url?window.open(he.data.url,"_blank"):R.error("No se pudo obtener la URL del archivo")}}catch(he){console.error("Error obteniendo URL:",he),R.error("Error al obtener el archivo")}finally{ue(!1)}},Ae=v||b||P,ze=C||E||j;return n.jsxs("div",{className:"w-full",children:[(Ae||ze)&&n.jsx(pe,{message:Ae?"Subiendo archivo...":"Cargando archivo..."}),n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 bg-purple-100 rounded-full mb-3",children:n.jsx(we,{className:"w-6 h-6 text-purple-600"})}),n.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"Documentos Requeridos"}),n.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Suba los documentos necesarios para completar su inscripción"})]}),$&&n.jsx("div",{className:"mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Se,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-yellow-900",children:"Complete la subida de documentos"}),n.jsx("p",{className:"text-sm text-yellow-700 mt-1",children:"Debe subir todos los documentos requeridos para continuar con el proceso de inscripción."})]})]})}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("section",{children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(we,{className:"w-5 h-5 text-blue-600"}),"Documento de Identidad"]}),n.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900",children:"DNI, Carnet de Extranjería o Pasaporte *"}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Formato: PDF - Máximo 5MB"})]}),m&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-semibold text-white bg-green-600 rounded-lg shadow-sm",children:[n.jsx(cs,{className:"w-4 h-4"}),"Subido"]})]}),o&&n.jsx("div",{className:"mb-3 p-3 bg-white border border-gray-200 rounded-lg",children:n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(we,{className:"w-4 h-4 text-gray-400"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-gray-900",children:o.name}),n.jsxs("p",{className:"text-xs text-gray-500",children:[(o.size/1024).toFixed(2)," KB"]})]})]})})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("label",{className:"flex-1",children:[n.jsx("input",{type:"file",accept:".pdf",onChange:W,disabled:v,className:"hidden"}),n.jsxs("div",{className:`flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border transition-colors cursor-pointer ${v?"bg-gray-100 text-gray-400 border-gray-200 cursor-not-allowed":"bg-white text-blue-600 border-blue-600 hover:bg-blue-50"}`,children:[v?n.jsx(os,{className:"w-4 h-4 animate-spin"}):n.jsx(Wt,{className:"w-4 h-4"}),v?"Subiendo...":"Subir"]})]}),m&&n.jsx(ne,{type:"button",variant:"primary",size:"md",text:"Ver Documento",leftIcon:n.jsx(Gt,{className:"w-4 h-4"}),onClick:()=>de(m,o,p),disabled:v||C})]})]})]}),n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(il,{className:"w-5 h-5 text-blue-600"}),"Fotografía Personal"]}),n.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900",children:"Foto tipo carnet *"}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Formato: Imagen (JPG, PNG) - Máximo 5MB - Fondo blanco"})]}),f&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-semibold text-white bg-green-600 rounded-lg shadow-sm",children:[n.jsx(cs,{className:"w-4 h-4"}),"Subido"]})]}),l&&n.jsx("div",{className:"mb-3 p-3 bg-white border border-gray-200 rounded-lg",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("img",{src:URL.createObjectURL(l),alt:"Preview",className:"w-16 h-16 object-cover rounded border border-gray-200"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-gray-900",children:l.name}),n.jsxs("p",{className:"text-xs text-gray-500",children:[(l.size/1024).toFixed(2)," KB"]})]})]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("label",{className:"flex-1",children:[n.jsx("input",{type:"file",accept:".jpg,.jpeg,.png",onChange:k,disabled:b,className:"hidden"}),n.jsxs("div",{className:`flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border transition-colors cursor-pointer ${b?"bg-gray-100 text-gray-400 border-gray-200 cursor-not-allowed":"bg-white text-blue-600 border-blue-600 hover:bg-blue-50"}`,children:[b?n.jsx(os,{className:"w-4 h-4 animate-spin"}):n.jsx(Wt,{className:"w-4 h-4"}),b?"Subiendo...":"Subir"]})]}),f&&n.jsx(ne,{type:"button",variant:"primary",size:"md",text:"Ver Foto",leftIcon:n.jsx(Gt,{className:"w-4 h-4"}),onClick:()=>de(f,l,L),disabled:b||E})]})]})]}),n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(we,{className:"w-5 h-5 text-blue-600"}),T?"Certificado de Estudios":"Constancia de Logros de Aprendizaje"]}),n.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900",children:T?"Certificado oficial de culminación de estudios *":"Constancia del grado que cursa actualmente"}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Formato: PDF - Máximo 5MB"})]}),w&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-semibold text-white bg-green-600 rounded-lg shadow-sm",children:[n.jsx(cs,{className:"w-4 h-4"}),"Subido"]})]}),u&&n.jsx("div",{className:"mb-3 p-3 bg-white border border-gray-200 rounded-lg",children:n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(we,{className:"w-4 h-4 text-gray-400"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-gray-900",children:u.name}),n.jsxs("p",{className:"text-xs text-gray-500",children:[(u.size/1024).toFixed(2)," KB"]})]})]})})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("label",{className:"flex-1",children:[n.jsx("input",{type:"file",accept:".pdf",onChange:ce,disabled:P,className:"hidden"}),n.jsxs("div",{className:`flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border transition-colors cursor-pointer ${P?"bg-gray-100 text-gray-400 border-gray-200 cursor-not-allowed":"bg-white text-blue-600 border-blue-600 hover:bg-blue-50"}`,children:[P?n.jsx(os,{className:"w-4 h-4 animate-spin"}):n.jsx(Wt,{className:"w-4 h-4"}),P?"Subiendo...":"Subir"]})]}),w&&n.jsx(ne,{type:"button",variant:"primary",size:"md",text:"Ver Certificado",leftIcon:n.jsx(Gt,{className:"w-4 h-4"}),onClick:()=>de(w,u,O),disabled:P||j})]})]})]})]})]})},Qh=Ao({accept_declaration:ko().refine(e=>e===!0,{message:"Debe aceptar la declaración jurada para continuar"})}),ef=()=>{const e=J(h=>h.user),t=J(h=>h.meta),{loading:s,registerSwornDeclaration:r}=Ne(),[a,o]=x.useState(!1),{register:i,handleSubmit:l,formState:{errors:c}}=Le({resolver:Oe(Qh),mode:"onChange",defaultValues:{accept_declaration:!1}}),u=x.useMemo(()=>t?.enrollment?.oath_declaration===!0||a,[a]),d=async h=>{console.log("📤 Enviando declaración jurada:",h);const f=await r({sworn_declaration:!0});if(!f.success){const g=f.error||"Error al registrar la declaración jurada";R.error(g);return}o(!0),R.success("Declaración jurada aceptada correctamente")},m=new Date().toLocaleDateString("es-ES",{day:"2-digit",month:"long",year:"numeric"});return u?n.jsxs("div",{className:"w-full max-w-2xl mx-auto",children:[n.jsx("div",{className:"flex justify-center mb-6",children:n.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-green-600 rounded-full",children:n.jsx(De,{className:"w-12 h-12 text-white"})})}),n.jsxs("div",{className:"bg-green-600 text-white text-center py-6 rounded-t-lg",children:[n.jsx("h2",{className:"text-2xl font-bold",children:"Declaración Jurada Aceptada"}),n.jsx("p",{className:"text-sm mt-2",children:"Usted ha firmado digitalmente su compromiso legal"})]}),n.jsxs("div",{className:"bg-white border border-green-600 rounded-b-lg p-6 space-y-6",children:[n.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[n.jsx(We,{className:"w-5 h-5 text-green-600 flex-shrink-0"}),n.jsx("h3",{className:"text-sm font-semibold text-green-900",children:"✓ DECLARACIÓN FIRMADA DIGITALMENTE"})]}),n.jsx("p",{className:"text-sm text-green-700",children:"Su declaración jurada ha sido registrada exitosamente con validez legal plena. Este documento constituye su compromiso formal y vinculante."})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(we,{className:"w-4 h-4 text-blue-600"}),n.jsx("h4",{className:"text-sm font-semibold text-gray-900",children:"Estado Legal"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-2 h-2 bg-green-600 rounded-full"}),n.jsx("span",{className:"text-sm text-gray-700",children:"Documento firmado y válido"})]})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Re,{className:"w-4 h-4 text-blue-600"}),n.jsx("h4",{className:"text-sm font-semibold text-gray-900",children:"Firmante"})]}),n.jsxs("p",{className:"text-sm font-medium text-gray-900",children:[e?.names," ",e?.paternal_surname," ",e?.maternal_surname]}),n.jsxs("p",{className:"text-xs text-gray-600",children:["DNI ",e?.document_number]})]})]}),n.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(We,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-blue-900 mb-2",children:"Compromiso Registrado"}),n.jsx("p",{className:"text-sm text-blue-700",children:"Usted ha confirmado bajo juramento la veracidad de toda su información y se ha comprometido con el cumplimiento de las normas institucionales. Su declaración ha sido registrada digitalmente con plena validez jurídica."})]})]})})]})]}):n.jsxs("div",{className:"w-full max-w-3xl mx-auto",children:[s&&n.jsx(pe,{message:"Procesando declaración jurada..."}),n.jsxs("div",{className:"bg-gradient-to-r from-blue-600 to-orange-600 text-white text-center py-8 rounded-t-lg",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-white/20 rounded-full mb-4",children:n.jsx(We,{className:"w-10 h-10 text-white"})}),n.jsx("h2",{className:"text-2xl font-bold",children:"DECLARACIÓN JURADA"}),n.jsx("p",{className:"text-sm mt-2",children:"Compromiso de Veracidad e Integridad Académica"})]}),n.jsxs("div",{className:"bg-white rounded-b-lg border border-gray-200",children:[n.jsxs("div",{className:"bg-gray-50 border-b border-gray-200 p-6",children:[n.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"DATOS DEL DECLARANTE"}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm text-gray-700",children:[n.jsx("span",{className:"font-medium",children:"Nombre completo:"})," ",e?.names," ",e?.paternal_surname," ",e?.maternal_surname]}),n.jsxs("p",{className:"text-sm text-gray-700",children:[n.jsx("span",{className:"font-medium",children:"Documento:"})," DNI"," ",e?.document_number]})]})]}),n.jsxs("div",{className:"p-6 space-y-6",children:[n.jsx("p",{className:"text-sm text-gray-700",children:"Por medio de la presente, declaro bajo juramento lo siguiente:"}),n.jsx("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4 space-y-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(De,{className:"w-5 h-5 text-green-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-gray-900 mb-2",children:"Declaraciones y Compromisos"}),n.jsxs("div",{className:"space-y-3 text-sm text-gray-700",children:[n.jsxs("p",{children:[n.jsx("span",{className:"font-medium",children:"Veracidad de la Información:"})," ","Declaro bajo juramento que todos los datos, documentos y certificaciones presentados son completamente verídicos, auténticos y comprobables."]}),n.jsxs("p",{children:[n.jsx("span",{className:"font-medium",children:"Responsabilidad Legal:"})," ","Asumo total responsabilidad por la autenticidad de la información proporcionada, conociendo las implicaciones legales de proporcionar datos falsos o adulterados."]}),n.jsxs("p",{children:[n.jsx("span",{className:"font-medium",children:"Cumplimiento de Normas:"})," ","Me comprometo a cumplir estrictamente con todas las disposiciones, reglamentos y normativas establecidas por la institución organizadora."]}),n.jsxs("p",{children:[n.jsx("span",{className:"font-medium",children:"Integridad Académica:"})," ","Declaro mi compromiso con los más altos estándares de integridad académica y ética profesional en todas las actividades relacionadas con este proceso."]})]})]})]})}),n.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Ea,{className:"w-5 h-5 text-red-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-red-900 mb-2",children:"Consecuencias por Información Falsa"}),n.jsx("p",{className:"text-sm text-red-700 mb-3",children:"El proporcionar información falsa, incompleta o adulterada resultará en las siguientes consecuencias:"}),n.jsxs("ul",{className:"space-y-2 text-sm text-red-700 list-disc list-inside",children:[n.jsx("li",{children:"Anulación inmediata e irrevocable de mi participación en el proceso"}),n.jsx("li",{children:"Prohibición de participar en futuros procesos de selección de la institución"}),n.jsx("li",{children:"Reporte a las autoridades competentes según corresponda"}),n.jsx("li",{children:"Posibles acciones legales por falsificación de documentos"})]})]})]})}),n.jsxs("div",{className:"text-sm text-gray-700 space-y-3",children:[n.jsx("p",{children:"Firmo la presente declaración jurada en pleno uso de mis facultades mentales, libre de coacción, con pleno conocimiento de su contenido y alcances legales, para que surta los efectos legales que correspondan."}),n.jsxs("p",{className:"font-medium",children:["Fecha: ",m]})]}),n.jsx("div",{className:"border-t border-gray-200 pt-6",children:n.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[n.jsx("input",{...i("accept_declaration"),type:"checkbox",disabled:s,className:"w-5 h-5 text-blue-600 rounded focus:ring-blue-500 mt-0.5 cursor-pointer"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("span",{className:"text-sm font-semibold text-gray-900 group-hover:text-blue-600 transition-colors",children:"Acepto y Firmo la Declaración Jurada *"}),n.jsx("p",{className:"text-xs text-gray-600 mt-1",children:"Al marcar esta casilla, confirmo que he leído detenidamente, entendido y acepto todos los términos de esta declaración jurada. Reconozco que esta constituye mi firma digital con plena validez legal."}),c.accept_declaration&&n.jsx("p",{className:"text-sm text-red-600 mt-2",children:c.accept_declaration.message})]})]})}),n.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(We,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-blue-900 mb-1",children:"Importante"}),n.jsx("p",{className:"text-sm text-blue-700",children:"Esta declaración jurada tiene carácter legal y vinculante. Asegúrese de haber revisado y verificado toda la información proporcionada en los pasos anteriores antes de aceptar y firmar digitalmente este documento."})]})]})})]}),n.jsx("div",{className:"bg-gray-50 border-t border-gray-200 px-6 py-4 rounded-b-lg",children:n.jsx("div",{className:"flex justify-center",children:n.jsx(ne,{type:"button",variant:"primary",size:"lg",text:s?"Procesando...":"Confirmar y Firmar",leftIcon:s?null:n.jsx(We,{className:"w-5 h-5"}),loading:s,disabled:s,onClick:l(d),fullWidth:!0,className:"sm:w-auto"})})})]})]})},tf=["image/jpeg","image/jpg","image/png","application/pdf"],sf=5*1024*1024,Ds=["pending","approved","rejected"],ja=[{value:"box",label:"Caja"}],nf=()=>{const e=J(M=>M.user),t=J(M=>M.meta);J(M=>M.syncAuth);const{showDocument:s}=Qe(),{loading:r,registerPaymentData:a,deletePayment:o}=Ne(),[i,l]=x.useState(null),[c,u]=x.useState(null),[d,m]=x.useState(""),[h,f]=x.useState(!1),[g,w]=x.useState([]),[N,v]=x.useState(!1),[S,b]=x.useState(null),[A,P]=x.useState(!1),{register:y,handleSubmit:C,setError:p,clearErrors:E,reset:L,formState:{errors:j}}=Le({resolver:Oe(Ro),mode:"onChange",defaultValues:{payment_date:"",amount:"",receipt_number:"",payment_method:"box",comment:""}});x.useEffect(()=>{if(e)try{const V=(t?.enrollment?.payments||[]).filter(G=>Ds.includes(G.status));w(V)}catch(M){console.error("Error leyendo meta:",M)}},[e,t]);const O=x.useMemo(()=>g.length===0,[g]),T=new Date().toISOString().split("T")[0],$=x.useMemo(()=>t?.enrollment?.total_amount_pending||0,[t]),H=()=>{f(!0)},Q=()=>{L({payment_date:"",amount:"",receipt_number:"",payment_method:"box",comment:""}),ce(),f(!1)},W=M=>M?tf.includes(M.type)?M.size>sf?(m("El archivo no debe superar los 5MB"),!1):(m(""),!0):(m("El archivo debe ser JPG, PNG o PDF"),!1):(m("Debe seleccionar un archivo"),!1),k=M=>{const V=M.target.files[0];if(V&&W(V))if(l(V),V.type.startsWith("image/")){const G=new FileReader;G.onloadend=()=>u(G.result),G.readAsDataURL(V)}else u(null);M.target.value=null},ce=()=>{l(null),u(null),m("")},de=async M=>{try{const V=await s(M);V.success&&V.data?.url?window.open(V.data.url,"_blank"):R.error("No se pudo obtener la URL del archivo")}catch(V){console.error("Error obteniendo URL:",V),R.error("Error al obtener el archivo")}},Ae=M=>{b(M),v(!0)},ze=()=>{A||(v(!1),b(null))},I=async()=>{if(S){P(!0);try{const M=await o(S.id);if(!M.success){R.error(M.error||"Error al cancelar el pago");return}const V=g.filter(G=>G.id!==S.id&&Ds.includes(G.status));w(V),R.success("Pago cancelado correctamente"),v(!1),b(null)}catch{R.error("Error inesperado al cancelar el pago")}finally{P(!1)}}},B=async M=>{if(E(),m(""),!i){m("Debe subir el voucher de pago"),R.error("Debe subir el voucher de pago");return}const V=new FormData;V.append("payment_date",M.payment_date),V.append("amount",M.amount),V.append("receipt_number",M.receipt_number),V.append("payment_method",M.payment_method),M.comment&&V.append("comment",M.comment),V.append("file",i);const G=await a(V);if(!G.success){const ve=G.error||"Error al registrar información de pago";R.error(ve),G.fieldErrors&&Ze(G,p,ve);return}try{if(G.data?.meta?.enrollment?.payments){const et=G.data.meta.enrollment.payments.filter(Po=>Ds.includes(Po.status));w(et)}}catch(ve){console.error("Error leyendo meta:",ve)}Q(),R.success("Información de pago registrada correctamente")},ue=M=>{const V={pending:{label:"Pendiente",icon:Wo,className:"bg-yellow-100 text-yellow-800 border-yellow-200"},approved:{label:"Aprobado",icon:Yo,className:"bg-green-100 text-green-800 border-green-200"},rejected:{label:"Rechazado",icon:$o,className:"bg-red-100 text-red-800 border-red-200"}},G=V[M]||V.pending,ve=G.icon;return n.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded-full border ${G.className}`,children:[n.jsx(ve,{className:"w-3 h-3"}),G.label]})},he=M=>new Date(M).toLocaleDateString("es-ES",{day:"2-digit",month:"short",year:"numeric"}),Y=M=>{const V=ja.find(G=>G.value===M);return V?V.label:M};return n.jsxs("div",{className:"w-full",children:[r&&n.jsx(pe,{message:"Procesando pago..."}),n.jsx(zo,{isOpen:N,onClose:ze,onConfirm:I,title:"Cancelar Pago",message:"¿Está seguro de que desea cancelar este pago? Esta acción no se puede deshacer y el registro del pago será eliminado permanentemente.",variant:"danger",confirmText:"Confirmar Cancelación",cancelText:"Cancelar",loading:A}),n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 bg-green-100 rounded-full mb-3",children:n.jsx(Xe,{className:"w-6 h-6 text-green-600"})}),n.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"Información de Pago"}),n.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Complete los datos de su pago y adjunte el voucher"})]}),n.jsx("div",{className:"mb-6 bg-gradient-to-r from-blue-50 to-indigo-50 border-2 border-blue-200 rounded-lg p-6",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex items-center justify-center w-12 h-12 bg-blue-100 rounded-lg",children:n.jsx(Go,{className:"w-6 h-6 text-blue-600"})}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-gray-700 mb-1",children:"Monto Pendiente de Pago"}),n.jsx("p",{className:"text-xs text-gray-600",children:"Total restante por abonar a su inscripción"})]})]}),n.jsxs("div",{className:"text-right",children:[n.jsxs("div",{className:"text-4xl font-bold text-blue-600",children:["S/ ",parseFloat($).toFixed(2)]}),$==0&&n.jsx("p",{className:"text-xs text-green-600 mt-1 font-medium",children:"✓ Pago completado"})]})]})}),O&&n.jsx("div",{className:"mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Se,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-yellow-900",children:"Registre al menos un pago"}),n.jsx("p",{className:"text-sm text-yellow-700 mt-1",children:"Debe registrar al menos un pago para continuar con el proceso de inscripción."})]})]})}),n.jsx("div",{className:"flex justify-center mb-6",children:n.jsx(ne,{type:"button",variant:"primary",size:"md",text:"Agregar Pago",leftIcon:n.jsx(Lo,{className:"w-5 h-5"}),onClick:H,disabled:r||$==0})}),g.length>0&&n.jsxs("section",{className:"mb-8",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(we,{className:"w-5 h-5 text-blue-600"}),"Historial de Pagos (",g.length,")"]}),n.jsx("div",{className:"overflow-x-auto border border-gray-200 rounded-lg",children:n.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[n.jsx("thead",{className:"bg-gray-50",children:n.jsxs("tr",{children:[n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Fecha"}),n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Monto"}),n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"N° Operación"}),n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Método"}),n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Estado"}),n.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Comentario"}),n.jsx("th",{className:"px-4 py-3 text-center text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Acciones"})]})}),n.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:g.map(M=>n.jsxs("tr",{className:"hover:bg-gray-50",children:[n.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 whitespace-nowrap",children:he(M.payment_date)}),n.jsxs("td",{className:"px-4 py-3 text-sm font-medium text-gray-900 whitespace-nowrap",children:["S/ ",parseFloat(M.amount).toFixed(2)]}),n.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 whitespace-nowrap",children:M.receipt_number}),n.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 whitespace-nowrap",children:Y(M.method)}),n.jsx("td",{className:"px-4 py-3 text-sm whitespace-nowrap",children:ue(M.status)}),n.jsx("td",{className:"px-4 py-3 text-sm text-gray-600",children:M.comment||"-"}),n.jsx("td",{className:"px-4 py-3 text-center",children:n.jsxs("div",{className:"flex items-center justify-center gap-2",children:[n.jsx("button",{type:"button",onClick:()=>de(M.file),disabled:r||A,className:"inline-flex items-center justify-center w-8 h-8 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors disabled:opacity-50",title:"Ver voucher",children:n.jsx(Gt,{className:"w-4 h-4"})}),M.status!=="approved"&&n.jsx("button",{type:"button",onClick:()=>Ae(M),disabled:r||A,className:"inline-flex items-center justify-center w-8 h-8 text-red-600 hover:bg-red-50 rounded-lg transition-colors disabled:opacity-50",title:"Cancelar pago",children:n.jsx(Ls,{className:"w-4 h-4"})})]})})]},M.id))})]})})]}),n.jsx(Da,{isOpen:h,onClose:Q,title:"Registrar Nuevo Pago",size:"lg",closeOnClickOutside:!1,children:n.jsxs("form",{onSubmit:C(B),className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx(oe,{...y("payment_date"),type:"date",label:"Fecha de Pago *",icon:ka,disabled:r,max:T,error:j.payment_date?.message}),n.jsx(U,{message:j.payment_date?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Fecha en que realizó el pago"})]}),n.jsxs("div",{children:[n.jsx(oe,{...y("amount"),type:"number",step:"0.01",label:"Monto Pagado (S/) *",placeholder:"0.00",icon:Bs,disabled:r,error:j.amount?.message}),n.jsx(U,{message:j.amount?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Monto exacto del pago realizado"})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx(oe,{...y("receipt_number"),type:"text",label:"Número de Operación / Recibo *",placeholder:"002-00024512-x",icon:sl,disabled:r,error:j.receipt_number?.message}),n.jsx(U,{message:j.receipt_number?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Número de operación bancaria o código del recibo"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Método de Pago *"}),n.jsxs("div",{className:"relative",children:[n.jsx(Oo,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),n.jsx("select",{...y("payment_method"),disabled:r,className:`w-full pl-10 pr-3 py-2 text-sm border rounded-lg transition-colors ${j.payment_method?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500"} ${r?"bg-gray-100 cursor-not-allowed":"bg-white hover:border-gray-400"}`,children:ja.map(M=>n.jsx("option",{value:M.value,children:M.label},M.value))})]}),n.jsx(U,{message:j.payment_method?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Medio utilizado para realizar el pago"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Comentario (Opcional)"}),n.jsx("textarea",{...y("comment"),rows:3,placeholder:"Información adicional sobre el pago...",disabled:r,className:`w-full px-3 py-2 text-sm border rounded-lg transition-colors resize-none ${j.comment?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500"} ${r?"bg-gray-100 cursor-not-allowed":"bg-white hover:border-gray-400"}`}),n.jsx(U,{message:j.comment?.message})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Voucher de Pago *"}),n.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4",children:[n.jsx("p",{className:"text-xs text-gray-500 mb-3",children:"Formato: Imagenes JPG, PNG - Máximo 5MB"}),i&&n.jsx("div",{className:"mb-3 p-3 bg-white border border-gray-200 rounded-lg",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[c?n.jsx("img",{src:c,alt:"Preview",className:"w-16 h-16 object-cover rounded border border-gray-200"}):n.jsx("div",{className:"w-16 h-16 flex items-center justify-center bg-gray-100 rounded border border-gray-200",children:n.jsx(we,{className:"w-8 h-8 text-gray-400"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:i.name}),n.jsxs("p",{className:"text-xs text-gray-500",children:[(i.size/1024).toFixed(2)," KB"]})]})]}),n.jsx("button",{type:"button",onClick:ce,disabled:r,className:"ml-3 inline-flex items-center justify-center w-8 h-8 text-red-600 hover:bg-red-50 rounded-lg transition-colors disabled:opacity-50",title:"Eliminar archivo",children:n.jsx(Ls,{className:"w-4 h-4"})})]})}),d&&n.jsx("div",{className:"mb-3 p-3 bg-red-50 border border-red-200 rounded-lg",children:n.jsx("p",{className:"text-sm text-red-600",children:d})}),n.jsxs("label",{className:"w-full",children:[n.jsx("input",{type:"file",accept:".jpg,.jpeg,.png",onChange:k,disabled:r,className:"hidden"}),n.jsxs("div",{className:`flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border transition-colors cursor-pointer ${r?"bg-gray-100 text-gray-400 border-gray-200 cursor-not-allowed":"bg-white text-blue-600 border-blue-600 hover:bg-blue-50"}`,children:[n.jsx(Wt,{className:"w-4 h-4"}),i?"Cambiar Archivo":"Subir Voucher"]})]})]})]}),n.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Se,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-blue-900 mb-1",children:"Importante"}),n.jsxs("ul",{className:"text-sm text-blue-700 space-y-1 list-disc list-inside",children:[n.jsx("li",{children:"Verifique que todos los datos coincidan con su comprobante de pago"}),n.jsx("li",{children:"El voucher debe ser legible y mostrar claramente el monto y fecha"}),n.jsx("li",{children:"Puede registrar múltiples pagos si los realizó en diferentes fechas"}),n.jsx("li",{children:"Su pago será verificado por el área administrativa"})]})]})]})}),n.jsxs("div",{className:"flex gap-3 justify-end pt-4 border-t border-gray-200",children:[n.jsx(ne,{type:"button",variant:"secondary",size:"md",text:"Cancelar",onClick:Q,disabled:r}),n.jsx(ne,{type:"submit",variant:"primary",size:"md",text:"Registrar Pago",leftIcon:n.jsx(Je,{className:"w-5 h-5"}),disabled:r,loading:r})]})]})})]})},Xt=[0,48,110],_s=[34,197,94],hn=[107,114,128],Co=[229,231,235],rf=async()=>window.jspdf?window.jspdf.jsPDF:new Promise((e,t)=>{const s=document.createElement("script");s.src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js",s.onload=()=>e(window.jspdf.jsPDF),s.onerror=t,document.head.appendChild(s)}),Es=e=>e?new Date(e).toLocaleDateString("es-ES",{day:"2-digit",month:"long",year:"numeric"}):"-",Ms=e=>e?`S/ ${parseFloat(e).toFixed(2)}`:"S/ 0.00",wa=e=>e?[e.name,e.province?.name,e.province?.department?.name].filter(Boolean).join(", "):"-",af=e=>({pending:"Pendiente",approved:"Aprobada",rejected:"Rechazada",cancelled:"Cancelada"})[e]||e,of=e=>({full:"Pago Completo",installment:"Pago Fraccionado"})[e]||"-",lf=e=>({first:"1ro",second:"2do",third:"3ro",fourth:"4to",fifth:"5to"})[e]||e,yt=(e,t,s,r,a)=>(e.setTextColor(...Xt),e.setFontSize(12),e.setFont(void 0,"bold"),e.text(t,r,s),e.setDrawColor(...Co),e.setLineWidth(.5),e.line(r,s+2,a-r,s+2),s+8),ee=(e,t,s,r,a,o)=>{e.setFillColor(249,250,251),e.roundedRect(r,a,o,14,2,2,"F"),e.setTextColor(...hn),e.setFontSize(8),e.setFont(void 0,"normal"),e.text(t.toUpperCase(),r+3,a+5),e.setTextColor(0,0,0),e.setFontSize(9),e.setFont(void 0,"bold");const i=e.splitTextToSize(s,o-6);e.text(i,r+3,a+10)},cf=async e=>{try{const t=await rf(),s=new t("p","mm","a4"),r=20,a=s.internal.pageSize.getWidth(),o=a-r*2,i=(o-5)/2;let l=20;const{student:c,cycle:u,career:d,discount_type:m,payments:h}=e;try{s.addImage(Io,"PNG",r,l,30,25)}catch{s.setFillColor(...Xt),s.roundedRect(r,l,25,25,3,3,"F"),s.setTextColor(255,255,255),s.setFontSize(18),s.setFont(void 0,"bold"),s.text("CP",r+12.5,l+16,{align:"center"})}s.setTextColor(...Xt),s.setFontSize(20),s.setFont(void 0,"bold"),s.text("CONSTANCIA DE INSCRIPCIÓN",r+35,l+12),s.setTextColor(...hn),s.setFontSize(12),s.setFont(void 0,"normal"),s.text("Centro Pre Universitario",r+35,l+20),l+=30,s.setDrawColor(...Xt),s.setLineWidth(1),s.line(r,l,a-r,l),l+=10,s.setFillColor(240,253,244),s.setDrawColor(..._s),s.setLineWidth(.5),s.roundedRect(r,l,o,20,3,3,"FD");const f=a/2-65,g=l+10;return s.setFillColor(..._s),s.circle(f,g,3,"F"),s.setDrawColor(255,255,255),s.setLineWidth(.8),s.line(f-1,g,f-.2,g+1.5),s.line(f-.2,g+1.5,f+1.5,g-1.5),s.setTextColor(..._s),s.setFontSize(14),s.setFont(void 0,"bold"),s.text("INSCRIPCIÓN COMPLETADA EXITOSAMENTE",a/2+2,l+10.5,{align:"center"}),s.setTextColor(0,0,0),s.setFontSize(10),s.setFont(void 0,"normal"),s.text("Su proceso de registro ha sido finalizado correctamente",a/2,l+16,{align:"center"}),l+=25,l=yt(s,"DATOS PERSONALES",l,r,a),ee(s,"Nombres Completos",`${c.names} ${c.paternal_surname} ${c.maternal_surname}`,r,l,i),ee(s,"Documento de Identidad",`${c.document_type.toUpperCase()}: ${c.document_number}`,r+i+5,l,i),l+=18,ee(s,"Fecha de Nacimiento",Es(c.birth_date),r,l,i),ee(s,"Género",c.gender==="male"?"Masculino":c.gender==="female"?"Femenino":"-",r+i+5,l,i),l+=22,l=yt(s,"INFORMACIÓN DE CONTACTO",l,r,a),ee(s,"Teléfono",c.phone_number||"-",r,l,i),ee(s,"Correo Electrónico",c.email||"-",r+i+5,l,i),l+=18,ee(s,"Dirección de Residencia",c.residence_address||"-",r,l,i),ee(s,"Lugar de Residencia",wa(c.residence_district),r+i+5,l,i),l+=22,l=yt(s,"INFORMACIÓN ACADÉMICA",l,r,a),ee(s,"Colegio de Procedencia",c.school?.name||"-",r,l,i),ee(s,"Ubicación del Colegio",wa(c.school?.district),r+i+5,l,i),l+=18,ee(s,"Año de Graduación",c.school_graduation_year||(e.grade_school?`Grado: ${lf(e.grade_school)}`:"-"),r,l,i),ee(s,"Carrera de Interés",d?.name||"-",r+i+5,l,i),l+=22,l=yt(s,"INFORMACIÓN DE MATRÍCULA",l,r,a),ee(s,"Ciclo",u?.name||"-",r,l,i),ee(s,"Estado",af(e.status),r+i+5,l,i),l+=18,ee(s,"Tipo de Pago",of(e.payment_type),r,l,i),ee(s,"Monto Total",Ms(e.total_amount),r+i+5,l,i),m&&(l+=18,ee(s,"Tipo de Descuento",m.name||"-",r,l,i),ee(s,"Monto de Descuento",Ms(e.discount_amount),r+i+5,l,i)),h&&h.length>0&&(l+=22,l=yt(s,"PAGOS REALIZADOS",l,r,a),h.forEach((w,N)=>{N>0&&(l+=18),ee(s,`Pago ${N+1} - Fecha`,Es(w.payment_date),r,l,i),ee(s,"Monto",Ms(w.amount),r+i+5,l,i)})),l=s.internal.pageSize.getHeight()-25,s.setDrawColor(...Co),s.setLineWidth(.5),s.line(r,l,a-r,l),l+=5,s.setTextColor(...hn),s.setFontSize(8),s.setFont(void 0,"normal"),s.text(`Documento generado el ${Es(new Date().toISOString())}`,a/2,l,{align:"center"}),l+=4,s.text("Este documento es una constancia de inscripción y no constituye un certificado oficial",a/2,l,{align:"center"}),s.save(`Constancia_Inscripcion_${c.document_number}.pdf`),!0}catch(t){throw console.error("Error generando PDF:",t),t}},Na=e=>e?new Date(e).toLocaleDateString("es-ES",{day:"2-digit",month:"long",year:"numeric"}):"-",$t=e=>e?`S/ ${parseFloat(e).toFixed(2)}`:"S/ 0.00",Sa=e=>e?[e.name,e.province?.name,e.province?.department?.name].filter(Boolean).join(", "):"-",df=e=>e==="full"?"Pago Completo":e==="installment"?"Pago Fraccionado":"-",uf=e=>({first:"1ro",second:"2do",third:"3ro",fourth:"4to",fifth:"5to"})[e]||e,ae=({label:e,value:t,icon:s})=>n.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s&&n.jsx(s,{className:"w-4 h-4 text-gray-400"}),n.jsx("p",{className:"text-xs text-gray-500 uppercase font-medium",children:e})]}),n.jsx("p",{className:"text-sm font-semibold text-gray-900",children:t||"-"})]}),Ut=({title:e,icon:t,children:s})=>n.jsxs("div",{className:"border-t pt-6 first:border-t-0 first:pt-0",children:[n.jsxs("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[t&&n.jsx(t,{className:"w-5 h-5 text-[#00306e]"}),e]}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s})]}),mf=()=>{const e=J(N=>N.user),{getStudentEnrollmentDetail:t,loading:s,error:r}=Qe(),[a,o]=x.useState(!1),[i,l]=x.useState(null);x.useEffect(()=>{console.log(e.id),c()},[]);const c=async()=>{const N=await t(e.id);console.log(N),l(N.data)},u=async()=>{if(!i){R.error("No hay datos disponibles para generar el PDF");return}o(!0);try{await cf(i),R.success("PDF generado exitosamente")}catch(N){console.error("Error al generar PDF:",N),R.error("Error al generar el PDF. Intente nuevamente.")}finally{o(!1)}};if(s)return n.jsx(pe,{message:"Cargando información de matrícula..."});if(r)return n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-red-100 rounded-full mb-4",children:n.jsx(we,{className:"w-8 h-8 text-red-600"})}),n.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Error al cargar información"}),n.jsx("p",{className:"text-gray-600",children:r})]});if(!i)return n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-gray-600",children:"No se encontró información de matrícula"})});const{student:d,cycle:m,career:h,discount_type:f,payments:g,status:w}=i;return n.jsxs("div",{className:"w-full max-w-4xl mx-auto",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-green-100 rounded-full mb-4",children:n.jsx(De,{className:"w-12 h-12 text-green-600"})}),n.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"¡Inscripción Completada!"}),n.jsx("p",{className:"text-lg text-gray-600",children:"Su proceso de registro ha sido finalizado exitosamente"})]}),n.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg shadow-sm overflow-hidden mb-8",children:[n.jsxs("div",{className:"bg-gradient-to-r from-[#00306e] to-blue-700 px-6 py-4",children:[n.jsx("h2",{className:"text-xl font-bold text-white",children:"Resumen de Inscripción"}),n.jsxs("p",{className:"text-blue-100 text-sm mt-1",children:["Ciclo: ",m?.name||"-"]})]}),n.jsxs("div",{className:"p-6 space-y-6",children:[n.jsxs(Ut,{title:"Datos Personales",icon:Re,children:[n.jsx(ae,{label:"Documento de Identidad",value:`${d.document_type.toUpperCase()}: ${d.document_number}`}),n.jsx(ae,{label:"Nombres Completos",value:`${d.names} ${d.paternal_surname} ${d.maternal_surname}`}),n.jsx(ae,{label:"Fecha de Nacimiento",value:Na(d.birth_date)}),n.jsx(ae,{label:"Género",value:d.gender==="male"?"Masculino":d.gender==="female"?"Femenino":"-"})]}),n.jsxs(Ut,{title:"Información de Contacto",icon:Zt,children:[n.jsx(ae,{label:"Teléfono",value:d.phone_number}),n.jsx(ae,{label:"Correo Electrónico",value:d.email}),n.jsx(ae,{label:"Dirección",value:d.residence_address}),n.jsx(ae,{label:"Lugar de Residencia",value:Sa(d.residence_district)})]}),n.jsxs(Ut,{title:"Información Académica",icon:fn,children:[n.jsx(ae,{label:"Colegio de Procedencia",value:d.school?.name}),n.jsx(ae,{label:"Ubicación del Colegio",value:Sa(d.school?.district)}),n.jsx(ae,{label:"Año de Graduación",value:d.school_graduation_year||(i.grade_school?`Grado: ${uf(i.grade_school)}`:"-")}),n.jsx(ae,{label:"Carrera de Interés",value:h?.name,icon:Ct})]}),n.jsxs(Ut,{title:"Información de Pago",icon:Xe,children:[n.jsx(ae,{label:"Tipo de Pago",value:df(i.payment_type)}),n.jsx(ae,{label:"Monto Total",value:$t(i.total_amount)}),f&&n.jsxs(n.Fragment,{children:[n.jsx(ae,{label:"Tipo de Descuento",value:f.name}),n.jsx(ae,{label:"Descuento Aplicado",value:$t(i.discount_amount)})]}),n.jsx(ae,{label:"Monto Pendiente",value:$t(i.total_amount_pending)})]}),g&&g.length>0&&n.jsxs("div",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(we,{className:"w-5 h-5 text-[#00306e]"}),"Pagos Realizados"]}),n.jsx("div",{className:"space-y-3",children:g.map((N,v)=>n.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg flex justify-between items-center",children:[n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm font-medium text-gray-900",children:["Pago #",v+1]}),n.jsx("p",{className:"text-xs text-gray-500",children:Na(N.payment_date)})]}),n.jsxs("div",{className:"text-right",children:[n.jsx("p",{className:"text-sm font-bold text-gray-900",children:$t(N.amount)}),n.jsx("p",{className:"text-xs text-gray-500",children:N.method})]})]},N.id))})]})]})]}),n.jsx("div",{className:"flex justify-center mb-8",children:n.jsx(ne,{type:"button",variant:"primary",size:"lg",text:a?"Generando PDF...":"Descargar Constancia en PDF",leftIcon:n.jsx(Qo,{className:"w-5 h-5"}),onClick:u,disabled:a,className:"bg-[#00306e] hover:bg-blue-800"})}),n.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(De,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-blue-900 mb-1",children:"Próximos Pasos"}),n.jsxs("ul",{className:"text-sm text-blue-700 space-y-1 list-disc list-inside",children:[n.jsx("li",{children:"Su inscripción será revisada por el área administrativa"}),n.jsx("li",{children:"Recibirá una notificación sobre el estado de su inscripción"}),n.jsx("li",{children:"Puede cerrar esta sesión de manera segura"})]})]})]})})]})},hf=[{value:"full",label:"Pago Completo",description:"Pague el monto total en una sola transacción",icon:De,color:"green"},{value:"installment",label:"Pago Parcial",description:"Divida su pago en 2 o más cuotas",icon:Xe,color:"blue"}],ff=()=>{J(p=>p.user);const e=J(p=>p.meta),t=Pa(p=>p.cycle),{loading:s,registerPaymentType:r}=Ne(),{fetchDiscountTypesActive:a}=Qe(),[o,i]=x.useState([]),[l,c]=x.useState(!0),{register:u,handleSubmit:d,setError:m,clearErrors:h,setValue:f,watch:g,formState:{errors:w,isDirty:N}}=Le({resolver:Oe(Fo),mode:"onChange",defaultValues:{payment_type:"",discount_type_id:1,discount_amount:0}}),v=g("payment_type"),S=g("discount_type_id"),b=g("discount_amount")||0;x.useEffect(()=>{(async()=>{c(!0);try{const E=await a();E.success&&E.data&&i(E.data)}catch(E){console.error("Error cargando tipos de descuento:",E),R.error("Error al cargar tipos de descuento")}finally{c(!1)}})()},[]),x.useEffect(()=>{if(!S||o.length===0)return;const p=o.find(E=>E.id===S);p&&f("discount_amount",parseFloat(p.amount),{shouldDirty:!0})},[S,o,f]),x.useEffect(()=>{if(!e?.enrollment)return;const p=e.enrollment;f("payment_type",p.payment_type||""),f("discount_type_id",p.discount_type_id||1),f("discount_amount",p.discount_amount||0)},[e,f]);const A=x.useMemo(()=>e?.enrollment?!e.enrollment.payment_type:!0,[e]),P=x.useMemo(()=>{let p=0;v==="full"?p=t?.full_payment_cost||0:v==="installment"&&(p=t?.installment_cost||0);const E=Number(b)||0,L=Math.max(0,p-E);return{baseCost:p,discount:E,finalAmount:L}},[t,v,b]),y=p=>{f("payment_type",p,{shouldDirty:!0})},C=async p=>{h();const E={payment_type:p.payment_type,discount_type_id:p.discount_type_id||1,discount_amount:p.discount_amount||0},L=await r(E);if(!L.success){const j=L.error||"Error al actualizar tipo de pago";R.error(j),L.fieldErrors&&Ze(L,m,j);return}R.success("Tipo de pago actualizado correctamente")};return n.jsxs("div",{className:"w-full",children:[(s||l)&&n.jsx(pe,{message:l?"Cargando información...":"Guardando información..."}),n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 bg-green-100 rounded-full mb-3",children:n.jsx(Xe,{className:"w-6 h-6 text-green-600"})}),n.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"Tipo de Pago"}),n.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Seleccione cómo desea realizar el pago de su inscripción"})]}),A&&n.jsx("div",{className:"mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Se,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-yellow-900",children:"Seleccione un tipo de pago"}),n.jsx("p",{className:"text-sm text-yellow-700 mt-1",children:"Debe seleccionar cómo desea realizar el pago para continuar con el proceso de inscripción."})]})]})}),(!t||!t.full_payment_cost&&!t.installment_cost)&&n.jsx("div",{className:"mb-6 bg-blue-50 border border-blue-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Se,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-semibold text-blue-900",children:"Información del ciclo no disponible"}),n.jsx("p",{className:"text-sm text-blue-700 mt-1",children:"No se pudo cargar la información de costos del ciclo activo. Por favor, contacte con administración."})]})]})}),n.jsxs("form",{onSubmit:d(C),className:"space-y-6",children:[n.jsxs("section",{children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(Xe,{className:"w-5 h-5 text-blue-600"}),"Seleccione Tipo de Pago"]}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:hf.map(p=>{const E=p.icon,L=v===p.value;return n.jsxs("label",{className:`relative flex flex-col p-6 border-2 rounded-lg cursor-pointer transition-all ${L?`border-${p.color}-600 bg-${p.color}-50 shadow-md`:"border-gray-300 hover:border-gray-400 hover:bg-gray-50"} ${s?"opacity-50 cursor-not-allowed":""}`,children:[n.jsx("input",{type:"radio",value:p.value,checked:L,onChange:j=>y(j.target.value),disabled:s,className:"sr-only"}),n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:`flex items-center justify-center w-12 h-12 rounded-lg ${L?`bg-${p.color}-100`:"bg-gray-100"}`,children:n.jsx(E,{className:`w-6 h-6 ${L?`text-${p.color}-600`:"text-gray-400"}`})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"text-lg font-semibold text-gray-900 mb-1",children:p.label}),n.jsx("p",{className:"text-sm text-gray-600",children:p.description})]})]}),L&&n.jsx("div",{className:"absolute top-4 right-4",children:n.jsx("div",{className:`w-6 h-6 rounded-full bg-${p.color}-600 flex items-center justify-center`,children:n.jsx(De,{className:"w-4 h-4 text-white"})})})]},p.value)})}),n.jsx(U,{message:w.payment_type?.message})]}),v&&n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(ml,{className:"w-5 h-5 text-blue-600"}),"Descuentos"]}),l?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-sm text-gray-500",children:"Cargando tipos de descuento..."})}):n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Tipo de Descuento *"}),n.jsx("select",{...u("discount_type_id",{setValueAs:p=>p===""?1:parseInt(p)}),disabled:s||l,className:`w-full px-3 py-2 text-sm border rounded-lg transition-colors ${w.discount_type_id?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500"} ${s||l?"bg-gray-100 cursor-not-allowed":"bg-white hover:border-gray-400"}`,children:o.map(p=>n.jsx("option",{value:p.id,children:p.name},p.id))}),n.jsx(U,{message:w.discount_type_id?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Seleccione el tipo de descuento aplicable"})]}),n.jsxs("div",{children:[n.jsx(oe,{...u("discount_amount",{setValueAs:p=>p===""?0:parseFloat(p)}),type:"number",step:"0.01",label:"Monto de Descuento (S/)",placeholder:"0.00",icon:Bs,disabled:!0,error:w.discount_amount?.message}),n.jsx(U,{message:w.discount_amount?.message}),n.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"El monto se actualiza automáticamente según el tipo de descuento"})]})]})]}),v&&P.baseCost>0&&n.jsxs("section",{className:"border-t pt-6",children:[n.jsxs("h3",{className:"text-base font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[n.jsx(Bs,{className:"w-5 h-5 text-blue-600"}),"Resumen de Pago"]}),n.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-green-50 border-2 border-blue-200 rounded-lg p-6",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-blue-200",children:[n.jsx("span",{className:"text-sm text-gray-700",children:"Costo de Inscripción:"}),n.jsxs("span",{className:"text-lg font-medium text-gray-900",children:["S/ ",P.baseCost]})]}),P.discount>0&&n.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-blue-200",children:[n.jsx("span",{className:"text-sm text-green-700",children:"Descuento Aplicado:"}),n.jsxs("span",{className:"text-lg font-medium text-green-600",children:["- S/ ",P.discount.toFixed(2)]})]}),n.jsxs("div",{className:"flex items-center justify-between pt-2",children:[n.jsx("span",{className:"text-lg font-semibold text-gray-900",children:"Total a Pagar:"}),n.jsxs("div",{className:"text-right",children:[n.jsxs("div",{className:"text-4xl font-bold text-blue-600",children:["S/ ",P.finalAmount.toFixed(2)]}),v==="installment"&&n.jsx("p",{className:"text-xs text-gray-600 mt-1",children:"Pago en cuotas"})]})]})]}),n.jsx("div",{className:"mt-6 pt-4 border-t border-blue-200",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Se,{className:"w-4 h-4 text-blue-600 flex-shrink-0 mt-0.5"}),n.jsx("p",{className:"text-xs text-gray-700",children:v==="full"?"El pago completo debe realizarse en una sola transacción.":"El pago parcial le permite dividir el monto en 2 o más cuotas. Deberá realizar cada pago en las fechas establecidas."})]})})]})]}),n.jsx("div",{className:"flex sm:justify-end pt-4",children:n.jsx(ne,{type:"submit",variant:"primary",size:"lg",text:s?"Guardando...":"Guardar Cambios",leftIcon:s?null:n.jsx(Je,{className:"w-5 h-5"}),loading:s,disabled:s||l||!N,fullWidth:!0,className:"sm:w-auto"})})]})]})},pf=()=>{const{finishRegistration:e,loading:t}=Ne(),[s,r]=x.useState(!1),a=async()=>{r(!0);const o=await e();if(!o.success){const i=o.error||"Error al finalizar la inscripción";R.error(i),r(!1);return}R.success(o.message||"Inscripción finalizada exitosamente"),r(!1)};return n.jsxs("div",{className:"w-full max-w-4xl mx-auto",children:[n.jsx(st.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:200,damping:20,delay:.1},className:"flex justify-center mb-8",children:n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-green-400 to-blue-500 rounded-full blur-2xl opacity-30 animate-pulse"}),n.jsx("div",{className:"relative flex items-center justify-center w-32 h-32 bg-gradient-to-br from-green-500 to-blue-600 rounded-full shadow-2xl",children:n.jsx(De,{className:"w-20 h-20 text-white",strokeWidth:2.5})})]})}),n.jsxs(st.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.2},className:"text-center mb-8",children:[n.jsxs("h1",{className:"text-4xl md:text-5xl font-bold bg-gradient-to-r from-green-600 via-blue-600 to-purple-600 bg-clip-text text-transparent mb-4 leading-tight",children:["¡Proceso de Registro",n.jsx("br",{}),"Completado!"]}),n.jsx("p",{className:"text-xl md:text-2xl text-gray-600 font-medium",children:"Está a un paso de finalizar su matrícula"})]}),n.jsx(st.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.3},className:"mb-8",children:n.jsx("div",{className:"bg-gradient-to-br from-blue-50 to-indigo-50 border-2 border-blue-200 rounded-2xl p-8 shadow-lg",children:n.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx("div",{className:"flex items-center justify-center w-12 h-12 bg-blue-600 rounded-xl shadow-md",children:n.jsx(Ea,{className:"w-7 h-7 text-white"})})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Verificación Importante"}),n.jsxs("p",{className:"text-base text-gray-700 leading-relaxed",children:["Antes de enviar su inscripción, por favor"," ",n.jsx("span",{className:"font-semibold text-blue-600",children:"revise cuidadosamente"})," ","que toda la información proporcionada sea"," ",n.jsx("span",{className:"font-semibold text-blue-600",children:"correcta y completa"}),". Una vez enviada, algunos datos no podrán ser modificados."]})]})]})})}),n.jsx(st.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.4},className:"flex justify-center",children:n.jsx(ne,{type:"button",variant:"primary",size:"lg",onClick:a,disabled:t||s,loading:s,text:s?"Enviando inscripción...":"Confirmar y Enviar Inscripción",leftIcon:s?null:n.jsx(dl,{className:"w-6 h-6"}),className:"px-8 py-4 text-lg font-semibold bg-gradient-to-r from-green-600 to-blue-600 hover:from-green-700 hover:to-blue-700 text-white shadow-xl hover:shadow-2xl transform hover:scale-105 active:scale-95 transition-all duration-200",fullWidth:!0})}),n.jsx(st.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.5},className:"mt-8 text-center",children:n.jsx("p",{className:"text-sm text-gray-500",children:"Visualizará una ficha de matrícula una vez que su inscripción sea procesada."})})]})},re=[{id:1,key:"personal_data",title:"Datos Personales",shortTitle:"Personal",icon:Re,component:Bh,description:"Información básica del estudiante"},{id:2,key:"additional_information",title:"Información Adicional",shortTitle:"Adicional",icon:pn,component:Uh,description:"Datos complementarios"},{id:3,key:"family_information",title:"Información Familiar",shortTitle:"Familiar",icon:Fs,component:Kh,description:"Datos del grupo familiar"},{id:4,key:"school_information",title:"Información Escolar",shortTitle:"Escolar",icon:fn,component:qh,description:"Datos académicos previos"},{id:5,key:"career_information",title:"Información de Carrera",shortTitle:"Carrera",icon:Ct,component:Xh,description:"Selección de carrera"},{id:6,key:"file_information",title:"Documentación",shortTitle:"Documentos",icon:we,component:Jh,description:"Subida de archivos"},{id:7,key:"discount_information",title:"Tipo de Pago",shortTitle:"Tipo",icon:Xe,component:ff,description:"Tipo y descuento de Pago"},{id:8,key:"payment_information",title:"Información de Pago",shortTitle:"Pago",icon:Xe,component:nf,description:"Proceso de pago"},{id:9,key:"sworn_declaration",title:"Declaración Jurada",shortTitle:"Declaración",icon:We,component:ef,description:"Compromiso y declaraciones"},{id:10,key:"finish_registration",title:"Finalizar Inscripción",shortTitle:"Finalización",icon:We,component:pf,description:"Terminar Inscripción"}],gf=({step:e,isActive:t,isCompleted:s,isAccessible:r,onClick:a})=>{const o=e.icon,i=()=>t?"bg-[#00306e] border-[#00306e] text-white shadow-lg shadow-[#00306e]/25 transform scale-105":s?"bg-green-600 border-green-600 text-white shadow-md hover:shadow-lg hover:scale-105 cursor-pointer":r?"bg-white border-gray-300 text-gray-400 hover:border-[#00306e] hover:text-[#00306e] hover:shadow-md cursor-pointer":"bg-gray-100 border-gray-200 text-gray-300 cursor-not-allowed",l=()=>t?"text-[#00306e]":s?"text-green-600":r?"text-gray-600":"text-gray-400";return n.jsxs("div",{className:"flex flex-col items-center relative z-10",children:[n.jsx("button",{onClick:()=>a(e.id),disabled:!r,className:`group flex items-center justify-center w-12 h-12 rounded-xl border-2 transition-all duration-300 mb-3 ${i()}`,children:s?n.jsx(Os,{className:"w-6 h-6"}):n.jsx(o,{className:"w-6 h-6"})}),n.jsxs("div",{className:"text-center max-w-24",children:[n.jsx("div",{className:`text-sm font-medium transition-colors duration-300 ${l()}`,children:e.title}),n.jsxs("div",{className:`text-xs mt-1 ${r?"text-gray-500":"text-gray-400"}`,children:["Paso ",e.id]})]})]})},xf=({step:e,isActive:t,isCompleted:s,isAccessible:r,onClick:a})=>{const o=()=>t?"bg-[#00306e] transform scale-125":s?"bg-green-500 cursor-pointer":r?"bg-gray-300 cursor-pointer hover:bg-gray-400":"bg-gray-200 cursor-not-allowed";return n.jsx("button",{onClick:()=>a(e.id),disabled:!r,className:`w-3 h-3 rounded-full transition-all duration-300 ${o()}`})},Ca=({user:e,loading:t,progressPercentage:s,completedStepsCount:r,currentStep:a,onLogout:o})=>n.jsx("header",{className:"bg-white border-b border-gray-200 shadow-sm sticky top-0 z-50",children:n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[n.jsxs("div",{className:"flex items-center justify-between h-16 lg:h-20",children:[n.jsxs("div",{className:"flex items-center space-x-4",children:[n.jsx("div",{className:"flex items-center justify-center w-10 h-10 bg-[#00306e] rounded-lg",children:n.jsx(Ct,{className:"w-6 h-6 text-white"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl lg:text-2xl font-semibold text-gray-900",children:a?"Proceso de Inscripción":"Inscripción Completada"}),a&&n.jsx("p",{className:"text-sm text-gray-600 hidden sm:block",children:"Complete su registro académico siguiendo los pasos indicados"})]})]}),n.jsxs("div",{className:"flex items-center space-x-4",children:[a&&n.jsxs("div",{className:"hidden md:flex items-center space-x-3 text-sm text-gray-600",children:[n.jsx("span",{className:"font-medium",children:"Progreso:"}),n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx("div",{className:"w-32 h-2 bg-gray-200 rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-gradient-to-r from-[#00306e] to-blue-600 transition-all duration-500 ease-out",style:{width:`${s}%`}})}),n.jsxs("span",{className:"font-semibold text-[#00306e] min-w-[3rem]",children:[r,"/",re.length]})]})]}),n.jsxs("div",{className:"flex items-center space-x-3",children:[n.jsxs("div",{className:"hidden sm:flex flex-col text-right text-sm",children:[n.jsxs("span",{className:"font-medium text-gray-900 truncate max-w-32",children:[e?.names," ",e?.paternal_surname]}),n.jsxs("span",{className:"text-xs text-gray-500",children:[e?.document_type?.toUpperCase()," ",e?.document_number]})]}),n.jsxs(mn,{variant:"outline",onClick:o,disabled:t,className:"flex cursor-pointer items-center space-x-2 px-3 lg:px-4 py-2 border-gray-300 text-gray-700 hover:bg-red-50 hover:border-red-300 hover:text-red-700 transition-all duration-200 group",children:[n.jsx(Bo,{className:"w-4 h-4 group-hover:text-red-600"}),n.jsx("span",{className:"hidden sm:inline font-medium",children:"Cerrar Sesión"}),n.jsx("span",{className:"sm:hidden font-medium",children:"Salir"})]})]})]})]}),a&&n.jsxs("div",{className:"md:hidden pb-3",children:[n.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 mb-1",children:[n.jsxs("span",{className:"font-medium truncate",children:[e?.names," ",e?.paternal_surname]}),n.jsxs("span",{className:"text-xs text-gray-500",children:[e?.document_type?.toUpperCase()," ",e?.document_number]})]}),n.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 mb-1",children:[n.jsxs("span",{className:"font-medium",children:["Paso ",a,"/",re.length]}),n.jsxs("span",{className:"font-medium",children:[s,"%"]})]}),n.jsx("div",{className:"w-full h-1.5 bg-gray-200 rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-gradient-to-r from-[#00306e] to-blue-600 transition-all duration-500 ease-out",style:{width:`${s}%`}})})]})]})}),Jf=()=>{const e=To(),t=J(j=>j.user),s=J(j=>j.meta),r=Pa(j=>j.cycle),{loading:a,logoutStudent:o,finishRegistration:i}=Ne(),[l,c]=x.useState(1),[u,d]=x.useState(!1),m=x.useMemo(()=>{const j=s?.registration_steps||[],O=s?.is_registration_completed||!1,T=re.filter(H=>j.includes(H.key)).length,$=Math.round(T/re.length*100);return{completedSteps:j,completedStepsCount:T,progressPercentage:$,isRegistrationCompleted:O}},[s?.registration_steps,s?.is_registration_completed]),{completedSteps:h,completedStepsCount:f,progressPercentage:g,isRegistrationCompleted:w}=m;x.useEffect(()=>{w&&r?.enrollment_open===!1&&e("/student",{replace:!0})},[w,r?.enrollment_open,e]);const N=j=>h.includes(j),v=j=>{if(j<=l)return!0;const O=re[l-1]?.key;return j===l+1&&N(O)},S=()=>re[l-1],b=()=>{const j=re[l-1];return N(j?.key)},A=()=>w||re.every(j=>N(j.key));x.useEffect(()=>{if(!(!t||u)){if(h.length===0)c(1);else{const j=re.findIndex(O=>!h.includes(O.key));c(j===-1?re.length:j+1)}d(!0)}},[t,u,h]);const P=j=>{v(j)&&c(j)},y=()=>{l>1&&c(l-1)},C=()=>{l<re.length&&b()&&c(l+1)},p=async()=>{if(!A()){R.error("Complete todos los pasos antes de finalizar");return}const j=await i();if(!j.success){const O=j.error||"Error al finalizar la inscripción";R.error(O);return}R.success(j.message||"Inscripción finalizada exitosamente")},E=async()=>{await o()},L=S()?.component;return u?w&&r?.enrollment_open?n.jsxs(n.Fragment,{children:[n.jsx(pe,{show:a,message:"Procesando..."}),n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-gray-100",children:[n.jsx(Ca,{user:t,loading:a,onLogout:E}),n.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6 lg:py-8",children:n.jsx(mf,{})})]})]}):n.jsxs(n.Fragment,{children:[n.jsx(pe,{show:a,message:"Procesando..."}),n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-gray-100",children:[n.jsx(Ca,{user:t,loading:a,progressPercentage:g,completedStepsCount:f,currentStep:l,onLogout:E}),n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6 lg:py-8",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx(Ts,{className:"hidden lg:block border border-gray-200 shadow-sm",children:n.jsx(As,{className:"p-4 lg:p-6",children:n.jsxs("div",{className:"flex items-center justify-between relative",children:[re.map(j=>n.jsx(gf,{step:j,isActive:l===j.id,isCompleted:N(j.key),isAccessible:v(j.id),onClick:P},j.id)),n.jsx("div",{className:"absolute top-6 left-6 right-6 h-0.5 bg-gray-200 -z-0",children:n.jsx("div",{className:"h-full bg-gradient-to-r from-green-500 via-blue-500 to-[#00306e] transition-all duration-700 ease-out",style:{width:`${f/re.length*100}%`}})})]})})}),n.jsx("div",{className:"lg:hidden",children:n.jsx(Ts,{className:"border border-gray-200 shadow-sm",children:n.jsxs(As,{className:"p-4",children:[n.jsx("div",{className:"text-center mb-3",children:n.jsx("h2",{className:"text-base font-semibold text-gray-900",children:S()?.shortTitle||S()?.title})}),n.jsx("div",{className:"flex justify-center space-x-2",children:re.map(j=>n.jsx(xf,{step:j,isActive:l===j.id,isCompleted:N(j.key),isAccessible:v(j.id),onClick:P},j.id))})]})})})]}),n.jsx(Ts,{className:"border border-gray-200 shadow-sm",children:n.jsxs(As,{className:"p-0",children:[n.jsx("div",{className:"p-6 lg:p-8",children:n.jsx(fd,{mode:"wait",children:n.jsx(st.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.4,ease:"easeInOut"},className:"w-full",children:L?n.jsx(L,{}):n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx("p",{className:"text-gray-500",children:"Componente no encontrado"})})},l)})}),n.jsx("div",{className:"border-t border-gray-200 bg-gray-50 px-6 py-4 lg:px-8 lg:py-6",children:n.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[n.jsxs(mn,{variant:"outline",onClick:y,disabled:l===1,className:"w-full sm:w-auto px-6 py-2.5 font-medium border-gray-300 text-gray-700 hover:bg-gray-100 hover:border-gray-400 hover:shadow-md disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-200",children:[n.jsx(Uo,{className:"w-4 h-4 mr-2"}),"Anterior"]}),n.jsxs("div",{className:"hidden sm:flex items-center space-x-4 text-sm text-gray-600",children:[n.jsxs("span",{children:["Paso ",l," de ",re.length]}),n.jsx("div",{className:"w-px h-4 bg-gray-300"}),n.jsx("span",{className:"font-medium text-gray-900",children:S()?.title})]}),n.jsx(mn,{onClick:l===re.length&&A()?p:C,disabled:l===re.length?!A():!b(),className:"w-full sm:w-auto px-6 py-2.5 font-medium bg-[#00306e] hover:bg-blue-800 text-white shadow-md hover:shadow-lg hover:shadow-[#00306e]/25 disabled:opacity-40 disabled:cursor-not-allowed transform hover:scale-[1.02] active:scale-[0.98] transition-all duration-200",children:l===re.length?A()?n.jsxs(n.Fragment,{children:[n.jsx(Os,{className:"w-4 h-4 mr-2"}),"Finalizar Inscripción"]}):n.jsxs(n.Fragment,{children:[n.jsx(Os,{className:"w-4 h-4 mr-2"}),"Complete todos los pasos"]}):b()?n.jsxs(n.Fragment,{children:["Continuar",n.jsx(Qn,{className:"w-4 h-4 ml-2"})]}):n.jsxs(n.Fragment,{children:["Complete este paso",n.jsx(Qn,{className:"w-4 h-4 ml-2"})]})})]})})]})})]})]})]}):n.jsx(pe,{show:!0,message:"Cargando proceso de inscripción..."})};export{Jf as default};
