1import{p as E,r as h,j as e}from"./react-vendor-BDHNqS4B.js";import{b as S}from"./query-7-WHkg5t.js";import{C as o,a as d}from"./card-U4xgiZnN.js";import{c as A,u as F,n as O,B as p}from"./main-m_sUF2N4.js";import{g as $,a as q,b as z}from"./petApi-Co8Qo3h-.js";import{H as m}from"./heart-DRwCktcb.js";import{C as T}from"./calendar-KPQ2FJpt.js";import{P as u}from"./phone-B2rvvDkK.js";import"./amplify-DYDcjoow.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const U=A("Weight",[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]]),V=r=>{if(!r)return null;const a=new Date(r),t=new Date,s=t.getFullYear()-a.getFullYear(),n=t.getMonth()-a.getMonth();return n<0||n===0&&t.getDate()<a.getDate()?s-1:s},W=r=>r&&r.trim().replace(/^\{+/,"").replace(/\}+$/,""),M=r=>{if(!r)return null;const a=r.trim();if(!a)return null;const t=a.startsWith("+"),s=a.replace(/[^\d]/g,"");return s?t?`+${s}`:s.length===8?`+852${s}`:s.startsWith("852")&&s.length===11?`+${s}`:s:null},R={dog:"petTag.speciesValues.dog",dogs:"petTag.speciesValues.dogs",cat:"petTag.speciesValues.cat",cats:"petTag.speciesValues.cats"},ee=()=>{const{tagId:r}=E(),a=W(r),{t}=F(),{data:s,isLoading:n,error:P}=S({queryKey:["pet",a],queryFn:async()=>a?z(a):null,enabled:!!a,retry:!1}),[C,l]=h.useState(null),[I,c]=h.useState(!0);if(h.useEffect(()=>((async()=>{var y;const i=(y=s==null?void 0:s.profileImage)==null?void 0:y.trim();if(!s||!i){l(null),c(!1);return}try{if(/^https?:\/\//i.test(i)){l(i),c(!1);return}const x=await fetch("https://acyttnqicmxqrjodohud.supabase.co/functions/v1/getS3ImageUrl",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bucket:"petwellclientstoragee8eec-prod",filePath:i})});if(!x.ok){const D=await x.json().catch(()=>({}));throw new Error(D.error||"Failed to get image URL")}const g=await x.json();g.ok&&g.url?l(g.url):l(null)}catch(v){console.error("Failed to load pet profile image:",v),l(null)}finally{c(!1)}})(),()=>{c(!1)}),[s]),n||I)return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-secondary/20 flex items-center justify-center",children:e.jsx(O,{className:"w-8 h-8 animate-spin text-primary"})});if(P||!s||!s.isTagActivated)return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-secondary/20 flex items-center justify-center p-4",children:e.jsx(o,{className:"max-w-md w-full",children:e.jsxs(d,{className:"pt-6 text-center",children:[e.jsx("div",{className:"w-20 h-20 bg-muted rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(m,{className:"w-10 h-10 text-muted-foreground"})}),e.jsx("h2",{className:"text-2xl font-bold mb-2",children:"寵ç©å°æªåå"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:t("petTag.notActivated.description")}),e.jsx(p,{size:"lg",className:"w-full",onClick:()=>window.location.href=`/activate/${a}`,children:t("petTag.notActivated.cta")})]})})});const f=V(s.birthdate),k=$(s),j=q(s),N=M(j),b=(s.species||"").trim(),w=R[b.toLowerCase()],L=w?t(w):b;return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-secondary/20 py-8 px-4",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsx(o,{className:"mb-6 border-primary/50 bg-primary/5",children:e.jsx(d,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(m,{className:"w-6 h-6 text-primary flex-shrink-0 mt-1"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg mb-1",children:t("petTag.foundLostPet")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("petTag.thankYouMessage")})]})]})})}),e.jsx(o,{className:"mb-6",children:e.jsxs(d,{className:"pt-6",children:[e.jsxs("div",{className:"flex flex-col items-center mb-6",children:[e.jsx("img",{src:C||"/placeholder.svg",alt:s.name,className:"w-40 h-40 rounded-full object-cover border-4 border-primary/20 mb-4"}),e.jsx("h1",{className:"text-3xl font-bold mb-2",children:s.name})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[f!==null&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[e.jsx(T,{className:"w-5 h-5 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t("petTag.age")}),e.jsxs("p",{className:"font-semibold",children:[f," ",t("petTag.yearsOld")]})]})]}),s.species&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[e.jsx(m,{className:"w-5 h-5 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t("petTag.species")}),e.jsx("p",{className:"font-semibold",children:L})]})]}),s.breed&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[e.jsx(m,{className:"w-5 h-5 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t("petTag.breed")}),e.jsx("p",{className:"font-semibold",children:s.breed})]})]}),s.weight&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[e.jsx(U,{className:"w-5 h-5 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t("petTag.weight")}),e.jsxs("p",{className:"font-semibold",children:[s.weight," kg"]})]})]}),s.birthdate&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[e.jsx(T,{className:"w-5 h-5 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t("petTag.birthday")}),e.jsx("p",{className:"font-semibold",children:new Date(s.birthdate).toLocaleDateString()})]})]})]}),s.microchipId&&e.jsxs("div",{className:"mt-4 p-3 bg-muted/50 rounded-lg",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:t("petTag.microchipId")}),e.jsx("p",{className:"font-mono font-semibold",children:s.microchipId})]})]})}),e.jsx(o,{children:e.jsxs(d,{className:"pt-6 text-center",children:[e.jsx(u,{className:"w-12 h-12 text-primary mx-auto mb-3"}),e.jsx("h3",{className:"text-xl font-bold mb-2",children:t("petTag.contactOwner")}),e.jsx("p",{className:"text-foreground mb-4",children:k}),N?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-3 text-base font-semibold text-primary",children:j}),e.jsxs(p,{size:"lg",className:"w-full",onClick:()=>window.location.href=`tel:${N}`,children:[e.jsx(u,{className:"mr-2 h-5 w-5"}),t("petTag.callOwnerNow")]})]}):e.jsxs(p,{size:"lg",className:"w-full",disabled:!0,children:[e.jsx(u,{className:"mr-2 h-5 w-5"}),t("petTag.phoneNotAvailable")]})]})}),e.jsx("div",{className:"mt-6 text-center text-sm text-muted-foreground",children:e.jsx("p",{children:t("petTag.footer")})})]})})};export{ee as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.