diff --git a/ReactRoastDotnet.API/wwwroot/assets/AuthFormHeader-c7daf50a.js b/ReactRoastDotnet.API/wwwroot/assets/AuthFormHeader-e50a937c.js similarity index 84% rename from ReactRoastDotnet.API/wwwroot/assets/AuthFormHeader-c7daf50a.js rename to ReactRoastDotnet.API/wwwroot/assets/AuthFormHeader-e50a937c.js index f0e2e6b..6b68dc2 100644 --- a/ReactRoastDotnet.API/wwwroot/assets/AuthFormHeader-c7daf50a.js +++ b/ReactRoastDotnet.API/wwwroot/assets/AuthFormHeader-e50a937c.js @@ -1 +1 @@ -import{j as t,C as r}from"./index-abbaf79c.js";function n(e){return t.jsxs("div",{className:"flex flex-col justify-center items-center text-center lg:text-left",children:[t.jsx("div",{className:"mt-10 text-primary",children:t.jsx(r,{})}),t.jsx("h1",{className:"mt-2 text-center text-2xl font-bold leading-9 text-transparent bg-clip-text bg-gradient-to-r from-primary to-secondary",children:e.title})]})}export{n as A}; +import{j as t,C as r}from"./index-e97df17e.js";function n(e){return t.jsxs("div",{className:"flex flex-col justify-center items-center text-center lg:text-left",children:[t.jsx("div",{className:"mt-10 text-primary",children:t.jsx(r,{})}),t.jsx("h1",{className:"mt-2 text-center text-2xl font-bold leading-9 text-transparent bg-clip-text bg-gradient-to-r from-primary to-secondary",children:e.title})]})}export{n as A}; diff --git a/ReactRoastDotnet.API/wwwroot/assets/AuthInput-dc4b44dd.js b/ReactRoastDotnet.API/wwwroot/assets/AuthInput-179d8048.js similarity index 99% rename from ReactRoastDotnet.API/wwwroot/assets/AuthInput-dc4b44dd.js rename to ReactRoastDotnet.API/wwwroot/assets/AuthInput-179d8048.js index e899d09..dde69d9 100644 --- a/ReactRoastDotnet.API/wwwroot/assets/AuthInput-dc4b44dd.js +++ b/ReactRoastDotnet.API/wwwroot/assets/AuthInput-179d8048.js @@ -1 +1 @@ -import{R as z,r as ft,j as ae}from"./index-abbaf79c.js";var le=e=>e.type==="checkbox",ee=e=>e instanceof Date,C=e=>e==null;const Qe=e=>typeof e=="object";var p=e=>!C(e)&&!Array.isArray(e)&&Qe(e)&&!ee(e),dt=e=>p(e)&&e.target?le(e.target)?e.target.checked:e.target.value:e,yt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ht=(e,i)=>e.has(yt(i)),gt=e=>{const i=e.constructor&&e.constructor.prototype;return p(i)&&i.hasOwnProperty("isPrototypeOf")},Ee=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function W(e){let i;const s=Array.isArray(e);if(e instanceof Date)i=new Date(e);else if(e instanceof Set)i=new Set(e);else if(!(Ee&&(e instanceof Blob||e instanceof FileList))&&(s||p(e)))if(i=s?[]:{},!s&&!gt(e))i=e;else for(const r in e)e.hasOwnProperty(r)&&(i[r]=W(e[r]));else return e;return i}var oe=e=>Array.isArray(e)?e.filter(Boolean):[],D=e=>e===void 0,d=(e,i,s)=>{if(!i||!p(e))return s;const r=oe(i.split(/[,[\].]+?/)).reduce((l,u)=>C(l)?l:l[u],e);return D(r)||r===e?D(e[i])?s:e[i]:r};const $e={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},P={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},j={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};z.createContext(null);var vt=(e,i,s,r=!0)=>{const l={defaultValues:i._defaultValues};for(const u in e)Object.defineProperty(l,u,{get:()=>{const f=u;return i._proxyFormState[f]!==P.all&&(i._proxyFormState[f]=!r||P.all),s&&(s[f]=!0),e[f]}});return l},N=e=>p(e)&&!Object.keys(e).length,bt=(e,i,s,r)=>{s(e);const{name:l,...u}=e;return N(u)||Object.keys(u).length>=Object.keys(i).length||Object.keys(u).find(f=>i[f]===(!r||P.all))},we=e=>Array.isArray(e)?e:[e];function _t(e){const i=z.useRef(e);i.current=e,z.useEffect(()=>{const s=!e.disabled&&i.current.subject&&i.current.subject.subscribe({next:i.current.next});return()=>{s&&s.unsubscribe()}},[e.disabled])}var q=e=>typeof e=="string",xt=(e,i,s,r,l)=>q(e)?(r&&i.watch.add(e),d(s,e,l)):Array.isArray(e)?e.map(u=>(r&&i.watch.add(u),d(s,u))):(r&&(i.watchAll=!0),s),Ce=e=>/^\w*$/.test(e),Xe=e=>oe(e.replace(/["|']|\]/g,"").split(/\.|\[/));function V(e,i,s){let r=-1;const l=Ce(i)?[i]:Xe(i),u=l.length,f=u-1;for(;++ri?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[r]:l||!0}}:{};const Se=(e,i,s)=>{for(const r of s||Object.keys(e)){const l=d(e,r);if(l){const{_f:u,...f}=l;if(u&&i(u.name)){if(u.ref.focus){u.ref.focus();break}else if(u.refs&&u.refs[0].focus){u.refs[0].focus();break}}else p(f)&&Se(f,i)}}};var je=e=>({isOnSubmit:!e||e===P.onSubmit,isOnBlur:e===P.onBlur,isOnChange:e===P.onChange,isOnAll:e===P.all,isOnTouch:e===P.onTouched}),He=(e,i,s)=>!s&&(i.watchAll||i.watch.has(e)||[...i.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length)))),Vt=(e,i,s)=>{const r=oe(d(e,s));return V(r,"root",i[s]),V(e,s,r),e},te=e=>typeof e=="boolean",Oe=e=>e.type==="file",K=e=>typeof e=="function",de=e=>{if(!Ee)return!1;const i=e?e.ownerDocument:0;return e instanceof(i&&i.defaultView?i.defaultView.HTMLElement:HTMLElement)},fe=e=>q(e),Le=e=>e.type==="radio",ye=e=>e instanceof RegExp;const We={value:!1,isValid:!1},ze={value:!0,isValid:!0};var Ye=e=>{if(Array.isArray(e)){if(e.length>1){const i=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:i,isValid:!!i.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!D(e[0].attributes.value)?D(e[0].value)||e[0].value===""?ze:{value:e[0].value,isValid:!0}:ze:We}return We};const Ke={isValid:!1,value:null};var et=e=>Array.isArray(e)?e.reduce((i,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:i,Ke):Ke;function Ze(e,i,s="validate"){if(fe(e)||Array.isArray(e)&&e.every(fe)||te(e)&&!e)return{type:s,message:fe(e)?e:"",ref:i}}var Y=e=>p(e)&&!ye(e)?e:{value:e,message:""},Ge=async(e,i,s,r,l)=>{const{ref:u,refs:f,required:A,maxLength:x,minLength:L,min:Q,max:k,pattern:b,validate:H,name:T,valueAsNumber:ve,mount:ce,disabled:be}=e._f,g=d(i,T);if(!ce||be)return{};const M=f?f[0]:u,I=_=>{r&&M.reportValidity&&(M.setCustomValidity(te(_)?"":_||""),M.reportValidity())},S={},re=Le(u),se=le(u),_e=re||se,U=(ve||Oe(u))&&D(u.value)&&D(g)||de(u)&&u.value===""||g===""||Array.isArray(g)&&!g.length,Z=At.bind(null,T,s,S),$=(_,v,w,O=j.maxLength,R=j.minLength)=>{const B=_?v:w;S[T]={type:_?O:R,message:B,ref:u,...Z(_?O:R,B)}};if(l?!Array.isArray(g)||!g.length:A&&(!_e&&(U||C(g))||te(g)&&!g||se&&!Ye(f).isValid||re&&!et(f).isValid)){const{value:_,message:v}=fe(A)?{value:!!A,message:A}:Y(A);if(_&&(S[T]={type:j.required,message:v,ref:M,...Z(j.required,v)},!s))return I(v),S}if(!U&&(!C(Q)||!C(k))){let _,v;const w=Y(k),O=Y(Q);if(!C(g)&&!isNaN(g)){const R=u.valueAsNumber||g&&+g;C(w.value)||(_=R>w.value),C(O.value)||(v=Rnew Date(new Date().toDateString()+" "+ne),G=u.type=="time",ie=u.type=="week";q(w.value)&&g&&(_=G?B(g)>B(w.value):ie?g>w.value:R>new Date(w.value)),q(O.value)&&g&&(v=G?B(g)+_.value,O=!C(v.value)&&g.length<+v.value;if((w||O)&&($(w,_.message,v.message),!s))return I(S[T].message),S}if(b&&!U&&q(g)){const{value:_,message:v}=Y(b);if(ye(_)&&!g.match(_)&&(S[T]={type:j.pattern,message:v,ref:u,...Z(j.pattern,v)},!s))return I(v),S}if(H){if(K(H)){const _=await H(g,i),v=Ze(_,M);if(v&&(S[T]={...v,...Z(j.validate,v.message)},!s))return I(v.message),S}else if(p(H)){let _={};for(const v in H){if(!N(_)&&!s)break;const w=Ze(await H[v](g,i),M,v);w&&(_={...w,...Z(v,w.message)},I(w.message),s&&(S[T]=_))}if(!N(_)&&(S[T]={ref:M,..._},!s))return S}}return I(!0),S};function mt(e,i){const s=i.slice(0,-1).length;let r=0;for(;r{for(const u of e)u.next&&u.next(l)},subscribe:l=>(e.push(l),{unsubscribe:()=>{e=e.filter(u=>u!==l)}}),unsubscribe:()=>{e=[]}}}var he=e=>C(e)||!Qe(e);function J(e,i){if(he(e)||he(i))return e===i;if(ee(e)&&ee(i))return e.getTime()===i.getTime();const s=Object.keys(e),r=Object.keys(i);if(s.length!==r.length)return!1;for(const l of s){const u=e[l];if(!r.includes(l))return!1;if(l!=="ref"){const f=i[l];if(ee(u)&&ee(f)||p(u)&&p(f)||Array.isArray(u)&&Array.isArray(f)?!J(u,f):u!==f)return!1}}return!0}var tt=e=>e.type==="select-multiple",Ft=e=>Le(e)||le(e),De=e=>de(e)&&e.isConnected,rt=e=>{for(const i in e)if(K(e[i]))return!0;return!1};function ge(e,i={}){const s=Array.isArray(e);if(p(e)||s)for(const r in e)Array.isArray(e[r])||p(e[r])&&!rt(e[r])?(i[r]=Array.isArray(e[r])?[]:{},ge(e[r],i[r])):C(e[r])||(i[r]=!0);return i}function st(e,i,s){const r=Array.isArray(e);if(p(e)||r)for(const l in e)Array.isArray(e[l])||p(e[l])&&!rt(e[l])?D(i)||he(s[l])?s[l]=Array.isArray(e[l])?ge(e[l],[]):{...ge(e[l])}:st(e[l],C(i)?{}:i[l],s[l]):s[l]=!J(e[l],i[l]);return s}var ke=(e,i)=>st(e,i,ge(i)),it=(e,{valueAsNumber:i,valueAsDate:s,setValueAs:r})=>D(e)?e:i?e===""?NaN:e&&+e:s&&q(e)?new Date(e):r?r(e):e;function pe(e){const i=e.ref;if(!(e.refs?e.refs.every(s=>s.disabled):i.disabled))return Oe(i)?i.files:Le(i)?et(e.refs).value:tt(i)?[...i.selectedOptions].map(({value:s})=>s):le(i)?Ye(e.refs).value:it(D(i.value)?e.ref.value:i.value,e)}var Dt=(e,i,s,r)=>{const l={};for(const u of e){const f=d(i,u);f&&V(l,u,f._f)}return{criteriaMode:s,names:[...e],fields:l,shouldUseNativeValidation:r}},ue=e=>D(e)?e:ye(e)?e.source:p(e)?ye(e.value)?e.value.source:e.value:e,kt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Je(e,i,s){const r=d(e,s);if(r||Ce(s))return{error:r,name:s};const l=s.split(".");for(;l.length;){const u=l.join("."),f=d(i,u),A=d(e,u);if(f&&!Array.isArray(f)&&s!==u)return{name:s};if(A&&A.type)return{name:u,error:A};l.pop()}return{name:s}}var pt=(e,i,s,r,l)=>l.isOnAll?!1:!s&&l.isOnTouch?!(i||e):(s?r.isOnBlur:l.isOnBlur)?!e:(s?r.isOnChange:l.isOnChange)?e:!0,St=(e,i)=>!oe(d(e,i)).length&&E(e,i);const Et={mode:P.onSubmit,reValidateMode:P.onChange,shouldFocusError:!0};function Ct(e={},i){let s={...Et,...e},r={submitCount:0,isDirty:!1,isLoading:K(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},l={},u=p(s.defaultValues)||p(s.values)?W(s.defaultValues||s.values)||{}:{},f=s.shouldUnregister?{}:W(u),A={action:!1,mount:!1,watch:!1},x={mount:new Set,unMount:new Set,array:new Set,watch:new Set},L,Q=0;const k={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},b={values:Fe(),array:Fe(),state:Fe()},H=e.resetOptions&&e.resetOptions.keepDirtyValues,T=je(s.mode),ve=je(s.reValidateMode),ce=s.criteriaMode===P.all,be=t=>n=>{clearTimeout(Q),Q=setTimeout(t,n)},g=async t=>{if(k.isValid||t){const n=s.resolver?N((await U()).errors):await $(l,!0);n!==r.isValid&&b.state.next({isValid:n})}},M=t=>k.isValidating&&b.state.next({isValidating:t}),I=(t,n=[],a,y,c=!0,o=!0)=>{if(y&&a){if(A.action=!0,o&&Array.isArray(d(l,t))){const h=a(d(l,t),y.argA,y.argB);c&&V(l,t,h)}if(o&&Array.isArray(d(r.errors,t))){const h=a(d(r.errors,t),y.argA,y.argB);c&&V(r.errors,t,h),St(r.errors,t)}if(k.touchedFields&&o&&Array.isArray(d(r.touchedFields,t))){const h=a(d(r.touchedFields,t),y.argA,y.argB);c&&V(r.touchedFields,t,h)}k.dirtyFields&&(r.dirtyFields=ke(u,f)),b.state.next({name:t,isDirty:v(t,n),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else V(f,t,n)},S=(t,n)=>{V(r.errors,t,n),b.state.next({errors:r.errors})},re=(t,n,a,y)=>{const c=d(l,t);if(c){const o=d(f,t,D(a)?d(u,t):a);D(o)||y&&y.defaultChecked||n?V(f,t,n?o:pe(c._f)):R(t,o),A.mount&&g()}},se=(t,n,a,y,c)=>{let o=!1,h=!1;const m={name:t};if(!a||y){k.isDirty&&(h=r.isDirty,r.isDirty=m.isDirty=v(),o=h!==m.isDirty);const F=J(d(u,t),n);h=d(r.dirtyFields,t),F?E(r.dirtyFields,t):V(r.dirtyFields,t,!0),m.dirtyFields=r.dirtyFields,o=o||k.dirtyFields&&h!==!F}if(a){const F=d(r.touchedFields,t);F||(V(r.touchedFields,t,a),m.touchedFields=r.touchedFields,o=o||k.touchedFields&&F!==a)}return o&&c&&b.state.next(m),o?m:{}},_e=(t,n,a,y)=>{const c=d(r.errors,t),o=k.isValid&&te(n)&&r.isValid!==n;if(e.delayError&&a?(L=be(()=>S(t,a)),L(e.delayError)):(clearTimeout(Q),L=null,a?V(r.errors,t,a):E(r.errors,t)),(a?!J(c,a):c)||!N(y)||o){const h={...y,...o&&te(n)?{isValid:n}:{},errors:r.errors,name:t};r={...r,...h},b.state.next(h)}M(!1)},U=async t=>s.resolver(f,s.context,Dt(t||x.mount,l,s.criteriaMode,s.shouldUseNativeValidation)),Z=async t=>{const{errors:n}=await U();if(t)for(const a of t){const y=d(n,a);y?V(r.errors,a,y):E(r.errors,a)}else r.errors=n;return n},$=async(t,n,a={valid:!0})=>{for(const y in t){const c=t[y];if(c){const{_f:o,...h}=c;if(o){const m=x.array.has(o.name),F=await Ge(c,f,ce,s.shouldUseNativeValidation&&!n,m);if(F[o.name]&&(a.valid=!1,n))break;!n&&(d(F,o.name)?m?Vt(r.errors,F,o.name):V(r.errors,o.name,F[o.name]):E(r.errors,o.name))}h&&await $(h,n,a)}}return a.valid},_=()=>{for(const t of x.unMount){const n=d(l,t);n&&(n._f.refs?n._f.refs.every(a=>!De(a)):!De(n._f.ref))&&xe(t)}x.unMount=new Set},v=(t,n)=>(t&&n&&V(f,t,n),!J(Te(),u)),w=(t,n,a)=>xt(t,x,{...A.mount?f:D(n)?u:q(t)?{[t]:n}:n},a,n),O=t=>oe(d(A.mount?f:u,t,e.shouldUnregister?d(u,t,[]):[])),R=(t,n,a={})=>{const y=d(l,t);let c=n;if(y){const o=y._f;o&&(!o.disabled&&V(f,t,it(n,o)),c=de(o.ref)&&C(n)?"":n,tt(o.ref)?[...o.ref.options].forEach(h=>h.selected=c.includes(h.value)):o.refs?le(o.ref)?o.refs.length>1?o.refs.forEach(h=>(!h.defaultChecked||!h.disabled)&&(h.checked=Array.isArray(c)?!!c.find(m=>m===h.value):c===h.value)):o.refs[0]&&(o.refs[0].checked=!!c):o.refs.forEach(h=>h.checked=h.value===c):Oe(o.ref)?o.ref.value="":(o.ref.value=c,o.ref.type||b.values.next({name:t,values:{...f}})))}(a.shouldDirty||a.shouldTouch)&&se(t,c,a.shouldTouch,a.shouldDirty,!0),a.shouldValidate&&ne(t)},B=(t,n,a)=>{for(const y in n){const c=n[y],o=`${t}.${y}`,h=d(l,o);(x.array.has(t)||!he(c)||h&&!h._f)&&!ee(c)?B(o,c,a):R(o,c,a)}},G=(t,n,a={})=>{const y=d(l,t),c=x.array.has(t),o=W(n);V(f,t,o),c?(b.array.next({name:t,values:{...f}}),(k.isDirty||k.dirtyFields)&&a.shouldDirty&&b.state.next({name:t,dirtyFields:ke(u,f),isDirty:v(t,o)})):y&&!y._f&&!C(o)?B(t,o,a):R(t,o,a),He(t,x)&&b.state.next({...r}),b.values.next({name:t,values:{...f}}),!A.mount&&i()},ie=async t=>{const n=t.target;let a=n.name,y=!0;const c=d(l,a),o=()=>n.type?pe(c._f):dt(t);if(c){let h,m;const F=o(),X=t.type===$e.BLUR||t.type===$e.FOCUS_OUT,lt=!kt(c._f)&&!s.resolver&&!d(r.errors,a)&&!c._f.deps||pt(X,d(r.touchedFields,a),r.isSubmitted,ve,T),Ve=He(a,x,X);V(f,a,F),X?(c._f.onBlur&&c._f.onBlur(t),L&&L(0)):c._f.onChange&&c._f.onChange(t);const me=se(a,F,X,!1),ot=!N(me)||Ve;if(!X&&b.values.next({name:a,type:t.type,values:{...f}}),lt)return k.isValid&&g(),ot&&b.state.next({name:a,...Ve?{}:me});if(!X&&Ve&&b.state.next({...r}),M(!0),s.resolver){const{errors:qe}=await U([a]),ct=Je(r.errors,l,a),Ie=Je(qe,l,ct.name||a);h=Ie.error,a=Ie.name,m=N(qe)}else h=(await Ge(c,f,ce,s.shouldUseNativeValidation))[a],y=isNaN(F)||F===d(f,a,F),y&&(h?m=!1:k.isValid&&(m=await $(l,!0)));y&&(c._f.deps&&ne(c._f.deps),_e(a,m,h,me))}},ne=async(t,n={})=>{let a,y;const c=we(t);if(M(!0),s.resolver){const o=await Z(D(t)?t:c);a=N(o),y=t?!c.some(h=>d(o,h)):a}else t?(y=(await Promise.all(c.map(async o=>{const h=d(l,o);return await $(h&&h._f?{[o]:h}:h)}))).every(Boolean),!(!y&&!r.isValid)&&g()):y=a=await $(l);return b.state.next({...!q(t)||k.isValid&&a!==r.isValid?{}:{name:t},...s.resolver||!t?{isValid:a}:{},errors:r.errors,isValidating:!1}),n.shouldFocus&&!y&&Se(l,o=>o&&d(r.errors,o),t?c:x.mount),y},Te=t=>{const n={...u,...A.mount?f:{}};return D(t)?n:q(t)?d(n,t):t.map(a=>d(n,a))},Re=(t,n)=>({invalid:!!d((n||r).errors,t),isDirty:!!d((n||r).dirtyFields,t),isTouched:!!d((n||r).touchedFields,t),error:d((n||r).errors,t)}),nt=t=>{t&&we(t).forEach(n=>E(r.errors,n)),b.state.next({errors:t?r.errors:{}})},Ne=(t,n,a)=>{const y=(d(l,t,{_f:{}})._f||{}).ref;V(r.errors,t,{...n,ref:y}),b.state.next({name:t,errors:r.errors,isValid:!1}),a&&a.shouldFocus&&y&&y.focus&&y.focus()},at=(t,n)=>K(t)?b.values.subscribe({next:a=>t(w(void 0,n),a)}):w(t,n,!0),xe=(t,n={})=>{for(const a of t?we(t):x.mount)x.mount.delete(a),x.array.delete(a),n.keepValue||(E(l,a),E(f,a)),!n.keepError&&E(r.errors,a),!n.keepDirty&&E(r.dirtyFields,a),!n.keepTouched&&E(r.touchedFields,a),!s.shouldUnregister&&!n.keepDefaultValue&&E(u,a);b.values.next({values:{...f}}),b.state.next({...r,...n.keepDirty?{isDirty:v()}:{}}),!n.keepIsValid&&g()},Ae=(t,n={})=>{let a=d(l,t);const y=te(n.disabled);return V(l,t,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:t}},name:t,mount:!0,...n}}),x.mount.add(t),D(n.value)||V(f,t,n.value),a?y&&V(f,t,n.disabled?void 0:d(f,t,pe(a._f))):re(t,!0,n.value),{...y?{disabled:n.disabled}:{},...s.progressive?{required:!!n.required,min:ue(n.min),max:ue(n.max),minLength:ue(n.minLength),maxLength:ue(n.maxLength),pattern:ue(n.pattern)}:{},name:t,onChange:ie,onBlur:ie,ref:c=>{if(c){Ae(t,n),a=d(l,t);const o=D(c.value)&&c.querySelectorAll&&c.querySelectorAll("input,select,textarea")[0]||c,h=Ft(o),m=a._f.refs||[];if(h?m.find(F=>F===o):o===a._f.ref)return;V(l,t,{_f:{...a._f,...h?{refs:[...m.filter(De),o,...Array.isArray(d(u,t))?[{}]:[]],ref:{type:o.type,name:t}}:{ref:o}}}),re(t,!1,void 0,o)}else a=d(l,t,{}),a._f&&(a._f.mount=!1),(s.shouldUnregister||n.shouldUnregister)&&!(ht(x.array,t)&&A.action)&&x.unMount.add(t)}}},Me=()=>s.shouldFocusError&&Se(l,t=>t&&d(r.errors,t),x.mount),Pe=(t,n)=>async a=>{a&&(a.preventDefault&&a.preventDefault(),a.persist&&a.persist());let y=W(f);if(b.state.next({isSubmitting:!0}),s.resolver){const{errors:c,values:o}=await U();r.errors=c,y=o}else await $(l);E(r.errors,"root"),N(r.errors)?(b.state.next({errors:{}}),await t(y,a)):(n&&await n({...r.errors},a),Me(),setTimeout(Me)),b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:N(r.errors),submitCount:r.submitCount+1,errors:r.errors})},ut=(t,n={})=>{d(l,t)&&(D(n.defaultValue)?G(t,d(u,t)):(G(t,n.defaultValue),V(u,t,n.defaultValue)),n.keepTouched||E(r.touchedFields,t),n.keepDirty||(E(r.dirtyFields,t),r.isDirty=n.defaultValue?v(t,d(u,t)):v()),n.keepError||(E(r.errors,t),k.isValid&&g()),b.state.next({...r}))},Ue=(t,n={})=>{const a=t||u,y=W(a),c=t&&!N(t)?y:u;if(n.keepDefaultValues||(u=a),!n.keepValues){if(n.keepDirtyValues||H)for(const o of x.mount)d(r.dirtyFields,o)?V(c,o,d(f,o)):G(o,d(c,o));else{if(Ee&&D(t))for(const o of x.mount){const h=d(l,o);if(h&&h._f){const m=Array.isArray(h._f.refs)?h._f.refs[0]:h._f.ref;if(de(m)){const F=m.closest("form");if(F){F.reset();break}}}}l={}}f=e.shouldUnregister?n.keepDefaultValues?W(u):{}:W(c),b.array.next({values:{...c}}),b.values.next({values:{...c}})}x={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!A.mount&&i(),A.mount=!k.isValid||!!n.keepIsValid,A.watch=!!e.shouldUnregister,b.state.next({submitCount:n.keepSubmitCount?r.submitCount:0,isDirty:n.keepDirty?r.isDirty:!!(n.keepDefaultValues&&!J(t,u)),isSubmitted:n.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:n.keepDirtyValues?r.dirtyFields:n.keepDefaultValues&&t?ke(u,t):{},touchedFields:n.keepTouched?r.touchedFields:{},errors:n.keepErrors?r.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},Be=(t,n)=>Ue(K(t)?t(f):t,n);return{control:{register:Ae,unregister:xe,getFieldState:Re,handleSubmit:Pe,setError:Ne,_executeSchema:U,_getWatch:w,_getDirty:v,_updateValid:g,_removeUnmounted:_,_updateFieldArray:I,_getFieldArray:O,_reset:Ue,_resetDefaultValues:()=>K(s.defaultValues)&&s.defaultValues().then(t=>{Be(t,s.resetOptions),b.state.next({isLoading:!1})}),_updateFormState:t=>{r={...r,...t}},_subjects:b,_proxyFormState:k,get _fields(){return l},get _formValues(){return f},get _state(){return A},set _state(t){A=t},get _defaultValues(){return u},get _names(){return x},set _names(t){x=t},get _formState(){return r},set _formState(t){r=t},get _options(){return s},set _options(t){s={...s,...t}}},trigger:ne,register:Ae,handleSubmit:Pe,watch:at,setValue:G,getValues:Te,reset:Be,resetField:ut,clearErrors:nt,unregister:xe,setError:Ne,setFocus:(t,n={})=>{const a=d(l,t),y=a&&a._f;if(y){const c=y.refs?y.refs[0]:y.ref;c.focus&&(c.focus(),n.shouldSelect&&c.select())}},getFieldState:Re}}function Zt(e={}){const i=z.useRef(),s=z.useRef(),[r,l]=z.useState({isDirty:!1,isValidating:!1,isLoading:K(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:K(e.defaultValues)?void 0:e.defaultValues});i.current||(i.current={...Ct(e,()=>l(f=>({...f}))),formState:r});const u=i.current.control;return u._options=e,_t({subject:u._subjects.state,next:f=>{bt(f,u._proxyFormState,u._updateFormState,!0)&&l({...u._formState})}}),z.useEffect(()=>{e.values&&!J(e.values,s.current)?(u._reset(e.values,u._options.resetOptions),s.current=e.values):u._resetDefaultValues()},[e.values,u]),z.useEffect(()=>{u._state.mount||(u._updateValid(),u._state.mount=!0),u._state.watch&&(u._state.watch=!1,u._subjects.state.next({...u._formState})),u._removeUnmounted()}),i.current.formState=vt(r,u),i.current}const Ot=/[a-z]/,Lt=/[A-Z]/,Tt=/[0-9]/,Rt=/[!@#$%^&*()_\-+=\][}{":;'?.`,~]/;function Nt(e){if(!Ot.test(e))return"Password must contain a lowercase letter."}function Mt(e){if(!Lt.test(e))return"Password must contain an uppercase letter."}function Pt(e){if(!Tt.test(e))return"Password must contain a number."}function Ut(e){if(!Rt.test(e))return"Password must contain a special character."}const Gt={required:"Password is required",minLength:{value:6,message:"Min length is 6"}},Jt={required:"Password is required",minLength:{value:6,message:"Min length is 6"},validate:{hasLowerCase:Nt,hasUpperCase:Mt,hasNumber:Pt,hasSpecialCharacter:Ut}},Qt={required:"Email is required",pattern:{value:/^.+@[^.].*\.[a-z]{2,}$/,message:"Please enter a valid email"}},Xt={required:"Name is required",minLength:{value:1,message:"Please enter a name"},pattern:{value:/^(?!\s*$).+/,message:"Please enter non-empty name"}},Bt="input input-bordered focus:input-primary dark:text-white",qt="input input-bordered input-error",It="label-text",$t="label-text text-error";function jt(e,i){return ae.jsxs("div",{className:"form-control",children:[ae.jsx("label",{className:"label",children:ae.jsx("span",{className:e.errorMsg?$t:It,children:e.labelText})}),ae.jsx("input",{id:e.name,type:e.type,ref:i,name:e.name,onChange:e.onChange,onBlur:e.onBlur,placeholder:e.name,className:e.errorMsg?qt:Bt,autoComplete:e.autoComplete,value:e.value,disabled:e.disabled}),ae.jsx("p",{className:"text-sm text-error pt-1 pl-2",children:e.errorMsg??""})]})}const Yt=ft.forwardRef(jt);export{Yt as A,Jt as a,Qt as e,Xt as n,Gt as s,Zt as u}; +import{R as z,r as ft,j as ae}from"./index-e97df17e.js";var le=e=>e.type==="checkbox",ee=e=>e instanceof Date,C=e=>e==null;const Qe=e=>typeof e=="object";var p=e=>!C(e)&&!Array.isArray(e)&&Qe(e)&&!ee(e),dt=e=>p(e)&&e.target?le(e.target)?e.target.checked:e.target.value:e,yt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ht=(e,i)=>e.has(yt(i)),gt=e=>{const i=e.constructor&&e.constructor.prototype;return p(i)&&i.hasOwnProperty("isPrototypeOf")},Ee=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function W(e){let i;const s=Array.isArray(e);if(e instanceof Date)i=new Date(e);else if(e instanceof Set)i=new Set(e);else if(!(Ee&&(e instanceof Blob||e instanceof FileList))&&(s||p(e)))if(i=s?[]:{},!s&&!gt(e))i=e;else for(const r in e)e.hasOwnProperty(r)&&(i[r]=W(e[r]));else return e;return i}var oe=e=>Array.isArray(e)?e.filter(Boolean):[],D=e=>e===void 0,d=(e,i,s)=>{if(!i||!p(e))return s;const r=oe(i.split(/[,[\].]+?/)).reduce((l,u)=>C(l)?l:l[u],e);return D(r)||r===e?D(e[i])?s:e[i]:r};const $e={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},P={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},j={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};z.createContext(null);var vt=(e,i,s,r=!0)=>{const l={defaultValues:i._defaultValues};for(const u in e)Object.defineProperty(l,u,{get:()=>{const f=u;return i._proxyFormState[f]!==P.all&&(i._proxyFormState[f]=!r||P.all),s&&(s[f]=!0),e[f]}});return l},N=e=>p(e)&&!Object.keys(e).length,bt=(e,i,s,r)=>{s(e);const{name:l,...u}=e;return N(u)||Object.keys(u).length>=Object.keys(i).length||Object.keys(u).find(f=>i[f]===(!r||P.all))},we=e=>Array.isArray(e)?e:[e];function _t(e){const i=z.useRef(e);i.current=e,z.useEffect(()=>{const s=!e.disabled&&i.current.subject&&i.current.subject.subscribe({next:i.current.next});return()=>{s&&s.unsubscribe()}},[e.disabled])}var q=e=>typeof e=="string",xt=(e,i,s,r,l)=>q(e)?(r&&i.watch.add(e),d(s,e,l)):Array.isArray(e)?e.map(u=>(r&&i.watch.add(u),d(s,u))):(r&&(i.watchAll=!0),s),Ce=e=>/^\w*$/.test(e),Xe=e=>oe(e.replace(/["|']|\]/g,"").split(/\.|\[/));function V(e,i,s){let r=-1;const l=Ce(i)?[i]:Xe(i),u=l.length,f=u-1;for(;++ri?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[r]:l||!0}}:{};const Se=(e,i,s)=>{for(const r of s||Object.keys(e)){const l=d(e,r);if(l){const{_f:u,...f}=l;if(u&&i(u.name)){if(u.ref.focus){u.ref.focus();break}else if(u.refs&&u.refs[0].focus){u.refs[0].focus();break}}else p(f)&&Se(f,i)}}};var je=e=>({isOnSubmit:!e||e===P.onSubmit,isOnBlur:e===P.onBlur,isOnChange:e===P.onChange,isOnAll:e===P.all,isOnTouch:e===P.onTouched}),He=(e,i,s)=>!s&&(i.watchAll||i.watch.has(e)||[...i.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length)))),Vt=(e,i,s)=>{const r=oe(d(e,s));return V(r,"root",i[s]),V(e,s,r),e},te=e=>typeof e=="boolean",Oe=e=>e.type==="file",K=e=>typeof e=="function",de=e=>{if(!Ee)return!1;const i=e?e.ownerDocument:0;return e instanceof(i&&i.defaultView?i.defaultView.HTMLElement:HTMLElement)},fe=e=>q(e),Le=e=>e.type==="radio",ye=e=>e instanceof RegExp;const We={value:!1,isValid:!1},ze={value:!0,isValid:!0};var Ye=e=>{if(Array.isArray(e)){if(e.length>1){const i=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:i,isValid:!!i.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!D(e[0].attributes.value)?D(e[0].value)||e[0].value===""?ze:{value:e[0].value,isValid:!0}:ze:We}return We};const Ke={isValid:!1,value:null};var et=e=>Array.isArray(e)?e.reduce((i,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:i,Ke):Ke;function Ze(e,i,s="validate"){if(fe(e)||Array.isArray(e)&&e.every(fe)||te(e)&&!e)return{type:s,message:fe(e)?e:"",ref:i}}var Y=e=>p(e)&&!ye(e)?e:{value:e,message:""},Ge=async(e,i,s,r,l)=>{const{ref:u,refs:f,required:A,maxLength:x,minLength:L,min:Q,max:k,pattern:b,validate:H,name:T,valueAsNumber:ve,mount:ce,disabled:be}=e._f,g=d(i,T);if(!ce||be)return{};const M=f?f[0]:u,I=_=>{r&&M.reportValidity&&(M.setCustomValidity(te(_)?"":_||""),M.reportValidity())},S={},re=Le(u),se=le(u),_e=re||se,U=(ve||Oe(u))&&D(u.value)&&D(g)||de(u)&&u.value===""||g===""||Array.isArray(g)&&!g.length,Z=At.bind(null,T,s,S),$=(_,v,w,O=j.maxLength,R=j.minLength)=>{const B=_?v:w;S[T]={type:_?O:R,message:B,ref:u,...Z(_?O:R,B)}};if(l?!Array.isArray(g)||!g.length:A&&(!_e&&(U||C(g))||te(g)&&!g||se&&!Ye(f).isValid||re&&!et(f).isValid)){const{value:_,message:v}=fe(A)?{value:!!A,message:A}:Y(A);if(_&&(S[T]={type:j.required,message:v,ref:M,...Z(j.required,v)},!s))return I(v),S}if(!U&&(!C(Q)||!C(k))){let _,v;const w=Y(k),O=Y(Q);if(!C(g)&&!isNaN(g)){const R=u.valueAsNumber||g&&+g;C(w.value)||(_=R>w.value),C(O.value)||(v=Rnew Date(new Date().toDateString()+" "+ne),G=u.type=="time",ie=u.type=="week";q(w.value)&&g&&(_=G?B(g)>B(w.value):ie?g>w.value:R>new Date(w.value)),q(O.value)&&g&&(v=G?B(g)+_.value,O=!C(v.value)&&g.length<+v.value;if((w||O)&&($(w,_.message,v.message),!s))return I(S[T].message),S}if(b&&!U&&q(g)){const{value:_,message:v}=Y(b);if(ye(_)&&!g.match(_)&&(S[T]={type:j.pattern,message:v,ref:u,...Z(j.pattern,v)},!s))return I(v),S}if(H){if(K(H)){const _=await H(g,i),v=Ze(_,M);if(v&&(S[T]={...v,...Z(j.validate,v.message)},!s))return I(v.message),S}else if(p(H)){let _={};for(const v in H){if(!N(_)&&!s)break;const w=Ze(await H[v](g,i),M,v);w&&(_={...w,...Z(v,w.message)},I(w.message),s&&(S[T]=_))}if(!N(_)&&(S[T]={ref:M,..._},!s))return S}}return I(!0),S};function mt(e,i){const s=i.slice(0,-1).length;let r=0;for(;r{for(const u of e)u.next&&u.next(l)},subscribe:l=>(e.push(l),{unsubscribe:()=>{e=e.filter(u=>u!==l)}}),unsubscribe:()=>{e=[]}}}var he=e=>C(e)||!Qe(e);function J(e,i){if(he(e)||he(i))return e===i;if(ee(e)&&ee(i))return e.getTime()===i.getTime();const s=Object.keys(e),r=Object.keys(i);if(s.length!==r.length)return!1;for(const l of s){const u=e[l];if(!r.includes(l))return!1;if(l!=="ref"){const f=i[l];if(ee(u)&&ee(f)||p(u)&&p(f)||Array.isArray(u)&&Array.isArray(f)?!J(u,f):u!==f)return!1}}return!0}var tt=e=>e.type==="select-multiple",Ft=e=>Le(e)||le(e),De=e=>de(e)&&e.isConnected,rt=e=>{for(const i in e)if(K(e[i]))return!0;return!1};function ge(e,i={}){const s=Array.isArray(e);if(p(e)||s)for(const r in e)Array.isArray(e[r])||p(e[r])&&!rt(e[r])?(i[r]=Array.isArray(e[r])?[]:{},ge(e[r],i[r])):C(e[r])||(i[r]=!0);return i}function st(e,i,s){const r=Array.isArray(e);if(p(e)||r)for(const l in e)Array.isArray(e[l])||p(e[l])&&!rt(e[l])?D(i)||he(s[l])?s[l]=Array.isArray(e[l])?ge(e[l],[]):{...ge(e[l])}:st(e[l],C(i)?{}:i[l],s[l]):s[l]=!J(e[l],i[l]);return s}var ke=(e,i)=>st(e,i,ge(i)),it=(e,{valueAsNumber:i,valueAsDate:s,setValueAs:r})=>D(e)?e:i?e===""?NaN:e&&+e:s&&q(e)?new Date(e):r?r(e):e;function pe(e){const i=e.ref;if(!(e.refs?e.refs.every(s=>s.disabled):i.disabled))return Oe(i)?i.files:Le(i)?et(e.refs).value:tt(i)?[...i.selectedOptions].map(({value:s})=>s):le(i)?Ye(e.refs).value:it(D(i.value)?e.ref.value:i.value,e)}var Dt=(e,i,s,r)=>{const l={};for(const u of e){const f=d(i,u);f&&V(l,u,f._f)}return{criteriaMode:s,names:[...e],fields:l,shouldUseNativeValidation:r}},ue=e=>D(e)?e:ye(e)?e.source:p(e)?ye(e.value)?e.value.source:e.value:e,kt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Je(e,i,s){const r=d(e,s);if(r||Ce(s))return{error:r,name:s};const l=s.split(".");for(;l.length;){const u=l.join("."),f=d(i,u),A=d(e,u);if(f&&!Array.isArray(f)&&s!==u)return{name:s};if(A&&A.type)return{name:u,error:A};l.pop()}return{name:s}}var pt=(e,i,s,r,l)=>l.isOnAll?!1:!s&&l.isOnTouch?!(i||e):(s?r.isOnBlur:l.isOnBlur)?!e:(s?r.isOnChange:l.isOnChange)?e:!0,St=(e,i)=>!oe(d(e,i)).length&&E(e,i);const Et={mode:P.onSubmit,reValidateMode:P.onChange,shouldFocusError:!0};function Ct(e={},i){let s={...Et,...e},r={submitCount:0,isDirty:!1,isLoading:K(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},l={},u=p(s.defaultValues)||p(s.values)?W(s.defaultValues||s.values)||{}:{},f=s.shouldUnregister?{}:W(u),A={action:!1,mount:!1,watch:!1},x={mount:new Set,unMount:new Set,array:new Set,watch:new Set},L,Q=0;const k={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},b={values:Fe(),array:Fe(),state:Fe()},H=e.resetOptions&&e.resetOptions.keepDirtyValues,T=je(s.mode),ve=je(s.reValidateMode),ce=s.criteriaMode===P.all,be=t=>n=>{clearTimeout(Q),Q=setTimeout(t,n)},g=async t=>{if(k.isValid||t){const n=s.resolver?N((await U()).errors):await $(l,!0);n!==r.isValid&&b.state.next({isValid:n})}},M=t=>k.isValidating&&b.state.next({isValidating:t}),I=(t,n=[],a,y,c=!0,o=!0)=>{if(y&&a){if(A.action=!0,o&&Array.isArray(d(l,t))){const h=a(d(l,t),y.argA,y.argB);c&&V(l,t,h)}if(o&&Array.isArray(d(r.errors,t))){const h=a(d(r.errors,t),y.argA,y.argB);c&&V(r.errors,t,h),St(r.errors,t)}if(k.touchedFields&&o&&Array.isArray(d(r.touchedFields,t))){const h=a(d(r.touchedFields,t),y.argA,y.argB);c&&V(r.touchedFields,t,h)}k.dirtyFields&&(r.dirtyFields=ke(u,f)),b.state.next({name:t,isDirty:v(t,n),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else V(f,t,n)},S=(t,n)=>{V(r.errors,t,n),b.state.next({errors:r.errors})},re=(t,n,a,y)=>{const c=d(l,t);if(c){const o=d(f,t,D(a)?d(u,t):a);D(o)||y&&y.defaultChecked||n?V(f,t,n?o:pe(c._f)):R(t,o),A.mount&&g()}},se=(t,n,a,y,c)=>{let o=!1,h=!1;const m={name:t};if(!a||y){k.isDirty&&(h=r.isDirty,r.isDirty=m.isDirty=v(),o=h!==m.isDirty);const F=J(d(u,t),n);h=d(r.dirtyFields,t),F?E(r.dirtyFields,t):V(r.dirtyFields,t,!0),m.dirtyFields=r.dirtyFields,o=o||k.dirtyFields&&h!==!F}if(a){const F=d(r.touchedFields,t);F||(V(r.touchedFields,t,a),m.touchedFields=r.touchedFields,o=o||k.touchedFields&&F!==a)}return o&&c&&b.state.next(m),o?m:{}},_e=(t,n,a,y)=>{const c=d(r.errors,t),o=k.isValid&&te(n)&&r.isValid!==n;if(e.delayError&&a?(L=be(()=>S(t,a)),L(e.delayError)):(clearTimeout(Q),L=null,a?V(r.errors,t,a):E(r.errors,t)),(a?!J(c,a):c)||!N(y)||o){const h={...y,...o&&te(n)?{isValid:n}:{},errors:r.errors,name:t};r={...r,...h},b.state.next(h)}M(!1)},U=async t=>s.resolver(f,s.context,Dt(t||x.mount,l,s.criteriaMode,s.shouldUseNativeValidation)),Z=async t=>{const{errors:n}=await U();if(t)for(const a of t){const y=d(n,a);y?V(r.errors,a,y):E(r.errors,a)}else r.errors=n;return n},$=async(t,n,a={valid:!0})=>{for(const y in t){const c=t[y];if(c){const{_f:o,...h}=c;if(o){const m=x.array.has(o.name),F=await Ge(c,f,ce,s.shouldUseNativeValidation&&!n,m);if(F[o.name]&&(a.valid=!1,n))break;!n&&(d(F,o.name)?m?Vt(r.errors,F,o.name):V(r.errors,o.name,F[o.name]):E(r.errors,o.name))}h&&await $(h,n,a)}}return a.valid},_=()=>{for(const t of x.unMount){const n=d(l,t);n&&(n._f.refs?n._f.refs.every(a=>!De(a)):!De(n._f.ref))&&xe(t)}x.unMount=new Set},v=(t,n)=>(t&&n&&V(f,t,n),!J(Te(),u)),w=(t,n,a)=>xt(t,x,{...A.mount?f:D(n)?u:q(t)?{[t]:n}:n},a,n),O=t=>oe(d(A.mount?f:u,t,e.shouldUnregister?d(u,t,[]):[])),R=(t,n,a={})=>{const y=d(l,t);let c=n;if(y){const o=y._f;o&&(!o.disabled&&V(f,t,it(n,o)),c=de(o.ref)&&C(n)?"":n,tt(o.ref)?[...o.ref.options].forEach(h=>h.selected=c.includes(h.value)):o.refs?le(o.ref)?o.refs.length>1?o.refs.forEach(h=>(!h.defaultChecked||!h.disabled)&&(h.checked=Array.isArray(c)?!!c.find(m=>m===h.value):c===h.value)):o.refs[0]&&(o.refs[0].checked=!!c):o.refs.forEach(h=>h.checked=h.value===c):Oe(o.ref)?o.ref.value="":(o.ref.value=c,o.ref.type||b.values.next({name:t,values:{...f}})))}(a.shouldDirty||a.shouldTouch)&&se(t,c,a.shouldTouch,a.shouldDirty,!0),a.shouldValidate&&ne(t)},B=(t,n,a)=>{for(const y in n){const c=n[y],o=`${t}.${y}`,h=d(l,o);(x.array.has(t)||!he(c)||h&&!h._f)&&!ee(c)?B(o,c,a):R(o,c,a)}},G=(t,n,a={})=>{const y=d(l,t),c=x.array.has(t),o=W(n);V(f,t,o),c?(b.array.next({name:t,values:{...f}}),(k.isDirty||k.dirtyFields)&&a.shouldDirty&&b.state.next({name:t,dirtyFields:ke(u,f),isDirty:v(t,o)})):y&&!y._f&&!C(o)?B(t,o,a):R(t,o,a),He(t,x)&&b.state.next({...r}),b.values.next({name:t,values:{...f}}),!A.mount&&i()},ie=async t=>{const n=t.target;let a=n.name,y=!0;const c=d(l,a),o=()=>n.type?pe(c._f):dt(t);if(c){let h,m;const F=o(),X=t.type===$e.BLUR||t.type===$e.FOCUS_OUT,lt=!kt(c._f)&&!s.resolver&&!d(r.errors,a)&&!c._f.deps||pt(X,d(r.touchedFields,a),r.isSubmitted,ve,T),Ve=He(a,x,X);V(f,a,F),X?(c._f.onBlur&&c._f.onBlur(t),L&&L(0)):c._f.onChange&&c._f.onChange(t);const me=se(a,F,X,!1),ot=!N(me)||Ve;if(!X&&b.values.next({name:a,type:t.type,values:{...f}}),lt)return k.isValid&&g(),ot&&b.state.next({name:a,...Ve?{}:me});if(!X&&Ve&&b.state.next({...r}),M(!0),s.resolver){const{errors:qe}=await U([a]),ct=Je(r.errors,l,a),Ie=Je(qe,l,ct.name||a);h=Ie.error,a=Ie.name,m=N(qe)}else h=(await Ge(c,f,ce,s.shouldUseNativeValidation))[a],y=isNaN(F)||F===d(f,a,F),y&&(h?m=!1:k.isValid&&(m=await $(l,!0)));y&&(c._f.deps&&ne(c._f.deps),_e(a,m,h,me))}},ne=async(t,n={})=>{let a,y;const c=we(t);if(M(!0),s.resolver){const o=await Z(D(t)?t:c);a=N(o),y=t?!c.some(h=>d(o,h)):a}else t?(y=(await Promise.all(c.map(async o=>{const h=d(l,o);return await $(h&&h._f?{[o]:h}:h)}))).every(Boolean),!(!y&&!r.isValid)&&g()):y=a=await $(l);return b.state.next({...!q(t)||k.isValid&&a!==r.isValid?{}:{name:t},...s.resolver||!t?{isValid:a}:{},errors:r.errors,isValidating:!1}),n.shouldFocus&&!y&&Se(l,o=>o&&d(r.errors,o),t?c:x.mount),y},Te=t=>{const n={...u,...A.mount?f:{}};return D(t)?n:q(t)?d(n,t):t.map(a=>d(n,a))},Re=(t,n)=>({invalid:!!d((n||r).errors,t),isDirty:!!d((n||r).dirtyFields,t),isTouched:!!d((n||r).touchedFields,t),error:d((n||r).errors,t)}),nt=t=>{t&&we(t).forEach(n=>E(r.errors,n)),b.state.next({errors:t?r.errors:{}})},Ne=(t,n,a)=>{const y=(d(l,t,{_f:{}})._f||{}).ref;V(r.errors,t,{...n,ref:y}),b.state.next({name:t,errors:r.errors,isValid:!1}),a&&a.shouldFocus&&y&&y.focus&&y.focus()},at=(t,n)=>K(t)?b.values.subscribe({next:a=>t(w(void 0,n),a)}):w(t,n,!0),xe=(t,n={})=>{for(const a of t?we(t):x.mount)x.mount.delete(a),x.array.delete(a),n.keepValue||(E(l,a),E(f,a)),!n.keepError&&E(r.errors,a),!n.keepDirty&&E(r.dirtyFields,a),!n.keepTouched&&E(r.touchedFields,a),!s.shouldUnregister&&!n.keepDefaultValue&&E(u,a);b.values.next({values:{...f}}),b.state.next({...r,...n.keepDirty?{isDirty:v()}:{}}),!n.keepIsValid&&g()},Ae=(t,n={})=>{let a=d(l,t);const y=te(n.disabled);return V(l,t,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:t}},name:t,mount:!0,...n}}),x.mount.add(t),D(n.value)||V(f,t,n.value),a?y&&V(f,t,n.disabled?void 0:d(f,t,pe(a._f))):re(t,!0,n.value),{...y?{disabled:n.disabled}:{},...s.progressive?{required:!!n.required,min:ue(n.min),max:ue(n.max),minLength:ue(n.minLength),maxLength:ue(n.maxLength),pattern:ue(n.pattern)}:{},name:t,onChange:ie,onBlur:ie,ref:c=>{if(c){Ae(t,n),a=d(l,t);const o=D(c.value)&&c.querySelectorAll&&c.querySelectorAll("input,select,textarea")[0]||c,h=Ft(o),m=a._f.refs||[];if(h?m.find(F=>F===o):o===a._f.ref)return;V(l,t,{_f:{...a._f,...h?{refs:[...m.filter(De),o,...Array.isArray(d(u,t))?[{}]:[]],ref:{type:o.type,name:t}}:{ref:o}}}),re(t,!1,void 0,o)}else a=d(l,t,{}),a._f&&(a._f.mount=!1),(s.shouldUnregister||n.shouldUnregister)&&!(ht(x.array,t)&&A.action)&&x.unMount.add(t)}}},Me=()=>s.shouldFocusError&&Se(l,t=>t&&d(r.errors,t),x.mount),Pe=(t,n)=>async a=>{a&&(a.preventDefault&&a.preventDefault(),a.persist&&a.persist());let y=W(f);if(b.state.next({isSubmitting:!0}),s.resolver){const{errors:c,values:o}=await U();r.errors=c,y=o}else await $(l);E(r.errors,"root"),N(r.errors)?(b.state.next({errors:{}}),await t(y,a)):(n&&await n({...r.errors},a),Me(),setTimeout(Me)),b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:N(r.errors),submitCount:r.submitCount+1,errors:r.errors})},ut=(t,n={})=>{d(l,t)&&(D(n.defaultValue)?G(t,d(u,t)):(G(t,n.defaultValue),V(u,t,n.defaultValue)),n.keepTouched||E(r.touchedFields,t),n.keepDirty||(E(r.dirtyFields,t),r.isDirty=n.defaultValue?v(t,d(u,t)):v()),n.keepError||(E(r.errors,t),k.isValid&&g()),b.state.next({...r}))},Ue=(t,n={})=>{const a=t||u,y=W(a),c=t&&!N(t)?y:u;if(n.keepDefaultValues||(u=a),!n.keepValues){if(n.keepDirtyValues||H)for(const o of x.mount)d(r.dirtyFields,o)?V(c,o,d(f,o)):G(o,d(c,o));else{if(Ee&&D(t))for(const o of x.mount){const h=d(l,o);if(h&&h._f){const m=Array.isArray(h._f.refs)?h._f.refs[0]:h._f.ref;if(de(m)){const F=m.closest("form");if(F){F.reset();break}}}}l={}}f=e.shouldUnregister?n.keepDefaultValues?W(u):{}:W(c),b.array.next({values:{...c}}),b.values.next({values:{...c}})}x={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!A.mount&&i(),A.mount=!k.isValid||!!n.keepIsValid,A.watch=!!e.shouldUnregister,b.state.next({submitCount:n.keepSubmitCount?r.submitCount:0,isDirty:n.keepDirty?r.isDirty:!!(n.keepDefaultValues&&!J(t,u)),isSubmitted:n.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:n.keepDirtyValues?r.dirtyFields:n.keepDefaultValues&&t?ke(u,t):{},touchedFields:n.keepTouched?r.touchedFields:{},errors:n.keepErrors?r.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},Be=(t,n)=>Ue(K(t)?t(f):t,n);return{control:{register:Ae,unregister:xe,getFieldState:Re,handleSubmit:Pe,setError:Ne,_executeSchema:U,_getWatch:w,_getDirty:v,_updateValid:g,_removeUnmounted:_,_updateFieldArray:I,_getFieldArray:O,_reset:Ue,_resetDefaultValues:()=>K(s.defaultValues)&&s.defaultValues().then(t=>{Be(t,s.resetOptions),b.state.next({isLoading:!1})}),_updateFormState:t=>{r={...r,...t}},_subjects:b,_proxyFormState:k,get _fields(){return l},get _formValues(){return f},get _state(){return A},set _state(t){A=t},get _defaultValues(){return u},get _names(){return x},set _names(t){x=t},get _formState(){return r},set _formState(t){r=t},get _options(){return s},set _options(t){s={...s,...t}}},trigger:ne,register:Ae,handleSubmit:Pe,watch:at,setValue:G,getValues:Te,reset:Be,resetField:ut,clearErrors:nt,unregister:xe,setError:Ne,setFocus:(t,n={})=>{const a=d(l,t),y=a&&a._f;if(y){const c=y.refs?y.refs[0]:y.ref;c.focus&&(c.focus(),n.shouldSelect&&c.select())}},getFieldState:Re}}function Zt(e={}){const i=z.useRef(),s=z.useRef(),[r,l]=z.useState({isDirty:!1,isValidating:!1,isLoading:K(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:K(e.defaultValues)?void 0:e.defaultValues});i.current||(i.current={...Ct(e,()=>l(f=>({...f}))),formState:r});const u=i.current.control;return u._options=e,_t({subject:u._subjects.state,next:f=>{bt(f,u._proxyFormState,u._updateFormState,!0)&&l({...u._formState})}}),z.useEffect(()=>{e.values&&!J(e.values,s.current)?(u._reset(e.values,u._options.resetOptions),s.current=e.values):u._resetDefaultValues()},[e.values,u]),z.useEffect(()=>{u._state.mount||(u._updateValid(),u._state.mount=!0),u._state.watch&&(u._state.watch=!1,u._subjects.state.next({...u._formState})),u._removeUnmounted()}),i.current.formState=vt(r,u),i.current}const Ot=/[a-z]/,Lt=/[A-Z]/,Tt=/[0-9]/,Rt=/[!@#$%^&*()_\-+=\][}{":;'?.`,~]/;function Nt(e){if(!Ot.test(e))return"Password must contain a lowercase letter."}function Mt(e){if(!Lt.test(e))return"Password must contain an uppercase letter."}function Pt(e){if(!Tt.test(e))return"Password must contain a number."}function Ut(e){if(!Rt.test(e))return"Password must contain a special character."}const Gt={required:"Password is required",minLength:{value:6,message:"Min length is 6"}},Jt={required:"Password is required",minLength:{value:6,message:"Min length is 6"},validate:{hasLowerCase:Nt,hasUpperCase:Mt,hasNumber:Pt,hasSpecialCharacter:Ut}},Qt={required:"Email is required",pattern:{value:/^.+@[^.].*\.[a-z]{2,}$/,message:"Please enter a valid email"}},Xt={required:"Name is required",minLength:{value:1,message:"Please enter a name"},pattern:{value:/^(?!\s*$).+/,message:"Please enter non-empty name"}},Bt="input input-bordered focus:input-primary dark:text-white",qt="input input-bordered input-error",It="label-text",$t="label-text text-error";function jt(e,i){return ae.jsxs("div",{className:"form-control",children:[ae.jsx("label",{className:"label",children:ae.jsx("span",{className:e.errorMsg?$t:It,children:e.labelText})}),ae.jsx("input",{id:e.name,type:e.type,ref:i,name:e.name,onChange:e.onChange,onBlur:e.onBlur,placeholder:e.name,className:e.errorMsg?qt:Bt,autoComplete:e.autoComplete,value:e.value,disabled:e.disabled}),ae.jsx("p",{className:"text-sm text-error pt-1 pl-2",children:e.errorMsg??""})]})}const Yt=ft.forwardRef(jt);export{Yt as A,Jt as a,Qt as e,Xt as n,Gt as s,Zt as u}; diff --git a/ReactRoastDotnet.API/wwwroot/assets/CheckoutPage-5fc6fad4.js b/ReactRoastDotnet.API/wwwroot/assets/CheckoutPage-f0e038d7.js similarity index 97% rename from ReactRoastDotnet.API/wwwroot/assets/CheckoutPage-5fc6fad4.js rename to ReactRoastDotnet.API/wwwroot/assets/CheckoutPage-f0e038d7.js index b5ccf09..4045d3e 100644 --- a/ReactRoastDotnet.API/wwwroot/assets/CheckoutPage-5fc6fad4.js +++ b/ReactRoastDotnet.API/wwwroot/assets/CheckoutPage-f0e038d7.js @@ -1 +1 @@ -import{j as e,L as b,p as P,u as o,r as C,b as q}from"./index-abbaf79c.js";import{u as G,n as O,e as H,A as h}from"./AuthInput-dc4b44dd.js";const n={reviewCart:0,submitOrder:1,receipt:2,length:3};function U(){return e.jsx("div",{className:"hero-content mt-4 text-center",children:e.jsx("div",{className:"max-w-screen-md",children:e.jsx("h1",{className:"mb-4 text-3xl md:text-5xl lg:text-5xl font-extrabold",children:e.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-primary to-secondary",children:"Checkout"})})})})}const L="step",A=L+" step-primary",D=A+" text-secondary";function N(t,s){return ti.addCartItem),r=o(i=>i.removeCartItem),a=o(i=>i.removeAllCartItemsWithId),l=t.item.price.toLocaleString("en-US",{style:"currency",currency:"USD"});return e.jsx("li",{className:"flex flex-col border-b border-accent py-2",children:e.jsxs("section",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{className:"sm:card-body",children:[e.jsxs("h2",{className:"card-title",children:[t.item.name,t.item.quantity>1&&e.jsxs("div",{className:"badge badge-secondary",children:["x",t.item.quantity]})]}),e.jsx("p",{children:e.jsx("strong",{className:"text-emerald-500",children:l})})]}),e.jsxs("menu",{className:"flex flex-col sm:flex-row gap-2 sm:px-2",children:[e.jsx("li",{className:f,"data-tip":"Remove All",children:e.jsx("button",{className:j,onClick:()=>a(t.item.id),"aria-label":"Remove All",children:e.jsx(z,{})})}),e.jsx("li",{className:f,"data-tip":"Add",children:e.jsx("button",{className:j,onClick:()=>s(t.item,1),"aria-label":"Add",children:e.jsx(J,{})})}),e.jsx("li",{className:f,"data-tip":"Subtract",children:e.jsx("button",{className:j,onClick:()=>r(t.item.id,1),"aria-label":"Subtract",children:e.jsx(K,{})})})]})]})})}function X(t){return e.jsx("ul",{children:t.cartItems.map(s=>e.jsx(Q,{item:s},s.id))})}function Z(t){let s=0;const r=`$${t.cartItems.reduce((a,l)=>(s+=l.quantity,l.price*l.quantity+a),0).toFixed(2)}`;return e.jsxs("div",{className:"flex flex-col gap-2 text-md sm:text-lg font-bold",children:[e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsx("h3",{className:"",children:"Total Items:"}),e.jsx("p",{className:"text-secondary",children:s})]}),e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsx("h3",{className:"",children:"Total Price:"}),e.jsx("p",{className:"text-emerald-500",children:r})]})]})}function _(t){return t.cartIsEmpty?e.jsx(V,{}):e.jsxs("div",{className:"flex flex-col w-full items-stretch",children:[e.jsxs("section",{className:"px-2 mx-2",children:[e.jsx("h2",{className:"text-center text-xl mt-6 font-bold",children:"Cart"}),e.jsx(X,{cartItems:t.cartItems})]}),e.jsxs("section",{className:"px-2 mx-2 self-start",children:[e.jsx("h2",{className:"card-title text-xl my-4",children:"Cart Summary"}),e.jsx(Z,{cartItems:t.cartItems})]})]})}function T(t){return e.jsxs("menu",{className:"modal-action flex flex-col sm:flex-row items-stretch gap-2 mx-4",children:[t.stepNum===n.reviewCart&&e.jsx("li",{className:"flex flex-col",children:e.jsx("button",{id:"clearCart",className:"btn btn-sm btn-error",type:"button",onClick:t.onClearCart,children:"Clear Cart"})}),e.jsx("li",{className:"flex flex-col",children:e.jsx("button",{id:"backButton",className:"btn btn-sm btn-primary",type:"button",onClick:t.onBack,disabled:t.stepNum===n.reviewCart,children:"Back"},"backButton")}),e.jsx("li",{className:"flex flex-col",children:e.jsxs("button",{id:"nextButton",className:"btn btn-sm btn-success",type:t.stepNum===n.submitOrder?"submit":"button",onClick:t.onNext,disabled:t.stepNum===n.receipt||t.disableOnNext,children:[t.stepNum===n.submitOrder?"Submit":"Next",t.isSubmitting&&e.jsx("span",{className:"loading loading-spinner"})]},"nextButton")})]})}function ee(t){const s=o(l=>l.items),r=o(l=>l.clearCart),a=s.length<1;return e.jsxs(e.Fragment,{children:[e.jsx(_,{cartItems:s,cartIsEmpty:a}),e.jsx(T,{stepNum:n.reviewCart,onClearCart:r,onNext:t.onNext,onBack:t.onPrev,disableOnNext:a})]})}function te(t){var v,g,k,y,w,p,I,S,B;const[s,r]=C.useState(!0),{register:a,handleSubmit:l,formState:{isSubmitting:i,errors:c}}=G({defaultValues:{firstName:(v=t.user)==null?void 0:v.firstName,lastName:(g=t.user)==null?void 0:g.lastName,email:(k=t.user)==null?void 0:k.email}}),M=o(u=>u.clearCart),E=()=>r(!s),F=async u=>{await new Promise(W=>setTimeout(W,3e3)),console.log(u),M(),t.onNext()},m=a("firstName",O),x=a("lastName",O),d=a("email",H),R=t.user===void 0;return e.jsxs("section",{children:[e.jsxs("h2",{className:"text-center text-xl mt-4 font-bold",children:[R&&"Enter ","Order Details"]}),e.jsxs("form",{className:"card-body",onSubmit:l(F),children:[e.jsx(h,{ref:m.ref,type:"text",name:m.name,onChange:m.onChange,onBlur:m.onBlur,labelText:"First Name",errorMsg:(y=c==null?void 0:c.firstName)==null?void 0:y.message,autoComplete:"given-name",value:(w=t.user)==null?void 0:w.firstName,disabled:!!t.user}),e.jsx(h,{ref:x.ref,type:"text",name:x.name,onChange:x.onChange,onBlur:x.onBlur,labelText:"Last Name",errorMsg:(p=c==null?void 0:c.lastName)==null?void 0:p.message,autoComplete:"family-name",value:(I=t.user)==null?void 0:I.lastName,disabled:!!t.user}),e.jsx(h,{ref:d.ref,type:"email",name:d.name,onChange:d.onChange,onBlur:d.onBlur,labelText:"Email",errorMsg:(S=c==null?void 0:c.email)==null?void 0:S.message,autoComplete:"email",value:(B=t.user)==null?void 0:B.email,disabled:!!t.user}),e.jsxs("label",{className:"label cursor-pointer",children:[e.jsx("span",{className:"label-text",children:"I understand this is a demo application; therefore, no actual order will be placed."}),e.jsx("input",{type:"checkbox",className:"checkbox checkbox-primary",onClick:E})]}),e.jsx("div",{className:"form-control mt-6",children:e.jsx(T,{stepNum:n.submitOrder,isSubmitting:i,onBack:t.onPrev,disableOnNext:s})})]})]})}function se(t){const[s,r]=C.useState(!1),a=q(l=>l.user);return s||a?e.jsx(te,{onNext:t.onNext,onPrev:t.onPrev,user:a}):e.jsx("section",{className:"hero-content mt-8 text-center",children:e.jsxs("div",{className:"max-w-md text-gray-900 dark:text-white",children:[e.jsx("h2",{className:"mb-4 text-xl font-extrabold md:text-2xl lg:text-3xl",children:"Continue as guest?"}),e.jsxs("div",{className:"flex flex-col justify-center items-center gap-4",children:[e.jsx("button",{className:"btn btn-primary",onClick:()=>r(!0),children:"Yes"}),e.jsx(b,{to:P.signIn,className:"link-secondary",children:"No? Sign In"})]})]})})}function ae(t){return t.stepNum===n.submitOrder?e.jsx(se,{onPrev:t.onPrev,onNext:t.onNext}):t.stepNum===n.receipt?e.jsx($,{}):e.jsx(ee,{onNext:t.onNext,onPrev:t.onPrev})}function re(){const[t,s]=C.useState(n.reviewCart),r=()=>{t{t>n.reviewCart&&s(t-1)};return e.jsxs("main",{className:"mx-auto max-w-screen-lg pb-2 md:pb-10 mb-24 md:mb-0",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(U,{}),e.jsx(Y,{stepNum:t})]}),e.jsx("div",{className:"max-w-screen-md mx-auto",children:e.jsx(ae,{stepNum:t,onPrev:a,onNext:r})})]})}export{re as default}; +import{j as e,L as b,p as P,u as o,r as C,b as q}from"./index-e97df17e.js";import{u as G,n as O,e as H,A as h}from"./AuthInput-179d8048.js";const n={reviewCart:0,submitOrder:1,receipt:2,length:3};function U(){return e.jsx("div",{className:"hero-content mt-4 text-center",children:e.jsx("div",{className:"max-w-screen-md",children:e.jsx("h1",{className:"mb-4 text-3xl md:text-5xl lg:text-5xl font-extrabold",children:e.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-primary to-secondary",children:"Checkout"})})})})}const L="step",A=L+" step-primary",D=A+" text-secondary";function N(t,s){return ti.addCartItem),r=o(i=>i.removeCartItem),a=o(i=>i.removeAllCartItemsWithId),l=t.item.price.toLocaleString("en-US",{style:"currency",currency:"USD"});return e.jsx("li",{className:"flex flex-col border-b border-accent py-2",children:e.jsxs("section",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{className:"sm:card-body",children:[e.jsxs("h2",{className:"card-title",children:[t.item.name,t.item.quantity>1&&e.jsxs("div",{className:"badge badge-secondary",children:["x",t.item.quantity]})]}),e.jsx("p",{children:e.jsx("strong",{className:"text-emerald-500",children:l})})]}),e.jsxs("menu",{className:"flex flex-col sm:flex-row gap-2 sm:px-2",children:[e.jsx("li",{className:f,"data-tip":"Remove All",children:e.jsx("button",{className:j,onClick:()=>a(t.item.id),"aria-label":"Remove All",children:e.jsx(z,{})})}),e.jsx("li",{className:f,"data-tip":"Add",children:e.jsx("button",{className:j,onClick:()=>s(t.item,1),"aria-label":"Add",children:e.jsx(J,{})})}),e.jsx("li",{className:f,"data-tip":"Subtract",children:e.jsx("button",{className:j,onClick:()=>r(t.item.id,1),"aria-label":"Subtract",children:e.jsx(K,{})})})]})]})})}function X(t){return e.jsx("ul",{children:t.cartItems.map(s=>e.jsx(Q,{item:s},s.id))})}function Z(t){let s=0;const r=`$${t.cartItems.reduce((a,l)=>(s+=l.quantity,l.price*l.quantity+a),0).toFixed(2)}`;return e.jsxs("div",{className:"flex flex-col gap-2 text-md sm:text-lg font-bold",children:[e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsx("h3",{className:"",children:"Total Items:"}),e.jsx("p",{className:"text-secondary",children:s})]}),e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsx("h3",{className:"",children:"Total Price:"}),e.jsx("p",{className:"text-emerald-500",children:r})]})]})}function _(t){return t.cartIsEmpty?e.jsx(V,{}):e.jsxs("div",{className:"flex flex-col w-full items-stretch",children:[e.jsxs("section",{className:"px-2 mx-2",children:[e.jsx("h2",{className:"text-center text-xl mt-6 font-bold",children:"Cart"}),e.jsx(X,{cartItems:t.cartItems})]}),e.jsxs("section",{className:"px-2 mx-2 self-start",children:[e.jsx("h2",{className:"card-title text-xl my-4",children:"Cart Summary"}),e.jsx(Z,{cartItems:t.cartItems})]})]})}function T(t){return e.jsxs("menu",{className:"modal-action flex flex-col sm:flex-row items-stretch gap-2 mx-4",children:[t.stepNum===n.reviewCart&&e.jsx("li",{className:"flex flex-col",children:e.jsx("button",{id:"clearCart",className:"btn btn-sm btn-error",type:"button",onClick:t.onClearCart,children:"Clear Cart"})}),e.jsx("li",{className:"flex flex-col",children:e.jsx("button",{id:"backButton",className:"btn btn-sm btn-primary",type:"button",onClick:t.onBack,disabled:t.stepNum===n.reviewCart,children:"Back"},"backButton")}),e.jsx("li",{className:"flex flex-col",children:e.jsxs("button",{id:"nextButton",className:"btn btn-sm btn-success",type:t.stepNum===n.submitOrder?"submit":"button",onClick:t.onNext,disabled:t.stepNum===n.receipt||t.disableOnNext,children:[t.stepNum===n.submitOrder?"Submit":"Next",t.isSubmitting&&e.jsx("span",{className:"loading loading-spinner"})]},"nextButton")})]})}function ee(t){const s=o(l=>l.items),r=o(l=>l.clearCart),a=s.length<1;return e.jsxs(e.Fragment,{children:[e.jsx(_,{cartItems:s,cartIsEmpty:a}),e.jsx(T,{stepNum:n.reviewCart,onClearCart:r,onNext:t.onNext,onBack:t.onPrev,disableOnNext:a})]})}function te(t){var v,g,k,y,w,p,I,S,B;const[s,r]=C.useState(!0),{register:a,handleSubmit:l,formState:{isSubmitting:i,errors:c}}=G({defaultValues:{firstName:(v=t.user)==null?void 0:v.firstName,lastName:(g=t.user)==null?void 0:g.lastName,email:(k=t.user)==null?void 0:k.email}}),M=o(u=>u.clearCart),E=()=>r(!s),F=async u=>{await new Promise(W=>setTimeout(W,3e3)),console.log(u),M(),t.onNext()},m=a("firstName",O),x=a("lastName",O),d=a("email",H),R=t.user===void 0;return e.jsxs("section",{children:[e.jsxs("h2",{className:"text-center text-xl mt-4 font-bold",children:[R&&"Enter ","Order Details"]}),e.jsxs("form",{className:"card-body",onSubmit:l(F),children:[e.jsx(h,{ref:m.ref,type:"text",name:m.name,onChange:m.onChange,onBlur:m.onBlur,labelText:"First Name",errorMsg:(y=c==null?void 0:c.firstName)==null?void 0:y.message,autoComplete:"given-name",value:(w=t.user)==null?void 0:w.firstName,disabled:!!t.user}),e.jsx(h,{ref:x.ref,type:"text",name:x.name,onChange:x.onChange,onBlur:x.onBlur,labelText:"Last Name",errorMsg:(p=c==null?void 0:c.lastName)==null?void 0:p.message,autoComplete:"family-name",value:(I=t.user)==null?void 0:I.lastName,disabled:!!t.user}),e.jsx(h,{ref:d.ref,type:"email",name:d.name,onChange:d.onChange,onBlur:d.onBlur,labelText:"Email",errorMsg:(S=c==null?void 0:c.email)==null?void 0:S.message,autoComplete:"email",value:(B=t.user)==null?void 0:B.email,disabled:!!t.user}),e.jsxs("label",{className:"label cursor-pointer",children:[e.jsx("span",{className:"label-text",children:"I understand this is a demo application; therefore, no actual order will be placed."}),e.jsx("input",{type:"checkbox",className:"checkbox checkbox-primary",onClick:E})]}),e.jsx("div",{className:"form-control mt-6",children:e.jsx(T,{stepNum:n.submitOrder,isSubmitting:i,onBack:t.onPrev,disableOnNext:s})})]})]})}function se(t){const[s,r]=C.useState(!1),a=q(l=>l.user);return s||a?e.jsx(te,{onNext:t.onNext,onPrev:t.onPrev,user:a}):e.jsx("section",{className:"hero-content mt-8 text-center",children:e.jsxs("div",{className:"max-w-md text-gray-900 dark:text-white",children:[e.jsx("h2",{className:"mb-4 text-xl font-extrabold md:text-2xl lg:text-3xl",children:"Continue as guest?"}),e.jsxs("div",{className:"flex flex-col justify-center items-center gap-4",children:[e.jsx("button",{className:"btn btn-primary",onClick:()=>r(!0),children:"Yes"}),e.jsx(b,{to:P.signIn,className:"link-secondary",children:"No? Sign In"})]})]})})}function ae(t){return t.stepNum===n.submitOrder?e.jsx(se,{onPrev:t.onPrev,onNext:t.onNext}):t.stepNum===n.receipt?e.jsx($,{}):e.jsx(ee,{onNext:t.onNext,onPrev:t.onPrev})}function re(){const[t,s]=C.useState(n.reviewCart),r=()=>{t{t>n.reviewCart&&s(t-1)};return e.jsxs("main",{className:"mx-auto max-w-screen-lg pb-2 md:pb-10 mb-24 md:mb-0",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx(U,{}),e.jsx(Y,{stepNum:t})]}),e.jsx("div",{className:"max-w-screen-md mx-auto",children:e.jsx(ae,{stepNum:t,onPrev:a,onNext:r})})]})}export{re as default}; diff --git a/ReactRoastDotnet.API/wwwroot/assets/MenuPage-5f9486b5.js b/ReactRoastDotnet.API/wwwroot/assets/MenuPage-343d66e6.js similarity index 99% rename from ReactRoastDotnet.API/wwwroot/assets/MenuPage-5f9486b5.js rename to ReactRoastDotnet.API/wwwroot/assets/MenuPage-343d66e6.js index d20f08e..9540df7 100644 --- a/ReactRoastDotnet.API/wwwroot/assets/MenuPage-5f9486b5.js +++ b/ReactRoastDotnet.API/wwwroot/assets/MenuPage-343d66e6.js @@ -1 +1 @@ -import{j as r,u as Ze,R as ve,r as x,s as Qe,a as Xe}from"./index-abbaf79c.js";const y={pageNum:"pageNumber",pageSize:"pageSize",pageSort:"sort",drinkName:"drinkName"},et="1",tt="6";function nt(e){const t=new URLSearchParams,n=e.get(y.pageNum)??"",a=e.get(y.pageSize)??"",s=e.get(y.pageSort),o=e.get(y.drinkName);return parseInt(n)>0?t.append(y.pageNum,n):t.append(y.pageNum,et),parseInt(a)>0?t.append(y.pageSize,a):t.append(y.pageSize,tt),s&&t.append(y.pageSort,s),o&&t.append(y.drinkName,o),t}function st(){return r.jsx("div",{className:"hero-content mt-8 text-center",children:r.jsxs("div",{className:"max-w-md text-gray-900 dark:text-white",children:[r.jsxs("h1",{className:"mb-4 text-3xl font-extrabold md:text-5xl lg:text-5xl",children:["Order drinks",r.jsxs("em",{className:"text-transparent bg-clip-text bg-gradient-to-r from-primary to-secondary",children:[" ","to-go!"]})," "]}),r.jsx("p",{className:"py-4 text-xl",children:"Our espresso drinks are made by our awesome baristas using high quality coffee beans."})]})})}function rt(){return r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:[r.jsx("title",{children:"Error"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})]})}function at(){return r.jsxs("section",{className:"alert alert-error max-w-screen-sm mx-auto",children:[r.jsx(rt,{}),r.jsx("h2",{className:"text-error-content",children:"Error! Failed to fetch products."})]})}function ot(e){return{id:e.id,type:e.type,name:e.name,price:e.price,quantity:1}}function it(e){const t=Ze(a=>a.addCartItem),n=e.productItem.price.toLocaleString("en-US",{style:"currency",currency:"USD"});return r.jsxs("div",{className:"card sm:card-side bg-base-100 shadow-xl pt-2",children:[r.jsx("cite",{className:"w-48 flex-none self-center tooltip tooltip-bottom tooltip-accent","data-tip":"Image by "+e.productItem.imageCreator+" at Unsplash",children:r.jsx("figure",{className:"justify-center self-center",children:r.jsx("img",{src:e.productItem.image,alt:e.productItem.name})})}),r.jsxs("section",{className:"card-body",children:[r.jsx("h2",{className:"card-title self-center md:self-start",children:e.productItem.name}),r.jsx("p",{className:"text-emerald-600 text-lg self-center md:self-start",children:r.jsx("strong",{children:n})}),r.jsx("p",{children:e.productItem.description}),r.jsx("div",{className:"card-actions justify-center md:justify-end",children:r.jsx("button",{className:"btn btn-primary btn-block sm:btn-wide",onClick:()=>t(ot(e.productItem),1),children:"+Add"})})]})]})}const k=()=>{},C=k(),me=Object,c=e=>e===C,U=e=>typeof e=="function",z=(e,t)=>({...e,...t}),ct=e=>U(e.then),ie=new WeakMap;let lt=0;const te=e=>{const t=typeof e,n=e&&e.constructor,a=n==Date;let s,o;if(me(e)===e&&!a&&n!=RegExp){if(s=ie.get(e),s)return s;if(s=++lt+"~",ie.set(e,s),n==Array){for(s="@",o=0;ole&&typeof window.requestAnimationFrame!=be,Me=(e,t)=>{const n=F.get(e);return[()=>!c(t)&&e.get(t)||ge,a=>{if(!c(t)){const s=e.get(t);t in ce||(ce[t]=s),n[5](t,z(s,a),s||ge)}},n[6],()=>!c(t)&&t in ce?ce[t]:!c(t)&&e.get(t)||ge]};let Re=!0;const dt=()=>Re,[Se,Ne]=le&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[k,k],ft=()=>{const e=pe&&document.visibilityState;return c(e)||e!=="hidden"},mt=e=>(pe&&document.addEventListener("visibilitychange",e),Se("focus",e),()=>{pe&&document.removeEventListener("visibilitychange",e),Ne("focus",e)}),gt=e=>{const t=()=>{Re=!0,e()},n=()=>{Re=!1};return Se("online",t),Se("offline",n),()=>{Ne("online",t),Ne("offline",n)}},ht={isOnline:dt,isVisible:ft},xt={initFocus:mt,initReconnect:gt},Le=!ve.useId,ne=!le||"Deno"in window,Et=e=>ut()?window.requestAnimationFrame(e):setTimeout(e,1),he=ne?x.useEffect:x.useLayoutEffect,xe=typeof navigator<"u"&&navigator.connection,Ve=!ne&&xe&&(["slow-2g","2g"].includes(xe.effectiveType)||xe.saveData),Te=e=>{if(U(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?te(e):"",[e,t]};let pt=0;const we=()=>++pt,ke=0,ze=1,We=2,Rt=3;var ee={__proto__:null,ERROR_REVALIDATE_EVENT:Rt,FOCUS_EVENT:ke,MUTATE_EVENT:We,RECONNECT_EVENT:ze};async function qe(...e){const[t,n,a,s]=e,o=z({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let l=o.populateCache;const m=o.rollbackOnError;let h=o.optimisticData;const j=o.revalidate!==!1,R=b=>typeof m=="function"?m(b):m!==!1,S=o.throwOnError;if(U(n)){const b=n,w=[],T=t.keys();for(const D of T)!/^\$(inf|sub)\$/.test(D)&&b(t.get(D)._k)&&w.push(D);return Promise.all(w.map(P))}return P(n);async function P(b){const[w]=Te(b);if(!w)return;const[T,D]=Me(t,w),[i,q,Q,W]=F.get(t),M=i[w],H=()=>j&&(delete Q[w],delete W[w],M&&M[0])?M[0](We).then(()=>T().data):T().data;if(e.length<3)return H();let E=a,u;const B=we();q[w]=[B,0];const A=!c(h),G=T(),se=G.data,re=G._c,O=c(re)?se:re;if(A&&(h=U(h)?h(O,se):h,D({data:h,_c:O})),U(E))try{E=E(O)}catch($){u=$}if(E&&ct(E))if(E=await E.catch($=>{u=$}),B!==q[w][0]){if(u)throw u;return E}else u&&A&&R(u)&&(l=!0,E=O,D({data:E,_c:C}));l&&(u||(U(l)&&(E=l(E,O)),D({data:E,error:C,_c:C}))),q[w][1]=we();const ue=await H();if(D({_c:C}),u){if(S)throw u;return}return l?ue:E}}const Fe=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},St=(e,t)=>{if(!F.has(e)){const n=z(xt,t),a={},s=qe.bind(C,e);let o=k;const l={},m=(R,S)=>{const P=l[R]||[];return l[R]=P,P.push(S),()=>P.splice(P.indexOf(S),1)},h=(R,S,P)=>{e.set(R,S);const b=l[R];if(b)for(const w of b)w(S,P)},j=()=>{if(!F.has(e)&&(F.set(e,[a,{},{},{},s,h,m]),!ne)){const R=n.initFocus(setTimeout.bind(C,Fe.bind(C,a,ke))),S=n.initReconnect(setTimeout.bind(C,Fe.bind(C,a,ze)));o=()=>{R&&R(),S&&S(),F.delete(e)}}};return j(),[e,s,j,o]}return[e,F.get(e)[4]]},Nt=(e,t,n,a,s)=>{const o=n.errorRetryCount,l=s.retryCount,m=~~((Math.random()+.5)*(1<<(l<8?l:8)))*n.errorRetryInterval;!c(o)&&l>o||setTimeout(a,m,s)},wt=(e,t)=>te(e)==te(t),[He,vt]=St(new Map),bt=z({onLoadingSlow:k,onSuccess:k,onError:k,onErrorRetry:Nt,onDiscarded:k,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ve?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ve?5e3:3e3,compare:wt,isPaused:()=>!1,cache:He,mutate:vt,fallback:{}},ht),Tt=(e,t)=>{const n=z(e,t);if(t){const{use:a,fallback:s}=e,{use:o,fallback:l}=t;a&&o&&(n.use=a.concat(o)),s&&l&&(n.fallback=z(s,l))}return n},_t=x.createContext({}),Be=le&&window.__SWR_DEVTOOLS_USE__,Ct=Be?window.__SWR_DEVTOOLS_USE__:[],jt=()=>{Be&&(window.__SWR_DEVTOOLS_REACT__=ve)},Pt=e=>U(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],Ot=()=>z(bt,x.useContext(_t)),yt=e=>(t,n,a)=>e(t,n&&((...o)=>{const[l]=Te(t),[,,,m]=F.get(He),h=m[l];return c(h)?n(...o):(delete m[l],h)}),a),Dt=Ct.concat(yt),At=e=>function(...n){const a=Ot(),[s,o,l]=Pt(n),m=Tt(a,l);let h=e;const{use:j}=m,R=(j||[]).concat(Dt);for(let S=R.length;S--;)h=R[S](h);return h(s,o||m.fetcher||null,m)},It=(e,t,n)=>{const a=t[e]||(t[e]=[]);return a.push(n),()=>{const s=a.indexOf(n);s>=0&&(a[s]=a[a.length-1],a.pop())}};jt();const Ue=ve.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)}),Ee={dedupe:!0},Lt=(e,t,n)=>{const{cache:a,compare:s,suspense:o,fallbackData:l,revalidateOnMount:m,revalidateIfStale:h,refreshInterval:j,refreshWhenHidden:R,refreshWhenOffline:S,keepPreviousData:P}=n,[b,w,T,D]=F.get(a),[i,q]=Te(e),Q=x.useRef(!1),W=x.useRef(!1),M=x.useRef(i),H=x.useRef(t),E=x.useRef(n),u=()=>E.current,B=()=>u().isVisible()&&u().isOnline(),[A,G,se,re]=Me(a,i),O=x.useRef({}).current,ue=c(l)?n.fallback[i]:l,$=(d,f)=>{for(const N in O){const g=N;if(g==="data"){if(!s(d[g],f[g])&&(!c(d[g])||!s(oe,f[g])))return!1}else if(f[g]!==d[g])return!1}return!0},_e=x.useMemo(()=>{const d=(()=>!i||!t?!1:c(m)?u().isPaused()||o?!1:c(h)?!0:h:m)(),f=v=>{const L=z(v);return delete L._k,d?{isValidating:!0,isLoading:!0,...L}:L},N=A(),g=re(),I=f(N),Z=N===g?I:f(g);let p=I;return[()=>{const v=f(A());return $(v,p)?(p.data=v.data,p.isLoading=v.isLoading,p.isValidating=v.isValidating,p.error=v.error,p):(p=v,v)},()=>Z]},[a,i]),J=Qe.useSyncExternalStore(x.useCallback(d=>se(i,(f,N)=>{$(N,f)||d()}),[a,i]),_e[0],_e[1]),Ce=!Q.current,$e=b[i]&&b[i].length>0,K=J.data,Y=c(K)?ue:K,ae=J.error,je=x.useRef(Y),oe=P?c(K)?je.current:K:Y,Pe=(()=>$e&&!c(ae)?!1:Ce&&!c(m)?m:u().isPaused()?!1:o?c(Y)?!1:h:c(Y)||h)(),Oe=!!(i&&t&&Ce&&Pe),Je=c(J.isValidating)?Oe:J.isValidating,Ke=c(J.isLoading)?Oe:J.isLoading,X=x.useCallback(async d=>{const f=H.current;if(!i||!f||W.current||u().isPaused())return!1;let N,g,I=!0;const Z=d||{},p=!T[i]||!Z.dedupe,v=()=>Le?!W.current&&i===M.current&&Q.current:i===M.current,L={isValidating:!1,isLoading:!1},De=()=>{G(L)},Ae=()=>{const _=T[i];_&&_[1]===g&&delete T[i]},Ie={isValidating:!0};c(A().data)&&(Ie.isLoading=!0);try{if(p&&(G(Ie),n.loadingTimeout&&c(A().data)&&setTimeout(()=>{I&&v()&&u().onLoadingSlow(i,n)},n.loadingTimeout),T[i]=[f(q),we()]),[N,g]=T[i],N=await N,p&&setTimeout(Ae,n.dedupingInterval),!T[i]||T[i][1]!==g)return p&&v()&&u().onDiscarded(i),!1;L.error=C;const _=w[i];if(!c(_)&&(g<=_[0]||g<=_[1]||_[1]===0))return De(),p&&v()&&u().onDiscarded(i),!1;const V=A().data;L.data=s(V,N)?V:N,p&&v()&&u().onSuccess(N,i,n)}catch(_){Ae();const V=u(),{shouldRetryOnError:de}=V;V.isPaused()||(L.error=_,p&&v()&&(V.onError(_,i,V),(de===!0||U(de)&&de(_))&&B()&&V.onErrorRetry(_,i,V,Ye=>{const fe=b[i];fe&&fe[0]&&fe[0](ee.ERROR_REVALIDATE_EVENT,Ye)},{retryCount:(Z.retryCount||0)+1,dedupe:!0})))}return I=!1,De(),!0},[i,a]),ye=x.useCallback((...d)=>qe(a,M.current,...d),[]);if(he(()=>{H.current=t,E.current=n,c(K)||(je.current=K)}),he(()=>{if(!i)return;const d=X.bind(C,Ee);let f=0;const g=It(i,b,(I,Z={})=>{if(I==ee.FOCUS_EVENT){const p=Date.now();u().revalidateOnFocus&&p>f&&B()&&(f=p+u().focusThrottleInterval,d())}else if(I==ee.RECONNECT_EVENT)u().revalidateOnReconnect&&B()&&d();else{if(I==ee.MUTATE_EVENT)return X();if(I==ee.ERROR_REVALIDATE_EVENT)return X(Z)}});return W.current=!1,M.current=i,Q.current=!0,G({_k:q}),Pe&&(c(Y)||ne?d():Et(d)),()=>{W.current=!0,g()}},[i]),he(()=>{let d;function f(){const g=U(j)?j(A().data):j;g&&d!==-1&&(d=setTimeout(N,g))}function N(){!A().error&&(R||u().isVisible())&&(S||u().isOnline())?X(Ee).then(f):f()}return f(),()=>{d&&(clearTimeout(d),d=-1)}},[j,R,S,i]),x.useDebugValue(oe),o&&c(Y)&&i){if(!Le&&ne)throw new Error("Fallback data is required when using suspense in SSR.");H.current=t,E.current=n,W.current=!1;const d=D[i];if(!c(d)){const f=ye(d);Ue(f)}if(c(ae)){const f=X(Ee);c(oe)||(f.status="fulfilled",f.value=!0),Ue(f)}else throw ae}return{mutate:ye,get data(){return O.data=!0,oe},get error(){return O.error=!0,ae},get isValidating(){return O.isValidating=!0,Je},get isLoading(){return O.isLoading=!0,Ke}}},Vt=At(Lt),Ft="/api/",Ut=Ft+"products?",Mt=6,kt=async e=>{const t=await fetch(Ut+e,{method:"GET"});if(!t.ok){const n=await t.json();throw new Error((n==null?void 0:n.message)||t.statusText)}return await t.json()},zt={revalidateOnFocus:!1,revalidateIfStale:!1,revalidateOnReconnect:!1};function Wt(e){const t=x.useRef(1),n=x.useRef(1),a=x.useRef(Mt),{data:s,error:o,isLoading:l}=Vt(e,kt,zt);return s!=null&&s.pagination&&(n.current!==s.pagination.totalPages&&(n.current=s.pagination.totalPages),t.current!==s.pagination.currentPage&&(t.current=s.pagination.currentPage),a.current!==s.pagination.pageSize&&(a.current=s.pagination.pageSize)),{products:s==null?void 0:s.items,error:o,isLoading:l,currentPage:t.current,totalPages:n.current,pageSize:a.current}}function qt(e){return r.jsxs("section",{className:"flex flex-col items-center pb-2 px-2",children:[r.jsx("div",{children:r.jsx("h3",{className:"stat-title font-bold",children:"Page Stats"})}),r.jsx("div",{children:r.jsxs("div",{className:"stats shadow",children:[r.jsxs("section",{className:"stat place-items-center px-4 sm:px-6",children:[r.jsx("h4",{className:"stat-desc",children:"Page Size"}),r.jsx("p",{className:"stat-value",children:e.pageSize})]}),r.jsxs("section",{className:"stat place-items-center px-4 sm:px-6",children:[r.jsx("h4",{className:"stat-desc",children:"Current Page"}),r.jsx("p",{className:"stat-value text-secondary",children:e.currentPage})]}),r.jsxs("section",{className:"stat place-items-center px-4 sm:px-6",children:[r.jsx("h4",{className:"stat-desc",children:"Total Pages"}),r.jsx("p",{className:"stat-value",children:e.totalPages})]})]})})]})}const Ge="join-item btn btn-outline ",Ht=Ge+"btn-secondary",Bt=Ge+"btn-primary";function Gt(e){return r.jsxs("menu",{className:"join grid grid-cols-2 ml-auto mr-auto max-w-screen-md px-1 sm:px-0",children:[r.jsx("button",{className:Ht,onClick:e.onPrevious,disabled:!e.hasPrevious,children:"Previous page"}),r.jsx("button",{className:Bt,onClick:e.onNext,disabled:!e.hasNext,children:"Next Page"})]})}function $t(e){const t=e.currentPage!==e.totalPages,n=e.currentPage>1,a=()=>{t&&e.onPageChange(e.currentPage+1)},s=()=>{n&&e.onPageChange(e.currentPage-1)};return r.jsxs("div",{className:"max-w-screen-lg flex-col justify-center items-center ml-auto mr-auto",children:[r.jsx(qt,{pageSize:e.pageSize,currentPage:e.currentPage,totalPages:e.totalPages}),r.jsx(Gt,{onPrevious:s,onNext:a,hasPrevious:n,hasNext:t})]})}function Jt(e){const{products:t,error:n,isLoading:a,pageSize:s,totalPages:o,currentPage:l}=Wt(e.pageSearchParams);return a?r.jsx("div",{className:"flex",children:r.jsx("progress",{className:"progress w-56 mx-auto progress-secondary"})}):n||t===void 0?r.jsx(at,{}):r.jsxs(r.Fragment,{children:[r.jsx("ul",{className:"flex flex-col w-full border-opacity-50 px-2",children:t.map(m=>r.jsxs("li",{children:[r.jsx(it,{productItem:m}),r.jsx("div",{className:"divider"})]},m.id))}),r.jsx($t,{pageSize:s,totalPages:o,currentPage:l,onPageChange:e.onPageChange})]})}const Kt={top:0,left:0,behavior:"smooth"};function Zt(){const[e,t]=Xe();x.useEffect(()=>{window.scrollTo(Kt)},[e]);const n=nt(e),a=s=>{s>0&&(n.set(y.pageNum,s.toString()),t(n))};return r.jsxs("main",{className:"container mx-auto max-w-screen-lg pb-8 mb-20 md:mb-0",children:[r.jsx("div",{className:"flex z-0 flex-col justify-center items-center",children:r.jsx(st,{})}),r.jsx(Jt,{pageSearchParams:n.toString(),onPageChange:a})]})}export{Zt as default}; +import{j as r,u as Ze,R as ve,r as x,s as Qe,a as Xe}from"./index-e97df17e.js";const y={pageNum:"pageNumber",pageSize:"pageSize",pageSort:"sort",drinkName:"drinkName"},et="1",tt="6";function nt(e){const t=new URLSearchParams,n=e.get(y.pageNum)??"",a=e.get(y.pageSize)??"",s=e.get(y.pageSort),o=e.get(y.drinkName);return parseInt(n)>0?t.append(y.pageNum,n):t.append(y.pageNum,et),parseInt(a)>0?t.append(y.pageSize,a):t.append(y.pageSize,tt),s&&t.append(y.pageSort,s),o&&t.append(y.drinkName,o),t}function st(){return r.jsx("div",{className:"hero-content mt-8 text-center",children:r.jsxs("div",{className:"max-w-md text-gray-900 dark:text-white",children:[r.jsxs("h1",{className:"mb-4 text-3xl font-extrabold md:text-5xl lg:text-5xl",children:["Order drinks",r.jsxs("em",{className:"text-transparent bg-clip-text bg-gradient-to-r from-primary to-secondary",children:[" ","to-go!"]})," "]}),r.jsx("p",{className:"py-4 text-xl",children:"Our espresso drinks are made by our awesome baristas using high quality coffee beans."})]})})}function rt(){return r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:[r.jsx("title",{children:"Error"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})]})}function at(){return r.jsxs("section",{className:"alert alert-error max-w-screen-sm mx-auto",children:[r.jsx(rt,{}),r.jsx("h2",{className:"text-error-content",children:"Error! Failed to fetch products."})]})}function ot(e){return{id:e.id,type:e.type,name:e.name,price:e.price,quantity:1}}function it(e){const t=Ze(a=>a.addCartItem),n=e.productItem.price.toLocaleString("en-US",{style:"currency",currency:"USD"});return r.jsxs("div",{className:"card sm:card-side bg-base-100 shadow-xl pt-2",children:[r.jsx("cite",{className:"w-48 flex-none self-center tooltip tooltip-bottom tooltip-accent","data-tip":"Image by "+e.productItem.imageCreator+" at Unsplash",children:r.jsx("figure",{className:"justify-center self-center",children:r.jsx("img",{src:e.productItem.image,alt:e.productItem.name})})}),r.jsxs("section",{className:"card-body",children:[r.jsx("h2",{className:"card-title self-center md:self-start",children:e.productItem.name}),r.jsx("p",{className:"text-emerald-600 text-lg self-center md:self-start",children:r.jsx("strong",{children:n})}),r.jsx("p",{children:e.productItem.description}),r.jsx("div",{className:"card-actions justify-center md:justify-end",children:r.jsx("button",{className:"btn btn-primary btn-block sm:btn-wide",onClick:()=>t(ot(e.productItem),1),children:"+Add"})})]})]})}const k=()=>{},C=k(),me=Object,c=e=>e===C,U=e=>typeof e=="function",z=(e,t)=>({...e,...t}),ct=e=>U(e.then),ie=new WeakMap;let lt=0;const te=e=>{const t=typeof e,n=e&&e.constructor,a=n==Date;let s,o;if(me(e)===e&&!a&&n!=RegExp){if(s=ie.get(e),s)return s;if(s=++lt+"~",ie.set(e,s),n==Array){for(s="@",o=0;ole&&typeof window.requestAnimationFrame!=be,Me=(e,t)=>{const n=F.get(e);return[()=>!c(t)&&e.get(t)||ge,a=>{if(!c(t)){const s=e.get(t);t in ce||(ce[t]=s),n[5](t,z(s,a),s||ge)}},n[6],()=>!c(t)&&t in ce?ce[t]:!c(t)&&e.get(t)||ge]};let Re=!0;const dt=()=>Re,[Se,Ne]=le&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[k,k],ft=()=>{const e=pe&&document.visibilityState;return c(e)||e!=="hidden"},mt=e=>(pe&&document.addEventListener("visibilitychange",e),Se("focus",e),()=>{pe&&document.removeEventListener("visibilitychange",e),Ne("focus",e)}),gt=e=>{const t=()=>{Re=!0,e()},n=()=>{Re=!1};return Se("online",t),Se("offline",n),()=>{Ne("online",t),Ne("offline",n)}},ht={isOnline:dt,isVisible:ft},xt={initFocus:mt,initReconnect:gt},Le=!ve.useId,ne=!le||"Deno"in window,Et=e=>ut()?window.requestAnimationFrame(e):setTimeout(e,1),he=ne?x.useEffect:x.useLayoutEffect,xe=typeof navigator<"u"&&navigator.connection,Ve=!ne&&xe&&(["slow-2g","2g"].includes(xe.effectiveType)||xe.saveData),Te=e=>{if(U(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?te(e):"",[e,t]};let pt=0;const we=()=>++pt,ke=0,ze=1,We=2,Rt=3;var ee={__proto__:null,ERROR_REVALIDATE_EVENT:Rt,FOCUS_EVENT:ke,MUTATE_EVENT:We,RECONNECT_EVENT:ze};async function qe(...e){const[t,n,a,s]=e,o=z({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let l=o.populateCache;const m=o.rollbackOnError;let h=o.optimisticData;const j=o.revalidate!==!1,R=b=>typeof m=="function"?m(b):m!==!1,S=o.throwOnError;if(U(n)){const b=n,w=[],T=t.keys();for(const D of T)!/^\$(inf|sub)\$/.test(D)&&b(t.get(D)._k)&&w.push(D);return Promise.all(w.map(P))}return P(n);async function P(b){const[w]=Te(b);if(!w)return;const[T,D]=Me(t,w),[i,q,Q,W]=F.get(t),M=i[w],H=()=>j&&(delete Q[w],delete W[w],M&&M[0])?M[0](We).then(()=>T().data):T().data;if(e.length<3)return H();let E=a,u;const B=we();q[w]=[B,0];const A=!c(h),G=T(),se=G.data,re=G._c,O=c(re)?se:re;if(A&&(h=U(h)?h(O,se):h,D({data:h,_c:O})),U(E))try{E=E(O)}catch($){u=$}if(E&&ct(E))if(E=await E.catch($=>{u=$}),B!==q[w][0]){if(u)throw u;return E}else u&&A&&R(u)&&(l=!0,E=O,D({data:E,_c:C}));l&&(u||(U(l)&&(E=l(E,O)),D({data:E,error:C,_c:C}))),q[w][1]=we();const ue=await H();if(D({_c:C}),u){if(S)throw u;return}return l?ue:E}}const Fe=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},St=(e,t)=>{if(!F.has(e)){const n=z(xt,t),a={},s=qe.bind(C,e);let o=k;const l={},m=(R,S)=>{const P=l[R]||[];return l[R]=P,P.push(S),()=>P.splice(P.indexOf(S),1)},h=(R,S,P)=>{e.set(R,S);const b=l[R];if(b)for(const w of b)w(S,P)},j=()=>{if(!F.has(e)&&(F.set(e,[a,{},{},{},s,h,m]),!ne)){const R=n.initFocus(setTimeout.bind(C,Fe.bind(C,a,ke))),S=n.initReconnect(setTimeout.bind(C,Fe.bind(C,a,ze)));o=()=>{R&&R(),S&&S(),F.delete(e)}}};return j(),[e,s,j,o]}return[e,F.get(e)[4]]},Nt=(e,t,n,a,s)=>{const o=n.errorRetryCount,l=s.retryCount,m=~~((Math.random()+.5)*(1<<(l<8?l:8)))*n.errorRetryInterval;!c(o)&&l>o||setTimeout(a,m,s)},wt=(e,t)=>te(e)==te(t),[He,vt]=St(new Map),bt=z({onLoadingSlow:k,onSuccess:k,onError:k,onErrorRetry:Nt,onDiscarded:k,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ve?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ve?5e3:3e3,compare:wt,isPaused:()=>!1,cache:He,mutate:vt,fallback:{}},ht),Tt=(e,t)=>{const n=z(e,t);if(t){const{use:a,fallback:s}=e,{use:o,fallback:l}=t;a&&o&&(n.use=a.concat(o)),s&&l&&(n.fallback=z(s,l))}return n},_t=x.createContext({}),Be=le&&window.__SWR_DEVTOOLS_USE__,Ct=Be?window.__SWR_DEVTOOLS_USE__:[],jt=()=>{Be&&(window.__SWR_DEVTOOLS_REACT__=ve)},Pt=e=>U(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],Ot=()=>z(bt,x.useContext(_t)),yt=e=>(t,n,a)=>e(t,n&&((...o)=>{const[l]=Te(t),[,,,m]=F.get(He),h=m[l];return c(h)?n(...o):(delete m[l],h)}),a),Dt=Ct.concat(yt),At=e=>function(...n){const a=Ot(),[s,o,l]=Pt(n),m=Tt(a,l);let h=e;const{use:j}=m,R=(j||[]).concat(Dt);for(let S=R.length;S--;)h=R[S](h);return h(s,o||m.fetcher||null,m)},It=(e,t,n)=>{const a=t[e]||(t[e]=[]);return a.push(n),()=>{const s=a.indexOf(n);s>=0&&(a[s]=a[a.length-1],a.pop())}};jt();const Ue=ve.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)}),Ee={dedupe:!0},Lt=(e,t,n)=>{const{cache:a,compare:s,suspense:o,fallbackData:l,revalidateOnMount:m,revalidateIfStale:h,refreshInterval:j,refreshWhenHidden:R,refreshWhenOffline:S,keepPreviousData:P}=n,[b,w,T,D]=F.get(a),[i,q]=Te(e),Q=x.useRef(!1),W=x.useRef(!1),M=x.useRef(i),H=x.useRef(t),E=x.useRef(n),u=()=>E.current,B=()=>u().isVisible()&&u().isOnline(),[A,G,se,re]=Me(a,i),O=x.useRef({}).current,ue=c(l)?n.fallback[i]:l,$=(d,f)=>{for(const N in O){const g=N;if(g==="data"){if(!s(d[g],f[g])&&(!c(d[g])||!s(oe,f[g])))return!1}else if(f[g]!==d[g])return!1}return!0},_e=x.useMemo(()=>{const d=(()=>!i||!t?!1:c(m)?u().isPaused()||o?!1:c(h)?!0:h:m)(),f=v=>{const L=z(v);return delete L._k,d?{isValidating:!0,isLoading:!0,...L}:L},N=A(),g=re(),I=f(N),Z=N===g?I:f(g);let p=I;return[()=>{const v=f(A());return $(v,p)?(p.data=v.data,p.isLoading=v.isLoading,p.isValidating=v.isValidating,p.error=v.error,p):(p=v,v)},()=>Z]},[a,i]),J=Qe.useSyncExternalStore(x.useCallback(d=>se(i,(f,N)=>{$(N,f)||d()}),[a,i]),_e[0],_e[1]),Ce=!Q.current,$e=b[i]&&b[i].length>0,K=J.data,Y=c(K)?ue:K,ae=J.error,je=x.useRef(Y),oe=P?c(K)?je.current:K:Y,Pe=(()=>$e&&!c(ae)?!1:Ce&&!c(m)?m:u().isPaused()?!1:o?c(Y)?!1:h:c(Y)||h)(),Oe=!!(i&&t&&Ce&&Pe),Je=c(J.isValidating)?Oe:J.isValidating,Ke=c(J.isLoading)?Oe:J.isLoading,X=x.useCallback(async d=>{const f=H.current;if(!i||!f||W.current||u().isPaused())return!1;let N,g,I=!0;const Z=d||{},p=!T[i]||!Z.dedupe,v=()=>Le?!W.current&&i===M.current&&Q.current:i===M.current,L={isValidating:!1,isLoading:!1},De=()=>{G(L)},Ae=()=>{const _=T[i];_&&_[1]===g&&delete T[i]},Ie={isValidating:!0};c(A().data)&&(Ie.isLoading=!0);try{if(p&&(G(Ie),n.loadingTimeout&&c(A().data)&&setTimeout(()=>{I&&v()&&u().onLoadingSlow(i,n)},n.loadingTimeout),T[i]=[f(q),we()]),[N,g]=T[i],N=await N,p&&setTimeout(Ae,n.dedupingInterval),!T[i]||T[i][1]!==g)return p&&v()&&u().onDiscarded(i),!1;L.error=C;const _=w[i];if(!c(_)&&(g<=_[0]||g<=_[1]||_[1]===0))return De(),p&&v()&&u().onDiscarded(i),!1;const V=A().data;L.data=s(V,N)?V:N,p&&v()&&u().onSuccess(N,i,n)}catch(_){Ae();const V=u(),{shouldRetryOnError:de}=V;V.isPaused()||(L.error=_,p&&v()&&(V.onError(_,i,V),(de===!0||U(de)&&de(_))&&B()&&V.onErrorRetry(_,i,V,Ye=>{const fe=b[i];fe&&fe[0]&&fe[0](ee.ERROR_REVALIDATE_EVENT,Ye)},{retryCount:(Z.retryCount||0)+1,dedupe:!0})))}return I=!1,De(),!0},[i,a]),ye=x.useCallback((...d)=>qe(a,M.current,...d),[]);if(he(()=>{H.current=t,E.current=n,c(K)||(je.current=K)}),he(()=>{if(!i)return;const d=X.bind(C,Ee);let f=0;const g=It(i,b,(I,Z={})=>{if(I==ee.FOCUS_EVENT){const p=Date.now();u().revalidateOnFocus&&p>f&&B()&&(f=p+u().focusThrottleInterval,d())}else if(I==ee.RECONNECT_EVENT)u().revalidateOnReconnect&&B()&&d();else{if(I==ee.MUTATE_EVENT)return X();if(I==ee.ERROR_REVALIDATE_EVENT)return X(Z)}});return W.current=!1,M.current=i,Q.current=!0,G({_k:q}),Pe&&(c(Y)||ne?d():Et(d)),()=>{W.current=!0,g()}},[i]),he(()=>{let d;function f(){const g=U(j)?j(A().data):j;g&&d!==-1&&(d=setTimeout(N,g))}function N(){!A().error&&(R||u().isVisible())&&(S||u().isOnline())?X(Ee).then(f):f()}return f(),()=>{d&&(clearTimeout(d),d=-1)}},[j,R,S,i]),x.useDebugValue(oe),o&&c(Y)&&i){if(!Le&&ne)throw new Error("Fallback data is required when using suspense in SSR.");H.current=t,E.current=n,W.current=!1;const d=D[i];if(!c(d)){const f=ye(d);Ue(f)}if(c(ae)){const f=X(Ee);c(oe)||(f.status="fulfilled",f.value=!0),Ue(f)}else throw ae}return{mutate:ye,get data(){return O.data=!0,oe},get error(){return O.error=!0,ae},get isValidating(){return O.isValidating=!0,Je},get isLoading(){return O.isLoading=!0,Ke}}},Vt=At(Lt),Ft="/api/",Ut=Ft+"products?",Mt=6,kt=async e=>{const t=await fetch(Ut+e,{method:"GET"});if(!t.ok){const n=await t.json();throw new Error((n==null?void 0:n.message)||t.statusText)}return await t.json()},zt={revalidateOnFocus:!1,revalidateIfStale:!1,revalidateOnReconnect:!1};function Wt(e){const t=x.useRef(1),n=x.useRef(1),a=x.useRef(Mt),{data:s,error:o,isLoading:l}=Vt(e,kt,zt);return s!=null&&s.pagination&&(n.current!==s.pagination.totalPages&&(n.current=s.pagination.totalPages),t.current!==s.pagination.currentPage&&(t.current=s.pagination.currentPage),a.current!==s.pagination.pageSize&&(a.current=s.pagination.pageSize)),{products:s==null?void 0:s.items,error:o,isLoading:l,currentPage:t.current,totalPages:n.current,pageSize:a.current}}function qt(e){return r.jsxs("section",{className:"flex flex-col items-center pb-2 px-2",children:[r.jsx("div",{children:r.jsx("h3",{className:"stat-title font-bold",children:"Page Stats"})}),r.jsx("div",{children:r.jsxs("div",{className:"stats shadow",children:[r.jsxs("section",{className:"stat place-items-center px-4 sm:px-6",children:[r.jsx("h4",{className:"stat-desc",children:"Page Size"}),r.jsx("p",{className:"stat-value",children:e.pageSize})]}),r.jsxs("section",{className:"stat place-items-center px-4 sm:px-6",children:[r.jsx("h4",{className:"stat-desc",children:"Current Page"}),r.jsx("p",{className:"stat-value text-secondary",children:e.currentPage})]}),r.jsxs("section",{className:"stat place-items-center px-4 sm:px-6",children:[r.jsx("h4",{className:"stat-desc",children:"Total Pages"}),r.jsx("p",{className:"stat-value",children:e.totalPages})]})]})})]})}const Ge="join-item btn btn-outline ",Ht=Ge+"btn-secondary",Bt=Ge+"btn-primary";function Gt(e){return r.jsxs("menu",{className:"join grid grid-cols-2 ml-auto mr-auto max-w-screen-md px-1 sm:px-0",children:[r.jsx("button",{className:Ht,onClick:e.onPrevious,disabled:!e.hasPrevious,children:"Previous page"}),r.jsx("button",{className:Bt,onClick:e.onNext,disabled:!e.hasNext,children:"Next Page"})]})}function $t(e){const t=e.currentPage!==e.totalPages,n=e.currentPage>1,a=()=>{t&&e.onPageChange(e.currentPage+1)},s=()=>{n&&e.onPageChange(e.currentPage-1)};return r.jsxs("div",{className:"max-w-screen-lg flex-col justify-center items-center ml-auto mr-auto",children:[r.jsx(qt,{pageSize:e.pageSize,currentPage:e.currentPage,totalPages:e.totalPages}),r.jsx(Gt,{onPrevious:s,onNext:a,hasPrevious:n,hasNext:t})]})}function Jt(e){const{products:t,error:n,isLoading:a,pageSize:s,totalPages:o,currentPage:l}=Wt(e.pageSearchParams);return a?r.jsx("div",{className:"flex",children:r.jsx("progress",{className:"progress w-56 mx-auto progress-secondary"})}):n||t===void 0?r.jsx(at,{}):r.jsxs(r.Fragment,{children:[r.jsx("ul",{className:"flex flex-col w-full border-opacity-50 px-2",children:t.map(m=>r.jsxs("li",{children:[r.jsx(it,{productItem:m}),r.jsx("div",{className:"divider"})]},m.id))}),r.jsx($t,{pageSize:s,totalPages:o,currentPage:l,onPageChange:e.onPageChange})]})}const Kt={top:0,left:0,behavior:"smooth"};function Zt(){const[e,t]=Xe();x.useEffect(()=>{window.scrollTo(Kt)},[e]);const n=nt(e),a=s=>{s>0&&(n.set(y.pageNum,s.toString()),t(n))};return r.jsxs("main",{className:"container mx-auto max-w-screen-lg pb-8 mb-20 md:mb-0",children:[r.jsx("div",{className:"flex z-0 flex-col justify-center items-center",children:r.jsx(st,{})}),r.jsx(Jt,{pageSearchParams:n.toString(),onPageChange:a})]})}export{Zt as default}; diff --git a/ReactRoastDotnet.API/wwwroot/assets/SignInPage-954f9f5e.js b/ReactRoastDotnet.API/wwwroot/assets/SignInPage-9444f052.js similarity index 86% rename from ReactRoastDotnet.API/wwwroot/assets/SignInPage-954f9f5e.js rename to ReactRoastDotnet.API/wwwroot/assets/SignInPage-9444f052.js index c83bf2c..8803035 100644 --- a/ReactRoastDotnet.API/wwwroot/assets/SignInPage-954f9f5e.js +++ b/ReactRoastDotnet.API/wwwroot/assets/SignInPage-9444f052.js @@ -1 +1 @@ -import{b as l,c as b,j as s,N as j,p as c,L as w}from"./index-abbaf79c.js";import{u as y,e as N,s as S,A as u}from"./AuthInput-dc4b44dd.js";import{A as C}from"./AuthFormHeader-c7daf50a.js";function B(){var i,r,m;const{register:t,handleSubmit:d,formState:{isSubmitting:p,errors:a}}=y(),g=l(e=>e.user),x=l(e=>e.signInUser),h=(i=b().state)==null?void 0:i.email;if(g)return s.jsx(j,{to:c.home});const f=async e=>{await x({email:e.email,password:e.password})},n=t("email",N),o=t("password",S);return s.jsx("main",{className:"flex justify-center min-h-full py-6 md:py-24 mb-20 md:mb-0",children:s.jsxs("div",{className:"card w-full max-w-md shadow-2xl bg-base-100",children:[s.jsx(C,{title:"Sign In"}),s.jsxs("form",{className:"card-body",onSubmit:d(f),children:[s.jsx(u,{type:"email",ref:n.ref,name:n.name,onChange:n.onChange,onBlur:n.onBlur,labelText:"Email",errorMsg:(r=a==null?void 0:a.email)==null?void 0:r.message,autoComplete:"email",value:h}),s.jsx(u,{type:"password",ref:o.ref,name:o.name,onChange:o.onChange,onBlur:o.onBlur,labelText:"Password",errorMsg:(m=a==null?void 0:a.password)==null?void 0:m.message,autoComplete:"current-password"}),s.jsx(w,{to:c.signUp,className:"link-secondary",children:"Not registered? Sign Up"}),s.jsx("div",{className:"form-control mt-6",children:s.jsxs("button",{className:"btn btn-primary",type:"submit",children:["Login",p&&s.jsx("span",{className:"loading loading-spinner"})]})})]})]})})}export{B as default}; +import{b as l,c as b,j as s,N as j,p as c,L as w}from"./index-e97df17e.js";import{u as y,e as N,s as S,A as u}from"./AuthInput-179d8048.js";import{A as C}from"./AuthFormHeader-e50a937c.js";function B(){var i,r,m;const{register:t,handleSubmit:d,formState:{isSubmitting:p,errors:a}}=y(),g=l(e=>e.user),x=l(e=>e.signInUser),h=(i=b().state)==null?void 0:i.email;if(g)return s.jsx(j,{to:c.home});const f=async e=>{await x({email:e.email,password:e.password})},n=t("email",N),o=t("password",S);return s.jsx("main",{className:"flex justify-center min-h-full py-6 md:py-24 mb-20 md:mb-0",children:s.jsxs("div",{className:"card w-full max-w-md shadow-2xl bg-base-100",children:[s.jsx(C,{title:"Sign In"}),s.jsxs("form",{className:"card-body",onSubmit:d(f),children:[s.jsx(u,{type:"email",ref:n.ref,name:n.name,onChange:n.onChange,onBlur:n.onBlur,labelText:"Email",errorMsg:(r=a==null?void 0:a.email)==null?void 0:r.message,autoComplete:"email",value:h}),s.jsx(u,{type:"password",ref:o.ref,name:o.name,onChange:o.onChange,onBlur:o.onBlur,labelText:"Password",errorMsg:(m=a==null?void 0:a.password)==null?void 0:m.message,autoComplete:"current-password"}),s.jsx(w,{to:c.signUp,className:"link-secondary",children:"Not registered? Sign Up"}),s.jsx("div",{className:"form-control mt-6",children:s.jsxs("button",{className:"btn btn-primary",type:"submit",children:["Login",p&&s.jsx("span",{className:"loading loading-spinner"})]})})]})]})})}export{B as default}; diff --git a/ReactRoastDotnet.API/wwwroot/assets/SignUpPage-8aa89d65.js b/ReactRoastDotnet.API/wwwroot/assets/SignUpPage-2bdafc56.js similarity index 90% rename from ReactRoastDotnet.API/wwwroot/assets/SignUpPage-8aa89d65.js rename to ReactRoastDotnet.API/wwwroot/assets/SignUpPage-2bdafc56.js index a737c84..8caf513 100644 --- a/ReactRoastDotnet.API/wwwroot/assets/SignUpPage-8aa89d65.js +++ b/ReactRoastDotnet.API/wwwroot/assets/SignUpPage-2bdafc56.js @@ -1 +1 @@ -import{r as y,j as e,N as w,p as f,L as C,d as S,_ as B,e as v}from"./index-abbaf79c.js";import{u as A,n as x,e as E,a as T,A as i}from"./AuthInput-dc4b44dd.js";import{A as U}from"./AuthFormHeader-c7daf50a.js";function k(){var u,c,g,d;const[p,N]=y.useState(),{register:s,handleSubmit:h,formState:{isSubmitting:b,errors:a}}=A();if(p)return e.jsx(w,{to:f.signIn,state:{email:p}});const j=async o=>{const r=await S({firstName:o.firstName,lastName:o.lastName,email:o.email,password:o.password});r.ok?(N(r.value),B.success("Successfully created account!")):v(r.problemDetails)},t=s("firstName",x),n=s("lastName",x),m=s("email",E),l=s("password",T);return e.jsx("main",{className:"flex justify-center min-h-full py-6 md:py-6 mb-20 md:mb-0",children:e.jsxs("div",{className:"card w-full max-w-md shadow-2xl bg-base-100",children:[e.jsx(U,{title:"Sign Up"}),e.jsxs("form",{className:"card-body",onSubmit:h(j),children:[e.jsx(i,{ref:t.ref,type:"text",name:t.name,onChange:t.onChange,onBlur:t.onBlur,labelText:"First Name",errorMsg:(u=a==null?void 0:a.firstName)==null?void 0:u.message,autoComplete:"given-name"}),e.jsx(i,{ref:n.ref,type:"text",name:n.name,onChange:n.onChange,onBlur:n.onBlur,labelText:"Last Name",errorMsg:(c=a==null?void 0:a.lastName)==null?void 0:c.message,autoComplete:"family-name"}),e.jsx(i,{ref:m.ref,type:"email",name:m.name,onChange:m.onChange,onBlur:m.onBlur,labelText:"Email",errorMsg:(g=a==null?void 0:a.email)==null?void 0:g.message,autoComplete:"email"}),e.jsx(i,{ref:l.ref,type:"password",name:l.name,onChange:l.onChange,onBlur:l.onBlur,labelText:"Password",errorMsg:(d=a==null?void 0:a.password)==null?void 0:d.message,autoComplete:"new-password"}),e.jsx(C,{to:f.signIn,className:"link-secondary",children:"Already registered? Sign In"}),e.jsx("div",{className:"form-control mt-6",children:e.jsxs("button",{className:"btn btn-primary",type:"submit",children:["Sign Up",b&&e.jsx("span",{className:"loading loading-spinner"})]})})]})]})})}export{k as default}; +import{r as y,j as e,N as w,p as f,L as C,d as S,_ as B,e as v}from"./index-e97df17e.js";import{u as A,n as x,e as E,a as T,A as i}from"./AuthInput-179d8048.js";import{A as U}from"./AuthFormHeader-e50a937c.js";function k(){var u,c,g,d;const[p,N]=y.useState(),{register:s,handleSubmit:h,formState:{isSubmitting:b,errors:a}}=A();if(p)return e.jsx(w,{to:f.signIn,state:{email:p}});const j=async o=>{const r=await S({firstName:o.firstName,lastName:o.lastName,email:o.email,password:o.password});r.ok?(N(r.value),B.success("Successfully created account!")):v(r.problemDetails)},t=s("firstName",x),n=s("lastName",x),m=s("email",E),l=s("password",T);return e.jsx("main",{className:"flex justify-center min-h-full py-6 md:py-6 mb-20 md:mb-0",children:e.jsxs("div",{className:"card w-full max-w-md shadow-2xl bg-base-100",children:[e.jsx(U,{title:"Sign Up"}),e.jsxs("form",{className:"card-body",onSubmit:h(j),children:[e.jsx(i,{ref:t.ref,type:"text",name:t.name,onChange:t.onChange,onBlur:t.onBlur,labelText:"First Name",errorMsg:(u=a==null?void 0:a.firstName)==null?void 0:u.message,autoComplete:"given-name"}),e.jsx(i,{ref:n.ref,type:"text",name:n.name,onChange:n.onChange,onBlur:n.onBlur,labelText:"Last Name",errorMsg:(c=a==null?void 0:a.lastName)==null?void 0:c.message,autoComplete:"family-name"}),e.jsx(i,{ref:m.ref,type:"email",name:m.name,onChange:m.onChange,onBlur:m.onBlur,labelText:"Email",errorMsg:(g=a==null?void 0:a.email)==null?void 0:g.message,autoComplete:"email"}),e.jsx(i,{ref:l.ref,type:"password",name:l.name,onChange:l.onChange,onBlur:l.onBlur,labelText:"Password",errorMsg:(d=a==null?void 0:a.password)==null?void 0:d.message,autoComplete:"new-password"}),e.jsx(C,{to:f.signIn,className:"link-secondary",children:"Already registered? Sign In"}),e.jsx("div",{className:"form-control mt-6",children:e.jsxs("button",{className:"btn btn-primary",type:"submit",children:["Sign Up",b&&e.jsx("span",{className:"loading loading-spinner"})]})})]})]})})}export{k as default}; diff --git a/ReactRoastDotnet.API/wwwroot/assets/index-abbaf79c.js b/ReactRoastDotnet.API/wwwroot/assets/index-e97df17e.js similarity index 96% rename from ReactRoastDotnet.API/wwwroot/assets/index-abbaf79c.js rename to ReactRoastDotnet.API/wwwroot/assets/index-e97df17e.js index 86998d1..b7658f6 100644 --- a/ReactRoastDotnet.API/wwwroot/assets/index-abbaf79c.js +++ b/ReactRoastDotnet.API/wwwroot/assets/index-e97df17e.js @@ -65,7 +65,7 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[l]=e[l]);return n}function p1(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function h1(e,t){return e.button===0&&(!t||t==="_self")&&!p1(e)}function Oa(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(l=>[n,l]):[[n,r]])},[]))}function m1(e,t){let n=Oa(e);if(t)for(let r of t.keys())n.has(r)||t.getAll(r).forEach(l=>{n.append(r,l)});return n}const v1=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],g1=["aria-current","caseSensitive","className","end","style","to","children"];function y1(e,t){return zm({basename:t==null?void 0:t.basename,future:ir({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:nm({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||w1(),routes:e,mapRouteProperties:d1}).initialize()}function w1(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=ir({},t,{errors:x1(t.errors)})),t}function x1(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,l]of t)if(l&&l.__type==="RouteErrorResponse")n[r]=new zu(l.status,l.statusText,l.data,l.internal===!0);else if(l&&l.__type==="Error"){let o=new Error(l.message);o.stack="",n[r]=o}else n[r]=l;return n}const S1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",k1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,nd=E.forwardRef(function(t,n){let{onClick:r,relative:l,reloadDocument:o,replace:i,state:a,target:u,to:s,preventScrollReset:c}=t,h=td(t,v1),{basename:m}=E.useContext(En),g,y=!1;if(typeof s=="string"&&k1.test(s)&&(g=s,S1))try{let f=new URL(window.location.href),v=s.startsWith("//")?new URL(f.protocol+s):new URL(s),d=fr(v.pathname,m);v.origin===f.origin&&d!=null?s=d+v.search+v.hash:y=!0}catch{}let S=Qm(s,{relative:l}),_=E1(s,{replace:i,state:a,target:u,preventScrollReset:c,relative:l});function p(f){r&&r(f),f.defaultPrevented||_(f)}return E.createElement("a",ir({},h,{href:g||S,onClick:y||o?r:p,ref:n,target:u}))}),Jo=E.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:l=!1,className:o="",end:i=!1,style:a,to:u,children:s}=t,c=td(t,g1),h=Uu(u,{relative:c.relative}),m=Cn(),g=E.useContext(Ou),{navigator:y}=E.useContext(En),S=y.encodeLocation?y.encodeLocation(h).pathname:h.pathname,_=m.pathname,p=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;l||(_=_.toLowerCase(),p=p?p.toLowerCase():null,S=S.toLowerCase());let f=_===S||!i&&_.startsWith(S)&&_.charAt(S.length)==="/",v=p!=null&&(p===S||!i&&p.startsWith(S)&&p.charAt(S.length)==="/"),d=f?r:void 0,P;typeof o=="function"?P=o({isActive:f,isPending:v}):P=[o,f?"active":null,v?"pending":null].filter(Boolean).join(" ");let j=typeof a=="function"?a({isActive:f,isPending:v}):a;return E.createElement(nd,ir({},c,{"aria-current":d,className:P,ref:n,style:j,to:u}),typeof s=="function"?s({isActive:f,isPending:v}):s)});var wc;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher"})(wc||(wc={}));var xc;(function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(xc||(xc={}));function E1(e,t){let{target:n,replace:r,state:l,preventScrollReset:o,relative:i}=t===void 0?{}:t,a=Iu(),u=Cn(),s=Uu(e,{relative:i});return E.useCallback(c=>{if(h1(c,n)){c.preventDefault();let h=r!==void 0?r:xn(u)===xn(s);a(e,{replace:h,state:l,preventScrollReset:o,relative:i})}},[u,a,s,r,l,n,e,o,i])}function Fg(e){let t=E.useRef(Oa(e)),n=E.useRef(!1),r=Cn(),l=E.useMemo(()=>m1(r.search,n.current?null:t.current),[r.search]),o=Iu(),i=E.useCallback((a,u)=>{const s=Oa(typeof a=="function"?a(l):a);n.current=!0,o("?"+s,u)},[o,l]);return[l,i]}const C1="modulepreload",P1=function(e){return"/"+e},Sc={},Zo=function(t,n,r){if(!n||n.length===0)return t();const l=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=P1(o),o in Sc)return;Sc[o]=!0;const i=o.endsWith(".css"),a=i?'[rel="stylesheet"]':"";if(!!r)for(let c=l.length-1;c>=0;c--){const h=l[c];if(h.href===o&&(!i||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const s=document.createElement("link");if(s.rel=i?"stylesheet":C1,i||(s.as="script",s.crossOrigin=""),s.href=o,document.head.appendChild(s),i)return new Promise((c,h)=>{s.addEventListener("load",c),s.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=o,window.dispatchEvent(i),!i.defaultPrevented)throw o})};let N1={data:""},R1=e=>typeof window=="object"?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||N1,_1=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,j1=/\/\*[^]*?\*\/| +/g,kc=/\n+/g,Wt=(e,t)=>{let n="",r="",l="";for(let o in e){let i=e[o];o[0]=="@"?o[1]=="i"?n=o+" "+i+";":r+=o[1]=="f"?Wt(i,o):o+"{"+Wt(i,o[1]=="k"?"":t)+"}":typeof i=="object"?r+=Wt(i,t?t.replace(/([^,])+/g,a=>o.replace(/(^:.*)|([^,])+/g,u=>/&/.test(u)?u.replace(/&/g,a):a?a+" "+u:u)):o):i!=null&&(o=/^--/.test(o)?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),l+=Wt.p?Wt.p(o,i):o+":"+i+";")}return n+(t&&l?t+"{"+l+"}":l)+r},wt={},rd=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+rd(e[n]);return t}return e},L1=(e,t,n,r,l)=>{let o=rd(e),i=wt[o]||(wt[o]=(u=>{let s=0,c=11;for(;s>>0;return"go"+c})(o));if(!wt[i]){let u=o!==e?e:(s=>{let c,h,m=[{}];for(;c=_1.exec(s.replace(j1,""));)c[4]?m.shift():c[3]?(h=c[3].replace(kc," ").trim(),m.unshift(m[0][h]=m[0][h]||{})):m[0][c[1]]=c[2].replace(kc," ").trim();return m[0]})(e);wt[i]=Wt(l?{["@keyframes "+i]:u}:u,n?"":"."+i)}let a=n&&wt.g?wt.g:null;return n&&(wt.g=wt[i]),((u,s,c,h)=>{h?s.data=s.data.replace(h,u):s.data.indexOf(u)===-1&&(s.data=c?u+s.data:s.data+u)})(wt[i],t,r,a),i},D1=(e,t,n)=>e.reduce((r,l,o)=>{let i=t[o];if(i&&i.call){let a=i(n),u=a&&a.props&&a.props.className||/^go/.test(a)&&a;i=u?"."+u:a&&typeof a=="object"?a.props?"":Wt(a,""):a===!1?"":a}return r+l+(i??"")},"");function qo(e){let t=this||{},n=e.call?e(t.p):e;return L1(n.unshift?n.raw?D1(n,[].slice.call(arguments,1),t.p):n.reduce((r,l)=>Object.assign(r,l&&l.call?l(t.p):l),{}):n,R1(t.target),t.g,t.o,t.k)}let ld,Ia,Ua;qo.bind({g:1});let Lt=qo.bind({k:1});function T1(e,t,n,r){Wt.p=t,ld=e,Ia=n,Ua=r}function on(e,t){let n=this||{};return function(){let r=arguments;function l(o,i){let a=Object.assign({},o),u=a.className||l.className;n.p=Object.assign({theme:Ia&&Ia()},a),n.o=/ *go\d+/.test(u),a.className=qo.apply(n,r)+(u?" "+u:""),t&&(a.ref=i);let s=e;return e[0]&&(s=a.as||e,delete a.as),Ua&&s[0]&&Ua(a),ld(s,a)}return t?t(l):l}}var z1=e=>typeof e=="function",Ro=(e,t)=>z1(e)?e(t):e,M1=(()=>{let e=0;return()=>(++e).toString()})(),od=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),O1=20,ql=new Map,I1=1e3,Ec=e=>{if(ql.has(e))return;let t=setTimeout(()=>{ql.delete(e),Pn({type:4,toastId:e})},I1);ql.set(e,t)},U1=e=>{let t=ql.get(e);t&&clearTimeout(t)},Fa=(e,t)=>{switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,O1)};case 1:return t.toast.id&&U1(t.toast.id),{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return e.toasts.find(o=>o.id===n.id)?Fa(e,{type:1,toast:n}):Fa(e,{type:0,toast:n});case 3:let{toastId:r}=t;return r?Ec(r):e.toasts.forEach(o=>{Ec(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===r||r===void 0?{...o,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let l=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+l}))}}},bl=[],eo={toasts:[],pausedAt:void 0},Pn=e=>{eo=Fa(eo,e),bl.forEach(t=>{t(eo)})},F1={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},$1=(e={})=>{let[t,n]=E.useState(eo);E.useEffect(()=>(bl.push(n),()=>{let l=bl.indexOf(n);l>-1&&bl.splice(l,1)}),[t]);let r=t.toasts.map(l=>{var o,i;return{...e,...e[l.type],...l,duration:l.duration||((o=e[l.type])==null?void 0:o.duration)||(e==null?void 0:e.duration)||F1[l.type],style:{...e.style,...(i=e[l.type])==null?void 0:i.style,...l.style}}});return{...t,toasts:r}},A1=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:(n==null?void 0:n.id)||M1()}),pl=e=>(t,n)=>{let r=A1(t,e,n);return Pn({type:2,toast:r}),r.id},Be=(e,t)=>pl("blank")(e,t);Be.error=pl("error");Be.success=pl("success");Be.loading=pl("loading");Be.custom=pl("custom");Be.dismiss=e=>{Pn({type:3,toastId:e})};Be.remove=e=>Pn({type:4,toastId:e});Be.promise=(e,t,n)=>{let r=Be.loading(t.loading,{...n,...n==null?void 0:n.loading});return e.then(l=>(Be.success(Ro(t.success,l),{id:r,...n,...n==null?void 0:n.success}),l)).catch(l=>{Be.error(Ro(t.error,l),{id:r,...n,...n==null?void 0:n.error})}),e};var B1=(e,t)=>{Pn({type:1,toast:{id:e,height:t}})},V1=()=>{Pn({type:5,time:Date.now()})},W1=e=>{let{toasts:t,pausedAt:n}=$1(e);E.useEffect(()=>{if(n)return;let o=Date.now(),i=t.map(a=>{if(a.duration===1/0)return;let u=(a.duration||0)+a.pauseDuration-(o-a.createdAt);if(u<0){a.visible&&Be.dismiss(a.id);return}return setTimeout(()=>Be.dismiss(a.id),u)});return()=>{i.forEach(a=>a&&clearTimeout(a))}},[t,n]);let r=E.useCallback(()=>{n&&Pn({type:6,time:Date.now()})},[n]),l=E.useCallback((o,i)=>{let{reverseOrder:a=!1,gutter:u=8,defaultPosition:s}=i||{},c=t.filter(g=>(g.position||s)===(o.position||s)&&g.height),h=c.findIndex(g=>g.id===o.id),m=c.filter((g,y)=>yg.visible).slice(...a?[m+1]:[0,m]).reduce((g,y)=>g+(y.height||0)+u,0)},[t]);return{toasts:t,handlers:{updateHeight:B1,startPause:V1,endPause:r,calculateOffset:l}}},H1=Lt` + */function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[l]=e[l]);return n}function p1(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function h1(e,t){return e.button===0&&(!t||t==="_self")&&!p1(e)}function Oa(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(l=>[n,l]):[[n,r]])},[]))}function m1(e,t){let n=Oa(e);if(t)for(let r of t.keys())n.has(r)||t.getAll(r).forEach(l=>{n.append(r,l)});return n}const v1=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],g1=["aria-current","caseSensitive","className","end","style","to","children"];function y1(e,t){return zm({basename:t==null?void 0:t.basename,future:ir({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:nm({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||w1(),routes:e,mapRouteProperties:d1}).initialize()}function w1(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=ir({},t,{errors:x1(t.errors)})),t}function x1(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,l]of t)if(l&&l.__type==="RouteErrorResponse")n[r]=new zu(l.status,l.statusText,l.data,l.internal===!0);else if(l&&l.__type==="Error"){let o=new Error(l.message);o.stack="",n[r]=o}else n[r]=l;return n}const S1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",k1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,nd=E.forwardRef(function(t,n){let{onClick:r,relative:l,reloadDocument:o,replace:i,state:a,target:u,to:s,preventScrollReset:c}=t,h=td(t,v1),{basename:m}=E.useContext(En),g,y=!1;if(typeof s=="string"&&k1.test(s)&&(g=s,S1))try{let f=new URL(window.location.href),v=s.startsWith("//")?new URL(f.protocol+s):new URL(s),d=fr(v.pathname,m);v.origin===f.origin&&d!=null?s=d+v.search+v.hash:y=!0}catch{}let S=Qm(s,{relative:l}),_=E1(s,{replace:i,state:a,target:u,preventScrollReset:c,relative:l});function p(f){r&&r(f),f.defaultPrevented||_(f)}return E.createElement("a",ir({},h,{href:g||S,onClick:y||o?r:p,ref:n,target:u}))}),Jo=E.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:l=!1,className:o="",end:i=!1,style:a,to:u,children:s}=t,c=td(t,g1),h=Uu(u,{relative:c.relative}),m=Cn(),g=E.useContext(Ou),{navigator:y}=E.useContext(En),S=y.encodeLocation?y.encodeLocation(h).pathname:h.pathname,_=m.pathname,p=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;l||(_=_.toLowerCase(),p=p?p.toLowerCase():null,S=S.toLowerCase());let f=_===S||!i&&_.startsWith(S)&&_.charAt(S.length)==="/",v=p!=null&&(p===S||!i&&p.startsWith(S)&&p.charAt(S.length)==="/"),d=f?r:void 0,P;typeof o=="function"?P=o({isActive:f,isPending:v}):P=[o,f?"active":null,v?"pending":null].filter(Boolean).join(" ");let j=typeof a=="function"?a({isActive:f,isPending:v}):a;return E.createElement(nd,ir({},c,{"aria-current":d,className:P,ref:n,style:j,to:u}),typeof s=="function"?s({isActive:f,isPending:v}):s)});var wc;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher"})(wc||(wc={}));var xc;(function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(xc||(xc={}));function E1(e,t){let{target:n,replace:r,state:l,preventScrollReset:o,relative:i}=t===void 0?{}:t,a=Iu(),u=Cn(),s=Uu(e,{relative:i});return E.useCallback(c=>{if(h1(c,n)){c.preventDefault();let h=r!==void 0?r:xn(u)===xn(s);a(e,{replace:h,state:l,preventScrollReset:o,relative:i})}},[u,a,s,r,l,n,e,o,i])}function $g(e){let t=E.useRef(Oa(e)),n=E.useRef(!1),r=Cn(),l=E.useMemo(()=>m1(r.search,n.current?null:t.current),[r.search]),o=Iu(),i=E.useCallback((a,u)=>{const s=Oa(typeof a=="function"?a(l):a);n.current=!0,o("?"+s,u)},[o,l]);return[l,i]}const C1="modulepreload",P1=function(e){return"/"+e},Sc={},Zo=function(t,n,r){if(!n||n.length===0)return t();const l=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=P1(o),o in Sc)return;Sc[o]=!0;const i=o.endsWith(".css"),a=i?'[rel="stylesheet"]':"";if(!!r)for(let c=l.length-1;c>=0;c--){const h=l[c];if(h.href===o&&(!i||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const s=document.createElement("link");if(s.rel=i?"stylesheet":C1,i||(s.as="script",s.crossOrigin=""),s.href=o,document.head.appendChild(s),i)return new Promise((c,h)=>{s.addEventListener("load",c),s.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=o,window.dispatchEvent(i),!i.defaultPrevented)throw o})};let N1={data:""},R1=e=>typeof window=="object"?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||N1,_1=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,j1=/\/\*[^]*?\*\/| +/g,kc=/\n+/g,Wt=(e,t)=>{let n="",r="",l="";for(let o in e){let i=e[o];o[0]=="@"?o[1]=="i"?n=o+" "+i+";":r+=o[1]=="f"?Wt(i,o):o+"{"+Wt(i,o[1]=="k"?"":t)+"}":typeof i=="object"?r+=Wt(i,t?t.replace(/([^,])+/g,a=>o.replace(/(^:.*)|([^,])+/g,u=>/&/.test(u)?u.replace(/&/g,a):a?a+" "+u:u)):o):i!=null&&(o=/^--/.test(o)?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),l+=Wt.p?Wt.p(o,i):o+":"+i+";")}return n+(t&&l?t+"{"+l+"}":l)+r},wt={},rd=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+rd(e[n]);return t}return e},L1=(e,t,n,r,l)=>{let o=rd(e),i=wt[o]||(wt[o]=(u=>{let s=0,c=11;for(;s>>0;return"go"+c})(o));if(!wt[i]){let u=o!==e?e:(s=>{let c,h,m=[{}];for(;c=_1.exec(s.replace(j1,""));)c[4]?m.shift():c[3]?(h=c[3].replace(kc," ").trim(),m.unshift(m[0][h]=m[0][h]||{})):m[0][c[1]]=c[2].replace(kc," ").trim();return m[0]})(e);wt[i]=Wt(l?{["@keyframes "+i]:u}:u,n?"":"."+i)}let a=n&&wt.g?wt.g:null;return n&&(wt.g=wt[i]),((u,s,c,h)=>{h?s.data=s.data.replace(h,u):s.data.indexOf(u)===-1&&(s.data=c?u+s.data:s.data+u)})(wt[i],t,r,a),i},D1=(e,t,n)=>e.reduce((r,l,o)=>{let i=t[o];if(i&&i.call){let a=i(n),u=a&&a.props&&a.props.className||/^go/.test(a)&&a;i=u?"."+u:a&&typeof a=="object"?a.props?"":Wt(a,""):a===!1?"":a}return r+l+(i??"")},"");function qo(e){let t=this||{},n=e.call?e(t.p):e;return L1(n.unshift?n.raw?D1(n,[].slice.call(arguments,1),t.p):n.reduce((r,l)=>Object.assign(r,l&&l.call?l(t.p):l),{}):n,R1(t.target),t.g,t.o,t.k)}let ld,Ia,Ua;qo.bind({g:1});let Lt=qo.bind({k:1});function T1(e,t,n,r){Wt.p=t,ld=e,Ia=n,Ua=r}function on(e,t){let n=this||{};return function(){let r=arguments;function l(o,i){let a=Object.assign({},o),u=a.className||l.className;n.p=Object.assign({theme:Ia&&Ia()},a),n.o=/ *go\d+/.test(u),a.className=qo.apply(n,r)+(u?" "+u:""),t&&(a.ref=i);let s=e;return e[0]&&(s=a.as||e,delete a.as),Ua&&s[0]&&Ua(a),ld(s,a)}return t?t(l):l}}var z1=e=>typeof e=="function",Ro=(e,t)=>z1(e)?e(t):e,M1=(()=>{let e=0;return()=>(++e).toString()})(),od=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),O1=20,ql=new Map,I1=1e3,Ec=e=>{if(ql.has(e))return;let t=setTimeout(()=>{ql.delete(e),Pn({type:4,toastId:e})},I1);ql.set(e,t)},U1=e=>{let t=ql.get(e);t&&clearTimeout(t)},Fa=(e,t)=>{switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,O1)};case 1:return t.toast.id&&U1(t.toast.id),{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return e.toasts.find(o=>o.id===n.id)?Fa(e,{type:1,toast:n}):Fa(e,{type:0,toast:n});case 3:let{toastId:r}=t;return r?Ec(r):e.toasts.forEach(o=>{Ec(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===r||r===void 0?{...o,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let l=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+l}))}}},bl=[],eo={toasts:[],pausedAt:void 0},Pn=e=>{eo=Fa(eo,e),bl.forEach(t=>{t(eo)})},F1={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},$1=(e={})=>{let[t,n]=E.useState(eo);E.useEffect(()=>(bl.push(n),()=>{let l=bl.indexOf(n);l>-1&&bl.splice(l,1)}),[t]);let r=t.toasts.map(l=>{var o,i;return{...e,...e[l.type],...l,duration:l.duration||((o=e[l.type])==null?void 0:o.duration)||(e==null?void 0:e.duration)||F1[l.type],style:{...e.style,...(i=e[l.type])==null?void 0:i.style,...l.style}}});return{...t,toasts:r}},A1=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:(n==null?void 0:n.id)||M1()}),pl=e=>(t,n)=>{let r=A1(t,e,n);return Pn({type:2,toast:r}),r.id},Be=(e,t)=>pl("blank")(e,t);Be.error=pl("error");Be.success=pl("success");Be.loading=pl("loading");Be.custom=pl("custom");Be.dismiss=e=>{Pn({type:3,toastId:e})};Be.remove=e=>Pn({type:4,toastId:e});Be.promise=(e,t,n)=>{let r=Be.loading(t.loading,{...n,...n==null?void 0:n.loading});return e.then(l=>(Be.success(Ro(t.success,l),{id:r,...n,...n==null?void 0:n.success}),l)).catch(l=>{Be.error(Ro(t.error,l),{id:r,...n,...n==null?void 0:n.error})}),e};var B1=(e,t)=>{Pn({type:1,toast:{id:e,height:t}})},V1=()=>{Pn({type:5,time:Date.now()})},W1=e=>{let{toasts:t,pausedAt:n}=$1(e);E.useEffect(()=>{if(n)return;let o=Date.now(),i=t.map(a=>{if(a.duration===1/0)return;let u=(a.duration||0)+a.pauseDuration-(o-a.createdAt);if(u<0){a.visible&&Be.dismiss(a.id);return}return setTimeout(()=>Be.dismiss(a.id),u)});return()=>{i.forEach(a=>a&&clearTimeout(a))}},[t,n]);let r=E.useCallback(()=>{n&&Pn({type:6,time:Date.now()})},[n]),l=E.useCallback((o,i)=>{let{reverseOrder:a=!1,gutter:u=8,defaultPosition:s}=i||{},c=t.filter(g=>(g.position||s)===(o.position||s)&&g.height),h=c.findIndex(g=>g.id===o.id),m=c.filter((g,y)=>yg.visible).slice(...a?[m+1]:[0,m]).reduce((g,y)=>g+(y.height||0)+u,0)},[t]);return{toasts:t,handlers:{updateHeight:B1,startPause:V1,endPause:r,calculateOffset:l}}},H1=Lt` from { transform: scale(0) rotate(45deg); opacity: 0; @@ -257,7 +257,7 @@ to { * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var bo=E,Nv=Pv;function Rv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _v=typeof Object.is=="function"?Object.is:Rv,jv=Nv.useSyncExternalStore,Lv=bo.useRef,Dv=bo.useEffect,Tv=bo.useMemo,zv=bo.useDebugValue;sd.useSyncExternalStoreWithSelector=function(e,t,n,r,l){var o=Lv(null);if(o.current===null){var i={hasValue:!1,value:null};o.current=i}else i=o.current;o=Tv(function(){function u(g){if(!s){if(s=!0,c=g,g=r(g),l!==void 0&&i.hasValue){var y=i.value;if(l(y,g))return h=y}return h=g}if(y=h,_v(c,g))return y;var S=r(g);return l!==void 0&&l(y,S)?y:(c=g,h=S)}var s=!1,c,h,m=n===void 0?null:n;return[function(){return u(t())},m===null?void 0:function(){return u(m())}]},[t,n,r,l]);var a=jv(e,o[0],o[1]);return Dv(function(){i.hasValue=!0,i.value=a},[a]),zv(a),a};ud.exports=sd;var Mv=ud.exports;const Ov=_c(Mv),{useSyncExternalStoreWithSelector:Iv}=Ov;function Uv(e,t=e.getState,n){const r=Iv(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return E.useDebugValue(r),r}const Pc=e=>{const t=typeof e=="function"?mv(e):e,n=(r,l)=>Uv(t,r,l);return Object.assign(n,t),n},dd=e=>e?Pc(e):Pc;function Fv(e){if(e&&typeof e=="object"&&"type"in e&&typeof e.type=="string")return e.type}function $v(e,t="Server Error"){if(e&&typeof e=="object"){if("title"in e&&typeof e.title=="string")return e.title;if("statusText"in e&&typeof e.statusText=="string")return e.statusText}return t}function Av(e){return e&&typeof e=="object"&&"status"in e&&typeof e.status=="number"?e.status:500}function Bv(e){if(e&&typeof e=="object"&&"detail"in e&&typeof e.detail=="string")return e.detail}function Vv(e){if(e&&typeof e=="object"&&"traceId"in e&&typeof e.traceId=="string")return e.traceId}function Wv(e){if(e&&typeof e=="object"&&"errors"in e&&typeof e.errors=="object"&&e.errors!==null)return e.errors}function _o(e,t){return{type:Fv(e),title:$v(e,t),status:Av(e),detail:Bv(e),traceId:Vv(e),errors:Wv(e)}}const pd="/api/",Hv=pd+"account/login",Qv=pd+"account/register";async function Kv(e){try{const t=await fetch(Hv,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json();return{ok:!1,problemDetails:_o(r)}}return{ok:!0,value:await t.json()}}catch{return{ok:!1,problemDetails:_o("An Unknown Error Occurred")}}}async function $g(e){try{const t=await fetch(Qv,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json();return{ok:!1,problemDetails:_o(r)}}return{ok:!0,value:(await t.json()).email}}catch{return{ok:!1,problemDetails:_o("An Unknown Error Occurred")}}}function Yv(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"hsl(var(--s))",className:"w-4 h-4",children:[w.jsx("title",{children:"X"}),w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})]})}function Gv(e){const t=new Array;for(const[n,r]of Object.entries(e))t.push(w.jsx("li",{children:w.jsx("p",{children:r[0]})},n));return t}function Xv(e){let t=null;return e.problemDetails.errors&&(t=Gv(e.problemDetails.errors)),w.jsxs("div",{className:"flex flex-col justify-between items-center py-1",children:[w.jsx("button",{className:"btn btn-sm btn-circle btn-ghost absolute right-0 top-0","aria-label":"close",onClick:()=>ad.dismiss(e.toast.id),children:w.jsx(Yv,{})}),w.jsx("h4",{className:"text-md text-center font-medium",children:e.problemDetails.title}),w.jsxs("div",{className:"text-sm text-left",children:[w.jsx("p",{children:e.problemDetails.detail}),t&&w.jsx("ul",{children:t})]})]})}function Jv(e){ad(t=>w.jsx(Xv,{toast:t,problemDetails:e}),{icon:w.jsx(id,{})})}const Nc={user:void 0,error:void 0,loading:!1},ei=dd(e=>({...Nc,signInUser:async t=>{e({loading:!0});const n=await Kv(t);n.ok?e({user:n.value,loading:!1}):(e({error:n.problemDetails,loading:!1}),Jv(n.problemDetails))},signOutUser:()=>e(Nc)})),Zv="text-secondary",qv="hover:text-primary";function jo(e){return w.jsx("li",{children:w.jsx(Jo,{end:!0,to:e.route,className:({isActive:t})=>t?Zv:qv,children:e.children})})}function bv(){return w.jsxs("svg",{fill:"currentcolor",className:"h-7 w-7",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25.468 25.468",children:[w.jsx("title",{children:"Coffee Cup"}),w.jsx("path",{d:`M19.417,16.694c-0.096,0-0.188,0.02-0.282,0.028c0.096-0.59,0.16-0.658,0.172-1.28 + */var bo=E,Nv=Pv;function Rv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _v=typeof Object.is=="function"?Object.is:Rv,jv=Nv.useSyncExternalStore,Lv=bo.useRef,Dv=bo.useEffect,Tv=bo.useMemo,zv=bo.useDebugValue;sd.useSyncExternalStoreWithSelector=function(e,t,n,r,l){var o=Lv(null);if(o.current===null){var i={hasValue:!1,value:null};o.current=i}else i=o.current;o=Tv(function(){function u(g){if(!s){if(s=!0,c=g,g=r(g),l!==void 0&&i.hasValue){var y=i.value;if(l(y,g))return h=y}return h=g}if(y=h,_v(c,g))return y;var S=r(g);return l!==void 0&&l(y,S)?y:(c=g,h=S)}var s=!1,c,h,m=n===void 0?null:n;return[function(){return u(t())},m===null?void 0:function(){return u(m())}]},[t,n,r,l]);var a=jv(e,o[0],o[1]);return Dv(function(){i.hasValue=!0,i.value=a},[a]),zv(a),a};ud.exports=sd;var Mv=ud.exports;const Ov=_c(Mv),{useSyncExternalStoreWithSelector:Iv}=Ov;function Uv(e,t=e.getState,n){const r=Iv(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return E.useDebugValue(r),r}const Pc=e=>{const t=typeof e=="function"?mv(e):e,n=(r,l)=>Uv(t,r,l);return Object.assign(n,t),n},dd=e=>e?Pc(e):Pc;function Fv(e){if(e&&typeof e=="object"&&"type"in e&&typeof e.type=="string")return e.type}function $v(e,t="Server Error"){if(e&&typeof e=="object"){if("title"in e&&typeof e.title=="string")return e.title;if("statusText"in e&&typeof e.statusText=="string")return e.statusText}return t}function Av(e){return e&&typeof e=="object"&&"status"in e&&typeof e.status=="number"?e.status:500}function Bv(e){if(e&&typeof e=="object"&&"detail"in e&&typeof e.detail=="string")return e.detail}function Vv(e){if(e&&typeof e=="object"&&"traceId"in e&&typeof e.traceId=="string")return e.traceId}function Wv(e){if(e&&typeof e=="object"&&"instance"in e&&typeof e.instance=="string")return e.instance}function Hv(e){if(e&&typeof e=="object"&&"errors"in e&&typeof e.errors=="object"&&e.errors!==null)return e.errors}function _o(e,t){return{type:Fv(e),title:$v(e,t),status:Av(e),detail:Bv(e),traceId:Vv(e),instance:Wv(e),errors:Hv(e)}}const pd="/api/",Qv=pd+"account/login",Kv=pd+"account/register";async function Yv(e){try{const t=await fetch(Qv,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json();return{ok:!1,problemDetails:_o(r)}}return{ok:!0,value:await t.json()}}catch{return{ok:!1,problemDetails:_o("An Unknown Error Occurred")}}}async function Ag(e){try{const t=await fetch(Kv,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json();return{ok:!1,problemDetails:_o(r)}}return{ok:!0,value:(await t.json()).email}}catch{return{ok:!1,problemDetails:_o("An Unknown Error Occurred")}}}function Gv(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"hsl(var(--s))",className:"w-4 h-4",children:[w.jsx("title",{children:"X"}),w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})]})}function Xv(e){const t=new Array;for(const[n,r]of Object.entries(e))t.push(w.jsx("li",{children:w.jsx("p",{children:r[0]})},n));return t}function Jv(e){let t=null;return e.problemDetails.errors&&(t=Xv(e.problemDetails.errors)),w.jsxs("div",{className:"flex flex-col justify-between items-center py-1",children:[w.jsx("button",{className:"btn btn-sm btn-circle btn-ghost absolute right-0 top-0","aria-label":"close",onClick:()=>ad.dismiss(e.toast.id),children:w.jsx(Gv,{})}),w.jsx("h4",{className:"text-md text-center font-medium",children:e.problemDetails.title}),w.jsxs("div",{className:"text-sm text-left",children:[w.jsx("p",{children:e.problemDetails.detail}),t&&w.jsx("ul",{children:t})]})]})}function Zv(e){ad(t=>w.jsx(Jv,{toast:t,problemDetails:e}),{icon:w.jsx(id,{})})}const Nc={user:void 0,error:void 0,loading:!1},ei=dd(e=>({...Nc,signInUser:async t=>{e({loading:!0});const n=await Yv(t);n.ok?e({user:n.value,loading:!1}):(e({error:n.problemDetails,loading:!1}),Zv(n.problemDetails))},signOutUser:()=>e(Nc)})),qv="text-secondary",bv="hover:text-primary";function jo(e){return w.jsx("li",{children:w.jsx(Jo,{end:!0,to:e.route,className:({isActive:t})=>t?qv:bv,children:e.children})})}function eg(){return w.jsxs("svg",{fill:"currentcolor",className:"h-7 w-7",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25.468 25.468",children:[w.jsx("title",{children:"Coffee Cup"}),w.jsx("path",{d:`M19.417,16.694c-0.096,0-0.188,0.02-0.282,0.028c0.096-0.59,0.16-0.658,0.172-1.28 c0.006-0.051,0.016-0.101,0.019-0.154c-0.149-3.101-3.876-4.877-8.076-4.915c-4.203,0.036-7.929,1.813-8.079,4.914 c0.003,0.058,0.016,0.112,0.019,0.168c0-0.002,0-0.002,0-0.002c0.125,5.557,3.681,10.015,8.06,10.015 c2.397,0,4.543-1.344,6.019-3.465c0.526,0.599,1.289,0.98,2.149,0.98c1.588,0,2.878-1.823,2.878-3.412 @@ -328,4 +328,4 @@ to { c-0.004,0.004-0.009,0.007-0.014,0.012c-0.106,0.066-0.203,0.187-0.179,0.322c0.022,0.123,0.164,0.151,0.26,0.092 c0.211-0.129,0.377-0.314,0.493-0.534c0.092-0.172,0.165-0.379,0.159-0.577c-0.003-0.164-0.054-0.367-0.241-0.407 c-0.183-0.04-0.364,0.045-0.518,0.152c-0.106-0.185-0.252-0.358-0.45-0.428C12.753,3.351,12.393,3.67,12.297,3.98z M13.577,4.847 - c-0.001,0.001-0.002,0.001-0.003,0.002C13.623,4.814,13.593,4.837,13.577,4.847z`})]})}const hd=E.memo(bv);function eg(){return w.jsx(jo,{route:ae.home,children:w.jsx("div",{className:"tooltip tooltip-right tooltip-accent pb-1","data-tip":"Home","aria-label":"Home",children:w.jsx(hd,{})})})}function tg(){const e=ei(n=>n.signOutUser),t=()=>{e()};return w.jsx("button",{onClick:t,className:"hover:text-primary",children:"Sign Out"})}function ng(){return w.jsx("li",{children:w.jsx(tg,{})})}function rg(){return w.jsxs(w.Fragment,{children:[w.jsx(jo,{route:ae.signIn,children:"Sign In"}),w.jsx(jo,{route:ae.signUp,children:"Sign Up"})]})}function lg(e){return w.jsxs(w.Fragment,{children:[w.jsx(jo,{route:ae.menu,children:"Menu"}),e.isAuthenticated?w.jsx(ng,{}):w.jsx(rg,{})]})}class md extends Error{constructor(t){super(t),console.error(t)}}function og(e,t,n=1){if(n<1)throw new md("cartItem must have a positive quantity value in addCartItem");if(e.length===0)return new Array(t);if(e.find(o=>o.id===t.id))return e.map(o=>o.id===t.id?{...t,quantity:o.quantity+n}:o);const l=e.slice();return l.push(t),l}function ig(e,t,n){if(e.length===0)return[];if(n){if(n<1)throw new md("quantity must be a positive value in removeCartItem");const r=e.find(o=>o.id===t),l=r?r.quantity-n:0;if(l>0)return e.map(o=>o.id===t?{...o,quantity:l}:o)}return e.filter(r=>r.id!==t)}function ag(e,t){return e.filter(n=>n.id!==t)}function ug(){return new Array}const sg={items:new Array,status:"idle"},cg=dd(e=>({...sg,addCartItem:(t,n)=>e(r=>({items:og(r.items,t,n)})),removeCartItem:(t,n)=>e(r=>({items:ig(r.items,t,n)})),removeAllCartItemsWithId:t=>e(n=>({items:ag(n.items,t)})),clearCart:()=>e({items:ug()})}));function fg(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentcolor",viewBox:"0 0 24 24",className:"h-6 w-6 group-hover:scale-125 ease-in duration-300",children:[w.jsx("title",{children:"Cart"}),w.jsx("path",{d:"M2.25 2.25a.75.75 0 000 1.5h1.386c.17 0 .318.114.362.278l2.558 9.592a3.752 3.752 0 00-2.806 3.63c0 .414.336.75.75.75h15.75a.75.75 0 000-1.5H5.378A2.25 2.25 0 017.5 15h11.218a.75.75 0 00.674-.421 60.358 60.358 0 002.96-7.228.75.75 0 00-.525-.965A60.864 60.864 0 005.68 4.509l-.232-.867A1.875 1.875 0 003.636 2.25H2.25zM3.75 20.25a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zM16.5 20.25a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0z"})]})}const dg=E.memo(fg),vd="hover:bg-base-300 text-primary hover:text-accent",pg="btn btn-circle btn-ghost badge badge-sm badge-secondary"+vd,hg="active text-secondary ",gd="indicator-item badge badge-sm badge-secondary text-secondary-content",mg=gd+" animate-ping";function Rc(e,t,n){return w.jsx(Jo,{end:!0,to:ae.checkout,className:({isActive:r})=>r?hg+e:e,children:w.jsxs("div",{className:"indicator",children:[w.jsx(dg,{}),w.jsx("span",{className:t,children:n})]})},"cartLink")}function yd(e){const[t,n]=E.useState(!0),r=cg(a=>a.items);E.useEffect(()=>{if(r.length===0){t&&n(!1);return}n(!0);const a=setTimeout(()=>{n(!1)},400);return()=>{clearTimeout(a)}},[r]);const l=r.reduce((a,u)=>u.quantity+a,0),o=e.isTopNav?pg:vd,i=t?mg:gd;return e.isTopNav?w.jsx("li",{children:Rc(o,i,l)}):Rc(o,i,l)}function vg(e){return w.jsx("div",{className:"bg-base-100 top-0 sticky opacity-90 hidden md:flex z-20",children:w.jsxs("div",{className:"navbar mx-auto max-w-screen-md",children:[w.jsx("nav",{className:"navbar-start",children:w.jsx("ul",{children:w.jsx(eg,{})})}),w.jsx("nav",{className:"navbar-center",children:w.jsx("ul",{className:"menu menu-horizontal menu-lg px-1",children:w.jsx(lg,{isAuthenticated:e.isAuthenticated})})}),w.jsx("nav",{className:"navbar-end",children:w.jsx("ul",{children:w.jsx(yd,{isTopNav:!0})})})]})})}const gg="hover:bg-base-300 text-primary hover:text-accent ",yg="active text-secondary hover:bg-base-300";function Lo(e){return w.jsx(Jo,{to:e.route,className:({isActive:t})=>t?yg:gg,children:e.children})}function wg(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:[w.jsx("title",{children:"Bag"}),w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 10.5V6a3.75 3.75 0 10-7.5 0v4.5m11.356-1.993l1.263 12c.07.665-.45 1.243-1.119 1.243H4.25a1.125 1.125 0 01-1.12-1.243l1.264-12A1.125 1.125 0 015.513 7.5h12.974c.576 0 1.059.435 1.119 1.007zM8.625 10.5a.375.375 0 11-.75 0 .375.375 0 01.75 0zm7.5 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})]})}function xg(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentcolor",className:"w-6 h-6",children:[w.jsx("title",{children:"Sign Out"}),w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})]})}const Sg="hover:bg-base-300 text-primary hover:text-accent ";function kg(){const e=ei(n=>n.signOutUser),t=()=>{e()};return w.jsx(w.Fragment,{children:w.jsxs("button",{className:Sg,onClick:t,children:[w.jsx(xg,{}),w.jsx("span",{className:"btm-nav-label",children:"Sign Out"})]})})}function Eg(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentcolor",className:"w-6 h-6",children:[w.jsx("title",{children:"Sign Up"}),w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zM4 19.235v-.11a6.375 6.375 0 0112.75 0v.109A12.318 12.318 0 0110.374 21c-2.331 0-4.512-.645-6.374-1.766z"})]})}function Cg(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentcolor",className:"w-6 h-6",fill:"none",children:[w.jsx("title",{children:"Sign In"}),w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75"})]})}function Pg(){return w.jsxs(w.Fragment,{children:[w.jsxs(Lo,{route:ae.signUp,children:[w.jsx(Eg,{}),w.jsx("span",{className:"btm-nav-label",children:"Sign Up"})]}),w.jsxs(Lo,{route:ae.signIn,children:[w.jsx(Cg,{}),w.jsx("span",{className:"btm-nav-label",children:"Sign In"})]})]})}function Ng(e){return w.jsxs(w.Fragment,{children:[w.jsxs(Lo,{route:ae.home,children:[w.jsx(hd,{}),w.jsx("span",{className:"btm-nav-label",children:"Home"})]}),w.jsxs(Lo,{route:ae.menu,children:[w.jsx(wg,{}),w.jsx("span",{className:"btm-nav-label",children:"Order"})]}),e.isAuthenticated?w.jsx(kg,{}):w.jsx(Pg,{}),w.jsx(yd,{isTopNav:!1})]})}function Rg(e){return w.jsx("nav",{className:"btm-nav btm-nav-lg md:hidden",children:w.jsx(Ng,{isAuthenticated:e.isAuthenticated})})}const _g={style:{color:"hsl(var(--bc))",background:"hsl(var(--b1))"}};function jg(){const t=!!ei(n=>n.user);return w.jsxs(w.Fragment,{children:[w.jsx(hv,{position:"top-right",toastOptions:_g}),w.jsx(vg,{isAuthenticated:t}),w.jsx(c1,{}),w.jsx(Rg,{isAuthenticated:t})]})}function Lg(e){return e?`Welcome back ${e.firstName} ${e.lastName}, to `:"Welcome to "}function Dg(){const e=ei(t=>t.user);return w.jsx("main",{className:"hero min-h-full px-6 py-24 sm:py-32 lg:px-8 mb-20 md:mb-0",children:w.jsx("div",{className:"hero-content mt-8 text-center",children:w.jsxs("div",{className:"max-w-md text-gray-900 dark:text-white",children:[w.jsxs("h1",{className:"mb-4 text-3xl font-extrabold md:text-5xl lg:text-6xl",children:[Lg(e),w.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-secondary to-primary",children:"React Roast Dotnet"})," "]}),w.jsx("p",{className:"py-4 text-xl",children:"Order fresh coffee to go"}),w.jsx(Jo,{end:!0,to:ae.menu,className:"link link-secondary link-hover",children:w.jsx("p",{className:"hover:animate-pulse text-2xl ",children:"Order Now!"})})]})})})}function Fl(e){return w.jsx("main",{className:"hero min-h-full px-6 py-24 sm:py-32 lg:px-8 mb-20 md:mb-0",children:w.jsx("div",{className:"hero-content mt-8 text-center",children:w.jsxs("div",{className:"max-w-md text-gray-900 dark:text-white",children:[w.jsxs("h1",{className:"mb-4 text-3xl font-extrabold md:text-5xl lg:text-6xl",children:[w.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-secondary to-primary",children:"Loading"})," "]}),w.jsxs("p",{className:"py-4 text-xl",children:[e.pageName," page..."]}),w.jsx("progress",{className:"progress w-56 progress-secondary"})]})})})}function Tg(){return w.jsx("main",{className:"hero min-h-full px-6 py-24 sm:py-32 lg:px-8 mb-20 md:mb-0",children:w.jsx("div",{className:"hero-content text-center",children:w.jsxs("div",{className:"max-w-md",children:[w.jsx("h1",{className:"text-5xl font-bold",children:w.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-secondary to-primary",children:"404"})}),w.jsx("h2",{className:"text-3xl font-bold sm:text-5xl",children:"Page not found"}),w.jsx("p",{className:"py-6",children:"Sorry, we could not find the page you were looking for."}),w.jsx("div",{className:"mt-2 flex items-center justify-center gap-x-6",children:w.jsx(nd,{to:ae.home,className:"btn btn-primary",children:"Go back home"})})]})})})}const zg=E.lazy(()=>Zo(()=>import("./MenuPage-5f9486b5.js"),[])),Mg=E.lazy(()=>Zo(()=>import("./CheckoutPage-5fc6fad4.js"),["assets/CheckoutPage-5fc6fad4.js","assets/AuthInput-dc4b44dd.js"])),Og=E.lazy(()=>Zo(()=>import("./SignInPage-954f9f5e.js"),["assets/SignInPage-954f9f5e.js","assets/AuthInput-dc4b44dd.js","assets/AuthFormHeader-c7daf50a.js"])),Ig=E.lazy(()=>Zo(()=>import("./SignUpPage-8aa89d65.js"),["assets/SignUpPage-8aa89d65.js","assets/AuthInput-dc4b44dd.js","assets/AuthFormHeader-c7daf50a.js"])),ae={home:"/",menu:"/menu",checkout:"/checkout",signIn:"/auth/sign-in",signUp:"/auth/sign-up",notFound:"/not-found"},Ug=y1([{path:"/",element:w.jsx(jg,{}),children:[{path:ae.home,element:w.jsx(Dg,{})},{path:ae.menu,element:w.jsx(E.Suspense,{fallback:w.jsx(Fl,{pageName:ae.menu}),children:w.jsx(zg,{})})},{path:ae.checkout,element:w.jsx(E.Suspense,{fallback:w.jsx(Fl,{pageName:ae.checkout}),children:w.jsx(Mg,{})})},{path:ae.signIn,element:w.jsx(E.Suspense,{fallback:w.jsx(Fl,{pageName:ae.signIn}),children:w.jsx(Og,{})})},{path:ae.signUp,element:w.jsx(E.Suspense,{fallback:w.jsx(Fl,{pageName:ae.signUp}),children:w.jsx(Ig,{})})},{path:ae.notFound,element:w.jsx(Tg,{})},{path:"*",element:w.jsx(s1,{replace:!0,to:ae.notFound})}]}]);Ui.createRoot(document.getElementById("root")).render(w.jsx(Fc.StrictMode,{children:w.jsx(a1,{router:Ug})}));export{hd as C,nd as L,s1 as N,Fc as R,ad as _,Fg as a,ei as b,Cn as c,$g as d,Jv as e,w as j,ae as p,E as r,Pv as s,cg as u}; + c-0.001,0.001-0.002,0.001-0.003,0.002C13.623,4.814,13.593,4.837,13.577,4.847z`})]})}const hd=E.memo(eg);function tg(){return w.jsx(jo,{route:ae.home,children:w.jsx("div",{className:"tooltip tooltip-right tooltip-accent pb-1","data-tip":"Home","aria-label":"Home",children:w.jsx(hd,{})})})}function ng(){const e=ei(n=>n.signOutUser),t=()=>{e()};return w.jsx("button",{onClick:t,className:"hover:text-primary",children:"Sign Out"})}function rg(){return w.jsx("li",{children:w.jsx(ng,{})})}function lg(){return w.jsxs(w.Fragment,{children:[w.jsx(jo,{route:ae.signIn,children:"Sign In"}),w.jsx(jo,{route:ae.signUp,children:"Sign Up"})]})}function og(e){return w.jsxs(w.Fragment,{children:[w.jsx(jo,{route:ae.menu,children:"Menu"}),e.isAuthenticated?w.jsx(rg,{}):w.jsx(lg,{})]})}class md extends Error{constructor(t){super(t),console.error(t)}}function ig(e,t,n=1){if(n<1)throw new md("cartItem must have a positive quantity value in addCartItem");if(e.length===0)return new Array(t);if(e.find(o=>o.id===t.id))return e.map(o=>o.id===t.id?{...t,quantity:o.quantity+n}:o);const l=e.slice();return l.push(t),l}function ag(e,t,n){if(e.length===0)return[];if(n){if(n<1)throw new md("quantity must be a positive value in removeCartItem");const r=e.find(o=>o.id===t),l=r?r.quantity-n:0;if(l>0)return e.map(o=>o.id===t?{...o,quantity:l}:o)}return e.filter(r=>r.id!==t)}function ug(e,t){return e.filter(n=>n.id!==t)}function sg(){return new Array}const cg={items:new Array,status:"idle"},fg=dd(e=>({...cg,addCartItem:(t,n)=>e(r=>({items:ig(r.items,t,n)})),removeCartItem:(t,n)=>e(r=>({items:ag(r.items,t,n)})),removeAllCartItemsWithId:t=>e(n=>({items:ug(n.items,t)})),clearCart:()=>e({items:sg()})}));function dg(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentcolor",viewBox:"0 0 24 24",className:"h-6 w-6 group-hover:scale-125 ease-in duration-300",children:[w.jsx("title",{children:"Cart"}),w.jsx("path",{d:"M2.25 2.25a.75.75 0 000 1.5h1.386c.17 0 .318.114.362.278l2.558 9.592a3.752 3.752 0 00-2.806 3.63c0 .414.336.75.75.75h15.75a.75.75 0 000-1.5H5.378A2.25 2.25 0 017.5 15h11.218a.75.75 0 00.674-.421 60.358 60.358 0 002.96-7.228.75.75 0 00-.525-.965A60.864 60.864 0 005.68 4.509l-.232-.867A1.875 1.875 0 003.636 2.25H2.25zM3.75 20.25a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zM16.5 20.25a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0z"})]})}const pg=E.memo(dg),vd="hover:bg-base-300 text-primary hover:text-accent",hg="btn btn-circle btn-ghost badge badge-sm badge-secondary"+vd,mg="active text-secondary ",gd="indicator-item badge badge-sm badge-secondary text-secondary-content",vg=gd+" animate-ping";function Rc(e,t,n){return w.jsx(Jo,{end:!0,to:ae.checkout,className:({isActive:r})=>r?mg+e:e,children:w.jsxs("div",{className:"indicator",children:[w.jsx(pg,{}),w.jsx("span",{className:t,children:n})]})},"cartLink")}function yd(e){const[t,n]=E.useState(!0),r=fg(a=>a.items);E.useEffect(()=>{if(r.length===0){t&&n(!1);return}n(!0);const a=setTimeout(()=>{n(!1)},400);return()=>{clearTimeout(a)}},[r]);const l=r.reduce((a,u)=>u.quantity+a,0),o=e.isTopNav?hg:vd,i=t?vg:gd;return e.isTopNav?w.jsx("li",{children:Rc(o,i,l)}):Rc(o,i,l)}function gg(e){return w.jsx("div",{className:"bg-base-100 top-0 sticky opacity-90 hidden md:flex z-20",children:w.jsxs("div",{className:"navbar mx-auto max-w-screen-md",children:[w.jsx("nav",{className:"navbar-start",children:w.jsx("ul",{children:w.jsx(tg,{})})}),w.jsx("nav",{className:"navbar-center",children:w.jsx("ul",{className:"menu menu-horizontal menu-lg px-1",children:w.jsx(og,{isAuthenticated:e.isAuthenticated})})}),w.jsx("nav",{className:"navbar-end",children:w.jsx("ul",{children:w.jsx(yd,{isTopNav:!0})})})]})})}const yg="hover:bg-base-300 text-primary hover:text-accent ",wg="active text-secondary hover:bg-base-300";function Lo(e){return w.jsx(Jo,{to:e.route,className:({isActive:t})=>t?wg:yg,children:e.children})}function xg(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:[w.jsx("title",{children:"Bag"}),w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 10.5V6a3.75 3.75 0 10-7.5 0v4.5m11.356-1.993l1.263 12c.07.665-.45 1.243-1.119 1.243H4.25a1.125 1.125 0 01-1.12-1.243l1.264-12A1.125 1.125 0 015.513 7.5h12.974c.576 0 1.059.435 1.119 1.007zM8.625 10.5a.375.375 0 11-.75 0 .375.375 0 01.75 0zm7.5 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})]})}function Sg(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentcolor",className:"w-6 h-6",children:[w.jsx("title",{children:"Sign Out"}),w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})]})}const kg="hover:bg-base-300 text-primary hover:text-accent ";function Eg(){const e=ei(n=>n.signOutUser),t=()=>{e()};return w.jsx(w.Fragment,{children:w.jsxs("button",{className:kg,onClick:t,children:[w.jsx(Sg,{}),w.jsx("span",{className:"btm-nav-label",children:"Sign Out"})]})})}function Cg(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentcolor",className:"w-6 h-6",children:[w.jsx("title",{children:"Sign Up"}),w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zM4 19.235v-.11a6.375 6.375 0 0112.75 0v.109A12.318 12.318 0 0110.374 21c-2.331 0-4.512-.645-6.374-1.766z"})]})}function Pg(){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentcolor",className:"w-6 h-6",fill:"none",children:[w.jsx("title",{children:"Sign In"}),w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75"})]})}function Ng(){return w.jsxs(w.Fragment,{children:[w.jsxs(Lo,{route:ae.signUp,children:[w.jsx(Cg,{}),w.jsx("span",{className:"btm-nav-label",children:"Sign Up"})]}),w.jsxs(Lo,{route:ae.signIn,children:[w.jsx(Pg,{}),w.jsx("span",{className:"btm-nav-label",children:"Sign In"})]})]})}function Rg(e){return w.jsxs(w.Fragment,{children:[w.jsxs(Lo,{route:ae.home,children:[w.jsx(hd,{}),w.jsx("span",{className:"btm-nav-label",children:"Home"})]}),w.jsxs(Lo,{route:ae.menu,children:[w.jsx(xg,{}),w.jsx("span",{className:"btm-nav-label",children:"Order"})]}),e.isAuthenticated?w.jsx(Eg,{}):w.jsx(Ng,{}),w.jsx(yd,{isTopNav:!1})]})}function _g(e){return w.jsx("nav",{className:"btm-nav btm-nav-lg md:hidden",children:w.jsx(Rg,{isAuthenticated:e.isAuthenticated})})}const jg={style:{color:"hsl(var(--bc))",background:"hsl(var(--b1))"}};function Lg(){const t=!!ei(n=>n.user);return w.jsxs(w.Fragment,{children:[w.jsx(hv,{position:"top-right",toastOptions:jg}),w.jsx(gg,{isAuthenticated:t}),w.jsx(c1,{}),w.jsx(_g,{isAuthenticated:t})]})}function Dg(e){return e?`Welcome back ${e.firstName} ${e.lastName}, to `:"Welcome to "}function Tg(){const e=ei(t=>t.user);return w.jsx("main",{className:"hero min-h-full px-6 py-24 sm:py-32 lg:px-8 mb-20 md:mb-0",children:w.jsx("div",{className:"hero-content mt-8 text-center",children:w.jsxs("div",{className:"max-w-md text-gray-900 dark:text-white",children:[w.jsxs("h1",{className:"mb-4 text-3xl font-extrabold md:text-5xl lg:text-6xl",children:[Dg(e),w.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-secondary to-primary",children:"React Roast Dotnet"})," "]}),w.jsx("p",{className:"py-4 text-xl",children:"Order fresh coffee to go"}),w.jsx(Jo,{end:!0,to:ae.menu,className:"link link-secondary link-hover",children:w.jsx("p",{className:"hover:animate-pulse text-2xl ",children:"Order Now!"})})]})})})}function Fl(e){return w.jsx("main",{className:"hero min-h-full px-6 py-24 sm:py-32 lg:px-8 mb-20 md:mb-0",children:w.jsx("div",{className:"hero-content mt-8 text-center",children:w.jsxs("div",{className:"max-w-md text-gray-900 dark:text-white",children:[w.jsxs("h1",{className:"mb-4 text-3xl font-extrabold md:text-5xl lg:text-6xl",children:[w.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-secondary to-primary",children:"Loading"})," "]}),w.jsxs("p",{className:"py-4 text-xl",children:[e.pageName," page..."]}),w.jsx("progress",{className:"progress w-56 progress-secondary"})]})})})}function zg(){return w.jsx("main",{className:"hero min-h-full px-6 py-24 sm:py-32 lg:px-8 mb-20 md:mb-0",children:w.jsx("div",{className:"hero-content text-center",children:w.jsxs("div",{className:"max-w-md",children:[w.jsx("h1",{className:"text-5xl font-bold",children:w.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-secondary to-primary",children:"404"})}),w.jsx("h2",{className:"text-3xl font-bold sm:text-5xl",children:"Page not found"}),w.jsx("p",{className:"py-6",children:"Sorry, we could not find the page you were looking for."}),w.jsx("div",{className:"mt-2 flex items-center justify-center gap-x-6",children:w.jsx(nd,{to:ae.home,className:"btn btn-primary",children:"Go back home"})})]})})})}const Mg=E.lazy(()=>Zo(()=>import("./MenuPage-343d66e6.js"),[])),Og=E.lazy(()=>Zo(()=>import("./CheckoutPage-f0e038d7.js"),["assets/CheckoutPage-f0e038d7.js","assets/AuthInput-179d8048.js"])),Ig=E.lazy(()=>Zo(()=>import("./SignInPage-9444f052.js"),["assets/SignInPage-9444f052.js","assets/AuthInput-179d8048.js","assets/AuthFormHeader-e50a937c.js"])),Ug=E.lazy(()=>Zo(()=>import("./SignUpPage-2bdafc56.js"),["assets/SignUpPage-2bdafc56.js","assets/AuthInput-179d8048.js","assets/AuthFormHeader-e50a937c.js"])),ae={home:"/",menu:"/menu",checkout:"/checkout",signIn:"/auth/sign-in",signUp:"/auth/sign-up",notFound:"/not-found"},Fg=y1([{path:"/",element:w.jsx(Lg,{}),children:[{path:ae.home,element:w.jsx(Tg,{})},{path:ae.menu,element:w.jsx(E.Suspense,{fallback:w.jsx(Fl,{pageName:ae.menu}),children:w.jsx(Mg,{})})},{path:ae.checkout,element:w.jsx(E.Suspense,{fallback:w.jsx(Fl,{pageName:ae.checkout}),children:w.jsx(Og,{})})},{path:ae.signIn,element:w.jsx(E.Suspense,{fallback:w.jsx(Fl,{pageName:ae.signIn}),children:w.jsx(Ig,{})})},{path:ae.signUp,element:w.jsx(E.Suspense,{fallback:w.jsx(Fl,{pageName:ae.signUp}),children:w.jsx(Ug,{})})},{path:ae.notFound,element:w.jsx(zg,{})},{path:"*",element:w.jsx(s1,{replace:!0,to:ae.notFound})}]}]);Ui.createRoot(document.getElementById("root")).render(w.jsx(Fc.StrictMode,{children:w.jsx(a1,{router:Fg})}));export{hd as C,nd as L,s1 as N,Fc as R,ad as _,$g as a,ei as b,Cn as c,Ag as d,Zv as e,w as j,ae as p,E as r,Pv as s,fg as u}; diff --git a/ReactRoastDotnet.API/wwwroot/index.html b/ReactRoastDotnet.API/wwwroot/index.html index 93704ec..f2fa475 100644 --- a/ReactRoastDotnet.API/wwwroot/index.html +++ b/ReactRoastDotnet.API/wwwroot/index.html @@ -13,7 +13,7 @@ React Roast.NET - + diff --git a/ReactRoastDotnet.Client/package-lock.json b/ReactRoastDotnet.Client/package-lock.json index da053fa..a3ec1ea 100644 --- a/ReactRoastDotnet.Client/package-lock.json +++ b/ReactRoastDotnet.Client/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0", "dependencies": { "@headlessui/react": "^1.7.15", + "problem-details-mapper": "^1.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-hook-form": "^7.45.2", @@ -2723,6 +2724,11 @@ "node": ">= 0.8.0" } }, + "node_modules/problem-details-mapper": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/problem-details-mapper/-/problem-details-mapper-1.0.0.tgz", + "integrity": "sha512-QP05CcaEpRyEFThcwgHUVcXtd72jZyjCfikLfDns1ceMw9yEp/agz1bkgh6SKyEe+5AI3h96bbbu6ABFnOc0GQ==" + }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", diff --git a/ReactRoastDotnet.Client/package.json b/ReactRoastDotnet.Client/package.json index 85503e5..fa73a6e 100644 --- a/ReactRoastDotnet.Client/package.json +++ b/ReactRoastDotnet.Client/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "@headlessui/react": "^1.7.15", + "problem-details-mapper": "^1.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-hook-form": "^7.45.2", diff --git a/ReactRoastDotnet.Client/src/api/getRequest.ts b/ReactRoastDotnet.Client/src/api/getRequest.ts index 6c2a06e..7583558 100644 --- a/ReactRoastDotnet.Client/src/api/getRequest.ts +++ b/ReactRoastDotnet.Client/src/api/getRequest.ts @@ -1,6 +1,6 @@ import toast from "react-hot-toast"; // My imports. -import getProblemDetails from "../problem-details/getProblemDetails.ts"; +import getProblemDetails from "problem-details-mapper"; import problemToast from "../toast/problemToast.tsx"; const baseURL = import.meta.env.VITE_API_URL as string; diff --git a/ReactRoastDotnet.Client/src/models/Result.ts b/ReactRoastDotnet.Client/src/models/Result.ts index 0c0a88d..2391609 100644 --- a/ReactRoastDotnet.Client/src/models/Result.ts +++ b/ReactRoastDotnet.Client/src/models/Result.ts @@ -1,5 +1,5 @@ // My import. -import ProblemDetails from "../problem-details/ProblemDetails.ts"; +import type {ProblemDetails} from "problem-details-mapper"; type Result = | { ok: true; value: T } diff --git a/ReactRoastDotnet.Client/src/problem-details/ProblemDetails.ts b/ReactRoastDotnet.Client/src/problem-details/ProblemDetails.ts deleted file mode 100644 index 16e2025..0000000 --- a/ReactRoastDotnet.Client/src/problem-details/ProblemDetails.ts +++ /dev/null @@ -1,10 +0,0 @@ -interface ProblemDetails { - type?: string; - title: string; - status: number; - detail?: string; - traceId?: string; - errors?: Record -} - -export default ProblemDetails; diff --git a/ReactRoastDotnet.Client/src/problem-details/getProblemDetails.ts b/ReactRoastDotnet.Client/src/problem-details/getProblemDetails.ts deleted file mode 100644 index 37943cf..0000000 --- a/ReactRoastDotnet.Client/src/problem-details/getProblemDetails.ts +++ /dev/null @@ -1,66 +0,0 @@ -// My import. -import type ProblemDetails from "./ProblemDetails.ts"; - -function getType(result: unknown): string | undefined { - if (!!result && typeof result === "object" && "type" in result && typeof result.type === "string") { - return result.type; - } -} - -function getTitle(result: unknown, errorMessage = "Server Error"): string { - if(!!result && typeof result === "object"){ - if ("title" in result && typeof result.title === "string") { - return result.title; - } - // If the response only returns a string with failed status code. - if ("statusText" in result && typeof result.statusText === "string") { - return result.statusText; - } - } - // Default to the error message or to Server Error. - return errorMessage; -} - -function getStatus(result: unknown): number { - if (!!result && typeof result === "object" && "status" in result && typeof result.status === "number") { - return result.status; - } - // Default to a server error. - return 500; -} - -function getDetail(result: unknown): string | undefined { - if (!!result && typeof result === "object" && "detail" in result && typeof result.detail === "string") { - return result.detail; - } -} - -function getTraceId(result: unknown): string | undefined { - if (!!result && typeof result === "object" && "traceId" in result && typeof result.traceId === "string") { - return result.traceId; - } -} - -function getErrors(result: unknown): Record | undefined { - if (!!result - && typeof result === "object" - && "errors" in result - && typeof result.errors === "object" - && result.errors !== null - ) { - return result.errors as Record; - } -} - -function getProblemDetails(responseResult: unknown, errorMessage?: string): ProblemDetails { - return { - type: getType(responseResult), - title: getTitle(responseResult, errorMessage), - status: getStatus(responseResult), - detail: getDetail(responseResult), - traceId: getTraceId(responseResult), - errors: getErrors(responseResult) - }; -} - -export default getProblemDetails; diff --git a/ReactRoastDotnet.Client/src/store/userActions.ts b/ReactRoastDotnet.Client/src/store/userActions.ts index b3be103..13b36f5 100644 --- a/ReactRoastDotnet.Client/src/store/userActions.ts +++ b/ReactRoastDotnet.Client/src/store/userActions.ts @@ -2,7 +2,7 @@ import type AuthUser from "../models/AuthUser"; import type LoginRequest from "../models/LoginRequest.ts"; import type Result from "../models/Result.ts"; import type UserSignUpRequest from "../models/UserSignUpRequest.ts"; -import getProblemDetails from "../problem-details/getProblemDetails.ts"; +import getProblemDetails from "problem-details-mapper"; const BASE_URL = import.meta.env.VITE_API_URL as string; const ACCOUNT_LOGIN_URL = BASE_URL + "account/login"; diff --git a/ReactRoastDotnet.Client/src/store/userStore.ts b/ReactRoastDotnet.Client/src/store/userStore.ts index 45ce61e..89c33f3 100644 --- a/ReactRoastDotnet.Client/src/store/userStore.ts +++ b/ReactRoastDotnet.Client/src/store/userStore.ts @@ -2,7 +2,7 @@ import {create} from "zustand"; // My imports. import type AuthUser from "../models/AuthUser"; import type LoginRequest from "../models/LoginRequest.ts"; -import type ProblemDetails from "../problem-details/ProblemDetails.ts"; +import type {ProblemDetails} from "problem-details-mapper"; import {signIn} from "./userActions.ts"; import problemToast from "../toast/problemToast.tsx"; diff --git a/ReactRoastDotnet.Client/src/toast/ProblemDetailsToast.tsx b/ReactRoastDotnet.Client/src/toast/ProblemDetailsToast.tsx index a104056..882a919 100644 --- a/ReactRoastDotnet.Client/src/toast/ProblemDetailsToast.tsx +++ b/ReactRoastDotnet.Client/src/toast/ProblemDetailsToast.tsx @@ -2,7 +2,7 @@ import type {ReactNode} from "react"; import type {Toast} from "react-hot-toast"; import toast from "react-hot-toast"; // My imports. -import type ProblemDetails from "../problem-details/ProblemDetails.ts"; +import type {ProblemDetails} from "problem-details-mapper"; import XMarkIcon from "../icons/XMarkIcon.tsx"; type Props = { diff --git a/ReactRoastDotnet.Client/src/toast/problemToast.tsx b/ReactRoastDotnet.Client/src/toast/problemToast.tsx index ee0991f..14d9917 100644 --- a/ReactRoastDotnet.Client/src/toast/problemToast.tsx +++ b/ReactRoastDotnet.Client/src/toast/problemToast.tsx @@ -1,6 +1,6 @@ import toast, {ErrorIcon} from "react-hot-toast"; // My Imports. -import type ProblemDetails from "../problem-details/ProblemDetails.ts"; +import type {ProblemDetails} from "problem-details-mapper"; import ProblemDetailsToast from "./ProblemDetailsToast.tsx"; function problemToast(problemDetails: ProblemDetails) {