2 lines
22 KiB
JavaScript
2 lines
22 KiB
JavaScript
import{j as e,r as h,i as ne}from"./router-zNjPR4CY.js";import{u as M,L as x,I as _,B as A,x as j,y as k,p as P,z as N,E as oe,F as de,G as ce,H as me,J as pe,g as T,K as G,C as ue,f as fe,S as xe,A as he,m as ge,n as ve,o as ye,q as _e,r as be,s as je,t as Pe,v as Ne}from"./index-CuOHsLf7.js";import{P as we}from"./progress-C6-hh8fF.js";import{S as Se,a as ke,b as Ce,c as qe,d as Ae}from"./select-DGqIoF9r.js";import{S as W}from"./switch-Kc2EZ0Ga.js";import{T as J}from"./textarea-8PIujbf-.js";import{$ as Fe,a0 as Be,d as Te,a1 as Me,V as De,a2 as Ee,J as Oe,a3 as Re,e as U,a4 as Ie,A as ze}from"./icons-DTcdLw9j.js";import{R as Le,u as Ke,a as Ge}from"./restart-overlay-B44c6hlE.js";import"./misc-BwRzHX8c.js";import"./radix-C-ZuImoP.js";import"./utils-DjBw3JGv.js";import"./system-api-DeeJapvB.js";const We={qq:"qq",telegram:"telegram",tg:"telegram",discord:"discord",kook:"kook"},Je=["qq","telegram","discord","kook","custom"];function S(s){const t=s.trim().toLowerCase();return We[t]||t}function Ue(s){const t=s.platform;return!t&&s.qq_account.trim()?{selected:"qq",customName:""}:t?Je.find(r=>r===t&&r!=="custom")?{selected:t,customName:""}:{selected:"custom",customName:t}:{selected:"",customName:""}}function H(s,t,a){const r=S(t),n=s.filter(d=>{const p=d.split(":")[0];return S(p)!==r});return a.trim()&&n.push(`${r}:${a.trim()}`),n}function He(s,t){const a=S(t),r=s.find(n=>{const d=n.split(":")[0];return S(d)===a});return r?r.split(":").slice(1).join(":"):""}function Qe({config:s,onChange:t}){const{t:a}=M(),r=Ue(s),[n,d]=h.useState(null),[p,l]=h.useState(null),c=n??r.selected,u=p??r.customName,g=c==="qq"?s.qq_account.trim():s.platform?He(s.platforms,s.platform):"",f=[{value:"qq",label:"QQ"},{value:"telegram",label:"Telegram"},{value:"discord",label:"Discord"},{value:"kook",label:"Kook"},{value:"custom",label:a("setupPage.forms.botBasic.platform.options.custom")}],C=o=>{d(o),t({...s,platform:S(o==="custom"?u:o),qq_account:s.qq_account})},F=o=>{l(o);const v=S(o),b=g?H(s.platforms,v,g):s.platforms;t({...s,platform:v,platforms:b})},w=o=>{const b=S(c==="custom"?u:c);t(b==="qq"?{...s,qq_account:o.trim(),platform:"qq"}:{...s,platform:b,platforms:H(s.platforms,b,o)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"platform",children:a("setupPage.forms.botBasic.platform.label")}),e.jsxs(Se,{value:c,onValueChange:C,children:[e.jsx(ke,{id:"platform",children:e.jsx(Ce,{placeholder:a("setupPage.forms.botBasic.platform.placeholder")})}),e.jsx(qe,{children:f.map(o=>e.jsx(Ae,{value:o.value,children:o.label},o.value))})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.botBasic.platform.description")})]}),c==="custom"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"custom_platform_name",children:a("setupPage.forms.botBasic.customPlatform.label")}),e.jsx(_,{id:"custom_platform_name",placeholder:a("setupPage.forms.botBasic.customPlatform.placeholder"),value:u,onChange:o=>F(o.target.value)})]}),c==="qq"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"qq_account",children:a("setupPage.forms.botBasic.qqAccount.label")}),e.jsx(_,{id:"qq_account",type:"number",placeholder:a("setupPage.forms.botBasic.qqAccount.placeholder"),value:g,onChange:o=>w(o.target.value)}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.botBasic.qqAccount.description")})]}),c&&c!=="qq"&&(c!=="custom"||u)&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"primary_account",children:a("setupPage.forms.botBasic.primaryAccount.label")}),e.jsx(_,{id:"primary_account",placeholder:a("setupPage.forms.botBasic.primaryAccount.placeholder"),value:g,onChange:o=>w(o.target.value)}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.botBasic.primaryAccount.description")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"nickname",children:a("setupPage.forms.botBasic.nickname.label")}),e.jsx(_,{id:"nickname",placeholder:a("setupPage.forms.botBasic.nickname.placeholder"),value:s.nickname,onChange:o=>t({...s,nickname:o.target.value})}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.botBasic.nickname.description")})]})]})}function Ve({config:s,onChange:t}){const{t:a}=M();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"personality",children:a("setupPage.forms.personality.personality.label")}),e.jsx(J,{id:"personality",placeholder:a("setupPage.forms.personality.personality.placeholder"),value:s.personality,onChange:r=>t({...s,personality:r.target.value}),rows:3}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.personality.personality.description")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"reply_style",children:a("setupPage.forms.personality.replyStyle.label")}),e.jsx(J,{id:"reply_style",placeholder:a("setupPage.forms.personality.replyStyle.placeholder"),value:s.reply_style,onChange:r=>t({...s,reply_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.personality.replyStyle.description")})]})]})}function $e({config:s,onChange:t}){const{t:a}=M(),[r,n]=h.useState(!1),d=a(r?"setupPage.forms.apiProvider.apiKey.hide":"setupPage.forms.apiProvider.apiKey.show");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"provider_name",children:a("setupPage.forms.apiProvider.providerName.label")}),e.jsx(_,{id:"provider_name",placeholder:a("setupPage.forms.apiProvider.providerName.placeholder"),value:s.provider_name,onChange:p=>t({...s,provider_name:p.target.value})}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.apiProvider.providerName.description")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"base_url",children:a("setupPage.forms.apiProvider.baseUrl.label")}),e.jsx(_,{id:"base_url",placeholder:"https://api.example.com/v1",value:s.base_url,onChange:p=>t({...s,base_url:p.target.value}),className:"font-mono"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.apiProvider.baseUrl.description")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"api_key",children:a("setupPage.forms.apiProvider.apiKey.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(_,{id:"api_key",type:r?"text":"password",placeholder:"sk-...",value:s.api_key,onChange:p=>t({...s,api_key:p.target.value}),className:"pr-10 font-mono"}),e.jsx(A,{type:"button",variant:"ghost",size:"sm",className:"absolute top-0 right-0 h-full px-3 hover:bg-transparent",onClick:()=>n(!r),"aria-label":d,title:d,children:r?e.jsx(Fe,{className:"text-muted-foreground h-4 w-4"}):e.jsx(Be,{className:"text-muted-foreground h-4 w-4"})})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.apiProvider.apiKey.description")})]})]})}function Xe({config:s,onChange:t}){const{t:a}=M();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-4 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"planner_model_identifier",children:a("setupPage.forms.modelSetup.planner.identifier.label")}),e.jsx(_,{id:"planner_model_identifier",placeholder:"gpt-4.1-mini",value:s.planner_model_identifier,onChange:r=>t({...s,planner_model_identifier:r.target.value,planner_model_name:r.target.value}),className:"font-mono"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.modelSetup.planner.identifier.description")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md bg-muted/40 p-3",children:[e.jsx(x,{htmlFor:"planner_visual",className:"text-sm font-medium",children:a("setupPage.forms.modelSetup.planner.visual.label")}),e.jsx(W,{id:"planner_visual",checked:s.planner_visual,onCheckedChange:r=>t({...s,planner_visual:r})})]})]}),e.jsxs("div",{className:"space-y-4 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{htmlFor:"replyer_model_identifier",children:a("setupPage.forms.modelSetup.replyer.identifier.label")}),e.jsx(_,{id:"replyer_model_identifier",placeholder:"gpt-4.1",value:s.replyer_model_identifier,onChange:r=>t({...s,replyer_model_identifier:r.target.value,replyer_model_name:r.target.value}),className:"font-mono"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a("setupPage.forms.modelSetup.replyer.identifier.description")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md bg-muted/40 p-3",children:[e.jsx(x,{htmlFor:"replyer_visual",className:"text-sm font-medium",children:a("setupPage.forms.modelSetup.replyer.visual.label")}),e.jsx(W,{id:"replyer_visual",checked:s.replyer_visual,onCheckedChange:r=>t({...s,replyer_visual:r})})]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 text-sm text-muted-foreground",children:a("setupPage.forms.modelSetup.saveHint")})]})}async function Ye(){const s=await j("/api/webui/config/bot",{method:"GET",headers:k()}),t=await P(s),r=N(t).config.bot||{},n=String(r.qq_account??"").trim();return{platform:r.platform||(n?"qq":""),qq_account:n,platforms:r.platforms||[],nickname:r.nickname||"",alias_names:r.alias_names||[]}}async function Ze(){const s=await j("/api/webui/config/bot",{method:"GET",headers:k()}),t=await P(s),r=N(t).config.personality||{};return{personality:r.personality||"",reply_style:r.reply_style||"",multiple_reply_style:r.multiple_reply_style||[],multiple_probability:r.multiple_probability??.2}}async function E(){const s=await j("/api/webui/config/model",{method:"GET",headers:k()}),t=await P(s);return N(t).config||{}}async function et(){const s=await E(),t=s.models||[],a=s.model_task_config||{},r=a.planner?.model_list?.[0]||"",n=a.replyer?.model_list?.[0]||"",d=t.find(u=>u.name===r),p=t.find(u=>u.name===n),l=d?.api_provider||p?.api_provider||s.api_providers?.[0]?.name||"",c=s.api_providers?.find(u=>u.name===l);return{provider_name:l,base_url:c?.base_url||"",api_key:""}}async function tt(){const s=await E(),t=s.models||[],a=s.model_task_config||{},r=a.planner?.model_list?.[0]||"",n=a.replyer?.model_list?.[0]||"",d=t.find(l=>l.name===r),p=t.find(l=>l.name===n);return{planner_model_name:r,planner_model_identifier:d?.model_identifier||r,planner_visual:!!d?.visual,replyer_model_name:n,replyer_model_identifier:p?.model_identifier||n,replyer_visual:!!p?.visual}}async function st(s){const t=await j("/api/webui/config/bot/section/bot",{method:"POST",headers:k(),body:JSON.stringify(s)}),a=await P(t);return N(a)}async function at(s){const t=await j("/api/webui/config/bot/section/personality",{method:"POST",headers:k(),body:JSON.stringify(s)}),a=await P(t);return N(a)}function Q(s,t,a,r,n){return{price_in:0,cache:!1,cache_price_in:0,price_out:0,force_stream_mode:!1,extra_params:{},...n,visual:r,model_identifier:t,name:s,api_provider:a}}function V(s,t){const a=s.findIndex(r=>r.name===t.name);return a>=0?s.map((r,n)=>n===a?t:r):[...s,t]}async function rt(s){const t=await E(),a=s.provider_name.trim(),r=t.api_providers||[],n=r.findIndex(u=>u.name===a),d={name:a,base_url:s.base_url.trim(),api_key:s.api_key.trim(),client_type:"openai",max_retry:3,timeout:120,retry_interval:5};n>=0?r[n]={...r[n],...d}:r.push(d);const p={...t,api_providers:r},l=await j("/api/webui/config/model",{method:"POST",headers:k(),body:JSON.stringify(p)}),c=await P(l);return N(c)}async function it(s,t){const a=await E(),r=t.trim(),n=s.planner_model_identifier.trim(),d=n,p=s.replyer_model_identifier.trim(),l=p;let c=a.models||[];const u=c.find(v=>v.name===d),g=c.find(v=>v.name===l);c=V(c,Q(d,n,r,s.planner_visual,u)),c=V(c,Q(l,p,r,s.replyer_visual,g));const f=a.model_task_config||{},C={...f,planner:{...f.planner||{},model_list:[d]},replyer:{...f.replyer||{},model_list:[l]},utils:{...f.utils||{},model_list:[d]}},F={...a,models:c,model_task_config:C},w=await j("/api/webui/config/model",{method:"POST",headers:k(),body:JSON.stringify(F)}),o=await P(w);return N(o)}async function $(){const s=await j("/api/webui/setup/complete",{method:"POST"}),t=await P(s);return N(t)}const lt=["zh","en","ja","ko"],X={zh:"中文",en:"English",ja:"日本語",ko:"한국어"};function _t(){return e.jsx(Le,{children:e.jsx(nt,{})})}function nt(){const s=ne(),{t,i18n:a}=M(),{toast:r}=oe(),{triggerRestart:n}=Ke(),d=a.resolvedLanguage||a.language||"zh",p=()=>({personality:t("setupPage.defaults.personality.personality"),reply_style:t("setupPage.defaults.personality.replyStyle"),multiple_reply_style:[t("setupPage.defaults.personality.multipleReplyStyles.plain"),t("setupPage.defaults.personality.multipleReplyStyles.shortText"),t("setupPage.defaults.personality.multipleReplyStyles.shortSymbol"),t("setupPage.defaults.personality.multipleReplyStyles.translation")],multiple_probability:.2}),[l,c]=h.useState(0),[u,g]=h.useState(!1),[f,C]=h.useState(!1),[F,w]=h.useState(!0),[o,v]=h.useState({platform:"",qq_account:"",platforms:[],nickname:"",alias_names:[]}),[b,O]=h.useState(()=>p()),[B,R]=h.useState({provider_name:"",base_url:"",api_key:""}),[D,I]=h.useState({planner_model_name:"",planner_model_identifier:"",planner_visual:!1,replyer_model_name:"",replyer_model_identifier:"",replyer_visual:!1}),y=[{id:"bot-basic",title:t("setupPage.steps.botBasic.title"),description:t("setupPage.steps.botBasic.description"),icon:Te},{id:"personality",title:t("setupPage.steps.personality.title"),description:t("setupPage.steps.personality.description"),icon:Me},{id:"api-provider",title:t("setupPage.steps.apiProvider.title"),description:t("setupPage.steps.apiProvider.description"),icon:De},{id:"model-setup",title:t("setupPage.steps.modelSetup.title"),description:t("setupPage.steps.modelSetup.description"),icon:Ee}],z=(l+1)/y.length*100;h.useEffect(()=>{(async()=>{try{w(!0);const[m,q,ie,le]=await Promise.all([Ye(),Ze(),et(),tt()]);v(m),O(q),R(ie),I(le)}catch(m){r({title:t("setupPage.toast.loadFailedTitle"),description:m instanceof Error?m.message:t("setupPage.toast.loadFailedDescription"),variant:"destructive"})}finally{w(!1)}})()},[t,r]);const L=async()=>{C(!0);try{switch(l){case 0:await st(o);break;case 1:await at(b);break;case 2:await rt(B);break;case 3:await it(D,B.provider_name);break}return r({title:t("setupPage.toast.saveSuccessTitle"),description:t("setupPage.toast.saveSuccessDescription",{step:y[l].title})}),!0}catch(i){return r({title:t("setupPage.toast.saveFailedTitle"),description:i instanceof Error?i.message:t("setupPage.toast.unknownError"),variant:"destructive"}),!1}finally{C(!1)}};function Y(i){if(!i.platform)return t("setupPage.validation.selectPlatform");if(!i.nickname.trim())return t("setupPage.validation.enterNickname");if(i.platform==="qq"){if(!i.qq_account.trim())return t("setupPage.validation.enterQqAccount")}else if(!i.platforms.some(q=>q.startsWith(i.platform+":")&&q.split(":")[1]?.trim()))return t("setupPage.validation.enterAccountId");return null}function Z(i){return i.provider_name.trim()?i.base_url.trim()?i.api_key.trim()?null:t("setupPage.validation.enterApiKey"):t("setupPage.validation.enterBaseUrl"):t("setupPage.validation.enterProviderName")}function K(i){return i.planner_model_identifier.trim()?i.replyer_model_identifier.trim()?B.provider_name.trim()?null:t("setupPage.validation.enterProviderName"):t("setupPage.validation.enterReplyerModelIdentifier"):t("setupPage.validation.enterPlannerModelIdentifier")}const ee=async()=>{if(l===0){const m=Y(o);if(m){r({title:t("setupPage.toast.validationFailedTitle"),description:m,variant:"destructive"});return}}if(l===2){const m=Z(B);if(m){r({title:t("setupPage.toast.validationFailedTitle"),description:m,variant:"destructive"});return}}if(l===3){const m=K(D);if(m){r({title:t("setupPage.toast.validationFailedTitle"),description:m,variant:"destructive"});return}}await L()&&l<y.length-1&&c(l+1)},te=()=>{l>0&&c(l-1)},se=async()=>{g(!0);try{const i=K(D);if(i){r({title:t("setupPage.toast.validationFailedTitle"),description:i,variant:"destructive"}),g(!1);return}if(!await L()){g(!1);return}await $(),r({title:t("setupPage.toast.completeSuccessTitle"),description:t("setupPage.toast.completeSuccessDescription",{appName:G})}),await n()}catch(i){r({title:t("setupPage.toast.completeFailedTitle"),description:i instanceof Error?i.message:t("setupPage.toast.unknownError"),variant:"destructive"})}finally{g(!1)}},ae=async()=>{try{await $(),s({to:"/"})}catch(i){r({title:t("setupPage.toast.skipFailedTitle"),description:i instanceof Error?i.message:t("setupPage.toast.unknownError"),variant:"destructive"})}},re=()=>{switch(l){case 0:return e.jsx(Qe,{config:o,onChange:v});case 1:return e.jsx(Ve,{config:b,onChange:O});case 2:return e.jsx($e,{config:B,onChange:R});case 3:return e.jsx(Xe,{config:D,onChange:I});default:return null}};return e.jsxs("div",{className:"from-primary/5 via-background to-secondary/5 relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br p-4 md:p-6",children:[e.jsx(Ge,{}),e.jsx("div",{className:"absolute top-4 right-4 z-20",children:e.jsxs(de,{children:[e.jsx(ce,{asChild:!0,children:e.jsxs(A,{variant:"ghost",size:"sm",className:"gap-2",children:[e.jsx(Oe,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden text-xs sm:inline",children:X[d.split("-")[0]]??d})]})}),e.jsx(me,{align:"end",children:lt.map(i=>e.jsxs(pe,{onClick:()=>a.changeLanguage(i),className:T("cursor-pointer",d.split("-")[0]===i&&"text-primary font-semibold"),children:[d.split("-")[0]===i&&e.jsx("span",{className:"mr-2",children:"✓"}),X[i]]},i))})]})}),e.jsxs("div",{className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e.jsx("div",{className:"bg-primary/5 absolute top-1/4 left-1/4 h-64 w-64 rounded-full blur-3xl md:h-96 md:w-96"}),e.jsx("div",{className:"bg-secondary/5 absolute right-1/4 bottom-1/4 h-64 w-64 rounded-full blur-3xl md:h-96 md:w-96"})]}),F?e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:e.jsx("div",{className:"border-primary h-12 w-12 animate-spin rounded-full border-4 border-t-transparent"})}),e.jsx("p",{className:"text-lg font-medium",children:t("setupPage.loading.title")}),e.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:t("setupPage.loading.description")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[e.jsxs("div",{className:"mb-6 text-center md:mb-8",children:[e.jsx("div",{className:"bg-primary/10 mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl md:h-16 md:w-16",children:e.jsx(Re,{className:"text-primary h-6 w-6 md:h-8 md:w-8",strokeWidth:2,fill:"none"})}),e.jsx("h1",{className:"mb-2 text-2xl font-bold md:text-3xl",children:t("setupPage.header.title")}),e.jsx("p",{className:"text-muted-foreground text-sm md:text-base",children:t("setupPage.header.description",{appName:G})})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:t("setupPage.progress.stepCounter",{current:l+1,total:y.length})}),e.jsxs("span",{className:"text-primary font-medium",children:[Math.round(z),"%"]})]}),e.jsx(we,{value:z,className:"h-2"})]}),e.jsx("div",{className:"mb-6 flex justify-between md:mb-8",children:y.map((i,m)=>{const q=i.icon;return e.jsxs("div",{className:T("flex flex-1 flex-col items-center gap-1 md:gap-2",m<y.length-1&&"relative"),children:[m<y.length-1&&e.jsx("div",{className:T("absolute top-3 left-1/2 h-0.5 w-full md:top-4",m<l?"bg-primary":"bg-border")}),e.jsx("div",{className:T("relative z-10 flex h-6 w-6 items-center justify-center rounded-full border-2 transition-all md:h-8 md:w-8",m===l||m<l?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-muted-foreground"),children:m<l?e.jsx(U,{className:"h-3 w-3 md:h-4 md:w-4",strokeWidth:2.5,fill:"none"}):e.jsx(q,{className:"h-3 w-3 md:h-4 md:w-4"})}),e.jsx("span",{className:T("max-w-[60px] truncate text-center text-[10px] md:max-w-none md:text-xs md:whitespace-normal",m===l?"text-foreground font-medium":"text-muted-foreground"),title:i.title,children:i.title})]},i.id)})}),e.jsx(ue,{className:"mb-6 shadow-lg md:mb-8",children:e.jsx(fe,{className:"p-4 md:p-8",children:e.jsxs("div",{className:"min-h-[300px] md:min-h-[400px]",children:[e.jsxs("div",{className:"mb-4 md:mb-6",children:[e.jsx("h2",{className:"mb-2 text-xl font-semibold md:text-2xl",children:y[l].title}),e.jsx("p",{className:"text-muted-foreground text-sm md:text-base",children:y[l].description})]}),e.jsx(xe,{className:"h-[400px] md:h-[500px]",children:e.jsx("div",{className:"pr-2",children:re()})})]})})}),e.jsxs("div",{className:"flex flex-col items-center justify-between gap-3 sm:flex-row sm:gap-0",children:[e.jsx(A,{variant:"outline",onClick:te,disabled:l===0||f,className:"order-2 w-full sm:order-1 sm:w-auto",children:t("setupPage.actions.previous")}),e.jsxs("div",{className:"order-1 flex w-full gap-2 sm:order-2 sm:w-auto",children:[e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsxs(A,{variant:"ghost",className:"flex-1 gap-2 sm:flex-none",disabled:f||u,children:[e.jsx(Ie,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),t("setupPage.actions.skip")]})}),e.jsxs(ve,{children:[e.jsxs(ye,{children:[e.jsx(_e,{children:t("setupPage.skipDialog.title")}),e.jsx(be,{children:t("setupPage.skipDialog.description")})]}),e.jsxs(je,{children:[e.jsx(Pe,{children:t("common.cancel")}),e.jsx(Ne,{onClick:ae,children:t("setupPage.skipDialog.confirm")})]})]})]}),l===y.length-1?e.jsx(A,{onClick:se,disabled:u||f,className:"flex-1 sm:flex-none",children:u||f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),t(f?"setupPage.actions.saving":"setupPage.actions.completing")]}):e.jsxs(e.Fragment,{children:[t("setupPage.actions.complete"),e.jsx(U,{className:"ml-2 h-4 w-4",strokeWidth:2,fill:"none"})]})}):e.jsx(A,{onClick:ee,disabled:f,className:"flex-1 sm:flex-none",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),t("setupPage.actions.saving")]}):e.jsxs(e.Fragment,{children:[t("setupPage.actions.next"),e.jsx(ze,{className:"ml-2 h-4 w-4",strokeWidth:2,fill:"none"})]})})]})]})]}),e.jsx("div",{className:"text-muted-foreground relative z-10 mt-6 text-center text-xs md:mt-8",children:e.jsx("p",{children:t("setupPage.footer")})})]})]})}export{_t as SetupPage};
|