@opengis/form 0.0.71 → 0.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- (function(Z,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],e):(Z=typeof globalThis<"u"?globalThis:Z||self,e(Z.FormBuilder={},Z.Vue,Z.OpenGISCore))})(this,function(Z,e,ee){"use strict";const dl={class:"w-full relative"},ul={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},pl={class:"opacity-100"},hl={key:0,class:"text-red-500 text-[14px]"},ml={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},fl=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){const t=e.ref("uk"),l=n=>{n.detail.key==="locale"&&(t.value=n.detail.newValue)};return e.onMounted(()=>{t.value=localStorage.locale,window.addEventListener("storage",l)}),e.onUnmounted(()=>{window.removeEventListener("resize",l)}),(n,o)=>(e.openBlock(),e.createElementBlock("div",dl,[n.ua||n.label?(e.openBlock(),e.createElementBlock("div",ul,[e.createElementVNode("span",pl,e.toDisplayString(n.item[t.value]||n.ua||n.label),1),n.item?.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",hl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"default",e.mergeProps(n.$attrs,{class:{"opacity-60":n.item.disabled}})),n.error?(e.openBlock(),e.createElementBlock("span",ml,e.toDisplayString(n.error),1)):e.createCommentVNode("",!0)]))}}),gl={class:"w-full relative flex flex-row items-center gap-2"},kl={key:0,class:"text-red-500 text-[14px]"},yl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},bl=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(r){const t=r,l=e.computed(()=>t.columns??{container:12,label:3}),n=e.computed(()=>{const{container:i,label:c}=l.value;return!i||i<=0?0:Math.min(Math.max(c??0,0),i)/i}),o=e.computed(()=>t.item?.type==="html"||n.value<=0?!1:!!(t.ua||t.label)),s=e.computed(()=>{if(!o.value)return{};const i=`${n.value*100}%`;return{flexBasis:i,maxWidth:i}}),a=e.computed(()=>{const{container:i,label:c}=l.value;if(!i||i<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!o.value)return{flexBasis:"100%",maxWidth:"100%"};const d=Math.max(i-Math.max(c??0,0),0)/i;if(!d)return{};const m=`${d*100}%`;return{flexBasis:m,maxWidth:m}});return(i,c)=>(e.openBlock(),e.createElementBlock("div",gl,[o.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:e.normalizeStyle(s.value)},[e.createTextVNode(e.toDisplayString(i.ua||i.label)+" ",1),i.item?.rules?.includes("required")&&(i.ua||i.label)?(e.openBlock(),e.createElementBlock("span",kl,"*")):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(a.value)},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],4),i.error?(e.openBlock(),e.createElementBlock("span",yl,e.toDisplayString(i.error),1)):e.createCommentVNode("",!0)]))}}),xl={class:"w-full relative"},wl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},_l=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){return(t,l)=>(e.openBlock(),e.createElementBlock("div",xl,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",wl,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),El={class:"flex-1 min-w-0"},vl={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Vl={class:"truncate"},Bl={key:0,class:"text-red-500 text-[14px]"},Cl={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},Sl={key:0,class:"mt-1 text-xs text-red-500"},Nl={default:fl,horizontal:bl,inline:_l,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){const t=r,l=e.ref("uk");e.computed(()=>(t.item??{})?.[l.value]??t.ua??t.label??"");const n=e.computed(()=>t.item?.description??""),o=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),s=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),a=i=>{i.key==="locale"&&(l.value=i.newValue??"uk")};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(l.value=localStorage.locale)}catch{}window.addEventListener("storage",a)}),e.onUnmounted(()=>{window.removeEventListener("storage",a)}),(i,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",El,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",vl,[e.createElementVNode("span",Vl,e.toDisplayString(i.item[l.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Bl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("p",Cl,e.toDisplayString(n.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),s.value?(e.openBlock(),e.createElementBlock("p",Sl,e.toDisplayString(s.value),1)):e.createCommentVNode("",!0)],2))}})};function ae(r){return{inputClass:e.computed(()=>{const l=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${r?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return r?.size==="sm"?`${l}h-[32px]`:`${l}h-[38px]`})}}const Ml=["placeholder","disabled"],$l=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??"");return(a,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),placeholder:s.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Ml)),[[e.vModelText,n.value]])}}),Al=["placeholder","disabled"],Fe=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??"");return(a,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),placeholder:s.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Al)),[[e.vModelText,n.value]])}}),Fl=["placeholder","disabled","min","max"],yt=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled);return(s,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":a[0]||(a[0]=i=>n.value=i),placeholder:s.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"},min:s.min,max:s.max},null,10,Fl)),[[e.vModelText,n.value]])}}),q=(r,t)=>{const l=r.__vccOpts||r;for(const[n,o]of t)l[n]=o;return l},Dl={},Ll={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function Il(r,t){return e.openBlock(),e.createElementBlock("svg",Ll,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const Tl=q(Dl,[["render",Il]]),Ol={class:"flex items-center gap-[4px]"},Rl=["value","id","disabled"],zl=["for"],jl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Ul=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(r,{emit:t}){const l=t,n=r,o=e.computed({get:()=>n.modelValue,set:a=>l("update:modelValue",a)}),s=e.computed(()=>!!n.disabled);return(a,i)=>(e.openBlock(),e.createElementBlock("div",Ol,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:a.value,"onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":s.value}]),id:a.id,disabled:s.value},null,10,Rl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:a.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":s.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",a.error?"border-red-600":""]])},[e.createVNode(Tl,{height:"12",width:"12"})],2),e.createElementVNode("span",jl,[e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(a.label),1)])])],10,zl)]))}}),Pl=["name","value","disabled"],Hl={class:"flex items-center gap-[6px] text-[14px]"},Gl={key:0,class:"text-[16px]"},ql=["src"],Kl=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r,n=t,o=e.computed({get:()=>l.modelValue,set:i=>{n("update:modelValue",i)}}),s=e.computed(()=>Array.isArray(o.value)?o.value.includes(l.value):o.value===!0||o.value===l.value),a=e.computed(()=>l.style?.size==="xs"?"p-1.5 text-xs":l.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,c)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[a.value,s.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:i.disabled},null,8,Pl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",Hl,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",Gl,[i.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(i.icon)},null,2)):e.createCommentVNode("",!0),i.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,ql)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),Zl={class:"flex items-center"},st=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r,n=t,o=`radio-${Math.floor(Math.random()*1e4)}`,s=e.computed({get:()=>Array.isArray(l.modelValue)?Array.isArray(l.modelValue)&&l.modelValue.includes(l.value):l.modelValue,set:i=>{if(Array.isArray(l.modelValue)){let c=[...l.modelValue];i?c.includes(l.value)||c.push(l.value):c=c.filter(d=>d!==l.value),n("update:modelValue",c)}else n("update:modelValue",i)}}),a=e.ref(`vs-checkbox-${l.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Zl,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value==="vs-checkbox-buttons"?e.unref(Kl):e.unref(Ul)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),Wl={},Yl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function Jl(r,t){return e.openBlock(),e.createElementBlock("svg",Yl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Xl=q(Wl,[["render",Jl]]),Ql={},en={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function tn(r,t){return e.openBlock(),e.createElementBlock("svg",en,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const bt=q(Ql,[["render",tn]]),ln={},nn={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function on(r,t){return e.openBlock(),e.createElementBlock("svg",nn,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M12 9h.01"},null,-1),e.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),e.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const sn=q(ln,[["render",on]]),an={key:0,class:"flex items-start gap-x-1"},rn={key:0,class:"text-red-500 text-[14px]"},cn=["title"],dn=["disabled"],at=e.defineComponent({__name:"vs-input-switcher",props:e.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue");return(n,o)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",an,[e.createVNode(st,{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=s=>l.value=s),label:n.text,error:n.error||""},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",rn,"*")):e.createCommentVNode("",!0),n.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(sn),{class:"text-gray-500 w-[14px] h-[14px]"})],8,cn)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[l.value?`bg-${n.style?.primaryColor||"blue"}-500`:"bg-stone-200",n.customClass]]),disabled:n.disabled,onClick:o[2]||(o[2]=s=>l.value=!l.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[l.value?"translate-x-4":"translate-x-0"]])},null,2)],10,dn))}}),un=["id","innerHTML"],rt=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(r){return(t,l)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,un))}}),pn=["placeholder","disabled","name"],xt=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue"),o=e.ref(null);let s=null;return e.onMounted(async()=>{if(o.value){const{default:a}=await Promise.resolve().then(()=>cl);s=a(o.value,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),s.on("accept",()=>{n.value=t.unmask?s.unmaskedValue:s.value}),s.on("complete",()=>{n.value=t.unmask?s.unmaskedValue:s.value}),s.value=n.value??""}}),e.onBeforeUnmount(()=>{s?.destroy()}),e.watch(()=>t.mask,a=>{s&&s.updateOptions({mask:a,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),e.watch(n,a=>{s&&s.unmaskedValue!==a&&(s.value=a||"")}),(a,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:a.placeholder,disabled:a.disabled,name:a.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"}},null,10,pn))}}),hn={class:"relative w-full bg-white rounded-lg"},mn=["placeholder","disabled"],wt=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue");return(o,s)=>(e.openBlock(),e.createElementBlock("div",hn,[s[1]||(s[1]=e.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><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" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":s[0]||(s[0]=a=>n.value=a),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,mn),[[e.vModelText,n.value]])]))}}),fn=["value","disabled"],gn={class:"text-[13px] text-gray-700"},kn=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.computed(()=>!!t.disabled);return(o,s)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,n.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>l.value=a),type:"radio",value:t.value,disabled:n.value,class:"hidden"},null,8,fn),[[e.vModelRadio,l.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,n.value?"opacity-50 cursor-not-allowed":""]])},[l.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",gn,e.toDisplayString(t.text),1)],2))}}),yn=["value","disabled"],bn={class:"text-[13px] text-gray-700"},xn={"vs-input-radio-default":kn,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.computed(()=>!!t.disabled);return(o,s)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[l.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,n.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>l.value=a),type:"radio",value:t.value,disabled:n.value,class:"hidden"},null,8,yn),[[e.vModelRadio,l.value]]),e.createElementVNode("span",bn,e.toDisplayString(t.text),1)],2))}})},it=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.computed(()=>xn[`vs-input-radio-${t.view}`]);return(o,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,a=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value),e.mergeProps({key:a?.id,text:a.text,value:a.id.toString(),checked:l.value===a.id,modelValue:l.value,"onUpdate:modelValue":s[0]||(s[0]=i=>l.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),wn={key:1,class:"w-full flex flex-col gap-4"},_n={key:0,class:"text-sm font-medium text-muted-foreground my-2"},En="Без категорії",_t=q(e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r,n=t,o=e.ref([]),s=e.reactive({}),a=k=>k?.value||k?.id||k?.text||k,i=k=>k.text||String(k),c=k=>`lg:col-span-${k||12}`,d=e.computed(()=>[l.position==="vertical"?"flex flex-col":"",l.colSpan?"grid":"flex justify-start"]),m=k=>k==null||k===""?null:typeof k=="string"||typeof k=="number"?k:String(k),f=e.computed(()=>{if(!l.group)return[];const k=new Map;o.value.forEach(w=>{const C=w[l.group],b=m(C);k.has(b)||k.set(b,[]),k.get(b)?.push(w)});const N=[];l.values?.length&&l.values.forEach(w=>{const C=m(w);N.push(C)});const y=new Set,h=w=>{const C=k.get(w)||[];if(!C.length)return null;const b=w===null?"group-null":`group-${String(w)}`,v=w===null?En:String(w);return y.add(w),{key:b,label:v,options:C}},x=[];return N.forEach(w=>{const C=h(w);C&&x.push(C)}),k.forEach((w,C)=>{if(y.has(C))return;const b=h(C);b&&x.push(b)}),x}),E=async()=>{try{const k=await fetch(`/api/suggest/${l.data}`).then(N=>N.json());o.value=k?.data||k}catch(k){console.error(k)}};return e.watch(()=>l.modelValue,k=>{if(typeof k=="boolean"&&o.value.length===1){const N=a(o.value[0]);s[N]=k}else if(Array.isArray(k)){const N=new Set(k);o.value.forEach(y=>{if(!y.disabled){const h=a(y);s[h]=N.has(h)}})}},{immediate:!0}),e.watch(s,()=>{if(!o.value.length){n("update:modelValue",null);return}const k=Object.entries(s).filter(([,N])=>N).map(([N])=>N);n("update:modelValue",k.length===0?[]:k)},{deep:!0}),e.onMounted(()=>{if(l.data)E().then(()=>{if(typeof l.modelValue=="boolean"&&o.value.length===1){const k=a(o.value[0]);s[k]=l.modelValue}else if(Array.isArray(l.modelValue)){const k=new Set(l.modelValue);o.value.forEach(N=>{if(!N.disabled){const y=a(N);s[y]=k.has(y)}})}});else if(o.value=l.options,typeof l.modelValue=="boolean"&&o.value.length===1){const k=a(o.value[0]);s[k]=l.modelValue}else if(Array.isArray(l.modelValue)){const k=new Set(l.modelValue);o.value.forEach(N=>{if(!N.disabled){const y=a(N);s[y]=k.has(y)}})}}),(k,N)=>l.group?(e.openBlock(),e.createElementBlock("div",wn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y.key,class:"flex flex-col gap-2"},[y.label?(e.openBlock(),e.createElementBlock("span",_n,e.toDisplayString(y.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.options,h=>(e.openBlock(),e.createBlock(st,{modelValue:s[a(h)],"onUpdate:modelValue":x=>s[a(h)]=x,value:a(h),class:e.normalizeClass(c(k.colSpan)),disabled:l.disabled||h.disabled,label:i(h),key:`${y.key}-${a(h)}`,icon:h?.icon,imgUrl:h?.imgUrl,option:h,view:k.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,y=>(e.openBlock(),e.createBlock(st,{modelValue:s[a(y)],"onUpdate:modelValue":h=>s[a(y)]=h,value:a(y),class:e.normalizeClass(c(k.colSpan)),disabled:l.disabled||y.disabled,label:i(y),key:a(y),icon:y?.icon,imgUrl:y?.imgUrl,option:y,view:k.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),vn=["type","placeholder","disabled"],Et=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},mode:{default:"date"}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r;function n(m){return m?l.mode==="datetime"?(m.includes("T")?m:null)||m+(m.includes(" ")?"":"T00:00"):m?.split(" ")[0]:null}const{inputClass:o}=ae(l.style),s=t,a=e.computed({get:()=>n(l.modelValue),set:m=>s("update:modelValue",m)}),i=e.computed(()=>l.mode==="datetime"?"datetime-local":l.mode),c=e.computed(()=>!!l.disabled),d=e.computed(()=>l.placeholder??"");return(m,f)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":f[0]||(f[0]=E=>a.value=E),placeholder:d.value,disabled:c.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[m.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,vn)),[[e.vModelDynamic,a.value]])}}),vt=async(r,t,l,n)=>{try{const o=new FormData;return o.append("unique","true"),o.append("file",r),(await fetch(`/file/upload/uploads?id=${t||""}&form=${l||""}&table=${n||""}`,{method:"POST",body:o}).then(a=>a.json()))?.result}catch(o){return ee.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",o),null}},Vn=async r=>{try{return await fetch(`file/delete${r}`),!0}catch(t){return console.error(t),!1}},Vt=async r=>{try{const t=await fetch(`file/download/files/uploads${r}`),l=await t.arrayBuffer(),n=t.headers["content-type"],o=new TextDecoder("utf-8").decode(l),s=new Blob([o],{type:n}),a=document.createElement("a");a.setAttribute("download",r),a.href=window.URL.createObjectURL(s),a.click()}catch(t){console.error(t.message)}},Bn={},Cn={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Sn(r,t){return e.openBlock(),e.createElementBlock("svg",Cn,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const Be=q(Bn,[["render",Sn]]),Nn={},Mn={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function $n(r,t,l,n,o,s){return e.openBlock(),e.createElementBlock("svg",Mn,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const An=q(Nn,[["render",$n]]),Fn={},Dn={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Ln(r,t,l,n,o,s){return e.openBlock(),e.createElementBlock("svg",Dn,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),e.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),e.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const In=q(Fn,[["render",Ln]]),Tn={},On={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Rn(r,t){return e.openBlock(),e.createElementBlock("svg",On,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const Bt=q(Tn,[["render",Rn]]),zn={},jn={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Un(r,t,l,n,o,s){return e.openBlock(),e.createElementBlock("svg",jn,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const Pn=q(zn,[["render",Un]]),Hn={},Gn={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function qn(r,t,l,n,o,s){return e.openBlock(),e.createElementBlock("svg",Gn,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const Kn=q(Hn,[["render",qn]]),Zn=r=>{if(!r)return"";const t=r?.split(".");return t[t.length-1]},Wn=r=>{const t=Zn(r),l={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return l.imageFormat.includes(t)?"img":l.sheetsFormat.includes(t)?In:l.textsFormat.includes(t)?Kn:l.documentsFormat.includes(t)?An:l.archivesFormat.includes(t)?Pn:Bt},Yn={},Jn={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function Xn(r,t){return e.openBlock(),e.createElementBlock("svg",Jn,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const qe=q(Yn,[["render",Xn]]),Qn={},eo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function to(r,t){return e.openBlock(),e.createElementBlock("svg",eo,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Ct=q(Qn,[["render",to]]),lo=["title"],no={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},St=q(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(r){const t=e.useModel(r,"value"),l=e.useModel(r,"item"),n=r;return(o,s)=>(e.openBlock(),e.createElementBlock("div",{title:l.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Wn)(l.value)),{src:l.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:s[0]||(s[0]=a=>e.unref(Vt)(l.value))},null,8,["src"])),e.createElementVNode("div",no,[e.createElementVNode("button",{type:"button",onClick:s[1]||(s[1]=a=>{e.unref(Vn)(l.value),t.value=n.multiple?t.value?.filter(i=>i!==l.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(qe,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:s[2]||(s[2]=a=>e.unref(Vt)(l.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(Ct,{class:"w-4 h-4"})])])],8,lo))}}),[["__scopeId","data-v-286cdbc0"]]),oo={class:"flex items-center gap-x-2"},so=["multiple","disabled"],ao={key:1,class:"flex items-center flex-wrap gap-2"},ro={key:1,class:"loader"},io={key:1,class:"loader"},Nt=q(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(r,{emit:t}){const l=r,n=e.useModel(r,"modelValue"),o=t,s=e.ref(null),a=e.ref(!1),i=m=>Array.isArray(n.value)&&n.value[m]||"",c=m=>{if(l.max_size&&m.size>l.max_size*1024*1024){const f=(m.size/1048576).toFixed(2);return ee.notify({type:"error",title:"Помилка!",message:`Файл "${m.name}" занадто великий. Максимальний розмір: ${l.max_size} МБ, розмір файлу: ${f} МБ`,position:"right-bottom"}),!1}return!0},d=async m=>{const{files:f}=m.target;if(!f||f.length===0)return;const E=Array.from(f);if(l.max_size&&E.filter(N=>!c(N)).length>0){s.value&&(s.value.value="");return}a.value=!0;try{if(l.multiple){const k=Array.from(f).map(async x=>l.format&&!x.name.endsWith(l.format)?null:await vt(x,"1","form","table")),h=(await Promise.all(k)).filter(x=>x!==null).map(x=>x?.file_path).filter(Boolean);n.value=[...n.value||[],...h],o("change",n.value)}else{const k=f[0];if(l.format&&!k.name.endsWith(l.format))return;const N=await vt(k,"1","form","table");n.value=N?.file_path,o("change",n.value||"")}}finally{a.value=!1,s.value&&(s.value.value="")}};return(m,f)=>(e.openBlock(),e.createElementBlock("div",oo,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:s,type:"file",multiple:m.multiple,onChange:d,disabled:a.value||m.disabled},null,40,so),!m.multiple&&n.value?(e.openBlock(),e.createBlock(St,{key:0,item:n.value,"onUpdate:item":f[0]||(f[0]=E=>n.value=E),value:n.value,"onUpdate:value":f[1]||(f[1]=E=>n.value=E)},null,8,["item","value"])):m.multiple?(e.openBlock(),e.createElementBlock("div",ao,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(E,k)=>(e.openBlock(),e.createBlock(St,{multiple:m.multiple,key:k,value:n.value,"onUpdate:value":f[2]||(f[2]=N=>n.value=N),item:i(k)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:f[3]||(f[3]=E=>!m.disabled&&!a.value&&s.value?.click()),class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",m.disabled||a.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[a.value?(e.openBlock(),e.createElementBlock("div",ro)):(e.openBlock(),e.createBlock(Be,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),m.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:f[4]||(f[4]=E=>s.value?.click()),class:e.normalizeClass([m.disabled||a.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[a.value?(e.openBlock(),e.createElementBlock("div",io)):(e.openBlock(),e.createBlock(Be,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-e613a523"]]),co={class:"max-w-[55vw]"},uo={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},po={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},ho={class:"px-[5px]"},mo={class:""},Ke=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(r){const t=r,l=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function n(o){if(o<1024)return`${o} B`;const s=o/1024;return s<1024?`${s.toFixed(2)} KB`:`${(s/1024).toFixed(2)} MB`}return(o,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[s[1]||(s[1]=e.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),e.createElementVNode("div",co,[e.createElementVNode("p",uo,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",po,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",ho,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(l.value),1),s[0]||(s[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",mo,e.toDisplayString(n(o.item?.size)),1)])])],64))}}),fo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},go={key:0,class:"flex w-full gap-x-3 items-center"},ko={key:1,class:"flex gap-x-3 w-full items-center"},yo={key:2,class:"flex gap-x-3 w-full items-center"},bo=["href"],xo={key:3,class:"flex gap-x-3 w-full items-center"},wo={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},_o={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},Eo={class:"inline-block"},vo={class:"inline-block"},Vo=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(r,{emit:t}){const l=r,n=t;function o(m){return["pdf","json"].includes(m.ext)}function s(m){return["ppt","pptx","doc","docx","xls","xlsx"].includes(m.ext)}function a(m){const f=document.createElement("a");f.setAttribute("download",m?.uploaded_name),f.href=m?.file_path,f.click()}async function i(){try{await fetch(`${l.prefix}/widget/file/${l.item.entity_id}/${l.item.file_id}`),n("update")}catch(m){console.error(m)}}function c(){n("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(m){(l.item.ext==="jpg"||l.item.ext==="png")&&n("openLightbox",{item:l.item,index:m})}return(m,f)=>(e.openBlock(),e.createElementBlock("div",fo,[m.item.ext==="jpg"||m.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",go,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:f[0]||(f[0]=E=>d(m.index))},[e.createVNode(Ke,{item:m.item},null,8,["item"])])])):o(m.item)?(e.openBlock(),e.createElementBlock("div",ko,[e.createVNode(Ke,{item:m.item},null,8,["item"])])):s(m.item)?(e.openBlock(),e.createElementBlock("div",yo,[e.createElementVNode("a",{href:`/api/file-preview?id=${m.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Ke,{item:m.item},null,8,["item"])],8,bo)])):(e.openBlock(),e.createElementBlock("div",xo,[e.createVNode(Ke,{item:m.item},null,8,["item"])])),e.createElementVNode("div",wo,[e.createElementVNode("div",_o,[e.createElementVNode("div",Eo,[e.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:f[1]||(f[1]=E=>a(m.item))},[e.createVNode(Ct,{height:"14",width:"14"})])]),f[3]||(f[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",vo,[e.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:f[2]||(f[2]=E=>c())},[e.createVNode(qe,{height:"14",width:"14"})])])])])]))}}),Bo={},Co={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function So(r,t){return e.openBlock(),e.createElementBlock("svg",Co,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const No=q(Bo,[["render",So]]),Mo={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},$o={class:"flex w-full mb-[12px] items-center gap-x-2"},Ao={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Fo={class1:"ml-auto"},Do={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},Lo={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Io={class:"relative"},To={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},Oo={key:0},Mt=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(r,{emit:t}){const l=r,n=e.inject("form"),o=e.computed(()=>n.value.formId),s=e.ref(!1),a=e.ref(0),i=t,c=e.ref(!1),d=e.ref({}),m=e.ref([]),f=e.ref(""),E=e.computed(()=>Array.isArray(m.value)?m.value.filter(C=>C.ext==="jpg"||C.ext==="png").map(C=>C?.file_path):[]),k=e.computed(()=>f.value===""?m.value:m.value.filter(C=>C?.uploaded_name?.includes(f.value))),N=C=>{const b=E.value.findIndex(v=>v===C.item.file_path);b!==-1&&(s.value=!0,a.value=b)},y=async()=>{try{const C=await fetch(`${l.prefix}/widget/file/${o.value}`).then(b=>b.json());m.value=C?.rows}catch(C){console.error(C)}},h=async C=>{await Promise.all(Array.from(C.target.files).map(async b=>{const v=new FormData;v.append("file",b);try{const $=`${l.prefix}/widget/file/${o.value}`,M=await fetch($,{method:"POST",body:v});return M.ok?(i("update","file-list"),b):(ee.notify({type:M.status>=400&&M.status<500?"warning":"error",title:"Error",message:`Error code: ${M.status}`}),null)}catch($){return ee.notify({type:"error",title:"Error",message:$.message||"Unknown error"}),console.error($),null}})),await y()},x=C=>{const b={...C};return C.cancel||(b.cancel=()=>{c.value=!1}),C.updateListOnConfirm&&(b.confirm=async()=>{await C.confirm(),c.value=!1,y()}),b},w=C=>{d.value=x(C),c.value=!0};return e.watch(o,C=>{C&&y()}),e.onMounted(()=>{o.value&&y()}),(C,b)=>{const v=e.resolveComponent("Lightbox"),$=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",Mo,[e.createElementVNode("div",$o,[e.createElementVNode("h2",Ao," Файлів: "+e.toDisplayString(m.value?.length),1),e.createElementVNode("div",Fo,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:b[0]||(b[0]=M=>h(M))},null,32),e.createElementVNode("div",Do,[e.createVNode(No,{height:"16",width:"16"})])])])]),m.value?.length>4?(e.openBlock(),e.createElementBlock("div",Lo,[e.createElementVNode("div",null,[e.createElementVNode("div",Io,[b[8]||(b[8]=e.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[e.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),e.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":b[1]||(b[1]=M=>f.value=M),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,f.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),m.value?.length?(e.openBlock(),e.createElementBlock("div",To,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,(M,z)=>(e.openBlock(),e.createBlock(Vo,{key:z,prefix:C.prefix,item:M,index:z,onUpdate:b[2]||(b[2]=X=>C.$emit("update","file-list")),onOpenModal:b[3]||(b[3]=X=>w(X)),onOpenLightbox:b[4]||(b[4]=X=>N(X))},null,8,["prefix","item","index"]))),128)),k.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Oo,b[9]||(b[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(v,{modelValue:s.value,"onUpdate:modelValue":b[5]||(b[5]=M=>s.value=M),startIndex:a.value,"onUpdate:index":b[6]||(b[6]=M=>a.value=M),images:E.value},null,8,["modelValue","startIndex","images"]),e.createVNode($,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":b[7]||(b[7]=M=>c.value=M),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),Ro={class:"flex items-center justify-between"},zo={class:"text-[16px] text-gray-900 font-medium"},jo={class:"grid gap-3"},Uo=q(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(r){const t=r,l=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{l.value=n}),(n,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Ro,[e.createElementVNode("p",zo,e.toDisplayString(r.title),1),e.createVNode(at,{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=s=>l.value=s),style:e.normalizeStyle(r.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",jo,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,l.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Po={class:"text-[16px] text-gray-900 font-medium"},Ho={class:"grid gap-3"},Go=q(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(r){const t=r,l=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{l.value=n}),(n,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=s=>l.value=!l.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Xl),{class:e.normalizeClass(["h-4 w-4 duration-300",[l.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Po,e.toDisplayString(r.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Ho,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,l.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),qo={class:"flex items-center justify-between"},Ko={switcher:Uo,accordion:Go,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(r){return(t,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",qo,[e.createElementVNode("p",null,e.toDisplayString(r.title),1)]),e.renderSlot(t.$slots,"default")]))}})},ce={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Zo=(r,t)=>String(r)===String(t),Wo=(r,t)=>String(r)!==String(t),Yo=(r,t)=>r>t,Jo=(r,t)=>r>=t,Xo=(r,t)=>r<t,Qo=(r,t)=>r<=t,es=(r,t)=>Array.isArray(t)&&t.length===2?r>=t[0]&&r<=t[1]:!1,ts=(r,t)=>String(r).startsWith(String(t)),ls=(r,t)=>String(r).endsWith(String(t)),ns=(r,t)=>String(r).includes(String(t)),os=(r,t)=>Array.isArray(t)?t.includes(r):!1,ss=(r,t)=>Array.isArray(t)?!t.includes(r):!0,$t=(r,t)=>{if(!t)return!0;switch(t?.[1]){case ce.Equal:return Zo(r,t?.[2]);case ce.Inequal:return Wo(r,t?.[2]);case ce.Higer:return Yo(r,t?.[2]);case ce.HigerOrEqual:return Jo(r,t?.[2]);case ce.Lower:return Xo(r,t?.[2]);case ce.LowerOrEqual:return Qo(r,t?.[2]);case ce.Between:return es(r,t?.[2]);case ce.StartWith:return ts(r,t?.[2]);case ce.EndWith:return ls(r,t?.[2]);case ce.Contain:return ns(r,t?.[2]);case ce.In:return os(r,t?.[2]);case ce.NotIn:return ss(r,t?.[2]);default:return!0}},At=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(r){const t=r,l=e.inject("values",e.ref({})),n=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,m=t.name?l.value?.[t.name]?.[d]??l.value?.[d]:l.value?.[d];return $t(m,c)})),s=e.computed(()=>Ko[t.view]),a=e.computed(()=>{if(l.value||(l.value={}),!t.name)return l.value;const i=l.value[t.name];if(i)return i;const c={};return l.value={...l.value,[t.name]:c},c});return(i,c)=>r.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value),{key:0,title:r.title,style:e.normalizeStyle(r.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,d=>(e.openBlock(),e.createBlock(qt,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:a.value[d.name],"onUpdate:modelValue":m=>a.value[d.name]=m,style:r.style,error:e.unref(n)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),as=["aria-expanded","data-focus"],rs={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},is={class:"flex items-center min-w-0"},cs=["title"],ds=["innerHTML"],us=["onClick"],ps={class:"flex-1 min-w-[2px]"},hs=["placeholder"],ms=["title"],fs=["innerHTML"],gs={key:2,class:"flex-1 min-w-[2px]"},ks=["placeholder"],ys={class:"flex items-center shrink-0"},bs=["disabled"],xs=["disabled","title"],ws=["aria-disabled","onClick"],_s=["innerHTML"],Es={key:1,class:"px-3 py-2 text-center text-gray-500"},vs=["disabled"],ct=e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(r,{emit:t}){const l=r,n=t,o=e.computed(()=>l.multiple),s=e.computed(()=>l.disabled);ae(l.style);const a=e.computed({get:()=>l.modelValue,set:g=>n("update:modelValue",g)});!a.value&&l.defaultValue&&(a.value=l.defaultValue);const i=e.ref(null),c=e.ref(null),d=e.ref(null),m=e.ref(null),f=e.ref(!1),E=e.ref(!1),k=e.ref(null),N=e.ref([]),y=e.ref(-1),h=e.ref([]),x=e.ref(""),w=e.ref(null),C=e.ref("bottom"),b=e.ref({}),v=e.ref([]),$=e.computed(()=>{if(!v.value.length)return[];const g=N.value,_=new Map(g.map(V=>[V.id?.toString(),V]));return v.value.map(V=>_.get(V?.toString())).filter(V=>!!V)}),M=e.computed(()=>l.placeholder||"Select..."),z=e.computed(()=>A(k.value));e.computed(()=>o.value?!v.value.length&&x.value==="":!z.value&&x.value==="");const X=e.computed(()=>s.value?!1:o.value?v.value.length>0:!!a.value),G=g=>o.value?v.value.some(_=>_?.toString()===g?.toString()):a.value?.toString()===g?.toString(),F=e.computed(()=>{let g=N.value??[];if(!l.data&&x.value.trim()!==""){const _=x.value.toLowerCase();g=g.filter(V=>{const R=A(V).toLowerCase(),J=V.text?.toLowerCase?.()||"";return R.includes(_)||J.includes(_)})}if(o.value&&v.value.length){const _=new Set(v.value.map(V=>V?.toString()));g=g.filter(V=>!_.has(V.id?.toString()))}return g}),K=e.inject("values"),Y=/\{\{\s*([^}]+?)\s*\}\}/g,Q=g=>(g?String(g):"").replace(/<[^>]*>/g,"").trim(),O=e.computed(()=>l.slot??l?.optionTemplate??""),D=g=>{if(!g)return"";const _=O.value;return _?_.replace(Y,(V,R)=>{const J=R.trim(),te=g[J];return te!=null?String(te):""}):g.text??""},A=g=>{if(!g)return"";if(!O.value)return g.text??"";const V=D(g);return Q(V)||g.text||""},U=g=>{l.set&&K?.value&&Object.entries(l.set).forEach(([_,V])=>{if(!_)return;const R=g?g[V]:null;K.value[_]=R??null})},W=e.computed(()=>l.parent?K?.value?.[l.parent]?.toString()??null:null),re=async g=>{if(!l.data){let _=l.options??[];if(g?.trim()){const V=g.toLowerCase();_=_.filter(R=>{const J=A(R).toLowerCase(),te=R.text?.toLowerCase?.()||"";return J.includes(V)||te.includes(V)})}return _}try{const _=l.host??"",V=l.prefix??"api",R=l.api??`/${V}/suggest/${l.data}`,J=`${_}${R}`,te=new URLSearchParams;return te.set("json","1"),g&&te.set("key",g),W.value!==void 0&&W.value!==null&&W.value!==""&&te.set("parent",W.value),(await fetch(`${J}?${te.toString()}`).then(Ve=>Ve.json()))?.data??[]}catch{return[]}},fe=async()=>{l.data?N.value=await re(x.value):N.value=l.options?[...l.options]:[]},xe=async g=>{if(g==null)return null;const _=N.value?.find(V=>V?.id?.toString()===String(g));if(_)return _;if(l.data)try{const V=l.host??"",R=l.prefix??"api",J=l.api??`/${R}/suggest/${l.data}`,te=`${V}${J}`,de=new URLSearchParams;return de.set("json","1"),de.set("val",String(g)),W.value!==void 0&&W.value!==null&&W.value!==""&&de.set("parent",W.value),((await fetch(`${te}?${de.toString()}`).then(Pe=>Pe.json()))?.data??[])?.[0]??null}catch{return null}return null},ft=async g=>{const _=new Set(N.value.map(R=>R.id?.toString())),V=g.filter(R=>!_.has(R?.toString()));V.length&&await V.reduce(async(R,J)=>{await R;const te=await xe(J);te&&N.value.push(te)},Promise.resolve())},oe=async()=>{s.value||(f.value=!0,await fe(),await e.nextTick(()=>{Me(),w.value?.focus(),F.value.length?y.value=0:y.value=-1}))},ue=()=>{f.value=!1,y.value=-1},Se=async g=>{if(s.value)return;!f.value?await oe():ue()},ze=async()=>{f.value?w.value?.focus():await oe()},Xe=()=>{o.value?(v.value=[],a.value=[],n("change",[])):(k.value=null,a.value=null,n("change",null)),U(null),x.value="",e.nextTick(()=>w.value?.focus())},gt=g=>{o.value&&(v.value=v.value.filter(_=>_?.toString()!==g?.toString()),a.value=[...v.value],n("change",a.value),e.nextTick(()=>w.value?.focus()))},ge=g=>{o.value?(G(g.id)||(v.value=[...v.value,g.id],a.value=[...v.value],n("change",a.value)),x.value="",e.nextTick(()=>{w.value?.focus(),y.value=Math.min(y.value,F.value.length-1)}),U(null)):(k.value=g,a.value=g.id,n("change",a.value),x.value="",ue(),U(g))},we=g=>{G(g.id)||ge(g)},Ne=(g,_)=>{if(!g||!_)return;const V=g.offsetTop,R=V+g.offsetHeight,J=_.scrollTop,te=J+_.clientHeight;let de=_.scrollTop;V<J?de=V-80:R>te&&(de=R-_.clientHeight+4);const Ve=_;Ve.scrollTop=de},ie=g=>{let _=g.parentElement;for(;_;){if(_.classList.contains("ui-dialog__content"))return _;const V=window.getComputedStyle(_),R=V.overflow+V.overflowY+V.overflowX;if(R.includes("auto")||R.includes("scroll")||_===document.body||_===document.documentElement)return _;_=_.parentElement}return document.body},Me=()=>{if(!c.value)return;const g=c.value.getBoundingClientRect(),_=window.innerHeight||document.documentElement.clientHeight,V=window.innerWidth||document.documentElement.clientWidth,R=8,J=8,te=l.maxHeight||300,de=_-g.bottom-J-R,Ve=g.top-J-R,Ue=de>=Ve,Pe=Math.max(V-R*2,0);let{width:He}=g;Pe>0&&He>Pe&&(He=Pe);let{left:Ge}=g;Ge+He+R>V&&(Ge=V-He-R),Ge=Math.max(Ge,R);const ac=Math.min(te,Math.max(Ue?de:Ve,50));C.value=Ue?"bottom":"top",b.value={position:"fixed",left:`${Ge}px`,width:`${He}px`,minWidth:"300px",maxHeight:`${ac}px`,transform:Ue?"none":"translateY(-100%)",top:Ue?`${g.bottom+J}px`:`${g.top-J}px`}},kt=async g=>{s.value||!f.value&&(g.key==="ArrowDown"||g.key==="ArrowUp")&&(g.preventDefault(),await oe())},Qe=g=>{if(!f.value)return;const{key:_}=g;if(_==="ArrowDown")g.preventDefault(),y.value+1<F.value.length&&(y.value+=1,Ne(h.value[y.value],d.value));else if(_==="ArrowUp")g.preventDefault(),y.value>0&&(y.value-=1,Ne(h.value[y.value],d.value));else if(_==="Enter"){g.preventDefault();const V=F.value[y.value];V&&ge(V),w.value?.blur()}else _==="Escape"?(g.preventDefault(),ue()):_==="Backspace"?o.value&&x.value===""&&v.value.length&&(v.value=v.value.slice(0,-1),a.value=[...v.value],n("change",a.value)):_==="Home"?(y.value=0,Ne(h.value[0],d.value)):_==="End"?(y.value=F.value.length-1,Ne(h.value[y.value],d.value)):_==="Tab"&&ue()},et=()=>{s.value||(E.value=!0)},ke=()=>{E.value=!1,x.value=""},tt=g=>{g.key==="Escape"&&f.value&&ue()},lt=g=>{const _=g.target;i.value?.contains(_)||m.value?.contains(_)||ue()},Ee=g=>{f.value&&d.value&&!d.value.contains(g.target)&&Me()},nt=()=>{f.value&&Me()},ot=()=>{f.value&&Me()};e.watch(()=>l.options,g=>{g?.length&&(N.value=[...g],$e())},{immediate:!0});async function $e(){if(o.value)Array.isArray(a.value)?v.value=[...a.value]:(v.value=a.value==null?[]:[a.value],a.value=[...v.value]),l.data&&v.value.length&&(await ft(v.value),await e.nextTick());else{if(Array.isArray(a.value)){const g=a.value[0]??null;a.value=g??null}a.value!=null&&(k.value=await xe(a.value)),U(k.value??null)}}e.watch(a,()=>{$e()}),e.onMounted(async()=>{addEventListener("keydown",tt),addEventListener("scroll",Ee,!0),addEventListener("resize",nt),document.addEventListener("click",lt,!0),c.value&&ie(c.value).addEventListener("scroll",ot,!0),l.options?.length&&!l.data?N.value=[...l.options]:l.data&&(N.value=await re("")),await $e(),H.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",tt),removeEventListener("scroll",Ee,!0),removeEventListener("resize",nt),document.removeEventListener("click",lt,!0),c.value&&ie(c.value).removeEventListener("scroll",ot,!0)});const Ae=e.ref(!1),je=e.ref({}),ve=e.ref([]),u=e.ref(null);async function p(){if(!l.add?.token||u?.value.validate())return;const _=l.add.api??`/api/table/${l.add.token}`,{id:V}=await fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(je.value)}).then(R=>R.json());if(!l.options?.length&&l.data){const{data:R}=await fetch(`${l.api??`/api/suggest/${l.data}`}?val=${V}`).then(J=>J.json());k.value=R[0],N.value.push(R[0]),a.value=V}Ae.value=!1,ee.notify({title:"Success!",message:"Object created."})}async function B(){if(!l.add)return null;const g=await fetch(`/api/template/form/${l.add.form}`).then(_=>_.json());return ve.value=g.schema,Ae.value=!0,null}function S(g,_=200){let V;return(...R)=>{V&&clearTimeout(V),V=window.setTimeout(()=>g(...R),_)}}const I=S(async g=>{N.value=await re(g)},200);e.watch(x,g=>{l.data&&I(g.trim())}),e.watch(()=>l.options,g=>{!l.data&&g?.length&&(N.value=[...g],$e())},{immediate:!0}),e.watch(()=>l.parent??l.parentValue,()=>{l.data&&fe()});const H=e.ref(!0);return e.watch(W,async()=>{if(l.data&&(H.value||(o.value?(v.value=[],a.value=[],n("change",[])):(k.value=null,a.value=null,n("change",null))),await fe(),l.auto===1&&W.value&&N.value.length>0)){const g=N.value[0];g&&ge(g)}}),(g,_)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ee.VsModal),{visible:Ae.value,"onUpdate:visible":_[1]||(_[1]=V=>Ae.value=V),title:"Додати",buttonText:"Додати",onDone:p,teleport:g.teleport},{default:e.withCtx(()=>[e.createVNode(_e,{schema:ve.value,modelValue:je.value,"onUpdate:modelValue":_[0]||(_[0]=V=>je.value=V),ref_key:"addForm",ref:u},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:_[5]||(_[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",l.customClass])},[_[10]||(_[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),_[11]||(_[11]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",f.value||E.value?"border-blue-500 ring-1 ring-blue-500":"",s.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":f.value,"aria-haspopup":"listbox",onKeydown:kt,onClick:ze,"data-focus":f.value||E.value?"true":"false"},[e.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full",ref_key:"triggerRef",ref:c},[o.value?(e.openBlock(),e.createElementBlock("div",rs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,V=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:V.id},[e.createElementVNode("div",is,[V?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:V?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:A(V)},[O.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:D(V)},null,8,ds)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(V.text),1)],64))],8,cs)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:e.withModifiers(R=>gt(V.id),["stop"])},_[6]||(_[6]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,us)]))),128)),e.createElementVNode("div",ps,[!s.value&&g.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:w,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:v.value.length?" ":M.value,"onUpdate:modelValue":_[2]||(_[2]=V=>x.value=V),onFocus:et,onBlur:ke,onKeydown:Qe},null,40,hs)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)])])):!o.value&&!E.value&&z.value&&x.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:z.value},[k.value?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:e.normalizeStyle({backgroundColor:k.value?.color})},null,4)):e.createCommentVNode("",!0),O.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":k.value?.color}),innerHTML:D(k.value)},null,10,fs)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":k.value?.color})},e.toDisplayString(k.value?.text),3))],8,ms)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",gs,[!s.value&&g.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:w,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:z.value?" ":M.value,"onUpdate:modelValue":_[3]||(_[3]=V=>x.value=V),onFocus:et,onBlur:ke,onKeydown:Qe},null,40,ks)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)]))],512),e.createElementVNode("div",ys,[X.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:e.withModifiers(Xe,["stop"])},_[7]||(_[7]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,bs)):e.createCommentVNode("",!0),_[9]||(_[9]=e.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),e.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:_[4]||(_[4]=e.withModifiers(V=>Se(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},_[8]||(_[8]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,xs)])],42,as),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[f.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:m,class:e.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:e.normalizeStyle(b.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:b.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[F.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(F.value,(V,R)=>(e.openBlock(),e.createElementBlock("div",{key:V.id,ref_for:!0,ref:J=>h.value[R]=J,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",G(V.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",y.value===R&&!G(V.id)?"bg-blue-100":""]),"aria-disabled":G(V.id)?"true":"false",role:"option",tabindex:"-1",onClick:J=>we(V)},[V?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:e.normalizeStyle({backgroundColor:V?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",y.value===V.id?"text-white":"",(y.value===R,"")])},[O.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:D(V)},null,8,_s)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(V.text),1)],64))],2)],10,ws))),128)):(e.openBlock(),e.createElementBlock("div",Es," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),l.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:B,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:s.value,type:"button"},[e.createVNode(Be,{width:"16",height:"16"}),_[12]||(_[12]=e.createElementVNode("span",null,"Додати",-1))],8,vs)):e.createCommentVNode("",!0)],512)],64))}}),Vs=["placeholder","disabled"],Ft=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??"");return(a,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),placeholder:s.value,disabled:o.value,row:"2",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"}},null,10,Vs)),[[e.vModelText,n.value]])}}),Bs={},Cs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function Ss(r,t){return e.openBlock(),e.createElementBlock("svg",Cs,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),e.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const Ns=q(Bs,[["render",Ss]]),Ms={},$s={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function As(r,t){return e.openBlock(),e.createElementBlock("svg",$s,t[0]||(t[0]=[e.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),e.createElementVNode("path",{d:"M7 20V4"},null,-1),e.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),e.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const Fs=q(Ms,[["render",As]]),Ds={},Ls={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Is(r,t){return e.openBlock(),e.createElementBlock("svg",Ls,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Ts=q(Ds,[["render",Is]]),Os={},Rs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function zs(r,t){return e.openBlock(),e.createElementBlock("svg",Rs,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const js=q(Os,[["render",zs]]),Us={},Ps={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Hs(r,t){return e.openBlock(),e.createElementBlock("svg",Ps,t[0]||(t[0]=[e.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const Dt=q(Us,[["render",Hs]]),Gs={},qs={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ks(r,t){return e.openBlock(),e.createElementBlock("svg",qs,t[0]||(t[0]=[e.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const Zs=q(Gs,[["render",Ks]]),Ws={},Ys={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Js(r,t){return e.openBlock(),e.createElementBlock("svg",Ys,t[0]||(t[0]=[e.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const Xs=q(Ws,[["render",Js]]),Qs={class:"vs-datatable border rounded-xl w-full flex-grow"},ea={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},ta={class:"relative w-full"},la={class:"table-wrapper flex gap-2"},na={class:"vs-popover inline-block text-slate-700"},oa={class:"text-center"},sa={class:""},aa={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},ra={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},ia={class:"text-sm items-center text-gray-800 flex gap-1"},ca={class:"w-full overflow-x-auto"},da={class:"w-full table-auto caption-bottom text-sm"},ua={class:"[&_tr]:border-b"},pa={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},ha={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},ma={key:0,colspan:"100%",class:"text-center"},fa={class:"w-full"},ga={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},ka=["onDragstart","onDragover","onDrop"],ya={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},ba={class:"flex items-center justify-center"},xa={key:0,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},wa={key:0},_a=["src"],Ea={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},va=["innerHTML"],Va={key:2,class:"line-clamp-2 rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},Ba={key:3,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},Ca={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},Sa={class:"flex items-center justify-center gap-2"},Na=["onClick"],Ma=["onClick"],$a={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Lt=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.ref({}),o=e.ref(""),s=e.computed(()=>{if(!o.value)return l.value??[];const O=o.value.toLowerCase();return l.value.filter(D=>t.colModel?.some(A=>{const U=D[A.key];return U?Array.isArray(U)?U.join(", ").toLowerCase().includes(O):String(U).toLowerCase().includes(O):!1}))}),a=e.ref(null),i=e.ref(null),c=e.ref(!1),d=e.ref(null),m=e.ref({top:0,left:0}),f=O=>{a.value=O},E=O=>{i.value=O},k=O=>{if(a.value===null||a.value===O){a.value=null,i.value=null;return}const D=[...l.value],[A]=D.splice(a.value,1);D.splice(O,0,A),l.value=D,a.value=null,i.value=null},N=O=>{const A=O.currentTarget.getBoundingClientRect();m.value={top:A.bottom+window.scrollY,left:A.left+window.scrollX},c.value=!c.value},y=()=>{d.value&&d.value.click()},h=O=>{const D=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],A=O.toLowerCase();return D.some(U=>A.endsWith(U))},x=O=>{const A=O.target.files?.[0];if(!A)return;const U=new FileReader;U.onload=W=>{try{const re=W.target?.result;if(typeof re=="string"){const fe=JSON.parse(re);Array.isArray(fe)&&l.value.push(...fe)}}catch(re){console.error("Error parsing file:",re)}},U.readAsText(A)},w=()=>{const O=JSON.stringify(l.value,null,2),D=new Blob([O],{type:"application/json"}),A=URL.createObjectURL(D),U=document.createElement("a");U.href=A,U.download="data.json",U.click(),URL.revokeObjectURL(A)};e.onMounted(async()=>{const O=t.colModel?.filter(D=>D.data);O?.length&&Promise.all(O.map(async D=>{const U=await(await fetch(`/api/suggest/${D.data}`)).json();n.value[D.key]=U.data}))});const C=e.ref(""),b=e.ref(!1);let v="edit",$=0;const M=e.ref({}),z=e.ref({});async function X(){C.value="Додати",b.value=!0,v="add",M.value={}}function G(O,D){const A=D.key||D.name;return n.value[A]&&O[A]?n.value[A].find(U=>U.id.toString()===O[A].toString())?.text??O[A]:O[A]||"-"}async function F(O,D){C.value="Редагувати",b.value=!0,v="edit",$=D,M.value={...O}}function K(){const O=z.value.validate();if(O){ee.notify({type:"warning",title:"Помилка валідації",message:Object.entries(O).map(([D,A])=>`${D}: ${A}`).join(`
2
- `)});return}v==="add"?Array.isArray(l.value)?l.value=[...l.value,M.value]:l.value=[M.value]:l.value=l.value.map((D,A)=>A===$?M.value:D),b.value=!1}function Y(O){l.value=l.value.filter((D,A)=>A!==O)}function Q(){b.value=!1}return(O,D)=>(e.openBlock(),e.createElementBlock("div",Qs,[e.createElementVNode("div",ea,[e.createElementVNode("div",ta,[e.createVNode(Ns,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":D[0]||(D[0]=A=>o.value=A),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[e.vModelText,o.value]])]),e.createElementVNode("div",la,[e.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:x,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",na,[e.createElementVNode("div",oa,[e.createElementVNode("div",sa,[e.createElementVNode("button",{onClick:N,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[e.createVNode(Fs,{height:"16",width:"16"})])])])])]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:e.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:m.value.top+"px",left:m.value.left+"px"}])},[e.createElementVNode("div",aa,[e.createElementVNode("div",ra,[e.createElementVNode("button",{onClick:y,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(Ts,{class:"text-black",width:"14",height:"14"}),D[4]||(D[4]=e.createTextVNode(" Імпортувати ",-1))]),e.createElementVNode("button",{onClick:w,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createElementVNode("span",ia,[e.createVNode(js,{class:"text-black",width:"14",height:"14"}),D[5]||(D[5]=e.createTextVNode(" Експортувати ",-1))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:X,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[e.createVNode(Be),D[6]||(D[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",ca,[e.createElementVNode("table",da,[e.createElementVNode("thead",ua,[e.createElementVNode("tr",pa,[e.createElementVNode("th",ha,[e.createVNode(Dt,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.colModel,A=>(e.openBlock(),e.createElementBlock("th",{key:A.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},e.toDisplayString(A.ua||A.label),1))),128)),D[7]||(D[7]=e.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[s.value.length===0?(e.openBlock(),e.createElementBlock("td",ma,[e.createElementVNode("div",fa,[e.createElementVNode("div",ga,[e.createVNode(Zs,{class:"w-48 mx-auto"}),D[8]||(D[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(A,U)=>(e.openBlock(),e.createElementBlock("tr",{key:A.id,class:e.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":a.value===U,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===U}]),draggable:"true",onDragstart:W=>f(U),onDragover:e.withModifiers(W=>E(U),["prevent"]),onDrop:W=>k(U)},[e.createElementVNode("td",ya,[e.createElementVNode("div",ba,[e.createVNode(Dt,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(O.colModel,W=>(e.openBlock(),e.createElementBlock("td",{key:W.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[W.type==="file"?(e.openBlock(),e.createElementBlock("div",xa,[h(G(A,W))?(e.openBlock(),e.createElementBlock("div",wa,[e.createElementVNode("img",{src:G(A,W),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,_a)])):(e.openBlock(),e.createElementBlock("div",Ea,[e.createVNode(Bt,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):W.type==="tiptap-editor"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors line-clamp-3",innerHTML:G(A,W)},null,8,va)):W.type==="reference"?(e.openBlock(),e.createElementBlock("div",Va,e.toDisplayString(G(A,W)),1)):(e.openBlock(),e.createElementBlock("div",Ba,e.toDisplayString(G(A,W)),1))]))),128)),e.createElementVNode("td",Ca,[e.createElementVNode("div",Sa,[e.createElementVNode("button",{onClick:W=>F(A,U),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[e.createVNode(Xs,{width:"24",height:"24",class:"w-3 h-3"})],8,Na),e.createElementVNode("button",{onClick:W=>Y(U),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[e.createVNode(qe,{width:"24",height:"24",class:"w-3 h-3"})],8,Ma)])])],42,ka))),128))],2)])]),e.createVNode(e.unref(ee.VsModal),{teleport:"#modal",visible:b.value,title:C.value,size:"lg",onClose:Q},{default:e.withCtx(()=>[e.createVNode(_e,{schema:t.colModel,values:M.value,"onUpdate:values":D[1]||(D[1]=A=>M.value=A),form:z.value,"onUpdate:form":D[2]||(D[2]=A=>z.value=A)},null,8,["schema","values","form"]),e.createElementVNode("div",$a,[e.createElementVNode("button",{type:"button",onClick:D[3]||(D[3]=A=>b.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:K,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),Aa={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}};function De(r){return r?r.type==="Polygon"?{type:"MultiPolygon",coordinates:[r.coordinates]}:r.type==="Feature"?{...r,geometry:De(r.geometry)}:r.type==="FeatureCollection"?{...r,features:(r.features||[]).map(t=>De(t)).filter(Boolean)}:r:null}function Fa(r){return r?r.type==="FeatureCollection"||r.type==="Feature"?De(r):r.geom?{type:"Feature",geometry:De({type:r.geom.type,coordinates:r.geom.coordinates}),properties:{}}:r.type&&r.coordinates?{type:"Feature",geometry:De(r),properties:{}}:null:null}const Da={},La={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function Ia(r,t){return e.openBlock(),e.createElementBlock("svg",La,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),e.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const Ta=q(Da,[["render",Ia]]),Oa={},Ra={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function za(r,t){return e.openBlock(),e.createElementBlock("svg",Ra,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const ja=q(Oa,[["render",za]]),Ua={},Pa={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function Ha(r,t){return e.openBlock(),e.createElementBlock("svg",Pa,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const Ga=q(Ua,[["render",Ha]]),qa={},Ka={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function Za(r,t){return e.openBlock(),e.createElementBlock("svg",Ka,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const Wa=q(qa,[["render",Za]]),Ya={},Ja={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function Xa(r,t){return e.openBlock(),e.createElementBlock("svg",Ja,t[0]||(t[0]=[e.createElementVNode("title",null,null,-1),e.createElementVNode("desc",null,null,-1),e.createElementVNode("defs",null,null,-1),e.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[e.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[e.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[e.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const Qa=q(Ya,[["render",Xa]]),er={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},tr={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},lr=["onClick"],nr={class:"relative flex-1 min-w-[140px]"},or=["placeholder"],sr="https://data.softpro.ua/api-user/gis-url-proxy",ar="https://geo.rv.ua/api-user/dzk.api",rr=q(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(r,{emit:t}){const l=r,n=t,o=["here","xy","parcel"],s=e.computed(()=>{const b=l.config?.tools?.filter(v=>o.includes(v));return b&&b.length?b:o}),a=e.computed(()=>l.config?.placeholder?.trim()||"Пошук…"),i=e.ref(s.value[0]??o[0]);e.watch(s,b=>{b.includes(i.value)||(i.value=b[0])});const c=e.ref(""),d=e.ref(!1),m=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function f(b){i.value=b}function E(b){if(!d.value)return;const v=m.value;v&&!v.contains(b.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",E,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",E,!0)});function k(b){return b==="xy"?"Координати":b==="parcel"?"Кадастр":"Адреси"}function N(b){const v=b.replace(/[,]+/g," ").trim();if(!v)return null;const $=v.split(/\s+/).filter(Boolean);if($.length<2)return null;const M=$.slice(0,2).map(Number);if(!M.every(Q=>Number.isFinite(Q)))return null;let[z,X]=M,G=z,F=X;const K=Q=>Math.abs(Q)<=90,Y=Q=>Math.abs(Q)<=180;if(!K(G)||!Y(F))if(K(F)&&Y(G))G=X,F=z;else return null;return{lat:G,lng:F}}function y(b){return(b?.items||[]).map(($,M)=>({id:String($?.id??M),title:$?.title||$?.address?.label||"Знайдений обʼєкт",lat:Number($?.position?.lat),lng:Number($?.position?.lng)})).filter($=>Number.isFinite($.lat)&&Number.isFinite($.lng))}function h(b){const v=b?.result||b?.data||b;if(!v)return[];const $=v.geom_centroid;if(!$||!Array.isArray($.coordinates))return[];const[M,z]=$.coordinates;return!Number.isFinite(z)||!Number.isFinite(M)?[]:[{id:"parcel",title:v.cadnum||v.cad_num||"Земельна ділянка",lat:z,lng:M}]}function x(b){const $=b.replace(/\s+/g,"").split(":");if($.length!==4)return!1;const M=[10,2,3,4];return $.every((z,X)=>z.length===M[X]&&/^\d+$/.test(z))}function w(b){n("goToCoordinates",[b.lat,b.lng])}async function C(){const b=c.value.trim();if(b){if(i.value==="xy"){const v=N(b);if(!v){ee.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}w(v),c.value="";return}try{const v=new URL(i.value==="here"?sr:ar);if(i.value==="here")v.searchParams.set("searchtext",b);else{if(!x(b)){ee.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}v.searchParams.set("cad_num",b)}const $=await fetch(v.toString());if(!$.ok)throw new Error(`HTTP ${$.status}`);const M=await $.json(),z=i.value==="here"?y(M):h(M);if(!z.length)ee.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const X=z[0];w(X),c.value=""}}catch(v){const $=v?.message||"Помилка пошуку";ee.notify({type:"error",title:"Пошук",message:$})}}}return(b,v)=>(e.openBlock(),e.createElementBlock("div",er,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(C,["prevent"])},[s.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:m,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:v[0]||(v[0]=$=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(k(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v[2]||(v[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(e.openBlock(),e.createElementBlock("div",tr,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,$=>(e.openBlock(),e.createElementBlock("li",{key:$,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:M=>f($)},e.toDisplayString(k($)),9,lr))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",nr,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":v[1]||(v[1]=$=>c.value=$),placeholder:a.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,or),[[e.vModelText,c.value,void 0,{trim:!0}]]),v[3]||(v[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-3048520a"]]),ir={class:"bg-white/30 p-1 rounded-md shadow"},cr={class:"flex gap-2"},dr=["onClick","title"],ur=["src"],pr=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(r,{emit:t}){const l=r,n=e.ref(Object.keys(l.basemaps)[0]),o=t;function s(a){o("onLayerChange",a),n.value=a}return(a,i)=>(e.openBlock(),e.createElementBlock("div",ir,[e.createElementVNode("div",cr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.basemaps,(c,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":n.value===d}]),onClick:m=>s(d),title:c.name||d,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:c.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,ur)],10,dr))),128))])]))}}),hr={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},mr={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},fr={class:"text-sm font-medium"},gr={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},kr={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},yr={class:"flex items-center gap-1"},br=["disabled"],xr=["disabled"],wr=["disabled"],_r={class:"absolute top-4 right-4 z-[1000]"},Er={class:"flex flex-col gap-[2px]"},vr=["disabled"],Vr=["disabled"],Br=["disabled"],Cr=["disabled"],Sr={class:"flex flex-col gap-2"},Nr={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},Mr={class:"flex flex-col gap-1"},$r=["checked","disabled","onChange"],Ar={class:"text-gray-700 text-xs font-medium"},Fr={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},Dr={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Lr={class:"shrink-0"},Ir={class:"font-bold"},Tr={class:"flex items-center"},Or={class:"text-xs mr-2"},Rr={key:0,class:"text-xs"},zr={key:1,class:"text-xs"},jr=["disabled"],Ur=["disabled"],It=q(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},layers:{default:()=>[]},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(r,{emit:t}){const l=e.getCurrentInstance(),n=r,o=t,s=e.computed(()=>{const u={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!n.tools||!n.tools.length)return u;const p=new Set(n.tools.map(B=>B.toLowerCase()));return{search:p.has("search"),import:p.has("import"),export:p.has("export"),point:p.has("point"),line:p.has("line"),polygon:p.has("polygon"),rectangle:p.has("rectangle")}}),a=e.computed(()=>!!n.disabled),i=e.ref(!1),c=e.ref(null),d=e.ref(null),m=e.ref(!1),f=e.ref(""),E=e.reactive({}),k=e.ref([]),N=e.computed(()=>k.value.map(u=>E[u]).filter(u=>!!u)),y=e.computed(()=>Array.isArray(n.layers)&&n.layers.some(u=>`${u?.service??""}`.toLowerCase()==="vtile"));let h,x,w;function C(){const u=navigator.platform.toUpperCase().indexOf("MAC")>=0;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}const b=e.ref(null),v=e.ref(null);let $=null;const M=e.ref(null),z=u=>{u.ctrlKey&&u.preventDefault()};function X(u,p){return u?.id?String(u.id):u?.url?`${u.url}-${p}`:`layer-${p}`}function G(u){if(!u)return"";if(/^https?:\/\//i.test(u))return u.replace(/\/+$/,"");const p=u.replace(/^\/+/,"").replace(/\/+$/,"");return p?`/${p}`:""}function F(u){const p=u?.url??"";if(!p||/^https?:\/\//i.test(p))return p;const B=typeof window<"u"&&window.location?.origin?window.location.origin:"";if(p.startsWith("/"))return B?`${B}${p}`:p;const S=G(u?.prefix),I=G(n.prefix),H=S||I,g=p.replace(/^\/+/,""),_=H?`${H.replace(/\/$/,"")}/${g}`:`/${g}`;return B?`${B}${_}`:_}function K(u){const p=u?.style??{};return B=>{const S=p.colorAttr,I=p.colorSet??{},H=typeof S=="string"?I?.[B?.[S]]??p.color??"#3388ff":p.color??"#3388ff",g=p.stroke??H;return{weight:p.width??1,color:g,opacity:p.opacity??1,fill:p.type?p.type!=="polyline":!0,fillColor:H,fillOpacity:p.opacity??.5}}}function Y(u){const p=u?.colorSet||u?.colors;if(u?.colorAttr&&p){const B=Object.entries(p).flat();return["match",["get",u.colorAttr],...B,u.color??"#94a3b8"]}return u?.color??"#3388ff"}function Q(u,p,B){if(!u)return[];const S=[],I=Y(u);return u.icon&&S.push({id:`${p}-icon`,type:"symbol",source:p,"source-layer":B,minzoom:u.iconZoom||0,layout:{"icon-image":u.icon,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),u.pointZoom&&S.push({id:`${p}-point`,type:"circle",source:p,"source-layer":B,maxzoom:u.pointZoom,paint:{"circle-stroke-color":u.stroke||"#fff","circle-opacity":u.opacity??1,"circle-color":I,"circle-stroke-width":u.width??1,"circle-radius":u.radius??5}}),u.type==="polygon"?S.push({id:`${p}-fill`,type:"fill",source:p,"source-layer":B,minzoom:u.pointZoom||0,paint:{"fill-color":I,"fill-opacity":u.opacity??.5,"fill-outline-color":u.stroke||I}}):u.type==="line"?S.push({id:`${p}-line`,type:"line",source:p,"source-layer":B,paint:{"line-color":I,"line-opacity":u.opacity??1,"line-width":u.width??1.5}}):u.icon||S.push({id:`${p}-circle`,type:"circle",source:p,"source-layer":B,paint:{"circle-stroke-color":u.stroke||"#fff","circle-opacity":u.opacity??1,"circle-color":I,"circle-stroke-width":u.width??1,"circle-radius":u.radius??5}}),S}function O(u,p){const B=u.id||`source-${Math.random().toString(36).slice(2,8)}`,S=u.sourceLayer||u.layer||u.service_layer||u.service_key||u.map_key||u.dataset?.layer||u.id||u.table_name||B,I=Q(u.style||{},B,S||B);return I.length?{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{[B]:{type:"vector",tiles:[p],minzoom:u.minzoom??0,maxzoom:u.maxzoom??19}},layers:I}:null}function D(u){const p=(u?.service??"").toLowerCase(),B=F(u),S=u.sourceLayer||u.layer||u.service_layer||u.service_key||u.map_key||u.dataset?.layer||u.id||u.table_name;if(console.info("[vs-input-map] create overlay layer",{id:u.id,service:p,url:B,sourceLayer:S,hasSourceLayer:!!S}),p==="vtile"){if(L?.vectorGrid?.protobuf&&!L?.maplibreGL)return console.info("[vs-input-map] using Leaflet.vectorGrid"),L.vectorGrid.protobuf(B,{interactive:!0,vectorTileLayerStyles:{default:K(u)}});if(L?.maplibreGL&&window?.maplibregl){console.info("[vs-input-map] using maplibre-gl-leaflet");const I=O(u,B);return I?L.maplibreGL({style:I,interactive:!1,pane:"overlayPane"}):(console.warn("[vs-input-map] maplibre spec is empty",u.id),null)}return null}return p==="tile"||/^https?:\/\//i.test(B)||B.includes("{z}")?L.tileLayer(B,{opacity:u?.style?.opacity??1}):L.tileLayer(B,{opacity:u?.style?.opacity??1})}function A(){h&&k.value.forEach(u=>{const p=E[u];p&&(p.visible?(p.layer||(p.layer=D(p.config)),p.layer&&!h.hasLayer(p.layer)?(console.info("[vs-input-map] add overlay layer to map",p.id),p.layer.addTo(h)):p.layer||console.warn("[vs-input-map] overlay layer is null",p.id)):p.layer&&h.hasLayer(p.layer)&&(console.info("[vs-input-map] remove overlay layer from map",p.id),h.removeLayer(p.layer)))})}function U(u){if(a.value)return;const p=E[u];p&&(p.visible=!p.visible,h&&(console.info("[vs-input-map] toggle overlay",{id:u,nextVisible:p.visible,hasLayerInstance:!!p.layer}),p.visible?(p.layer||(p.layer=D(p.config)),p.layer&&!h.hasLayer(p.layer)&&(console.info("[vs-input-map] add overlay layer to map",p.id),p.layer.addTo(h))):p.layer&&h.hasLayer(p.layer)&&h.removeLayer(p.layer)))}function W(){if(!n.handleZoom)return null;let u;const p=S=>{const I=S.ctrlKey||S.metaKey,H=S.shiftKey;if(!I&&!H){m.value=!0,f.value=C(),clearTimeout(u),u=window.setTimeout(()=>{m.value=!1},1e3);return}m.value=!1,h.scrollWheelZoom.enable(),setTimeout(()=>{h.scrollWheelZoom.disable()},100)},B=S=>{if(S.touches.length===1){m.value=!0,f.value=C(),clearTimeout(u),u=window.setTimeout(()=>{m.value=!1},3e3);return}m.value=!1};return v.value&&(v.value.addEventListener("wheel",p,{passive:!1}),v.value.addEventListener("touchstart",B,{passive:!0})),h&&h.on("wheel",S=>{const I=S.originalEvent.ctrlKey||S.originalEvent.metaKey,H=S.originalEvent.shiftKey;!I&&!H&&(S.originalEvent.preventDefault(),S.originalEvent.stopPropagation())}),()=>{v.value&&(v.value.removeEventListener("wheel",p),v.value.removeEventListener("touchstart",B)),h&&h.off("wheel"),clearTimeout(u)}}const re=e.ref(null),fe=e.ref(6),xe=e.ref(0),ft=e.ref(l?.appContext.config.globalProperties.$settings?.center||[50,30]),oe=e.ref(null),ue=je();let Se;const ze=e.ref("topo100");function Xe(u){return u?u.type==="Polygon"?{type:"MultiPolygon",coordinates:[u.coordinates]}:(u.type==="MultiPolygon",u):null}function gt(){return new Promise((u,p)=>{window.L&&window.L.Draw&&u(0);const B=H=>{if(Array.from(document.styleSheets).some(V=>V?.href?.includes(H)))return;const _=document.createElement("link");_.rel="stylesheet",_.href=H,document.head.appendChild(_)},S=H=>new Promise((g,_)=>{const V=Array.from(document.scripts).find(J=>J.src===H);if(V){V.addEventListener("load",()=>g()),V.addEventListener("error",J=>_(J));return}const R=document.createElement("script");R.src=H,R.async=!0,R.onload=()=>g(),R.onerror=J=>_(J),document.body.appendChild(R)});B("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),B("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),y.value&&B("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css");let I=S("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>S("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"));y.value?I=I.then(()=>S("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js")).then(()=>(window.maplibregl&&!window.mapboxgl&&(window.mapboxgl=window.maplibregl),S("https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"))):I=I.then(()=>S("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>Promise.resolve())),I.then(()=>u(0)).catch(p)})}function ge(){const u=x.toGeoJSON(),p=[];let B=null;const S=H=>{if(H)switch(H.type){case"Point":B=H;break;case"Polygon":p.push(H.coordinates);break;case"MultiPolygon":p.push(...H.coordinates);break;case"GeometryCollection":(H.geometries||[]).forEach(S);break}};(u?.features||[]).forEach(H=>S(H.geometry));const I=B||(p.length?{type:"MultiPolygon",coordinates:p}:null);o("update:modelValue",I?Xe(I):null),xe.value=x.getLayers().length}function we(u=30){const p=x.getLayers();if(!p.length)return;const S=L.featureGroup(p).getBounds();S&&S.isValid()&&h.fitBounds(S,{padding:[u,u]})}function Ne(){a.value||M.value?.click()}const ie=e.ref("");e.watch(s,u=>{ie.value&&!Object.entries(u).filter(([p,B])=>B).map(([p])=>p).includes(ie.value)&&(w?.disable&&w.disable(),ie.value="")}),e.watch(()=>n.layers,u=>{const p=Array.isArray(u)?u:[],B=[],S=new Set;p.forEach((I,H)=>{if(!I)return;const g=X(I,H);B.push(g),S.add(g),console.info("[vs-input-map] overlay register",{id:g,service:I?.service,url:I?.url});const _=E[g];_?E[g]={..._,config:{...I,id:g}}:E[g]={id:g,config:{...I,id:g},visible:I?.overlay!==!1,layer:null}}),Object.keys(E).forEach(I=>{if(S.has(I))return;const H=E[I];H?.layer&&h?.hasLayer&&h.hasLayer(H.layer)&&h.removeLayer(H.layer),delete E[I]}),k.value=B,A()},{immediate:!0,deep:!0}),e.watch(a,u=>{u&&w&&(w.disable(),ie.value=""),x&&x.eachLayer(p=>{u?p.dragging?.disable?.():p.dragging?.enable&&(p.dragging.enable(),p.dragging.enabled?.())})});function Me(u){return u instanceof L.Circle?"Circle":u instanceof L.Rectangle?"Rectangle":u instanceof L.Polygon&&!(u instanceof L.Rectangle)?"Polygon":u instanceof L.Polyline&&!(u instanceof L.Polygon)?"Polyline":u instanceof L.Marker?"Point":"Feature"}function kt(u){if(u instanceof L.Circle){const p=u.getRadius();return Math.PI*(p*p)/1e6}if(u instanceof L.Polygon||u instanceof L.Rectangle)try{const p=u.getLatLngs(),B=Array.isArray(p[0])?p[0]:p,S=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(B):0;return S?S/1e6:0}catch{return null}return null}function Qe(u){return u instanceof L.Circle?u.getLatLng():u.getBounds?u.getBounds().getCenter():u.getLatLng?u.getLatLng():h.getCenter()}async function et(u,p){if(b.value="",!n.api?.length)return;const[B,S]=n.api;try{const I=new URL(B);I.searchParams.set("lat",String(u)),I.searchParams.set("lon",String(p));const H=await fetch(I.toString());if(!H.ok)throw new Error("Request failed");const g=await H.json();S&&g[S]!==void 0?b.value=String(g[S]):b.value=JSON.stringify(g)}catch(I){console.error("[vs-input-map] reverse geocode failed:",I),b.value=null}}function ke(){const u=x.getLayers();if(!u.length){oe.value=null,xe.value=0;return}const p=u[u.length-1],B=Me(p),S=Qe(p),I=kt(p);oe.value={type:B,center:S,areaKm2:I,layer:p},xe.value=u.length,et(S.lat,S.lng)}function tt(){if(a.value)return;const u=oe.value?.layer;u&&(u instanceof L.Circle&&u.getBounds?h.fitBounds(u.getBounds(),{padding:[30,30]}):u.getBounds?h.fitBounds(u.getBounds(),{padding:[30,30]}):u.getLatLng&&h.setView(u.getLatLng(),Math.max(fe.value,14)))}function lt(){if(a.value)return;const u=oe.value?.layer;u&&(x.removeLayer(u),ge(),ke())}e.onMounted(async()=>{document.addEventListener("wheel",z,{passive:!1}),await gt(),L.drawLocal=Aa;const u=n.handleZoom;h=L.map(v.value,{zoomControl:!1,scrollWheelZoom:!u}).setView(ft.value,10),setTimeout(()=>{$=W()},100),L.control.zoom({position:"bottomright"}).addTo(h),ze.value=Object.keys(ue)[0],Se=L.tileLayer(ue[ze.value].url,{maxZoom:19,minZoom:6}).addTo(h),x=new L.FeatureGroup().addTo(h),h.on(L.Draw.Event.CREATED,S=>{if(a.value)return;const{layer:I}=S;x.clearLayers(),x.addLayer(I),ge(),we(),ie.value=""}),h.on(L.Draw.Event.EDITED,()=>{a.value||(ge(),ke(),we())}),h.on(L.Draw.Event.DELETED,()=>{a.value||(ge(),ke(),we())});let p=!1;h.on("mousemove",S=>{p||(h.invalidateSize(),p=!0),re.value=S.latlng}),h.on("zoomend",()=>{fe.value=h.getZoom()});const B=Fa(n.modelValue);if(B){const S=[];L.geoJSON(B).eachLayer(I=>S.push(I)),S.length&&x.addLayer(S[0]),ge(),ke(),we()}A()}),e.onUnmounted(()=>{document.removeEventListener("wheel",z),$&&$(),Object.values(E).forEach(u=>{u?.layer&&(h?.hasLayer?.(u.layer)&&h.removeLayer(u.layer),typeof u.layer.remove=="function"&&u.layer.remove())})});function Ee(u){if(!a.value&&h){switch(w&&w.disable(),u){case"marker":w=new L.Draw.Marker(h);break;case"polyline":w=new L.Draw.Polyline(h);break;case"polygon":w=new L.Draw.Polygon(h);break;case"rectangle":w=new L.Draw.Rectangle(h);break;default:w=new L.Draw.Rectangle(h);break}w&&(w.enable(),ie.value=u)}}function nt(){if(a.value)return;const u=x.toGeoJSON(),p=new Blob([JSON.stringify(u,null,2)],{type:"application/json"}),B=URL.createObjectURL(p),S=document.createElement("a");S.href=B,S.download="data.geojson",S.click(),URL.revokeObjectURL(B)}function ot(u){if(a.value)return;const p=u.target,B=p.files?.[0];if(!B)return;const S=new FileReader;S.onload=()=>{if(typeof S.result=="string")try{const I=JSON.parse(S.result);x.clearLayers(),I&&L.geoJSON({type:"Feature",geometry:I}).eachLayer(H=>{x.addLayer(H)}),ge(),ke(),we()}finally{p.value=""}},S.readAsText(B)}function $e(u){h&&(Se&&h.removeLayer(Se),Se=L.tileLayer(ue[u].url,{maxZoom:19,minZoom:6}).addTo(h),ze.value=u)}function Ae(u){const p=L.latLng(u[0],u[1]);h.setView(p,13)}e.watch(()=>n.modelValue,u=>{const p=Xe(u);if(u&&p!==u){o("update:modelValue",p);return}x.clearLayers(),p&&L.geoJSON({type:"Feature",geometry:p}).eachLayer(B=>{if(x.addLayer(B),a.value){B.dragging?.disable?.();return}B.dragging?.enable?.(),B.dragging?.enabled?.(),B.on("dragend",S=>{const H=S.target.getLatLng();o("update:modelValue",{type:"Point",coordinates:[H.lng,H.lat]})})}),xe.value=x.getLayers().length,ke(),we()});function je(){return l?.appContext.config.globalProperties.$settings?.basemaps?l?.appContext.config.globalProperties.$settings?.basemaps.map((u,p)=>Object.assign(u,{key:`b${p}`,preview:u.preview||u.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((u,p)=>({...u,[p.key]:p}),{}):{topo100:{url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const ve=e.ref(!1);return e.watch(ve,()=>{setTimeout(()=>{h.invalidateSize()},50)}),e.watch(i,async u=>{if(!u||!d.value){c.value=null;return}await e.nextTick();const p=d.value.getBoundingClientRect();c.value={top:p.bottom+6,left:p.left}}),e.onUnmounted(()=>{i.value=!1,c.value=null}),(u,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:ve.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:v,class:"w-full h-full"},null,512),e.createVNode(e.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:e.withCtx(()=>[m.value&&n.handleZoom?(e.openBlock(),e.createElementBlock("div",hr,[e.createElementVNode("div",mr,[e.createElementVNode("p",fr,e.toDisplayString(f.value),1)])])):e.createCommentVNode("",!0)]),_:1}),s.value.search||s.value.import||s.value.export?(e.openBlock(),e.createElementBlock("div",gr,[s.value.search?(e.openBlock(),e.createBlock(rr,{key:0,onGoToCoordinates:Ae})):e.createCommentVNode("",!0),s.value.import||s.value.export?(e.openBlock(),e.createElementBlock("div",kr,[e.createElementVNode("div",yr,[s.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Ne,disabled:a.value}," Import ",8,br)):e.createCommentVNode("",!0),s.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:nt,disabled:a.value||xe.value===0}," Export ",8,xr)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:M,type:"file",onChange:ot,accept:".json,.geojson",class:"hidden",disabled:a.value},null,40,wr)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",_r,[e.createElementVNode("div",Er,[s.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":ie.value==="marker"}]),title:"Point",onClick:p[0]||(p[0]=B=>Ee("marker")),disabled:a.value},[e.createVNode(Ta)],10,vr)):e.createCommentVNode("",!0),s.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":ie.value==="polyline"}]),title:"Line",onClick:p[1]||(p[1]=B=>Ee("polyline")),disabled:a.value},[e.createVNode(ja)],10,Vr)):e.createCommentVNode("",!0),s.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":ie.value==="polygon"}]),title:"Polygon",onClick:p[2]||(p[2]=B=>Ee("polygon")),disabled:a.value},[e.createVNode(Ga)],10,Br)):e.createCommentVNode("",!0),s.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":ie.value==="rectangle"}]),title:"Rectangle",onClick:p[3]||(p[3]=B=>Ee("rectangle")),disabled:a.value},[e.createVNode(Wa)],10,Cr)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:p[4]||(p[4]=B=>ve.value=!ve.value),title:"Full Screen"},[e.createVNode(Qa,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",oe.value?"bottom-8":"bottom-4"])},[e.createElementVNode("div",Sr,[e.createVNode(pr,{basemaps:e.unref(ue),onOnLayerChange:$e},null,8,["basemaps"]),N.value.length?(e.openBlock(),e.createElementBlock("div",Nr,[p[9]||(p[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Layers",-1)),e.createElementVNode("div",Mr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,B=>(e.openBlock(),e.createElementBlock("label",{key:B.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:B.visible,disabled:a.value,onChange:S=>U(B.id)},null,40,$r),e.createElementVNode("span",Ar,e.toDisplayString(B.config.title||B.config.name||B.id),1)]))),128))])])):e.createCommentVNode("",!0)])],2),e.createElementVNode("div",Fr,[oe.value?(e.openBlock(),e.createElementBlock("div",Dr,[e.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:p[5]||(p[5]=B=>i.value=!0),onMouseleave:p[6]||(p[6]=B=>i.value=!1)},[e.createElementVNode("div",Lr,[p[10]||(p[10]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",Ir,e.toDisplayString(oe.value.type),1)]),b.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"addressEl",ref:d,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+e.toDisplayString(b.value),513)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[i.value&&b.value&&c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:e.normalizeStyle({top:c.value.top+"px",left:c.value.left+"px"})},e.toDisplayString(b.value),5)):e.createCommentVNode("",!0)]))],32),e.createElementVNode("div",Tr,[e.createElementVNode("div",Or,[p[11]||(p[11]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(oe.value.center.lat.toFixed(5))+", "+e.toDisplayString(oe.value.center.lng.toFixed(5)),1)]),oe.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",Rr,[p[12]||(p[12]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(oe.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",zr,p[13]||(p[13]=[e.createTextVNode("Area: ",-1),e.createElementVNode("b",null,"—",-1)]))),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:p[7]||(p[7]=B=>tt()),disabled:a.value},p[14]||(p[14]=[e.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-3 h-3" data-v-150e767b><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-150e767b></path><path d="M7 10l6 0" data-v-150e767b></path><path d="M10 7l0 6" data-v-150e767b></path><path d="M21 21l-6 -6" data-v-150e767b></path></svg>',1)]),8,jr),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:p[8]||(p[8]=B=>lt()),disabled:a.value},[e.createVNode(qe,{class:"w-3 h-3"})],8,Ur)])])):e.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-150e767b"]]),Pr=["data-focus"],Hr={class:"flex items-center"},Gr={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},qr=["onClick","aria-label"],Kr={key:0,class:"absolute text-gray-500 truncate pl-2"},Zr={class:"flex-1 min-w-[2px]"},Wr=["placeholder"],Yr={class:"flex items-center shrink-0"},Jr=["disabled"],Tt=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(r,{emit:t}){const l=r,n=t;ae(l.style);const o=e.ref(null),s=e.ref(null),a=e.ref(null),i=e.ref(!1),c=e.ref(""),d=e.useModel(r,"modelValue"),m=e.computed(()=>l.placeholder||"Add tag…"),f=e.computed(()=>d.value?.length===0&&c.value===""),E=e.computed(()=>!l.disabled&&d.value?.length>0),k=e.computed(()=>l.disabled),N=async()=>{k.value||await e.nextTick(()=>a.value?.focus())},y=$=>{const M=$.trim();M!==""&&(!d.value||!Array.isArray(d.value)?d.value=[M]:l.unique?d.value.includes(M)||(d.value=[...d.value,M]):d.value=[...d.value,M],c.value="")},h=()=>{const $=c.value;$.trim()!==""&&y($),c.value=""},x=$=>{const M=d.value.slice();M.splice($,1),n("update:modelValue",M)},w=()=>{n("update:modelValue",[])},C=()=>{k.value||(i.value=!0)},b=()=>{i.value=!1,!k.value&&h()},v=$=>{const{key:M}=$;M==="Enter"?($.preventDefault(),h()):M==="Backspace"&&c.value===""&&d.value.length>0&&x(d.value.length-1)};return($,M)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:M[1]||(M[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",l.customClass]),role:"group","aria-label":"Tag input"},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",k.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:N},[e.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:s},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(z,X)=>(e.openBlock(),e.createElementBlock("div",{key:X,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",Hr,[e.createElementVNode("div",Gr,e.toDisplayString(z),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(G=>x(X),["stop"]),"aria-label":`Remove ${z}`},M[2]||(M[2]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,qr)]))),128)),f.value?(e.openBlock(),e.createElementBlock("div",Kr,e.toDisplayString(m.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Zr,[k.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:a,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":M[0]||(M[0]=z=>c.value=z),onFocus:C,onBlur:b,onKeydown:v,placeholder:d.value&&d.value.length?"":void 0},null,40,Wr)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",Yr,[E.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:k.value,onClick:e.withModifiers(w,["stop"])},M[3]||(M[3]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Jr)):e.createCommentVNode("",!0)])],10,Pr)],2)],512))}}),Xr={class:"relative flex gap-1 bg-white w-full"},Qr=["disabled","placeholder"],Ot=q(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=e.inject("values"),l=r,n=e.useModel(r,"modelValue");function o(a){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return a.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const s=()=>{const a=t?.value?.[l.parent||""]?.toString(),i=o(a);n.value=i.toString()};return(a,i)=>(e.openBlock(),e.createElementBlock("div",Xr,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:a.disabled,placeholder:a.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,Qr),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:s}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),ei={class:"relative flex gap-1 bg-white w-full"},ti=["disabled","placeholder"],li=["disabled"],ni={key:0},oi={key:1},Rt=q(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.ref(!1),o=e.computed(()=>t.init!==!1),s=e.computed(()=>!!t.table&&!!t.code),a=()=>{if(!s.value)return"";const d=encodeURIComponent(String(t.table)),m=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${m}`},i=async()=>{if(!s.value||n.value)return;const d=a();if(d){n.value=!0;try{const f=await(await fetch(d)).text();l.value=f}finally{n.value=!1}}},c=()=>{o.value&&(l.value||i())};return e.onMounted(()=>{c()}),e.watch(()=>[t.table,t.code,t.init],()=>{c()}),(d,m)=>(e.openBlock(),e.createElementBlock("div",ei,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":m[0]||(m[0]=f=>l.value=f),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,ti),[[e.vModelText,l.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:n.value||d.disabled||!s.value,onClick:i},[n.value?(e.openBlock(),e.createElementBlock("span",oi,"...")):(e.openBlock(),e.createElementBlock("span",ni,"Gen"))],8,li)]))}}),[["__scopeId","data-v-6ee5237d"]]),si={class:"w-full"},ai={ref:"sortableContainer",class:"flex flex-col gap-1"},ri=["onDragstart","onDrop"],ii={class:"w-1/3"},ci={class:"w-2/3"},di=["onClick"],ui={key:0,class:"text-[14px] text-gray-700"},pi={class:"mt-2 w-full flex items-center"},hi=["disabled"],zt=q(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:t}){const l=h=>`${h}-${Math.random().toString(36).substring(2,15)}`,n=e.inject("values"),o=r,s=t,a=o.addButtonText??"Додати",i=o.ignore??[],c=e.ref([]),d=e.ref(null);(()=>{const h=o.parent&&n?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(h).filter(([x])=>!i.includes(x)).map(([x,w])=>({id:l("key-value-"),key:x,value:w}))})();function f(h){d.value=h}function E(h){if(d.value===null||d.value===h)return;const x=c.value.splice(d.value,1)[0];c.value.splice(h,0,x),d.value=null}const k=e.computed(()=>c.value.some(h=>h.key&&!h.value||!h.key&&h.value)),N=()=>{c.value.push({id:l("key-value-"),key:"",value:""})},y=h=>{c.value=c.value.filter(x=>x.id!==h)};return e.watch(c,h=>{const x={};h.forEach(C=>{C.key&&C.value!==void 0&&(x[C.key]=C.value)});const w={};i.length&&i.forEach(C=>{w[C]=o.parent?n?.value?.[o.parent]?.[C]:void 0}),n?.value&&o.parent&&(n.value[o.parent]={...w,...x}),s("update:modelValue",x)},{deep:!0}),(h,x)=>(e.openBlock(),e.createElementBlock("div",si,[e.createElementVNode("div",ai,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(w,C)=>(e.openBlock(),e.createElementBlock("div",{key:w.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===C}]),draggable:"true",onDragstart:b=>f(C),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:b=>E(C)},[x[1]||(x[1]=e.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),e.createElementVNode("div",ii,[e.createVNode(Fe,{modelValue:w.key,"onUpdate:modelValue":b=>w.key=b,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",ci,[e.createVNode(Fe,{modelValue:w.value,"onUpdate:modelValue":b=>w.value=b,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:b=>y(w.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(bt),{height:"16",width:"16"})],8,di)],42,ri))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",ui," Дані для відображення відсутні ")),e.createElementVNode("div",pi,[e.createElementVNode("button",{type:"button",onClick:N,disabled:k.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Be,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)),1)],8,hi)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),mi={class:"flex items-center gap-2 w-full"},fi=["disabled"],gi=["disabled"],jt=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r,{inputClass:n}=ae(l.style),o=t,s=e.computed({get:()=>l.modelValue||"#000000",set:i=>o("update:modelValue",i)}),a=e.computed(()=>!!l.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",mi,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),disabled:a.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[i.modelValue?"":"text-opacity-50",e.unref(n)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,fi),[[e.vModelText,s.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:a.value},null,8,gi),[[e.vModelText,s.value]])]))}}),ki={class:"flex items-center gap-2 w-full"},yi=["min","max","step","disabled"],bi=["disabled"],Ut=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r,{inputClass:n}=ae(l.style),o=t,s=e.computed({get:()=>Number(l.modelValue??l.min),set:i=>o("update:modelValue",Number(i))}),a=e.computed(()=>!!l.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",ki,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),min:i.min,max:i.max,step:i.step,disabled:a.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(n)].join(" ")])},null,10,yi),[[e.vModelText,s.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:a.value},null,8,bi),[[e.vModelText,s.value]])]))}}),xi=["placeholder","disabled","name"],wi=["type","value","onInput","placeholder","disabled"],_i=["onClick"],Pt=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.ref(t.count),n=e.computed(()=>t.limit),{inputClass:o}=ae(t.style),s=e.useModel(r,"modelValue"),a=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const y=s.value?.length??0;y<l.value&&(s.value=[...s.value??[],...Array(l.value-y)])});const c=e.ref({}),d=e.ref({});function m(y,h){y&&(c.value[h]=y)}async function f(y,h){if(!y||t.inputType!=="mask")return;const{default:x}=await Promise.resolve().then(()=>cl);d.value[h]&&d.value[h].destroy(),d.value[h]=x(y,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[h].on("accept",()=>{const w=[...s.value||[]];w[h]=t.unmask?d.value[h].unmaskedValue:d.value[h].value,s.value=w}),d.value[h].on("complete",()=>{const w=[...s.value||[]];w[h]=t.unmask?d.value[h].unmaskedValue:d.value[h].value,s.value=w}),s.value?.[h]&&(d.value[h].value=s.value[h])}function E(y,h){if(a.value)return;const x=y.target.value??null,w=[...s.value];w[h]=t.inputType==="text"?x:Number(x),s.value=w}function k(){l.value+=1;const y=t.inputType==="text"||t.inputType==="mask"?null:0;s.value=[...s.value,y],t.inputType==="mask"&&setTimeout(()=>{const h=l.value-1;c.value[h]&&f(c.value[h],h)},0)}function N(y){if(l.value>1){d.value[y]&&(d.value[y].destroy(),delete d.value[y]),l.value-=1,s.value=s.value.filter((x,w)=>w!==y);const h={};Object.keys(d.value).forEach(x=>{const w=parseInt(x,10);w>y?h[w-1]=d.value[w]:w<y&&(h[w]=d.value[w])}),d.value=h}}return e.onMounted(()=>{if(t.inputType==="mask")for(let y=0;y<l.value;y+=1)c.value[y]&&f(c.value[y],y)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(y=>{y&&y.destroy()})}),e.watch(()=>t.mask,y=>{t.inputType==="mask"&&Object.values(d.value).forEach(h=>{h&&h.updateOptions({mask:y,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(s,y=>{t.inputType==="mask"&&y&&y.forEach((h,x)=>{d.value[x]&&d.value[x].value!==h&&(d.value[x].value=h||"")})},{deep:!0}),(y,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${n.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"flex items-center gap-2 w-full"},[y.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:w=>m(w,x-1),placeholder:y.placeholder,disabled:y.disabled,name:`${y.name}[${x-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":y.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,xi)):(e.openBlock(),e.createElementBlock("input",{key:1,type:y.inputType,value:s.value?.[x-1],onInput:w=>E(w,x-1),placeholder:i.value,disabled:a.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":y.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,wi)),!y.disabled&&x===l.value?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(k,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Be,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!y.disabled&&l.value>1?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(w=>N(x-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(bt,{height:"18",width:"18"})],8,_i)):e.createCommentVNode("",!0)]))),128))],2))}}),Ei={class:"flex items-center gap-2 w-full"},vi={class:"relative flex-1"},Vi=["placeholder","disabled","onKeydown"],Bi=["disabled"],Ci={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Si={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},Ni={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},Mi={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},$i={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Ai=["onClick"],Fi={key:0,class:"p-4 text-sm text-gray-500"},Ht=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(r,{emit:t}){const l=r,n=t,{inputClass:o}=ae(l.style),s=e.useModel(r,"modelValue"),a=e.computed({get:()=>s.value,set:x=>{s.value=x}}),i=e.ref(!1),c=e.ref([]),d=e.ref(!1),m=e.computed(()=>l.placeholder??""),f=e.computed(()=>!!l.disabled),E=e.inject("values");function k(){!f.value&&a.value.trim()&&N()}async function N(){const x=(a.value||"").trim();if(!x)return;let w=x;if(l.includes?.length&&E?.value){const b=l.includes.map(v=>E.value?.[v]).filter(Boolean);b.length&&(w=`${b.join(", ")}, ${x}`)}const C=l.api.replace("{{value}}",encodeURIComponent(w));i.value=!0;try{const v=await(await fetch(C)).json();c.value=Array.isArray(v)?v:[],d.value=!0}catch(b){console.error("Address search error:",b)}finally{i.value=!1}}function y(){d.value=!d.value}function h(x){if(!x)return;d.value=!1;const w=parseFloat(x.lat),b={type:"Point",coordinates:[parseFloat(x.lon),w]};l.geom&&E?.value&&(E.value[l.geom]=b),n("update:geom",b)}return(x,w)=>(e.openBlock(),e.createElementBlock("div",Ei,[e.createElementVNode("div",vi,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":w[0]||(w[0]=C=>a.value=C),placeholder:m.value,disabled:f.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(o),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(k,["prevent"]),["enter"])},null,42,Vi),[[e.vModelText,a.value]]),c.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:y,title:"Show search results"},w[2]||(w[2]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",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("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:N,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:i.value||!a.value?.trim()},[i.value?(e.openBlock(),e.createElementBlock("svg",Si,w[4]||(w[4]=[e.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(e.openBlock(),e.createElementBlock("svg",Ci,w[3]||(w[3]=[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),e.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,Bi),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",Ni,[e.createElementVNode("div",Mi,[e.createElementVNode("div",$i,[w[6]||(w[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:w[1]||(w[1]=C=>d.value=!1),title:"Close"},w[5]||(w[5]=[e.createElementVNode("svg",{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"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(C,b)=>(e.openBlock(),e.createElementBlock("li",{key:b,onClick:v=>h(C),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(C.display_name),9,Ai))),128))]),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Fi," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),Gt={VsInputText:Fe,VsInputRadio:it,"vs-input-text":Fe,"vs-input-password":$l,"vs-input-textarea":Ft,"vs-input-mask":xt,"vs-input-number":yt,"vs-input-radio":it,"vs-input-select":ct,"vs-input-switcher":at,"vs-input-static":rt,"vs-input-container":At,"vs-input-date":Et,"vs-input-checkbox":_t,"vs-input-file":Nt,"vs-input-html":rt,"vs-input-email":wt,"vs-input-datatable":Lt,"vs-input-map":It,"vs-input-file-list":Mt,"vs-input-tags":Tt,"vs-input-slug":Ot,"vs-input-codegen":Rt,"vs-input-key-value":zt,"vs-input-range":Ut,"vs-input-color":jt,"vs-input-native-select":ct,"vs-input-array":Pt,"vs-input-address":Ht},Di=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(r){const t=r,l=e.inject("values");async function n(){try{if(!t.api)return;const o=t.api.replace("{{value}}",t.value),s=await fetch(o);if(!s.ok){ee.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const a=await s.json();if(!t.set||!l)return;for(const[i,c]of Object.entries(t.set))l.value[i]=a.result[c]}catch(o){console.error(t.error,o)}}return(o,s)=>(e.openBlock(),e.createElementBlock("button",{onClick:n,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},e.toDisplayString(o.button),1))}}),Li={class:"flex flex-col gap-1 w-full"},Ii={key:0,class:"text-sm text-gray-500"},qt=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.computed(()=>Nl[`${t.layout}`]),o=e.computed(()=>Gt?.[`vs-input-${t.item.type}`]),s=e.computed(()=>{const i=e.unref(o);if(!i)return new Set;const c=i.props??i.__vccOpts?.props;if(!c)return new Set;const d=Array.isArray(c)?c:Object.keys(c);return new Set(d)}),a=e.computed(()=>{const i=t.item??{},c=s.value;return c.size?Object.fromEntries(Object.entries(i).filter(([d])=>c.has(d))):{}});return(i,c)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value),{ua:t.item.ua,error:t.error||"",item:i.item,columns:t.columns,label:t.item.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${t.item.type}-component`])},[e.createElementVNode("div",Li,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),e.mergeProps(a.value,{modelValue:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d)}),null,16,["modelValue"])),i.item.description&&t.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",Ii,e.toDisplayString(i.item.description),1)):e.createCommentVNode("",!0)]),i.item.behavior?.api&&i.item.behavior?.button?(e.openBlock(),e.createBlock(Di,e.mergeProps({key:0},i.item.behavior,{value:l.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),Ti={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Oi={class:"vs-compact-form-navigation__rail mt-[6px]"},Ri=["onClick"],zi=q(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(r,{expose:t}){const l=r,n=e.ref([]),o=e.ref(""),s=e.ref(""),a=e.computed(()=>!!l.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=e.computed(()=>{const F=l.width;if(F==null)return{};const K=typeof F=="number"?`${F}px`:`${F}`;return{width:K,minWidth:K}});let d=null,m=0,f=0,E=null,k=null,N=null;const y=()=>X(),h=()=>w();e.watch(()=>l.target,async F=>{if($(),!F){E=null,n.value=[],o.value="";return}E=F,a.value&&(await e.nextTick(),v(F),w())},{immediate:!0}),e.watch(()=>l.scrollContainer,F=>{if(!a.value){k=F??null;return}x(F??null),e.nextTick(()=>w())},{immediate:!0}),e.onMounted(()=>{l.scrollContainer||x(null),w()}),e.onBeforeUnmount(()=>{$(),x(null,!0),E=null,typeof window<"u"&&(m&&window.cancelAnimationFrame(m),f&&window.cancelAnimationFrame(f))});function x(F,K=!1){if(N&&(N(),N=null),K){k=null;return}if(k=F??null,typeof window>"u")return;const Y=F??window,Q=window;Y.addEventListener("scroll",y,{passive:!0}),Q.addEventListener("resize",h),N=()=>{Y.removeEventListener("scroll",y),Q.removeEventListener("resize",h)}}function w(){if(!a.value||!E)return;m&&typeof window<"u"&&window.cancelAnimationFrame(m);const F=()=>{C(),m=0};typeof window>"u"?F():m=window.requestAnimationFrame(F)}function C(){if(!a.value||!E)return;const F=Array.from(E.querySelectorAll("h1, h2")),K=new Set,Y=[];F.forEach((Q,O)=>{const D=Q.textContent?.trim()??"";if(!D)return;let A=(Q.getAttribute("id")??"").trim();A||(A=b(D)||`heading-${O+1}`);let U=A,W=1;for(;K.has(U);)U=`${A}-${W+=1}`;Q.id!==U&&Object.assign(Q,{id:U}),K.add(U),Y.push({id:U,text:D,level:Q.tagName.toLowerCase()==="h1"?1:2})}),n.value=Y,Y.length||(o.value=""),z()}function b(F){return F.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function v(F){!F||!a.value||typeof MutationObserver>"u"||($(),d=new MutationObserver(()=>w()),d.observe(F,{childList:!0,subtree:!0}))}function $(){d&&(d.disconnect(),d=null)}function M(F){const K=k;if(!K)return typeof window>"u"?F.offsetTop:F.getBoundingClientRect().top+window.scrollY;const Y=F.getBoundingClientRect(),Q=K.getBoundingClientRect();return Y.top-Q.top+K.scrollTop}function z(){if(!a.value||!n.value.length)return;const F=k,K=(F?F.scrollTop:null)||(typeof window<"u"?window.scrollY:0),Y=(F?F.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Q=K+Y;let O=null;for(let A=0;A<n.value.length;A+=1){const U=n.value[A],W=document.getElementById(U.id);if(W){const re=M(W);re+W.offsetHeight>K&&re<Q&&(O=U.id)}}!O&&s.value&&(O=s.value),O&&(s.value=O);const D=F?F.scrollHeight-F.clientHeight:document.documentElement.scrollHeight-window.innerHeight;K+5>=D&&(O=n.value[n.value.length-1].id),O&&(o.value=O)}function X(){a.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{z(),f=0}))}function G(F){if(!a.value)return;const K=document.getElementById(F);if(!K)return;const Y=k,Q=Math.max(0,M(K));Y?Y.scrollTo({top:Q,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Q,behavior:"smooth"})}return t({refresh:w}),(F,K)=>a.value&&n.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",Ti,e.toDisplayString(F.title),1),e.createElementVNode("div",Oi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,Y=>(e.openBlock(),e.createElementBlock("div",{key:Y.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",Y.level===2?"vs-compact-form-navigation__item--nested":"",Y.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:Q=>G(Y.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",Y.level===2?"pl-[15px]":"pl-[18px]",Y.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(Y.text),1)],10,Ri)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),Kt={required:"Це поле є обов’язковим",email:"Неправильний email"},ji=r=>r?!1:Kt.required,Ui=r=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return r?t.test(r)?!1:Kt.email:!1},Pi=(r,t)=>{const l=t.pattern??t.regexp,n=typeof l=="string"?new RegExp(l):l;if(Array.isArray(r)){const o=r.filter(Boolean);return o.length===0||o.every(s=>n.test(s))?!1:t.message}return!n.test(r)&&r?t.message:!1},Hi=(r,t)=>!1,Gi=(r,t)=>{switch(typeof t=="string"?t:t.type){case"required":return ji(r);case"email":return Ui(r);case"regexp":return Pi(r,t);case"custom":return Hi();default:return!1}},qi={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function Zt(r){const t=r.toLowerCase();return qi[t]||t}function dt(r,t=!1){if(Array.isArray(r)){const n=[];return r.forEach(o=>{const s={...o};s.name=(o.name||o.id||o.key||"").toString(),s.type=Zt(o.type),s.label=o.label||o.ua,s.rules=o.rules||o.validators,s.type==="email"&&!s.rules&&(s.rules=["email"]),o.data&&(s.api=`/api/suggest/${o.data}`),s.disabled=t||s.disabled,Array.isArray(s.schema)&&(s.schema=dt(s.schema,s.disabled)),n.push(s)}),n}const l=[];return Object.entries(r).forEach(n=>{const o={name:n[0],...n[1],type:Zt(n[1].type),label:n[1].label||n[1].ua,rules:n[1].rules||n[1].validators,disabled:t};o.type==="email"&&!o.rules&&(o.rules=["email"]),n[1].type.includes("list")&&(o.multiple=!0),!o.api&&n[1].data&&(o.api=`/api/suggest/${n[1].data}`),Array.isArray(o.schema)&&(o.schema=dt(o.schema,o.disabled)),l.push(o)}),l}function Ki(r,t,l=!1){const n=e.computed(()=>dt((Array.isArray(t),t),typeof l=="boolean"?l:l.value)),o=e.ref({});function s(d){const m=d?.conditions;if(!m)return!0;const f=Array.isArray(m)?m[0]:m,E=r?.value?.[f];return $t(E,m)}const a=(d=n.value,m=!0)=>(d.forEach(f=>{if(f.rules){if(!s(f)){delete o.value[f.name];return}let E=!1,k=null;f.rules.forEach(N=>{const y=Gi(r.value[f.name],N);y&&(E=!0,!k&&typeof y=="string"&&(k=y))}),E&&k?o.value[f.name]=k:delete o.value[f.name]}f.schema&&a(f.schema,!1)}),m&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>n.value?.filter(d=>d.hidden!==!0&&s(d)));return{errors:o,validate:a,reset:()=>{r.value={},o.value={}},visibleSchema:i}}const Zi={class:"flex w-full h-full min-h-0 gap-6"},Wi={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},_e=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(r,{expose:t,emit:l}){const n=l,o=r,s=e.useModel(r,"form"),a=e.useModel(r,"values"),{errors:i,validate:c,reset:d,visibleSchema:m}=Ki(a,o.schema,e.toRef(o,"disabled")),f=e.ref(null),E=e.ref(null),k=e.computed(()=>o.navigation),N=e.computed(()=>o.navWidth),y=e.computed(()=>o.style?.columns),h=Object.freeze({container:12,label:3}),x=e.computed(()=>o.columns??y.value??h),w=e.computed(()=>o.columns!=null||y.value!=null),C=e.computed(()=>w.value?"horizontal":o.layout),b=z=>z?.columns?"horizontal":C.value,v=z=>z?.columns??x.value,$=()=>{n("update:modelValue",a.value),c(),n("handle-submit",a.value)};t({validate:c,reset:d,errors:i}),e.onMounted(()=>{o.modelValue&&(a.value=o.modelValue),s.value={value:a.value,errors:i.value,reset:d,validate:c,formId:o.formId}});function M(z,X){if(z===X)return!0;if(typeof z!="object"||typeof X!="object"||!z||!X)return!1;const G=Object.keys(z),F=Object.keys(X);return G.length!==F.length?!1:G.every(K=>z[K]===X[K])}return e.provide("form",s),e.provide("values",a),(z,X)=>(e.openBlock(),e.createElementBlock("div",Zi,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:E},[e.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:e.withModifiers($,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",C.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(G,F)=>(e.openBlock(),e.createElementBlock("div",{key:G.name,class:e.normalizeClass(b(G)==="horizontal"?"col-span-12":`col-span-${G.col||12}`)},[e.createVNode(qt,{style:e.normalizeStyle(z.style),item:G,layout:b(G),columns:v(G),"model-value":a.value[G.name],"onUpdate:modelValue":K=>{const Y=a.value[G.name];M(Y,K)||(a.value[G.name]=K)},error:e.unref(i)[G.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),b(G)==="settings"&&F+1!==e.unref(m).length?(e.openBlock(),e.createElementBlock("div",Wi)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(zi,{target:f.value,"scroll-container":E.value,enabled:k.value,width:N.value},null,8,["target","scroll-container","enabled","width"])]))}}),Yi={class:"relative"},Ji={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},Xi={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},Qi={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},ec={class:"font-medium text-gray-800 dark:text-[#ffffff]"},tc={class:"p-4 mim-h-0 h-full overflow-auto"},Wt=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(r,{emit:t}){const l=r,n=t,o=e.ref(l.schema),s=e.ref(l.defaultValue?JSON.parse(JSON.stringify(l.defaultValue)):{}),a=e.ref({}),i=e.ref(),c=e.ref(l.mode);async function d(){const f=a.value.validate();if(f){ee.notify({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([E,k])=>`${E}: ${k}`).join(`
3
- `)});return}if(i.value)try{const E=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s.value)});if(E.ok)await E.json(),ee.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),n("save",s.value);else if(E.status===400){const k=await E.json().catch(()=>({}));ee.notify({type:"warning",title:"Помилка валідації",message:k.message||"Некоректні дані (400)"})}else E.status===500?ee.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):ee.notify({type:"error",title:"Помилка",message:`Статус: ${E.status}`})}catch(E){ee.notify({type:"error",title:"Помилка з’єднання",message:E.message||"Не вдалося виконати запит"})}}function m(){n("close")}return e.onMounted(async()=>{try{if(l.form){const f=await fetch(`/api/template/form/${l.form}`);if(!f.ok){ee.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const E=await f.json();o.value=E.schema,i.value=E.token}else if(l.token){i.value=l.token;const f=await fetch(`/api/form/${i.value}`);if(!f.ok){ee.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const E=await f.json();o.value=E.schema,E.data?s.value=E.data:c.value="add"}}catch(f){ee.notify({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,E)=>(e.openBlock(),e.createElementBlock("div",Yi,[e.createElementVNode("div",Ji,[e.createElementVNode("div",Xi,[e.createElementVNode("div",Qi,[e.createElementVNode("h3",ec,e.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:m,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},E[2]||(E[2]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M18 6 6 18"}),e.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),e.createElementVNode("div",tc,[o.value?(e.openBlock(),e.createBlock(_e,{key:0,schema:o.value,values:s.value,"onUpdate:values":E[0]||(E[0]=k=>s.value=k),form:a.value,"onUpdate:form":E[1]||(E[1]=k=>a.value=k)},null,8,["schema","values","form"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[e.createElementVNode("button",{type:"button",onClick:m,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:d,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),Yt=(r={mode:"edit",schema:null})=>new Promise(t=>{const{close:l}=ee.modal({title:r.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Wt,contentProps:{...r,onClose:()=>{t(null),l()},onSave:n=>{t(n),l()}}})});_e.install=function(t){t.component("VForm",_e),Object.assign(t.config.globalProperties,{$form:Yt}),t.provide("form",Yt),window.v3plugin||(window.v3plugin={})};function ye(r){return typeof r=="string"||r instanceof String}function Jt(r){var t;return typeof r=="object"&&r!=null&&(r==null||(t=r.constructor)==null?void 0:t.name)==="Object"}function Xt(r,t){return Array.isArray(t)?Xt(r,(l,n)=>t.includes(n)):Object.entries(r).reduce((l,n)=>{let[o,s]=n;return t(s,o)&&(l[o]=s),l},{})}const T={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Qt(r){switch(r){case T.LEFT:return T.FORCE_LEFT;case T.RIGHT:return T.FORCE_RIGHT;default:return r}}function ut(r){return r.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Ze(r,t){if(t===r)return!0;const l=Array.isArray(t),n=Array.isArray(r);let o;if(l&&n){if(t.length!=r.length)return!1;for(o=0;o<t.length;o++)if(!Ze(t[o],r[o]))return!1;return!0}if(l!=n)return!1;if(t&&r&&typeof t=="object"&&typeof r=="object"){const s=t instanceof Date,a=r instanceof Date;if(s&&a)return t.getTime()==r.getTime();if(s!=a)return!1;const i=t instanceof RegExp,c=r instanceof RegExp;if(i&&c)return t.toString()==r.toString();if(i!=c)return!1;const d=Object.keys(t);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(r,d[o]))return!1;for(o=0;o<d.length;o++)if(!Ze(r[d[o]],t[d[o]]))return!1;return!0}else if(t&&r&&typeof t=="function"&&typeof r=="function")return t.toString()===r.toString();return!1}class lc{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?T.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?T.RIGHT:T.LEFT}}function j(r,t){return new j.InputMask(r,t)}function el(r){if(r==null)throw new Error("mask property should be defined");return r instanceof RegExp?j.MaskedRegExp:ye(r)?j.MaskedPattern:r===Date?j.MaskedDate:r===Number?j.MaskedNumber:Array.isArray(r)||r===Array?j.MaskedDynamic:j.Masked&&r.prototype instanceof j.Masked?r:j.Masked&&r instanceof j.Masked?r.constructor:r instanceof Function?j.MaskedFunction:(console.warn("Mask not found for mask",r),j.Masked)}function Ce(r){if(!r)throw new Error("Options in not defined");if(j.Masked){if(r.prototype instanceof j.Masked)return{mask:r};const{mask:t=void 0,...l}=r instanceof j.Masked?{mask:r}:Jt(r)&&r.mask instanceof j.Masked?r:{};if(t){const n=t.mask;return{...Xt(t,(o,s)=>!s.startsWith("_")),mask:t.constructor,_mask:n,...l}}}return Jt(r)?{...r}:{mask:r}}function pe(r){if(j.Masked&&r instanceof j.Masked)return r;const t=Ce(r),l=el(t.mask);if(!l)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===l&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new l(t)}j.createMask=pe;class We{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,l){if(!(t==null||l==null||t===this.selectionStart&&l===this.selectionEnd))try{this._unsafeSelect(t,l)}catch{}}get isActive(){return!1}}j.MaskElement=We;const tl=90,nc=89;class Le extends We{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,l,n;return(t=(l=(n=this.input).getRootNode)==null?void 0:l.call(n))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===tl&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===nc&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===tl&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}j.HTMLMaskElement=Le;class ll extends Le{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,l){this.input.setSelectionRange(t,l)}get value(){return this.input.value}set value(t){this.input.value=t}}j.HTMLMaskElement=Le;class pt extends Le{get _unsafeSelectionStart(){const t=this.rootElement,l=t.getSelection&&t.getSelection(),n=l&&l.anchorOffset,o=l&&l.focusOffset;return o==null||n==null||n<o?n:o}get _unsafeSelectionEnd(){const t=this.rootElement,l=t.getSelection&&t.getSelection(),n=l&&l.anchorOffset,o=l&&l.focusOffset;return o==null||n==null||n>o?n:o}_unsafeSelect(t,l){if(!this.rootElement.createRange)return;const n=this.rootElement.createRange();n.setStart(this.input.firstChild||this.input,t),n.setEnd(this.input.lastChild||this.input,l);const o=this.rootElement,s=o.getSelection&&o.getSelection();s&&(s.removeAllRanges(),s.addRange(n))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}j.HTMLContenteditableMaskElement=pt;class Ye{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>Ye.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}Ye.MAX_LENGTH=100;class nl{constructor(t,l){this.el=t instanceof We?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new pt(t):new ll(t),this.masked=pe(l),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ye,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var l;return t==null||((l=this.masked)==null?void 0:l.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof j.Masked)&&this.masked.constructor===el(t)){this.masked.updateOptions({mask:t});return}const l=t instanceof j.Masked?t:pe({mask:t});l.unmaskedValue=this.masked.unmaskedValue,this.masked=l}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,l){const n=this._listeners[t];n&&n.forEach(o=>o(l))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const l=this.masked.unmaskedValue,n=this.masked.value,o=this.masked.rawInputValue,s=this.displayValue,a=this.unmaskedValue!==l||this.value!==n||this._rawInputValue!==o;this._unmaskedValue=l,this._value=n,this._rawInputValue=o,this.el.value!==s&&(this.el.value=s),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),a&&this._fireChangeEvents(),!this._historyChanging&&(a||this.history.isEmpty)&&this.history.push({unmaskedValue:l,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:l,...n}=t,o=!this.maskEquals(l),s=this.masked.optionsIsChanged(n);o&&(this.mask=l),s&&this.masked.updateOptions(n),(o||s)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,T.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,l){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(l),this}off(t,l){if(!this._listeners[t])return this;if(!l)return delete this._listeners[t],this;const n=this._listeners[t].indexOf(l);return n>=0&&this._listeners[t].splice(n,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const l=new lc({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),n=this.masked.rawInputValue,o=this.masked.splice(l.startChangePos,l.removed.length,l.inserted,l.removeDirection,{input:!0,raw:!0}).offset,s=n===this.masked.rawInputValue?l.removeDirection:T.NONE;let a=this.masked.nearestInputPos(l.startChangePos+o,s);s!==T.NONE&&(a=this.masked.nearestInputPos(a,T.NONE)),this.updateControl(a),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}j.InputMask=nl;class P{static normalize(t){return Array.isArray(t)?t:[t,new P]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}j.ChangeDetails=P;class he{constructor(t,l,n){t===void 0&&(t=""),l===void 0&&(l=0),this.value=t,this.from=l,this.stop=n}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const l=this.value[0];return this.value=this.value.slice(1),l}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class le{constructor(t){this._value="",this._update({...le.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,l){l===void 0&&(l={input:!0}),this.reset(),this.append(t,l,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,l){return t}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),Math.min(this.displayValue.length,l-t)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),this.displayValue.slice(t,l)}extractTail(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),new he(this.extractInput(t,l),t)}appendTail(t){return ye(t)&&(t=new he(String(t))),t.appendTo(this)}_appendCharRaw(t,l){return t?(this._value+=t,new P({inserted:t,rawInserted:t})):new P}_appendChar(t,l,n){l===void 0&&(l={});const o=this.state;let s;if([t,s]=this.doPrepareChar(t,l),t&&(s=s.aggregate(this._appendCharRaw(t,l)),!s.rawInserted&&this.autofix==="pad")){const a=this.state;this.state=o;let i=this.pad(l);const c=this._appendCharRaw(t,l);i=i.aggregate(c),c.rawInserted||i.equals(s)?s=i:this.state=a}if(s.inserted){let a,i=this.doValidate(l)!==!1;if(i&&n!=null){const c=this.state;if(this.overwrite===!0){a=n.state;for(let m=0;m<s.rawInserted.length;++m)n.unshift(this.displayValue.length-s.tailShift)}let d=this.appendTail(n);if(i=d.rawInserted.length===n.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,a=n.state;for(let m=0;m<s.rawInserted.length;++m)n.shift();d=this.appendTail(n),i=d.rawInserted.length===n.toString().length}i&&d.inserted&&(this.state=c)}i||(s=new P,this.state=o,n&&a&&(n.state=a))}return s}_appendPlaceholder(){return new P}_appendEager(){return new P}append(t,l,n){if(!ye(t))throw new Error("value should be string");const o=ye(n)?new he(String(n)):n;l!=null&&l.tail&&(l._beforeTailState=this.state);let s;[t,s]=this.doPrepare(t,l);for(let a=0;a<t.length;++a){const i=this._appendChar(t[a],l,o);if(!i.rawInserted&&!this.doSkipInvalid(t[a],l,o))break;s.aggregate(i)}return(this.eager===!0||this.eager==="append")&&l!=null&&l.input&&t&&s.aggregate(this._appendEager()),o!=null&&(s.tailShift+=this.appendTail(o).tailShift),s}remove(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(l),new P}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const l=this.rawInputValue,n=this.value,o=t();return this.rawInputValue=l,this.value&&this.value!==n&&n.indexOf(this.value)===0&&(this.append(n.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const l=this.state,n=t(this);return this.state=l,delete this._isolated,n}doSkipInvalid(t,l,n){return!!this.skipInvalid}doPrepare(t,l){return l===void 0&&(l={}),P.normalize(this.prepare?this.prepare(t,this,l):t)}doPrepareChar(t,l){return l===void 0&&(l={}),P.normalize(this.prepareChar?this.prepareChar(t,this,l):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,l,n,o,s){n===void 0&&(n=""),o===void 0&&(o=T.NONE),s===void 0&&(s={input:!0});const a=t+l,i=this.extractTail(a),c=this.eager===!0||this.eager==="remove";let d;c&&(o=Qt(o),d=this.extractInput(0,a,{raw:!0}));let m=t;const f=new P;if(o!==T.NONE&&(m=this.nearestInputPos(t,l>1&&t!==0&&!c?T.NONE:o),f.tailShift=m-t),f.aggregate(this.remove(m)),c&&o!==T.NONE&&d===this.rawInputValue)if(o===T.FORCE_LEFT){let E;for(;d===this.rawInputValue&&(E=this.displayValue.length);)f.aggregate(new P({tailShift:-1})).aggregate(this.remove(E-1))}else o===T.FORCE_RIGHT&&i.unshift();return f.aggregate(this.append(n,s,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!Ze(this,t)}typedValueEquals(t){const l=this.typedValue;return t===l||le.EMPTY_VALUES.includes(t)&&le.EMPTY_VALUES.includes(l)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new P}}le.DEFAULTS={skipInvalid:!0},le.EMPTY_VALUES=[void 0,null,""],j.Masked=le;class be{constructor(t,l){t===void 0&&(t=[]),l===void 0&&(l=0),this.chunks=t,this.from=l}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=ye(t)?new he(String(t)):t;const l=this.chunks[this.chunks.length-1],n=l&&(l.stop===t.stop||t.stop==null)&&t.from===l.from+l.toString().length;if(t instanceof he)n?l.extend(t.toString()):this.chunks.push(t);else if(t instanceof be){if(t.stop==null){let o;for(;t.chunks.length&&t.chunks[0].stop==null;)o=t.chunks.shift(),o.from+=t.from,this.extend(o)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof j.MaskedPattern))return new he(this.toString()).appendTo(t);const l=new P;for(let n=0;n<this.chunks.length;++n){const o=this.chunks[n],s=t._mapPosToBlock(t.displayValue.length),a=o.stop;let i;if(a!=null&&(!s||s.index<=a)&&((o instanceof be||t._stops.indexOf(a)>=0)&&l.aggregate(t._appendPlaceholder(a)),i=o instanceof be&&t._blocks[a]),i){const c=i.appendTail(o);l.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&l.aggregate(t.append(d,{tail:!0}))}else l.aggregate(t.append(o.toString(),{tail:!0}))}return l}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:l,...n}=t;Object.assign(this,n),this.chunks=l.map(o=>{const s="chunks"in o?new be:new he;return s.state=o,s})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const l=t!=null?t-this.from:t;let n=0;for(;n<this.chunks.length;){const o=this.chunks[n],s=o.unshift(l);if(o.toString()){if(!s)break;++n}else this.chunks.splice(n,1);if(s)return s}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const l=this.chunks[t],n=l.shift();if(l.toString()){if(!n)break;--t}else this.chunks.splice(t,1);if(n)return n}return""}}class oc{constructor(t,l){this.masked=t,this._log=[];const{offset:n,index:o}=t._mapPosToBlock(l)||(l<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=n,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((l=this.block)==null?void 0:l.displayValue.length)||0){var l;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,T.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,T.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,T.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,T.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,T.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,T.NONE),!0})}}class ht{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,l){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(l),this._value||(this._isRawInput=!1),new P}nearestInputPos(t,l){l===void 0&&(l=T.NONE);const n=0,o=this._value.length;switch(l){case T.LEFT:case T.FORCE_LEFT:return n;case T.NONE:case T.RIGHT:case T.FORCE_RIGHT:default:return o}}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),this._isRawInput?l-t:0}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),n===void 0&&(n={}),n.raw&&this._isRawInput&&this._value.slice(t,l)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,l){if(l===void 0&&(l={}),this.isFilled)return new P;const n=this.eager===!0||this.eager==="append",s=this.char===t&&(this.isUnmasking||l.input||l.raw)&&(!l.raw||!n)&&!l.tail,a=new P({inserted:this.char,rawInserted:s?this.char:""});return this._value=this.char,this._isRawInput=s&&(l.raw||l.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new P;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new he("")}appendTail(t){return ye(t)&&(t=new he(String(t))),t.appendTo(this)}append(t,l,n){const o=this._appendChar(t[0],l);return n!=null&&(o.tailShift+=this.appendTail(n).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class Ie{constructor(t){const{parent:l,isOptional:n,placeholderChar:o,displayChar:s,lazy:a,eager:i,...c}=t;this.masked=pe(c),Object.assign(this,{parent:l,isOptional:n,placeholderChar:o,displayChar:s,lazy:a,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),t===0&&l>=1?(this.isFilled=!1,this.masked.remove(t,l)):new P}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,l){if(l===void 0&&(l={}),this.isFilled)return new P;const n=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(l));return o.inserted&&this.doValidate(l)===!1&&(o=new P,this.masked.state=n),!o.inserted&&!this.isOptional&&!this.lazy&&!l.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(t,l,n){return this.masked.append(t,this.currentMaskFlags(l),n)}_appendPlaceholder(){return this.isFilled||this.isOptional?new P:(this.isFilled=!0,new P({inserted:this.placeholderChar}))}_appendEager(){return new P}extractTail(t,l){return this.masked.extractTail(t,l)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),this.masked.extractInput(t,l,n)}nearestInputPos(t,l){l===void 0&&(l=T.NONE);const n=0,o=this.value.length,s=Math.min(Math.max(t,n),o);switch(l){case T.LEFT:case T.FORCE_LEFT:return this.isComplete?s:n;case T.RIGHT:case T.FORCE_RIGHT:return this.isComplete?s:o;case T.NONE:default:return s}}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),this.value.slice(t,l).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var l;return{...t,_beforeTailState:(t==null||(l=t._beforeTailState)==null?void 0:l.masked)||t?._beforeTailState}}pad(t){return new P}}Ie.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class ol extends le{updateOptions(t){super.updateOptions(t)}_update(t){const l=t.mask;l&&(t.validate=n=>n.search(l)>=0),super._update(t)}}j.MaskedRegExp=ol;class ne extends le{constructor(t){super({...ne.DEFAULTS,...t,definitions:Object.assign({},Ie.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const l=this.mask;if(!l||!t)return;let n=!1,o=!1;for(let s=0;s<l.length;++s){if(this.blocks){const d=l.slice(s),m=Object.keys(this.blocks).filter(E=>d.indexOf(E)===0);m.sort((E,k)=>k.length-E.length);const f=m[0];if(f){const{expose:E,repeat:k,...N}=Ce(this.blocks[f]),y={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...N,repeat:k,parent:this},h=k!=null?new j.RepeatBlock(y):pe(y);h&&(this._blocks.push(h),E&&(this.exposeBlock=h),this._maskedBlocks[f]||(this._maskedBlocks[f]=[]),this._maskedBlocks[f].push(this._blocks.length-1)),s+=f.length-1;continue}}let a=l[s],i=a in t;if(a===ne.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(a==="{"||a==="}"){n=!n;continue}if(a==="["||a==="]"){o=!o;continue}if(a===ne.ESCAPE_CHAR){if(++s,a=l[s],!a)break;i=!1}const c=i?new Ie({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Ce(t[a]),parent:this}):new ht({char:a,eager:this.eager,isUnmasking:n});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:l,...n}=t;this._blocks.forEach((o,s)=>o.state=l[s]),super.state=n}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,l)=>t+=l.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(l),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,l)=>t+=l.value,"")}set value(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(l),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(l),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,l)=>t+=l.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const l=new P;let n=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(n==null)return l;this._blocks[n].isFilled&&++n;for(let o=n;o<this._blocks.length;++o){const s=this._blocks[o]._appendEager();if(!s.inserted)break;l.aggregate(s)}return l}_appendCharRaw(t,l){l===void 0&&(l={});const n=this._mapPosToBlock(this.displayValue.length),o=new P;if(!n)return o;for(let a=n.index,i;i=this._blocks[a];++a){var s;const c=i._appendChar(t,{...l,_beforeTailState:(s=l._beforeTailState)==null||(s=s._blocks)==null?void 0:s[a]});if(o.aggregate(c),c.consumed)break}return o}extractTail(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=new be;return t===l||this._forEachBlocksInRange(t,l,(o,s,a,i)=>{const c=o.extractTail(a,i);c.stop=this._findStopBefore(s),c.from=this._blockStartPos(s),c instanceof be&&(c.blockIndex=s),n.extend(c)}),n}extractInput(t,l,n){if(t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),n===void 0&&(n={}),t===l)return"";let o="";return this._forEachBlocksInRange(t,l,(s,a,i,c)=>{o+=s.extractInput(i,c,n)}),o}_findStopBefore(t){let l;for(let n=0;n<this._stops.length;++n){const o=this._stops[n];if(o<=t)l=o;else break}return l}_appendPlaceholder(t){const l=new P;if(this.lazy&&t==null)return l;const n=this._mapPosToBlock(this.displayValue.length);if(!n)return l;const o=n.index,s=t??this._blocks.length;return this._blocks.slice(o,s).forEach(a=>{if(!a.lazy||t!=null){var i;l.aggregate(a._appendPlaceholder((i=a._blocks)==null?void 0:i.length))}}),l}_mapPosToBlock(t){let l="";for(let n=0;n<this._blocks.length;++n){const o=this._blocks[n],s=l.length;if(l+=o.displayValue,t<=l.length)return{index:n,offset:t-s}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((l,n)=>l+=n.displayValue.length,0)}_forEachBlocksInRange(t,l,n){l===void 0&&(l=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const s=this._mapPosToBlock(l),a=s&&o.index===s.index,i=o.offset,c=s&&a?s.offset:this._blocks[o.index].displayValue.length;if(n(this._blocks[o.index],o.index,i,c),s&&!a){for(let d=o.index+1;d<s.index;++d)n(this._blocks[d],d,0,this._blocks[d].displayValue.length);n(this._blocks[s.index],s.index,0,s.offset)}}}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=super.remove(t,l);return this._forEachBlocksInRange(t,l,(o,s,a,i)=>{n.aggregate(o.remove(a,i))}),n}nearestInputPos(t,l){if(l===void 0&&(l=T.NONE),!this._blocks.length)return 0;const n=new oc(this,t);if(l===T.NONE)return n.pushRightBeforeInput()||(n.popState(),n.pushLeftBeforeInput())?n.pos:this.displayValue.length;if(l===T.LEFT||l===T.FORCE_LEFT){if(l===T.LEFT){if(n.pushRightBeforeFilled(),n.ok&&n.pos===t)return t;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),l===T.LEFT){if(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.ok&&n.pos<=t||(n.popState(),n.ok&&n.pos<=t))return n.pos;n.popState()}return n.ok?n.pos:l===T.FORCE_LEFT?0:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:0)}return l===T.RIGHT||l===T.FORCE_RIGHT?(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.pushRightBeforeFilled()?n.pos:l===T.FORCE_RIGHT?this.displayValue.length:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:this.nearestInputPos(t,T.LEFT))):t}totalInputPositions(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);let n=0;return this._forEachBlocksInRange(t,l,(o,s,a,i)=>{n+=o.totalInputPositions(a,i)}),n}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const l=this._maskedBlocks[t];return l?l.map(n=>this._blocks[n]):[]}pad(t){const l=new P;return this._forEachBlocksInRange(0,this.displayValue.length,n=>l.aggregate(n.pad(t))),l}}ne.DEFAULTS={...le.DEFAULTS,lazy:!0,placeholderChar:"_"},ne.STOP_CHAR="`",ne.ESCAPE_CHAR="\\",ne.InputDefinition=Ie,ne.FixedDefinition=ht,j.MaskedPattern=ne;class Te extends ne{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:l=this.to||0,from:n=this.from||0,maxLength:o=this.maxLength||0,autofix:s=this.autofix,...a}=t;this.to=l,this.from=n,this.maxLength=Math.max(String(l).length,o),this.autofix=s;const i=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===i[d];)++d;a.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(a)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let l="",n="";const[,o,s]=t.match(/^(\D*)(\d*)(\D*)/)||[];return s&&(l="0".repeat(o.length)+s,n="9".repeat(o.length)+s),l=l.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[l,n]}doPrepareChar(t,l){l===void 0&&(l={});let n;return[t,n]=super.doPrepareChar(t.replace(/\D/g,""),l),t||(n.skip=!this.isComplete),[t,n]}_appendCharRaw(t,l){if(l===void 0&&(l={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,l);const n=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[s,a]=this.boundaries(this.value+t);return Number(a)<this.from?super._appendCharRaw(n[this.value.length],l):Number(s)>this.to?!l.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(n[this.value.length],l).aggregate(this._appendCharRaw(t,l)):super._appendCharRaw(o[this.value.length],l):super._appendCharRaw(t,l)}doValidate(t){const l=this.value;if(l.search(/[^0]/)===-1&&l.length<=this._matchFrom)return!0;const[o,s]=this.boundaries(l);return this.from<=Number(s)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const l=new P;if(this.value.length===this.maxLength)return l;const n=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let s=0;s<o;++s)l.aggregate(super._appendCharRaw("0",t));n.split("").forEach(s=>this._appendCharRaw(s))}return l}}j.MaskedRange=Te;const sc="d{.}`m{.}`Y";class me extends ne{static extractPatternOptions(t){const{mask:l,pattern:n,...o}=t;return{...o,mask:ye(l)?l:n}}constructor(t){super(me.extractPatternOptions({...me.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:l,pattern:n,blocks:o,...s}={...me.DEFAULTS,...t},a=Object.assign({},me.GET_DEFAULT_BLOCKS());t.min&&(a.Y.from=t.min.getFullYear()),t.max&&(a.Y.to=t.max.getFullYear()),t.min&&t.max&&a.Y.from===a.Y.to&&(a.m.from=t.min.getMonth()+1,a.m.to=t.max.getMonth()+1,a.m.from===a.m.to&&(a.d.from=t.min.getDate(),a.d.to=t.max.getDate())),Object.assign(a,this.blocks,o),super._update({...s,mask:ye(l)?l:n,blocks:a})}doValidate(t){const l=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&l!=null&&(this.min==null||this.min<=l)&&(this.max==null||l<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(me.extractPatternOptions(t))}}me.GET_DEFAULT_BLOCKS=()=>({d:{mask:Te,from:1,to:31,maxLength:2},m:{mask:Te,from:1,to:12,maxLength:2},Y:{mask:Te,from:1900,to:9999}}),me.DEFAULTS={...ne.DEFAULTS,mask:Date,pattern:sc,format:(r,t)=>{if(!r)return"";const l=String(r.getDate()).padStart(2,"0"),n=String(r.getMonth()+1).padStart(2,"0"),o=r.getFullYear();return[l,n,o].join(".")},parse:(r,t)=>{const[l,n,o]=r.split(".").map(Number);return new Date(o,n-1,l)}},j.MaskedDate=me;class Oe extends le{constructor(t){super({...Oe.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(l=>{const{expose:n,...o}=Ce(l),s=pe({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return n&&(this.exposeMask=s),s}):[])}_appendCharRaw(t,l){l===void 0&&(l={});const n=this._applyDispatch(t,l);return this.currentMask&&n.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(l))),n}_applyDispatch(t,l,n){t===void 0&&(t=""),l===void 0&&(l={}),n===void 0&&(n="");const o=l.tail&&l._beforeTailState!=null?l._beforeTailState._value:this.value,s=this.rawInputValue,a=l.tail&&l._beforeTailState!=null?l._beforeTailState._rawInputValue:s,i=s.slice(a.length),c=this.currentMask,d=new P,m=c?.state;return this.currentMask=this.doDispatch(t,{...l},n),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),a&&(this.currentMask.append(a,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):m&&(this.currentMask.state=m)),d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const l=new P;return t&&l.aggregate(this._applyDispatch("",{},t)),l.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var l,n;return{...t,_beforeTailState:((l=t._beforeTailState)==null?void 0:l.currentMaskRef)===this.currentMask&&((n=t._beforeTailState)==null?void 0:n.currentMask)||t._beforeTailState}}doDispatch(t,l,n){return l===void 0&&(l={}),n===void 0&&(n=""),this.dispatch(t,this,l,n)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,l){l===void 0&&(l={});let[n,o]=super.doPrepare(t,l);if(this.currentMask){let s;[n,s]=super.doPrepare(n,this.currentMaskFlags(l)),o=o.aggregate(s)}return[n,o]}doPrepareChar(t,l){l===void 0&&(l={});let[n,o]=super.doPrepareChar(t,l);if(this.currentMask){let s;[n,s]=super.doPrepareChar(n,this.currentMaskFlags(l)),o=o.aggregate(s)}return[n,o]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(l=>l.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let l=String(t);this.currentMask&&(this.currentMask.typedValue=t,l=this.currentMask.unmaskedValue),this.unmaskedValue=l}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,l){const n=new P;return this.currentMask&&n.aggregate(this.currentMask.remove(t,l)).aggregate(this._applyDispatch()),n}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(l=>l.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:l,currentMaskRef:n,currentMask:o,...s}=t;l&&this.compiledMasks.forEach((a,i)=>a.state=l[i]),n!=null&&(this.currentMask=n,this.currentMask.state=o),super.state=s}extractInput(t,l,n){return this.currentMask?this.currentMask.extractInput(t,l,n):""}extractTail(t,l){return this.currentMask?this.currentMask.extractTail(t,l):super.extractTail(t,l)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,l){return this.currentMask?this.currentMask.nearestInputPos(t,l):super.nearestInputPos(t,l)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((l,n)=>{if(!t[n])return;const{mask:o,...s}=t[n];return Ze(l,s)&&l.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var l;return!!((l=this.currentMask)!=null&&l.typedValueEquals(t))}}Oe.DEFAULTS={...le.DEFAULTS,dispatch:(r,t,l,n)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,s=t.compiledMasks.map((a,i)=>{const c=t.currentMask===a,d=c?a.displayValue.length:a.nearestInputPos(a.displayValue.length,T.FORCE_LEFT);return a.rawInputValue!==o?(a.reset(),a.append(o,{raw:!0})):c||a.remove(d),a.append(r,t.currentMaskFlags(l)),a.appendTail(n),{index:i,weight:a.rawInputValue.length,totalInputPositions:a.totalInputPositions(0,Math.max(d,a.nearestInputPos(a.displayValue.length,T.FORCE_LEFT)))}});return s.sort((a,i)=>i.weight-a.weight||i.totalInputPositions-a.totalInputPositions),t.compiledMasks[s[0].index]}},j.MaskedDynamic=Oe;class Re extends ne{constructor(t){super({...Re.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:l,...n}=t;if(l){const o=l.map(i=>i.length),s=Math.min(...o),a=Math.max(...o)-s;n.mask="*".repeat(s),a&&(n.mask+="["+"*".repeat(a)+"]"),this.enum=l}super._update(n)}_appendCharRaw(t,l){l===void 0&&(l={});const n=Math.min(this.nearestInputPos(0,T.FORCE_RIGHT),this.value.length),o=this.enum.filter(s=>this.matchValue(s,this.unmaskedValue+t,n));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(a,i)=>{const c=o[0][i];i>=this.value.length||c===a.value||(a.reset(),a._appendChar(c,l))});const s=super._appendCharRaw(o[0][this.value.length],l);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(a=>s.aggregate(super._appendCharRaw(a))),s}return new P({skip:!this.isComplete})}extractTail(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),new he("",t)}remove(t,l){if(t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),t===l)return new P;const n=Math.min(super.nearestInputPos(0,T.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(n,o),n)).length>1);--o);const s=super.remove(o,l);return s.tailShift+=o-t,s}get isComplete(){return this.enum.indexOf(this.value)>=0}}Re.DEFAULTS={...ne.DEFAULTS,matchValue:(r,t,l)=>r.indexOf(t,l)===l},j.MaskedEnum=Re;class sl extends le{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}j.MaskedFunction=sl;var al;class se extends le{constructor(t){super({...se.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),l="\\d*",n=(this.scale?"("+ut(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+l+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(ut).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(ut(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const l=t.split(this.radix);return l[0]=l[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),l.join(this.radix)}doPrepareChar(t,l){l===void 0&&(l={});const[n,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(l.input&&l.raw||!l.input&&!l.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),l);return t&&!n&&(o.skip=!0),n&&!this.allowPositive&&!this.value&&n!=="-"&&o.aggregate(this._appendChar("-")),[n,o]}_separatorsCount(t,l){l===void 0&&(l=!1);let n=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++n,l&&(t+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),[t,l]=this._adjustRangeWithSeparators(t,l),this._removeThousandsSeparators(super.extractInput(t,l,n))}_appendCharRaw(t,l){l===void 0&&(l={});const n=l.tail&&l._beforeTailState?l._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(n);this._value=this._removeThousandsSeparators(this.value);const s=this._value;this._value+=t;const a=this.number;let i=!isNaN(a),c=!1;if(i){let E;this.min!=null&&this.min<0&&this.number<this.min&&(E=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(E=this.max),E!=null&&(this.autofix?(this._value=this.format(E,this).replace(se.UNMASKED_RADIX,this.radix),c||(c=s===this._value&&!l.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new P({inserted:this._value.slice(s.length),rawInserted:c?"":t,skip:c}):(this._value=s,d=new P),this._value=this._insertThousandsSeparators(this._value);const m=l.tail&&l._beforeTailState?l._beforeTailState._value:this._value,f=this._separatorsCountFromSlice(m);return d.tailShift+=(f-o)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const l=t-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,l);if(n<=t)return n}return-1}_adjustRangeWithSeparators(t,l){const n=this._findSeparatorAround(t);n>=0&&(t=n);const o=this._findSeparatorAround(l);return o>=0&&(l=o+this.thousandsSeparator.length),[t,l]}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),[t,l]=this._adjustRangeWithSeparators(t,l);const n=this.value.slice(0,t),o=this.value.slice(l),s=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+o));const a=this._separatorsCountFromSlice(n);return new P({tailShift:(a-s)*this.thousandsSeparator.length})}nearestInputPos(t,l){if(!this.thousandsSeparator)return t;switch(l){case T.NONE:case T.LEFT:case T.FORCE_LEFT:{const n=this._findSeparatorAround(t-1);if(n>=0){const o=n+this.thousandsSeparator.length;if(t<o||this.value.length<=o||l===T.FORCE_LEFT)return n}break}case T.RIGHT:case T.FORCE_RIGHT:{const n=this._findSeparatorAround(t);if(n>=0)return n+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let l=t;this.min!=null&&(l=Math.max(l,this.min)),this.max!=null&&(l=Math.min(l,this.max)),l!==t&&(this.unmaskedValue=this.format(l,this));let n=this.value;this.normalizeZeros&&(n=this._normalizeZeros(n)),this.padFractionalZeros&&this.scale>0&&(n=this._padFractionalZeros(n)),this._value=n}super.doCommit()}_normalizeZeros(t){const l=this._removeThousandsSeparators(t).split(this.radix);return l[0]=l[0].replace(/^(\D*)(0*)(\d*)/,(n,o,s,a)=>o+a),t.length&&!/\d$/.test(l[0])&&(l[0]=l[0]+"0"),l.length>1&&(l[1]=l[1].replace(/0*$/,""),l[1].length||(l.length=1)),this._insertThousandsSeparators(l.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const l=t.split(this.radix);return l.length<2&&l.push(""),l[1]=l[1].padEnd(this.scale,"0"),l.join(this.radix)}doSkipInvalid(t,l,n){l===void 0&&(l={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===se.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,l,n)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,se.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(se.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||se.EMPTY_VALUES.includes(t)&&se.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}al=se,se.UNMASKED_RADIX=".",se.EMPTY_VALUES=[...le.EMPTY_VALUES,0],se.DEFAULTS={...le.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[al.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:r=>r.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},j.MaskedNumber=se;const Je={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function mt(r,t,l){t===void 0&&(t=Je.MASKED),l===void 0&&(l=Je.MASKED);const n=pe(r);return o=>n.runIsolated(s=>(s[t]=o,s[l]))}function rl(r,t,l,n){return mt(t,l,n)(r)}j.PIPE_TYPE=Je,j.createPipe=mt,j.pipe=rl;class il extends ne{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var l,n,o;const{repeat:s,...a}=Ce(t);this._blockOpts=Object.assign({},this._blockOpts,a);const i=pe(this._blockOpts);this.repeat=(l=(n=s??i.repeat)!=null?n:this.repeat)!=null?l:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(pe(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,l){l===void 0&&(l={});const n=new P;for(let c=(o=(s=this._mapPosToBlock(this.displayValue.length))==null?void 0:s.index)!=null?o:Math.max(this._blocks.length-1,0),d,m;d=(a=this._blocks[c])!=null?a:m=!m&&this._allocateBlock(c);++c){var o,s,a,i;const f=d._appendChar(t,{...l,_beforeTailState:(i=l._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(f.skip&&m){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(n.aggregate(f),f.consumed)break}return n}_trimEmptyTail(t,l){var n,o;t===void 0&&(t=0);const s=Math.max(((n=this._mapPosToBlock(t))==null?void 0:n.index)||0,this.repeatFrom,0);let a;l!=null&&(a=(o=this._mapPosToBlock(l))==null?void 0:o.index),a==null&&(a=this._blocks.length-1);let i=0;for(let c=a;s<=c&&!this._blocks[c].unmaskedValue;--c,++i);i&&(this._blocks.splice(a-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=super.remove(t,l);return this._trimEmptyTail(t,l),n}totalInputPositions(t,l){return t===void 0&&(t=0),l==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,l)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}j.RepeatBlock=il;try{globalThis.IMask=j}catch{}const cl=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:P,ChunksTailDetails:be,DIRECTION:T,HTMLContenteditableMaskElement:pt,HTMLInputMaskElement:ll,HTMLMaskElement:Le,InputMask:nl,MaskElement:We,Masked:le,MaskedDate:me,MaskedDynamic:Oe,MaskedEnum:Re,MaskedFunction:sl,MaskedNumber:se,MaskedPattern:ne,MaskedRange:Te,MaskedRegExp:ol,PIPE_TYPE:Je,PatternFixedDefinition:ht,PatternInputDefinition:Ie,RepeatBlock:il,createMask:pe,createPipe:mt,default:j,forceDirection:Qt,normalizeOpts:Ce,pipe:rl},Symbol.toStringTag,{value:"Module"}));Z.ModalEdit=Wt,Z.VForm=_e,Z.VsInputAddress=Ht,Z.VsInputArray=Pt,Z.VsInputCheckbox=_t,Z.VsInputCodegen=Rt,Z.VsInputColor=jt,Z.VsInputContainer=At,Z.VsInputDate=Et,Z.VsInputEmail=wt,Z.VsInputFile=Nt,Z.VsInputFileList=Mt,Z.VsInputKeyValue=zt,Z.VsInputMask=xt,Z.VsInputNumber=yt,Z.VsInputRadio=it,Z.VsInputRange=Ut,Z.VsInputSelect=ct,Z.VsInputSlug=Ot,Z.VsInputStatic=rt,Z.VsInputSwitcher=at,Z.VsInputTag=Tt,Z.VsInputText=Fe,Z.VsInputTextarea=Ft,Z.default=_e,Z.inputs=Gt,Z.vsInputDatatable=Lt,Z.vsInputMap=It,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(K,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],e):(K=typeof globalThis<"u"?globalThis:K||self,e(K.FormBuilder={},K.Vue,K.OpenGISCore))})(this,function(K,e,Q){"use strict";const il={class:"w-full relative"},cl={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},dl={class:"opacity-100"},ul={key:0,class:"text-red-500 text-[14px]"},pl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},hl=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){const t=e.ref("uk"),l=n=>{n.detail.key==="locale"&&(t.value=n.detail.newValue)};return e.onMounted(()=>{t.value=localStorage.locale,window.addEventListener("storage",l)}),e.onUnmounted(()=>{window.removeEventListener("resize",l)}),(n,o)=>(e.openBlock(),e.createElementBlock("div",il,[n.ua||n.label?(e.openBlock(),e.createElementBlock("div",cl,[e.createElementVNode("span",dl,e.toDisplayString(n.item[t.value]||n.ua||n.label),1),n.item?.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",ul,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"default",e.mergeProps(n.$attrs,{class:{"opacity-60":n.item.disabled}})),n.error?(e.openBlock(),e.createElementBlock("span",pl,e.toDisplayString(n.error),1)):e.createCommentVNode("",!0)]))}}),ml={class:"w-full relative flex flex-row items-center gap-2"},fl={key:0,class:"text-red-500 text-[14px]"},gl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},kl=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(r){const t=r,l=e.computed(()=>t.columns??{container:12,label:3}),n=e.computed(()=>{const{container:i,label:c}=l.value;return!i||i<=0?0:Math.min(Math.max(c??0,0),i)/i}),o=e.computed(()=>t.item?.type==="html"||n.value<=0?!1:!!(t.ua||t.label)),s=e.computed(()=>{if(!o.value)return{};const i=`${n.value*100}%`;return{flexBasis:i,maxWidth:i}}),a=e.computed(()=>{const{container:i,label:c}=l.value;if(!i||i<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!o.value)return{flexBasis:"100%",maxWidth:"100%"};const d=Math.max(i-Math.max(c??0,0),0)/i;if(!d)return{};const p=`${d*100}%`;return{flexBasis:p,maxWidth:p}});return(i,c)=>(e.openBlock(),e.createElementBlock("div",ml,[o.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:e.normalizeStyle(s.value)},[e.createTextVNode(e.toDisplayString(i.ua||i.label)+" ",1),i.item?.rules?.includes("required")&&(i.ua||i.label)?(e.openBlock(),e.createElementBlock("span",fl,"*")):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(a.value)},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],4),i.error?(e.openBlock(),e.createElementBlock("span",gl,e.toDisplayString(i.error),1)):e.createCommentVNode("",!0)]))}}),yl={class:"w-full relative"},bl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},xl=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){return(t,l)=>(e.openBlock(),e.createElementBlock("div",yl,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",bl,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),wl={class:"flex-1 min-w-0"},_l={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},El={class:"truncate"},Vl={key:0,class:"text-red-500 text-[14px]"},vl={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},Bl={key:0,class:"mt-1 text-xs text-red-500"},Cl={default:hl,horizontal:kl,inline:xl,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){const t=r,l=e.ref("uk");e.computed(()=>(t.item??{})?.[l.value]??t.ua??t.label??"");const n=e.computed(()=>t.item?.description??""),o=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),s=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),a=i=>{i.key==="locale"&&(l.value=i.newValue??"uk")};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(l.value=localStorage.locale)}catch{}window.addEventListener("storage",a)}),e.onUnmounted(()=>{window.removeEventListener("storage",a)}),(i,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",wl,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",_l,[e.createElementVNode("span",El,e.toDisplayString(i.item[l.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Vl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("p",vl,e.toDisplayString(n.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),s.value?(e.openBlock(),e.createElementBlock("p",Bl,e.toDisplayString(s.value),1)):e.createCommentVNode("",!0)],2))}})};function ae(r){return{inputClass:e.computed(()=>{const l=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${r?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return r?.size==="sm"?`${l}h-[32px]`:`${l}h-[38px]`})}}const Nl=["placeholder","disabled"],Sl=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??"");return(a,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),placeholder:s.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Nl)),[[e.vModelText,n.value]])}}),Ml=["placeholder","disabled"],Ee=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??"");return(a,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),placeholder:s.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Ml)),[[e.vModelText,n.value]])}}),$l=["placeholder","disabled","min","max"],kt=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled);return(s,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":a[0]||(a[0]=i=>n.value=i),placeholder:s.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"},min:s.min,max:s.max},null,10,$l)),[[e.vModelText,n.value]])}}),H=(r,t)=>{const l=r.__vccOpts||r;for(const[n,o]of t)l[n]=o;return l},Al={},Fl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function Dl(r,t){return e.openBlock(),e.createElementBlock("svg",Fl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const Il=H(Al,[["render",Dl]]),Tl={class:"flex items-center gap-[4px]"},Ll=["value","id","disabled"],Ol=["for"],Rl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},zl=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(r,{emit:t}){const l=t,n=r,o=e.computed({get:()=>n.modelValue,set:a=>l("update:modelValue",a)}),s=e.computed(()=>!!n.disabled);return(a,i)=>(e.openBlock(),e.createElementBlock("div",Tl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:a.value,"onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":s.value}]),id:a.id,disabled:s.value},null,10,Ll),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:a.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":s.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",a.error?"border-red-600":""]])},[e.createVNode(Il,{height:"12",width:"12"})],2),e.createElementVNode("span",Rl,[e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(a.label),1)])])],10,Ol)]))}}),jl=["name","value","disabled"],Ul={class:"flex items-center gap-[6px] text-[14px]"},Pl={key:0,class:"text-[16px]"},Hl=["src"],Gl=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r,n=t,o=e.computed({get:()=>l.modelValue,set:i=>{n("update:modelValue",i)}}),s=e.computed(()=>Array.isArray(o.value)?o.value.includes(l.value):o.value===!0||o.value===l.value),a=e.computed(()=>l.style?.size==="xs"?"p-1.5 text-xs":l.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,c)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[a.value,s.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:i.disabled},null,8,jl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",Ul,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",Pl,[i.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(i.icon)},null,2)):e.createCommentVNode("",!0),i.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Hl)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),Kl={class:"flex items-center"},et=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r,n=t,o=`radio-${Math.floor(Math.random()*1e4)}`,s=e.computed({get:()=>Array.isArray(l.modelValue)?Array.isArray(l.modelValue)&&l.modelValue.includes(l.value):l.modelValue,set:i=>{if(Array.isArray(l.modelValue)){let c=[...l.modelValue];i?c.includes(l.value)||c.push(l.value):c=c.filter(d=>d!==l.value),n("update:modelValue",c)}else n("update:modelValue",i)}}),a=e.ref(`vs-checkbox-${l.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Kl,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value==="vs-checkbox-buttons"?e.unref(Gl):e.unref(zl)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),ql={},Zl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function Wl(r,t){return e.openBlock(),e.createElementBlock("svg",Zl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Yl=H(ql,[["render",Wl]]),Jl={},Xl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function Ql(r,t){return e.openBlock(),e.createElementBlock("svg",Xl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const tt=H(Jl,[["render",Ql]]),en={},tn={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function ln(r,t){return e.openBlock(),e.createElementBlock("svg",tn,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M12 9h.01"},null,-1),e.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),e.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const nn=H(en,[["render",ln]]),on={key:0,class:"flex items-start gap-x-1"},sn={key:0,class:"text-red-500 text-[14px]"},an=["title"],rn=["disabled"],lt=e.defineComponent({__name:"vs-input-switcher",props:e.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue");return(n,o)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",on,[e.createVNode(et,{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=s=>l.value=s),label:n.text,error:n.error||""},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",sn,"*")):e.createCommentVNode("",!0),n.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(nn),{class:"text-gray-500 w-[14px] h-[14px]"})],8,an)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[l.value?`bg-${n.style?.primaryColor||"blue"}-500`:"bg-stone-200",n.customClass]]),disabled:n.disabled,onClick:o[2]||(o[2]=s=>l.value=!l.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[l.value?"translate-x-4":"translate-x-0"]])},null,2)],10,rn))}}),cn=["id","innerHTML"],nt=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(r){return(t,l)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,cn))}}),dn=["placeholder","disabled","name"],yt=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue"),o=e.ref(null);let s=null;return e.onMounted(async()=>{if(o.value){const{default:a}=await Promise.resolve().then(()=>al);s=a(o.value,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),s.on("accept",()=>{n.value=t.unmask?s.unmaskedValue:s.value}),s.on("complete",()=>{n.value=t.unmask?s.unmaskedValue:s.value}),s.value=n.value??""}}),e.onBeforeUnmount(()=>{s?.destroy()}),e.watch(()=>t.mask,a=>{s&&s.updateOptions({mask:a,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),e.watch(n,a=>{s&&s.unmaskedValue!==a&&(s.value=a||"")}),(a,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:a.placeholder,disabled:a.disabled,name:a.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"}},null,10,dn))}}),un={class:"relative w-full bg-white rounded-lg"},pn=["placeholder","disabled"],bt=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue");return(o,s)=>(e.openBlock(),e.createElementBlock("div",un,[s[1]||(s[1]=e.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><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" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":s[0]||(s[0]=a=>n.value=a),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,pn),[[e.vModelText,n.value]])]))}}),hn=["value","disabled"],mn={class:"text-[13px] text-gray-700"},fn=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.computed(()=>!!t.disabled);return(o,s)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,n.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>l.value=a),type:"radio",value:t.value,disabled:n.value,class:"hidden"},null,8,hn),[[e.vModelRadio,l.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,n.value?"opacity-50 cursor-not-allowed":""]])},[l.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",mn,e.toDisplayString(t.text),1)],2))}}),gn=["value","disabled"],kn={class:"text-[13px] text-gray-700"},yn={"vs-input-radio-default":fn,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.computed(()=>!!t.disabled);return(o,s)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[l.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,n.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=a=>l.value=a),type:"radio",value:t.value,disabled:n.value,class:"hidden"},null,8,gn),[[e.vModelRadio,l.value]]),e.createElementVNode("span",kn,e.toDisplayString(t.text),1)],2))}})},ot=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.computed(()=>yn[`vs-input-radio-${t.view}`]);return(o,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,a=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value),e.mergeProps({key:a?.id,text:a.text,value:a.id.toString(),checked:l.value===a.id,modelValue:l.value,"onUpdate:modelValue":s[0]||(s[0]=i=>l.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),bn={key:1,class:"w-full flex flex-col gap-4"},xn={key:0,class:"text-sm font-medium text-muted-foreground my-2"},wn="Без категорії",xt=H(e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r,n=t,o=e.ref([]),s=e.reactive({}),a=f=>f?.value||f?.id||f?.text||f,i=f=>f.text||String(f),c=f=>`lg:col-span-${f||12}`,d=e.computed(()=>[l.position==="vertical"?"flex flex-col":"",l.colSpan?"grid":"flex justify-start"]),p=f=>f==null||f===""?null:typeof f=="string"||typeof f=="number"?f:String(f),h=e.computed(()=>{if(!l.group)return[];const f=new Map;o.value.forEach(x=>{const C=x[l.group],k=p(C);f.has(k)||f.set(k,[]),f.get(k)?.push(x)});const B=[];l.values?.length&&l.values.forEach(x=>{const C=p(x);B.push(C)});const m=new Set,g=x=>{const C=f.get(x)||[];if(!C.length)return null;const k=x===null?"group-null":`group-${String(x)}`,E=x===null?wn:String(x);return m.add(x),{key:k,label:E,options:C}},b=[];return B.forEach(x=>{const C=g(x);C&&b.push(C)}),f.forEach((x,C)=>{if(m.has(C))return;const k=g(C);k&&b.push(k)}),b}),_=async()=>{try{const f=await fetch(`/api/suggest/${l.data}`).then(B=>B.json());o.value=f?.data||f}catch(f){console.error(f)}};return e.watch(()=>l.modelValue,f=>{if(typeof f=="boolean"&&o.value.length===1){const B=a(o.value[0]);s[B]=f}else if(Array.isArray(f)){const B=new Set(f);o.value.forEach(m=>{if(!m.disabled){const g=a(m);s[g]=B.has(g)}})}},{immediate:!0}),e.watch(s,()=>{if(!o.value.length){n("update:modelValue",null);return}const f=Object.entries(s).filter(([,B])=>B).map(([B])=>B);n("update:modelValue",f.length===0?[]:f)},{deep:!0}),e.onMounted(()=>{if(l.data)_().then(()=>{if(typeof l.modelValue=="boolean"&&o.value.length===1){const f=a(o.value[0]);s[f]=l.modelValue}else if(Array.isArray(l.modelValue)){const f=new Set(l.modelValue);o.value.forEach(B=>{if(!B.disabled){const m=a(B);s[m]=f.has(m)}})}});else if(o.value=l.options,typeof l.modelValue=="boolean"&&o.value.length===1){const f=a(o.value[0]);s[f]=l.modelValue}else if(Array.isArray(l.modelValue)){const f=new Set(l.modelValue);o.value.forEach(B=>{if(!B.disabled){const m=a(B);s[m]=f.has(m)}})}}),(f,B)=>l.group?(e.openBlock(),e.createElementBlock("div",bn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,m=>(e.openBlock(),e.createElementBlock("div",{key:m.key,class:"flex flex-col gap-2"},[m.label?(e.openBlock(),e.createElementBlock("span",xn,e.toDisplayString(m.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.options,g=>(e.openBlock(),e.createBlock(et,{modelValue:s[a(g)],"onUpdate:modelValue":b=>s[a(g)]=b,value:a(g),class:e.normalizeClass(c(f.colSpan)),disabled:l.disabled||g.disabled,label:i(g),key:`${m.key}-${a(g)}`,icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:f.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,m=>(e.openBlock(),e.createBlock(et,{modelValue:s[a(m)],"onUpdate:modelValue":g=>s[a(m)]=g,value:a(m),class:e.normalizeClass(c(f.colSpan)),disabled:l.disabled||m.disabled,label:i(m),key:a(m),icon:m?.icon,imgUrl:m?.imgUrl,option:m,view:f.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),_n=["type","placeholder","disabled"],wt=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},mode:{default:"date"}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r;function n(p){return p?l.mode==="datetime"?(p.includes("T")?p:null)||p+(p.includes(" ")?"":"T00:00"):p?.split(" ")[0]:null}const{inputClass:o}=ae(l.style),s=t,a=e.computed({get:()=>n(l.modelValue),set:p=>s("update:modelValue",p)}),i=e.computed(()=>l.mode==="datetime"?"datetime-local":l.mode),c=e.computed(()=>!!l.disabled),d=e.computed(()=>l.placeholder??"");return(p,h)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":h[0]||(h[0]=_=>a.value=_),placeholder:d.value,disabled:c.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[p.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,_n)),[[e.vModelDynamic,a.value]])}}),_t=async(r,t,l,n)=>{try{const o=new FormData;return o.append("unique","true"),o.append("file",r),(await fetch(`/file/upload/uploads?id=${t||""}&form=${l||""}&table=${n||""}`,{method:"POST",body:o}).then(a=>a.json()))?.result}catch(o){return Q.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",o),null}},En=async r=>{try{return await fetch(`file/delete${r}`),!0}catch(t){return console.error(t),!1}},Et=async r=>{try{const t=await fetch(`file/download/files/uploads${r}`),l=await t.arrayBuffer(),n=t.headers["content-type"],o=new TextDecoder("utf-8").decode(l),s=new Blob([o],{type:n}),a=document.createElement("a");a.setAttribute("download",r),a.href=window.URL.createObjectURL(s),a.click()}catch(t){console.error(t.message)}},Vn={},vn={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Bn(r,t){return e.openBlock(),e.createElementBlock("svg",vn,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const xe=H(Vn,[["render",Bn]]),Cn={},Nn={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Sn(r,t,l,n,o,s){return e.openBlock(),e.createElementBlock("svg",Nn,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const Mn=H(Cn,[["render",Sn]]),$n={},An={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Fn(r,t,l,n,o,s){return e.openBlock(),e.createElementBlock("svg",An,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),e.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),e.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const Dn=H($n,[["render",Fn]]),In={},Tn={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Ln(r,t){return e.openBlock(),e.createElementBlock("svg",Tn,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const Vt=H(In,[["render",Ln]]),On={},Rn={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function zn(r,t,l,n,o,s){return e.openBlock(),e.createElementBlock("svg",Rn,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const jn=H(On,[["render",zn]]),Un={},Pn={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Hn(r,t,l,n,o,s){return e.openBlock(),e.createElementBlock("svg",Pn,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const Gn=H(Un,[["render",Hn]]),Kn=r=>{if(!r)return"";const t=r?.split(".");return t[t.length-1]},qn=r=>{const t=Kn(r),l={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return l.imageFormat.includes(t)?"img":l.sheetsFormat.includes(t)?Dn:l.textsFormat.includes(t)?Gn:l.documentsFormat.includes(t)?Mn:l.archivesFormat.includes(t)?jn:Vt},Zn={},Wn={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function Yn(r,t){return e.openBlock(),e.createElementBlock("svg",Wn,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const ze=H(Zn,[["render",Yn]]),Jn={},Xn={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Qn(r,t){return e.openBlock(),e.createElementBlock("svg",Xn,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const vt=H(Jn,[["render",Qn]]),eo=["title"],to={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},Bt=H(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(r){const t=e.useModel(r,"value"),l=e.useModel(r,"item"),n=r;return(o,s)=>(e.openBlock(),e.createElementBlock("div",{title:l.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(qn)(l.value)),{src:l.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:s[0]||(s[0]=a=>e.unref(Et)(l.value))},null,8,["src"])),e.createElementVNode("div",to,[e.createElementVNode("button",{type:"button",onClick:s[1]||(s[1]=a=>{e.unref(En)(l.value),t.value=n.multiple?t.value?.filter(i=>i!==l.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(ze,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:s[2]||(s[2]=a=>e.unref(Et)(l.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(vt,{class:"w-4 h-4"})])])],8,eo))}}),[["__scopeId","data-v-286cdbc0"]]),lo={class:"flex items-center gap-x-2"},no=["multiple","disabled"],oo={key:1,class:"flex items-center flex-wrap gap-2"},so={key:1,class:"loader"},ao={key:1,class:"loader"},Ct=H(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(r,{emit:t}){const l=r,n=e.useModel(r,"modelValue"),o=t,s=e.ref(null),a=e.ref(!1),i=p=>Array.isArray(n.value)&&n.value[p]||"",c=p=>{if(l.max_size&&p.size>l.max_size*1024*1024){const h=(p.size/1048576).toFixed(2);return Q.notify({type:"error",title:"Помилка!",message:`Файл "${p.name}" занадто великий. Максимальний розмір: ${l.max_size} МБ, розмір файлу: ${h} МБ`,position:"right-bottom"}),!1}return!0},d=async p=>{const{files:h}=p.target;if(!h||h.length===0)return;const _=Array.from(h);if(l.max_size&&_.filter(B=>!c(B)).length>0){s.value&&(s.value.value="");return}a.value=!0;try{if(l.multiple){const f=Array.from(h).map(async b=>l.format&&!b.name.endsWith(l.format)?null:await _t(b,"1","form","table")),g=(await Promise.all(f)).filter(b=>b!==null).map(b=>b?.file_path).filter(Boolean);n.value=[...n.value||[],...g],o("change",n.value)}else{const f=h[0];if(l.format&&!f.name.endsWith(l.format))return;const B=await _t(f,"1","form","table");n.value=B?.file_path,o("change",n.value||"")}}finally{a.value=!1,s.value&&(s.value.value="")}};return(p,h)=>(e.openBlock(),e.createElementBlock("div",lo,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:s,type:"file",multiple:p.multiple,onChange:d,disabled:a.value||p.disabled},null,40,no),!p.multiple&&n.value?(e.openBlock(),e.createBlock(Bt,{key:0,item:n.value,"onUpdate:item":h[0]||(h[0]=_=>n.value=_),value:n.value,"onUpdate:value":h[1]||(h[1]=_=>n.value=_)},null,8,["item","value"])):p.multiple?(e.openBlock(),e.createElementBlock("div",oo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(_,f)=>(e.openBlock(),e.createBlock(Bt,{multiple:p.multiple,key:f,value:n.value,"onUpdate:value":h[2]||(h[2]=B=>n.value=B),item:i(f)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:h[3]||(h[3]=_=>!p.disabled&&!a.value&&s.value?.click()),class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",p.disabled||a.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[a.value?(e.openBlock(),e.createElementBlock("div",so)):(e.openBlock(),e.createBlock(xe,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),p.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:h[4]||(h[4]=_=>s.value?.click()),class:e.normalizeClass([p.disabled||a.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[a.value?(e.openBlock(),e.createElementBlock("div",ao)):(e.openBlock(),e.createBlock(xe,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-70ddd946"]]),ro={class:"max-w-[55vw]"},io={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},co={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},uo={class:"px-[5px]"},po={class:""},je=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(r){const t=r,l=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function n(o){if(o<1024)return`${o} B`;const s=o/1024;return s<1024?`${s.toFixed(2)} KB`:`${(s/1024).toFixed(2)} MB`}return(o,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[s[1]||(s[1]=e.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),e.createElementVNode("div",ro,[e.createElementVNode("p",io,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",co,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",uo,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(l.value),1),s[0]||(s[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",po,e.toDisplayString(n(o.item?.size)),1)])])],64))}}),ho={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},mo={key:0,class:"flex w-full gap-x-3 items-center"},fo={key:1,class:"flex gap-x-3 w-full items-center"},go={key:2,class:"flex gap-x-3 w-full items-center"},ko=["href"],yo={key:3,class:"flex gap-x-3 w-full items-center"},bo={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},xo={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},wo={class:"inline-block"},_o={class:"inline-block"},Eo=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(r,{emit:t}){const l=r,n=t;function o(p){return["pdf","json"].includes(p.ext)}function s(p){return["ppt","pptx","doc","docx","xls","xlsx"].includes(p.ext)}function a(p){const h=document.createElement("a");h.setAttribute("download",p?.uploaded_name),h.href=p?.file_path,h.click()}async function i(){try{await fetch(`${l.prefix}/widget/file/${l.item.entity_id}/${l.item.file_id}`),n("update")}catch(p){console.error(p)}}function c(){n("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(p){(l.item.ext==="jpg"||l.item.ext==="png")&&n("openLightbox",{item:l.item,index:p})}return(p,h)=>(e.openBlock(),e.createElementBlock("div",ho,[p.item.ext==="jpg"||p.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",mo,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:h[0]||(h[0]=_=>d(p.index))},[e.createVNode(je,{item:p.item},null,8,["item"])])])):o(p.item)?(e.openBlock(),e.createElementBlock("div",fo,[e.createVNode(je,{item:p.item},null,8,["item"])])):s(p.item)?(e.openBlock(),e.createElementBlock("div",go,[e.createElementVNode("a",{href:`/api/file-preview?id=${p.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(je,{item:p.item},null,8,["item"])],8,ko)])):(e.openBlock(),e.createElementBlock("div",yo,[e.createVNode(je,{item:p.item},null,8,["item"])])),e.createElementVNode("div",bo,[e.createElementVNode("div",xo,[e.createElementVNode("div",wo,[e.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:h[1]||(h[1]=_=>a(p.item))},[e.createVNode(vt,{height:"14",width:"14"})])]),h[3]||(h[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",_o,[e.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:h[2]||(h[2]=_=>c())},[e.createVNode(ze,{height:"14",width:"14"})])])])])]))}}),Vo={},vo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Bo(r,t){return e.openBlock(),e.createElementBlock("svg",vo,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Co=H(Vo,[["render",Bo]]),No={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},So={class:"flex w-full mb-[12px] items-center gap-x-2"},Mo={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},$o={class1:"ml-auto"},Ao={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},Fo={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Do={class:"relative"},Io={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},To={key:0},Nt=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(r,{emit:t}){const l=r,n=e.inject("form"),o=e.computed(()=>n.value.formId),s=e.ref(!1),a=e.ref(0),i=t,c=e.ref(!1),d=e.ref({}),p=e.ref([]),h=e.ref(""),_=e.computed(()=>Array.isArray(p.value)?p.value.filter(C=>C.ext==="jpg"||C.ext==="png").map(C=>C?.file_path):[]),f=e.computed(()=>h.value===""?p.value:p.value.filter(C=>C?.uploaded_name?.includes(h.value))),B=C=>{const k=_.value.findIndex(E=>E===C.item.file_path);k!==-1&&(s.value=!0,a.value=k)},m=async()=>{try{const C=await fetch(`${l.prefix}/widget/file/${o.value}`).then(k=>k.json());p.value=C?.rows}catch(C){console.error(C)}},g=async C=>{await Promise.all(Array.from(C.target.files).map(async k=>{const E=new FormData;E.append("file",k);try{const $=`${l.prefix}/widget/file/${o.value}`,M=await fetch($,{method:"POST",body:E});return M.ok?(i("update","file-list"),k):(Q.notify({type:M.status>=400&&M.status<500?"warning":"error",title:"Error",message:`Error code: ${M.status}`}),null)}catch($){return Q.notify({type:"error",title:"Error",message:$.message||"Unknown error"}),console.error($),null}})),await m()},b=C=>{const k={...C};return C.cancel||(k.cancel=()=>{c.value=!1}),C.updateListOnConfirm&&(k.confirm=async()=>{await C.confirm(),c.value=!1,m()}),k},x=C=>{d.value=b(C),c.value=!0};return e.watch(o,C=>{C&&m()}),e.onMounted(()=>{o.value&&m()}),(C,k)=>{const E=e.resolveComponent("Lightbox"),$=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",No,[e.createElementVNode("div",So,[e.createElementVNode("h2",Mo," Файлів: "+e.toDisplayString(p.value?.length),1),e.createElementVNode("div",$o,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:k[0]||(k[0]=M=>g(M))},null,32),e.createElementVNode("div",Ao,[e.createVNode(Co,{height:"16",width:"16"})])])])]),p.value?.length>4?(e.openBlock(),e.createElementBlock("div",Fo,[e.createElementVNode("div",null,[e.createElementVNode("div",Do,[k[8]||(k[8]=e.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[e.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),e.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":k[1]||(k[1]=M=>h.value=M),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,h.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),p.value?.length?(e.openBlock(),e.createElementBlock("div",Io,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(M,L)=>(e.openBlock(),e.createBlock(Eo,{key:L,prefix:C.prefix,item:M,index:L,onUpdate:k[2]||(k[2]=W=>C.$emit("update","file-list")),onOpenModal:k[3]||(k[3]=W=>x(W)),onOpenLightbox:k[4]||(k[4]=W=>B(W))},null,8,["prefix","item","index"]))),128)),f.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",To,k[9]||(k[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(E,{modelValue:s.value,"onUpdate:modelValue":k[5]||(k[5]=M=>s.value=M),startIndex:a.value,"onUpdate:index":k[6]||(k[6]=M=>a.value=M),images:_.value},null,8,["modelValue","startIndex","images"]),e.createVNode($,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":k[7]||(k[7]=M=>c.value=M),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),Lo={class:"flex items-center justify-between"},Oo={class:"text-[16px] text-gray-900 font-medium"},Ro={class:"grid gap-3"},zo=H(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(r){const t=r,l=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{l.value=n}),(n,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Lo,[e.createElementVNode("p",Oo,e.toDisplayString(r.title),1),e.createVNode(lt,{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=s=>l.value=s),style:e.normalizeStyle(r.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Ro,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,l.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),jo={class:"text-[16px] text-gray-900 font-medium"},Uo={class:"grid gap-3"},Po=H(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(r){const t=r,l=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{l.value=n}),(n,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=s=>l.value=!l.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Yl),{class:e.normalizeClass(["h-4 w-4 duration-300",[l.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",jo,e.toDisplayString(r.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Uo,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,l.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),Ho={class:"flex items-center justify-between"},Go={switcher:zo,accordion:Po,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(r){return(t,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Ho,[e.createElementVNode("p",null,e.toDisplayString(r.title),1)]),e.renderSlot(t.$slots,"default")]))}})},re={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Ko=(r,t)=>String(r)===String(t),qo=(r,t)=>String(r)!==String(t),Zo=(r,t)=>r>t,Wo=(r,t)=>r>=t,Yo=(r,t)=>r<t,Jo=(r,t)=>r<=t,Xo=(r,t)=>Array.isArray(t)&&t.length===2?r>=t[0]&&r<=t[1]:!1,Qo=(r,t)=>String(r).startsWith(String(t)),es=(r,t)=>String(r).endsWith(String(t)),ts=(r,t)=>String(r).includes(String(t)),ls=(r,t)=>Array.isArray(t)?t.includes(r):!1,ns=(r,t)=>Array.isArray(t)?!t.includes(r):!0,St=(r,t)=>{if(!t)return!0;switch(t?.[1]){case re.Equal:return Ko(r,t?.[2]);case re.Inequal:return qo(r,t?.[2]);case re.Higer:return Zo(r,t?.[2]);case re.HigerOrEqual:return Wo(r,t?.[2]);case re.Lower:return Yo(r,t?.[2]);case re.LowerOrEqual:return Jo(r,t?.[2]);case re.Between:return Xo(r,t?.[2]);case re.StartWith:return Qo(r,t?.[2]);case re.EndWith:return es(r,t?.[2]);case re.Contain:return ts(r,t?.[2]);case re.In:return ls(r,t?.[2]);case re.NotIn:return ns(r,t?.[2]);default:return!0}},Mt=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(r){const t=r,l=e.inject("values",e.ref({})),n=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,p=t.name?l.value?.[t.name]?.[d]??l.value?.[d]:l.value?.[d];return St(p,c)})),s=e.computed(()=>Go[t.view]),a=e.computed(()=>{if(l.value||(l.value={}),!t.name)return l.value;const i=l.value[t.name];if(i)return i;const c={};return l.value={...l.value,[t.name]:c},c});return(i,c)=>r.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value),{key:0,title:r.title,style:e.normalizeStyle(r.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,d=>(e.openBlock(),e.createBlock(Pt,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:a.value[d.name],"onUpdate:modelValue":p=>a.value[d.name]=p,style:r.style,error:e.unref(n)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),os=["aria-expanded","data-focus"],ss={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},as={class:"flex items-center min-w-0"},rs=["title"],is=["innerHTML"],cs=["onClick"],ds={class:"flex-1 min-w-[2px]"},us=["placeholder"],ps=["title"],hs=["innerHTML"],ms={key:2,class:"flex-1 min-w-[2px]"},fs=["placeholder"],gs={class:"flex items-center shrink-0"},ks=["disabled"],ys=["disabled","title"],bs=["aria-disabled","onClick"],xs=["innerHTML"],ws={key:1,class:"px-3 py-2 text-center text-gray-500"},_s=["disabled"],st=e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(r,{emit:t}){const l=r,n=t,o=e.computed(()=>l.multiple),s=e.computed(()=>l.disabled);ae(l.style);const a=e.computed({get:()=>l.modelValue,set:w=>n("update:modelValue",w)});!a.value&&l.defaultValue&&(a.value=l.defaultValue);const i=e.ref(null),c=e.ref(null),d=e.ref(null),p=e.ref(null),h=e.ref(!1),_=e.ref(!1),f=e.ref(null),B=e.ref([]),m=e.ref(-1),g=e.ref([]),b=e.ref(""),x=e.ref(null),C=e.ref("bottom"),k=e.ref({}),E=e.ref([]),$=e.computed(()=>{if(!E.value.length)return[];const w=B.value,v=new Map(w.map(N=>[N.id?.toString(),N]));return E.value.map(N=>v.get(N?.toString())).filter(N=>!!N)}),M=e.computed(()=>l.placeholder||"Select..."),L=e.computed(()=>A(f.value));e.computed(()=>o.value?!E.value.length&&b.value==="":!L.value&&b.value==="");const W=e.computed(()=>s.value?!1:o.value?E.value.length>0:!!a.value),G=w=>o.value?E.value.some(v=>v?.toString()===w?.toString()):a.value?.toString()===w?.toString(),F=e.computed(()=>{let w=B.value??[];if(!l.data&&b.value.trim()!==""){const v=b.value.toLowerCase();w=w.filter(N=>{const j=A(N).toLowerCase(),X=N.text?.toLowerCase?.()||"";return j.includes(v)||X.includes(v)})}if(o.value&&E.value.length){const v=new Set(E.value.map(N=>N?.toString()));w=w.filter(N=>!v.has(N.id?.toString()))}return w}),U=e.inject("values"),Z=/\{\{\s*([^}]+?)\s*\}\}/g,Y=w=>(w?String(w):"").replace(/<[^>]*>/g,"").trim(),D=e.computed(()=>l.slot??l?.optionTemplate??""),V=w=>{if(!w)return"";const v=D.value;return v?v.replace(Z,(N,j)=>{const X=j.trim(),ee=w[X];return ee!=null?String(ee):""}):w.text??""},A=w=>{if(!w)return"";if(!D.value)return w.text??"";const N=V(w);return Y(N)||w.text||""},O=w=>{l.set&&U?.value&&Object.entries(l.set).forEach(([v,N])=>{if(!v)return;const j=w?w[N]:null;U.value[v]=j??null})},q=e.computed(()=>l.parent?U?.value?.[l.parent]?.toString()??null:null),se=async w=>{if(!l.data){let v=l.options??[];if(w?.trim()){const N=w.toLowerCase();v=v.filter(j=>{const X=A(j).toLowerCase(),ee=j.text?.toLowerCase?.()||"";return X.includes(N)||ee.includes(N)})}return v}try{const v=l.host??"",N=l.prefix??"api",j=l.api??`/${N}/suggest/${l.data}`,X=`${v}${j}`,ee=new URLSearchParams;return ee.set("json","1"),w&&ee.set("key",w),q.value!==void 0&&q.value!==null&&q.value!==""&&ee.set("parent",q.value),(await fetch(`${X}?${ee.toString()}`).then(_e=>_e.json()))?.data??[]}catch{return[]}},he=async()=>{l.data?B.value=await se(b.value):B.value=l.options?[...l.options]:[]},Ke=async w=>{if(w==null)return null;const v=B.value?.find(N=>N?.id?.toString()===String(w));if(v)return v;if(l.data)try{const N=l.host??"",j=l.prefix??"api",X=l.api??`/${j}/suggest/${l.data}`,ee=`${N}${X}`,ie=new URLSearchParams;return ie.set("json","1"),ie.set("val",String(w)),q.value!==void 0&&q.value!==null&&q.value!==""&&ie.set("parent",q.value),((await fetch(`${ee}?${ie.toString()}`).then(Le=>Le.json()))?.data??[])?.[0]??null}catch{return null}return null},pt=async w=>{const v=new Set(B.value.map(j=>j.id?.toString())),N=w.filter(j=>!v.has(j?.toString()));N.length&&await N.reduce(async(j,X)=>{await j;const ee=await Ke(X);ee&&B.value.push(ee)},Promise.resolve())},ve=async()=>{s.value||(h.value=!0,await he(),await e.nextTick(()=>{ke(),x.value?.focus(),F.value.length?m.value=0:m.value=-1}))},me=()=>{h.value=!1,m.value=-1},qe=async w=>{if(s.value)return;!h.value?await ve():me()},ht=async()=>{h.value?x.value?.focus():await ve()},mt=()=>{o.value?(E.value=[],a.value=[],n("change",[])):(f.value=null,a.value=null,n("change",null)),O(null),b.value="",e.nextTick(()=>x.value?.focus())},ft=w=>{o.value&&(E.value=E.value.filter(v=>v?.toString()!==w?.toString()),a.value=[...E.value],n("change",a.value),e.nextTick(()=>x.value?.focus()))},Ae=w=>{o.value?(G(w.id)||(E.value=[...E.value,w.id],a.value=[...E.value],n("change",a.value)),b.value="",e.nextTick(()=>{x.value?.focus(),m.value=Math.min(m.value,F.value.length-1)}),O(null)):(f.value=w,a.value=w.id,n("change",a.value),b.value="",me(),O(w))},Be=w=>{G(w.id)||Ae(w)},fe=(w,v)=>{if(!w||!v)return;const N=w.offsetTop,j=N+w.offsetHeight,X=v.scrollTop,ee=X+v.clientHeight;let ie=v.scrollTop;N<X?ie=N-80:j>ee&&(ie=j-v.clientHeight+4);const _e=v;_e.scrollTop=ie},ge=w=>{let v=w.parentElement;for(;v;){if(v.classList.contains("ui-dialog__content"))return v;const N=window.getComputedStyle(v),j=N.overflow+N.overflowY+N.overflowX;if(j.includes("auto")||j.includes("scroll")||v===document.body||v===document.documentElement)return v;v=v.parentElement}return document.body},ke=()=>{if(!c.value)return;const w=c.value.getBoundingClientRect(),v=window.innerHeight||document.documentElement.clientHeight,N=window.innerWidth||document.documentElement.clientWidth,j=8,X=8,ee=l.maxHeight||300,ie=v-w.bottom-X-j,_e=w.top-X-j,Te=ie>=_e,Le=Math.max(N-j*2,0);let{width:Oe}=w;Le>0&&Oe>Le&&(Oe=Le);let{left:Re}=w;Re+Oe+j>N&&(Re=N-Oe-j),Re=Math.max(Re,j);const hc=Math.min(ee,Math.max(Te?ie:_e,50));C.value=Te?"bottom":"top",k.value={position:"fixed",left:`${Re}px`,width:`${Oe}px`,minWidth:"300px",maxHeight:`${hc}px`,transform:Te?"none":"translateY(-100%)",top:Te?`${w.bottom+X}px`:`${w.top-X}px`}},gt=async w=>{s.value||!h.value&&(w.key==="ArrowDown"||w.key==="ArrowUp")&&(w.preventDefault(),await ve())},Ze=w=>{if(!h.value)return;const{key:v}=w;if(v==="ArrowDown")w.preventDefault(),m.value+1<F.value.length&&(m.value+=1,fe(g.value[m.value],d.value));else if(v==="ArrowUp")w.preventDefault(),m.value>0&&(m.value-=1,fe(g.value[m.value],d.value));else if(v==="Enter"){w.preventDefault();const N=F.value[m.value];N&&Ae(N),x.value?.blur()}else v==="Escape"?(w.preventDefault(),me()):v==="Backspace"?o.value&&b.value===""&&E.value.length&&(E.value=E.value.slice(0,-1),a.value=[...E.value],n("change",a.value)):v==="Home"?(m.value=0,fe(g.value[0],d.value)):v==="End"?(m.value=F.value.length-1,fe(g.value[m.value],d.value)):v==="Tab"&&me()},Fe=()=>{s.value||(_.value=!0)},We=()=>{_.value=!1,b.value=""},Ye=w=>{w.key==="Escape"&&h.value&&me()},Je=w=>{const v=w.target;i.value?.contains(v)||p.value?.contains(v)||me()},Xe=w=>{h.value&&d.value&&!d.value.contains(w.target)&&ke()},Qe=()=>{h.value&&ke()},De=()=>{h.value&&ke()};e.watch(()=>l.options,w=>{w?.length&&(B.value=[...w],y())},{immediate:!0});async function y(){if(o.value)Array.isArray(a.value)?E.value=[...a.value]:(E.value=a.value==null?[]:[a.value],a.value=[...E.value]),l.data&&E.value.length&&(await pt(E.value),await e.nextTick());else{if(Array.isArray(a.value)){const w=a.value[0]??null;a.value=w??null}a.value!=null&&(f.value=await Ke(a.value)),O(f.value??null)}}e.watch(a,()=>{y()}),e.onMounted(async()=>{addEventListener("keydown",Ye),addEventListener("scroll",Xe,!0),addEventListener("resize",Qe),document.addEventListener("click",Je,!0),c.value&&ge(c.value).addEventListener("scroll",De,!0),l.options?.length&&!l.data?B.value=[...l.options]:l.data&&(B.value=await se("")),await y(),rl.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Ye),removeEventListener("scroll",Xe,!0),removeEventListener("resize",Qe),document.removeEventListener("click",Je,!0),c.value&&ge(c.value).removeEventListener("scroll",De,!0)});const u=e.ref(!1),S=e.ref({}),T=e.ref([]),R=e.ref(null);async function J(){if(!l.add?.token||R?.value.validate())return;const v=l.add.api??`/api/table/${l.add.token}`,{id:N}=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S.value)}).then(j=>j.json());if(!l.options?.length&&l.data){const{data:j}=await fetch(`${l.api??`/api/suggest/${l.data}`}?val=${N}`).then(X=>X.json());f.value=j[0],B.value.push(j[0]),a.value=N}u.value=!1,Q.notify({title:"Success!",message:"Object created."})}async function ne(){if(!l.add)return null;const w=await fetch(`/api/template/form/${l.add.form}`).then(v=>v.json());return T.value=w.schema,u.value=!0,null}function pe(w,v=200){let N;return(...j)=>{N&&clearTimeout(N),N=window.setTimeout(()=>w(...j),v)}}const Ie=pe(async w=>{B.value=await se(w)},200);e.watch(b,w=>{l.data&&Ie(w.trim())}),e.watch(()=>l.options,w=>{!l.data&&w?.length&&(B.value=[...w],y())},{immediate:!0}),e.watch(()=>l.parent??l.parentValue,()=>{l.data&&he()});const rl=e.ref(!0);return e.watch(q,async()=>{if(l.data&&(rl.value||(o.value?(E.value=[],a.value=[],n("change",[])):(f.value=null,a.value=null,n("change",null))),await he(),l.auto===1&&q.value&&B.value.length>0)){const w=B.value[0];w&&Ae(w)}}),(w,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(Q.VsModal),{visible:u.value,"onUpdate:visible":v[1]||(v[1]=N=>u.value=N),title:"Додати",buttonText:"Додати",onDone:J,teleport:w.teleport},{default:e.withCtx(()=>[e.createVNode(we,{schema:T.value,modelValue:S.value,"onUpdate:modelValue":v[0]||(v[0]=N=>S.value=N),ref_key:"addForm",ref:R},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:v[5]||(v[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",l.customClass])},[v[10]||(v[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),v[11]||(v[11]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",h.value||_.value?"border-blue-500 ring-1 ring-blue-500":"",s.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":h.value,"aria-haspopup":"listbox",onKeydown:gt,onClick:ht,"data-focus":h.value||_.value?"true":"false"},[e.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full",ref_key:"triggerRef",ref:c},[o.value?(e.openBlock(),e.createElementBlock("div",ss,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,N=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:N.id},[e.createElementVNode("div",as,[N?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:N?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:A(N)},[D.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:V(N)},null,8,is)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(N.text),1)],64))],8,rs)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:e.withModifiers(j=>ft(N.id),["stop"])},v[6]||(v[6]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,cs)]))),128)),e.createElementVNode("div",ds,[!s.value&&w.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:x,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:E.value.length?" ":M.value,"onUpdate:modelValue":v[2]||(v[2]=N=>b.value=N),onFocus:Fe,onBlur:We,onKeydown:Ze},null,40,us)),[[e.vModelText,b.value]]):e.createCommentVNode("",!0)])])):!o.value&&!_.value&&L.value&&b.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:L.value},[f.value?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:e.normalizeStyle({backgroundColor:f.value?.color})},null,4)):e.createCommentVNode("",!0),D.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":f.value?.color}),innerHTML:V(f.value)},null,10,hs)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":f.value?.color})},e.toDisplayString(f.value?.text),3))],8,ps)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ms,[!s.value&&w.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:x,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:L.value?" ":M.value,"onUpdate:modelValue":v[3]||(v[3]=N=>b.value=N),onFocus:Fe,onBlur:We,onKeydown:Ze},null,40,fs)),[[e.vModelText,b.value]]):e.createCommentVNode("",!0)]))],512),e.createElementVNode("div",gs,[W.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:e.withModifiers(mt,["stop"])},v[7]||(v[7]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,ks)):e.createCommentVNode("",!0),v[9]||(v[9]=e.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),e.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:v[4]||(v[4]=e.withModifiers(N=>qe(),["stop"])),title:h.value?"Закрити список":"Відкрити список"},v[8]||(v[8]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,ys)])],42,os),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:p,class:e.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:e.normalizeStyle(k.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:k.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[F.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(F.value,(N,j)=>(e.openBlock(),e.createElementBlock("div",{key:N.id,ref_for:!0,ref:X=>g.value[j]=X,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",G(N.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",m.value===j&&!G(N.id)?"bg-blue-100":""]),"aria-disabled":G(N.id)?"true":"false",role:"option",tabindex:"-1",onClick:X=>Be(N)},[N?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:e.normalizeStyle({backgroundColor:N?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",m.value===N.id?"text-white":"",(m.value===j,"")])},[D.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:V(N)},null,8,xs)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(N.text),1)],64))],2)],10,bs))),128)):(e.openBlock(),e.createElementBlock("div",ws," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),l.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:ne,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:s.value,type:"button"},[e.createVNode(xe,{width:"16",height:"16"}),v[12]||(v[12]=e.createElementVNode("span",null,"Додати",-1))],8,_s)):e.createCommentVNode("",!0)],512)],64))}}),Es=["placeholder","disabled"],$t=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:l}=ae(t.style),n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??"");return(a,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),placeholder:s.value,disabled:o.value,row:"2",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"}},null,10,Es)),[[e.vModelText,n.value]])}}),Vs={},vs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function Bs(r,t){return e.openBlock(),e.createElementBlock("svg",vs,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),e.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const Cs=H(Vs,[["render",Bs]]),Ns={},Ss={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Ms(r,t){return e.openBlock(),e.createElementBlock("svg",Ss,t[0]||(t[0]=[e.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),e.createElementVNode("path",{d:"M7 20V4"},null,-1),e.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),e.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const $s=H(Ns,[["render",Ms]]),As={},Fs={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Ds(r,t){return e.openBlock(),e.createElementBlock("svg",Fs,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Is=H(As,[["render",Ds]]),Ts={},Ls={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Os(r,t){return e.openBlock(),e.createElementBlock("svg",Ls,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Rs=H(Ts,[["render",Os]]),zs={},js={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Us(r,t){return e.openBlock(),e.createElementBlock("svg",js,t[0]||(t[0]=[e.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const At=H(zs,[["render",Us]]),Ps={},Hs={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Gs(r,t){return e.openBlock(),e.createElementBlock("svg",Hs,t[0]||(t[0]=[e.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const Ks=H(Ps,[["render",Gs]]),qs={},Zs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Ws(r,t){return e.openBlock(),e.createElementBlock("svg",Zs,t[0]||(t[0]=[e.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const Ys=H(qs,[["render",Ws]]),Js={class:"vs-datatable border rounded-xl w-full flex-grow"},Xs={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},Qs={class:"relative w-full"},ea={class:"table-wrapper flex gap-2"},ta={class:"vs-popover inline-block text-slate-700"},la={class:"text-center"},na={class:""},oa={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},sa={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},aa={class:"text-sm items-center text-gray-800 flex gap-1"},ra={class:"w-full overflow-x-auto"},ia={class:"w-full table-auto caption-bottom text-sm"},ca={class:"[&_tr]:border-b"},da={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},ua={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},pa={key:0,colspan:"100%",class:"text-center"},ha={class:"w-full"},ma={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},fa=["onDragstart","onDragover","onDrop"],ga={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},ka={class:"flex items-center justify-center"},ya={key:0,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},ba={key:0},xa=["src"],wa={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},_a=["innerHTML"],Ea={key:2,class:"line-clamp-2 rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},Va={key:3,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},va={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},Ba={class:"flex items-center justify-center gap-2"},Ca=["onClick"],Na=["onClick"],Sa={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Ft=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.ref({}),o=e.ref(""),s=e.computed(()=>{if(!o.value)return l.value??[];const D=o.value.toLowerCase();return l.value.filter(V=>t.colModel?.some(A=>{const O=V[A.key];return O?Array.isArray(O)?O.join(", ").toLowerCase().includes(D):String(O).toLowerCase().includes(D):!1}))}),a=e.ref(null),i=e.ref(null),c=e.ref(!1),d=e.ref(null),p=e.ref({top:0,left:0}),h=D=>{a.value=D},_=D=>{i.value=D},f=D=>{if(a.value===null||a.value===D){a.value=null,i.value=null;return}const V=[...l.value],[A]=V.splice(a.value,1);V.splice(D,0,A),l.value=V,a.value=null,i.value=null},B=D=>{const A=D.currentTarget.getBoundingClientRect();p.value={top:A.bottom+window.scrollY,left:A.left+window.scrollX},c.value=!c.value},m=()=>{d.value&&d.value.click()},g=D=>{const V=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],A=D.toLowerCase();return V.some(O=>A.endsWith(O))},b=D=>{const A=D.target.files?.[0];if(!A)return;const O=new FileReader;O.onload=q=>{try{const se=q.target?.result;if(typeof se=="string"){const he=JSON.parse(se);Array.isArray(he)&&l.value.push(...he)}}catch(se){console.error("Error parsing file:",se)}},O.readAsText(A)},x=()=>{const D=JSON.stringify(l.value,null,2),V=new Blob([D],{type:"application/json"}),A=URL.createObjectURL(V),O=document.createElement("a");O.href=A,O.download="data.json",O.click(),URL.revokeObjectURL(A)};e.onMounted(async()=>{const D=t.colModel?.filter(V=>V.data);D?.length&&Promise.all(D.map(async V=>{const O=await(await fetch(`/api/suggest/${V.data}`)).json();n.value[V.key]=O.data}))});const C=e.ref(""),k=e.ref(!1);let E="edit",$=0;const M=e.ref({}),L=e.ref({});async function W(){C.value="Додати",k.value=!0,E="add",M.value={}}function G(D,V){const A=V.key||V.name;return n.value[A]&&D[A]?n.value[A].find(O=>O.id.toString()===D[A].toString())?.text??D[A]:D[A]||"-"}async function F(D,V){C.value="Редагувати",k.value=!0,E="edit",$=V,M.value={...D}}function U(){const D=L.value.validate();if(D){Q.notify({type:"warning",title:"Помилка валідації",message:Object.entries(D).map(([V,A])=>`${V}: ${A}`).join(`
2
+ `)});return}E==="add"?Array.isArray(l.value)?l.value=[...l.value,M.value]:l.value=[M.value]:l.value=l.value.map((V,A)=>A===$?M.value:V),k.value=!1}function Z(D){l.value=l.value.filter((V,A)=>A!==D)}function Y(){k.value=!1}return(D,V)=>(e.openBlock(),e.createElementBlock("div",Js,[e.createElementVNode("div",Xs,[e.createElementVNode("div",Qs,[e.createVNode(Cs,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":V[0]||(V[0]=A=>o.value=A),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[e.vModelText,o.value]])]),e.createElementVNode("div",ea,[e.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",ta,[e.createElementVNode("div",la,[e.createElementVNode("div",na,[e.createElementVNode("button",{onClick:B,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[e.createVNode($s,{height:"16",width:"16"})])])])])]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:e.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:p.value.top+"px",left:p.value.left+"px"}])},[e.createElementVNode("div",oa,[e.createElementVNode("div",sa,[e.createElementVNode("button",{onClick:m,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(Is,{class:"text-black",width:"14",height:"14"}),V[4]||(V[4]=e.createTextVNode(" Імпортувати "))]),e.createElementVNode("button",{onClick:x,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createElementVNode("span",aa,[e.createVNode(Rs,{class:"text-black",width:"14",height:"14"}),V[5]||(V[5]=e.createTextVNode(" Експортувати "))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:W,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[e.createVNode(xe),V[6]||(V[6]=e.createTextVNode(" Додати "))])]),e.createElementVNode("div",ra,[e.createElementVNode("table",ia,[e.createElementVNode("thead",ca,[e.createElementVNode("tr",da,[e.createElementVNode("th",ua,[e.createVNode(At,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.colModel,A=>(e.openBlock(),e.createElementBlock("th",{key:A.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},e.toDisplayString(A.ua||A.label),1))),128)),V[7]||(V[7]=e.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[s.value.length===0?(e.openBlock(),e.createElementBlock("td",pa,[e.createElementVNode("div",ha,[e.createElementVNode("div",ma,[e.createVNode(Ks,{class:"w-48 mx-auto"}),V[8]||(V[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(A,O)=>(e.openBlock(),e.createElementBlock("tr",{key:A.id,class:e.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":a.value===O,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===O}]),draggable:"true",onDragstart:q=>h(O),onDragover:e.withModifiers(q=>_(O),["prevent"]),onDrop:q=>f(O)},[e.createElementVNode("td",ga,[e.createElementVNode("div",ka,[e.createVNode(At,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.colModel,q=>(e.openBlock(),e.createElementBlock("td",{key:q.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[q.type==="file"?(e.openBlock(),e.createElementBlock("div",ya,[g(G(A,q))?(e.openBlock(),e.createElementBlock("div",ba,[e.createElementVNode("img",{src:G(A,q),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,xa)])):(e.openBlock(),e.createElementBlock("div",wa,[e.createVNode(Vt,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):q.type==="tiptap-editor"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors line-clamp-3",innerHTML:G(A,q)},null,8,_a)):q.type==="reference"?(e.openBlock(),e.createElementBlock("div",Ea,e.toDisplayString(G(A,q)),1)):(e.openBlock(),e.createElementBlock("div",Va,e.toDisplayString(G(A,q)),1))]))),128)),e.createElementVNode("td",va,[e.createElementVNode("div",Ba,[e.createElementVNode("button",{onClick:q=>F(A,O),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[e.createVNode(Ys,{width:"24",height:"24",class:"w-3 h-3"})],8,Ca),e.createElementVNode("button",{onClick:q=>Z(O),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[e.createVNode(ze,{width:"24",height:"24",class:"w-3 h-3"})],8,Na)])])],42,fa))),128))],2)])]),e.createVNode(e.unref(Q.VsModal),{teleport:"#modal",visible:k.value,title:C.value,size:"lg",onClose:Y},{default:e.withCtx(()=>[e.createVNode(we,{schema:t.colModel,values:M.value,"onUpdate:values":V[1]||(V[1]=A=>M.value=A),form:L.value,"onUpdate:form":V[2]||(V[2]=A=>L.value=A)},null,8,["schema","values","form"]),e.createElementVNode("div",Sa,[e.createElementVNode("button",{type:"button",onClick:V[3]||(V[3]=A=>k.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:U,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),Ma={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}},$a={},Aa={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function Fa(r,t){return e.openBlock(),e.createElementBlock("svg",Aa,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),e.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const Da=H($a,[["render",Fa]]),Ia={},Ta={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function La(r,t){return e.openBlock(),e.createElementBlock("svg",Ta,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const Oa=H(Ia,[["render",La]]),Ra={},za={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function ja(r,t){return e.openBlock(),e.createElementBlock("svg",za,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const Ua=H(Ra,[["render",ja]]),Pa={},Ha={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function Ga(r,t){return e.openBlock(),e.createElementBlock("svg",Ha,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const Ka=H(Pa,[["render",Ga]]),qa={},Za={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function Wa(r,t){return e.openBlock(),e.createElementBlock("svg",Za,t[0]||(t[0]=[e.createElementVNode("title",null,null,-1),e.createElementVNode("desc",null,null,-1),e.createElementVNode("defs",null,null,-1),e.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[e.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[e.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[e.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const Ya=H(qa,[["render",Wa]]),Ja={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Xa={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},Qa=["onClick"],er={class:"relative flex-1 min-w-[140px]"},tr=["placeholder"],lr="https://data.softpro.ua/api-user/gis-url-proxy",nr="https://geo.rv.ua/api-user/dzk.api",or=H(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(r,{emit:t}){const l=r,n=t,o=["here","xy","parcel"],s=e.computed(()=>{const k=l.config?.tools?.filter(E=>o.includes(E));return k&&k.length?k:o}),a=e.computed(()=>l.config?.placeholder?.trim()||"Пошук…"),i=e.ref(s.value[0]??o[0]);e.watch(s,k=>{k.includes(i.value)||(i.value=k[0])});const c=e.ref(""),d=e.ref(!1),p=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function h(k){i.value=k}function _(k){if(!d.value)return;const E=p.value;E&&!E.contains(k.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",_,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",_,!0)});function f(k){return k==="xy"?"Координати":k==="parcel"?"Кадастр":"Адреси"}function B(k){const E=k.replace(/[,]+/g," ").trim();if(!E)return null;const $=E.split(/\s+/).filter(Boolean);if($.length<2)return null;const M=$.slice(0,2).map(Number);if(!M.every(Y=>Number.isFinite(Y)))return null;let[L,W]=M,G=L,F=W;const U=Y=>Math.abs(Y)<=90,Z=Y=>Math.abs(Y)<=180;if(!U(G)||!Z(F))if(U(F)&&Z(G))G=W,F=L;else return null;return{lat:G,lng:F}}function m(k){return(k?.items||[]).map(($,M)=>({id:String($?.id??M),title:$?.title||$?.address?.label||"Знайдений обʼєкт",lat:Number($?.position?.lat),lng:Number($?.position?.lng)})).filter($=>Number.isFinite($.lat)&&Number.isFinite($.lng))}function g(k){const E=k?.result||k?.data||k;if(!E)return[];const $=E.geom_centroid;if(!$||!Array.isArray($.coordinates))return[];const[M,L]=$.coordinates;return!Number.isFinite(L)||!Number.isFinite(M)?[]:[{id:"parcel",title:E.cadnum||E.cad_num||"Земельна ділянка",lat:L,lng:M}]}function b(k){const $=k.replace(/\s+/g,"").split(":");if($.length!==4)return!1;const M=[10,2,3,4];return $.every((L,W)=>L.length===M[W]&&/^\d+$/.test(L))}function x(k){n("goToCoordinates",[k.lat,k.lng])}async function C(){const k=c.value.trim();if(k){if(i.value==="xy"){const E=B(k);if(!E){Q.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}x(E),c.value="";return}try{const E=new URL(i.value==="here"?lr:nr);if(i.value==="here")E.searchParams.set("searchtext",k);else{if(!b(k)){Q.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}E.searchParams.set("cad_num",k)}const $=await fetch(E.toString());if(!$.ok)throw new Error(`HTTP ${$.status}`);const M=await $.json(),L=i.value==="here"?m(M):g(M);if(!L.length)Q.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const W=L[0];x(W),c.value=""}}catch(E){const $=E?.message||"Помилка пошуку";Q.notify({type:"error",title:"Пошук",message:$})}}}return(k,E)=>(e.openBlock(),e.createElementBlock("div",Ja,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(C,["prevent"])},[s.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:p,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:E[0]||(E[0]=$=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(f(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},E[2]||(E[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(e.openBlock(),e.createElementBlock("div",Xa,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,$=>(e.openBlock(),e.createElementBlock("li",{key:$,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:M=>h($)},e.toDisplayString(f($)),9,Qa))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",er,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":E[1]||(E[1]=$=>c.value=$),placeholder:a.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,tr),[[e.vModelText,c.value,void 0,{trim:!0}]]),E[3]||(E[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-3048520a"]]),sr={class:"bg-white/30 p-1 rounded-md shadow w-fit"},ar={class:"flex gap-2"},rr=["onClick","title"],ir=["src"],cr=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(r,{emit:t}){const l=r,n=e.ref(Object.keys(l.basemaps)[0]),o=t;function s(a){o("onLayerChange",a),n.value=a}return(a,i)=>(e.openBlock(),e.createElementBlock("div",sr,[e.createElementVNode("div",ar,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.basemaps,(c,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":n.value===d}]),onClick:p=>s(d),title:c.name||d,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:c.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,ir)],10,rr))),128))])]))}}),dr={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},ur={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},pr={class:"text-sm font-medium"},hr={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},mr={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},fr={class:"flex items-center gap-1"},gr=["disabled"],kr=["disabled"],yr=["disabled"],br={class:"absolute top-4 right-4 z-[1000]"},xr={class:"flex flex-col gap-[2px]"},wr=["disabled"],_r=["disabled"],Er=["disabled"],Vr=["disabled"],vr={class:"flex flex-col gap-2"},Br={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},Cr={class:"flex flex-col gap-1"},Nr=["checked","disabled","onChange"],Sr={class:"text-gray-700 text-xs font-medium"},Mr={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},$r={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Ar={class:"shrink-0"},Fr={class:"font-bold"},Dr={class:"flex items-center"},Ir={class:"text-xs mr-2"},Tr={key:0,class:"text-xs"},Lr={key:1,class:"text-xs"},Or=["disabled"],Rr=["disabled"],Dt=H(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},layers:{default:()=>[]},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=e.getCurrentInstance()?.appContext?.config?.globalProperties?.$settings??{},o=Array.isArray(n.center)&&n.center.length===2?n.center:[50,30],s=typeof n.zoom=="number"?n.zoom:typeof n.defaultZoom=="number"?n.defaultZoom:10,a=r,i=t,c=e.computed(()=>!!a.disabled),d=e.ref(!1),p=e.ref(null),h=e.ref(!1),_=e.ref(""),f=e.ref(null),B=e.ref(null),m=e.ref(!1),g=e.ref(null),b=e.ref(null),x=e.ref(0),C=e.ref(o),k=e.ref(s),E=e.ref(null),$=e.computed(()=>{const y={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!a.tools?.length)return y;const u=new Set(a.tools.map(S=>S.toLowerCase()));return{search:u.has("search"),import:u.has("import"),export:u.has("export"),point:u.has("point"),line:u.has("line"),polygon:u.has("polygon"),rectangle:u.has("rectangle")}}),M=e.reactive({}),L=e.ref([]),W=e.computed(()=>L.value.map(y=>M[y]).filter(Boolean));function G(y){if(typeof y!="string"||!y.trim())return"";if(/^https?:\/\//i.test(y))return y;const u=window?.location?.origin??"",S=y.replace(/^\/+/,"");return S?u?`${u}/${S}`:`/${S}`:u}function F(){if(Array.isArray(n.basemaps)&&n.basemaps.length){const u=n.basemaps.map((S,T)=>{const R=String(S?.key??S?.id??S?.name??`b${T}`),J=G(String(S?.url??""));if(!J)return null;const ne=typeof S?.preview=="string"&&S.preview?G(S.preview):"";return[R,{...S,url:J,preview:ne}]}).filter(S=>Array.isArray(S)&&S.length===2).reduce((S,[T,R])=>(S[T]=R,S),{});if(Object.keys(u).length)return u}return{voyager:{name:"Оглядова карта",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{name:"Ортофото 1:10K",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{name:"Open Street Maps",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const U=F(),Z=Object.keys(U),Y=e.ref(Z.length?Z[0]:"");let D,V,A,O;async function q(){const y=T=>{if(!Array.from(document.styleSheets).some(R=>R?.href?.includes(T))){const R=document.createElement("link");R.rel="stylesheet",R.href=T,document.head.appendChild(R)}},u=T=>new Promise((R,J)=>{if(Array.from(document.scripts).some(Ie=>Ie.src===T))return R();const pe=document.createElement("script");pe.src=T,pe.async=!0,pe.onload=()=>R(),pe.onerror=Ie=>J(Ie),document.body.appendChild(pe)});y("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),y("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css");try{await u("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js")}catch{}try{await u("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")}catch{}try{await u("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js")}catch{}return window.L}function se(){const y=navigator.platform.toUpperCase().includes("MAC");return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":y?"Використовуйте Ctrl або ⌘ + прокрутка для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}function he(){if(!a.handleZoom||!p.value||!V)return null;let y;const u=T=>{if(!(T.ctrlKey||T.metaKey||T.shiftKey)){h.value=!0,_.value=se(),clearTimeout(y),y=window.setTimeout(()=>h.value=!1,1200);return}h.value=!1,V.scrollWheelZoom.enable(),setTimeout(()=>V.scrollWheelZoom.disable(),120)},S=T=>{T.touches.length===1?(h.value=!0,_.value=se(),clearTimeout(y),y=window.setTimeout(()=>h.value=!1,3e3)):h.value=!1};return p.value.addEventListener("wheel",u,{passive:!1}),p.value.addEventListener("touchstart",S,{passive:!0}),V.on("wheel",T=>{T.originalEvent?.ctrlKey||T.originalEvent?.metaKey||T.originalEvent?.shiftKey||(T.originalEvent?.preventDefault?.(),T.originalEvent?.stopPropagation?.())}),()=>{p.value?.removeEventListener("wheel",u),p.value?.removeEventListener("touchstart",S),clearTimeout(y)}}function Ke(y,u){return y?.id?String(y.id):y?.url?`${y.url}-${u}`:`layer-${u}`}function pt(y){const u=(y?.url??"").trim();if(!u)return"";if(/^https?:\/\//i.test(u))return u;const S=window.location?.origin??"",T=u.replace(/^\/+/,"");return`${S}/${T}`}function ve(y){const u=y?.style??{};return S=>{const T=u.colorAttr,R=u.colorSet??{},J=typeof T=="string"?R?.[S?.[T]]??u.color??"#3388ff":u.color??"#3388ff",ne=u.stroke??J;return{weight:u.width??1,color:ne,opacity:u.opacity??1,fill:u.type?u.type!=="polyline":!0,fillColor:J,fillOpacity:u.opacity??.5}}}function me(y){const u=(y?.service??"").toLowerCase(),S=pt(y),T=y.sourceLayer||y.layer||y.service_layer||y.service_key||y.map_key||y.dataset?.layer||y.id||y.table_name;if(u==="vtile"){const R=E.value;if(R?.vectorGrid?.protobuf&&!R?.maplibreGL)return R.vectorGrid.protobuf(S,{interactive:!0,maxNativeZoom:y.maxzoom??19,vectorTileLayerStyles:{[T??"default"]:ve(y),default:ve(y)}});if(R?.maplibreGL&&window?.maplibregl){const J=S;return J?R.maplibreGL({style:J,interactive:!1,pane:"overlayPane"}):null}return null}return u==="tile"||/^https?:\/\//i.test(S)||S.includes("{z}")?E.value.tileLayer(S,{opacity:y?.style?.opacity??1}):E.value.tileLayer(S,{opacity:y?.style?.opacity??1})}function qe(){!V||!E.value||L.value.forEach(y=>{const u=M[y];u&&(u.visible?(u.layer||(u.layer=me(u.config)),u.layer&&!V.hasLayer(u.layer)&&u.layer.addTo(V)):u.layer&&V.hasLayer(u.layer)&&V.removeLayer(u.layer))})}function ht(y){if(c.value)return;const u=M[y];u&&(u.visible=!u.visible,u.visible?(u.layer||(u.layer=me(u.config)),u.layer&&!V.hasLayer(u.layer)&&u.layer.addTo(V)):u.layer&&V.hasLayer(u.layer)&&V.removeLayer(u.layer))}e.watch(()=>a.layers,y=>{const u=Array.isArray(y)?y:[],S=[],T=new Set;u.forEach((R,J)=>{if(!R)return;const ne=Ke(R,J);S.push(ne),T.add(ne);const pe=M[ne];pe?M[ne]={...pe,config:{...R,id:ne}}:M[ne]={id:ne,config:{...R,id:ne},visible:R?.overlay!==!1,layer:null}}),Object.keys(M).forEach(R=>{if(!T.has(R)){const J=M[R];J?.layer&&V?.hasLayer(J.layer)&&V.removeLayer(J.layer),delete M[R]}}),L.value=S,qe()},{immediate:!0,deep:!0});function mt(y){const u=E.value;return y instanceof u.Circle?"Circle":y instanceof u.Rectangle?"Rectangle":y instanceof u.Polygon&&!(y instanceof u.Rectangle)?"Polygon":y instanceof u.Polyline&&!(y instanceof u.Polygon)?"Polyline":y instanceof u.Marker?"Point":"Feature"}function ft(y){const u=E.value;if(y instanceof u.Circle){const S=y.getRadius();return Math.PI*(S*S)/1e6}if(y instanceof u.Polygon||y instanceof u.Rectangle)try{const S=y.getLatLngs(),T=Array.isArray(S[0])?S[0]:S,R=u.GeometryUtil?.geodesicArea?u.GeometryUtil.geodesicArea(T):0;return R?R/1e6:0}catch{return null}return null}function Ae(y){return y instanceof E.value.Circle?y.getLatLng():y.getBounds?y.getBounds().getCenter():y.getLatLng?y.getLatLng():V.getCenter()}function Be(){const y=A.toGeoJSON(),u=[];let S=null;const T=J=>{if(J)switch(J.type){case"Point":S=J;break;case"Polygon":u.push(J.coordinates);break;case"MultiPolygon":u.push(...J.coordinates);break;case"GeometryCollection":(J.geometries||[]).forEach(T);break}};(y?.features||[]).forEach(J=>T(J.geometry));const R=S||(u.length?{type:"MultiPolygon",coordinates:u}:null);i("update:modelValue",R),x.value=A.getLayers().length}function fe(){const y=A.getLayers();if(!y.length){B.value=null,x.value=0;return}const u=y[y.length-1],S=mt(u),T=Ae(u),R=ft(u);B.value={type:S,center:T,areaKm2:R,layer:u},x.value=y.length}const ge=e.ref("");function ke(y){if(c.value||!V||!E.value)return;O?.disable&&O.disable();const u=E.value;switch(y){case"marker":O=new u.Draw.Marker(V);break;case"polyline":O=new u.Draw.Polyline(V);break;case"polygon":O=new u.Draw.Polygon(V);break;case"rectangle":O=new u.Draw.Rectangle(V);break}O.enable(),ge.value=y}function gt(){if(c.value)return;const y=B.value?.layer;y&&(y.getBounds?V.fitBounds(y.getBounds(),{padding:[30,30]}):y.getLatLng&&V.setView(y.getLatLng(),Math.max(k.value,14)))}function Ze(){c.value||A&&(A.clearLayers(),i("update:modelValue",null),B.value=null,x.value=0)}const Fe=e.ref(null);function We(){c.value||Fe.value?.click()}function Ye(y){if(c.value)return;const u=y.target,S=u.files?.[0];if(!S)return;const T=new FileReader;T.onload=()=>{try{const R=JSON.parse(String(T.result));A.clearLayers(),R&&E.value.geoJSON(R).eachLayer(J=>A.addLayer(J)),Be(),fe()}finally{u.value=""}},T.readAsText(S)}function Je(){if(c.value)return;const y=A.toGeoJSON(),u=new Blob([JSON.stringify(y,null,2)],{type:"application/json"}),S=URL.createObjectURL(u),T=document.createElement("a");T.href=S,T.download="data.geojson",T.click(),URL.revokeObjectURL(S)}function Xe(y){!V||!E.value||!U[y]||(D&&V.removeLayer(D),D=E.value.tileLayer(U[y].url,{maxZoom:19,minZoom:6}).addTo(V),Y.value=y)}function Qe(y){if(!V||!E.value)return;const u=E.value.latLng(y[0],y[1]);V.setView(u,13)}let De=null;return e.onMounted(async()=>{E.value=await q();const y=E.value;y.drawLocal=Ma,V=y.map(p.value,{zoomControl:!1,scrollWheelZoom:!1}).setView(C.value,k.value),y.control.zoom({position:"bottomright"}).addTo(V);const u=Y.value||Object.keys(U)[0];u&&U[u]&&(Y.value=u,D=y.tileLayer(U[u].url,{maxZoom:19,minZoom:6}).addTo(V)),A=new y.FeatureGroup().addTo(V),V.on(y.Draw.Event.CREATED,T=>{if(c.value)return;const{layer:R}=T;A.clearLayers(),A.addLayer(R),Be(),fe(),ge.value=""}),V.on(y.Draw.Event.EDITED,()=>{c.value||(Be(),fe())}),V.on(y.Draw.Event.DELETED,()=>{c.value||(Be(),fe())});let S=!1;V.on("mousemove",T=>{S||(V.invalidateSize(),S=!0)}),V.on("zoomend",()=>{k.value=V.getZoom()}),De=he(),qe()}),e.onUnmounted(()=>{De?.(),V?.remove&&V.remove()}),e.watch(d,()=>{setTimeout(()=>{V?.invalidateSize&&V.invalidateSize()},50)}),e.watch(m,async y=>{if(!y||!b.value){g.value=null;return}await e.nextTick();const u=b.value.getBoundingClientRect();g.value={top:u.bottom+6,left:u.left}}),(y,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:d.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:p,class:"w-full h-full"},null,512),e.createVNode(e.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:e.withCtx(()=>[h.value&&a.handleZoom?(e.openBlock(),e.createElementBlock("div",dr,[e.createElementVNode("div",ur,[e.createElementVNode("p",pr,e.toDisplayString(_.value),1)])])):e.createCommentVNode("",!0)]),_:1}),$.value.search||$.value.import||$.value.export?(e.openBlock(),e.createElementBlock("div",hr,[$.value.search?(e.openBlock(),e.createBlock(or,{key:0,onGoToCoordinates:Qe})):e.createCommentVNode("",!0),$.value.import||$.value.export?(e.openBlock(),e.createElementBlock("div",mr,[e.createElementVNode("div",fr,[$.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:We,disabled:c.value}," Import ",8,gr)):e.createCommentVNode("",!0),$.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Je,disabled:c.value||x.value===0}," Export ",8,kr)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:Fe,type:"file",onChange:Ye,accept:".json,.geojson",class:"hidden",disabled:c.value},null,40,yr)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",br,[e.createElementVNode("div",xr,[$.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":ge.value==="marker"}]),title:"Point",onClick:u[0]||(u[0]=S=>ke("marker")),disabled:c.value},[e.createVNode(Da)],10,wr)):e.createCommentVNode("",!0),$.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":ge.value==="polyline"}]),title:"Line",onClick:u[1]||(u[1]=S=>ke("polyline")),disabled:c.value},[e.createVNode(Oa)],10,_r)):e.createCommentVNode("",!0),$.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":ge.value==="polygon"}]),title:"Polygon",onClick:u[2]||(u[2]=S=>ke("polygon")),disabled:c.value},[e.createVNode(Ua)],10,Er)):e.createCommentVNode("",!0),$.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":ge.value==="rectangle"}]),title:"Rectangle",onClick:u[3]||(u[3]=S=>ke("rectangle")),disabled:c.value},[e.createVNode(Ka)],10,Vr)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:u[4]||(u[4]=S=>d.value=!d.value),title:"Full Screen"},[e.createVNode(Ya,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",B.value?"bottom-8":"bottom-4"])},[e.createElementVNode("div",vr,[e.createVNode(cr,{basemaps:e.unref(U),onOnLayerChange:Xe},null,8,["basemaps"]),W.value.length?(e.openBlock(),e.createElementBlock("div",Br,[u[9]||(u[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Layers",-1)),e.createElementVNode("div",Cr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,S=>(e.openBlock(),e.createElementBlock("label",{key:S.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:S.visible,disabled:c.value,onChange:T=>ht(S.id)},null,40,Nr),e.createElementVNode("span",Sr,e.toDisplayString(S.config.title||S.config.name||S.id),1)]))),128))])])):e.createCommentVNode("",!0)])],2),e.createElementVNode("div",Mr,[B.value?(e.openBlock(),e.createElementBlock("div",$r,[e.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:u[5]||(u[5]=S=>m.value=!0),onMouseleave:u[6]||(u[6]=S=>m.value=!1)},[e.createElementVNode("div",Ar,[u[10]||(u[10]=e.createTextVNode(" Type: ")),e.createElementVNode("span",Fr,e.toDisplayString(B.value.type),1)]),f.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"addressEl",ref:b,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+e.toDisplayString(f.value),513)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[m.value&&f.value&&g.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:e.normalizeStyle({top:g.value.top+"px",left:g.value.left+"px"})},e.toDisplayString(f.value),5)):e.createCommentVNode("",!0)]))],32),e.createElementVNode("div",Dr,[e.createElementVNode("div",Ir,[u[11]||(u[11]=e.createTextVNode(" Center: ")),e.createElementVNode("b",null,e.toDisplayString(B.value.center.lat.toFixed(5))+", "+e.toDisplayString(B.value.center.lng.toFixed(5)),1)]),B.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",Tr,[u[12]||(u[12]=e.createTextVNode(" Area: ")),e.createElementVNode("b",null,e.toDisplayString(B.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",Lr,u[13]||(u[13]=[e.createTextVNode("Area: "),e.createElementVNode("b",null,"—",-1)]))),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:u[7]||(u[7]=S=>gt()),disabled:c.value},u[14]||(u[14]=[e.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-3 h-3" data-v-878b95a9><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-878b95a9></path><path d="M7 10l6 0" data-v-878b95a9></path><path d="M10 7l0 6" data-v-878b95a9></path><path d="M21 21l-6 -6" data-v-878b95a9></path></svg>',1)]),8,Or),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:u[8]||(u[8]=S=>Ze()),disabled:c.value},[e.createVNode(ze,{class:"w-3 h-3"})],8,Rr)])])):e.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-878b95a9"]]),zr=["data-focus"],jr={class:"flex items-center"},Ur={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Pr=["onClick","aria-label"],Hr={key:0,class:"absolute text-gray-500 truncate pl-2"},Gr={class:"flex-1 min-w-[2px]"},Kr=["placeholder"],qr={class:"flex items-center shrink-0"},Zr=["disabled"],It=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(r,{emit:t}){const l=r,n=t;ae(l.style);const o=e.ref(null),s=e.ref(null),a=e.ref(null),i=e.ref(!1),c=e.ref(""),d=e.useModel(r,"modelValue"),p=e.computed(()=>l.placeholder||"Add tag…"),h=e.computed(()=>d.value?.length===0&&c.value===""),_=e.computed(()=>!l.disabled&&d.value?.length>0),f=e.computed(()=>l.disabled),B=async()=>{f.value||await e.nextTick(()=>a.value?.focus())},m=$=>{const M=$.trim();M!==""&&(!d.value||!Array.isArray(d.value)?d.value=[M]:l.unique?d.value.includes(M)||(d.value=[...d.value,M]):d.value=[...d.value,M],c.value="")},g=()=>{const $=c.value;$.trim()!==""&&m($),c.value=""},b=$=>{const M=d.value.slice();M.splice($,1),n("update:modelValue",M)},x=()=>{n("update:modelValue",[])},C=()=>{f.value||(i.value=!0)},k=()=>{i.value=!1,!f.value&&g()},E=$=>{const{key:M}=$;M==="Enter"?($.preventDefault(),g()):M==="Backspace"&&c.value===""&&d.value.length>0&&b(d.value.length-1)};return($,M)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:M[1]||(M[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",l.customClass]),role:"group","aria-label":"Tag input"},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",f.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:B},[e.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:s},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(L,W)=>(e.openBlock(),e.createElementBlock("div",{key:W,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",jr,[e.createElementVNode("div",Ur,e.toDisplayString(L),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(G=>b(W),["stop"]),"aria-label":`Remove ${L}`},M[2]||(M[2]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Pr)]))),128)),h.value?(e.openBlock(),e.createElementBlock("div",Hr,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Gr,[f.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:a,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":M[0]||(M[0]=L=>c.value=L),onFocus:C,onBlur:k,onKeydown:E,placeholder:d.value&&d.value.length?"":void 0},null,40,Kr)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",qr,[_.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:f.value,onClick:e.withModifiers(x,["stop"])},M[3]||(M[3]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Zr)):e.createCommentVNode("",!0)])],10,zr)],2)],512))}}),Wr={class:"relative flex gap-1 bg-white w-full"},Yr=["disabled","placeholder"],Tt=H(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=e.inject("values"),l=r,n=e.useModel(r,"modelValue");function o(a){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return a.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const s=()=>{const a=t?.value?.[l.parent||""]?.toString(),i=o(a);n.value=i.toString()};return(a,i)=>(e.openBlock(),e.createElementBlock("div",Wr,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:a.disabled,placeholder:a.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,Yr),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:s}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),Jr={class:"relative flex gap-1 bg-white w-full"},Xr=["disabled","placeholder"],Qr=["disabled"],ei={key:0},ti={key:1},Lt=H(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.ref(!1),o=e.computed(()=>t.init!==!1),s=e.computed(()=>!!t.table&&!!t.code),a=()=>{if(!s.value)return"";const d=encodeURIComponent(String(t.table)),p=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${p}`},i=async()=>{if(!s.value||n.value)return;const d=a();if(d){n.value=!0;try{const h=await(await fetch(d)).text();l.value=h}finally{n.value=!1}}},c=()=>{o.value&&(l.value||i())};return e.onMounted(()=>{c()}),e.watch(()=>[t.table,t.code,t.init],()=>{c()}),(d,p)=>(e.openBlock(),e.createElementBlock("div",Jr,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":p[0]||(p[0]=h=>l.value=h),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,Xr),[[e.vModelText,l.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:n.value||d.disabled||!s.value,onClick:i},[n.value?(e.openBlock(),e.createElementBlock("span",ti,"...")):(e.openBlock(),e.createElementBlock("span",ei,"Gen"))],8,Qr)]))}}),[["__scopeId","data-v-6ee5237d"]]),li={class:"w-full"},ni={ref:"sortableContainer",class:"flex flex-col gap-1"},oi=["onDragstart","onDrop"],si={class:"w-1/3"},ai={class:"w-2/3"},ri=["onClick"],ii={key:0,class:"text-[14px] text-gray-700"},ci={class:"mt-2 w-full flex items-center"},di=["disabled"],Ot=H(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:t}){const l=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,n=e.inject("values"),o=r,s=t,a=o.addButtonText??"Додати",i=o.ignore??[],c=e.ref([]),d=e.ref(null);(()=>{const g=o.parent&&n?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(g).filter(([b])=>!i.includes(b)).map(([b,x])=>({id:l("key-value-"),key:b,value:x}))})();function h(g){d.value=g}function _(g){if(d.value===null||d.value===g)return;const b=c.value.splice(d.value,1)[0];c.value.splice(g,0,b),d.value=null}const f=e.computed(()=>c.value.some(g=>g.key&&!g.value||!g.key&&g.value)),B=()=>{c.value.push({id:l("key-value-"),key:"",value:""})},m=g=>{c.value=c.value.filter(b=>b.id!==g)};return e.watch(c,g=>{const b={};g.forEach(C=>{C.key&&C.value!==void 0&&(b[C.key]=C.value)});const x={};i.length&&i.forEach(C=>{x[C]=o.parent?n?.value?.[o.parent]?.[C]:void 0}),n?.value&&o.parent&&(n.value[o.parent]={...x,...b}),s("update:modelValue",b)},{deep:!0}),(g,b)=>(e.openBlock(),e.createElementBlock("div",li,[e.createElementVNode("div",ni,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(x,C)=>(e.openBlock(),e.createElementBlock("div",{key:x.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===C}]),draggable:"true",onDragstart:k=>h(C),onDragover:b[0]||(b[0]=e.withModifiers(()=>{},["prevent"])),onDrop:k=>_(C)},[b[1]||(b[1]=e.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),e.createElementVNode("div",si,[e.createVNode(Ee,{modelValue:x.key,"onUpdate:modelValue":k=>x.key=k,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",ai,[e.createVNode(Ee,{modelValue:x.value,"onUpdate:modelValue":k=>x.value=k,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:k=>m(x.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(tt),{height:"16",width:"16"})],8,ri)],42,oi))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",ii," Дані для відображення відсутні ")),e.createElementVNode("div",ci,[e.createElementVNode("button",{type:"button",onClick:B,disabled:f.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(xe,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)),1)],8,di)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),ui={class:"w-full"},pi={ref:"sortableContainer",class:"flex flex-col gap-1"},hi=["onDragstart","onDrop"],mi=["disabled"],fi={class:"flex-1"},gi=["onClick","disabled"],ki={key:0,class:"text-[14px] text-gray-700"},yi={class:"mt-2 w-full flex items-center"},bi=["disabled"],at=H(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},placeholder:{default:"Значення"},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.ref([]),o=e.ref(null),s=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let c=!1;const d=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,p=g=>{const b=g??l.value??[];n.value=b.map((x,C)=>({id:n.value[C]?.id??d("text-array"),value:x??""}))};p(),e.watch(()=>l.value,g=>{if(c){c=!1;return}p(g||[])},{deep:!0}),e.watch(n,g=>{c=!0,l.value=g.map(b=>b.value).filter(b=>b!=null&&b!=="")},{deep:!0});const h=e.computed(()=>s.value||n.value.some(g=>!g.value));function _(){h.value||(n.value=[...n.value,{id:d("text-array"),value:""}])}function f(g){s.value||(n.value=n.value.filter(b=>b.id!==g))}function B(g){s.value||(o.value=g)}function m(g){if(s.value||o.value===null||o.value===g)return;const b=[...n.value],[x]=b.splice(o.value,1);b.splice(g,0,x),n.value=b,o.value=null}return(g,b)=>(e.openBlock(),e.createElementBlock("div",ui,[e.createElementVNode("div",pi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(x,C)=>(e.openBlock(),e.createElementBlock("div",{key:x.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===C}]),draggable:"true",onDragstart:k=>B(C),onDragover:b[0]||(b[0]=e.withModifiers(()=>{},["prevent"])),onDrop:k=>m(C)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:s.value},b[1]||(b[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-efa2057b><circle cx="15" cy="12" r="1.5" data-v-efa2057b></circle><circle cx="15" cy="24" r="1.5" data-v-efa2057b></circle><circle cx="21" cy="12" r="1.5" data-v-efa2057b></circle><circle cx="21" cy="24" r="1.5" data-v-efa2057b></circle><circle cx="21" cy="18" r="1.5" data-v-efa2057b></circle><circle cx="15" cy="18" r="1.5" data-v-efa2057b></circle></svg>',1)]),8,mi),e.createElementVNode("div",fi,[e.createVNode(Ee,{modelValue:x.value,"onUpdate:modelValue":k=>x.value=k,disabled:s.value,placeholder:a.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])]),e.createElementVNode("button",{type:"button",onClick:k=>f(x.id),disabled:s.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(tt),{height:"16",width:"16"})],8,gi)],42,hi))),128))],512),n.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",ki," Дані для відображення відсутні ")),e.createElementVNode("div",yi,[e.createElementVNode("button",{type:"button",onClick:_,disabled:h.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(xe,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,bi)])]))}}),[["__scopeId","data-v-efa2057b"]]),xi={class:"flex items-center gap-2 w-full"},wi=["disabled"],_i=["disabled"],Rt=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r,{inputClass:n}=ae(l.style),o=t,s=e.computed({get:()=>l.modelValue||"#000000",set:i=>o("update:modelValue",i)}),a=e.computed(()=>!!l.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",xi,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),disabled:a.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[i.modelValue?"":"text-opacity-50",e.unref(n)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,wi),[[e.vModelText,s.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:a.value},null,8,_i),[[e.vModelText,s.value]])]))}}),Ei={class:"flex items-center gap-2 w-full"},Vi=["min","max","step","disabled"],vi=["disabled"],zt=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(r,{emit:t}){const l=r,{inputClass:n}=ae(l.style),o=t,s=e.computed({get:()=>Number(l.modelValue??l.min),set:i=>o("update:modelValue",Number(i))}),a=e.computed(()=>!!l.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Ei,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),min:i.min,max:i.max,step:i.step,disabled:a.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(n)].join(" ")])},null,10,Vi),[[e.vModelText,s.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:a.value},null,8,vi),[[e.vModelText,s.value]])]))}}),Bi={class:"flex items-center gap-2 w-full"},Ci={class:"relative flex-1"},Ni=["placeholder","disabled","onKeydown"],Si=["disabled"],Mi={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},$i={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},Ai={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},Fi={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},Di={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Ii=["onClick"],Ti={key:0,class:"p-4 text-sm text-gray-500"},jt=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(r,{emit:t}){const l=r,n=t,{inputClass:o}=ae(l.style),s=e.useModel(r,"modelValue"),a=e.computed({get:()=>s.value,set:b=>{s.value=b}}),i=e.ref(!1),c=e.ref([]),d=e.ref(!1),p=e.computed(()=>l.placeholder??""),h=e.computed(()=>!!l.disabled),_=e.inject("values");function f(){!h.value&&a.value.trim()&&B()}async function B(){const b=(a.value||"").trim();if(!b)return;let x=b;if(l.includes?.length&&_?.value){const k=l.includes.map(E=>_.value?.[E]).filter(Boolean);k.length&&(x=`${k.join(", ")}, ${b}`)}const C=l.api.replace("{{value}}",encodeURIComponent(x));i.value=!0;try{const E=await(await fetch(C)).json();c.value=Array.isArray(E)?E:[],d.value=!0}catch(k){console.error("Address search error:",k)}finally{i.value=!1}}function m(){d.value=!d.value}function g(b){if(!b)return;d.value=!1;const x=parseFloat(b.lat),k={type:"Point",coordinates:[parseFloat(b.lon),x]};l.geom&&_?.value&&(_.value[l.geom]=k),n("update:geom",k)}return(b,x)=>(e.openBlock(),e.createElementBlock("div",Bi,[e.createElementVNode("div",Ci,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":x[0]||(x[0]=C=>a.value=C),placeholder:p.value,disabled:h.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(o),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(f,["prevent"]),["enter"])},null,42,Ni),[[e.vModelText,a.value]]),c.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:m,title:"Show search results"},x[2]||(x[2]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",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("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:B,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:i.value||!a.value?.trim()},[i.value?(e.openBlock(),e.createElementBlock("svg",$i,x[4]||(x[4]=[e.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(e.openBlock(),e.createElementBlock("svg",Mi,x[3]||(x[3]=[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),e.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,Si),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",Ai,[e.createElementVNode("div",Fi,[e.createElementVNode("div",Di,[x[6]||(x[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:x[1]||(x[1]=C=>d.value=!1),title:"Close"},x[5]||(x[5]=[e.createElementVNode("svg",{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"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(C,k)=>(e.openBlock(),e.createElementBlock("li",{key:k,onClick:E=>g(C),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(C.display_name),9,Ii))),128))]),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ti," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),Ut={VsInputText:Ee,VsInputRadio:ot,"vs-input-text":Ee,"vs-input-password":Sl,"vs-input-textarea":$t,"vs-input-mask":yt,"vs-input-number":kt,"vs-input-radio":ot,"vs-input-select":st,"vs-input-switcher":lt,"vs-input-static":nt,"vs-input-container":Mt,"vs-input-date":wt,"vs-input-checkbox":xt,"vs-input-file":Ct,"vs-input-html":nt,"vs-input-email":bt,"vs-input-datatable":Ft,"vs-input-map":Dt,"vs-input-file-list":Nt,"vs-input-tags":It,"vs-input-slug":Tt,"vs-input-codegen":Lt,"vs-input-key-value":Ot,"vs-input-text[]":at,"vs-input-range":zt,"vs-input-color":Rt,"vs-input-native-select":st,"vs-input-array":at,"vs-input-address":jt},Li=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(r){const t=r,l=e.inject("values");async function n(){try{if(!t.api)return;const o=t.api.replace("{{value}}",t.value),s=await fetch(o);if(!s.ok){Q.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const a=await s.json();if(!t.set||!l)return;for(const[i,c]of Object.entries(t.set))l.value[i]=a.result[c]}catch(o){console.error(t.error,o)}}return(o,s)=>(e.openBlock(),e.createElementBlock("button",{onClick:n,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},e.toDisplayString(o.button),1))}}),Oi={class:"flex flex-col gap-1 w-full"},Ri={key:0,class:"text-sm text-gray-500"},Pt=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.useModel(r,"modelValue"),n=e.computed(()=>Cl[`${t.layout}`]),o=e.computed(()=>Ut?.[`vs-input-${t.item.type}`]),s=e.computed(()=>{const i=e.unref(o);if(!i)return new Set;const c=i.props??i.__vccOpts?.props;if(!c)return new Set;const d=Array.isArray(c)?c:Object.keys(c);return new Set(d)}),a=e.computed(()=>{const i=t.item??{},c=s.value;return c.size?Object.fromEntries(Object.entries(i).filter(([d])=>c.has(d))):{}});return(i,c)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value),{ua:t.item.ua,error:t.error||"",item:i.item,columns:t.columns,label:t.item.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${t.item.type}-component`])},[e.createElementVNode("div",Oi,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),e.mergeProps(a.value,{modelValue:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d)}),null,16,["modelValue"])),i.item.description&&t.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",Ri,e.toDisplayString(i.item.description),1)):e.createCommentVNode("",!0)]),i.item.behavior?.api&&i.item.behavior?.button?(e.openBlock(),e.createBlock(Li,e.mergeProps({key:0},i.item.behavior,{value:l.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),zi={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},ji={class:"vs-compact-form-navigation__rail mt-[6px]"},Ui=["onClick"],Pi=H(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(r,{expose:t}){const l=r,n=e.ref([]),o=e.ref(""),s=e.ref(""),a=e.computed(()=>!!l.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=e.computed(()=>{const F=l.width;if(F==null)return{};const U=typeof F=="number"?`${F}px`:`${F}`;return{width:U,minWidth:U}});let d=null,p=0,h=0,_=null,f=null,B=null;const m=()=>W(),g=()=>x();e.watch(()=>l.target,async F=>{if($(),!F){_=null,n.value=[],o.value="";return}_=F,a.value&&(await e.nextTick(),E(F),x())},{immediate:!0}),e.watch(()=>l.scrollContainer,F=>{if(!a.value){f=F??null;return}b(F??null),e.nextTick(()=>x())},{immediate:!0}),e.onMounted(()=>{l.scrollContainer||b(null),x()}),e.onBeforeUnmount(()=>{$(),b(null,!0),_=null,typeof window<"u"&&(p&&window.cancelAnimationFrame(p),h&&window.cancelAnimationFrame(h))});function b(F,U=!1){if(B&&(B(),B=null),U){f=null;return}if(f=F??null,typeof window>"u")return;const Z=F??window,Y=window;Z.addEventListener("scroll",m,{passive:!0}),Y.addEventListener("resize",g),B=()=>{Z.removeEventListener("scroll",m),Y.removeEventListener("resize",g)}}function x(){if(!a.value||!_)return;p&&typeof window<"u"&&window.cancelAnimationFrame(p);const F=()=>{C(),p=0};typeof window>"u"?F():p=window.requestAnimationFrame(F)}function C(){if(!a.value||!_)return;const F=Array.from(_.querySelectorAll("h1, h2")),U=new Set,Z=[];F.forEach((Y,D)=>{const V=Y.textContent?.trim()??"";if(!V)return;let A=(Y.getAttribute("id")??"").trim();A||(A=k(V)||`heading-${D+1}`);let O=A,q=1;for(;U.has(O);)O=`${A}-${q+=1}`;Y.id!==O&&Object.assign(Y,{id:O}),U.add(O),Z.push({id:O,text:V,level:Y.tagName.toLowerCase()==="h1"?1:2})}),n.value=Z,Z.length||(o.value=""),L()}function k(F){return F.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function E(F){!F||!a.value||typeof MutationObserver>"u"||($(),d=new MutationObserver(()=>x()),d.observe(F,{childList:!0,subtree:!0}))}function $(){d&&(d.disconnect(),d=null)}function M(F){const U=f;if(!U)return typeof window>"u"?F.offsetTop:F.getBoundingClientRect().top+window.scrollY;const Z=F.getBoundingClientRect(),Y=U.getBoundingClientRect();return Z.top-Y.top+U.scrollTop}function L(){if(!a.value||!n.value.length)return;const F=f,U=(F?F.scrollTop:null)||(typeof window<"u"?window.scrollY:0),Z=(F?F.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Y=U+Z;let D=null;for(let A=0;A<n.value.length;A+=1){const O=n.value[A],q=document.getElementById(O.id);if(q){const se=M(q);se+q.offsetHeight>U&&se<Y&&(D=O.id)}}!D&&s.value&&(D=s.value),D&&(s.value=D);const V=F?F.scrollHeight-F.clientHeight:document.documentElement.scrollHeight-window.innerHeight;U+5>=V&&(D=n.value[n.value.length-1].id),D&&(o.value=D)}function W(){a.value&&(h&&window.cancelAnimationFrame(h),h=window.requestAnimationFrame(()=>{L(),h=0}))}function G(F){if(!a.value)return;const U=document.getElementById(F);if(!U)return;const Z=f,Y=Math.max(0,M(U));Z?Z.scrollTo({top:Y,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Y,behavior:"smooth"})}return t({refresh:x}),(F,U)=>a.value&&n.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",zi,e.toDisplayString(F.title),1),e.createElementVNode("div",ji,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,Z=>(e.openBlock(),e.createElementBlock("div",{key:Z.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",Z.level===2?"vs-compact-form-navigation__item--nested":"",Z.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:Y=>G(Z.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",Z.level===2?"pl-[15px]":"pl-[18px]",Z.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(Z.text),1)],10,Ui)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),Ht={required:"Це поле є обов’язковим",email:"Неправильний email"},Hi=r=>r?!1:Ht.required,Gi=r=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return r?t.test(r)?!1:Ht.email:!1},Ki=(r,t)=>{const l=t.pattern??t.regexp,n=typeof l=="string"?new RegExp(l):l;if(Array.isArray(r)){const o=r.filter(Boolean);return o.length===0||o.every(s=>n.test(s))?!1:t.message}return!n.test(r)&&r?t.message:!1},qi=(r,t)=>!1,Zi=(r,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Hi(r);case"email":return Gi(r);case"regexp":return Ki(r,t);case"custom":return qi();default:return!1}},Wi={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function Gt(r){const t=r.toLowerCase();return Wi[t]||t}function rt(r,t=!1){if(Array.isArray(r)){const n=[];return r.forEach(o=>{const s={...o};s.name=(o.name||o.id||o.key||"").toString(),s.type=Gt(o.type),s.label=o.label||o.ua,s.rules=o.rules||o.validators,s.type==="email"&&!s.rules&&(s.rules=["email"]),o.data&&(s.api=`/api/suggest/${o.data}`),s.disabled=t||s.disabled,Array.isArray(s.schema)&&(s.schema=rt(s.schema,s.disabled)),n.push(s)}),n}const l=[];return Object.entries(r).forEach(n=>{const o={name:n[0],...n[1],type:Gt(n[1].type),label:n[1].label||n[1].ua,rules:n[1].rules||n[1].validators,disabled:t};o.type==="email"&&!o.rules&&(o.rules=["email"]),n[1].type.includes("list")&&(o.multiple=!0),!o.api&&n[1].data&&(o.api=`/api/suggest/${n[1].data}`),Array.isArray(o.schema)&&(o.schema=rt(o.schema,o.disabled)),l.push(o)}),l}function Yi(r,t,l=!1){const n=e.computed(()=>rt((Array.isArray(t),t),typeof l=="boolean"?l:l.value)),o=e.ref({});function s(d){const p=d?.conditions;if(!p)return!0;const h=Array.isArray(p)?p[0]:p,_=r?.value?.[h];return St(_,p)}const a=(d=n.value,p=!0)=>(d.forEach(h=>{if(h.rules){if(!s(h)){delete o.value[h.name];return}let _=!1,f=null;h.rules.forEach(B=>{const m=Zi(r.value[h.name],B);m&&(_=!0,!f&&typeof m=="string"&&(f=m))}),_&&f?o.value[h.name]=f:delete o.value[h.name]}h.schema&&a(h.schema,!1)}),p&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>n.value?.filter(d=>d.hidden!==!0&&s(d)));return{errors:o,validate:a,reset:()=>{r.value={},o.value={}},visibleSchema:i}}const Ji={class:"flex w-full h-full min-h-0 gap-6"},Xi={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},we=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(r,{expose:t,emit:l}){const n=l,o=r,s=e.useModel(r,"form"),a=e.useModel(r,"values"),{errors:i,validate:c,reset:d,visibleSchema:p}=Yi(a,o.schema,e.toRef(o,"disabled")),h=e.ref(null),_=e.ref(null),f=e.computed(()=>o.navigation),B=e.computed(()=>o.navWidth),m=e.computed(()=>o.style?.columns),g=Object.freeze({container:12,label:3}),b=e.computed(()=>o.columns??m.value??g),x=e.computed(()=>o.columns!=null||m.value!=null),C=e.computed(()=>x.value?"horizontal":o.layout),k=L=>L?.columns?"horizontal":C.value,E=L=>L?.columns??b.value,$=()=>{n("update:modelValue",a.value),c(),n("handle-submit",a.value)};t({validate:c,reset:d,errors:i}),e.onMounted(()=>{o.modelValue&&(a.value=o.modelValue),s.value={value:a.value,errors:i.value,reset:d,validate:c,formId:o.formId}});function M(L,W){if(L===W)return!0;if(typeof L!="object"||typeof W!="object"||!L||!W)return!1;const G=Object.keys(L),F=Object.keys(W);return G.length!==F.length?!1:G.every(U=>L[U]===W[U])}return e.provide("form",s),e.provide("values",a),(L,W)=>(e.openBlock(),e.createElementBlock("div",Ji,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:_},[e.createElementVNode("form",{ref_key:"formRef",ref:h,onSubmit:e.withModifiers($,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",C.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),(G,F)=>(e.openBlock(),e.createElementBlock("div",{key:G.name,class:e.normalizeClass(k(G)==="horizontal"?"col-span-12":`col-span-${G.col||12}`)},[e.createVNode(Pt,{style:e.normalizeStyle(L.style),item:G,layout:k(G),columns:E(G),"model-value":a.value[G.name],"onUpdate:modelValue":U=>{const Z=a.value[G.name];M(Z,U)||(a.value[G.name]=U)},error:e.unref(i)[G.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),k(G)==="settings"&&F+1!==e.unref(p).length?(e.openBlock(),e.createElementBlock("div",Xi)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Pi,{target:h.value,"scroll-container":_.value,enabled:f.value,width:B.value},null,8,["target","scroll-container","enabled","width"])]))}}),Qi={class:"relative"},ec={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},tc={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},lc={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},nc={class:"font-medium text-gray-800 dark:text-[#ffffff]"},oc={class:"p-4 mim-h-0 h-full overflow-auto"},Kt=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(r,{emit:t}){const l=r,n=t,o=e.ref(l.schema),s=e.ref(l.defaultValue?JSON.parse(JSON.stringify(l.defaultValue)):{}),a=e.ref({}),i=e.ref(),c=e.ref(l.mode);async function d(){const h=a.value.validate();if(h){Q.notify({type:"warning",title:"Помилка валідації",message:Object.entries(h).map(([_,f])=>`${_}: ${f}`).join(`
3
+ `)});return}if(i.value)try{const _=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s.value)});if(_.ok)await _.json(),Q.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),n("save",s.value);else if(_.status===400){const f=await _.json().catch(()=>({}));Q.notify({type:"warning",title:"Помилка валідації",message:f.message||"Некоректні дані (400)"})}else _.status===500?Q.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Q.notify({type:"error",title:"Помилка",message:`Статус: ${_.status}`})}catch(_){Q.notify({type:"error",title:"Помилка з’єднання",message:_.message||"Не вдалося виконати запит"})}}function p(){n("close")}return e.onMounted(async()=>{try{if(l.form){const h=await fetch(`/api/template/form/${l.form}`);if(!h.ok){Q.notify({type:h.status>=400&&h.status<500?"warning":"error",title:"Error",message:`Error code: ${h.status}`});return}const _=await h.json();o.value=_.schema,i.value=_.token}else if(l.token){i.value=l.token;const h=await fetch(`/api/form/${i.value}`);if(!h.ok){Q.notify({type:h.status>=400&&h.status<500?"warning":"error",title:"Error",message:`Error code: ${h.status}`});return}const _=await h.json();o.value=_.schema,_.data?s.value=_.data:c.value="add"}}catch(h){Q.notify({type:"error",title:"Error",message:h.message||"Unexpected error"}),console.error(h)}}),(h,_)=>(e.openBlock(),e.createElementBlock("div",Qi,[e.createElementVNode("div",ec,[e.createElementVNode("div",tc,[e.createElementVNode("div",lc,[e.createElementVNode("h3",nc,e.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:p,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},_[2]||(_[2]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M18 6 6 18"}),e.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),e.createElementVNode("div",oc,[o.value?(e.openBlock(),e.createBlock(we,{key:0,schema:o.value,values:s.value,"onUpdate:values":_[0]||(_[0]=f=>s.value=f),form:a.value,"onUpdate:form":_[1]||(_[1]=f=>a.value=f)},null,8,["schema","values","form"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[e.createElementVNode("button",{type:"button",onClick:p,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:d,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),sc=["placeholder","disabled","name"],ac=["type","value","onInput","placeholder","disabled"],rc=["onClick"],ic=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,l=e.ref(t.count),n=e.computed(()=>t.limit),{inputClass:o}=ae(t.style),s=e.useModel(r,"modelValue"),a=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const m=s.value?.length??0;m<l.value&&(s.value=[...s.value??[],...Array(l.value-m)])});const c=e.ref({}),d=e.ref({});function p(m,g){m&&(c.value[g]=m)}async function h(m,g){if(!m||t.inputType!=="mask")return;const{default:b}=await Promise.resolve().then(()=>al);d.value[g]&&d.value[g].destroy(),d.value[g]=b(m,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[g].on("accept",()=>{const x=[...s.value||[]];x[g]=t.unmask?d.value[g].unmaskedValue:d.value[g].value,s.value=x}),d.value[g].on("complete",()=>{const x=[...s.value||[]];x[g]=t.unmask?d.value[g].unmaskedValue:d.value[g].value,s.value=x}),s.value?.[g]&&(d.value[g].value=s.value[g])}function _(m,g){if(a.value)return;const b=m.target.value??null,x=[...s.value];x[g]=t.inputType==="text"?b:Number(b),s.value=x}function f(){l.value+=1;const m=t.inputType==="text"||t.inputType==="mask"?null:0;s.value=[...s.value,m],t.inputType==="mask"&&setTimeout(()=>{const g=l.value-1;c.value[g]&&h(c.value[g],g)},0)}function B(m){if(l.value>1){d.value[m]&&(d.value[m].destroy(),delete d.value[m]),l.value-=1,s.value=s.value.filter((b,x)=>x!==m);const g={};Object.keys(d.value).forEach(b=>{const x=parseInt(b,10);x>m?g[x-1]=d.value[x]:x<m&&(g[x]=d.value[x])}),d.value=g}}return e.onMounted(()=>{if(t.inputType==="mask")for(let m=0;m<l.value;m+=1)c.value[m]&&h(c.value[m],m)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(m=>{m&&m.destroy()})}),e.watch(()=>t.mask,m=>{t.inputType==="mask"&&Object.values(d.value).forEach(g=>{g&&g.updateOptions({mask:m,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(s,m=>{t.inputType==="mask"&&m&&m.forEach((g,b)=>{d.value[b]&&d.value[b].value!==g&&(d.value[b].value=g||"")})},{deep:!0}),(m,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${n.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b,class:"flex items-center gap-2 w-full"},[m.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:x=>p(x,b-1),placeholder:m.placeholder,disabled:m.disabled,name:`${m.name}[${b-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":m.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,sc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:m.inputType,value:s.value?.[b-1],onInput:x=>_(x,b-1),placeholder:i.value,disabled:a.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":m.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,ac)),!m.disabled&&b===l.value&&m.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(f,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(xe,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!m.disabled&&l.value>1&&m.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(x=>B(b-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(tt,{height:"18",width:"18"})],8,rc)):e.createCommentVNode("",!0)]))),128))],2))}}),qt=(r={mode:"edit",schema:null})=>new Promise(t=>{const{close:l}=Q.modal({title:r.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Kt,contentProps:{...r,onClose:()=>{t(null),l()},onSave:n=>{t(n),l()}}})});we.install=function(t){t.component("VForm",we),Object.assign(t.config.globalProperties,{$form:qt}),t.provide("form",qt),window.v3plugin||(window.v3plugin={})};function ye(r){return typeof r=="string"||r instanceof String}function Zt(r){var t;return typeof r=="object"&&r!=null&&(r==null||(t=r.constructor)==null?void 0:t.name)==="Object"}function Wt(r,t){return Array.isArray(t)?Wt(r,(l,n)=>t.includes(n)):Object.entries(r).reduce((l,n)=>{let[o,s]=n;return t(s,o)&&(l[o]=s),l},{})}const I={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Yt(r){switch(r){case I.LEFT:return I.FORCE_LEFT;case I.RIGHT:return I.FORCE_RIGHT;default:return r}}function it(r){return r.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Ue(r,t){if(t===r)return!0;const l=Array.isArray(t),n=Array.isArray(r);let o;if(l&&n){if(t.length!=r.length)return!1;for(o=0;o<t.length;o++)if(!Ue(t[o],r[o]))return!1;return!0}if(l!=n)return!1;if(t&&r&&typeof t=="object"&&typeof r=="object"){const s=t instanceof Date,a=r instanceof Date;if(s&&a)return t.getTime()==r.getTime();if(s!=a)return!1;const i=t instanceof RegExp,c=r instanceof RegExp;if(i&&c)return t.toString()==r.toString();if(i!=c)return!1;const d=Object.keys(t);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(r,d[o]))return!1;for(o=0;o<d.length;o++)if(!Ue(r[d[o]],t[d[o]]))return!1;return!0}else if(t&&r&&typeof t=="function"&&typeof r=="function")return t.toString()===r.toString();return!1}class cc{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?I.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?I.RIGHT:I.LEFT}}function z(r,t){return new z.InputMask(r,t)}function Jt(r){if(r==null)throw new Error("mask property should be defined");return r instanceof RegExp?z.MaskedRegExp:ye(r)?z.MaskedPattern:r===Date?z.MaskedDate:r===Number?z.MaskedNumber:Array.isArray(r)||r===Array?z.MaskedDynamic:z.Masked&&r.prototype instanceof z.Masked?r:z.Masked&&r instanceof z.Masked?r.constructor:r instanceof Function?z.MaskedFunction:(console.warn("Mask not found for mask",r),z.Masked)}function Ve(r){if(!r)throw new Error("Options in not defined");if(z.Masked){if(r.prototype instanceof z.Masked)return{mask:r};const{mask:t=void 0,...l}=r instanceof z.Masked?{mask:r}:Zt(r)&&r.mask instanceof z.Masked?r:{};if(t){const n=t.mask;return{...Wt(t,(o,s)=>!s.startsWith("_")),mask:t.constructor,_mask:n,...l}}}return Zt(r)?{...r}:{mask:r}}function ce(r){if(z.Masked&&r instanceof z.Masked)return r;const t=Ve(r),l=Jt(t.mask);if(!l)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===l&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new l(t)}z.createMask=ce;class Pe{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,l){if(!(t==null||l==null||t===this.selectionStart&&l===this.selectionEnd))try{this._unsafeSelect(t,l)}catch{}}get isActive(){return!1}}z.MaskElement=Pe;const Xt=90,dc=89;class Ce extends Pe{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,l,n;return(t=(l=(n=this.input).getRootNode)==null?void 0:l.call(n))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===Xt&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===dc&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===Xt&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}z.HTMLMaskElement=Ce;class Qt extends Ce{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,l){this.input.setSelectionRange(t,l)}get value(){return this.input.value}set value(t){this.input.value=t}}z.HTMLMaskElement=Ce;class ct extends Ce{get _unsafeSelectionStart(){const t=this.rootElement,l=t.getSelection&&t.getSelection(),n=l&&l.anchorOffset,o=l&&l.focusOffset;return o==null||n==null||n<o?n:o}get _unsafeSelectionEnd(){const t=this.rootElement,l=t.getSelection&&t.getSelection(),n=l&&l.anchorOffset,o=l&&l.focusOffset;return o==null||n==null||n>o?n:o}_unsafeSelect(t,l){if(!this.rootElement.createRange)return;const n=this.rootElement.createRange();n.setStart(this.input.firstChild||this.input,t),n.setEnd(this.input.lastChild||this.input,l);const o=this.rootElement,s=o.getSelection&&o.getSelection();s&&(s.removeAllRanges(),s.addRange(n))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}z.HTMLContenteditableMaskElement=ct;class He{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>He.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}He.MAX_LENGTH=100;class el{constructor(t,l){this.el=t instanceof Pe?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new ct(t):new Qt(t),this.masked=ce(l),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new He,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var l;return t==null||((l=this.masked)==null?void 0:l.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof z.Masked)&&this.masked.constructor===Jt(t)){this.masked.updateOptions({mask:t});return}const l=t instanceof z.Masked?t:ce({mask:t});l.unmaskedValue=this.masked.unmaskedValue,this.masked=l}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,l){const n=this._listeners[t];n&&n.forEach(o=>o(l))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const l=this.masked.unmaskedValue,n=this.masked.value,o=this.masked.rawInputValue,s=this.displayValue,a=this.unmaskedValue!==l||this.value!==n||this._rawInputValue!==o;this._unmaskedValue=l,this._value=n,this._rawInputValue=o,this.el.value!==s&&(this.el.value=s),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),a&&this._fireChangeEvents(),!this._historyChanging&&(a||this.history.isEmpty)&&this.history.push({unmaskedValue:l,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:l,...n}=t,o=!this.maskEquals(l),s=this.masked.optionsIsChanged(n);o&&(this.mask=l),s&&this.masked.updateOptions(n),(o||s)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,I.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,l){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(l),this}off(t,l){if(!this._listeners[t])return this;if(!l)return delete this._listeners[t],this;const n=this._listeners[t].indexOf(l);return n>=0&&this._listeners[t].splice(n,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const l=new cc({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),n=this.masked.rawInputValue,o=this.masked.splice(l.startChangePos,l.removed.length,l.inserted,l.removeDirection,{input:!0,raw:!0}).offset,s=n===this.masked.rawInputValue?l.removeDirection:I.NONE;let a=this.masked.nearestInputPos(l.startChangePos+o,s);s!==I.NONE&&(a=this.masked.nearestInputPos(a,I.NONE)),this.updateControl(a),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}z.InputMask=el;class P{static normalize(t){return Array.isArray(t)?t:[t,new P]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}z.ChangeDetails=P;class de{constructor(t,l,n){t===void 0&&(t=""),l===void 0&&(l=0),this.value=t,this.from=l,this.stop=n}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const l=this.value[0];return this.value=this.value.slice(1),l}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class te{constructor(t){this._value="",this._update({...te.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,l){l===void 0&&(l={input:!0}),this.reset(),this.append(t,l,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,l){return t}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),Math.min(this.displayValue.length,l-t)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),this.displayValue.slice(t,l)}extractTail(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),new de(this.extractInput(t,l),t)}appendTail(t){return ye(t)&&(t=new de(String(t))),t.appendTo(this)}_appendCharRaw(t,l){return t?(this._value+=t,new P({inserted:t,rawInserted:t})):new P}_appendChar(t,l,n){l===void 0&&(l={});const o=this.state;let s;if([t,s]=this.doPrepareChar(t,l),t&&(s=s.aggregate(this._appendCharRaw(t,l)),!s.rawInserted&&this.autofix==="pad")){const a=this.state;this.state=o;let i=this.pad(l);const c=this._appendCharRaw(t,l);i=i.aggregate(c),c.rawInserted||i.equals(s)?s=i:this.state=a}if(s.inserted){let a,i=this.doValidate(l)!==!1;if(i&&n!=null){const c=this.state;if(this.overwrite===!0){a=n.state;for(let p=0;p<s.rawInserted.length;++p)n.unshift(this.displayValue.length-s.tailShift)}let d=this.appendTail(n);if(i=d.rawInserted.length===n.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,a=n.state;for(let p=0;p<s.rawInserted.length;++p)n.shift();d=this.appendTail(n),i=d.rawInserted.length===n.toString().length}i&&d.inserted&&(this.state=c)}i||(s=new P,this.state=o,n&&a&&(n.state=a))}return s}_appendPlaceholder(){return new P}_appendEager(){return new P}append(t,l,n){if(!ye(t))throw new Error("value should be string");const o=ye(n)?new de(String(n)):n;l!=null&&l.tail&&(l._beforeTailState=this.state);let s;[t,s]=this.doPrepare(t,l);for(let a=0;a<t.length;++a){const i=this._appendChar(t[a],l,o);if(!i.rawInserted&&!this.doSkipInvalid(t[a],l,o))break;s.aggregate(i)}return(this.eager===!0||this.eager==="append")&&l!=null&&l.input&&t&&s.aggregate(this._appendEager()),o!=null&&(s.tailShift+=this.appendTail(o).tailShift),s}remove(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(l),new P}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const l=this.rawInputValue,n=this.value,o=t();return this.rawInputValue=l,this.value&&this.value!==n&&n.indexOf(this.value)===0&&(this.append(n.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const l=this.state,n=t(this);return this.state=l,delete this._isolated,n}doSkipInvalid(t,l,n){return!!this.skipInvalid}doPrepare(t,l){return l===void 0&&(l={}),P.normalize(this.prepare?this.prepare(t,this,l):t)}doPrepareChar(t,l){return l===void 0&&(l={}),P.normalize(this.prepareChar?this.prepareChar(t,this,l):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,l,n,o,s){n===void 0&&(n=""),o===void 0&&(o=I.NONE),s===void 0&&(s={input:!0});const a=t+l,i=this.extractTail(a),c=this.eager===!0||this.eager==="remove";let d;c&&(o=Yt(o),d=this.extractInput(0,a,{raw:!0}));let p=t;const h=new P;if(o!==I.NONE&&(p=this.nearestInputPos(t,l>1&&t!==0&&!c?I.NONE:o),h.tailShift=p-t),h.aggregate(this.remove(p)),c&&o!==I.NONE&&d===this.rawInputValue)if(o===I.FORCE_LEFT){let _;for(;d===this.rawInputValue&&(_=this.displayValue.length);)h.aggregate(new P({tailShift:-1})).aggregate(this.remove(_-1))}else o===I.FORCE_RIGHT&&i.unshift();return h.aggregate(this.append(n,s,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!Ue(this,t)}typedValueEquals(t){const l=this.typedValue;return t===l||te.EMPTY_VALUES.includes(t)&&te.EMPTY_VALUES.includes(l)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new P}}te.DEFAULTS={skipInvalid:!0},te.EMPTY_VALUES=[void 0,null,""],z.Masked=te;class be{constructor(t,l){t===void 0&&(t=[]),l===void 0&&(l=0),this.chunks=t,this.from=l}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=ye(t)?new de(String(t)):t;const l=this.chunks[this.chunks.length-1],n=l&&(l.stop===t.stop||t.stop==null)&&t.from===l.from+l.toString().length;if(t instanceof de)n?l.extend(t.toString()):this.chunks.push(t);else if(t instanceof be){if(t.stop==null){let o;for(;t.chunks.length&&t.chunks[0].stop==null;)o=t.chunks.shift(),o.from+=t.from,this.extend(o)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof z.MaskedPattern))return new de(this.toString()).appendTo(t);const l=new P;for(let n=0;n<this.chunks.length;++n){const o=this.chunks[n],s=t._mapPosToBlock(t.displayValue.length),a=o.stop;let i;if(a!=null&&(!s||s.index<=a)&&((o instanceof be||t._stops.indexOf(a)>=0)&&l.aggregate(t._appendPlaceholder(a)),i=o instanceof be&&t._blocks[a]),i){const c=i.appendTail(o);l.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&l.aggregate(t.append(d,{tail:!0}))}else l.aggregate(t.append(o.toString(),{tail:!0}))}return l}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:l,...n}=t;Object.assign(this,n),this.chunks=l.map(o=>{const s="chunks"in o?new be:new de;return s.state=o,s})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const l=t!=null?t-this.from:t;let n=0;for(;n<this.chunks.length;){const o=this.chunks[n],s=o.unshift(l);if(o.toString()){if(!s)break;++n}else this.chunks.splice(n,1);if(s)return s}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const l=this.chunks[t],n=l.shift();if(l.toString()){if(!n)break;--t}else this.chunks.splice(t,1);if(n)return n}return""}}class uc{constructor(t,l){this.masked=t,this._log=[];const{offset:n,index:o}=t._mapPosToBlock(l)||(l<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=n,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((l=this.block)==null?void 0:l.displayValue.length)||0){var l;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,I.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,I.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,I.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,I.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,I.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,I.NONE),!0})}}class dt{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,l){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(l),this._value||(this._isRawInput=!1),new P}nearestInputPos(t,l){l===void 0&&(l=I.NONE);const n=0,o=this._value.length;switch(l){case I.LEFT:case I.FORCE_LEFT:return n;case I.NONE:case I.RIGHT:case I.FORCE_RIGHT:default:return o}}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),this._isRawInput?l-t:0}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),n===void 0&&(n={}),n.raw&&this._isRawInput&&this._value.slice(t,l)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,l){if(l===void 0&&(l={}),this.isFilled)return new P;const n=this.eager===!0||this.eager==="append",s=this.char===t&&(this.isUnmasking||l.input||l.raw)&&(!l.raw||!n)&&!l.tail,a=new P({inserted:this.char,rawInserted:s?this.char:""});return this._value=this.char,this._isRawInput=s&&(l.raw||l.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new P;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new de("")}appendTail(t){return ye(t)&&(t=new de(String(t))),t.appendTo(this)}append(t,l,n){const o=this._appendChar(t[0],l);return n!=null&&(o.tailShift+=this.appendTail(n).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class Ne{constructor(t){const{parent:l,isOptional:n,placeholderChar:o,displayChar:s,lazy:a,eager:i,...c}=t;this.masked=ce(c),Object.assign(this,{parent:l,isOptional:n,placeholderChar:o,displayChar:s,lazy:a,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),t===0&&l>=1?(this.isFilled=!1,this.masked.remove(t,l)):new P}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,l){if(l===void 0&&(l={}),this.isFilled)return new P;const n=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(l));return o.inserted&&this.doValidate(l)===!1&&(o=new P,this.masked.state=n),!o.inserted&&!this.isOptional&&!this.lazy&&!l.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(t,l,n){return this.masked.append(t,this.currentMaskFlags(l),n)}_appendPlaceholder(){return this.isFilled||this.isOptional?new P:(this.isFilled=!0,new P({inserted:this.placeholderChar}))}_appendEager(){return new P}extractTail(t,l){return this.masked.extractTail(t,l)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),this.masked.extractInput(t,l,n)}nearestInputPos(t,l){l===void 0&&(l=I.NONE);const n=0,o=this.value.length,s=Math.min(Math.max(t,n),o);switch(l){case I.LEFT:case I.FORCE_LEFT:return this.isComplete?s:n;case I.RIGHT:case I.FORCE_RIGHT:return this.isComplete?s:o;case I.NONE:default:return s}}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),this.value.slice(t,l).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var l;return{...t,_beforeTailState:(t==null||(l=t._beforeTailState)==null?void 0:l.masked)||t?._beforeTailState}}pad(t){return new P}}Ne.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class tl extends te{updateOptions(t){super.updateOptions(t)}_update(t){const l=t.mask;l&&(t.validate=n=>n.search(l)>=0),super._update(t)}}z.MaskedRegExp=tl;class le extends te{constructor(t){super({...le.DEFAULTS,...t,definitions:Object.assign({},Ne.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const l=this.mask;if(!l||!t)return;let n=!1,o=!1;for(let s=0;s<l.length;++s){if(this.blocks){const d=l.slice(s),p=Object.keys(this.blocks).filter(_=>d.indexOf(_)===0);p.sort((_,f)=>f.length-_.length);const h=p[0];if(h){const{expose:_,repeat:f,...B}=Ve(this.blocks[h]),m={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...B,repeat:f,parent:this},g=f!=null?new z.RepeatBlock(m):ce(m);g&&(this._blocks.push(g),_&&(this.exposeBlock=g),this._maskedBlocks[h]||(this._maskedBlocks[h]=[]),this._maskedBlocks[h].push(this._blocks.length-1)),s+=h.length-1;continue}}let a=l[s],i=a in t;if(a===le.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(a==="{"||a==="}"){n=!n;continue}if(a==="["||a==="]"){o=!o;continue}if(a===le.ESCAPE_CHAR){if(++s,a=l[s],!a)break;i=!1}const c=i?new Ne({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Ve(t[a]),parent:this}):new dt({char:a,eager:this.eager,isUnmasking:n});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:l,...n}=t;this._blocks.forEach((o,s)=>o.state=l[s]),super.state=n}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,l)=>t+=l.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(l),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,l)=>t+=l.value,"")}set value(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(l),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(l),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,l)=>t+=l.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const l=new P;let n=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(n==null)return l;this._blocks[n].isFilled&&++n;for(let o=n;o<this._blocks.length;++o){const s=this._blocks[o]._appendEager();if(!s.inserted)break;l.aggregate(s)}return l}_appendCharRaw(t,l){l===void 0&&(l={});const n=this._mapPosToBlock(this.displayValue.length),o=new P;if(!n)return o;for(let a=n.index,i;i=this._blocks[a];++a){var s;const c=i._appendChar(t,{...l,_beforeTailState:(s=l._beforeTailState)==null||(s=s._blocks)==null?void 0:s[a]});if(o.aggregate(c),c.consumed)break}return o}extractTail(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=new be;return t===l||this._forEachBlocksInRange(t,l,(o,s,a,i)=>{const c=o.extractTail(a,i);c.stop=this._findStopBefore(s),c.from=this._blockStartPos(s),c instanceof be&&(c.blockIndex=s),n.extend(c)}),n}extractInput(t,l,n){if(t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),n===void 0&&(n={}),t===l)return"";let o="";return this._forEachBlocksInRange(t,l,(s,a,i,c)=>{o+=s.extractInput(i,c,n)}),o}_findStopBefore(t){let l;for(let n=0;n<this._stops.length;++n){const o=this._stops[n];if(o<=t)l=o;else break}return l}_appendPlaceholder(t){const l=new P;if(this.lazy&&t==null)return l;const n=this._mapPosToBlock(this.displayValue.length);if(!n)return l;const o=n.index,s=t??this._blocks.length;return this._blocks.slice(o,s).forEach(a=>{if(!a.lazy||t!=null){var i;l.aggregate(a._appendPlaceholder((i=a._blocks)==null?void 0:i.length))}}),l}_mapPosToBlock(t){let l="";for(let n=0;n<this._blocks.length;++n){const o=this._blocks[n],s=l.length;if(l+=o.displayValue,t<=l.length)return{index:n,offset:t-s}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((l,n)=>l+=n.displayValue.length,0)}_forEachBlocksInRange(t,l,n){l===void 0&&(l=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const s=this._mapPosToBlock(l),a=s&&o.index===s.index,i=o.offset,c=s&&a?s.offset:this._blocks[o.index].displayValue.length;if(n(this._blocks[o.index],o.index,i,c),s&&!a){for(let d=o.index+1;d<s.index;++d)n(this._blocks[d],d,0,this._blocks[d].displayValue.length);n(this._blocks[s.index],s.index,0,s.offset)}}}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=super.remove(t,l);return this._forEachBlocksInRange(t,l,(o,s,a,i)=>{n.aggregate(o.remove(a,i))}),n}nearestInputPos(t,l){if(l===void 0&&(l=I.NONE),!this._blocks.length)return 0;const n=new uc(this,t);if(l===I.NONE)return n.pushRightBeforeInput()||(n.popState(),n.pushLeftBeforeInput())?n.pos:this.displayValue.length;if(l===I.LEFT||l===I.FORCE_LEFT){if(l===I.LEFT){if(n.pushRightBeforeFilled(),n.ok&&n.pos===t)return t;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),l===I.LEFT){if(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.ok&&n.pos<=t||(n.popState(),n.ok&&n.pos<=t))return n.pos;n.popState()}return n.ok?n.pos:l===I.FORCE_LEFT?0:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:0)}return l===I.RIGHT||l===I.FORCE_RIGHT?(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.pushRightBeforeFilled()?n.pos:l===I.FORCE_RIGHT?this.displayValue.length:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:this.nearestInputPos(t,I.LEFT))):t}totalInputPositions(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);let n=0;return this._forEachBlocksInRange(t,l,(o,s,a,i)=>{n+=o.totalInputPositions(a,i)}),n}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const l=this._maskedBlocks[t];return l?l.map(n=>this._blocks[n]):[]}pad(t){const l=new P;return this._forEachBlocksInRange(0,this.displayValue.length,n=>l.aggregate(n.pad(t))),l}}le.DEFAULTS={...te.DEFAULTS,lazy:!0,placeholderChar:"_"},le.STOP_CHAR="`",le.ESCAPE_CHAR="\\",le.InputDefinition=Ne,le.FixedDefinition=dt,z.MaskedPattern=le;class Se extends le{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:l=this.to||0,from:n=this.from||0,maxLength:o=this.maxLength||0,autofix:s=this.autofix,...a}=t;this.to=l,this.from=n,this.maxLength=Math.max(String(l).length,o),this.autofix=s;const i=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===i[d];)++d;a.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(a)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let l="",n="";const[,o,s]=t.match(/^(\D*)(\d*)(\D*)/)||[];return s&&(l="0".repeat(o.length)+s,n="9".repeat(o.length)+s),l=l.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[l,n]}doPrepareChar(t,l){l===void 0&&(l={});let n;return[t,n]=super.doPrepareChar(t.replace(/\D/g,""),l),t||(n.skip=!this.isComplete),[t,n]}_appendCharRaw(t,l){if(l===void 0&&(l={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,l);const n=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[s,a]=this.boundaries(this.value+t);return Number(a)<this.from?super._appendCharRaw(n[this.value.length],l):Number(s)>this.to?!l.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(n[this.value.length],l).aggregate(this._appendCharRaw(t,l)):super._appendCharRaw(o[this.value.length],l):super._appendCharRaw(t,l)}doValidate(t){const l=this.value;if(l.search(/[^0]/)===-1&&l.length<=this._matchFrom)return!0;const[o,s]=this.boundaries(l);return this.from<=Number(s)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const l=new P;if(this.value.length===this.maxLength)return l;const n=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let s=0;s<o;++s)l.aggregate(super._appendCharRaw("0",t));n.split("").forEach(s=>this._appendCharRaw(s))}return l}}z.MaskedRange=Se;const pc="d{.}`m{.}`Y";class ue extends le{static extractPatternOptions(t){const{mask:l,pattern:n,...o}=t;return{...o,mask:ye(l)?l:n}}constructor(t){super(ue.extractPatternOptions({...ue.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:l,pattern:n,blocks:o,...s}={...ue.DEFAULTS,...t},a=Object.assign({},ue.GET_DEFAULT_BLOCKS());t.min&&(a.Y.from=t.min.getFullYear()),t.max&&(a.Y.to=t.max.getFullYear()),t.min&&t.max&&a.Y.from===a.Y.to&&(a.m.from=t.min.getMonth()+1,a.m.to=t.max.getMonth()+1,a.m.from===a.m.to&&(a.d.from=t.min.getDate(),a.d.to=t.max.getDate())),Object.assign(a,this.blocks,o),super._update({...s,mask:ye(l)?l:n,blocks:a})}doValidate(t){const l=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&l!=null&&(this.min==null||this.min<=l)&&(this.max==null||l<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(ue.extractPatternOptions(t))}}ue.GET_DEFAULT_BLOCKS=()=>({d:{mask:Se,from:1,to:31,maxLength:2},m:{mask:Se,from:1,to:12,maxLength:2},Y:{mask:Se,from:1900,to:9999}}),ue.DEFAULTS={...le.DEFAULTS,mask:Date,pattern:pc,format:(r,t)=>{if(!r)return"";const l=String(r.getDate()).padStart(2,"0"),n=String(r.getMonth()+1).padStart(2,"0"),o=r.getFullYear();return[l,n,o].join(".")},parse:(r,t)=>{const[l,n,o]=r.split(".").map(Number);return new Date(o,n-1,l)}},z.MaskedDate=ue;class Me extends te{constructor(t){super({...Me.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(l=>{const{expose:n,...o}=Ve(l),s=ce({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return n&&(this.exposeMask=s),s}):[])}_appendCharRaw(t,l){l===void 0&&(l={});const n=this._applyDispatch(t,l);return this.currentMask&&n.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(l))),n}_applyDispatch(t,l,n){t===void 0&&(t=""),l===void 0&&(l={}),n===void 0&&(n="");const o=l.tail&&l._beforeTailState!=null?l._beforeTailState._value:this.value,s=this.rawInputValue,a=l.tail&&l._beforeTailState!=null?l._beforeTailState._rawInputValue:s,i=s.slice(a.length),c=this.currentMask,d=new P,p=c?.state;return this.currentMask=this.doDispatch(t,{...l},n),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),a&&(this.currentMask.append(a,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):p&&(this.currentMask.state=p)),d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const l=new P;return t&&l.aggregate(this._applyDispatch("",{},t)),l.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var l,n;return{...t,_beforeTailState:((l=t._beforeTailState)==null?void 0:l.currentMaskRef)===this.currentMask&&((n=t._beforeTailState)==null?void 0:n.currentMask)||t._beforeTailState}}doDispatch(t,l,n){return l===void 0&&(l={}),n===void 0&&(n=""),this.dispatch(t,this,l,n)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,l){l===void 0&&(l={});let[n,o]=super.doPrepare(t,l);if(this.currentMask){let s;[n,s]=super.doPrepare(n,this.currentMaskFlags(l)),o=o.aggregate(s)}return[n,o]}doPrepareChar(t,l){l===void 0&&(l={});let[n,o]=super.doPrepareChar(t,l);if(this.currentMask){let s;[n,s]=super.doPrepareChar(n,this.currentMaskFlags(l)),o=o.aggregate(s)}return[n,o]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(l=>l.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let l=String(t);this.currentMask&&(this.currentMask.typedValue=t,l=this.currentMask.unmaskedValue),this.unmaskedValue=l}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,l){const n=new P;return this.currentMask&&n.aggregate(this.currentMask.remove(t,l)).aggregate(this._applyDispatch()),n}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(l=>l.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:l,currentMaskRef:n,currentMask:o,...s}=t;l&&this.compiledMasks.forEach((a,i)=>a.state=l[i]),n!=null&&(this.currentMask=n,this.currentMask.state=o),super.state=s}extractInput(t,l,n){return this.currentMask?this.currentMask.extractInput(t,l,n):""}extractTail(t,l){return this.currentMask?this.currentMask.extractTail(t,l):super.extractTail(t,l)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,l){return this.currentMask?this.currentMask.nearestInputPos(t,l):super.nearestInputPos(t,l)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((l,n)=>{if(!t[n])return;const{mask:o,...s}=t[n];return Ue(l,s)&&l.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var l;return!!((l=this.currentMask)!=null&&l.typedValueEquals(t))}}Me.DEFAULTS={...te.DEFAULTS,dispatch:(r,t,l,n)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,s=t.compiledMasks.map((a,i)=>{const c=t.currentMask===a,d=c?a.displayValue.length:a.nearestInputPos(a.displayValue.length,I.FORCE_LEFT);return a.rawInputValue!==o?(a.reset(),a.append(o,{raw:!0})):c||a.remove(d),a.append(r,t.currentMaskFlags(l)),a.appendTail(n),{index:i,weight:a.rawInputValue.length,totalInputPositions:a.totalInputPositions(0,Math.max(d,a.nearestInputPos(a.displayValue.length,I.FORCE_LEFT)))}});return s.sort((a,i)=>i.weight-a.weight||i.totalInputPositions-a.totalInputPositions),t.compiledMasks[s[0].index]}},z.MaskedDynamic=Me;class $e extends le{constructor(t){super({...$e.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:l,...n}=t;if(l){const o=l.map(i=>i.length),s=Math.min(...o),a=Math.max(...o)-s;n.mask="*".repeat(s),a&&(n.mask+="["+"*".repeat(a)+"]"),this.enum=l}super._update(n)}_appendCharRaw(t,l){l===void 0&&(l={});const n=Math.min(this.nearestInputPos(0,I.FORCE_RIGHT),this.value.length),o=this.enum.filter(s=>this.matchValue(s,this.unmaskedValue+t,n));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(a,i)=>{const c=o[0][i];i>=this.value.length||c===a.value||(a.reset(),a._appendChar(c,l))});const s=super._appendCharRaw(o[0][this.value.length],l);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(a=>s.aggregate(super._appendCharRaw(a))),s}return new P({skip:!this.isComplete})}extractTail(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),new de("",t)}remove(t,l){if(t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),t===l)return new P;const n=Math.min(super.nearestInputPos(0,I.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(n,o),n)).length>1);--o);const s=super.remove(o,l);return s.tailShift+=o-t,s}get isComplete(){return this.enum.indexOf(this.value)>=0}}$e.DEFAULTS={...le.DEFAULTS,matchValue:(r,t,l)=>r.indexOf(t,l)===l},z.MaskedEnum=$e;class ll extends te{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}z.MaskedFunction=ll;var nl;class oe extends te{constructor(t){super({...oe.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),l="\\d*",n=(this.scale?"("+it(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+l+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(it).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(it(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const l=t.split(this.radix);return l[0]=l[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),l.join(this.radix)}doPrepareChar(t,l){l===void 0&&(l={});const[n,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(l.input&&l.raw||!l.input&&!l.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),l);return t&&!n&&(o.skip=!0),n&&!this.allowPositive&&!this.value&&n!=="-"&&o.aggregate(this._appendChar("-")),[n,o]}_separatorsCount(t,l){l===void 0&&(l=!1);let n=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++n,l&&(t+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),[t,l]=this._adjustRangeWithSeparators(t,l),this._removeThousandsSeparators(super.extractInput(t,l,n))}_appendCharRaw(t,l){l===void 0&&(l={});const n=l.tail&&l._beforeTailState?l._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(n);this._value=this._removeThousandsSeparators(this.value);const s=this._value;this._value+=t;const a=this.number;let i=!isNaN(a),c=!1;if(i){let _;this.min!=null&&this.min<0&&this.number<this.min&&(_=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(_=this.max),_!=null&&(this.autofix?(this._value=this.format(_,this).replace(oe.UNMASKED_RADIX,this.radix),c||(c=s===this._value&&!l.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new P({inserted:this._value.slice(s.length),rawInserted:c?"":t,skip:c}):(this._value=s,d=new P),this._value=this._insertThousandsSeparators(this._value);const p=l.tail&&l._beforeTailState?l._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(p);return d.tailShift+=(h-o)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const l=t-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,l);if(n<=t)return n}return-1}_adjustRangeWithSeparators(t,l){const n=this._findSeparatorAround(t);n>=0&&(t=n);const o=this._findSeparatorAround(l);return o>=0&&(l=o+this.thousandsSeparator.length),[t,l]}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),[t,l]=this._adjustRangeWithSeparators(t,l);const n=this.value.slice(0,t),o=this.value.slice(l),s=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+o));const a=this._separatorsCountFromSlice(n);return new P({tailShift:(a-s)*this.thousandsSeparator.length})}nearestInputPos(t,l){if(!this.thousandsSeparator)return t;switch(l){case I.NONE:case I.LEFT:case I.FORCE_LEFT:{const n=this._findSeparatorAround(t-1);if(n>=0){const o=n+this.thousandsSeparator.length;if(t<o||this.value.length<=o||l===I.FORCE_LEFT)return n}break}case I.RIGHT:case I.FORCE_RIGHT:{const n=this._findSeparatorAround(t);if(n>=0)return n+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let l=t;this.min!=null&&(l=Math.max(l,this.min)),this.max!=null&&(l=Math.min(l,this.max)),l!==t&&(this.unmaskedValue=this.format(l,this));let n=this.value;this.normalizeZeros&&(n=this._normalizeZeros(n)),this.padFractionalZeros&&this.scale>0&&(n=this._padFractionalZeros(n)),this._value=n}super.doCommit()}_normalizeZeros(t){const l=this._removeThousandsSeparators(t).split(this.radix);return l[0]=l[0].replace(/^(\D*)(0*)(\d*)/,(n,o,s,a)=>o+a),t.length&&!/\d$/.test(l[0])&&(l[0]=l[0]+"0"),l.length>1&&(l[1]=l[1].replace(/0*$/,""),l[1].length||(l.length=1)),this._insertThousandsSeparators(l.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const l=t.split(this.radix);return l.length<2&&l.push(""),l[1]=l[1].padEnd(this.scale,"0"),l.join(this.radix)}doSkipInvalid(t,l,n){l===void 0&&(l={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===oe.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,l,n)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,oe.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(oe.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||oe.EMPTY_VALUES.includes(t)&&oe.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}nl=oe,oe.UNMASKED_RADIX=".",oe.EMPTY_VALUES=[...te.EMPTY_VALUES,0],oe.DEFAULTS={...te.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[nl.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:r=>r.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},z.MaskedNumber=oe;const Ge={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function ut(r,t,l){t===void 0&&(t=Ge.MASKED),l===void 0&&(l=Ge.MASKED);const n=ce(r);return o=>n.runIsolated(s=>(s[t]=o,s[l]))}function ol(r,t,l,n){return ut(t,l,n)(r)}z.PIPE_TYPE=Ge,z.createPipe=ut,z.pipe=ol;class sl extends le{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var l,n,o;const{repeat:s,...a}=Ve(t);this._blockOpts=Object.assign({},this._blockOpts,a);const i=ce(this._blockOpts);this.repeat=(l=(n=s??i.repeat)!=null?n:this.repeat)!=null?l:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(ce(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,l){l===void 0&&(l={});const n=new P;for(let c=(o=(s=this._mapPosToBlock(this.displayValue.length))==null?void 0:s.index)!=null?o:Math.max(this._blocks.length-1,0),d,p;d=(a=this._blocks[c])!=null?a:p=!p&&this._allocateBlock(c);++c){var o,s,a,i;const h=d._appendChar(t,{...l,_beforeTailState:(i=l._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(h.skip&&p){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(n.aggregate(h),h.consumed)break}return n}_trimEmptyTail(t,l){var n,o;t===void 0&&(t=0);const s=Math.max(((n=this._mapPosToBlock(t))==null?void 0:n.index)||0,this.repeatFrom,0);let a;l!=null&&(a=(o=this._mapPosToBlock(l))==null?void 0:o.index),a==null&&(a=this._blocks.length-1);let i=0;for(let c=a;s<=c&&!this._blocks[c].unmaskedValue;--c,++i);i&&(this._blocks.splice(a-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=super.remove(t,l);return this._trimEmptyTail(t,l),n}totalInputPositions(t,l){return t===void 0&&(t=0),l==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,l)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}z.RepeatBlock=sl;try{globalThis.IMask=z}catch{}const al=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:P,ChunksTailDetails:be,DIRECTION:I,HTMLContenteditableMaskElement:ct,HTMLInputMaskElement:Qt,HTMLMaskElement:Ce,InputMask:el,MaskElement:Pe,Masked:te,MaskedDate:ue,MaskedDynamic:Me,MaskedEnum:$e,MaskedFunction:ll,MaskedNumber:oe,MaskedPattern:le,MaskedRange:Se,MaskedRegExp:tl,PIPE_TYPE:Ge,PatternFixedDefinition:dt,PatternInputDefinition:Ne,RepeatBlock:sl,createMask:ce,createPipe:ut,default:z,forceDirection:Yt,normalizeOpts:Ve,pipe:ol},Symbol.toStringTag,{value:"Module"}));K.ModalEdit=Kt,K.VForm=we,K.VsInputAddress=jt,K.VsInputArray=ic,K.VsInputCheckbox=xt,K.VsInputCodegen=Lt,K.VsInputColor=Rt,K.VsInputContainer=Mt,K.VsInputDate=wt,K.VsInputEmail=bt,K.VsInputFile=Ct,K.VsInputFileList=Nt,K.VsInputKeyValue=Ot,K.VsInputMask=yt,K.VsInputNumber=kt,K.VsInputRadio=ot,K.VsInputRange=zt,K.VsInputSelect=st,K.VsInputSlug=Tt,K.VsInputStatic=nt,K.VsInputSwitcher=lt,K.VsInputTag=It,K.VsInputText=Ee,K.VsInputTextArray=at,K.VsInputTextarea=$t,K.default=we,K.inputs=Ut,K.vsInputDatatable=Ft,K.vsInputMap=Dt,Object.defineProperties(K,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});