From afdbf94450e2f7ee0fb48256fab4aebf9721bfde Mon Sep 17 00:00:00 2001 From: Blizzard Date: Thu, 30 Jul 2026 11:59:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E5=85=BB=E6=8A=A4=E6=96=B9?= =?UTF-8?q?=E6=A1=88=E9=A1=B5=E9=87=8D=E5=86=99=20=E2=80=94=E2=80=94=20?= =?UTF-8?q?=E5=A4=9A=E5=A5=97=E3=80=81=E9=87=8D=E5=A4=8D=E8=A7=84=E5=88=99?= =?UTF-8?q?=E3=80=81"=E5=BC=B9=E5=B1=82"=E6=94=B9=E6=88=90=E7=9C=9F?= =?UTF-8?q?=E5=AE=9E=E7=9A=84=E8=AE=B0=E5=BD=95=E4=BA=8B=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 你问的那个「弹层」是什么 sheet_type = 用户在小程序点这条计划时,直接跳到哪个记录表单。 「体重记录」这条关联 weight,点了就是体重表单,不用自己去记录页找。 叫「弹层」是因为那时候记录表单是底部弹出的浮层。三件事让这个名字烂掉了: 1. 记录表单上一批已经搬成 pages/addrecord 独立页面了 2. 可选值写死 6 个,而记录事项现在有 24 种且后台可配 —— 新加的一个都选不到 3. 里头的 report / taskDetail 早就不存在,选了等于点了没反应 现在改成「关联记录事项」,下拉读 record_types 表。后台加一种事项, 这里立刻能选到。 ## 这一页原来和后端已经对不上了 它的结构(今日任务 / 30 天计划 / 提醒 三段、第 N 天偏移)就是上一个提交在后端 推翻掉的那套。你在上面配的东西一部分已经不会生效——所以先改它,不等前端。 三段 → 两段(计划事项 / 到期提醒) 「第 N 天 + 标签」 → 重复规则:每天 / 每周(勾星期几)/ 每月(几号)/ 一次性 一个 (物种,阶段) 一套 → 多套,列表页展示,每套有名字和摘要 ## 后端跟着改成按 id 存取 原来是「按 species+stage 覆盖」:GET/PUT /admin/care-templates?species=&stage=。 那个模型下「让用户选方案」无从选起。改成 GET /admin/care-templates 列全部 GET /admin/care-templates/:id POST /admin/care-templates 新增或更新 DELETE /admin/care-templates/:id ## 唯一索引是真拦路石 从模型 tag 里去掉 uniqueIndex:idx_species_stage 之后,新增第二套仍然报 Duplicate entry —— **AutoMigrate 会加索引但不会删已有的**。写了个一次性程序 DropIndex 才通。这个坑值得记:改索引不能只改 tag。 ## 校验放服务端 一条配错(「每周」没勾星期几)会让套用时静默少排几条,用户看不出是配错了。 所以保存时就拦,并且报出是哪一条:「梳毛」选了每周,但没勾星期几。 ## 列表里报「展开后大概多少条」 只报明细条数会骗人:4 条「每天」套一整月就是 120 多条。 列表和小程序端的方案卡都按重复方式分开报数。 ## 验证(预生产库实跑 service 层) 8 套现有方案迁移后都有名字 没名字 / 每周没勾星期几 / 每月几号填 0 → 三条校验都拦住并指名道姓 (猫,成年期) 成功配出第二套「成年猫省心版」,小程序端能看到 2 套可选 tsc --noEmit 通过;npm run build 后重启,/admin/ 资源哈希与新构建一致 Co-Authored-By: Claude Opus 5 --- .../admin/dist/assets/index-0lrkDIfq.css | 1 - .../{index-DkaMHmZz.js => index-DyVnSuaV.js} | 6 +- .../admin/dist/assets/index-PPcOOdtF.css | 1 + pets-be/internal/admin/dist/index.html | 4 +- pets-be/internal/handler/admin.go | 52 +- pets-be/internal/router/router.go | 6 +- pets-be/internal/service/care_template.go | 116 +++- pets-be/web/admin/src/lib/api.ts | 11 +- pets-be/web/admin/src/pages/CareTemplates.tsx | 617 ++++++++++++------ 9 files changed, 546 insertions(+), 268 deletions(-) delete mode 100644 pets-be/internal/admin/dist/assets/index-0lrkDIfq.css rename pets-be/internal/admin/dist/assets/{index-DkaMHmZz.js => index-DyVnSuaV.js} (78%) create mode 100644 pets-be/internal/admin/dist/assets/index-PPcOOdtF.css diff --git a/pets-be/internal/admin/dist/assets/index-0lrkDIfq.css b/pets-be/internal/admin/dist/assets/index-0lrkDIfq.css deleted file mode 100644 index de95d4c..0000000 --- a/pets-be/internal/admin/dist/assets/index-0lrkDIfq.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background:40 33% 98%;--foreground:24 10% 15%;--card:0 0% 100%;--card-foreground:24 10% 15%;--primary:33 90% 62%;--primary-foreground:0 0% 100%;--secondary:40 30% 94%;--secondary-foreground:24 10% 25%;--muted:40 20% 94%;--muted-foreground:25 8% 45%;--accent:40 40% 92%;--accent-foreground:24 10% 20%;--destructive:5 78% 57%;--destructive-foreground:0 0% 100%;--border:33 25% 88%;--input:33 25% 88%;--ring:33 90% 62%;--radius:.6rem}*{border-color:hsl(var(--border))}body{background:hsl(var(--background));color:hsl(var(--foreground));margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-1\/2{left:50%}.right-4{right:1rem}.top-1\/2{top:50%}.top-4{top:1rem}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-1{margin-right:.25rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-4{margin-top:1rem}.mt-auto{margin-top:auto}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-8{height:2rem}.h-9{height:2.25rem}.min-h-24{min-height:6rem}.min-h-\[120px\]{min-height:120px}.min-h-screen{min-height:100vh}.w-16{width:4rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-56{width:14rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-36{min-width:9rem}.min-w-40{min-width:10rem}.max-w-2xl{max-width:42rem}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.-translate-x-1\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.self-center{align-self:center}.overflow-auto{overflow:auto}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-r{border-right-width:1px}.border-input{border-color:hsl(var(--input))}.border-primary\/40{border-color:hsl(var(--primary) / .4)}.border-transparent{border-color:#0000}.bg-black\/40{background-color:#0006}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/15{background-color:hsl(var(--destructive) / .15)}.bg-emerald-100{--tw-bg-opacity:1;background-color:rgb(209 250 229/var(--tw-bg-opacity,1))}.bg-muted{background-color:hsl(var(--muted))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-secondary{background-color:hsl(var(--secondary))}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.text-card-foreground{color:hsl(var(--card-foreground))}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-emerald-700{--tw-text-opacity:1;color:rgb(4 120 87/var(--tw-text-opacity,1))}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.underline-offset-4{text-underline-offset:4px}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a;--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=1024px){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} diff --git a/pets-be/internal/admin/dist/assets/index-DkaMHmZz.js b/pets-be/internal/admin/dist/assets/index-DyVnSuaV.js similarity index 78% rename from pets-be/internal/admin/dist/assets/index-DkaMHmZz.js rename to pets-be/internal/admin/dist/assets/index-DyVnSuaV.js index ceb5885..2da668b 100644 --- a/pets-be/internal/admin/dist/assets/index-DkaMHmZz.js +++ b/pets-be/internal/admin/dist/assets/index-DyVnSuaV.js @@ -16,7 +16,7 @@ Please change the parent to {if(!n._listeners)return;let t=n._listeners.length;for(;t-->0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new ha(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function vo(e){return function(t){return e.apply(null,t)}}function yo(e){return N.isObject(e)&&e.isAxiosError===!0}var bo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(bo).forEach(([e,t])=>{bo[t]=e});function xo(e){let t=new _o(e),n=tr(_o.prototype.request,t);return N.extend(n,_o.prototype,t,{allOwnKeys:!0}),N.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return xo(Pa(e,t))},n}var So=xo(fa);So.Axios=_o,So.CanceledError=ha,So.CancelToken=I,So.isCancel=ma,So.VERSION=Ja,So.toFormData=Hi,So.AxiosError=P,So.Cancel=So.CanceledError,So.all=function(e){return Promise.all(e)},So.spread=vo,So.isAxiosError=yo,So.mergeConfig=Pa,So.AxiosHeaders=Pi,So.formToJSON=e=>la(N.isHTMLForm(e)?new FormData(e):e),So.getAdapter=co.getAdapter,So.HttpStatusCode=bo,So.default=So;var Co=`pets_admin_token`,wo=`pets_admin_refresh`;function To(){return localStorage.getItem(Co)||``}function Eo(){return localStorage.getItem(wo)||``}function Do(e,t){localStorage.setItem(Co,e),t&&localStorage.setItem(wo,t)}function Oo(){localStorage.removeItem(Co),localStorage.removeItem(wo)}var L=So.create({baseURL:`/api`});L.interceptors.request.use(e=>{let t=To();return t&&(e.headers.Authorization=`Bearer ${t}`),e});var ko=null;function Ao(){if(!ko){let e=Eo();ko=(e?So.post(`/api/admin/refresh`,{refresh_token:e}).then(e=>{let t=e.data;if(!t||t.code!==0)throw Error(t?.message||`续期失败`);return Do(t.data.token,t.data.refresh_token),t.data.token}):Promise.reject(Error(`没有刷新令牌`))).finally(()=>{ko=null})}return ko}function jo(){Oo(),location.pathname!==`/admin/login`&&(location.href=`/admin/login`)}var Mo=[`/admin/login`,`/admin/refresh`,`/admin/logout`];L.interceptors.response.use(async e=>{let t=e.data;if(t&&typeof t==`object`&&`code`in t){if(t.code===0)return t.data;if(t.code===40100){let t=e.config,n=Mo.some(e=>(t.url||``).startsWith(e));if(!n&&!t._retried){t._retried=!0;try{let e=await Ao();return t.headers.Authorization=`Bearer ${e}`,await L.request(t)}catch{}}n||jo()}return Promise.reject(Error(t.message||`请求失败`))}return t},e=>Promise.reject(e));var R={login:(e,t)=>L.post(`/admin/login`,{username:e,password:t}),logout:()=>L.post(`/admin/logout`,{refresh_token:Eo()}),me:()=>L.get(`/admin/me`),stats:()=>L.get(`/admin/stats`),users:e=>L.get(`/admin/users`,{params:e}),setUserDisabled:(e,t)=>L.put(`/admin/users/${e}/disabled`,{disabled:t}),pets:e=>L.get(`/admin/pets`,{params:e}),posts:e=>L.get(`/admin/posts`,{params:e}),setPostStatus:(e,t)=>L.put(`/admin/posts/${e}/status`,{status:t}),comments:e=>L.get(`/admin/comments`,{params:e}),deleteComment:e=>L.delete(`/admin/comments/${e}`),articles:e=>L.get(`/admin/articles`,{params:e}),saveArticle:e=>L.post(`/admin/articles`,e),deleteArticle:e=>L.delete(`/admin/articles/${e}`),memberships:e=>L.get(`/admin/memberships`,{params:e}),careTemplateMeta:()=>L.get(`/admin/care-templates/meta`),careTemplate:(e,t)=>L.get(`/admin/care-templates`,{params:{species:e,stage:t}}),saveCareTemplate:(e,t,n)=>L.put(`/admin/care-templates`,{species:e,stage:t,items:n}),genCareTemplate:(e,t)=>L.post(`/admin/care-templates/generate`,{species:e,stage:t}),feedback:e=>L.get(`/admin/feedback`,{params:e}),setFeedbackHandled:(e,t)=>L.put(`/admin/feedback/${e}/handled`,{handled:t}),aiQuota:()=>L.get(`/admin/ai-quota`),saveAIQuota:e=>L.put(`/admin/ai-quota`,e),recordTypes:()=>L.get(`/admin/record-types`),saveRecordType:e=>L.post(`/admin/record-types`,e),deleteRecordType:e=>L.delete(`/admin/record-types/${e}`),breeds:e=>L.get(`/admin/breeds`,{params:e?{species:e}:{}}),saveBreed:e=>L.post(`/admin/breeds`,e),deleteBreed:e=>L.delete(`/admin/breeds/${e}`),communityBot:()=>L.get(`/admin/community-bot`),saveCommunityBot:e=>L.put(`/admin/community-bot`,e),genCommunityPosts:e=>L.post(`/admin/community-bot/generate`,{count:e})},No=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Po=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Fo=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Io=e=>{let t=Fo(e);return t.charAt(0).toUpperCase()+t.slice(1)},Lo={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Ro=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},zo=(0,S.createContext)({}),Bo=()=>(0,S.useContext)(zo),Vo=(0,S.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Bo()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,S.createElement)(`svg`,{ref:c,...Lo,width:t??l??Lo.width,height:t??l??Lo.height,stroke:e??f,strokeWidth:m,className:No(`lucide`,p,i),...!a&&!Ro(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,S.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Ho=(e,t)=>{let n=(0,S.forwardRef)(({className:n,...r},i)=>(0,S.createElement)(Vo,{ref:i,iconNode:t,className:No(`lucide-${Po(Io(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Io(e),n},Uo=Ho(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Wo=Ho(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),Go=Ho(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),Ko=Ho(`crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),qo=Ho(`dna`,[[`path`,{d:`m10 16 1.5 1.5`,key:`11lckj`}],[`path`,{d:`m14 8-1.5-1.5`,key:`1ohn8i`}],[`path`,{d:`M15 2c-1.798 1.998-2.518 3.995-2.807 5.993`,key:`80uv8i`}],[`path`,{d:`m16.5 10.5 1 1`,key:`696xn5`}],[`path`,{d:`m17 6-2.891-2.891`,key:`xu6p2f`}],[`path`,{d:`M2 15c6.667-6 13.333 0 20-6`,key:`1pyr53`}],[`path`,{d:`m20 9 .891.891`,key:`3xwk7g`}],[`path`,{d:`M3.109 14.109 4 15`,key:`q76aoh`}],[`path`,{d:`m6.5 12.5 1 1`,key:`cs35ky`}],[`path`,{d:`m7 18 2.891 2.891`,key:`1sisit`}],[`path`,{d:`M9 22c1.798-1.998 2.518-3.995 2.807-5.993`,key:`q3hbxp`}]]),Jo=Ho(`dog`,[[`path`,{d:`M11.25 16.25h1.5L12 17z`,key:`w7jh35`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309`,key:`u7s9ue`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5`,key:`v8hric`}]]),Yo=Ho(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Xo=Ho(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Zo=Ho(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Qo=Ho(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),$o=Ho(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),es=Ho(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),ts=Ho(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),ns=Ho(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),rs=Ho(`paw-print`,[[`circle`,{cx:`11`,cy:`4`,r:`2`,key:`vol9p0`}],[`circle`,{cx:`18`,cy:`8`,r:`2`,key:`17gozi`}],[`circle`,{cx:`20`,cy:`16`,r:`2`,key:`1v9bxh`}],[`path`,{d:`M9 10a5 5 0 0 1 5 5v3.5a3.5 3.5 0 0 1-6.84 1.045Q6.52 17.48 4.46 16.84A3.5 3.5 0 0 1 5.5 10Z`,key:`1ydw1z`}]]),is=Ho(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),as=Ho(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),os=Ho(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),ss=Ho(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),cs=Ho(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),ls=Ho(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),us=Ho(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function ds(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),hs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),gs=`-`,_s=[],vs=`arbitrary..`,ys=e=>{let t=Ss(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return xs(e);let n=e.split(gs);return bs(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ps(i,t):t:i||_s}return n[e]||_s}}},bs=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=bs(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(gs):e.slice(t).join(gs),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?vs+r:void 0})(),Ss=e=>{let{theme:t,classGroups:n}=e;return Cs(n,t)},Cs=(e,t)=>{let n=hs();for(let r in e){let i=e[r];ws(i,n,r,t)}return n},ws=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){Es(e,t,n);return}if(typeof e==`function`){Ds(e,t,n,r);return}Os(e,t,n,r)},Es=(e,t,n)=>{let r=e===``?t:ks(t,e);r.classGroupId=n},Ds=(e,t,n,r)=>{if(As(e)){ws(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ms(n,e))},Os=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(gs),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,js=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ms=`!`,Ns=`:`,Ps=[],Fs=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Is=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return Fs(t,l,c,u)};if(t){let e=t+Ns,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Fs(Ps,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Ls=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Rs=e=>({cache:js(e.cacheSize),parseClassName:Is(e),sortModifiers:Ls(e),postfixLookupClassGroupIds:zs(e),...ys(e)}),zs=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Bs),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ms:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e0?` `+l:l)}return l},Hs=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=Rs(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Vs(e,n);return i(e,a),a};return a=o,(...e)=>a(Hs(...e))},Gs=[],Ks=e=>{let t=t=>t[e]||Gs;return t.isThemeGetter=!0,t},qs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Js=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ys=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Xs=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zs=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Qs=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$s=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ec=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tc=e=>Ys.test(e),z=e=>!!e&&!Number.isNaN(Number(e)),nc=e=>!!e&&Number.isInteger(Number(e)),rc=e=>e.endsWith(`%`)&&z(e.slice(0,-1)),ic=e=>Xs.test(e),ac=()=>!0,oc=e=>Zs.test(e)&&!Qs.test(e),sc=()=>!1,cc=e=>$s.test(e),lc=e=>ec.test(e),uc=e=>!B(e)&&!V(e),dc=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),fc=e=>Dc(e,jc,sc),B=e=>qs.test(e),pc=e=>Dc(e,Mc,oc),mc=e=>Dc(e,Nc,z),hc=e=>Dc(e,Fc,ac),gc=e=>Dc(e,Pc,sc),_c=e=>Dc(e,kc,sc),vc=e=>Dc(e,Ac,lc),yc=e=>Dc(e,Ic,cc),V=e=>Js.test(e),bc=e=>Oc(e,Mc),xc=e=>Oc(e,Pc),Sc=e=>Oc(e,kc),Cc=e=>Oc(e,jc),wc=e=>Oc(e,Ac),Tc=e=>Oc(e,Ic,!0),Ec=e=>Oc(e,Fc,!0),Dc=(e,t,n)=>{let r=qs.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Oc=(e,t,n=!1)=>{let r=Js.exec(e);return r?r[1]?t(r[1]):n:!1},kc=e=>e===`position`||e===`percentage`,Ac=e=>e===`image`||e===`url`,jc=e=>e===`length`||e===`size`||e===`bg-size`,Mc=e=>e===`length`,Nc=e=>e===`number`,Pc=e=>e===`family-name`,Fc=e=>e===`number`||e===`weight`,Ic=e=>e===`shadow`,Lc=Ws(()=>{let e=Ks(`color`),t=Ks(`font`),n=Ks(`text`),r=Ks(`font-weight`),i=Ks(`tracking`),a=Ks(`leading`),o=Ks(`breakpoint`),s=Ks(`container`),c=Ks(`spacing`),l=Ks(`radius`),u=Ks(`shadow`),d=Ks(`inset-shadow`),f=Ks(`text-shadow`),p=Ks(`drop-shadow`),m=Ks(`blur`),h=Ks(`perspective`),g=Ks(`aspect`),_=Ks(`ease`),v=Ks(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),V,B],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[V,B,c],T=()=>[tc,`full`,`auto`,...w()],ee=()=>[nc,`none`,`subgrid`,V,B],te=()=>[`auto`,{span:[`full`,nc,V,B]},nc,V,B],ne=()=>[nc,`auto`,V,B],E=()=>[`auto`,`min`,`max`,`fr`,V,B],re=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],D=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],ie=()=>[`auto`,...w()],ae=()=>[tc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],oe=()=>[tc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],se=()=>[tc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],O=()=>[e,V,B],k=()=>[...b(),Sc,_c,{position:[V,B]}],ce=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],le=()=>[`auto`,`cover`,`contain`,Cc,fc,{size:[V,B]}],ue=()=>[rc,bc,pc],A=()=>[``,`none`,`full`,l,V,B],j=()=>[``,z,bc,pc],M=()=>[`solid`,`dashed`,`dotted`,`double`],de=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],fe=()=>[z,rc,Sc,_c],pe=()=>[``,`none`,m,V,B],me=()=>[`none`,z,V,B],he=()=>[`none`,z,V,B],ge=()=>[z,V,B],_e=()=>[tc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[ic],breakpoint:[ic],color:[ac],container:[ic],"drop-shadow":[ic],ease:[`in`,`out`,`in-out`],font:[uc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[ic],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[ic],shadow:[ic],spacing:[`px`,z],text:[ic],"text-shadow":[ic],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,tc,B,V,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,V,B]}],"container-named":[dc],columns:[{columns:[z,B,V,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[nc,`auto`,V,B]}],basis:[{basis:[tc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[z,tc,`auto`,`initial`,`none`,B]}],grow:[{grow:[``,z,V,B]}],shrink:[{shrink:[``,z,V,B]}],order:[{order:[nc,`first`,`last`,`none`,V,B]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...re(),`normal`]}],"justify-items":[{"justify-items":[...D(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...D()]}],"align-content":[{content:[`normal`,...re()]}],"align-items":[{items:[...D(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...D(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":re()}],"place-items":[{"place-items":[...D(),`baseline`]}],"place-self":[{"place-self":[`auto`,...D()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:ie()}],mx:[{mx:ie()}],my:[{my:ie()}],ms:[{ms:ie()}],me:[{me:ie()}],mbs:[{mbs:ie()}],mbe:[{mbe:ie()}],mt:[{mt:ie()}],mr:[{mr:ie()}],mb:[{mb:ie()}],ml:[{ml:ie()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ae()}],"inline-size":[{inline:[`auto`,...oe()]}],"min-inline-size":[{"min-inline":[`auto`,...oe()]}],"max-inline-size":[{"max-inline":[`none`,...oe()]}],"block-size":[{block:[`auto`,...se()]}],"min-block-size":[{"min-block":[`auto`,...se()]}],"max-block-size":[{"max-block":[`none`,...se()]}],w:[{w:[s,`screen`,...ae()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ae()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ae()]}],h:[{h:[`screen`,`lh`,...ae()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ae()]}],"max-h":[{"max-h":[`screen`,`lh`,...ae()]}],"font-size":[{text:[`base`,n,bc,pc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ec,hc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,rc,B]}],"font-family":[{font:[xc,gc,t]}],"font-features":[{"font-features":[B]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,V,B]}],"line-clamp":[{"line-clamp":[z,`none`,V,mc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,V,B]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,V,B]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...M(),`wavy`]}],"text-decoration-thickness":[{decoration:[z,`from-font`,`auto`,V,pc]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[z,`auto`,V,B]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[nc,V,B]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,V,B]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,V,B]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:k()}],"bg-repeat":[{bg:ce()}],"bg-size":[{bg:le()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},nc,V,B],radial:[``,V,B],conic:[nc,V,B]},wc,vc]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:j()}],"border-w-x":[{"border-x":j()}],"border-w-y":[{"border-y":j()}],"border-w-s":[{"border-s":j()}],"border-w-e":[{"border-e":j()}],"border-w-bs":[{"border-bs":j()}],"border-w-be":[{"border-be":j()}],"border-w-t":[{"border-t":j()}],"border-w-r":[{"border-r":j()}],"border-w-b":[{"border-b":j()}],"border-w-l":[{"border-l":j()}],"divide-x":[{"divide-x":j()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":j()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...M(),`hidden`,`none`]}],"divide-style":[{divide:[...M(),`hidden`,`none`]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...M(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[z,V,B]}],"outline-w":[{outline:[``,z,bc,pc]}],"outline-color":[{outline:O()}],shadow:[{shadow:[``,`none`,u,Tc,yc]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":[`none`,d,Tc,yc]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:j()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[z,pc]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":j()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":[`none`,f,Tc,yc]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[z,V,B]}],"mix-blend":[{"mix-blend":[...de(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":de()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[z]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[V,B]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[z]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:k()}],"mask-repeat":[{mask:ce()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,V,B]}],filter:[{filter:[``,`none`,V,B]}],blur:[{blur:pe()}],brightness:[{brightness:[z,V,B]}],contrast:[{contrast:[z,V,B]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Tc,yc]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:[``,z,V,B]}],"hue-rotate":[{"hue-rotate":[z,V,B]}],invert:[{invert:[``,z,V,B]}],saturate:[{saturate:[z,V,B]}],sepia:[{sepia:[``,z,V,B]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,V,B]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[z,V,B]}],"backdrop-contrast":[{"backdrop-contrast":[z,V,B]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,z,V,B]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[z,V,B]}],"backdrop-invert":[{"backdrop-invert":[``,z,V,B]}],"backdrop-opacity":[{"backdrop-opacity":[z,V,B]}],"backdrop-saturate":[{"backdrop-saturate":[z,V,B]}],"backdrop-sepia":[{"backdrop-sepia":[``,z,V,B]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,V,B]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[z,`initial`,V,B]}],ease:[{ease:[`linear`,`initial`,_,V,B]}],delay:[{delay:[z,V,B]}],animate:[{animate:[`none`,v,V,B]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,V,B]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":[`scale-3d`],skew:[{skew:ge()}],"skew-x":[{"skew-x":ge()}],"skew-y":[{"skew-y":ge()}],transform:[{transform:[V,B,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":[`translate-none`],zoom:[{zoom:[nc,V,B]}],accent:[{accent:O()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,V,B]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":O()}],"scrollbar-track-color":[{"scrollbar-track":O()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,V,B]}],fill:[{fill:[`none`,...O()]}],"stroke-w":[{stroke:[z,bc,pc,mc]}],stroke:[{stroke:[`none`,...O()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Rc(...e){return Lc(fs(e))}function zc(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Bc(...e){return t=>{let n=!1,r=e.map(e=>{let r=zc(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{children:r,...i}=t,a=null,o=!1,s=[];Xc(r)&&typeof el==`function`&&(r=el(r._payload)),S.Children.forEach(r,e=>{if(Jc(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Xc(n)&&typeof el==`function`&&(n=el(n._payload)),a=Gc(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=S.cloneElement(a,void 0,s):!o&&S.Children.count(r)===1&&S.isValidElement(r)&&(a=r);let c=a?qc(a):void 0,l=Vc(n,c);if(!a){if(r||r===0)throw Error(o?$c(e):Qc(e));return r}let u=Kc(i,a.props??{});return a.type!==S.Fragment&&(u.ref=n?l:c),S.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var Uc=Hc(`Slot`),Wc=Symbol.for(`radix.slottable`),Gc=(e,t)=>{if(`child`in e.props){let t=e.props.child;return S.isValidElement(t)?S.cloneElement(t,void 0,e.props.children(t.props.children)):null}return S.isValidElement(t)?t:null};function Kc(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function qc(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Jc(e){return S.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Wc}var Yc=Symbol.for(`react.lazy`);function Xc(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Yc&&`_payload`in e&&Zc(e._payload)}function Zc(e){return typeof e==`object`&&!!e&&`then`in e}var Qc=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,$c=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,el=S.use,tl=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,nl=fs,rl=(e,t)=>n=>{if(t?.variants==null)return nl(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=tl(t)||tl(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return nl(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},il=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),H=o(((e,t)=>{t.exports=il()}))(),al=rl(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90 shadow`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-card hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),U=S.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,H.jsx)(r?Uc:`button`,{className:Rc(al({variant:t,size:n,className:e})),ref:a,...i}));U.displayName=`Button`;var ol=[{to:`/`,label:`概览`,icon:Zo,end:!0},{to:`/users`,label:`用户管理`,icon:cs},{to:`/pets`,label:`宠物管理`,icon:rs},{to:`/posts`,label:`帖子审核`,icon:ts},{to:`/comments`,label:`评论管理`,icon:ns},{to:`/articles`,label:`文章管理`,icon:Yo},{to:`/care-templates`,label:`养护模板`,icon:Go},{to:`/record-types`,label:`记录事项`,icon:Qo},{to:`/breeds`,label:`品种管理`,icon:qo},{to:`/community-bot`,label:`社区运营`,icon:os},{to:`/feedback`,label:`意见反馈`,icon:es},{to:`/members`,label:`会员管理`,icon:Ko}];function sl(){let e=ht();function t(){R.logout().catch(()=>{}),Oo(),e(`/login`)}return(0,H.jsxs)(`div`,{className:`flex min-h-screen`,children:[(0,H.jsxs)(`aside`,{className:`w-56 shrink-0 border-r bg-card p-4 flex flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-3 mb-4`,children:[(0,H.jsx)(`span`,{className:`text-2xl`,children:`🐾`}),(0,H.jsx)(`span`,{className:`font-bold`,children:`毛孩子后台`})]}),(0,H.jsx)(`nav`,{className:`flex flex-col gap-1`,children:ol.map(e=>(0,H.jsxs)(Ln,{to:e.to,end:e.end,className:({isActive:e})=>Rc(`flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors`,e?`bg-primary/15 text-primary`:`text-muted-foreground hover:bg-accent`),children:[(0,H.jsx)(e.icon,{className:`h-4 w-4`}),e.label]},e.to))}),(0,H.jsx)(`div`,{className:`mt-auto`,children:(0,H.jsxs)(U,{variant:`ghost`,className:`w-full justify-start text-muted-foreground`,onClick:t,children:[(0,H.jsx)($o,{className:`h-4 w-4`}),` 退出登录`]})})]}),(0,H.jsx)(`main`,{className:`flex-1 p-8 overflow-auto`,children:(0,H.jsx)(Ut,{})})]})}var W=S.forwardRef(({className:e,type:t,...n},r)=>(0,H.jsx)(`input`,{type:t,ref:r,className:Rc(`flex h-9 w-full rounded-md border border-input bg-card px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),...n}));W.displayName=`Input`;var cl=l(h(),1),ll=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Hc(`Primitive.${t}`),r=S.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ul(e,t){e&&cl.flushSync(()=>e.dispatchEvent(t))}var dl=`Label`,fl=S.forwardRef((e,t)=>(0,H.jsx)(ll.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));fl.displayName=dl;var pl=fl,G=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(pl,{ref:n,className:Rc(`text-sm font-medium leading-none`,e),...t}));G.displayName=`Label`;var ml=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:Rc(`rounded-xl border bg-card text-card-foreground shadow-sm`,e),...t}));ml.displayName=`Card`;var hl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:Rc(`flex flex-col space-y-1.5 p-6`,e),...t}));hl.displayName=`CardHeader`;var gl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:Rc(`font-semibold leading-none tracking-tight`,e),...t}));gl.displayName=`CardTitle`;var _l=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:Rc(`p-6 pt-0`,e),...t}));_l.displayName=`CardContent`;function vl(){let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(!1),c=ht();async function l(t){if(t.preventDefault(),!e.trim()||!n){a(`请输入账号和密码`);return}s(!0),a(``);try{let t=await R.login(e.trim(),n);Do(t.token,t.refresh_token),c(`/`)}catch(e){a(e.message||`登录失败`)}finally{s(!1)}}return(0,H.jsx)(`div`,{className:`flex min-h-screen items-center justify-center p-4`,children:(0,H.jsxs)(ml,{className:`w-full max-w-sm`,children:[(0,H.jsxs)(hl,{children:[(0,H.jsx)(`div`,{className:`text-3xl text-center mb-2`,children:`🐾`}),(0,H.jsx)(gl,{className:`text-center text-xl`,children:`肉垫计划 · 后台管理`})]}),(0,H.jsx)(_l,{children:(0,H.jsxs)(`form`,{onSubmit:l,className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`账号`}),(0,H.jsx)(W,{value:e,autoComplete:`username`,placeholder:`请输入账号`,onChange:e=>t(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`密码`}),(0,H.jsx)(W,{type:`password`,value:n,autoComplete:`current-password`,placeholder:`请输入密码`,onChange:e=>r(e.target.value)})]}),i&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:i}),(0,H.jsx)(U,{type:`submit`,className:`w-full`,disabled:o,children:o?`登录中...`:`登录`})]})})]})})}function yl(){let[e,t]=(0,S.useState)(null);(0,S.useEffect)(()=>{R.stats().then(t).catch(()=>{})},[]);let n=[{label:`用户`,value:e?.users,icon:cs},{label:`宠物`,value:e?.pets,icon:rs},{label:`帖子`,value:e?.posts,icon:ts},{label:`健康记录`,value:e?.records,icon:Uo}];return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`概览`}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-4`,children:n.map(e=>(0,H.jsxs)(ml,{children:[(0,H.jsxs)(hl,{className:`flex-row items-center justify-between pb-2`,children:[(0,H.jsx)(gl,{className:`text-sm text-muted-foreground`,children:e.label}),(0,H.jsx)(e.icon,{className:`h-4 w-4 text-primary`})]}),(0,H.jsx)(_l,{children:(0,H.jsx)(`div`,{className:`text-3xl font-bold`,children:e.value??`—`})})]},e.label))})]})}function bl(e,t={}){let[n,r]=(0,S.useState)(1),[i]=(0,S.useState)(10),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(``),d=(0,S.useCallback)(()=>{c(!0),u(``),e({page:n,page_size:i,...t}).then(o).catch(e=>u(e.message||`加载失败`)).finally(()=>c(!1))},[n,i,JSON.stringify(t)]);return(0,S.useEffect)(()=>{d()},[d]),{page:n,setPage:r,pageSize:i,data:a,loading:s,error:l,reload:d,totalPages:a?Math.max(1,Math.ceil(a.total/i)):1}}var xl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,H.jsx)(`table`,{ref:n,className:Rc(`w-full caption-bottom text-sm`,e),...t})}));xl.displayName=`Table`;var Sl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`thead`,{ref:n,className:Rc(`[&_tr]:border-b`,e),...t}));Sl.displayName=`TableHeader`;var Cl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`tbody`,{ref:n,className:Rc(`[&_tr:last-child]:border-0`,e),...t}));Cl.displayName=`TableBody`;var wl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`tr`,{ref:n,className:Rc(`border-b transition-colors hover:bg-muted/50`,e),...t}));wl.displayName=`TableRow`;var K=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`th`,{ref:n,className:Rc(`h-10 px-3 text-left align-middle font-medium text-muted-foreground`,e),...t}));K.displayName=`TableHead`;var q=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`td`,{ref:n,className:Rc(`p-3 align-middle`,e),...t}));q.displayName=`TableCell`;var Tl=rl(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold`,{variants:{variant:{default:`border-transparent bg-primary/15 text-primary`,secondary:`border-transparent bg-secondary text-secondary-foreground`,destructive:`border-transparent bg-destructive/15 text-destructive`,outline:`text-foreground`,success:`border-transparent bg-emerald-100 text-emerald-700`,muted:`border-transparent bg-muted text-muted-foreground`}},defaultVariants:{variant:`default`}});function El({className:e,variant:t,...n}){return(0,H.jsx)(`div`,{className:Rc(Tl({variant:t}),e),...n})}function Dl({page:e,totalPages:t,total:n,onChange:r}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between pt-4 text-sm text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[`共 `,n,` 条`]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(U,{variant:`outline`,size:`sm`,disabled:e<=1,onClick:()=>r(e-1),children:`上一页`}),(0,H.jsxs)(`span`,{children:[e,` / `,t]}),(0,H.jsx)(U,{variant:`outline`,size:`sm`,disabled:e>=t,onClick:()=>r(e+1),children:`下一页`})]})]})}function Ol(){let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(``),{page:o,setPage:s,data:c,totalPages:l,reload:u}=bl(R.users,{keyword:n,type:i});async function d(e){await R.setUserDisabled(e.id,!e.disabled),u()}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`用户管理`}),(0,H.jsxs)(`div`,{className:`flex gap-2 mb-4`,children:[(0,H.jsx)(W,{placeholder:`搜索昵称`,value:e,onChange:e=>t(e.target.value),className:`max-w-xs`,onKeyDown:t=>t.key===`Enter`&&(s(1),r(e))}),(0,H.jsx)(U,{onClick:()=>(s(1),r(e)),children:`搜索`}),(0,H.jsxs)(`select`,{className:`h-9 rounded-md border border-input bg-card px-3 text-sm`,value:i,onChange:e=>(s(1),a(e.target.value)),children:[(0,H.jsx)(`option`,{value:``,children:`全部账号`}),(0,H.jsx)(`option`,{value:`real`,children:`真实用户`}),(0,H.jsx)(`option`,{value:`bot`,children:`机器人(AI)`})]})]}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`昵称`}),(0,H.jsx)(K,{children:`手机号`}),(0,H.jsx)(K,{children:`宠物档案`}),(0,H.jsx)(K,{children:`建档`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{className:`text-right`,children:`操作`})]})}),(0,H.jsx)(Cl,{children:c?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsxs)(q,{className:`font-medium`,children:[e.nickname,e.is_bot&&(0,H.jsx)(El,{variant:`muted`,className:`ml-2`,children:`AI`})]}),(0,H.jsx)(q,{children:e.phone||`—`}),(0,H.jsx)(q,{className:`whitespace-nowrap`,children:e.pet_count>0?`${e.pet_count} 个`:(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsx)(q,{children:e.onboarded?`已建档`:`未建档`}),(0,H.jsx)(q,{children:e.disabled?(0,H.jsx)(El,{variant:`destructive`,children:`已禁用`}):(0,H.jsx)(El,{variant:`success`,children:`正常`})}),(0,H.jsx)(q,{className:`text-right`,children:(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>d(e),children:e.disabled?`启用`:`禁用`})})]},e.id))})]}),(0,H.jsx)(Dl,{page:o,totalPages:l,total:c?.total??0,onChange:s})]})})]})}function kl(){let{page:e,setPage:t,data:n,totalPages:r}=bl(R.pets);return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`宠物管理`}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`宠物`}),(0,H.jsx)(K,{children:`类型`}),(0,H.jsx)(K,{children:`阶段`}),(0,H.jsx)(K,{children:`体重`}),(0,H.jsx)(K,{children:`主人ID`})]})}),(0,H.jsx)(Cl,{children:n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsxs)(q,{className:`font-medium`,children:[(0,H.jsx)(`span`,{className:`mr-1`,children:e.emoji}),e.name]}),(0,H.jsx)(q,{children:e.type}),(0,H.jsx)(q,{children:e.stage}),(0,H.jsx)(q,{children:e.weight}),(0,H.jsx)(q,{children:e.user_id})]},e.id))})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})})]})}var Al={published:{label:`已发布`,variant:`success`},hidden:{label:`已隐藏`,variant:`muted`},deleted:{label:`已删除`,variant:`destructive`}};function jl(e){if(!e)return`—`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`—`;let n=e=>String(e).padStart(2,`0`),r=`${n(t.getHours())}:${n(t.getMinutes())}`,i=new Date;if(t.toDateString()===i.toDateString())return`今天 ${r}`;let a=new Date(i.getTime()-864e5);return t.toDateString()===a.toDateString()?`昨天 ${r}`:`${t.getFullYear()===i.getFullYear()?``:t.getFullYear()+`-`}${n(t.getMonth()+1)}-${n(t.getDate())} ${r}`}function Ml(){let{page:e,setPage:t,data:n,totalPages:r,reload:i}=bl(R.posts);async function a(e,t){await R.setPostStatus(e,t),i()}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`帖子审核`}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`作者`}),(0,H.jsx)(K,{children:`内容`}),(0,H.jsx)(K,{children:`赞/评`}),(0,H.jsx)(K,{children:`发布时间`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{className:`text-right`,children:`操作`})]})}),(0,H.jsx)(Cl,{children:n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsxs)(q,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{className:`mr-1`,children:e.author_emoji}),e.author_name]}),(0,H.jsx)(q,{className:`max-w-sm truncate`,children:e.content}),(0,H.jsxs)(q,{className:`whitespace-nowrap`,children:[e.like_count,` / `,e.comment_count]}),(0,H.jsx)(q,{className:`whitespace-nowrap text-muted-foreground`,children:jl(e.created_at)}),(0,H.jsx)(q,{children:(0,H.jsx)(El,{variant:Al[e.status]?.variant,children:Al[e.status]?.label??e.status})}),(0,H.jsxs)(q,{className:`text-right space-x-2 whitespace-nowrap`,children:[e.status!==`published`&&(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>a(e.id,`published`),children:`恢复`}),e.status===`published`&&(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>a(e.id,`hidden`),children:`隐藏`}),(0,H.jsx)(U,{variant:`destructive`,size:`sm`,onClick:()=>a(e.id,`deleted`),children:`删除`})]})]},e.id))})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})})]})}function Nl(){let{page:e,setPage:t,data:n,totalPages:r,reload:i}=bl(R.comments);async function a(e){await R.deleteComment(e),i()}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`评论管理`}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`帖子ID`}),(0,H.jsx)(K,{children:`作者`}),(0,H.jsx)(K,{children:`内容`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{className:`text-right`,children:`操作`})]})}),(0,H.jsx)(Cl,{children:n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsx)(q,{children:e.post_id}),(0,H.jsx)(q,{className:`whitespace-nowrap`,children:e.author_name}),(0,H.jsx)(q,{className:`max-w-sm truncate`,children:e.content}),(0,H.jsx)(q,{children:e.status===`deleted`?(0,H.jsx)(El,{variant:`destructive`,children:`已删除`}):(0,H.jsx)(El,{variant:`success`,children:`正常`})}),(0,H.jsx)(q,{className:`text-right`,children:e.status!==`deleted`&&(0,H.jsx)(U,{variant:`destructive`,size:`sm`,onClick:()=>a(e.id),children:`删除`})})]},e.id))})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})})]})}typeof window<`u`&&window.document&&window.document.createElement;function Pl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Fl(e,t=[]){let n=[];function r(t,r){let i=S.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=S.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=S.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>S.createContext(e));return function(n){let r=n?.[e]||t;return S.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Il(i,...t)]}function Il(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var J=globalThis?.document?S.useLayoutEffect:()=>{},Ll=S.useId||(()=>void 0),Y=0;function X(e){let[t,n]=S.useState(Ll());return J(()=>{e||n(e=>e??String(Y++))},[e]),e||(t?`radix-${t}`:``)}var Z=S.useEffectEvent,Rl=S.useInsertionEffect;function zl(e){if(typeof Z==`function`)return Z(e);let t=S.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof Rl==`function`?Rl(()=>{t.current=e}):J(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}var Bl=S.useInsertionEffect||J;function Vl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Hl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=S.useRef(e!==void 0);S.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,S.useCallback(t=>{if(s){let n=Ul(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Hl({defaultProp:e,onChange:t}){let[n,r]=S.useState(e),i=S.useRef(n),a=S.useRef(t);return Bl(()=>{a.current=t},[t]),S.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ul(e){return typeof e==`function`}function Wl(e){let t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}var Gl=`DismissableLayer`,Kl=`dismissableLayer.update`,ql=`dismissableLayer.pointerDownOutside`,Jl=`dismissableLayer.focusOutside`,Yl,Xl=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Zl=S.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=S.useContext(Xl),[d,f]=S.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=S.useState({}),h=Vc(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(_),y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,C=S.useRef(!1),w=tu(e=>{let t=e.target;if(!(t instanceof Node))return;let n=[...u.branches].some(e=>e.contains(t));!x||n||(a?.(e),s?.(e),e.defaultPrevented||c?.())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces}),T=nu(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),ee=d?y===g.length-1:!1,te=zl(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return S.useEffect(()=>{if(ee)return p.addEventListener(`keydown`,te,{capture:!0}),()=>p.removeEventListener(`keydown`,te,{capture:!0})},[p,ee]),S.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Yl=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),ru(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Yl))}},[d,p,n,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),ru())},[d,u]),S.useEffect(()=>{let e=()=>m({});return document.addEventListener(Kl,e),()=>document.removeEventListener(Kl,e)},[]),(0,H.jsx)(ll.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Pl(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Pl(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Pl(e.onPointerDownCapture,w.onPointerDownCapture)})});Zl.displayName=Gl;var Ql=`DismissableLayerBranch`,$l=S.forwardRef((e,t)=>{let n=S.useContext(Xl),r=S.useRef(null),i=Vc(t,r);return S.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,H.jsx)(ll.div,{...e,ref:i})});$l.displayName=Ql;function eu(){let e=S.useContext(Xl),[t,n]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function tu(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a}=t,o=Wl(e),s=S.useRef(!1),c=S.useRef(!1),l=S.useRef(new Map),u=S.useRef(()=>{});return S.useEffect(()=>{function e(){c.current=!1,i.current=!1,l.current.clear()}function t(){return Array.from(l.current.values()).some(Boolean)}function d(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||l.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{c.current&&u.current()},0)}function f(e){c.current&&l.current.set(e.type,!1)}let p=a=>{if(a.target&&!s.current){let s=function(){n.removeEventListener(`click`,u.current);let r=t();e(),r||iu(ql,o,d,{discrete:!0})},d={originalEvent:a};c.current=!0,i.current=r&&a.button===0,l.current.clear(),!r||a.button!==0?s():(n.removeEventListener(`click`,u.current),u.current=s,n.addEventListener(`click`,u.current,{once:!0}))}else n.removeEventListener(`click`,u.current),e();s.current=!1},m=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of m)n.addEventListener(e,d,!0),n.addEventListener(e,f);let h=window.setTimeout(()=>{n.addEventListener(`pointerdown`,p)},0);return()=>{window.clearTimeout(h),n.removeEventListener(`pointerdown`,p),n.removeEventListener(`click`,u.current);for(let e of m)n.removeEventListener(e,d,!0),n.removeEventListener(e,f)}},[n,o,r,i,a]),{onPointerDownCapture:()=>s.current=!0}}function nu(e,t=globalThis?.document){let n=Wl(e),r=S.useRef(!1);return S.useEffect(()=>{let e=e=>{e.target&&!r.current&&iu(Jl,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ru(){let e=new CustomEvent(Kl);document.dispatchEvent(e)}function iu(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?ul(i,a):i.dispatchEvent(a)}var au=`focusScope.autoFocusOnMount`,ou=`focusScope.autoFocusOnUnmount`,su={bubbles:!1,cancelable:!0},cu=`FocusScope`,lu=S.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=S.useState(null),l=Wl(i),u=Wl(a),d=S.useRef(null),f=Vc(t,c),p=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:gu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||gu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&gu(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),S.useEffect(()=>{if(s){_u.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(au,su);s.addEventListener(au,l),s.dispatchEvent(t),t.defaultPrevented||(uu(bu(fu(s)),{select:!0}),document.activeElement===e&&gu(s))}return()=>{s.removeEventListener(au,l),setTimeout(()=>{let t=new CustomEvent(ou,su);s.addEventListener(ou,u),s.dispatchEvent(t),t.defaultPrevented||gu(e??document.body,{select:!0}),s.removeEventListener(ou,u),_u.remove(p)},0)}}},[s,l,u,p]);let m=S.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=du(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&gu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&gu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,H.jsx)(ll.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});lu.displayName=cu;function uu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(gu(r,{select:t}),document.activeElement!==n)return}function du(e){let t=fu(e);return[pu(t,e),pu(t.reverse(),e)]}function fu(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function pu(e,t){for(let n of e)if(!mu(n,{upTo:t}))return n}function mu(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function hu(e){return e instanceof HTMLInputElement&&`select`in e}function gu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hu(e)&&t&&e.select()}}var _u=vu();function vu(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=yu(e,t),e.unshift(t)},remove(t){e=yu(e,t),e[0]?.resume()}}}function yu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bu(e){return e.filter(e=>e.tagName!==`A`)}var xu=`Portal`,Su=S.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=S.useState(!1);J(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?cl.createPortal((0,H.jsx)(ll.div,{...r,ref:t}),o):null});Su.displayName=xu;function Cu(e,t){return S.useReducer((e,n)=>t[e][n]??e,e)}var wu=e=>{let{present:t,children:n}=e,r=Tu(t),i=typeof n==`function`?n({present:r.isPresent}):S.Children.only(n),a=Du(r.ref,ku(i));return typeof n==`function`||r.isPresent?S.cloneElement(i,{ref:a}):null};wu.displayName=`Presence`;function Tu(e){let[t,n]=S.useState(),r=S.useRef(null),i=S.useRef(e),a=S.useRef(`none`),[o,s]=Cu(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return S.useEffect(()=>{let e=Ou(r.current);a.current=o===`mounted`?e:`none`},[o]),J(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Ou(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),J(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ou(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Ou(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:S.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Eu(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Du(...e){let t=S.useRef(e);return t.current=e,S.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Eu(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e{ju||={start:Nu(),end:Nu()};let{start:e,end:t}=ju;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Au++,()=>{Au===1&&(ju?.start.remove(),ju?.end.remove(),ju=null),Au=Math.max(0,Au-1)}},[])}function Nu(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Pu=function(){return Pu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return sd;var t=ld(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},dd=od(),fd=`data-scroll-locked`,pd=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` +`+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=Pa(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&ho.assertOptions(n,{silentJSONParsing:go.transitional(go.boolean),forcedJSONParsing:go.transitional(go.boolean),clarifyTimeoutError:go.transitional(go.boolean),legacyInterceptorReqResOrdering:go.transitional(go.boolean),advertiseZstdAcceptEncoding:go.transitional(go.boolean),validateStatusUndefinedResolves:go.transitional(go.boolean)},!1),r!=null&&(N.isFunction(r)?t.paramsSerializer={serialize:r}:ho.assertOptions(r,{encode:go.function,serialize:go.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),ho.assertOptions(t,{baseUrl:go.spelling(`baseURL`),withXsrfToken:go.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&N.merge(i.common,i[t.method]);i&&N.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`,`common`],e=>{delete i[e]}),t.headers=Pi.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||Yi;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[uo.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u{if(!n._listeners)return;let t=n._listeners.length;for(;t-->0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new ha(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function vo(e){return function(t){return e.apply(null,t)}}function yo(e){return N.isObject(e)&&e.isAxiosError===!0}var bo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(bo).forEach(([e,t])=>{bo[t]=e});function xo(e){let t=new _o(e),n=tr(_o.prototype.request,t);return N.extend(n,_o.prototype,t,{allOwnKeys:!0}),N.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return xo(Pa(e,t))},n}var So=xo(fa);So.Axios=_o,So.CanceledError=ha,So.CancelToken=I,So.isCancel=ma,So.VERSION=Ja,So.toFormData=Hi,So.AxiosError=P,So.Cancel=So.CanceledError,So.all=function(e){return Promise.all(e)},So.spread=vo,So.isAxiosError=yo,So.mergeConfig=Pa,So.AxiosHeaders=Pi,So.formToJSON=e=>la(N.isHTMLForm(e)?new FormData(e):e),So.getAdapter=co.getAdapter,So.HttpStatusCode=bo,So.default=So;var Co=`pets_admin_token`,wo=`pets_admin_refresh`;function To(){return localStorage.getItem(Co)||``}function Eo(){return localStorage.getItem(wo)||``}function Do(e,t){localStorage.setItem(Co,e),t&&localStorage.setItem(wo,t)}function Oo(){localStorage.removeItem(Co),localStorage.removeItem(wo)}var L=So.create({baseURL:`/api`});L.interceptors.request.use(e=>{let t=To();return t&&(e.headers.Authorization=`Bearer ${t}`),e});var ko=null;function Ao(){if(!ko){let e=Eo();ko=(e?So.post(`/api/admin/refresh`,{refresh_token:e}).then(e=>{let t=e.data;if(!t||t.code!==0)throw Error(t?.message||`续期失败`);return Do(t.data.token,t.data.refresh_token),t.data.token}):Promise.reject(Error(`没有刷新令牌`))).finally(()=>{ko=null})}return ko}function jo(){Oo(),location.pathname!==`/admin/login`&&(location.href=`/admin/login`)}var Mo=[`/admin/login`,`/admin/refresh`,`/admin/logout`];L.interceptors.response.use(async e=>{let t=e.data;if(t&&typeof t==`object`&&`code`in t){if(t.code===0)return t.data;if(t.code===40100){let t=e.config,n=Mo.some(e=>(t.url||``).startsWith(e));if(!n&&!t._retried){t._retried=!0;try{let e=await Ao();return t.headers.Authorization=`Bearer ${e}`,await L.request(t)}catch{}}n||jo()}return Promise.reject(Error(t.message||`请求失败`))}return t},e=>Promise.reject(e));var R={login:(e,t)=>L.post(`/admin/login`,{username:e,password:t}),logout:()=>L.post(`/admin/logout`,{refresh_token:Eo()}),me:()=>L.get(`/admin/me`),stats:()=>L.get(`/admin/stats`),users:e=>L.get(`/admin/users`,{params:e}),setUserDisabled:(e,t)=>L.put(`/admin/users/${e}/disabled`,{disabled:t}),pets:e=>L.get(`/admin/pets`,{params:e}),posts:e=>L.get(`/admin/posts`,{params:e}),setPostStatus:(e,t)=>L.put(`/admin/posts/${e}/status`,{status:t}),comments:e=>L.get(`/admin/comments`,{params:e}),deleteComment:e=>L.delete(`/admin/comments/${e}`),articles:e=>L.get(`/admin/articles`,{params:e}),saveArticle:e=>L.post(`/admin/articles`,e),deleteArticle:e=>L.delete(`/admin/articles/${e}`),memberships:e=>L.get(`/admin/memberships`,{params:e}),careTemplateMeta:()=>L.get(`/admin/care-templates/meta`),careTemplates:()=>L.get(`/admin/care-templates`),careTemplate:e=>L.get(`/admin/care-templates/${e}`),saveCareTemplate:e=>L.post(`/admin/care-templates`,e),deleteCareTemplate:e=>L.delete(`/admin/care-templates/${e}`),genCareTemplate:(e,t)=>L.post(`/admin/care-templates/generate`,{species:e,stage:t}),feedback:e=>L.get(`/admin/feedback`,{params:e}),setFeedbackHandled:(e,t)=>L.put(`/admin/feedback/${e}/handled`,{handled:t}),aiQuota:()=>L.get(`/admin/ai-quota`),saveAIQuota:e=>L.put(`/admin/ai-quota`,e),recordTypes:()=>L.get(`/admin/record-types`),saveRecordType:e=>L.post(`/admin/record-types`,e),deleteRecordType:e=>L.delete(`/admin/record-types/${e}`),breeds:e=>L.get(`/admin/breeds`,{params:e?{species:e}:{}}),saveBreed:e=>L.post(`/admin/breeds`,e),deleteBreed:e=>L.delete(`/admin/breeds/${e}`),communityBot:()=>L.get(`/admin/community-bot`),saveCommunityBot:e=>L.put(`/admin/community-bot`,e),genCommunityPosts:e=>L.post(`/admin/community-bot/generate`,{count:e})},No=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Po=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Fo=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Io=e=>{let t=Fo(e);return t.charAt(0).toUpperCase()+t.slice(1)},Lo={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Ro=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},zo=(0,S.createContext)({}),Bo=()=>(0,S.useContext)(zo),Vo=(0,S.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Bo()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,S.createElement)(`svg`,{ref:c,...Lo,width:t??l??Lo.width,height:t??l??Lo.height,stroke:e??f,strokeWidth:m,className:No(`lucide`,p,i),...!a&&!Ro(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,S.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Ho=(e,t)=>{let n=(0,S.forwardRef)(({className:n,...r},i)=>(0,S.createElement)(Vo,{ref:i,iconNode:t,className:No(`lucide-${Po(Io(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Io(e),n},Uo=Ho(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Wo=Ho(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),Go=Ho(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),Ko=Ho(`crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),qo=Ho(`dna`,[[`path`,{d:`m10 16 1.5 1.5`,key:`11lckj`}],[`path`,{d:`m14 8-1.5-1.5`,key:`1ohn8i`}],[`path`,{d:`M15 2c-1.798 1.998-2.518 3.995-2.807 5.993`,key:`80uv8i`}],[`path`,{d:`m16.5 10.5 1 1`,key:`696xn5`}],[`path`,{d:`m17 6-2.891-2.891`,key:`xu6p2f`}],[`path`,{d:`M2 15c6.667-6 13.333 0 20-6`,key:`1pyr53`}],[`path`,{d:`m20 9 .891.891`,key:`3xwk7g`}],[`path`,{d:`M3.109 14.109 4 15`,key:`q76aoh`}],[`path`,{d:`m6.5 12.5 1 1`,key:`cs35ky`}],[`path`,{d:`m7 18 2.891 2.891`,key:`1sisit`}],[`path`,{d:`M9 22c1.798-1.998 2.518-3.995 2.807-5.993`,key:`q3hbxp`}]]),Jo=Ho(`dog`,[[`path`,{d:`M11.25 16.25h1.5L12 17z`,key:`w7jh35`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309`,key:`u7s9ue`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5`,key:`v8hric`}]]),Yo=Ho(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Xo=Ho(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Zo=Ho(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Qo=Ho(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),$o=Ho(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),es=Ho(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),ts=Ho(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),ns=Ho(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),rs=Ho(`paw-print`,[[`circle`,{cx:`11`,cy:`4`,r:`2`,key:`vol9p0`}],[`circle`,{cx:`18`,cy:`8`,r:`2`,key:`17gozi`}],[`circle`,{cx:`20`,cy:`16`,r:`2`,key:`1v9bxh`}],[`path`,{d:`M9 10a5 5 0 0 1 5 5v3.5a3.5 3.5 0 0 1-6.84 1.045Q6.52 17.48 4.46 16.84A3.5 3.5 0 0 1 5.5 10Z`,key:`1ydw1z`}]]),is=Ho(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),as=Ho(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),os=Ho(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),ss=Ho(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),cs=Ho(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),ls=Ho(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),us=Ho(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function ds(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),hs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),gs=`-`,_s=[],vs=`arbitrary..`,ys=e=>{let t=Ss(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return xs(e);let n=e.split(gs);return bs(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ps(i,t):t:i||_s}return n[e]||_s}}},bs=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=bs(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(gs):e.slice(t).join(gs),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?vs+r:void 0})(),Ss=e=>{let{theme:t,classGroups:n}=e;return Cs(n,t)},Cs=(e,t)=>{let n=hs();for(let r in e){let i=e[r];ws(i,n,r,t)}return n},ws=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){Es(e,t,n);return}if(typeof e==`function`){Ds(e,t,n,r);return}Os(e,t,n,r)},Es=(e,t,n)=>{let r=e===``?t:ks(t,e);r.classGroupId=n},Ds=(e,t,n,r)=>{if(As(e)){ws(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ms(n,e))},Os=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(gs),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,js=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ms=`!`,Ns=`:`,Ps=[],Fs=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Is=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return Fs(t,l,c,u)};if(t){let e=t+Ns,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Fs(Ps,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Ls=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Rs=e=>({cache:js(e.cacheSize),parseClassName:Is(e),sortModifiers:Ls(e),postfixLookupClassGroupIds:zs(e),...ys(e)}),zs=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Bs),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ms:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e0?` `+l:l)}return l},Hs=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=Rs(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Vs(e,n);return i(e,a),a};return a=o,(...e)=>a(Hs(...e))},Gs=[],Ks=e=>{let t=t=>t[e]||Gs;return t.isThemeGetter=!0,t},qs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Js=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ys=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Xs=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zs=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Qs=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$s=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ec=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tc=e=>Ys.test(e),z=e=>!!e&&!Number.isNaN(Number(e)),nc=e=>!!e&&Number.isInteger(Number(e)),rc=e=>e.endsWith(`%`)&&z(e.slice(0,-1)),ic=e=>Xs.test(e),ac=()=>!0,oc=e=>Zs.test(e)&&!Qs.test(e),sc=()=>!1,cc=e=>$s.test(e),lc=e=>ec.test(e),uc=e=>!B(e)&&!V(e),dc=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),fc=e=>Dc(e,jc,sc),B=e=>qs.test(e),pc=e=>Dc(e,Mc,oc),mc=e=>Dc(e,Nc,z),hc=e=>Dc(e,Fc,ac),gc=e=>Dc(e,Pc,sc),_c=e=>Dc(e,kc,sc),vc=e=>Dc(e,Ac,lc),yc=e=>Dc(e,Ic,cc),V=e=>Js.test(e),bc=e=>Oc(e,Mc),xc=e=>Oc(e,Pc),Sc=e=>Oc(e,kc),Cc=e=>Oc(e,jc),wc=e=>Oc(e,Ac),Tc=e=>Oc(e,Ic,!0),Ec=e=>Oc(e,Fc,!0),Dc=(e,t,n)=>{let r=qs.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Oc=(e,t,n=!1)=>{let r=Js.exec(e);return r?r[1]?t(r[1]):n:!1},kc=e=>e===`position`||e===`percentage`,Ac=e=>e===`image`||e===`url`,jc=e=>e===`length`||e===`size`||e===`bg-size`,Mc=e=>e===`length`,Nc=e=>e===`number`,Pc=e=>e===`family-name`,Fc=e=>e===`number`||e===`weight`,Ic=e=>e===`shadow`,Lc=Ws(()=>{let e=Ks(`color`),t=Ks(`font`),n=Ks(`text`),r=Ks(`font-weight`),i=Ks(`tracking`),a=Ks(`leading`),o=Ks(`breakpoint`),s=Ks(`container`),c=Ks(`spacing`),l=Ks(`radius`),u=Ks(`shadow`),d=Ks(`inset-shadow`),f=Ks(`text-shadow`),p=Ks(`drop-shadow`),m=Ks(`blur`),h=Ks(`perspective`),g=Ks(`aspect`),_=Ks(`ease`),v=Ks(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),V,B],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[V,B,c],T=()=>[tc,`full`,`auto`,...w()],ee=()=>[nc,`none`,`subgrid`,V,B],te=()=>[`auto`,{span:[`full`,nc,V,B]},nc,V,B],ne=()=>[nc,`auto`,V,B],E=()=>[`auto`,`min`,`max`,`fr`,V,B],re=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],D=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],ie=()=>[`auto`,...w()],ae=()=>[tc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],oe=()=>[tc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],se=()=>[tc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],O=()=>[e,V,B],k=()=>[...b(),Sc,_c,{position:[V,B]}],ce=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],le=()=>[`auto`,`cover`,`contain`,Cc,fc,{size:[V,B]}],ue=()=>[rc,bc,pc],A=()=>[``,`none`,`full`,l,V,B],j=()=>[``,z,bc,pc],M=()=>[`solid`,`dashed`,`dotted`,`double`],de=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],fe=()=>[z,rc,Sc,_c],pe=()=>[``,`none`,m,V,B],me=()=>[`none`,z,V,B],he=()=>[`none`,z,V,B],ge=()=>[z,V,B],_e=()=>[tc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[ic],breakpoint:[ic],color:[ac],container:[ic],"drop-shadow":[ic],ease:[`in`,`out`,`in-out`],font:[uc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[ic],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[ic],shadow:[ic],spacing:[`px`,z],text:[ic],"text-shadow":[ic],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,tc,B,V,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,V,B]}],"container-named":[dc],columns:[{columns:[z,B,V,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[nc,`auto`,V,B]}],basis:[{basis:[tc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[z,tc,`auto`,`initial`,`none`,B]}],grow:[{grow:[``,z,V,B]}],shrink:[{shrink:[``,z,V,B]}],order:[{order:[nc,`first`,`last`,`none`,V,B]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...re(),`normal`]}],"justify-items":[{"justify-items":[...D(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...D()]}],"align-content":[{content:[`normal`,...re()]}],"align-items":[{items:[...D(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...D(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":re()}],"place-items":[{"place-items":[...D(),`baseline`]}],"place-self":[{"place-self":[`auto`,...D()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:ie()}],mx:[{mx:ie()}],my:[{my:ie()}],ms:[{ms:ie()}],me:[{me:ie()}],mbs:[{mbs:ie()}],mbe:[{mbe:ie()}],mt:[{mt:ie()}],mr:[{mr:ie()}],mb:[{mb:ie()}],ml:[{ml:ie()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ae()}],"inline-size":[{inline:[`auto`,...oe()]}],"min-inline-size":[{"min-inline":[`auto`,...oe()]}],"max-inline-size":[{"max-inline":[`none`,...oe()]}],"block-size":[{block:[`auto`,...se()]}],"min-block-size":[{"min-block":[`auto`,...se()]}],"max-block-size":[{"max-block":[`none`,...se()]}],w:[{w:[s,`screen`,...ae()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ae()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ae()]}],h:[{h:[`screen`,`lh`,...ae()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ae()]}],"max-h":[{"max-h":[`screen`,`lh`,...ae()]}],"font-size":[{text:[`base`,n,bc,pc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ec,hc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,rc,B]}],"font-family":[{font:[xc,gc,t]}],"font-features":[{"font-features":[B]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,V,B]}],"line-clamp":[{"line-clamp":[z,`none`,V,mc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,V,B]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,V,B]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...M(),`wavy`]}],"text-decoration-thickness":[{decoration:[z,`from-font`,`auto`,V,pc]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[z,`auto`,V,B]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[nc,V,B]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,V,B]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,V,B]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:k()}],"bg-repeat":[{bg:ce()}],"bg-size":[{bg:le()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},nc,V,B],radial:[``,V,B],conic:[nc,V,B]},wc,vc]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:j()}],"border-w-x":[{"border-x":j()}],"border-w-y":[{"border-y":j()}],"border-w-s":[{"border-s":j()}],"border-w-e":[{"border-e":j()}],"border-w-bs":[{"border-bs":j()}],"border-w-be":[{"border-be":j()}],"border-w-t":[{"border-t":j()}],"border-w-r":[{"border-r":j()}],"border-w-b":[{"border-b":j()}],"border-w-l":[{"border-l":j()}],"divide-x":[{"divide-x":j()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":j()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...M(),`hidden`,`none`]}],"divide-style":[{divide:[...M(),`hidden`,`none`]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...M(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[z,V,B]}],"outline-w":[{outline:[``,z,bc,pc]}],"outline-color":[{outline:O()}],shadow:[{shadow:[``,`none`,u,Tc,yc]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":[`none`,d,Tc,yc]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:j()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[z,pc]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":j()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":[`none`,f,Tc,yc]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[z,V,B]}],"mix-blend":[{"mix-blend":[...de(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":de()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[z]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[V,B]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[z]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:k()}],"mask-repeat":[{mask:ce()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,V,B]}],filter:[{filter:[``,`none`,V,B]}],blur:[{blur:pe()}],brightness:[{brightness:[z,V,B]}],contrast:[{contrast:[z,V,B]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Tc,yc]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:[``,z,V,B]}],"hue-rotate":[{"hue-rotate":[z,V,B]}],invert:[{invert:[``,z,V,B]}],saturate:[{saturate:[z,V,B]}],sepia:[{sepia:[``,z,V,B]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,V,B]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[z,V,B]}],"backdrop-contrast":[{"backdrop-contrast":[z,V,B]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,z,V,B]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[z,V,B]}],"backdrop-invert":[{"backdrop-invert":[``,z,V,B]}],"backdrop-opacity":[{"backdrop-opacity":[z,V,B]}],"backdrop-saturate":[{"backdrop-saturate":[z,V,B]}],"backdrop-sepia":[{"backdrop-sepia":[``,z,V,B]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,V,B]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[z,`initial`,V,B]}],ease:[{ease:[`linear`,`initial`,_,V,B]}],delay:[{delay:[z,V,B]}],animate:[{animate:[`none`,v,V,B]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,V,B]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":[`scale-3d`],skew:[{skew:ge()}],"skew-x":[{"skew-x":ge()}],"skew-y":[{"skew-y":ge()}],transform:[{transform:[V,B,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":[`translate-none`],zoom:[{zoom:[nc,V,B]}],accent:[{accent:O()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,V,B]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":O()}],"scrollbar-track-color":[{"scrollbar-track":O()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,V,B]}],fill:[{fill:[`none`,...O()]}],"stroke-w":[{stroke:[z,bc,pc,mc]}],stroke:[{stroke:[`none`,...O()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Rc(...e){return Lc(fs(e))}function zc(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Bc(...e){return t=>{let n=!1,r=e.map(e=>{let r=zc(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{children:r,...i}=t,a=null,o=!1,s=[];Xc(r)&&typeof el==`function`&&(r=el(r._payload)),S.Children.forEach(r,e=>{if(Jc(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Xc(n)&&typeof el==`function`&&(n=el(n._payload)),a=Gc(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=S.cloneElement(a,void 0,s):!o&&S.Children.count(r)===1&&S.isValidElement(r)&&(a=r);let c=a?qc(a):void 0,l=Vc(n,c);if(!a){if(r||r===0)throw Error(o?$c(e):Qc(e));return r}let u=Kc(i,a.props??{});return a.type!==S.Fragment&&(u.ref=n?l:c),S.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var Uc=Hc(`Slot`),Wc=Symbol.for(`radix.slottable`),Gc=(e,t)=>{if(`child`in e.props){let t=e.props.child;return S.isValidElement(t)?S.cloneElement(t,void 0,e.props.children(t.props.children)):null}return S.isValidElement(t)?t:null};function Kc(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function qc(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Jc(e){return S.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Wc}var Yc=Symbol.for(`react.lazy`);function Xc(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Yc&&`_payload`in e&&Zc(e._payload)}function Zc(e){return typeof e==`object`&&!!e&&`then`in e}var Qc=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,$c=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,el=S.use,tl=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,nl=fs,rl=(e,t)=>n=>{if(t?.variants==null)return nl(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=tl(t)||tl(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return nl(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},il=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),H=o(((e,t)=>{t.exports=il()}))(),al=rl(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90 shadow`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-card hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),U=S.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,H.jsx)(r?Uc:`button`,{className:Rc(al({variant:t,size:n,className:e})),ref:a,...i}));U.displayName=`Button`;var ol=[{to:`/`,label:`概览`,icon:Zo,end:!0},{to:`/users`,label:`用户管理`,icon:cs},{to:`/pets`,label:`宠物管理`,icon:rs},{to:`/posts`,label:`帖子审核`,icon:ts},{to:`/comments`,label:`评论管理`,icon:ns},{to:`/articles`,label:`文章管理`,icon:Yo},{to:`/care-templates`,label:`养护模板`,icon:Go},{to:`/record-types`,label:`记录事项`,icon:Qo},{to:`/breeds`,label:`品种管理`,icon:qo},{to:`/community-bot`,label:`社区运营`,icon:os},{to:`/feedback`,label:`意见反馈`,icon:es},{to:`/members`,label:`会员管理`,icon:Ko}];function sl(){let e=ht();function t(){R.logout().catch(()=>{}),Oo(),e(`/login`)}return(0,H.jsxs)(`div`,{className:`flex min-h-screen`,children:[(0,H.jsxs)(`aside`,{className:`w-56 shrink-0 border-r bg-card p-4 flex flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-3 mb-4`,children:[(0,H.jsx)(`span`,{className:`text-2xl`,children:`🐾`}),(0,H.jsx)(`span`,{className:`font-bold`,children:`毛孩子后台`})]}),(0,H.jsx)(`nav`,{className:`flex flex-col gap-1`,children:ol.map(e=>(0,H.jsxs)(Ln,{to:e.to,end:e.end,className:({isActive:e})=>Rc(`flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors`,e?`bg-primary/15 text-primary`:`text-muted-foreground hover:bg-accent`),children:[(0,H.jsx)(e.icon,{className:`h-4 w-4`}),e.label]},e.to))}),(0,H.jsx)(`div`,{className:`mt-auto`,children:(0,H.jsxs)(U,{variant:`ghost`,className:`w-full justify-start text-muted-foreground`,onClick:t,children:[(0,H.jsx)($o,{className:`h-4 w-4`}),` 退出登录`]})})]}),(0,H.jsx)(`main`,{className:`flex-1 p-8 overflow-auto`,children:(0,H.jsx)(Ut,{})})]})}var W=S.forwardRef(({className:e,type:t,...n},r)=>(0,H.jsx)(`input`,{type:t,ref:r,className:Rc(`flex h-9 w-full rounded-md border border-input bg-card px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),...n}));W.displayName=`Input`;var cl=l(h(),1),ll=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Hc(`Primitive.${t}`),r=S.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,H.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ul(e,t){e&&cl.flushSync(()=>e.dispatchEvent(t))}var dl=`Label`,fl=S.forwardRef((e,t)=>(0,H.jsx)(ll.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));fl.displayName=dl;var pl=fl,G=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(pl,{ref:n,className:Rc(`text-sm font-medium leading-none`,e),...t}));G.displayName=`Label`;var ml=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:Rc(`rounded-xl border bg-card text-card-foreground shadow-sm`,e),...t}));ml.displayName=`Card`;var hl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:Rc(`flex flex-col space-y-1.5 p-6`,e),...t}));hl.displayName=`CardHeader`;var gl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:Rc(`font-semibold leading-none tracking-tight`,e),...t}));gl.displayName=`CardTitle`;var _l=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{ref:n,className:Rc(`p-6 pt-0`,e),...t}));_l.displayName=`CardContent`;function vl(){let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(!1),c=ht();async function l(t){if(t.preventDefault(),!e.trim()||!n){a(`请输入账号和密码`);return}s(!0),a(``);try{let t=await R.login(e.trim(),n);Do(t.token,t.refresh_token),c(`/`)}catch(e){a(e.message||`登录失败`)}finally{s(!1)}}return(0,H.jsx)(`div`,{className:`flex min-h-screen items-center justify-center p-4`,children:(0,H.jsxs)(ml,{className:`w-full max-w-sm`,children:[(0,H.jsxs)(hl,{children:[(0,H.jsx)(`div`,{className:`text-3xl text-center mb-2`,children:`🐾`}),(0,H.jsx)(gl,{className:`text-center text-xl`,children:`肉垫计划 · 后台管理`})]}),(0,H.jsx)(_l,{children:(0,H.jsxs)(`form`,{onSubmit:l,className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`账号`}),(0,H.jsx)(W,{value:e,autoComplete:`username`,placeholder:`请输入账号`,onChange:e=>t(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`密码`}),(0,H.jsx)(W,{type:`password`,value:n,autoComplete:`current-password`,placeholder:`请输入密码`,onChange:e=>r(e.target.value)})]}),i&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:i}),(0,H.jsx)(U,{type:`submit`,className:`w-full`,disabled:o,children:o?`登录中...`:`登录`})]})})]})})}function yl(){let[e,t]=(0,S.useState)(null);(0,S.useEffect)(()=>{R.stats().then(t).catch(()=>{})},[]);let n=[{label:`用户`,value:e?.users,icon:cs},{label:`宠物`,value:e?.pets,icon:rs},{label:`帖子`,value:e?.posts,icon:ts},{label:`健康记录`,value:e?.records,icon:Uo}];return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`概览`}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-4`,children:n.map(e=>(0,H.jsxs)(ml,{children:[(0,H.jsxs)(hl,{className:`flex-row items-center justify-between pb-2`,children:[(0,H.jsx)(gl,{className:`text-sm text-muted-foreground`,children:e.label}),(0,H.jsx)(e.icon,{className:`h-4 w-4 text-primary`})]}),(0,H.jsx)(_l,{children:(0,H.jsx)(`div`,{className:`text-3xl font-bold`,children:e.value??`—`})})]},e.label))})]})}function bl(e,t={}){let[n,r]=(0,S.useState)(1),[i]=(0,S.useState)(10),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(``),d=(0,S.useCallback)(()=>{c(!0),u(``),e({page:n,page_size:i,...t}).then(o).catch(e=>u(e.message||`加载失败`)).finally(()=>c(!1))},[n,i,JSON.stringify(t)]);return(0,S.useEffect)(()=>{d()},[d]),{page:n,setPage:r,pageSize:i,data:a,loading:s,error:l,reload:d,totalPages:a?Math.max(1,Math.ceil(a.total/i)):1}}var xl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,H.jsx)(`table`,{ref:n,className:Rc(`w-full caption-bottom text-sm`,e),...t})}));xl.displayName=`Table`;var Sl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`thead`,{ref:n,className:Rc(`[&_tr]:border-b`,e),...t}));Sl.displayName=`TableHeader`;var Cl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`tbody`,{ref:n,className:Rc(`[&_tr:last-child]:border-0`,e),...t}));Cl.displayName=`TableBody`;var wl=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`tr`,{ref:n,className:Rc(`border-b transition-colors hover:bg-muted/50`,e),...t}));wl.displayName=`TableRow`;var K=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`th`,{ref:n,className:Rc(`h-10 px-3 text-left align-middle font-medium text-muted-foreground`,e),...t}));K.displayName=`TableHead`;var q=S.forwardRef(({className:e,...t},n)=>(0,H.jsx)(`td`,{ref:n,className:Rc(`p-3 align-middle`,e),...t}));q.displayName=`TableCell`;var Tl=rl(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold`,{variants:{variant:{default:`border-transparent bg-primary/15 text-primary`,secondary:`border-transparent bg-secondary text-secondary-foreground`,destructive:`border-transparent bg-destructive/15 text-destructive`,outline:`text-foreground`,success:`border-transparent bg-emerald-100 text-emerald-700`,muted:`border-transparent bg-muted text-muted-foreground`}},defaultVariants:{variant:`default`}});function El({className:e,variant:t,...n}){return(0,H.jsx)(`div`,{className:Rc(Tl({variant:t}),e),...n})}function Dl({page:e,totalPages:t,total:n,onChange:r}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between pt-4 text-sm text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[`共 `,n,` 条`]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(U,{variant:`outline`,size:`sm`,disabled:e<=1,onClick:()=>r(e-1),children:`上一页`}),(0,H.jsxs)(`span`,{children:[e,` / `,t]}),(0,H.jsx)(U,{variant:`outline`,size:`sm`,disabled:e>=t,onClick:()=>r(e+1),children:`下一页`})]})]})}function Ol(){let[e,t]=(0,S.useState)(``),[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(``),{page:o,setPage:s,data:c,totalPages:l,reload:u}=bl(R.users,{keyword:n,type:i});async function d(e){await R.setUserDisabled(e.id,!e.disabled),u()}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`用户管理`}),(0,H.jsxs)(`div`,{className:`flex gap-2 mb-4`,children:[(0,H.jsx)(W,{placeholder:`搜索昵称`,value:e,onChange:e=>t(e.target.value),className:`max-w-xs`,onKeyDown:t=>t.key===`Enter`&&(s(1),r(e))}),(0,H.jsx)(U,{onClick:()=>(s(1),r(e)),children:`搜索`}),(0,H.jsxs)(`select`,{className:`h-9 rounded-md border border-input bg-card px-3 text-sm`,value:i,onChange:e=>(s(1),a(e.target.value)),children:[(0,H.jsx)(`option`,{value:``,children:`全部账号`}),(0,H.jsx)(`option`,{value:`real`,children:`真实用户`}),(0,H.jsx)(`option`,{value:`bot`,children:`机器人(AI)`})]})]}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`昵称`}),(0,H.jsx)(K,{children:`手机号`}),(0,H.jsx)(K,{children:`宠物档案`}),(0,H.jsx)(K,{children:`建档`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{className:`text-right`,children:`操作`})]})}),(0,H.jsx)(Cl,{children:c?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsxs)(q,{className:`font-medium`,children:[e.nickname,e.is_bot&&(0,H.jsx)(El,{variant:`muted`,className:`ml-2`,children:`AI`})]}),(0,H.jsx)(q,{children:e.phone||`—`}),(0,H.jsx)(q,{className:`whitespace-nowrap`,children:e.pet_count>0?`${e.pet_count} 个`:(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsx)(q,{children:e.onboarded?`已建档`:`未建档`}),(0,H.jsx)(q,{children:e.disabled?(0,H.jsx)(El,{variant:`destructive`,children:`已禁用`}):(0,H.jsx)(El,{variant:`success`,children:`正常`})}),(0,H.jsx)(q,{className:`text-right`,children:(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>d(e),children:e.disabled?`启用`:`禁用`})})]},e.id))})]}),(0,H.jsx)(Dl,{page:o,totalPages:l,total:c?.total??0,onChange:s})]})})]})}function kl(){let{page:e,setPage:t,data:n,totalPages:r}=bl(R.pets);return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`宠物管理`}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`宠物`}),(0,H.jsx)(K,{children:`类型`}),(0,H.jsx)(K,{children:`阶段`}),(0,H.jsx)(K,{children:`体重`}),(0,H.jsx)(K,{children:`主人ID`})]})}),(0,H.jsx)(Cl,{children:n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsxs)(q,{className:`font-medium`,children:[(0,H.jsx)(`span`,{className:`mr-1`,children:e.emoji}),e.name]}),(0,H.jsx)(q,{children:e.type}),(0,H.jsx)(q,{children:e.stage}),(0,H.jsx)(q,{children:e.weight}),(0,H.jsx)(q,{children:e.user_id})]},e.id))})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})})]})}var Al={published:{label:`已发布`,variant:`success`},hidden:{label:`已隐藏`,variant:`muted`},deleted:{label:`已删除`,variant:`destructive`}};function jl(e){if(!e)return`—`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`—`;let n=e=>String(e).padStart(2,`0`),r=`${n(t.getHours())}:${n(t.getMinutes())}`,i=new Date;if(t.toDateString()===i.toDateString())return`今天 ${r}`;let a=new Date(i.getTime()-864e5);return t.toDateString()===a.toDateString()?`昨天 ${r}`:`${t.getFullYear()===i.getFullYear()?``:t.getFullYear()+`-`}${n(t.getMonth()+1)}-${n(t.getDate())} ${r}`}function Ml(){let{page:e,setPage:t,data:n,totalPages:r,reload:i}=bl(R.posts);async function a(e,t){await R.setPostStatus(e,t),i()}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`帖子审核`}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`作者`}),(0,H.jsx)(K,{children:`内容`}),(0,H.jsx)(K,{children:`赞/评`}),(0,H.jsx)(K,{children:`发布时间`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{className:`text-right`,children:`操作`})]})}),(0,H.jsx)(Cl,{children:n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsxs)(q,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{className:`mr-1`,children:e.author_emoji}),e.author_name]}),(0,H.jsx)(q,{className:`max-w-sm truncate`,children:e.content}),(0,H.jsxs)(q,{className:`whitespace-nowrap`,children:[e.like_count,` / `,e.comment_count]}),(0,H.jsx)(q,{className:`whitespace-nowrap text-muted-foreground`,children:jl(e.created_at)}),(0,H.jsx)(q,{children:(0,H.jsx)(El,{variant:Al[e.status]?.variant,children:Al[e.status]?.label??e.status})}),(0,H.jsxs)(q,{className:`text-right space-x-2 whitespace-nowrap`,children:[e.status!==`published`&&(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>a(e.id,`published`),children:`恢复`}),e.status===`published`&&(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>a(e.id,`hidden`),children:`隐藏`}),(0,H.jsx)(U,{variant:`destructive`,size:`sm`,onClick:()=>a(e.id,`deleted`),children:`删除`})]})]},e.id))})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})})]})}function Nl(){let{page:e,setPage:t,data:n,totalPages:r,reload:i}=bl(R.comments);async function a(e){await R.deleteComment(e),i()}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`评论管理`}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`帖子ID`}),(0,H.jsx)(K,{children:`作者`}),(0,H.jsx)(K,{children:`内容`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{className:`text-right`,children:`操作`})]})}),(0,H.jsx)(Cl,{children:n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsx)(q,{children:e.post_id}),(0,H.jsx)(q,{className:`whitespace-nowrap`,children:e.author_name}),(0,H.jsx)(q,{className:`max-w-sm truncate`,children:e.content}),(0,H.jsx)(q,{children:e.status===`deleted`?(0,H.jsx)(El,{variant:`destructive`,children:`已删除`}):(0,H.jsx)(El,{variant:`success`,children:`正常`})}),(0,H.jsx)(q,{className:`text-right`,children:e.status!==`deleted`&&(0,H.jsx)(U,{variant:`destructive`,size:`sm`,onClick:()=>a(e.id),children:`删除`})})]},e.id))})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})})]})}typeof window<`u`&&window.document&&window.document.createElement;function Pl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Fl(e,t=[]){let n=[];function r(t,r){let i=S.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=S.useMemo(()=>o,Object.values(o));return(0,H.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=S.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>S.createContext(e));return function(n){let r=n?.[e]||t;return S.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Il(i,...t)]}function Il(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var J=globalThis?.document?S.useLayoutEffect:()=>{},Ll=S.useId||(()=>void 0),Y=0;function X(e){let[t,n]=S.useState(Ll());return J(()=>{e||n(e=>e??String(Y++))},[e]),e||(t?`radix-${t}`:``)}var Z=S.useEffectEvent,Rl=S.useInsertionEffect;function zl(e){if(typeof Z==`function`)return Z(e);let t=S.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof Rl==`function`?Rl(()=>{t.current=e}):J(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}var Bl=S.useInsertionEffect||J;function Vl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Hl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=S.useRef(e!==void 0);S.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,S.useCallback(t=>{if(s){let n=Ul(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Hl({defaultProp:e,onChange:t}){let[n,r]=S.useState(e),i=S.useRef(n),a=S.useRef(t);return Bl(()=>{a.current=t},[t]),S.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ul(e){return typeof e==`function`}function Wl(e){let t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}var Gl=`DismissableLayer`,Kl=`dismissableLayer.update`,ql=`dismissableLayer.pointerDownOutside`,Jl=`dismissableLayer.focusOutside`,Yl,Xl=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Zl=S.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=S.useContext(Xl),[d,f]=S.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=S.useState({}),h=Vc(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(_),y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,C=S.useRef(!1),w=tu(e=>{let t=e.target;if(!(t instanceof Node))return;let n=[...u.branches].some(e=>e.contains(t));!x||n||(a?.(e),s?.(e),e.defaultPrevented||c?.())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces}),T=nu(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),ee=d?y===g.length-1:!1,te=zl(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return S.useEffect(()=>{if(ee)return p.addEventListener(`keydown`,te,{capture:!0}),()=>p.removeEventListener(`keydown`,te,{capture:!0})},[p,ee]),S.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Yl=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),ru(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Yl))}},[d,p,n,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),ru())},[d,u]),S.useEffect(()=>{let e=()=>m({});return document.addEventListener(Kl,e),()=>document.removeEventListener(Kl,e)},[]),(0,H.jsx)(ll.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Pl(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Pl(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Pl(e.onPointerDownCapture,w.onPointerDownCapture)})});Zl.displayName=Gl;var Ql=`DismissableLayerBranch`,$l=S.forwardRef((e,t)=>{let n=S.useContext(Xl),r=S.useRef(null),i=Vc(t,r);return S.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,H.jsx)(ll.div,{...e,ref:i})});$l.displayName=Ql;function eu(){let e=S.useContext(Xl),[t,n]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function tu(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a}=t,o=Wl(e),s=S.useRef(!1),c=S.useRef(!1),l=S.useRef(new Map),u=S.useRef(()=>{});return S.useEffect(()=>{function e(){c.current=!1,i.current=!1,l.current.clear()}function t(){return Array.from(l.current.values()).some(Boolean)}function d(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||l.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{c.current&&u.current()},0)}function f(e){c.current&&l.current.set(e.type,!1)}let p=a=>{if(a.target&&!s.current){let s=function(){n.removeEventListener(`click`,u.current);let r=t();e(),r||iu(ql,o,d,{discrete:!0})},d={originalEvent:a};c.current=!0,i.current=r&&a.button===0,l.current.clear(),!r||a.button!==0?s():(n.removeEventListener(`click`,u.current),u.current=s,n.addEventListener(`click`,u.current,{once:!0}))}else n.removeEventListener(`click`,u.current),e();s.current=!1},m=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of m)n.addEventListener(e,d,!0),n.addEventListener(e,f);let h=window.setTimeout(()=>{n.addEventListener(`pointerdown`,p)},0);return()=>{window.clearTimeout(h),n.removeEventListener(`pointerdown`,p),n.removeEventListener(`click`,u.current);for(let e of m)n.removeEventListener(e,d,!0),n.removeEventListener(e,f)}},[n,o,r,i,a]),{onPointerDownCapture:()=>s.current=!0}}function nu(e,t=globalThis?.document){let n=Wl(e),r=S.useRef(!1);return S.useEffect(()=>{let e=e=>{e.target&&!r.current&&iu(Jl,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ru(){let e=new CustomEvent(Kl);document.dispatchEvent(e)}function iu(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?ul(i,a):i.dispatchEvent(a)}var au=`focusScope.autoFocusOnMount`,ou=`focusScope.autoFocusOnUnmount`,su={bubbles:!1,cancelable:!0},cu=`FocusScope`,lu=S.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=S.useState(null),l=Wl(i),u=Wl(a),d=S.useRef(null),f=Vc(t,c),p=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:gu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||gu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&gu(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),S.useEffect(()=>{if(s){_u.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(au,su);s.addEventListener(au,l),s.dispatchEvent(t),t.defaultPrevented||(uu(bu(fu(s)),{select:!0}),document.activeElement===e&&gu(s))}return()=>{s.removeEventListener(au,l),setTimeout(()=>{let t=new CustomEvent(ou,su);s.addEventListener(ou,u),s.dispatchEvent(t),t.defaultPrevented||gu(e??document.body,{select:!0}),s.removeEventListener(ou,u),_u.remove(p)},0)}}},[s,l,u,p]);let m=S.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=du(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&gu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&gu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,H.jsx)(ll.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});lu.displayName=cu;function uu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(gu(r,{select:t}),document.activeElement!==n)return}function du(e){let t=fu(e);return[pu(t,e),pu(t.reverse(),e)]}function fu(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function pu(e,t){for(let n of e)if(!mu(n,{upTo:t}))return n}function mu(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function hu(e){return e instanceof HTMLInputElement&&`select`in e}function gu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hu(e)&&t&&e.select()}}var _u=vu();function vu(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=yu(e,t),e.unshift(t)},remove(t){e=yu(e,t),e[0]?.resume()}}}function yu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bu(e){return e.filter(e=>e.tagName!==`A`)}var xu=`Portal`,Su=S.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=S.useState(!1);J(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?cl.createPortal((0,H.jsx)(ll.div,{...r,ref:t}),o):null});Su.displayName=xu;function Cu(e,t){return S.useReducer((e,n)=>t[e][n]??e,e)}var wu=e=>{let{present:t,children:n}=e,r=Tu(t),i=typeof n==`function`?n({present:r.isPresent}):S.Children.only(n),a=Du(r.ref,ku(i));return typeof n==`function`||r.isPresent?S.cloneElement(i,{ref:a}):null};wu.displayName=`Presence`;function Tu(e){let[t,n]=S.useState(),r=S.useRef(null),i=S.useRef(e),a=S.useRef(`none`),[o,s]=Cu(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return S.useEffect(()=>{let e=Ou(r.current);a.current=o===`mounted`?e:`none`},[o]),J(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Ou(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),J(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ou(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Ou(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:S.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Eu(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Du(...e){let t=S.useRef(e);return t.current=e,S.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Eu(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e{ju||={start:Nu(),end:Nu()};let{start:e,end:t}=ju;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Au++,()=>{Au===1&&(ju?.start.remove(),ju?.end.remove(),ju=null),Au=Math.max(0,Au-1)}},[])}function Nu(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Pu=function(){return Pu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return sd;var t=ld(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},dd=od(),fd=`data-scroll-locked`,pd=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` .${zu} { overflow: hidden ${r}; padding-right: ${s}px ${r}; @@ -56,8 +56,8 @@ Please change the parent to i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},wd=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Td=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Ed=function(e,t){return e===`v`?xd(t):Sd(t)},Dd=function(e,t){return e===`v`?wd(t):Td(t)},Od=function(e,t){return e===`h`&&t===`rtl`?-1:1},kd=function(e,t,n,r,i){var a=Od(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Dd(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Ed(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Ad=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},jd=function(e){return[e.deltaX,e.deltaY]},Md=function(e){return e&&`current`in e?e.current:e},Nd=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Pd=function(e){return` .block-interactivity-${e} {pointer-events: none;} .allow-interactivity-${e} {pointer-events: all;} -`},Fd=0,Id=[];function Ld(e){var t=S.useRef([]),n=S.useRef([0,0]),r=S.useRef(),i=S.useState(Fd++)[0],a=S.useState(od)[0],o=S.useRef(e);S.useEffect(function(){o.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Iu([e.lockRef.current],(e.shards||[]).map(Md),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=S.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ad(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Cd(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Cd(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return kd(h,t,e,h===`h`?s:c,!0)},[]),c=S.useCallback(function(e){var n=e;if(!(!Id.length||Id[Id.length-1]!==a)){var r=`deltaY`in n?jd(n):Ad(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Nd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Md).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=S.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Rd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=S.useCallback(function(e){n.current=Ad(e),r.current=void 0},[]),d=S.useCallback(function(t){l(t.type,jd(t),t.target,s(t,e.lockRef.current))},[]),f=S.useCallback(function(t){l(t.type,Ad(t),t.target,s(t,e.lockRef.current))},[]);S.useEffect(function(){return Id.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,$),document.addEventListener(`touchmove`,c,$),document.addEventListener(`touchstart`,u,$),function(){Id=Id.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,$),document.removeEventListener(`touchmove`,c,$),document.removeEventListener(`touchstart`,u,$)}},[]);var p=e.removeScrollBar,m=e.inert;return S.createElement(S.Fragment,null,m?S.createElement(a,{styles:Pd(i)}):null,p?S.createElement(gd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Rd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var zd=Yu(Xu,Ld),Bd=S.forwardRef(function(e,t){return S.createElement(Qu,Pu({},e,{ref:t,sideCar:zd}))});Bd.classNames=Qu.classNames;var Vd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Hd=new WeakMap,Ud=new WeakMap,Wd={},Gd=0,Kd=function(e){return e&&(e.host||Kd(e.parentNode))},qd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Kd(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Jd=function(e,t,n,r){var i=qd(t,Array.isArray(e)?e:[e]);Wd[n]||(Wd[n]=new WeakMap);var a=Wd[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Hd.get(e)||0)+1,l=(a.get(e)||0)+1;Hd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Ud.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Gd++,function(){o.forEach(function(e){var t=Hd.get(e)-1,i=a.get(e)-1;Hd.set(e,t),a.set(e,i),t||(Ud.has(e)||e.removeAttribute(r),Ud.delete(e)),i||e.removeAttribute(n)}),Gd--,Gd||(Hd=new WeakMap,Hd=new WeakMap,Ud=new WeakMap,Wd={})}},Yd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Vd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Jd(r,i,n,`aria-hidden`)):function(){return null}},Xd=`Dialog`,[Zd,Qd]=Fl(Xd),[$d,ef]=Zd(Xd),tf=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=S.useRef(null),c=S.useRef(null),[l,u]=Vl({prop:r,defaultProp:i??!1,onChange:a,caller:Xd});return(0,H.jsx)($d,{scope:t,triggerRef:s,contentRef:c,contentId:X(),titleId:X(),descriptionId:X(),open:l,onOpenChange:u,onOpenToggle:S.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};tf.displayName=Xd;var nf=`DialogTrigger`,rf=S.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ef(nf,n),a=Vc(t,i.triggerRef);return(0,H.jsx)(ll.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":wf(i.open),...r,ref:a,onClick:Pl(e.onClick,i.onOpenToggle)})});rf.displayName=nf;var af=`DialogPortal`,[of,sf]=Zd(af,{forceMount:void 0}),cf=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=ef(af,t);return(0,H.jsx)(of,{scope:t,forceMount:n,children:S.Children.map(r,e=>(0,H.jsx)(wu,{present:n||a.open,children:(0,H.jsx)(Su,{asChild:!0,container:i,children:e})}))})};cf.displayName=af;var lf=`DialogOverlay`,uf=S.forwardRef((e,t)=>{let n=sf(lf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ef(lf,e.__scopeDialog);return a.modal?(0,H.jsx)(wu,{present:r||a.open,children:(0,H.jsx)(ff,{...i,ref:t})}):null});uf.displayName=lf;var df=Hc(`DialogOverlay.RemoveScroll`),ff=S.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ef(lf,n),a=Vc(t,eu());return(0,H.jsx)(Bd,{as:df,allowPinchZoom:!0,shards:[i.contentRef],children:(0,H.jsx)(ll.div,{"data-state":wf(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),pf=`DialogContent`,mf=S.forwardRef((e,t)=>{let n=sf(pf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ef(pf,e.__scopeDialog);return(0,H.jsx)(wu,{present:r||a.open,children:a.modal?(0,H.jsx)(hf,{...i,ref:t}):(0,H.jsx)(gf,{...i,ref:t})})});mf.displayName=pf;var hf=S.forwardRef((e,t)=>{let n=ef(pf,e.__scopeDialog),r=S.useRef(null),i=Vc(t,n.contentRef,r);return S.useEffect(()=>{let e=r.current;if(e)return Yd(e)},[]),(0,H.jsx)(_f,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Pl(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Pl(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Pl(e.onFocusOutside,e=>e.preventDefault())})}),gf=S.forwardRef((e,t)=>{let n=ef(pf,e.__scopeDialog),r=S.useRef(!1),i=S.useRef(!1);return(0,H.jsx)(_f,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),_f=S.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=ef(pf,n);return Mu(),(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(lu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Zl,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":wf(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),vf=`DialogTitle`,yf=S.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ef(vf,n);return(0,H.jsx)(ll.h2,{id:i.titleId,...r,ref:t})});yf.displayName=vf;var bf=`DialogDescription`,xf=S.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ef(bf,n);return(0,H.jsx)(ll.p,{id:i.descriptionId,...r,ref:t})});xf.displayName=bf;var Sf=`DialogClose`,Cf=S.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ef(Sf,n);return(0,H.jsx)(ll.button,{type:`button`,...r,ref:t,onClick:Pl(e.onClick,()=>i.onOpenChange(!1))})});Cf.displayName=Sf;function wf(e){return e?`open`:`closed`}var Tf=tf,Ef=S.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(cf,{children:[(0,H.jsx)(uf,{className:`fixed inset-0 z-50 bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out`}),(0,H.jsxs)(mf,{ref:r,className:Rc(`fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-card p-6 shadow-lg rounded-xl`,e),...n,children:[t,(0,H.jsx)(Cf,{className:`absolute right-4 top-4 opacity-70 hover:opacity-100`,children:(0,H.jsx)(us,{className:`h-4 w-4`})})]})]}));Ef.displayName=`DialogContent`;function Df({className:e,...t}){return(0,H.jsx)(`div`,{className:Rc(`flex flex-col space-y-1.5`,e),...t})}function Of({className:e,...t}){return(0,H.jsx)(`h2`,{className:Rc(`text-lg font-semibold`,e),...t})}var kf={id:0,icon:`📘`,title:``,description:``,content:``,category:``,related_sheet_type:``,published:!0};function Af(){let{page:e,setPage:t,data:n,totalPages:r,reload:i}=bl(R.articles),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(kf);function l(e){c({...e}),o(!0)}function u(){c({...kf}),o(!0)}async function d(){await R.saveArticle(s),o(!1),i()}async function f(e){await R.deleteArticle(e),i()}let p=e=>t=>c({...s,[e]:t.target.value});return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`文章管理`}),(0,H.jsx)(U,{onClick:u,children:`新建文章`})]}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`标题`}),(0,H.jsx)(K,{children:`分类`}),(0,H.jsx)(K,{children:`关联弹层`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{className:`text-right`,children:`操作`})]})}),(0,H.jsx)(Cl,{children:n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsxs)(q,{className:`font-medium`,children:[(0,H.jsx)(`span`,{className:`mr-1`,children:e.icon}),e.title]}),(0,H.jsx)(q,{children:e.category||`—`}),(0,H.jsx)(q,{children:e.related_sheet_type||`—`}),(0,H.jsx)(q,{children:e.published?(0,H.jsx)(El,{variant:`success`,children:`已发布`}):(0,H.jsx)(El,{variant:`muted`,children:`草稿`})}),(0,H.jsxs)(q,{className:`text-right space-x-2 whitespace-nowrap`,children:[(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>l(e),children:`编辑`}),(0,H.jsx)(U,{variant:`destructive`,size:`sm`,onClick:()=>f(e.id),children:`删除`})]})]},e.id))})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})}),(0,H.jsx)(Tf,{open:a,onOpenChange:o,children:(0,H.jsxs)(Ef,{children:[(0,H.jsx)(Df,{children:(0,H.jsx)(Of,{children:s.id?`编辑文章`:`新建文章`})}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`图标(emoji)`}),(0,H.jsx)(W,{value:s.icon,onChange:p(`icon`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`分类`}),(0,H.jsx)(W,{value:s.category,onChange:p(`category`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5 col-span-2`,children:[(0,H.jsx)(G,{children:`标题`}),(0,H.jsx)(W,{value:s.title,onChange:p(`title`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5 col-span-2`,children:[(0,H.jsx)(G,{children:`简介`}),(0,H.jsx)(W,{value:s.description,onChange:p(`description`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`关联弹层类型`}),(0,H.jsx)(W,{value:s.related_sheet_type,onChange:p(`related_sheet_type`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`发布状态`}),(0,H.jsxs)(`select`,{className:`flex h-9 w-full rounded-md border border-input bg-card px-3 text-sm`,value:s.published?`1`:`0`,onChange:e=>c({...s,published:e.target.value===`1`}),children:[(0,H.jsx)(`option`,{value:`1`,children:`已发布`}),(0,H.jsx)(`option`,{value:`0`,children:`草稿`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5 col-span-2`,children:[(0,H.jsx)(G,{children:`正文`}),(0,H.jsx)(`textarea`,{className:`flex min-h-24 w-full rounded-md border border-input bg-card px-3 py-2 text-sm`,value:s.content,onChange:p(`content`)})]})]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,H.jsx)(U,{variant:`outline`,onClick:()=>o(!1),children:`取消`}),(0,H.jsx)(U,{onClick:d,children:`保存`})]})]})})]})}var jf=[{key:`cat`,label:`猫猫`,Icon:Wo},{key:`dog`,label:`狗狗`,Icon:Jo}],Mf=[`刚到家 0-30 天`,`幼年期`,`成年期`,`老年期`],Nf={"":`无`,weight:`体重`,poop:`便便`,food:`饮食`,symptom:`异常`,vaccine:`疫苗`,medicine:`用药`,report:`报告`,taskDetail:`任务详情`},Pf={vaccine:`疫苗`,deworm:`驱虫`,weight:`体重`,monthlyReport:`月报`},Ff=[``,`weight`,`poop`,`food`,`symptom`,`vaccine`,`medicine`],If=[``,`weight`,`vaccine`,`medicine`,`report`,`taskDetail`],Lf=[`vaccine`,`deworm`,`weight`,`monthlyReport`],Rf=`h-9 rounded-md border border-input bg-card px-2 text-sm shrink-0`,zf=1;function Bf(e){return(e||[]).map(e=>({_k:zf++,kind:e.kind,title:e.title||``,description:e.description||``,priority:e.priority||``,sheet_type:e.sheet_type||``,day:e.day??0,day_label:e.day_label||``,reminder_type:e.reminder_type||`vaccine`,offset_days:e.offset_days??0,frequency:e.frequency||``}))}function Vf(e){return{_k:zf++,kind:e,title:``,description:``,priority:``,sheet_type:``,day:0,day_label:``,reminder_type:`vaccine`,offset_days:0,frequency:``}}function Hf(){let[e,t]=(0,S.useState)(`cat`),[n,r]=(0,S.useState)(`成年期`),[i,a]=(0,S.useState)([]),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(!1),[f,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(``),g=(0,S.useRef)(0);async function _(e,t){let n=++g.current;s(!0),h(``);try{let r=await R.careTemplate(e,t);n===g.current&&(a(Bf(r.items)),p(!1))}finally{n===g.current&&s(!1)}}(0,S.useEffect)(()=>{_(e,n)},[e,n]);function v(e,t,n){a(r=>r.map(r=>r._k===e?{...r,[t]:n}:r)),p(!0)}function y(e){a(t=>t.filter(t=>t._k!==e)),p(!0)}function b(e){a(t=>[...t,Vf(e)]),p(!0)}async function x(){d(!0),h(``);try{let t=await R.genCareTemplate(e,n);a(Bf(t.items)),p(!0),h(`已生成草稿,确认无误后点「保存该模板」`)}catch(e){h(e?.message||`AI 生成失败`)}finally{d(!1)}}async function C(){l(!0),h(``);try{await R.saveCareTemplate(e,n,i),p(!1),h(`已保存`)}catch(e){h(e?.message||`保存失败`)}finally{l(!1)}}let w=(0,S.useMemo)(()=>i.filter(e=>e.kind===`task`),[i]),T=(0,S.useMemo)(()=>i.filter(e=>e.kind===`plan`),[i]),ee=(0,S.useMemo)(()=>i.filter(e=>e.kind===`reminder`),[i]);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between mb-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`养护模板`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`建档时按宠物的物种和阶段套用;改动只影响之后建档 / 重新建档的宠物。`})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsxs)(U,{variant:`outline`,onClick:x,disabled:u,children:[(0,H.jsx)(ls,{className:`h-4 w-4`}),` `,u?`生成中…`:`AI 生成草稿`]}),(0,H.jsxs)(U,{onClick:C,disabled:c||!f,children:[(0,H.jsx)(as,{className:`h-4 w-4`}),` `,c?`保存中…`:`保存该模板`]})]})]}),(0,H.jsx)(`div`,{className:`flex gap-2 mb-2`,children:jf.map(n=>(0,H.jsxs)(`button`,{onClick:()=>t(n.key),className:Rc(`inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm transition-colors`,e===n.key?`bg-primary/15 text-primary border-primary/40`:`text-muted-foreground hover:bg-accent`),children:[(0,H.jsx)(n.Icon,{className:`h-4 w-4`}),` `,n.label]},n.key))}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-4`,children:Mf.map(e=>(0,H.jsx)(`button`,{onClick:()=>r(e),className:Rc(`rounded-full border px-3 py-1.5 text-sm transition-colors`,n===e?`bg-primary/15 text-primary border-primary/40`:`text-muted-foreground hover:bg-accent`),children:e},e))}),m&&(0,H.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-md bg-primary/10 px-3 py-2 text-sm text-primary`,children:[(0,H.jsx)(Xo,{className:`h-4 w-4`}),` `,m]}),o?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`加载中…`}):(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(Uf,{title:`今日任务`,count:w.length,onAdd:()=>b(`task`),children:w.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(W,{className:`flex-1 min-w-40`,placeholder:`任务标题`,value:e.title,onChange:t=>v(e._k,`title`,t.target.value)}),(0,H.jsx)(W,{className:`flex-1 min-w-40`,placeholder:`说明`,value:e.description,onChange:t=>v(e._k,`description`,t.target.value)}),(0,H.jsxs)(`select`,{className:Rf,value:e.priority,onChange:t=>v(e._k,`priority`,t.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`普通`}),(0,H.jsx)(`option`,{value:`重要`,children:`重要`})]}),(0,H.jsx)(`select`,{className:Rf,value:e.sheet_type,onChange:t=>v(e._k,`sheet_type`,t.target.value),children:Ff.map(e=>(0,H.jsxs)(`option`,{value:e,children:[`关联·`,Nf[e]]},e))}),(0,H.jsx)(Wf,{onClick:()=>y(e._k)})]},e._k))}),(0,H.jsx)(Uf,{title:`30 天计划`,count:T.length,onAdd:()=>b(`plan`),children:T.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(W,{type:`number`,className:`w-16`,placeholder:`第N天`,value:e.day,onChange:t=>v(e._k,`day`,Number(t.target.value))}),(0,H.jsx)(W,{className:`w-24`,placeholder:`标签`,value:e.day_label,onChange:t=>v(e._k,`day_label`,t.target.value)}),(0,H.jsx)(W,{className:`flex-1 min-w-36`,placeholder:`节点标题`,value:e.title,onChange:t=>v(e._k,`title`,t.target.value)}),(0,H.jsx)(W,{className:`flex-1 min-w-36`,placeholder:`说明`,value:e.description,onChange:t=>v(e._k,`description`,t.target.value)}),(0,H.jsx)(`select`,{className:Rf,value:e.sheet_type,onChange:t=>v(e._k,`sheet_type`,t.target.value),children:If.map(e=>(0,H.jsxs)(`option`,{value:e,children:[`弹层·`,Nf[e]]},e))}),(0,H.jsx)(Wf,{onClick:()=>y(e._k)})]},e._k))}),(0,H.jsx)(Uf,{title:`提醒`,count:ee.length,onAdd:()=>b(`reminder`),children:ee.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`select`,{className:Rf,value:e.reminder_type,onChange:t=>v(e._k,`reminder_type`,t.target.value),children:Lf.map(e=>(0,H.jsx)(`option`,{value:e,children:Pf[e]},e))}),(0,H.jsx)(W,{className:`flex-1 min-w-40`,placeholder:`提醒标题`,value:e.title,onChange:t=>v(e._k,`title`,t.target.value)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`到期+`}),(0,H.jsx)(W,{type:`number`,className:`w-16`,value:e.offset_days,onChange:t=>v(e._k,`offset_days`,Number(t.target.value))}),(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`天`})]}),(0,H.jsx)(W,{className:`flex-1 min-w-36`,placeholder:`或填频率(到期天数填0)`,value:e.frequency,onChange:t=>v(e._k,`frequency`,t.target.value)}),(0,H.jsx)(Wf,{onClick:()=>y(e._k)})]},e._k))}),(0,H.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsx)(Xo,{className:`h-3.5 w-3.5`}),` 模板留空时建档会回退内置默认,不会让新宠没有任务。`]})]})]})}function Uf({title:e,count:t,onAdd:n,children:r}){return(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-4 pb-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,H.jsxs)(`div`,{className:`font-medium`,children:[e,` `,(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:t})]}),(0,H.jsxs)(U,{variant:`outline`,size:`sm`,onClick:n,children:[(0,H.jsx)(is,{className:`h-4 w-4`}),` 添加`]})]}),(0,H.jsx)(`div`,{className:`space-y-2`,children:t===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`暂无,点「添加」新增一条。`}):r})]})})}function Wf({onClick:e}){return(0,H.jsx)(U,{variant:`ghost`,size:`icon`,className:`text-muted-foreground shrink-0`,onClick:e,"aria-label":`删除`,children:(0,H.jsx)(ss,{className:`h-4 w-4`})})}var Gf={id:``,code:``,label:``,icon:`note`,group:`daily`,sort:0,enabled:!0,form:`simple`,locked:!1,fields_raw:``},Kf=[{key:`daily`,label:`日常`},{key:`health`,label:`健康`},{key:`care`,label:`洗护`},{key:`clean`,label:`清洁`}],qf=`number:体重:kg 数值,落 num_value +`},Fd=0,Id=[];function Ld(e){var t=S.useRef([]),n=S.useRef([0,0]),r=S.useRef(),i=S.useState(Fd++)[0],a=S.useState(od)[0],o=S.useRef(e);S.useEffect(function(){o.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Iu([e.lockRef.current],(e.shards||[]).map(Md),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=S.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ad(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Cd(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Cd(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return kd(h,t,e,h===`h`?s:c,!0)},[]),c=S.useCallback(function(e){var n=e;if(!(!Id.length||Id[Id.length-1]!==a)){var r=`deltaY`in n?jd(n):Ad(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Nd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Md).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=S.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Rd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=S.useCallback(function(e){n.current=Ad(e),r.current=void 0},[]),d=S.useCallback(function(t){l(t.type,jd(t),t.target,s(t,e.lockRef.current))},[]),f=S.useCallback(function(t){l(t.type,Ad(t),t.target,s(t,e.lockRef.current))},[]);S.useEffect(function(){return Id.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,$),document.addEventListener(`touchmove`,c,$),document.addEventListener(`touchstart`,u,$),function(){Id=Id.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,$),document.removeEventListener(`touchmove`,c,$),document.removeEventListener(`touchstart`,u,$)}},[]);var p=e.removeScrollBar,m=e.inert;return S.createElement(S.Fragment,null,m?S.createElement(a,{styles:Pd(i)}):null,p?S.createElement(gd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Rd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var zd=Yu(Xu,Ld),Bd=S.forwardRef(function(e,t){return S.createElement(Qu,Pu({},e,{ref:t,sideCar:zd}))});Bd.classNames=Qu.classNames;var Vd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Hd=new WeakMap,Ud=new WeakMap,Wd={},Gd=0,Kd=function(e){return e&&(e.host||Kd(e.parentNode))},qd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Kd(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Jd=function(e,t,n,r){var i=qd(t,Array.isArray(e)?e:[e]);Wd[n]||(Wd[n]=new WeakMap);var a=Wd[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Hd.get(e)||0)+1,l=(a.get(e)||0)+1;Hd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Ud.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Gd++,function(){o.forEach(function(e){var t=Hd.get(e)-1,i=a.get(e)-1;Hd.set(e,t),a.set(e,i),t||(Ud.has(e)||e.removeAttribute(r),Ud.delete(e)),i||e.removeAttribute(n)}),Gd--,Gd||(Hd=new WeakMap,Hd=new WeakMap,Ud=new WeakMap,Wd={})}},Yd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Vd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Jd(r,i,n,`aria-hidden`)):function(){return null}},Xd=`Dialog`,[Zd,Qd]=Fl(Xd),[$d,ef]=Zd(Xd),tf=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=S.useRef(null),c=S.useRef(null),[l,u]=Vl({prop:r,defaultProp:i??!1,onChange:a,caller:Xd});return(0,H.jsx)($d,{scope:t,triggerRef:s,contentRef:c,contentId:X(),titleId:X(),descriptionId:X(),open:l,onOpenChange:u,onOpenToggle:S.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};tf.displayName=Xd;var nf=`DialogTrigger`,rf=S.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ef(nf,n),a=Vc(t,i.triggerRef);return(0,H.jsx)(ll.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":wf(i.open),...r,ref:a,onClick:Pl(e.onClick,i.onOpenToggle)})});rf.displayName=nf;var af=`DialogPortal`,[of,sf]=Zd(af,{forceMount:void 0}),cf=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=ef(af,t);return(0,H.jsx)(of,{scope:t,forceMount:n,children:S.Children.map(r,e=>(0,H.jsx)(wu,{present:n||a.open,children:(0,H.jsx)(Su,{asChild:!0,container:i,children:e})}))})};cf.displayName=af;var lf=`DialogOverlay`,uf=S.forwardRef((e,t)=>{let n=sf(lf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ef(lf,e.__scopeDialog);return a.modal?(0,H.jsx)(wu,{present:r||a.open,children:(0,H.jsx)(ff,{...i,ref:t})}):null});uf.displayName=lf;var df=Hc(`DialogOverlay.RemoveScroll`),ff=S.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ef(lf,n),a=Vc(t,eu());return(0,H.jsx)(Bd,{as:df,allowPinchZoom:!0,shards:[i.contentRef],children:(0,H.jsx)(ll.div,{"data-state":wf(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),pf=`DialogContent`,mf=S.forwardRef((e,t)=>{let n=sf(pf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ef(pf,e.__scopeDialog);return(0,H.jsx)(wu,{present:r||a.open,children:a.modal?(0,H.jsx)(hf,{...i,ref:t}):(0,H.jsx)(gf,{...i,ref:t})})});mf.displayName=pf;var hf=S.forwardRef((e,t)=>{let n=ef(pf,e.__scopeDialog),r=S.useRef(null),i=Vc(t,n.contentRef,r);return S.useEffect(()=>{let e=r.current;if(e)return Yd(e)},[]),(0,H.jsx)(_f,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Pl(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Pl(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Pl(e.onFocusOutside,e=>e.preventDefault())})}),gf=S.forwardRef((e,t)=>{let n=ef(pf,e.__scopeDialog),r=S.useRef(!1),i=S.useRef(!1);return(0,H.jsx)(_f,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),_f=S.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=ef(pf,n);return Mu(),(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(lu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Zl,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":wf(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),vf=`DialogTitle`,yf=S.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ef(vf,n);return(0,H.jsx)(ll.h2,{id:i.titleId,...r,ref:t})});yf.displayName=vf;var bf=`DialogDescription`,xf=S.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ef(bf,n);return(0,H.jsx)(ll.p,{id:i.descriptionId,...r,ref:t})});xf.displayName=bf;var Sf=`DialogClose`,Cf=S.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=ef(Sf,n);return(0,H.jsx)(ll.button,{type:`button`,...r,ref:t,onClick:Pl(e.onClick,()=>i.onOpenChange(!1))})});Cf.displayName=Sf;function wf(e){return e?`open`:`closed`}var Tf=tf,Ef=S.forwardRef(({className:e,children:t,...n},r)=>(0,H.jsxs)(cf,{children:[(0,H.jsx)(uf,{className:`fixed inset-0 z-50 bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out`}),(0,H.jsxs)(mf,{ref:r,className:Rc(`fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-card p-6 shadow-lg rounded-xl`,e),...n,children:[t,(0,H.jsx)(Cf,{className:`absolute right-4 top-4 opacity-70 hover:opacity-100`,children:(0,H.jsx)(us,{className:`h-4 w-4`})})]})]}));Ef.displayName=`DialogContent`;function Df({className:e,...t}){return(0,H.jsx)(`div`,{className:Rc(`flex flex-col space-y-1.5`,e),...t})}function Of({className:e,...t}){return(0,H.jsx)(`h2`,{className:Rc(`text-lg font-semibold`,e),...t})}var kf={id:0,icon:`📘`,title:``,description:``,content:``,category:``,related_sheet_type:``,published:!0};function Af(){let{page:e,setPage:t,data:n,totalPages:r,reload:i}=bl(R.articles),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(kf);function l(e){c({...e}),o(!0)}function u(){c({...kf}),o(!0)}async function d(){await R.saveArticle(s),o(!1),i()}async function f(e){await R.deleteArticle(e),i()}let p=e=>t=>c({...s,[e]:t.target.value});return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`文章管理`}),(0,H.jsx)(U,{onClick:u,children:`新建文章`})]}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`标题`}),(0,H.jsx)(K,{children:`分类`}),(0,H.jsx)(K,{children:`关联弹层`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{className:`text-right`,children:`操作`})]})}),(0,H.jsx)(Cl,{children:n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsxs)(q,{className:`font-medium`,children:[(0,H.jsx)(`span`,{className:`mr-1`,children:e.icon}),e.title]}),(0,H.jsx)(q,{children:e.category||`—`}),(0,H.jsx)(q,{children:e.related_sheet_type||`—`}),(0,H.jsx)(q,{children:e.published?(0,H.jsx)(El,{variant:`success`,children:`已发布`}):(0,H.jsx)(El,{variant:`muted`,children:`草稿`})}),(0,H.jsxs)(q,{className:`text-right space-x-2 whitespace-nowrap`,children:[(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>l(e),children:`编辑`}),(0,H.jsx)(U,{variant:`destructive`,size:`sm`,onClick:()=>f(e.id),children:`删除`})]})]},e.id))})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})}),(0,H.jsx)(Tf,{open:a,onOpenChange:o,children:(0,H.jsxs)(Ef,{children:[(0,H.jsx)(Df,{children:(0,H.jsx)(Of,{children:s.id?`编辑文章`:`新建文章`})}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`图标(emoji)`}),(0,H.jsx)(W,{value:s.icon,onChange:p(`icon`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`分类`}),(0,H.jsx)(W,{value:s.category,onChange:p(`category`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5 col-span-2`,children:[(0,H.jsx)(G,{children:`标题`}),(0,H.jsx)(W,{value:s.title,onChange:p(`title`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5 col-span-2`,children:[(0,H.jsx)(G,{children:`简介`}),(0,H.jsx)(W,{value:s.description,onChange:p(`description`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`关联弹层类型`}),(0,H.jsx)(W,{value:s.related_sheet_type,onChange:p(`related_sheet_type`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`发布状态`}),(0,H.jsxs)(`select`,{className:`flex h-9 w-full rounded-md border border-input bg-card px-3 text-sm`,value:s.published?`1`:`0`,onChange:e=>c({...s,published:e.target.value===`1`}),children:[(0,H.jsx)(`option`,{value:`1`,children:`已发布`}),(0,H.jsx)(`option`,{value:`0`,children:`草稿`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5 col-span-2`,children:[(0,H.jsx)(G,{children:`正文`}),(0,H.jsx)(`textarea`,{className:`flex min-h-24 w-full rounded-md border border-input bg-card px-3 py-2 text-sm`,value:s.content,onChange:p(`content`)})]})]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,H.jsx)(U,{variant:`outline`,onClick:()=>o(!1),children:`取消`}),(0,H.jsx)(U,{onClick:d,children:`保存`})]})]})})]})}var jf=[{key:`cat`,label:`猫猫`,Icon:Wo},{key:`dog`,label:`狗狗`,Icon:Jo}],Mf=[`刚到家 0-30 天`,`幼年期`,`成年期`,`老年期`],Nf={vaccine:`疫苗`,deworm:`驱虫`,weight:`体重`,monthlyReport:`月报`},Pf=[`vaccine`,`deworm`,`weight`,`monthlyReport`],Ff=[{key:`daily`,label:`每天`},{key:`weekly`,label:`每周`},{key:`monthly`,label:`每月`},{key:`once`,label:`一次性`}],If=[`一`,`二`,`三`,`四`,`五`,`六`,`日`],Lf=`h-9 rounded-md border border-input bg-card px-2 text-sm shrink-0`,Rf=1;function zf(e){return{_k:Rf++,kind:e.kind===`reminder`?`reminder`:`plan`,title:e.title||``,description:e.description||``,priority:e.priority||``,sheet_type:e.sheet_type||``,repeat:e.repeat||`once`,day:e.day??0,weekdays:e.weekdays||``,month_day:e.month_day??1,reminder_type:e.reminder_type||`vaccine`,offset_days:e.offset_days??0,frequency:e.frequency||``}}function Bf(e){return zf({kind:e,repeat:e===`plan`?`daily`:``})}function Vf(){let[e,t]=(0,S.useState)([]),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)({id:``,species:`cat`,stage:`成年期`,name:``,summary:``,sort:0,enabled:!0}),[c,l]=(0,S.useState)([]),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(!1);function g(){R.careTemplates().then(e=>t(e||[])).catch(()=>t([]))}(0,S.useEffect)(()=>{g(),R.careTemplateMeta().then(e=>r(e?.record_types||[])).catch(()=>{})},[]);function _(){s({id:``,species:`cat`,stage:`成年期`,name:``,summary:``,sort:0,enabled:!0}),l([]),d(``),a(!0)}async function v(e){d(``);let t=await R.careTemplate(e.id);s({...e}),l((t?.items||[]).map(zf)),a(!0)}async function y(){d(``),p(!0);try{await R.saveCareTemplate({...o,items:c}),a(!1),g()}catch(e){d(e?.message||`保存失败`)}finally{p(!1)}}async function b(e){confirm(`删除方案「${e.name||e.stage}」?已经套用出去的计划不受影响。`)&&(await R.deleteCareTemplate(e.id).catch(e=>alert(e?.message||`删除失败`)),g())}async function x(){h(!0);try{let e=await R.genCareTemplate(o.species,o.stage);l((e?.items||[]).map(zf))}catch(e){d(e?.message||`AI 生成失败`)}finally{h(!1)}}let C=(e,t,n)=>l(r=>r.map(r=>r._k===e?{...r,[t]:n}:r)),w=e=>l(t=>t.filter(t=>t._k!==e));function T(e,t){let n=String(t+1),r=e.weekdays.split(`,`).filter(Boolean),i=r.includes(n)?r.filter(e=>e!==n):[...r,n].sort();C(e._k,`weekdays`,i.join(`,`))}let ee=c.filter(e=>e.kind===`plan`),te=c.filter(e=>e.kind===`reminder`);function ne(e){let t=e.items||[],n={daily:0,weekly:0,monthly:0,once:0,rem:0};return t.forEach(e=>{e.kind===`reminder`?n.rem++:e.repeat===`daily`?n.daily++:e.repeat===`weekly`?n.weekly++:e.repeat===`monthly`?n.monthly++:n.once++}),n}return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`养护方案`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`用户建档最后一步从这里挑一套,也可以选「先空着自己排」。同一个物种阶段可以配多套。`})]}),(0,H.jsxs)(U,{onClick:_,children:[(0,H.jsx)(is,{className:`h-4 w-4`}),` 新建方案`]})]}),(0,H.jsx)(ml,{children:(0,H.jsx)(_l,{className:`pt-6`,children:(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{className:`w-24`,children:`物种/阶段`}),(0,H.jsx)(K,{children:`方案名`}),(0,H.jsx)(K,{children:`内容`}),(0,H.jsx)(K,{className:`w-20`,children:`状态`}),(0,H.jsx)(K,{className:`w-32 text-right`,children:`操作`})]})}),(0,H.jsxs)(Cl,{children:[e.map(e=>{let t=ne(e);return(0,H.jsxs)(wl,{children:[(0,H.jsxs)(q,{className:`text-muted-foreground`,children:[e.species===`dog`?`狗`:`猫`,` · `,e.stage]}),(0,H.jsxs)(q,{children:[(0,H.jsx)(`div`,{className:`font-medium`,children:e.name||`(未命名)`}),(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.summary})]}),(0,H.jsxs)(q,{className:`text-xs text-muted-foreground`,children:[`每天 `,t.daily,` · 每周 `,t.weekly,` · 每月 `,t.monthly,` · 一次性 `,t.once,` · 提醒 `,t.rem]}),(0,H.jsx)(q,{children:e.enabled?(0,H.jsx)(El,{children:`启用`}):(0,H.jsx)(El,{variant:`secondary`,children:`停用`})}),(0,H.jsxs)(q,{className:`text-right`,children:[(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>v(e),children:`编辑`}),(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>b(e),children:`删除`})]})]},e.id)}),!e.length&&(0,H.jsx)(wl,{children:(0,H.jsx)(q,{colSpan:5,className:`py-10 text-center text-muted-foreground`,children:`还没有方案 —— 用户建档后计划页会是空的,只能自己排`})})]})]})})}),(0,H.jsx)(Tf,{open:i,onOpenChange:a,children:(0,H.jsxs)(Ef,{className:`max-h-[88vh] max-w-4xl overflow-y-auto`,children:[(0,H.jsx)(Df,{children:(0,H.jsx)(Of,{children:o.id?`编辑方案`:`新建方案`})}),(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`物种`}),(0,H.jsx)(`div`,{className:`flex gap-2`,children:jf.map(e=>(0,H.jsxs)(U,{type:`button`,size:`sm`,variant:o.species===e.key?`default`:`outline`,onClick:()=>s({...o,species:e.key}),children:[(0,H.jsx)(e.Icon,{className:`h-4 w-4`}),` `,e.label]},e.key))})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`阶段`}),(0,H.jsx)(`select`,{className:Lf,value:o.stage,onChange:e=>s({...o,stage:e.target.value}),children:Mf.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`方案名(用户建档时看到的就是这个)`}),(0,H.jsx)(W,{value:o.name,onChange:e=>s({...o,name:e.target.value}),placeholder:`幼猫标准照护`})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`一句话摘要`}),(0,H.jsx)(W,{value:o.summary,onChange:e=>s({...o,summary:e.target.value}),placeholder:`每天清砂盆和喂食,每周称体重,含疫苗驱虫提醒`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{id:`ct-enabled`,type:`checkbox`,checked:o.enabled,onChange:e=>s({...o,enabled:e.target.checked})}),(0,H.jsx)(G,{htmlFor:`ct-enabled`,className:`cursor-pointer`,children:`启用(停用后建档时挑不到)`})]}),(0,H.jsxs)(`div`,{className:`rounded-md border p-3`,children:[(0,H.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`font-medium`,children:[`计划事项(`,ee.length,`)`]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsxs)(U,{size:`sm`,variant:`outline`,onClick:x,disabled:m,children:[(0,H.jsx)(ls,{className:`h-4 w-4`}),` `,m?`生成中…`:`AI 起草`]}),(0,H.jsxs)(U,{size:`sm`,variant:`outline`,onClick:()=>l([...c,Bf(`plan`)]),children:[(0,H.jsx)(is,{className:`h-4 w-4`}),` 加一条`]})]})]}),(0,H.jsxs)(`div`,{className:`mb-3 flex items-start gap-2 rounded bg-muted p-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(Xo,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{children:`「关联记录事项」= 用户在小程序点这条计划时,直接跳到哪个记录表单。 比如「记录一次体重」关联体重,点了就是体重表单,不用自己去记录页找。 这个下拉读的是记录事项那一页的配置。`})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[ee.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(W,{className:`min-w-40 flex-1`,placeholder:`做什么`,value:e.title,onChange:t=>C(e._k,`title`,t.target.value)}),(0,H.jsx)(W,{className:`min-w-40 flex-1`,placeholder:`说明`,value:e.description,onChange:t=>C(e._k,`description`,t.target.value)}),(0,H.jsx)(`select`,{className:Lf,value:e.repeat,onChange:t=>C(e._k,`repeat`,t.target.value),children:Ff.map(e=>(0,H.jsx)(`option`,{value:e.key,children:e.label},e.key))}),e.repeat===`weekly`&&(0,H.jsx)(`div`,{className:`flex gap-1`,children:If.map((t,n)=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>T(e,n),className:`h-7 w-7 rounded text-xs `+(e.weekdays.split(`,`).includes(String(n+1))?`bg-primary text-primary-foreground`:`border border-input bg-card`),children:t},t))}),e.repeat===`monthly`&&(0,H.jsx)(W,{type:`number`,className:`w-20`,placeholder:`几号`,value:e.month_day,onChange:t=>C(e._k,`month_day`,Number(t.target.value)||1)}),e.repeat===`once`&&(0,H.jsx)(W,{type:`number`,className:`w-24`,placeholder:`第N天`,value:e.day,onChange:t=>C(e._k,`day`,Number(t.target.value)||0)}),(0,H.jsxs)(`select`,{className:Lf,value:e.priority,onChange:t=>C(e._k,`priority`,t.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`普通`}),(0,H.jsx)(`option`,{value:`重要`,children:`重要`})]}),(0,H.jsxs)(`select`,{className:Lf,value:e.sheet_type,onChange:t=>C(e._k,`sheet_type`,t.target.value),children:[(0,H.jsx)(`option`,{value:``,children:`不关联`}),n.map(e=>(0,H.jsx)(`option`,{value:e.code,children:e.label},e.code))]}),(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>w(e._k),children:(0,H.jsx)(ss,{className:`h-4 w-4`})})]},e._k)),!ee.length&&(0,H.jsx)(`p`,{className:`py-4 text-center text-sm text-muted-foreground`,children:`还没有计划事项`})]})]}),(0,H.jsxs)(`div`,{className:`rounded-md border p-3`,children:[(0,H.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`font-medium`,children:[`到期提醒(`,te.length,`)`]}),(0,H.jsxs)(U,{size:`sm`,variant:`outline`,onClick:()=>l([...c,Bf(`reminder`)]),children:[(0,H.jsx)(is,{className:`h-4 w-4`}),` 加一条`]})]}),(0,H.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:`提醒不占计划页的格子,只在到期时冒出来。疫苗和驱虫这两类建档时就会自动建 (漏针是真会出事的),不用等用户挑方案。`}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[te.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`select`,{className:Lf,value:e.reminder_type,onChange:t=>C(e._k,`reminder_type`,t.target.value),children:Pf.map(e=>(0,H.jsx)(`option`,{value:e,children:Nf[e]},e))}),(0,H.jsx)(W,{className:`min-w-40 flex-1`,placeholder:`提醒标题`,value:e.title,onChange:t=>C(e._k,`title`,t.target.value)}),(0,H.jsx)(W,{type:`number`,className:`w-28`,placeholder:`N天后到期`,value:e.offset_days,onChange:t=>C(e._k,`offset_days`,Number(t.target.value)||0)}),(0,H.jsx)(W,{className:`w-40`,placeholder:`频率说明`,value:e.frequency,onChange:t=>C(e._k,`frequency`,t.target.value)}),(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>w(e._k),children:(0,H.jsx)(ss,{className:`h-4 w-4`})})]},e._k)),!te.length&&(0,H.jsx)(`p`,{className:`py-4 text-center text-sm text-muted-foreground`,children:`还没有提醒`})]})]}),u&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:u}),(0,H.jsx)(U,{onClick:y,disabled:f,children:f?`保存中…`:`保存方案`})]})]})})]})}var Hf={id:``,code:``,label:``,icon:`note`,group:`daily`,sort:0,enabled:!0,form:`simple`,locked:!1,fields_raw:``},Uf=[{key:`daily`,label:`日常`},{key:`health`,label:`健康`},{key:`care`,label:`洗护`},{key:`clean`,label:`清洁`}],Wf=`number:体重:kg 数值,落 num_value options:状态:正常|软便|拉稀 单选,落 category options:症状:呕吐|拉稀:- 末尾 - 表示不落 category(只进标题) text:吃了什么 文本,只进标题 -(留空) 只要「时间 + 描述 + 照片」`;function Jf(){let[e,t]=(0,S.useState)([]),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(Gf),[o,s]=(0,S.useState)(``);function c(){R.recordTypes().then(e=>t(e||[])).catch(()=>t([]))}(0,S.useEffect)(c,[]);function l(){a({...Gf}),s(``),r(!0)}function u(e){a({...e}),s(``),r(!0)}async function d(){s(``);try{await R.saveRecordType(i),r(!1),c()}catch(e){s(e?.message||`保存失败`)}}async function f(e){if(confirm(`删除「${e.label}」?`))try{await R.deleteRecordType(e.id),c()}catch(e){alert(e?.message||`删除失败`)}}let p=e=>t=>a({...i,[e]:t.target.value});function m(e){return e.fields?.length?(0,H.jsx)(`span`,{className:`space-x-2`,children:e.fields.map((e,t)=>(0,H.jsxs)(`span`,{className:`whitespace-nowrap text-xs`,children:[e.label,e.kind===`number`&&`·数值${e.unit||``}`,e.kind===`text`&&`·文本`,e.kind===`options`&&`·单选${e.to_category?`★`:``}`]},t))}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`时间 + 描述 + 照片`})}let h={};return e.forEach(e=>(h[e.group]=h[e.group]||[]).push(e)),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`记录事项`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`小程序「记一笔」的事项和它们的表单字段。★ 标记的单选会落到 category —— 周报的高风险数、账单的分类统计都读这一列。`})]}),(0,H.jsx)(U,{onClick:l,children:`新增事项`})]}),(0,H.jsx)(ml,{children:(0,H.jsx)(_l,{className:`pt-6`,children:(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{className:`w-20`,children:`分组`}),(0,H.jsx)(K,{className:`w-28`,children:`名称`}),(0,H.jsx)(K,{className:`w-28`,children:`code`}),(0,H.jsx)(K,{children:`表单字段`}),(0,H.jsx)(K,{className:`w-16`,children:`排序`}),(0,H.jsx)(K,{className:`w-24`,children:`状态`}),(0,H.jsx)(K,{className:`w-32 text-right`,children:`操作`})]})}),(0,H.jsxs)(Cl,{children:[Kf.map(e=>(h[e.key]||[]).map((t,n)=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{className:`text-muted-foreground`,children:n===0?e.label:``}),(0,H.jsx)(q,{className:`font-medium`,children:t.label}),(0,H.jsx)(q,{className:`font-mono text-xs text-muted-foreground`,children:t.code}),(0,H.jsx)(q,{children:m(t)}),(0,H.jsx)(q,{className:`text-muted-foreground`,children:t.sort}),(0,H.jsxs)(q,{children:[t.enabled?(0,H.jsx)(El,{children:`启用`}):(0,H.jsx)(El,{variant:`secondary`,children:`停用`}),t.locked&&(0,H.jsx)(El,{variant:`outline`,className:`ml-1`,children:`内置`})]}),(0,H.jsxs)(q,{className:`text-right`,children:[(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>u(t),children:`编辑`}),!t.locked&&(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>f(t),children:`删除`})]})]},t.id))),!e.length&&(0,H.jsx)(wl,{children:(0,H.jsx)(q,{colSpan:7,className:`py-10 text-center text-muted-foreground`,children:`还没有事项 —— 小程序的记录页会是空的`})})]})]})})}),(0,H.jsx)(Tf,{open:n,onOpenChange:r,children:(0,H.jsxs)(Ef,{className:`max-w-2xl`,children:[(0,H.jsx)(Df,{children:(0,H.jsx)(Of,{children:i.id?`编辑「${i.label}」`:`新增事项`})}),(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`名称`}),(0,H.jsx)(W,{value:i.label,onChange:p(`label`),placeholder:`洗澡`})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`code(落库的 type,建过记录后不能改)`}),(0,H.jsx)(W,{value:i.code,onChange:p(`code`),placeholder:`bath`,className:`font-mono`,disabled:i.locked})]})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`分组`}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Kf.map(e=>(0,H.jsx)(U,{type:`button`,variant:i.group===e.key?`default`:`outline`,size:`sm`,onClick:()=>a({...i,group:e.key}),children:e.label},e.key))})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`图标名(pt-icon)`}),(0,H.jsx)(W,{value:i.icon,onChange:p(`icon`),placeholder:`bath`,className:`font-mono`})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`表单字段(一行一个,留空则只有「时间 + 描述 + 照片」)`}),(0,H.jsx)(`textarea`,{className:`min-h-[120px] w-full rounded-md border border-input bg-card px-3 py-2 font-mono text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:i.fields_raw||``,onChange:p(`fields_raw`),placeholder:`number:体重:kg`}),(0,H.jsx)(`pre`,{className:`whitespace-pre-wrap rounded bg-muted p-3 text-xs text-muted-foreground`,children:qf}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`一个事项里最多一个字段能落 category。多出来的那个末尾加 `,(0,H.jsx)(`code`,{children:`:-`}),`。`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(G,{children:`排序`}),(0,H.jsx)(W,{type:`number`,value:i.sort,onChange:e=>a({...i,sort:Number(e.target.value)||0}),className:`w-24`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{id:`rt-enabled`,type:`checkbox`,checked:i.enabled,onChange:e=>a({...i,enabled:e.target.checked})}),(0,H.jsx)(G,{htmlFor:`rt-enabled`,className:`cursor-pointer`,children:`启用`})]})]}),i.locked&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`这是内置事项:统计和分析逻辑依赖它的 code,不能删也不能改 code。想隐藏请改成停用。`}),o&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:o}),(0,H.jsx)(U,{onClick:d,children:`保存`})]})]})})]})}var Yf={id:``,species:`cat`,name:``,initial:``,sort:0,enabled:!0},Xf=[{key:`cat`,label:`猫`},{key:`dog`,label:`狗`}];function Zf(){let[e,t]=(0,S.useState)(`cat`),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(Yf),[c,l]=(0,S.useState)(``);function u(){R.breeds(e).then(e=>r(e||[])).catch(()=>r([]))}(0,S.useEffect)(u,[e]);function d(){s({...Yf,species:e}),l(``),a(!0)}function f(e){s({...e}),l(``),a(!0)}async function p(){l(``);try{await R.saveBreed(o),a(!1),u()}catch(e){l(e?.message||`保存失败`)}}async function m(e){if(confirm(`删除「${e.name}」?`))try{await R.deleteBreed(e.id),u()}catch(e){alert(e?.message||`删除失败`)}}let h=e=>t=>s({...o,[e]:t.target.value}),g={};n.forEach(e=>{let t=(e.initial||`#`).toUpperCase();(g[t]=g[t]||[]).push(e)});let _=Object.keys(g).sort();return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`品种管理`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`建档第二步的品种选择器读这里。首字母要手填 —— 多音字(藏獒、柴犬)自动转拼音常出错。`})]}),(0,H.jsx)(U,{onClick:d,children:`新增品种`})]}),(0,H.jsxs)(`div`,{className:`mb-4 flex gap-2`,children:[Xf.map(n=>(0,H.jsx)(U,{variant:e===n.key?`default`:`outline`,size:`sm`,onClick:()=>t(n.key),children:n.label},n.key)),(0,H.jsxs)(`span`,{className:`ml-2 self-center text-sm text-muted-foreground`,children:[`共 `,n.length,` 种,`,_.length,` 个首字母`]})]}),(0,H.jsx)(ml,{children:(0,H.jsx)(_l,{className:`pt-6`,children:(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{className:`w-16`,children:`首字母`}),(0,H.jsx)(K,{children:`品种`}),(0,H.jsx)(K,{className:`w-20`,children:`排序`}),(0,H.jsx)(K,{className:`w-20`,children:`状态`}),(0,H.jsx)(K,{className:`w-32 text-right`,children:`操作`})]})}),(0,H.jsxs)(Cl,{children:[_.map(e=>g[e].map((t,n)=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{className:`font-mono text-muted-foreground`,children:n===0?e:``}),(0,H.jsx)(q,{className:`font-medium`,children:t.name}),(0,H.jsx)(q,{className:`text-muted-foreground`,children:t.sort}),(0,H.jsx)(q,{children:t.enabled?(0,H.jsx)(El,{children:`启用`}):(0,H.jsx)(El,{variant:`secondary`,children:`停用`})}),(0,H.jsxs)(q,{className:`text-right`,children:[(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>f(t),children:`编辑`}),(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>m(t),children:`删除`})]})]},t.id))),!n.length&&(0,H.jsx)(wl,{children:(0,H.jsx)(q,{colSpan:5,className:`py-10 text-center text-muted-foreground`,children:`还没有品种`})})]})]})})}),(0,H.jsx)(Tf,{open:i,onOpenChange:a,children:(0,H.jsxs)(Ef,{children:[(0,H.jsx)(Df,{children:(0,H.jsx)(Of,{children:o.id?`编辑品种`:`新增品种`})}),(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`物种`}),(0,H.jsx)(`div`,{className:`flex gap-2`,children:Xf.map(e=>(0,H.jsx)(U,{type:`button`,variant:o.species===e.key?`default`:`outline`,size:`sm`,onClick:()=>s({...o,species:e.key}),children:e.label},e.key))})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`品种名`}),(0,H.jsx)(W,{value:o.name,onChange:h(`name`),placeholder:`例如:布偶猫`})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`首字母(A-Z,一位)`}),(0,H.jsx)(W,{value:o.initial,maxLength:1,onChange:e=>s({...o,initial:e.target.value.toUpperCase()}),placeholder:`B`,className:`w-20 font-mono`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`按国内常用读法填。多音字自己定:藏獒填 Z,柴犬填 C。`})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`排序(同首字母内,小的在前)`}),(0,H.jsx)(W,{type:`number`,value:o.sort,onChange:e=>s({...o,sort:Number(e.target.value)||0}),className:`w-28`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{id:`bd-enabled`,type:`checkbox`,checked:o.enabled,onChange:e=>s({...o,enabled:e.target.checked})}),(0,H.jsx)(G,{htmlFor:`bd-enabled`,className:`cursor-pointer`,children:`启用(停用后建档时选不到,已填这个品种的档案不受影响)`})]}),c&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:c}),(0,H.jsx)(U,{onClick:p,children:`保存`})]})]})})]})}function Qf(){let[e,t]=(0,S.useState)({enabled:!0,daily_count:3,start_hour:9,end_hour:21}),[n,r]=(0,S.useState)(!0),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(5),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)({enabled:!0,daily_chat:20,daily_symptom:10,daily_plan:5}),[m,h]=(0,S.useState)(!1),[g,_]=(0,S.useState)(``);(0,S.useEffect)(()=>{R.communityBot().then(e=>{t(e),r(!1)}),R.aiQuota().then(p).catch(()=>{})},[]);let v=e=>t=>{let n=Number(t.target.value);(Number.isNaN(n)||n<0)&&(n=0),p({...f,[e]:Math.min(999,n)})};async function y(){h(!0),_(``);try{p(await R.saveAIQuota(f)),_(`已保存,立即生效`)}catch(e){_(e.message||`保存失败`)}finally{h(!1)}}let b=(n,r,i)=>a=>{let o=Number(a.target.value);Number.isNaN(o)&&(o=r),o=Math.max(r,Math.min(i,o)),t({...e,[n]:o})};async function x(){a(!0),d(``);try{let n=await R.saveCommunityBot(e);t(n),d(`已保存`)}catch(e){d(e?.message||`保存失败`)}finally{a(!1)}}async function C(){l(!0),d(``);try{let{made:e}=await R.genCommunityPosts(o);d(`已生成 ${e} 条并发布到宠友圈`)}catch(e){d(e?.message||`生成失败`)}finally{l(!1)}}return(0,H.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,H.jsxs)(`div`,{className:`mb-4`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`社区运营`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`AI 以虚拟宠友账号自动生成养宠动态丰富社区,每条都会带「AI」标签,可在「帖子审核」里删除或隐藏。`})]}),u&&(0,H.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-md bg-primary/10 px-3 py-2 text-sm text-primary`,children:[(0,H.jsx)(Xo,{className:`h-4 w-4`}),` `,u]}),n?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`加载中…`}):(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-5 pb-5 space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,H.jsx)(os,{className:`h-4 w-4 text-primary`}),` 每日自动生成`]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`自动生成`}),(0,H.jsxs)(`select`,{className:`flex h-9 w-full rounded-md border border-input bg-card px-3 text-sm`,value:e.enabled?`1`:`0`,onChange:n=>t({...e,enabled:n.target.value===`1`}),children:[(0,H.jsx)(`option`,{value:`1`,children:`开启`}),(0,H.jsx)(`option`,{value:`0`,children:`关闭`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`每天条数`}),(0,H.jsx)(W,{type:`number`,value:e.daily_count,onChange:b(`daily_count`,0,50)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`投放起始时段(点)`}),(0,H.jsx)(W,{type:`number`,value:e.start_hour,onChange:b(`start_hour`,0,23)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`投放结束时段(点)`}),(0,H.jsx)(W,{type:`number`,value:e.end_hour,onChange:b(`end_hour`,1,24)})]})]}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`当前设置:`,e.enabled?`开启`:`关闭`,`,每天 `,e.daily_count,` 条, 在 `,e.start_hour,`:00 – `,e.end_hour,`:00 之间随机时间发布。`]}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(U,{onClick:x,disabled:i,children:[(0,H.jsx)(as,{className:`h-4 w-4`}),` `,i?`保存中…`:`保存设置`]})})]})}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-5 pb-5 space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,H.jsx)(ls,{className:`h-4 w-4 text-primary`}),` 立即生成一批`]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`社区太空时可一次性铺一批。会立刻调用 AI 生成并发布,最多 30 条。`}),(0,H.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`条数`}),(0,H.jsx)(W,{type:`number`,className:`w-28`,value:o,onChange:e=>s(Math.max(1,Math.min(30,Number(e.target.value)||1)))})]}),(0,H.jsxs)(U,{variant:`outline`,onClick:C,disabled:c,children:[(0,H.jsx)(ls,{className:`h-4 w-4`}),` `,c?`生成中…`:`立即生成 ${o} 条`]})]})]})})]}),(0,H.jsx)(ml,{className:`mt-4`,children:(0,H.jsxs)(_l,{className:`pt-6 space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(os,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`font-medium`,children:`AI 每日次数上限`})]}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground flex gap-2`,children:[(0,H.jsx)(Xo,{className:`h-4 w-4 shrink-0 mt-0.5`}),(0,H.jsx)(`span`,{children:`按「每个用户 / 每个自然日」计,改完立即生效。填 0 表示该功能不限次。 总开关关掉则全部不限——AI 调用是真金白银,关之前想清楚。`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{id:`q-enabled`,type:`checkbox`,checked:f.enabled,onChange:e=>p({...f,enabled:e.target.checked})}),(0,H.jsx)(G,{htmlFor:`q-enabled`,children:`启用次数限制`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 max-w-lg`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`问问 AI`}),(0,H.jsx)(W,{type:`number`,value:f.daily_chat,onChange:v(`daily_chat`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`异常评估`}),(0,H.jsx)(W,{type:`number`,value:f.daily_symptom,onChange:v(`daily_symptom`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`AI 生成计划`}),(0,H.jsx)(W,{type:`number`,value:f.daily_plan,onChange:v(`daily_plan`)})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsxs)(U,{onClick:y,disabled:m,children:[(0,H.jsx)(as,{className:`h-4 w-4`}),` `,m?`保存中…`:`保存额度`]}),g&&(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:g})]})]})})]})}function $f(){let{page:e,setPage:t,data:n,totalPages:r,reload:i}=bl(R.feedback);async function a(e){await R.setFeedbackHandled(e.id,!e.handled),i()}return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-6`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`意见反馈`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`来自小程序「我的 → 意见反馈」的用户留言。`})]}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`时间`}),(0,H.jsx)(K,{children:`用户`}),(0,H.jsx)(K,{children:`内容`}),(0,H.jsx)(K,{children:`联系方式`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{className:`text-right`,children:`操作`})]})}),(0,H.jsxs)(Cl,{children:[n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{className:`whitespace-nowrap text-muted-foreground`,children:String(e.created_at).slice(0,16).replace(`T`,` `)}),(0,H.jsx)(q,{children:e.nickname||`—`}),(0,H.jsx)(q,{className:`max-w-md whitespace-pre-wrap`,children:e.content}),(0,H.jsx)(q,{children:e.contact||`—`}),(0,H.jsx)(q,{children:e.handled?(0,H.jsx)(El,{variant:`success`,children:`已处理`}):(0,H.jsx)(El,{variant:`muted`,children:`待处理`})}),(0,H.jsx)(q,{className:`text-right`,children:(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>a(e),children:e.handled?`标为待处理`:`标为已处理`})})]},e.id)),!n?.list?.length&&(0,H.jsx)(wl,{children:(0,H.jsx)(q,{colSpan:6,className:`text-center text-muted-foreground py-8`,children:`还没有反馈`})})]})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})})]})}function ep(){let{page:e,setPage:t,data:n,totalPages:r}=bl(R.memberships);return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`会员管理`}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`用户ID`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{children:`类型`}),(0,H.jsx)(K,{children:`价格`}),(0,H.jsx)(K,{children:`到期`})]})}),(0,H.jsx)(Cl,{children:n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsx)(q,{children:e.user_id}),(0,H.jsx)(q,{children:e.status===`active`?(0,H.jsx)(El,{variant:`success`,children:`生效中`}):(0,H.jsx)(El,{variant:`muted`,children:e.status})}),(0,H.jsx)(q,{children:e.plan_type||`—`}),(0,H.jsxs)(q,{children:[`¥`,e.price]}),(0,H.jsx)(q,{children:e.end_date?String(e.end_date).slice(0,10):`—`})]},e.id))})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})})]})}function tp({children:e}){return To()?e:(0,H.jsx)(Ht,{to:`/login`,replace:!0})}function np(){return(0,H.jsxs)(Kt,{children:[(0,H.jsx)(Wt,{path:`/login`,element:(0,H.jsx)(vl,{})}),(0,H.jsxs)(Wt,{path:`/`,element:(0,H.jsx)(tp,{children:(0,H.jsx)(sl,{})}),children:[(0,H.jsx)(Wt,{index:!0,element:(0,H.jsx)(yl,{})}),(0,H.jsx)(Wt,{path:`users`,element:(0,H.jsx)(Ol,{})}),(0,H.jsx)(Wt,{path:`pets`,element:(0,H.jsx)(kl,{})}),(0,H.jsx)(Wt,{path:`posts`,element:(0,H.jsx)(Ml,{})}),(0,H.jsx)(Wt,{path:`comments`,element:(0,H.jsx)(Nl,{})}),(0,H.jsx)(Wt,{path:`articles`,element:(0,H.jsx)(Af,{})}),(0,H.jsx)(Wt,{path:`care-templates`,element:(0,H.jsx)(Hf,{})}),(0,H.jsx)(Wt,{path:`record-types`,element:(0,H.jsx)(Jf,{})}),(0,H.jsx)(Wt,{path:`breeds`,element:(0,H.jsx)(Zf,{})}),(0,H.jsx)(Wt,{path:`community-bot`,element:(0,H.jsx)(Qf,{})}),(0,H.jsx)(Wt,{path:`feedback`,element:(0,H.jsx)($f,{})}),(0,H.jsx)(Wt,{path:`members`,element:(0,H.jsx)(ep,{})})]}),(0,H.jsx)(Wt,{path:`*`,element:(0,H.jsx)(Ht,{to:`/`,replace:!0})})]})}(0,er.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(S.StrictMode,{children:(0,H.jsx)(Pn,{basename:`/admin`,children:(0,H.jsx)(np,{})})})); \ No newline at end of file +(留空) 只要「时间 + 描述 + 照片」`;function Gf(){let[e,t]=(0,S.useState)([]),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(Hf),[o,s]=(0,S.useState)(``);function c(){R.recordTypes().then(e=>t(e||[])).catch(()=>t([]))}(0,S.useEffect)(c,[]);function l(){a({...Hf}),s(``),r(!0)}function u(e){a({...e}),s(``),r(!0)}async function d(){s(``);try{await R.saveRecordType(i),r(!1),c()}catch(e){s(e?.message||`保存失败`)}}async function f(e){if(confirm(`删除「${e.label}」?`))try{await R.deleteRecordType(e.id),c()}catch(e){alert(e?.message||`删除失败`)}}let p=e=>t=>a({...i,[e]:t.target.value});function m(e){return e.fields?.length?(0,H.jsx)(`span`,{className:`space-x-2`,children:e.fields.map((e,t)=>(0,H.jsxs)(`span`,{className:`whitespace-nowrap text-xs`,children:[e.label,e.kind===`number`&&`·数值${e.unit||``}`,e.kind===`text`&&`·文本`,e.kind===`options`&&`·单选${e.to_category?`★`:``}`]},t))}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`时间 + 描述 + 照片`})}let h={};return e.forEach(e=>(h[e.group]=h[e.group]||[]).push(e)),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`记录事项`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`小程序「记一笔」的事项和它们的表单字段。★ 标记的单选会落到 category —— 周报的高风险数、账单的分类统计都读这一列。`})]}),(0,H.jsx)(U,{onClick:l,children:`新增事项`})]}),(0,H.jsx)(ml,{children:(0,H.jsx)(_l,{className:`pt-6`,children:(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{className:`w-20`,children:`分组`}),(0,H.jsx)(K,{className:`w-28`,children:`名称`}),(0,H.jsx)(K,{className:`w-28`,children:`code`}),(0,H.jsx)(K,{children:`表单字段`}),(0,H.jsx)(K,{className:`w-16`,children:`排序`}),(0,H.jsx)(K,{className:`w-24`,children:`状态`}),(0,H.jsx)(K,{className:`w-32 text-right`,children:`操作`})]})}),(0,H.jsxs)(Cl,{children:[Uf.map(e=>(h[e.key]||[]).map((t,n)=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{className:`text-muted-foreground`,children:n===0?e.label:``}),(0,H.jsx)(q,{className:`font-medium`,children:t.label}),(0,H.jsx)(q,{className:`font-mono text-xs text-muted-foreground`,children:t.code}),(0,H.jsx)(q,{children:m(t)}),(0,H.jsx)(q,{className:`text-muted-foreground`,children:t.sort}),(0,H.jsxs)(q,{children:[t.enabled?(0,H.jsx)(El,{children:`启用`}):(0,H.jsx)(El,{variant:`secondary`,children:`停用`}),t.locked&&(0,H.jsx)(El,{variant:`outline`,className:`ml-1`,children:`内置`})]}),(0,H.jsxs)(q,{className:`text-right`,children:[(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>u(t),children:`编辑`}),!t.locked&&(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>f(t),children:`删除`})]})]},t.id))),!e.length&&(0,H.jsx)(wl,{children:(0,H.jsx)(q,{colSpan:7,className:`py-10 text-center text-muted-foreground`,children:`还没有事项 —— 小程序的记录页会是空的`})})]})]})})}),(0,H.jsx)(Tf,{open:n,onOpenChange:r,children:(0,H.jsxs)(Ef,{className:`max-w-2xl`,children:[(0,H.jsx)(Df,{children:(0,H.jsx)(Of,{children:i.id?`编辑「${i.label}」`:`新增事项`})}),(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`名称`}),(0,H.jsx)(W,{value:i.label,onChange:p(`label`),placeholder:`洗澡`})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`code(落库的 type,建过记录后不能改)`}),(0,H.jsx)(W,{value:i.code,onChange:p(`code`),placeholder:`bath`,className:`font-mono`,disabled:i.locked})]})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`分组`}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Uf.map(e=>(0,H.jsx)(U,{type:`button`,variant:i.group===e.key?`default`:`outline`,size:`sm`,onClick:()=>a({...i,group:e.key}),children:e.label},e.key))})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`图标名(pt-icon)`}),(0,H.jsx)(W,{value:i.icon,onChange:p(`icon`),placeholder:`bath`,className:`font-mono`})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`表单字段(一行一个,留空则只有「时间 + 描述 + 照片」)`}),(0,H.jsx)(`textarea`,{className:`min-h-[120px] w-full rounded-md border border-input bg-card px-3 py-2 font-mono text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:i.fields_raw||``,onChange:p(`fields_raw`),placeholder:`number:体重:kg`}),(0,H.jsx)(`pre`,{className:`whitespace-pre-wrap rounded bg-muted p-3 text-xs text-muted-foreground`,children:Wf}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`一个事项里最多一个字段能落 category。多出来的那个末尾加 `,(0,H.jsx)(`code`,{children:`:-`}),`。`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(G,{children:`排序`}),(0,H.jsx)(W,{type:`number`,value:i.sort,onChange:e=>a({...i,sort:Number(e.target.value)||0}),className:`w-24`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{id:`rt-enabled`,type:`checkbox`,checked:i.enabled,onChange:e=>a({...i,enabled:e.target.checked})}),(0,H.jsx)(G,{htmlFor:`rt-enabled`,className:`cursor-pointer`,children:`启用`})]})]}),i.locked&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`这是内置事项:统计和分析逻辑依赖它的 code,不能删也不能改 code。想隐藏请改成停用。`}),o&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:o}),(0,H.jsx)(U,{onClick:d,children:`保存`})]})]})})]})}var Kf={id:``,species:`cat`,name:``,initial:``,sort:0,enabled:!0},qf=[{key:`cat`,label:`猫`},{key:`dog`,label:`狗`}];function Jf(){let[e,t]=(0,S.useState)(`cat`),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(Kf),[c,l]=(0,S.useState)(``);function u(){R.breeds(e).then(e=>r(e||[])).catch(()=>r([]))}(0,S.useEffect)(u,[e]);function d(){s({...Kf,species:e}),l(``),a(!0)}function f(e){s({...e}),l(``),a(!0)}async function p(){l(``);try{await R.saveBreed(o),a(!1),u()}catch(e){l(e?.message||`保存失败`)}}async function m(e){if(confirm(`删除「${e.name}」?`))try{await R.deleteBreed(e.id),u()}catch(e){alert(e?.message||`删除失败`)}}let h=e=>t=>s({...o,[e]:t.target.value}),g={};n.forEach(e=>{let t=(e.initial||`#`).toUpperCase();(g[t]=g[t]||[]).push(e)});let _=Object.keys(g).sort();return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`品种管理`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`建档第二步的品种选择器读这里。首字母要手填 —— 多音字(藏獒、柴犬)自动转拼音常出错。`})]}),(0,H.jsx)(U,{onClick:d,children:`新增品种`})]}),(0,H.jsxs)(`div`,{className:`mb-4 flex gap-2`,children:[qf.map(n=>(0,H.jsx)(U,{variant:e===n.key?`default`:`outline`,size:`sm`,onClick:()=>t(n.key),children:n.label},n.key)),(0,H.jsxs)(`span`,{className:`ml-2 self-center text-sm text-muted-foreground`,children:[`共 `,n.length,` 种,`,_.length,` 个首字母`]})]}),(0,H.jsx)(ml,{children:(0,H.jsx)(_l,{className:`pt-6`,children:(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{className:`w-16`,children:`首字母`}),(0,H.jsx)(K,{children:`品种`}),(0,H.jsx)(K,{className:`w-20`,children:`排序`}),(0,H.jsx)(K,{className:`w-20`,children:`状态`}),(0,H.jsx)(K,{className:`w-32 text-right`,children:`操作`})]})}),(0,H.jsxs)(Cl,{children:[_.map(e=>g[e].map((t,n)=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{className:`font-mono text-muted-foreground`,children:n===0?e:``}),(0,H.jsx)(q,{className:`font-medium`,children:t.name}),(0,H.jsx)(q,{className:`text-muted-foreground`,children:t.sort}),(0,H.jsx)(q,{children:t.enabled?(0,H.jsx)(El,{children:`启用`}):(0,H.jsx)(El,{variant:`secondary`,children:`停用`})}),(0,H.jsxs)(q,{className:`text-right`,children:[(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>f(t),children:`编辑`}),(0,H.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>m(t),children:`删除`})]})]},t.id))),!n.length&&(0,H.jsx)(wl,{children:(0,H.jsx)(q,{colSpan:5,className:`py-10 text-center text-muted-foreground`,children:`还没有品种`})})]})]})})}),(0,H.jsx)(Tf,{open:i,onOpenChange:a,children:(0,H.jsxs)(Ef,{children:[(0,H.jsx)(Df,{children:(0,H.jsx)(Of,{children:o.id?`编辑品种`:`新增品种`})}),(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`物种`}),(0,H.jsx)(`div`,{className:`flex gap-2`,children:qf.map(e=>(0,H.jsx)(U,{type:`button`,variant:o.species===e.key?`default`:`outline`,size:`sm`,onClick:()=>s({...o,species:e.key}),children:e.label},e.key))})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`品种名`}),(0,H.jsx)(W,{value:o.name,onChange:h(`name`),placeholder:`例如:布偶猫`})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`首字母(A-Z,一位)`}),(0,H.jsx)(W,{value:o.initial,maxLength:1,onChange:e=>s({...o,initial:e.target.value.toUpperCase()}),placeholder:`B`,className:`w-20 font-mono`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`按国内常用读法填。多音字自己定:藏獒填 Z,柴犬填 C。`})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`排序(同首字母内,小的在前)`}),(0,H.jsx)(W,{type:`number`,value:o.sort,onChange:e=>s({...o,sort:Number(e.target.value)||0}),className:`w-28`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{id:`bd-enabled`,type:`checkbox`,checked:o.enabled,onChange:e=>s({...o,enabled:e.target.checked})}),(0,H.jsx)(G,{htmlFor:`bd-enabled`,className:`cursor-pointer`,children:`启用(停用后建档时选不到,已填这个品种的档案不受影响)`})]}),c&&(0,H.jsx)(`p`,{className:`text-sm text-destructive`,children:c}),(0,H.jsx)(U,{onClick:p,children:`保存`})]})]})})]})}function Yf(){let[e,t]=(0,S.useState)({enabled:!0,daily_count:3,start_hour:9,end_hour:21}),[n,r]=(0,S.useState)(!0),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(5),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)({enabled:!0,daily_chat:20,daily_symptom:10,daily_plan:5}),[m,h]=(0,S.useState)(!1),[g,_]=(0,S.useState)(``);(0,S.useEffect)(()=>{R.communityBot().then(e=>{t(e),r(!1)}),R.aiQuota().then(p).catch(()=>{})},[]);let v=e=>t=>{let n=Number(t.target.value);(Number.isNaN(n)||n<0)&&(n=0),p({...f,[e]:Math.min(999,n)})};async function y(){h(!0),_(``);try{p(await R.saveAIQuota(f)),_(`已保存,立即生效`)}catch(e){_(e.message||`保存失败`)}finally{h(!1)}}let b=(n,r,i)=>a=>{let o=Number(a.target.value);Number.isNaN(o)&&(o=r),o=Math.max(r,Math.min(i,o)),t({...e,[n]:o})};async function x(){a(!0),d(``);try{let n=await R.saveCommunityBot(e);t(n),d(`已保存`)}catch(e){d(e?.message||`保存失败`)}finally{a(!1)}}async function C(){l(!0),d(``);try{let{made:e}=await R.genCommunityPosts(o);d(`已生成 ${e} 条并发布到宠友圈`)}catch(e){d(e?.message||`生成失败`)}finally{l(!1)}}return(0,H.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,H.jsxs)(`div`,{className:`mb-4`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`社区运营`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`AI 以虚拟宠友账号自动生成养宠动态丰富社区,每条都会带「AI」标签,可在「帖子审核」里删除或隐藏。`})]}),u&&(0,H.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-md bg-primary/10 px-3 py-2 text-sm text-primary`,children:[(0,H.jsx)(Xo,{className:`h-4 w-4`}),` `,u]}),n?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`加载中…`}):(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-5 pb-5 space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,H.jsx)(os,{className:`h-4 w-4 text-primary`}),` 每日自动生成`]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`自动生成`}),(0,H.jsxs)(`select`,{className:`flex h-9 w-full rounded-md border border-input bg-card px-3 text-sm`,value:e.enabled?`1`:`0`,onChange:n=>t({...e,enabled:n.target.value===`1`}),children:[(0,H.jsx)(`option`,{value:`1`,children:`开启`}),(0,H.jsx)(`option`,{value:`0`,children:`关闭`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`每天条数`}),(0,H.jsx)(W,{type:`number`,value:e.daily_count,onChange:b(`daily_count`,0,50)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`投放起始时段(点)`}),(0,H.jsx)(W,{type:`number`,value:e.start_hour,onChange:b(`start_hour`,0,23)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`投放结束时段(点)`}),(0,H.jsx)(W,{type:`number`,value:e.end_hour,onChange:b(`end_hour`,1,24)})]})]}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`当前设置:`,e.enabled?`开启`:`关闭`,`,每天 `,e.daily_count,` 条, 在 `,e.start_hour,`:00 – `,e.end_hour,`:00 之间随机时间发布。`]}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(U,{onClick:x,disabled:i,children:[(0,H.jsx)(as,{className:`h-4 w-4`}),` `,i?`保存中…`:`保存设置`]})})]})}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-5 pb-5 space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,H.jsx)(ls,{className:`h-4 w-4 text-primary`}),` 立即生成一批`]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`社区太空时可一次性铺一批。会立刻调用 AI 生成并发布,最多 30 条。`}),(0,H.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`条数`}),(0,H.jsx)(W,{type:`number`,className:`w-28`,value:o,onChange:e=>s(Math.max(1,Math.min(30,Number(e.target.value)||1)))})]}),(0,H.jsxs)(U,{variant:`outline`,onClick:C,disabled:c,children:[(0,H.jsx)(ls,{className:`h-4 w-4`}),` `,c?`生成中…`:`立即生成 ${o} 条`]})]})]})})]}),(0,H.jsx)(ml,{className:`mt-4`,children:(0,H.jsxs)(_l,{className:`pt-6 space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(os,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`font-medium`,children:`AI 每日次数上限`})]}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground flex gap-2`,children:[(0,H.jsx)(Xo,{className:`h-4 w-4 shrink-0 mt-0.5`}),(0,H.jsx)(`span`,{children:`按「每个用户 / 每个自然日」计,改完立即生效。填 0 表示该功能不限次。 总开关关掉则全部不限——AI 调用是真金白银,关之前想清楚。`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{id:`q-enabled`,type:`checkbox`,checked:f.enabled,onChange:e=>p({...f,enabled:e.target.checked})}),(0,H.jsx)(G,{htmlFor:`q-enabled`,children:`启用次数限制`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 max-w-lg`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`问问 AI`}),(0,H.jsx)(W,{type:`number`,value:f.daily_chat,onChange:v(`daily_chat`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`异常评估`}),(0,H.jsx)(W,{type:`number`,value:f.daily_symptom,onChange:v(`daily_symptom`)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(G,{children:`AI 生成计划`}),(0,H.jsx)(W,{type:`number`,value:f.daily_plan,onChange:v(`daily_plan`)})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsxs)(U,{onClick:y,disabled:m,children:[(0,H.jsx)(as,{className:`h-4 w-4`}),` `,m?`保存中…`:`保存额度`]}),g&&(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:g})]})]})})]})}function Xf(){let{page:e,setPage:t,data:n,totalPages:r,reload:i}=bl(R.feedback);async function a(e){await R.setFeedbackHandled(e.id,!e.handled),i()}return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-6`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold`,children:`意见反馈`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`来自小程序「我的 → 意见反馈」的用户留言。`})]}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`时间`}),(0,H.jsx)(K,{children:`用户`}),(0,H.jsx)(K,{children:`内容`}),(0,H.jsx)(K,{children:`联系方式`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{className:`text-right`,children:`操作`})]})}),(0,H.jsxs)(Cl,{children:[n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{className:`whitespace-nowrap text-muted-foreground`,children:String(e.created_at).slice(0,16).replace(`T`,` `)}),(0,H.jsx)(q,{children:e.nickname||`—`}),(0,H.jsx)(q,{className:`max-w-md whitespace-pre-wrap`,children:e.content}),(0,H.jsx)(q,{children:e.contact||`—`}),(0,H.jsx)(q,{children:e.handled?(0,H.jsx)(El,{variant:`success`,children:`已处理`}):(0,H.jsx)(El,{variant:`muted`,children:`待处理`})}),(0,H.jsx)(q,{className:`text-right`,children:(0,H.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>a(e),children:e.handled?`标为待处理`:`标为已处理`})})]},e.id)),!n?.list?.length&&(0,H.jsx)(wl,{children:(0,H.jsx)(q,{colSpan:6,className:`text-center text-muted-foreground py-8`,children:`还没有反馈`})})]})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})})]})}function Zf(){let{page:e,setPage:t,data:n,totalPages:r}=bl(R.memberships);return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-2xl font-bold mb-6`,children:`会员管理`}),(0,H.jsx)(ml,{children:(0,H.jsxs)(_l,{className:`pt-6`,children:[(0,H.jsxs)(xl,{children:[(0,H.jsx)(Sl,{children:(0,H.jsxs)(wl,{children:[(0,H.jsx)(K,{children:`ID`}),(0,H.jsx)(K,{children:`用户ID`}),(0,H.jsx)(K,{children:`状态`}),(0,H.jsx)(K,{children:`类型`}),(0,H.jsx)(K,{children:`价格`}),(0,H.jsx)(K,{children:`到期`})]})}),(0,H.jsx)(Cl,{children:n?.list?.map(e=>(0,H.jsxs)(wl,{children:[(0,H.jsx)(q,{children:e.id}),(0,H.jsx)(q,{children:e.user_id}),(0,H.jsx)(q,{children:e.status===`active`?(0,H.jsx)(El,{variant:`success`,children:`生效中`}):(0,H.jsx)(El,{variant:`muted`,children:e.status})}),(0,H.jsx)(q,{children:e.plan_type||`—`}),(0,H.jsxs)(q,{children:[`¥`,e.price]}),(0,H.jsx)(q,{children:e.end_date?String(e.end_date).slice(0,10):`—`})]},e.id))})]}),(0,H.jsx)(Dl,{page:e,totalPages:r,total:n?.total??0,onChange:t})]})})]})}function Qf({children:e}){return To()?e:(0,H.jsx)(Ht,{to:`/login`,replace:!0})}function $f(){return(0,H.jsxs)(Kt,{children:[(0,H.jsx)(Wt,{path:`/login`,element:(0,H.jsx)(vl,{})}),(0,H.jsxs)(Wt,{path:`/`,element:(0,H.jsx)(Qf,{children:(0,H.jsx)(sl,{})}),children:[(0,H.jsx)(Wt,{index:!0,element:(0,H.jsx)(yl,{})}),(0,H.jsx)(Wt,{path:`users`,element:(0,H.jsx)(Ol,{})}),(0,H.jsx)(Wt,{path:`pets`,element:(0,H.jsx)(kl,{})}),(0,H.jsx)(Wt,{path:`posts`,element:(0,H.jsx)(Ml,{})}),(0,H.jsx)(Wt,{path:`comments`,element:(0,H.jsx)(Nl,{})}),(0,H.jsx)(Wt,{path:`articles`,element:(0,H.jsx)(Af,{})}),(0,H.jsx)(Wt,{path:`care-templates`,element:(0,H.jsx)(Vf,{})}),(0,H.jsx)(Wt,{path:`record-types`,element:(0,H.jsx)(Gf,{})}),(0,H.jsx)(Wt,{path:`breeds`,element:(0,H.jsx)(Jf,{})}),(0,H.jsx)(Wt,{path:`community-bot`,element:(0,H.jsx)(Yf,{})}),(0,H.jsx)(Wt,{path:`feedback`,element:(0,H.jsx)(Xf,{})}),(0,H.jsx)(Wt,{path:`members`,element:(0,H.jsx)(Zf,{})})]}),(0,H.jsx)(Wt,{path:`*`,element:(0,H.jsx)(Ht,{to:`/`,replace:!0})})]})}(0,er.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(S.StrictMode,{children:(0,H.jsx)(Pn,{basename:`/admin`,children:(0,H.jsx)($f,{})})})); \ No newline at end of file diff --git a/pets-be/internal/admin/dist/assets/index-PPcOOdtF.css b/pets-be/internal/admin/dist/assets/index-PPcOOdtF.css new file mode 100644 index 0000000..a86afcc --- /dev/null +++ b/pets-be/internal/admin/dist/assets/index-PPcOOdtF.css @@ -0,0 +1 @@ +*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background:40 33% 98%;--foreground:24 10% 15%;--card:0 0% 100%;--card-foreground:24 10% 15%;--primary:33 90% 62%;--primary-foreground:0 0% 100%;--secondary:40 30% 94%;--secondary-foreground:24 10% 25%;--muted:40 20% 94%;--muted-foreground:25 8% 45%;--accent:40 40% 92%;--accent-foreground:24 10% 20%;--destructive:5 78% 57%;--destructive-foreground:0 0% 100%;--border:33 25% 88%;--input:33 25% 88%;--ring:33 90% 62%;--radius:.6rem}*{border-color:hsl(var(--border))}body{background:hsl(var(--background));color:hsl(var(--foreground));margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-1\/2{left:50%}.right-4{right:1rem}.top-1\/2{top:50%}.top-4{top:1rem}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-1{margin-right:.25rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-4{margin-top:1rem}.mt-auto{margin-top:auto}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.max-h-\[88vh\]{max-height:88vh}.min-h-24{min-height:6rem}.min-h-\[120px\]{min-height:120px}.min-h-screen{min-height:100vh}.w-16{width:4rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-56{width:14rem}.w-7{width:1.75rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-40{min-width:10rem}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.-translate-x-1\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.self-center{align-self:center}.overflow-auto{overflow:auto}.overflow-y-auto{overflow-y:auto}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-r{border-right-width:1px}.border-input{border-color:hsl(var(--input))}.border-transparent{border-color:#0000}.bg-black\/40{background-color:#0006}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/15{background-color:hsl(var(--destructive) / .15)}.bg-emerald-100{--tw-bg-opacity:1;background-color:rgb(209 250 229/var(--tw-bg-opacity,1))}.bg-muted{background-color:hsl(var(--muted))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-secondary{background-color:hsl(var(--secondary))}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-5{padding-bottom:1.25rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.text-card-foreground{color:hsl(var(--card-foreground))}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-emerald-700{--tw-text-opacity:1;color:rgb(4 120 87/var(--tw-text-opacity,1))}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.underline-offset-4{text-underline-offset:4px}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a;--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=1024px){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} diff --git a/pets-be/internal/admin/dist/index.html b/pets-be/internal/admin/dist/index.html index 960f663..cc27d14 100644 --- a/pets-be/internal/admin/dist/index.html +++ b/pets-be/internal/admin/dist/index.html @@ -5,8 +5,8 @@ admin - - + +
diff --git a/pets-be/internal/handler/admin.go b/pets-be/internal/handler/admin.go index 33686e7..93b1a6d 100644 --- a/pets-be/internal/handler/admin.go +++ b/pets-be/internal/handler/admin.go @@ -377,43 +377,71 @@ func (h *Handler) AdminCareTemplateMeta(c *gin.Context) { {"key": model.SpeciesCat, "label": "猫猫"}, {"key": model.SpeciesDog, "label": "狗狗"}, }, - "stages": service.CareStages, - "task_sheets": []string{"", "weight", "poop", "food", "symptom", "vaccine", "medicine"}, - "plan_sheets": []string{"", "weight", "vaccine", "medicine", "report", "taskDetail"}, + "stages": service.CareStages, + // 「关联记录事项」的可选值读 record_types 表,不再写死。 + // 原来是两个硬编码数组(task_sheets / plan_sheets),里头还有 + // report / taskDetail 这种早就不存在的值 —— 选了等于点了没反应; + // 而后台新加的 24 种事项一个都选不到 + "record_types": h.svc.AdminListRecordTypes(), + "repeats": []string{"once", "daily", "weekly", "monthly"}, "reminder_types": []string{"vaccine", "deworm", "weight", "monthlyReport"}, "priorities": []string{"", "重要"}, }) } -// AdminGetCareTemplate GET /api/admin/care-templates?species=&stage= +// AdminListCareTemplates GET /api/admin/care-templates 全部方案 +func (h *Handler) AdminListCareTemplates(c *gin.Context) { + response.OK(c, h.svc.AdminListTemplates()) +} + +// AdminGetCareTemplate GET /api/admin/care-templates/:id 一套方案 func (h *Handler) AdminGetCareTemplate(c *gin.Context) { - data, err := h.svc.GetCareTemplate(c.Query("species"), c.Query("stage")) + tpl, err := h.svc.AdminGetTemplate(idParam(c, "id")) if err != nil { - response.FailParams(c, err.Error()) + respondErr(c, err) return } - response.OK(c, data) + response.OK(c, tpl) } type careTemplateReq struct { + ID string `json:"id"` Species string `json:"species"` Stage string `json:"stage"` + Name string `json:"name"` + Summary string `json:"summary"` + Sort int `json:"sort"` + Enabled bool `json:"enabled"` Items []model.CareTemplateItem `json:"items"` } -// AdminSaveCareTemplate PUT /api/admin/care-templates +// AdminSaveCareTemplate POST /api/admin/care-templates 新增或更新一套 func (h *Handler) AdminSaveCareTemplate(c *gin.Context) { var req careTemplateReq if err := c.ShouldBindJSON(&req); err != nil { response.FailParams(c, err.Error()) return } - if err := h.svc.SaveCareTemplate(req.Species, req.Stage, req.Items); err != nil { - response.FailErr(c, err) + tpl := &model.CareTemplate{ + Species: req.Species, Stage: req.Stage, Name: req.Name, + Summary: req.Summary, Sort: req.Sort, Enabled: req.Enabled, + } + tpl.ID = req.ID + if err := h.svc.SaveTemplate(tpl, req.Items); err != nil { + respondErr(c, err) return } - data, _ := h.svc.GetCareTemplate(req.Species, req.Stage) - response.OK(c, data) + saved, _ := h.svc.AdminGetTemplate(tpl.ID) + response.OK(c, saved) +} + +// AdminDeleteCareTemplate DELETE /api/admin/care-templates/:id +func (h *Handler) AdminDeleteCareTemplate(c *gin.Context) { + if err := h.svc.DeleteTemplate(idParam(c, "id")); err != nil { + respondErr(c, err) + return + } + response.OK(c, nil) } type careGenReq struct { diff --git a/pets-be/internal/router/router.go b/pets-be/internal/router/router.go index 6275783..79c695e 100644 --- a/pets-be/internal/router/router.go +++ b/pets-be/internal/router/router.go @@ -163,8 +163,10 @@ func registerAdminAPI(api *gin.RouterGroup, h *handler.Handler, jm *appjwt.Manag g.DELETE("/record-types/:id", h.AdminDeleteRecordType) g.GET("/care-templates/meta", h.AdminCareTemplateMeta) - g.GET("/care-templates", h.AdminGetCareTemplate) - g.PUT("/care-templates", h.AdminSaveCareTemplate) + g.GET("/care-templates", h.AdminListCareTemplates) + g.GET("/care-templates/:id", h.AdminGetCareTemplate) + g.POST("/care-templates", h.AdminSaveCareTemplate) + g.DELETE("/care-templates/:id", h.AdminDeleteCareTemplate) g.POST("/care-templates/generate", h.AdminGenerateCareTemplate) g.GET("/ai-quota", h.AdminGetAIQuota) diff --git a/pets-be/internal/service/care_template.go b/pets-be/internal/service/care_template.go index 7e8d8a1..0200276 100644 --- a/pets-be/internal/service/care_template.go +++ b/pets-be/internal/service/care_template.go @@ -106,51 +106,99 @@ func (s *Service) careTemplateItems(species, stage string) []model.CareTemplateI } // GetCareTemplate 后台读取:返回某组合的明细(DB 优先,无则内置默认) -func (s *Service) GetCareTemplate(species, stage string) (map[string]any, error) { - if !validSpecies(species) || !validStage(stage) { - return nil, errors.New("invalid species or stage") +// AdminListTemplates 后台:全部方案(含停用),按物种阶段排 +func (s *Service) AdminListTemplates() []model.CareTemplate { + var all []model.CareTemplate + s.db.Preload("Items", func(db *gorm.DB) *gorm.DB { return db.Order("kind, sort, id") }). + Order("species asc, stage asc, sort asc, id asc").Find(&all) + if all == nil { + return []model.CareTemplate{} } - return map[string]any{ - "species": species, - "stage": stage, - "items": s.careTemplateItems(species, stage), - }, nil + return all +} + +// AdminGetTemplate 后台:取一套 +func (s *Service) AdminGetTemplate(id string) (*model.CareTemplate, error) { + var tpl model.CareTemplate + if err := s.db.Preload("Items", func(db *gorm.DB) *gorm.DB { return db.Order("kind, sort, id") }). + First(&tpl, "id = ?", id).Error; err != nil { + return nil, ErrNotFound + } + return &tpl, nil +} + +// DeleteTemplate 删一套方案。已经套用出去的计划节点不受影响—— +// 套用时就已经展开成实体行、和模板断开了 +func (s *Service) DeleteTemplate(id string) error { + return s.db.Transaction(func(tx *gorm.DB) error { + if err := tx.Where("template_id = ?", id).Delete(&model.CareTemplateItem{}).Error; err != nil { + return err + } + return tx.Delete(&model.CareTemplate{}, "id = ?", id).Error + }) } // SaveCareTemplate 后台保存:整表替换该组合的明细 -func (s *Service) SaveCareTemplate(species, stage string, items []model.CareTemplateItem) error { - if !validSpecies(species) || !validStage(stage) { - return errors.New("invalid species or stage") +// SaveTemplate 存一套方案。id 为空则新建 —— 同一个 (物种, 阶段) 可以有多套, +// 用户建档时挑一套。原来是「按 species+stage 覆盖」,那个模型下 +// 「让用户选方案」根本无从选起 +func (s *Service) SaveTemplate(in *model.CareTemplate, items []model.CareTemplateItem) error { + if !validSpecies(in.Species) || !validStage(in.Stage) { + return errors.New("物种或阶段不合法") } + if strings.TrimSpace(in.Name) == "" { + return errors.New("方案要有名字 —— 用户建档时看到的就是它") + } + // 明细先校验一遍再落库:一条配错(比如「每周」没勾星期几)会让套用时 + // 静默少排几条,用户看不出来是配错了 + clean := make([]model.CareTemplateItem, 0, len(items)) + for i := range items { + it := items[i] + it.Title = strings.TrimSpace(it.Title) + if it.Title == "" { + continue + } + if it.Kind != model.CareKindReminder { + it.Kind = model.CareKindPlan + switch it.Repeat { + case model.RepeatDaily, model.RepeatMonthly: + case model.RepeatWeekly: + if len(weekdaysOf(it.Weekdays)) == 0 { + return errors.New("「" + it.Title + "」选了每周,但没勾星期几") + } + default: + it.Repeat = model.RepeatOnce + } + if it.Repeat == model.RepeatMonthly && (it.MonthDay < 1 || it.MonthDay > 31) { + return errors.New("「" + it.Title + "」选了每月,几号要填 1-31") + } + } + it.ID = "" + it.Sort = i + clean = append(clean, it) + } + return s.db.Transaction(func(tx *gorm.DB) error { - var tpl model.CareTemplate - err := tx.Where("species = ? AND stage = ?", species, stage).First(&tpl).Error - if errors.Is(err, gorm.ErrRecordNotFound) { - tpl = model.CareTemplate{Species: species, Stage: stage} - if err := tx.Create(&tpl).Error; err != nil { + if in.ID == "" { + if err := tx.Create(in).Error; err != nil { return err } - } else if err != nil { - return err - } - if err := tx.Where("template_id = ?", tpl.ID).Delete(&model.CareTemplateItem{}).Error; err != nil { - return err - } - clean := make([]model.CareTemplateItem, 0, len(items)) - for i := range items { - it := items[i] - if strings.TrimSpace(it.Title) == "" { - continue + } else { + if err := tx.Model(&model.CareTemplate{}).Where("id = ?", in.ID).Updates(map[string]any{ + "species": in.Species, "stage": in.Stage, "name": in.Name, + "summary": in.Summary, "sort": in.Sort, "enabled": in.Enabled, + }).Error; err != nil { + return err } - it.ID = "" - it.TemplateID = tpl.ID - it.Sort = i - clean = append(clean, it) + if err := tx.Where("template_id = ?", in.ID).Delete(&model.CareTemplateItem{}).Error; err != nil { + return err + } + } + for i := range clean { + clean[i].TemplateID = in.ID } if len(clean) > 0 { - if err := tx.Create(&clean).Error; err != nil { - return err - } + return tx.Create(&clean).Error } return nil }) diff --git a/pets-be/web/admin/src/lib/api.ts b/pets-be/web/admin/src/lib/api.ts index 9ed98de..5027bca 100644 --- a/pets-be/web/admin/src/lib/api.ts +++ b/pets-be/web/admin/src/lib/api.ts @@ -121,12 +121,11 @@ export const api = { memberships: (params: any) => http.get>('/admin/memberships', { params }), careTemplateMeta: () => http.get('/admin/care-templates/meta'), - careTemplate: (species: string, stage: string) => - http.get('/admin/care-templates', { - params: { species, stage }, - }), - saveCareTemplate: (species: string, stage: string, items: any[]) => - http.put('/admin/care-templates', { species, stage, items }), + // 方案改成「同一个物种阶段可以多套」,所以按 id 存取,不再按 species+stage 覆盖 + careTemplates: () => http.get('/admin/care-templates'), + careTemplate: (id: string) => http.get(`/admin/care-templates/${id}`), + saveCareTemplate: (t: any) => http.post('/admin/care-templates', t), + deleteCareTemplate: (id: string) => http.delete(`/admin/care-templates/${id}`), genCareTemplate: (species: string, stage: string) => http.post('/admin/care-templates/generate', { species, diff --git a/pets-be/web/admin/src/pages/CareTemplates.tsx b/pets-be/web/admin/src/pages/CareTemplates.tsx index 477a5d4..e527332 100644 --- a/pets-be/web/admin/src/pages/CareTemplates.tsx +++ b/pets-be/web/admin/src/pages/CareTemplates.tsx @@ -1,285 +1,486 @@ -import { useEffect, useMemo, useRef, useState } from 'react' -import { Cat, Dog, Wand2, Plus, Trash2, Save, Info } from 'lucide-react' +import { useEffect, useState } from 'react' +import { Cat, Dog, Plus, Trash2, Wand2, Info } from 'lucide-react' import { api } from '@/lib/api' -import { cn } from '@/lib/utils' import { Button } from '@/components/ui/button' import { Card, CardContent } from '@/components/ui/card' import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' +import { Badge } from '@/components/ui/badge' +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table' +import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog' const SPECIES = [ { key: 'cat', label: '猫猫', Icon: Cat }, { key: 'dog', label: '狗狗', Icon: Dog }, ] const STAGES = ['刚到家 0-30 天', '幼年期', '成年期', '老年期'] - -const SHEET_LABEL: Record = { - '': '无', weight: '体重', poop: '便便', food: '饮食', symptom: '异常', - vaccine: '疫苗', medicine: '用药', report: '报告', taskDetail: '任务详情', -} const REMINDER_LABEL: Record = { vaccine: '疫苗', deworm: '驱虫', weight: '体重', monthlyReport: '月报', } -const TASK_SHEETS = ['', 'weight', 'poop', 'food', 'symptom', 'vaccine', 'medicine'] -const PLAN_SHEETS = ['', 'weight', 'vaccine', 'medicine', 'report', 'taskDetail'] const REMINDER_TYPES = ['vaccine', 'deworm', 'weight', 'monthlyReport'] - -const selectCls = - 'h-9 rounded-md border border-input bg-card px-2 text-sm shrink-0' +const REPEATS = [ + { key: 'daily', label: '每天' }, + { key: 'weekly', label: '每周' }, + { key: 'monthly', label: '每月' }, + { key: 'once', label: '一次性' }, +] +const WEEKDAYS = ['一', '二', '三', '四', '五', '六', '日'] +const selectCls = 'h-9 rounded-md border border-input bg-card px-2 text-sm shrink-0' type Item = { _k: number - kind: 'task' | 'plan' | 'reminder' + kind: 'plan' | 'reminder' title: string description: string priority: string sheet_type: string + repeat: string day: number - day_label: string + weekdays: string + month_day: number reminder_type: string offset_days: number frequency: string } +type Tpl = { + id: string + species: string + stage: string + name: string + summary: string + sort: number + enabled: boolean + items?: any[] +} let uid = 1 -function normalize(raw: any[]): Item[] { - return (raw || []).map((r) => ({ +function toItem(r: any): Item { + return { _k: uid++, - kind: r.kind, + kind: r.kind === 'reminder' ? 'reminder' : 'plan', title: r.title || '', description: r.description || '', priority: r.priority || '', sheet_type: r.sheet_type || '', + repeat: r.repeat || 'once', day: r.day ?? 0, - day_label: r.day_label || '', + weekdays: r.weekdays || '', + month_day: r.month_day ?? 1, reminder_type: r.reminder_type || 'vaccine', offset_days: r.offset_days ?? 0, frequency: r.frequency || '', - })) + } } function blank(kind: Item['kind']): Item { - return { - _k: uid++, kind, title: '', description: '', priority: '', sheet_type: '', - day: 0, day_label: '', reminder_type: 'vaccine', offset_days: 0, frequency: '', - } + return toItem({ kind, repeat: kind === 'plan' ? 'daily' : '' }) } export default function CareTemplates() { - const [species, setSpecies] = useState('cat') - const [stage, setStage] = useState('成年期') + const [list, setList] = useState([]) + const [types, setTypes] = useState([]) + const [open, setOpen] = useState(false) + const [tpl, setTpl] = useState({ + id: '', species: 'cat', stage: '成年期', name: '', summary: '', sort: 0, enabled: true, + }) const [items, setItems] = useState([]) - const [loading, setLoading] = useState(false) + const [err, setErr] = useState('') const [saving, setSaving] = useState(false) const [gen, setGen] = useState(false) - const [dirty, setDirty] = useState(false) - const [msg, setMsg] = useState('') - const reqId = useRef(0) - async function load(sp: string, st: string) { - const my = ++reqId.current - setLoading(true) - setMsg('') + function reload() { + api.careTemplates().then((r) => setList(r || [])).catch(() => setList([])) + } + useEffect(() => { + reload() + // 「关联记录事项」的可选值来自 record_types,不再是写死的几个。 + // 原来那两个硬编码数组里还有 report / taskDetail 这种早就不存在的值 + api.careTemplateMeta().then((m: any) => setTypes(m?.record_types || [])).catch(() => {}) + }, []) + + function create() { + setTpl({ id: '', species: 'cat', stage: '成年期', name: '', summary: '', sort: 0, enabled: true }) + setItems([]) + setErr('') + setOpen(true) + } + async function edit(t: Tpl) { + setErr('') + const full = await api.careTemplate(t.id) + setTpl({ ...t }) + setItems(((full as any)?.items || []).map(toItem)) + setOpen(true) + } + async function save() { + setErr('') + setSaving(true) try { - const data = await api.careTemplate(sp, st) - if (my === reqId.current) { - setItems(normalize(data.items)) - setDirty(false) - } + await api.saveCareTemplate({ ...tpl, items }) + setOpen(false) + reload() + } catch (e: any) { + // 后端会指名道姓说哪条配错了(「XX 选了每周,但没勾星期几」) + setErr(e?.message || '保存失败') } finally { - if (my === reqId.current) setLoading(false) + setSaving(false) } } - - useEffect(() => { - load(species, stage) - }, [species, stage]) - - function update(k: number, key: keyof Item, value: any) { - setItems((prev) => prev.map((it) => (it._k === k ? { ...it, [key]: value } : it))) - setDirty(true) + async function del(t: Tpl) { + if (!confirm(`删除方案「${t.name || t.stage}」?已经套用出去的计划不受影响。`)) return + await api.deleteCareTemplate(t.id).catch((e: any) => alert(e?.message || '删除失败')) + reload() } - function remove(k: number) { - setItems((prev) => prev.filter((it) => it._k !== k)) - setDirty(true) - } - function add(kind: Item['kind']) { - setItems((prev) => [...prev, blank(kind)]) - setDirty(true) - } - - async function generate() { + async function draft() { setGen(true) - setMsg('') try { - const data = await api.genCareTemplate(species, stage) - setItems(normalize(data.items)) - setDirty(true) - setMsg('已生成草稿,确认无误后点「保存该模板」') + const r: any = await api.genCareTemplate(tpl.species, tpl.stage) + setItems((r?.items || []).map(toItem)) } catch (e: any) { - setMsg(e?.message || 'AI 生成失败') + setErr(e?.message || 'AI 生成失败') } finally { setGen(false) } } - async function save() { - setSaving(true) - setMsg('') - try { - await api.saveCareTemplate(species, stage, items) - setDirty(false) - setMsg('已保存') - } catch (e: any) { - setMsg(e?.message || '保存失败') - } finally { - setSaving(false) - } + const upd = (k: number, field: string, v: any) => + setItems((prev) => prev.map((it) => (it._k === k ? { ...it, [field]: v } : it))) + const rm = (k: number) => setItems((prev) => prev.filter((it) => it._k !== k)) + function toggleWd(it: Item, idx: number) { + const n = String(idx + 1) + const cur = it.weekdays.split(',').filter(Boolean) + const next = cur.includes(n) ? cur.filter((x) => x !== n) : [...cur, n].sort() + upd(it._k, 'weekdays', next.join(',')) } - const tasks = useMemo(() => items.filter((i) => i.kind === 'task'), [items]) - const plans = useMemo(() => items.filter((i) => i.kind === 'plan'), [items]) - const reminders = useMemo(() => items.filter((i) => i.kind === 'reminder'), [items]) + const plans = items.filter((i) => i.kind === 'plan') + const reminders = items.filter((i) => i.kind === 'reminder') + + // 列表里展示「这套方案套一个月大概会排多少条」——只报明细条数会骗人: + // 4 条「每天」套一整月就是 120 多条 + function spread(t: Tpl) { + const its = t.items || [] + const c = { daily: 0, weekly: 0, monthly: 0, once: 0, rem: 0 } + its.forEach((i: any) => { + if (i.kind === 'reminder') c.rem++ + else if (i.repeat === 'daily') c.daily++ + else if (i.repeat === 'weekly') c.weekly++ + else if (i.repeat === 'monthly') c.monthly++ + else c.once++ + }) + return c + } return (
-
+
-

养护模板

-

- 建档时按宠物的物种和阶段套用;改动只影响之后建档 / 重新建档的宠物。 +

养护方案

+

+ 用户建档最后一步从这里挑一套,也可以选「先空着自己排」。同一个物种阶段可以配多套。

-
- - -
+
-
- {SPECIES.map((s) => ( - - ))} -
-
- {STAGES.map((st) => ( - - ))} -
+ + + + + + 物种/阶段 + 方案名 + 内容 + 状态 + 操作 + + + + {list.map((t) => { + const c = spread(t) + return ( + + + {t.species === 'dog' ? '狗' : '猫'} · {t.stage} + + +
{t.name || '(未命名)'}
+
{t.summary}
+
+ + 每天 {c.daily} · 每周 {c.weekly} · 每月 {c.monthly} · 一次性 {c.once} · 提醒 {c.rem} + + + {t.enabled ? 启用 : 停用} + + + + + +
+ ) + })} + {!list.length && ( + + + 还没有方案 —— 用户建档后计划页会是空的,只能自己排 + + + )} +
+
+
+
- {msg && ( -
- {msg} -
- )} + + + + {tpl.id ? '编辑方案' : '新建方案'} + - {loading ? ( -

加载中…

- ) : ( -
-
add('task')}> - {tasks.map((it) => ( -
- update(it._k, 'title', e.target.value)} /> - update(it._k, 'description', e.target.value)} /> - - - remove(it._k)} /> -
- ))} -
- -
add('plan')}> - {plans.map((it) => ( -
- update(it._k, 'day', Number(e.target.value))} /> - update(it._k, 'day_label', e.target.value)} /> - update(it._k, 'title', e.target.value)} /> - update(it._k, 'description', e.target.value)} /> - - remove(it._k)} /> -
- ))} -
- -
add('reminder')}> - {reminders.map((it) => ( -
- - update(it._k, 'title', e.target.value)} /> -
- 到期+ - update(it._k, 'offset_days', Number(e.target.value))} /> - +
+
+
+ +
+ {SPECIES.map((s) => ( + + ))}
- update(it._k, 'frequency', e.target.value)} /> - remove(it._k)} />
- ))} -
+
+ + +
+
+
+ + setTpl({ ...tpl, name: e.target.value })} + placeholder="幼猫标准照护" + /> +
+
+ + setTpl({ ...tpl, summary: e.target.value })} + placeholder="每天清砂盆和喂食,每周称体重,含疫苗驱虫提醒" + /> +
+
+ setTpl({ ...tpl, enabled: e.target.checked })} + /> + +
-

- 模板留空时建档会回退内置默认,不会让新宠没有任务。 -

-
- )} + {/* ── 计划事项 ── */} +
+
+
计划事项({plans.length})
+
+ + +
+
+
+ + + 「关联记录事项」= 用户在小程序点这条计划时,直接跳到哪个记录表单。 + 比如「记录一次体重」关联体重,点了就是体重表单,不用自己去记录页找。 + 这个下拉读的是记录事项那一页的配置。 + +
+
+ {plans.map((it) => ( +
+ upd(it._k, 'title', e.target.value)} + /> + upd(it._k, 'description', e.target.value)} + /> + + {it.repeat === 'weekly' && ( +
+ {WEEKDAYS.map((w, i) => ( + + ))} +
+ )} + {it.repeat === 'monthly' && ( + upd(it._k, 'month_day', Number(e.target.value) || 1)} + /> + )} + {it.repeat === 'once' && ( + upd(it._k, 'day', Number(e.target.value) || 0)} + /> + )} + + + +
+ ))} + {!plans.length && ( +

还没有计划事项

+ )} +
+
+ + {/* ── 提醒 ── */} +
+
+
到期提醒({reminders.length})
+ +
+

+ 提醒不占计划页的格子,只在到期时冒出来。疫苗和驱虫这两类建档时就会自动建 + (漏针是真会出事的),不用等用户挑方案。 +

+
+ {reminders.map((it) => ( +
+ + upd(it._k, 'title', e.target.value)} + /> + upd(it._k, 'offset_days', Number(e.target.value) || 0)} + /> + upd(it._k, 'frequency', e.target.value)} + /> + +
+ ))} + {!reminders.length && ( +

还没有提醒

+ )} +
+
+ + {err &&

{err}

} + +
+ + ) } - -function Section({ title, count, onAdd, children }: { title: string; count: number; onAdd: () => void; children: React.ReactNode }) { - return ( - - -
-
- {title} {count} -
- -
-
- {count === 0 ?

暂无,点「添加」新增一条。

: children} -
-
-
- ) -} - -function DelBtn({ onClick }: { onClick: () => void }) { - return ( - - ) -}