@opengis/form 0.0.62 → 0.0.64
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.
- package/dist/components/inputs/vs-input-select.vue.d.ts.map +1 -1
- package/dist/components/layouts/vs-compact-form-layout.vue.d.ts.map +1 -1
- package/dist/index.js +1156 -1160
- package/dist/index.umd.cjs +3 -3
- package/dist/types/form.d.ts +1 -0
- package/dist/types/form.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(q,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):(q=typeof globalThis<"u"?globalThis:q||self,e(q.FormBuilder={},q.Vue,q.OpenGISCore))})(this,function(q,e,ee){"use strict";const sn={class:"w-full relative"},on={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},an={class:"opacity-100"},rn={key:0,class:"text-red-500 text-[14px]"},cn={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},dn=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(a){const t=e.ref("uk"),n=l=>{l.detail.key==="locale"&&(t.value=l.detail.newValue)};return e.onMounted(()=>{t.value=localStorage.locale,window.addEventListener("storage",n)}),e.onUnmounted(()=>{window.removeEventListener("resize",n)}),(l,s)=>(e.openBlock(),e.createElementBlock("div",sn,[l.ua||l.label?(e.openBlock(),e.createElementBlock("div",on,[e.createElementVNode("span",an,e.toDisplayString(l.item[t.value]||l.ua||l.label),1),l.item?.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",rn,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"default",e.mergeProps(l.$attrs,{class:{"opacity-60":l.item.disabled}})),l.error?(e.openBlock(),e.createElementBlock("span",cn,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),un={class:"w-full relative flex flex-row items-center gap-2"},pn={key:0,class:"text-red-500 text-[14px]"},hn={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},mn=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(a){const t=a,n=e.computed(()=>t.columns??{container:12,label:3}),l=e.computed(()=>{const{container:i,label:c}=n.value;return!i||i<=0?0:Math.min(Math.max(c??0,0),i)/i}),s=e.computed(()=>t.item?.type==="html"||l.value<=0?!1:!!(t.ua||t.label)),o=e.computed(()=>{if(!s.value)return{};const i=`${l.value*100}%`;return{flexBasis:i,maxWidth:i}}),r=e.computed(()=>{const{container:i,label:c}=n.value;if(!i||i<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const d=Math.max(i-Math.max(c??0,0),0)/i;if(!d)return{};const u=`${d*100}%`;return{flexBasis:u,maxWidth:u}});return(i,c)=>(e.openBlock(),e.createElementBlock("div",un,[s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:e.normalizeStyle(o.value)},[e.createTextVNode(e.toDisplayString(i.ua||i.label)+" ",1),i.item?.rules?.includes("required")&&(i.ua||i.label)?(e.openBlock(),e.createElementBlock("span",pn,"*")):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(r.value)},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],4),i.error?(e.openBlock(),e.createElementBlock("span",hn,e.toDisplayString(i.error),1)):e.createCommentVNode("",!0)]))}}),fn={class:"w-full relative"},gn={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},kn=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(a){return(t,n)=>(e.openBlock(),e.createElementBlock("div",fn,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",gn,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),yn={class:"flex-1 min-w-0"},bn={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},xn={class:"truncate"},wn={key:0,class:"text-red-500 text-[14px]"},_n={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},En={class:"w-full md:w-auto"},Vn={key:0,class:"mt-1 text-xs text-red-500"},vn={default:dn,horizontal:mn,inline:kn,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(a){const t=a,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const l=e.computed(()=>t.item?.description??""),s=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),o=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),r=i=>{i.key==="locale"&&(n.value=i.newValue??"uk")};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",r)}),e.onUnmounted(()=>{window.removeEventListener("storage",r)}),(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",yn,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",bn,[e.createElementVNode("span",xn,e.toDisplayString(i.item[n.value]||i.ua||i.label),1),s.value?(e.openBlock(),e.createElementBlock("span",wn,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("p",_n,e.toDisplayString(l.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",En,[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))])],2),o.value?(e.openBlock(),e.createElementBlock("p",Vn,e.toDisplayString(o.value),1)):e.createCommentVNode("",!0)],2))}})};function ae(a){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${a?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return a?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const Cn=["placeholder","disabled"],Bn=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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");return(s,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":o[0]||(o[0]=r=>l.value=r),placeholder:s.placeholder,disabled:s.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Cn)),[[e.vModelText,l.value]])}}),Sn=["placeholder","disabled"],Ve=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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");return(s,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":o[0]||(o[0]=r=>l.value=r),placeholder:s.placeholder,disabled:s.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Sn)),[[e.vModelText,l.value]])}}),Mn=["placeholder","min","max"],ot=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");return(s,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":o[0]||(o[0]=r=>l.value=r),placeholder:s.placeholder,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:s.min,max:s.max},null,10,Mn)),[[e.vModelText,l.value]])}}),H=(a,t)=>{const n=a.__vccOpts||a;for(const[l,s]of t)n[l]=s;return n},Nn={},Fn={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 $n(a,t){return e.openBlock(),e.createElementBlock("svg",Fn,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 An=H(Nn,[["render",$n]]),Dn={class:"flex items-center gap-[4px]"},In=["value","id","disabled"],Tn=["for"],Ln={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Rn=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(a,{emit:t}){const n=t,l=a,s=e.computed({get:()=>l.modelValue,set:o=>n("update:modelValue",o)});return(o,r)=>(e.openBlock(),e.createElementBlock("div",Dn,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:o.value,"onUpdate:modelValue":r[0]||(r[0]=i=>s.value=i),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":o.disabled}]),id:o.id,disabled:o.disabled},null,10,In),[[e.vModelCheckbox,s.value]]),e.createElementVNode("label",{for:o.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":o.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[s.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",o.error?"border-red-600":""]])},[e.createVNode(An,{height:"12",width:"12"})],2),e.createElementVNode("span",Ln,[e.renderSlot(o.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.label),1)])])],10,Tn)]))}}),On=["name","value","disabled"],zn={class:"flex items-center gap-[6px] text-[14px]"},jn={key:0,class:"text-[16px]"},Un=["src"],Pn=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(a,{emit:t}){const n=a,l=t,s=e.computed({get:()=>n.modelValue,set:i=>{l("update:modelValue",i)}}),o=e.computed(()=>Array.isArray(s.value)?s.value.includes(n.value):s.value===!0||s.value===n.value),r=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.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",[r.value,o.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=>s.value=d),disabled:i.disabled},null,8,On),[[e.vModelCheckbox,s.value]]),e.createElementVNode("span",zn,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",jn,[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,Un)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),Hn={class:"flex items-center"},Ke=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(a,{emit:t}){const n=a,l=t,s=`radio-${Math.floor(Math.random()*1e4)}`,o=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:i=>{if(Array.isArray(n.modelValue)){let c=[...n.modelValue];i?c.includes(n.value)||c.push(n.value):c=c.filter(d=>d!==n.value),l("update:modelValue",c)}else l("update:modelValue",i)}}),r=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Hn,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value==="vs-checkbox-buttons"?e.unref(Pn):e.unref(Rn)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:o.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),id:s,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"]))]))}}),Gn={},qn={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 Kn(a,t){return e.openBlock(),e.createElementBlock("svg",qn,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 Zn=H(Gn,[["render",Kn]]),Wn={},Yn={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 Jn(a,t){return e.openBlock(),e.createElementBlock("svg",Yn,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 Xn=H(Wn,[["render",Jn]]),Qn={},el={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 tl(a,t){return e.openBlock(),e.createElementBlock("svg",el,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 nl=H(Qn,[["render",tl]]),ll={key:0,class:"flex items-start gap-x-1"},sl={key:0,class:"text-red-500 text-[14px]"},ol=["title"],al=["disabled"],Ze=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(a){const t=a,n=e.useModel(a,"modelValue");return(l,s)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",ll,[e.createVNode(Ke,{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=o=>n.value=o),label:l.text,error:l.error||""},null,8,["modelValue","label","error"]),l.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",sl,"*")):e.createCommentVNode("",!0),l.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:l.i,onClick:s[1]||(s[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(nl),{class:"text-gray-500 w-[14px] h-[14px]"})],8,ol)):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",[n.value?`bg-${l.style?.primaryColor||"blue"}-500`:"bg-stone-200",l.customClass]]),disabled:l.disabled,onClick:s[2]||(s[2]=o=>n.value=!n.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",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,al))}}),rl=["id","innerHTML"],We=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(a){return(t,n)=>(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,rl))}}),il=["placeholder","disabled","name"],at=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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue"),s=e.ref(null);let o=null;return e.onMounted(async()=>{if(s.value){const{default:r}=await Promise.resolve().then(()=>$i);o=r(s.value,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),o.on("accept",()=>{l.value=t.unmask?o.unmaskedValue:o.value}),o.on("complete",()=>{l.value=t.unmask?o.unmaskedValue:o.value}),o.value=l.value??""}}),e.onBeforeUnmount(()=>{o?.destroy()}),e.watch(()=>t.mask,r=>{o&&o.updateOptions({mask:r,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),e.watch(l,r=>{o&&o.unmaskedValue!==r&&(o.value=r||"")}),(r,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:s,placeholder:r.placeholder,disabled:r.disabled,name:r.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,il))}}),cl={class:"relative w-full bg-white rounded-lg"},dl=["placeholder","disabled"],rt=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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");return(s,o)=>(e.openBlock(),e.createElementBlock("div",cl,[o[1]||(o[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":o[0]||(o[0]=r=>l.value=r),placeholder:s.placeholder,disabled:s.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,dl),[[e.vModelText,l.value]])]))}}),ul=["value","disabled"],pl={class:"text-[13px] text-gray-700"},hl=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(a){const t=e.useModel(a,"modelValue");return(n,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[n.customClass]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=s=>t.value=s),type:"radio",value:n.value,disabled:n.disabled,class:"hidden"},null,8,ul),[[e.vModelRadio,t.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${n.style?.primaryColor||"blue"}-500`,n.disabled?"opacity-50 cursor-not-allowed":""]])},[t.value==n.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${n.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",pl,e.toDisplayString(n.text),1)],2))}}),ml=["value","disabled"],fl={class:"text-[13px] text-gray-700"},gl={"vs-input-radio-default":hl,"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(a){const t=e.useModel(a,"modelValue");return(n,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[t.value==n.value?`ring-2 ring-ring ring-${n.style?.primaryColor||"blue"}-500`:"",n.customClass]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=s=>t.value=s),type:"radio",value:n.value,disabled:n.disabled,class:"hidden"},null,8,ml),[[e.vModelRadio,t.value]]),e.createElementVNode("span",fl,e.toDisplayString(n.text),1)],2))}})},Ye=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(a){const t=a,n=e.useModel(a,"modelValue"),l=e.computed(()=>gl[`vs-input-radio-${t.view}`]);return(s,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([s.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.options,r=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value),e.mergeProps({key:r?.id,text:r.text,value:r.id.toString(),checked:n.value===r.id,modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=i=>n.value=i)},{ref_for:!0},s.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),kl={key:1,class:"w-full flex flex-col gap-4"},yl={key:0,class:"text-sm font-medium text-muted-foreground my-2"},bl="Без категорії",it=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(a,{emit:t}){const n=a,l=t,s=e.ref([]),o=e.reactive({}),r=h=>h?.value||h?.id||h?.text||h,i=h=>h.text||String(h),c=h=>`lg:col-span-${h||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),u=h=>h==null||h===""?null:typeof h=="string"||typeof h=="number"?h:String(h),p=e.computed(()=>{if(!n.group)return[];const h=new Map;s.value.forEach(A=>{const _=A[n.group],m=u(_);h.has(m)||h.set(m,[]),h.get(m)?.push(A)});const v=[];n.values?.length&&n.values.forEach(A=>{const _=u(A);v.push(_)});const w=new Set,S=A=>{const _=h.get(A)||[];if(!_.length)return null;const m=A===null?"group-null":`group-${String(A)}`,b=A===null?bl:String(A);return w.add(A),{key:m,label:b,options:_}},M=[];return v.forEach(A=>{const _=S(A);_&&M.push(_)}),h.forEach((A,_)=>{if(w.has(_))return;const m=S(_);m&&M.push(m)}),M}),g=async()=>{try{const h=await fetch(`/api/suggest/${n.data}`).then(v=>v.json());s.value=h?.data||h}catch(h){console.error(h)}};return e.watch(()=>n.modelValue,h=>{if(typeof h=="boolean"&&s.value.length===1){const v=r(s.value[0]);o[v]=h}else if(Array.isArray(h)){const v=new Set(h);s.value.forEach(w=>{if(!w.disabled){const S=r(w);o[S]=v.has(S)}})}},{immediate:!0}),e.watch(o,()=>{if(!s.value.length){l("update:modelValue",null);return}const h=Object.entries(o).filter(([,v])=>v).map(([v])=>v);l("update:modelValue",h.length===0?[]:h)},{deep:!0}),e.onMounted(()=>{if(n.data)g().then(()=>{if(typeof n.modelValue=="boolean"&&s.value.length===1){const h=r(s.value[0]);o[h]=n.modelValue}else if(Array.isArray(n.modelValue)){const h=new Set(n.modelValue);s.value.forEach(v=>{if(!v.disabled){const w=r(v);o[w]=h.has(w)}})}});else if(s.value=n.options,typeof n.modelValue=="boolean"&&s.value.length===1){const h=r(s.value[0]);o[h]=n.modelValue}else if(Array.isArray(n.modelValue)){const h=new Set(n.modelValue);s.value.forEach(v=>{if(!v.disabled){const w=r(v);o[w]=h.has(w)}})}}),(h,v)=>n.group?(e.openBlock(),e.createElementBlock("div",kl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w.key,class:"flex flex-col gap-2"},[w.label?(e.openBlock(),e.createElementBlock("span",yl,e.toDisplayString(w.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(w.options,S=>(e.openBlock(),e.createBlock(Ke,{modelValue:o[r(S)],"onUpdate:modelValue":M=>o[r(S)]=M,value:r(S),class:e.normalizeClass(c(h.colSpan)),disabled:S.disabled,label:i(S),key:`${w.key}-${r(S)}`,icon:S?.icon,imgUrl:S?.imgUrl,option:S,view:h.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(s.value,w=>(e.openBlock(),e.createBlock(Ke,{modelValue:o[r(w)],"onUpdate:modelValue":S=>o[r(w)]=S,value:r(w),class:e.normalizeClass(c(h.colSpan)),disabled:w.disabled,label:i(w),key:r(w),icon:w?.icon,imgUrl:w?.imgUrl,option:w,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-58e06c8a"]]),xl=["type","placeholder","disabled"],ct=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(a,{emit:t}){const n=a;function l(c){return c?n.mode==="datetime"?(c.includes("T")?c:null)||c+(c.includes(" ")?"":"T00:00"):c?.split(" ")[0]:null}const{inputClass:s}=ae(n.style),o=t,r=e.computed({get:()=>l(n.modelValue),set:c=>o("update:modelValue",c)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode);return(c,d)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":d[0]||(d[0]=u=>r.value=u),placeholder:c.placeholder,disabled:c.disabled,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[c.modelValue?"":"text-opacity-50",e.unref(s)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,xl)),[[e.vModelDynamic,r.value]])}}),dt=async(a,t,n,l)=>{try{const s=new FormData;return s.append("unique","true"),s.append("file",a),(await fetch(`/file/upload/uploads?id=${t||""}&form=${n||""}&table=${l||""}`,{method:"POST",body:s}).then(r=>r.json()))?.result}catch(s){return ee.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",s),null}},wl=async a=>{try{return await fetch(`file/delete${a}`),!0}catch(t){return console.error(t),!1}},ut=async a=>{try{const t=await fetch(`file/download/files/uploads${a}`),n=await t.arrayBuffer(),l=t.headers["content-type"],s=new TextDecoder("utf-8").decode(n),o=new Blob([s],{type:l}),r=document.createElement("a");r.setAttribute("download",a),r.href=window.URL.createObjectURL(o),r.click()}catch(t){console.error(t.message)}},_l={},El={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 Vl(a,t){return e.openBlock(),e.createElementBlock("svg",El,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const ve=H(_l,[["render",Vl]]),vl={},Cl={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 Bl(a,t,n,l,s,o){return e.openBlock(),e.createElementBlock("svg",Cl,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 Sl=H(vl,[["render",Bl]]),Ml={},Nl={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 Fl(a,t,n,l,s,o){return e.openBlock(),e.createElementBlock("svg",Nl,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 $l=H(Ml,[["render",Fl]]),Al={},Dl={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 Il(a,t){return e.openBlock(),e.createElementBlock("svg",Dl,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 pt=H(Al,[["render",Il]]),Tl={},Ll={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 Rl(a,t,n,l,s,o){return e.openBlock(),e.createElementBlock("svg",Ll,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 Ol=H(Tl,[["render",Rl]]),zl={},jl={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 Ul(a,t,n,l,s,o){return e.openBlock(),e.createElementBlock("svg",jl,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 Pl=H(zl,[["render",Ul]]),Hl=a=>{if(!a)return"";const t=a?.split(".");return t[t.length-1]},Gl=a=>{const t=Hl(a),n={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 n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?$l:n.textsFormat.includes(t)?Pl:n.documentsFormat.includes(t)?Sl:n.archivesFormat.includes(t)?Ol:pt},ql={},Kl={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 Zl(a,t){return e.openBlock(),e.createElementBlock("svg",Kl,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 Re=H(ql,[["render",Zl]]),Wl={},Yl={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 Jl(a,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:"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 ht=H(Wl,[["render",Jl]]),Xl={class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},Ql={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},mt=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(a){const t=e.useModel(a,"value"),n=e.useModel(a,"item"),l=a;return(s,o)=>(e.openBlock(),e.createElementBlock("div",Xl,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Gl)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:o[0]||(o[0]=r=>e.unref(ut)(n.value))},null,8,["src"])),e.createElementVNode("div",Ql,[e.createElementVNode("button",{type:"button",onClick:o[1]||(o[1]=r=>{e.unref(wl)(n.value),t.value=l.multiple?t.value?.filter(i=>i!==n.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(Re,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:o[2]||(o[2]=r=>e.unref(ut)(n.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(ht,{class:"w-4 h-4"})])])]))}}),[["__scopeId","data-v-0ca886b3"]]),es={class:"flex items-center gap-x-2"},ts=["multiple","disabled"],ns={key:1,class:"flex items-center flex-wrap gap-2"},ls={key:1,class:"loader"},ss={key:1,class:"loader"},ft=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(a,{emit:t}){const n=a,l=e.useModel(a,"modelValue"),s=t,o=e.ref(null),r=e.ref(!1),i=u=>Array.isArray(l.value)&&l.value[u]||"",c=u=>{if(n.max_size&&u.size>n.max_size*1024*1024){const p=(u.size/1048576).toFixed(2);return ee.notify({type:"error",title:"Помилка!",message:`Файл "${u.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${p} МБ`,position:"right-bottom"}),!1}return!0},d=async u=>{const{files:p}=u.target;if(!p||p.length===0)return;const g=Array.from(p);if(n.max_size&&g.filter(v=>!c(v)).length>0){o.value&&(o.value.value="");return}r.value=!0;try{if(n.multiple){const h=Array.from(p).map(async M=>n.format&&!M.name.endsWith(n.format)?null:await dt(M,"1","form","table")),S=(await Promise.all(h)).filter(M=>M!==null).map(M=>M?.file_path).filter(Boolean);l.value=[...l.value||[],...S],s("change",l.value)}else{const h=p[0];if(n.format&&!h.name.endsWith(n.format))return;const v=await dt(h,"1","form","table");l.value=v?.file_path,s("change",l.value||"")}}finally{r.value=!1,o.value&&(o.value.value="")}};return(u,p)=>(e.openBlock(),e.createElementBlock("div",es,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:o,type:"file",multiple:u.multiple,onChange:d,disabled:r.value||u.disabled},null,40,ts),!u.multiple&&l.value?(e.openBlock(),e.createBlock(mt,{key:0,item:l.value,"onUpdate:item":p[0]||(p[0]=g=>l.value=g),value:l.value,"onUpdate:value":p[1]||(p[1]=g=>l.value=g)},null,8,["item","value"])):u.multiple?(e.openBlock(),e.createElementBlock("div",ns,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(g,h)=>(e.openBlock(),e.createBlock(mt,{multiple:u.multiple,key:h,value:l.value,"onUpdate:value":p[2]||(p[2]=v=>l.value=v),item:i(h)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:p[3]||(p[3]=g=>!u.disabled&&!r.value&&o.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",u.disabled||r.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[r.value?(e.openBlock(),e.createElementBlock("div",ls)):(e.openBlock(),e.createBlock(ve,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),u.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:p[4]||(p[4]=g=>o.value?.click()),class:e.normalizeClass([u.disabled||r.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"])},[r.value?(e.openBlock(),e.createElementBlock("div",ss)):(e.openBlock(),e.createBlock(ve,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-e613a523"]]),os={class:"max-w-[55vw]"},as={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},rs={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},is={class:"px-[5px]"},cs={class:""},Oe=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(a){const t=a,n=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function l(s){if(s<1024)return`${s} B`;const o=s/1024;return o<1024?`${o.toFixed(2)} KB`:`${(o/1024).toFixed(2)} MB`}return(s,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o[1]||(o[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",os,[e.createElementVNode("p",as,e.toDisplayString(s.item?.uploaded_name),1),e.createElementVNode("p",rs,[e.createElementVNode("span",null,e.toDisplayString(s.item?.username),1),e.withDirectives(e.createElementVNode("span",is,"|",512),[[e.vShow,s.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),o[0]||(o[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",cs,e.toDisplayString(l(s.item?.size)),1)])])],64))}}),ds={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},us={key:0,class:"flex w-full gap-x-3 items-center"},ps={key:1,class:"flex gap-x-3 w-full items-center"},hs={key:2,class:"flex gap-x-3 w-full items-center"},ms=["href"],fs={key:3,class:"flex gap-x-3 w-full items-center"},gs={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},ks={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"},ys={class:"inline-block"},bs={class:"inline-block"},xs=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(a,{emit:t}){const n=a,l=t;function s(u){return["pdf","json"].includes(u.ext)}function o(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function r(u){const p=document.createElement("a");p.setAttribute("download",u?.uploaded_name),p.href=u?.file_path,p.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),l("update")}catch(u){console.error(u)}}function c(){l("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(u){(n.item.ext==="jpg"||n.item.ext==="png")&&l("openLightbox",{item:n.item,index:u})}return(u,p)=>(e.openBlock(),e.createElementBlock("div",ds,[u.item.ext==="jpg"||u.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",us,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:p[0]||(p[0]=g=>d(u.index))},[e.createVNode(Oe,{item:u.item},null,8,["item"])])])):s(u.item)?(e.openBlock(),e.createElementBlock("div",ps,[e.createVNode(Oe,{item:u.item},null,8,["item"])])):o(u.item)?(e.openBlock(),e.createElementBlock("div",hs,[e.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Oe,{item:u.item},null,8,["item"])],8,ms)])):(e.openBlock(),e.createElementBlock("div",fs,[e.createVNode(Oe,{item:u.item},null,8,["item"])])),e.createElementVNode("div",gs,[e.createElementVNode("div",ks,[e.createElementVNode("div",ys,[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:p[1]||(p[1]=g=>r(u.item))},[e.createVNode(ht,{height:"14",width:"14"})])]),p[3]||(p[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",bs,[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:p[2]||(p[2]=g=>c())},[e.createVNode(Re,{height:"14",width:"14"})])])])])]))}}),ws={},_s={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 Es(a,t){return e.openBlock(),e.createElementBlock("svg",_s,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 Vs=H(ws,[["render",Es]]),vs={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},Cs={class:"flex w-full mb-[12px] items-center gap-x-2"},Bs={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Ss={class1:"ml-auto"},Ms={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"},Ns={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Fs={class:"relative"},$s={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"},As={key:0},gt=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(a,{emit:t}){const n=a,l=e.inject("form"),s=e.computed(()=>l.value.formId),o=e.ref(!1),r=e.ref(0),i=t,c=e.ref(!1),d=e.ref({}),u=e.ref([]),p=e.ref(""),g=e.computed(()=>Array.isArray(u.value)?u.value.filter(_=>_.ext==="jpg"||_.ext==="png").map(_=>_?.file_path):[]),h=e.computed(()=>p.value===""?u.value:u.value.filter(_=>_?.uploaded_name?.includes(p.value))),v=_=>{const m=g.value.findIndex(b=>b===_.item.file_path);m!==-1&&(o.value=!0,r.value=m)},w=async()=>{try{const _=await fetch(`${n.prefix}/widget/file/${s.value}`).then(m=>m.json());u.value=_?.rows}catch(_){console.error(_)}},S=async _=>{await Promise.all(Array.from(_.target.files).map(async m=>{const b=new FormData;b.append("file",m);try{const C=`${n.prefix}/widget/file/${s.value}`,E=await fetch(C,{method:"POST",body:b});return E.ok?(i("update","file-list"),m):(ee.notify({type:E.status>=400&&E.status<500?"warning":"error",title:"Error",message:`Error code: ${E.status}`}),null)}catch(C){return ee.notify({type:"error",title:"Error",message:C.message||"Unknown error"}),console.error(C),null}})),await w()},M=_=>{const m={..._};return _.cancel||(m.cancel=()=>{c.value=!1}),_.updateListOnConfirm&&(m.confirm=async()=>{await _.confirm(),c.value=!1,w()}),m},A=_=>{d.value=M(_),c.value=!0};return e.watch(s,_=>{_&&w()}),e.onMounted(()=>{s.value&&w()}),(_,m)=>{const b=e.resolveComponent("Lightbox"),C=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",vs,[e.createElementVNode("div",Cs,[e.createElementVNode("h2",Bs," Файлів: "+e.toDisplayString(u.value?.length),1),e.createElementVNode("div",Ss,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:m[0]||(m[0]=E=>S(E))},null,32),e.createElementVNode("div",Ms,[e.createVNode(Vs,{height:"16",width:"16"})])])])]),u.value?.length>4?(e.openBlock(),e.createElementBlock("div",Ns,[e.createElementVNode("div",null,[e.createElementVNode("div",Fs,[m[8]||(m[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":m[1]||(m[1]=E=>p.value=E),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,p.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),u.value?.length?(e.openBlock(),e.createElementBlock("div",$s,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(E,I)=>(e.openBlock(),e.createBlock(xs,{key:I,prefix:_.prefix,item:E,index:I,onUpdate:m[2]||(m[2]=W=>_.$emit("update","file-list")),onOpenModal:m[3]||(m[3]=W=>A(W)),onOpenLightbox:m[4]||(m[4]=W=>v(W))},null,8,["prefix","item","index"]))),128)),h.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",As,m[9]||(m[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(b,{modelValue:o.value,"onUpdate:modelValue":m[5]||(m[5]=E=>o.value=E),startIndex:r.value,"onUpdate:index":m[6]||(m[6]=E=>r.value=E),images:g.value},null,8,["modelValue","startIndex","images"]),e.createVNode(C,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":m[7]||(m[7]=E=>c.value=E),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),Ds={class:"flex items-center justify-between"},Is={class:"text-[16px] text-gray-900 font-medium"},Ts={class:"grid gap-3"},Ls=H(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(a){const t=a,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,l=>{n.value=l}),(l,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Ds,[e.createElementVNode("p",Is,e.toDisplayString(a.title),1),e.createVNode(Ze,{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=o=>n.value=o),style:e.normalizeStyle(a.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Ts,[e.renderSlot(l.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Rs={class:"text-[16px] text-gray-900 font-medium"},Os={class:"grid gap-3"},zs=H(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(a){const t=a,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,l=>{n.value=l}),(l,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:s[0]||(s[0]=o=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Zn),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Rs,e.toDisplayString(a.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Os,[e.renderSlot(l.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),js={class:"flex items-center justify-between"},Us={switcher:Ls,accordion:zs,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(a){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",js,[e.createElementVNode("p",null,e.toDisplayString(a.title),1)]),e.renderSlot(t.$slots,"default")]))}})},re={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Ps=(a,t)=>String(a)===String(t),Hs=(a,t)=>String(a)!==String(t),Gs=(a,t)=>a>t,qs=(a,t)=>a>=t,Ks=(a,t)=>a<t,Zs=(a,t)=>a<=t,Ws=(a,t)=>Array.isArray(t)&&t.length===2?a>=t[0]&&a<=t[1]:!1,Ys=(a,t)=>String(a).startsWith(String(t)),Js=(a,t)=>String(a).endsWith(String(t)),Xs=(a,t)=>String(a).includes(String(t)),Qs=(a,t)=>Array.isArray(t)?t.includes(a):!1,eo=(a,t)=>Array.isArray(t)?!t.includes(a):!0,kt=(a,t)=>{if(!t)return!0;switch(t?.[1]){case re.Equal:return Ps(a,t?.[2]);case re.Inequal:return Hs(a,t?.[2]);case re.Higer:return Gs(a,t?.[2]);case re.HigerOrEqual:return qs(a,t?.[2]);case re.Lower:return Ks(a,t?.[2]);case re.LowerOrEqual:return Zs(a,t?.[2]);case re.Between:return Ws(a,t?.[2]);case re.StartWith:return Ys(a,t?.[2]);case re.EndWith:return Js(a,t?.[2]);case re.Contain:return Xs(a,t?.[2]);case re.In:return Qs(a,t?.[2]);case re.NotIn:return eo(a,t?.[2]);default:return!0}},yt=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(a){const t=a,n=e.inject("values",e.ref({})),l=e.inject("form"),s=e.computed(()=>t.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,u=t.name?n.value?.[t.name]?.[d]??n.value?.[d]:n.value?.[d];return kt(u,c)})),o=e.computed(()=>Us[t.view]),r=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const i=n.value[t.name];if(i)return i;const c={};return n.value={...n.value,[t.name]:c},c});return(i,c)=>a.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),{key:0,title:a.title,style:e.normalizeStyle(a.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,d=>(e.openBlock(),e.createBlock(Ft,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:r.value[d.name],"onUpdate:modelValue":u=>r.value[d.name]=u,style:a.style,error:e.unref(l)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),to=["aria-expanded","data-focus"],no={key:0,class:"flex flex-wrap items-center gap-1 max-h-20 overflow-y-auto min-w-0 flex-1"},lo={class:"flex items-center min-w-0"},so=["title"],oo=["innerHTML"],ao=["onClick"],ro={class:"flex-1 min-w-[2px]"},io=["placeholder"],co=["title"],uo=["innerHTML"],po={key:2,class:"text-gray-500 truncate"},ho={key:3,class:"flex-1 min-w-[2px]"},mo=["placeholder"],fo={class:"flex items-center shrink-0"},go=["disabled"],ko=["disabled","title"],yo=["aria-disabled","onClick"],bo=["innerHTML"],xo={key:1,class:"px-3 py-2 text-center text-gray-500"},wo=["disabled"],Je=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"},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(a,{emit:t}){const n=a,l=t,s=e.computed(()=>n.multiple),o=e.computed(()=>n.disabled);ae(n.style);const r=e.computed({get:()=>n.modelValue,set:f=>l("update:modelValue",f)});!r.value&&n.defaultValue&&(r.value=n.defaultValue);const i=e.ref(null),c=e.ref(null),d=e.ref(null),u=e.ref(null),p=e.ref(!1),g=e.ref(!1),h=e.ref(null),v=e.ref([]),w=e.ref(-1),S=e.ref([]),M=e.ref(""),A=e.ref(null),_=e.ref("bottom"),m=e.ref({}),b=e.ref([]),C=e.computed(()=>{if(!b.value.length)return[];const f=v.value,y=new Map(f.map(x=>[x.id?.toString(),x]));return b.value.map(x=>y.get(x?.toString())).filter(x=>!!x)}),E=e.computed(()=>n.placeholder||"Select..."),I=e.computed(()=>T(h.value)),W=e.computed(()=>s.value?!b.value.length&&M.value==="":!I.value&&M.value===""),Z=e.computed(()=>o.value?!1:s.value?b.value.length>0:!!r.value),B=f=>s.value?b.value.some(y=>y?.toString()===f?.toString()):r.value?.toString()===f?.toString(),O=e.computed(()=>{let f=v.value??[];if(!n.data&&M.value.trim()!==""){const y=M.value.toLowerCase();f=f.filter(x=>{const j=T(x).toLowerCase(),Q=x.text?.toLowerCase?.()||"";return j.includes(y)||Q.includes(y)})}if(s.value&&b.value.length){const y=new Set(b.value.map(x=>x?.toString()));f=f.filter(x=>!y.has(x.id?.toString()))}return f}),K=e.inject("values"),P=/\{\{\s*([^}]+?)\s*\}\}/g,D=f=>(f?String(f):"").replace(/<[^>]*>/g,"").trim(),F=e.computed(()=>n.slot??n?.optionTemplate??""),N=f=>{if(!f)return"";const y=F.value;return y?y.replace(P,(x,j)=>{const Q=j.trim(),ne=f[Q];return ne!=null?String(ne):""}):f.text??""},T=f=>{if(!f)return"";if(!F.value)return f.text??"";const x=N(f);return D(x)||f.text||""},Y=f=>{n.set&&K?.value&&Object.entries(n.set).forEach(([y,x])=>{if(!y)return;const j=f?f[x]:null;K.value[y]=j??null})},te=e.computed(()=>n.parent?K?.value?.[n.parent]?.toString()??null:null),ie=async f=>{if(!n.data){let y=n.options??[];if(f?.trim()){const x=f.toLowerCase();y=y.filter(j=>{const Q=T(j).toLowerCase(),ne=j.text?.toLowerCase?.()||"";return Q.includes(x)||ne.includes(x)})}return y}try{const y=n.host??"",x=n.prefix??"api",j=n.api??`/${x}/suggest/${n.data}`,Q=`${y}${j}`,ne=new URLSearchParams;return ne.set("json","1"),f&&ne.set("key",f),te.value!==void 0&&te.value!==null&&te.value!==""&&ne.set("parent",te.value),(await fetch(`${Q}?${ne.toString()}`).then(we=>we.json()))?.data??[]}catch{return[]}},$e=async()=>{n.data?v.value=await ie(M.value):v.value=n.options?[...n.options]:[]},He=async f=>{if(f==null)return null;const y=v.value?.find(x=>x?.id?.toString()===String(f));if(y)return y;if(n.data)try{const x=n.host??"",j=n.prefix??"api",Q=n.api??`/${j}/suggest/${n.data}`,ne=`${x}${Q}`,ce=new URLSearchParams;return ce.set("json","1"),ce.set("val",String(f)),te.value!==void 0&&te.value!==null&&te.value!==""&&ce.set("parent",te.value),((await fetch(`${ne}?${ce.toString()}`).then(Ie=>Ie.json()))?.data??[])?.[0]??null}catch{return null}return null},lt=async f=>{const y=new Set(v.value.map(j=>j.id?.toString())),x=f.filter(j=>!y.has(j?.toString()));x.length&&await x.reduce(async(j,Q)=>{await j;const ne=await He(Q);ne&&v.value.push(ne)},Promise.resolve())},Ae=async()=>{o.value||(p.value=!0,await $e(),await e.nextTick(()=>{he(),A.value?.focus(),O.value.length?w.value=0:w.value=-1}))},ke=()=>{p.value=!1,w.value=-1},Ee=async f=>{if(o.value)return;!p.value?await Ae():ke()},k=async()=>{p.value?A.value?.focus():await Ae()},V=()=>{s.value?(b.value=[],r.value=[],l("change",[])):(h.value=null,r.value=null,l("change",null)),Y(null),M.value="",e.nextTick(()=>A.value?.focus())},G=f=>{s.value&&(b.value=b.value.filter(y=>y?.toString()!==f?.toString()),r.value=[...b.value],l("change",r.value),e.nextTick(()=>A.value?.focus()))},R=f=>{s.value?(B(f.id)||(b.value=[...b.value,f.id],r.value=[...b.value],l("change",r.value)),M.value="",e.nextTick(()=>{A.value?.focus(),w.value=Math.min(w.value,O.value.length-1)}),Y(null)):(h.value=f,r.value=f.id,l("change",r.value),M.value="",ke(),Y(f))},X=f=>{B(f.id)||R(f)},J=(f,y)=>{if(!f||!y)return;const x=f.offsetTop,j=x+f.offsetHeight,Q=y.scrollTop,ne=Q+y.clientHeight;let ce=y.scrollTop;x<Q?ce=x-80:j>ne&&(ce=j-y.clientHeight+4);const we=y;we.scrollTop=ce},me=f=>{let y=f.parentElement;for(;y;){if(y.classList.contains("ui-dialog__content"))return y;const x=window.getComputedStyle(y),j=x.overflow+x.overflowY+x.overflowX;if(j.includes("auto")||j.includes("scroll")||y===document.body||y===document.documentElement)return y;y=y.parentElement}return document.body},he=()=>{if(!c.value)return;const f=c.value.getBoundingClientRect(),y=window.innerHeight||document.documentElement.clientHeight,x=window.innerWidth||document.documentElement.clientWidth,j=8,Q=8,ne=n.maxHeight||300,ce=y-f.bottom-Q-j,we=f.top-Q-j,De=ce>=we,Ie=Math.max(x-j*2,0);let{width:Te}=f;Ie>0&&Te>Ie&&(Te=Ie);let{left:Le}=f;Le+Te+j>x&&(Le=x-Te-j),Le=Math.max(Le,j);const Li=Math.min(ne,Math.max(De?ce:we,50));_.value=De?"bottom":"top",m.value={position:"fixed",left:`${Le}px`,width:`${Te}px`,minWidth:"300px",maxHeight:`${Li}px`,transform:De?"none":"translateY(-100%)",top:De?`${f.bottom+Q}px`:`${f.top-Q}px`}},xe=async f=>{o.value||!p.value&&(f.key==="ArrowDown"||f.key==="ArrowUp")&&(f.preventDefault(),await Ae())},ye=f=>{if(!p.value)return;const{key:y}=f;if(y==="ArrowDown")f.preventDefault(),w.value+1<O.value.length&&(w.value+=1,J(S.value[w.value],d.value));else if(y==="ArrowUp")f.preventDefault(),w.value>0&&(w.value-=1,J(S.value[w.value],d.value));else if(y==="Enter"){f.preventDefault();const x=O.value[w.value];x&&R(x),A.value?.blur()}else y==="Escape"?(f.preventDefault(),ke()):y==="Backspace"?s.value&&M.value===""&&b.value.length&&(b.value=b.value.slice(0,-1),r.value=[...b.value],l("change",r.value)):y==="Home"?(w.value=0,J(S.value[0],d.value)):y==="End"?(w.value=O.value.length-1,J(S.value[w.value],d.value)):y==="Tab"&&ke()},Zt=()=>{o.value||(g.value=!0)},Wt=()=>{g.value=!1,M.value=""},Yt=f=>{f.key==="Escape"&&p.value&&ke()},Jt=f=>{const y=f.target;i.value?.contains(y)||u.value?.contains(y)||ke()},Xt=f=>{p.value&&d.value&&!d.value.contains(f.target)&&he()},Qt=()=>{p.value&&he()},en=()=>{p.value&&he()};e.watch(()=>n.options,f=>{f?.length&&(v.value=[...f],Ge())},{immediate:!0});async function Ge(){if(s.value)Array.isArray(r.value)?b.value=[...r.value]:(b.value=r.value==null?[]:[r.value],r.value=[...b.value]),n.data&&b.value.length&&(await lt(b.value),await e.nextTick());else{if(Array.isArray(r.value)){const f=r.value[0]??null;r.value=f??null}r.value!=null&&(h.value=await He(r.value)),Y(h.value??null)}}e.watch(r,()=>{Ge()}),e.onMounted(async()=>{addEventListener("keydown",Yt),addEventListener("scroll",Xt,!0),addEventListener("resize",Qt),document.addEventListener("click",Jt,!0),c.value&&me(c.value).addEventListener("scroll",en,!0),n.options?.length&&!n.data?v.value=[...n.options]:n.data&&(v.value=await ie("")),await Ge(),ln.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Yt),removeEventListener("scroll",Xt,!0),removeEventListener("resize",Qt),document.removeEventListener("click",Jt,!0),c.value&&me(c.value).removeEventListener("scroll",en,!0)});const qe=e.ref(!1),st=e.ref({}),tn=e.ref([]),nn=e.ref(null);async function Ai(){if(!n.add?.token||nn?.value.validate())return;const y=n.add.api??`/api/table/${n.add.token}`,{id:x}=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(st.value)}).then(j=>j.json());if(!n.options?.length&&n.data){const{data:j}=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${x}`).then(Q=>Q.json());h.value=j[0],v.value.push(j[0]),r.value=x}qe.value=!1,ee.notify({title:"Success!",message:"Object created."})}async function Di(){if(!n.add)return null;const f=await fetch(`/api/template/form/${n.add.form}`).then(y=>y.json());return tn.value=f.schema,qe.value=!0,null}function Ii(f,y=200){let x;return(...j)=>{x&&clearTimeout(x),x=window.setTimeout(()=>f(...j),y)}}const Ti=Ii(async f=>{v.value=await ie(f)},200);e.watch(M,f=>{n.data&&Ti(f.trim())}),e.watch(()=>n.options,f=>{!n.data&&f?.length&&(v.value=[...f],Ge())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&$e()});const ln=e.ref(!0);return e.watch(te,async()=>{n.data&&(ln.value||(s.value?(b.value=[],r.value=[],l("change",[])):(h.value=null,r.value=null,l("change",null))),await $e())}),(f,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ee.VsModal),{visible:qe.value,"onUpdate:visible":y[1]||(y[1]=x=>qe.value=x),title:"Додати",buttonText:"Додати",onDone:Ai,teleport:f.teleport},{default:e.withCtx(()=>[e.createVNode(be,{schema:tn.value,modelValue:st.value,"onUpdate:modelValue":y[0]||(y[0]=x=>st.value=x),ref_key:"addForm",ref:nn},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:y[5]||(y[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[y[10]||(y[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),y[11]||(y[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",p.value||g.value?"border-blue-500 ring-1 ring-blue-500":"",o.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":p.value,"aria-haspopup":"listbox",onKeydown:xe,onClick:k,"data-focus":p.value||g.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},[s.value?(e.openBlock(),e.createElementBlock("div",no,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,x=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:x.id},[e.createElementVNode("div",lo,[x?.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:x?.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:T(x)},[F.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:N(x)},null,8,oo)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(x.text),1)],64))],8,so)]),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=>G(x.id),["stop"])},y[6]||(y[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,ao)]))),128)),e.createElementVNode("div",ro,[!o.value&&f.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:A,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:b.value.length?" ":E.value,"onUpdate:modelValue":y[2]||(y[2]=x=>M.value=x),onFocus:Zt,onBlur:Wt,onKeydown:ye},null,40,io)),[[e.vModelText,M.value]]):e.createCommentVNode("",!0)])])):!s.value&&!g.value&&I.value&&M.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:I.value},[h.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:h.value?.color})},null,4)):e.createCommentVNode("",!0),F.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":h.value?.color}),innerHTML:N(h.value)},null,10,uo)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":h.value?.color})},e.toDisplayString(h.value?.text),3))],8,co)):e.createCommentVNode("",!0),W.value?(e.openBlock(),e.createElementBlock("div",po,e.toDisplayString(E.value),1)):e.createCommentVNode("",!0),s.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ho,[!o.value&&f.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:A,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:g.value&&!M.value?.length&&I.value||" ","onUpdate:modelValue":y[3]||(y[3]=x=>M.value=x),onFocus:Zt,onBlur:Wt,onKeydown:ye},null,40,mo)),[[e.vModelText,M.value]]):e.createCommentVNode("",!0)]))],512),e.createElementVNode("div",fo,[Z.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:o.value,onClick:e.withModifiers(V,["stop"])},y[7]||(y[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,go)):e.createCommentVNode("",!0),y[9]||(y[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:o.value,onClick:y[4]||(y[4]=e.withModifiers(x=>Ee(),["stop"])),title:p.value?"Закрити список":"Відкрити список"},y[8]||(y[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,ko)])],42,to),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,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(m.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:m.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[O.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(O.value,(x,j)=>(e.openBlock(),e.createElementBlock("div",{key:x.id,ref_for:!0,ref:Q=>S.value[j]=Q,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",B(x.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",w.value===j&&!B(x.id)?"bg-blue-100":""]),"aria-disabled":B(x.id)?"true":"false",role:"option",tabindex:"-1",onClick:Q=>X(x)},[x?.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:x?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",w.value===x.id?"text-white":"",(w.value===j,"")])},[F.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:N(x)},null,8,bo)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(x.text),1)],64))],2)],10,yo))),128)):(e.openBlock(),e.createElementBlock("div",xo," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:Di,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:o.value,type:"button"},[e.createVNode(ve,{width:"16",height:"16"}),y[12]||(y[12]=e.createElementVNode("span",null,"Додати",-1))],8,wo)):e.createCommentVNode("",!0)],512)],64))}}),_o=["placeholder","disabled"],bt=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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");return(s,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":o[0]||(o[0]=r=>l.value=r),placeholder:s.placeholder,disabled:s.disabled,row:"2",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,_o)),[[e.vModelText,l.value]])}}),Eo={},Vo={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 vo(a,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:"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 Co=H(Eo,[["render",vo]]),Bo={},So={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 Mo(a,t){return e.openBlock(),e.createElementBlock("svg",So,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 No=H(Bo,[["render",Mo]]),Fo={},$o={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 Ao(a,t){return e.openBlock(),e.createElementBlock("svg",$o,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 Do=H(Fo,[["render",Ao]]),Io={},To={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 Lo(a,t){return e.openBlock(),e.createElementBlock("svg",To,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 Ro=H(Io,[["render",Lo]]),Oo={},zo={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 jo(a,t){return e.openBlock(),e.createElementBlock("svg",zo,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 xt=H(Oo,[["render",jo]]),Uo={},Po={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ho(a,t){return e.openBlock(),e.createElementBlock("svg",Po,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 Go=H(Uo,[["render",Ho]]),qo={},Ko={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 Zo(a,t){return e.openBlock(),e.createElementBlock("svg",Ko,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 Wo=H(qo,[["render",Zo]]),Yo={class:"vs-datatable border rounded-xl w-full flex-grow"},Jo={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},Xo={class:"relative w-full"},Qo={class:"table-wrapper flex gap-2"},ea={class:"vs-popover inline-block text-slate-700"},ta={class:"text-center"},na={class:""},la={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]"},oa={class:"text-sm items-center text-gray-800 flex gap-1"},aa={class:"w-full overflow-x-auto"},ra={class:"w-full table-auto caption-bottom text-sm"},ia={class:"[&_tr]:border-b"},ca={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"},da={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"},ua={key:0,colspan:"100%",class:"text-center"},pa={class:"w-full"},ha={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},ma=["onDragstart","onDragover","onDrop"],fa={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},ga={class:"flex items-center justify-center"},ka={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"},ya={key:0},ba=["src"],xa={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},wa=["innerHTML"],_a={key:2,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"},Ea={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},Va={class:"flex items-center justify-center gap-2"},va=["onClick"],Ca=["onClick"],Ba={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},wt=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(a){const t=a,n=e.useModel(a,"modelValue"),l=e.ref({}),s=e.ref(""),o=e.computed(()=>{if(!s.value)return n.value??[];const D=s.value.toLowerCase();return n.value.filter(F=>t.colModel?.some(N=>{const T=F[N.key];return T?Array.isArray(T)?T.join(", ").toLowerCase().includes(D):String(T).toLowerCase().includes(D):!1}))}),r=e.ref(null),i=e.ref(null),c=e.ref(!1),d=e.ref(null),u=e.ref({top:0,left:0}),p=D=>{r.value=D},g=D=>{i.value=D},h=D=>{if(r.value===null||r.value===D){r.value=null,i.value=null;return}const F=[...n.value],[N]=F.splice(r.value,1);F.splice(D,0,N),n.value=F,r.value=null,i.value=null},v=D=>{const N=D.currentTarget.getBoundingClientRect();u.value={top:N.bottom+window.scrollY,left:N.left+window.scrollX},c.value=!c.value},w=()=>{d.value&&d.value.click()},S=D=>{const F=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],N=D.toLowerCase();return F.some(T=>N.endsWith(T))},M=D=>{const N=D.target.files?.[0];if(!N)return;const T=new FileReader;T.onload=Y=>{try{const te=Y.target?.result;if(typeof te=="string"){const ie=JSON.parse(te);Array.isArray(ie)&&n.value.push(...ie)}}catch(te){console.error("Error parsing file:",te)}},T.readAsText(N)},A=()=>{const D=JSON.stringify(n.value,null,2),F=new Blob([D],{type:"application/json"}),N=URL.createObjectURL(F),T=document.createElement("a");T.href=N,T.download="data.json",T.click(),URL.revokeObjectURL(N)};e.onMounted(async()=>{const D=t.colModel?.filter(F=>F.data);D?.length&&Promise.all(D.map(async F=>{const T=await(await fetch(`/api/suggest/${F.data}`)).json();l.value[F.key]=T.data}))});const _=e.ref(""),m=e.ref(!1);let b="edit",C=0;const E=e.ref({}),I=e.ref({});async function W(){_.value="Додати",m.value=!0,b="add",E.value={}}function Z(D,F){const N=F.key||F.name;return l.value[N]&&D[N]?l.value[N].find(T=>T.id.toString()===D[N].toString())?.text??D[N]:D[N]||"-"}async function B(D,F){_.value="Редагувати",m.value=!0,b="edit",C=F,E.value={...D}}function O(){const D=I.value.validate();if(D){ee.notify({type:"warning",title:"Помилка валідації",message:Object.entries(D).map(([F,N])=>`${F}: ${N}`).join(`
|
|
2
|
-
`)});return}b==="add"?Array.isArray(n.value)?n.value=[...n.value,E.value]:n.value=[E.value]:n.value=n.value.map((F,N)=>N===C?E.value:F),m.value=!1}function K(D){n.value=n.value.filter((F,N)=>N!==D)}function P(){m.value=!1}return(D,F)=>(e.openBlock(),e.createElementBlock("div",Yo,[e.createElementVNode("div",Jo,[e.createElementVNode("div",Xo,[e.createVNode(Co,{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":F[0]||(F[0]=N=>s.value=N),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,s.value]])]),e.createElementVNode("div",Qo,[e.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:M,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",ea,[e.createElementVNode("div",ta,[e.createElementVNode("div",na,[e.createElementVNode("button",{onClick:v,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(No,{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:u.value.top+"px",left:u.value.left+"px"}])},[e.createElementVNode("div",la,[e.createElementVNode("div",sa,[e.createElementVNode("button",{onClick:w,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(Do,{class:"text-black",width:"14",height:"14"}),F[4]||(F[4]=e.createTextVNode(" Імпортувати ",-1))]),e.createElementVNode("button",{onClick:A,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createElementVNode("span",oa,[e.createVNode(Ro,{class:"text-black",width:"14",height:"14"}),F[5]||(F[5]=e.createTextVNode(" Експортувати ",-1))])])])])],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(ve),F[6]||(F[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",aa,[e.createElementVNode("table",ra,[e.createElementVNode("thead",ia,[e.createElementVNode("tr",ca,[e.createElementVNode("th",da,[e.createVNode(xt,{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,N=>(e.openBlock(),e.createElementBlock("th",{key:N.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(N.ua||N.label),1))),128)),F[7]||(F[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})},[o.value.length===0?(e.openBlock(),e.createElementBlock("td",ua,[e.createElementVNode("div",pa,[e.createElementVNode("div",ha,[e.createVNode(Go,{class:"w-48 mx-auto"}),F[8]||(F[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(o.value,(N,T)=>(e.openBlock(),e.createElementBlock("tr",{key:N.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":r.value===T,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===T}]),draggable:"true",onDragstart:Y=>p(T),onDragover:e.withModifiers(Y=>g(T),["prevent"]),onDrop:Y=>h(T)},[e.createElementVNode("td",fa,[e.createElementVNode("div",ga,[e.createVNode(xt,{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,Y=>(e.openBlock(),e.createElementBlock("td",{key:Y.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[Y.type==="file"?(e.openBlock(),e.createElementBlock("div",ka,[S(Z(N,Y))?(e.openBlock(),e.createElementBlock("div",ya,[e.createElementVNode("img",{src:Z(N,Y),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,ba)])):(e.openBlock(),e.createElementBlock("div",xa,[e.createVNode(pt,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):Y.type==="tiptap-editor"?(e.openBlock(),e.createElementBlock("div",{key:1,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",innerHTML:Z(N,Y)},null,8,wa)):(e.openBlock(),e.createElementBlock("div",_a,e.toDisplayString(Z(N,Y)),1))]))),128)),e.createElementVNode("td",Ea,[e.createElementVNode("div",Va,[e.createElementVNode("button",{onClick:Y=>B(N,T),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(Wo,{width:"24",height:"24",class:"w-3 h-3"})],8,va),e.createElementVNode("button",{onClick:Y=>K(T),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(Re,{width:"24",height:"24",class:"w-3 h-3"})],8,Ca)])])],42,ma))),128))],2)])]),e.createVNode(e.unref(ee.VsModal),{teleport:"#modal",visible:m.value,title:_.value,size:"lg",onClose:P},{default:e.withCtx(()=>[e.createVNode(be,{schema:t.colModel,values:E.value,"onUpdate:values":F[1]||(F[1]=N=>E.value=N),form:I.value,"onUpdate:form":F[2]||(F[2]=N=>I.value=N)},null,8,["schema","values","form"]),e.createElementVNode("div",Ba,[e.createElementVNode("button",{type:"button",onClick:F[3]||(F[3]=N=>m.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:O,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"])]))}}),Sa={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 Ce(a){return a?a.type==="Polygon"?{type:"MultiPolygon",coordinates:[a.coordinates]}:a.type==="Feature"?{...a,geometry:Ce(a.geometry)}:a.type==="FeatureCollection"?{...a,features:(a.features||[]).map(t=>Ce(t)).filter(Boolean)}:a:null}function Ma(a){return a?a.type==="FeatureCollection"||a.type==="Feature"?Ce(a):a.geom?{type:"Feature",geometry:Ce({type:a.geom.type,coordinates:a.geom.coordinates}),properties:{}}:a.type&&a.coordinates?{type:"Feature",geometry:Ce(a),properties:{}}:null:null}const Na={},Fa={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 $a(a,t){return e.openBlock(),e.createElementBlock("svg",Fa,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 Aa=H(Na,[["render",$a]]),Da={},Ia={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 Ta(a,t){return e.openBlock(),e.createElementBlock("svg",Ia,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 La=H(Da,[["render",Ta]]),Ra={},Oa={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 za(a,t){return e.openBlock(),e.createElementBlock("svg",Oa,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 ja=H(Ra,[["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-topology-ring-3"};function Ha(a,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="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 Ga=H(Ua,[["render",Ha]]),qa={},Ka={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 Za(a,t){return e.openBlock(),e.createElementBlock("svg",Ka,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 Wa=H(qa,[["render",Za]]),Ya={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Ja={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"},Xa=["onClick"],Qa={class:"relative flex-1 min-w-[140px]"},er=["placeholder"],tr="https://data.softpro.ua/api-user/gis-url-proxy",nr="https://geo.rv.ua/api-user/dzk.api",lr=H(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(a,{emit:t}){const n=a,l=t,s=["here","xy","parcel"],o=e.computed(()=>{const m=n.config?.tools?.filter(b=>s.includes(b));return m&&m.length?m:s}),r=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(o.value[0]??s[0]);e.watch(o,m=>{m.includes(i.value)||(i.value=m[0])});const c=e.ref(""),d=e.ref(!1),u=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function p(m){i.value=m}function g(m){if(!d.value)return;const b=u.value;b&&!b.contains(m.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",g,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",g,!0)});function h(m){return m==="xy"?"Координати":m==="parcel"?"Кадастр":"Адреси"}function v(m){const b=m.replace(/[,]+/g," ").trim();if(!b)return null;const C=b.split(/\s+/).filter(Boolean);if(C.length<2)return null;const E=C.slice(0,2).map(Number);if(!E.every(P=>Number.isFinite(P)))return null;let[I,W]=E,Z=I,B=W;const O=P=>Math.abs(P)<=90,K=P=>Math.abs(P)<=180;if(!O(Z)||!K(B))if(O(B)&&K(Z))Z=W,B=I;else return null;return{lat:Z,lng:B}}function w(m){return(m?.items||[]).map((C,E)=>({id:String(C?.id??E),title:C?.title||C?.address?.label||"Знайдений обʼєкт",lat:Number(C?.position?.lat),lng:Number(C?.position?.lng)})).filter(C=>Number.isFinite(C.lat)&&Number.isFinite(C.lng))}function S(m){const b=m?.result||m?.data||m;if(!b)return[];const C=b.geom_centroid;if(!C||!Array.isArray(C.coordinates))return[];const[E,I]=C.coordinates;return!Number.isFinite(I)||!Number.isFinite(E)?[]:[{id:"parcel",title:b.cadnum||b.cad_num||"Земельна ділянка",lat:I,lng:E}]}function M(m){const C=m.replace(/\s+/g,"").split(":");if(C.length!==4)return!1;const E=[10,2,3,4];return C.every((I,W)=>I.length===E[W]&&/^\d+$/.test(I))}function A(m){l("goToCoordinates",[m.lat,m.lng])}async function _(){const m=c.value.trim();if(m){if(i.value==="xy"){const b=v(m);if(!b){ee.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}A(b),c.value="";return}try{const b=new URL(i.value==="here"?tr:nr);if(i.value==="here")b.searchParams.set("searchtext",m);else{if(!M(m)){ee.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}b.searchParams.set("cad_num",m)}const C=await fetch(b.toString());if(!C.ok)throw new Error(`HTTP ${C.status}`);const E=await C.json(),I=i.value==="here"?w(E):S(E);if(!I.length)ee.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const W=I[0];A(W),c.value=""}}catch(b){const C=b?.message||"Помилка пошуку";ee.notify({type:"error",title:"Пошук",message:C})}}}return(m,b)=>(e.openBlock(),e.createElementBlock("div",Ya,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(_,["prevent"])},[o.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,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:b[0]||(b[0]=C=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(h(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"},b[2]||(b[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",Ja,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,C=>(e.openBlock(),e.createElementBlock("li",{key:C,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:E=>p(C)},e.toDisplayString(h(C)),9,Xa))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Qa,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":b[1]||(b[1]=C=>c.value=C),placeholder:r.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,er),[[e.vModelText,c.value,void 0,{trim:!0}]]),b[3]||(b[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"},or={class:"flex gap-2"},ar=["onClick","title"],rr=["src"],ir=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(a,{emit:t}){const n=a,l=e.ref(Object.keys(n.basemaps)[0]),s=t;function o(r){s("onLayerChange",r),l.value=r}return(r,i)=>(e.openBlock(),e.createElementBlock("div",sr,[e.createElementVNode("div",or,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.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":l.value===d}]),onClick:u=>o(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,rr)],10,ar))),128))])]))}}),cr={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},dr={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},ur={class:"text-sm font-medium"},pr={class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},hr={class:"form-geom__panel flex gap-1 items-start mt-2"},mr={class:"flex items-center gap-1"},fr=["disabled"],gr={class:"absolute top-4 right-4 z-[1000]"},kr={class:"flex flex-col gap-[2px]"},yr=["aria-pressed"],br=["aria-pressed"],xr=["aria-pressed"],wr=["aria-pressed"],_r={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"},Er={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Vr={class:"mr-auto"},vr={class:"font-bold"},Cr={class:"flex items-center"},Br={class:"text-xs mr-2"},Sr={key:0,class:"text-xs"},Mr={key:1,class:"text-xs"},_t=H(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},geomType:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(a,{emit:t}){const n=e.getCurrentInstance(),l=a,s=t,o=e.computed(()=>l.geomType?l.geomType.map(k=>k.toLowerCase()).filter(k=>["marker","polyline","polygon","rectangle"].includes(k)):["marker","polyline","polygon","rectangle"]),r=e.ref(!1),i=e.ref("");function c(){const k=navigator.platform.toUpperCase().indexOf("MAC")>=0;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}const d=e.ref(null);let u,p,g,h=null;const v=e.ref(null),w=k=>{k.ctrlKey&&k.preventDefault()};function S(){if(!l.handleZoom)return null;let k;const V=R=>{const X=R.ctrlKey||R.metaKey,J=R.shiftKey;if(!X&&!J){r.value=!0,i.value=c(),clearTimeout(k),k=window.setTimeout(()=>{r.value=!1},1e3);return}r.value=!1,u.scrollWheelZoom.enable(),setTimeout(()=>{u.scrollWheelZoom.disable()},100)},G=R=>{if(R.touches.length===1){r.value=!0,i.value=c(),clearTimeout(k),k=window.setTimeout(()=>{r.value=!1},3e3);return}r.value=!1};return d.value&&(d.value.addEventListener("wheel",V,{passive:!1}),d.value.addEventListener("touchstart",G,{passive:!0})),u&&u.on("wheel",R=>{const X=R.originalEvent.ctrlKey||R.originalEvent.metaKey,J=R.originalEvent.shiftKey;!X&&!J&&(R.originalEvent.preventDefault(),R.originalEvent.stopPropagation())}),()=>{d.value&&(d.value.removeEventListener("wheel",V),d.value.removeEventListener("touchstart",G)),u&&u.off("wheel"),clearTimeout(k)}}const M=e.ref(null),A=e.ref(6),_=e.ref(0),m=e.ref(n?.appContext.config.globalProperties.$settings?.center||[50,30]),b=e.ref(null),C=ke();let E;const I=e.ref("topo100");function W(k){return k?k.type==="Polygon"?{type:"MultiPolygon",coordinates:[k.coordinates]}:(k.type==="MultiPolygon",k):null}function Z(){return new Promise((k,V)=>{window.L&&window.L.Draw&&k(0);const G=X=>{if(Array.from(document.styleSheets).some(he=>he?.href?.includes(X)))return;const me=document.createElement("link");me.rel="stylesheet",me.href=X,document.head.appendChild(me)},R=X=>new Promise((J,me)=>{const he=Array.from(document.scripts).find(ye=>ye.src===X);if(he){he.addEventListener("load",()=>J()),he.addEventListener("error",ye=>me(ye));return}const xe=document.createElement("script");xe.src=X,xe.async=!0,xe.onload=()=>J(),xe.onerror=ye=>me(ye),document.body.appendChild(xe)});G("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),G("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),R("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>R("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")).then(()=>k(0)).catch(V)})}function B(){const k=p.toGeoJSON(),V=[];let G=null;const R=J=>{if(J)switch(J.type){case"Point":G=J;break;case"Polygon":V.push(J.coordinates);break;case"MultiPolygon":V.push(...J.coordinates);break;case"GeometryCollection":(J.geometries||[]).forEach(R);break}};(k?.features||[]).forEach(J=>R(J.geometry));const X=G||(V.length?{type:"MultiPolygon",coordinates:V}:null);s("update:modelValue",X?W(X):null),_.value=p.getLayers().length}function O(k=30){const V=p.getLayers();if(!V.length)return;const R=L.featureGroup(V).getBounds();R&&R.isValid()&&u.fitBounds(R,{padding:[k,k]})}function K(){v.value?.click()}const P=e.ref("");function D(k){return k instanceof L.Circle?"Circle":k instanceof L.Rectangle?"Rectangle":k instanceof L.Polygon&&!(k instanceof L.Rectangle)?"Polygon":k instanceof L.Polyline&&!(k instanceof L.Polygon)?"Polyline":k instanceof L.Marker?"Point":"Feature"}function F(k){if(k instanceof L.Circle){const V=k.getRadius();return Math.PI*(V*V)/1e6}if(k instanceof L.Polygon||k instanceof L.Rectangle)try{const V=k.getLatLngs(),G=Array.isArray(V[0])?V[0]:V,R=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(G):0;return R?R/1e6:0}catch{return null}return null}function N(k){return k instanceof L.Circle?k.getLatLng():k.getBounds?k.getBounds().getCenter():k.getLatLng?k.getLatLng():u.getCenter()}function T(){const k=p.getLayers();if(!k.length){b.value=null,_.value=0;return}const V=k[k.length-1],G=D(V),R=N(V),X=F(V);b.value={type:G,center:R,areaKm2:X,layer:V},_.value=k.length}function Y(){const k=b.value?.layer;k&&(k instanceof L.Circle&&k.getBounds?u.fitBounds(k.getBounds(),{padding:[30,30]}):k.getBounds?u.fitBounds(k.getBounds(),{padding:[30,30]}):k.getLatLng&&u.setView(k.getLatLng(),Math.max(A.value,14)))}function te(){const k=b.value?.layer;k&&(p.removeLayer(k),B(),T())}e.onMounted(async()=>{document.addEventListener("wheel",w,{passive:!1}),await Z(),L.drawLocal=Sa;const k=l.handleZoom;u=L.map(d.value,{zoomControl:!1,scrollWheelZoom:!k}).setView(m.value,10),setTimeout(()=>{h=S()},100),L.control.zoom({position:"bottomright"}).addTo(u),I.value=Object.keys(C)[0],E=L.tileLayer(C[I.value].url,{maxZoom:19,minZoom:6}).addTo(u),p=new L.FeatureGroup().addTo(u),u.on(L.Draw.Event.CREATED,R=>{const{layer:X}=R;p.clearLayers(),p.addLayer(X),B(),T(),O(),P.value=""}),u.on(L.Draw.Event.EDITED,()=>{B(),T(),O()}),u.on(L.Draw.Event.DELETED,()=>{B(),T(),O()});let V=!1;u.on("mousemove",R=>{V||(u.invalidateSize(),V=!0),M.value=R.latlng}),u.on("zoomend",()=>{A.value=u.getZoom()});const G=Ma(l.modelValue);if(G){const R=[];L.geoJSON(G).eachLayer(X=>R.push(X)),R.length&&p.addLayer(R[0]),B(),T(),O()}}),e.onUnmounted(()=>{document.removeEventListener("wheel",w),h&&h()});function ie(k){if(u){switch(g&&g.disable(),k){case"marker":g=new L.Draw.Marker(u);break;case"polyline":g=new L.Draw.Polyline(u);break;case"polygon":g=new L.Draw.Polygon(u);break;case"rectangle":g=new L.Draw.Rectangle(u);break;default:g=new L.Draw.Rectangle(u);break}g&&(g.enable(),P.value=k)}}function $e(){const k=p.toGeoJSON(),V=new Blob([JSON.stringify(k,null,2)],{type:"application/json"}),G=URL.createObjectURL(V),R=document.createElement("a");R.href=G,R.download="data.geojson",R.click(),URL.revokeObjectURL(G)}function He(k){const V=k.target,G=V.files?.[0];if(!G)return;const R=new FileReader;R.onload=()=>{if(typeof R.result=="string")try{const X=JSON.parse(R.result);p.clearLayers(),X&&L.geoJSON({type:"Feature",geometry:X}).eachLayer(J=>{p.addLayer(J)}),B(),T(),O()}finally{V.value=""}},R.readAsText(G)}function lt(k){u&&(E&&u.removeLayer(E),E=L.tileLayer(C[k].url,{maxZoom:19,minZoom:6}).addTo(u),I.value=k)}function Ae(k){const V=L.latLng(k[0],k[1]);u.setView(V,13)}e.watch(()=>l.modelValue,k=>{const V=W(k);if(k&&V!==k){s("update:modelValue",V);return}p.clearLayers(),V&&L.geoJSON({type:"Feature",geometry:V}).eachLayer(G=>{p.addLayer(G),G.dragging?.enable(),G.dragging?.enabled(),G.on("dragend",R=>{const J=R.target.getLatLng();s("update:modelValue",{type:"Point",coordinates:[J.lng,J.lat]})})}),_.value=p.getLayers().length,T(),O()});function ke(){return n?.appContext.config.globalProperties.$settings?.basemaps?n?.appContext.config.globalProperties.$settings?.basemaps.map((k,V)=>Object.assign(k,{key:`b${V}`,preview:k.preview||k.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((k,V)=>({...k,[V.key]:V}),{}):{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 Ee=e.ref(!1);return e.watch(Ee,()=>{setTimeout(()=>{u.invalidateSize()},50)}),(k,V)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:Ee.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:d,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(()=>[r.value&&l.handleZoom?(e.openBlock(),e.createElementBlock("div",cr,[e.createElementVNode("div",dr,[e.createElementVNode("p",ur,e.toDisplayString(i.value),1)])])):e.createCommentVNode("",!0)]),_:1}),e.createElementVNode("div",pr,[e.createVNode(lr,{onGoToCoordinates:Ae}),e.createElementVNode("div",hr,[e.createElementVNode("div",mr,[e.createElementVNode("button",{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 hover:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:ring-offset-1 transition",onClick:K},"Import"),e.createElementVNode("button",{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 hover:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:ring-offset-1 transition disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 disabled:border-gray-200 disabled:hover:bg-gray-100 disabled:hover:text-gray-400",onClick:$e,disabled:_.value===0},"Export",8,fr)]),e.createElementVNode("input",{ref_key:"importRef",ref:v,type:"file",onChange:He,accept:".json,.geojson",class:"hidden"},null,544)])]),e.createElementVNode("div",gr,[e.createElementVNode("div",kr,[o.value.includes("marker")?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":P.value==="marker"}]),"aria-pressed":P.value==="marker",title:"Point (P)","aria-label":"Draw point",onClick:V[0]||(V[0]=G=>ie("marker"))},[e.createVNode(Aa)],10,yr)):e.createCommentVNode("",!0),o.value.includes("polyline")?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":P.value==="polyline"}]),"aria-pressed":P.value==="polyline",title:"Line (L)","aria-label":"Draw polyline",onClick:V[1]||(V[1]=G=>ie("polyline"))},[e.createVNode(La)],10,br)):e.createCommentVNode("",!0),o.value.includes("polygon")?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":P.value==="polygon"}]),"aria-pressed":P.value==="polygon",title:"Polygon (G)","aria-label":"Draw polygon",onClick:V[2]||(V[2]=G=>ie("polygon"))},[e.createVNode(ja)],10,xr)):e.createCommentVNode("",!0),o.value.includes("rectangle")?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":P.value==="rectangle"}]),"aria-pressed":P.value==="rectangle",title:"Rectangle (R)","aria-label":"Draw rectangle",onClick:V[3]||(V[3]=G=>ie("rectangle"))},[e.createVNode(Ga)],10,wr)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:V[4]||(V[4]=G=>{Ee.value=!Ee.value}),title:"Full Screen","aria-label":"Full Screen"},[e.createVNode(Wa,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",b.value?"bottom-8":"bottom-4"])},[e.createVNode(ir,{basemaps:e.unref(C),onOnLayerChange:lt},null,8,["basemaps"])],2),e.createElementVNode("div",_r,[b.value?(e.openBlock(),e.createElementBlock("div",Er,[e.createElementVNode("div",Vr,[V[7]||(V[7]=e.createTextVNode(" Тип: ",-1)),e.createElementVNode("span",vr,e.toDisplayString(b.value.type),1)]),e.createElementVNode("div",Cr,[e.createElementVNode("div",Br,[V[8]||(V[8]=e.createTextVNode(" Центр: ",-1)),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",Sr,[V[9]||(V[9]=e.createTextVNode(" Площа: ",-1)),e.createElementVNode("b",null,e.toDisplayString(b.value.areaKm2.toFixed(1))+"км²",1)])):(e.openBlock(),e.createElementBlock("div",Mr,V[10]||(V[10]=[e.createTextVNode(" Площа: ",-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:"Наблизити",onClick:V[5]||(V[5]=G=>Y())},V[11]||(V[11]=[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-77633b64><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-77633b64></path><path d="M7 10l6 0" data-v-77633b64></path><path d="M10 7l0 6" data-v-77633b64></path><path d="M21 21l-6 -6" data-v-77633b64></path></svg>',1)])),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:"Видалити",onClick:V[6]||(V[6]=G=>te())},[e.createVNode(Re,{class:"w-3 h-3"})])])])):e.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-77633b64"]]),Nr=["data-focus"],Fr={class:"flex items-center"},$r={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Ar=["onClick","aria-label"],Dr={key:0,class:"absolute text-gray-500 truncate pl-2"},Ir={class:"flex-1 min-w-[2px]"},Tr=["placeholder"],Lr={class:"flex items-center shrink-0"},Rr=["disabled"],Et=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(a,{emit:t}){const n=a,l=t;ae(n.style);const s=e.ref(null),o=e.ref(null),r=e.ref(null),i=e.ref(!1),c=e.ref(""),d=e.useModel(a,"modelValue"),u=e.computed(()=>n.placeholder||"Add tag…"),p=e.computed(()=>d.value?.length===0&&c.value===""),g=e.computed(()=>!n.disabled&&d.value?.length>0),h=e.computed(()=>n.disabled),v=async()=>{h.value||await e.nextTick(()=>r.value?.focus())},w=C=>{const E=C.trim();E!==""&&(!d.value||!Array.isArray(d.value)?d.value=[E]:n.unique?d.value.includes(E)||(d.value=[...d.value,E]):d.value=[...d.value,E],c.value="")},S=()=>{const C=c.value;C.trim()!==""&&w(C),c.value=""},M=C=>{const E=d.value.slice();E.splice(C,1),l("update:modelValue",E)},A=()=>{l("update:modelValue",[])},_=()=>{h.value||(i.value=!0)},m=()=>{i.value=!1,!h.value&&S()},b=C=>{const{key:E}=C;E==="Enter"?(C.preventDefault(),S()):E==="Backspace"&&c.value===""&&d.value.length>0&&M(d.value.length-1)};return(C,E)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:s,onClick:E[1]||(E[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.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":"",h.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:v},[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:o},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(I,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",Fr,[e.createElementVNode("div",$r,e.toDisplayString(I),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(Z=>M(W),["stop"]),"aria-label":`Remove ${I}`},E[2]||(E[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,Ar)]))),128)),p.value?(e.openBlock(),e.createElementBlock("div",Dr,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Ir,[h.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:r,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":E[0]||(E[0]=I=>c.value=I),onFocus:_,onBlur:m,onKeydown:b,placeholder:d.value&&d.value.length?"":void 0},null,40,Tr)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",Lr,[g.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:h.value,onClick:e.withModifiers(A,["stop"])},E[3]||(E[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,Rr)):e.createCommentVNode("",!0)])],10,Nr)],2)],512))}}),Or={class:"relative flex gap-1 bg-white w-full"},zr=["disabled","placeholder"],Vt=H(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const t=e.inject("values"),n=a,l=e.useModel(a,"modelValue");function s(r){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 r.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const o=()=>{const r=t?.value?.[n.parent||""]?.toString(),i=s(r);l.value=i.toString()};return(r,i)=>(e.openBlock(),e.createElementBlock("div",Or,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:r.disabled,placeholder:r.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>l.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,zr),[[e.vModelText,l.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:o}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),jr={class:"relative flex gap-1 bg-white w-full"},Ur=["disabled","placeholder"],Pr=["disabled"],Hr={key:0},Gr={key:1},vt=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(a){const t=a,n=e.useModel(a,"modelValue"),l=e.ref(!1),s=e.computed(()=>t.init!==!1),o=e.computed(()=>!!t.table&&!!t.code),r=()=>{if(!o.value)return"";const d=encodeURIComponent(String(t.table)),u=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${u}`},i=async()=>{if(!o.value||l.value)return;const d=r();if(d){l.value=!0;try{const p=await(await fetch(d)).text();n.value=p}finally{l.value=!1}}},c=()=>{s.value&&(n.value||i())};return e.onMounted(()=>{c()}),e.watch(()=>[t.table,t.code,t.init],()=>{c()}),(d,u)=>(e.openBlock(),e.createElementBlock("div",jr,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=p=>n.value=p),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,Ur),[[e.vModelText,n.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:l.value||d.disabled||!o.value,onClick:i},[l.value?(e.openBlock(),e.createElementBlock("span",Gr,"...")):(e.openBlock(),e.createElementBlock("span",Hr,"Gen"))],8,Pr)]))}}),[["__scopeId","data-v-6ee5237d"]]),qr={class:"w-full"},Kr={ref:"sortableContainer",class:"flex flex-col gap-1"},Zr=["onDragstart","onDrop"],Wr={class:"w-1/3"},Yr={class:"w-2/3"},Jr=["onClick"],Xr={key:0,class:"text-[14px] text-gray-700"},Qr={class:"mt-2 w-full flex items-center"},ei=["disabled"],Ct=H(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(a,{emit:t}){const n=S=>`${S}-${Math.random().toString(36).substring(2,15)}`,l=e.inject("values"),s=a,o=t,r=s.addButtonText??"Додати",i=s.ignore??[],c=e.ref([]),d=e.ref(null);(()=>{const S=s.parent&&l?.value?.[s.parent]||s.modelValue||{};c.value=Object.entries(S).filter(([M])=>!i.includes(M)).map(([M,A])=>({id:n("key-value-"),key:M,value:A}))})();function p(S){d.value=S}function g(S){if(d.value===null||d.value===S)return;const M=c.value.splice(d.value,1)[0];c.value.splice(S,0,M),d.value=null}const h=e.computed(()=>c.value.some(S=>S.key&&!S.value||!S.key&&S.value)),v=()=>{c.value.push({id:n("key-value-"),key:"",value:""})},w=S=>{c.value=c.value.filter(M=>M.id!==S)};return e.watch(c,S=>{const M={};S.forEach(_=>{_.key&&_.value!==void 0&&(M[_.key]=_.value)});const A={};i.length&&i.forEach(_=>{A[_]=s.parent?l?.value?.[s.parent]?.[_]:void 0}),l?.value&&s.parent&&(l.value[s.parent]={...A,...M}),o("update:modelValue",M)},{deep:!0}),(S,M)=>(e.openBlock(),e.createElementBlock("div",qr,[e.createElementVNode("div",Kr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(A,_)=>(e.openBlock(),e.createElementBlock("div",{key:A.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===_}]),draggable:"true",onDragstart:m=>p(_),onDragover:M[0]||(M[0]=e.withModifiers(()=>{},["prevent"])),onDrop:m=>g(_)},[M[1]||(M[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",Wr,[e.createVNode(Ve,{modelValue:A.key,"onUpdate:modelValue":m=>A.key=m,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Yr,[e.createVNode(Ve,{modelValue:A.value,"onUpdate:modelValue":m=>A.value=m,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:m=>w(A.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(Xn),{height:"16",width:"16"})],8,Jr)],42,Zr))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Xr," Дані для відображення відсутні ")),e.createElementVNode("div",Qr,[e.createElementVNode("button",{type:"button",onClick:v,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(ve,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(r)),1)],8,ei)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),ti={class:"flex items-center gap-2 w-full"},ni=["disabled"],Bt=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(a,{emit:t}){const n=a,{inputClass:l}=ae(n.style),s=t,o=e.computed({get:()=>n.modelValue||"#000000",set:r=>s("update:modelValue",r)});return(r,i)=>(e.openBlock(),e.createElementBlock("div",ti,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),disabled:r.disabled,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[r.modelValue?"":"text-opacity-50",e.unref(l)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,ni),[[e.vModelText,o.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":i[1]||(i[1]=c=>o.value=c)},null,512),[[e.vModelText,o.value]])]))}}),li={class:"flex items-center gap-2 w-full"},si=["min","max","step","disabled"],St=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(a,{emit:t}){const n=a,{inputClass:l}=ae(n.style),s=t,o=e.computed({get:()=>Number(n.modelValue??n.min),set:r=>s("update:modelValue",Number(r))});return(r,i)=>(e.openBlock(),e.createElementBlock("div",li,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),min:r.min,max:r.max,step:r.step,disabled:r.disabled,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[r.modelValue?"":"text-opacity-50",e.unref(l)].join(" ")])},null,10,si),[[e.vModelText,o.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":i[1]||(i[1]=c=>o.value=c)},null,512),[[e.vModelText,o.value]])]))}}),oi=["type","value","onInput","placeholder","disabled"],Mt=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:a=>a.count??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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");e.watchEffect(()=>{const o=l.value?.length??0;o<t.count&&(l.value=[...l.value??[],...Array(t.count-o)])});function s(o,r){const i=o.target.value,c=[...l.value];c[r]=t.inputType==="text"?i:Number(i),l.value=c}return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${o.limit}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.count,i=>(e.openBlock(),e.createElementBlock("input",{type:o.inputType,value:l.value?.[i-1]??"",onInput:c=>s(c,i-1),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,oi))),256))],2))}}),Nt={VsInputText:Ve,VsInputRadio:Ye,"vs-input-text":Ve,"vs-input-password":Bn,"vs-input-textarea":bt,"vs-input-mask":at,"vs-input-number":ot,"vs-input-radio":Ye,"vs-input-select":Je,"vs-input-switcher":Ze,"vs-input-static":We,"vs-input-container":yt,"vs-input-date":ct,"vs-input-checkbox":it,"vs-input-file":ft,"vs-input-html":We,"vs-input-email":rt,"vs-input-datatable":wt,"vs-input-map":_t,"vs-input-file-list":gt,"vs-input-tags":Et,"vs-input-slug":Vt,"vs-input-codegen":vt,"vs-input-key-value":Ct,"vs-input-range":St,"vs-input-color":Bt,"vs-input-native-select":Je,"vs-input-array":Mt},ai=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(a){const t=a,n=e.inject("values");async function l(){try{if(!t.api)return;const s=t.api.replace("{{value}}",t.value),o=await fetch(s);if(!o.ok){ee.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const r=await o.json();if(!t.set||!n)return;for(const[i,c]of Object.entries(t.set))n.value[i]=r.result[c]}catch(s){console.error(t.error,s)}}return(s,o)=>(e.openBlock(),e.createElementBlock("button",{onClick:l,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(s.button),1))}}),ri={class:"flex flex-col gap-1 w-full"},ii={key:0,class:"text-sm text-gray-500"},Ft=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(a){const t=a,n=e.useModel(a,"modelValue"),l=e.computed(()=>vn[`${t.layout}`]),s=e.computed(()=>Nt?.[`vs-input-${t.item.type}`]),o=e.computed(()=>{const i=e.unref(s);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)}),r=e.computed(()=>{const i=t.item??{},c=o.value;return c.size?Object.fromEntries(Object.entries(i).filter(([d])=>c.has(d))):{}});return(i,c)=>e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.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",ri,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value),e.mergeProps(r.value,{modelValue:n.value,"onUpdate:modelValue":c[0]||(c[0]=d=>n.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(ai,e.mergeProps({key:0},i.item.behavior,{value:n.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"])),[[e.vShow,!i.item.hidden]])}}),ci={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},di={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(a,{expose:t}){const n=a,l=e.ref([]),s=e.ref(""),o=e.ref(""),r=e.computed(()=>!!n.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 B=n.width;if(B==null)return{};const O=typeof B=="number"?`${B}px`:`${B}`;return{width:O,minWidth:O}});let d=null,u=0,p=0,g=null,h=null,v=null;const w=()=>W(),S=()=>A();e.watch(()=>n.target,async B=>{if(C(),!B){g=null,l.value=[],s.value="";return}g=B,r.value&&(await e.nextTick(),b(B),A())},{immediate:!0}),e.watch(()=>n.scrollContainer,B=>{if(!r.value){h=B??null;return}M(B??null),e.nextTick(()=>A())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||M(null),A()}),e.onBeforeUnmount(()=>{C(),M(null,!0),g=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),p&&window.cancelAnimationFrame(p))});function M(B,O=!1){if(v&&(v(),v=null),O){h=null;return}if(h=B??null,typeof window>"u")return;const K=B??window,P=window;K.addEventListener("scroll",w,{passive:!0}),P.addEventListener("resize",S),v=()=>{K.removeEventListener("scroll",w),P.removeEventListener("resize",S)}}function A(){if(!r.value||!g)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const B=()=>{_(),u=0};typeof window>"u"?B():u=window.requestAnimationFrame(B)}function _(){if(!r.value||!g)return;const B=Array.from(g.querySelectorAll("h1, h2")),O=new Set,K=[];B.forEach((P,D)=>{const F=P.textContent?.trim()??"";if(!F)return;let N=(P.getAttribute("id")??"").trim();N||(N=m(F)||`heading-${D+1}`);let T=N,Y=1;for(;O.has(T);)T=`${N}-${Y+=1}`;P.id!==T&&Object.assign(P,{id:T}),O.add(T),K.push({id:T,text:F,level:P.tagName.toLowerCase()==="h1"?1:2})}),l.value=K,K.length||(s.value=""),I()}function m(B){return B.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function b(B){!B||!r.value||typeof MutationObserver>"u"||(C(),d=new MutationObserver(()=>A()),d.observe(B,{childList:!0,subtree:!0}))}function C(){d&&(d.disconnect(),d=null)}function E(B){const O=h;if(!O)return typeof window>"u"?B.offsetTop:B.getBoundingClientRect().top+window.scrollY;const K=B.getBoundingClientRect(),P=O.getBoundingClientRect();return K.top-P.top+O.scrollTop}function I(){if(!r.value||!l.value.length)return;const B=h,O=(B?B.scrollTop:null)||(typeof window<"u"?window.scrollY:0),K=(B?B.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),P=O+K;let D=null;for(let N=0;N<l.value.length;N+=1){const T=l.value[N],Y=document.getElementById(T.id);if(Y){const te=E(Y);te+Y.offsetHeight>O&&te<P&&(D=T.id)}}!D&&o.value&&(D=o.value),D&&(o.value=D);const F=B?B.scrollHeight-B.clientHeight:document.documentElement.scrollHeight-window.innerHeight;O+5>=F&&(D=l.value[l.value.length-1].id),D&&(s.value=D)}function W(){r.value&&(p&&window.cancelAnimationFrame(p),p=window.requestAnimationFrame(()=>{I(),p=0}))}function Z(B){if(!r.value)return;const O=document.getElementById(B);if(!O)return;const K=h,P=Math.max(0,E(O));K?K.scrollTo({top:P,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:P,behavior:"smooth"})}return t({refresh:A}),(B,O)=>r.value&&l.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",ci,e.toDisplayString(B.title),1),e.createElementVNode("div",di,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,K=>(e.openBlock(),e.createElementBlock("div",{key:K.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",K.level===2?"vs-compact-form-navigation__item--nested":"",K.id===s.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:P=>Z(K.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",K.level===2?"pl-[15px]":"pl-[18px]",K.id===s.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(K.text),1)],10,ui)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),$t={required:"Це поле є обов’язковим",email:"Неправильний email"},hi=a=>a?!1:$t.required,mi=a=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return a?t.test(a)?!1:$t.email:!1},fi=(a,t)=>{const n=t.pattern??t.regexp;return!(typeof n=="string"?new RegExp(n):n).test(a)&&a?t.message:!1},gi=(a,t)=>!1,ki=(a,t)=>{switch(typeof t=="string"?t:t.type){case"required":return hi(a);case"email":return mi(a);case"regexp":return fi(a,t);case"custom":return gi();default:return!1}},yi={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function At(a){const t=a.toLowerCase();return yi[t]||t}function Xe(a,t=!1){if(Array.isArray(a)){const l=[];return a.forEach(s=>{const o={...s};o.name=(s.name||s.id||s.key||"").toString(),o.type=At(s.type),o.label=s.label||s.ua,o.rules=s.rules||s.validators,o.type==="email"&&!o.rules&&(o.rules=["email"]),s.data&&(o.api=`/api/suggest/${s.data}`),o.disabled=t||o.disabled,Array.isArray(o.schema)&&(o.schema=Xe(o.schema,o.disabled)),l.push(o)}),l}const n=[];return Object.entries(a).forEach(l=>{const s={name:l[0],...l[1],type:At(l[1].type),label:l[1].label||l[1].ua,rules:l[1].rules||l[1].validators,disabled:t};s.type==="email"&&!s.rules&&(s.rules=["email"]),l[1].type.includes("list")&&(s.multiple=!0),!s.api&&l[1].data&&(s.api=`/api/suggest/${l[1].data}`),Array.isArray(s.schema)&&(s.schema=Xe(s.schema,s.disabled)),n.push(s)}),n}function bi(a,t,n=!1){const l=e.computed(()=>Xe((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),s=e.ref({});function o(d){const u=d?.conditions;if(!u)return!0;const p=Array.isArray(u)?u[0]:u,g=a?.value?.[p];return kt(g,u)}const r=(d=l.value,u=!0)=>(d.forEach(p=>{if(p.rules){if(!o(p)){delete s.value[p.name];return}let g=!1,h=null;p.rules.forEach(v=>{const w=ki(a.value[p.name],v);w&&(g=!0,!h&&typeof w=="string"&&(h=w))}),g&&h?s.value[p.name]=h:delete s.value[p.name]}p.schema&&r(p.schema,!1)}),u&&Object.values(s.value).some(Boolean)?s.value:null),i=e.computed(()=>l.value?.filter(d=>o(d)));return{errors:s,validate:r,reset:()=>{a.value={},s.value={}},visibleSchema:i}}const xi={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"},be=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(a,{expose:t,emit:n}){const l=n,s=a,o=e.useModel(a,"form"),r=e.useModel(a,"values"),{errors:i,validate:c,reset:d,visibleSchema:u}=bi(r,s.schema,e.toRef(s,"disabled")),p=e.ref(null),g=e.ref(null),h=e.computed(()=>s.navigation),v=e.computed(()=>s.navWidth),w=e.computed(()=>s.style?.columns),S=Object.freeze({container:12,label:3}),M=e.computed(()=>s.columns??w.value??S),A=e.computed(()=>s.columns!=null||w.value!=null),_=e.computed(()=>A.value?"horizontal":s.layout),m=I=>I?.columns?"horizontal":_.value,b=I=>I?.columns??M.value,C=()=>{l("update:modelValue",r.value),c(),l("handle-submit",r.value)};t({validate:c,reset:d,errors:i}),e.onMounted(()=>{s.modelValue&&(r.value=s.modelValue),o.value={value:r.value,errors:i.value,reset:d,validate:c,formId:s.formId}});function E(I,W){if(I===W)return!0;if(typeof I!="object"||typeof W!="object"||!I||!W)return!1;const Z=Object.keys(I),B=Object.keys(W);return Z.length!==B.length?!1:Z.every(O=>I[O]===W[O])}return e.provide("form",o),e.provide("values",r),(I,W)=>(e.openBlock(),e.createElementBlock("div",xi,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:g},[e.createElementVNode("form",{ref_key:"formRef",ref:p,onSubmit:e.withModifiers(C,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",_.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(u),(Z,B)=>(e.openBlock(),e.createElementBlock("div",{key:Z.name,class:e.normalizeClass(m(Z)==="horizontal"?"col-span-12":`col-span-${Z.col||12}`)},[e.createVNode(Ft,{style:e.normalizeStyle(I.style),item:Z,layout:m(Z),columns:b(Z),"model-value":r.value[Z.name],"onUpdate:modelValue":O=>{const K=r.value[Z.name];E(K,O)||(r.value[Z.name]=O)},error:e.unref(i)[Z.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),m(Z)==="settings"&&B+1!==e.unref(u).length?(e.openBlock(),e.createElementBlock("div",wi)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(pi,{target:p.value,"scroll-container":g.value,enabled:h.value,width:v.value},null,8,["target","scroll-container","enabled","width"])]))}}),_i={class:"relative"},Ei={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},Vi={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"},vi={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Ci={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Bi={class:"p-4 mim-h-0 h-full overflow-auto"},Dt=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(a,{emit:t}){const n=a,l=t,s=e.ref(n.schema),o=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),r=e.ref({}),i=e.ref(),c=e.ref(n.mode);async function d(){const p=r.value.validate();if(p){ee.notify({type:"warning",title:"Помилка валідації",message:Object.entries(p).map(([g,h])=>`${g}: ${h}`).join(`
|
|
3
|
-
`)});return}if(i.value)try{const g=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o.value)});if(g.ok)await g.json(),ee.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),l("save",o.value);else if(g.status===400){const h=await g.json().catch(()=>({}));ee.notify({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else g.status===500?ee.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):ee.notify({type:"error",title:"Помилка",message:`Статус: ${g.status}`})}catch(g){ee.notify({type:"error",title:"Помилка з’єднання",message:g.message||"Не вдалося виконати запит"})}}function u(){l("close")}return e.onMounted(async()=>{try{if(n.form){const p=await fetch(`/api/template/form/${n.form}`);if(!p.ok){ee.notify({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const g=await p.json();s.value=g.schema,i.value=g.token}else if(n.token){i.value=n.token;const p=await fetch(`/api/form/${i.value}`);if(!p.ok){ee.notify({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const g=await p.json();s.value=g.schema,g.data?o.value=g.data:c.value="add"}}catch(p){ee.notify({type:"error",title:"Error",message:p.message||"Unexpected error"}),console.error(p)}}),(p,g)=>(e.openBlock(),e.createElementBlock("div",_i,[e.createElementVNode("div",Ei,[e.createElementVNode("div",Vi,[e.createElementVNode("div",vi,[e.createElementVNode("h3",Ci,e.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:u,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"},g[2]||(g[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",Bi,[s.value?(e.openBlock(),e.createBlock(be,{key:0,schema:s.value,values:o.value,"onUpdate:values":g[0]||(g[0]=h=>o.value=h),form:r.value,"onUpdate:form":g[1]||(g[1]=h=>r.value=h)},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:u,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"}," Зберегти ")])])])]))}}),It=(a={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=ee.modal({title:a.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Dt,contentProps:{...a,onClose:()=>{t(null),n()},onSave:l=>{t(l),n()}}})});be.install=function(t){t.component("VForm",be),Object.assign(t.config.globalProperties,{$form:It}),t.provide("form",It),window.v3plugin||(window.v3plugin={})};function fe(a){return typeof a=="string"||a instanceof String}function Tt(a){var t;return typeof a=="object"&&a!=null&&(a==null||(t=a.constructor)==null?void 0:t.name)==="Object"}function Lt(a,t){return Array.isArray(t)?Lt(a,(n,l)=>t.includes(l)):Object.entries(a).reduce((n,l)=>{let[s,o]=l;return t(o,s)&&(n[s]=o),n},{})}const $={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Rt(a){switch(a){case $.LEFT:return $.FORCE_LEFT;case $.RIGHT:return $.FORCE_RIGHT;default:return a}}function Qe(a){return a.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function ze(a,t){if(t===a)return!0;const n=Array.isArray(t),l=Array.isArray(a);let s;if(n&&l){if(t.length!=a.length)return!1;for(s=0;s<t.length;s++)if(!ze(t[s],a[s]))return!1;return!0}if(n!=l)return!1;if(t&&a&&typeof t=="object"&&typeof a=="object"){const o=t instanceof Date,r=a instanceof Date;if(o&&r)return t.getTime()==a.getTime();if(o!=r)return!1;const i=t instanceof RegExp,c=a instanceof RegExp;if(i&&c)return t.toString()==a.toString();if(i!=c)return!1;const d=Object.keys(t);for(s=0;s<d.length;s++)if(!Object.prototype.hasOwnProperty.call(a,d[s]))return!1;for(s=0;s<d.length;s++)if(!ze(a[d[s]],t[d[s]]))return!1;return!0}else if(t&&a&&typeof t=="function"&&typeof a=="function")return t.toString()===a.toString();return!1}class Si{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?$.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?$.RIGHT:$.LEFT}}function z(a,t){return new z.InputMask(a,t)}function Ot(a){if(a==null)throw new Error("mask property should be defined");return a instanceof RegExp?z.MaskedRegExp:fe(a)?z.MaskedPattern:a===Date?z.MaskedDate:a===Number?z.MaskedNumber:Array.isArray(a)||a===Array?z.MaskedDynamic:z.Masked&&a.prototype instanceof z.Masked?a:z.Masked&&a instanceof z.Masked?a.constructor:a instanceof Function?z.MaskedFunction:(console.warn("Mask not found for mask",a),z.Masked)}function _e(a){if(!a)throw new Error("Options in not defined");if(z.Masked){if(a.prototype instanceof z.Masked)return{mask:a};const{mask:t=void 0,...n}=a instanceof z.Masked?{mask:a}:Tt(a)&&a.mask instanceof z.Masked?a:{};if(t){const l=t.mask;return{...Lt(t,(s,o)=>!o.startsWith("_")),mask:t.constructor,_mask:l,...n}}}return Tt(a)?{...a}:{mask:a}}function de(a){if(z.Masked&&a instanceof z.Masked)return a;const t=_e(a),n=Ot(t.mask);if(!n)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===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}z.createMask=de;class je{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,n){if(!(t==null||n==null||t===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(t,n)}catch{}}get isActive(){return!1}}z.MaskElement=je;const zt=90,Mi=89;class Be extends je{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,n,l;return(t=(n=(l=this.input).getRootNode)==null?void 0:n.call(l))!=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===zt&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===Mi&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===zt&&(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=Be;class jt extends Be{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,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}z.HTMLMaskElement=Be;class et extends Be{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),l=n&&n.anchorOffset,s=n&&n.focusOffset;return s==null||l==null||l<s?l:s}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),l=n&&n.anchorOffset,s=n&&n.focusOffset;return s==null||l==null||l>s?l:s}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const l=this.rootElement.createRange();l.setStart(this.input.firstChild||this.input,t),l.setEnd(this.input.lastChild||this.input,n);const s=this.rootElement,o=s.getSelection&&s.getSelection();o&&(o.removeAllRanges(),o.addRange(l))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}z.HTMLContenteditableMaskElement=et;class Ue{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>Ue.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}}Ue.MAX_LENGTH=100;class Ut{constructor(t,n){this.el=t instanceof je?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new et(t):new jt(t),this.masked=de(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ue,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 n;return t==null||((n=this.masked)==null?void 0:n.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof z.Masked)&&this.masked.constructor===Ot(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof z.Masked?t:de({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}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,n){const l=this._listeners[t];l&&l.forEach(s=>s(n))}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 n=this.masked.unmaskedValue,l=this.masked.value,s=this.masked.rawInputValue,o=this.displayValue,r=this.unmaskedValue!==n||this.value!==l||this._rawInputValue!==s;this._unmaskedValue=n,this._value=l,this._rawInputValue=s,this.el.value!==o&&(this.el.value=o),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),r&&this._fireChangeEvents(),!this._historyChanging&&(r||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...l}=t,s=!this.maskEquals(n),o=this.masked.optionsIsChanged(l);s&&(this.mask=n),o&&this.masked.updateOptions(l),(s||o)&&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,$.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const l=this._listeners[t].indexOf(n);return l>=0&&this._listeners[t].splice(l,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new Si({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),l=this.masked.rawInputValue,s=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,o=l===this.masked.rawInputValue?n.removeDirection:$.NONE;let r=this.masked.nearestInputPos(n.startChangePos+s,o);o!==$.NONE&&(r=this.masked.nearestInputPos(r,$.NONE)),this.updateControl(r),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=Ut;class U{static normalize(t){return Array.isArray(t)?t:[t,new U]}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=U;class ue{constructor(t,n,l){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=l}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 n=this.value[0];return this.value=this.value.slice(1),n}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,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),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,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new ue(this.extractInput(t,n),t)}appendTail(t){return fe(t)&&(t=new ue(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new U({inserted:t,rawInserted:t})):new U}_appendChar(t,n,l){n===void 0&&(n={});const s=this.state;let o;if([t,o]=this.doPrepareChar(t,n),t&&(o=o.aggregate(this._appendCharRaw(t,n)),!o.rawInserted&&this.autofix==="pad")){const r=this.state;this.state=s;let i=this.pad(n);const c=this._appendCharRaw(t,n);i=i.aggregate(c),c.rawInserted||i.equals(o)?o=i:this.state=r}if(o.inserted){let r,i=this.doValidate(n)!==!1;if(i&&l!=null){const c=this.state;if(this.overwrite===!0){r=l.state;for(let u=0;u<o.rawInserted.length;++u)l.unshift(this.displayValue.length-o.tailShift)}let d=this.appendTail(l);if(i=d.rawInserted.length===l.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,r=l.state;for(let u=0;u<o.rawInserted.length;++u)l.shift();d=this.appendTail(l),i=d.rawInserted.length===l.toString().length}i&&d.inserted&&(this.state=c)}i||(o=new U,this.state=s,l&&r&&(l.state=r))}return o}_appendPlaceholder(){return new U}_appendEager(){return new U}append(t,n,l){if(!fe(t))throw new Error("value should be string");const s=fe(l)?new ue(String(l)):l;n!=null&&n.tail&&(n._beforeTailState=this.state);let o;[t,o]=this.doPrepare(t,n);for(let r=0;r<t.length;++r){const i=this._appendChar(t[r],n,s);if(!i.rawInserted&&!this.doSkipInvalid(t[r],n,s))break;o.aggregate(i)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&o.aggregate(this._appendEager()),s!=null&&(o.tailShift+=this.appendTail(s).tailShift),o}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new U}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,l=this.value,s=t();return this.rawInputValue=n,this.value&&this.value!==l&&l.indexOf(this.value)===0&&(this.append(l.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,s}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,l=t(this);return this.state=n,delete this._isolated,l}doSkipInvalid(t,n,l){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),U.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),U.normalize(this.prepareChar?this.prepareChar(t,this,n):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,n,l,s,o){l===void 0&&(l=""),s===void 0&&(s=$.NONE),o===void 0&&(o={input:!0});const r=t+n,i=this.extractTail(r),c=this.eager===!0||this.eager==="remove";let d;c&&(s=Rt(s),d=this.extractInput(0,r,{raw:!0}));let u=t;const p=new U;if(s!==$.NONE&&(u=this.nearestInputPos(t,n>1&&t!==0&&!c?$.NONE:s),p.tailShift=u-t),p.aggregate(this.remove(u)),c&&s!==$.NONE&&d===this.rawInputValue)if(s===$.FORCE_LEFT){let g;for(;d===this.rawInputValue&&(g=this.displayValue.length);)p.aggregate(new U({tailShift:-1})).aggregate(this.remove(g-1))}else s===$.FORCE_RIGHT&&i.unshift();return p.aggregate(this.append(l,o,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!ze(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||le.EMPTY_VALUES.includes(t)&&le.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new U}}le.DEFAULTS={skipInvalid:!0},le.EMPTY_VALUES=[void 0,null,""],z.Masked=le;class ge{constructor(t,n){t===void 0&&(t=[]),n===void 0&&(n=0),this.chunks=t,this.from=n}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=fe(t)?new ue(String(t)):t;const n=this.chunks[this.chunks.length-1],l=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof ue)l?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof ge){if(t.stop==null){let s;for(;t.chunks.length&&t.chunks[0].stop==null;)s=t.chunks.shift(),s.from+=t.from,this.extend(s)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof z.MaskedPattern))return new ue(this.toString()).appendTo(t);const n=new U;for(let l=0;l<this.chunks.length;++l){const s=this.chunks[l],o=t._mapPosToBlock(t.displayValue.length),r=s.stop;let i;if(r!=null&&(!o||o.index<=r)&&((s instanceof ge||t._stops.indexOf(r)>=0)&&n.aggregate(t._appendPlaceholder(r)),i=s instanceof ge&&t._blocks[r]),i){const c=i.appendTail(s);n.aggregate(c);const d=s.toString().slice(c.rawInserted.length);d&&n.aggregate(t.append(d,{tail:!0}))}else n.aggregate(t.append(s.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...l}=t;Object.assign(this,l),this.chunks=n.map(s=>{const o="chunks"in s?new ge:new ue;return o.state=s,o})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let l=0;for(;l<this.chunks.length;){const s=this.chunks[l],o=s.unshift(n);if(s.toString()){if(!o)break;++l}else this.chunks.splice(l,1);if(o)return o}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],l=n.shift();if(n.toString()){if(!l)break;--t}else this.chunks.splice(t,1);if(l)return l}return""}}class Ni{constructor(t,n){this.masked=t,this._log=[];const{offset:l,index:s}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=l,this.index=s,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=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;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,$.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,$.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,$.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,$.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,$.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,$.NONE),!0})}}class tt{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,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new U}nearestInputPos(t,n){n===void 0&&(n=$.NONE);const l=0,s=this._value.length;switch(n){case $.LEFT:case $.FORCE_LEFT:return l;case $.NONE:case $.RIGHT:case $.FORCE_RIGHT:default:return s}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),l===void 0&&(l={}),l.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new U;const l=this.eager===!0||this.eager==="append",o=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!l)&&!n.tail,r=new U({inserted:this.char,rawInserted:o?this.char:""});return this._value=this.char,this._isRawInput=o&&(n.raw||n.input),r}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new U;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new ue("")}appendTail(t){return fe(t)&&(t=new ue(String(t))),t.appendTo(this)}append(t,n,l){const s=this._appendChar(t[0],n);return l!=null&&(s.tailShift+=this.appendTail(l).tailShift),s}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 Se{constructor(t){const{parent:n,isOptional:l,placeholderChar:s,displayChar:o,lazy:r,eager:i,...c}=t;this.masked=de(c),Object.assign(this,{parent:n,isOptional:l,placeholderChar:s,displayChar:o,lazy:r,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new U}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,n){if(n===void 0&&(n={}),this.isFilled)return new U;const l=this.masked.state;let s=this.masked._appendChar(t,this.currentMaskFlags(n));return s.inserted&&this.doValidate(n)===!1&&(s=new U,this.masked.state=l),!s.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(s.inserted=this.placeholderChar),s.skip=!s.inserted&&!this.isOptional,this.isFilled=!!s.inserted,s}append(t,n,l){return this.masked.append(t,this.currentMaskFlags(n),l)}_appendPlaceholder(){return this.isFilled||this.isOptional?new U:(this.isFilled=!0,new U({inserted:this.placeholderChar}))}_appendEager(){return new U}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,l)}nearestInputPos(t,n){n===void 0&&(n=$.NONE);const l=0,s=this.value.length,o=Math.min(Math.max(t,l),s);switch(n){case $.LEFT:case $.FORCE_LEFT:return this.isComplete?o:l;case $.RIGHT:case $.FORCE_RIGHT:return this.isComplete?o:s;case $.NONE:default:return o}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).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 n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new U}}Se.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 Pt extends le{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=l=>l.search(n)>=0),super._update(t)}}z.MaskedRegExp=Pt;class se extends le{constructor(t){super({...se.DEFAULTS,...t,definitions:Object.assign({},Se.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 n=this.mask;if(!n||!t)return;let l=!1,s=!1;for(let o=0;o<n.length;++o){if(this.blocks){const d=n.slice(o),u=Object.keys(this.blocks).filter(g=>d.indexOf(g)===0);u.sort((g,h)=>h.length-g.length);const p=u[0];if(p){const{expose:g,repeat:h,...v}=_e(this.blocks[p]),w={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...v,repeat:h,parent:this},S=h!=null?new z.RepeatBlock(w):de(w);S&&(this._blocks.push(S),g&&(this.exposeBlock=S),this._maskedBlocks[p]||(this._maskedBlocks[p]=[]),this._maskedBlocks[p].push(this._blocks.length-1)),o+=p.length-1;continue}}let r=n[o],i=r in t;if(r===se.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(r==="{"||r==="}"){l=!l;continue}if(r==="["||r==="]"){s=!s;continue}if(r===se.ESCAPE_CHAR){if(++o,r=n[o],!r)break;i=!1}const c=i?new Se({isOptional:s,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,..._e(t[r]),parent:this}):new tt({char:r,eager:this.eager,isUnmasking:l});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:n,...l}=t;this._blocks.forEach((s,o)=>s.state=n[o]),super.state=l}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,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new U;let l=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(l==null)return n;this._blocks[l].isFilled&&++l;for(let s=l;s<this._blocks.length;++s){const o=this._blocks[s]._appendEager();if(!o.inserted)break;n.aggregate(o)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const l=this._mapPosToBlock(this.displayValue.length),s=new U;if(!l)return s;for(let r=l.index,i;i=this._blocks[r];++r){var o;const c=i._appendChar(t,{...n,_beforeTailState:(o=n._beforeTailState)==null||(o=o._blocks)==null?void 0:o[r]});if(s.aggregate(c),c.consumed)break}return s}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const l=new ge;return t===n||this._forEachBlocksInRange(t,n,(s,o,r,i)=>{const c=s.extractTail(r,i);c.stop=this._findStopBefore(o),c.from=this._blockStartPos(o),c instanceof ge&&(c.blockIndex=o),l.extend(c)}),l}extractInput(t,n,l){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),l===void 0&&(l={}),t===n)return"";let s="";return this._forEachBlocksInRange(t,n,(o,r,i,c)=>{s+=o.extractInput(i,c,l)}),s}_findStopBefore(t){let n;for(let l=0;l<this._stops.length;++l){const s=this._stops[l];if(s<=t)n=s;else break}return n}_appendPlaceholder(t){const n=new U;if(this.lazy&&t==null)return n;const l=this._mapPosToBlock(this.displayValue.length);if(!l)return n;const s=l.index,o=t??this._blocks.length;return this._blocks.slice(s,o).forEach(r=>{if(!r.lazy||t!=null){var i;n.aggregate(r._appendPlaceholder((i=r._blocks)==null?void 0:i.length))}}),n}_mapPosToBlock(t){let n="";for(let l=0;l<this._blocks.length;++l){const s=this._blocks[l],o=n.length;if(n+=s.displayValue,t<=n.length)return{index:l,offset:t-o}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,l)=>n+=l.displayValue.length,0)}_forEachBlocksInRange(t,n,l){n===void 0&&(n=this.displayValue.length);const s=this._mapPosToBlock(t);if(s){const o=this._mapPosToBlock(n),r=o&&s.index===o.index,i=s.offset,c=o&&r?o.offset:this._blocks[s.index].displayValue.length;if(l(this._blocks[s.index],s.index,i,c),o&&!r){for(let d=s.index+1;d<o.index;++d)l(this._blocks[d],d,0,this._blocks[d].displayValue.length);l(this._blocks[o.index],o.index,0,o.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const l=super.remove(t,n);return this._forEachBlocksInRange(t,n,(s,o,r,i)=>{l.aggregate(s.remove(r,i))}),l}nearestInputPos(t,n){if(n===void 0&&(n=$.NONE),!this._blocks.length)return 0;const l=new Ni(this,t);if(n===$.NONE)return l.pushRightBeforeInput()||(l.popState(),l.pushLeftBeforeInput())?l.pos:this.displayValue.length;if(n===$.LEFT||n===$.FORCE_LEFT){if(n===$.LEFT){if(l.pushRightBeforeFilled(),l.ok&&l.pos===t)return t;l.popState()}if(l.pushLeftBeforeInput(),l.pushLeftBeforeRequired(),l.pushLeftBeforeFilled(),n===$.LEFT){if(l.pushRightBeforeInput(),l.pushRightBeforeRequired(),l.ok&&l.pos<=t||(l.popState(),l.ok&&l.pos<=t))return l.pos;l.popState()}return l.ok?l.pos:n===$.FORCE_LEFT?0:(l.popState(),l.ok||(l.popState(),l.ok)?l.pos:0)}return n===$.RIGHT||n===$.FORCE_RIGHT?(l.pushRightBeforeInput(),l.pushRightBeforeRequired(),l.pushRightBeforeFilled()?l.pos:n===$.FORCE_RIGHT?this.displayValue.length:(l.popState(),l.ok||(l.popState(),l.ok)?l.pos:this.nearestInputPos(t,$.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let l=0;return this._forEachBlocksInRange(t,n,(s,o,r,i)=>{l+=s.totalInputPositions(r,i)}),l}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(l=>this._blocks[l]):[]}pad(t){const n=new U;return this._forEachBlocksInRange(0,this.displayValue.length,l=>n.aggregate(l.pad(t))),n}}se.DEFAULTS={...le.DEFAULTS,lazy:!0,placeholderChar:"_"},se.STOP_CHAR="`",se.ESCAPE_CHAR="\\",se.InputDefinition=Se,se.FixedDefinition=tt,z.MaskedPattern=se;class Me extends se{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:l=this.from||0,maxLength:s=this.maxLength||0,autofix:o=this.autofix,...r}=t;this.to=n,this.from=l,this.maxLength=Math.max(String(n).length,s),this.autofix=o;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;r.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(r)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",l="";const[,s,o]=t.match(/^(\D*)(\d*)(\D*)/)||[];return o&&(n="0".repeat(s.length)+o,l="9".repeat(s.length)+o),n=n.padEnd(this.maxLength,"0"),l=l.padEnd(this.maxLength,"9"),[n,l]}doPrepareChar(t,n){n===void 0&&(n={});let l;return[t,l]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(l.skip=!this.isComplete),[t,l]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const l=String(this.from).padStart(this.maxLength,"0"),s=String(this.to).padStart(this.maxLength,"0"),[o,r]=this.boundaries(this.value+t);return Number(r)<this.from?super._appendCharRaw(l[this.value.length],n):Number(o)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(l[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(s[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[s,o]=this.boundaries(n);return this.from<=Number(o)&&Number(s)<=this.to&&super.doValidate(t)}pad(t){const n=new U;if(this.value.length===this.maxLength)return n;const l=this.value,s=this.maxLength-this.value.length;if(s){this.reset();for(let o=0;o<s;++o)n.aggregate(super._appendCharRaw("0",t));l.split("").forEach(o=>this._appendCharRaw(o))}return n}}z.MaskedRange=Me;const Fi="d{.}`m{.}`Y";class pe extends se{static extractPatternOptions(t){const{mask:n,pattern:l,...s}=t;return{...s,mask:fe(n)?n:l}}constructor(t){super(pe.extractPatternOptions({...pe.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:l,blocks:s,...o}={...pe.DEFAULTS,...t},r=Object.assign({},pe.GET_DEFAULT_BLOCKS());t.min&&(r.Y.from=t.min.getFullYear()),t.max&&(r.Y.to=t.max.getFullYear()),t.min&&t.max&&r.Y.from===r.Y.to&&(r.m.from=t.min.getMonth()+1,r.m.to=t.max.getMonth()+1,r.m.from===r.m.to&&(r.d.from=t.min.getDate(),r.d.to=t.max.getDate())),Object.assign(r,this.blocks,s),super._update({...o,mask:fe(n)?n:l,blocks:r})}doValidate(t){const n=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=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(pe.extractPatternOptions(t))}}pe.GET_DEFAULT_BLOCKS=()=>({d:{mask:Me,from:1,to:31,maxLength:2},m:{mask:Me,from:1,to:12,maxLength:2},Y:{mask:Me,from:1900,to:9999}}),pe.DEFAULTS={...se.DEFAULTS,mask:Date,pattern:Fi,format:(a,t)=>{if(!a)return"";const n=String(a.getDate()).padStart(2,"0"),l=String(a.getMonth()+1).padStart(2,"0"),s=a.getFullYear();return[n,l,s].join(".")},parse:(a,t)=>{const[n,l,s]=a.split(".").map(Number);return new Date(s,l-1,n)}},z.MaskedDate=pe;class Ne extends le{constructor(t){super({...Ne.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(n=>{const{expose:l,...s}=_e(n),o=de({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return l&&(this.exposeMask=o),o}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const l=this._applyDispatch(t,n);return this.currentMask&&l.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),l}_applyDispatch(t,n,l){t===void 0&&(t=""),n===void 0&&(n={}),l===void 0&&(l="");const s=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,o=this.rawInputValue,r=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:o,i=o.slice(r.length),c=this.currentMask,d=new U,u=c?.state;return this.currentMask=this.doDispatch(t,{...n},l),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),r&&(this.currentMask.append(r,{raw:!0}),d.tailShift=this.currentMask.value.length-s.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),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 n=new U;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,l;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((l=t._beforeTailState)==null?void 0:l.currentMask)||t._beforeTailState}}doDispatch(t,n,l){return n===void 0&&(n={}),l===void 0&&(l=""),this.dispatch(t,this,n,l)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[l,s]=super.doPrepare(t,n);if(this.currentMask){let o;[l,o]=super.doPrepare(l,this.currentMaskFlags(n)),s=s.aggregate(o)}return[l,s]}doPrepareChar(t,n){n===void 0&&(n={});let[l,s]=super.doPrepareChar(t,n);if(this.currentMask){let o;[l,o]=super.doPrepareChar(l,this.currentMaskFlags(n)),s=s.aggregate(o)}return[l,s]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.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 n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}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,n){const l=new U;return this.currentMask&&l.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),l}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:l,currentMask:s,...o}=t;n&&this.compiledMasks.forEach((r,i)=>r.state=n[i]),l!=null&&(this.currentMask=l,this.currentMask.state=s),super.state=o}extractInput(t,n,l){return this.currentMask?this.currentMask.extractInput(t,n,l):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}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((n,l)=>{if(!t[l])return;const{mask:s,...o}=t[l];return ze(n,o)&&n.maskEquals(s)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}Ne.DEFAULTS={...le.DEFAULTS,dispatch:(a,t,n,l)=>{if(!t.compiledMasks.length)return;const s=t.rawInputValue,o=t.compiledMasks.map((r,i)=>{const c=t.currentMask===r,d=c?r.displayValue.length:r.nearestInputPos(r.displayValue.length,$.FORCE_LEFT);return r.rawInputValue!==s?(r.reset(),r.append(s,{raw:!0})):c||r.remove(d),r.append(a,t.currentMaskFlags(n)),r.appendTail(l),{index:i,weight:r.rawInputValue.length,totalInputPositions:r.totalInputPositions(0,Math.max(d,r.nearestInputPos(r.displayValue.length,$.FORCE_LEFT)))}});return o.sort((r,i)=>i.weight-r.weight||i.totalInputPositions-r.totalInputPositions),t.compiledMasks[o[0].index]}},z.MaskedDynamic=Ne;class Fe extends se{constructor(t){super({...Fe.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...l}=t;if(n){const s=n.map(i=>i.length),o=Math.min(...s),r=Math.max(...s)-o;l.mask="*".repeat(o),r&&(l.mask+="["+"*".repeat(r)+"]"),this.enum=n}super._update(l)}_appendCharRaw(t,n){n===void 0&&(n={});const l=Math.min(this.nearestInputPos(0,$.FORCE_RIGHT),this.value.length),s=this.enum.filter(o=>this.matchValue(o,this.unmaskedValue+t,l));if(s.length){s.length===1&&this._forEachBlocksInRange(0,this.value.length,(r,i)=>{const c=s[0][i];i>=this.value.length||c===r.value||(r.reset(),r._appendChar(c,n))});const o=super._appendCharRaw(s[0][this.value.length],n);return s.length===1&&s[0].slice(this.unmaskedValue.length).split("").forEach(r=>o.aggregate(super._appendCharRaw(r))),o}return new U({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new ue("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new U;const l=Math.min(super.nearestInputPos(0,$.FORCE_RIGHT),this.value.length);let s;for(s=t;s>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(l,s),l)).length>1);--s);const o=super.remove(s,n);return o.tailShift+=s-t,o}get isComplete(){return this.enum.indexOf(this.value)>=0}}Fe.DEFAULTS={...se.DEFAULTS,matchValue:(a,t,n)=>a.indexOf(t,n)===n},z.MaskedEnum=Fe;class Ht extends le{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}z.MaskedFunction=Ht;var Gt;class oe extends le{constructor(t){super({...oe.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",l=(this.scale?"("+Qe(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+l),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Qe).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Qe(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[l,s]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!l&&(s.skip=!0),l&&!this.allowPositive&&!this.value&&l!=="-"&&s.aggregate(this._appendChar("-")),[l,s]}_separatorsCount(t,n){n===void 0&&(n=!1);let l=0;for(let s=0;s<t;++s)this._value.indexOf(this.thousandsSeparator,s)===s&&(++l,n&&(t+=this.thousandsSeparator.length));return l}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,l))}_appendCharRaw(t,n){n===void 0&&(n={});const l=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,s=this._separatorsCountFromSlice(l);this._value=this._removeThousandsSeparators(this.value);const o=this._value;this._value+=t;const r=this.number;let i=!isNaN(r),c=!1;if(i){let g;this.min!=null&&this.min<0&&this.number<this.min&&(g=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(g=this.max),g!=null&&(this.autofix?(this._value=this.format(g,this).replace(oe.UNMASKED_RADIX,this.radix),c||(c=o===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new U({inserted:this._value.slice(o.length),rawInserted:c?"":t,skip:c}):(this._value=o,d=new U),this._value=this._insertThousandsSeparators(this._value);const u=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,p=this._separatorsCountFromSlice(u);return d.tailShift+=(p-s)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,l=this.value.indexOf(this.thousandsSeparator,n);if(l<=t)return l}return-1}_adjustRangeWithSeparators(t,n){const l=this._findSeparatorAround(t);l>=0&&(t=l);const s=this._findSeparatorAround(n);return s>=0&&(n=s+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const l=this.value.slice(0,t),s=this.value.slice(n),o=this._separatorsCount(l.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(l+s));const r=this._separatorsCountFromSlice(l);return new U({tailShift:(r-o)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case $.NONE:case $.LEFT:case $.FORCE_LEFT:{const l=this._findSeparatorAround(t-1);if(l>=0){const s=l+this.thousandsSeparator.length;if(t<s||this.value.length<=s||n===$.FORCE_LEFT)return l}break}case $.RIGHT:case $.FORCE_RIGHT:{const l=this._findSeparatorAround(t);if(l>=0)return l+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let l=this.value;this.normalizeZeros&&(l=this._normalizeZeros(l)),this.padFractionalZeros&&this.scale>0&&(l=this._padFractionalZeros(l)),this._value=l}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(l,s,o,r)=>s+r),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,l){n===void 0&&(n={});const s=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===oe.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,l)&&!s}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==="")}}Gt=oe,oe.UNMASKED_RADIX=".",oe.EMPTY_VALUES=[...le.EMPTY_VALUES,0],oe.DEFAULTS={...le.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Gt.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:a=>a.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},z.MaskedNumber=oe;const Pe={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function nt(a,t,n){t===void 0&&(t=Pe.MASKED),n===void 0&&(n=Pe.MASKED);const l=de(a);return s=>l.runIsolated(o=>(o[t]=s,o[n]))}function qt(a,t,n,l){return nt(t,n,l)(a)}z.PIPE_TYPE=Pe,z.createPipe=nt,z.pipe=qt;class Kt extends se{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 n,l,s;const{repeat:o,...r}=_e(t);this._blockOpts=Object.assign({},this._blockOpts,r);const i=de(this._blockOpts);this.repeat=(n=(l=o??i.repeat)!=null?l:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((s=this._blocks)==null?void 0:s.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(de(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const l=new U;for(let c=(s=(o=this._mapPosToBlock(this.displayValue.length))==null?void 0:o.index)!=null?s:Math.max(this._blocks.length-1,0),d,u;d=(r=this._blocks[c])!=null?r:u=!u&&this._allocateBlock(c);++c){var s,o,r,i;const p=d._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(p.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(l.aggregate(p),p.consumed)break}return l}_trimEmptyTail(t,n){var l,s;t===void 0&&(t=0);const o=Math.max(((l=this._mapPosToBlock(t))==null?void 0:l.index)||0,this.repeatFrom,0);let r;n!=null&&(r=(s=this._mapPosToBlock(n))==null?void 0:s.index),r==null&&(r=this._blocks.length-1);let i=0;for(let c=r;o<=c&&!this._blocks[c].unmaskedValue;--c,++i);i&&(this._blocks.splice(r-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const l=super.remove(t,n);return this._trimEmptyTail(t,n),l}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}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=Kt;try{globalThis.IMask=z}catch{}const $i=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:U,ChunksTailDetails:ge,DIRECTION:$,HTMLContenteditableMaskElement:et,HTMLInputMaskElement:jt,HTMLMaskElement:Be,InputMask:Ut,MaskElement:je,Masked:le,MaskedDate:pe,MaskedDynamic:Ne,MaskedEnum:Fe,MaskedFunction:Ht,MaskedNumber:oe,MaskedPattern:se,MaskedRange:Me,MaskedRegExp:Pt,PIPE_TYPE:Pe,PatternFixedDefinition:tt,PatternInputDefinition:Se,RepeatBlock:Kt,createMask:de,createPipe:nt,default:z,forceDirection:Rt,normalizeOpts:_e,pipe:qt},Symbol.toStringTag,{value:"Module"}));q.ModalEdit=Dt,q.VForm=be,q.VsInputArray=Mt,q.VsInputCheckbox=it,q.VsInputCodegen=vt,q.VsInputColor=Bt,q.VsInputContainer=yt,q.VsInputDate=ct,q.VsInputEmail=rt,q.VsInputFile=ft,q.VsInputFileList=gt,q.VsInputKeyValue=Ct,q.VsInputMask=at,q.VsInputNumber=ot,q.VsInputRadio=Ye,q.VsInputRange=St,q.VsInputSelect=Je,q.VsInputSlug=Vt,q.VsInputStatic=We,q.VsInputSwitcher=Ze,q.VsInputTag=Et,q.VsInputText=Ve,q.VsInputTextarea=bt,q.default=be,q.inputs=Nt,q.vsInputDatatable=wt,q.vsInputMap=_t,Object.defineProperties(q,{__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,ee){"use strict";const ln={class:"w-full relative"},sn={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},on={class:"opacity-100"},an={key:0,class:"text-red-500 text-[14px]"},rn={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},cn=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(a){const t=e.ref("uk"),n=l=>{l.detail.key==="locale"&&(t.value=l.detail.newValue)};return e.onMounted(()=>{t.value=localStorage.locale,window.addEventListener("storage",n)}),e.onUnmounted(()=>{window.removeEventListener("resize",n)}),(l,s)=>(e.openBlock(),e.createElementBlock("div",ln,[l.ua||l.label?(e.openBlock(),e.createElementBlock("div",sn,[e.createElementVNode("span",on,e.toDisplayString(l.item[t.value]||l.ua||l.label),1),l.item?.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",an,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"default",e.mergeProps(l.$attrs,{class:{"opacity-60":l.item.disabled}})),l.error?(e.openBlock(),e.createElementBlock("span",rn,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),dn={class:"w-full relative flex flex-row items-center gap-2"},un={key:0,class:"text-red-500 text-[14px]"},pn={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},hn=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(a){const t=a,n=e.computed(()=>t.columns??{container:12,label:3}),l=e.computed(()=>{const{container:i,label:c}=n.value;return!i||i<=0?0:Math.min(Math.max(c??0,0),i)/i}),s=e.computed(()=>t.item?.type==="html"||l.value<=0?!1:!!(t.ua||t.label)),o=e.computed(()=>{if(!s.value)return{};const i=`${l.value*100}%`;return{flexBasis:i,maxWidth:i}}),r=e.computed(()=>{const{container:i,label:c}=n.value;if(!i||i<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const d=Math.max(i-Math.max(c??0,0),0)/i;if(!d)return{};const u=`${d*100}%`;return{flexBasis:u,maxWidth:u}});return(i,c)=>(e.openBlock(),e.createElementBlock("div",dn,[s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:e.normalizeStyle(o.value)},[e.createTextVNode(e.toDisplayString(i.ua||i.label)+" ",1),i.item?.rules?.includes("required")&&(i.ua||i.label)?(e.openBlock(),e.createElementBlock("span",un,"*")):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(r.value)},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],4),i.error?(e.openBlock(),e.createElementBlock("span",pn,e.toDisplayString(i.error),1)):e.createCommentVNode("",!0)]))}}),mn={class:"w-full relative"},fn={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},gn=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(a){return(t,n)=>(e.openBlock(),e.createElementBlock("div",mn,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",fn,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),kn={class:"flex-1 min-w-0"},yn={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},bn={class:"truncate"},xn={key:0,class:"text-red-500 text-[14px]"},wn={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},_n={class:"w-full md:w-auto"},En={key:0,class:"mt-1 text-xs text-red-500"},Vn={default:cn,horizontal:hn,inline:gn,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(a){const t=a,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const l=e.computed(()=>t.item?.description??""),s=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),o=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),r=i=>{i.key==="locale"&&(n.value=i.newValue??"uk")};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",r)}),e.onUnmounted(()=>{window.removeEventListener("storage",r)}),(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",kn,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",yn,[e.createElementVNode("span",bn,e.toDisplayString(i.item[n.value]||i.ua||i.label),1),s.value?(e.openBlock(),e.createElementBlock("span",xn,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("p",wn,e.toDisplayString(l.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",_n,[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))])],2),o.value?(e.openBlock(),e.createElementBlock("p",En,e.toDisplayString(o.value),1)):e.createCommentVNode("",!0)],2))}})};function ae(a){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${a?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return a?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const vn=["placeholder","disabled"],Cn=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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");return(s,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":o[0]||(o[0]=r=>l.value=r),placeholder:s.placeholder,disabled:s.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,vn)),[[e.vModelText,l.value]])}}),Bn=["placeholder","disabled"],Ve=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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");return(s,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":o[0]||(o[0]=r=>l.value=r),placeholder:s.placeholder,disabled:s.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Bn)),[[e.vModelText,l.value]])}}),Sn=["placeholder","min","max"],ot=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");return(s,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":o[0]||(o[0]=r=>l.value=r),placeholder:s.placeholder,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:s.min,max:s.max},null,10,Sn)),[[e.vModelText,l.value]])}}),G=(a,t)=>{const n=a.__vccOpts||a;for(const[l,s]of t)n[l]=s;return n},Mn={},Nn={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 Fn(a,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:"M5 12l5 5l10 -10"},null,-1)]))}const $n=G(Mn,[["render",Fn]]),An={class:"flex items-center gap-[4px]"},Dn=["value","id","disabled"],In=["for"],Tn={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Ln=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(a,{emit:t}){const n=t,l=a,s=e.computed({get:()=>l.modelValue,set:o=>n("update:modelValue",o)});return(o,r)=>(e.openBlock(),e.createElementBlock("div",An,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:o.value,"onUpdate:modelValue":r[0]||(r[0]=i=>s.value=i),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":o.disabled}]),id:o.id,disabled:o.disabled},null,10,Dn),[[e.vModelCheckbox,s.value]]),e.createElementVNode("label",{for:o.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":o.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[s.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",o.error?"border-red-600":""]])},[e.createVNode($n,{height:"12",width:"12"})],2),e.createElementVNode("span",Tn,[e.renderSlot(o.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.label),1)])])],10,In)]))}}),Rn=["name","value","disabled"],On={class:"flex items-center gap-[6px] text-[14px]"},zn={key:0,class:"text-[16px]"},jn=["src"],Un=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(a,{emit:t}){const n=a,l=t,s=e.computed({get:()=>n.modelValue,set:i=>{l("update:modelValue",i)}}),o=e.computed(()=>Array.isArray(s.value)?s.value.includes(n.value):s.value===!0||s.value===n.value),r=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.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",[r.value,o.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=>s.value=d),disabled:i.disabled},null,8,Rn),[[e.vModelCheckbox,s.value]]),e.createElementVNode("span",On,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",zn,[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,jn)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),Pn={class:"flex items-center"},qe=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(a,{emit:t}){const n=a,l=t,s=`radio-${Math.floor(Math.random()*1e4)}`,o=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:i=>{if(Array.isArray(n.modelValue)){let c=[...n.modelValue];i?c.includes(n.value)||c.push(n.value):c=c.filter(d=>d!==n.value),l("update:modelValue",c)}else l("update:modelValue",i)}}),r=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Pn,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value==="vs-checkbox-buttons"?e.unref(Un):e.unref(Ln)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:o.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),id:s,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"]))]))}}),Hn={},Gn={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 qn(a,t){return e.openBlock(),e.createElementBlock("svg",Gn,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 Kn=G(Hn,[["render",qn]]),Zn={},Wn={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 Yn(a,t){return e.openBlock(),e.createElementBlock("svg",Wn,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 Jn=G(Zn,[["render",Yn]]),Xn={},Qn={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 el(a,t){return e.openBlock(),e.createElementBlock("svg",Qn,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 tl=G(Xn,[["render",el]]),nl={key:0,class:"flex items-start gap-x-1"},ll={key:0,class:"text-red-500 text-[14px]"},sl=["title"],ol=["disabled"],Ke=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(a){const t=a,n=e.useModel(a,"modelValue");return(l,s)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",nl,[e.createVNode(qe,{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=o=>n.value=o),label:l.text,error:l.error||""},null,8,["modelValue","label","error"]),l.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",ll,"*")):e.createCommentVNode("",!0),l.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:l.i,onClick:s[1]||(s[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(tl),{class:"text-gray-500 w-[14px] h-[14px]"})],8,sl)):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",[n.value?`bg-${l.style?.primaryColor||"blue"}-500`:"bg-stone-200",l.customClass]]),disabled:l.disabled,onClick:s[2]||(s[2]=o=>n.value=!n.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",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,ol))}}),al=["id","innerHTML"],Ze=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(a){return(t,n)=>(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,al))}}),rl=["placeholder","disabled","name"],at=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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue"),s=e.ref(null);let o=null;return e.onMounted(async()=>{if(s.value){const{default:r}=await Promise.resolve().then(()=>Ni);o=r(s.value,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),o.on("accept",()=>{l.value=t.unmask?o.unmaskedValue:o.value}),o.on("complete",()=>{l.value=t.unmask?o.unmaskedValue:o.value}),o.value=l.value??""}}),e.onBeforeUnmount(()=>{o?.destroy()}),e.watch(()=>t.mask,r=>{o&&o.updateOptions({mask:r,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),e.watch(l,r=>{o&&o.unmaskedValue!==r&&(o.value=r||"")}),(r,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:s,placeholder:r.placeholder,disabled:r.disabled,name:r.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,rl))}}),il={class:"relative w-full bg-white rounded-lg"},cl=["placeholder","disabled"],rt=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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");return(s,o)=>(e.openBlock(),e.createElementBlock("div",il,[o[1]||(o[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":o[0]||(o[0]=r=>l.value=r),placeholder:s.placeholder,disabled:s.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,cl),[[e.vModelText,l.value]])]))}}),dl=["value","disabled"],ul={class:"text-[13px] text-gray-700"},pl=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(a){const t=e.useModel(a,"modelValue");return(n,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[n.customClass]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=s=>t.value=s),type:"radio",value:n.value,disabled:n.disabled,class:"hidden"},null,8,dl),[[e.vModelRadio,t.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${n.style?.primaryColor||"blue"}-500`,n.disabled?"opacity-50 cursor-not-allowed":""]])},[t.value==n.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${n.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",ul,e.toDisplayString(n.text),1)],2))}}),hl=["value","disabled"],ml={class:"text-[13px] text-gray-700"},fl={"vs-input-radio-default":pl,"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(a){const t=e.useModel(a,"modelValue");return(n,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[t.value==n.value?`ring-2 ring-ring ring-${n.style?.primaryColor||"blue"}-500`:"",n.customClass]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=s=>t.value=s),type:"radio",value:n.value,disabled:n.disabled,class:"hidden"},null,8,hl),[[e.vModelRadio,t.value]]),e.createElementVNode("span",ml,e.toDisplayString(n.text),1)],2))}})},We=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(a){const t=a,n=e.useModel(a,"modelValue"),l=e.computed(()=>fl[`vs-input-radio-${t.view}`]);return(s,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([s.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.options,r=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value),e.mergeProps({key:r?.id,text:r.text,value:r.id.toString(),checked:n.value===r.id,modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=i=>n.value=i)},{ref_for:!0},s.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),gl={key:1,class:"w-full flex flex-col gap-4"},kl={key:0,class:"text-sm font-medium text-muted-foreground my-2"},yl="Без категорії",it=G(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(a,{emit:t}){const n=a,l=t,s=e.ref([]),o=e.reactive({}),r=h=>h?.value||h?.id||h?.text||h,i=h=>h.text||String(h),c=h=>`lg:col-span-${h||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),u=h=>h==null||h===""?null:typeof h=="string"||typeof h=="number"?h:String(h),p=e.computed(()=>{if(!n.group)return[];const h=new Map;s.value.forEach(A=>{const _=A[n.group],m=u(_);h.has(m)||h.set(m,[]),h.get(m)?.push(A)});const C=[];n.values?.length&&n.values.forEach(A=>{const _=u(A);C.push(_)});const w=new Set,S=A=>{const _=h.get(A)||[];if(!_.length)return null;const m=A===null?"group-null":`group-${String(A)}`,b=A===null?yl:String(A);return w.add(A),{key:m,label:b,options:_}},M=[];return C.forEach(A=>{const _=S(A);_&&M.push(_)}),h.forEach((A,_)=>{if(w.has(_))return;const m=S(_);m&&M.push(m)}),M}),g=async()=>{try{const h=await fetch(`/api/suggest/${n.data}`).then(C=>C.json());s.value=h?.data||h}catch(h){console.error(h)}};return e.watch(()=>n.modelValue,h=>{if(typeof h=="boolean"&&s.value.length===1){const C=r(s.value[0]);o[C]=h}else if(Array.isArray(h)){const C=new Set(h);s.value.forEach(w=>{if(!w.disabled){const S=r(w);o[S]=C.has(S)}})}},{immediate:!0}),e.watch(o,()=>{if(!s.value.length){l("update:modelValue",null);return}const h=Object.entries(o).filter(([,C])=>C).map(([C])=>C);l("update:modelValue",h.length===0?[]:h)},{deep:!0}),e.onMounted(()=>{if(n.data)g().then(()=>{if(typeof n.modelValue=="boolean"&&s.value.length===1){const h=r(s.value[0]);o[h]=n.modelValue}else if(Array.isArray(n.modelValue)){const h=new Set(n.modelValue);s.value.forEach(C=>{if(!C.disabled){const w=r(C);o[w]=h.has(w)}})}});else if(s.value=n.options,typeof n.modelValue=="boolean"&&s.value.length===1){const h=r(s.value[0]);o[h]=n.modelValue}else if(Array.isArray(n.modelValue)){const h=new Set(n.modelValue);s.value.forEach(C=>{if(!C.disabled){const w=r(C);o[w]=h.has(w)}})}}),(h,C)=>n.group?(e.openBlock(),e.createElementBlock("div",gl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w.key,class:"flex flex-col gap-2"},[w.label?(e.openBlock(),e.createElementBlock("span",kl,e.toDisplayString(w.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(w.options,S=>(e.openBlock(),e.createBlock(qe,{modelValue:o[r(S)],"onUpdate:modelValue":M=>o[r(S)]=M,value:r(S),class:e.normalizeClass(c(h.colSpan)),disabled:S.disabled,label:i(S),key:`${w.key}-${r(S)}`,icon:S?.icon,imgUrl:S?.imgUrl,option:S,view:h.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(s.value,w=>(e.openBlock(),e.createBlock(qe,{modelValue:o[r(w)],"onUpdate:modelValue":S=>o[r(w)]=S,value:r(w),class:e.normalizeClass(c(h.colSpan)),disabled:w.disabled,label:i(w),key:r(w),icon:w?.icon,imgUrl:w?.imgUrl,option:w,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-58e06c8a"]]),bl=["type","placeholder","disabled"],ct=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(a,{emit:t}){const n=a;function l(c){return c?n.mode==="datetime"?(c.includes("T")?c:null)||c+(c.includes(" ")?"":"T00:00"):c?.split(" ")[0]:null}const{inputClass:s}=ae(n.style),o=t,r=e.computed({get:()=>l(n.modelValue),set:c=>o("update:modelValue",c)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode);return(c,d)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":d[0]||(d[0]=u=>r.value=u),placeholder:c.placeholder,disabled:c.disabled,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[c.modelValue?"":"text-opacity-50",e.unref(s)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,bl)),[[e.vModelDynamic,r.value]])}}),dt=async(a,t,n,l)=>{try{const s=new FormData;return s.append("unique","true"),s.append("file",a),(await fetch(`/file/upload/uploads?id=${t||""}&form=${n||""}&table=${l||""}`,{method:"POST",body:s}).then(r=>r.json()))?.result}catch(s){return ee.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",s),null}},xl=async a=>{try{return await fetch(`file/delete${a}`),!0}catch(t){return console.error(t),!1}},ut=async a=>{try{const t=await fetch(`file/download/files/uploads${a}`),n=await t.arrayBuffer(),l=t.headers["content-type"],s=new TextDecoder("utf-8").decode(n),o=new Blob([s],{type:l}),r=document.createElement("a");r.setAttribute("download",a),r.href=window.URL.createObjectURL(o),r.click()}catch(t){console.error(t.message)}},wl={},_l={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 El(a,t){return e.openBlock(),e.createElementBlock("svg",_l,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const ve=G(wl,[["render",El]]),Vl={},vl={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 Cl(a,t,n,l,s,o){return e.openBlock(),e.createElementBlock("svg",vl,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 Bl=G(Vl,[["render",Cl]]),Sl={},Ml={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 Nl(a,t,n,l,s,o){return e.openBlock(),e.createElementBlock("svg",Ml,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 Fl=G(Sl,[["render",Nl]]),$l={},Al={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 Dl(a,t){return e.openBlock(),e.createElementBlock("svg",Al,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 pt=G($l,[["render",Dl]]),Il={},Tl={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 Ll(a,t,n,l,s,o){return e.openBlock(),e.createElementBlock("svg",Tl,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 Rl=G(Il,[["render",Ll]]),Ol={},zl={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 jl(a,t,n,l,s,o){return e.openBlock(),e.createElementBlock("svg",zl,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 Ul=G(Ol,[["render",jl]]),Pl=a=>{if(!a)return"";const t=a?.split(".");return t[t.length-1]},Hl=a=>{const t=Pl(a),n={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 n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?Fl:n.textsFormat.includes(t)?Ul:n.documentsFormat.includes(t)?Bl:n.archivesFormat.includes(t)?Rl:pt},Gl={},ql={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 Kl(a,t){return e.openBlock(),e.createElementBlock("svg",ql,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 Le=G(Gl,[["render",Kl]]),Zl={},Wl={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 Yl(a,t){return e.openBlock(),e.createElementBlock("svg",Wl,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 ht=G(Zl,[["render",Yl]]),Jl={class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},Xl={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},mt=G(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(a){const t=e.useModel(a,"value"),n=e.useModel(a,"item"),l=a;return(s,o)=>(e.openBlock(),e.createElementBlock("div",Jl,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Hl)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:o[0]||(o[0]=r=>e.unref(ut)(n.value))},null,8,["src"])),e.createElementVNode("div",Xl,[e.createElementVNode("button",{type:"button",onClick:o[1]||(o[1]=r=>{e.unref(xl)(n.value),t.value=l.multiple?t.value?.filter(i=>i!==n.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(Le,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:o[2]||(o[2]=r=>e.unref(ut)(n.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(ht,{class:"w-4 h-4"})])])]))}}),[["__scopeId","data-v-0ca886b3"]]),Ql={class:"flex items-center gap-x-2"},es=["multiple","disabled"],ts={key:1,class:"flex items-center flex-wrap gap-2"},ns={key:1,class:"loader"},ls={key:1,class:"loader"},ft=G(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(a,{emit:t}){const n=a,l=e.useModel(a,"modelValue"),s=t,o=e.ref(null),r=e.ref(!1),i=u=>Array.isArray(l.value)&&l.value[u]||"",c=u=>{if(n.max_size&&u.size>n.max_size*1024*1024){const p=(u.size/1048576).toFixed(2);return ee.notify({type:"error",title:"Помилка!",message:`Файл "${u.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${p} МБ`,position:"right-bottom"}),!1}return!0},d=async u=>{const{files:p}=u.target;if(!p||p.length===0)return;const g=Array.from(p);if(n.max_size&&g.filter(C=>!c(C)).length>0){o.value&&(o.value.value="");return}r.value=!0;try{if(n.multiple){const h=Array.from(p).map(async M=>n.format&&!M.name.endsWith(n.format)?null:await dt(M,"1","form","table")),S=(await Promise.all(h)).filter(M=>M!==null).map(M=>M?.file_path).filter(Boolean);l.value=[...l.value||[],...S],s("change",l.value)}else{const h=p[0];if(n.format&&!h.name.endsWith(n.format))return;const C=await dt(h,"1","form","table");l.value=C?.file_path,s("change",l.value||"")}}finally{r.value=!1,o.value&&(o.value.value="")}};return(u,p)=>(e.openBlock(),e.createElementBlock("div",Ql,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:o,type:"file",multiple:u.multiple,onChange:d,disabled:r.value||u.disabled},null,40,es),!u.multiple&&l.value?(e.openBlock(),e.createBlock(mt,{key:0,item:l.value,"onUpdate:item":p[0]||(p[0]=g=>l.value=g),value:l.value,"onUpdate:value":p[1]||(p[1]=g=>l.value=g)},null,8,["item","value"])):u.multiple?(e.openBlock(),e.createElementBlock("div",ts,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(g,h)=>(e.openBlock(),e.createBlock(mt,{multiple:u.multiple,key:h,value:l.value,"onUpdate:value":p[2]||(p[2]=C=>l.value=C),item:i(h)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:p[3]||(p[3]=g=>!u.disabled&&!r.value&&o.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",u.disabled||r.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[r.value?(e.openBlock(),e.createElementBlock("div",ns)):(e.openBlock(),e.createBlock(ve,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),u.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:p[4]||(p[4]=g=>o.value?.click()),class:e.normalizeClass([u.disabled||r.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"])},[r.value?(e.openBlock(),e.createElementBlock("div",ls)):(e.openBlock(),e.createBlock(ve,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-e613a523"]]),ss={class:"max-w-[55vw]"},os={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},as={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},rs={class:"px-[5px]"},is={class:""},Re=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(a){const t=a,n=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function l(s){if(s<1024)return`${s} B`;const o=s/1024;return o<1024?`${o.toFixed(2)} KB`:`${(o/1024).toFixed(2)} MB`}return(s,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o[1]||(o[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",ss,[e.createElementVNode("p",os,e.toDisplayString(s.item?.uploaded_name),1),e.createElementVNode("p",as,[e.createElementVNode("span",null,e.toDisplayString(s.item?.username),1),e.withDirectives(e.createElementVNode("span",rs,"|",512),[[e.vShow,s.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),o[0]||(o[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",is,e.toDisplayString(l(s.item?.size)),1)])])],64))}}),cs={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},ds={key:0,class:"flex w-full gap-x-3 items-center"},us={key:1,class:"flex gap-x-3 w-full items-center"},ps={key:2,class:"flex gap-x-3 w-full items-center"},hs=["href"],ms={key:3,class:"flex gap-x-3 w-full items-center"},fs={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},gs={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"},ks={class:"inline-block"},ys={class:"inline-block"},bs=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(a,{emit:t}){const n=a,l=t;function s(u){return["pdf","json"].includes(u.ext)}function o(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function r(u){const p=document.createElement("a");p.setAttribute("download",u?.uploaded_name),p.href=u?.file_path,p.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),l("update")}catch(u){console.error(u)}}function c(){l("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(u){(n.item.ext==="jpg"||n.item.ext==="png")&&l("openLightbox",{item:n.item,index:u})}return(u,p)=>(e.openBlock(),e.createElementBlock("div",cs,[u.item.ext==="jpg"||u.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",ds,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:p[0]||(p[0]=g=>d(u.index))},[e.createVNode(Re,{item:u.item},null,8,["item"])])])):s(u.item)?(e.openBlock(),e.createElementBlock("div",us,[e.createVNode(Re,{item:u.item},null,8,["item"])])):o(u.item)?(e.openBlock(),e.createElementBlock("div",ps,[e.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Re,{item:u.item},null,8,["item"])],8,hs)])):(e.openBlock(),e.createElementBlock("div",ms,[e.createVNode(Re,{item:u.item},null,8,["item"])])),e.createElementVNode("div",fs,[e.createElementVNode("div",gs,[e.createElementVNode("div",ks,[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:p[1]||(p[1]=g=>r(u.item))},[e.createVNode(ht,{height:"14",width:"14"})])]),p[3]||(p[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",ys,[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:p[2]||(p[2]=g=>c())},[e.createVNode(Le,{height:"14",width:"14"})])])])])]))}}),xs={},ws={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 _s(a,t){return e.openBlock(),e.createElementBlock("svg",ws,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 Es=G(xs,[["render",_s]]),Vs={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},vs={class:"flex w-full mb-[12px] items-center gap-x-2"},Cs={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Bs={class1:"ml-auto"},Ss={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"},Ms={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Ns={class:"relative"},Fs={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"},$s={key:0},gt=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(a,{emit:t}){const n=a,l=e.inject("form"),s=e.computed(()=>l.value.formId),o=e.ref(!1),r=e.ref(0),i=t,c=e.ref(!1),d=e.ref({}),u=e.ref([]),p=e.ref(""),g=e.computed(()=>Array.isArray(u.value)?u.value.filter(_=>_.ext==="jpg"||_.ext==="png").map(_=>_?.file_path):[]),h=e.computed(()=>p.value===""?u.value:u.value.filter(_=>_?.uploaded_name?.includes(p.value))),C=_=>{const m=g.value.findIndex(b=>b===_.item.file_path);m!==-1&&(o.value=!0,r.value=m)},w=async()=>{try{const _=await fetch(`${n.prefix}/widget/file/${s.value}`).then(m=>m.json());u.value=_?.rows}catch(_){console.error(_)}},S=async _=>{await Promise.all(Array.from(_.target.files).map(async m=>{const b=new FormData;b.append("file",m);try{const B=`${n.prefix}/widget/file/${s.value}`,V=await fetch(B,{method:"POST",body:b});return V.ok?(i("update","file-list"),m):(ee.notify({type:V.status>=400&&V.status<500?"warning":"error",title:"Error",message:`Error code: ${V.status}`}),null)}catch(B){return ee.notify({type:"error",title:"Error",message:B.message||"Unknown error"}),console.error(B),null}})),await w()},M=_=>{const m={..._};return _.cancel||(m.cancel=()=>{c.value=!1}),_.updateListOnConfirm&&(m.confirm=async()=>{await _.confirm(),c.value=!1,w()}),m},A=_=>{d.value=M(_),c.value=!0};return e.watch(s,_=>{_&&w()}),e.onMounted(()=>{s.value&&w()}),(_,m)=>{const b=e.resolveComponent("Lightbox"),B=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",Vs,[e.createElementVNode("div",vs,[e.createElementVNode("h2",Cs," Файлів: "+e.toDisplayString(u.value?.length),1),e.createElementVNode("div",Bs,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:m[0]||(m[0]=V=>S(V))},null,32),e.createElementVNode("div",Ss,[e.createVNode(Es,{height:"16",width:"16"})])])])]),u.value?.length>4?(e.openBlock(),e.createElementBlock("div",Ms,[e.createElementVNode("div",null,[e.createElementVNode("div",Ns,[m[8]||(m[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":m[1]||(m[1]=V=>p.value=V),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,p.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),u.value?.length?(e.openBlock(),e.createElementBlock("div",Fs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(V,I)=>(e.openBlock(),e.createBlock(bs,{key:I,prefix:_.prefix,item:V,index:I,onUpdate:m[2]||(m[2]=Y=>_.$emit("update","file-list")),onOpenModal:m[3]||(m[3]=Y=>A(Y)),onOpenLightbox:m[4]||(m[4]=Y=>C(Y))},null,8,["prefix","item","index"]))),128)),h.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",$s,m[9]||(m[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(b,{modelValue:o.value,"onUpdate:modelValue":m[5]||(m[5]=V=>o.value=V),startIndex:r.value,"onUpdate:index":m[6]||(m[6]=V=>r.value=V),images:g.value},null,8,["modelValue","startIndex","images"]),e.createVNode(B,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":m[7]||(m[7]=V=>c.value=V),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),As={class:"flex items-center justify-between"},Ds={class:"text-[16px] text-gray-900 font-medium"},Is={class:"grid gap-3"},Ts=G(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(a){const t=a,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,l=>{n.value=l}),(l,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",As,[e.createElementVNode("p",Ds,e.toDisplayString(a.title),1),e.createVNode(Ke,{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=o=>n.value=o),style:e.normalizeStyle(a.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Is,[e.renderSlot(l.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Ls={class:"text-[16px] text-gray-900 font-medium"},Rs={class:"grid gap-3"},Os=G(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(a){const t=a,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,l=>{n.value=l}),(l,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:s[0]||(s[0]=o=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Kn),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Ls,e.toDisplayString(a.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Rs,[e.renderSlot(l.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),zs={class:"flex items-center justify-between"},js={switcher:Ts,accordion:Os,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(a){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",zs,[e.createElementVNode("p",null,e.toDisplayString(a.title),1)]),e.renderSlot(t.$slots,"default")]))}})},re={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Us=(a,t)=>String(a)===String(t),Ps=(a,t)=>String(a)!==String(t),Hs=(a,t)=>a>t,Gs=(a,t)=>a>=t,qs=(a,t)=>a<t,Ks=(a,t)=>a<=t,Zs=(a,t)=>Array.isArray(t)&&t.length===2?a>=t[0]&&a<=t[1]:!1,Ws=(a,t)=>String(a).startsWith(String(t)),Ys=(a,t)=>String(a).endsWith(String(t)),Js=(a,t)=>String(a).includes(String(t)),Xs=(a,t)=>Array.isArray(t)?t.includes(a):!1,Qs=(a,t)=>Array.isArray(t)?!t.includes(a):!0,kt=(a,t)=>{if(!t)return!0;switch(t?.[1]){case re.Equal:return Us(a,t?.[2]);case re.Inequal:return Ps(a,t?.[2]);case re.Higer:return Hs(a,t?.[2]);case re.HigerOrEqual:return Gs(a,t?.[2]);case re.Lower:return qs(a,t?.[2]);case re.LowerOrEqual:return Ks(a,t?.[2]);case re.Between:return Zs(a,t?.[2]);case re.StartWith:return Ws(a,t?.[2]);case re.EndWith:return Ys(a,t?.[2]);case re.Contain:return Js(a,t?.[2]);case re.In:return Xs(a,t?.[2]);case re.NotIn:return Qs(a,t?.[2]);default:return!0}},yt=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(a){const t=a,n=e.inject("values",e.ref({})),l=e.inject("form"),s=e.computed(()=>t.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,u=t.name?n.value?.[t.name]?.[d]??n.value?.[d]:n.value?.[d];return kt(u,c)})),o=e.computed(()=>js[t.view]),r=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const i=n.value[t.name];if(i)return i;const c={};return n.value={...n.value,[t.name]:c},c});return(i,c)=>a.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),{key:0,title:a.title,style:e.normalizeStyle(a.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,d=>(e.openBlock(),e.createBlock(Ft,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:r.value[d.name],"onUpdate:modelValue":u=>r.value[d.name]=u,style:a.style,error:e.unref(l)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),eo=["aria-expanded","data-focus"],to={key:0,class:"flex flex-wrap items-center gap-1 max-h-20 overflow-y-auto min-w-0 flex-1"},no={class:"flex items-center min-w-0"},lo=["title"],so=["innerHTML"],oo=["onClick"],ao={class:"flex-1 min-w-[2px]"},ro=["placeholder"],io=["title"],co=["innerHTML"],uo={key:2,class:"flex-1 min-w-[2px]"},po=["placeholder"],ho={class:"flex items-center shrink-0"},mo=["disabled"],fo=["disabled","title"],go=["aria-disabled","onClick"],ko=["innerHTML"],yo={key:1,class:"px-3 py-2 text-center text-gray-500"},bo=["disabled"],Ye=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"},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(a,{emit:t}){const n=a,l=t,s=e.computed(()=>n.multiple),o=e.computed(()=>n.disabled);ae(n.style);const r=e.computed({get:()=>n.modelValue,set:f=>l("update:modelValue",f)});!r.value&&n.defaultValue&&(r.value=n.defaultValue);const i=e.ref(null),c=e.ref(null),d=e.ref(null),u=e.ref(null),p=e.ref(!1),g=e.ref(!1),h=e.ref(null),C=e.ref([]),w=e.ref(-1),S=e.ref([]),M=e.ref(""),A=e.ref(null),_=e.ref("bottom"),m=e.ref({}),b=e.ref([]),B=e.computed(()=>{if(!b.value.length)return[];const f=C.value,y=new Map(f.map(x=>[x.id?.toString(),x]));return b.value.map(x=>y.get(x?.toString())).filter(x=>!!x)}),V=e.computed(()=>n.placeholder||"Select..."),I=e.computed(()=>N(h.value));e.computed(()=>s.value?!b.value.length&&M.value==="":!I.value&&M.value==="");const Y=e.computed(()=>o.value?!1:s.value?b.value.length>0:!!r.value),q=f=>s.value?b.value.some(y=>y?.toString()===f?.toString()):r.value?.toString()===f?.toString(),v=e.computed(()=>{let f=C.value??[];if(!n.data&&M.value.trim()!==""){const y=M.value.toLowerCase();f=f.filter(x=>{const z=N(x).toLowerCase(),Q=x.text?.toLowerCase?.()||"";return z.includes(y)||Q.includes(y)})}if(s.value&&b.value.length){const y=new Set(b.value.map(x=>x?.toString()));f=f.filter(x=>!y.has(x.id?.toString()))}return f}),U=e.inject("values"),Z=/\{\{\s*([^}]+?)\s*\}\}/g,P=f=>(f?String(f):"").replace(/<[^>]*>/g,"").trim(),D=e.computed(()=>n.slot??n?.optionTemplate??""),F=f=>{if(!f)return"";const y=D.value;return y?y.replace(Z,(x,z)=>{const Q=z.trim(),te=f[Q];return te!=null?String(te):""}):f.text??""},N=f=>{if(!f)return"";if(!D.value)return f.text??"";const x=F(f);return P(x)||f.text||""},T=f=>{n.set&&U?.value&&Object.entries(n.set).forEach(([y,x])=>{if(!y)return;const z=f?f[x]:null;U.value[y]=z??null})},W=e.computed(()=>n.parent?U?.value?.[n.parent]?.toString()??null:null),oe=async f=>{if(!n.data){let y=n.options??[];if(f?.trim()){const x=f.toLowerCase();y=y.filter(z=>{const Q=N(z).toLowerCase(),te=z.text?.toLowerCase?.()||"";return Q.includes(x)||te.includes(x)})}return y}try{const y=n.host??"",x=n.prefix??"api",z=n.api??`/${x}/suggest/${n.data}`,Q=`${y}${z}`,te=new URLSearchParams;return te.set("json","1"),f&&te.set("key",f),W.value!==void 0&&W.value!==null&&W.value!==""&&te.set("parent",W.value),(await fetch(`${Q}?${te.toString()}`).then(we=>we.json()))?.data??[]}catch{return[]}},ie=async()=>{n.data?C.value=await oe(M.value):C.value=n.options?[...n.options]:[]},Pe=async f=>{if(f==null)return null;const y=C.value?.find(x=>x?.id?.toString()===String(f));if(y)return y;if(n.data)try{const x=n.host??"",z=n.prefix??"api",Q=n.api??`/${z}/suggest/${n.data}`,te=`${x}${Q}`,ce=new URLSearchParams;return ce.set("json","1"),ce.set("val",String(f)),W.value!==void 0&&W.value!==null&&W.value!==""&&ce.set("parent",W.value),((await fetch(`${te}?${ce.toString()}`).then(De=>De.json()))?.data??[])?.[0]??null}catch{return null}return null},nt=async f=>{const y=new Set(C.value.map(z=>z.id?.toString())),x=f.filter(z=>!y.has(z?.toString()));x.length&&await x.reduce(async(z,Q)=>{await z;const te=await Pe(Q);te&&C.value.push(te)},Promise.resolve())},$e=async()=>{o.value||(p.value=!0,await ie(),await e.nextTick(()=>{de(),A.value?.focus(),v.value.length?w.value=0:w.value=-1}))},ge=()=>{p.value=!1,w.value=-1},lt=async f=>{if(o.value)return;!p.value?await $e():ge()},Ee=async()=>{p.value?A.value?.focus():await $e()},k=()=>{s.value?(b.value=[],r.value=[],l("change",[])):(h.value=null,r.value=null,l("change",null)),T(null),M.value="",e.nextTick(()=>A.value?.focus())},E=f=>{s.value&&(b.value=b.value.filter(y=>y?.toString()!==f?.toString()),r.value=[...b.value],l("change",r.value),e.nextTick(()=>A.value?.focus()))},H=f=>{s.value?(q(f.id)||(b.value=[...b.value,f.id],r.value=[...b.value],l("change",r.value)),M.value="",e.nextTick(()=>{A.value?.focus(),w.value=Math.min(w.value,v.value.length-1)}),T(null)):(h.value=f,r.value=f.id,l("change",r.value),M.value="",ge(),T(f))},R=f=>{q(f.id)||H(f)},J=(f,y)=>{if(!f||!y)return;const x=f.offsetTop,z=x+f.offsetHeight,Q=y.scrollTop,te=Q+y.clientHeight;let ce=y.scrollTop;x<Q?ce=x-80:z>te&&(ce=z-y.clientHeight+4);const we=y;we.scrollTop=ce},X=f=>{let y=f.parentElement;for(;y;){if(y.classList.contains("ui-dialog__content"))return y;const x=window.getComputedStyle(y),z=x.overflow+x.overflowY+x.overflowX;if(z.includes("auto")||z.includes("scroll")||y===document.body||y===document.documentElement)return y;y=y.parentElement}return document.body},de=()=>{if(!c.value)return;const f=c.value.getBoundingClientRect(),y=window.innerHeight||document.documentElement.clientHeight,x=window.innerWidth||document.documentElement.clientWidth,z=8,Q=8,te=n.maxHeight||300,ce=y-f.bottom-Q-z,we=f.top-Q-z,Ae=ce>=we,De=Math.max(x-z*2,0);let{width:Ie}=f;De>0&&Ie>De&&(Ie=De);let{left:Te}=f;Te+Ie+z>x&&(Te=x-Ie-z),Te=Math.max(Te,z);const Ii=Math.min(te,Math.max(Ae?ce:we,50));_.value=Ae?"bottom":"top",m.value={position:"fixed",left:`${Te}px`,width:`${Ie}px`,minWidth:"300px",maxHeight:`${Ii}px`,transform:Ae?"none":"translateY(-100%)",top:Ae?`${f.bottom+Q}px`:`${f.top-Q}px`}},xe=async f=>{o.value||!p.value&&(f.key==="ArrowDown"||f.key==="ArrowUp")&&(f.preventDefault(),await $e())},ke=f=>{if(!p.value)return;const{key:y}=f;if(y==="ArrowDown")f.preventDefault(),w.value+1<v.value.length&&(w.value+=1,J(S.value[w.value],d.value));else if(y==="ArrowUp")f.preventDefault(),w.value>0&&(w.value-=1,J(S.value[w.value],d.value));else if(y==="Enter"){f.preventDefault();const x=v.value[w.value];x&&H(x),A.value?.blur()}else y==="Escape"?(f.preventDefault(),ge()):y==="Backspace"?s.value&&M.value===""&&b.value.length&&(b.value=b.value.slice(0,-1),r.value=[...b.value],l("change",r.value)):y==="Home"?(w.value=0,J(S.value[0],d.value)):y==="End"?(w.value=v.value.length-1,J(S.value[w.value],d.value)):y==="Tab"&&ge()},ye=()=>{o.value||(g.value=!0)},Zt=()=>{g.value=!1,M.value=""},Wt=f=>{f.key==="Escape"&&p.value&&ge()},Yt=f=>{const y=f.target;i.value?.contains(y)||u.value?.contains(y)||ge()},Jt=f=>{p.value&&d.value&&!d.value.contains(f.target)&&de()},Xt=()=>{p.value&&de()},Qt=()=>{p.value&&de()};e.watch(()=>n.options,f=>{f?.length&&(C.value=[...f],He())},{immediate:!0});async function He(){if(s.value)Array.isArray(r.value)?b.value=[...r.value]:(b.value=r.value==null?[]:[r.value],r.value=[...b.value]),n.data&&b.value.length&&(await nt(b.value),await e.nextTick());else{if(Array.isArray(r.value)){const f=r.value[0]??null;r.value=f??null}r.value!=null&&(h.value=await Pe(r.value)),T(h.value??null)}}e.watch(r,()=>{He()}),e.onMounted(async()=>{addEventListener("keydown",Wt),addEventListener("scroll",Jt,!0),addEventListener("resize",Xt),document.addEventListener("click",Yt,!0),c.value&&X(c.value).addEventListener("scroll",Qt,!0),n.options?.length&&!n.data?C.value=[...n.options]:n.data&&(C.value=await oe("")),await He(),nn.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Wt),removeEventListener("scroll",Jt,!0),removeEventListener("resize",Xt),document.removeEventListener("click",Yt,!0),c.value&&X(c.value).removeEventListener("scroll",Qt,!0)});const Ge=e.ref(!1),st=e.ref({}),en=e.ref([]),tn=e.ref(null);async function Fi(){if(!n.add?.token||tn?.value.validate())return;const y=n.add.api??`/api/table/${n.add.token}`,{id:x}=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(st.value)}).then(z=>z.json());if(!n.options?.length&&n.data){const{data:z}=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${x}`).then(Q=>Q.json());h.value=z[0],C.value.push(z[0]),r.value=x}Ge.value=!1,ee.notify({title:"Success!",message:"Object created."})}async function $i(){if(!n.add)return null;const f=await fetch(`/api/template/form/${n.add.form}`).then(y=>y.json());return en.value=f.schema,Ge.value=!0,null}function Ai(f,y=200){let x;return(...z)=>{x&&clearTimeout(x),x=window.setTimeout(()=>f(...z),y)}}const Di=Ai(async f=>{C.value=await oe(f)},200);e.watch(M,f=>{n.data&&Di(f.trim())}),e.watch(()=>n.options,f=>{!n.data&&f?.length&&(C.value=[...f],He())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&ie()});const nn=e.ref(!0);return e.watch(W,async()=>{n.data&&(nn.value||(s.value?(b.value=[],r.value=[],l("change",[])):(h.value=null,r.value=null,l("change",null))),await ie())}),(f,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ee.VsModal),{visible:Ge.value,"onUpdate:visible":y[1]||(y[1]=x=>Ge.value=x),title:"Додати",buttonText:"Додати",onDone:Fi,teleport:f.teleport},{default:e.withCtx(()=>[e.createVNode(be,{schema:en.value,modelValue:st.value,"onUpdate:modelValue":y[0]||(y[0]=x=>st.value=x),ref_key:"addForm",ref:tn},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:y[5]||(y[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[y[10]||(y[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),y[11]||(y[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",p.value||g.value?"border-blue-500 ring-1 ring-blue-500":"",o.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":p.value,"aria-haspopup":"listbox",onKeydown:xe,onClick:Ee,"data-focus":p.value||g.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},[s.value?(e.openBlock(),e.createElementBlock("div",to,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,x=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:x.id},[e.createElementVNode("div",no,[x?.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:x?.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:N(x)},[D.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:F(x)},null,8,so)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(x.text),1)],64))],8,lo)]),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(z=>E(x.id),["stop"])},y[6]||(y[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,oo)]))),128)),e.createElementVNode("div",ao,[!o.value&&f.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:A,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:b.value.length?" ":V.value,"onUpdate:modelValue":y[2]||(y[2]=x=>M.value=x),onFocus:ye,onBlur:Zt,onKeydown:ke},null,40,ro)),[[e.vModelText,M.value]]):e.createCommentVNode("",!0)])])):!s.value&&!g.value&&I.value&&M.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:I.value},[h.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:h.value?.color})},null,4)):e.createCommentVNode("",!0),D.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":h.value?.color}),innerHTML:F(h.value)},null,10,co)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":h.value?.color})},e.toDisplayString(h.value?.text),3))],8,io)):e.createCommentVNode("",!0),s.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",uo,[!o.value&&f.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:A,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:g.value&&!M.value?.length&&I.value||" ","onUpdate:modelValue":y[3]||(y[3]=x=>M.value=x),onFocus:ye,onBlur:Zt,onKeydown:ke},null,40,po)),[[e.vModelText,M.value]]):e.createCommentVNode("",!0)]))],512),e.createElementVNode("div",ho,[Y.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:o.value,onClick:e.withModifiers(k,["stop"])},y[7]||(y[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,mo)):e.createCommentVNode("",!0),y[9]||(y[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:o.value,onClick:y[4]||(y[4]=e.withModifiers(x=>lt(),["stop"])),title:p.value?"Закрити список":"Відкрити список"},y[8]||(y[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,fo)])],42,eo),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,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(m.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:m.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[v.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(v.value,(x,z)=>(e.openBlock(),e.createElementBlock("div",{key:x.id,ref_for:!0,ref:Q=>S.value[z]=Q,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",q(x.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",w.value===z&&!q(x.id)?"bg-blue-100":""]),"aria-disabled":q(x.id)?"true":"false",role:"option",tabindex:"-1",onClick:Q=>R(x)},[x?.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:x?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",w.value===x.id?"text-white":"",(w.value===z,"")])},[D.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:F(x)},null,8,ko)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(x.text),1)],64))],2)],10,go))),128)):(e.openBlock(),e.createElementBlock("div",yo," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:$i,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:o.value,type:"button"},[e.createVNode(ve,{width:"16",height:"16"}),y[12]||(y[12]=e.createElementVNode("span",null,"Додати",-1))],8,bo)):e.createCommentVNode("",!0)],512)],64))}}),xo=["placeholder","disabled"],bt=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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");return(s,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":o[0]||(o[0]=r=>l.value=r),placeholder:s.placeholder,disabled:s.disabled,row:"2",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,xo)),[[e.vModelText,l.value]])}}),wo={},_o={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 Eo(a,t){return e.openBlock(),e.createElementBlock("svg",_o,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 Vo=G(wo,[["render",Eo]]),vo={},Co={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 Bo(a,t){return e.openBlock(),e.createElementBlock("svg",Co,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 So=G(vo,[["render",Bo]]),Mo={},No={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 Fo(a,t){return e.openBlock(),e.createElementBlock("svg",No,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 $o=G(Mo,[["render",Fo]]),Ao={},Do={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 Io(a,t){return e.openBlock(),e.createElementBlock("svg",Do,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 To=G(Ao,[["render",Io]]),Lo={},Ro={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 Oo(a,t){return e.openBlock(),e.createElementBlock("svg",Ro,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 xt=G(Lo,[["render",Oo]]),zo={},jo={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Uo(a,t){return e.openBlock(),e.createElementBlock("svg",jo,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 Po=G(zo,[["render",Uo]]),Ho={},Go={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 qo(a,t){return e.openBlock(),e.createElementBlock("svg",Go,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 Ko=G(Ho,[["render",qo]]),Zo={class:"vs-datatable border rounded-xl w-full flex-grow"},Wo={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},Yo={class:"relative w-full"},Jo={class:"table-wrapper flex gap-2"},Xo={class:"vs-popover inline-block text-slate-700"},Qo={class:"text-center"},ea={class:""},ta={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"},na={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},la={class:"text-sm items-center text-gray-800 flex gap-1"},sa={class:"w-full overflow-x-auto"},oa={class:"w-full table-auto caption-bottom text-sm"},aa={class:"[&_tr]:border-b"},ra={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"},ia={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"},ca={key:0,colspan:"100%",class:"text-center"},da={class:"w-full"},ua={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},pa=["onDragstart","onDragover","onDrop"],ha={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},ma={class:"flex items-center justify-center"},fa={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"},ga={key:0},ka=["src"],ya={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},ba=["innerHTML"],xa={key:2,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={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},_a={class:"flex items-center justify-center gap-2"},Ea=["onClick"],Va=["onClick"],va={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},wt=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(a){const t=a,n=e.useModel(a,"modelValue"),l=e.ref({}),s=e.ref(""),o=e.computed(()=>{if(!s.value)return n.value??[];const D=s.value.toLowerCase();return n.value.filter(F=>t.colModel?.some(N=>{const T=F[N.key];return T?Array.isArray(T)?T.join(", ").toLowerCase().includes(D):String(T).toLowerCase().includes(D):!1}))}),r=e.ref(null),i=e.ref(null),c=e.ref(!1),d=e.ref(null),u=e.ref({top:0,left:0}),p=D=>{r.value=D},g=D=>{i.value=D},h=D=>{if(r.value===null||r.value===D){r.value=null,i.value=null;return}const F=[...n.value],[N]=F.splice(r.value,1);F.splice(D,0,N),n.value=F,r.value=null,i.value=null},C=D=>{const N=D.currentTarget.getBoundingClientRect();u.value={top:N.bottom+window.scrollY,left:N.left+window.scrollX},c.value=!c.value},w=()=>{d.value&&d.value.click()},S=D=>{const F=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],N=D.toLowerCase();return F.some(T=>N.endsWith(T))},M=D=>{const N=D.target.files?.[0];if(!N)return;const T=new FileReader;T.onload=W=>{try{const oe=W.target?.result;if(typeof oe=="string"){const ie=JSON.parse(oe);Array.isArray(ie)&&n.value.push(...ie)}}catch(oe){console.error("Error parsing file:",oe)}},T.readAsText(N)},A=()=>{const D=JSON.stringify(n.value,null,2),F=new Blob([D],{type:"application/json"}),N=URL.createObjectURL(F),T=document.createElement("a");T.href=N,T.download="data.json",T.click(),URL.revokeObjectURL(N)};e.onMounted(async()=>{const D=t.colModel?.filter(F=>F.data);D?.length&&Promise.all(D.map(async F=>{const T=await(await fetch(`/api/suggest/${F.data}`)).json();l.value[F.key]=T.data}))});const _=e.ref(""),m=e.ref(!1);let b="edit",B=0;const V=e.ref({}),I=e.ref({});async function Y(){_.value="Додати",m.value=!0,b="add",V.value={}}function q(D,F){const N=F.key||F.name;return l.value[N]&&D[N]?l.value[N].find(T=>T.id.toString()===D[N].toString())?.text??D[N]:D[N]||"-"}async function v(D,F){_.value="Редагувати",m.value=!0,b="edit",B=F,V.value={...D}}function U(){const D=I.value.validate();if(D){ee.notify({type:"warning",title:"Помилка валідації",message:Object.entries(D).map(([F,N])=>`${F}: ${N}`).join(`
|
|
2
|
+
`)});return}b==="add"?Array.isArray(n.value)?n.value=[...n.value,V.value]:n.value=[V.value]:n.value=n.value.map((F,N)=>N===B?V.value:F),m.value=!1}function Z(D){n.value=n.value.filter((F,N)=>N!==D)}function P(){m.value=!1}return(D,F)=>(e.openBlock(),e.createElementBlock("div",Zo,[e.createElementVNode("div",Wo,[e.createElementVNode("div",Yo,[e.createVNode(Vo,{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":F[0]||(F[0]=N=>s.value=N),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,s.value]])]),e.createElementVNode("div",Jo,[e.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:M,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",Xo,[e.createElementVNode("div",Qo,[e.createElementVNode("div",ea,[e.createElementVNode("button",{onClick:C,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(So,{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:u.value.top+"px",left:u.value.left+"px"}])},[e.createElementVNode("div",ta,[e.createElementVNode("div",na,[e.createElementVNode("button",{onClick:w,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode($o,{class:"text-black",width:"14",height:"14"}),F[4]||(F[4]=e.createTextVNode(" Імпортувати ",-1))]),e.createElementVNode("button",{onClick:A,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createElementVNode("span",la,[e.createVNode(To,{class:"text-black",width:"14",height:"14"}),F[5]||(F[5]=e.createTextVNode(" Експортувати ",-1))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:Y,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(ve),F[6]||(F[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",sa,[e.createElementVNode("table",oa,[e.createElementVNode("thead",aa,[e.createElementVNode("tr",ra,[e.createElementVNode("th",ia,[e.createVNode(xt,{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,N=>(e.openBlock(),e.createElementBlock("th",{key:N.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(N.ua||N.label),1))),128)),F[7]||(F[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})},[o.value.length===0?(e.openBlock(),e.createElementBlock("td",ca,[e.createElementVNode("div",da,[e.createElementVNode("div",ua,[e.createVNode(Po,{class:"w-48 mx-auto"}),F[8]||(F[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(o.value,(N,T)=>(e.openBlock(),e.createElementBlock("tr",{key:N.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":r.value===T,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===T}]),draggable:"true",onDragstart:W=>p(T),onDragover:e.withModifiers(W=>g(T),["prevent"]),onDrop:W=>h(T)},[e.createElementVNode("td",ha,[e.createElementVNode("div",ma,[e.createVNode(xt,{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,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",fa,[S(q(N,W))?(e.openBlock(),e.createElementBlock("div",ga,[e.createElementVNode("img",{src:q(N,W),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,ka)])):(e.openBlock(),e.createElementBlock("div",ya,[e.createVNode(pt,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):W.type==="tiptap-editor"?(e.openBlock(),e.createElementBlock("div",{key:1,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",innerHTML:q(N,W)},null,8,ba)):(e.openBlock(),e.createElementBlock("div",xa,e.toDisplayString(q(N,W)),1))]))),128)),e.createElementVNode("td",wa,[e.createElementVNode("div",_a,[e.createElementVNode("button",{onClick:W=>v(N,T),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(Ko,{width:"24",height:"24",class:"w-3 h-3"})],8,Ea),e.createElementVNode("button",{onClick:W=>Z(T),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(Le,{width:"24",height:"24",class:"w-3 h-3"})],8,Va)])])],42,pa))),128))],2)])]),e.createVNode(e.unref(ee.VsModal),{teleport:"#modal",visible:m.value,title:_.value,size:"lg",onClose:P},{default:e.withCtx(()=>[e.createVNode(be,{schema:t.colModel,values:V.value,"onUpdate:values":F[1]||(F[1]=N=>V.value=N),form:I.value,"onUpdate:form":F[2]||(F[2]=N=>I.value=N)},null,8,["schema","values","form"]),e.createElementVNode("div",va,[e.createElementVNode("button",{type:"button",onClick:F[3]||(F[3]=N=>m.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"])]))}}),Ca={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 Ce(a){return a?a.type==="Polygon"?{type:"MultiPolygon",coordinates:[a.coordinates]}:a.type==="Feature"?{...a,geometry:Ce(a.geometry)}:a.type==="FeatureCollection"?{...a,features:(a.features||[]).map(t=>Ce(t)).filter(Boolean)}:a:null}function Ba(a){return a?a.type==="FeatureCollection"||a.type==="Feature"?Ce(a):a.geom?{type:"Feature",geometry:Ce({type:a.geom.type,coordinates:a.geom.coordinates}),properties:{}}:a.type&&a.coordinates?{type:"Feature",geometry:Ce(a),properties:{}}:null:null}const Sa={},Ma={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 Na(a,t){return e.openBlock(),e.createElementBlock("svg",Ma,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 Fa=G(Sa,[["render",Na]]),$a={},Aa={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 Da(a,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:"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 Ia=G($a,[["render",Da]]),Ta={},La={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 Ra(a,t){return e.openBlock(),e.createElementBlock("svg",La,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 Oa=G(Ta,[["render",Ra]]),za={},ja={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 Ua(a,t){return e.openBlock(),e.createElementBlock("svg",ja,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 Pa=G(za,[["render",Ua]]),Ha={},Ga={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 qa(a,t){return e.openBlock(),e.createElementBlock("svg",Ga,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 Ka=G(Ha,[["render",qa]]),Za={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Wa={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"},Ya=["onClick"],Ja={class:"relative flex-1 min-w-[140px]"},Xa=["placeholder"],Qa="https://data.softpro.ua/api-user/gis-url-proxy",er="https://geo.rv.ua/api-user/dzk.api",tr=G(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(a,{emit:t}){const n=a,l=t,s=["here","xy","parcel"],o=e.computed(()=>{const m=n.config?.tools?.filter(b=>s.includes(b));return m&&m.length?m:s}),r=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(o.value[0]??s[0]);e.watch(o,m=>{m.includes(i.value)||(i.value=m[0])});const c=e.ref(""),d=e.ref(!1),u=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function p(m){i.value=m}function g(m){if(!d.value)return;const b=u.value;b&&!b.contains(m.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",g,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",g,!0)});function h(m){return m==="xy"?"Координати":m==="parcel"?"Кадастр":"Адреси"}function C(m){const b=m.replace(/[,]+/g," ").trim();if(!b)return null;const B=b.split(/\s+/).filter(Boolean);if(B.length<2)return null;const V=B.slice(0,2).map(Number);if(!V.every(P=>Number.isFinite(P)))return null;let[I,Y]=V,q=I,v=Y;const U=P=>Math.abs(P)<=90,Z=P=>Math.abs(P)<=180;if(!U(q)||!Z(v))if(U(v)&&Z(q))q=Y,v=I;else return null;return{lat:q,lng:v}}function w(m){return(m?.items||[]).map((B,V)=>({id:String(B?.id??V),title:B?.title||B?.address?.label||"Знайдений обʼєкт",lat:Number(B?.position?.lat),lng:Number(B?.position?.lng)})).filter(B=>Number.isFinite(B.lat)&&Number.isFinite(B.lng))}function S(m){const b=m?.result||m?.data||m;if(!b)return[];const B=b.geom_centroid;if(!B||!Array.isArray(B.coordinates))return[];const[V,I]=B.coordinates;return!Number.isFinite(I)||!Number.isFinite(V)?[]:[{id:"parcel",title:b.cadnum||b.cad_num||"Земельна ділянка",lat:I,lng:V}]}function M(m){const B=m.replace(/\s+/g,"").split(":");if(B.length!==4)return!1;const V=[10,2,3,4];return B.every((I,Y)=>I.length===V[Y]&&/^\d+$/.test(I))}function A(m){l("goToCoordinates",[m.lat,m.lng])}async function _(){const m=c.value.trim();if(m){if(i.value==="xy"){const b=C(m);if(!b){ee.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}A(b),c.value="";return}try{const b=new URL(i.value==="here"?Qa:er);if(i.value==="here")b.searchParams.set("searchtext",m);else{if(!M(m)){ee.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}b.searchParams.set("cad_num",m)}const B=await fetch(b.toString());if(!B.ok)throw new Error(`HTTP ${B.status}`);const V=await B.json(),I=i.value==="here"?w(V):S(V);if(!I.length)ee.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const Y=I[0];A(Y),c.value=""}}catch(b){const B=b?.message||"Помилка пошуку";ee.notify({type:"error",title:"Пошук",message:B})}}}return(m,b)=>(e.openBlock(),e.createElementBlock("div",Za,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(_,["prevent"])},[o.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,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:b[0]||(b[0]=B=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(h(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"},b[2]||(b[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",Wa,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,B=>(e.openBlock(),e.createElementBlock("li",{key:B,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:V=>p(B)},e.toDisplayString(h(B)),9,Ya))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Ja,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":b[1]||(b[1]=B=>c.value=B),placeholder:r.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,Xa),[[e.vModelText,c.value,void 0,{trim:!0}]]),b[3]||(b[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"]]),nr={class:"bg-white/30 p-1 rounded-md shadow"},lr={class:"flex gap-2"},sr=["onClick","title"],or=["src"],ar=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(a,{emit:t}){const n=a,l=e.ref(Object.keys(n.basemaps)[0]),s=t;function o(r){s("onLayerChange",r),l.value=r}return(r,i)=>(e.openBlock(),e.createElementBlock("div",nr,[e.createElementVNode("div",lr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.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":l.value===d}]),onClick:u=>o(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,or)],10,sr))),128))])]))}}),rr={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},ir={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},cr={class:"text-sm font-medium"},dr={class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},ur={class:"form-geom__panel flex gap-1 items-start mt-2"},pr={class:"flex items-center gap-1"},hr=["disabled"],mr={class:"absolute top-4 right-4 z-[1000]"},fr={class:"flex flex-col gap-[2px]"},gr=["aria-pressed"],kr=["aria-pressed"],yr=["aria-pressed"],br=["aria-pressed"],xr={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"},wr={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},_r={class:"mr-auto"},Er={class:"font-bold"},Vr={class:"flex items-center"},vr={class:"text-xs mr-2"},Cr={key:0,class:"text-xs"},Br={key:1,class:"text-xs"},_t=G(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},geomType:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(a,{emit:t}){const n=e.getCurrentInstance(),l=a,s=t,o=e.computed(()=>l.geomType?l.geomType.map(k=>k.toLowerCase()).filter(k=>["marker","polyline","polygon","rectangle"].includes(k)):["marker","polyline","polygon","rectangle"]),r=e.ref(!1),i=e.ref("");function c(){const k=navigator.platform.toUpperCase().indexOf("MAC")>=0;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}const d=e.ref(null);let u,p,g,h=null;const C=e.ref(null),w=k=>{k.ctrlKey&&k.preventDefault()};function S(){if(!l.handleZoom)return null;let k;const E=R=>{const J=R.ctrlKey||R.metaKey,X=R.shiftKey;if(!J&&!X){r.value=!0,i.value=c(),clearTimeout(k),k=window.setTimeout(()=>{r.value=!1},1e3);return}r.value=!1,u.scrollWheelZoom.enable(),setTimeout(()=>{u.scrollWheelZoom.disable()},100)},H=R=>{if(R.touches.length===1){r.value=!0,i.value=c(),clearTimeout(k),k=window.setTimeout(()=>{r.value=!1},3e3);return}r.value=!1};return d.value&&(d.value.addEventListener("wheel",E,{passive:!1}),d.value.addEventListener("touchstart",H,{passive:!0})),u&&u.on("wheel",R=>{const J=R.originalEvent.ctrlKey||R.originalEvent.metaKey,X=R.originalEvent.shiftKey;!J&&!X&&(R.originalEvent.preventDefault(),R.originalEvent.stopPropagation())}),()=>{d.value&&(d.value.removeEventListener("wheel",E),d.value.removeEventListener("touchstart",H)),u&&u.off("wheel"),clearTimeout(k)}}const M=e.ref(null),A=e.ref(6),_=e.ref(0),m=e.ref(n?.appContext.config.globalProperties.$settings?.center||[50,30]),b=e.ref(null),B=lt();let V;const I=e.ref("topo100");function Y(k){return k?k.type==="Polygon"?{type:"MultiPolygon",coordinates:[k.coordinates]}:(k.type==="MultiPolygon",k):null}function q(){return new Promise((k,E)=>{window.L&&window.L.Draw&&k(0);const H=J=>{if(Array.from(document.styleSheets).some(xe=>xe?.href?.includes(J)))return;const de=document.createElement("link");de.rel="stylesheet",de.href=J,document.head.appendChild(de)},R=J=>new Promise((X,de)=>{const xe=Array.from(document.scripts).find(ye=>ye.src===J);if(xe){xe.addEventListener("load",()=>X()),xe.addEventListener("error",ye=>de(ye));return}const ke=document.createElement("script");ke.src=J,ke.async=!0,ke.onload=()=>X(),ke.onerror=ye=>de(ye),document.body.appendChild(ke)});H("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),H("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),R("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>R("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")).then(()=>k(0)).catch(E)})}function v(){const k=p.toGeoJSON(),E=[];let H=null;const R=X=>{if(X)switch(X.type){case"Point":H=X;break;case"Polygon":E.push(X.coordinates);break;case"MultiPolygon":E.push(...X.coordinates);break;case"GeometryCollection":(X.geometries||[]).forEach(R);break}};(k?.features||[]).forEach(X=>R(X.geometry));const J=H||(E.length?{type:"MultiPolygon",coordinates:E}:null);s("update:modelValue",J?Y(J):null),_.value=p.getLayers().length}function U(k=30){const E=p.getLayers();if(!E.length)return;const R=L.featureGroup(E).getBounds();R&&R.isValid()&&u.fitBounds(R,{padding:[k,k]})}function Z(){C.value?.click()}const P=e.ref("");function D(k){return k instanceof L.Circle?"Circle":k instanceof L.Rectangle?"Rectangle":k instanceof L.Polygon&&!(k instanceof L.Rectangle)?"Polygon":k instanceof L.Polyline&&!(k instanceof L.Polygon)?"Polyline":k instanceof L.Marker?"Point":"Feature"}function F(k){if(k instanceof L.Circle){const E=k.getRadius();return Math.PI*(E*E)/1e6}if(k instanceof L.Polygon||k instanceof L.Rectangle)try{const E=k.getLatLngs(),H=Array.isArray(E[0])?E[0]:E,R=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(H):0;return R?R/1e6:0}catch{return null}return null}function N(k){return k instanceof L.Circle?k.getLatLng():k.getBounds?k.getBounds().getCenter():k.getLatLng?k.getLatLng():u.getCenter()}function T(){const k=p.getLayers();if(!k.length){b.value=null,_.value=0;return}const E=k[k.length-1],H=D(E),R=N(E),J=F(E);b.value={type:H,center:R,areaKm2:J,layer:E},_.value=k.length}function W(){const k=b.value?.layer;k&&(k instanceof L.Circle&&k.getBounds?u.fitBounds(k.getBounds(),{padding:[30,30]}):k.getBounds?u.fitBounds(k.getBounds(),{padding:[30,30]}):k.getLatLng&&u.setView(k.getLatLng(),Math.max(A.value,14)))}function oe(){const k=b.value?.layer;k&&(p.removeLayer(k),v(),T())}e.onMounted(async()=>{document.addEventListener("wheel",w,{passive:!1}),await q(),L.drawLocal=Ca;const k=l.handleZoom;u=L.map(d.value,{zoomControl:!1,scrollWheelZoom:!k}).setView(m.value,10),setTimeout(()=>{h=S()},100),L.control.zoom({position:"bottomright"}).addTo(u),I.value=Object.keys(B)[0],V=L.tileLayer(B[I.value].url,{maxZoom:19,minZoom:6}).addTo(u),p=new L.FeatureGroup().addTo(u),u.on(L.Draw.Event.CREATED,R=>{const{layer:J}=R;p.clearLayers(),p.addLayer(J),v(),T(),U(),P.value=""}),u.on(L.Draw.Event.EDITED,()=>{v(),T(),U()}),u.on(L.Draw.Event.DELETED,()=>{v(),T(),U()});let E=!1;u.on("mousemove",R=>{E||(u.invalidateSize(),E=!0),M.value=R.latlng}),u.on("zoomend",()=>{A.value=u.getZoom()});const H=Ba(l.modelValue);if(H){const R=[];L.geoJSON(H).eachLayer(J=>R.push(J)),R.length&&p.addLayer(R[0]),v(),T(),U()}}),e.onUnmounted(()=>{document.removeEventListener("wheel",w),h&&h()});function ie(k){if(u){switch(g&&g.disable(),k){case"marker":g=new L.Draw.Marker(u);break;case"polyline":g=new L.Draw.Polyline(u);break;case"polygon":g=new L.Draw.Polygon(u);break;case"rectangle":g=new L.Draw.Rectangle(u);break;default:g=new L.Draw.Rectangle(u);break}g&&(g.enable(),P.value=k)}}function Pe(){const k=p.toGeoJSON(),E=new Blob([JSON.stringify(k,null,2)],{type:"application/json"}),H=URL.createObjectURL(E),R=document.createElement("a");R.href=H,R.download="data.geojson",R.click(),URL.revokeObjectURL(H)}function nt(k){const E=k.target,H=E.files?.[0];if(!H)return;const R=new FileReader;R.onload=()=>{if(typeof R.result=="string")try{const J=JSON.parse(R.result);p.clearLayers(),J&&L.geoJSON({type:"Feature",geometry:J}).eachLayer(X=>{p.addLayer(X)}),v(),T(),U()}finally{E.value=""}},R.readAsText(H)}function $e(k){u&&(V&&u.removeLayer(V),V=L.tileLayer(B[k].url,{maxZoom:19,minZoom:6}).addTo(u),I.value=k)}function ge(k){const E=L.latLng(k[0],k[1]);u.setView(E,13)}e.watch(()=>l.modelValue,k=>{const E=Y(k);if(k&&E!==k){s("update:modelValue",E);return}p.clearLayers(),E&&L.geoJSON({type:"Feature",geometry:E}).eachLayer(H=>{p.addLayer(H),H.dragging?.enable(),H.dragging?.enabled(),H.on("dragend",R=>{const X=R.target.getLatLng();s("update:modelValue",{type:"Point",coordinates:[X.lng,X.lat]})})}),_.value=p.getLayers().length,T(),U()});function lt(){return n?.appContext.config.globalProperties.$settings?.basemaps?n?.appContext.config.globalProperties.$settings?.basemaps.map((k,E)=>Object.assign(k,{key:`b${E}`,preview:k.preview||k.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((k,E)=>({...k,[E.key]:E}),{}):{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 Ee=e.ref(!1);return e.watch(Ee,()=>{setTimeout(()=>{u.invalidateSize()},50)}),(k,E)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:Ee.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:d,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(()=>[r.value&&l.handleZoom?(e.openBlock(),e.createElementBlock("div",rr,[e.createElementVNode("div",ir,[e.createElementVNode("p",cr,e.toDisplayString(i.value),1)])])):e.createCommentVNode("",!0)]),_:1}),e.createElementVNode("div",dr,[e.createVNode(tr,{onGoToCoordinates:ge}),e.createElementVNode("div",ur,[e.createElementVNode("div",pr,[e.createElementVNode("button",{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 hover:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:ring-offset-1 transition",onClick:Z},"Import"),e.createElementVNode("button",{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 hover:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:ring-offset-1 transition disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 disabled:border-gray-200 disabled:hover:bg-gray-100 disabled:hover:text-gray-400",onClick:Pe,disabled:_.value===0},"Export",8,hr)]),e.createElementVNode("input",{ref_key:"importRef",ref:C,type:"file",onChange:nt,accept:".json,.geojson",class:"hidden"},null,544)])]),e.createElementVNode("div",mr,[e.createElementVNode("div",fr,[o.value.includes("marker")?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":P.value==="marker"}]),"aria-pressed":P.value==="marker",title:"Point (P)","aria-label":"Draw point",onClick:E[0]||(E[0]=H=>ie("marker"))},[e.createVNode(Fa)],10,gr)):e.createCommentVNode("",!0),o.value.includes("polyline")?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":P.value==="polyline"}]),"aria-pressed":P.value==="polyline",title:"Line (L)","aria-label":"Draw polyline",onClick:E[1]||(E[1]=H=>ie("polyline"))},[e.createVNode(Ia)],10,kr)):e.createCommentVNode("",!0),o.value.includes("polygon")?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":P.value==="polygon"}]),"aria-pressed":P.value==="polygon",title:"Polygon (G)","aria-label":"Draw polygon",onClick:E[2]||(E[2]=H=>ie("polygon"))},[e.createVNode(Oa)],10,yr)):e.createCommentVNode("",!0),o.value.includes("rectangle")?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":P.value==="rectangle"}]),"aria-pressed":P.value==="rectangle",title:"Rectangle (R)","aria-label":"Draw rectangle",onClick:E[3]||(E[3]=H=>ie("rectangle"))},[e.createVNode(Pa)],10,br)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:E[4]||(E[4]=H=>{Ee.value=!Ee.value}),title:"Full Screen","aria-label":"Full Screen"},[e.createVNode(Ka,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",b.value?"bottom-8":"bottom-4"])},[e.createVNode(ar,{basemaps:e.unref(B),onOnLayerChange:$e},null,8,["basemaps"])],2),e.createElementVNode("div",xr,[b.value?(e.openBlock(),e.createElementBlock("div",wr,[e.createElementVNode("div",_r,[E[7]||(E[7]=e.createTextVNode(" Тип: ",-1)),e.createElementVNode("span",Er,e.toDisplayString(b.value.type),1)]),e.createElementVNode("div",Vr,[e.createElementVNode("div",vr,[E[8]||(E[8]=e.createTextVNode(" Центр: ",-1)),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",Cr,[E[9]||(E[9]=e.createTextVNode(" Площа: ",-1)),e.createElementVNode("b",null,e.toDisplayString(b.value.areaKm2.toFixed(1))+"км²",1)])):(e.openBlock(),e.createElementBlock("div",Br,E[10]||(E[10]=[e.createTextVNode(" Площа: ",-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:"Наблизити",onClick:E[5]||(E[5]=H=>W())},E[11]||(E[11]=[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-77633b64><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-77633b64></path><path d="M7 10l6 0" data-v-77633b64></path><path d="M10 7l0 6" data-v-77633b64></path><path d="M21 21l-6 -6" data-v-77633b64></path></svg>',1)])),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:"Видалити",onClick:E[6]||(E[6]=H=>oe())},[e.createVNode(Le,{class:"w-3 h-3"})])])])):e.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-77633b64"]]),Sr=["data-focus"],Mr={class:"flex items-center"},Nr={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Fr=["onClick","aria-label"],$r={key:0,class:"absolute text-gray-500 truncate pl-2"},Ar={class:"flex-1 min-w-[2px]"},Dr=["placeholder"],Ir={class:"flex items-center shrink-0"},Tr=["disabled"],Et=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(a,{emit:t}){const n=a,l=t;ae(n.style);const s=e.ref(null),o=e.ref(null),r=e.ref(null),i=e.ref(!1),c=e.ref(""),d=e.useModel(a,"modelValue"),u=e.computed(()=>n.placeholder||"Add tag…"),p=e.computed(()=>d.value?.length===0&&c.value===""),g=e.computed(()=>!n.disabled&&d.value?.length>0),h=e.computed(()=>n.disabled),C=async()=>{h.value||await e.nextTick(()=>r.value?.focus())},w=B=>{const V=B.trim();V!==""&&(!d.value||!Array.isArray(d.value)?d.value=[V]:n.unique?d.value.includes(V)||(d.value=[...d.value,V]):d.value=[...d.value,V],c.value="")},S=()=>{const B=c.value;B.trim()!==""&&w(B),c.value=""},M=B=>{const V=d.value.slice();V.splice(B,1),l("update:modelValue",V)},A=()=>{l("update:modelValue",[])},_=()=>{h.value||(i.value=!0)},m=()=>{i.value=!1,!h.value&&S()},b=B=>{const{key:V}=B;V==="Enter"?(B.preventDefault(),S()):V==="Backspace"&&c.value===""&&d.value.length>0&&M(d.value.length-1)};return(B,V)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:s,onClick:V[1]||(V[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.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":"",h.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:C},[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:o},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(I,Y)=>(e.openBlock(),e.createElementBlock("div",{key:Y,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",Mr,[e.createElementVNode("div",Nr,e.toDisplayString(I),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(q=>M(Y),["stop"]),"aria-label":`Remove ${I}`},V[2]||(V[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,Fr)]))),128)),p.value?(e.openBlock(),e.createElementBlock("div",$r,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Ar,[h.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:r,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":V[0]||(V[0]=I=>c.value=I),onFocus:_,onBlur:m,onKeydown:b,placeholder:d.value&&d.value.length?"":void 0},null,40,Dr)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",Ir,[g.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:h.value,onClick:e.withModifiers(A,["stop"])},V[3]||(V[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,Tr)):e.createCommentVNode("",!0)])],10,Sr)],2)],512))}}),Lr={class:"relative flex gap-1 bg-white w-full"},Rr=["disabled","placeholder"],Vt=G(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const t=e.inject("values"),n=a,l=e.useModel(a,"modelValue");function s(r){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 r.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const o=()=>{const r=t?.value?.[n.parent||""]?.toString(),i=s(r);l.value=i.toString()};return(r,i)=>(e.openBlock(),e.createElementBlock("div",Lr,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:r.disabled,placeholder:r.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>l.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,Rr),[[e.vModelText,l.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:o}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),Or={class:"relative flex gap-1 bg-white w-full"},zr=["disabled","placeholder"],jr=["disabled"],Ur={key:0},Pr={key:1},vt=G(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(a){const t=a,n=e.useModel(a,"modelValue"),l=e.ref(!1),s=e.computed(()=>t.init!==!1),o=e.computed(()=>!!t.table&&!!t.code),r=()=>{if(!o.value)return"";const d=encodeURIComponent(String(t.table)),u=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${u}`},i=async()=>{if(!o.value||l.value)return;const d=r();if(d){l.value=!0;try{const p=await(await fetch(d)).text();n.value=p}finally{l.value=!1}}},c=()=>{s.value&&(n.value||i())};return e.onMounted(()=>{c()}),e.watch(()=>[t.table,t.code,t.init],()=>{c()}),(d,u)=>(e.openBlock(),e.createElementBlock("div",Or,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=p=>n.value=p),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,zr),[[e.vModelText,n.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:l.value||d.disabled||!o.value,onClick:i},[l.value?(e.openBlock(),e.createElementBlock("span",Pr,"...")):(e.openBlock(),e.createElementBlock("span",Ur,"Gen"))],8,jr)]))}}),[["__scopeId","data-v-6ee5237d"]]),Hr={class:"w-full"},Gr={ref:"sortableContainer",class:"flex flex-col gap-1"},qr=["onDragstart","onDrop"],Kr={class:"w-1/3"},Zr={class:"w-2/3"},Wr=["onClick"],Yr={key:0,class:"text-[14px] text-gray-700"},Jr={class:"mt-2 w-full flex items-center"},Xr=["disabled"],Ct=G(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(a,{emit:t}){const n=S=>`${S}-${Math.random().toString(36).substring(2,15)}`,l=e.inject("values"),s=a,o=t,r=s.addButtonText??"Додати",i=s.ignore??[],c=e.ref([]),d=e.ref(null);(()=>{const S=s.parent&&l?.value?.[s.parent]||s.modelValue||{};c.value=Object.entries(S).filter(([M])=>!i.includes(M)).map(([M,A])=>({id:n("key-value-"),key:M,value:A}))})();function p(S){d.value=S}function g(S){if(d.value===null||d.value===S)return;const M=c.value.splice(d.value,1)[0];c.value.splice(S,0,M),d.value=null}const h=e.computed(()=>c.value.some(S=>S.key&&!S.value||!S.key&&S.value)),C=()=>{c.value.push({id:n("key-value-"),key:"",value:""})},w=S=>{c.value=c.value.filter(M=>M.id!==S)};return e.watch(c,S=>{const M={};S.forEach(_=>{_.key&&_.value!==void 0&&(M[_.key]=_.value)});const A={};i.length&&i.forEach(_=>{A[_]=s.parent?l?.value?.[s.parent]?.[_]:void 0}),l?.value&&s.parent&&(l.value[s.parent]={...A,...M}),o("update:modelValue",M)},{deep:!0}),(S,M)=>(e.openBlock(),e.createElementBlock("div",Hr,[e.createElementVNode("div",Gr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(A,_)=>(e.openBlock(),e.createElementBlock("div",{key:A.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===_}]),draggable:"true",onDragstart:m=>p(_),onDragover:M[0]||(M[0]=e.withModifiers(()=>{},["prevent"])),onDrop:m=>g(_)},[M[1]||(M[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",Kr,[e.createVNode(Ve,{modelValue:A.key,"onUpdate:modelValue":m=>A.key=m,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Zr,[e.createVNode(Ve,{modelValue:A.value,"onUpdate:modelValue":m=>A.value=m,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:m=>w(A.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(Jn),{height:"16",width:"16"})],8,Wr)],42,qr))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Yr," Дані для відображення відсутні ")),e.createElementVNode("div",Jr,[e.createElementVNode("button",{type:"button",onClick:C,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(ve,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(r)),1)],8,Xr)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),Qr={class:"flex items-center gap-2 w-full"},ei=["disabled"],Bt=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(a,{emit:t}){const n=a,{inputClass:l}=ae(n.style),s=t,o=e.computed({get:()=>n.modelValue||"#000000",set:r=>s("update:modelValue",r)});return(r,i)=>(e.openBlock(),e.createElementBlock("div",Qr,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),disabled:r.disabled,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[r.modelValue?"":"text-opacity-50",e.unref(l)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,ei),[[e.vModelText,o.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":i[1]||(i[1]=c=>o.value=c)},null,512),[[e.vModelText,o.value]])]))}}),ti={class:"flex items-center gap-2 w-full"},ni=["min","max","step","disabled"],St=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(a,{emit:t}){const n=a,{inputClass:l}=ae(n.style),s=t,o=e.computed({get:()=>Number(n.modelValue??n.min),set:r=>s("update:modelValue",Number(r))});return(r,i)=>(e.openBlock(),e.createElementBlock("div",ti,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),min:r.min,max:r.max,step:r.step,disabled:r.disabled,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[r.modelValue?"":"text-opacity-50",e.unref(l)].join(" ")])},null,10,ni),[[e.vModelText,o.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":i[1]||(i[1]=c=>o.value=c)},null,512),[[e.vModelText,o.value]])]))}}),li=["type","value","onInput","placeholder","disabled"],Mt=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:a=>a.count??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(a){const t=a,{inputClass:n}=ae(t.style),l=e.useModel(a,"modelValue");e.watchEffect(()=>{const o=l.value?.length??0;o<t.count&&(l.value=[...l.value??[],...Array(t.count-o)])});function s(o,r){const i=o.target.value,c=[...l.value];c[r]=t.inputType==="text"?i:Number(i),l.value=c}return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${o.limit}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.count,i=>(e.openBlock(),e.createElementBlock("input",{type:o.inputType,value:l.value?.[i-1]??"",onInput:c=>s(c,i-1),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,li))),256))],2))}}),Nt={VsInputText:Ve,VsInputRadio:We,"vs-input-text":Ve,"vs-input-password":Cn,"vs-input-textarea":bt,"vs-input-mask":at,"vs-input-number":ot,"vs-input-radio":We,"vs-input-select":Ye,"vs-input-switcher":Ke,"vs-input-static":Ze,"vs-input-container":yt,"vs-input-date":ct,"vs-input-checkbox":it,"vs-input-file":ft,"vs-input-html":Ze,"vs-input-email":rt,"vs-input-datatable":wt,"vs-input-map":_t,"vs-input-file-list":gt,"vs-input-tags":Et,"vs-input-slug":Vt,"vs-input-codegen":vt,"vs-input-key-value":Ct,"vs-input-range":St,"vs-input-color":Bt,"vs-input-native-select":Ye,"vs-input-array":Mt},si=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(a){const t=a,n=e.inject("values");async function l(){try{if(!t.api)return;const s=t.api.replace("{{value}}",t.value),o=await fetch(s);if(!o.ok){ee.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const r=await o.json();if(!t.set||!n)return;for(const[i,c]of Object.entries(t.set))n.value[i]=r.result[c]}catch(s){console.error(t.error,s)}}return(s,o)=>(e.openBlock(),e.createElementBlock("button",{onClick:l,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(s.button),1))}}),oi={class:"flex flex-col gap-1 w-full"},ai={key:0,class:"text-sm text-gray-500"},Ft=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(a){const t=a,n=e.useModel(a,"modelValue"),l=e.computed(()=>Vn[`${t.layout}`]),s=e.computed(()=>Nt?.[`vs-input-${t.item.type}`]),o=e.computed(()=>{const i=e.unref(s);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)}),r=e.computed(()=>{const i=t.item??{},c=o.value;return c.size?Object.fromEntries(Object.entries(i).filter(([d])=>c.has(d))):{}});return(i,c)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.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(s.value),e.mergeProps(r.value,{modelValue:n.value,"onUpdate:modelValue":c[0]||(c[0]=d=>n.value=d)}),null,16,["modelValue"])),i.item.description&&t.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",ai,e.toDisplayString(i.item.description),1)):e.createCommentVNode("",!0)]),i.item.behavior?.api&&i.item.behavior?.button?(e.openBlock(),e.createBlock(si,e.mergeProps({key:0},i.item.behavior,{value:n.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),ri={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},ii={class:"vs-compact-form-navigation__rail mt-[6px]"},ci=["onClick"],di=G(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(a,{expose:t}){const n=a,l=e.ref([]),s=e.ref(""),o=e.ref(""),r=e.computed(()=>!!n.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 v=n.width;if(v==null)return{};const U=typeof v=="number"?`${v}px`:`${v}`;return{width:U,minWidth:U}});let d=null,u=0,p=0,g=null,h=null,C=null;const w=()=>Y(),S=()=>A();e.watch(()=>n.target,async v=>{if(B(),!v){g=null,l.value=[],s.value="";return}g=v,r.value&&(await e.nextTick(),b(v),A())},{immediate:!0}),e.watch(()=>n.scrollContainer,v=>{if(!r.value){h=v??null;return}M(v??null),e.nextTick(()=>A())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||M(null),A()}),e.onBeforeUnmount(()=>{B(),M(null,!0),g=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),p&&window.cancelAnimationFrame(p))});function M(v,U=!1){if(C&&(C(),C=null),U){h=null;return}if(h=v??null,typeof window>"u")return;const Z=v??window,P=window;Z.addEventListener("scroll",w,{passive:!0}),P.addEventListener("resize",S),C=()=>{Z.removeEventListener("scroll",w),P.removeEventListener("resize",S)}}function A(){if(!r.value||!g)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const v=()=>{_(),u=0};typeof window>"u"?v():u=window.requestAnimationFrame(v)}function _(){if(!r.value||!g)return;const v=Array.from(g.querySelectorAll("h1, h2")),U=new Set,Z=[];v.forEach((P,D)=>{const F=P.textContent?.trim()??"";if(!F)return;let N=(P.getAttribute("id")??"").trim();N||(N=m(F)||`heading-${D+1}`);let T=N,W=1;for(;U.has(T);)T=`${N}-${W+=1}`;P.id!==T&&Object.assign(P,{id:T}),U.add(T),Z.push({id:T,text:F,level:P.tagName.toLowerCase()==="h1"?1:2})}),l.value=Z,Z.length||(s.value=""),I()}function m(v){return v.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function b(v){!v||!r.value||typeof MutationObserver>"u"||(B(),d=new MutationObserver(()=>A()),d.observe(v,{childList:!0,subtree:!0}))}function B(){d&&(d.disconnect(),d=null)}function V(v){const U=h;if(!U)return typeof window>"u"?v.offsetTop:v.getBoundingClientRect().top+window.scrollY;const Z=v.getBoundingClientRect(),P=U.getBoundingClientRect();return Z.top-P.top+U.scrollTop}function I(){if(!r.value||!l.value.length)return;const v=h,U=(v?v.scrollTop:null)||(typeof window<"u"?window.scrollY:0),Z=(v?v.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),P=U+Z;let D=null;for(let N=0;N<l.value.length;N+=1){const T=l.value[N],W=document.getElementById(T.id);if(W){const oe=V(W);oe+W.offsetHeight>U&&oe<P&&(D=T.id)}}!D&&o.value&&(D=o.value),D&&(o.value=D);const F=v?v.scrollHeight-v.clientHeight:document.documentElement.scrollHeight-window.innerHeight;U+5>=F&&(D=l.value[l.value.length-1].id),D&&(s.value=D)}function Y(){r.value&&(p&&window.cancelAnimationFrame(p),p=window.requestAnimationFrame(()=>{I(),p=0}))}function q(v){if(!r.value)return;const U=document.getElementById(v);if(!U)return;const Z=h,P=Math.max(0,V(U));Z?Z.scrollTo({top:P,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:P,behavior:"smooth"})}return t({refresh:A}),(v,U)=>r.value&&l.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",ri,e.toDisplayString(v.title),1),e.createElementVNode("div",ii,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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===s.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:P=>q(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===s.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(Z.text),1)],10,ci)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),$t={required:"Це поле є обов’язковим",email:"Неправильний email"},ui=a=>a?!1:$t.required,pi=a=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return a?t.test(a)?!1:$t.email:!1},hi=(a,t)=>{const n=t.pattern??t.regexp;return!(typeof n=="string"?new RegExp(n):n).test(a)&&a?t.message:!1},mi=(a,t)=>!1,fi=(a,t)=>{switch(typeof t=="string"?t:t.type){case"required":return ui(a);case"email":return pi(a);case"regexp":return hi(a,t);case"custom":return mi();default:return!1}},gi={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function At(a){const t=a.toLowerCase();return gi[t]||t}function Je(a,t=!1){if(Array.isArray(a)){const l=[];return a.forEach(s=>{const o={...s};o.name=(s.name||s.id||s.key||"").toString(),o.type=At(s.type),o.label=s.label||s.ua,o.rules=s.rules||s.validators,o.type==="email"&&!o.rules&&(o.rules=["email"]),s.data&&(o.api=`/api/suggest/${s.data}`),o.disabled=t||o.disabled,Array.isArray(o.schema)&&(o.schema=Je(o.schema,o.disabled)),l.push(o)}),l}const n=[];return Object.entries(a).forEach(l=>{const s={name:l[0],...l[1],type:At(l[1].type),label:l[1].label||l[1].ua,rules:l[1].rules||l[1].validators,disabled:t};s.type==="email"&&!s.rules&&(s.rules=["email"]),l[1].type.includes("list")&&(s.multiple=!0),!s.api&&l[1].data&&(s.api=`/api/suggest/${l[1].data}`),Array.isArray(s.schema)&&(s.schema=Je(s.schema,s.disabled)),n.push(s)}),n}function ki(a,t,n=!1){const l=e.computed(()=>Je((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),s=e.ref({});function o(d){const u=d?.conditions;if(!u)return!0;const p=Array.isArray(u)?u[0]:u,g=a?.value?.[p];return kt(g,u)}const r=(d=l.value,u=!0)=>(d.forEach(p=>{if(p.rules){if(!o(p)){delete s.value[p.name];return}let g=!1,h=null;p.rules.forEach(C=>{const w=fi(a.value[p.name],C);w&&(g=!0,!h&&typeof w=="string"&&(h=w))}),g&&h?s.value[p.name]=h:delete s.value[p.name]}p.schema&&r(p.schema,!1)}),u&&Object.values(s.value).some(Boolean)?s.value:null),i=e.computed(()=>l.value?.filter(d=>d.hidden!==!0&&o(d)));return{errors:s,validate:r,reset:()=>{a.value={},s.value={}},visibleSchema:i}}const yi={class:"flex w-full h-full min-h-0 gap-6"},bi={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},be=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(a,{expose:t,emit:n}){const l=n,s=a,o=e.useModel(a,"form"),r=e.useModel(a,"values"),{errors:i,validate:c,reset:d,visibleSchema:u}=ki(r,s.schema,e.toRef(s,"disabled")),p=e.ref(null),g=e.ref(null),h=e.computed(()=>s.navigation),C=e.computed(()=>s.navWidth),w=e.computed(()=>s.style?.columns),S=Object.freeze({container:12,label:3}),M=e.computed(()=>s.columns??w.value??S),A=e.computed(()=>s.columns!=null||w.value!=null),_=e.computed(()=>A.value?"horizontal":s.layout),m=I=>I?.columns?"horizontal":_.value,b=I=>I?.columns??M.value,B=()=>{l("update:modelValue",r.value),c(),l("handle-submit",r.value)};t({validate:c,reset:d,errors:i}),e.onMounted(()=>{s.modelValue&&(r.value=s.modelValue),o.value={value:r.value,errors:i.value,reset:d,validate:c,formId:s.formId}});function V(I,Y){if(I===Y)return!0;if(typeof I!="object"||typeof Y!="object"||!I||!Y)return!1;const q=Object.keys(I),v=Object.keys(Y);return q.length!==v.length?!1:q.every(U=>I[U]===Y[U])}return e.provide("form",o),e.provide("values",r),(I,Y)=>(e.openBlock(),e.createElementBlock("div",yi,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:g},[e.createElementVNode("form",{ref_key:"formRef",ref:p,onSubmit:e.withModifiers(B,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",_.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(u),(q,v)=>(e.openBlock(),e.createElementBlock("div",{key:q.name,class:e.normalizeClass(m(q)==="horizontal"?"col-span-12":`col-span-${q.col||12}`)},[e.createVNode(Ft,{style:e.normalizeStyle(I.style),item:q,layout:m(q),columns:b(q),"model-value":r.value[q.name],"onUpdate:modelValue":U=>{const Z=r.value[q.name];V(Z,U)||(r.value[q.name]=U)},error:e.unref(i)[q.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),m(q)==="settings"&&v+1!==e.unref(u).length?(e.openBlock(),e.createElementBlock("div",bi)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(di,{target:p.value,"scroll-container":g.value,enabled:h.value,width:C.value},null,8,["target","scroll-container","enabled","width"])]))}}),xi={class:"relative"},wi={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},_i={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"},Ei={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Vi={class:"font-medium text-gray-800 dark:text-[#ffffff]"},vi={class:"p-4 mim-h-0 h-full overflow-auto"},Dt=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(a,{emit:t}){const n=a,l=t,s=e.ref(n.schema),o=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),r=e.ref({}),i=e.ref(),c=e.ref(n.mode);async function d(){const p=r.value.validate();if(p){ee.notify({type:"warning",title:"Помилка валідації",message:Object.entries(p).map(([g,h])=>`${g}: ${h}`).join(`
|
|
3
|
+
`)});return}if(i.value)try{const g=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o.value)});if(g.ok)await g.json(),ee.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),l("save",o.value);else if(g.status===400){const h=await g.json().catch(()=>({}));ee.notify({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else g.status===500?ee.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):ee.notify({type:"error",title:"Помилка",message:`Статус: ${g.status}`})}catch(g){ee.notify({type:"error",title:"Помилка з’єднання",message:g.message||"Не вдалося виконати запит"})}}function u(){l("close")}return e.onMounted(async()=>{try{if(n.form){const p=await fetch(`/api/template/form/${n.form}`);if(!p.ok){ee.notify({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const g=await p.json();s.value=g.schema,i.value=g.token}else if(n.token){i.value=n.token;const p=await fetch(`/api/form/${i.value}`);if(!p.ok){ee.notify({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const g=await p.json();s.value=g.schema,g.data?o.value=g.data:c.value="add"}}catch(p){ee.notify({type:"error",title:"Error",message:p.message||"Unexpected error"}),console.error(p)}}),(p,g)=>(e.openBlock(),e.createElementBlock("div",xi,[e.createElementVNode("div",wi,[e.createElementVNode("div",_i,[e.createElementVNode("div",Ei,[e.createElementVNode("h3",Vi,e.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:u,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"},g[2]||(g[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",vi,[s.value?(e.openBlock(),e.createBlock(be,{key:0,schema:s.value,values:o.value,"onUpdate:values":g[0]||(g[0]=h=>o.value=h),form:r.value,"onUpdate:form":g[1]||(g[1]=h=>r.value=h)},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:u,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"}," Зберегти ")])])])]))}}),It=(a={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=ee.modal({title:a.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Dt,contentProps:{...a,onClose:()=>{t(null),n()},onSave:l=>{t(l),n()}}})});be.install=function(t){t.component("VForm",be),Object.assign(t.config.globalProperties,{$form:It}),t.provide("form",It),window.v3plugin||(window.v3plugin={})};function me(a){return typeof a=="string"||a instanceof String}function Tt(a){var t;return typeof a=="object"&&a!=null&&(a==null||(t=a.constructor)==null?void 0:t.name)==="Object"}function Lt(a,t){return Array.isArray(t)?Lt(a,(n,l)=>t.includes(l)):Object.entries(a).reduce((n,l)=>{let[s,o]=l;return t(o,s)&&(n[s]=o),n},{})}const $={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Rt(a){switch(a){case $.LEFT:return $.FORCE_LEFT;case $.RIGHT:return $.FORCE_RIGHT;default:return a}}function Xe(a){return a.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Oe(a,t){if(t===a)return!0;const n=Array.isArray(t),l=Array.isArray(a);let s;if(n&&l){if(t.length!=a.length)return!1;for(s=0;s<t.length;s++)if(!Oe(t[s],a[s]))return!1;return!0}if(n!=l)return!1;if(t&&a&&typeof t=="object"&&typeof a=="object"){const o=t instanceof Date,r=a instanceof Date;if(o&&r)return t.getTime()==a.getTime();if(o!=r)return!1;const i=t instanceof RegExp,c=a instanceof RegExp;if(i&&c)return t.toString()==a.toString();if(i!=c)return!1;const d=Object.keys(t);for(s=0;s<d.length;s++)if(!Object.prototype.hasOwnProperty.call(a,d[s]))return!1;for(s=0;s<d.length;s++)if(!Oe(a[d[s]],t[d[s]]))return!1;return!0}else if(t&&a&&typeof t=="function"&&typeof a=="function")return t.toString()===a.toString();return!1}class Ci{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?$.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?$.RIGHT:$.LEFT}}function O(a,t){return new O.InputMask(a,t)}function Ot(a){if(a==null)throw new Error("mask property should be defined");return a instanceof RegExp?O.MaskedRegExp:me(a)?O.MaskedPattern:a===Date?O.MaskedDate:a===Number?O.MaskedNumber:Array.isArray(a)||a===Array?O.MaskedDynamic:O.Masked&&a.prototype instanceof O.Masked?a:O.Masked&&a instanceof O.Masked?a.constructor:a instanceof Function?O.MaskedFunction:(console.warn("Mask not found for mask",a),O.Masked)}function _e(a){if(!a)throw new Error("Options in not defined");if(O.Masked){if(a.prototype instanceof O.Masked)return{mask:a};const{mask:t=void 0,...n}=a instanceof O.Masked?{mask:a}:Tt(a)&&a.mask instanceof O.Masked?a:{};if(t){const l=t.mask;return{...Lt(t,(s,o)=>!o.startsWith("_")),mask:t.constructor,_mask:l,...n}}}return Tt(a)?{...a}:{mask:a}}function ue(a){if(O.Masked&&a instanceof O.Masked)return a;const t=_e(a),n=Ot(t.mask);if(!n)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===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}O.createMask=ue;class ze{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,n){if(!(t==null||n==null||t===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(t,n)}catch{}}get isActive(){return!1}}O.MaskElement=ze;const zt=90,Bi=89;class Be extends ze{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,n,l;return(t=(n=(l=this.input).getRootNode)==null?void 0:n.call(l))!=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===zt&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===Bi&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===zt&&(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={}}}O.HTMLMaskElement=Be;class jt extends Be{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,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}O.HTMLMaskElement=Be;class Qe extends Be{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),l=n&&n.anchorOffset,s=n&&n.focusOffset;return s==null||l==null||l<s?l:s}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),l=n&&n.anchorOffset,s=n&&n.focusOffset;return s==null||l==null||l>s?l:s}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const l=this.rootElement.createRange();l.setStart(this.input.firstChild||this.input,t),l.setEnd(this.input.lastChild||this.input,n);const s=this.rootElement,o=s.getSelection&&s.getSelection();o&&(o.removeAllRanges(),o.addRange(l))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}O.HTMLContenteditableMaskElement=Qe;class je{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>je.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}}je.MAX_LENGTH=100;class Ut{constructor(t,n){this.el=t instanceof ze?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new Qe(t):new jt(t),this.masked=ue(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new je,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 n;return t==null||((n=this.masked)==null?void 0:n.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof O.Masked)&&this.masked.constructor===Ot(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof O.Masked?t:ue({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}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,n){const l=this._listeners[t];l&&l.forEach(s=>s(n))}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 n=this.masked.unmaskedValue,l=this.masked.value,s=this.masked.rawInputValue,o=this.displayValue,r=this.unmaskedValue!==n||this.value!==l||this._rawInputValue!==s;this._unmaskedValue=n,this._value=l,this._rawInputValue=s,this.el.value!==o&&(this.el.value=o),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),r&&this._fireChangeEvents(),!this._historyChanging&&(r||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...l}=t,s=!this.maskEquals(n),o=this.masked.optionsIsChanged(l);s&&(this.mask=n),o&&this.masked.updateOptions(l),(s||o)&&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,$.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const l=this._listeners[t].indexOf(n);return l>=0&&this._listeners[t].splice(l,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new Ci({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),l=this.masked.rawInputValue,s=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,o=l===this.masked.rawInputValue?n.removeDirection:$.NONE;let r=this.masked.nearestInputPos(n.startChangePos+s,o);o!==$.NONE&&(r=this.masked.nearestInputPos(r,$.NONE)),this.updateControl(r),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}}O.InputMask=Ut;class j{static normalize(t){return Array.isArray(t)?t:[t,new j]}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}}O.ChangeDetails=j;class pe{constructor(t,n,l){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=l}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 n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class ne{constructor(t){this._value="",this._update({...ne.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,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),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,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new pe(this.extractInput(t,n),t)}appendTail(t){return me(t)&&(t=new pe(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new j({inserted:t,rawInserted:t})):new j}_appendChar(t,n,l){n===void 0&&(n={});const s=this.state;let o;if([t,o]=this.doPrepareChar(t,n),t&&(o=o.aggregate(this._appendCharRaw(t,n)),!o.rawInserted&&this.autofix==="pad")){const r=this.state;this.state=s;let i=this.pad(n);const c=this._appendCharRaw(t,n);i=i.aggregate(c),c.rawInserted||i.equals(o)?o=i:this.state=r}if(o.inserted){let r,i=this.doValidate(n)!==!1;if(i&&l!=null){const c=this.state;if(this.overwrite===!0){r=l.state;for(let u=0;u<o.rawInserted.length;++u)l.unshift(this.displayValue.length-o.tailShift)}let d=this.appendTail(l);if(i=d.rawInserted.length===l.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,r=l.state;for(let u=0;u<o.rawInserted.length;++u)l.shift();d=this.appendTail(l),i=d.rawInserted.length===l.toString().length}i&&d.inserted&&(this.state=c)}i||(o=new j,this.state=s,l&&r&&(l.state=r))}return o}_appendPlaceholder(){return new j}_appendEager(){return new j}append(t,n,l){if(!me(t))throw new Error("value should be string");const s=me(l)?new pe(String(l)):l;n!=null&&n.tail&&(n._beforeTailState=this.state);let o;[t,o]=this.doPrepare(t,n);for(let r=0;r<t.length;++r){const i=this._appendChar(t[r],n,s);if(!i.rawInserted&&!this.doSkipInvalid(t[r],n,s))break;o.aggregate(i)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&o.aggregate(this._appendEager()),s!=null&&(o.tailShift+=this.appendTail(s).tailShift),o}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new j}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,l=this.value,s=t();return this.rawInputValue=n,this.value&&this.value!==l&&l.indexOf(this.value)===0&&(this.append(l.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,s}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,l=t(this);return this.state=n,delete this._isolated,l}doSkipInvalid(t,n,l){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),j.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),j.normalize(this.prepareChar?this.prepareChar(t,this,n):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,n,l,s,o){l===void 0&&(l=""),s===void 0&&(s=$.NONE),o===void 0&&(o={input:!0});const r=t+n,i=this.extractTail(r),c=this.eager===!0||this.eager==="remove";let d;c&&(s=Rt(s),d=this.extractInput(0,r,{raw:!0}));let u=t;const p=new j;if(s!==$.NONE&&(u=this.nearestInputPos(t,n>1&&t!==0&&!c?$.NONE:s),p.tailShift=u-t),p.aggregate(this.remove(u)),c&&s!==$.NONE&&d===this.rawInputValue)if(s===$.FORCE_LEFT){let g;for(;d===this.rawInputValue&&(g=this.displayValue.length);)p.aggregate(new j({tailShift:-1})).aggregate(this.remove(g-1))}else s===$.FORCE_RIGHT&&i.unshift();return p.aggregate(this.append(l,o,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!Oe(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||ne.EMPTY_VALUES.includes(t)&&ne.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new j}}ne.DEFAULTS={skipInvalid:!0},ne.EMPTY_VALUES=[void 0,null,""],O.Masked=ne;class fe{constructor(t,n){t===void 0&&(t=[]),n===void 0&&(n=0),this.chunks=t,this.from=n}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=me(t)?new pe(String(t)):t;const n=this.chunks[this.chunks.length-1],l=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof pe)l?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof fe){if(t.stop==null){let s;for(;t.chunks.length&&t.chunks[0].stop==null;)s=t.chunks.shift(),s.from+=t.from,this.extend(s)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof O.MaskedPattern))return new pe(this.toString()).appendTo(t);const n=new j;for(let l=0;l<this.chunks.length;++l){const s=this.chunks[l],o=t._mapPosToBlock(t.displayValue.length),r=s.stop;let i;if(r!=null&&(!o||o.index<=r)&&((s instanceof fe||t._stops.indexOf(r)>=0)&&n.aggregate(t._appendPlaceholder(r)),i=s instanceof fe&&t._blocks[r]),i){const c=i.appendTail(s);n.aggregate(c);const d=s.toString().slice(c.rawInserted.length);d&&n.aggregate(t.append(d,{tail:!0}))}else n.aggregate(t.append(s.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...l}=t;Object.assign(this,l),this.chunks=n.map(s=>{const o="chunks"in s?new fe:new pe;return o.state=s,o})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let l=0;for(;l<this.chunks.length;){const s=this.chunks[l],o=s.unshift(n);if(s.toString()){if(!o)break;++l}else this.chunks.splice(l,1);if(o)return o}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],l=n.shift();if(n.toString()){if(!l)break;--t}else this.chunks.splice(t,1);if(l)return l}return""}}class Si{constructor(t,n){this.masked=t,this._log=[];const{offset:l,index:s}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=l,this.index=s,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=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;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,$.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,$.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,$.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,$.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,$.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,$.NONE),!0})}}class et{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,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new j}nearestInputPos(t,n){n===void 0&&(n=$.NONE);const l=0,s=this._value.length;switch(n){case $.LEFT:case $.FORCE_LEFT:return l;case $.NONE:case $.RIGHT:case $.FORCE_RIGHT:default:return s}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),l===void 0&&(l={}),l.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new j;const l=this.eager===!0||this.eager==="append",o=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!l)&&!n.tail,r=new j({inserted:this.char,rawInserted:o?this.char:""});return this._value=this.char,this._isRawInput=o&&(n.raw||n.input),r}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new j;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new pe("")}appendTail(t){return me(t)&&(t=new pe(String(t))),t.appendTo(this)}append(t,n,l){const s=this._appendChar(t[0],n);return l!=null&&(s.tailShift+=this.appendTail(l).tailShift),s}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 Se{constructor(t){const{parent:n,isOptional:l,placeholderChar:s,displayChar:o,lazy:r,eager:i,...c}=t;this.masked=ue(c),Object.assign(this,{parent:n,isOptional:l,placeholderChar:s,displayChar:o,lazy:r,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new j}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,n){if(n===void 0&&(n={}),this.isFilled)return new j;const l=this.masked.state;let s=this.masked._appendChar(t,this.currentMaskFlags(n));return s.inserted&&this.doValidate(n)===!1&&(s=new j,this.masked.state=l),!s.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(s.inserted=this.placeholderChar),s.skip=!s.inserted&&!this.isOptional,this.isFilled=!!s.inserted,s}append(t,n,l){return this.masked.append(t,this.currentMaskFlags(n),l)}_appendPlaceholder(){return this.isFilled||this.isOptional?new j:(this.isFilled=!0,new j({inserted:this.placeholderChar}))}_appendEager(){return new j}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,l)}nearestInputPos(t,n){n===void 0&&(n=$.NONE);const l=0,s=this.value.length,o=Math.min(Math.max(t,l),s);switch(n){case $.LEFT:case $.FORCE_LEFT:return this.isComplete?o:l;case $.RIGHT:case $.FORCE_RIGHT:return this.isComplete?o:s;case $.NONE:default:return o}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).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 n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new j}}Se.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 Pt extends ne{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=l=>l.search(n)>=0),super._update(t)}}O.MaskedRegExp=Pt;class le extends ne{constructor(t){super({...le.DEFAULTS,...t,definitions:Object.assign({},Se.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 n=this.mask;if(!n||!t)return;let l=!1,s=!1;for(let o=0;o<n.length;++o){if(this.blocks){const d=n.slice(o),u=Object.keys(this.blocks).filter(g=>d.indexOf(g)===0);u.sort((g,h)=>h.length-g.length);const p=u[0];if(p){const{expose:g,repeat:h,...C}=_e(this.blocks[p]),w={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...C,repeat:h,parent:this},S=h!=null?new O.RepeatBlock(w):ue(w);S&&(this._blocks.push(S),g&&(this.exposeBlock=S),this._maskedBlocks[p]||(this._maskedBlocks[p]=[]),this._maskedBlocks[p].push(this._blocks.length-1)),o+=p.length-1;continue}}let r=n[o],i=r in t;if(r===le.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(r==="{"||r==="}"){l=!l;continue}if(r==="["||r==="]"){s=!s;continue}if(r===le.ESCAPE_CHAR){if(++o,r=n[o],!r)break;i=!1}const c=i?new Se({isOptional:s,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,..._e(t[r]),parent:this}):new et({char:r,eager:this.eager,isUnmasking:l});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:n,...l}=t;this._blocks.forEach((s,o)=>s.state=n[o]),super.state=l}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,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new j;let l=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(l==null)return n;this._blocks[l].isFilled&&++l;for(let s=l;s<this._blocks.length;++s){const o=this._blocks[s]._appendEager();if(!o.inserted)break;n.aggregate(o)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const l=this._mapPosToBlock(this.displayValue.length),s=new j;if(!l)return s;for(let r=l.index,i;i=this._blocks[r];++r){var o;const c=i._appendChar(t,{...n,_beforeTailState:(o=n._beforeTailState)==null||(o=o._blocks)==null?void 0:o[r]});if(s.aggregate(c),c.consumed)break}return s}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const l=new fe;return t===n||this._forEachBlocksInRange(t,n,(s,o,r,i)=>{const c=s.extractTail(r,i);c.stop=this._findStopBefore(o),c.from=this._blockStartPos(o),c instanceof fe&&(c.blockIndex=o),l.extend(c)}),l}extractInput(t,n,l){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),l===void 0&&(l={}),t===n)return"";let s="";return this._forEachBlocksInRange(t,n,(o,r,i,c)=>{s+=o.extractInput(i,c,l)}),s}_findStopBefore(t){let n;for(let l=0;l<this._stops.length;++l){const s=this._stops[l];if(s<=t)n=s;else break}return n}_appendPlaceholder(t){const n=new j;if(this.lazy&&t==null)return n;const l=this._mapPosToBlock(this.displayValue.length);if(!l)return n;const s=l.index,o=t??this._blocks.length;return this._blocks.slice(s,o).forEach(r=>{if(!r.lazy||t!=null){var i;n.aggregate(r._appendPlaceholder((i=r._blocks)==null?void 0:i.length))}}),n}_mapPosToBlock(t){let n="";for(let l=0;l<this._blocks.length;++l){const s=this._blocks[l],o=n.length;if(n+=s.displayValue,t<=n.length)return{index:l,offset:t-o}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,l)=>n+=l.displayValue.length,0)}_forEachBlocksInRange(t,n,l){n===void 0&&(n=this.displayValue.length);const s=this._mapPosToBlock(t);if(s){const o=this._mapPosToBlock(n),r=o&&s.index===o.index,i=s.offset,c=o&&r?o.offset:this._blocks[s.index].displayValue.length;if(l(this._blocks[s.index],s.index,i,c),o&&!r){for(let d=s.index+1;d<o.index;++d)l(this._blocks[d],d,0,this._blocks[d].displayValue.length);l(this._blocks[o.index],o.index,0,o.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const l=super.remove(t,n);return this._forEachBlocksInRange(t,n,(s,o,r,i)=>{l.aggregate(s.remove(r,i))}),l}nearestInputPos(t,n){if(n===void 0&&(n=$.NONE),!this._blocks.length)return 0;const l=new Si(this,t);if(n===$.NONE)return l.pushRightBeforeInput()||(l.popState(),l.pushLeftBeforeInput())?l.pos:this.displayValue.length;if(n===$.LEFT||n===$.FORCE_LEFT){if(n===$.LEFT){if(l.pushRightBeforeFilled(),l.ok&&l.pos===t)return t;l.popState()}if(l.pushLeftBeforeInput(),l.pushLeftBeforeRequired(),l.pushLeftBeforeFilled(),n===$.LEFT){if(l.pushRightBeforeInput(),l.pushRightBeforeRequired(),l.ok&&l.pos<=t||(l.popState(),l.ok&&l.pos<=t))return l.pos;l.popState()}return l.ok?l.pos:n===$.FORCE_LEFT?0:(l.popState(),l.ok||(l.popState(),l.ok)?l.pos:0)}return n===$.RIGHT||n===$.FORCE_RIGHT?(l.pushRightBeforeInput(),l.pushRightBeforeRequired(),l.pushRightBeforeFilled()?l.pos:n===$.FORCE_RIGHT?this.displayValue.length:(l.popState(),l.ok||(l.popState(),l.ok)?l.pos:this.nearestInputPos(t,$.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let l=0;return this._forEachBlocksInRange(t,n,(s,o,r,i)=>{l+=s.totalInputPositions(r,i)}),l}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(l=>this._blocks[l]):[]}pad(t){const n=new j;return this._forEachBlocksInRange(0,this.displayValue.length,l=>n.aggregate(l.pad(t))),n}}le.DEFAULTS={...ne.DEFAULTS,lazy:!0,placeholderChar:"_"},le.STOP_CHAR="`",le.ESCAPE_CHAR="\\",le.InputDefinition=Se,le.FixedDefinition=et,O.MaskedPattern=le;class Me extends le{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:l=this.from||0,maxLength:s=this.maxLength||0,autofix:o=this.autofix,...r}=t;this.to=n,this.from=l,this.maxLength=Math.max(String(n).length,s),this.autofix=o;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;r.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(r)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",l="";const[,s,o]=t.match(/^(\D*)(\d*)(\D*)/)||[];return o&&(n="0".repeat(s.length)+o,l="9".repeat(s.length)+o),n=n.padEnd(this.maxLength,"0"),l=l.padEnd(this.maxLength,"9"),[n,l]}doPrepareChar(t,n){n===void 0&&(n={});let l;return[t,l]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(l.skip=!this.isComplete),[t,l]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const l=String(this.from).padStart(this.maxLength,"0"),s=String(this.to).padStart(this.maxLength,"0"),[o,r]=this.boundaries(this.value+t);return Number(r)<this.from?super._appendCharRaw(l[this.value.length],n):Number(o)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(l[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(s[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[s,o]=this.boundaries(n);return this.from<=Number(o)&&Number(s)<=this.to&&super.doValidate(t)}pad(t){const n=new j;if(this.value.length===this.maxLength)return n;const l=this.value,s=this.maxLength-this.value.length;if(s){this.reset();for(let o=0;o<s;++o)n.aggregate(super._appendCharRaw("0",t));l.split("").forEach(o=>this._appendCharRaw(o))}return n}}O.MaskedRange=Me;const Mi="d{.}`m{.}`Y";class he extends le{static extractPatternOptions(t){const{mask:n,pattern:l,...s}=t;return{...s,mask:me(n)?n:l}}constructor(t){super(he.extractPatternOptions({...he.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:l,blocks:s,...o}={...he.DEFAULTS,...t},r=Object.assign({},he.GET_DEFAULT_BLOCKS());t.min&&(r.Y.from=t.min.getFullYear()),t.max&&(r.Y.to=t.max.getFullYear()),t.min&&t.max&&r.Y.from===r.Y.to&&(r.m.from=t.min.getMonth()+1,r.m.to=t.max.getMonth()+1,r.m.from===r.m.to&&(r.d.from=t.min.getDate(),r.d.to=t.max.getDate())),Object.assign(r,this.blocks,s),super._update({...o,mask:me(n)?n:l,blocks:r})}doValidate(t){const n=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=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(he.extractPatternOptions(t))}}he.GET_DEFAULT_BLOCKS=()=>({d:{mask:Me,from:1,to:31,maxLength:2},m:{mask:Me,from:1,to:12,maxLength:2},Y:{mask:Me,from:1900,to:9999}}),he.DEFAULTS={...le.DEFAULTS,mask:Date,pattern:Mi,format:(a,t)=>{if(!a)return"";const n=String(a.getDate()).padStart(2,"0"),l=String(a.getMonth()+1).padStart(2,"0"),s=a.getFullYear();return[n,l,s].join(".")},parse:(a,t)=>{const[n,l,s]=a.split(".").map(Number);return new Date(s,l-1,n)}},O.MaskedDate=he;class Ne extends ne{constructor(t){super({...Ne.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(n=>{const{expose:l,...s}=_e(n),o=ue({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return l&&(this.exposeMask=o),o}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const l=this._applyDispatch(t,n);return this.currentMask&&l.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),l}_applyDispatch(t,n,l){t===void 0&&(t=""),n===void 0&&(n={}),l===void 0&&(l="");const s=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,o=this.rawInputValue,r=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:o,i=o.slice(r.length),c=this.currentMask,d=new j,u=c?.state;return this.currentMask=this.doDispatch(t,{...n},l),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),r&&(this.currentMask.append(r,{raw:!0}),d.tailShift=this.currentMask.value.length-s.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),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 n=new j;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,l;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((l=t._beforeTailState)==null?void 0:l.currentMask)||t._beforeTailState}}doDispatch(t,n,l){return n===void 0&&(n={}),l===void 0&&(l=""),this.dispatch(t,this,n,l)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[l,s]=super.doPrepare(t,n);if(this.currentMask){let o;[l,o]=super.doPrepare(l,this.currentMaskFlags(n)),s=s.aggregate(o)}return[l,s]}doPrepareChar(t,n){n===void 0&&(n={});let[l,s]=super.doPrepareChar(t,n);if(this.currentMask){let o;[l,o]=super.doPrepareChar(l,this.currentMaskFlags(n)),s=s.aggregate(o)}return[l,s]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.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 n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}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,n){const l=new j;return this.currentMask&&l.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),l}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:l,currentMask:s,...o}=t;n&&this.compiledMasks.forEach((r,i)=>r.state=n[i]),l!=null&&(this.currentMask=l,this.currentMask.state=s),super.state=o}extractInput(t,n,l){return this.currentMask?this.currentMask.extractInput(t,n,l):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}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((n,l)=>{if(!t[l])return;const{mask:s,...o}=t[l];return Oe(n,o)&&n.maskEquals(s)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}Ne.DEFAULTS={...ne.DEFAULTS,dispatch:(a,t,n,l)=>{if(!t.compiledMasks.length)return;const s=t.rawInputValue,o=t.compiledMasks.map((r,i)=>{const c=t.currentMask===r,d=c?r.displayValue.length:r.nearestInputPos(r.displayValue.length,$.FORCE_LEFT);return r.rawInputValue!==s?(r.reset(),r.append(s,{raw:!0})):c||r.remove(d),r.append(a,t.currentMaskFlags(n)),r.appendTail(l),{index:i,weight:r.rawInputValue.length,totalInputPositions:r.totalInputPositions(0,Math.max(d,r.nearestInputPos(r.displayValue.length,$.FORCE_LEFT)))}});return o.sort((r,i)=>i.weight-r.weight||i.totalInputPositions-r.totalInputPositions),t.compiledMasks[o[0].index]}},O.MaskedDynamic=Ne;class Fe extends le{constructor(t){super({...Fe.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...l}=t;if(n){const s=n.map(i=>i.length),o=Math.min(...s),r=Math.max(...s)-o;l.mask="*".repeat(o),r&&(l.mask+="["+"*".repeat(r)+"]"),this.enum=n}super._update(l)}_appendCharRaw(t,n){n===void 0&&(n={});const l=Math.min(this.nearestInputPos(0,$.FORCE_RIGHT),this.value.length),s=this.enum.filter(o=>this.matchValue(o,this.unmaskedValue+t,l));if(s.length){s.length===1&&this._forEachBlocksInRange(0,this.value.length,(r,i)=>{const c=s[0][i];i>=this.value.length||c===r.value||(r.reset(),r._appendChar(c,n))});const o=super._appendCharRaw(s[0][this.value.length],n);return s.length===1&&s[0].slice(this.unmaskedValue.length).split("").forEach(r=>o.aggregate(super._appendCharRaw(r))),o}return new j({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new pe("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new j;const l=Math.min(super.nearestInputPos(0,$.FORCE_RIGHT),this.value.length);let s;for(s=t;s>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(l,s),l)).length>1);--s);const o=super.remove(s,n);return o.tailShift+=s-t,o}get isComplete(){return this.enum.indexOf(this.value)>=0}}Fe.DEFAULTS={...le.DEFAULTS,matchValue:(a,t,n)=>a.indexOf(t,n)===n},O.MaskedEnum=Fe;class Ht extends ne{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}O.MaskedFunction=Ht;var Gt;class se extends ne{constructor(t){super({...se.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",l=(this.scale?"("+Xe(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+l),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Xe).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Xe(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[l,s]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!l&&(s.skip=!0),l&&!this.allowPositive&&!this.value&&l!=="-"&&s.aggregate(this._appendChar("-")),[l,s]}_separatorsCount(t,n){n===void 0&&(n=!1);let l=0;for(let s=0;s<t;++s)this._value.indexOf(this.thousandsSeparator,s)===s&&(++l,n&&(t+=this.thousandsSeparator.length));return l}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,l){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,l))}_appendCharRaw(t,n){n===void 0&&(n={});const l=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,s=this._separatorsCountFromSlice(l);this._value=this._removeThousandsSeparators(this.value);const o=this._value;this._value+=t;const r=this.number;let i=!isNaN(r),c=!1;if(i){let g;this.min!=null&&this.min<0&&this.number<this.min&&(g=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(g=this.max),g!=null&&(this.autofix?(this._value=this.format(g,this).replace(se.UNMASKED_RADIX,this.radix),c||(c=o===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new j({inserted:this._value.slice(o.length),rawInserted:c?"":t,skip:c}):(this._value=o,d=new j),this._value=this._insertThousandsSeparators(this._value);const u=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,p=this._separatorsCountFromSlice(u);return d.tailShift+=(p-s)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,l=this.value.indexOf(this.thousandsSeparator,n);if(l<=t)return l}return-1}_adjustRangeWithSeparators(t,n){const l=this._findSeparatorAround(t);l>=0&&(t=l);const s=this._findSeparatorAround(n);return s>=0&&(n=s+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const l=this.value.slice(0,t),s=this.value.slice(n),o=this._separatorsCount(l.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(l+s));const r=this._separatorsCountFromSlice(l);return new j({tailShift:(r-o)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case $.NONE:case $.LEFT:case $.FORCE_LEFT:{const l=this._findSeparatorAround(t-1);if(l>=0){const s=l+this.thousandsSeparator.length;if(t<s||this.value.length<=s||n===$.FORCE_LEFT)return l}break}case $.RIGHT:case $.FORCE_RIGHT:{const l=this._findSeparatorAround(t);if(l>=0)return l+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let l=this.value;this.normalizeZeros&&(l=this._normalizeZeros(l)),this.padFractionalZeros&&this.scale>0&&(l=this._padFractionalZeros(l)),this._value=l}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(l,s,o,r)=>s+r),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,l){n===void 0&&(n={});const s=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===se.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,l)&&!s}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==="")}}Gt=se,se.UNMASKED_RADIX=".",se.EMPTY_VALUES=[...ne.EMPTY_VALUES,0],se.DEFAULTS={...ne.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Gt.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:a=>a.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},O.MaskedNumber=se;const Ue={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function tt(a,t,n){t===void 0&&(t=Ue.MASKED),n===void 0&&(n=Ue.MASKED);const l=ue(a);return s=>l.runIsolated(o=>(o[t]=s,o[n]))}function qt(a,t,n,l){return tt(t,n,l)(a)}O.PIPE_TYPE=Ue,O.createPipe=tt,O.pipe=qt;class Kt 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 n,l,s;const{repeat:o,...r}=_e(t);this._blockOpts=Object.assign({},this._blockOpts,r);const i=ue(this._blockOpts);this.repeat=(n=(l=o??i.repeat)!=null?l:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((s=this._blocks)==null?void 0:s.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(ue(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const l=new j;for(let c=(s=(o=this._mapPosToBlock(this.displayValue.length))==null?void 0:o.index)!=null?s:Math.max(this._blocks.length-1,0),d,u;d=(r=this._blocks[c])!=null?r:u=!u&&this._allocateBlock(c);++c){var s,o,r,i;const p=d._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(p.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(l.aggregate(p),p.consumed)break}return l}_trimEmptyTail(t,n){var l,s;t===void 0&&(t=0);const o=Math.max(((l=this._mapPosToBlock(t))==null?void 0:l.index)||0,this.repeatFrom,0);let r;n!=null&&(r=(s=this._mapPosToBlock(n))==null?void 0:s.index),r==null&&(r=this._blocks.length-1);let i=0;for(let c=r;o<=c&&!this._blocks[c].unmaskedValue;--c,++i);i&&(this._blocks.splice(r-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const l=super.remove(t,n);return this._trimEmptyTail(t,n),l}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}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}}O.RepeatBlock=Kt;try{globalThis.IMask=O}catch{}const Ni=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:j,ChunksTailDetails:fe,DIRECTION:$,HTMLContenteditableMaskElement:Qe,HTMLInputMaskElement:jt,HTMLMaskElement:Be,InputMask:Ut,MaskElement:ze,Masked:ne,MaskedDate:he,MaskedDynamic:Ne,MaskedEnum:Fe,MaskedFunction:Ht,MaskedNumber:se,MaskedPattern:le,MaskedRange:Me,MaskedRegExp:Pt,PIPE_TYPE:Ue,PatternFixedDefinition:et,PatternInputDefinition:Se,RepeatBlock:Kt,createMask:ue,createPipe:tt,default:O,forceDirection:Rt,normalizeOpts:_e,pipe:qt},Symbol.toStringTag,{value:"Module"}));K.ModalEdit=Dt,K.VForm=be,K.VsInputArray=Mt,K.VsInputCheckbox=it,K.VsInputCodegen=vt,K.VsInputColor=Bt,K.VsInputContainer=yt,K.VsInputDate=ct,K.VsInputEmail=rt,K.VsInputFile=ft,K.VsInputFileList=gt,K.VsInputKeyValue=Ct,K.VsInputMask=at,K.VsInputNumber=ot,K.VsInputRadio=We,K.VsInputRange=St,K.VsInputSelect=Ye,K.VsInputSlug=Vt,K.VsInputStatic=Ze,K.VsInputSwitcher=Ke,K.VsInputTag=Et,K.VsInputText=Ve,K.VsInputTextarea=bt,K.default=be,K.inputs=Nt,K.vsInputDatatable=wt,K.vsInputMap=_t,Object.defineProperties(K,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|