1import{f as B,u as A,a as E,t as d,r as m,b as i,j as t,A as P,C as r,e as o,S as T,c as p,d as y,s as F,B as H,D as k}from"./index-bM8UT4Os.js";import{I as D}from"./input-BwpLlRYf.js";import{L as S}from"./label-2Seh_wFH.js";import{P as G}from"./plus-DSaqw8wa.js";import{T as $}from"./trash-2-4iirX7DH.js";import"./dialog-CxcTDVnZ.js";import"./useComposition-DO5dIJEj.js";/** 2 * @license lucide-react v0.453.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 W=B("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);function V(){A();const e=E(),s=d.useUtils(),[u,j]=m.useState(""),[g,N]=m.useState("2000"),[f,I]=m.useState(!1),{data:c}=d.recommendations.getDaily.useQuery();m.useEffect(()=>{c?.water?.recommended&&N(String(c.water.recommended))},[c?.water?.recommended]);const{data:n,refetch:b}=d.hydration.getByDate.useQuery({date:e}),x=d.hydration.add.useMutation({onSuccess:()=>{i.success("飲水è¨éå·²è¨ä½ï¼ð§"),j(""),b();const a=e.toISOString().slice(0,10);s.hydration.getByDate.invalidate({date:e}),s.meals.getByDate.invalidate({date:e}),s.workouts.getByDate.invalidate({date:e}),s.sleep.getByDate.invalidate({date:e}),s.supplements.getDailyChecklist.invalidate({date:a})},onError:()=>{i.error("å åå°ï¼è©¦å¤æ¬¡")}}),v=d.hydration.delete.useMutation({onSuccess:()=>{i.success("è¨éå·²å·å"),b();const a=e.toISOString().slice(0,10);s.hydration.getByDate.invalidate({date:e}),s.meals.getByDate.invalidate({date:e}),s.workouts.getByDate.invalidate({date:e}),s.sleep.getByDate.invalidate({date:e}),s.supplements.getDailyChecklist.invalidate({date:a})},onError:()=>{i.error("å·åå°ï¼è©¦å¤æ¬¡")}}),M=async a=>{if(a.preventDefault(),!u){i.error("å ¥è¿é£²æ°´éå ");return}await x.mutateAsync({waterIntake:parseFloat(u),dailyGoal:parseFloat(g)})},h=n?.reduce((a,C)=>a+(Number(C.waterIntake)||0),0)||0,L=parseFloat(g)||2e3,l=h/L*100,w=l>=100?{text:"鿍åï¼åå¾å¥½ ð",color:"text-green-400"}:l>=75?{text:"å°±å¿«éæ¨ï¼å æ²¹åï¼ðª",color:"text-cyan-400"}:l>=50?{text:"飲åä¸åï¼ç¹¼çºä¿æï¼",color:"text-blue-400"}:l>=25?{text:"éå§å¾åé¯ï¼è¨å¾ç¹¼çºé£²æ°´",color:"text-yellow-400"}:{text:`仲差 ${Math.round(L-h)} mlï¼è¨å¾é£²æ°´å`,color:"text-muted-foreground"};return t.jsx(P,{"data-loc":"client/src/pages/HydrationLog.tsx:101",title:"飲水è¨é",showBack:!0,children:t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:102",className:"py-6 px-4",children:t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:103",className:"max-w-3xl mx-auto space-y-5",children:[t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:104",className:"mb-2",children:[t.jsx("h1",{"data-loc":"client/src/pages/HydrationLog.tsx:105",className:"text-2xl md:text-3xl font-bold text-foreground",children:"ð§ 飲水è¨é"}),t.jsx("p",{"data-loc":"client/src/pages/HydrationLog.tsx:106",className:"text-sm text-muted-foreground mt-1",children:"è¨ä½ä½ æ¯æ¥å 飲水éï¼ä¿ææ°´å平衡"})]}),c?.water&&t.jsx(r,{"data-loc":"client/src/pages/HydrationLog.tsx:111",className:"card-premium !border-cyan-800/30",children:t.jsx(o,{"data-loc":"client/src/pages/HydrationLog.tsx:112",className:"pt-5",children:t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:113",className:"flex items-start gap-3",children:[t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:114",className:"bg-cyan-500/15 p-2.5 rounded-xl",children:t.jsx(T,{"data-loc":"client/src/pages/HydrationLog.tsx:115",className:"w-5 h-5 text-cyan-400"})}),t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:117",className:"flex-1",children:[t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:118",className:"flex items-center gap-2 mb-1",children:[t.jsx("p",{"data-loc":"client/src/pages/HydrationLog.tsx:119",className:"font-semibold text-cyan-300 text-sm",children:"AI åæ§åé£²æ°´ç®æ¨"}),t.jsx("button",{"data-loc":"client/src/pages/HydrationLog.tsx:120",onClick:()=>I(!f),className:"text-muted-foreground hover:text-cyan-400 transition-colors",children:t.jsx(W,{"data-loc":"client/src/pages/HydrationLog.tsx:124",className:"w-3.5 h-3.5"})})]}),t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:127",className:"flex items-baseline gap-2",children:[t.jsx("span",{"data-loc":"client/src/pages/HydrationLog.tsx:128",className:"text-2xl font-bold text-foreground",children:c.water.recommended}),t.jsx("span",{"data-loc":"client/src/pages/HydrationLog.tsx:129",className:"text-sm text-muted-foreground",children:"ml / æ¥"})]}),t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:131",className:"flex gap-4 mt-2 text-xs text-muted-foreground",children:[t.jsxs("span",{"data-loc":"client/src/pages/HydrationLog.tsx:132",children:["æä½ ",c.water.minimum," ml"]}),t.jsxs("span",{"data-loc":"client/src/pages/HydrationLog.tsx:133",children:["æé« ",c.water.maximum," ml"]})]}),f&&t.jsxs("p",{"data-loc":"client/src/pages/HydrationLog.tsx:136",className:"text-xs text-muted-foreground mt-3 bg-secondary/60 p-3 rounded-lg leading-relaxed",children:[c.water.explanation,t.jsx("br",{"data-loc":"client/src/pages/HydrationLog.tsx:138"}),t.jsx("br",{"data-loc":"client/src/pages/HydrationLog.tsx:138"}),"è¨ç®æ¹å¼ï¼é«é à 35ml à 活åéä¿æ¸ãéåæ¥å»ºè°é¡å¤è£å 500-1000mlã"]})]})]})})}),t.jsxs(r,{"data-loc":"client/src/pages/HydrationLog.tsx:149",className:"card-premium overflow-hidden relative",children:[t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:150",className:"absolute inset-0 bg-gradient-to-br from-cyan-500/5 to-blue-500/5 pointer-events-none"}),t.jsx(p,{"data-loc":"client/src/pages/HydrationLog.tsx:151",className:"pb-2 relative",children:t.jsxs(y,{"data-loc":"client/src/pages/HydrationLog.tsx:152",className:"flex items-center gap-2 text-foreground text-lg",children:[t.jsx(F,{"data-loc":"client/src/pages/HydrationLog.tsx:153",className:"w-5 h-5"}),"仿¥é£²æ°´é²åº¦"]})}),t.jsx(o,{"data-loc":"client/src/pages/HydrationLog.tsx:157",className:"relative",children:t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:158",className:"space-y-3",children:[t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:159",className:"flex justify-between items-end",children:[t.jsx("span",{"data-loc":"client/src/pages/HydrationLog.tsx:160",className:"text-3xl font-bold text-foreground",children:Math.round(h)}),t.jsxs("span",{"data-loc":"client/src/pages/HydrationLog.tsx:161",className:"text-muted-foreground text-sm",children:["/ ",Math.round(L)," ml"]})]}),t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:163",className:"w-full bg-secondary rounded-full h-3 overflow-hidden",children:t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:164",className:`h-full transition-all duration-500 ease-out rounded-full ${l>=100?"bg-gradient-to-r from-green-400 to-emerald-500":"bg-gradient-to-r from-cyan-400 to-blue-500"}`,style:{width:`${Math.min(l,100)}%`}})}),t.jsx("p",{"data-loc":"client/src/pages/HydrationLog.tsx:173",className:`text-sm font-medium ${w.color}`,children:w.text})]})})]}),t.jsxs(r,{"data-loc":"client/src/pages/HydrationLog.tsx:181",className:"card-premium",children:[t.jsx(p,{"data-loc":"client/src/pages/HydrationLog.tsx:182",className:"pb-3",children:t.jsx(y,{"data-loc":"client/src/pages/HydrationLog.tsx:183",className:"text-base text-foreground
6/90",children:"å¿«æå æ°´"})}),t.jsx(o,{"data-loc":"client/src/pages/HydrationLog.tsx:185",children:t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:186",className:"grid grid-cols-4 gap-2",children:[250,500,750,1e3].map(a=>t.jsxs(H,{"data-loc":"client/src/pages/HydrationLog.tsx:188",variant:"outline",onClick:()=>{x.mutate({waterIntake:a,dailyGoal:parseFloat(g)})},disabled:x.isPending,className:"text-sm h-12 border-cyan-800/30 hover:bg-cyan-900/30 hover:border-cyan-600/50 text-foreground/90",children:[t.jsx(k,{"data-loc":"client/src/pages/HydrationLog.tsx:200",className:"w-3.5 h-3.5 mr-1 text-cyan-400"}),a,"ml"]},a))})})]}),t.jsxs(r,{"data-loc":"client/src/pages/HydrationLog.tsx:209",className:"card-premium",children:[t.jsx(p,{"data-loc":"client/src/pages/HydrationLog.tsx:210",className:"pb-3",children:t.jsx(y,{"data-loc":"client/src/pages/HydrationLog.tsx:211",className:"text-base text-foreground/90",children:"èªå®ç¾©è¨é"})}),t.jsx(o,{"data-loc":"client/src/pages/HydrationLog.tsx:213",children:t.jsxs("form",{"data-loc":"client/src/pages/HydrationLog.tsx:214",onSubmit:M,className:"space-y-4",children:[t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:215",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:216",children:[t.jsx(S,{"data-loc":"client/src/pages/HydrationLog.tsx:217",htmlFor:"intake",className:"text-sm font-medium text-foreground/80",children:"飲水é (ml)"}),t.jsx(D,{"data-loc":"client/src/pages/HydrationLog.tsx:220",id:"intake",type:"text",inputMode:"numeric",pattern:"[0-9]*",placeholder:"250",value:u,onChange:a=>j(a.target.value.replace(/[^0-9]/g,"")),className:"mt-2"})]}),t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:232",children:[t.jsx(S,{"data-loc":"client/src/pages/HydrationLog.tsx:233",htmlFor:"goal",className:"text-sm font-medium text-foreground/80",children:"æ¯æ¥ç®æ¨ (ml)"}),t.jsx(D,{"data-loc":"client/src/pages/HydrationLog.tsx:236",id:"goal",type:"text",inputMode:"numeric",pattern:"[0-9]*",value:g,onChange:a=>N(a.target.value.replace(/[^0-9]/g,"")),className:"mt-2"})]})]}),t.jsxs(H,{"data-loc":"client/src/pages/HydrationLog.tsx:248",type:"submit",disabled:x.isPending,className:"w-full bg-cyan-600 hover:bg-cyan-700",children:[t.jsx(G,{"data-loc":"client/src/pages/HydrationLog.tsx:253",className:"w-4 h-4 mr-2"}),"å å
¥è¨é"]})]})})]}),t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:261",className:"space-y-3 mb-6",children:[t.jsxs("h2",{"data-loc":"client/src/pages/HydrationLog.tsx:262",className:"text-lg font-semibold text-foreground/90 mb-3",children:["仿¥è¨é (",n?.length||0,")"]}),n&&n.length>0?n.map(a=>t.jsx(r,{"data-loc":"client/src/pages/HydrationLog.tsx:267",className:"card-premium hover:opacity-90 transition-opacity",children:t.jsx(o,{"data-loc":"client/src/pages/HydrationLog.tsx:268",className:"py-3 px-4",children:t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:269",className:"flex justify-between items-center",children:[t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:270",className:"flex items-center gap-3",children:[t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:271",className:"bg-cyan-500/10 p-2 rounded-lg",children:t.jsx(k,{"data-loc":"client/src/pages/HydrationLog.tsx:272",className:"w-4 h-4 text-cyan-400"})}),t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:274",children:[t.jsxs("p",{"data-loc":"client/src/pages/HydrationLog.tsx:275",className:"font-semibold text-foreground",children:[Number(a.waterIntake)," ml"]}),t.jsx("p",{"data-loc":"client/src/pages/HydrationLog.tsx:276",className:"text-xs text-muted-foreground",children:new Date(a.createdAt).toLocaleTimeString("zh-TW",{hour:"2-digit",minute:"2-digit"})})]})]}),t.jsx(H,{"data-loc":"client/src/pages/HydrationLog.tsx:281",variant:"ghost",size:"sm",onClick:()=>v.mutate({id:a.id}),disabled:v.isPending,className:"hover:bg-red-900/20",children:t.jsx($,{"data-loc":"client/src/pages/HydrationLog.tsx:288",className:"w-4 h-4 text-red-400"})})]})})},a.id)):t.jsx(r,{"data-loc":"client/src/pages/HydrationLog.tsx:295",className:"card-glass-subtle",children:t.jsx(o,{"data-loc":"client/src/pages/HydrationLog.tsx:296",className:"py-8",children:t.jsx("p",{"data-loc":"client/src/pages/HydrationLog.tsx:297",className:"text-muted-foreground text-center",children:"仿¥æªæé£²æ°´è¨éï¼å¿«å²é£²æ¯æ°´å¦ ð§"})})})]}),t.jsxs(r,{"data-loc":"client/src/pages/HydrationLog.tsx:304",className:"card-glass-subtle",children:[t.jsx(p,{"data-loc":"client/src/pages/HydrationLog.tsx:305",className:"pb-2",children:t.jsx(y,{"data-loc":"client/src/pages/HydrationLog.tsx:306",className:"text-base text-foreground",children:"ð¡ 飲水å°è²¼å£«"})}),t.jsxs(o,{"data-loc":"client/src/pages/HydrationLog.tsx:308",className:"text-sm text-muted-foreground space-y-2",children:[t.jsx("p",{"data-loc":"client/src/pages/HydrationLog.tsx:309",children:t.jsx("strong",{"data-loc":"client/src/pages/HydrationLog.tsx:310",className:"text-foreground
6/80",children:"建è°é£²æ°´æé表ï¼"})}),t.jsxs("div",{"data-loc":"client/src/pages/HydrationLog.tsx:312",className:"grid grid-cols-2 gap-2 text-xs",children:[t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:313",className:"bg-secondary/60 p-2 rounded-lg",children:"âï¸ èµ·èº«ï¼250-500ml"}),t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:314",className:"bg-secondary/60 p-2 rounded-lg",children:"ð¤ï¸ ä¸åï¼500ml"}),t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:315",className:"bg-secondary/60 p-2 rounded-lg",children:"ð½ï¸ åé¤åï¼250ml"}),t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:316",className:"bg-secondary/60 p-2 rounded-lg",children:"âï¸ ä¸åï¼500ml"}),t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:317",className:"bg-secondary/60 p-2 rounded-lg",children:"ð æé¤åï¼250ml"}),t.jsx("div",{"data-loc":"client/src/pages/HydrationLog.tsx:318",className:"bg-secondary/60 p-2 rounded-lg",children:"ðï¸ éåæï¼+500ml"})]}),t.jsx("p",{"data-loc":"client/src/pages/HydrationLog.tsx:320",className:"text-xs text-muted-foreground mt-3",children:"éååå¾å天氣ç±å
æåè¨å¾é¡å¤è£æ°´ï¼é£²åæ°´å¯ä»¥å¹«å©æåæ°é³ä»£è¬ã"})]})]})]})})})}export{V 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.