import{_ as h,c as C,o as B,b4 as V,i as z,g as o,d as u,w as c,a as s,j as d,b as l,h as F,n as b,p as f,e as x,F as g,k as v,t as r,aA as S,bi as T}from"./index-BUdRbiwj.js";const $={class:"flex min-h-full items-center justify-center p-4"},M={key:0,class:"px-6 py-4 border-b border-gray-200"},j={class:"flex items-center justify-between"},E={class:"flex-1"},O={class:"text-lg font-semibold text-gray-900"},N={key:0,class:"mt-1 text-sm text-gray-600"},D={key:1,class:"px-6 py-4 border-t border-gray-200 bg-gray-50 rounded-b"},L={key:2,class:"px-6 py-4 border-t border-gray-200 bg-gray-50 rounded-b flex justify-end space-x-3"},P={__name:"FPModal",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:""},subtitle:{type:String,default:""},size:{type:String,default:"md",validator:e=>["sm","md","lg","xl","full"].includes(e)},closable:{type:Boolean,default:!0},closeOnOverlay:{type:Boolean,default:!0},scrollable:{type:Boolean,default:!1},hideDefaultFooter:{type:Boolean,default:!1},confirmText:{type:String,default:"Confirm"},cancelText:{type:String,default:"Cancel"},loading:{type:Boolean,default:!1}},emits:["update:modelValue","confirm","cancel"],setup(e,{emit:p}){const n=e,m=p,k=C(()=>({sm:"max-w-md w-full",md:"max-w-lg w-full",lg:"max-w-2xl w-full",xl:"max-w-4xl w-full",full:"max-w-none w-full h-full m-0 rounded-none"})[n.size]),i=()=>{m("update:modelValue",!1),m("cancel")},w=()=>{n.closeOnOverlay&&n.closable&&i()},y=t=>{t.key==="Escape"&&n.modelValue&&n.closable&&i()};return B(()=>{document.addEventListener("keydown",y)}),V(()=>{document.removeEventListener("keydown",y)}),(t,a)=>(o(),z(T,{to:"body"},[u(S,{name:"modal"},{default:c(()=>[e.modelValue?(o(),s("div",{key:0,class:"fixed inset-0 z-50 overflow-y-auto",onClick:w},[a[3]||(a[3]=l("div",{class:"fixed inset-0 bg-black transition-opacity",style:{opacity:"0.5"}},null,-1)),l("div",$,[l("div",{class:b(["relative bg-white rounded shadow-xl transform transition-all",k.value]),onClick:a[1]||(a[1]=F(()=>{},["stop"]))},[t.$slots.header||e.title?(o(),s("div",M,[l("div",j,[l("div",E,[f(t.$slots,"header",{},()=>[l("h3",O,r(e.title),1),e.subtitle?(o(),s("p",N,r(e.subtitle),1)):d("",!0)],!0)]),e.closable?(o(),s("button",{key:0,type:"button",class:"ml-4 text-gray-400 hover:text-gray-600 transition-colors",onClick:i},a[2]||(a[2]=[l("svg",{class:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[l("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))):d("",!0)])])):d("",!0),l("div",{class:b(["px-6 py-4",{"max-h-96 overflow-y-auto":e.scrollable}])},[f(t.$slots,"default",{},void 0,!0)],2),t.$slots.footer?(o(),s("div",D,[f(t.$slots,"footer",{},void 0,!0)])):e.hideDefaultFooter?d("",!0):(o(),s("div",L,[u(x(g),{variant:"secondary",onClick:i},{default:c(()=>[v(r(e.cancelText),1)]),_:1}),u(x(g),{variant:"primary",loading:e.loading,onClick:a[0]||(a[0]=A=>t.$emit("confirm"))},{default:c(()=>[v(r(e.confirmText),1)]),_:1},8,["loading"])]))],2)])])):d("",!0)]),_:3})]))}},K=h(P,[["__scopeId","data-v-583bdfc3"]]);export{K as F};