import{M as P,N as C,Q as S,r as _,bv as z,R as L,f as n,X as D,W as R,bw as M,V as U,l as T,ax as V,bx as Y,q,by as Q,p as W,aA as X,bz as j,am as p,P as G,bA as J,O as Z,ak as ee,S as te,bB as A,bC as ne,aY as oe,bD as ae,bE as le}from"./index-ojdwC1S2.js";import{B as k}from"./index-CQpN59BC.js";const[N,E]=S("action-bar"),F=Symbol(N),se={placeholder:Boolean,safeAreaInsetBottom:C};var ce=P({name:N,props:se,setup(e,{slots:r}){const o=_(),i=z(o,E),{linkChildren:l}=L(F);l();const f=()=>{var m;return n("div",{ref:o,class:[E(),{"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(F),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(k,{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({},J,{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=[...j,"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=Q(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:A,Escape:e.showCancelButton?B:A})[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}),x=oe(a)?a():a;return u&&typeof x=="string"?n("div",{class:b,innerHTML:x},null):n("div",{class:b},[x])},I=()=>{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)])}},K=()=>n("div",{class:[le,c("footer")]},[e.showCancelButton&&n(k,{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(k,{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)]),$=()=>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)]}),H=()=>o.footer?o.footer():e.theme==="round-button"?$():K();return()=>{const{width:t,title:a,theme:u,message:d,className:b}=e;return n(G,W({ref:i,role:"dialog",class:[c([u]),b],style:{width:p(t)},tabindex:0,"aria-labelledby":a||d,onKeydown:v,"onUpdate:show":f},X(e,ge)),{default:()=>[w(),I(),H()]})}}});export{Ce as s};
