From bdac7b6eb623cf46749a2b48100ba2d31c46177c Mon Sep 17 00:00:00 2001 From: acheung-94 Date: Tue, 30 Apr 2024 16:58:33 -0700 Subject: [PATCH] adjust wave layering and complexity --- frontend/dist/assets/{index-baaaec33.js => index-d13e05a3.js} | 4 ++-- frontend/dist/index.html | 2 +- frontend/src/components/Auth/Auth.jsx | 2 +- frontend/src/components/Dashboard/Dashboard.jsx | 2 +- frontend/src/components/Home/Home.jsx | 2 +- frontend/src/components/PetProfile/PetProfile.jsx | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) rename frontend/dist/assets/{index-baaaec33.js => index-d13e05a3.js} (86%) diff --git a/frontend/dist/assets/index-baaaec33.js b/frontend/dist/assets/index-d13e05a3.js similarity index 86% rename from frontend/dist/assets/index-baaaec33.js rename to frontend/dist/assets/index-d13e05a3.js index 095c097..6e6a71f 100644 --- a/frontend/dist/assets/index-baaaec33.js +++ b/frontend/dist/assets/index-d13e05a3.js @@ -835,8 +835,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var _a=_;function Jw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qw=typeof Object.is=="function"?Object.is:Jw,Zw=_a.useSyncExternalStore,e2=_a.useRef,t2=_a.useEffect,n2=_a.useMemo,r2=_a.useDebugValue;bv.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=e2(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=n2(function(){function s(g){if(!c){if(c=!0,f=g,g=r(g),i!==void 0&&o.hasValue){var y=o.value;if(i(y,g))return d=y}return d=g}if(y=d,qw(f,g))return y;var w=r(g);return i!==void 0&&i(y,w)?y:(f=g,d=w)}var c=!1,f,d,m=n===void 0?null:n;return[function(){return s(t())},m===null?void 0:function(){return s(m())}]},[t,n,r,i]);var l=Zw(e,a[0],a[1]);return t2(function(){o.hasValue=!0,o.value=l},[l]),r2(l),l};Ev.exports=bv;var i2=Ev.exports,yt="default"in ps?ya:ps,ep=Symbol.for("react-redux-context"),tp=typeof globalThis<"u"?globalThis:{};function a2(){if(!yt.createContext)return{};const e=tp[ep]??(tp[ep]=new Map);let t=e.get(yt.createContext);return t||(t=yt.createContext(null),e.set(yt.createContext,t)),t}var Yn=a2(),o2=()=>{throw new Error("uSES not initialized!")};function Bc(e=Yn){return function(){return yt.useContext(e)}}var jv=Bc(),Nv=o2,l2=e=>{Nv=e},s2=(e,t)=>e===t;function u2(e=Yn){const t=e===Yn?jv:Bc(e),n=(r,i={})=>{const{equalityFn:a=s2,devModeChecks:o={}}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:s,getServerState:c,stabilityCheck:f,identityFunctionCheck:d}=t();yt.useRef(!0);const m=yt.useCallback({[r.name](y){return r(y)}}[r.name],[r,f,o.stabilityCheck]),g=Nv(s.addNestedSub,l.getState,c||l.getState,m,a);return yt.useDebugValue(g),g};return Object.assign(n,{withTypes:()=>n}),n}var Jt=u2();function c2(e){e()}function f2(){let e=null,t=null;return{clear(){e=null,t=null},notify(){c2(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var np={notify(){},get:()=>[]};function d2(e,t){let n,r=np,i=0,a=!1;function o(w){f();const E=r.subscribe(w);let h=!1;return()=>{h||(h=!0,E(),d())}}function l(){r.notify()}function s(){y.onStateChange&&y.onStateChange()}function c(){return a}function f(){i++,n||(n=t?t.addNestedSub(s):e.subscribe(s),r=f2())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=np)}function m(){a||(a=!0,f())}function g(){a&&(a=!1,d())}const y={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:s,isSubscribed:c,trySubscribe:m,tryUnsubscribe:g,getListeners:()=>r};return y}var p2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",m2=typeof navigator<"u"&&navigator.product==="ReactNative",h2=p2||m2?yt.useLayoutEffect:yt.useEffect;function v2({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",identityFunctionCheck:a="once"}){const o=yt.useMemo(()=>{const c=d2(e);return{store:e,subscription:c,getServerState:r?()=>r:void 0,stabilityCheck:i,identityFunctionCheck:a}},[e,r,i,a]),l=yt.useMemo(()=>e.getState(),[e]);h2(()=>{const{subscription:c}=o;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),l!==e.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[o,l]);const s=t||Yn;return yt.createElement(s.Provider,{value:o},n)}var g2=v2;function Cv(e=Yn){const t=e===Yn?jv:Bc(e),n=()=>{const{store:r}=t();return r};return Object.assign(n,{withTypes:()=>n}),n}var y2=Cv();function x2(e=Yn){const t=e===Yn?y2:Cv(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Ot=x2();l2(i2.useSyncExternalStoreWithSelector);const qt=async(e,t={})=>{t.method=t.method||"GET",t.headers=t.headers||{};const n=localStorage.getItem("jwtToken");n&&(t.headers.Authorization="Bearer "+n),t.method.toUpperCase()!=="GET"&&(t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.headers["CSRF-Token"]=Wc("CSRF-TOKEN"));const r=await fetch(e,t);if(r.status>=400)throw r;return r},Wc=e=>{const t=document.cookie.split(";");for(let n of t){const[r,i]=n.split("=");if(r.trim()===e)return i}return null},w2=e=>qt("/api/users/register",{method:"POST",body:JSON.stringify(e)}),S2=e=>qt("/api/users/login",{method:"POST",body:JSON.stringify(e)}),k2=()=>qt("/api/users/sessionRestore"),Hc=({user:e,token:t,issued:n,expiresSeconds:r})=>{const i=new Date(n),a=new Date(i.getTime()+r*1e3);e.sessionExpiration=a.toISOString(),localStorage.setItem("jwtToken",t),localStorage.setItem("currentUser",JSON.stringify(e))},Pv="session/SET_CURRENT_USER",_v="sesison/REMOVE_CURRENT_USER",E2="session/SET_EXPIRATION",Yc=e=>({type:Pv,sessionInfo:e}),b2=()=>({type:_v}),j2=e=>t=>w2(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>{Hc(n),t(Yc(n.user))}),Rv=e=>t=>S2(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>{Hc(n),t(Yc(n.user))}),Cu=()=>e=>{localStorage.removeItem("jwtToken"),localStorage.removeItem("currentUser"),e(b2())},N2=()=>e=>{k2().then(t=>{if(t.ok)return t.json();throw t}).then(t=>{Hc(t),e(Yc(t.user))})},El=e=>e.session,C2=JSON.parse(localStorage.getItem("currentUser"))||null,P2=(e=C2,t)=>{switch(t.type){case Pv:return t.sessionInfo;case _v:return null;case E2:return t.expiresAt;default:return e}},Tv="errors/SESSION_ALERT",Pu=e=>({type:Tv,boolean:e}),_2=e=>e.errors.session,R2={session:!1},T2=(e=R2,t)=>{const n={...e};switch(t.type){case Tv:return{...n,session:t.boolean};default:return e}};const O2=()=>{const e=Ot(),t=ja(),n=()=>{e(Pu(!1)),t("/login")},r=()=>{e(Cu()),e(Pu(!1)),t("/")};return u.jsx("div",{className:"session-alert-bg",children:u.jsxs("div",{className:"session-alert",children:[u.jsx("h3",{children:"Oh no! Your session has expired. "}),u.jsx("h3",{children:"Click below to log in again."}),u.jsx("button",{onClick:n,children:"Go to Login"}),u.jsx("button",{onClick:r,children:"Log out"})]})})},Kc=()=>{const e=Jt(El),t=Jt(_2),n=Ot(),r=Jn(),i=ja();return _.useEffect(()=>{if(e&&e.sessionExpiration){const a=setInterval(()=>{const o=Date.now(),l=new Date(e.sessionExpiration).getTime();o>=l-5e3&&(n(N2()),clearInterval(a))},500);return()=>{clearInterval(a)}}},[e,n]),_.useEffect(()=>{const a=r.pathname==="/login",o=r.pathname==="/",l=r.pathname==="/register";if(e&&e.sessionExpiration){const s=Date.now(),c=new Date(e.sessionExpiration).getTime();s>=c&&!a&&n(Pu(!0)),s>=c&&o&&n(Cu())}else!o&&!a&&!l&&i("/login")},[r,e,n,i]),u.jsxs("div",{children:[u.jsxs("div",{className:"navbar-container",children:[u.jsxs("div",{className:"title-section",children:[u.jsx("span",{children:u.jsx($e,{to:"/",children:u.jsx("img",{className:"nav-icon",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/Frame.svg"})})}),u.jsx("span",{className:"pet-portal-title",children:u.jsx($e,{to:"/",children:"Pet Portal"})})]}),u.jsx("div",{className:"auth-section",children:e?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"logout-button-container",children:[u.jsx("span",{className:"marker"}),u.jsx(X0,{to:"/dashboard",children:"Dashboard"})]}),u.jsx("span",{className:"deco-1"}),u.jsxs("div",{className:"logout-button-container",onClick:()=>n(Cu()),children:[u.jsx("span",{className:"marker"}),u.jsx($e,{to:"/",children:"Log out"})]})]}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"login-button-container",children:[u.jsx($e,{to:"/login",children:"Log in"}),u.jsx("span",{className:"marker"})]}),u.jsx("span",{className:"deco-1"}),u.jsxs("div",{className:"signup-button-container",children:[u.jsx("span",{className:"marker"}),u.jsx($e,{to:"/register",children:"Sign up"})]})]})})]}),t&&u.jsx(O2,{})]})};const rp=()=>{const e=Ot(),t=ja(),[n,r]=_.useState(),i=()=>{e(Rv({email:"demo@demo.com",password:"password"})).then(()=>t("/dashboard"))};return _.useEffect(()=>{r(!0)},[]),u.jsxs("div",{className:"home-page-container",children:[u.jsx(Kc,{}),u.jsx("div",{className:"welcome-container-1",children:u.jsxs("div",{className:"section-1",children:[u.jsx("img",{className:"bg-image",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/layered-waves-haikei+adjusted.svg"}),u.jsx("div",{className:"display-container",children:u.jsx("div",{className:"display-border",children:u.jsx("img",{className:"display-dog",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/depositphotos_570233356-stock-photo-australian-cattle-dog-forest-hiking.jpg"})})}),u.jsxs("div",{className:"section-1-text",children:[u.jsxs("div",{className:`welcome-heading ${n&&"loaded"}`,children:[u.jsx("h1",{children:"Welcome to Pet Portal."}),u.jsx("span",{className:"deco-1"}),u.jsx("span",{className:"deco-3"})]}),u.jsxs("div",{className:"welcome-message",children:[u.jsx("div",{className:"welcome-message-1",children:u.jsx("p",{children:"Whether you're a seasoned pet parent or embarking on your journey with a new furry friend, Pet Portal is here to simplify your pet care routine."})}),u.jsx("div",{className:"welcome-message-2",children:u.jsx("p",{children:"Keep track of your pet's important information, health reminders, and appointments all in one convenient location!"})}),u.jsx("div",{className:"welcome-message-3",children:u.jsxs("div",{className:"welcome-links",children:[u.jsx("h3",{children:" Ready to get started? "}),u.jsx("div",{className:"demo-login",onClick:i,children:"Try it out"})]})})]})]})]})}),u.jsx(kv,{})]})};const ip=()=>{const e=Jn(),{pathname:t}=e,n=Ot(),r=t==="/register",i=t==="/login",a=ja(),[o,l]=_.useState(""),[s,c]=_.useState(""),[f,d]=_.useState(""),[m,g]=_.useState(""),[y,w]=_.useState(""),[E,h]=_.useState(!1),p=v=>{v.preventDefault(),r?n(j2({email:o,password:s})).then(()=>a("/dashboard")).catch(j=>{j.ok||j.json().then(R=>w(R.email))}):i&&n(Rv({email:o,password:s})).then(()=>a("/dashboard")).catch(j=>{j.ok||g("Invalid credentials")}),l(""),c(""),d("")};return _.useEffect(()=>{l(""),c(""),d(""),g(""),w(""),h(!1)},[e.pathname]),_.useEffect(()=>{h(!!(s!==f&&r))},[s,f,r]),u.jsxs(u.Fragment,{children:[u.jsx(Kc,{}),u.jsxs("div",{className:"below-navbar",children:[u.jsxs("div",{className:"content-container",children:[u.jsx("img",{className:"bg-image",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/layered-waves-haikei+adjusted.svg"}),u.jsxs("div",{className:"session-form-container",children:[u.jsx("div",{className:"session-title",children:t==="/login"?u.jsx("h2",{children:"Log in to your account"}):u.jsx("h2",{children:"Create an Account"})}),u.jsxs("div",{className:"session-input-field",children:[u.jsxs("form",{className:"session-form",onSubmit:p,children:[u.jsx("div",{children:u.jsxs("label",{className:"email-label-container",children:[u.jsx("div",{className:"email-label",children:"Email:"}),u.jsx("input",{id:"email-input",type:"email",placeholder:"E-mail",onChange:v=>l(v.target.value)})]})}),u.jsx("span",{className:"auth-errors",children:y&&y}),u.jsx("div",{children:u.jsxs("label",{className:"password-label-container",children:[u.jsx("div",{className:"password-label",children:"Password:"}),u.jsx("input",{id:"password-input",type:"password",placeholder:"Password",onChange:v=>c(v.target.value)})]})}),u.jsx("div",{children:r&&u.jsxs("label",{className:"password-label-container",children:[u.jsx("div",{className:"password-label",children:"Confirm Password:"}),u.jsx("input",{id:"password-input",type:"password",placeholder:"Password",onChange:v=>d(v.target.value)})]})}),u.jsxs("span",{className:"auth-errors",children:[m&&m,E&&r&&"Passwords must match!"]}),u.jsx("button",{className:"auth-button-submit",type:"submit",disabled:!o.length||!s.length||E,children:"Submit"}),o.length&&s.length&&!E?u.jsx("span",{className:"deco-2"}):u.jsx("span",{})]}),i&&u.jsxs("div",{className:"auth-button-new-to-portal",children:[u.jsx("span",{className:"marker"}),u.jsx($e,{to:"/register",children:"New to Pet Portal"})]})]})]})]}),u.jsx(kv,{})]})]})},L2=e=>qt(`/api/users/${e}/pets`),A2=e=>fetch("/api/pets",{method:"POST",body:e,headers:{"CSRF-TOKEN":Wc("CSRF-TOKEN"),Accept:"application/json",Authorization:"Bearer "+localStorage.getItem("jwtToken")}}),M2=(e,t)=>fetch(`/api/pets/${t}`,{method:"PUT",body:e,headers:{"CSRF-TOKEN":Wc("CSRF-TOKEN"),Accept:"application/json",Authorization:"Bearer "+localStorage.getItem("jwtToken")}}),D2=e=>qt(`/api/pets/${e}`,{method:"DELETE"});function I2(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function z2(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function F2(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var ap=e=>Array.isArray(e)?e:[e];function U2(e){const t=Array.isArray(e[0])?e[0]:e;return F2(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function $2(e,t){const n=[],{length:r}=e;for(let i=0;i{n=uo(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function H2(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let a=0,o=0,l,s={},c=i.pop();typeof c=="object"&&(s=c,c=i.pop()),I2(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const f={...n,...s},{memoize:d,memoizeOptions:m=[],argsMemoize:g=Ov,argsMemoizeOptions:y=[],devModeChecks:w={}}=f,E=ap(m),h=ap(y),p=U2(i),v=d(function(){return a++,c.apply(null,arguments)},...E),j=g(function(){o++;const x=$2(p,arguments);return l=v.apply(null,x),l},...h);return Object.assign(j,{resultFunc:c,memoizedResultFunc:v,dependencies:p,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:d,argsMemoize:g})};return Object.assign(r,{withTypes:()=>r}),r}var Qc=H2(Ov),Y2=Object.assign((e,t=Qc)=>{z2(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(a=>e[a]);return t(r,(...a)=>a.reduce((o,l,s)=>(o[n[s]]=l,o),{}))},{withTypes:()=>Y2});const Lv="pets/RECEIVE_PETS",Av="pets/RECEIVE_PET",Mv="pets/REMOVE_PET",K2=e=>({type:Lv,pets:e}),Dv=e=>({type:Av,pet:e}),Q2=e=>({type:Mv,petId:e}),Iv=e=>t=>L2(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(K2(n))),G2=e=>t=>A2(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(Dv(n))).catch(n=>console.error(n)),X2=(e,t)=>n=>{if(!t)return console.error("attempted to update a pet without an id"),e;M2(e,t).then(r=>{if(r.ok)return r.json();throw r}).then(r=>n(Dv(r)))},J2=e=>t=>D2(e).then(n=>{if(n.ok)t(Q2(e));else throw n}),q2=Qc(e=>e.pets,e=>Object.values(e)),Z2=e=>t=>t.pets[e],eS=(e={},t)=>{const n={...e};switch(t.type){case Lv:return t.pets.reduce((r,i)=>(r[i._id]=i,r),{});case Av:return{...e,[t.pet._id]:t.pet};case Mv:return delete n[t.petId],n;default:return e}};const lp=["Rabies","Distemper/Parvo","Leptospirosis","Bordetella","Influenza","Lyme","Rattlesnake"],sp=["Rabies","FVRCP","FELV"],up=["Wellness","Illness","Procedure"],cp=["Flea/Tick Prevention","Heartworm Prevention"],tS=["Canine","Feline","Avian","Pocket Pet","Reptile","Equine","Aquatic"],fs={green:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/check-mark-circle-2-svgrepo-com.svg",upcoming:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/clock-ui-web-svgrepo-com.svg",overdue:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/exclamation-triangle-svgrepo-com.svg"},zv=e=>{const t=new Date,n=new Date(e);if(t>=n)return fs.overdue;let r=n.getMonth(),i=n.getFullYear(),a=n.getDate(),o=r-2;o<0&&(o+=12,i-=1),o===2&&(a=28);const l=new Date(i,o,a);return t>=l&&t<=n?fs.upcoming:fs.green},Fv=({modalState:e,setModalState:t,editModalState:n,setEditModalState:r,initialPetData:i,petId:a})=>{const[o,l]=_.useState((i==null?void 0:i.name)??""),s=i?new Date(i.dob).toISOString().split("T")[0]:"",[c,f]=_.useState(s),[d,m]=_.useState((i==null?void 0:i.sex)??""),[g,y]=_.useState((i==null?void 0:i.species)??""),[w,E]=_.useState((i==null?void 0:i.color)??""),[h,p]=_.useState((i==null?void 0:i.breed)??""),[v,j]=_.useState((i==null?void 0:i.microchipNum)??""),[R,x]=_.useState((i==null?void 0:i.insurancePolicyId)??""),[P,L]=_.useState((i==null?void 0:i.weight)??""),[D,$]=_.useState(i?i.photo:null),[Z,fe]=_.useState(!1),[he,Ie]=_.useState((i==null?void 0:i.imageUrl)??""),Qe=Ot(),dt=Jn(),{pathname:oe}=dt,I=k=>{k.preventDefault();const O=new FormData,z={_id:a,name:o,dob:c,sex:d,species:g,color:w,breed:h,microchipNum:v,insurancePolicyId:R,weight:P,imageUpdated:Z};D&&(O.append("image",D),fe(!0));for(const B in z)Object.hasOwn(z,B)&&O.append(`${B}`,z[B]);Qe(X2(O,a)),r(null),fe(!1)},Y=k=>{k.preventDefault();const O=new FormData,z={name:o,dob:c,sex:d,species:g,color:w,breed:h,microchipNum:v,insurancePolicyId:R,weight:P};for(const B in z)Object.prototype.hasOwnProperty.call(z,B)&&O.append(B,z[B]);D&&O.append("image",D),Qe(G2(O)),t(null),l(""),f(""),m(""),y(""),E(""),p(""),j(""),x(""),L(""),$(null),Ie("")},K=k=>{const O=k.currentTarget.files[0];$(O),Ie(URL.createObjectURL(O))},S=()=>u.jsxs(u.Fragment,{children:[u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"name-input-label",children:u.jsxs("span",{children:["Name",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("input",{placeholder:"Name",type:"text",value:o,onChange:k=>l(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"dob-input-label",children:u.jsxs("span",{children:["Date of Birth",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("input",{placeholder:"Date of birth",type:"date",value:c,onChange:k=>f(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"sex-select-label",children:u.jsxs("span",{children:["Sex",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("select",{className:"sex-select",placeholder:"Sex",value:d,onChange:k=>m(k.target.value),children:u.jsxs("optgroup",{children:[u.jsx("option",{disabled:!0,value:"",children:" "}),u.jsx("option",{value:"female",id:"female",children:"Female"}),u.jsx("option",{value:"male",id:"male",children:"Male"}),u.jsx("option",{value:"unknown",id:"unknown",children:"Unknown"})]})})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"species-input-label",children:u.jsxs("span",{children:["Species",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("select",{className:"species-select",value:g,onChange:k=>y(k.target.value),children:u.jsxs("optgroup",{children:[u.jsx("option",{disabled:!0,value:"",children:"Select Species"}),tS.map((k,O)=>u.jsx("option",{value:k.toLowerCase(),id:k.toLowerCase(),children:k},O))]})})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"color-input-label",children:u.jsxs("span",{children:["Color",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("input",{placeholder:"Color",type:"text",value:w,onChange:k=>E(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"breed-input-label",children:u.jsx("span",{children:"Breed"})}),u.jsx("input",{placeholder:"Breed",type:"text",value:h,onChange:k=>p(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"microchipNum-input-label",children:u.jsx("span",{children:"Microchip Number"})}),u.jsx("input",{placeholder:"Microchip number",type:"text",value:v,onChange:k=>j(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"insurance-policy-input-label",children:u.jsx("span",{children:"Insurance Policy Id"})}),u.jsx("input",{placeholder:"Insurance policy id",type:"text",value:R,onChange:k=>x(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"weight-input-label",children:u.jsx("span",{children:"Weight"})}),u.jsx("input",{placeholder:"Weight",type:"text",value:P,onChange:k=>L(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"photo-input-label",children:u.jsx("span",{children:e==="edit"?"Update Photo":"Please add photo of your pet !"})}),u.jsx("input",{id:"photo",onChange:K,type:"file"})]})]}),C=()=>{oe==="/dashboard"?t(null):r(null)};return u.jsx(u.Fragment,{children:u.jsx("div",{className:"modal-background",children:u.jsxs("div",{className:`${e?`${e}`:""}${n?`${n}`:""}-modal-content`,onClick:k=>k.stopPropagation(),children:[u.jsx("div",{className:`modal-content-top-${e?`${e}`:""}${n?`${n}`:""}`,children:u.jsx("button",{className:"pet-form-button",onClick:C,children:u.jsx("span",{children:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32","aria-hidden":"true",role:"presentation",focusable:"false",style:{display:"block",fill:"none",height:"16px",width:"16px",stroke:"currentcolor",strokeWidth:"3",overflow:"visible"},children:u.jsx("path",{d:"m6 6 20 20M26 6 6 26"})})})})}),u.jsxs("div",{className:"modal-content-center",children:[u.jsxs("div",{className:"modal-content-center-title",children:[e&&u.jsxs("h2",{className:"pet-modal-h2",children:[" ",u.jsx("span",{className:"pet-dash-highlight"}),"Add New Pet"]}),n&&u.jsxs("h2",{className:"pet-modal-h2",children:[u.jsx("span",{className:"pet-dash-highlight"}),"Edit Pet"]})]}),he&&u.jsx("div",{className:"file-preview",children:u.jsx("img",{src:he})}),u.jsx("div",{className:"modal-content-center-form",children:u.jsxs("form",{className:`${e?`${e}`:""}${n?`${n}`:""}-new-pet-form`,onSubmit:oe==="/dashboard"?Y:I,children:[S(),u.jsx("div",{className:`${e?`${e}`:""}${n?`${n}`:""}-new-pet-button`,children:u.jsxs("button",{type:"submit",children:[e&&u.jsx("h2",{children:"Add New Pet"}),n&&u.jsx("h2",{children:"Edit Pet"})]})})]})})]})]})})})};const nS=()=>{const e=Ot(),t=Jt(El),n=Jt(a=>a.pets),[r,i]=_.useState(null);return _.useEffect(()=>{t&&e(Iv(t._id))},[t,n.length,e]),u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"pet-grid-container",children:[u.jsxs("div",{className:"pet-grid-header-container",children:[u.jsx("div",{className:"pet-grid-header-text",children:u.jsx("h1",{children:"Your Pets"})}),u.jsx("div",{className:"get-grid-header-form",children:u.jsx("button",{className:"grid-add-pet-button",onClick:()=>i("add"),children:"+ Add pet"})})]}),u.jsx("div",{className:"pet-grid-divider"}),u.jsxs("div",{className:"pet-grid-index",children:[n&&Object.values(n).map((a,o)=>u.jsxs("div",{className:"pet-item",children:[u.jsx("div",{className:"pet-img",children:u.jsx($e,{to:`/dashboard/${a._id}`,children:u.jsx("img",{className:a._id,src:a.imageUrl})})}),u.jsx("div",{className:"pet-name",children:u.jsx("p",{children:a.name})})]},o)),!n&&u.jsx("div",{children:"Loading..."})]})]}),r&&u.jsx(Fv,{modalState:r,setModalState:i})]})};const rS=({clinicModalState:e,setClinicModalState:t})=>u.jsx("div",{className:"modal-background",onClick:n=>t(null),children:u.jsxs("div",{className:`modal-content-${e}`,onClick:n=>n.stopPropagation(),children:[u.jsx("div",{className:"clinic-modal-content-top",children:u.jsx("button",{onClick:n=>t(null),children:u.jsx("span",{children:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32","aria-hidden":"true",role:"presentation",focusable:"false",style:{display:"block",fill:"none",height:"16px",width:"16px",stroke:"currentcolor",strokeWidth:"3",overflow:"visible"},children:u.jsx("path",{d:"m6 6 20 20M26 6 6 26"})})})})}),u.jsx("div",{className:"clinic-modal-content-bottom",children:u.jsxs("div",{className:"clinic-content-container",children:[u.jsx("div",{className:"clinic-left",children:u.jsxs("div",{className:"clinic-search",children:[u.jsx("input",{type:"text"}),u.jsx("button",{children:"Search Clinic"})]})}),u.jsxs("div",{className:"clinic-right",children:[u.jsx("div",{children:"RIGHT"}),u.jsx("div",{children:"ALL CLINIC INFOs"})]})]})})]})});const iS=e=>qt(`/api/reminders/user/${e}`,{method:"GET"}),aS=e=>qt(`/api/reminders/pet/${e}`,{method:"GET"}),oS=e=>qt("/api/reminders",{method:"POST",body:JSON.stringify(e)}),lS=e=>qt(`/api/reminders/${e._id}`,{method:"PUT",body:JSON.stringify(e)}),sS=e=>qt(`/api/reminders/${e}`,{method:"DELETE"}),Uv="reminders/RECEIVE_REMINDERS",$v="reminders/RECEIVE_REMINDER",Vv="reminders/REMOVE_REMINDER",Bv=e=>({type:Uv,reminders:e}),Wv=e=>({type:$v,reminder:e}),uS=e=>({type:Vv,reminderId:e}),cS=e=>t=>iS(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(Bv(n))).catch(n=>console.error(n)),fS=e=>t=>aS(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(Bv(n))).catch(n=>console.error(n)),dS=e=>t=>oS(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(Wv(n))).catch(n=>console.error(n)),pS=e=>t=>lS(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(Wv(n))).catch(n=>console.error(n)),Gc=e=>t=>sS(e).then(n=>{if(n.ok)return t(uS(e)),n.json();throw n}).catch(n=>console.error(n)),Hv=Qc(e=>e.reminders,e=>{const t=Object.values(e);return t.sort((n,r)=>new Date(n.dueDate)-new Date(r.dueDate)),t}),mS=(e={},t)=>{const n={...e};switch(t.type){case $v:return{...e,[t.reminder._id]:t.reminder};case Uv:return t.reminders;case Vv:return delete n[t.reminderId],n;default:return e}};var hS={prefix:"fas",iconName:"pills",icon:[576,512,[],"f484","M112 96c-26.5 0-48 21.5-48 48V256h96V144c0-26.5-21.5-48-48-48zM0 144C0 82.1 50.1 32 112 32s112 50.1 112 112V368c0 61.9-50.1 112-112 112S0 429.9 0 368V144zM554.9 399.4c-7.1 12.3-23.7 13.1-33.8 3.1L333.5 214.9c-10-10-9.3-26.7 3.1-33.8C360 167.7 387.1 160 416 160c88.4 0 160 71.6 160 160c0 28.9-7.7 56-21.1 79.4zm-59.5 59.5C472 472.3 444.9 480 416 480c-88.4 0-160-71.6-160-160c0-28.9 7.7-56 21.1-79.4c7.1-12.3 23.7-13.1 33.8-3.1L498.5 425.1c10 10 9.3 26.7-3.1 33.8z"]},vS={prefix:"fas",iconName:"syringe",icon:[512,512,[128137],"f48e","M441 7l32 32 32 32c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-15-15L417.9 128l55 55c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-72-72L295 73c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l55 55L422.1 56 407 41c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0zM210.3 155.7l61.1-61.1c.3 .3 .6 .7 1 1l16 16 56 56 56 56 16 16c.3 .3 .6 .6 1 1l-191 191c-10.5 10.5-24.7 16.4-39.6 16.4H97.9L41 505c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l57-57V325.3c0-14.9 5.9-29.1 16.4-39.6l43.3-43.3 57 57c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-57-57 41.4-41.4 57 57c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-57-57z"]},bl={prefix:"far",iconName:"trash-can",icon:[448,512,[61460,"trash-alt"],"f2ed","M170.5 51.6L151.5 80h145l-19-28.4c-1.5-2.2-4-3.6-6.7-3.6H177.1c-2.7 0-5.2 1.3-6.7 3.6zm147-26.6L354.2 80H368h48 8c13.3 0 24 10.7 24 24s-10.7 24-24 24h-8V432c0 44.2-35.8 80-80 80H112c-44.2 0-80-35.8-80-80V128H24c-13.3 0-24-10.7-24-24S10.7 80 24 80h8H80 93.8l36.7-55.1C140.9 9.4 158.4 0 177.1 0h93.7c18.7 0 36.2 9.4 46.6 24.9zM80 128V432c0 17.7 14.3 32 32 32H336c17.7 0 32-14.3 32-32V128H80zm80 64V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16z"]},jl={prefix:"far",iconName:"pen-to-square",icon:[512,512,["edit"],"f044","M441 58.9L453.1 71c9.4 9.4 9.4 24.6 0 33.9L424 134.1 377.9 88 407 58.9c9.4-9.4 24.6-9.4 33.9 0zM209.8 256.2L344 121.9 390.1 168 255.8 302.2c-2.9 2.9-6.5 5-10.4 6.1l-58.5 16.7 16.7-58.5c1.1-3.9 3.2-7.5 6.1-10.4zM373.1 25L175.8 222.2c-8.7 8.7-15 19.4-18.3 31.1l-28.6 100c-2.4 8.4-.1 17.4 6.1 23.6s15.2 8.5 23.6 6.1l100-28.6c11.8-3.4 22.5-9.7 31.1-18.3L487 138.9c28.1-28.1 28.1-73.7 0-101.8L474.9 25C446.8-3.1 401.2-3.1 373.1 25zM88 64C39.4 64 0 103.4 0 152V424c0 48.6 39.4 88 88 88H360c48.6 0 88-39.4 88-88V312c0-13.3-10.7-24-24-24s-24 10.7-24 24V424c0 22.1-17.9 40-40 40H88c-22.1 0-40-17.9-40-40V152c0-22.1 17.9-40 40-40H200c13.3 0 24-10.7 24-24s-10.7-24-24-24H88z"]},gS={prefix:"far",iconName:"calendar-check",icon:[448,512,[],"f274","M128 0c13.3 0 24 10.7 24 24V64H296V24c0-13.3 10.7-24 24-24s24 10.7 24 24V64h40c35.3 0 64 28.7 64 64v16 48V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V192 144 128C0 92.7 28.7 64 64 64h40V24c0-13.3 10.7-24 24-24zM400 192H48V448c0 8.8 7.2 16 16 16H384c8.8 0 16-7.2 16-16V192zM329 297L217 409c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47 95-95c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"]};const yS=()=>{const e=Ot(),t=Jt(El),r=Jt(Hv).filter(d=>{var m;return d.user===((m=t==null?void 0:t._id)==null?void 0:m.toString())}),i=Jt(q2),a=new Date,o=[],l=[],s=r==null?void 0:r.filter((d,m)=>{let g=new Date(r[m].dueDate),y=Math.ceil((g-a)/(1e3*60*60*24));if(y<=5&&y>=0)return o.push(y),l.push(d.pet),d}),c=[],f=[];for(let d=0;d{t!=null&&t._id&&e(cS(t._id))},[e,t==null?void 0:t._id]),u.jsxs(u.Fragment,{children:[s.length===0&&u.jsx("div",{className:"no-upcoming-reminder",children:"Currently, there are no upcoming reminders!"}),s.length!==0&&s.map((d,m)=>u.jsxs("div",{className:"upcoming-reminder-container",children:[u.jsxs("div",{className:"upcoming-reminder-icon-container",children:[u.jsxs("div",{className:"upcoming-reminder-icon",children:[d.type==="appointment"&&u.jsx(Ee,{className:"appointment-icon",icon:gS,size:"xl"}),d.type==="vaccination"&&u.jsx(Ee,{className:"vaccination-icon",icon:vS,size:"xl"}),d.type==="medication"&&u.jsx(Ee,{className:"medication-icon",icon:hS,size:"xl"})]}),u.jsxs("div",{className:"upcoming-reminder-type",children:[d.type==="appointment"&&"appointment",d.type==="vaccination"&&"vaccination",d.type==="medication"&&"medication"]})]}),u.jsxs("div",{className:"upcoming-reminder-content",children:[u.jsx("div",{children:d.title}),u.jsx("div",{className:"upcoming-reminder-pet-name",children:c[m]&&u.jsx("p",{children:c[m]})}),u.jsx("div",{className:"upcoming-pet-image",children:f[m]&&u.jsx("img",{id:"upcoming-pet-image",src:f[m]})})]}),u.jsx("div",{className:"upcoming-reminder-pet",children:u.jsxs("div",{className:"upcoming-days",children:[o[m]<0&&u.jsx("p",{children:" Overdue! "}),o[m]===0&&u.jsx("p",{children:"due today"}),o[m]>0&&u.jsxs("p",{children:["in ",o[m]," days"]})]})})]},m))]})},xS=()=>{const[e,t]=_.useState(null);return u.jsxs("div",{className:"page-container",children:[u.jsx("img",{className:"bg-image",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/layered-waves-haikei+adjusted.svg"}),u.jsxs("h1",{className:"dashboard-header",children:[u.jsx("span",{className:"pet-dash-highlight"}),"Dashboard"]}),u.jsxs("div",{className:"dashboard-container",children:[u.jsx("div",{className:"index-container",children:u.jsx(nS,{})}),u.jsx("div",{className:"right-container",children:u.jsxs("div",{className:"all-reminders",children:[u.jsx("div",{className:"all-reminders-title",children:u.jsx("h3",{children:"Upcoming Reminders"})}),u.jsx(yS,{})]})})]}),e&&u.jsx(rS,{clinicModalState:e,setClinicModalState:t})]})};function Xc({name:e="reminder"}){const t=/[aeiou]/.test(e.charAt(0));return u.jsxs("div",{className:"empty-reminders",children:["Click the ",u.jsx("span",{children:"+"})," icon to add a",t&&"n"," ",e,"!"]})}const wS=({reminders:e,setModalState:t,setCurrentReminder:n})=>{const r=Ot(),i=e.filter(l=>l.type==="appointment"),a=l=>{const s=new Date(l),c=s.toLocaleDateString("en-US");let f=s.getHours();const d=s.getMinutes(),m=f>=12?"PM":"AM";f=f%12,f=f||12;const g=f.toString(),y=d<10?"0"+d:d.toString(),w=`${g}:${y} ${m}`;return`${c} - ${w}`},o=(l,s)=>{s.preventDefault(),s.stopPropagation(),r(Gc(l))};return u.jsxs(u.Fragment,{children:[i&&i.map((l,s)=>u.jsxs("div",{className:"appointment-info-container",children:[u.jsxs("div",{className:"appointment-header",children:[u.jsxs("div",{className:"appointment-title",children:[u.jsx("p",{children:l.title}),u.jsxs("div",{className:"edit-del-reminder",children:[u.jsx(Ee,{className:"edit-del-icons pen",icon:jl,onClick:()=>{n(l),t("edit")}}),u.jsx(Ee,{className:"edit-del-icons trash",icon:bl,onClick:c=>{o(l._id,c)}})]})]}),u.jsx("div",{className:"appointment-date",children:u.jsx("p",{children:a(l.dueDate)})})]}),u.jsx("div",{className:"reminder-divider"}),u.jsxs("div",{className:"appointment-content",children:[u.jsx("div",{className:"appointment-desc",children:u.jsx("p",{children:l.description})}),u.jsx("div",{className:"appointment-loc",children:u.jsx("p",{children:l.location})})]})]},s)),!i.length&&u.jsx(Xc,{name:"appointment reminder"})]})};const SS=({reminders:e,setModalState:t,setCurrentReminder:n})=>{const r=Ot(),i=e.filter(o=>o.type==="vaccination"),a=(o,l)=>{l.preventDefault(),l.stopPropagation(),r(Gc(o))};return u.jsxs(u.Fragment,{children:[i&&Object.values(i).map((o,l)=>u.jsx("div",{className:"vaccine-info-container",children:u.jsxs("div",{className:"vaccine-header",children:[u.jsxs("div",{className:"vaccine-desc",children:[u.jsx("p",{children:o.title}),u.jsxs("div",{className:"edit-del-reminder",children:[u.jsx(Ee,{className:"edit-del-icons pen",icon:jl,onClick:()=>{n(o),t("edit")}}),u.jsx(Ee,{className:"edit-del-icons trash",icon:bl,onClick:s=>{a(o._id,s)}})]})]}),u.jsxs("div",{className:"vaccine-date",children:[u.jsxs("p",{children:["Due: ",new Date(o.dueDate).toLocaleDateString("en-US")]}),u.jsx("img",{src:zv(o.dueDate),className:"proximity-icon"})]})]})},l)),!i.length&&u.jsx(Xc,{name:"vaccine reminder"})]})};const kS=({reminders:e,setModalState:t,setCurrentReminder:n})=>{const r=Ot(),i=e.filter(o=>o.type==="medication"),a=(o,l)=>{l.preventDefault(),l.stopPropagation(),r(Gc(o))};return u.jsxs(u.Fragment,{children:[i&&Object.values(i).map((o,l)=>u.jsxs("div",{className:"medication-info-container",children:[u.jsxs("div",{className:"medication-header",children:[u.jsxs("div",{className:"medication-title",children:[u.jsx("p",{children:o.title}),u.jsxs("div",{className:"edit-del-reminder",children:[u.jsx(Ee,{className:"edit-del-icons pen",icon:jl,onClick:()=>{n(o),t("edit")}}),u.jsx(Ee,{className:"edit-del-icons trash",icon:bl,onClick:s=>{a(o._id,s)}})]})]}),u.jsxs("div",{className:"medication-date",children:[u.jsxs("p",{children:["Due: ",new Date(o.dueDate).toLocaleDateString("en-US")]}),u.jsx("img",{src:zv(o.dueDate),className:"proximity-icon"})]})]}),o.description&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"reminder-divider"}),u.jsx("div",{className:"medication-content",children:u.jsx("p",{children:o.description})})]})]},l)),!i.length&&u.jsx(Xc,{name:"medication reminder"})]})};const ES=({modalState:e,setModalState:t,pet:n,reminder:r={}})=>{const[i,a]=_.useState(e==="edit"?r.type:""),[o,l]=_.useState(e==="edit"?r.title:""),[s,c]=_.useState(e==="edit"?r.dueDate.slice(0,10):""),[f,d]=_.useState(e==="edit"&&r.performDate?r.performDate.slice(0,10):""),[m,g]=_.useState(e==="edit"?r.description:""),[y,w]=_.useState(e==="edit"?r.location:""),E=Ot(),h=_.useCallback(P=>{switch(P){case"appointment":return up;case"vaccination":return n.species==="feline"?sp:lp;case"medication":return cp;default:return[]}},[n.species]),[p,v]=_.useState(e==="edit"?h(r.type):[]);_.useEffect(()=>{e!=="edit"&&(a(e),v(h(e)))},[i,e,h]),_.useEffect(()=>{},[E,r]);const j=P=>{switch(a(P.target.value),P.target.value.toLowerCase()){case"appointment":v(up);break;case"vaccination":v(n.species.toLowerCase()==="feline"?sp:lp);break;case"medication":v(cp);break;default:v([])}},R=P=>{P.preventDefault();const L={...r,type:i,title:o,dueDate:s,performDate:f,description:m,location:y,pet:n._id};E(e==="edit"?pS(L):dS(L)),t(null),a(""),l(""),c(""),d(""),g(""),w("")},x=()=>u.jsxs(u.Fragment,{children:[u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"type-select-label",children:u.jsxs("span",{children:["Type",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("select",{className:"type-select",placeholder:"Type",value:i,onChange:j,children:u.jsxs("optgroup",{children:[u.jsx("option",{disabled:!0,value:"",children:" Select Type "}),u.jsx("option",{id:"appt",value:"appointment",children:"Appointment"}),u.jsx("option",{id:"vaccine",value:"vaccination",children:"Vaccination"}),u.jsx("option",{id:"medication",value:"medication",children:"Medication"})]})})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"title-select-label",children:u.jsxs("span",{children:["Title",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("select",{className:"title-select",value:o,onChange:P=>l(P.target.value),children:u.jsxs("optgroup",{children:[u.jsxs("option",{disabled:!0,value:"",children:[" ",`Select ${e!=="edit"&&e}`," "]}),p&&p.map((P,L)=>u.jsx("option",{value:P,children:P},L))]})})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"duedate-input-label",children:u.jsxs("span",{children:["Due Date",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("input",{placeholder:"Due Date",type:i==="appointment"?"datetime-local":"date",value:s,onChange:P=>c(P.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"perform-date-input-label",children:u.jsx("span",{children:"Perform Date"})}),u.jsx("input",{placeholder:"Perform Date",type:i==="appointment"?"datetime-local":"date",value:f,onChange:P=>d(P.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"description-input-label",children:u.jsx("span",{children:"Description"})}),u.jsx("textarea",{className:"description-input",type:"textarea",value:m,onChange:P=>g(P.target.value),placeholder:"Description"})]}),e==="appointment"&&u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"location-input-label",children:u.jsx("span",{children:"Location"})}),u.jsx("input",{placeholder:"Location",type:"text",value:y,onChange:P=>w(P.target.value)})]})]});return u.jsx(u.Fragment,{children:u.jsx("div",{className:"modal-background",children:u.jsxs("div",{className:`modal-content-${e}`,onClick:P=>P.stopPropagation(),children:[u.jsx("div",{className:"reminder-modal-content-top",children:u.jsx("button",{onClick:P=>t(null),children:u.jsx("span",{children:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32","aria-hidden":"true",role:"presentation",focusable:"false",style:{display:"block",color:"black",fill:"none",height:"16px",width:"16px",stroke:"currentColor",strokeWidth:"3",overflow:"visible"},children:u.jsx("path",{d:"m6 6 20 20M26 6 6 26"})})})})}),u.jsxs("div",{className:"modal-content-bottom",children:[u.jsx("div",{className:"modal-content-bottom-title",children:e&&u.jsxs("div",{className:"reminder-title",children:[u.jsx("span",{className:"pet-dash-highlight"}),e==="edit"?"Update":`Add ${e.charAt(0).toUpperCase()+e.slice(1)}`," Reminder"]})}),u.jsx("div",{className:"modal-content-bottom-form-container",children:u.jsxs("form",{className:"modal-content-bottom-form",onSubmit:R,children:[x(),u.jsx("div",{className:"reminder-button-container",children:u.jsx("button",{type:"submit",className:"add-new-reminder-button",children:e&&u.jsx("div",{className:e==="edit"?"reminder-button-edit":"reminder-button",children:e==="edit"?"Confirm Changes":`Add ${e.charAt(0).toUpperCase()+e.slice(1)} - Reminder`})})})]})})]})]})})})},bS=()=>{const{petId:e}=g0(),t=Jt(Z2(e)),n=Jt(El),r=Ot(),[i,a]=_.useState(null),[o,l]=_.useState(null),[s,c]=_.useState(null),f=Jt(Hv),d=g=>{const y=new Date(g),w=new Date;let E=w.getFullYear()-y.getFullYear(),h=w.getMonth()-y.getMonth(),p=w.getDate()-y.getDate();if((h<0||h===0&&p<0)&&(E--,h<0&&(h+=12),p<0)){const v=new Date(w.getFullYear(),w.getMonth()-1,0);p+=v.getDate()}if(E<1)if(h<4){let v=Math.floor(p/7),j=p%7;return v>1?`${v} weeks & ${j} days`:`${p} ${p===1?"day":"days"}`}else return`${h} months`;else return`${E} ${E===1?"year":"years"} & ${h} months`},m=g=>g.split(" ").map(y=>y[0].toUpperCase()+y.slice(1).toLowerCase()).join(" ");if(_.useEffect(()=>{n!=null&&n._id&&r(Iv(n._id)),e&&r(fS(e))},[r,n,e]),t)return u.jsxs("div",{className:"dash-page-container",children:[u.jsx("img",{className:"bg-image",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/layered-waves-haikei+adjusted.svg"}),u.jsxs("div",{className:"pet-dashboard-container",children:[u.jsxs("div",{className:"pet-dashboard",children:[u.jsx($e,{to:"/dashboard",className:"back-link",children:" ← Back to your pets "}),u.jsxs("h1",{className:"pet-dash-header",children:[u.jsx("span",{className:"pet-dash-highlight"}),`${t.name}'s Profile`]}),u.jsxs("div",{className:"pet-metrics-container",children:[u.jsxs("div",{className:"pet-reminder-module",children:[u.jsxs("div",{className:"pet-reminder-header",children:[u.jsx("h3",{children:"Appointments"}),u.jsx("button",{className:"pet-dash-buttons",onClick:()=>a("appointment"),children:" + "})]}),u.jsx("div",{className:"appointment-index-container",children:u.jsx(wS,{reminders:f,setModalState:a,setCurrentReminder:c})})]}),u.jsxs("div",{className:"preventatives-module",children:[u.jsxs("div",{className:"vaccines",children:[u.jsxs("div",{className:"pet-vaccines-header",children:[u.jsx("h3",{children:"Vaccines"}),u.jsx("button",{className:"pet-dash-buttons",onClick:()=>a("vaccination"),children:" + "})]}),u.jsx("div",{className:"vaccinations-index-container",children:u.jsx(SS,{reminders:f,setModalState:a,setCurrentReminder:c})})]}),u.jsxs("div",{className:"medications",children:[u.jsxs("div",{className:"medications-header",children:[u.jsx("h3",{children:"Medications"}),u.jsx("button",{className:"pet-dash-buttons",onClick:()=>a("medication"),children:" + "})]}),u.jsx("div",{className:"medications-index-container",children:u.jsx(kS,{reminders:f,setModalState:a,setCurrentReminder:c})})]})]})]})]}),u.jsxs("div",{className:"pet-signalment",children:[u.jsx("div",{className:"profile-pic-border",children:u.jsx("img",{src:t.imageUrl,className:"profile-pic"})}),u.jsxs("div",{className:"pet-summary",children:[u.jsx("div",{className:"name-splash-container",children:u.jsx("div",{className:"name-border",children:u.jsx("h3",{children:m(t.name)})})}),u.jsx("div",{children:u.jsx($e,{to:"/dashboard",children:u.jsx("button",{className:"delete-pet-dash-buttons",onClick:()=>r(J2(e)),children:u.jsx(Ee,{icon:bl})})})}),u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Age: "}),u.jsx("p",{children:d(t.dob)}),u.jsx("span",{className:"decoration"})]}),u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Sex: "}),u.jsx("p",{children:t.sex}),u.jsx("span",{className:"decoration"})]}),u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Species: "}),u.jsx("p",{children:t.species}),u.jsx("span",{className:"decoration"})]}),u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Breed: "}),u.jsx("p",{children:t.breed}),u.jsx("span",{className:"decoration"})]}),u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Color: "}),u.jsx("p",{children:t.color}),u.jsx("span",{className:"decoration"})]}),t.insurancePolicyId&&u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Insurance ID: "}),u.jsx("p",{children:t.insurancePolicyId}),u.jsx("span",{className:"decoration"})]}),t.microchipNumber&&u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Microchip: "}),u.jsx("p",{children:t.microchipNumber}),u.jsx("span",{className:"decoration"})]}),t.weight&&u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Weight: "}),u.jsx("p",{children:t.weight}),u.jsx("span",{className:"decoration"})]}),u.jsx("div",{children:u.jsx("button",{className:"edit-pet-dash-buttons",onClick:()=>l("edit"),children:u.jsx(Ee,{icon:jl})})})]})]})]}),o&&u.jsx(Fv,{editModalState:o,setEditModalState:l,initialPetData:t,petId:e}),i&&u.jsx(ES,{modalState:i,setModalState:a,pet:t,reminder:s})]})},jS=z0([{path:"/",element:u.jsx(rp,{})},{path:"/login",element:u.jsx(ip,{})},{path:"/register",element:u.jsx(ip,{})},{path:"/dashboard",element:u.jsxs(u.Fragment,{children:[u.jsx(Kc,{}),u.jsx(R0,{})]}),children:[{index:!0,element:u.jsx(xS,{})},{path:":petId",element:u.jsx(bS,{})}]},{path:"*",element:u.jsx(rp,{})}]),NS=()=>u.jsx(Y0,{router:jS});function We(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var CS=(()=>typeof Symbol=="function"&&Symbol.observable||"@@observable")(),fp=CS,ds=()=>Math.random().toString(36).substring(7).split("").join("."),PS={INIT:`@@redux/INIT${ds()}`,REPLACE:`@@redux/REPLACE${ds()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ds()}`},el=PS;function _S(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Yv(e,t,n){if(typeof e!="function")throw new Error(We(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(We(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(We(1));return n(Yv)(e,t)}let r=e,i=t,a=new Map,o=a,l=0,s=!1;function c(){o===a&&(o=new Map,a.forEach((E,h)=>{o.set(h,E)}))}function f(){if(s)throw new Error(We(3));return i}function d(E){if(typeof E!="function")throw new Error(We(4));if(s)throw new Error(We(5));let h=!0;c();const p=l++;return o.set(p,E),function(){if(h){if(s)throw new Error(We(6));h=!1,c(),o.delete(p),a=null}}}function m(E){if(!_S(E))throw new Error(We(7));if(typeof E.type>"u")throw new Error(We(8));if(typeof E.type!="string")throw new Error(We(17));if(s)throw new Error(We(9));try{s=!0,i=r(i,E)}finally{s=!1}return(a=o).forEach(p=>{p()}),E}function g(E){if(typeof E!="function")throw new Error(We(10));r=E,m({type:el.REPLACE})}function y(){const E=d;return{subscribe(h){if(typeof h!="object"||h===null)throw new Error(We(11));function p(){const j=h;j.next&&j.next(f())}return p(),{unsubscribe:E(p)}},[fp](){return this}}}return m({type:el.INIT}),{dispatch:m,subscribe:d,getState:f,replaceReducer:g,[fp]:y}}function RS(e,t,n){return Yv(e,t,n)}function TS(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:el.INIT})>"u")throw new Error(We(12));if(typeof n(void 0,{type:el.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(We(13))})}function OS(e){const t=Object.keys(e),n={};for(let a=0;a"u")throw l&&l.type,new Error(We(14));c[d]=y,s=s||y!==g}return s=s||r.length!==Object.keys(o).length,s?c:o}}function LS(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function AS(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(We(15))};const o={getState:i.getState,dispatch:(s,...c)=>a(s,...c)},l=e.map(s=>s(o));return a=LS(...l)(i.dispatch),{...i,dispatch:a}}}function MS(e){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,e):i(a)}var DS=MS(),dp={exports:{}};(function(e,t){(function(n,r){r(t)})(vi,function(n){function r(S,C){S.super_=C,S.prototype=Object.create(C.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}})}function i(S,C){Object.defineProperty(this,"kind",{value:S,enumerable:!0}),C&&C.length&&Object.defineProperty(this,"path",{value:C,enumerable:!0})}function a(S,C,k){a.super_.call(this,"E",S),Object.defineProperty(this,"lhs",{value:C,enumerable:!0}),Object.defineProperty(this,"rhs",{value:k,enumerable:!0})}function o(S,C){o.super_.call(this,"N",S),Object.defineProperty(this,"rhs",{value:C,enumerable:!0})}function l(S,C){l.super_.call(this,"D",S),Object.defineProperty(this,"lhs",{value:C,enumerable:!0})}function s(S,C,k){s.super_.call(this,"A",S),Object.defineProperty(this,"index",{value:C,enumerable:!0}),Object.defineProperty(this,"item",{value:k,enumerable:!0})}function c(S,C,k){var O=S.slice((k||C)+1||S.length);return S.length=C<0?S.length+C:C,S.push.apply(S,O),S}function f(S){var C=typeof S>"u"?"undefined":Qe(S);return C!=="object"?C:S===Math?"math":S===null?"null":Array.isArray(S)?"array":Object.prototype.toString.call(S)==="[object Date]"?"date":typeof S.toString=="function"&&/^\/.*\//.test(S.toString())?"regexp":"object"}function d(S,C,k,O,z,B,X){z=z||[],X=X||[];var ne=z.slice(0);if(typeof B<"u"){if(O){if(typeof O=="function"&&O(ne,B))return;if((typeof O>"u"?"undefined":Qe(O))==="object"){if(O.prefilter&&O.prefilter(ne,B))return;if(O.normalize){var it=O.normalize(ne,B,S,C);it&&(S=it[0],C=it[1])}}}ne.push(B)}f(S)==="regexp"&&f(C)==="regexp"&&(S=S.toString(),C=C.toString());var pt=typeof S>"u"?"undefined":Qe(S),de=typeof C>"u"?"undefined":Qe(C),Re=pt!=="undefined"||X&&X[X.length-1].lhs&&X[X.length-1].lhs.hasOwnProperty(B),at=de!=="undefined"||X&&X[X.length-1].rhs&&X[X.length-1].rhs.hasOwnProperty(B);if(!Re&&at)k(new o(ne,C));else if(!at&&Re)k(new l(ne,S));else if(f(S)!==f(C))k(new a(ne,S,C));else if(f(S)==="date"&&S-C!==0)k(new a(ne,S,C));else if(pt==="object"&&S!==null&&C!==null)if(X.filter(function(Se){return Se.lhs===S}).length)S!==C&&k(new a(ne,S,C));else{if(X.push({lhs:S,rhs:C}),Array.isArray(S)){var ue;for(S.length,ue=0;ue=C.length?k(new s(ne,ue,new l(void 0,S[ue]))):d(S[ue],C[ue],k,O,ne,ue,X);for(;ue=0?(d(S[Se],C[Se],k,O,ne,Se,X),Lt=c(Lt,qn)):d(S[Se],void 0,k,O,ne,Se,X)}),Lt.forEach(function(Se){d(void 0,C[Se],k,O,ne,Se,X)})}X.length=X.length-1}else S!==C&&(pt==="number"&&isNaN(S)&&isNaN(C)||k(new a(ne,S,C)))}function m(S,C,k,O){return O=O||[],d(S,C,function(z){z&&O.push(z)},k),O.length?O:void 0}function g(S,C,k){if(k.path&&k.path.length){var O,z=S[C],B=k.path.length-1;for(O=0;O"u"&&(O[k.path[z]]=typeof k.path[z]=="number"?[]:{}),O=O[k.path[z]];switch(k.kind){case"A":g(k.path?O[k.path[z]]:O,k.index,k.item);break;case"D":delete O[k.path[z]];break;case"E":case"N":O[k.path[z]]=k.rhs}}}function w(S,C,k){if(k.path&&k.path.length){var O,z=S[C],B=k.path.length-1;for(O=0;O"u"&&(B[k.path[O]]={}),B=B[k.path[O]];switch(k.kind){case"A":w(B[k.path[O]],k.index,k.item);break;case"D":B[k.path[O]]=k.lhs;break;case"E":B[k.path[O]]=k.lhs;break;case"N":delete B[k.path[O]]}}}function h(S,C,k){if(S&&C){var O=function(z){k&&!k(S,C,z)||y(S,C,z)};d(S,C,O)}}function p(S){return"color: "+I[S].color+"; font-weight: bold"}function v(S){var C=S.kind,k=S.path,O=S.lhs,z=S.rhs,B=S.index,X=S.item;switch(C){case"E":return[k.join("."),O,"→",z];case"N":return[k.join("."),z];case"D":return[k.join(".")];case"A":return[k.join(".")+"["+B+"]",X];default:return[]}}function j(S,C,k,O){var z=m(S,C);try{O?k.groupCollapsed("diff"):k.group("diff")}catch{k.log("diff")}z?z.forEach(function(B){var X=B.kind,ne=v(B);k.log.apply(k,["%c "+I[X].text,p(X)].concat(dt(ne)))}):k.log("—— no diff ——");try{k.groupEnd()}catch{k.log("—— diff end —— ")}}function R(S,C,k,O){switch(typeof S>"u"?"undefined":Qe(S)){case"object":return typeof S[O]=="function"?S[O].apply(S,dt(k)):S[O];case"function":return S(C);default:return S}}function x(S){var C=S.timestamp,k=S.duration;return function(O,z,B){var X=["action"];return X.push("%c"+String(O.type)),C&&X.push("%c@ "+z),k&&X.push("%c(in "+B.toFixed(2)+" ms)"),X.join(" ")}}function P(S,C){var k=C.logger,O=C.actionTransformer,z=C.titleFormatter,B=z===void 0?x(C):z,X=C.collapsed,ne=C.colors,it=C.level,pt=C.diff,de=typeof C.titleFormatter>"u";S.forEach(function(Re,at){var ue=Re.started,Ze=Re.startedTime,Lt=Re.action,Se=Re.prevState,wn=Re.error,qn=Re.took,Zt=Re.nextState,en=S[at+1];en&&(Zt=en.prevState,qn=en.started-ue);var mt=O(Lt),kr=typeof X=="function"?X(function(){return Zt},Lt,Re):X,Bt=he(Ze),Zn=ne.title?"color: "+ne.title(mt)+";":"",Sn=["color: gray; font-weight: lighter;"];Sn.push(Zn),C.timestamp&&Sn.push("color: gray; font-weight: lighter;"),C.duration&&Sn.push("color: gray; font-weight: lighter;");var Wt=B(mt,Bt,qn);try{kr?ne.title&&de?k.groupCollapsed.apply(k,["%c "+Wt].concat(Sn)):k.groupCollapsed(Wt):ne.title&&de?k.group.apply(k,["%c "+Wt].concat(Sn)):k.group(Wt)}catch{k.log(Wt)}var mi=R(it,mt,[Se],"prevState"),bt=R(it,mt,[mt],"action"),Er=R(it,mt,[wn,Se],"error"),br=R(it,mt,[Zt],"nextState");if(mi)if(ne.prevState){var Ra="color: "+ne.prevState(Se)+"; font-weight: bold";k[mi]("%c prev state",Ra,Se)}else k[mi]("prev state",Se);if(bt)if(ne.action){var Nl="color: "+ne.action(mt)+"; font-weight: bold";k[bt]("%c action ",Nl,mt)}else k[bt]("action ",mt);if(wn&&Er)if(ne.error){var Ta="color: "+ne.error(wn,Se)+"; font-weight: bold;";k[Er]("%c error ",Ta,wn)}else k[Er]("error ",wn);if(br)if(ne.nextState){var jr="color: "+ne.nextState(Zt)+"; font-weight: bold";k[br]("%c next state",jr,Zt)}else k[br]("next state",Zt);pt&&j(Se,Zt,k,kr);try{k.groupEnd()}catch{k.log("—— log end ——")}})}function L(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},C=Object.assign({},Y,S),k=C.logger,O=C.stateTransformer,z=C.errorTransformer,B=C.predicate,X=C.logErrors,ne=C.diffPredicate;if(typeof k>"u")return function(){return function(pt){return function(de){return pt(de)}}};if(S.getState&&S.dispatch)return console.error(`[redux-logger] redux-logger not installed. Make sure to pass logger instance as middleware: + */var _a=_;function Jw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qw=typeof Object.is=="function"?Object.is:Jw,Zw=_a.useSyncExternalStore,e2=_a.useRef,t2=_a.useEffect,n2=_a.useMemo,r2=_a.useDebugValue;bv.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=e2(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=n2(function(){function s(g){if(!c){if(c=!0,f=g,g=r(g),i!==void 0&&o.hasValue){var y=o.value;if(i(y,g))return d=y}return d=g}if(y=d,qw(f,g))return y;var w=r(g);return i!==void 0&&i(y,w)?y:(f=g,d=w)}var c=!1,f,d,m=n===void 0?null:n;return[function(){return s(t())},m===null?void 0:function(){return s(m())}]},[t,n,r,i]);var l=Zw(e,a[0],a[1]);return t2(function(){o.hasValue=!0,o.value=l},[l]),r2(l),l};Ev.exports=bv;var i2=Ev.exports,yt="default"in ps?ya:ps,ep=Symbol.for("react-redux-context"),tp=typeof globalThis<"u"?globalThis:{};function a2(){if(!yt.createContext)return{};const e=tp[ep]??(tp[ep]=new Map);let t=e.get(yt.createContext);return t||(t=yt.createContext(null),e.set(yt.createContext,t)),t}var Yn=a2(),o2=()=>{throw new Error("uSES not initialized!")};function Bc(e=Yn){return function(){return yt.useContext(e)}}var jv=Bc(),Nv=o2,l2=e=>{Nv=e},s2=(e,t)=>e===t;function u2(e=Yn){const t=e===Yn?jv:Bc(e),n=(r,i={})=>{const{equalityFn:a=s2,devModeChecks:o={}}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:s,getServerState:c,stabilityCheck:f,identityFunctionCheck:d}=t();yt.useRef(!0);const m=yt.useCallback({[r.name](y){return r(y)}}[r.name],[r,f,o.stabilityCheck]),g=Nv(s.addNestedSub,l.getState,c||l.getState,m,a);return yt.useDebugValue(g),g};return Object.assign(n,{withTypes:()=>n}),n}var Jt=u2();function c2(e){e()}function f2(){let e=null,t=null;return{clear(){e=null,t=null},notify(){c2(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var np={notify(){},get:()=>[]};function d2(e,t){let n,r=np,i=0,a=!1;function o(w){f();const E=r.subscribe(w);let h=!1;return()=>{h||(h=!0,E(),d())}}function l(){r.notify()}function s(){y.onStateChange&&y.onStateChange()}function c(){return a}function f(){i++,n||(n=t?t.addNestedSub(s):e.subscribe(s),r=f2())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=np)}function m(){a||(a=!0,f())}function g(){a&&(a=!1,d())}const y={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:s,isSubscribed:c,trySubscribe:m,tryUnsubscribe:g,getListeners:()=>r};return y}var p2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",m2=typeof navigator<"u"&&navigator.product==="ReactNative",h2=p2||m2?yt.useLayoutEffect:yt.useEffect;function v2({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",identityFunctionCheck:a="once"}){const o=yt.useMemo(()=>{const c=d2(e);return{store:e,subscription:c,getServerState:r?()=>r:void 0,stabilityCheck:i,identityFunctionCheck:a}},[e,r,i,a]),l=yt.useMemo(()=>e.getState(),[e]);h2(()=>{const{subscription:c}=o;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),l!==e.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[o,l]);const s=t||Yn;return yt.createElement(s.Provider,{value:o},n)}var g2=v2;function Cv(e=Yn){const t=e===Yn?jv:Bc(e),n=()=>{const{store:r}=t();return r};return Object.assign(n,{withTypes:()=>n}),n}var y2=Cv();function x2(e=Yn){const t=e===Yn?y2:Cv(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Ot=x2();l2(i2.useSyncExternalStoreWithSelector);const qt=async(e,t={})=>{t.method=t.method||"GET",t.headers=t.headers||{};const n=localStorage.getItem("jwtToken");n&&(t.headers.Authorization="Bearer "+n),t.method.toUpperCase()!=="GET"&&(t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.headers["CSRF-Token"]=Wc("CSRF-TOKEN"));const r=await fetch(e,t);if(r.status>=400)throw r;return r},Wc=e=>{const t=document.cookie.split(";");for(let n of t){const[r,i]=n.split("=");if(r.trim()===e)return i}return null},w2=e=>qt("/api/users/register",{method:"POST",body:JSON.stringify(e)}),S2=e=>qt("/api/users/login",{method:"POST",body:JSON.stringify(e)}),k2=()=>qt("/api/users/sessionRestore"),Hc=({user:e,token:t,issued:n,expiresSeconds:r})=>{const i=new Date(n),a=new Date(i.getTime()+r*1e3);e.sessionExpiration=a.toISOString(),localStorage.setItem("jwtToken",t),localStorage.setItem("currentUser",JSON.stringify(e))},Pv="session/SET_CURRENT_USER",_v="sesison/REMOVE_CURRENT_USER",E2="session/SET_EXPIRATION",Yc=e=>({type:Pv,sessionInfo:e}),b2=()=>({type:_v}),j2=e=>t=>w2(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>{Hc(n),t(Yc(n.user))}),Rv=e=>t=>S2(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>{Hc(n),t(Yc(n.user))}),Cu=()=>e=>{localStorage.removeItem("jwtToken"),localStorage.removeItem("currentUser"),e(b2())},N2=()=>e=>{k2().then(t=>{if(t.ok)return t.json();throw t}).then(t=>{Hc(t),e(Yc(t.user))})},El=e=>e.session,C2=JSON.parse(localStorage.getItem("currentUser"))||null,P2=(e=C2,t)=>{switch(t.type){case Pv:return t.sessionInfo;case _v:return null;case E2:return t.expiresAt;default:return e}},Tv="errors/SESSION_ALERT",Pu=e=>({type:Tv,boolean:e}),_2=e=>e.errors.session,R2={session:!1},T2=(e=R2,t)=>{const n={...e};switch(t.type){case Tv:return{...n,session:t.boolean};default:return e}};const O2=()=>{const e=Ot(),t=ja(),n=()=>{e(Pu(!1)),t("/login")},r=()=>{e(Cu()),e(Pu(!1)),t("/")};return u.jsx("div",{className:"session-alert-bg",children:u.jsxs("div",{className:"session-alert",children:[u.jsx("h3",{children:"Oh no! Your session has expired. "}),u.jsx("h3",{children:"Click below to log in again."}),u.jsx("button",{onClick:n,children:"Go to Login"}),u.jsx("button",{onClick:r,children:"Log out"})]})})},Kc=()=>{const e=Jt(El),t=Jt(_2),n=Ot(),r=Jn(),i=ja();return _.useEffect(()=>{if(e&&e.sessionExpiration){const a=setInterval(()=>{const o=Date.now(),l=new Date(e.sessionExpiration).getTime();o>=l-5e3&&(n(N2()),clearInterval(a))},500);return()=>{clearInterval(a)}}},[e,n]),_.useEffect(()=>{const a=r.pathname==="/login",o=r.pathname==="/",l=r.pathname==="/register";if(e&&e.sessionExpiration){const s=Date.now(),c=new Date(e.sessionExpiration).getTime();s>=c&&!a&&n(Pu(!0)),s>=c&&o&&n(Cu())}else!o&&!a&&!l&&i("/login")},[r,e,n,i]),u.jsxs("div",{children:[u.jsxs("div",{className:"navbar-container",children:[u.jsxs("div",{className:"title-section",children:[u.jsx("span",{children:u.jsx($e,{to:"/",children:u.jsx("img",{className:"nav-icon",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/Frame.svg"})})}),u.jsx("span",{className:"pet-portal-title",children:u.jsx($e,{to:"/",children:"Pet Portal"})})]}),u.jsx("div",{className:"auth-section",children:e?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"logout-button-container",children:[u.jsx("span",{className:"marker"}),u.jsx(X0,{to:"/dashboard",children:"Dashboard"})]}),u.jsx("span",{className:"deco-1"}),u.jsxs("div",{className:"logout-button-container",onClick:()=>n(Cu()),children:[u.jsx("span",{className:"marker"}),u.jsx($e,{to:"/",children:"Log out"})]})]}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"login-button-container",children:[u.jsx($e,{to:"/login",children:"Log in"}),u.jsx("span",{className:"marker"})]}),u.jsx("span",{className:"deco-1"}),u.jsxs("div",{className:"signup-button-container",children:[u.jsx("span",{className:"marker"}),u.jsx($e,{to:"/register",children:"Sign up"})]})]})})]}),t&&u.jsx(O2,{})]})};const rp=()=>{const e=Ot(),t=ja(),[n,r]=_.useState(),i=()=>{e(Rv({email:"demo@demo.com",password:"password"})).then(()=>t("/dashboard"))};return _.useEffect(()=>{r(!0)},[]),u.jsxs("div",{className:"home-page-container",children:[u.jsx(Kc,{}),u.jsx("div",{className:"welcome-container-1",children:u.jsxs("div",{className:"section-1",children:[u.jsx("img",{className:"bg-image",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/layered-waves-haikei+(1).svg"}),u.jsx("div",{className:"display-container",children:u.jsx("div",{className:"display-border",children:u.jsx("img",{className:"display-dog",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/depositphotos_570233356-stock-photo-australian-cattle-dog-forest-hiking.jpg"})})}),u.jsxs("div",{className:"section-1-text",children:[u.jsxs("div",{className:`welcome-heading ${n&&"loaded"}`,children:[u.jsx("h1",{children:"Welcome to Pet Portal."}),u.jsx("span",{className:"deco-1"}),u.jsx("span",{className:"deco-3"})]}),u.jsxs("div",{className:"welcome-message",children:[u.jsx("div",{className:"welcome-message-1",children:u.jsx("p",{children:"Whether you're a seasoned pet parent or embarking on your journey with a new furry friend, Pet Portal is here to simplify your pet care routine."})}),u.jsx("div",{className:"welcome-message-2",children:u.jsx("p",{children:"Keep track of your pet's important information, health reminders, and appointments all in one convenient location!"})}),u.jsx("div",{className:"welcome-message-3",children:u.jsxs("div",{className:"welcome-links",children:[u.jsx("h3",{children:" Ready to get started? "}),u.jsx("div",{className:"demo-login",onClick:i,children:"Try it out"})]})})]})]})]})}),u.jsx(kv,{})]})};const ip=()=>{const e=Jn(),{pathname:t}=e,n=Ot(),r=t==="/register",i=t==="/login",a=ja(),[o,l]=_.useState(""),[s,c]=_.useState(""),[f,d]=_.useState(""),[m,g]=_.useState(""),[y,w]=_.useState(""),[E,h]=_.useState(!1),p=v=>{v.preventDefault(),r?n(j2({email:o,password:s})).then(()=>a("/dashboard")).catch(j=>{j.ok||j.json().then(R=>w(R.email))}):i&&n(Rv({email:o,password:s})).then(()=>a("/dashboard")).catch(j=>{j.ok||g("Invalid credentials")}),l(""),c(""),d("")};return _.useEffect(()=>{l(""),c(""),d(""),g(""),w(""),h(!1)},[e.pathname]),_.useEffect(()=>{h(!!(s!==f&&r))},[s,f,r]),u.jsxs(u.Fragment,{children:[u.jsx(Kc,{}),u.jsxs("div",{className:"below-navbar",children:[u.jsxs("div",{className:"content-container",children:[u.jsx("img",{className:"bg-image",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/layered-waves-haikei+(1).svg"}),u.jsxs("div",{className:"session-form-container",children:[u.jsx("div",{className:"session-title",children:t==="/login"?u.jsx("h2",{children:"Log in to your account"}):u.jsx("h2",{children:"Create an Account"})}),u.jsxs("div",{className:"session-input-field",children:[u.jsxs("form",{className:"session-form",onSubmit:p,children:[u.jsx("div",{children:u.jsxs("label",{className:"email-label-container",children:[u.jsx("div",{className:"email-label",children:"Email:"}),u.jsx("input",{id:"email-input",type:"email",placeholder:"E-mail",onChange:v=>l(v.target.value)})]})}),u.jsx("span",{className:"auth-errors",children:y&&y}),u.jsx("div",{children:u.jsxs("label",{className:"password-label-container",children:[u.jsx("div",{className:"password-label",children:"Password:"}),u.jsx("input",{id:"password-input",type:"password",placeholder:"Password",onChange:v=>c(v.target.value)})]})}),u.jsx("div",{children:r&&u.jsxs("label",{className:"password-label-container",children:[u.jsx("div",{className:"password-label",children:"Confirm Password:"}),u.jsx("input",{id:"password-input",type:"password",placeholder:"Password",onChange:v=>d(v.target.value)})]})}),u.jsxs("span",{className:"auth-errors",children:[m&&m,E&&r&&"Passwords must match!"]}),u.jsx("button",{className:"auth-button-submit",type:"submit",disabled:!o.length||!s.length||E,children:"Submit"}),o.length&&s.length&&!E?u.jsx("span",{className:"deco-2"}):u.jsx("span",{})]}),i&&u.jsxs("div",{className:"auth-button-new-to-portal",children:[u.jsx("span",{className:"marker"}),u.jsx($e,{to:"/register",children:"New to Pet Portal"})]})]})]})]}),u.jsx(kv,{})]})]})},L2=e=>qt(`/api/users/${e}/pets`),A2=e=>fetch("/api/pets",{method:"POST",body:e,headers:{"CSRF-TOKEN":Wc("CSRF-TOKEN"),Accept:"application/json",Authorization:"Bearer "+localStorage.getItem("jwtToken")}}),M2=(e,t)=>fetch(`/api/pets/${t}`,{method:"PUT",body:e,headers:{"CSRF-TOKEN":Wc("CSRF-TOKEN"),Accept:"application/json",Authorization:"Bearer "+localStorage.getItem("jwtToken")}}),D2=e=>qt(`/api/pets/${e}`,{method:"DELETE"});function I2(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function z2(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function F2(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var ap=e=>Array.isArray(e)?e:[e];function U2(e){const t=Array.isArray(e[0])?e[0]:e;return F2(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function $2(e,t){const n=[],{length:r}=e;for(let i=0;i{n=uo(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function H2(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let a=0,o=0,l,s={},c=i.pop();typeof c=="object"&&(s=c,c=i.pop()),I2(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const f={...n,...s},{memoize:d,memoizeOptions:m=[],argsMemoize:g=Ov,argsMemoizeOptions:y=[],devModeChecks:w={}}=f,E=ap(m),h=ap(y),p=U2(i),v=d(function(){return a++,c.apply(null,arguments)},...E),j=g(function(){o++;const x=$2(p,arguments);return l=v.apply(null,x),l},...h);return Object.assign(j,{resultFunc:c,memoizedResultFunc:v,dependencies:p,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:d,argsMemoize:g})};return Object.assign(r,{withTypes:()=>r}),r}var Qc=H2(Ov),Y2=Object.assign((e,t=Qc)=>{z2(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(a=>e[a]);return t(r,(...a)=>a.reduce((o,l,s)=>(o[n[s]]=l,o),{}))},{withTypes:()=>Y2});const Lv="pets/RECEIVE_PETS",Av="pets/RECEIVE_PET",Mv="pets/REMOVE_PET",K2=e=>({type:Lv,pets:e}),Dv=e=>({type:Av,pet:e}),Q2=e=>({type:Mv,petId:e}),Iv=e=>t=>L2(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(K2(n))),G2=e=>t=>A2(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(Dv(n))).catch(n=>console.error(n)),X2=(e,t)=>n=>{if(!t)return console.error("attempted to update a pet without an id"),e;M2(e,t).then(r=>{if(r.ok)return r.json();throw r}).then(r=>n(Dv(r)))},J2=e=>t=>D2(e).then(n=>{if(n.ok)t(Q2(e));else throw n}),q2=Qc(e=>e.pets,e=>Object.values(e)),Z2=e=>t=>t.pets[e],eS=(e={},t)=>{const n={...e};switch(t.type){case Lv:return t.pets.reduce((r,i)=>(r[i._id]=i,r),{});case Av:return{...e,[t.pet._id]:t.pet};case Mv:return delete n[t.petId],n;default:return e}};const lp=["Rabies","Distemper/Parvo","Leptospirosis","Bordetella","Influenza","Lyme","Rattlesnake"],sp=["Rabies","FVRCP","FELV"],up=["Wellness","Illness","Procedure"],cp=["Flea/Tick Prevention","Heartworm Prevention"],tS=["Canine","Feline","Avian","Pocket Pet","Reptile","Equine","Aquatic"],fs={green:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/check-mark-circle-2-svgrepo-com.svg",upcoming:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/clock-ui-web-svgrepo-com.svg",overdue:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/exclamation-triangle-svgrepo-com.svg"},zv=e=>{const t=new Date,n=new Date(e);if(t>=n)return fs.overdue;let r=n.getMonth(),i=n.getFullYear(),a=n.getDate(),o=r-2;o<0&&(o+=12,i-=1),o===2&&(a=28);const l=new Date(i,o,a);return t>=l&&t<=n?fs.upcoming:fs.green},Fv=({modalState:e,setModalState:t,editModalState:n,setEditModalState:r,initialPetData:i,petId:a})=>{const[o,l]=_.useState((i==null?void 0:i.name)??""),s=i?new Date(i.dob).toISOString().split("T")[0]:"",[c,f]=_.useState(s),[d,m]=_.useState((i==null?void 0:i.sex)??""),[g,y]=_.useState((i==null?void 0:i.species)??""),[w,E]=_.useState((i==null?void 0:i.color)??""),[h,p]=_.useState((i==null?void 0:i.breed)??""),[v,j]=_.useState((i==null?void 0:i.microchipNum)??""),[R,x]=_.useState((i==null?void 0:i.insurancePolicyId)??""),[P,L]=_.useState((i==null?void 0:i.weight)??""),[D,$]=_.useState(i?i.photo:null),[Z,fe]=_.useState(!1),[he,Ie]=_.useState((i==null?void 0:i.imageUrl)??""),Qe=Ot(),dt=Jn(),{pathname:oe}=dt,I=k=>{k.preventDefault();const O=new FormData,z={_id:a,name:o,dob:c,sex:d,species:g,color:w,breed:h,microchipNum:v,insurancePolicyId:R,weight:P,imageUpdated:Z};D&&(O.append("image",D),fe(!0));for(const B in z)Object.hasOwn(z,B)&&O.append(`${B}`,z[B]);Qe(X2(O,a)),r(null),fe(!1)},Y=k=>{k.preventDefault();const O=new FormData,z={name:o,dob:c,sex:d,species:g,color:w,breed:h,microchipNum:v,insurancePolicyId:R,weight:P};for(const B in z)Object.prototype.hasOwnProperty.call(z,B)&&O.append(B,z[B]);D&&O.append("image",D),Qe(G2(O)),t(null),l(""),f(""),m(""),y(""),E(""),p(""),j(""),x(""),L(""),$(null),Ie("")},K=k=>{const O=k.currentTarget.files[0];$(O),Ie(URL.createObjectURL(O))},S=()=>u.jsxs(u.Fragment,{children:[u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"name-input-label",children:u.jsxs("span",{children:["Name",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("input",{placeholder:"Name",type:"text",value:o,onChange:k=>l(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"dob-input-label",children:u.jsxs("span",{children:["Date of Birth",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("input",{placeholder:"Date of birth",type:"date",value:c,onChange:k=>f(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"sex-select-label",children:u.jsxs("span",{children:["Sex",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("select",{className:"sex-select",placeholder:"Sex",value:d,onChange:k=>m(k.target.value),children:u.jsxs("optgroup",{children:[u.jsx("option",{disabled:!0,value:"",children:" "}),u.jsx("option",{value:"female",id:"female",children:"Female"}),u.jsx("option",{value:"male",id:"male",children:"Male"}),u.jsx("option",{value:"unknown",id:"unknown",children:"Unknown"})]})})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"species-input-label",children:u.jsxs("span",{children:["Species",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("select",{className:"species-select",value:g,onChange:k=>y(k.target.value),children:u.jsxs("optgroup",{children:[u.jsx("option",{disabled:!0,value:"",children:"Select Species"}),tS.map((k,O)=>u.jsx("option",{value:k.toLowerCase(),id:k.toLowerCase(),children:k},O))]})})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"color-input-label",children:u.jsxs("span",{children:["Color",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("input",{placeholder:"Color",type:"text",value:w,onChange:k=>E(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"breed-input-label",children:u.jsx("span",{children:"Breed"})}),u.jsx("input",{placeholder:"Breed",type:"text",value:h,onChange:k=>p(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"microchipNum-input-label",children:u.jsx("span",{children:"Microchip Number"})}),u.jsx("input",{placeholder:"Microchip number",type:"text",value:v,onChange:k=>j(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"insurance-policy-input-label",children:u.jsx("span",{children:"Insurance Policy Id"})}),u.jsx("input",{placeholder:"Insurance policy id",type:"text",value:R,onChange:k=>x(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"weight-input-label",children:u.jsx("span",{children:"Weight"})}),u.jsx("input",{placeholder:"Weight",type:"text",value:P,onChange:k=>L(k.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"photo-input-label",children:u.jsx("span",{children:e==="edit"?"Update Photo":"Please add photo of your pet !"})}),u.jsx("input",{id:"photo",onChange:K,type:"file"})]})]}),C=()=>{oe==="/dashboard"?t(null):r(null)};return u.jsx(u.Fragment,{children:u.jsx("div",{className:"modal-background",children:u.jsxs("div",{className:`${e?`${e}`:""}${n?`${n}`:""}-modal-content`,onClick:k=>k.stopPropagation(),children:[u.jsx("div",{className:`modal-content-top-${e?`${e}`:""}${n?`${n}`:""}`,children:u.jsx("button",{className:"pet-form-button",onClick:C,children:u.jsx("span",{children:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32","aria-hidden":"true",role:"presentation",focusable:"false",style:{display:"block",fill:"none",height:"16px",width:"16px",stroke:"currentcolor",strokeWidth:"3",overflow:"visible"},children:u.jsx("path",{d:"m6 6 20 20M26 6 6 26"})})})})}),u.jsxs("div",{className:"modal-content-center",children:[u.jsxs("div",{className:"modal-content-center-title",children:[e&&u.jsxs("h2",{className:"pet-modal-h2",children:[" ",u.jsx("span",{className:"pet-dash-highlight"}),"Add New Pet"]}),n&&u.jsxs("h2",{className:"pet-modal-h2",children:[u.jsx("span",{className:"pet-dash-highlight"}),"Edit Pet"]})]}),he&&u.jsx("div",{className:"file-preview",children:u.jsx("img",{src:he})}),u.jsx("div",{className:"modal-content-center-form",children:u.jsxs("form",{className:`${e?`${e}`:""}${n?`${n}`:""}-new-pet-form`,onSubmit:oe==="/dashboard"?Y:I,children:[S(),u.jsx("div",{className:`${e?`${e}`:""}${n?`${n}`:""}-new-pet-button`,children:u.jsxs("button",{type:"submit",children:[e&&u.jsx("h2",{children:"Add New Pet"}),n&&u.jsx("h2",{children:"Edit Pet"})]})})]})})]})]})})})};const nS=()=>{const e=Ot(),t=Jt(El),n=Jt(a=>a.pets),[r,i]=_.useState(null);return _.useEffect(()=>{t&&e(Iv(t._id))},[t,n.length,e]),u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"pet-grid-container",children:[u.jsxs("div",{className:"pet-grid-header-container",children:[u.jsx("div",{className:"pet-grid-header-text",children:u.jsx("h1",{children:"Your Pets"})}),u.jsx("div",{className:"get-grid-header-form",children:u.jsx("button",{className:"grid-add-pet-button",onClick:()=>i("add"),children:"+ Add pet"})})]}),u.jsx("div",{className:"pet-grid-divider"}),u.jsxs("div",{className:"pet-grid-index",children:[n&&Object.values(n).map((a,o)=>u.jsxs("div",{className:"pet-item",children:[u.jsx("div",{className:"pet-img",children:u.jsx($e,{to:`/dashboard/${a._id}`,children:u.jsx("img",{className:a._id,src:a.imageUrl})})}),u.jsx("div",{className:"pet-name",children:u.jsx("p",{children:a.name})})]},o)),!n&&u.jsx("div",{children:"Loading..."})]})]}),r&&u.jsx(Fv,{modalState:r,setModalState:i})]})};const rS=({clinicModalState:e,setClinicModalState:t})=>u.jsx("div",{className:"modal-background",onClick:n=>t(null),children:u.jsxs("div",{className:`modal-content-${e}`,onClick:n=>n.stopPropagation(),children:[u.jsx("div",{className:"clinic-modal-content-top",children:u.jsx("button",{onClick:n=>t(null),children:u.jsx("span",{children:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32","aria-hidden":"true",role:"presentation",focusable:"false",style:{display:"block",fill:"none",height:"16px",width:"16px",stroke:"currentcolor",strokeWidth:"3",overflow:"visible"},children:u.jsx("path",{d:"m6 6 20 20M26 6 6 26"})})})})}),u.jsx("div",{className:"clinic-modal-content-bottom",children:u.jsxs("div",{className:"clinic-content-container",children:[u.jsx("div",{className:"clinic-left",children:u.jsxs("div",{className:"clinic-search",children:[u.jsx("input",{type:"text"}),u.jsx("button",{children:"Search Clinic"})]})}),u.jsxs("div",{className:"clinic-right",children:[u.jsx("div",{children:"RIGHT"}),u.jsx("div",{children:"ALL CLINIC INFOs"})]})]})})]})});const iS=e=>qt(`/api/reminders/user/${e}`,{method:"GET"}),aS=e=>qt(`/api/reminders/pet/${e}`,{method:"GET"}),oS=e=>qt("/api/reminders",{method:"POST",body:JSON.stringify(e)}),lS=e=>qt(`/api/reminders/${e._id}`,{method:"PUT",body:JSON.stringify(e)}),sS=e=>qt(`/api/reminders/${e}`,{method:"DELETE"}),Uv="reminders/RECEIVE_REMINDERS",$v="reminders/RECEIVE_REMINDER",Vv="reminders/REMOVE_REMINDER",Bv=e=>({type:Uv,reminders:e}),Wv=e=>({type:$v,reminder:e}),uS=e=>({type:Vv,reminderId:e}),cS=e=>t=>iS(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(Bv(n))).catch(n=>console.error(n)),fS=e=>t=>aS(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(Bv(n))).catch(n=>console.error(n)),dS=e=>t=>oS(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(Wv(n))).catch(n=>console.error(n)),pS=e=>t=>lS(e).then(n=>{if(n.ok)return n.json();throw n}).then(n=>t(Wv(n))).catch(n=>console.error(n)),Gc=e=>t=>sS(e).then(n=>{if(n.ok)return t(uS(e)),n.json();throw n}).catch(n=>console.error(n)),Hv=Qc(e=>e.reminders,e=>{const t=Object.values(e);return t.sort((n,r)=>new Date(n.dueDate)-new Date(r.dueDate)),t}),mS=(e={},t)=>{const n={...e};switch(t.type){case $v:return{...e,[t.reminder._id]:t.reminder};case Uv:return t.reminders;case Vv:return delete n[t.reminderId],n;default:return e}};var hS={prefix:"fas",iconName:"pills",icon:[576,512,[],"f484","M112 96c-26.5 0-48 21.5-48 48V256h96V144c0-26.5-21.5-48-48-48zM0 144C0 82.1 50.1 32 112 32s112 50.1 112 112V368c0 61.9-50.1 112-112 112S0 429.9 0 368V144zM554.9 399.4c-7.1 12.3-23.7 13.1-33.8 3.1L333.5 214.9c-10-10-9.3-26.7 3.1-33.8C360 167.7 387.1 160 416 160c88.4 0 160 71.6 160 160c0 28.9-7.7 56-21.1 79.4zm-59.5 59.5C472 472.3 444.9 480 416 480c-88.4 0-160-71.6-160-160c0-28.9 7.7-56 21.1-79.4c7.1-12.3 23.7-13.1 33.8-3.1L498.5 425.1c10 10 9.3 26.7-3.1 33.8z"]},vS={prefix:"fas",iconName:"syringe",icon:[512,512,[128137],"f48e","M441 7l32 32 32 32c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-15-15L417.9 128l55 55c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-72-72L295 73c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l55 55L422.1 56 407 41c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0zM210.3 155.7l61.1-61.1c.3 .3 .6 .7 1 1l16 16 56 56 56 56 16 16c.3 .3 .6 .6 1 1l-191 191c-10.5 10.5-24.7 16.4-39.6 16.4H97.9L41 505c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l57-57V325.3c0-14.9 5.9-29.1 16.4-39.6l43.3-43.3 57 57c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-57-57 41.4-41.4 57 57c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-57-57z"]},bl={prefix:"far",iconName:"trash-can",icon:[448,512,[61460,"trash-alt"],"f2ed","M170.5 51.6L151.5 80h145l-19-28.4c-1.5-2.2-4-3.6-6.7-3.6H177.1c-2.7 0-5.2 1.3-6.7 3.6zm147-26.6L354.2 80H368h48 8c13.3 0 24 10.7 24 24s-10.7 24-24 24h-8V432c0 44.2-35.8 80-80 80H112c-44.2 0-80-35.8-80-80V128H24c-13.3 0-24-10.7-24-24S10.7 80 24 80h8H80 93.8l36.7-55.1C140.9 9.4 158.4 0 177.1 0h93.7c18.7 0 36.2 9.4 46.6 24.9zM80 128V432c0 17.7 14.3 32 32 32H336c17.7 0 32-14.3 32-32V128H80zm80 64V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16z"]},jl={prefix:"far",iconName:"pen-to-square",icon:[512,512,["edit"],"f044","M441 58.9L453.1 71c9.4 9.4 9.4 24.6 0 33.9L424 134.1 377.9 88 407 58.9c9.4-9.4 24.6-9.4 33.9 0zM209.8 256.2L344 121.9 390.1 168 255.8 302.2c-2.9 2.9-6.5 5-10.4 6.1l-58.5 16.7 16.7-58.5c1.1-3.9 3.2-7.5 6.1-10.4zM373.1 25L175.8 222.2c-8.7 8.7-15 19.4-18.3 31.1l-28.6 100c-2.4 8.4-.1 17.4 6.1 23.6s15.2 8.5 23.6 6.1l100-28.6c11.8-3.4 22.5-9.7 31.1-18.3L487 138.9c28.1-28.1 28.1-73.7 0-101.8L474.9 25C446.8-3.1 401.2-3.1 373.1 25zM88 64C39.4 64 0 103.4 0 152V424c0 48.6 39.4 88 88 88H360c48.6 0 88-39.4 88-88V312c0-13.3-10.7-24-24-24s-24 10.7-24 24V424c0 22.1-17.9 40-40 40H88c-22.1 0-40-17.9-40-40V152c0-22.1 17.9-40 40-40H200c13.3 0 24-10.7 24-24s-10.7-24-24-24H88z"]},gS={prefix:"far",iconName:"calendar-check",icon:[448,512,[],"f274","M128 0c13.3 0 24 10.7 24 24V64H296V24c0-13.3 10.7-24 24-24s24 10.7 24 24V64h40c35.3 0 64 28.7 64 64v16 48V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V192 144 128C0 92.7 28.7 64 64 64h40V24c0-13.3 10.7-24 24-24zM400 192H48V448c0 8.8 7.2 16 16 16H384c8.8 0 16-7.2 16-16V192zM329 297L217 409c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47 95-95c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"]};const yS=()=>{const e=Ot(),t=Jt(El),r=Jt(Hv).filter(d=>{var m;return d.user===((m=t==null?void 0:t._id)==null?void 0:m.toString())}),i=Jt(q2),a=new Date,o=[],l=[],s=r==null?void 0:r.filter((d,m)=>{let g=new Date(r[m].dueDate),y=Math.ceil((g-a)/(1e3*60*60*24));if(y<=5&&y>=0)return o.push(y),l.push(d.pet),d}),c=[],f=[];for(let d=0;d{t!=null&&t._id&&e(cS(t._id))},[e,t==null?void 0:t._id]),u.jsxs(u.Fragment,{children:[s.length===0&&u.jsx("div",{className:"no-upcoming-reminder",children:"Currently, there are no upcoming reminders!"}),s.length!==0&&s.map((d,m)=>u.jsxs("div",{className:"upcoming-reminder-container",children:[u.jsxs("div",{className:"upcoming-reminder-icon-container",children:[u.jsxs("div",{className:"upcoming-reminder-icon",children:[d.type==="appointment"&&u.jsx(Ee,{className:"appointment-icon",icon:gS,size:"xl"}),d.type==="vaccination"&&u.jsx(Ee,{className:"vaccination-icon",icon:vS,size:"xl"}),d.type==="medication"&&u.jsx(Ee,{className:"medication-icon",icon:hS,size:"xl"})]}),u.jsxs("div",{className:"upcoming-reminder-type",children:[d.type==="appointment"&&"appointment",d.type==="vaccination"&&"vaccination",d.type==="medication"&&"medication"]})]}),u.jsxs("div",{className:"upcoming-reminder-content",children:[u.jsx("div",{children:d.title}),u.jsx("div",{className:"upcoming-reminder-pet-name",children:c[m]&&u.jsx("p",{children:c[m]})}),u.jsx("div",{className:"upcoming-pet-image",children:f[m]&&u.jsx("img",{id:"upcoming-pet-image",src:f[m]})})]}),u.jsx("div",{className:"upcoming-reminder-pet",children:u.jsxs("div",{className:"upcoming-days",children:[o[m]<0&&u.jsx("p",{children:" Overdue! "}),o[m]===0&&u.jsx("p",{children:"due today"}),o[m]>0&&u.jsxs("p",{children:["in ",o[m]," days"]})]})})]},m))]})},xS=()=>{const[e,t]=_.useState(null);return u.jsxs("div",{className:"page-container",children:[u.jsx("img",{className:"bg-image",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/layered-waves-haikei+(1).svg"}),u.jsxs("h1",{className:"dashboard-header",children:[u.jsx("span",{className:"pet-dash-highlight"}),"Dashboard"]}),u.jsxs("div",{className:"dashboard-container",children:[u.jsx("div",{className:"index-container",children:u.jsx(nS,{})}),u.jsx("div",{className:"right-container",children:u.jsxs("div",{className:"all-reminders",children:[u.jsx("div",{className:"all-reminders-title",children:u.jsx("h3",{children:"Upcoming Reminders"})}),u.jsx(yS,{})]})})]}),e&&u.jsx(rS,{clinicModalState:e,setClinicModalState:t})]})};function Xc({name:e="reminder"}){const t=/[aeiou]/.test(e.charAt(0));return u.jsxs("div",{className:"empty-reminders",children:["Click the ",u.jsx("span",{children:"+"})," icon to add a",t&&"n"," ",e,"!"]})}const wS=({reminders:e,setModalState:t,setCurrentReminder:n})=>{const r=Ot(),i=e.filter(l=>l.type==="appointment"),a=l=>{const s=new Date(l),c=s.toLocaleDateString("en-US");let f=s.getHours();const d=s.getMinutes(),m=f>=12?"PM":"AM";f=f%12,f=f||12;const g=f.toString(),y=d<10?"0"+d:d.toString(),w=`${g}:${y} ${m}`;return`${c} - ${w}`},o=(l,s)=>{s.preventDefault(),s.stopPropagation(),r(Gc(l))};return u.jsxs(u.Fragment,{children:[i&&i.map((l,s)=>u.jsxs("div",{className:"appointment-info-container",children:[u.jsxs("div",{className:"appointment-header",children:[u.jsxs("div",{className:"appointment-title",children:[u.jsx("p",{children:l.title}),u.jsxs("div",{className:"edit-del-reminder",children:[u.jsx(Ee,{className:"edit-del-icons pen",icon:jl,onClick:()=>{n(l),t("edit")}}),u.jsx(Ee,{className:"edit-del-icons trash",icon:bl,onClick:c=>{o(l._id,c)}})]})]}),u.jsx("div",{className:"appointment-date",children:u.jsx("p",{children:a(l.dueDate)})})]}),u.jsx("div",{className:"reminder-divider"}),u.jsxs("div",{className:"appointment-content",children:[u.jsx("div",{className:"appointment-desc",children:u.jsx("p",{children:l.description})}),u.jsx("div",{className:"appointment-loc",children:u.jsx("p",{children:l.location})})]})]},s)),!i.length&&u.jsx(Xc,{name:"appointment reminder"})]})};const SS=({reminders:e,setModalState:t,setCurrentReminder:n})=>{const r=Ot(),i=e.filter(o=>o.type==="vaccination"),a=(o,l)=>{l.preventDefault(),l.stopPropagation(),r(Gc(o))};return u.jsxs(u.Fragment,{children:[i&&Object.values(i).map((o,l)=>u.jsx("div",{className:"vaccine-info-container",children:u.jsxs("div",{className:"vaccine-header",children:[u.jsxs("div",{className:"vaccine-desc",children:[u.jsx("p",{children:o.title}),u.jsxs("div",{className:"edit-del-reminder",children:[u.jsx(Ee,{className:"edit-del-icons pen",icon:jl,onClick:()=>{n(o),t("edit")}}),u.jsx(Ee,{className:"edit-del-icons trash",icon:bl,onClick:s=>{a(o._id,s)}})]})]}),u.jsxs("div",{className:"vaccine-date",children:[u.jsxs("p",{children:["Due: ",new Date(o.dueDate).toLocaleDateString("en-US")]}),u.jsx("img",{src:zv(o.dueDate),className:"proximity-icon"})]})]})},l)),!i.length&&u.jsx(Xc,{name:"vaccine reminder"})]})};const kS=({reminders:e,setModalState:t,setCurrentReminder:n})=>{const r=Ot(),i=e.filter(o=>o.type==="medication"),a=(o,l)=>{l.preventDefault(),l.stopPropagation(),r(Gc(o))};return u.jsxs(u.Fragment,{children:[i&&Object.values(i).map((o,l)=>u.jsxs("div",{className:"medication-info-container",children:[u.jsxs("div",{className:"medication-header",children:[u.jsxs("div",{className:"medication-title",children:[u.jsx("p",{children:o.title}),u.jsxs("div",{className:"edit-del-reminder",children:[u.jsx(Ee,{className:"edit-del-icons pen",icon:jl,onClick:()=>{n(o),t("edit")}}),u.jsx(Ee,{className:"edit-del-icons trash",icon:bl,onClick:s=>{a(o._id,s)}})]})]}),u.jsxs("div",{className:"medication-date",children:[u.jsxs("p",{children:["Due: ",new Date(o.dueDate).toLocaleDateString("en-US")]}),u.jsx("img",{src:zv(o.dueDate),className:"proximity-icon"})]})]}),o.description&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"reminder-divider"}),u.jsx("div",{className:"medication-content",children:u.jsx("p",{children:o.description})})]})]},l)),!i.length&&u.jsx(Xc,{name:"medication reminder"})]})};const ES=({modalState:e,setModalState:t,pet:n,reminder:r={}})=>{const[i,a]=_.useState(e==="edit"?r.type:""),[o,l]=_.useState(e==="edit"?r.title:""),[s,c]=_.useState(e==="edit"?r.dueDate.slice(0,10):""),[f,d]=_.useState(e==="edit"&&r.performDate?r.performDate.slice(0,10):""),[m,g]=_.useState(e==="edit"?r.description:""),[y,w]=_.useState(e==="edit"?r.location:""),E=Ot(),h=_.useCallback(P=>{switch(P){case"appointment":return up;case"vaccination":return n.species==="feline"?sp:lp;case"medication":return cp;default:return[]}},[n.species]),[p,v]=_.useState(e==="edit"?h(r.type):[]);_.useEffect(()=>{e!=="edit"&&(a(e),v(h(e)))},[i,e,h]),_.useEffect(()=>{},[E,r]);const j=P=>{switch(a(P.target.value),P.target.value.toLowerCase()){case"appointment":v(up);break;case"vaccination":v(n.species.toLowerCase()==="feline"?sp:lp);break;case"medication":v(cp);break;default:v([])}},R=P=>{P.preventDefault();const L={...r,type:i,title:o,dueDate:s,performDate:f,description:m,location:y,pet:n._id};E(e==="edit"?pS(L):dS(L)),t(null),a(""),l(""),c(""),d(""),g(""),w("")},x=()=>u.jsxs(u.Fragment,{children:[u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"type-select-label",children:u.jsxs("span",{children:["Type",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("select",{className:"type-select",placeholder:"Type",value:i,onChange:j,children:u.jsxs("optgroup",{children:[u.jsx("option",{disabled:!0,value:"",children:" Select Type "}),u.jsx("option",{id:"appt",value:"appointment",children:"Appointment"}),u.jsx("option",{id:"vaccine",value:"vaccination",children:"Vaccination"}),u.jsx("option",{id:"medication",value:"medication",children:"Medication"})]})})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"title-select-label",children:u.jsxs("span",{children:["Title",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("select",{className:"title-select",value:o,onChange:P=>l(P.target.value),children:u.jsxs("optgroup",{children:[u.jsxs("option",{disabled:!0,value:"",children:[" ",`Select ${e!=="edit"&&e}`," "]}),p&&p.map((P,L)=>u.jsx("option",{value:P,children:P},L))]})})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"duedate-input-label",children:u.jsxs("span",{children:["Due Date",u.jsx("span",{className:"required",children:"· required"})]})}),u.jsx("input",{placeholder:"Due Date",type:i==="appointment"?"datetime-local":"date",value:s,onChange:P=>c(P.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"perform-date-input-label",children:u.jsx("span",{children:"Perform Date"})}),u.jsx("input",{placeholder:"Perform Date",type:i==="appointment"?"datetime-local":"date",value:f,onChange:P=>d(P.target.value)})]}),u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"description-input-label",children:u.jsx("span",{children:"Description"})}),u.jsx("textarea",{className:"description-input",type:"textarea",value:m,onChange:P=>g(P.target.value),placeholder:"Description"})]}),e==="appointment"&&u.jsxs("label",{className:"input-label",children:[u.jsx("div",{className:"location-input-label",children:u.jsx("span",{children:"Location"})}),u.jsx("input",{placeholder:"Location",type:"text",value:y,onChange:P=>w(P.target.value)})]})]});return u.jsx(u.Fragment,{children:u.jsx("div",{className:"modal-background",children:u.jsxs("div",{className:`modal-content-${e}`,onClick:P=>P.stopPropagation(),children:[u.jsx("div",{className:"reminder-modal-content-top",children:u.jsx("button",{onClick:P=>t(null),children:u.jsx("span",{children:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32","aria-hidden":"true",role:"presentation",focusable:"false",style:{display:"block",color:"black",fill:"none",height:"16px",width:"16px",stroke:"currentColor",strokeWidth:"3",overflow:"visible"},children:u.jsx("path",{d:"m6 6 20 20M26 6 6 26"})})})})}),u.jsxs("div",{className:"modal-content-bottom",children:[u.jsx("div",{className:"modal-content-bottom-title",children:e&&u.jsxs("div",{className:"reminder-title",children:[u.jsx("span",{className:"pet-dash-highlight"}),e==="edit"?"Update":`Add ${e.charAt(0).toUpperCase()+e.slice(1)}`," Reminder"]})}),u.jsx("div",{className:"modal-content-bottom-form-container",children:u.jsxs("form",{className:"modal-content-bottom-form",onSubmit:R,children:[x(),u.jsx("div",{className:"reminder-button-container",children:u.jsx("button",{type:"submit",className:"add-new-reminder-button",children:e&&u.jsx("div",{className:e==="edit"?"reminder-button-edit":"reminder-button",children:e==="edit"?"Confirm Changes":`Add ${e.charAt(0).toUpperCase()+e.slice(1)} + Reminder`})})})]})})]})]})})})},bS=()=>{const{petId:e}=g0(),t=Jt(Z2(e)),n=Jt(El),r=Ot(),[i,a]=_.useState(null),[o,l]=_.useState(null),[s,c]=_.useState(null),f=Jt(Hv),d=g=>{const y=new Date(g),w=new Date;let E=w.getFullYear()-y.getFullYear(),h=w.getMonth()-y.getMonth(),p=w.getDate()-y.getDate();if((h<0||h===0&&p<0)&&(E--,h<0&&(h+=12),p<0)){const v=new Date(w.getFullYear(),w.getMonth()-1,0);p+=v.getDate()}if(E<1)if(h<4){let v=Math.floor(p/7),j=p%7;return v>1?`${v} weeks & ${j} days`:`${p} ${p===1?"day":"days"}`}else return`${h} months`;else return`${E} ${E===1?"year":"years"} & ${h} months`},m=g=>g.split(" ").map(y=>y[0].toUpperCase()+y.slice(1).toLowerCase()).join(" ");if(_.useEffect(()=>{n!=null&&n._id&&r(Iv(n._id)),e&&r(fS(e))},[r,n,e]),t)return u.jsxs("div",{className:"dash-page-container",children:[u.jsx("img",{className:"bg-image",src:"https://pet-portal-assets.s3.us-west-1.amazonaws.com/layered-waves-haikei+(1).svg"}),u.jsxs("div",{className:"pet-dashboard-container",children:[u.jsxs("div",{className:"pet-dashboard",children:[u.jsx($e,{to:"/dashboard",className:"back-link",children:" ← Back to your pets "}),u.jsxs("h1",{className:"pet-dash-header",children:[u.jsx("span",{className:"pet-dash-highlight"}),`${t.name}'s Profile`]}),u.jsxs("div",{className:"pet-metrics-container",children:[u.jsxs("div",{className:"pet-reminder-module",children:[u.jsxs("div",{className:"pet-reminder-header",children:[u.jsx("h3",{children:"Appointments"}),u.jsx("button",{className:"pet-dash-buttons",onClick:()=>a("appointment"),children:" + "})]}),u.jsx("div",{className:"appointment-index-container",children:u.jsx(wS,{reminders:f,setModalState:a,setCurrentReminder:c})})]}),u.jsxs("div",{className:"preventatives-module",children:[u.jsxs("div",{className:"vaccines",children:[u.jsxs("div",{className:"pet-vaccines-header",children:[u.jsx("h3",{children:"Vaccines"}),u.jsx("button",{className:"pet-dash-buttons",onClick:()=>a("vaccination"),children:" + "})]}),u.jsx("div",{className:"vaccinations-index-container",children:u.jsx(SS,{reminders:f,setModalState:a,setCurrentReminder:c})})]}),u.jsxs("div",{className:"medications",children:[u.jsxs("div",{className:"medications-header",children:[u.jsx("h3",{children:"Medications"}),u.jsx("button",{className:"pet-dash-buttons",onClick:()=>a("medication"),children:" + "})]}),u.jsx("div",{className:"medications-index-container",children:u.jsx(kS,{reminders:f,setModalState:a,setCurrentReminder:c})})]})]})]})]}),u.jsxs("div",{className:"pet-signalment",children:[u.jsx("div",{className:"profile-pic-border",children:u.jsx("img",{src:t.imageUrl,className:"profile-pic"})}),u.jsxs("div",{className:"pet-summary",children:[u.jsx("div",{className:"name-splash-container",children:u.jsx("div",{className:"name-border",children:u.jsx("h3",{children:m(t.name)})})}),u.jsx("div",{children:u.jsx($e,{to:"/dashboard",children:u.jsx("button",{className:"delete-pet-dash-buttons",onClick:()=>r(J2(e)),children:u.jsx(Ee,{icon:bl})})})}),u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Age: "}),u.jsx("p",{children:d(t.dob)}),u.jsx("span",{className:"decoration"})]}),u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Sex: "}),u.jsx("p",{children:t.sex}),u.jsx("span",{className:"decoration"})]}),u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Species: "}),u.jsx("p",{children:t.species}),u.jsx("span",{className:"decoration"})]}),u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Breed: "}),u.jsx("p",{children:t.breed}),u.jsx("span",{className:"decoration"})]}),u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Color: "}),u.jsx("p",{children:t.color}),u.jsx("span",{className:"decoration"})]}),t.insurancePolicyId&&u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Insurance ID: "}),u.jsx("p",{children:t.insurancePolicyId}),u.jsx("span",{className:"decoration"})]}),t.microchipNumber&&u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Microchip: "}),u.jsx("p",{children:t.microchipNumber}),u.jsx("span",{className:"decoration"})]}),t.weight&&u.jsxs("div",{className:"pet-attribute",children:[u.jsx("h3",{children:"Weight: "}),u.jsx("p",{children:t.weight}),u.jsx("span",{className:"decoration"})]}),u.jsx("div",{children:u.jsx("button",{className:"edit-pet-dash-buttons",onClick:()=>l("edit"),children:u.jsx(Ee,{icon:jl})})})]})]})]}),o&&u.jsx(Fv,{editModalState:o,setEditModalState:l,initialPetData:t,petId:e}),i&&u.jsx(ES,{modalState:i,setModalState:a,pet:t,reminder:s})]})},jS=z0([{path:"/",element:u.jsx(rp,{})},{path:"/login",element:u.jsx(ip,{})},{path:"/register",element:u.jsx(ip,{})},{path:"/dashboard",element:u.jsxs(u.Fragment,{children:[u.jsx(Kc,{}),u.jsx(R0,{})]}),children:[{index:!0,element:u.jsx(xS,{})},{path:":petId",element:u.jsx(bS,{})}]},{path:"*",element:u.jsx(rp,{})}]),NS=()=>u.jsx(Y0,{router:jS});function We(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var CS=(()=>typeof Symbol=="function"&&Symbol.observable||"@@observable")(),fp=CS,ds=()=>Math.random().toString(36).substring(7).split("").join("."),PS={INIT:`@@redux/INIT${ds()}`,REPLACE:`@@redux/REPLACE${ds()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ds()}`},el=PS;function _S(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Yv(e,t,n){if(typeof e!="function")throw new Error(We(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(We(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(We(1));return n(Yv)(e,t)}let r=e,i=t,a=new Map,o=a,l=0,s=!1;function c(){o===a&&(o=new Map,a.forEach((E,h)=>{o.set(h,E)}))}function f(){if(s)throw new Error(We(3));return i}function d(E){if(typeof E!="function")throw new Error(We(4));if(s)throw new Error(We(5));let h=!0;c();const p=l++;return o.set(p,E),function(){if(h){if(s)throw new Error(We(6));h=!1,c(),o.delete(p),a=null}}}function m(E){if(!_S(E))throw new Error(We(7));if(typeof E.type>"u")throw new Error(We(8));if(typeof E.type!="string")throw new Error(We(17));if(s)throw new Error(We(9));try{s=!0,i=r(i,E)}finally{s=!1}return(a=o).forEach(p=>{p()}),E}function g(E){if(typeof E!="function")throw new Error(We(10));r=E,m({type:el.REPLACE})}function y(){const E=d;return{subscribe(h){if(typeof h!="object"||h===null)throw new Error(We(11));function p(){const j=h;j.next&&j.next(f())}return p(),{unsubscribe:E(p)}},[fp](){return this}}}return m({type:el.INIT}),{dispatch:m,subscribe:d,getState:f,replaceReducer:g,[fp]:y}}function RS(e,t,n){return Yv(e,t,n)}function TS(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:el.INIT})>"u")throw new Error(We(12));if(typeof n(void 0,{type:el.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(We(13))})}function OS(e){const t=Object.keys(e),n={};for(let a=0;a"u")throw l&&l.type,new Error(We(14));c[d]=y,s=s||y!==g}return s=s||r.length!==Object.keys(o).length,s?c:o}}function LS(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function AS(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(We(15))};const o={getState:i.getState,dispatch:(s,...c)=>a(s,...c)},l=e.map(s=>s(o));return a=LS(...l)(i.dispatch),{...i,dispatch:a}}}function MS(e){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,e):i(a)}var DS=MS(),dp={exports:{}};(function(e,t){(function(n,r){r(t)})(vi,function(n){function r(S,C){S.super_=C,S.prototype=Object.create(C.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}})}function i(S,C){Object.defineProperty(this,"kind",{value:S,enumerable:!0}),C&&C.length&&Object.defineProperty(this,"path",{value:C,enumerable:!0})}function a(S,C,k){a.super_.call(this,"E",S),Object.defineProperty(this,"lhs",{value:C,enumerable:!0}),Object.defineProperty(this,"rhs",{value:k,enumerable:!0})}function o(S,C){o.super_.call(this,"N",S),Object.defineProperty(this,"rhs",{value:C,enumerable:!0})}function l(S,C){l.super_.call(this,"D",S),Object.defineProperty(this,"lhs",{value:C,enumerable:!0})}function s(S,C,k){s.super_.call(this,"A",S),Object.defineProperty(this,"index",{value:C,enumerable:!0}),Object.defineProperty(this,"item",{value:k,enumerable:!0})}function c(S,C,k){var O=S.slice((k||C)+1||S.length);return S.length=C<0?S.length+C:C,S.push.apply(S,O),S}function f(S){var C=typeof S>"u"?"undefined":Qe(S);return C!=="object"?C:S===Math?"math":S===null?"null":Array.isArray(S)?"array":Object.prototype.toString.call(S)==="[object Date]"?"date":typeof S.toString=="function"&&/^\/.*\//.test(S.toString())?"regexp":"object"}function d(S,C,k,O,z,B,X){z=z||[],X=X||[];var ne=z.slice(0);if(typeof B<"u"){if(O){if(typeof O=="function"&&O(ne,B))return;if((typeof O>"u"?"undefined":Qe(O))==="object"){if(O.prefilter&&O.prefilter(ne,B))return;if(O.normalize){var it=O.normalize(ne,B,S,C);it&&(S=it[0],C=it[1])}}}ne.push(B)}f(S)==="regexp"&&f(C)==="regexp"&&(S=S.toString(),C=C.toString());var pt=typeof S>"u"?"undefined":Qe(S),de=typeof C>"u"?"undefined":Qe(C),Re=pt!=="undefined"||X&&X[X.length-1].lhs&&X[X.length-1].lhs.hasOwnProperty(B),at=de!=="undefined"||X&&X[X.length-1].rhs&&X[X.length-1].rhs.hasOwnProperty(B);if(!Re&&at)k(new o(ne,C));else if(!at&&Re)k(new l(ne,S));else if(f(S)!==f(C))k(new a(ne,S,C));else if(f(S)==="date"&&S-C!==0)k(new a(ne,S,C));else if(pt==="object"&&S!==null&&C!==null)if(X.filter(function(Se){return Se.lhs===S}).length)S!==C&&k(new a(ne,S,C));else{if(X.push({lhs:S,rhs:C}),Array.isArray(S)){var ue;for(S.length,ue=0;ue=C.length?k(new s(ne,ue,new l(void 0,S[ue]))):d(S[ue],C[ue],k,O,ne,ue,X);for(;ue=0?(d(S[Se],C[Se],k,O,ne,Se,X),Lt=c(Lt,qn)):d(S[Se],void 0,k,O,ne,Se,X)}),Lt.forEach(function(Se){d(void 0,C[Se],k,O,ne,Se,X)})}X.length=X.length-1}else S!==C&&(pt==="number"&&isNaN(S)&&isNaN(C)||k(new a(ne,S,C)))}function m(S,C,k,O){return O=O||[],d(S,C,function(z){z&&O.push(z)},k),O.length?O:void 0}function g(S,C,k){if(k.path&&k.path.length){var O,z=S[C],B=k.path.length-1;for(O=0;O"u"&&(O[k.path[z]]=typeof k.path[z]=="number"?[]:{}),O=O[k.path[z]];switch(k.kind){case"A":g(k.path?O[k.path[z]]:O,k.index,k.item);break;case"D":delete O[k.path[z]];break;case"E":case"N":O[k.path[z]]=k.rhs}}}function w(S,C,k){if(k.path&&k.path.length){var O,z=S[C],B=k.path.length-1;for(O=0;O"u"&&(B[k.path[O]]={}),B=B[k.path[O]];switch(k.kind){case"A":w(B[k.path[O]],k.index,k.item);break;case"D":B[k.path[O]]=k.lhs;break;case"E":B[k.path[O]]=k.lhs;break;case"N":delete B[k.path[O]]}}}function h(S,C,k){if(S&&C){var O=function(z){k&&!k(S,C,z)||y(S,C,z)};d(S,C,O)}}function p(S){return"color: "+I[S].color+"; font-weight: bold"}function v(S){var C=S.kind,k=S.path,O=S.lhs,z=S.rhs,B=S.index,X=S.item;switch(C){case"E":return[k.join("."),O,"→",z];case"N":return[k.join("."),z];case"D":return[k.join(".")];case"A":return[k.join(".")+"["+B+"]",X];default:return[]}}function j(S,C,k,O){var z=m(S,C);try{O?k.groupCollapsed("diff"):k.group("diff")}catch{k.log("diff")}z?z.forEach(function(B){var X=B.kind,ne=v(B);k.log.apply(k,["%c "+I[X].text,p(X)].concat(dt(ne)))}):k.log("—— no diff ——");try{k.groupEnd()}catch{k.log("—— diff end —— ")}}function R(S,C,k,O){switch(typeof S>"u"?"undefined":Qe(S)){case"object":return typeof S[O]=="function"?S[O].apply(S,dt(k)):S[O];case"function":return S(C);default:return S}}function x(S){var C=S.timestamp,k=S.duration;return function(O,z,B){var X=["action"];return X.push("%c"+String(O.type)),C&&X.push("%c@ "+z),k&&X.push("%c(in "+B.toFixed(2)+" ms)"),X.join(" ")}}function P(S,C){var k=C.logger,O=C.actionTransformer,z=C.titleFormatter,B=z===void 0?x(C):z,X=C.collapsed,ne=C.colors,it=C.level,pt=C.diff,de=typeof C.titleFormatter>"u";S.forEach(function(Re,at){var ue=Re.started,Ze=Re.startedTime,Lt=Re.action,Se=Re.prevState,wn=Re.error,qn=Re.took,Zt=Re.nextState,en=S[at+1];en&&(Zt=en.prevState,qn=en.started-ue);var mt=O(Lt),kr=typeof X=="function"?X(function(){return Zt},Lt,Re):X,Bt=he(Ze),Zn=ne.title?"color: "+ne.title(mt)+";":"",Sn=["color: gray; font-weight: lighter;"];Sn.push(Zn),C.timestamp&&Sn.push("color: gray; font-weight: lighter;"),C.duration&&Sn.push("color: gray; font-weight: lighter;");var Wt=B(mt,Bt,qn);try{kr?ne.title&&de?k.groupCollapsed.apply(k,["%c "+Wt].concat(Sn)):k.groupCollapsed(Wt):ne.title&&de?k.group.apply(k,["%c "+Wt].concat(Sn)):k.group(Wt)}catch{k.log(Wt)}var mi=R(it,mt,[Se],"prevState"),bt=R(it,mt,[mt],"action"),Er=R(it,mt,[wn,Se],"error"),br=R(it,mt,[Zt],"nextState");if(mi)if(ne.prevState){var Ra="color: "+ne.prevState(Se)+"; font-weight: bold";k[mi]("%c prev state",Ra,Se)}else k[mi]("prev state",Se);if(bt)if(ne.action){var Nl="color: "+ne.action(mt)+"; font-weight: bold";k[bt]("%c action ",Nl,mt)}else k[bt]("action ",mt);if(wn&&Er)if(ne.error){var Ta="color: "+ne.error(wn,Se)+"; font-weight: bold;";k[Er]("%c error ",Ta,wn)}else k[Er]("error ",wn);if(br)if(ne.nextState){var jr="color: "+ne.nextState(Zt)+"; font-weight: bold";k[br]("%c next state",jr,Zt)}else k[br]("next state",Zt);pt&&j(Se,Zt,k,kr);try{k.groupEnd()}catch{k.log("—— log end ——")}})}function L(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},C=Object.assign({},Y,S),k=C.logger,O=C.stateTransformer,z=C.errorTransformer,B=C.predicate,X=C.logErrors,ne=C.diffPredicate;if(typeof k>"u")return function(){return function(pt){return function(de){return pt(de)}}};if(S.getState&&S.dispatch)return console.error(`[redux-logger] redux-logger not installed. Make sure to pass logger instance as middleware: // Logger with default options import { logger } from 'redux-logger' const store = createStore( diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 1b1b5b2..95e512c 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -5,7 +5,7 @@ Pet Portal - + diff --git a/frontend/src/components/Auth/Auth.jsx b/frontend/src/components/Auth/Auth.jsx index 87f6c76..9a2074d 100644 --- a/frontend/src/components/Auth/Auth.jsx +++ b/frontend/src/components/Auth/Auth.jsx @@ -73,7 +73,7 @@ const Auth = () =>{
- +
{pathname === '/login' ? ( diff --git a/frontend/src/components/Dashboard/Dashboard.jsx b/frontend/src/components/Dashboard/Dashboard.jsx index cae58c8..92181af 100644 --- a/frontend/src/components/Dashboard/Dashboard.jsx +++ b/frontend/src/components/Dashboard/Dashboard.jsx @@ -11,7 +11,7 @@ const Dashboard = () => { return(
- +

Dashboard

diff --git a/frontend/src/components/Home/Home.jsx b/frontend/src/components/Home/Home.jsx index c36c80c..1d37a94 100644 --- a/frontend/src/components/Home/Home.jsx +++ b/frontend/src/components/Home/Home.jsx @@ -27,7 +27,7 @@ const Home = () => {
- +
diff --git a/frontend/src/components/PetProfile/PetProfile.jsx b/frontend/src/components/PetProfile/PetProfile.jsx index 3b21965..e479f02 100644 --- a/frontend/src/components/PetProfile/PetProfile.jsx +++ b/frontend/src/components/PetProfile/PetProfile.jsx @@ -81,7 +81,7 @@ const PetProfile = () => { return(
- +