import{defineComponent as w,toRefs as A,computed as F,createVNode as t}from"vue";import{CloseOutlined as z}from"@antsoo-lib/icons";import c from"../_util/classNames.mjs";import{isFunction as P}from"../_util/util.mjs";import"../button/index.mjs";import S from"../locale/LocaleReceiver.mjs";import V from"../locale/en_US.mjs";import{tourStepProps as I}from"./interface.mjs";import h from"../button/button.mjs";const K=w({name:"ATourPanel",inheritAttrs:!1,props:I(),setup(o,{attrs:p,slots:m}){const{current:s,total:l}=A(o),f=F(()=>s.value===l.value-1),k=e=>{const n=o.prevButtonProps;o.onPrev?.(e),typeof n?.onClick=="function"&&n?.onClick()},N=e=>{const n=o.nextButtonProps;f.value?o.onFinish?.(e):o.onNext?.(e),typeof n?.onClick=="function"&&n?.onClick()};return()=>{const{prefixCls:e,title:n,onClose:x,cover:v,description:y,type:u,arrow:R}=o,r=o.prevButtonProps,a=o.nextButtonProps;let $;n&&($=t("div",{class:`${e}-header`},[t("div",{class:`${e}-title`},[n])]));let B;y&&(B=t("div",{class:`${e}-description`},[y]));let C;v&&(C=t("div",{class:`${e}-cover`},[v]));let d;m.indicatorsRender?d=m.indicatorsRender({current:s.value,total:l}):d=[...Array.from({length:l.value}).keys()].map((i,g)=>t("span",{key:i,class:c(g===s.value&&`${e}-indicator-active`,`${e}-indicator`)},null));const T=u==="primary"?"default":"primary",b={type:"default",ghost:u==="primary"};return t(S,{componentName:"Tour",defaultLocale:V.Tour},{default:i=>t("div",{...p,class:c(u==="primary"?`${e}-primary`:"",p.class,`${e}-content`)},[R&&t("div",{class:`${e}-arrow`,key:"arrow"},null),t("div",{class:`${e}-inner`},[t(z,{class:`${e}-close`,onClick:x},null),C,$,B,t("div",{class:`${e}-footer`},[l.value>1&&t("div",{class:`${e}-indicators`},[d]),t("div",{class:`${e}-buttons`},[s.value!==0?t(h,{...b,...r,onClick:k,size:"small",class:c(`${e}-prev-btn`,r?.className)},{default:()=>[P(r?.children)?r.children():r?.children??i.Previous]}):null,t(h,{type:T,...a,onClick:N,size:"small",class:c(`${e}-next-btn`,a?.className)},{default:()=>[P(a?.children)?a?.children():f.value?i.Finish:i.Next]})])])])])})}}});export{K as default};
