UNPKG

vue-smart-ui

Version:

A collection of Vue 3 smart and highly customizable UI components for modern web applications

2 lines 88.6 kB
(function(L,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(L=typeof globalThis<"u"?globalThis:L||self,e(L.VueSmartUI={},L.Vue))})(this,function(L,e){"use strict";let be=0;function Z(t="base",w){const l=()=>(be++,`${t}-${be}`);return{autoId:e.computed(()=>w.id||l())}}const Te=["id"],ge={__name:"BaseAccordion",props:{id:{type:String,default:""},multiple:{type:Boolean,default:!1},variant:{type:String,default:"default",validator:t=>["default","bordered","minimal"].includes(t)}},setup(t){const w=t,{autoId:l}=Z("accordion",w),y=e.ref([]),a=o=>{if(w.multiple){const i=y.value.indexOf(o);i===-1?y.value.push(o):y.value.splice(i,1)}else y.value=y.value.includes(o)?[]:[o]};return e.provide("accordion",{activeItems:y,toggleItem:a,variant:w.variant}),(o,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vsui base-accordion",`base-accordion--${t.variant}`]),id:e.unref(l)},[e.renderSlot(o.$slots,"default")],10,Te))}},Ie=["disabled","aria-expanded"],ze={class:"base-accordion-item__body"},ye={__name:"BaseAccordionItem",props:{title:{type:String,required:!0},disabled:{type:Boolean,default:!1}},setup(t){const w=t,l=e.inject("accordion"),y=e.ref(Symbol()),a=e.ref("0px"),o=e.ref(null),i=e.computed(()=>l.activeItems.value.includes(y.value)),r=e.computed(()=>l.variant),m=()=>{w.disabled||l.toggleItem(y.value)},c=()=>{o.value&&(a.value=i.value?`${o.value.scrollHeight}px`:"0px")},N=new ResizeObserver(c);return e.onMounted(()=>{o.value&&(N.observe(o.value),c())}),e.onUnmounted(()=>{N.disconnect()}),e.watch(i,c),(g,$)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vsui base-accordion-item",[`base-accordion-item--${r.value}`,{"base-accordion-item--active":i.value,"base-accordion-item--disabled":t.disabled}]])},[e.createElementVNode("button",{class:"base-accordion-item__header",onClick:m,disabled:t.disabled,"aria-expanded":i.value},[g.$slots.icon?e.renderSlot(g.$slots,"icon",{key:0}):e.createCommentVNode("",!0),e.renderSlot(g.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),e.renderSlot(g.$slots,"chevron",{},()=>[$[0]||($[0]=e.createElementVNode("svg",{class:"base-accordion-item__chevron",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"},[e.createElementVNode("path",{fill:"currentColor",d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"})],-1))])],8,Ie),e.createElementVNode("div",{class:"base-accordion-item__content",ref_key:"contentRef",ref:o,style:e.normalizeStyle({height:a.value})},[e.createElementVNode("div",ze,[e.renderSlot(g.$slots,"default")])],4)],2))}},Ae=["id","disabled"],Le={key:0,class:"spinner"},J=Object.assign({inheritAttrs:!1},{__name:"BaseButton",props:{id:{type:String,default:""},type:{type:String,default:"button",validator:t=>["button","submit","reset"].includes(t)},variant:{type:String,default:"primary",validator:t=>["primary","secondary","gray","white","outline","outline-red","ghost"].includes(t)},size:{type:String,default:"medium",validator:t=>["small","medium","large","auto"].includes(t)},block:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},iconOnly:{type:Boolean,default:!1},hideFocusOutline:{type:Boolean,default:!1}},emits:["click"],setup(t){const w=t,{autoId:l}=Z("button",w);return(y,a)=>(e.openBlock(),e.createElementBlock("button",{id:e.unref(l),class:e.normalizeClass(["vsui base-button",[`base-button--${t.variant}`,`base-button--${t.size}`,{"base-button--block":t.block,"base-button--disabled":t.disabled,"base-button--icon-only":t.iconOnly,"base-button--loading":t.loading,"base-button--hide-focus-outline":t.hideFocusOutline},y.$attrs.class]]),disabled:t.disabled,onClick:a[0]||(a[0]=o=>y.$emit("click",o))},[e.createElementVNode("div",{class:e.normalizeClass(["button-content",[{hidden:t.loading}]])},[y.$slots.prefix?e.renderSlot(y.$slots,"prefix",{key:0}):e.createCommentVNode("",!0),e.renderSlot(y.$slots,"default"),y.$slots.suffix?e.renderSlot(y.$slots,"suffix",{key:1}):e.createCommentVNode("",!0)],2),t.loading?(e.openBlock(),e.createElementBlock("div",Le)):e.createCommentVNode("",!0)],10,Ae))}}),Ye=["id","checked","disabled","indeterminate"],qe={class:"base-checkbox__checkmark"},Oe={key:0,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Fe={key:1,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Re={key:0,class:"base-checkbox__label"},ee={__name:"BaseCheckbox",props:{id:{type:String,default:""},modelValue:{type:[Boolean,Array],default:!1},value:{type:[String,Number,Boolean,Object],default:null},label:{type:String,default:""},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)},disabled:{type:Boolean,default:!1},error:{type:Boolean,default:!1},indeterminate:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:w}){const l=t,{autoId:y}=Z("checkbox",l),a=w,o=e.computed(()=>Array.isArray(l.modelValue)?l.modelValue.includes(l.value):l.modelValue),i=r=>{if(Array.isArray(l.modelValue)){const m=[...l.modelValue];if(r.target.checked)m.push(l.value);else{const c=m.indexOf(l.value);c>-1&&m.splice(c,1)}a("update:modelValue",m)}else a("update:modelValue",r.target.checked)};return(r,m)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["vsui base-checkbox",`base-checkbox--${t.size}`,{"base-checkbox--disabled":t.disabled,"base-checkbox--error":t.error}])},[e.createElementVNode("input",{id:e.unref(y),type:"checkbox",checked:o.value,disabled:t.disabled,indeterminate:t.indeterminate,class:"base-checkbox__input",onChange:i},null,40,Ye),e.createElementVNode("span",qe,[e.renderSlot(r.$slots,"checkmark",{},()=>[o.value&&!t.indeterminate?(e.openBlock(),e.createElementBlock("svg",Oe,m[0]||(m[0]=[e.createElementVNode("path",{d:"M11.6666 3.5L5.24992 9.91667L2.33325 7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))):e.createCommentVNode("",!0),t.indeterminate?(e.openBlock(),e.createElementBlock("svg",Fe,m[1]||(m[1]=[e.createElementVNode("path",{d:"M2.91675 7H11.0834",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))):e.createCommentVNode("",!0)])]),r.$slots.default||t.label?(e.openBlock(),e.createElementBlock("span",Re,[e.renderSlot(r.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])])):e.createCommentVNode("",!0)],2))}},je=["id"],he={__name:"BaseDropdown",props:{id:{type:String,default:""},modelValue:{type:Boolean,default:!1},variant:{type:String,default:"default",validator:t=>["default","white","dark"].includes(t)},width:{type:String,default:"auto"},closeOnClick:{type:Boolean,default:!0},closeOnClickOutside:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:w}){const l=t,{autoId:y}=Z("dropdown",l),a=w,o=e.ref(null),i=e.ref(null),r=e.ref(l.modelValue),m=()=>{if(!i.value||!o.value)return;const g=i.value.getBoundingClientRect(),$=o.value.getBoundingClientRect(),M={width:window.innerWidth,height:window.innerHeight};i.value.style.top="100%",i.value.style.bottom="auto",i.value.style.left="auto",i.value.style.right="0",$.right+g.width>M.width&&(i.value.style.right="0",i.value.style.left="auto"),$.right-g.width<0&&(i.value.style.left="0",i.value.style.right="auto"),$.bottom+g.height>M.height&&(i.value.style.bottom="100%",i.value.style.top="auto",i.value.style.marginTop="0",i.value.style.marginBottom="0.5rem")};e.watch(()=>l.modelValue,g=>{r.value=g,g?(document.addEventListener("click",c),e.nextTick(()=>{m()})):document.removeEventListener("click",c)});const c=g=>{l.closeOnClickOutside&&o.value&&!o.value.contains(g.target)&&a("update:modelValue",!1)},N=g=>{l.closeOnClick&&!g.target.closest("[data-prevent-close]")&&a("update:modelValue",!1)};return e.onMounted(()=>{l.modelValue&&document.addEventListener("click",c),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m)}),e.onUnmounted(()=>{document.removeEventListener("click",c),window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}),(g,$)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dropdownRef",ref:o,class:"vsui base-dropdown",id:e.unref(y)},[e.createElementVNode("div",{class:"base-dropdown__trigger",onClick:$[0]||($[0]=M=>a("update:modelValue",!t.modelValue))},[e.renderSlot(g.$slots,"trigger")]),e.createVNode(e.Transition,{name:"dropdown"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"menuRef",ref:i,class:e.normalizeClass(["base-dropdown__menu",`base-dropdown__menu--${t.variant}`]),style:e.normalizeStyle({width:t.width}),onClick:N},[e.renderSlot(g.$slots,"default")],6),[[e.vShow,r.value]])]),_:3})],8,je))}},Pe={class:"vsui infinite-scroll"},Ue={class:"infinite-scroll__loader"},Ke={key:0},He={key:0,class:"infinite-scroll__end"},ke={__name:"BaseInfiniteScroll",props:{loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},threshold:{type:Number,default:20},container:{type:String,default:null},loadingText:{type:String,default:"Loading more items..."},endText:{type:String,default:"There are no more items to load"}},emits:["load-more"],setup(t,{emit:w}){const l=t,y=w,a=e.ref(null),o=e.ref(null),i=()=>{a.value&&a.value.disconnect(),a.value=new IntersectionObserver(r=>{r[0].isIntersecting&&!l.loading&&!l.disabled&&y("load-more")},{threshold:0,root:l.container?document.querySelector(l.container):null,rootMargin:`0px 0px ${l.threshold}px 0px`}),o.value&&a.value.observe(o.value)};return e.watch(()=>l.loading,(r,m)=>{m===!0&&r===!1&&setTimeout(()=>{i()},100)}),e.onMounted(()=>{i()}),e.onUnmounted(()=>{a.value&&a.value.disconnect()}),(r,m)=>(e.openBlock(),e.createElementBlock("div",Pe,[e.renderSlot(r.$slots,"default"),e.createElementVNode("div",{ref_key:"bottomElement",ref:o,class:"infinite-scroll__trigger"},[t.loading?e.renderSlot(r.$slots,"loading",{key:0},()=>[e.createElementVNode("div",Ue,[m[0]||(m[0]=e.createElementVNode("div",{class:"spinner"},null,-1)),t.loadingText?(e.openBlock(),e.createElementBlock("span",Ke,e.toDisplayString(t.loadingText),1)):e.createCommentVNode("",!0)])]):t.disabled?e.renderSlot(r.$slots,"disabled",{key:1},()=>[t.endText?(e.openBlock(),e.createElementBlock("div",He,e.toDisplayString(t.endText),1)):e.createCommentVNode("",!0)]):e.createCommentVNode("",!0)],512)]))}},le={required:"This field is required",email:"Please enter a valid email",min:t=>`Must be at least ${t} characters`,max:t=>`Must be no more than ${t} characters`,pattern:"Invalid format",minValue:t=>`Value must be at least ${t}`,maxValue:t=>`Value must be no more than ${t}`,hexColor:"Invalid HEX color",rgbColor:"Invalid RGB color",rgbaColor:"Invalid RGBA color",hslColor:"Invalid HSL color"},oe=e.reactive({messages:{...le}}),de=()=>({setValidationMessages:y=>{oe.messages={...le,...y}},getValidationMessage:(y,a)=>{const o=oe.messages[y];return typeof o=="function"?o(a):o||le[y]},resetValidationMessages:()=>{oe.messages={...le}},validationConfig:oe}),We={key:0,class:"base-input__label"},Ze={key:0,class:"base-input__required","aria-hidden":"true"},Xe={key:0,class:"base-input__prefix"},Ge=["id","type","value","placeholder","disabled","readonly","required","aria-required","maxlength","min","max"],Qe={key:1,class:"base-input__suffix"},Je=["aria-label"],et={key:0,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},tt={key:1,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},te={__name:"BaseInput",props:{id:{type:String,default:""},modelValue:{type:[String,Number],default:""},transparentBg:{type:Boolean,default:!1},variant:{type:String,default:"default",validator:t=>["default","filled","outlined"].includes(t)},state:{type:String,default:null,validator:t=>["success","error","warning"].includes(t)},type:{type:String,default:"text"},label:{type:String,default:null},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},helperText:{type:String,default:null},errorMessage:{type:String,default:null},prefixIcon:{type:String,default:null},suffixIcon:{type:String,default:null},rules:{type:Array,default:()=>[]},validateOnBlur:{type:Boolean,default:!0},validateOnInput:{type:Boolean,default:!1},name:{type:String,default:""},min:{type:[Number,String],default:null},max:{type:[Number,String],default:null},mask:{type:[String,Object],default:null},rawValue:{type:Boolean,default:!0},dateDisplayFormat:{type:String,default:"DD/MM/YYYY",validator:t=>["DD/MM/YYYY","MM/DD/YYYY","YYYY-MM-DD","YYYY/MM/DD"].includes(t)},dateValueFormat:{type:String,default:"YYYY-MM-DD",validator:t=>["DD/MM/YYYY","MM/DD/YYYY","YYYY-MM-DD","YYYY/MM/DD"].includes(t)},uppercase:{type:Boolean,default:!1},lowercase:{type:Boolean,default:!1}},emits:["update:modelValue","focus","blur","input","enter","validation","mounted"],setup(t,{emit:w}){const l=e.useSlots(),{getValidationMessage:y}=de(),a=t,{autoId:o}=Z("input",a),i=w,r=e.ref(null),m=e.ref(!1),c=e.ref(""),N=e.ref(!1),g=e.ref(!1),$=e.computed(()=>({"vsui base-input":!0,[`base-input--${a.variant}`]:!0,[`base-input--${k.value}`]:k.value,"base-input--disabled":a.disabled,"base-input--focused":m.value,"base-input--with-prefix":a.prefixIcon||l.prefix,"base-input--with-suffix":a.suffixIcon||l.suffix||a.type==="password"})),M=e.computed(()=>a.type==="password"&&g.value?"text":a.type),x=()=>{var s;const n=(s=r.value)==null?void 0:s.selectionStart;g.value=!g.value,n!==void 0&&setTimeout(()=>{var B;(B=r.value)==null||B.setSelectionRange(n,n)},50)},R={required:n=>({valid:!!(n!=null&&n.toString().trim()),message:y("required")}),email:n=>({valid:!n||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n),message:y("email")}),min:(n,s)=>({valid:!n||n.length>=s,message:y("min",s)}),max:(n,s)=>({valid:!n||n.length<=s,message:y("max",s)}),pattern:(n,s)=>({valid:!n||new RegExp(s).test(n),message:y("pattern")}),minValue:(n,s)=>({valid:!n||Number(n)>=s,message:y("minValue",s)}),maxValue:(n,s)=>({valid:!n||Number(n)<=s,message:y("maxValue",s)}),hexColor:n=>({valid:!n||/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(n),message:y("hexColor")}),rgbColor:n=>({valid:!n||/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/.test(n),message:y("rgbColor")}),rgbaColor:n=>({valid:!n||/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|0?\.\d+|1(\.0)?)\s*\)$/.test(n),message:y("rgbaColor")}),hslColor:n=>({valid:!n||/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/.test(n),message:y("hslColor")})},j=n=>{if(!a.rules.length)return!0;N.value=!0;for(const s of a.rules){if(typeof s=="string"){const B=R[s];if(B){const D=B(n);if(!D.valid)return c.value=D.message,!1}continue}if(typeof s=="object"){const[B,D]=Object.entries(s)[0],F=R[B];if(F){const P=F(n,D);if(!P.valid)return c.value=s.message||P.message,!1}if(typeof s.validator=="function"&&!s.validator(n))return c.value=s.message||"Invalid value",!1}}return c.value="",!0},_=(n,s)=>{if(!n)return null;const B=n.replace(/\D/g,"").substring(0,8);if(B.length<8)return null;let D,F,P;return s==="DD/MM/YYYY"?(D=B.substring(0,2),F=B.substring(2,4),P=B.substring(4,8)):s==="MM/DD/YYYY"?(F=B.substring(0,2),D=B.substring(2,4),P=B.substring(4,8)):(s==="YYYY-MM-DD"||s==="YYYY/MM/DD")&&(P=B.substring(0,4),F=B.substring(4,6),D=B.substring(6,8)),{day:D,month:F,year:P}},f=(n,s,B,D)=>!n||!s||!B?"":D==="DD/MM/YYYY"?`${n}/${s}/${B}`:D==="MM/DD/YYYY"?`${s}/${n}/${B}`:D==="YYYY-MM-DD"?`${B}-${s}-${n}`:D==="YYYY/MM/DD"?`${B}/${s}/${n}`:"",p=(n,s,B)=>{if(!n||n.replace(/\D/g,"").substring(0,8).length<8)return"";const F=_(n,s);return F?f(F.day,F.month,F.year,B):""},d={phone:{patterns:["(##) ####-####","(##) #####-####"],match:n=>n.replace(/\D/g,"").length<=10?0:1},currency:{pattern:"currency",format:n=>{if(!n&&n!==0)return"";const s=typeof n=="string"?parseFloat(n.replace(/\D/g,""))/100:n;return isNaN(s)?"":new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL",minimumFractionDigits:2,maximumFractionDigits:2}).format(s)},parse:n=>{if(!n)return 0;const s=n.replace(/[^\d]/g,"");if(!s)return 0;const B=parseFloat(s)/100;return isNaN(B)?0:B}},date:"##/##/####",cpf:"###.###.###-##",cnpj:"##.###.###/####-##",cep:"#####-###"},b=n=>{if(typeof n=="string"){if(n==="date"){const s=a.dateDisplayFormat;if(s==="DD/MM/YYYY"||s==="MM/DD/YYYY")return"##/##/####";if(s==="YYYY-MM-DD")return"####-##-##";if(s==="YYYY/MM/DD")return"####/##/##"}return d[n]||n}return n},E=(n,s)=>{if(!n)return n;if(s==="currency"||(s==null?void 0:s.pattern)==="currency"){const B=d.currency.parse(n);return d.currency.format(B)}if(typeof s=="string")return V(n,s);if(s!=null&&s.patterns){const B=s.match(n);return V(n,s.patterns[B])}return n},v=n=>n&&(a.uppercase?n.toUpperCase():a.lowercase?n.toLowerCase():n),Y=(n,s)=>{const B=s.includes("#"),D=s.includes("A"),F=s.includes("X");let P=n;return F?P=n.replace(/[^a-zA-Z0-9]/g,""):D&&B?P=n.replace(/[^a-zA-Z0-9]/g,""):D?P=n.replace(/[^a-zA-Z]/g,""):B?P=n.replace(/\D/g,""):P=n,v(P)},V=(n,s)=>{if(!s)return n;const B=Y(n,s).split("");let D="",F=0;for(let P=0;P<s.length&&F<B.length;P++){const G=s[P];if(G==="#")if(/\d/.test(B[F]))D+=B[F],F++;else break;else if(G==="A")if(/[a-zA-Z]/.test(B[F]))D+=B[F],F++;else break;else if(G==="X")if(/[a-zA-Z0-9]/.test(B[F]))D+=B[F],F++;else break;else D+=G}return D},q=(n,s)=>{if(!n)return n;if(s==="currency"||(s==null?void 0:s.pattern)==="currency")return d.currency.parse(n);if(typeof s=="string"){const B=s.includes("#"),D=s.includes("A");if(s.includes("X"))return n.replace(/[^a-zA-Z0-9]/g,"");if(D&&B)return n.replace(/[^a-zA-Z0-9]/g,"");if(D)return n.replace(/[^a-zA-Z]/g,"");if(B)return n.replace(/\D/g,"")}return n.replace(/\D/g,"")},U=e.computed({get:()=>{if(!a.mask){if(a.modelValue&&(a.uppercase||a.lowercase)){const s=String(a.modelValue);if(a.uppercase)return s.toUpperCase();if(a.lowercase)return s.toLowerCase()}return a.modelValue}if(!a.modelValue&&a.modelValue!==0)return a.modelValue;const n=b(a.mask);if(a.mask==="currency")return d.currency.format(a.modelValue);if(a.mask==="date"&&a.rawValue){if(String(a.modelValue).replace(/\D/g,"").length>=8){const B=p(a.modelValue,a.dateValueFormat,a.dateDisplayFormat);if(B)return B}return E(String(a.modelValue),n)||""}return a.rawValue?E(String(a.modelValue),n)||"":a.modelValue},set:n=>i("update:modelValue",n)}),T=n=>{let s=n.target.value,B=s;if(a.mask){const D=b(a.mask),P=E(s,D)||"";r.value&&(r.value.value=P),a.mask==="date"&&a.rawValue?P.replace(/\D/g,"").length>=8?B=p(P,a.dateDisplayFormat,a.dateValueFormat)||q(s,D):B=q(s,D):B=a.rawValue?q(s,D):P}else a.uppercase?(B=s.toUpperCase(),r.value&&(r.value.value=B)):a.lowercase&&(B=s.toLowerCase(),r.value&&(r.value.value=B));if(a.type==="email"&&B&&(B=B.toLowerCase()),i("update:modelValue",B),i("input",{...n,target:{...n.target,value:s}}),a.validateOnInput||N.value){const D=j(B);i("validation",{valid:D,error:c.value})}},z=n=>{i("enter",n)},H=n=>{m.value=!0,i("focus",n)},h=n=>{if(m.value=!1,i("blur",n),a.validateOnBlur){const s=j(U.value);i("validation",{valid:s,error:c.value})}},S=()=>{var n;(n=r.value)==null||n.focus()},k=e.computed(()=>c.value?"error":a.state),I=e.computed(()=>c.value?c.value:a.errorMessage||a.helperText),O=()=>{const n=j(U.value);return i("validation",{valid:n,error:c.value,name:a.name}),n},W=e.computed(()=>a.required?!0:a.rules.some(n=>n==="required"?!0:typeof n=="object"?n.required||Object.keys(n)[0]==="required":!1)),ae=e.computed(()=>{if(!a.mask)return;const n=b(a.mask);if(typeof n=="string")return n.length;if(n!=null&&n.patterns)return Math.max(...n.patterns.map(s=>s.length))}),ce=()=>{if(!a.mask||!r.value||!a.modelValue&&a.modelValue!==0)return;const n=b(a.mask);let s;a.mask==="currency"?s=d.currency.format(a.modelValue):a.mask==="date"&&a.rawValue&&String(a.modelValue).replace(/\D/g,"").length>=8?s=p(a.modelValue,a.dateValueFormat,a.dateDisplayFormat):s=E(String(a.modelValue),n);const B=s||"";r.value.value!==B&&(r.value.value=B)};return e.watch(()=>a.modelValue,()=>{e.nextTick(()=>{ce()})}),e.onMounted(()=>{ce(),i("mounted",{validate:O,focus:S})}),(n,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass($.value)},[t.label?(e.openBlock(),e.createElementBlock("label",We,[e.createTextVNode(e.toDisplayString(t.label)+" ",1),W.value?(e.openBlock(),e.createElementBlock("span",Ze,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["base-input__wrapper",{"base-input__wrapper--transparent":t.transparentBg}])},[n.$slots.prefix||t.prefixIcon?(e.openBlock(),e.createElementBlock("div",Xe,[e.renderSlot(n.$slots,"prefix",{},()=>[e.createElementVNode("i",{class:e.normalizeClass(t.prefixIcon)},null,2)])])):e.createCommentVNode("",!0),e.createElementVNode("input",{id:e.unref(o),ref_key:"inputRef",ref:r,type:M.value,value:U.value,placeholder:t.placeholder,disabled:t.disabled,readonly:t.readonly,required:W.value,"aria-required":W.value,maxlength:ae.value,min:t.min,max:t.max,class:"base-input__field",onInput:T,onFocus:H,onBlur:h,onKeydown:e.withKeys(z,["enter"])},null,40,Ge),n.$slots.suffix||t.suffixIcon||t.type==="password"?(e.openBlock(),e.createElementBlock("div",Qe,[e.renderSlot(n.$slots,"suffix",{},()=>[t.suffixIcon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(t.suffixIcon)},null,2)):e.createCommentVNode("",!0)]),t.type==="password"?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"base-input__password-toggle",tabindex:"-1",onClick:x,onMousedown:s[0]||(s[0]=e.withModifiers(()=>{},["prevent"])),"aria-label":g.value?"Hide password":"Show password"},[g.value?(e.openBlock(),e.createElementBlock("svg",et,s[1]||(s[1]=[e.createElementVNode("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"},null,-1),e.createElementVNode("line",{x1:"1",y1:"1",x2:"23",y2:"23"},null,-1)]))):(e.openBlock(),e.createElementBlock("svg",tt,s[2]||(s[2]=[e.createElementVNode("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},null,-1),e.createElementVNode("circle",{cx:"12",cy:"12",r:"3"},null,-1)])))],40,Je)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2),I.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["base-input__helper",{"base-input__helper--error":c.value}])},e.toDisplayString(I.value),3)):e.createCommentVNode("",!0)],2))}},at={key:0,class:"base-popup__header"},lt={class:"base-popup__content"},ot={key:1,class:"base-popup__footer"},Be={__name:"BasePopup",props:{modelValue:{type:Boolean,default:!1},variant:{type:String,default:"default",validator:t=>["default","info","success","warning","error"].includes(t)},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)},position:{type:String,default:"center",validator:t=>["center","top","bottom","left","right"].includes(t)},disableClickOutside:{type:Boolean,default:!1},closeOnEsc:{type:Boolean,default:!0},scrollContentOnly:{type:Boolean,default:!0}},emits:["update:modelValue","close"],setup(t,{emit:w}){const l=t,y=w,a=e.ref(null),o=r=>{!l.disableClickOutside&&a.value&&!a.value.contains(r.target)&&(r.target.closest(".base-popup")||(y("update:modelValue",!1),y("close")))},i=r=>{l.closeOnEsc&&r.key==="Escape"&&(y("update:modelValue",!1),y("close"))};return e.onMounted(()=>{document.addEventListener("mousedown",o),document.addEventListener("keydown",i)}),e.onUnmounted(()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",i)}),(r,m)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["vsui base-popup-overlay",[`base-popup-overlay--${t.position}`]])},[e.createElementVNode("div",{ref_key:"popupRef",ref:a,class:e.normalizeClass(["base-popup",[`base-popup--${t.variant}`,`base-popup--${t.size}`,`base-popup--${t.position}`,{"base-popup--scroll-content-only":t.scrollContentOnly}]])},[r.$slots.header?(e.openBlock(),e.createElementBlock("div",at,[e.renderSlot(r.$slots,"header")])):e.createCommentVNode("",!0),e.createElementVNode("div",lt,[e.renderSlot(r.$slots,"default")]),r.$slots.footer?(e.openBlock(),e.createElementBlock("div",ot,[e.renderSlot(r.$slots,"footer")])):e.createCommentVNode("",!0),r.$slots.close?(e.openBlock(),e.createElementBlock("button",{key:2,class:"base-popup__close",onClick:m[0]||(m[0]=c=>r.$emit("update:modelValue",!1))},[e.renderSlot(r.$slots,"close")])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0)]))}},ne={__name:"BaseSkeleton",props:{variant:{type:String,default:"rectangle",validator:t=>["rectangle","circle","text","heading","button"].includes(t)},width:{type:String,default:"100%"},height:{type:String,default:null},animated:{type:Boolean,default:!0},rounded:{type:Boolean,default:!1}},setup(t){return(w,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vsui base-skeleton",[`base-skeleton--${t.variant}`,{"base-skeleton--animated":t.animated,"base-skeleton--rounded":t.rounded}]]),style:e.normalizeStyle({width:t.width,height:t.height||null})},[e.renderSlot(w.$slots,"default")],6))}},nt=["for"],st={key:0,class:"base-slider__required"},rt={class:"base-slider__container"},it={class:"base-slider__extremity-value base-slider__extremity-value--min"},ct={key:0,class:"base-slider__mark-label"},dt=["onMousedown","onTouchstart","onKeydown","aria-valuemin","aria-valuemax","aria-valuenow","aria-valuetext","aria-disabled"],ut={key:0,class:"base-slider__thumb-value"},mt={class:"base-slider__extremity-value base-slider__extremity-value--max"},ft={key:1,class:"base-slider__helper"},Ve={__name:"BaseSlider",props:{id:{type:String,default:""},modelValue:{type:[Number,Array],default:0},min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},label:{type:String,default:null},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},helperText:{type:String,default:null},errorMessage:{type:String,default:null},state:{type:String,default:null,validator:t=>["success","error","warning"].includes(t)},showValue:{type:Boolean,default:!0},range:{type:Boolean,default:!1},variant:{type:String,default:"default",validator:t=>["default","filled"].includes(t)},marks:{type:Array,default:()=>[]},formatValue:{type:Function,default:null}},emits:["update:modelValue","change","mounted"],setup(t,{emit:w}){const l=t,y=w,{autoId:a}=Z("slider",l),o=e.ref(l.modelValue),i=e.ref(!1),r=e.ref(null),m=e.ref([]),c=e.computed(()=>l.range&&Array.isArray(l.modelValue)),N=e.computed(()=>l.formatValue?c.value?o.value.map(_=>l.formatValue(_)):l.formatValue(o.value):o.value),g=e.computed(()=>{if(c.value){const[_,f]=o.value,p=(_-l.min)/(l.max-l.min)*100,d=(f-l.min)/(l.max-l.min)*100;return{left:`${p}%`,width:`${d-p}%`}}else return{width:`${(o.value-l.min)/(l.max-l.min)*100}%`}}),$=e.computed(()=>c.value?o.value.map(_=>`${(_-l.min)/(l.max-l.min)*100}%`):[`${(o.value-l.min)/(l.max-l.min)*100}%`]),M=e.computed(()=>({"base-slider--disabled":l.disabled,"base-slider--success":l.state==="success","base-slider--error":l.state==="error","base-slider--warning":l.state==="warning","base-slider--filled":l.variant==="filled"}));e.watch(()=>l.modelValue,_=>{o.value=_}),e.watch(o,_=>{y("update:modelValue",_)});const x=(_,f=0)=>{if(l.disabled)return;const p=r.value.getBoundingClientRect(),d=_.clientX-p.left,b=Math.min(Math.max(d/p.width,0),1),E=l.min+b*(l.max-l.min),v=Math.round(E/l.step)*l.step,Y=Math.min(Math.max(v,l.min),l.max);if(c.value){const V=[...o.value];V[f]=Y,f===0&&V[0]>V[1]?V[0]=V[1]:f===1&&V[1]<V[0]&&(V[1]=V[0]),o.value=V}else o.value=Y;y("change",o.value)},R=(_,f=0)=>{if(l.disabled)return;i.value=!0,x(_,f);const p=b=>x(b,f),d=()=>{i.value=!1,document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",d),document.removeEventListener("touchmove",p),document.removeEventListener("touchend",d)};document.addEventListener("mousemove",p),document.addEventListener("mouseup",d),document.addEventListener("touchmove",p),document.addEventListener("touchend",d)},j=(_,f=0)=>{if(l.disabled)return;const p=c.value?o.value[f]:o.value;let d=p;switch(_.key){case"ArrowRight":case"ArrowUp":d=Math.min(p+l.step,l.max);break;case"ArrowLeft":case"ArrowDown":d=Math.max(p-l.step,l.min);break;case"Home":d=l.min;break;case"End":d=l.max;break;default:return}if(c.value){const b=[...o.value];b[f]=d,f===0&&b[0]>b[1]?b[0]=b[1]:f===1&&b[1]<b[0]&&(b[1]=b[0]),o.value=b}else o.value=d;y("change",o.value),_.preventDefault()};return e.onMounted(()=>{c.value&&(!Array.isArray(o.value)||o.value.length!==2)?o.value=[l.min,l.max]:!c.value&&Array.isArray(o.value)&&(o.value=l.min),y("mounted",{id:a.value,getValue:()=>o.value,setValue:_=>{o.value=_}})}),(_,f)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vsui base-slider",M.value])},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(a),class:"base-slider__label"},[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",st,"*")):e.createCommentVNode("",!0)],8,nt)):e.createCommentVNode("",!0),e.createElementVNode("div",rt,[e.createElementVNode("div",it,e.toDisplayString(t.formatValue?t.formatValue(t.min):t.min),1),e.createElementVNode("div",{ref_key:"sliderTrack",ref:r,class:"base-slider__track",onMousedown:f[0]||(f[0]=p=>x(p)),onTouchstart:f[1]||(f[1]=e.withModifiers(p=>x(p.touches[0]),["prevent"]))},[e.createElementVNode("div",{class:"base-slider__track-fill",style:e.normalizeStyle(g.value)},null,4),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.marks,p=>(e.openBlock(),e.createElementBlock("div",{key:p.value,class:e.normalizeClass(["base-slider__mark",{"base-slider__mark--active":c.value?p.value>=o.value[0]&&p.value<=o.value[1]:p.value<=o.value}]),style:e.normalizeStyle({left:`calc(${(p.value-t.min)/(t.max-t.min)*100}%)`})},[f[2]||(f[2]=e.createElementVNode("div",{class:"base-slider__mark-dot"},null,-1)),p.label?(e.openBlock(),e.createElementBlock("div",ct,e.toDisplayString(p.label),1)):e.createCommentVNode("",!0)],6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,(p,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,ref_for:!0,ref_key:"thumbRefs",ref:m,class:"base-slider__thumb",style:e.normalizeStyle({left:p}),onMousedown:e.withModifiers(b=>R(b,d),["stop"]),onTouchstart:e.withModifiers(b=>R(b.touches[0],d),["stop","prevent"]),onKeydown:b=>j(b,d),tabindex:"0",role:"slider","aria-valuemin":t.min,"aria-valuemax":t.max,"aria-valuenow":c.value?o.value[d]:o.value,"aria-valuetext":c.value?N.value[d]:N.value,"aria-disabled":t.disabled},[t.showValue?(e.openBlock(),e.createElementBlock("div",ut,e.toDisplayString(c.value?N.value[d]:N.value),1)):e.createCommentVNode("",!0)],44,dt))),128))],544),e.createElementVNode("div",mt,e.toDisplayString(t.formatValue?t.formatValue(t.max):t.max),1)]),t.helperText||t.errorMessage?(e.openBlock(),e.createElementBlock("div",ft,e.toDisplayString(t.errorMessage||t.helperText),1)):e.createCommentVNode("",!0)],2))}},pt={key:0,class:"base-textarea__label"},bt={key:0,class:"base-textarea__required","aria-hidden":"true"},gt=["id","value","rows","placeholder","disabled","readonly","required","aria-required"],we={__name:"BaseTextarea",props:{id:{type:String,default:""},modelValue:{type:String,default:""},transparentBg:{type:Boolean,default:!1},variant:{type:String,default:"default",validator:t=>["default","filled","outlined"].includes(t)},state:{type:String,default:null,validator:t=>["success","error","warning"].includes(t)},label:{type:String,default:null},placeholder:{type:String,default:""},rows:{type:[String,Number],default:3},maxRows:{type:[String,Number],default:null},disabled:{type:Boolean,default:!1},block:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},helperText:{type:String,default:null},errorMessage:{type:String,default:null},rules:{type:Array,default:()=>[]},validateOnBlur:{type:Boolean,default:!0},validateOnInput:{type:Boolean,default:!1},name:{type:String,default:""},resize:{type:String,default:"vertical",validator:t=>["none","both","horizontal","vertical"].includes(t)},autoResize:{type:Boolean,default:!1}},emits:["update:modelValue","focus","blur","input","validation","mounted"],setup(t,{emit:w}){const l=t,{autoId:y}=Z("textarea",l),a=w,o=e.ref(null),i=e.ref(!1),r=e.ref(""),m=e.computed(()=>({"vsui base-textarea":!0,[`base-textarea--${l.variant}`]:!0,[`base-textarea--${_.value}`]:_.value,"base-textarea--disabled":l.disabled,"base-textarea--focused":i.value,"base-textarea--block":l.block,[`base-textarea--resize-${l.resize}`]:!0})),c={required:d=>({valid:!!(d!=null&&d.toString().trim()),message:"This field is required"}),min:(d,b)=>({valid:!d||d.toString().length>=b,message:`Must be at least ${b} characters`}),max:(d,b)=>({valid:!d||d.toString().length<=b,message:`Must be no more than ${b} characters`})},N=()=>{const d=g(l.modelValue);return a("validation",{valid:d,error:r.value,name:l.name}),d},g=d=>{if(!l.rules.length)return!0;for(const b of l.rules){if(typeof b=="string"){const E=c[b];if(E){const v=E(d);if(!v.valid)return r.value=v.message,!1}continue}if(typeof b=="object"){const[E,v]=Object.entries(b)[0],Y=c[E];if(Y){const V=Y(d,v);if(!V.valid)return r.value=b.message||V.message,!1}if(typeof b.validator=="function"&&!b.validator(d))return r.value=b.message||"Invalid value",!1}}return r.value="",!0},$=d=>{if(a("update:modelValue",d.target.value),a("input",d),l.validateOnInput){const b=g(d.target.value);a("validation",{valid:b,error:r.value})}l.autoResize&&R()},M=d=>{i.value=!0,a("focus",d)},x=d=>{if(i.value=!1,a("blur",d),l.validateOnBlur){const b=g(d.target.value);a("validation",{valid:b,error:r.value})}},R=()=>{if(!o.value)return;o.value.style.height="auto";let d=o.value.scrollHeight+2;if(l.maxRows){const E=parseInt(getComputedStyle(o.value).lineHeight)*l.maxRows;d=Math.min(d,E)}o.value.style.height=`${d}px`},j=()=>{var d;(d=o.value)==null||d.focus()},_=e.computed(()=>r.value?"error":l.state),f=e.computed(()=>r.value?r.value:l.errorMessage||l.helperText),p=e.computed(()=>l.required?!0:l.rules.some(d=>d==="required"||typeof d=="object"&&d.required));return e.onMounted(()=>{l.autoResize&&R(),a("mounted",{validate:N,focus:j})}),(d,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(m.value)},[t.label?(e.openBlock(),e.createElementBlock("label",pt,[e.createTextVNode(e.toDisplayString(t.label)+" ",1),p.value?(e.openBlock(),e.createElementBlock("span",bt,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["base-textarea__wrapper",{"base-textarea__wrapper--transparent":t.transparentBg}])},[e.createElementVNode("textarea",{id:e.unref(y),ref_key:"textareaRef",ref:o,value:t.modelValue,rows:t.rows,placeholder:t.placeholder,disabled:t.disabled,readonly:t.readonly,required:p.value,"aria-required":p.value,class:"base-textarea__field",onInput:$,onFocus:M,onBlur:x},null,40,gt)],2),f.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["base-textarea__helper",{"base-textarea__helper--error":r.value}])},e.toDisplayString(f.value),3)):e.createCommentVNode("",!0)],2))}},se=(t,w)=>{const l=t.__vccOpts||t;for(const[y,a]of w)l[y]=a;return l},yt={},ht={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function kt(t,w){return e.openBlock(),e.createElementBlock("svg",ht,w[0]||(w[0]=[e.createElementVNode("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"},null,-1),e.createElementVNode("polyline",{points:"22 4 12 14.01 9 11.01"},null,-1)]))}const Bt=se(yt,[["render",kt]]),Vt={},wt={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function St(t,w){return e.openBlock(),e.createElementBlock("svg",wt,w[0]||(w[0]=[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),e.createElementVNode("line",{x1:"15",y1:"9",x2:"9",y2:"15"},null,-1),e.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"15"},null,-1)]))}const Ct=se(Vt,[["render",St]]),Et={},$t={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function xt(t,w){return e.openBlock(),e.createElementBlock("svg",$t,w[0]||(w[0]=[e.createElementVNode("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"},null,-1),e.createElementVNode("line",{x1:"12",y1:"9",x2:"12",y2:"13"},null,-1),e.createElementVNode("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"},null,-1)]))}const _t=se(Et,[["render",xt]]),Nt={},vt={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Mt(t,w){return e.openBlock(),e.createElementBlock("svg",vt,w[0]||(w[0]=[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),e.createElementVNode("line",{x1:"12",y1:"16",x2:"12",y2:"12"},null,-1),e.createElementVNode("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"},null,-1)]))}const Se=se(Nt,[["render",Mt]]),Dt=["data-toast-id"],Tt={key:0,class:"base-toast__icon"},It={class:"base-toast__content"},zt={key:0,class:"base-toast__title"},At={class:"base-toast__message"},ue={__name:"BaseToast",props:{id:{type:[String,Number],required:!0},variant:{type:String,default:"default",validator:t=>["default","info","success","warning","error"].includes(t)},position:{type:String,default:"top-right",validator:t=>["top-right","top-left","top-center","bottom-right","bottom-left","bottom-center"].includes(t)},duration:{type:Number,default:3e3},closable:{type:Boolean,default:!0},message:{type:String,required:!0},title:{type:String,default:""},simple:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:w}){const l=t,y=w,a=e.ref(!1),o=e.ref(null),i=e.ref("100%"),r=()=>{l.duration>0&&(i.value="100%",requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.value="0%"})}))},m=()=>{a.value=!1,setTimeout(()=>{y("close")},100)},c=()=>{o.value&&(o.value.style.animationPlayState="paused")},N=()=>{o.value&&(o.value.style.animationPlayState="running")},g={success:Bt,error:Ct,warning:_t,info:Se,default:Se},$=e.computed(()=>g[l.variant]||g.default);return e.onMounted(()=>{var M;setTimeout(()=>{a.value=!0},100),l.duration>0&&(l.simple?setTimeout(m,l.duration):(M=o.value)==null||M.addEventListener("animationend",m,{once:!0})),r()}),e.onUnmounted(()=>{o.value&&o.value.removeEventListener("animationend",m)}),(M,x)=>(e.openBlock(),e.createElementBlock("div",{"data-toast-id":t.id,class:e.normalizeClass(["vsui base-toast",[`base-toast--${t.variant}`,`base-toast--${t.position}`,{"base-toast--visible":a.value},{"base-toast--simple":t.simple}]]),onMouseenter:c,onMouseleave:N},[t.simple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Tt,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent($.value),{class:"icon"}))])),e.createElementVNode("div",It,[!t.simple&&t.title?(e.openBlock(),e.createElementBlock("div",zt,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",At,e.toDisplayString(t.message),1)]),t.closable?(e.openBlock(),e.createElementBlock("button",{key:1,class:"base-toast__close",onClick:m},x[0]||(x[0]=[e.createElementVNode("span",null,"×",-1)]))):e.createCommentVNode("",!0),!t.simple&&t.duration>0?(e.openBlock(),e.createElementBlock("div",{key:2,ref_key:"progressBarRef",ref:o,class:e.normalizeClass(["progress-bar",`progress-bar--${t.variant}`]),style:e.normalizeStyle({animationDuration:`${t.duration}ms`})},null,6)):e.createCommentVNode("",!0)],42,Dt))}},me={position:"top-right",duration:3e3,closable:!0,simple:!1},re=e.reactive({defaults:{...me}}),Ce=()=>({setToastDefaults:y=>{re.defaults={...me,...y}},getToastDefaults:()=>({...re.defaults}),resetToastDefaults:()=>{re.defaults={...me}},toastConfig:re}),ie=e.ref([]);let Lt=0,Ee=null;function $e(){const{getToastDefaults:t}=Ce(),w=()=>{if(Ee)return;const a=document.createElement("div");a.id="toast-container",document.body.appendChild(a),Ee=e.createApp({render:()=>e.h(pe)}).mount(a)},l=({message:a,title:o="",variant:i="default",position:r,duration:m,closable:c,simple:N})=>{w();const g=t(),$=++Lt;return ie.value.push({id:$,message:a,title:o,variant:i,position:r??g.position,duration:m??g.duration,closable:c??g.closable,simple:N??g.simple}),$};return{toasts:ie,addToast:l,removeToast:a=>{const o=ie.value.findIndex(i=>i.id===a);o>-1&&ie.value.splice(o,1)},default:(a,o={})=>l({...o,message:a,variant:"default"}),success:(a,o={})=>l({...o,message:a,variant:"success"}),error:(a,o={})=>l({...o,message:a,variant:"error"}),info:(a,o={})=>l({...o,message:a,variant:"info"}),warning:(a,o={})=>l({...o,message:a,variant:"warning"})}}const Yt={class:"base-switch__wrapper-container"},qt=["for"],Ot={key:0,class:"base-switch__required","aria-hidden":"true"},Ft={class:"base-switch__container"},Rt=["for"],jt={key:0,class:"base-switch__required","aria-hidden":"true"},Pt=["for"],Ut=["id","checked","disabled","required","aria-required","aria-checked","name"],Kt={class:"base-switch__track"},Ht={class:"base-switch__thumb"},Wt={key:0,class:"base-switch__spinner"},Zt={key:0,class:"base-switch__track-label base-switch__track-label--on"},Xt={key:1,class:"base-switch__track-label base-switch__track-label--off"},Gt=["for"],Qt={key:0,class:"base-switch__required","aria-hidden":"true"},xe={__name:"BaseSwitch",props:{id:{type:String,default:""},modelValue:{type:[Boolean,String,Number],default:!1},onValue:{type:[Boolean,String,Number],default:!0},offValue:{type:[Boolean,String,Number],default:!1},label:{type:String,default:null},labelPosition:{type:String,default:"right",validator:t=>["top","left","right"].includes(t)},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},helperText:{type:String,default:null},errorMessage:{type:String,default:null},state:{type:String,default:null,validator:t=>["success","error","warning"].includes(t)},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)},variant:{type:String,default:"default",validator:t=>["default","filled"].includes(t)},onLabel:{type:String,default:null},offLabel:{type:String,default:null},loading:{type:Boolean,default:!1},name:{type:String,default:""}},emits:["update:modelValue","change","mounted"],setup(t,{emit:w}){const l=t,y=w,{autoId:a}=Z("switch",l),o=e.ref(l.modelValue),i=e.ref(!1),r=e.computed(()=>o.value===l.onValue),m=e.computed(()=>({"vsui base-switch":!0,[`base-switch--${l.size}`]:!0,[`base-switch--${l.variant}`]:!0,[`base-switch--${l.state}`]:l.state,[`base-switch--label-${l.labelPosition}`]:l.label,"base-switch--disabled":l.disabled||l.loading,"base-switch--loading":l.loading,"base-switch--focused":i.value,"base-switch--on":r.value})),c=e.computed(()=>l.errorMessage||l.helperText);e.watch(()=>l.modelValue,x=>{o.value=x});const N=()=>{l.disabled||l.loading||(o.value=r.value?l.offValue:l.onValue,y("update:modelValue",o.value),y("change",o.value))},g=x=>{l.disabled||l.loading||(x.key===" "||x.key==="Enter")&&(x.preventDefault(),N())},$=()=>{i.value=!0},M=()=>{i.value=!1};return e.onMounted(()=>{y("mounted",{id:a.value,getValue:()=>o.value,setValue:x=>{o.value=x,y("update:modelValue",x)}})}),(x,R)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(m.value)},[e.createElementVNode("div",Yt,[t.label&&t.labelPosition==="top"?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(a),class:"base-switch__label base-switch__label--top"},[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",Ot,"*")):e.createCommentVNode("",!0)],8,qt)):e.createCommentVNode("",!0),e.createElementVNode("div",Ft,[t.label&&t.labelPosition==="left"?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(a),class:"base-switch__label base-switch__label--left"},[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",jt,"*")):e.createCommentVNode("",!0)],8,Rt)):e.createCommentVNode("",!0),e.createElementVNode("label",{for:e.unref(a),class:"base-switch__wrapper"},[e.createElementVNode("input",{id:e.unref(a),ref:"switchRef",type:"checkbox",checked:r.value,disabled:t.disabled||t.loading,required:t.required,"aria-required":t.required,"aria-checked":r.value,name:t.name,class:"base-switch__input",onChange:N,onFocus:$,onBlur:M,onKeydown:g},null,40,Ut),e.createElementVNode("div",Kt,[e.createElementVNode("div",Ht,[t.loading?(e.openBlock(),e.createElementBlock("div",Wt)):e.createCommentVNode("",!0)]),t.onLabel&&r.value?(e.openBlock(),e.createElementBlock("span",Zt,e.toDisplayString(t.onLabel),1)):e.createCommentVNode("",!0),t.offLabel&&!r.value?(e.openBlock(),e.createElementBlock("span",Xt,e.toDisplayString(t.offLabel),1)):e.createCommentVNode("",!0)])],8,Pt),t.label&&t.labelPosition==="right"?(e.openBlock(),e.createElementBlock("label",{key:1,for:e.unref(a),class:"base-switch__label base-switch__label--right"},[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",Qt,"*")):e.createCommentVNode("",!0)],8,Gt)):e.createCommentVNode("",!0)])]),c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["base-switch__helper",{"base-switch__helper--error":t.state==="error"||t.errorMessage}])},e.toDisplayString(c.value),3)):e.createCommentVNode("",!0)],2))}},Jt={class:"vsui base-segmented-buttons-wrapper"},ea={key:0,class:"base-segmented-buttons__label"},ta={key:0,class:"base-segmented-buttons__required"},aa=["id"],la=["disabled","onClick"],_e={__name:"BaseSegmentedButtons",props:{id:{type:String,default:""},modelValue:{type:[String,Number,Array],default:()=>[]},options:{type:Array,default:()=>[],required:!0},valueKey:{type:String,default:"value"},labelKey:{type:String,default:"label"},variant:{type:String,default:"primary",validator:t=>["primary","secondary","gray"].includes(t)},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)},disabled:{type:Boolean,default:!1},block:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},label:{type:String,default:null},helperText:{type:String,default:null},errorMessage:{type:String,default:null},rules:{type:Array,default:()=>[]},validateOnChange:{type:Boolean,default:!0}},emits:["update:modelValue","change","validation","mounted"],setup(t,{emit:w}){const l=t,{autoId:y}=Z("segmented-buttons",l),a=w,o=e.ref(""),i=e.ref(!1),r={required:f=>({valid:Array.isArray(f)?f.length>0:!!f,message:"This field is required"}),min:(f,p)=>({valid:!Array.isArray(f)||f.length>=p,message:`Select at least ${p} option${p>1?"s":""}`}),max:(f,p)=>({valid:!Array.isArray(f)||f.length<=p,message:`Select no more than ${p} option${p>1?"s":""}`})},m=f=>{if(!l.rules.length)return!0;for(const p of l.rules){if(typeof p=="string"){if(p.includes(":")){const[d,b]=p.split(":"),E=r[d];if(E){const v=E(f,parseInt(b,10));if(!v.valid)return o.value=v.message,!1}}else if(r[p]){const d=r[p](f);if(!d.valid)return o.value=d.message,!1}continue}if(typeof p=="object"){if(p.message){let d,b;for(const v in p)if(v!=="message"){d=v,b=p[v];break}const E=r[d];if(E){const v=E(f,b);if(!v.valid)return o.value=p.message||v.message,!1}}else if(typeof p.validator=="function"&&!p.validator(f))return o.value=p.message||"Invalid selection",!1}}return o.value="",!0},c=e.computed({get:()=>l.modelValue,set:f=>{if(a("update:modelValue",f),a("change",f),l.validateOnChange){i.value=!0;const p=m(f);a("validation",{valid:p,error:o.value})}}}),N=e.computed(()=>({"vsui base-segmented-buttons":!0,[`base-segmented-buttons--${l.size}`]:!0,"base-segmented-buttons--block":l.block,"base-segmented-buttons--disabled":l.disabled,"base-segmented-buttons--error":o.value&&i.value})),g=f=>typeof f=="object"&&f!==null?f[l.valueKey]:f,$=f=>typeof f=="object"&&f!==null?f[l.labelKey]||f[l.valueKey]||String(f):f,M=f=>{const p=g(f);return l.multiple?Array.isArray(l.modelValue)?typeof l.modelValue[0]=="object"&&l.modelValue[0]!==null?l.modelValue.some(d=>g(d)===p):l.modelValue.includes(p):!1:l.modelValue===null?!1:typeof l.modelValue=="object"&&l.modelValue!==null?g(l.modelValue)===p:l.modelValue===p},x=f=>{if(l.disabled)return;const p=g(f),d=typeof l.options[0]=="object"&&l.options[0]!==null;if(!l.multiple){c.value=M(f)?null:d?f:p;return}const b=Array.isArray(l.modelValue)?[...l.modelValue]:[];M(f)?typeof b[0]=="object"&&b[0]!==null?b.splice(b.findIndex(v=>g(v)===p),1):b.splice(b.indexOf(p),1):b.push(d?f:p),c.value=b},R=e.computed(()=>l.rules.some(f=>f==="required"?!0:typeof f=="object"?f.required||Object.keys(f)[0]==="required":!1)),j=e.computed(()=>o.value&&i.value?o.value:l.errorMessage||l.helperText),_=()=>{i.value=!0;const f=m(c.value);return a("validation",{valid:f,error:o.value}),f};return e.onMounted(()=>{a("mounted",{validate:_})}),(f,p)=>(e.openBlock(),e.createElementBlock("div",Jt,[t.label?(e.openBlock(),e.createElementBlock("label",ea,[e.createTextVNode(e.toDisplayString(t.label)+" ",1),R.value?(e.openBlock(),e.createElementBlock("span",ta,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",{id:e.unref(y),class:e.normalizeClass(N.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(d,b)=>(e.openBlock(),e.createElementBlock("button",{key:b,type:"button",class:e.normalizeClass(["base-segmented-buttons__button",[`base-segmented-buttons__button--${t.variant}`,{"base-segmented-buttons__button--selected":M(d),"base-segmented-buttons__button--first":b===0,"base-segmented-buttons__button--last":b===t.options.length-1,"base-segmented-buttons__button--middle":b>0&&b<t.options.length-1}]]),disabled:t.disabled,onClick:E=>x(d)},e.toDisplayString($(d)),11,la))),128))],10,aa),j.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["base-segmented-buttons__helper",{"base-segmented-buttons__helper--error":o.value&&i.value}])},e.toDisplayString(j.value),3)):e.createCommentVNode("",!0)]))}},oa={class:"base-color-picker__container"},na=["value"],sa={key:0,class:"base-color-picker__presets"},ra=["onClick"],Ne={__name:"BaseColorPicker",props:{id:{type:String,default:""},modelValue:{type:String,default:"#000000"},variant:{type:String,default:"default",validator:t=>["default","filled","outlined"].includes(t)},state:{type:String,default:null,validator:t=>["success","error","warning"].includes(t)},label:{type:String,default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},helperText:{type:String,default:null},errorMessage:{type:String,default:null},rules:{type:Array,default:()=>[]},name:{type:String,default:""},format:{type:String,default:"hex",validator:t=>["hex","rgb","rgba","hsl"].includes(t)},showPreview:{type:Boolean,default:!0},presets:{type:Array,default:()=>[]}},emits:["update:modelValue","focus","blur","input","validation","mounted"],setup(t,{emit:w}){const l=t,{autoId:y}=Z("color-picker",l),a=w,o=e.ref(null),i=e.ref(null),r=e.ref(!1),m=e.computed({get:()=>l.modelValue,set:E=>a("update:modelValue",E)}),c=e.computed(()=>({"vsui base-color-picker":!0,"base-color-picker--disabled":l.disabled,"base-color-picker--open":r.value})),N=E=>{m.value=E,a("input",{target:{value:E}})},g=E=>{const v=E.target.value;m.value=v,a("input",{target:{value:v}}),e.nextTick(()=>{var Y;(Y=i.value)!=null&&Y.validate&&i.value.validate()})},$=E=>{a("focus",E)},M=E=>{setTimeout(()=>{var v;r.value&&!((v=o.value)!=null&&v.contains(document.activeElement))&&(r.value=!1),a("blur",E)},100)},x=()=>{!l.disabled&&!l.readonly&&(r.value=!r.value,r.value&&e.nextTick(()=>{var E;(E=o.value)==null||E.focus()}))},R=E=>{let v=E;if(l.format!=="hex"&&E.startsWith("#")){const Y=E.replace("#",""),V=parseInt(Y.substring(0,2),16),q=parseInt(Y.substring(2,4),16),U=parseInt(Y.substring(4,6),16);if(l.format==="rgb")v=`rgb(${V}, ${q}, ${U})`;else if(l.format==="rgba")v=`rgba(${V}, ${q}, ${U}, 1)`;else if(l.format==="hsl"){const T=V/255,z=q/255,H=U/255,h=Math.max(T,z,H),S=Math.min(T,z,H);let k,I,O=(h+S)/2;if(h===S)k=I=0;else{const W=h-S;switch(I=O>.5?W/(2-h-S):W/(h+S),h){case T:k=(z-H)/W+(z<H?6:0);break;case z:k=(H-T)/W+2;break;case H:k=(T-z)/W+4;break}k=Math.round(k*60),I=Math.round(I*100),O=Math.round(O*100)}v=`hsl(${k}, ${I}%, ${O}%)`}}m.value=v,a("input",{target:{value:v}}),e.nextTick(()=>{var Y;(Y=i.value)!=null&&Y.validate&&i.value.validate()})},j=()=>{var E;(E=i.value)==null||E.focus()},_=E=>{a("validation",E)},f=E=>{i.value=E,a("mounted",{validate:E.validate,focus:j})},p=["#3b82f6","#9333ea","#22c55e","#f59e0b","#ef4444","#111827","#374151","#6b7280","#f3f4f6","#ffffff"],d=e.computed(()=>l.presets.length>0?l.presets:p),b=e.computed(()=>{const v={hex:"hexColor",rgb:"rgbColor",rgba:"rgbaColor",hsl:"hslColor"}[l.format];return l.rules.some(V=>typeof V=="string"&&V===v?!0:typeof V=="object"&&V!==null?Object.keys(V).some(q=>q===v):!1)?l.rules:[...l.rules,v]});return(E,v)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(c.value)},[e.createElementVNode("div",oa,[e.createVNode(te,{id:e.unref(y),modelValue:m.value,variant:t.variant,state:t.state,label:t.label,disabled:t.disabled,readonly:t.readonly,required:t.required,helperText:t.helperText,errorMessage:t.errorMessage,rules:b.value,name:t.name,"onUpdate:modelValue":N,onFocus:$,onBlur:M,onValidation:_,onMounted:f},e.createSlots({suffix:e.withCtx(()=>[e.createElementVNode("div",{class:"base-color-picker__icon",onClick:x},v[0]||(v[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("circle",{cx:"12",cy:"12",r:"3"})],-1)]))]),_:2},[t.showPreview?{name:"prefix",fn:e.withCtx(()=>[e.createElementVNode("div",{class:"base-color-picker__preview",style:e.normalizeStyle({backgroundColor:m.value}),onClick:x},null,4)]),key:"0"}:void 0]),1032,["id","modelValue","variant","state","label","disabled","readonly","required","helperText","errorMessage","rules","name"]),r.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"colorPickerRef",ref:o,class:"base-color-picker__popup",tabindex:"-1",onBlur:M},[e.createElementVNode("input",{type:"color",value:m.value,class:"base-color-picker__color-input",onInput:g},null,40,na),d.value.length>0?(e.openBlock(),e.createElementBlock("div",sa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(Y,V)=>(e.openBlock(),e.createElementBlock("div",{key:V,class:e.normalizeClass(["base-color-picker__preset",{"base-color-picker__preset--active":m.value===Y}]),style:e.normalizeStyle({backgroundColor:Y}),onClick:q=>R(Y)},null,14,ra))),128))])):e.createCommentVNode("",!0)],544)):e.createCommentVNode("",!0)])],2))}},ia={key:0,class:"base-combobox__label"},ca={key:0,class:"base-combobox__required","aria-hidden":"true"},da=["tabindex"],ua={key:0,class:"base-combobox__prefix"},ma={key:1,class:"base-combobox__tags"},fa=["onClick"],pa=["id","value","placeholder","disabled","readonly"],ba=["id"],ga={class:"base-combobox__suffix"},ya={key:0,class:"base-combobox__clear-container"},ha={key:1,class:"base-combobox__spinner"},ka={key:2,class:"base-combobox__suffix-content"},Ba={key:0,class:"base-combobox__loading"},Va={key:1,class:"base-combobox__no-data"},wa={key:2,class:"base-combobox__options"},Sa=["onClick","onMouseenter"],Ca={key:0,class:"base-combobox__option-check",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fe={__name:"BaseCombobox",props:{id:{type:String,default:""},modelValue:{type:[String,Number,Object,Array],default:null},options:{type:Array,default:()=>[]},variant:{type:String,default:"default",validator:t=>["default","filled","outlined"].includes(t)},state:{type:String,default:null,validator:t=>["success","error","warning"].includes(t)},label:{type:String,default:null},placeholder:{type:String,default:"Select an option..."},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},helperText:{type:String,default:null},errorMessage:{type:String,default:null},prefixIcon:{type:String,default:null},suffixIcon:{type:String,default:null},rules:{type:Array,default:()=>[]},validateOnBlur:{type:Boolean,default:!0},validateOnInput:{type:Boolean,default:!1},name:{type:String,default:""},multiple:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},valueKey:{type:String,default:"value"},labelKey:{type:String,default:"label"},noDataText:{type:String,default:"No options found"},maxHeight:{type:String,default:"200px"},minDropdownWidth:{type:[String,Number],default:200},wrapOptionText:{type:Boolean,default:!0},closeOnSelect:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},showTags:{type:Boolean,default:!1},removeSpecialChars:{type:Boolean,default:!1},selectedSingleText:{type:String,default:"1 item selected"},selectedMultipleText:{type:[String,Function],default:null}},emits:["update:modelValue","focus","blur","input","validation","mounted","search","clear","select"],setup(t,{emit:w}){const l=e.useSlots(),{getValidationMessage:y}=de(),a=t,{autoId:o}=Z("combobox",a),i=w,r=e.ref(null),m=e.ref(null),c=e.ref(null),N=e.ref(!1),g=e.ref(!1),$=e.ref(""),M=e.ref(""),x=e.ref(-1),R={required:u=>({valid:!!u||Array.isArray(u)&&u.length>0,message:y("required")}),min:(u,C)=>({valid:!u||u.length>=C,message:y("min",C)}),max:(u,C)=>({valid:!u||u.length<=C,message:y("max",C)}),minValue:(u,C)=>({valid:!u||Number(u)>=C,message:y("minValue",C)}),maxValue:(u,C)=>({valid:!u||Number(u)<=C,message:y("maxValue",C)})},j=u=>{if(!a.rules.length)return!0;for(const C of a.rules){if(typeof C=="string"){const A=R[C];if(A){const K=A(u);if(!K.valid)return $.value=K.message,!1}continue}if(typeof C=="object"){const[A,K]=Object.entries(C)[0],X=R[A];if(X){const Q=X(u,K);if(!Q.valid)return $.value=C.message||Q.message,!1}if(typeof C.validator=="function"&&!C.validator(u))return $.value=C.message||"Invalid value",!1}}return $.value="",!0},_=u=>typeof u=="object"&&u!==null?u[a.valueKey]:u,f=u=>typeof u=="object"&&u!==null&&(u[a.labelKey]||u[a.valueKey])||String(u),p=u=>u.replace(/[^\w\s]/g,"").toLowerCase().trim(),d=e.computed(()=>{if(!a.searchable||!M.value.trim())return a.options;const u=a.removeSpecialChars?p(M.value):M.value.toLowerCase().trim();return a.options.filter(C=>(a.removeSpecialChars?p(f(C)):f(C).toLowerCase()).includes(u))}),b=e.computed(()=>{if(!a.modelValue)return[];if(a.multiple)return Array.isArray(a.modelValue)?a.modelValue.map(u=>typeof u=="object"?u:a.options.find(C=>_(C)===u)||u):[];{if(typeof a.modelValue=="object")return[a.modelValue];const u=a.options.find(C=>_(C)===a.modelValue);return u?[u]:[]}}),E=e.computed(()=>a.searchable&&N.value&&g.value?M.value:b.value.length?a.multiple?!a.showTags&&b.value.length>0?b.value.length===1?a.selectedSingleText:typeof a.selectedMultipleText=="function"?a.selectedMultipleText(b.value.length):a.selectedMultipleText?a.selectedMultipleText.replace("{count}",b.value.length):`${b.value.length} items selected`:"":f(b.value[0]):""),v=e.computed(()=>({"vsui base-combobox":!0,[`base-combobox--${a.variant}`]:!0,[`base-combobox--${Y.value}`]:Y.value,"base-combobox--disabled":a.disabled,"base-combobox--focused":N.value,"base-combobox--open":g.value,"base-combobox--multiple":a.multiple,"base-combobox--with-prefix":a.prefixIcon||l.prefix,"base-combobox--with-suffix":a.suffixIcon||l.suffix||a.clearable})),Y=e.computed(()=>$.value?"error":a.state),V=e.computed(()=>$.value?$.value:a.errorMessage||a.helperText),q=e.computed(()=>a.required?!0:a.rules.some(u=>u==="required"?!0:typeof u=="object"?u.required||Object.keys(u)[0]==="required":!1)),U=e.computed(()=>a.clearable&&!a.disabled&&!a.readonly&&(a.multiple&&b.value.length>0||!a.multiple&&a.modelValue));let T=null,z=null;const H=()=>{z||(z=setTimeout(()=>{h(),z=null},16))},h=()=>{if(!c.value||!r.value)return;const u=r.value.getBoundingClientRect(),C={width:window.innerWidth,height:window.innerHeight};(!T||T.width!==C.width||T.height!==C.height)&&(T=C);const A=typeof a.minDropdownWidth=="string"?parseInt(a.minDropdownWidth):a.minDropdownWidth,K=Math.max(u.width,A);c.value.style.width=`${K}px`,c.value.style.top="100%",c.value.style.bottom="auto",c.value.style.left="0",c.value.style.right="auto",c.value.style.marginTop="0.25rem",c.value.style.marginBottom="0",u.left+K>T.width&&(c.value.style.right="0",c.value.style.left="auto");const X=c.value.offsetHeight;u.bottom+X>T.height&&(c.value.style.bottom="100%",c.value.style.top="auto",c.value.style.marginTop="0",c.value.style.marginBottom="0.25rem")},S=()=>{a.disabled||a.readonly||(g.value=!0,x.value=-1,e.nextTick(()=>{var u;a.searchable&&(M.value="",(u=m.value)==null||u.focus()),h(),document.addEventListener("click",I)}))},k=()=>{g.value=!1,x.value=-1,M.value="",document.removeEventListener("click",I)},I=u=>{r.value&&!r.value.contains(u.target)&&c.value&&!c.value.contains(u.target)&&(k(),ae())},O=()=>{a.disabled||a.readonly||(g.value?k():S())},W=u=>{N.value=!0,i("focus",u)},ae=u=>{if(!g.value&&(N.value=!1,i("blur",u),a.validateOnBlur)){const C=j(a.modelValue);i("validation",{valid:C,error:$.value})}},ce=u=>{if(M.value=u.target.value,x.value=-1,i("search",M.value),i("input",u),a.validateOnInput){const C=j(a.modelValue);i("validation",{valid:C,error:$.value})}},n=u=>{const C=_(u);let A;if(a.multiple){const K=Array.isArray(a.modelValue)?[...a.modelValue]:[],X=K.findIndex(Q=>typeof Q=="object"?_(Q)===C:Q===C);X>=0?K.splice(X,1):K.push(C),A=K}else A=C;i("update:modelValue",A),e.nextTick(()=>{if(a.closeOnSelect&&(k(),ae()),i("select",u),a.validateOnInput){const K=j(A);i("validation",{valid:K,error:$.value})}})},s=u=>{const C=_(u);return a.multiple?Array.isArray(a.modelValue)?a.modelValue.some(A=>typeof A=="object"?_(A)===C:A===C):!1:typeof a.modelValue=="object"?_(a.modelValue)===C:a.modelValue===C},B=()=>{if(i("update:modelValue",a.multiple?[]:null),i("clear"),a.validateOnInput){const u=j(a.multiple?[]:null);i("validation",{valid:u,error:$.value})}},D=u=>{if(!a.multiple)return;const C=Array.isArray(a.modelValue)?[...a.modelValue]:[],A=_(u),K=C.findIndex(X=>typeof X=="object"?_(X)===A:X===A);K>=0&&(C.splice(K,1),i("update:modelValue",C))},F=u=>{if(!(a.disabled||a.readonly))switch(u.key){case"ArrowDown":u.preventDefault(),g.value?x.value=Math.min(x.value+1,d.value.length-1):S();break;case"ArrowUp":u.preventDefault(),g.value&&(x.value=Math.max(x.value-1,-1));break;case"Enter":u.preventDefault(),g.value&&x.value>=0?n(d.value[x.value]):g.value||S();break;case"Escape":u.preventDefault(),k();break;case"Tab":g.value&&k();break}},P=()=>{const u=j(a.modelValue);return i("validation",{valid:u,error:$.value,name:a.name}),u},G=()=>{var u,C;a.searchable&&g.value?(u=m.value)==null||u.focus():(C=r.value)==null||C.focus()};return e.watch(()=>a.modelValue,(u,C)=>{u!==C&&a.validateOnInput&&j(u)},{deep:!0}),e.onMounted(()=>{window.addEventListener("scroll",H,!0),window.addEventListener("resize",H),i("mounted",{validate:P,focus:G,open:S,close:k})}),e.onUnmounted(()=>{document.removeEventListener("click",I),window.removeEventListener("scroll",H,!0),window.removeEventListener("resize",H),z&&(clearTimeout(z),z=null)}),(u,C)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(v.value)},[t.label?(e.openBlock(),e.createElementBlock("label",ia,[e.createTextVNode(e.toDisplayString(t.label)+" ",1),q.value?(e.openBlock(),e.createElementBlock("span",ca,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"comboboxRef",ref:r,class:"base-combobox__wrapper",tabindex:t.searchable&&g.value?-1:0,onClick:O,onFocus:W,onKeydown:F},[u.$slots.prefix||t.prefixIcon?(e.openBlock(),e.createElementBlock("div",ua,[e.renderSlot(u.$slots,"prefix",{},()=>[e.createElementVNode("i",{class:e.normalizeClass(t.prefixIcon)},null,2)])])):e.createCommentVNode("",!0),t.multiple&&b.value.length>0&&t.showTags?(e.openBlock(),e.createElementBlock("div",ma,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,A=>(e.openBlock(),e.createElementBlock("span",{key:_(A),class:"base-combobox__tag"},[e.createTextVNode(e.toDisplayString(f(A))+" ",1),e.createElementVNode("button",{type:"button",class:"base-combobox__tag-remove",onClick:e.withModifiers(K=>D(A),["stop"])}," × ",8,fa)]))),128))])):e.createCommentVNode("",!0),t.searchable&&(!(t.multiple&&b.value.length>0&&t.showTags)||g.value)?(e.openBlock(),e.createElementBlock("input",{key:2,id:e.unref(o),ref_key:"inputRef",ref:m,value:E.value,placeholder:t.placeholder,disabled:t.disabled,readonly:t.readonly||!g.value&&!t.searchable,class:"base-combobox__field",onInput:ce,onFocus:W,onBlur:ae},null,40,pa)):!t.searchable&&!(t.multiple&&b.value.length>0&&t.showTags)?(e.openBlock(),e.createElementBlock("div",{key:3,id:e.unref(o),class:e.normalizeClass(["base-combobox__field base-combobox__field--display",{"base-combobox__field--placeholder":!E.value}])},e.toDisplayString(E.value||t.placeholder),11,ba)):e.createCommentVNode("",!0),e.createElementVNode("div",ga,[t.clearable?(e.openBlock(),e.createElementBlock("div",ya,[U.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"base-combobox__clear",onClick:e.withModifiers(B,["stop"])}," × ")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),t.loading?(e.openBlock(),e.createElementBlock("div",ha,C[0]||(C[0]=[e.createElementVNode("div",{class:"spinner"},null,-1)]))):e.createCommentVNode("",!0),u.$slots.suffix||t.suffixIcon?(e.openBlock(),e.createElementBlock("div",ka,[e.renderSlot(u.$slots,"suffix",{},()=>[e.createElementVNode("i",{class:e.normalizeClass(t.suffixIcon)},null,2)])])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["base-combobox__arrow",{"base-combobox__arrow--open":g.value}])},C[1]||(C[1]=[e.createElementVNode("svg",{viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)]),2)])],40,da),e.createVNode(e.Transition,{name:"combobox-dropdown"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"menuRef",ref:c,class:"base-combobox__menu",style:e.normalizeStyle({maxHeight:t.maxHeight})},[t.loading?(e.openBlock(),e.createElementBlock("div",Ba,C[2]||(C[2]=[e.createElementVNode("div",{class:"spinner"},null,-1),e.createElementVNode("span",null,"Loading...",-1)]))):d.value.length===0?(e.openBlock(),e.createElementBlock("div",Va,e.toDisplayString(t.noDataText),1)):(e.openBlock(),e.createElementBlock("div",wa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(A,K)=>(e.openBlock(),e.createElementBlock("div",{key:_(A),class:e.normalizeClass(["base-combobox__option",{"base-combobox__option--selected":s(A),"base-combobox__option--highlighted":x.value===K}]),onClick:e.withModifiers(X=>n(A),["stop"]),onMouseenter:X=>x.value=K},[e.renderSlot(u.$slots,"option",{option:A,selected:s(A)},()=>[e.createElementVNode("span",{class:e.normalizeClass(["base-combobox__option-label",{"base-combobox__option-label--wrap":t.wrapOptionText}])},e.toDisplayString(f(A)),3),s(A)?(e.openBlock(),e.createElementBlock("svg",Ca,C[3]||(C[3]=[e.createElementVNode("path",{d:"M11.6666 3.5L5.24992 9.91667L2.33325 7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))):e.createCommentVNode("",!0)])],42,Sa))),128))]))],4),[[e.vShow,g.value]])]),_:3}),V.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["base-combobox__helper",{"base-combobox__helper--error":$.value}])},e.toDisplayString(V.value),3)):e.createCommentVNode("",!0)],2))}},Ea={key:0,class:"base-otp__label"},$a={key:0,class:"base-otp__required","aria-hidden":"true"},xa={class:"base-otp__wrapper"},_a=["id","type","onUpdate:modelValue","disabled","readonly","required","onInput","onKeydown","onFocus"],Na={key:2,class:"base-otp__instructions"},ve={__name:"BaseOTP",props:{id:{type:String,default:""},modelValue:{type:String,default:""},length:{type:Number,default:6},variant:{type:String,default:"default",validator:t=>["default","filled"].includes(t)},state:{type:String,default:null,validator:t=>["success","error","warning"].includes(t)},label:{type:String,default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},helperText:{type:String,default:null},errorMessage:{type:String,default:null},autoFocus:{type:Boolean,default:!1},type:{type:String,default:"number",validator:t=>["text","number","password"].includes(t)},instructions:{type:String,default:"Press Shift+Backspace to clear all fields"}},emits:["update:modelValue","complete","validation","mounted"],setup(t,{emit:w}){const l=t,{autoId:y}=Z("otp",l),a=w,o=e.ref([]),i=e.ref(!1),r=e.computed(()=>i.value),m=e.ref(0),c=e.ref(""),N=e.computed({get:()=>l.modelValue||"",set:V=>a("update:modelValue",V)}),g=e.computed(()=>{const V=N.value.split("");return Array.from({length:l.length},(q,U)=>V[U]||"")}),$=e.computed(()=>({"vsui base-otp":!0,[`base-otp--${l.variant}`]:!0,[`base-otp--${j.value}`]:j.value,"base-otp--disabled":l.disabled,"base-otp--focused":r.value})),M=e.computed(()=>({"base-otp__field":!0,"base-otp__field--focused":i.value})),x={incomplete:"Please enter the complete code",partialIncomplete:"Please complete the code or leave it empty"},R=()=>{const V=N.value.length===l.length,U=!(N.value.length===0)&&!V;return l.required&&!V?(c.value=l.errorMessage||x.incomplete,!1):!l.required&&U?(c.value=l.errorMessage||x.partialIncomplete,!1):(c.value="",!0)},j=e.computed(()=>c.value?"error":l.state),_=e.computed(()=>c.value?c.value:l.errorMessage||l.helperText),f=(V,q)=>{const U=q.target.value.slice(-1),T=g.value.map((z,H)=>H===V?U:z).join("");N.value=T,U&&V<l.length-1&&(o.value[V+1].focus(),m.value=V+1),T.length===l.length&&a("complete",T),R(),a("validation",{valid:!c.value,error:c.value})},p=(V,q)=>{if(q.key==="Backspace"){if(q.shiftKey){N.value="",m.value=0,o.value[0]&&o.value[0].focus(),R(),a("validation",{valid:!c.value,error:c.value});return}!g.value[V]&&V>0&&(o.value[V-1].focus(),m.value=V-1)}else if(q.key==="Delete"&&q.shiftKey){N.value="",m.value=0,o.value[0]&&o.value[0].focus(),R(),a("validation",{valid:!c.value,error:c.value});return}else q.key==="ArrowLeft"&&V>0?(o.value[V-1].focus(),m.value=V-1):q.key==="ArrowRight"&&V<l.length-1&&(o.value[V+1].focus(),m.value=V+1)},d=V=>{V.preventDefault();const U=(V.clipboardData||window.clipboardData).getData("text").slice(0,l.length).split(""),T=Array.from({length:l.length},(H,h)=>U[h]||g.value[h]||"").join("");N.value=T;const z=T.length<l.length?T.length:l.length-1;o.value[z]&&(o.value[z].focus(),m.value=z),R(),a("validation",{valid:!c.value,error:c.value}),T.length===l.length&&a("complete",T)},b=V=>{i.value=!0,m.value=V},E=()=>{i.value=!1,R(),a("validation",{valid:!c.value,error:c.value})},v=()=>{N.value="",m.value=0,c.value="",o.value[0]&&o.value[0].focus()},Y=()=>{o.value[0]&&(o.value[0].focus(),m.value=0)};return e.watch(()=>l.modelValue,V=>{R(),V===""&&(m.value=0,c.value="")}),e.onMounted(()=>{o.value=Array.from({length:l.length}),l.autoFocus&&setTimeout(()=>{Y()},0),a("mounted",{validate:R,focus:Y,reset:v})}),(V,q)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass($.value)},[t.label?(e.openBlock(),e.createElementBlock("label",Ea,[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",$a,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",xa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.length,(U,T)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:T,ref_for:!0,ref:z=>o.value[T]=z,id:`${e.unref(y)}-${T}`,type:l.type,"onUpdate:modelValue":z=>g.value[T]=z,maxlength:"1",disabled:l.disabled,readonly:l.readonly,required:l.required,class:e.normalizeClass(M.value),onInput:z=>f(T,z),onKeydown:z=>p(T,z),onFocus:z=>b(T),onBlur:E,onPaste:d},null,42,_a)),[[e.vModelDynamic,g.value[T]]])),128))]),_.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["base-otp__helper",{"base-otp__helper--error":c.value}])},e.toDisplayString(_.value),3)):e.createCommentVNode("",!0),l.instructions&&!c.value?(e.openBlock(),e.createElementBlock("div",Na,e.toDisplayString(l.instructions),1)):e.createCommentVNode("",!0)],2))}},va=["id"],Ma={key:0,class:"base-table__header"},Da={class:"base-table__search"},Ta={class:"base-table__container"},Ia={class:"base-table__table"},za={class:"base-table__thead"},Aa={class:"base-table__tr"},La={key:0,class:"base-table__th base-table__th--checkbox"},Ya=["onClick"],qa={class:"base-table__th-content"},Oa={key:0,class:"base-table__sort-icon"},Fa={key:0,class:"base-table__filter"},Ra={key:1,class:"base-table__th base-table__th--actions"},ja={class:"base-table__tbody"},Pa={key:0,class:"base-table__td"},Ua={key:1,class:"base-table__td"},Ka=["onClick"],Ha={key:0,class:"base-table__td base-table__td--checkbox"},Wa={key:1,class:"base-table__td base-table__td--actions"},Za={class:"base-table__actions"},Xa={key:2,class:"base-table__tr base-table__tr--empty"},Ga=["colspan"],Qa={class:"base-table__empty"},Ja={key:1,class:"base-table__pagination"},el={key:0,class:"base-table__pagination-info"},tl={key:1,class:"base-table__page-size"},al={class:"base-table__pagination-nav"},ll={class:"base-table__pagination-pages"},Me=Object.assign({inheritAttrs:!1},{__name:"BaseTable",props:{id:{type:String,default:""},columns:{type:Array,required:!0,validator:t=>t.every(w=>w.key&&w.label)},data:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1},variant:{type:String,default:"default",validator:t=>["default","striped","bordered"].includes(t)},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)},sortable:{type:Boolean,default:!0},filterable:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},pagination:{type:Object,default:()=>({enabled:!0,pageSize:10,pageSizeOptions:[5,10,25,50,100],showTotal:!0,showPageSizeSelector:!0,showFirstLastButtons:!0})},responsive:{type:Boolean,default:!0},emptyMessage:{type:String,default:"No data found"},loadingRows:{type:Number,default:5},scrollOnPageChange:{type:Boolean,default:!0}},emits:["sort","filter","select","select-all","page-change","page-size-change","row-click","action-click"],setup(t,{emit:w}){const l=t,{autoId:y}=Z("table",l),a=w,o=e.ref({column:null,direction:null}),i=e.ref({}),r=e.ref(new Set),m=e.ref(1),c=e.ref(l.pagination.pageSize),N=e.ref(""),g=e.ref(null),$=e.computed(()=>{let h=[...l.data];if(N.value){const S=N.value.toLowerCase();h=h.filter(k=>l.columns.some(I=>{const O=f(k,I.key);return String(O).toLowerCase().includes(S)}))}return Object.entries(i.value).forEach(([S,k])=>{k&&(h=h.filter(I=>{const O=f(I,S);return String(O).toLowerCase().includes(String(k).toLowerCase())}))}),o.value.column&&h.sort((S,k)=>{const I=f(S,o.value.column),O=f(k,o.value.column);if(I===O)return 0;const W=I>O?1:-1;return o.value.direction==="desc"?-W:W}),h}),M=e.computed(()=>l.pagination.enabled?Math.ceil($.value.length/c.value):1),x=e.computed(()=>{if(!l.pagination.enabled)return $.value;const h=(m.value-1)*c.value,S=h+c.value;return $.value.slice(h,S)}),R=e.computed(()=>{if(!l.pagination.enabled)return null;const h=Math.min((m.value-1)*c.value+1,$.value.length),S=Math.min(m.value*c.value,$.value.length),k=$.value.length;return{start:h,end:S,total:k}}),j=e.computed(()=>x.value.length>0&&x.value.every(h=>r.value.has(p(h)))),_=e.computed(()=>r.value.size>0&&!j.value),f=(h,S)=>S.split(".").reduce((k,I)=>k==null?void 0:k[I],h)??"",p=(h,S)=>h.id??S,d=()=>{l.scrollOnPageChange&&g.value&&g.value.scrollIntoView({behavior:"smooth",block:"start"})},b=()=>{l.scrollOnPageChange&&setTimeout(()=>{d()},100)},E=h=>{!l.sortable||h.sortable===!1||(o.value.column===h.key?o.value.direction=o.value.direction==="asc"?"desc":"asc":(o.value.column=h.key,o.value.direction="asc"),a("sort",{column:h.key,direction:o.value.direction}))},v=(h,S)=>{i.value[h]=S,m.value=1,a("filter",{column:h,value:S})},Y=(h,S)=>{const k=p(h,S);r.value.has(k)?r.value.delete(k):r.value.add(k),a("select",{row:h,selected:r.value.has(k),selectedRows:Array.from(r.value)})},V=()=>{j.value?x.value.forEach((h,S)=>{r.value.delete(p(h,S))}):x.value.forEach((h,S)=>{r.value.add(p(h,S))}),a("select-all",{selected:!j.value,selectedRows:Array.from(r.value)})},q=h=>{m.value=h,a("page-change",h),b()},U=h=>{c.value=h,m.value=1,a("page-size-change",h),b()},T=(h,S)=>{a("row-click",{row:h,index:S})},z=(h,S,k)=>{a("action-click",{action:h,row:S,index:k})},H=h=>o.value.column!==h.key?"↕️":o.value.direction==="asc"?"↑":"↓";return e.watch(()=>l.data,()=>{r.value.clear()},{deep:!0}),e.watch(i,()=>{m.value=1},{deep:!0}),(h,S)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(y),ref_key:"tableRef",ref:g,class:e.normalizeClass(["vsui base-table",[`base-table--${t.variant}`,`base-table--${t.size}`,{"base-table--loading":t.loading,"base-table--responsive":t.responsive,"base-table--selectable":t.selectable},h.$attrs.class]])},[t.filterable||h.$slots.header?(e.openBlock(),e.createElementBlock("div",Ma,[e.renderSlot(h.$slots,"header",{},()=>[e.createElementVNode("div",Da,[e.createVNode(te,{modelValue:N.value,"onUpdate:modelValue":S[0]||(S[0]=k=>N.value=k),placeholder:"Search...","prefix-icon":"🔍"},null,8,["modelValue"])])])])):e.createCommentVNode("",!0),e.createElementVNode("div",Ta,[e.createElementVNode("table",Ia,[e.createElementVNode("thead",za,[e.createElementVNode("tr",Aa,[t.selectable?(e.openBlock(),e.createElementBlock("th",La,[e.createVNode(ee,{"model-value":j.value,indeterminate:_.value,"onUpdate:modelValue":V},null,8,["model-value","indeterminate"])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,k=>(e.openBlock(),e.createElementBlock("th",{key:k.key,class:e.normalizeClass(["base-table__th",{"base-table__th--sortable":t.sortable&&k.sortable!==!1,"base-table__th--sorted":o.value.column===k.key}]),onClick:I=>E(k)},[e.createElementVNode("div",qa,[e.createElementVNode("span",null,e.toDisplayString(k.label),1),t.sortable&&k.sortable!==!1?(e.openBlock(),e.createElementBlock("span",Oa,e.toDisplayString(H(k)),1)):e.createCommentVNode("",!0)]),t.filterable&&k.filterable!==!1?(e.openBlock(),e.createElementBlock("div",Fa,[e.createVNode(te,{placeholder:`Filter ${k.label.toLowerCase()}...`,"model-value":i.value[k.key]||"","onUpdate:modelValue":I=>v(k.key,I),onClick:S[1]||(S[1]=e.withModifiers(()=>{},["stop"]))},null,8,["placeholder","model-value","onUpdate:modelValue"])])):e.createCommentVNode("",!0)],10,Ya))),128)),h.$slots.actions?(e.openBlock(),e.createElementBlock("th",Ra,"Actions")):e.createCommentVNode("",!0)])]),e.createElementVNode("tbody",ja,[t.loading?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.loadingRows,k=>(e.openBlock(),e.createElementBlock("tr",{key:`loading-${k}`,class:"base-table__tr base-table__tr--loading"},[t.selectable?(e.openBlock(),e.createElementBlock("td",Pa,[e.createVNode(ee,{disabled:""})])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,I=>(e.openBlock(),e.createElementBlock("td",{key:I.key,class:"base-table__td"},[e.createVNode(ne,{variant:"text",rounded:""})]))),128)),h.$slots.actions?(e.openBlock(),e.createElementBlock("td",Ua,[e.createVNode(ne,{variant:"text",rounded:""})])):e.createCommentVNode("",!0)]))),128)):x.value.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(x.value,(k,I)=>(e.openBlock(),e.createElementBlock("tr",{key:p(k,I),class:e.normalizeClass(["base-table__tr",{"base-table__tr--selected":t.selectable&&r.value.has(p(k,I))}]),onClick:O=>T(k,I)},[t.selectable?(e.openBlock(),e.createElementBlock("td",Ha,[e.createVNode(ee,{"model-value":r.value.has(p(k,I)),"onUpdate:modelValue":O=>Y(k,I),onClick:S[2]||(S[2]=e.withModifiers(()=>{},["stop"]))},null,8,["model-value","onUpdate:modelValue"])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,O=>(e.openBlock(),e.createElementBlock("td",{key:O.key,class:e.normalizeClass(["base-table__td",O.class])},[e.renderSlot(h.$slots,`cell-${O.key}`,{row:k,column:O,value:f(k,O.key),index:I},()=>[e.createTextVNode(e.toDisplayString(O.formatter?O.formatter(f(k,O.key),k):f(k,O.key)),1)])],2))),128)),h.$slots.actions?(e.openBlock(),e.createElementBlock("td",Wa,[e.createElementVNode("div",Za,[e.renderSlot(h.$slots,"actions",{row:k,index:I,handleAction:O=>z(O,k,I)})])])):e.createCommentVNode("",!0)],10,Ka))),128)):(e.openBlock(),e.createElementBlock("tr",Xa,[e.createElementVNode("td",{colspan:t.columns.length+(t.selectable?1:0)+(h.$slots.actions?1:0),class:"base-table__td base-table__td--empty"},[e.renderSlot(h.$slots,"empty",{},()=>[e.createElementVNode("div",Qa,[e.createElementVNode("p",null,e.toDisplayString(t.emptyMessage),1)])])],8,Ga)]))])])]),t.pagination.enabled&&!t.loading&&x.value.length>0?(e.openBlock(),e.createElementBlock("div",Ja,[t.pagination.showTotal?(e.openBlock(),e.createElementBlock("div",el," Showing "+e.toDisplayString(R.value.start)+" - "+e.toDisplayString(R.value.end)+" of "+e.toDisplayString(R.value.total)+" results ",1)):e.createCommentVNode("",!0),t.pagination.showPageSizeSelector?(e.openBlock(),e.createElementBlock("div",tl,[S[7]||(S[7]=e.createElementVNode("label",null,"Items per page:",-1)),e.createVNode(fe,{"model-value":c.value,options:t.pagination.pageSizeOptions,"onUpdate:modelValue":U,class:"base-table__page-size-select"},null,8,["model-value","options"])])):e.createCommentVNode("",!0),e.createElementVNode("div",al,[t.pagination.showFirstLastButtons&&M.value>2?(e.openBlock(),e.createBlock(J,{key:0,variant:"outline",size:"small",disabled:m.value===1,onClick:S[3]||(S[3]=k=>q(1)),title:"First page"},{default:e.withCtx(()=>S[8]||(S[8]=[e.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("polyline",{points:"11,17 6,12 11,7"}),e.createElementVNode("polyline",{points:"18,17 13,12 18,7"})],-1)])),_:1},8,["disabled"])):e.createCommentVNode("",!0),e.createVNode(J,{variant:"outline",size:"small",disabled:m.value===1,onClick:S[4]||(S[4]=k=>q(m.value-1)),title:"Previous page"},{default:e.withCtx(()=>S[9]||(S[9]=[e.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("polyline",{points:"15,18 9,12 15,6"})],-1)])),_:1},8,["disabled"]),e.createElementVNode("span",ll," Page "+e.toDisplayString(m.value)+" of "+e.toDisplayString(M.value),1),e.createVNode(J,{variant:"outline",size:"small",disabled:m.value===M.value,onClick:S[5]||(S[5]=k=>q(m.value+1)),title:"Next page"},{default:e.withCtx(()=>S[10]||(S[10]=[e.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("polyline",{points:"9,18 15,12 9,6"})],-1)])),_:1},8,["disabled"]),t.pagination.showFirstLastButtons&&M.value>2?(e.openBlock(),e.createBlock(J,{key:1,variant:"outline",size:"small",disabled:m.value===M.value,onClick:S[6]||(S[6]=k=>q(M.value)),title:"Last page"},{default:e.withCtx(()=>S[11]||(S[11]=[e.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("polyline",{points:"13,17 18,12 13,7"}),e.createElementVNode("polyline",{points:"6,17 11,12 6,7"})],-1)])),_:1},8,["disabled"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)],10,va))}}),ol=["id","title"],nl=["src","alt"],sl={key:1,class:"base-avatar__initials"},De={__name:"BaseAvatar",props:{id:{type:String,default:""},src:{type:String,default:null},alt:{type:String,default:""},name:{type:String,default:""},variant:{type:String,default:"default",validator:t=>["default","filled","outlined"].includes(t)},size:{type:String,default:"medium",validator:t=>["small","medium","large","xlarge"].includes(t)},shape:{type:String,default:"circle",validator:t=>["circle","square","rounded"].includes(t)},status:{type:String,default:null,validator:t=>["online","offline","away","busy"].includes(t)},disabled:{type:Boolean,default:!1},fallback:{type:String,default:null}},emits:["error","load"],setup(t,{emit:w}){const l=t,{autoId:y}=Z("avatar",l),a=w,o=e.computed(()=>!!l.src),i=e.computed(()=>{if(!l.name&&!l.fallback)return"?";const $=(l.name||l.fallback).trim().split(" ");return $.length===1?$[0].charAt(0).toUpperCase():($[0].charAt(0)+$[$.length-1].charAt(0)).toUpperCase()}),r=e.computed(()=>({"vsui base-avatar":!0,[`base-avatar--${l.variant}`]:!0,[`base-avatar--${l.size}`]:!0,[`base-avatar--${l.shape}`]:!0,"base-avatar--disabled":l.disabled,"base-avatar--has-image":o.value})),m=e.computed(()=>({"base-avatar__status":!0,[`base-avatar__status--${l.status}`]:l.status})),c=g=>{a("error",g)},N=g=>{a("load",g)};return(g,$)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(y),class:e.normalizeClass(r.value),title:t.name||t.alt},[o.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.src,alt:t.alt||t.name,class:"base-avatar__image",onError:c,onLoad:N},null,40,nl)):(e.openBlock(),e.createElementBlock("div",sl,e.toDisplayString(i.value),1)),t.status&&!t.disabled?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(m.value)},null,2)):e.createCommentVNode("",!0),e.renderSlot(g.$slots,"default")],10,ol))}},pe={__name:"ToastsContainer",setup(t){const{toasts:w,removeToast:l}=$e(),y=e.computed(()=>{const a={"top-right":[],"top-left":[],"top-center":[],"bottom-right":[],"bottom-left":[],"bottom-center":[]};return w.value.forEach(o=>{a[o.position].push(o)}),a});return(a,o)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(i,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r},[i.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["vsui toasts-container",`toasts-container--${r}`])},[e.createVNode(e.TransitionGroup,{name:"toast"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,m=>(e.openBlock(),e.createBlock(e.unref(ue),e.mergeProps({key:m.id,ref_for:!0},m,{onClose:c=>e.unref(l)(m.id)}),null,16,["onClose"]))),128))]),_:2},1024)],2)):e.createCommentVNode("",!0)],64))),128))}},rl={install(t){t.component("BaseAccordion",ge),t.component("BaseAccordionItem",ye),t.component("BaseButton",J),t.component("BaseCheckbox",ee),t.component("BaseDropdown",he),t.component("BaseInfiniteScroll",ke),t.component("BaseInput",te),t.component("BasePopup",Be),t.component("BaseSkeleton",ne),t.component("BaseSlider",Ve),t.component("BaseTextarea",we),t.component("BaseToast",ue),t.component("ToastsContainer",pe),t.component("BaseSegmentedButtons",_e),t.component("BaseColorPicker",Ne),t.component("BaseCombobox",fe),t.component("BaseOTP",ve),t.component("BaseTable",Me),t.component("BaseAvatar",De),t.component("BaseSwitch",xe)}};L.BaseAccordion=ge,L.BaseAccordionItem=ye,L.BaseAvatar=De,L.BaseButton=J,L.BaseCheckbox=ee,L.BaseColorPicker=Ne,L.BaseCombobox=fe,L.BaseDropdown=he,L.BaseInfiniteScroll=ke,L.BaseInput=te,L.BaseOTP=ve,L.BasePopup=Be,L.BaseSegmentedButtons=_e,L.BaseSkeleton=ne,L.BaseSlider=Ve,L.BaseSwitch=xe,L.BaseTable=Me,L.BaseTextarea=we,L.BaseToast=ue,L.ToastsContainer=pe,L.default=rl,L.useToast=$e,L.useToastConfig=Ce,L.useValidationConfig=de,Object.defineProperties(L,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});