import{M as P,N as C,Q as S,r as _,bC as L,R as z,f as n,X as D,W as R,bD as M,V as U,l as T,ax as V,bE as Y,q,bF as G,p as J,aA as Q,bG as W,am as X,P as j,bH as p,O as Z,ak as ee,S as te,bI as E,bJ as ne,aY as oe,bK as ae,bL as le}from"./index-BV0H45HW.js";import{B as x}from"./index-CBHeC2k-.js";const[F,A]=S("action-bar"),I=Symbol(F),se={placeholder:Boolean,safeAreaInsetBottom:C};var ce=P({name:F,props:se,setup(e,{slots:r}){const o=_(),i=L(o,A),{linkChildren:l}=z(I);l();const f=()=>{var m;return n("div",{ref:o,class:[A(),{"van-safe-area-bottom":e.safeAreaInsetBottom}]},[(m=r.default)==null?void 0:m.call(r)])};return()=>e.placeholder?i(f):f()}});const re=D(ce),[ie,ue]=S("action-bar-button"),de=R({},Y,{type:String,text:String,icon:String,color:String,loading:Boolean,disabled:Boolean});var fe=P({name:ie,props:de,setup(e,{slots:r}){const o=M(),{parent:i,index:l}=U(I),f=T(()=>{if(i){const s=i.children[l.value-1];return!(s&&"isButton"in s)}}),m=T(()=>{if(i){const s=i.children[l.value+1];return!(s&&"isButton"in s)}});return V({isButton:!0}),()=>{const{type:s,icon:B,text:g,color:v,loading:w,disabled:y}=e;return n(x,{class:ue([s,{last:m.value,first:f.value}]),size:"large",type:s,icon:B,color:v,loading:w,disabled:y,onClick:o},{default:()=>[r.default?r.default():g]})}}});const O=D(fe),[me,c,h]=S("dialog"),Be=R({},p,{title:String,theme:String,width:te,message:[String,Function],callback:Function,allowHtml:Boolean,className:ee,transition:Z("van-dialog-bounce"),messageAlign:String,closeOnPopstate:C,showCancelButton:Boolean,cancelButtonText:String,cancelButtonColor:String,cancelButtonDisabled:Boolean,confirmButtonText:String,confirmButtonColor:String,confirmButtonDisabled:Boolean,showConfirmButton:C,closeOnClickOverlay:Boolean,keyboardEnabled:C,destroyOnClose:Boolean}),ge=[...W,"transition","closeOnPopstate","destroyOnClose"];var Ce=P({name:me,props:Be,emits:["confirm","cancel","keydown","update:show"],setup(e,{emit:r,slots:o}){const i=_(),l=q({confirm:!1,cancel:!1}),f=t=>r("update:show",t),m=t=>{var a;f(!1),(a=e.callback)==null||a.call(e,t)},s=t=>()=>{e.show&&(r(t),e.beforeClose?(l[t]=!0,ne(e.beforeClose,{args:[t],done(){m(t),l[t]=!1},canceled(){l[t]=!1}})):m(t))},B=s("cancel"),g=s("confirm"),v=G(t=>{var a,u;if(!e.keyboardEnabled||t.target!==((u=(a=i.value)==null?void 0:a.popupRef)==null?void 0:u.value))return;({Enter:e.showConfirmButton?g:E,Escape:e.showCancelButton?B:E})[t.key](),r("keydown",t)},["enter","esc"]),w=()=>{const t=o.title?o.title():e.title;if(t)return n("div",{class:c("header",{isolated:!e.message&&!o.default})},[t])},y=t=>{const{message:a,allowHtml:u,messageAlign:d}=e,b=c("message",{"has-title":t,[d]:d}),k=oe(a)?a():a;return u&&typeof k=="string"?n("div",{class:b,innerHTML:k},null):n("div",{class:b},[k])},K=()=>{if(o.default)return n("div",{class:c("content")},[o.default()]);const{title:t,message:a,allowHtml:u}=e;if(a){const d=!!(t||o.title);return n("div",{key:u?1:0,class:c("content",{isolated:!d})},[y(d)])}},N=()=>n("div",{class:[le,c("footer")]},[e.showCancelButton&&n(x,{size:"large",text:e.cancelButtonText||h("cancel"),class:c("cancel"),style:{color:e.cancelButtonColor},loading:l.cancel,disabled:e.cancelButtonDisabled,onClick:B},null),e.showConfirmButton&&n(x,{size:"large",text:e.confirmButtonText||h("confirm"),class:[c("confirm"),{[ae]:e.showCancelButton}],style:{color:e.confirmButtonColor},loading:l.confirm,disabled:e.confirmButtonDisabled,onClick:g},null)]),H=()=>n(re,{class:c("footer")},{default:()=>[e.showCancelButton&&n(O,{type:"warning",text:e.cancelButtonText||h("cancel"),class:c("cancel"),color:e.cancelButtonColor,loading:l.cancel,disabled:e.cancelButtonDisabled,onClick:B},null),e.showConfirmButton&&n(O,{type:"danger",text:e.confirmButtonText||h("confirm"),class:c("confirm"),color:e.confirmButtonColor,loading:l.confirm,disabled:e.confirmButtonDisabled,onClick:g},null)]}),$=()=>o.footer?o.footer():e.theme==="round-button"?H():N();return()=>{const{width:t,title:a,theme:u,message:d,className:b}=e;return n(j,J({ref:i,role:"dialog",class:[c([u]),b],style:{width:X(t)},tabindex:0,"aria-labelledby":a||d,onKeydown:v,"onUpdate:show":f},Q(e,ge)),{default:()=>[w(),K(),$()]})}}});export{Ce as s};
