@opengis/cms 0.0.22 → 0.0.26
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/index-W-qQIppj-DRzFSjU1.js +2452 -0
- package/dist/index.html +28 -34
- package/dist/index.js +13915 -0
- package/dist/index.umd.cjs +153 -0
- package/package.json +4 -11
- package/dist/assets/AddUser-CX-McfRW.js +0 -1
- package/dist/assets/ApiKeys-DSv1exYv.js +0 -16
- package/dist/assets/Appearance-DDtOUvCV.js +0 -6
- package/dist/assets/ArticlesPage-D6B3cZsl.js +0 -6
- package/dist/assets/BuilderPage-CCeSMVWe.js +0 -1
- package/dist/assets/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-DVYVfYF4.js +0 -1
- package/dist/assets/CollectionsPage-CHk8Cn5k.js +0 -1
- package/dist/assets/Dashboard-Bs7sXO6h.js +0 -11
- package/dist/assets/EditCollectionPage-gPuLJrN8.js +0 -41
- package/dist/assets/EmailPage-DhlWsPxk.js +0 -1
- package/dist/assets/EmptyData-Ct-xQv_N.js +0 -1
- package/dist/assets/FeedbackPage-DtaOncVv.js +0 -1
- package/dist/assets/Logs-CZ5klHNK.js +0 -1
- package/dist/assets/MediaBreadcrumb-BpOxt5PK.js +0 -11
- package/dist/assets/MediaPage-DqRcZFlO.js +0 -16
- package/dist/assets/MenuAddPage-BLcoVgrS.js +0 -1
- package/dist/assets/MenuItemPage-B2otXqkz.js +0 -20
- package/dist/assets/MenuPage-C00m4Fc_.js +0 -1
- package/dist/assets/MonacoEditor.vue_vue_type_script_setup_true_lang-CjoEsC67.js +0 -3
- package/dist/assets/PermissionsPage-LtqcCJ14.js +0 -1
- package/dist/assets/Settings-BHH6RoBP.js +0 -1
- package/dist/assets/SettingsTable-CY5pZx1z.js +0 -1
- package/dist/assets/SettingsTitle-t4WJBFxZ.js +0 -1
- package/dist/assets/SingletonsPage-Bn2Ypjhs.js +0 -6
- package/dist/assets/TagsPage-DAiakEth.js +0 -1
- package/dist/assets/UniversalTable.vue_vue_type_script_setup_true_lang-BQ5m4aZd.js +0 -11
- package/dist/assets/UniversalTablePagination.vue_vue_type_script_setup_true_lang-DppVBws0.js +0 -1
- package/dist/assets/Users-CMH5j0db.js +0 -1
- package/dist/assets/UsersPage-CDGreEib.js +0 -1
- package/dist/assets/arrow-up-DCe0WsrM.js +0 -16
- package/dist/assets/calendar-o9t4MkD2.js +0 -6
- package/dist/assets/chevron-left-WFftVS9c.js +0 -6
- package/dist/assets/chevron-right-BiiSb3Be.js +0 -6
- package/dist/assets/contentForm-unZQhjCu.js +0 -6
- package/dist/assets/en-BDx3Svx8.js +0 -1
- package/dist/assets/eye-Dijywc6g.js +0 -6
- package/dist/assets/file-B_duymIT.js +0 -6
- package/dist/assets/general-CkN_0qIV.js +0 -1
- package/dist/assets/index-BIp7eSXk.js +0 -1
- package/dist/assets/index-DCW2e4Az.js +0 -9
- package/dist/assets/index-DGweaj24.js +0 -1
- package/dist/assets/index-W-qQIppj-BDlsxaGB.js +0 -1
- package/dist/assets/index-W-qQIppj-BsopI3Hz-BIZR-dhy.js +0 -1
- package/dist/assets/index-oQz9FOqL.css +0 -1
- package/dist/assets/index-yMJAVBXk.js +0 -290
- package/dist/assets/list-CXRbSNky.js +0 -6
- package/dist/assets/logo-Cct5WB26.png +0 -0
- package/dist/assets/pencil-CwnPP4IJ.js +0 -6
- package/dist/assets/plus-DLR44m6p.js +0 -6
- package/dist/assets/save-FeDrOUOd.js +0 -6
- package/dist/assets/search-C4-fHihx.js +0 -6
- package/dist/assets/square-pen-xVs4e8Yb.js +0 -6
- package/dist/assets/trash-2-BGXMNU3d.js +0 -6
- package/dist/assets/uk-BA7DIKEL.js +0 -1
- package/dist/assets/useDebounce-DFq3rxAW.js +0 -1
- package/dist/assets/vs-form-reletion-link-C-xrdHDl.js +0 -20
- package/dist/assets/vs-form-reletion-link-bk-9ZkDH.css +0 -1
- package/dist/assets/vue.-sixQ7xP-CUPNuJcq.js +0 -1
- package/dist/assets/vuedraggable.umd-W_2WTF6i.js +0 -14
- package/dist/assets/x-D2t-wfBe.js +0 -6
- package/module/cms/card/cms.content.table/index.yml +0 -17
- package/module/cms/card/cms.content.table/main_info.hbs +0 -26
- package/module/cms/card/cms.menu.table/content_info.hbs +0 -16
- package/module/cms/card/cms.menu.table/index.yml +0 -18
- package/module/cms/card/cms.menu.table/main_info.hbs +0 -22
- package/module/cms/card/cms.settings.table/index.yml +0 -13
- package/module/cms/card/cms.settings.table/main_info.hbs +0 -20
- package/module/cms/cls/content.status.json +0 -18
- package/module/cms/cls/user_type.json +0 -10
- package/module/cms/form/admin.users.form.json +0 -78
- package/module/cms/form/cms.content.form.json +0 -79
- package/module/cms/form/cms.menu.form.json +0 -69
- package/module/cms/form/cms.settings.form.json +0 -32
- package/module/cms/menu.json +0 -24
- package/module/cms/router.js +0 -169
- package/module/cms/select/cms.page_type.sql +0 -2
- package/module/cms/select/collection.sql +0 -1
- package/module/cms/select/locale.sql +0 -17
- package/module/cms/select/news_tag_id.sql +0 -12
- package/module/cms/select/tag_id.sql +0 -1
- package/module/cms/table/admin.users.table.json +0 -54
- package/module/cms/table/cms.content.table.json +0 -106
- package/module/cms/table/cms.menu.table.json +0 -73
- package/module/cms/table/cms.settings.table.json +0 -57
- package/module/cms/table/collection.default.table.json +0 -102
- package/module/cms/table/single.default.table.json +0 -115
- package/src/App.css +0 -52
- package/src/App.vue +0 -62
- package/src/assets/image.png +0 -0
- package/src/assets/main.css +0 -3
- package/src/assets/tailwind-3.4.17.js +0 -113
- package/src/components/LanguageSwitcher.vue +0 -73
- package/src/components/SettingsCard.vue +0 -40
- package/src/components/builder/CreateForm.vue +0 -128
- package/src/components/builder/formTypeSchema.js +0 -145
- package/src/components/builder/tabs/index.ts +0 -9
- package/src/components/builder/tabs/vs-builder-edit.vue +0 -133
- package/src/components/builder/tabs/vs-builder-monaco.vue +0 -29
- package/src/components/builder/tabs/vs-builder-preview.vue +0 -39
- package/src/components/builder/vs-builder-datatable-controls.vue +0 -138
- package/src/components/builder/vs-builder-datatable-form.vue +0 -80
- package/src/components/builder/vs-builder-datatable.vue +0 -191
- package/src/components/builder/vs-builder-list-item.vue +0 -110
- package/src/components/collections/CollectionsBreadcrumb.vue +0 -52
- package/src/components/collections/CollectionsGrid.vue +0 -176
- package/src/components/collections/ContentBlock.vue +0 -75
- package/src/components/collections/formWrapper.vue +0 -156
- package/src/components/dashboard/ContentItem.vue +0 -82
- package/src/components/dashboard/DashboardHeader.vue +0 -33
- package/src/components/dashboard/QuickActions.vue +0 -84
- package/src/components/dashboard/RecentContent.vue +0 -54
- package/src/components/dashboard/StatCard.vue +0 -63
- package/src/components/dashboard/StatsGrid.vue +0 -28
- package/src/components/form-components/MonacoEditor.vue +0 -104
- package/src/components/form-components/VsFormMeta.vue +0 -40
- package/src/components/form-components/VsFormTags.vue +0 -150
- package/src/components/form-components/custom-datatable/vs-form-custom-datatable-add.vue +0 -84
- package/src/components/form-components/custom-datatable/vs-form-custom-datatable-controls.vue +0 -106
- package/src/components/form-components/index.js +0 -23
- package/src/components/form-components/reference/vs-form-reference-add.vue +0 -92
- package/src/components/form-components/reference/vs-form-reference-controls.vue +0 -101
- package/src/components/form-components/reference-list/referenceOptionList.js +0 -78
- package/src/components/form-components/reference-list/vs-form-reference-add.vue +0 -145
- package/src/components/form-components/reference-list/vs-form-reference-choce.vue +0 -39
- package/src/components/form-components/reference-list/vs-form-reference-controls.vue +0 -110
- package/src/components/form-components/reference-skeleton/about-skeleton.vue +0 -37
- package/src/components/form-components/reference-skeleton/banner-skeleton.vue +0 -29
- package/src/components/form-components/reference-skeleton/body-skeleton.vue +0 -56
- package/src/components/form-components/reference-skeleton/cards-skeleton.vue +0 -47
- package/src/components/form-components/reference-skeleton/documents-skeleton.vue +0 -64
- package/src/components/form-components/reference-skeleton/faq-skeleton.vue +0 -64
- package/src/components/form-components/reference-skeleton/form-skeleton.vue +0 -41
- package/src/components/form-components/reference-skeleton/index.js +0 -36
- package/src/components/form-components/reference-skeleton/infoLine-skeleton.vue +0 -37
- package/src/components/form-components/reference-skeleton/news-skeleton.vue +0 -54
- package/src/components/form-components/reference-skeleton/slider-skeleton.vue +0 -41
- package/src/components/form-components/reference-skeleton/tabs-skeleton.vue +0 -40
- package/src/components/form-components/reference-skeleton/team-skeleton.vue +0 -103
- package/src/components/form-components/reference-skeleton/usefulLinks-skeleton.vue +0 -52
- package/src/components/form-components/reference-skeleton/video-skeleton.vue +0 -36
- package/src/components/form-components/testReferenceTypes.js +0 -773
- package/src/components/form-components/vs-form-color-picker.vue +0 -29
- package/src/components/form-components/vs-form-custom-datatable.vue +0 -214
- package/src/components/form-components/vs-form-integer.vue +0 -86
- package/src/components/form-components/vs-form-key-value.vue +0 -201
- package/src/components/form-components/vs-form-marcdown-md.vue +0 -3
- package/src/components/form-components/vs-form-media-select.vue +0 -780
- package/src/components/form-components/vs-form-reference-list.vue +0 -97
- package/src/components/form-components/vs-form-reference.vue +0 -59
- package/src/components/form-components/vs-form-relation.vue +0 -30
- package/src/components/form-components/vs-form-reletion-link.vue +0 -34
- package/src/components/form-components/vs-form-select-collection.vue +0 -0
- package/src/components/form-components/vs-form-slug.vue +0 -72
- package/src/components/form-components/vs-form-tiptap.vue +0 -7
- package/src/components/form-components/vs-richtext-md.vue +0 -3
- package/src/components/icons/BellIcon.vue +0 -17
- package/src/components/icons/GlobeIcon.vue +0 -18
- package/src/components/icons/KeyIcon.vue +0 -20
- package/src/components/icons/PaletteIcon.vue +0 -22
- package/src/components/icons/SettingsIcon.vue +0 -19
- package/src/components/icons/ShieldIcon.vue +0 -18
- package/src/components/icons/UsersIcon.vue +0 -19
- package/src/components/icons/icon-chevron-right.vue +0 -16
- package/src/components/icons/icon-drag.vue +0 -20
- package/src/components/icons/icon-file-text.vue +0 -21
- package/src/components/icons/icon-folder.vue +0 -18
- package/src/components/icons/icon-grid.vue +0 -17
- package/src/components/icons/icon-group.vue +0 -19
- package/src/components/icons/icon-home.vue +0 -16
- package/src/components/icons/icon-image.vue +0 -18
- package/src/components/icons/icon-list.vue +0 -20
- package/src/components/icons/icon-more.vue +0 -17
- package/src/components/icons/icon-plus.vue +0 -17
- package/src/components/icons-types/icon-array.vue +0 -22
- package/src/components/icons-types/icon-boolean.vue +0 -18
- package/src/components/icons-types/icon-datalist.vue +0 -22
- package/src/components/icons-types/icon-date.vue +0 -20
- package/src/components/icons-types/icon-datetime.vue +0 -20
- package/src/components/icons-types/icon-file.vue +0 -21
- package/src/components/icons-types/icon-gallery.vue +0 -18
- package/src/components/icons-types/icon-image.vue +0 -19
- package/src/components/icons-types/icon-integer.vue +0 -20
- package/src/components/icons-types/icon-merkdown.vue +0 -18
- package/src/components/icons-types/icon-multiselect.vue +0 -22
- package/src/components/icons-types/icon-number.vue +0 -20
- package/src/components/icons-types/icon-radio.vue +0 -22
- package/src/components/icons-types/icon-reference-list.vue +0 -22
- package/src/components/icons-types/icon-reference.vue +0 -20
- package/src/components/icons-types/icon-relation.vue +0 -22
- package/src/components/icons-types/icon-richtext.vue +0 -18
- package/src/components/icons-types/icon-select.vue +0 -22
- package/src/components/icons-types/icon-slug.vue +0 -19
- package/src/components/icons-types/icon-text.vue +0 -19
- package/src/components/icons-types/index.js +0 -43
- package/src/components/layout/Layout.vue +0 -67
- package/src/components/layout/Sidebar.vue +0 -128
- package/src/components/media/FileUploadProgress.vue +0 -29
- package/src/components/media/MediaBreadcrumb.vue +0 -42
- package/src/components/media/MediaCreateFolder.vue +0 -59
- package/src/components/media/MediaFileInfo.vue +0 -148
- package/src/components/media/MediaGrid.vue +0 -148
- package/src/components/media/MediaList.vue +0 -148
- package/src/components/media/MediaViewControls.vue +0 -38
- package/src/components/media/TypeTag.vue +0 -23
- package/src/components/menu/AddNewItemInTree.vue +0 -75
- package/src/components/menu/MenuBody.vue +0 -149
- package/src/components/menu/MenuItem.vue +0 -73
- package/src/components/menu/MenuList.vue +0 -101
- package/src/components/referencec/index.ts +0 -7
- package/src/components/referencec/vs-reference-faq.vue +0 -61
- package/src/components/referencec/vs-reference-user-card.vue +0 -40
- package/src/components/settings/NotificationSettings.vue +0 -32
- package/src/components/settings/SettingsTable.vue +0 -50
- package/src/components/settings/SettingsTitle.vue +0 -33
- package/src/components/settings/SettingsToggleItem.vue +0 -25
- package/src/components/sidebar/DropdownMenu.vue +0 -34
- package/src/components/sidebar/SettingsSidebar.vue +0 -121
- package/src/components/sidebar/SidebarFooter.vue +0 -52
- package/src/components/sidebar/SidebarHeader.vue +0 -57
- package/src/components/sidebar/SidebarMenu.vue +0 -78
- package/src/components/ui/EmptyData.vue +0 -76
- package/src/components/ui/UniversalTable.vue +0 -310
- package/src/components/ui/UniversalTableFilters.vue +0 -0
- package/src/components/ui/UniversalTablePagination.vue +0 -118
- package/src/components/ui/VsPreview.vue +0 -75
- package/src/composables/useCollectionView.ts +0 -21
- package/src/composables/useDebounce.ts +0 -26
- package/src/composables/useMonaco.ts +0 -28
- package/src/composables/useTheme.ts +0 -40
- package/src/content/test-slug/metadata.json +0 -1
- package/src/i18n.ts +0 -75
- package/src/index.css +0 -3
- package/src/index.ts +0 -122
- package/src/locales/en.json +0 -778
- package/src/locales/uk.json +0 -797
- package/src/main.ts +0 -41
- package/src/pages/Dashboard.vue +0 -168
- package/src/pages/EmailPage.vue +0 -183
- package/src/pages/FeedbackPage.vue +0 -232
- package/src/pages/MediaPage.vue +0 -372
- package/src/pages/TagsPage.vue +0 -207
- package/src/pages/builder/BuilderPage.vue +0 -195
- package/src/pages/builder/EditCollectionPage.vue +0 -163
- package/src/pages/collections/ArticlesPage.vue +0 -385
- package/src/pages/collections/CollectionsPage.vue +0 -146
- package/src/pages/collections/SingletonsPage.vue +0 -119
- package/src/pages/collections/contentForm.vue +0 -484
- package/src/pages/collections/schema/seo.ts +0 -27
- package/src/pages/menu/MenuAddPage.vue +0 -123
- package/src/pages/menu/MenuItemPage.vue +0 -183
- package/src/pages/menu/MenuPage.vue +0 -133
- package/src/pages/settings/ApiKeys.vue +0 -75
- package/src/pages/settings/Appearance.vue +0 -80
- package/src/pages/settings/Logs.vue +0 -260
- package/src/pages/settings/PermissionsPage.vue +0 -237
- package/src/pages/settings/Settings.vue +0 -186
- package/src/pages/settings/Users.vue +0 -109
- package/src/pages/settings/general.vue +0 -154
- package/src/pages/settings/generalScheme.js +0 -132
- package/src/pages/users/AddUser.vue +0 -106
- package/src/pages/users/UsersPage.vue +0 -98
- package/src/props/builder.ts +0 -67
- package/src/props/content.ts +0 -56
- package/src/props/media.ts +0 -63
- package/src/router/index.ts +0 -181
- package/src/types/fastify-auth.d.ts +0 -4
- package/src/utils/getField.js +0 -270
- package/src/utils/translit.js +0 -19
- package/src/vite-env.d.ts +0 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{d as J,E as ce,D as pe,bB as Gt,m as M,A as j,p as Ve,o as d,a as c,b as l,y as Ce,n as R,j as ue,k as fe,f as K,S as xe,e as re,v as I,h as ve,w as Te,i as Ke,V as qe,t as q,O as _t,q as Fe,bb as et,x as Ue,g as we,W as xt,X as wt,B as se,C as he,c2 as Kt,G as kt,z as ie,s as _e,bi as Ot,bQ as qt,r as Lt,N as Se,T as pt,bV as Jt,Y as Xt,ad as Ct,Q as Ft,bR as Tt,R as Vt,aH as Qt}from"./index-yMJAVBXk.js";import{w as Yt,y as me,J as Dt}from"./index-DGweaj24.js";const el={class:"w-full relative"},tl={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},ll={class:"opacity-100"},al={key:0,class:"text-red-500 text-[14px]"},rl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},ol=J({__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 e=M("uk"),t=o=>{o.detail.key==="locale"&&(e.value=o.detail.newValue)};return Ve(()=>{e.value=localStorage.locale,window.addEventListener("storage",t)}),et(()=>{window.removeEventListener("resize",t)}),(o,u)=>{var i,n;return d(),c("div",el,[o.ua||o.label?(d(),c("div",tl,[l("span",ll,q(o.item[e.value]||o.ua||o.label),1),(n=(i=o.item)==null?void 0:i.rules)!=null&&n.includes("required")?(d(),c("span",al,"*")):I("",!0)])):I("",!0),Ue(o.$slots,"default",qe(o.$attrs,{class:{"opacity-60":o.item.disabled}})),o.error?(d(),c("span",rl,q(o.error),1)):I("",!0)])}}}),nl={class:"w-full relative flex flex-row items-center gap-2"},sl={key:0,class:"text-red-500 text-[14px]"},il={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},ul=J({__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 e=a,t=j(()=>e.columns??{container:12,label:3}),o=j(()=>{const{container:r,label:f}=t.value;return!r||r<=0?0:Math.min(Math.max(f??0,0),r)/r}),u=j(()=>{var r;return((r=e.item)==null?void 0:r.type)==="html"||o.value<=0?!1:!!(e.ua||e.label)}),i=j(()=>{if(!u.value)return{};const r=`${o.value*100}%`;return{flexBasis:r,maxWidth:r}}),n=j(()=>{var w;const{container:r,label:f}=t.value;if(!r||r<=0)return{};if(((w=e.item)==null?void 0:w.type)==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!u.value)return{flexBasis:"100%",maxWidth:"100%"};const h=Math.max(r-Math.max(f??0,0),0)/r;if(!h)return{};const m=`${h*100}%`;return{flexBasis:m,maxWidth:m}});return(r,f)=>{var h,m;return d(),c("div",nl,[u.value?(d(),c("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:xe(i.value)},[we(q(r.ua||r.label)+" ",1),(m=(h=r.item)==null?void 0:h.rules)!=null&&m.includes("required")&&(r.ua||r.label)?(d(),c("span",sl,"*")):I("",!0)],4)):I("",!0),l("div",{class:"flex-1 min-w-0",style:xe(n.value)},[Ue(r.$slots,"default",xt(wt(r.$attrs)))],4),r.error?(d(),c("span",il,q(r.error),1)):I("",!0)])}}}),dl={class:"w-full relative"},cl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},pl=J({__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(e,t)=>(d(),c("div",dl,[Ue(e.$slots,"default",xt(wt(e.$attrs))),e.error?(d(),c("span",cl,q(e.error),1)):I("",!0)]))}}),vl={class:"flex-1 min-w-0"},fl={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},ml={class:"truncate"},hl={key:0,class:"text-red-500 text-[14px]"},gl={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},yl={key:0,class:"mt-1 text-xs text-red-500"},bl=J({__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 e=a,t=M("uk");j(()=>{var r;return((r=e.item??{})==null?void 0:r[t.value])??e.ua??e.label??""});const o=j(()=>{var r;return((r=e.item)==null?void 0:r.description)??""}),u=j(()=>{var r;return Array.isArray((r=e.item)==null?void 0:r.rules)&&e.item.rules.includes("required")}),i=j(()=>(typeof e.error=="string"?e.error:"")??""),n=r=>{r.key==="locale"&&(t.value=r.newValue??"uk")};return Ve(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(t.value=localStorage.locale)}catch{}window.addEventListener("storage",n)}),et(()=>{window.removeEventListener("storage",n)}),(r,f)=>{var h;return d(),c("div",{class:R(["w-full relative",{"opacity-60":(h=r.item)==null?void 0:h.disabled}])},[l("div",{class:R(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(r.item.type)?"flex flex-col":""]])},[l("div",vl,[r.ua||r.label?(d(),c("p",fl,[l("span",ml,q(r.item[t.value]||r.ua||r.label),1),u.value?(d(),c("span",hl,"*")):I("",!0)])):I("",!0),o.value?(d(),c("p",gl,q(o.value),1)):I("",!0)]),l("div",{class:R(["w-full",["select","native-select"].includes(r.item.type)?"md:w-[30%]":"md:w-auto"])},[Ue(r.$slots,"default",xt(wt(r.$attrs)))],2)],2),i.value?(d(),c("p",yl,q(i.value),1)):I("",!0)],2)}}}),xl={default:ol,horizontal:ul,inline:pl,settings:bl};function Le(a){return{inputClass:j(()=>{const e=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${(a==null?void 0:a.primaryColor)||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return(a==null?void 0:a.size)==="sm"?`${e}h-[32px]`:`${e}h-[38px]`})}}const wl=["placeholder","disabled"],kl=J({__name:"vs-input-password",props:ce({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:t}=Le(e.style),o=pe(a,"modelValue"),u=j(()=>!!e.disabled),i=j(()=>e.placeholder??"");return(n,r)=>se((d(),c("input",{type:"password","onUpdate:modelValue":r[0]||(r[0]=f=>o.value=f),placeholder:i.value,disabled:u.value,class:R(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[re(t),{"!border-red-600":n.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,wl)),[[he,o.value]])}}),Cl=["placeholder","disabled"],ct=J({__name:"vs-input-text",props:ce({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:t}=Le(e.style),o=pe(a,"modelValue"),u=j(()=>!!e.disabled),i=j(()=>e.placeholder??"");return(n,r)=>se((d(),c("input",{type:"text","onUpdate:modelValue":r[0]||(r[0]=f=>o.value=f),placeholder:i.value,disabled:u.value,class:R(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[re(t),{"!border-red-600":n.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Cl)),[[he,o.value]])}}),Vl=["placeholder","disabled","min","max"],_l=J({__name:"vs-input-number",props:ce({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:t}=Le(e.style),o=pe(a,"modelValue"),u=j(()=>!!e.disabled);return(i,n)=>se((d(),c("input",{type:"number",step:"any","onUpdate:modelValue":n[0]||(n[0]=r=>o.value=r),placeholder:i.placeholder,disabled:u.value,class:R(["py-1.5 px-3 block w-full bg-white",[re(t)]]),style:{border:"1px solid #CFD9E0"},min:i.min,max:i.max},null,10,Vl)),[[he,o.value]])}}),le=(a,e)=>{const t=a.__vccOpts||a;for(const[o,u]of e)t[o]=u;return t},Ll={},Ml={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 Bl(a,e){return d(),c("svg",Ml,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const jl=le(Ll,[["render",Bl]]),El={class:"flex items-center gap-[4px]"},$l=["value","id","disabled"],Al=["for"],zl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Sl=J({__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:e}){const t=e,o=a,u=j({get:()=>o.modelValue,set:n=>t("update:modelValue",n)}),i=j(()=>!!o.disabled);return(n,r)=>(d(),c("div",El,[se(l("input",{type:"checkbox",value:n.value,"onUpdate:modelValue":r[0]||(r[0]=f=>u.value=f),class:R(["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":i.value}]),id:n.id,disabled:i.value},null,10,$l),[[Ft,u.value]]),l("label",{for:n.id,class:R(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":i.value}])},[l("div",{class:R(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[u.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",n.error?"border-red-600":""]])},[K(jl,{height:"12",width:"12"})],2),l("span",zl,[Ue(n.$slots,"default",{},()=>[we(q(n.label),1)])])],10,Al)]))}}),Ul=["name","value","disabled"],Ol={class:"flex items-center gap-[6px] text-[14px]"},Fl={key:0,class:"text-[16px]"},Tl=["src"],Dl=J({__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:e}){const t=a,o=e,u=j({get:()=>t.modelValue,set:r=>{o("update:modelValue",r)}}),i=j(()=>Array.isArray(u.value)?u.value.includes(t.value):u.value===!0||u.value===t.value),n=j(()=>{var r,f;return((r=t.style)==null?void 0:r.size)==="xs"?"p-1.5 text-xs":((f=t.style)==null?void 0:f.size)==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs"});return(r,f)=>(d(),c("label",{class:R(["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",[n.value,i.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[se(l("input",{type:"checkbox",class:"hidden",name:r.id,value:r.value,"onUpdate:modelValue":f[0]||(f[0]=h=>u.value=h),disabled:r.disabled},null,8,Ul),[[Ft,u.value]]),l("span",Ol,[r.icon||r.imgUrl?(d(),c("span",Fl,[r.icon?(d(),c("i",{key:0,class:R(r.icon)},null,2)):I("",!0),r.imgUrl?(d(),c("img",{key:1,src:r.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Tl)):I("",!0)])):I("",!0),Ue(r.$slots,"default",{},()=>[we(q(r.label),1)])])],2))}}),Hl={class:"flex items-center"},yt=J({__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:e}){const t=a,o=e,u=`radio-${Math.floor(Math.random()*1e4)}`,i=j({get:()=>Array.isArray(t.modelValue)?Array.isArray(t.modelValue)&&t.modelValue.includes(t.value):t.modelValue,set:r=>{if(Array.isArray(t.modelValue)){let f=[...t.modelValue];r?f.includes(t.value)||f.push(t.value):f=f.filter(h=>h!==t.value),o("update:modelValue",f)}else o("update:modelValue",r)}}),n=M(`vs-checkbox-${t.view||"default"}`);return(r,f)=>{var h;return d(),c("div",Hl,[(d(),ve(Ke(n.value==="vs-checkbox-buttons"?re(Dl):re(Sl)),{value:r.value,label:r.label,info:(h=r.option)==null?void 0:h.info,disabled:r.disabled,modelValue:i.value,"onUpdate:modelValue":f[0]||(f[0]=m=>i.value=m),id:u,icon:r.icon,imgUrl:r.imgUrl,style:xe(r.style),error:r.error},{default:Te(()=>[we(q(r.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))])}}}),Il={},Rl={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 Pl(a,e){return d(),c("svg",Rl,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Nl=le(Il,[["render",Pl]]),Zl={},Wl={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 Gl(a,e){return d(),c("svg",Wl,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M18 6l-12 12"},null,-1),l("path",{d:"M6 6l12 12"},null,-1)]))}const Kl=le(Zl,[["render",Gl]]),ql={},Jl={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 Xl(a,e){return d(),c("svg",Jl,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M12 9h.01"},null,-1),l("path",{d:"M11 12h1v4h1"},null,-1),l("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 Ql=le(ql,[["render",Xl]]),Yl={key:0,class:"flex items-start gap-x-1"},ea={key:0,class:"text-red-500 text-[14px]"},ta=["title"],la=["disabled"],Ht=J({__name:"vs-input-switcher",props:ce({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 e=a,t=pe(a,"modelValue");return(o,u)=>{var i,n;return e.view==="checkbox"?(d(),c("div",Yl,[K(yt,{modelValue:t.value,"onUpdate:modelValue":u[0]||(u[0]=r=>t.value=r),label:o.text,error:o.error||""},null,8,["modelValue","label","error"]),(i=o.rules)!=null&&i.includes("required")?(d(),c("span",ea,"*")):I("",!0),o.i?(d(),c("button",{key:1,class:"cursor-pointer",title:o.i,onClick:u[1]||(u[1]=Ce(()=>{},["prevent"]))},[K(re(Ql),{class:"text-gray-500 w-[14px] h-[14px]"})],8,ta)):I("",!0)])):(d(),c("button",{key:1,type:"button",class:R(["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",[t.value?`bg-${((n=o.style)==null?void 0:n.primaryColor)||"blue"}-500`:"bg-stone-200",o.customClass]]),disabled:o.disabled,onClick:u[2]||(u[2]=r=>t.value=!t.value)},[l("span",{"data-state":"checked",class:R(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[t.value?"translate-x-4":"translate-x-0"]])},null,2)],10,la))}}}),aa=["id","innerHTML"],Mt=J({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(a){return(e,t)=>(d(),c("div",{id:e.name,class:R(["text-gray-900",e.customClass]),innerHTML:e.html?e.html:e.text},null,10,aa))}}),ra=["placeholder","disabled","name"],oa=J({__name:"vs-input-mask",props:ce({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 e=a,{inputClass:t}=Le(e.style),o=pe(a,"modelValue"),u=M(null);let i=null;return Ve(async()=>{if(u.value){const{default:n}=await Kt(()=>import("./index-W-qQIppj-BDlsxaGB.js"),__vite__mapDeps([]));i=n(u.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),i.on("accept",()=>{o.value=e.unmask?i.unmaskedValue:i.value}),i.on("complete",()=>{o.value=e.unmask?i.unmaskedValue:i.value}),i.value=o.value??""}}),kt(()=>{i==null||i.destroy()}),ie(()=>e.mask,n=>{i&&i.updateOptions({mask:n,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),ie(o,n=>{i&&i.unmaskedValue!==n&&(i.value=n||"")}),(n,r)=>(d(),c("input",{type:"text",ref_key:"inputEl",ref:u,placeholder:n.placeholder,disabled:n.disabled,name:n.name,class:R(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[re(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,ra))}}),na={class:"relative w-full bg-white rounded-lg"},sa=["placeholder","disabled"],ia=J({__name:"vs-input-email",props:ce({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 e=a,{inputClass:t}=Le(e.style),o=pe(a,"modelValue");return(u,i)=>(d(),c("div",na,[i[1]||(i[1]=_e('<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)),se(l("input",{type:"email","onUpdate:modelValue":i[0]||(i[0]=n=>o.value=n),placeholder:u.placeholder,disabled:u.disabled,class:R(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[re(t),{"!border-red-600":u.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,sa),[[he,o.value]])]))}}),ua=["value","disabled"],da={class:"text-[13px] text-gray-700"},ca=J({__name:"vs-input-radio-default",props:ce({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,t=pe(a,"modelValue"),o=j(()=>!!e.disabled);return(u,i)=>{var n,r;return d(),c("label",{class:R(["flex items-center gap-0",[e.customClass,o.value?"cursor-not-allowed opacity-60":""]])},[se(l("input",{"onUpdate:modelValue":i[0]||(i[0]=f=>t.value=f),type:"radio",value:e.value,disabled:o.value,class:"hidden"},null,8,ua),[[Tt,t.value]]),l("span",{class:R(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${((n=e.style)==null?void 0:n.primaryColor)||"blue"}-500`,o.value?"opacity-50 cursor-not-allowed":""]])},[t.value==e.value?(d(),c("span",{key:0,class:R(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${((r=e.style)==null?void 0:r.primaryColor)||"blue"}-500`]])},null,2)):I("",!0)],2),l("span",da,q(e.text),1)],2)}}}),pa=["value","disabled"],va={class:"text-[13px] text-gray-700"},fa=J({__name:"vs-input-radio-buttons",props:ce({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,t=pe(a,"modelValue"),o=j(()=>!!e.disabled);return(u,i)=>{var n;return d(),c("label",{class:R(["flex items-center border rounded-lg px-2 py-1",[t.value==e.value?`ring-2 ring-ring ring-${((n=e.style)==null?void 0:n.primaryColor)||"blue"}-500`:"",e.customClass,o.value?"cursor-not-allowed opacity-60":""]])},[se(l("input",{"onUpdate:modelValue":i[0]||(i[0]=r=>t.value=r),type:"radio",value:e.value,disabled:o.value,class:"hidden"},null,8,pa),[[Tt,t.value]]),l("span",va,q(e.text),1)],2)}}}),ma={"vs-input-radio-default":ca,"vs-input-radio-buttons":fa},Bt=J({__name:"vs-input-radio",props:ce({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 e=a,t=pe(a,"modelValue"),o=j(()=>ma[`vs-input-radio-${e.view}`]);return(u,i)=>(d(),c("div",{class:R([u.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(d(!0),c(ue,null,fe(u.options,n=>(d(),ve(Ke(o.value),qe({key:n==null?void 0:n.id,text:n.text,value:n.id.toString(),checked:t.value===n.id,modelValue:t.value,"onUpdate:modelValue":i[0]||(i[0]=r=>t.value=r)},{ref_for:!0},u.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),ha={key:1,class:"w-full flex flex-col gap-4"},ga={key:0,class:"text-sm font-medium text-muted-foreground my-2"},ya="Без категорії",ba=J({__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:e}){const t=a,o=e,u=M([]),i=Ot({}),n=y=>(y==null?void 0:y.value)||(y==null?void 0:y.id)||(y==null?void 0:y.text)||y,r=y=>y.text||String(y),f=y=>`lg:col-span-${y||12}`,h=j(()=>[t.position==="vertical"?"flex flex-col":"",t.colSpan?"grid":"flex justify-start"]),m=y=>y==null||y===""?null:typeof y=="string"||typeof y=="number"?y:String(y),w=j(()=>{var z;if(!t.group)return[];const y=new Map;u.value.forEach(E=>{var S;const b=E[t.group],x=m(b);y.has(x)||y.set(x,[]),(S=y.get(x))==null||S.push(E)});const U=[];(z=t.values)!=null&&z.length&&t.values.forEach(E=>{const b=m(E);U.push(b)});const V=new Set,k=E=>{const b=y.get(E)||[];if(!b.length)return null;const x=E===null?"group-null":`group-${String(E)}`,S=E===null?ya:String(E);return V.add(E),{key:x,label:S,options:b}},A=[];return U.forEach(E=>{const b=k(E);b&&A.push(b)}),y.forEach((E,b)=>{if(V.has(b))return;const x=k(b);x&&A.push(x)}),A}),_=async()=>{try{const y=await fetch(`/api/suggest/${t.data}`).then(U=>U.json());u.value=(y==null?void 0:y.data)||y}catch(y){console.error(y)}};return ie(()=>t.modelValue,y=>{if(typeof y=="boolean"&&u.value.length===1){const U=n(u.value[0]);i[U]=y}else if(Array.isArray(y)){const U=new Set(y);u.value.forEach(V=>{if(!V.disabled){const k=n(V);i[k]=U.has(k)}})}},{immediate:!0}),ie(i,()=>{if(!u.value.length){o("update:modelValue",null);return}const y=Object.entries(i).filter(([,U])=>U).map(([U])=>U);o("update:modelValue",y.length===0?[]:y)},{deep:!0}),Ve(()=>{if(t.data)_().then(()=>{if(typeof t.modelValue=="boolean"&&u.value.length===1){const y=n(u.value[0]);i[y]=t.modelValue}else if(Array.isArray(t.modelValue)){const y=new Set(t.modelValue);u.value.forEach(U=>{if(!U.disabled){const V=n(U);i[V]=y.has(V)}})}});else if(u.value=t.options,typeof t.modelValue=="boolean"&&u.value.length===1){const y=n(u.value[0]);i[y]=t.modelValue}else if(Array.isArray(t.modelValue)){const y=new Set(t.modelValue);u.value.forEach(U=>{if(!U.disabled){const V=n(U);i[V]=y.has(V)}})}}),(y,U)=>t.group?(d(),c("div",ha,[(d(!0),c(ue,null,fe(w.value,V=>(d(),c("div",{key:V.key,class:"flex flex-col gap-2"},[V.label?(d(),c("span",ga,q(V.label),1)):I("",!0),l("div",{class:R(["p-0 w-full gap-[12px]",h.value])},[(d(!0),c(ue,null,fe(V.options,k=>(d(),ve(yt,{modelValue:i[n(k)],"onUpdate:modelValue":A=>i[n(k)]=A,value:n(k),class:R(f(y.colSpan)),disabled:t.disabled||k.disabled,label:r(k),key:`${V.key}-${n(k)}`,icon:k==null?void 0:k.icon,imgUrl:k==null?void 0:k.imgUrl,option:k,view:y.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(d(),c("div",{key:0,class:R(["p-0 w-full gap-[10px]",h.value])},[(d(!0),c(ue,null,fe(u.value,V=>(d(),ve(yt,{modelValue:i[n(V)],"onUpdate:modelValue":k=>i[n(V)]=k,value:n(V),class:R(f(y.colSpan)),disabled:t.disabled||V.disabled,label:r(V),key:n(V),icon:V==null?void 0:V.icon,imgUrl:V==null?void 0:V.imgUrl,option:V,view:y.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),xa=le(ba,[["__scopeId","data-v-8e66207e"]]),wa=["type","placeholder","disabled"],ka=J({__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:e}){const t=a;function o(m){return m?t.mode==="datetime"?(m.includes("T")?m:null)||m+(m.includes(" ")?"":"T00:00"):m==null?void 0:m.split(" ")[0]:null}const{inputClass:u}=Le(t.style),i=e,n=j({get:()=>o(t.modelValue),set:m=>i("update:modelValue",m)}),r=j(()=>t.mode==="datetime"?"datetime-local":t.mode),f=j(()=>!!t.disabled),h=j(()=>t.placeholder??"");return(m,w)=>se((d(),c("input",{type:r.value,"onUpdate:modelValue":w[0]||(w[0]=_=>n.value=_),placeholder:h.value,disabled:f.value,ref:"date",class:R(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[m.modelValue?"":"text-opacity-50",re(u)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,wa)),[[qt,n.value]])}}),jt=async(a,e,t,o)=>{var u;try{const i=new FormData;return i.append("unique","true"),i.append("file",a),(u=await fetch(`/file/upload/uploads?id=${e||""}&form=${t||""}&table=${o||""}`,{method:"POST",body:i}).then(n=>n.json()))==null?void 0:u.result}catch(i){return me({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",i),null}},Ca=async a=>{try{return await fetch(`file/delete${a}`),!0}catch(e){return console.error(e),!1}},Et=async a=>{try{const e=await fetch(`file/download/files/uploads${a}`),t=await e.arrayBuffer(),o=e.headers["content-type"],u=new TextDecoder("utf-8").decode(t),i=new Blob([u],{type:o}),n=document.createElement("a");n.setAttribute("download",a),n.href=window.URL.createObjectURL(i),n.click()}catch(e){console.error(e.message)}},Va={},_a={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 La(a,e){return d(),c("svg",_a,e[0]||(e[0]=[l("path",{d:"M5 12h14"},null,-1),l("path",{d:"M12 5v14"},null,-1)]))}const tt=le(Va,[["render",La]]),Ma={},Ba={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 ja(a,e,t,o,u,i){return d(),c("svg",Ba,e[0]||(e[0]=[_e('<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 Ea=le(Ma,[["render",ja]]),$a={},Aa={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 za(a,e,t,o,u,i){return d(),c("svg",Aa,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),l("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),l("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const Sa=le($a,[["render",za]]),Ua={},Oa={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 Fa(a,e){return d(),c("svg",Oa,e[0]||(e[0]=[_e('<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 It=le(Ua,[["render",Fa]]),Ta={},Da={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 Ha(a,e,t,o,u,i){return d(),c("svg",Da,e[0]||(e[0]=[_e('<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 Ia=le(Ta,[["render",Ha]]),Ra={},Pa={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 Na(a,e,t,o,u,i){return d(),c("svg",Pa,e[0]||(e[0]=[_e('<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 Za=le(Ra,[["render",Na]]),Wa=a=>{if(!a)return"";const e=a==null?void 0:a.split(".");return e[e.length-1]},Ga=a=>{const e=Wa(a),t={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 t.imageFormat.includes(e)?"img":t.sheetsFormat.includes(e)?Sa:t.textsFormat.includes(e)?Za:t.documentsFormat.includes(e)?Ea:t.archivesFormat.includes(e)?Ia:It},Ka={},qa={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 Ja(a,e){return d(),c("svg",qa,e[0]||(e[0]=[_e('<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 vt=le(Ka,[["render",Ja]]),Xa={},Qa={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 Ya(a,e){return d(),c("svg",Qa,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),l("path",{d:"M7 11l5 5l5 -5"},null,-1),l("path",{d:"M12 4l0 12"},null,-1)]))}const Rt=le(Xa,[["render",Ya]]),er=["title"],tr={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},lr=J({__name:"vs-input-file-list-item",props:ce({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 e=pe(a,"value"),t=pe(a,"item"),o=a;return(u,i)=>(d(),c("div",{title:t.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(d(),ve(Ke(re(Ga)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:i[0]||(i[0]=n=>re(Et)(t.value))},null,8,["src"])),l("div",tr,[l("button",{type:"button",onClick:i[1]||(i[1]=n=>{var r;re(Ca)(t.value),e.value=o.multiple?(r=e.value)==null?void 0:r.filter(f=>f!==t.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[K(vt,{class:"w-4 h-4"})]),l("button",{type:"button",onClick:i[2]||(i[2]=n=>re(Et)(t.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[K(Rt,{class:"w-4 h-4"})])])],8,er))}}),$t=le(lr,[["__scopeId","data-v-286cdbc0"]]),ar={class:"flex items-center gap-x-2"},rr=["multiple","disabled"],or={key:1,class:"flex items-center flex-wrap gap-2"},nr={key:1,class:"loader"},sr={key:1,class:"loader"},ir=J({__name:"vs-input-file",props:ce({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:ce(["change"],["update:modelValue"]),setup(a,{emit:e}){const t=a,o=pe(a,"modelValue"),u=e,i=M(null),n=M(!1),r=m=>Array.isArray(o.value)&&o.value[m]||"",f=m=>{if(t.max_size&&m.size>t.max_size*1024*1024){const w=(m.size/1048576).toFixed(2);return me({type:"error",title:"Помилка!",message:`Файл "${m.name}" занадто великий. Максимальний розмір: ${t.max_size} МБ, розмір файлу: ${w} МБ`,position:"right-bottom"}),!1}return!0},h=async m=>{const{files:w}=m.target;if(!w||w.length===0)return;const _=Array.from(w);if(t.max_size&&_.filter(y=>!f(y)).length>0){i.value&&(i.value.value="");return}n.value=!0;try{if(t.multiple){const y=Array.from(w).map(async V=>t.format&&!V.name.endsWith(t.format)?null:await jt(V,"1","form","table")),U=(await Promise.all(y)).filter(V=>V!==null).map(V=>V==null?void 0:V.file_path).filter(Boolean);o.value=[...o.value||[],...U],u("change",o.value)}else{const y=w[0];if(t.format&&!y.name.endsWith(t.format))return;const U=await jt(y,"1","form","table");o.value=U==null?void 0:U.file_path,u("change",o.value||"")}}finally{n.value=!1,i.value&&(i.value.value="")}};return(m,w)=>(d(),c("div",ar,[l("input",{class:"hidden",ref_key:"fileInput",ref:i,type:"file",multiple:m.multiple,onChange:h,disabled:n.value||m.disabled},null,40,rr),!m.multiple&&o.value?(d(),ve($t,{key:0,item:o.value,"onUpdate:item":w[0]||(w[0]=_=>o.value=_),value:o.value,"onUpdate:value":w[1]||(w[1]=_=>o.value=_)},null,8,["item","value"])):m.multiple?(d(),c("div",or,[(d(!0),c(ue,null,fe(o.value,(_,y)=>(d(),ve($t,{multiple:m.multiple,key:y,value:o.value,"onUpdate:value":w[2]||(w[2]=U=>o.value=U),item:r(y)},null,8,["multiple","value","item"]))),128)),l("div",{onClick:w[3]||(w[3]=_=>{var y;return!m.disabled&&!n.value&&((y=i.value)==null?void 0:y.click())}),class:R(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",m.disabled||n.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[n.value?(d(),c("div",nr)):(d(),ve(tt,{key:0,class:"w-6 h-6"}))],2)])):I("",!0),m.multiple?I("",!0):(d(),c("div",{key:2,onClick:w[4]||(w[4]=_=>{var y;return(y=i.value)==null?void 0:y.click()}),class:R([m.disabled||n.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"])},[n.value?(d(),c("div",sr)):(d(),ve(tt,{key:0,class:"w-6 h-6"}))],2))]))}}),ur=le(ir,[["__scopeId","data-v-e613a523"]]),dr={class:"max-w-[55vw]"},cr={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},pr={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},vr={class:"px-[5px]"},fr={class:""},dt=J({__name:"vs-widget-file-info",props:{item:{default:null}},setup(a){const e=a,t=j(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function o(u){if(u<1024)return`${u} B`;const i=u/1024;return i<1024?`${i.toFixed(2)} KB`:`${(i/1024).toFixed(2)} MB`}return(u,i)=>{var n,r,f,h;return d(),c(ue,null,[i[1]||(i[1]=_e('<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)),l("div",dr,[l("p",cr,q((n=u.item)==null?void 0:n.uploaded_name),1),l("p",pr,[l("span",null,q((r=u.item)==null?void 0:r.username),1),se(l("span",vr,"|",512),[[Vt,(f=u.item)==null?void 0:f.username]]),l("span",null,q(t.value),1),i[0]||(i[0]=l("span",{class:"px-[5px]"},"|",-1)),l("span",fr,q(o((h=u.item)==null?void 0:h.size)),1)])])],64)}}}),mr={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},hr={key:0,class:"flex w-full gap-x-3 items-center"},gr={key:1,class:"flex gap-x-3 w-full items-center"},yr={key:2,class:"flex gap-x-3 w-full items-center"},br=["href"],xr={key:3,class:"flex gap-x-3 w-full items-center"},wr={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},kr={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"},Cr={class:"inline-block"},Vr={class:"inline-block"},_r=J({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(a,{emit:e}){const t=a,o=e;function u(m){return["pdf","json"].includes(m.ext)}function i(m){return["ppt","pptx","doc","docx","xls","xlsx"].includes(m.ext)}function n(m){const w=document.createElement("a");w.setAttribute("download",m==null?void 0:m.uploaded_name),w.href=m==null?void 0:m.file_path,w.click()}async function r(){try{await fetch(`${t.prefix}/widget/file/${t.item.entity_id}/${t.item.file_id}`),o("update")}catch(m){console.error(m)}}function f(){o("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:r,updateListOnConfirm:!0})}function h(m){(t.item.ext==="jpg"||t.item.ext==="png")&&o("openLightbox",{item:t.item,index:m})}return(m,w)=>(d(),c("div",mr,[m.item.ext==="jpg"||m.item.ext==="png"?(d(),c("div",hr,[l("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:w[0]||(w[0]=_=>h(m.index))},[K(dt,{item:m.item},null,8,["item"])])])):u(m.item)?(d(),c("div",gr,[K(dt,{item:m.item},null,8,["item"])])):i(m.item)?(d(),c("div",yr,[l("a",{href:`/api/file-preview?id=${m.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[K(dt,{item:m.item},null,8,["item"])],8,br)])):(d(),c("div",xr,[K(dt,{item:m.item},null,8,["item"])])),l("div",wr,[l("div",kr,[l("div",Cr,[l("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:w[1]||(w[1]=_=>n(m.item))},[K(Rt,{height:"14",width:"14"})])]),w[3]||(w[3]=l("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),l("div",Vr,[l("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:w[2]||(w[2]=_=>f())},[K(vt,{height:"14",width:"14"})])])])])]))}}),Lr={},Mr={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 Br(a,e){return d(),c("svg",Mr,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),l("path",{d:"M7 11l5 5l5 -5"},null,-1),l("path",{d:"M12 4l0 12"},null,-1)]))}const jr=le(Lr,[["render",Br]]),Er={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},$r={class:"flex w-full mb-[12px] items-center gap-x-2"},Ar={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},zr={class1:"ml-auto"},Sr={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"},Ur={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Or={class:"relative"},Fr={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"},Tr={key:0},Dr=J({__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:e}){const t=a,o=Fe("form"),u=j(()=>o.value.formId),i=M(!1),n=M(0),r=e,f=M(!1),h=M({}),m=M([]),w=M(""),_=j(()=>Array.isArray(m.value)?m.value.filter(E=>E.ext==="jpg"||E.ext==="png").map(E=>E==null?void 0:E.file_path):[]),y=j(()=>w.value===""?m.value:m.value.filter(E=>{var b;return(b=E==null?void 0:E.uploaded_name)==null?void 0:b.includes(w.value)})),U=E=>{const b=_.value.findIndex(x=>x===E.item.file_path);b!==-1&&(i.value=!0,n.value=b)},V=async()=>{try{const E=await fetch(`${t.prefix}/widget/file/${u.value}`).then(b=>b.json());m.value=E==null?void 0:E.rows}catch(E){console.error(E)}},k=async E=>{await Promise.all(Array.from(E.target.files).map(async b=>{const x=new FormData;x.append("file",b);try{const S=`${t.prefix}/widget/file/${u.value}`,T=await fetch(S,{method:"POST",body:x});return T.ok?(r("update","file-list"),b):(me({type:T.status>=400&&T.status<500?"warning":"error",title:"Error",message:`Error code: ${T.status}`}),null)}catch(S){return me({type:"error",title:"Error",message:S.message||"Unknown error"}),console.error(S),null}})),await V()},A=E=>{const b={...E};return E.cancel||(b.cancel=()=>{f.value=!1}),E.updateListOnConfirm&&(b.confirm=async()=>{await E.confirm(),f.value=!1,V()}),b},z=E=>{h.value=A(E),f.value=!0};return ie(u,E=>{E&&V()}),Ve(()=>{u.value&&V()}),(E,b)=>{var T,Z,oe;const x=Lt("Lightbox"),S=Lt("MessageBox");return d(),c("div",Er,[l("div",$r,[l("h2",Ar," Файлів: "+q((T=m.value)==null?void 0:T.length),1),l("div",zr,[l("label",null,[l("input",{type:"file",class:"hidden",onChange:b[0]||(b[0]=W=>k(W))},null,32),l("div",Sr,[K(jr,{height:"16",width:"16"})])])])]),((Z=m.value)==null?void 0:Z.length)>4?(d(),c("div",Ur,[l("div",null,[l("div",Or,[b[8]||(b[8]=l("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[l("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"},[l("circle",{cx:"11",cy:"11",r:"8"}),l("path",{d:"m21 21-4.3-4.3"})])],-1)),se(l("input",{type:"text","onUpdate:modelValue":b[1]||(b[1]=W=>w.value=W),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),[[he,w.value,void 0,{trim:!0}]])])])])):I("",!0),(oe=m.value)!=null&&oe.length?(d(),c("div",Fr,[(d(!0),c(ue,null,fe(y.value,(W,H)=>(d(),ve(_r,{key:H,prefix:E.prefix,item:W,index:H,onUpdate:b[2]||(b[2]=X=>E.$emit("update","file-list")),onOpenModal:b[3]||(b[3]=X=>z(X)),onOpenLightbox:b[4]||(b[4]=X=>U(X))},null,8,["prefix","item","index"]))),128)),y.value.length?I("",!0):(d(),c("div",Tr,b[9]||(b[9]=[l("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):I("",!0),K(x,{modelValue:i.value,"onUpdate:modelValue":b[5]||(b[5]=W=>i.value=W),startIndex:n.value,"onUpdate:index":b[6]||(b[6]=W=>n.value=W),images:_.value},null,8,["modelValue","startIndex","images"]),K(S,qe({modelValue:f.value,"onUpdate:modelValue":b[7]||(b[7]=W=>f.value=W),onConfirm:h.value.confirm},h.value),null,16,["modelValue","onConfirm"])])}}}),Hr={class:"flex items-center justify-between"},Ir={class:"text-[16px] text-gray-900 font-medium"},Rr={class:"grid gap-3"},Pr=J({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(a){const e=a,t=M(e.isOpen);return ie(()=>e.isOpen,o=>{t.value=o}),(o,u)=>(d(),c("div",null,[l("div",Hr,[l("p",Ir,q(a.title),1),K(Ht,{modelValue:t.value,"onUpdate:modelValue":u[0]||(u[0]=i=>t.value=i),style:xe(a.style)},null,8,["modelValue","style"])]),K(Ct,{name:"slide-fade"},{default:Te(()=>[se(l("div",Rr,[Ue(o.$slots,"default",{},void 0,!0)],512),[[Vt,t.value]])]),_:3})]))}}),Nr=le(Pr,[["__scopeId","data-v-90320b87"]]),Zr={class:"text-[16px] text-gray-900 font-medium"},Wr={class:"grid gap-3"},Gr=J({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(a){const e=a,t=M(e.isOpen);return ie(()=>e.isOpen,o=>{t.value=o}),(o,u)=>(d(),c("div",null,[l("button",{type:"button",onClick:u[0]||(u[0]=i=>t.value=!t.value),class:"flex items-center gap-2"},[K(re(Nl),{class:R(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),l("span",Zr,q(a.title),1)]),K(Ct,{name:"slide-fade"},{default:Te(()=>[se(l("div",Wr,[Ue(o.$slots,"default",{},void 0,!0)],512),[[Vt,t.value]])]),_:3})]))}}),Kr=le(Gr,[["__scopeId","data-v-590eff11"]]),qr={class:"flex items-center justify-between"},Jr=J({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(a){return(e,t)=>(d(),c("div",null,[l("div",qr,[l("p",null,q(a.title),1)]),Ue(e.$slots,"default")]))}}),Xr={switcher:Nr,accordion:Kr,default:Jr},Me={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Qr=(a,e)=>String(a)===String(e),Yr=(a,e)=>String(a)!==String(e),eo=(a,e)=>a>e,to=(a,e)=>a>=e,lo=(a,e)=>a<e,ao=(a,e)=>a<=e,ro=(a,e)=>Array.isArray(e)&&e.length===2?a>=e[0]&&a<=e[1]:!1,oo=(a,e)=>String(a).startsWith(String(e)),no=(a,e)=>String(a).endsWith(String(e)),so=(a,e)=>String(a).includes(String(e)),io=(a,e)=>Array.isArray(e)?e.includes(a):!1,uo=(a,e)=>Array.isArray(e)?!e.includes(a):!0,Pt=(a,e)=>{if(!e)return!0;switch(e==null?void 0:e[1]){case Me.Equal:return Qr(a,e==null?void 0:e[2]);case Me.Inequal:return Yr(a,e==null?void 0:e[2]);case Me.Higer:return eo(a,e==null?void 0:e[2]);case Me.HigerOrEqual:return to(a,e==null?void 0:e[2]);case Me.Lower:return lo(a,e==null?void 0:e[2]);case Me.LowerOrEqual:return ao(a,e==null?void 0:e[2]);case Me.Between:return ro(a,e==null?void 0:e[2]);case Me.StartWith:return oo(a,e==null?void 0:e[2]);case Me.EndWith:return no(a,e==null?void 0:e[2]);case Me.Contain:return so(a,e==null?void 0:e[2]);case Me.In:return io(a,e==null?void 0:e[2]);case Me.NotIn:return uo(a,e==null?void 0:e[2]);default:return!0}},co=J({__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 e=a,t=Fe("values",M({})),o=Fe("form"),u=j(()=>{var r;return(r=e.schema)==null?void 0:r.filter(f=>{var _,y,U,V;const h=f==null?void 0:f.conditions;if(!h)return!0;const m=Array.isArray(h)?h[0]:h,w=e.name?((y=(_=t.value)==null?void 0:_[e.name])==null?void 0:y[m])??((U=t.value)==null?void 0:U[m]):(V=t.value)==null?void 0:V[m];return Pt(w,h)})}),i=j(()=>Xr[e.view]),n=j(()=>{if(t.value||(t.value={}),!e.name)return t.value;const r=t.value[e.name];if(r)return r;const f={};return t.value={...t.value,[e.name]:f},f});return(r,f)=>{var h;return(h=a.schema)!=null&&h.length?(d(),ve(Ke(i.value),{key:0,title:a.title,style:xe(a.style)},{default:Te(()=>[(d(!0),c(ue,null,fe(u.value,m=>{var w,_;return d(),ve(Nt,qe({key:m.name},{ref_for:!0},m,{item:m,modelValue:n.value[m.name],"onUpdate:modelValue":y=>n.value[m.name]=y,style:a.style,error:(_=(w=re(o))==null?void 0:w.errors)==null?void 0:_[m.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"])}),128))]),_:1},8,["title","style"])):I("",!0)}}}),po=["aria-expanded","data-focus"],vo={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},fo={class:"flex items-center min-w-0"},mo=["title"],ho=["innerHTML"],go=["onClick"],yo={class:"flex-1 min-w-[2px]"},bo=["placeholder"],xo=["title"],wo=["innerHTML"],ko={key:2,class:"flex-1 min-w-[2px]"},Co=["placeholder"],Vo={class:"flex items-center shrink-0"},_o=["disabled"],Lo=["disabled","title"],Mo=["aria-disabled","onClick"],Bo=["innerHTML"],jo={key:1,class:"px-3 py-2 text-center text-gray-500"},Eo=["disabled"],At=J({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(a,{emit:e}){const t=a,o=e,u=j(()=>t.multiple),i=j(()=>t.disabled);Le(t.style);const n=j({get:()=>t.modelValue,set:p=>o("update:modelValue",p)});!n.value&&t.defaultValue&&(n.value=t.defaultValue);const r=M(null),f=M(null),h=M(null),m=M(null),w=M(!1),_=M(!1),y=M(null),U=M([]),V=M(-1),k=M([]),A=M(""),z=M(null),E=M("bottom"),b=M({}),x=M([]),S=j(()=>{if(!x.value.length)return[];const p=U.value,g=new Map(p.map(B=>{var F;return[(F=B.id)==null?void 0:F.toString(),B]}));return x.value.map(B=>g.get(B==null?void 0:B.toString())).filter(B=>!!B)}),T=j(()=>t.placeholder||"Select..."),Z=j(()=>D(y.value));j(()=>u.value?!x.value.length&&A.value==="":!Z.value&&A.value==="");const oe=j(()=>i.value?!1:u.value?x.value.length>0:!!n.value),W=p=>{var g;return u.value?x.value.some(B=>(B==null?void 0:B.toString())===(p==null?void 0:p.toString())):((g=n.value)==null?void 0:g.toString())===(p==null?void 0:p.toString())},H=j(()=>{let p=U.value??[];if(!t.data&&A.value.trim()!==""){const g=A.value.toLowerCase();p=p.filter(B=>{var te,de;const F=D(B).toLowerCase(),ee=((de=(te=B.text)==null?void 0:te.toLowerCase)==null?void 0:de.call(te))||"";return F.includes(g)||ee.includes(g)})}if(u.value&&x.value.length){const g=new Set(x.value.map(B=>B==null?void 0:B.toString()));p=p.filter(B=>{var F;return!g.has((F=B.id)==null?void 0:F.toString())})}return p}),X=Fe("values"),ae=/\{\{\s*([^}]+?)\s*\}\}/g,ne=p=>(p?String(p):"").replace(/<[^>]*>/g,"").trim(),N=j(()=>t.slot??(t==null?void 0:t.optionTemplate)??""),P=p=>{if(!p)return"";const g=N.value;return g?g.replace(ae,(B,F)=>{const ee=F.trim(),te=p[ee];return te!=null?String(te):""}):p.text??""},D=p=>{if(!p)return"";if(!N.value)return p.text??"";const g=P(p);return ne(g)||p.text||""},Y=p=>{t.set&&(X!=null&&X.value)&&Object.entries(t.set).forEach(([g,B])=>{if(!g)return;const F=p?p[B]:null;X.value[g]=F??null})},Q=j(()=>{var p,g;return t.parent?((g=(p=X==null?void 0:X.value)==null?void 0:p[t.parent])==null?void 0:g.toString())??null:null}),ye=async p=>{var g;if(!t.data){let B=t.options??[];if(p!=null&&p.trim()){const F=p.toLowerCase();B=B.filter(ee=>{var G,be;const te=D(ee).toLowerCase(),de=((be=(G=ee.text)==null?void 0:G.toLowerCase)==null?void 0:be.call(G))||"";return te.includes(F)||de.includes(F)})}return B}try{const B=t.host??"",F=t.prefix??"api",ee=t.api??`/${F}/suggest/${t.data}`,te=`${B}${ee}`,de=new URLSearchParams;return de.set("json","1"),p&&de.set("key",p),Q.value!==void 0&&Q.value!==null&&Q.value!==""&&de.set("parent",Q.value),((g=await fetch(`${te}?${de.toString()}`).then(G=>G.json()))==null?void 0:g.data)??[]}catch{return[]}},Be=async()=>{t.data?U.value=await ye(A.value):U.value=t.options?[...t.options]:[]},je=async p=>{var B,F,ee;if(p==null)return null;const g=(B=U.value)==null?void 0:B.find(te=>{var de;return((de=te==null?void 0:te.id)==null?void 0:de.toString())===String(p)});if(g)return g;if(t.data)try{const te=t.host??"",de=t.prefix??"api",G=t.api??`/${de}/suggest/${t.data}`,be=`${te}${G}`,$e=new URLSearchParams;return $e.set("json","1"),$e.set("val",String(p)),Q.value!==void 0&&Q.value!==null&&Q.value!==""&&$e.set("parent",Q.value),((ee=((F=await fetch(`${be}?${$e.toString()}`).then(Re=>Re.json()))==null?void 0:F.data)??[])==null?void 0:ee[0])??null}catch{return null}return null},ft=async p=>{const g=new Set(U.value.map(F=>{var ee;return(ee=F.id)==null?void 0:ee.toString()})),B=p.filter(F=>!g.has(F==null?void 0:F.toString()));B.length&&await B.reduce(async(F,ee)=>{await F;const te=await je(ee);te&&U.value.push(te)},Promise.resolve())},ge=async()=>{i.value||(w.value=!0,await Be(),await Se(()=>{var p;Ze(),(p=z.value)==null||p.focus(),H.value.length?V.value=0:V.value=-1}))},Ee=()=>{w.value=!1,V.value=-1},Pe=async p=>{i.value||(w.value?Ee():await ge())},Je=async()=>{var p;w.value?(p=z.value)==null||p.focus():await ge()},at=()=>{u.value?(x.value=[],n.value=[],o("change",[])):(y.value=null,n.value=null,o("change",null)),Y(null),A.value="",Se(()=>{var p;return(p=z.value)==null?void 0:p.focus()})},mt=p=>{u.value&&(x.value=x.value.filter(g=>(g==null?void 0:g.toString())!==(p==null?void 0:p.toString())),n.value=[...x.value],o("change",n.value),Se(()=>{var g;return(g=z.value)==null?void 0:g.focus()}))},Ae=p=>{u.value?(W(p.id)||(x.value=[...x.value,p.id],n.value=[...x.value],o("change",n.value)),A.value="",Se(()=>{var g;(g=z.value)==null||g.focus(),V.value=Math.min(V.value,H.value.length-1)}),Y(null)):(y.value=p,n.value=p.id,o("change",n.value),A.value="",Ee(),Y(p))},Oe=p=>{W(p.id)||Ae(p)},Ne=(p,g)=>{if(!p||!g)return;const B=p.offsetTop,F=B+p.offsetHeight,ee=g.scrollTop,te=ee+g.clientHeight;let de=g.scrollTop;B<ee?de=B-80:F>te&&(de=F-g.clientHeight+4);const G=g;G.scrollTop=de},ke=p=>{let g=p.parentElement;for(;g;){if(g.classList.contains("ui-dialog__content"))return g;const B=window.getComputedStyle(g),F=B.overflow+B.overflowY+B.overflowX;if(F.includes("auto")||F.includes("scroll")||g===document.body||g===document.documentElement)return g;g=g.parentElement}return document.body},Ze=()=>{if(!f.value)return;const p=f.value.getBoundingClientRect(),g=window.innerHeight||document.documentElement.clientHeight,B=window.innerWidth||document.documentElement.clientWidth,F=8,ee=8,te=t.maxHeight||300,de=g-p.bottom-ee-F,G=p.top-ee-F,be=de>=G,$e=Math.max(B-F*2,0);let{width:Re}=p;$e>0&&Re>$e&&(Re=$e);let{left:Qe}=p;Qe+Re+F>B&&(Qe=B-Re-F),Qe=Math.max(Qe,F);const Wt=Math.min(te,Math.max(be?de:G,50));E.value=be?"bottom":"top",b.value={position:"fixed",left:`${Qe}px`,width:`${Re}px`,minWidth:"300px",maxHeight:`${Wt}px`,transform:be?"none":"translateY(-100%)",top:be?`${p.bottom+ee}px`:`${p.top-ee}px`}},ht=async p=>{i.value||!w.value&&(p.key==="ArrowDown"||p.key==="ArrowUp")&&(p.preventDefault(),await ge())},rt=p=>{var B;if(!w.value)return;const{key:g}=p;if(g==="ArrowDown")p.preventDefault(),V.value+1<H.value.length&&(V.value+=1,Ne(k.value[V.value],h.value));else if(g==="ArrowUp")p.preventDefault(),V.value>0&&(V.value-=1,Ne(k.value[V.value],h.value));else if(g==="Enter"){p.preventDefault();const F=H.value[V.value];F&&Ae(F),(B=z.value)==null||B.blur()}else g==="Escape"?(p.preventDefault(),Ee()):g==="Backspace"?u.value&&A.value===""&&x.value.length&&(x.value=x.value.slice(0,-1),n.value=[...x.value],o("change",n.value)):g==="Home"?(V.value=0,Ne(k.value[0],h.value)):g==="End"?(V.value=H.value.length-1,Ne(k.value[V.value],h.value)):g==="Tab"&&Ee()},ot=()=>{i.value||(_.value=!0)},ze=()=>{_.value=!1,A.value=""},nt=p=>{p.key==="Escape"&&w.value&&Ee()},st=p=>{var B,F;const g=p.target;(B=r.value)!=null&&B.contains(g)||(F=m.value)!=null&&F.contains(g)||Ee()},De=p=>{w.value&&h.value&&!h.value.contains(p.target)&&Ze()},it=()=>{w.value&&Ze()},ut=()=>{w.value&&Ze()};ie(()=>t.options,p=>{p!=null&&p.length&&(U.value=[...p],We())},{immediate:!0});async function We(){if(u.value)Array.isArray(n.value)?x.value=[...n.value]:(x.value=n.value==null?[]:[n.value],n.value=[...x.value]),t.data&&x.value.length&&(await ft(x.value),await Se());else{if(Array.isArray(n.value)){const p=n.value[0]??null;n.value=p??null}n.value!=null&&(y.value=await je(n.value)),Y(y.value??null)}}ie(n,()=>{We()}),Ve(async()=>{var p;addEventListener("keydown",nt),addEventListener("scroll",De,!0),addEventListener("resize",it),document.addEventListener("click",st,!0),f.value&&ke(f.value).addEventListener("scroll",ut,!0),(p=t.options)!=null&&p.length&&!t.data?U.value=[...t.options]:t.data&&(U.value=await ye("")),await We(),O.value=!1}),et(()=>{removeEventListener("keydown",nt),removeEventListener("scroll",De,!0),removeEventListener("resize",it),document.removeEventListener("click",st,!0),f.value&&ke(f.value).removeEventListener("scroll",ut,!0)});const Ge=M(!1),Xe=M({}),He=M([]),Ie=M(null);async function s(){var B,F;if(!((B=t.add)!=null&&B.token)||Ie!=null&&Ie.value.validate())return;const p=t.add.api??`/api/table/${t.add.token}`,{id:g}=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Xe.value)}).then(ee=>ee.json());if(!((F=t.options)!=null&&F.length)&&t.data){const{data:ee}=await fetch(`${t.api??`/api/suggest/${t.data}`}?val=${g}`).then(te=>te.json());y.value=ee[0],U.value.push(ee[0]),n.value=g}Ge.value=!1,me({title:"Success!",message:"Object created."})}async function v(){if(!t.add)return null;const p=await fetch(`/api/template/form/${t.add.form}`).then(g=>g.json());return He.value=p.schema,Ge.value=!0,null}function C(p,g=200){let B;return(...F)=>{B&&clearTimeout(B),B=window.setTimeout(()=>p(...F),g)}}const $=C(async p=>{U.value=await ye(p)},200);ie(A,p=>{t.data&&$(p.trim())}),ie(()=>t.options,p=>{!t.data&&(p!=null&&p.length)&&(U.value=[...p],We())},{immediate:!0}),ie(()=>t.parent??t.parentValue,()=>{t.data&&Be()});const O=M(!0);return ie(Q,async()=>{if(t.data&&(O.value||(u.value?(x.value=[],n.value=[],o("change",[])):(y.value=null,n.value=null,o("change",null))),await Be(),t.auto===1&&Q.value&&U.value.length>0)){const p=U.value[0];p&&Ae(p)}}),(p,g)=>{var B,F,ee,te,de;return d(),c(ue,null,[K(re(Dt),{visible:Ge.value,"onUpdate:visible":g[1]||(g[1]=G=>Ge.value=G),title:"Додати",buttonText:"Додати",onDone:s,teleport:p.teleport},{default:Te(()=>[K(lt,{schema:He.value,modelValue:Xe.value,"onUpdate:modelValue":g[0]||(g[0]=G=>Xe.value=G),ref_key:"addForm",ref:Ie},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),l("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:r,onClick:g[5]||(g[5]=Ce(()=>{},["stop"]))},[l("div",{class:R(["relative w-full font-sans",t.customClass])},[g[10]||(g[10]=l("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),g[11]||(g[11]=l("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),l("div",{class:R(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",w.value||_.value?"border-blue-500 ring-1 ring-blue-500":"",i.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":w.value,"aria-haspopup":"listbox",onKeydown:ht,onClick:Je,"data-focus":w.value||_.value?"true":"false"},[l("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full",ref_key:"triggerRef",ref:f},[u.value?(d(),c("div",vo,[(d(!0),c(ue,null,fe(S.value,G=>(d(),c("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:G.id},[l("div",fo,[G!=null&&G.color?(d(),c("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:xe({backgroundColor:G==null?void 0:G.color})},null,4)):I("",!0),l("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:D(G)},[N.value?(d(),c("span",{key:0,innerHTML:P(G)},null,8,ho)):(d(),c(ue,{key:1},[we(q(G.text),1)],64))],8,mo)]),l("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:Ce(be=>mt(G.id),["stop"])},g[6]||(g[6]=[l("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"},[l("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)]))),128)),l("div",yo,[!i.value&&p.search?se((d(),c("input",{key:0,ref_key:"inputRef",ref:z,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:x.value.length?" ":T.value,"onUpdate:modelValue":g[2]||(g[2]=G=>A.value=G),onFocus:ot,onBlur:ze,onKeydown:rt},null,40,bo)),[[he,A.value]]):I("",!0)])])):!u.value&&!_.value&&Z.value&&A.value===""?(d(),c("div",{key:1,class:R(["truncate text-gray-900"]),title:Z.value},[(B=y.value)!=null&&B.color?(d(),c("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:xe({backgroundColor:(F=y.value)==null?void 0:F.color})},null,4)):I("",!0),N.value?(d(),c("span",{key:1,class:R({"pl-5":(ee=y.value)==null?void 0:ee.color}),innerHTML:P(y.value)},null,10,wo)):(d(),c("span",{key:2,class:R({"pl-5":(te=y.value)==null?void 0:te.color})},q((de=y.value)==null?void 0:de.text),3))],8,xo)):I("",!0),u.value?I("",!0):(d(),c("div",ko,[!i.value&&p.search?se((d(),c("input",{key:0,ref_key:"inputRef",ref:z,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:Z.value?" ":T.value,"onUpdate:modelValue":g[3]||(g[3]=G=>A.value=G),onFocus:ot,onBlur:ze,onKeydown:rt},null,40,Co)),[[he,A.value]]):I("",!0)]))],512),l("div",Vo,[oe.value?(d(),c("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:i.value,onClick:Ce(at,["stop"])},g[7]||(g[7]=[l("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[l("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,_o)):I("",!0),g[9]||(g[9]=l("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),l("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:i.value,onClick:g[4]||(g[4]=Ce(G=>Pe(),["stop"])),title:w.value?"Закрити список":"Відкрити список"},g[8]||(g[8]=[l("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[l("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,Lo)])],42,po),(d(),ve(pt,{to:"body"},[w.value?(d(),c("div",{key:0,ref_key:"dropdownRef",ref:m,class:R(["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:xe(b.value),role:"listbox"},[l("div",{class:"overflow-y-auto py-1",style:xe({maxHeight:b.value.maxHeight||"300px"}),ref_key:"listRef",ref:h},[H.value.length?(d(!0),c(ue,{key:0},fe(H.value,(G,be)=>(d(),c("div",{key:G.id,ref_for:!0,ref:$e=>k.value[be]=$e,class:R(["flex px-3 py-2 cursor-default select-none text-gray-900 ",W(G.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",V.value===be&&!W(G.id)?"bg-blue-100":""]),"aria-disabled":W(G.id)?"true":"false",role:"option",tabindex:"-1",onClick:$e=>Oe(G)},[G!=null&&G.color?(d(),c("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:xe({backgroundColor:G==null?void 0:G.color})},null,4)):I("",!0),l("div",{class:R(["leading-[19px]",V.value===G.id?"text-white":"",(V.value,"")])},[N.value?(d(),c("span",{key:0,innerHTML:P(G)},null,8,Bo)):(d(),c(ue,{key:1},[we(q(G.text),1)],64))],2)],10,Mo))),128)):(d(),c("div",jo," No options "))],4)],4)):I("",!0)]))],2),t.add?(d(),c("button",{key:0,onClick:v,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:i.value,type:"button"},[K(tt,{width:"16",height:"16"}),g[12]||(g[12]=l("span",null,"Додати",-1))],8,Eo)):I("",!0)],512)],64)}}}),$o=["placeholder","disabled"],Ao=J({__name:"vs-input-textarea",props:ce({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:t}=Le(e.style),o=pe(a,"modelValue"),u=j(()=>!!e.disabled),i=j(()=>e.placeholder??"");return(n,r)=>se((d(),c("textarea",{"onUpdate:modelValue":r[0]||(r[0]=f=>o.value=f),placeholder:i.value,disabled:u.value,row:"2",class:R(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[re(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,$o)),[[he,o.value]])}}),zo={},So={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 Uo(a,e){return d(),c("svg",So,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),l("path",{d:"M21 21l-6 -6"},null,-1)]))}const Oo=le(zo,[["render",Uo]]),Fo={},To={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 Do(a,e){return d(),c("svg",To,e[0]||(e[0]=[l("path",{d:"m3 16 4 4 4-4"},null,-1),l("path",{d:"M7 20V4"},null,-1),l("path",{d:"m21 8-4-4-4 4"},null,-1),l("path",{d:"M17 4v16"},null,-1)]))}const Ho=le(Fo,[["render",Do]]),Io={},Ro={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 Po(a,e){return d(),c("svg",Ro,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),l("path",{d:"M7 9l5 -5l5 5"},null,-1),l("path",{d:"M12 4l0 12"},null,-1)]))}const No=le(Io,[["render",Po]]),Zo={},Wo={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 Go(a,e){return d(),c("svg",Wo,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),l("path",{d:"M7 11l5 5l5 -5"},null,-1),l("path",{d:"M12 4l0 12"},null,-1)]))}const Ko=le(Zo,[["render",Go]]),qo={},Jo={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 Xo(a,e){return d(),c("svg",Jo,e[0]||(e[0]=[_e('<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 zt=le(qo,[["render",Xo]]),Qo={},Yo={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function en(a,e){return d(),c("svg",Yo,e[0]||(e[0]=[_e('<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 tn=le(Qo,[["render",en]]),ln={},an={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 rn(a,e){return d(),c("svg",an,e[0]||(e[0]=[l("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 on=le(ln,[["render",rn]]),nn={class:"vs-datatable border rounded-xl w-full flex-grow"},sn={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},un={class:"relative w-full"},dn={class:"table-wrapper flex gap-2"},cn={class:"vs-popover inline-block text-slate-700"},pn={class:"text-center"},vn={class:""},fn={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"},mn={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},hn={class:"text-sm items-center text-gray-800 flex gap-1"},gn={class:"w-full overflow-x-auto"},yn={class:"w-full table-auto caption-bottom text-sm"},bn={class:"[&_tr]:border-b"},xn={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"},wn={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"},kn={key:0,colspan:"100%",class:"text-center"},Cn={class:"w-full"},Vn={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},_n=["onDragstart","onDragover","onDrop"],Ln={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},Mn={class:"flex items-center justify-center"},Bn={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"},jn={key:0},En=["src"],$n={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},An=["innerHTML"],zn={key:2,class:"line-clamp-2 rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},Sn={key:3,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},Un={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},On={class:"flex items-center justify-center gap-2"},Fn=["onClick"],Tn=["onClick"],Dn={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Hn=J({__name:"vs-input-datatable",props:ce({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,t=pe(a,"modelValue"),o=M({}),u=M(""),i=j(()=>{if(!u.value)return t.value??[];const N=u.value.toLowerCase();return t.value.filter(P=>{var D;return(D=e.colModel)==null?void 0:D.some(Y=>{const Q=P[Y.key];return Q?Array.isArray(Q)?Q.join(", ").toLowerCase().includes(N):String(Q).toLowerCase().includes(N):!1})})}),n=M(null),r=M(null),f=M(!1),h=M(null),m=M({top:0,left:0}),w=N=>{n.value=N},_=N=>{r.value=N},y=N=>{if(n.value===null||n.value===N){n.value=null,r.value=null;return}const P=[...t.value],[D]=P.splice(n.value,1);P.splice(N,0,D),t.value=P,n.value=null,r.value=null},U=N=>{const P=N.currentTarget.getBoundingClientRect();m.value={top:P.bottom+window.scrollY,left:P.left+window.scrollX},f.value=!f.value},V=()=>{h.value&&h.value.click()},k=N=>{const P=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],D=N.toLowerCase();return P.some(Y=>D.endsWith(Y))},A=N=>{var Y;const P=(Y=N.target.files)==null?void 0:Y[0];if(!P)return;const D=new FileReader;D.onload=Q=>{var ye;try{const Be=(ye=Q.target)==null?void 0:ye.result;if(typeof Be=="string"){const je=JSON.parse(Be);Array.isArray(je)&&t.value.push(...je)}}catch(Be){console.error("Error parsing file:",Be)}},D.readAsText(P)},z=()=>{const N=JSON.stringify(t.value,null,2),P=new Blob([N],{type:"application/json"}),D=URL.createObjectURL(P),Y=document.createElement("a");Y.href=D,Y.download="data.json",Y.click(),URL.revokeObjectURL(D)};Ve(async()=>{var P;const N=(P=e.colModel)==null?void 0:P.filter(D=>D.data);N!=null&&N.length&&Promise.all(N.map(async D=>{const Y=await(await fetch(`/api/suggest/${D.data}`)).json();o.value[D.key]=Y.data}))});const E=M(""),b=M(!1);let x="edit",S=0;const T=M({}),Z=M({});async function oe(){E.value="Додати",b.value=!0,x="add",T.value={}}function W(N,P){var Y;const D=P.key||P.name;return o.value[D]&&N[D]?((Y=o.value[D].find(Q=>Q.id.toString()===N[D].toString()))==null?void 0:Y.text)??N[D]:N[D]||"-"}async function H(N,P){E.value="Редагувати",b.value=!0,x="edit",S=P,T.value={...N}}function X(){const N=Z.value.validate();if(N){me({type:"warning",title:"Помилка валідації",message:Object.entries(N).map(([P,D])=>`${P}: ${D}`).join(`
|
|
2
|
-
`)});return}x==="add"?Array.isArray(t.value)?t.value=[...t.value,T.value]:t.value=[T.value]:t.value=t.value.map((P,D)=>D===S?T.value:P),b.value=!1}function ae(N){t.value=t.value.filter((P,D)=>D!==N)}function ne(){b.value=!1}return(N,P)=>(d(),c("div",nn,[l("div",sn,[l("div",un,[K(Oo,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),se(l("input",{type:"text","onUpdate:modelValue":P[0]||(P[0]=D=>u.value=D),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),[[he,u.value]])]),l("div",dn,[l("input",{ref_key:"fileInput",ref:h,onChange:A,class:"hidden",accept:".json",type:"file"},null,544),l("div",cn,[l("div",pn,[l("div",vn,[l("button",{onClick:U,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"},[K(Ho,{height:"16",width:"16"})])])])])]),(d(),ve(pt,{to:"body"},[f.value?(d(),c("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:xe([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:m.value.top+"px",left:m.value.left+"px"}])},[l("div",fn,[l("div",mn,[l("button",{onClick:V,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[K(No,{class:"text-black",width:"14",height:"14"}),P[4]||(P[4]=we(" Імпортувати ",-1))]),l("button",{onClick:z,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[l("span",hn,[K(Ko,{class:"text-black",width:"14",height:"14"}),P[5]||(P[5]=we(" Експортувати ",-1))])])])])],4)):I("",!0)])),l("button",{onClick:oe,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"},[K(tt),P[6]||(P[6]=we(" Додати ",-1))])]),l("div",gn,[l("table",yn,[l("thead",bn,[l("tr",xn,[l("th",wn,[K(zt,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(d(!0),c(ue,null,fe(N.colModel,D=>(d(),c("th",{key:D.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]"},q(D.ua||D.label),1))),128)),P[7]||(P[7]=l("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))])]),l("tbody",{class:R({"[&_tr:last-child]:border-0":!r.value})},[i.value.length===0?(d(),c("td",kn,[l("div",Cn,[l("div",Vn,[K(tn,{class:"w-48 mx-auto"}),P[8]||(P[8]=l("div",{class:"max-w-sm mx-auto mt-6"},[l("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),l("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):I("",!0),(d(!0),c(ue,null,fe(i.value,(D,Y)=>(d(),c("tr",{key:D.id,class:R(["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":n.value===Y,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":r.value===Y}]),draggable:"true",onDragstart:Q=>w(Y),onDragover:Ce(Q=>_(Y),["prevent"]),onDrop:Q=>y(Y)},[l("td",Ln,[l("div",Mn,[K(zt,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(d(!0),c(ue,null,fe(N.colModel,Q=>(d(),c("td",{key:Q.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[Q.type==="file"?(d(),c("div",Bn,[k(W(D,Q))?(d(),c("div",jn,[l("img",{src:W(D,Q),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,En)])):(d(),c("div",$n,[K(It,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):Q.type==="tiptap-editor"?(d(),c("div",{key:1,class:"rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors line-clamp-3",innerHTML:W(D,Q)},null,8,An)):Q.type==="reference"?(d(),c("div",zn,q(W(D,Q)),1)):(d(),c("div",Sn,q(W(D,Q)),1))]))),128)),l("td",Un,[l("div",On,[l("button",{onClick:Q=>H(D,Y),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"},[K(on,{width:"24",height:"24",class:"w-3 h-3"})],8,Fn),l("button",{onClick:Q=>ae(Y),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"},[K(vt,{width:"24",height:"24",class:"w-3 h-3"})],8,Tn)])])],42,_n))),128))],2)])]),K(re(Dt),{teleport:"#modal",visible:b.value,title:E.value,size:"lg",onClose:ne},{default:Te(()=>[K(lt,{schema:e.colModel,values:T.value,"onUpdate:values":P[1]||(P[1]=D=>T.value=D),form:Z.value,"onUpdate:form":P[2]||(P[2]=D=>Z.value=D)},null,8,["schema","values","form"]),l("div",Dn,[l("button",{type:"button",onClick:P[3]||(P[3]=D=>b.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),l("button",{onClick:X,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"])]))}}),In={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 Ye(a){return a?a.type==="Polygon"?{type:"MultiPolygon",coordinates:[a.coordinates]}:a.type==="Feature"?{...a,geometry:Ye(a.geometry)}:a.type==="FeatureCollection"?{...a,features:(a.features||[]).map(e=>Ye(e)).filter(Boolean)}:a:null}function Rn(a){return a?a.type==="FeatureCollection"||a.type==="Feature"?Ye(a):a.geom?{type:"Feature",geometry:Ye({type:a.geom.type,coordinates:a.geom.coordinates}),properties:{}}:a.type&&a.coordinates?{type:"Feature",geometry:Ye(a),properties:{}}:null:null}const Pn={},Nn={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 Zn(a,e){return d(),c("svg",Nn,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),l("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 Wn=le(Pn,[["render",Zn]]),Gn={},Kn={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 qn(a,e){return d(),c("svg",Kn,e[0]||(e[0]=[l("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),l("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),l("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),l("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const Jn=le(Gn,[["render",qn]]),Xn={},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-polygon"};function Yn(a,e){return d(),c("svg",Qn,e[0]||(e[0]=[_e('<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 es=le(Xn,[["render",Yn]]),ts={},ls={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function as(a,e){return d(),c("svg",ls,e[0]||(e[0]=[_e('<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 rs=le(ts,[["render",as]]),os={},ns={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 ss(a,e){return d(),c("svg",ns,e[0]||(e[0]=[l("title",null,null,-1),l("desc",null,null,-1),l("defs",null,null,-1),l("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[l("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[l("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[l("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 is=le(os,[["render",ss]]),us={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},ds={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"},cs=["onClick"],ps={class:"relative flex-1 min-w-[140px]"},vs=["placeholder"],fs="https://data.softpro.ua/api-user/gis-url-proxy",ms="https://geo.rv.ua/api-user/dzk.api",hs=J({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(a,{emit:e}){const t=a,o=e,u=["here","xy","parcel"],i=j(()=>{var x,S;const b=(S=(x=t.config)==null?void 0:x.tools)==null?void 0:S.filter(T=>u.includes(T));return b&&b.length?b:u}),n=j(()=>{var b,x;return((x=(b=t.config)==null?void 0:b.placeholder)==null?void 0:x.trim())||"Пошук…"}),r=M(i.value[0]??u[0]);ie(i,b=>{b.includes(r.value)||(r.value=b[0])});const f=M(""),h=M(!1),m=M(null);ie(r,()=>{f.value="",h.value=!1});function w(b){r.value=b}function _(b){if(!h.value)return;const x=m.value;x&&!x.contains(b.target)&&(h.value=!1)}Ve(()=>{window.addEventListener("click",_,!0)}),kt(()=>{window.removeEventListener("click",_,!0)});function y(b){return b==="xy"?"Координати":b==="parcel"?"Кадастр":"Адреси"}function U(b){const x=b.replace(/[,]+/g," ").trim();if(!x)return null;const S=x.split(/\s+/).filter(Boolean);if(S.length<2)return null;const T=S.slice(0,2).map(Number);if(!T.every(ne=>Number.isFinite(ne)))return null;let[Z,oe]=T,W=Z,H=oe;const X=ne=>Math.abs(ne)<=90,ae=ne=>Math.abs(ne)<=180;if(!X(W)||!ae(H))if(X(H)&&ae(W))W=oe,H=Z;else return null;return{lat:W,lng:H}}function V(b){return((b==null?void 0:b.items)||[]).map((x,S)=>{var T,Z,oe;return{id:String((x==null?void 0:x.id)??S),title:(x==null?void 0:x.title)||((T=x==null?void 0:x.address)==null?void 0:T.label)||"Знайдений обʼєкт",lat:Number((Z=x==null?void 0:x.position)==null?void 0:Z.lat),lng:Number((oe=x==null?void 0:x.position)==null?void 0:oe.lng)}}).filter(x=>Number.isFinite(x.lat)&&Number.isFinite(x.lng))}function k(b){const x=(b==null?void 0:b.result)||(b==null?void 0:b.data)||b;if(!x)return[];const S=x.geom_centroid;if(!S||!Array.isArray(S.coordinates))return[];const[T,Z]=S.coordinates;return!Number.isFinite(Z)||!Number.isFinite(T)?[]:[{id:"parcel",title:x.cadnum||x.cad_num||"Земельна ділянка",lat:Z,lng:T}]}function A(b){const x=b.replace(/\s+/g,"").split(":");if(x.length!==4)return!1;const S=[10,2,3,4];return x.every((T,Z)=>T.length===S[Z]&&/^\d+$/.test(T))}function z(b){o("goToCoordinates",[b.lat,b.lng])}async function E(){const b=f.value.trim();if(b){if(r.value==="xy"){const x=U(b);if(!x){me({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}z(x),f.value="";return}try{const x=new URL(r.value==="here"?fs:ms);if(r.value==="here")x.searchParams.set("searchtext",b);else{if(!A(b)){me({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}x.searchParams.set("cad_num",b)}const S=await fetch(x.toString());if(!S.ok)throw new Error(`HTTP ${S.status}`);const T=await S.json(),Z=r.value==="here"?V(T):k(T);if(!Z.length)me({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const oe=Z[0];z(oe),f.value=""}}catch(x){const S=(x==null?void 0:x.message)||"Помилка пошуку";me({type:"error",title:"Пошук",message:S})}}}return(b,x)=>(d(),c("div",us,[l("form",{class:"flex gap-2",onSubmit:Ce(E,["prevent"])},[i.value.length>1?(d(),c("div",{key:0,ref_key:"dropdownRef",ref:m,class:"relative search-type w-[140px]"},[l("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:x[0]||(x[0]=S=>h.value=!h.value)},[l("span",null,q(y(r.value)),1),(d(),c("svg",{class:R(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":h.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},x[2]||(x[2]=[l("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),h.value?(d(),c("div",ds,[l("ul",null,[(d(!0),c(ue,null,fe(i.value,S=>(d(),c("li",{key:S,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:T=>w(S)},q(y(S)),9,cs))),128))])])):I("",!0)],512)):I("",!0),l("div",ps,[se(l("input",{"onUpdate:modelValue":x[1]||(x[1]=S=>f.value=S),placeholder:n.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,vs),[[he,f.value,void 0,{trim:!0}]]),x[3]||(x[3]=l("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[l("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"},[l("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)]))}}),gs=le(hs,[["__scopeId","data-v-3048520a"]]),ys={class:"bg-white/30 p-1 rounded-md shadow"},bs={class:"flex gap-2"},xs=["onClick","title"],ws=["src"],ks=J({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(a,{emit:e}){const t=M(Object.keys(a.basemaps)[0]),o=e;function u(i){o("onLayerChange",i),t.value=i}return(i,n)=>(d(),c("div",ys,[l("div",bs,[(d(!0),c(ue,null,fe(i.basemaps,(r,f)=>(d(),c("div",{key:f,class:R(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":t.value===f}]),onClick:h=>u(f),title:r.name||f,role:"button",tabindex:"0"},[l("img",{src:r.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,ws)],10,xs))),128))])]))}}),Cs={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},Vs={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},_s={class:"text-sm font-medium"},Ls={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Ms={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Bs={class:"flex items-center gap-1"},js=["disabled"],Es=["disabled"],$s=["disabled"],As={class:"absolute top-4 right-4 z-[1000]"},zs={class:"flex flex-col gap-[2px]"},Ss=["disabled"],Us=["disabled"],Os=["disabled"],Fs=["disabled"],Ts={class:"flex flex-col gap-2"},Ds={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},Hs={class:"flex flex-col gap-1"},Is=["checked","disabled","onChange"],Rs={class:"text-gray-700 text-xs font-medium"},Ps={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"},Ns={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Zs={class:"shrink-0"},Ws={class:"font-bold"},Gs={class:"flex items-center"},Ks={class:"text-xs mr-2"},qs={key:0,class:"text-xs"},Js={key:1,class:"text-xs"},Xs=["disabled"],Qs=["disabled"],Ys=J({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},layers:{default:()=>[]},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(a,{emit:e}){var Ie;const t=Qt(),o=a,u=e,i=j(()=>{const s={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!o.tools||!o.tools.length)return s;const v=new Set(o.tools.map(C=>C.toLowerCase()));return{search:v.has("search"),import:v.has("import"),export:v.has("export"),point:v.has("point"),line:v.has("line"),polygon:v.has("polygon"),rectangle:v.has("rectangle")}}),n=j(()=>!!o.disabled),r=M(!1),f=M(null),h=M(null),m=M(!1),w=M(""),_=Ot({}),y=M([]),U=j(()=>y.value.map(s=>_[s]).filter(s=>!!s)),V=j(()=>Array.isArray(o.layers)&&o.layers.some(s=>`${(s==null?void 0:s.service)??""}`.toLowerCase()==="vtile"));let k,A,z;function E(){return navigator.platform.toUpperCase().indexOf("MAC")>=0,/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}const b=M(null),x=M(null);let S=null;const T=M(null),Z=s=>{s.ctrlKey&&s.preventDefault()};function oe(s,v){return s!=null&&s.id?String(s.id):s!=null&&s.url?`${s.url}-${v}`:`layer-${v}`}function W(s){if(!s)return"";if(/^https?:\/\//i.test(s))return s.replace(/\/+$/,"");const v=s.replace(/^\/+/,"").replace(/\/+$/,"");return v?`/${v}`:""}function H(s){var F;const v=(s==null?void 0:s.url)??"";if(!v||/^https?:\/\//i.test(v))return v;const C=typeof window<"u"&&((F=window.location)!=null&&F.origin)?window.location.origin:"";if(v.startsWith("/"))return C?`${C}${v}`:v;const $=W(s==null?void 0:s.prefix),O=W(o.prefix),p=$||O,g=v.replace(/^\/+/,""),B=p?`${p.replace(/\/$/,"")}/${g}`:`/${g}`;return C?`${C}${B}`:B}function X(s){const v=(s==null?void 0:s.style)??{};return C=>{const $=v.colorAttr,O=v.colorSet??{},p=typeof $=="string"?(O==null?void 0:O[C==null?void 0:C[$]])??v.color??"#3388ff":v.color??"#3388ff",g=v.stroke??p;return{weight:v.width??1,color:g,opacity:v.opacity??1,fill:v.type?v.type!=="polyline":!0,fillColor:p,fillOpacity:v.opacity??.5}}}function ae(s){const v=(s==null?void 0:s.colorSet)||(s==null?void 0:s.colors);if(s!=null&&s.colorAttr&&v){const C=Object.entries(v).flat();return["match",["get",s.colorAttr],...C,s.color??"#94a3b8"]}return(s==null?void 0:s.color)??"#3388ff"}function ne(s,v,C){if(!s)return[];const $=[],O=ae(s);return s.icon&&$.push({id:`${v}-icon`,type:"symbol",source:v,"source-layer":C,minzoom:s.iconZoom||0,layout:{"icon-image":s.icon,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),s.pointZoom&&$.push({id:`${v}-point`,type:"circle",source:v,"source-layer":C,maxzoom:s.pointZoom,paint:{"circle-stroke-color":s.stroke||"#fff","circle-opacity":s.opacity??1,"circle-color":O,"circle-stroke-width":s.width??1,"circle-radius":s.radius??5}}),s.type==="polygon"?$.push({id:`${v}-fill`,type:"fill",source:v,"source-layer":C,minzoom:s.pointZoom||0,paint:{"fill-color":O,"fill-opacity":s.opacity??.5,"fill-outline-color":s.stroke||O}}):s.type==="line"?$.push({id:`${v}-line`,type:"line",source:v,"source-layer":C,paint:{"line-color":O,"line-opacity":s.opacity??1,"line-width":s.width??1.5}}):s.icon||$.push({id:`${v}-circle`,type:"circle",source:v,"source-layer":C,paint:{"circle-stroke-color":s.stroke||"#fff","circle-opacity":s.opacity??1,"circle-color":O,"circle-stroke-width":s.width??1,"circle-radius":s.radius??5}}),$}function N(s,v){var p;const C=s.id||`source-${Math.random().toString(36).slice(2,8)}`,$=s.sourceLayer||s.layer||s.service_layer||s.service_key||s.map_key||((p=s.dataset)==null?void 0:p.layer)||s.id||s.table_name||C,O=ne(s.style||{},C,$||C);return O.length?{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{[C]:{type:"vector",tiles:[v],minzoom:s.minzoom??0,maxzoom:s.maxzoom??19}},layers:O}:null}function P(s){var O,p,g,B;const v=((s==null?void 0:s.service)??"").toLowerCase(),C=H(s),$=s.sourceLayer||s.layer||s.service_layer||s.service_key||s.map_key||((O=s.dataset)==null?void 0:O.layer)||s.id||s.table_name;if(console.info("[vs-input-map] create overlay layer",{id:s.id,service:v,url:C,sourceLayer:$,hasSourceLayer:!!$}),v==="vtile"){if((p=L==null?void 0:L.vectorGrid)!=null&&p.protobuf&&!(L!=null&&L.maplibreGL))return console.info("[vs-input-map] using Leaflet.vectorGrid"),L.vectorGrid.protobuf(C,{interactive:!0,vectorTileLayerStyles:{default:X(s)}});if(L!=null&&L.maplibreGL&&(window!=null&&window.maplibregl)){console.info("[vs-input-map] using maplibre-gl-leaflet");const F=N(s,C);return F?L.maplibreGL({style:F,interactive:!1,pane:"overlayPane"}):(console.warn("[vs-input-map] maplibre spec is empty",s.id),null)}return null}return v==="tile"||/^https?:\/\//i.test(C)||C.includes("{z}")?L.tileLayer(C,{opacity:((g=s==null?void 0:s.style)==null?void 0:g.opacity)??1}):L.tileLayer(C,{opacity:((B=s==null?void 0:s.style)==null?void 0:B.opacity)??1})}function D(){k&&y.value.forEach(s=>{const v=_[s];v&&(v.visible?(v.layer||(v.layer=P(v.config)),v.layer&&!k.hasLayer(v.layer)?(console.info("[vs-input-map] add overlay layer to map",v.id),v.layer.addTo(k)):v.layer||console.warn("[vs-input-map] overlay layer is null",v.id)):v.layer&&k.hasLayer(v.layer)&&(console.info("[vs-input-map] remove overlay layer from map",v.id),k.removeLayer(v.layer)))})}function Y(s){if(n.value)return;const v=_[s];v&&(v.visible=!v.visible,k&&(console.info("[vs-input-map] toggle overlay",{id:s,nextVisible:v.visible,hasLayerInstance:!!v.layer}),v.visible?(v.layer||(v.layer=P(v.config)),v.layer&&!k.hasLayer(v.layer)&&(console.info("[vs-input-map] add overlay layer to map",v.id),v.layer.addTo(k))):v.layer&&k.hasLayer(v.layer)&&k.removeLayer(v.layer)))}function Q(){if(!o.handleZoom)return null;let s;const v=$=>{const O=$.ctrlKey||$.metaKey,p=$.shiftKey;if(!O&&!p){m.value=!0,w.value=E(),clearTimeout(s),s=window.setTimeout(()=>{m.value=!1},1e3);return}m.value=!1,k.scrollWheelZoom.enable(),setTimeout(()=>{k.scrollWheelZoom.disable()},100)},C=$=>{if($.touches.length===1){m.value=!0,w.value=E(),clearTimeout(s),s=window.setTimeout(()=>{m.value=!1},3e3);return}m.value=!1};return x.value&&(x.value.addEventListener("wheel",v,{passive:!1}),x.value.addEventListener("touchstart",C,{passive:!0})),k&&k.on("wheel",$=>{const O=$.originalEvent.ctrlKey||$.originalEvent.metaKey,p=$.originalEvent.shiftKey;!O&&!p&&($.originalEvent.preventDefault(),$.originalEvent.stopPropagation())}),()=>{x.value&&(x.value.removeEventListener("wheel",v),x.value.removeEventListener("touchstart",C)),k&&k.off("wheel"),clearTimeout(s)}}const ye=M(null),Be=M(6),je=M(0),ft=M(((Ie=t==null?void 0:t.appContext.config.globalProperties.$settings)==null?void 0:Ie.center)||[50,30]),ge=M(null),Ee=Xe();let Pe;const Je=M("topo100");function at(s){return s?s.type==="Polygon"?{type:"MultiPolygon",coordinates:[s.coordinates]}:(s.type,s):null}function mt(){return new Promise((s,v)=>{window.L&&window.L.Draw&&s(0);const C=p=>{if(Array.from(document.styleSheets).some(B=>{var F;return(F=B==null?void 0:B.href)==null?void 0:F.includes(p)}))return;const g=document.createElement("link");g.rel="stylesheet",g.href=p,document.head.appendChild(g)},$=p=>new Promise((g,B)=>{const F=Array.from(document.scripts).find(te=>te.src===p);if(F){F.addEventListener("load",()=>g()),F.addEventListener("error",te=>B(te));return}const ee=document.createElement("script");ee.src=p,ee.async=!0,ee.onload=()=>g(),ee.onerror=te=>B(te),document.body.appendChild(ee)});C("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),C("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),V.value&&C("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css");let O=$("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>$("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"));V.value?O=O.then(()=>$("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js")).then(()=>(window.maplibregl&&!window.mapboxgl&&(window.mapboxgl=window.maplibregl),$("https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"))):O=O.then(()=>$("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>Promise.resolve())),O.then(()=>s(0)).catch(v)})}function Ae(){const s=A.toGeoJSON(),v=[];let C=null;const $=p=>{if(p)switch(p.type){case"Point":C=p;break;case"Polygon":v.push(p.coordinates);break;case"MultiPolygon":v.push(...p.coordinates);break;case"GeometryCollection":(p.geometries||[]).forEach($);break}};((s==null?void 0:s.features)||[]).forEach(p=>$(p.geometry));const O=C||(v.length?{type:"MultiPolygon",coordinates:v}:null);u("update:modelValue",O?at(O):null),je.value=A.getLayers().length}function Oe(s=30){const v=A.getLayers();if(!v.length)return;const C=L.featureGroup(v).getBounds();C&&C.isValid()&&k.fitBounds(C,{padding:[s,s]})}function Ne(){var s;n.value||((s=T.value)==null||s.click())}const ke=M("");ie(i,s=>{ke.value&&!Object.entries(s).filter(([v,C])=>C).map(([v])=>v).includes(ke.value)&&(z!=null&&z.disable&&z.disable(),ke.value="")}),ie(()=>o.layers,s=>{const v=Array.isArray(s)?s:[],C=[],$=new Set;v.forEach((O,p)=>{if(!O)return;const g=oe(O,p);C.push(g),$.add(g),console.info("[vs-input-map] overlay register",{id:g,service:O==null?void 0:O.service,url:O==null?void 0:O.url});const B=_[g];B?_[g]={...B,config:{...O,id:g}}:_[g]={id:g,config:{...O,id:g},visible:(O==null?void 0:O.overlay)!==!1,layer:null}}),Object.keys(_).forEach(O=>{if($.has(O))return;const p=_[O];p!=null&&p.layer&&(k!=null&&k.hasLayer)&&k.hasLayer(p.layer)&&k.removeLayer(p.layer),delete _[O]}),y.value=C,D()},{immediate:!0,deep:!0}),ie(n,s=>{s&&z&&(z.disable(),ke.value=""),A&&A.eachLayer(v=>{var C,$,O,p,g;s?($=(C=v.dragging)==null?void 0:C.disable)==null||$.call(C):(O=v.dragging)!=null&&O.enable&&(v.dragging.enable(),(g=(p=v.dragging).enabled)==null||g.call(p))})});function Ze(s){return s instanceof L.Circle?"Circle":s instanceof L.Rectangle?"Rectangle":s instanceof L.Polygon&&!(s instanceof L.Rectangle)?"Polygon":s instanceof L.Polyline&&!(s instanceof L.Polygon)?"Polyline":s instanceof L.Marker?"Point":"Feature"}function ht(s){var v;if(s instanceof L.Circle){const C=s.getRadius();return Math.PI*(C*C)/1e6}if(s instanceof L.Polygon||s instanceof L.Rectangle)try{const C=s.getLatLngs(),$=Array.isArray(C[0])?C[0]:C,O=(v=L.GeometryUtil)!=null&&v.geodesicArea?L.GeometryUtil.geodesicArea($):0;return O?O/1e6:0}catch{return null}return null}function rt(s){return s instanceof L.Circle?s.getLatLng():s.getBounds?s.getBounds().getCenter():s.getLatLng?s.getLatLng():k.getCenter()}async function ot(s,v){var O;if(b.value="",!((O=o.api)!=null&&O.length))return;const[C,$]=o.api;try{const p=new URL(C);p.searchParams.set("lat",String(s)),p.searchParams.set("lon",String(v));const g=await fetch(p.toString());if(!g.ok)throw new Error("Request failed");const B=await g.json();$&&B[$]!==void 0?b.value=String(B[$]):b.value=JSON.stringify(B)}catch(p){console.error("[vs-input-map] reverse geocode failed:",p),b.value=null}}function ze(){const s=A.getLayers();if(!s.length){ge.value=null,je.value=0;return}const v=s[s.length-1],C=Ze(v),$=rt(v),O=ht(v);ge.value={type:C,center:$,areaKm2:O,layer:v},je.value=s.length,ot($.lat,$.lng)}function nt(){var v;if(n.value)return;const s=(v=ge.value)==null?void 0:v.layer;s&&(s instanceof L.Circle&&s.getBounds?k.fitBounds(s.getBounds(),{padding:[30,30]}):s.getBounds?k.fitBounds(s.getBounds(),{padding:[30,30]}):s.getLatLng&&k.setView(s.getLatLng(),Math.max(Be.value,14)))}function st(){var v;if(n.value)return;const s=(v=ge.value)==null?void 0:v.layer;s&&(A.removeLayer(s),Ae(),ze())}Ve(async()=>{document.addEventListener("wheel",Z,{passive:!1}),await mt(),L.drawLocal=In;const s=o.handleZoom;k=L.map(x.value,{zoomControl:!1,scrollWheelZoom:!s}).setView(ft.value,10),setTimeout(()=>{S=Q()},100),L.control.zoom({position:"bottomright"}).addTo(k),Je.value=Object.keys(Ee)[0],Pe=L.tileLayer(Ee[Je.value].url,{maxZoom:19,minZoom:6}).addTo(k),A=new L.FeatureGroup().addTo(k),k.on(L.Draw.Event.CREATED,$=>{if(n.value)return;const{layer:O}=$;A.clearLayers(),A.addLayer(O),Ae(),Oe(),ke.value=""}),k.on(L.Draw.Event.EDITED,()=>{n.value||(Ae(),ze(),Oe())}),k.on(L.Draw.Event.DELETED,()=>{n.value||(Ae(),ze(),Oe())});let v=!1;k.on("mousemove",$=>{v||(k.invalidateSize(),v=!0),ye.value=$.latlng}),k.on("zoomend",()=>{Be.value=k.getZoom()});const C=Rn(o.modelValue);if(C){const $=[];L.geoJSON(C).eachLayer(O=>$.push(O)),$.length&&A.addLayer($[0]),Ae(),ze(),Oe()}D()}),et(()=>{document.removeEventListener("wheel",Z),S&&S(),Object.values(_).forEach(s=>{var v;s!=null&&s.layer&&((v=k==null?void 0:k.hasLayer)!=null&&v.call(k,s.layer)&&k.removeLayer(s.layer),typeof s.layer.remove=="function"&&s.layer.remove())})});function De(s){if(!n.value&&k){switch(z&&z.disable(),s){case"marker":z=new L.Draw.Marker(k);break;case"polyline":z=new L.Draw.Polyline(k);break;case"polygon":z=new L.Draw.Polygon(k);break;case"rectangle":z=new L.Draw.Rectangle(k);break;default:z=new L.Draw.Rectangle(k);break}z&&(z.enable(),ke.value=s)}}function it(){if(n.value)return;const s=A.toGeoJSON(),v=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),C=URL.createObjectURL(v),$=document.createElement("a");$.href=C,$.download="data.geojson",$.click(),URL.revokeObjectURL(C)}function ut(s){var O;if(n.value)return;const v=s.target,C=(O=v.files)==null?void 0:O[0];if(!C)return;const $=new FileReader;$.onload=()=>{if(typeof $.result=="string")try{const p=JSON.parse($.result);A.clearLayers(),p&&L.geoJSON({type:"Feature",geometry:p}).eachLayer(g=>{A.addLayer(g)}),Ae(),ze(),Oe()}finally{v.value=""}},$.readAsText(C)}function We(s){k&&(Pe&&k.removeLayer(Pe),Pe=L.tileLayer(Ee[s].url,{maxZoom:19,minZoom:6}).addTo(k),Je.value=s)}function Ge(s){const v=L.latLng(s[0],s[1]);k.setView(v,13)}ie(()=>o.modelValue,s=>{const v=at(s);if(s&&v!==s){u("update:modelValue",v);return}A.clearLayers(),v&&L.geoJSON({type:"Feature",geometry:v}).eachLayer(C=>{var $,O,p,g,B,F;if(A.addLayer(C),n.value){(O=($=C.dragging)==null?void 0:$.disable)==null||O.call($);return}(g=(p=C.dragging)==null?void 0:p.enable)==null||g.call(p),(F=(B=C.dragging)==null?void 0:B.enabled)==null||F.call(B),C.on("dragend",ee=>{const te=ee.target.getLatLng();u("update:modelValue",{type:"Point",coordinates:[te.lng,te.lat]})})}),je.value=A.getLayers().length,ze(),Oe()});function Xe(){var s,v;return(s=t==null?void 0:t.appContext.config.globalProperties.$settings)!=null&&s.basemaps?(v=t==null?void 0:t.appContext.config.globalProperties.$settings)==null?void 0:v.basemaps.map((C,$)=>Object.assign(C,{key:`b${$}`,preview:C.preview||C.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((C,$)=>({...C,[$.key]:$}),{}):{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 He=M(!1);return ie(He,()=>{setTimeout(()=>{k.invalidateSize()},50)}),ie(r,async s=>{if(!s||!h.value){f.value=null;return}await Se();const v=h.value.getBoundingClientRect();f.value={top:v.bottom+6,left:v.left}}),et(()=>{r.value=!1,f.value=null}),(s,v)=>(d(),c("div",{class:R(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:He.value}])},[l("div",{ref_key:"mapContainer",ref:x,class:"w-full h-full"},null,512),K(Ct,{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:Te(()=>[m.value&&o.handleZoom?(d(),c("div",Cs,[l("div",Vs,[l("p",_s,q(w.value),1)])])):I("",!0)]),_:1}),i.value.search||i.value.import||i.value.export?(d(),c("div",Ls,[i.value.search?(d(),ve(gs,{key:0,onGoToCoordinates:Ge})):I("",!0),i.value.import||i.value.export?(d(),c("div",Ms,[l("div",Bs,[i.value.import?(d(),c("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Ne,disabled:n.value}," Import ",8,js)):I("",!0),i.value.export?(d(),c("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:it,disabled:n.value||je.value===0}," Export ",8,Es)):I("",!0)]),l("input",{ref_key:"importRef",ref:T,type:"file",onChange:ut,accept:".json,.geojson",class:"hidden",disabled:n.value},null,40,$s)])):I("",!0)])):I("",!0),l("div",As,[l("div",zs,[i.value.point?(d(),c("button",{key:0,class:R(["vs-btn",{"vs-active":ke.value==="marker"}]),title:"Point",onClick:v[0]||(v[0]=C=>De("marker")),disabled:n.value},[K(Wn)],10,Ss)):I("",!0),i.value.line?(d(),c("button",{key:1,class:R(["vs-btn",{"vs-active":ke.value==="polyline"}]),title:"Line",onClick:v[1]||(v[1]=C=>De("polyline")),disabled:n.value},[K(Jn)],10,Us)):I("",!0),i.value.polygon?(d(),c("button",{key:2,class:R(["vs-btn",{"vs-active":ke.value==="polygon"}]),title:"Polygon",onClick:v[2]||(v[2]=C=>De("polygon")),disabled:n.value},[K(es)],10,Os)):I("",!0),i.value.rectangle?(d(),c("button",{key:3,class:R(["vs-btn",{"vs-active":ke.value==="rectangle"}]),title:"Rectangle",onClick:v[3]||(v[3]=C=>De("rectangle")),disabled:n.value},[K(rs)],10,Fs)):I("",!0),l("button",{class:"vs-btn mt-5",onClick:v[4]||(v[4]=C=>He.value=!He.value),title:"Full Screen"},[K(is,{style:{width:"12px",height:"12px"}})])])]),l("div",{class:R(["absolute left-4 z-[1000]",ge.value?"bottom-8":"bottom-4"])},[l("div",Ts,[K(ks,{basemaps:re(Ee),onOnLayerChange:We},null,8,["basemaps"]),U.value.length?(d(),c("div",Ds,[v[9]||(v[9]=l("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Layers",-1)),l("div",Hs,[(d(!0),c(ue,null,fe(U.value,C=>(d(),c("label",{key:C.id,class:"flex items-center gap-2 cursor-pointer select-none"},[l("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:C.visible,disabled:n.value,onChange:$=>Y(C.id)},null,40,Is),l("span",Rs,q(C.config.title||C.config.name||C.id),1)]))),128))])])):I("",!0)])],2),l("div",Ps,[ge.value?(d(),c("div",Ns,[l("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:v[5]||(v[5]=C=>r.value=!0),onMouseleave:v[6]||(v[6]=C=>r.value=!1)},[l("div",Zs,[v[10]||(v[10]=we(" Type: ",-1)),l("span",Ws,q(ge.value.type),1)]),b.value?(d(),c("div",{key:0,ref_key:"addressEl",ref:h,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+q(b.value),513)):I("",!0),(d(),ve(pt,{to:"body"},[r.value&&b.value&&f.value?(d(),c("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:xe({top:f.value.top+"px",left:f.value.left+"px"})},q(b.value),5)):I("",!0)]))],32),l("div",Gs,[l("div",Ks,[v[11]||(v[11]=we(" Center: ",-1)),l("b",null,q(ge.value.center.lat.toFixed(5))+", "+q(ge.value.center.lng.toFixed(5)),1)]),ge.value.areaKm2!==null?(d(),c("div",qs,[v[12]||(v[12]=we(" Area: ",-1)),l("b",null,q(ge.value.areaKm2.toFixed(1))+" km²",1)])):(d(),c("div",Js,v[13]||(v[13]=[we("Area: ",-1),l("b",null,"—",-1)]))),l("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:v[7]||(v[7]=C=>nt()),disabled:n.value},v[14]||(v[14]=[_e('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-3 h-3" data-v-150e767b><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-150e767b></path><path d="M7 10l6 0" data-v-150e767b></path><path d="M10 7l0 6" data-v-150e767b></path><path d="M21 21l-6 -6" data-v-150e767b></path></svg>',1)]),8,Xs),l("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:v[8]||(v[8]=C=>st()),disabled:n.value},[K(vt,{class:"w-3 h-3"})],8,Qs)])])):I("",!0)])],2))}}),ei=le(Ys,[["__scopeId","data-v-150e767b"]]),ti=["data-focus"],li={class:"flex items-center"},ai={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},ri=["onClick","aria-label"],oi={key:0,class:"absolute text-gray-500 truncate pl-2"},ni={class:"flex-1 min-w-[2px]"},si=["placeholder"],ii={class:"flex items-center shrink-0"},ui=["disabled"],di=J({__name:"vs-input-tag",props:ce({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:ce(["update:modelValue"],["update:modelValue"]),setup(a,{emit:e}){const t=a,o=e;Le(t.style);const u=M(null),i=M(null),n=M(null),r=M(!1),f=M(""),h=pe(a,"modelValue"),m=j(()=>t.placeholder||"Add tag…"),w=j(()=>{var S;return((S=h.value)==null?void 0:S.length)===0&&f.value===""}),_=j(()=>{var S;return!t.disabled&&((S=h.value)==null?void 0:S.length)>0}),y=j(()=>t.disabled),U=async()=>{y.value||await Se(()=>{var S;return(S=n.value)==null?void 0:S.focus()})},V=S=>{const T=S.trim();T!==""&&(!h.value||!Array.isArray(h.value)?h.value=[T]:t.unique?h.value.includes(T)||(h.value=[...h.value,T]):h.value=[...h.value,T],f.value="")},k=()=>{const S=f.value;S.trim()!==""&&V(S),f.value=""},A=S=>{const T=h.value.slice();T.splice(S,1),o("update:modelValue",T)},z=()=>{o("update:modelValue",[])},E=()=>{y.value||(r.value=!0)},b=()=>{r.value=!1,!y.value&&k()},x=S=>{const{key:T}=S;T==="Enter"?(S.preventDefault(),k()):T==="Backspace"&&f.value===""&&h.value.length>0&&A(h.value.length-1)};return(S,T)=>(d(),c("div",{class:"flex gap-1 w-full",ref_key:"root",ref:u,onClick:T[1]||(T[1]=Ce(()=>{},["stop"]))},[l("div",{class:R(["relative w-full font-sans",t.customClass]),role:"group","aria-label":"Tag input"},[l("div",{class:R(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",r.value?"border-blue-500 ring-1 ring-blue-500":"",y.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":r.value?"true":"false",onClick:U},[l("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:i},[(d(!0),c(ue,null,fe(h.value,(Z,oe)=>(d(),c("div",{key:oe,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[l("div",li,[l("div",ai,q(Z),1)]),l("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:Ce(W=>A(oe),["stop"]),"aria-label":`Remove ${Z}`},T[2]||(T[2]=[l("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"},[l("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,ri)]))),128)),w.value?(d(),c("div",oi,q(m.value),1)):I("",!0),l("div",ni,[y.value?I("",!0):se((d(),c("input",{key:0,ref_key:"inputRef",ref:n,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":T[0]||(T[0]=Z=>f.value=Z),onFocus:E,onBlur:b,onKeydown:x,placeholder:h.value&&h.value.length?"":void 0},null,40,si)),[[he,f.value]])])],512),l("div",ii,[_.value?(d(),c("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:y.value,onClick:Ce(z,["stop"])},T[3]||(T[3]=[l("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[l("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,ui)):I("",!0)])],10,ti)],2)],512))}}),ci={class:"relative flex gap-1 bg-white w-full"},pi=["disabled","placeholder"],vi=J({__name:"vs-input-slug",props:ce({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=Fe("values"),t=a,o=pe(a,"modelValue");function u(n){const r={а:"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 n.toLowerCase().split("").map(f=>r[f]||f).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const i=()=>{var f,h;const n=(h=(f=e==null?void 0:e.value)==null?void 0:f[t.parent||""])==null?void 0:h.toString(),r=u(n);o.value=r.toString()};return(n,r)=>(d(),c("div",ci,[se(l("input",{ref:"vsText",disabled:n.disabled,placeholder:n.placeholder,"onUpdate:modelValue":r[0]||(r[0]=f=>o.value=f),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,pi),[[he,o.value]]),l("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:i}," Gen ")]))}}),fi=le(vi,[["__scopeId","data-v-b0eba370"]]),mi={class:"relative flex gap-1 bg-white w-full"},hi=["disabled","placeholder"],gi=["disabled"],yi={key:0},bi={key:1},xi=J({__name:"vs-input-codegen",props:ce({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,t=pe(a,"modelValue"),o=M(!1),u=j(()=>e.init!==!1),i=j(()=>!!e.table&&!!e.code),n=()=>{if(!i.value)return"";const h=encodeURIComponent(String(e.table)),m=encodeURIComponent(String(e.code));return`/api/code-gen/${h}/${m}`},r=async()=>{if(!i.value||o.value)return;const h=n();if(h){o.value=!0;try{const m=await(await fetch(h)).text();t.value=m}finally{o.value=!1}}},f=()=>{u.value&&(t.value||r())};return Ve(()=>{f()}),ie(()=>[e.table,e.code,e.init],()=>{f()}),(h,m)=>(d(),c("div",mi,[se(l("input",{disabled:h.disabled,placeholder:h.placeholder,"onUpdate:modelValue":m[0]||(m[0]=w=>t.value=w),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,hi),[[he,t.value]]),l("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:o.value||h.disabled||!i.value,onClick:r},[o.value?(d(),c("span",bi,"...")):(d(),c("span",yi,"Gen"))],8,gi)]))}}),wi=le(xi,[["__scopeId","data-v-6ee5237d"]]),ki={class:"w-full"},Ci={ref:"sortableContainer",class:"flex flex-col gap-1"},Vi=["onDragstart","onDrop"],_i={class:"w-1/3"},Li={class:"w-2/3"},Mi=["onClick"],Bi={key:0,class:"text-[14px] text-gray-700"},ji={class:"mt-2 w-full flex items-center"},Ei=["disabled"],$i=J({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(a,{emit:e}){const t=V=>`${V}-${Math.random().toString(36).substring(2,15)}`,o=Fe("values"),u=a,i=e,n=u.addButtonText??"Додати",r=u.ignore??[],f=M([]),h=M(null);(()=>{var k;const V=u.parent&&((k=o==null?void 0:o.value)==null?void 0:k[u.parent])||u.modelValue||{};f.value=Object.entries(V).filter(([A])=>!r.includes(A)).map(([A,z])=>({id:t("key-value-"),key:A,value:z}))})();function m(V){h.value=V}function w(V){if(h.value===null||h.value===V)return;const k=f.value.splice(h.value,1)[0];f.value.splice(V,0,k),h.value=null}const _=j(()=>f.value.some(V=>V.key&&!V.value||!V.key&&V.value)),y=()=>{f.value.push({id:t("key-value-"),key:"",value:""})},U=V=>{f.value=f.value.filter(k=>k.id!==V)};return ie(f,V=>{const k={};V.forEach(z=>{z.key&&z.value!==void 0&&(k[z.key]=z.value)});const A={};r.length&&r.forEach(z=>{var E,b;A[z]=u.parent?(b=(E=o==null?void 0:o.value)==null?void 0:E[u.parent])==null?void 0:b[z]:void 0}),o!=null&&o.value&&u.parent&&(o.value[u.parent]={...A,...k}),i("update:modelValue",k)},{deep:!0}),(V,k)=>(d(),c("div",ki,[l("div",Ci,[(d(!0),c(ue,null,fe(f.value,(A,z)=>(d(),c("div",{key:A.id,class:R(["flex items-center gap-2 w-full",{"opacity-50":h.value===z}]),draggable:"true",onDragstart:E=>m(z),onDragover:k[0]||(k[0]=Ce(()=>{},["prevent"])),onDrop:E=>w(z)},[k[1]||(k[1]=_e('<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)),l("div",_i,[K(ct,{modelValue:A.key,"onUpdate:modelValue":E=>A.key=E,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),l("div",Li,[K(ct,{modelValue:A.value,"onUpdate:modelValue":E=>A.value=E,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),l("button",{onClick:E=>U(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"},[K(re(Kl),{height:"16",width:"16"})],8,Mi)],42,Vi))),128))],512),f.value.length?I("",!0):(d(),c("span",Bi," Дані для відображення відсутні ")),l("div",ji,[l("button",{type:"button",onClick:y,disabled:_.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"},[K(tt,{height:"14",width:"14"}),we(" "+q(re(n)),1)],8,Ei)])]))}}),Ai=le($i,[["__scopeId","data-v-a0f7fbfc"]]),zi={class:"flex items-center gap-2 w-full"},Si=["disabled"],Ui=["disabled"],Oi=J({__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:e}){const t=a,{inputClass:o}=Le(t.style),u=e,i=j({get:()=>t.modelValue||"#000000",set:r=>u("update:modelValue",r)}),n=j(()=>!!t.disabled);return(r,f)=>(d(),c("div",zi,[se(l("input",{type:"color","onUpdate:modelValue":f[0]||(f[0]=h=>i.value=h),disabled:n.value,ref:"color",class:R(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[r.modelValue?"":"text-opacity-50",re(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Si),[[he,i.value]]),se(l("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":f[1]||(f[1]=h=>i.value=h),disabled:n.value},null,8,Ui),[[he,i.value]])]))}}),Fi={class:"flex items-center gap-2 w-full"},Ti=["min","max","step","disabled"],Di=["disabled"],Hi=J({__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:e}){const t=a,{inputClass:o}=Le(t.style),u=e,i=j({get:()=>Number(t.modelValue??t.min),set:r=>u("update:modelValue",Number(r))}),n=j(()=>!!t.disabled);return(r,f)=>(d(),c("div",Fi,[se(l("input",{type:"range","onUpdate:modelValue":f[0]||(f[0]=h=>i.value=h),min:r.min,max:r.max,step:r.step,disabled:n.value,ref:"range",class:R(["w-full cursor-pointer accent-blue-500",[r.modelValue?"":"text-opacity-50",re(o)].join(" ")])},null,10,Ti),[[he,i.value]]),se(l("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":f[1]||(f[1]=h=>i.value=h),disabled:n.value},null,8,Di),[[he,i.value]])]))}}),Ii=["type","value","onInput","placeholder","disabled"],Ri=J({__name:"vs-input-array",props:ce({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 e=a,{inputClass:t}=Le(e.style),o=pe(a,"modelValue"),u=j(()=>!!e.disabled),i=j(()=>e.placeholder??"");Jt(()=>{var f;const r=((f=o.value)==null?void 0:f.length)??0;r<e.count&&(o.value=[...o.value??[],...Array(e.count-r)])});function n(r,f){if(u.value)return;const h=r.target.value,m=[...o.value];m[f]=e.inputType==="text"?h:Number(h),o.value=m}return(r,f)=>(d(),c("div",{class:R(["grid gap-2",`grid-cols-${r.limit}`])},[(d(!0),c(ue,null,fe(r.count,h=>{var m;return d(),c("input",{type:r.inputType,value:((m=o.value)==null?void 0:m[h-1])??"",onInput:w=>n(w,h-1),placeholder:i.value,disabled:u.value,class:R(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[re(t),{"!border-red-600":r.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Ii)}),256))],2))}}),Pi={class:"flex items-center gap-2 w-full"},Ni={class:"relative flex-1"},Zi=["placeholder","disabled","onKeydown"],Wi=["disabled"],Gi={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Ki={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},qi={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},Ji={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},Xi={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Qi=["onClick"],Yi={key:0,class:"p-4 text-sm text-gray-500"},eu=J({__name:"vs-input-address",props:ce({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:ce(["update:modelValue","update:geom"],["update:modelValue"]),setup(a,{emit:e}){const t=a,o=e,{inputClass:u}=Le(t.style),i=pe(a,"modelValue"),n=j({get:()=>i.value,set:A=>{i.value=A}}),r=M(!1),f=M([]),h=M(!1),m=j(()=>t.placeholder??""),w=j(()=>!!t.disabled),_=Fe("values");function y(){!w.value&&n.value.trim()&&U()}async function U(){var b;const A=(n.value||"").trim();if(!A)return;let z=A;if((b=t.includes)!=null&&b.length&&(_!=null&&_.value)){const x=t.includes.map(S=>{var T;return(T=_.value)==null?void 0:T[S]}).filter(Boolean);x.length&&(z=`${x.join(", ")}, ${A}`)}const E=t.api.replace("{{value}}",encodeURIComponent(z));r.value=!0;try{const x=await(await fetch(E)).json();f.value=Array.isArray(x)?x:[],h.value=!0}catch(x){console.error("Address search error:",x)}finally{r.value=!1}}function V(){h.value=!h.value}function k(A){if(!A)return;h.value=!1;const z=parseFloat(A.lat),E={type:"Point",coordinates:[parseFloat(A.lon),z]};t.geom&&(_!=null&&_.value)&&(_.value[t.geom]=E),o("update:geom",E)}return(A,z)=>{var E;return d(),c("div",Pi,[l("div",Ni,[se(l("input",{type:"text","onUpdate:modelValue":z[0]||(z[0]=b=>n.value=b),placeholder:m.value,disabled:w.value,class:R(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[re(u),{"!border-red-600":t.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:Xt(Ce(y,["prevent"]),["enter"])},null,42,Zi),[[he,n.value]]),f.value.length?(d(),c("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:V,title:"Show search results"},z[2]||(z[2]=[l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M12 16v-4"}),l("path",{d:"M12 8h.01"})],-1)]))):I("",!0)]),l("button",{type:"button",onClick:U,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:r.value||!((E=n.value)!=null&&E.trim())},[r.value?(d(),c("svg",Ki,z[4]||(z[4]=[l("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),l("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(d(),c("svg",Gi,z[3]||(z[3]=[l("circle",{cx:"11",cy:"11",r:"8"},null,-1),l("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,Wi),(d(),ve(pt,{to:"body"},[h.value?(d(),c("div",qi,[l("div",Ji,[l("div",Xi,[z[6]||(z[6]=l("span",null,"Search results",-1)),l("button",{class:"text-gray-500 hover:text-blue-600",onClick:z[1]||(z[1]=b=>h.value=!1),title:"Close"},z[5]||(z[5]=[l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[l("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),l("ul",null,[(d(!0),c(ue,null,fe(f.value,(b,x)=>(d(),c("li",{key:x,onClick:S=>k(b),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},q(b.display_name),9,Qi))),128))]),f.value.length?I("",!0):(d(),c("div",Yi," No results found "))])])):I("",!0)]))])}}}),gt={VsInputText:ct,VsInputRadio:Bt,"vs-input-text":ct,"vs-input-password":kl,"vs-input-textarea":Ao,"vs-input-mask":oa,"vs-input-number":_l,"vs-input-radio":Bt,"vs-input-select":At,"vs-input-switcher":Ht,"vs-input-static":Mt,"vs-input-container":co,"vs-input-date":ka,"vs-input-checkbox":xa,"vs-input-file":ur,"vs-input-html":Mt,"vs-input-email":ia,"vs-input-datatable":Hn,"vs-input-map":ei,"vs-input-file-list":Dr,"vs-input-tags":di,"vs-input-slug":fi,"vs-input-codegen":wi,"vs-input-key-value":Ai,"vs-input-range":Hi,"vs-input-color":Oi,"vs-input-native-select":At,"vs-input-array":Ri,"vs-input-address":eu},tu=J({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(a){const e=a,t=Fe("values");async function o(){try{if(!e.api)return;const u=e.api.replace("{{value}}",e.value),i=await fetch(u);if(!i.ok){me({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const n=await i.json();if(!e.set||!t)return;for(const[r,f]of Object.entries(e.set))t.value[r]=n.result[f]}catch(u){console.error(e.error,u)}}return(u,i)=>(d(),c("button",{onClick:o,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"},q(u.button),1))}}),lu={class:"flex flex-col gap-1 w-full"},au={key:0,class:"text-sm text-gray-500"},Nt=J({__name:"vs-compact-form-layout",props:ce({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 e=a,t=pe(a,"modelValue"),o=j(()=>xl[`${e.layout}`]),u=j(()=>gt==null?void 0:gt[`vs-input-${e.item.type}`]),i=j(()=>{var m;const r=re(u);if(!r)return new Set;const f=r.props??((m=r.__vccOpts)==null?void 0:m.props);if(!f)return new Set;const h=Array.isArray(f)?f:Object.keys(f);return new Set(h)}),n=j(()=>{const r=e.item??{},f=i.value;return f.size?Object.fromEntries(Object.entries(r).filter(([h])=>f.has(h))):{}});return(r,f)=>(d(),ve(Ke(o.value),{ua:e.item.ua,error:e.error||"",item:r.item,columns:e.columns,label:e.item.label},{default:Te(()=>{var h,m;return[l("div",{class:R(["flex w-full",`${e.item.type}-component`])},[l("div",lu,[(d(),ve(Ke(u.value),qe(n.value,{modelValue:t.value,"onUpdate:modelValue":f[0]||(f[0]=w=>t.value=w)}),null,16,["modelValue"])),r.item.description&&e.layout!=="settings"?(d(),c("p",au,q(r.item.description),1)):I("",!0)]),(h=r.item.behavior)!=null&&h.api&&((m=r.item.behavior)!=null&&m.button)?(d(),ve(tu,qe({key:0},r.item.behavior,{value:t.value}),null,16,["value"])):I("",!0)],2)]}),_:1},8,["ua","error","item","columns","label"]))}}),ru={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},ou={class:"vs-compact-form-navigation__rail mt-[6px]"},nu=["onClick"],su=J({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(a,{expose:e}){const t=a,o=M([]),u=M(""),i=M(""),n=j(()=>!!t.enabled),r=j(()=>["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"]),f=j(()=>{const H=t.width;if(H==null)return{};const X=typeof H=="number"?`${H}px`:`${H}`;return{width:X,minWidth:X}});let h=null,m=0,w=0,_=null,y=null,U=null;const V=()=>oe(),k=()=>z();ie(()=>t.target,async H=>{if(S(),!H){_=null,o.value=[],u.value="";return}_=H,n.value&&(await Se(),x(H),z())},{immediate:!0}),ie(()=>t.scrollContainer,H=>{if(!n.value){y=H??null;return}A(H??null),Se(()=>z())},{immediate:!0}),Ve(()=>{t.scrollContainer||A(null),z()}),kt(()=>{S(),A(null,!0),_=null,typeof window<"u"&&(m&&window.cancelAnimationFrame(m),w&&window.cancelAnimationFrame(w))});function A(H,X=!1){if(U&&(U(),U=null),X){y=null;return}if(y=H??null,typeof window>"u")return;const ae=H??window,ne=window;ae.addEventListener("scroll",V,{passive:!0}),ne.addEventListener("resize",k),U=()=>{ae.removeEventListener("scroll",V),ne.removeEventListener("resize",k)}}function z(){if(!n.value||!_)return;m&&typeof window<"u"&&window.cancelAnimationFrame(m);const H=()=>{E(),m=0};typeof window>"u"?H():m=window.requestAnimationFrame(H)}function E(){if(!n.value||!_)return;const H=Array.from(_.querySelectorAll("h1, h2")),X=new Set,ae=[];H.forEach((ne,N)=>{var ye;const P=((ye=ne.textContent)==null?void 0:ye.trim())??"";if(!P)return;let D=(ne.getAttribute("id")??"").trim();D||(D=b(P)||`heading-${N+1}`);let Y=D,Q=1;for(;X.has(Y);)Y=`${D}-${Q+=1}`;ne.id!==Y&&Object.assign(ne,{id:Y}),X.add(Y),ae.push({id:Y,text:P,level:ne.tagName.toLowerCase()==="h1"?1:2})}),o.value=ae,ae.length||(u.value=""),Z()}function b(H){return H.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function x(H){!H||!n.value||typeof MutationObserver>"u"||(S(),h=new MutationObserver(()=>z()),h.observe(H,{childList:!0,subtree:!0}))}function S(){h&&(h.disconnect(),h=null)}function T(H){const X=y;if(!X)return typeof window>"u"?H.offsetTop:H.getBoundingClientRect().top+window.scrollY;const ae=H.getBoundingClientRect(),ne=X.getBoundingClientRect();return ae.top-ne.top+X.scrollTop}function Z(){if(!n.value||!o.value.length)return;const H=y,X=(H?H.scrollTop:null)||(typeof window<"u"?window.scrollY:0),ae=(H?H.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),ne=X+ae;let N=null;for(let D=0;D<o.value.length;D+=1){const Y=o.value[D],Q=document.getElementById(Y.id);if(Q){const ye=T(Q);ye+Q.offsetHeight>X&&ye<ne&&(N=Y.id)}}!N&&i.value&&(N=i.value),N&&(i.value=N);const P=H?H.scrollHeight-H.clientHeight:document.documentElement.scrollHeight-window.innerHeight;X+5>=P&&(N=o.value[o.value.length-1].id),N&&(u.value=N)}function oe(){n.value&&(w&&window.cancelAnimationFrame(w),w=window.requestAnimationFrame(()=>{Z(),w=0}))}function W(H){if(!n.value)return;const X=document.getElementById(H);if(!X)return;const ae=y,ne=Math.max(0,T(X));ae?ae.scrollTo({top:ne,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:ne,behavior:"smooth"})}return e({refresh:z}),(H,X)=>n.value&&o.value.length?(d(),c("div",{key:0,class:R(r.value),style:xe(f.value)},[l("h2",ru,q(H.title),1),l("div",ou,[(d(!0),c(ue,null,fe(o.value,ae=>(d(),c("div",{key:ae.id,class:R(["vs-compact-form-navigation__item relative",ae.level===2?"vs-compact-form-navigation__item--nested":"",ae.id===u.value?"vs-compact-form-navigation__item--active":""])},[l("button",{type:"button",onClick:ne=>W(ae.id),class:R(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",ae.level===2?"pl-[15px]":"pl-[18px]",ae.id===u.value?"text-gray-800":"text-gray-500"])},[l("span",null,q(ae.text),1)],10,nu)],2))),128))])],6)):I("",!0)}}),iu=le(su,[["__scopeId","data-v-1584a562"]]),Zt={required:"Це поле є обов’язковим",email:"Неправильний email"},uu=a=>a?!1:Zt.required,du=a=>a?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a)?!1:Zt.email:!1,cu=(a,e)=>{const t=e.pattern??e.regexp;return!(typeof t=="string"?new RegExp(t):t).test(a)&&a?e.message:!1},pu=(a,e)=>!1,vu=(a,e)=>{switch(typeof e=="string"?e:e.type){case"required":return uu(a);case"email":return du(a);case"regexp":return cu(a,e);case"custom":return pu();default:return!1}},fu={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function St(a){const e=a.toLowerCase();return fu[e]||e}function bt(a,e=!1){if(Array.isArray(a)){const o=[];return a.forEach(u=>{const i={...u};i.name=(u.name||u.id||u.key||"").toString(),i.type=St(u.type),i.label=u.label||u.ua,i.rules=u.rules||u.validators,i.type==="email"&&!i.rules&&(i.rules=["email"]),u.data&&(i.api=`/api/suggest/${u.data}`),i.disabled=e||i.disabled,Array.isArray(i.schema)&&(i.schema=bt(i.schema,i.disabled)),o.push(i)}),o}const t=[];return Object.entries(a).forEach(o=>{const u={name:o[0],...o[1],type:St(o[1].type),label:o[1].label||o[1].ua,rules:o[1].rules||o[1].validators,disabled:e};u.type==="email"&&!u.rules&&(u.rules=["email"]),o[1].type.includes("list")&&(u.multiple=!0),!u.api&&o[1].data&&(u.api=`/api/suggest/${o[1].data}`),Array.isArray(u.schema)&&(u.schema=bt(u.schema,u.disabled)),t.push(u)}),t}function mu(a,e,t=!1){const o=j(()=>bt(e,typeof t=="boolean"?t:t.value)),u=M({});function i(f){var _;const h=f==null?void 0:f.conditions;if(!h)return!0;const m=Array.isArray(h)?h[0]:h,w=(_=a==null?void 0:a.value)==null?void 0:_[m];return Pt(w,h)}const n=(f=o.value,h=!0)=>(f.forEach(m=>{if(m.rules){if(!i(m)){delete u.value[m.name];return}let w=!1,_=null;m.rules.forEach(y=>{const U=vu(a.value[m.name],y);U&&(w=!0,!_&&typeof U=="string"&&(_=U))}),w&&_?u.value[m.name]=_:delete u.value[m.name]}m.schema&&n(m.schema,!1)}),h&&Object.values(u.value).some(Boolean)?u.value:null),r=j(()=>{var f;return(f=o.value)==null?void 0:f.filter(h=>h.hidden!==!0&&i(h))});return{errors:u,validate:n,reset:()=>{a.value={},u.value={}},visibleSchema:r}}const hu={class:"flex w-full h-full min-h-0 gap-6"},gu={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},lt=J({__name:"vs-compact-form",props:ce({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:ce(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(a,{expose:e,emit:t}){const o=t,u=a,i=pe(a,"form"),n=pe(a,"values"),{errors:r,validate:f,reset:h,visibleSchema:m}=mu(n,u.schema,Gt(u,"disabled")),w=M(null),_=M(null),y=j(()=>u.navigation),U=j(()=>u.navWidth),V=j(()=>{var Z;return(Z=u.style)==null?void 0:Z.columns}),k=Object.freeze({container:12,label:3}),A=j(()=>u.columns??V.value??k),z=j(()=>u.columns!=null||V.value!=null),E=j(()=>z.value?"horizontal":u.layout),b=Z=>Z!=null&&Z.columns?"horizontal":E.value,x=Z=>(Z==null?void 0:Z.columns)??A.value,S=()=>{o("update:modelValue",n.value),f(),o("handle-submit",n.value)};e({validate:f,reset:h,errors:r}),Ve(()=>{u.modelValue&&(n.value=u.modelValue),i.value={value:n.value,errors:r.value,reset:h,validate:f,formId:u.formId}});function T(Z,oe){if(Z===oe)return!0;if(typeof Z!="object"||typeof oe!="object"||!Z||!oe)return!1;const W=Object.keys(Z),H=Object.keys(oe);return W.length!==H.length?!1:W.every(X=>Z[X]===oe[X])}return _t("form",i),_t("values",n),(Z,oe)=>(d(),c("div",hu,[l("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:_},[l("form",{ref_key:"formRef",ref:w,onSubmit:Ce(S,["prevent"]),class:R(["grid grid-cols-12 p-1",E.value==="default"?"gap-6":"gap-4"])},[(d(!0),c(ue,null,fe(re(m),(W,H)=>(d(),c("div",{key:W.name,class:R(b(W)==="horizontal"?"col-span-12":`col-span-${W.col||12}`)},[K(Nt,{style:xe(Z.style),item:W,layout:b(W),columns:x(W),"model-value":n.value[W.name],"onUpdate:modelValue":X=>{const ae=n.value[W.name];T(ae,X)||(n.value[W.name]=X)},error:re(r)[W.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),b(W)==="settings"&&H+1!==re(m).length?(d(),c("div",gu)):I("",!0)],2))),128))],34)],512),K(iu,{target:w.value,"scroll-container":_.value,enabled:y.value,width:U.value},null,8,["target","scroll-container","enabled","width"])]))}}),yu={class:"relative"},bu={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},xu={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"},wu={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},ku={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Cu={class:"p-4 mim-h-0 h-full overflow-auto"},Vu=J({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(a,{emit:e}){const t=a,o=e,u=M(t.schema),i=M(t.defaultValue?JSON.parse(JSON.stringify(t.defaultValue)):{}),n=M({}),r=M(),f=M(t.mode);async function h(){const w=n.value.validate();if(w){me({type:"warning",title:"Помилка валідації",message:Object.entries(w).map(([_,y])=>`${_}: ${y}`).join(`
|
|
3
|
-
`)});return}if(r.value)try{const _=await fetch(`/api/table/${r.value}`,{method:f.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i.value)});if(_.ok)await _.json(),me({type:"success",title:"Успішно",message:`Дані успішно ${f.value==="add"?"збережено":"оновлено"}`}),o("save",i.value);else if(_.status===400){const y=await _.json().catch(()=>({}));me({type:"warning",title:"Помилка валідації",message:y.message||"Некоректні дані (400)"})}else _.status===500?me({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):me({type:"error",title:"Помилка",message:`Статус: ${_.status}`})}catch(_){me({type:"error",title:"Помилка з’єднання",message:_.message||"Не вдалося виконати запит"})}}function m(){o("close")}return Ve(async()=>{try{if(t.form){const w=await fetch(`/api/template/form/${t.form}`);if(!w.ok){me({type:w.status>=400&&w.status<500?"warning":"error",title:"Error",message:`Error code: ${w.status}`});return}const _=await w.json();u.value=_.schema,r.value=_.token}else if(t.token){r.value=t.token;const w=await fetch(`/api/form/${r.value}`);if(!w.ok){me({type:w.status>=400&&w.status<500?"warning":"error",title:"Error",message:`Error code: ${w.status}`});return}const _=await w.json();u.value=_.schema,_.data?i.value=_.data:f.value="add"}}catch(w){me({type:"error",title:"Error",message:w.message||"Unexpected error"}),console.error(w)}}),(w,_)=>(d(),c("div",yu,[l("div",bu,[l("div",xu,[l("div",wu,[l("h3",ku,q(f.value==="add"?"Додати":"Змінити"),1),l("button",{onClick:m,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},_[2]||(_[2]=[l("span",{class:"sr-only"},"Close",-1),l("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"},[l("path",{d:"M18 6 6 18"}),l("path",{d:"m6 6 12 12"})],-1)]))]),l("div",Cu,[u.value?(d(),ve(lt,{key:0,schema:u.value,values:i.value,"onUpdate:values":_[0]||(_[0]=y=>i.value=y),form:n.value,"onUpdate:form":_[1]||(_[1]=y=>n.value=y)},null,8,["schema","values","form"])):I("",!0)]),l("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"},[l("button",{type:"button",onClick:m,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),l("button",{onClick:h,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"}," Зберегти ")])])])]))}}),Ut=(a={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=Yt({title:a.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Vu,contentProps:{...a,onClose:()=>{e(null),t()},onSave:o=>{e(o),t()}}})});lt.install=function(a){a.component("VForm",lt),Object.assign(a.config.globalProperties,{$form:Ut}),a.provide("form",Ut),window.v3plugin||(window.v3plugin={})};export{gt as Q,At as j,lt as l,xa as y};
|
|
4
|
-
function __vite__mapDeps(indexes) {
|
|
5
|
-
if (!__vite__mapDeps.viteFileDeps) {
|
|
6
|
-
__vite__mapDeps.viteFileDeps = []
|
|
7
|
-
}
|
|
8
|
-
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bi as H,ao as E,aL as g,d as L,o as c,a as p,b as e,h as _,i as S,t as x,A as C,bG as P,p as V,bb as $,f as N,w as Z,n as B,x as T,v as y,ad as q,e as I,T as A,m as M,z as K,bm as O,B as U,C as G,Y as J}from"./index-yMJAVBXk.js";const h=(m,r)=>{const l=m.__vccOpts||m;for(const[a,t]of r)l[a]=t;return l},Y={key:0,class:"fixed inset-0 z-[2000] flex items-center justify-center bg-gray-600 bg-opacity-75"},Q={key:0,class:"relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg",role:"dialog","aria-modal":"true","aria-labelledby":"dialog-title"},X={class:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"},F={class:"mt-3 text-center sm:mt-5"},R={id:"dialog-title",class:"text-base font-semibold text-gray-900"},W={class:"mt-2"},ee={class:"text-sm text-gray-500"},te={class:"bg-gray-50 px-4 py-3 sm:px-6 flex justify-center"},oe={key:1,class:"relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg",role:"dialog","aria-modal":"true","aria-labelledby":"dialog-title"},re={class:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"},se={class:"sm:flex sm:items-start"},ne={class:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"},le={id:"dialog-title",class:"text-base font-semibold text-gray-900"},ae={class:"mt-2"},ie={class:"text-sm text-gray-500"},de={key:0,class:"mt-2"},ue=["placeholder"],ce=L({__name:"message-box",props:{type:{default:"error"},mode:{default:"confirm"},title:{default:""},message:{default:""},confirmButtonText:{default:"OK"},cancelButtonText:{default:"Cancel"},modelValue:{type:Boolean,default:!1},promptPlaceholder:{default:""},align:{type:Boolean,default:!0}},emits:["confirm","cancel","update:modelValue"],setup(m,{emit:r}){const l=M(null);V(()=>{var u;(u=l.value)==null||u.focus()});const a={success:()=>g("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","aria-hidden":"true",class:"size-6 text-green-600"},[g("path",{d:"m4.5 12.75 6 6 9-13.5","stroke-linecap":"round","stroke-linejoin":"round"})]),error:()=>g("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","aria-hidden":"true",class:"size-6 text-red-600"},[g("path",{d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z","stroke-linecap":"round","stroke-linejoin":"round"})]),info:()=>g("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",class:"size-6 text-blue-600"},[g("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M13 16h-1v-4h-1m1-4h.01M12 20a8 8 0 100-16 8 8 0 000 16z"})]),warning:()=>g("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",class:"size-6 text-yellow-600"},[g("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v2m0 4h.01M10.29 3.86L1.82 17a1 1 0 0 0 .87 1.5h18.62a1 1 0 0 0 .87-1.5L13.71 3.86a1 1 0 0 0-1.42 0z"})])},t=m,i=r,n=M(t.modelValue),s=M("");K(()=>t.modelValue,u=>{n.value=u,u===!0&&t.mode==="prompt"&&(s.value="")});function f(u){n.value=!1,i("update:modelValue",!1),u==="confirm"&&t.mode==="prompt"?i("confirm",s.value):i(u)}function b(){f("confirm")}const o=C(()=>{switch(t.type){case"success":return"bg-green-100";case"error":return"bg-red-100";case"info":return"bg-blue-100";case"warning":return"bg-yellow-100";default:return"bg-gray-100"}}),d=C(()=>t.type==="warning"?"bg-orange-600 hover:bg-orange-500":t.type==="success"?"bg-green-600 hover:bg-green-500":t.type==="error"?"bg-red-600 hover:bg-red-500":"bg-blue-600 hover:bg-blue-500"),w=C(()=>a[t.type||"error"]||a.error),k=C(()=>t.title&&t.title.trim()!==""?t.title:t.type?t.type.charAt(0).toUpperCase()+t.type.slice(1):"Notification");return(u,v)=>{const D=O("focus");return c(),_(A,{to:"body"},[n.value?(c(),p("div",Y,[u.mode==="alert"?(c(),p("div",Q,[e("div",X,[e("div",null,[v[4]||(v[4]=e("div",{class:"mx-auto flex size-12 shrink-0 items-center justify-center rounded-full bg-green-100"},[e("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","aria-hidden":"true",class:"size-6 text-green-600"},[e("path",{d:"m4.5 12.75 6 6 9-13.5","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),e("div",F,[e("h3",R,x(k.value),1),e("div",W,[e("p",ee,x(u.message),1)])])])]),e("div",te,[e("button",{type:"button",onClick:v[0]||(v[0]=j=>f("confirm")),class:"inline-flex min-w-[70px] w-full justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 sm:w-auto"},x(u.confirmButtonText),1)])])):(c(),p("div",oe,[e("div",re,[e("div",se,[e("div",{class:B(["mx-auto flex size-12 shrink-0 items-center justify-center rounded-full sm:mx-0 sm:size-10",o.value])},[(c(),_(S(w.value)))],2),e("div",ne,[e("h3",le,x(k.value),1),e("div",ae,[e("p",ie,x(u.message),1)]),u.mode==="prompt"?(c(),p("div",de,[U(e("input",{"onUpdate:modelValue":v[1]||(v[1]=j=>s.value=j),placeholder:u.promptPlaceholder,class:"w-full rounded-md py-1.5 pl-2 text-gray-900 shadow-sm placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6",onKeyup:J(b,["enter"]),type:"text"},null,40,ue),[[G,s.value],[D]])])):y("",!0)])])]),e("div",{class:B(["bg-gray-50 px-4 py-3",u.align?"sm:flex sm:flex-row-reverse sm:px-6 gap-x-2.5":"sm:flex sm:flex-row sm:px-6 gap-x-2.5"])},[e("button",{type:"button",onClick:v[2]||(v[2]=j=>f("confirm")),class:B(["inline-flex w-full justify-center rounded-md px-3 py-2 text-sm font-semibold text-white shadow-xs sm:w-auto",d.value])},x(u.confirmButtonText),3),e("button",{type:"button",onClick:v[3]||(v[3]=j=>f("cancel")),class:"mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto"},x(u.cancelButtonText),1)],2)]))])):y("",!0)])}}}),me=h(ce,[["__scopeId","data-v-047caa71"]]),fe={key:0,class:"vsTailwind ui-dialog__wrapper text-gray-800"},pe={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},ge={class:"font-medium text-gray-800 dark:text-[#ffffff]"},xe={class:"ui-dialog__content p-4"},be={key:0,class:"flex justify-end gap-x-2"},ve={key:1,class:"flex justify-end items-center gap-x-2 py-3 px-4 border-t border-gray-200 dark:border-neutral-700"},we=L({__name:"vs-modal",props:{title:{default:""},template:{},visible:{type:Boolean,default:!1},size:{default:"small"},closeClickBack:{type:Boolean,default:!1},content:{},buttonText:{},contentProps:{},teleport:{default:"body"}},emits:["update:visible","close","done"],setup(m,{emit:r}){const l=m,a=r,t=C(()=>l.size==="small"?"md:w-5/12 w-9/12":l.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"),i=P();function n(){a("done")}function s(){a("update:visible",!1),a("close")}function f(o){o.key==="Escape"&&s()}function b(o,d){d&&o.target.classList.contains("vs-dialog-overlay")&&s()}return V(()=>{window.addEventListener("keydown",f)}),$(()=>{window.removeEventListener("keydown",f)}),(o,d)=>(c(),_(A,{to:o.teleport},[o.visible?(c(),p("div",fe,[e("div",{onMousedown:d[0]||(d[0]=w=>b(w,o.closeClickBack)),class:B(["vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 bg-black bg-opacity-50",[I(i).class]])},[N(q,{name:"content",appear:""},{default:Z(()=>[e("div",{class:B(["ui-dialog__modal 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",t.value])},[e("div",pe,[e("h3",ge,x(o.title),1),e("button",{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",onClick:s},[...d[1]||(d[1]=[e("span",{class:"sr-only"},"Close",-1),e("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("path",{d:"M18 6 6 18"}),e("path",{d:"m6 6 12 12"})],-1)])])]),e("div",xe,[T(o.$slots,"default",{},void 0,!0)]),o.$slots.footer?(c(),p("div",be,[T(o.$slots,"footer",{handleClose:s},void 0,!0)])):y("",!0),o.buttonText?(c(),p("div",ve,[e("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white 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",onClick:s}," Close "),e("button",{type:"button",onClick:n,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-hidden focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none"},x(o.buttonText),1)])):y("",!0)],2)]),_:3})],34)])):y("",!0)],8,["to"]))}}),ye=h(we,[["__scopeId","data-v-a6807cab"]]),he={key:0,class:"vsTailwind ui-drawer__wrapper"},ke={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Ce={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Be={class:"flex gap-2"},_e={class:"sr-only"},je={key:0,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"},ze={key:1,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"},Me={class:"ui-drawer__content p-4 flex-1 overflow-auto"},Te={key:0,class:"flex justify-end gap-x-2 p-4 border-0 border-t border-solid border-gray-200 dark:border-t-[#454545]"},Le=L({__name:"vs-drawer",props:{title:{default:""},visible:{type:Boolean,default:!1},position:{default:"right"},size:{default:"500px"},closeClickBack:{type:Boolean,default:!1}},emits:["update:visible","close"],setup(m,{emit:r}){const l=m,a=r,t=M(!1),i=C(()=>t.value?"fixed top-0 left-0 w-full h-full":l.position==="left"?"fixed top-0 left-0 h-full":l.position==="right"?"fixed top-0 right-0 h-full":l.position==="top"?"fixed top-0 left-0 w-full":"fixed bottom-0 left-0 w-full");function n(){a("update:visible",!1),a("close")}function s(){t.value=!t.value}function f(o){o.key==="Escape"&&n()}function b(o,d){d&&o.target.classList.contains("vs-drawer-overlay")&&n()}return V(()=>{window.addEventListener("keydown",f)}),$(()=>{window.removeEventListener("keydown",f)}),(o,d)=>(c(),_(A,{to:"#modal"},[o.visible?(c(),p("div",he,[e("div",{onMousedown:d[0]||(d[0]=w=>b(w,o.closeClickBack)),class:"vs-drawer-overlay vs-drawer w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},[N(q,{name:"drawer",appear:""},{default:Z(()=>[e("div",{class:B(["ui-drawer__drawer 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)]",[i.value,t.value?"w-full":`w-[${l.size}]`,`drawer-${l.position}`]])},[e("div",ke,[e("h3",Ce,x(o.title),1),e("div",Be,[e("button",{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",onClick:s},[e("span",_e,x(t.value?"Exit fullscreen":"Enter fullscreen"),1),t.value?(c(),p("svg",ze,[...d[2]||(d[2]=[e("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"},null,-1)])])):(c(),p("svg",je,[...d[1]||(d[1]=[e("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"},null,-1)])]))]),e("button",{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",onClick:n},[...d[3]||(d[3]=[e("span",{class:"sr-only"},"Close",-1),e("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("path",{d:"M18 6 6 18"}),e("path",{d:"m6 6 12 12"})],-1)])])])]),e("div",Me,[T(o.$slots,"default",{},void 0,!0)]),o.$slots.footer?(c(),p("div",Te,[T(o.$slots,"footer",{handleClose:n},void 0,!0)])):y("",!0)],2)]),_:3})],32)])):y("",!0)]))}}),et=h(Le,[["__scopeId","data-v-c808fe88"]]),Ee={},Ve={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-green-600"};function Ae(m,r){return c(),p("svg",Ve,[...r[0]||(r[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])}const Se=h(Ee,[["render",Ae]]),$e={},Ne={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"orange",class:"size-6 text-orange-600"};function Ze(m,r){return c(),p("svg",Ne,[...r[0]||(r[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])}const qe=h($e,[["render",Ze]]),De={},He={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-blue-600"};function Pe(m,r){return c(),p("svg",He,[...r[0]||(r[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"},null,-1)])])}const Ie=h(De,[["render",Pe]]),Ke={},Oe={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"red",class:"size-6 text-red-600"};function Ue(m,r){return c(),p("svg",Oe,[...r[0]||(r[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)])])}const Ge=h(Ke,[["render",Ue]]),Je={class:"rounded-md border border-gray-300 bg-white p-4 shadow-sm"},Ye={class:"flex items-start gap-4 opacity-100 scale-5 transition-all duration-300"},Qe={class:"flex-1"},Xe={class:"font-medium text-gray-900"},Fe={class:"mt-0.5 text-sm text-gray-700"},Re=L({__name:"vs-notify",props:{type:{},title:{},message:{}},setup(m){const r={success:Se,warning:qe,error:Ge,info:Ie};return(l,a)=>(c(),p("div",Je,[e("div",Ye,[(c(),_(S(r[l.type]))),e("div",Qe,[e("strong",Xe,x(l.title),1),e("p",Fe,x(l.message),1)]),a[0]||(a[0]=e("button",{class:"m-3 rounded-full p-1.5 text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700",type:"button","aria-label":"Dismiss notify"},[e("span",{class:"sr-only"},"Dismiss popup"),e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-5"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})])],-1))])]))}}),tt=m=>{const{message:r,title:l,mode:a="confirm",type:t="info",confirmButtonText:i,cancelButtonText:n,onConfirm:s,onCancel:f,cascade:b,confirmButtonStyle:o,cancelButtonStyle:d}=m||{},w=document.querySelector("body");if(!w){console.error('Modal root element with id "#modal" not found!');return}const k=document.createElement("div");w.appendChild(k);const u=()=>{k.remove()};E({render(){return g(me,{title:l,message:r,mode:a,type:t,cascade:b,confirmButtonText:i,cancelButtonText:n,cancelButtonStyle:d,confirmButtonStyle:o,modelValue:!0,onConfirm:()=>{s==null||s(),u()},onCancel:()=>{f==null||f(),u()}})}}).mount(k)};H({visible:!0});const ot=m=>{const{template:r="",title:l="",content:a,contentProps:t={},size:i="medium"}=m,n=document.querySelector("body");if(!n)return console.error('Modal root element with id "#modal" not found!'),{close:()=>{}};const s=document.createElement("div");n.appendChild(s);const f={title:l,template:r,visible:!0,size:i,closeClickBack:!0,onClose:o},b=E({render(){return g(ye,f,{default:()=>[a?g(a,t):g("p",r)]})}});function o(){b.unmount(),s.remove()}return b.mount(s),{close:o}},z={top:"top-4 left-1/2 transform -translate-x-1/2","left-bottom":"bottom-4 left-4 transform","right-bottom":"bottom-4 right-4 transform",bottom:"bottom-4 left-1/2 transform -translate-x-1/2"},rt=m=>{var f;const{type:r="info",title:l,message:a,position:t="right-bottom"}=m||{};let i=document.querySelector("#notify-root");i||(i=document.createElement("div"),i.id="notify-root",i.className=`fixed z-[2000] flex flex-col gap-3 ${z[t]} p-6 max-w-md mx-auto font-sans antialiased`,document.body.appendChild(i)),i.className.includes(z[t])||(Object.values(z).forEach(b=>{i.classList.remove(...b.split(" "))}),i.classList.add(...z[t].split(" ")));const n=document.createElement("div");i.appendChild(n);const s=E({render(){return g(Re,{type:r,title:l,message:a,onClose:()=>{s.unmount(),n.remove()}})}});s.mount(n),(f=n.querySelector("button"))==null||f.addEventListener("click",()=>{n.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{s.unmount(),n.remove()},350)}),setTimeout(()=>{n.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{s.unmount(),n.remove()},350)},3500)};export{ye as J,tt as Z,et as t,ot as w,rt as y};
|