@opengis/gis 0.2.145 → 0.2.146

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.
Files changed (201) hide show
  1. package/README.md +181 -181
  2. package/dist/{CardIcon-KPdJQSAj.js → CardIcon-BCll_4SB.js} +1 -1
  3. package/dist/{EntityCreatePage-Da8XgBKU.js → EntityCreatePage-Ch8NU_Yw.js} +14 -14
  4. package/dist/{EntityEditPage-QktKEAxz.js → EntityEditPage-CRRcW7FL.js} +27 -27
  5. package/dist/{EntityTablePage-D0CxSITf.js → EntityTablePage-DXJPsOx8.js} +26 -26
  6. package/dist/{ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-B7Nkfd7c.js → ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-BJ-zsrml.js} +1 -1
  7. package/dist/{HeaderActions.vue_vue_type_script_setup_true_lang-9kitzmJK.js → HeaderActions.vue_vue_type_script_setup_true_lang-EZGjVDor.js} +5 -5
  8. package/dist/{MapSettings-CBkp5Cfw.js → MapSettings-CG7u4F4i.js} +33 -33
  9. package/dist/{RastersTablePage-D1k_WisA.js → RastersTablePage-CN5hfj6F.js} +29 -29
  10. package/dist/cartocss-BNVXz6oJ.js +1065 -0
  11. package/dist/{import-utils-CVdAWcDL.js → import-utils-BwcMU3Gp.js} +33 -33
  12. package/dist/{index-DJKZSGVW.js → index-8aAArh78.js} +63 -63
  13. package/dist/index.css +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/index.umd.cjs +35 -35
  16. package/dist/raster-BN1gB-NS.js +804 -0
  17. package/dist/{register-Br5WdQas.js → register-DZ24Z6dC.js} +8 -8
  18. package/dist/{service-1sCTWkzU.js → service-DXLa4AiW.js} +392 -380
  19. package/dist/{vs-datatable-CviY_UkX.js → vs-datatable-DVC6-2mA.js} +28 -28
  20. package/module/cls.json +6 -6
  21. package/module/gis/card/gis.metadata.table/index.yml +22 -22
  22. package/module/gis/card/gis.metadata.table/main_info.hbs +20 -20
  23. package/module/gis/card/gis.metadata.table/metadata_info.hbs +27 -27
  24. package/module/gis/card/gis.metadata.table/other.hbs +25 -25
  25. package/module/gis/card/gis.rasters.table/index.yml +11 -11
  26. package/module/gis/card/gis.rasters.table/main_info.hbs +27 -27
  27. package/module/gis/card/gis.registers.table/cls.hbs +36 -36
  28. package/module/gis/card/gis.registers.table/columns.hbs +89 -89
  29. package/module/gis/card/gis.registers.table/filters.hbs +80 -80
  30. package/module/gis/card/gis.registers.table/index.yml +23 -23
  31. package/module/gis/card/gis.registers.table/main_info.hbs +35 -35
  32. package/module/gis/card/gis.registers.table/source.hbs +45 -45
  33. package/module/gis/card/gis.services.table/attributes.hbs +91 -91
  34. package/module/gis/card/gis.services.table/filters.hbs +83 -83
  35. package/module/gis/card/gis.services.table/index.yml +25 -25
  36. package/module/gis/card/gis.services.table/main_info.hbs +27 -27
  37. package/module/gis/card/gis.services.table/source.hbs +25 -25
  38. package/module/gis/cls/bool.yes_no.json +12 -12
  39. package/module/gis/cls/encoding.json +14 -14
  40. package/module/gis/cls/geom_type.json +14 -14
  41. package/module/gis/cls/gis.column_type.json +34 -34
  42. package/module/gis/cls/gis.column_view_type.json +26 -26
  43. package/module/gis/cls/gis.filter_type.json +22 -22
  44. package/module/gis/cls/language.json +10 -10
  45. package/module/gis/cls/meta.service_type.json +42 -42
  46. package/module/gis/cls/ogc.service.json +21 -21
  47. package/module/gis/cls/service_type.json +42 -42
  48. package/module/gis/cls/source_type.json +10 -10
  49. package/module/gis/cls/standarts.json +6 -6
  50. package/module/gis/cls/topic_category.json +106 -106
  51. package/module/gis/cls/update_frequency.json +29 -29
  52. package/module/gis/cls/view.json +21 -21
  53. package/module/gis/form/feedback.answer.form.json +10 -10
  54. package/module/gis/form/gis.cartocss.form.json +64 -64
  55. package/module/gis/form/gis.group_list.form.json +17 -17
  56. package/module/gis/form/gis.maps.form.json +61 -61
  57. package/module/gis/form/gis.metadata.form.json +240 -240
  58. package/module/gis/form/gis.metadata_new.form.json +195 -195
  59. package/module/gis/form/gis.ogc_service.form.json +51 -51
  60. package/module/gis/form/gis.rasters.form.json +76 -76
  61. package/module/gis/form/gis.registers.form.json +124 -124
  62. package/module/gis/form/gis.registers_column.form.json +84 -84
  63. package/module/gis/form/gis.registers_filter.form.json +65 -65
  64. package/module/gis/form/gis.services.form.json +111 -111
  65. package/module/gis/form/gis.services_attributes.form.json +75 -75
  66. package/module/gis/form/gis.services_filter.form.json +65 -65
  67. package/module/gis/menu.json +43 -43
  68. package/module/gis/select/admin.cls.name.sql +9 -9
  69. package/module/gis/select/layer_list.sql +7 -7
  70. package/module/gis/select/layer_list_text.sql +7 -7
  71. package/module/gis/select/pg.column_name.geometry.sql +12 -12
  72. package/module/gis/select/pg.columns.parent.sql +6 -6
  73. package/module/gis/select/pg.table_name.sql +17 -17
  74. package/module/gis/select/service_id.sql +1 -1
  75. package/module/gis/table/gis.cartocss.table.json +74 -74
  76. package/module/gis/table/gis.group_list.table.json +58 -58
  77. package/module/gis/table/gis.maps.table.json +110 -110
  78. package/module/gis/table/gis.metadata.table.json +70 -70
  79. package/module/gis/table/gis.metadata_new.table.json +137 -137
  80. package/module/gis/table/gis.ogc_service.table.json +100 -100
  81. package/module/gis/table/gis.rasters.table.json +101 -101
  82. package/module/gis/table/gis.registers.table.json +143 -143
  83. package/module/gis/table/gis.services.table.json +120 -120
  84. package/module/gis/table/site.gis.registers.table.json +88 -88
  85. package/module/gis/table/site.gis.services.table.json +106 -106
  86. package/module/gis/templates/ISO19136_2017_gml_template.xml +330 -330
  87. package/module/gis/tokens.yml +5 -5
  88. package/module/permissions/form/permissions.users.form.json +151 -151
  89. package/module/permissions/table/gis.permissions.table.json +97 -97
  90. package/module/test/cls/bp_build_type.json +37 -37
  91. package/module/test/cls/doc_status.json +31 -31
  92. package/module/test/cls/ts.temp_status.json +18 -18
  93. package/module/test/cls/ts.temp_structure.ts_class.json +49 -49
  94. package/module/test/cls/ts.temp_type.json +9 -9
  95. package/module/test/layer/bp.json +59 -59
  96. package/module/test/layer/bp1.yml +33 -33
  97. package/module/test/layer/individual.yml +53 -53
  98. package/module/test/layer/ts.linking_passport.yml +55 -55
  99. package/module/test/layer/ts.temp_structure.yml +50 -50
  100. package/module/test/map/addr.yml +21 -21
  101. package/module/test/map/bp_myo.json +43 -43
  102. package/module/test/map/bpf.json +43 -43
  103. package/module/test/map/main.json +37 -37
  104. package/module/test/map/mbd.json +92 -92
  105. package/module/test/map/ts.json +53 -53
  106. package/module/test/select/address_id.json +2 -2
  107. package/module/test/select/address_id.sql +7 -7
  108. package/module/test/select/core.user_uid.sql +1 -1
  109. package/module/test/table/data_address.street.table.json +69 -69
  110. package/module/test/table/data_bp_myo.bp.table.json +122 -122
  111. package/package.json +75 -75
  112. package/plugin.js +55 -55
  113. package/server/migrations/array_intersect.sql +13 -13
  114. package/server/migrations/cartocss.sql +27 -27
  115. package/server/migrations/group_list.sql +74 -74
  116. package/server/migrations/maps.sql +30 -30
  117. package/server/migrations/metadata.sql +415 -415
  118. package/server/migrations/ogc.sql +106 -106
  119. package/server/migrations/rasters.sql +265 -265
  120. package/server/migrations/services.sql +247 -247
  121. package/server/migrations/services_users_rel.sql +22 -22
  122. package/server/migrations/widgets.sql +20 -20
  123. package/server/plugins/crons.js +21 -21
  124. package/server/plugins/mapnik/funcs/checkRasterFile.js +109 -109
  125. package/server/plugins/mapnik/funcs/mapnik.js +151 -151
  126. package/server/plugins/mapnik/funcs/rootFolder.mjs +8 -8
  127. package/server/plugins/mapnik/map.proto +230 -230
  128. package/server/plugins/vite.js +74 -74
  129. package/server/routes/gis/cartocss/add.cartocss.js +42 -42
  130. package/server/routes/gis/cartocss/get.cartocss.js +59 -59
  131. package/server/routes/gis/checkXML.js +117 -117
  132. package/server/routes/gis/dashboard.js +29 -29
  133. package/server/routes/gis/index.mjs +87 -87
  134. package/server/routes/gis/metadata/editMetadata.js +34 -34
  135. package/server/routes/gis/metadata/metadataXML.js +13 -13
  136. package/server/routes/gis/ogc/map.info.point.js +124 -124
  137. package/server/routes/gis/registers/add.registry.js +35 -35
  138. package/server/routes/gis/registers/del.registry.js +14 -14
  139. package/server/routes/gis/registers/funcs/classifiers.js +100 -100
  140. package/server/routes/gis/registers/funcs/columns.js +3 -3
  141. package/server/routes/gis/registers/funcs/content.type.js +9 -9
  142. package/server/routes/gis/registers/funcs/get.info.js +89 -89
  143. package/server/routes/gis/registers/funcs/handleRegistryRequest.js +146 -146
  144. package/server/routes/gis/registers/gis.export.js +153 -153
  145. package/server/routes/gis/registers/gis.registry.js +64 -64
  146. package/server/routes/gis/registers/gis.registry.list.js +59 -59
  147. package/server/routes/gis/registers/insert.columns.js +107 -107
  148. package/server/routes/gis/registers/insert.filters.js +110 -110
  149. package/server/routes/gis/registers/map.registry.js +79 -79
  150. package/server/routes/gis/services/add.service.js +64 -64
  151. package/server/routes/gis/services/del.service.js +12 -12
  152. package/server/routes/gis/services/get.layer.geom.js +27 -27
  153. package/server/routes/gis/services/get.services.col.js +33 -33
  154. package/server/routes/gis/services/get.services.js +84 -84
  155. package/server/routes/gis/services/legend.auto.js +77 -77
  156. package/server/routes/map/controllers/clearTiles.js +34 -34
  157. package/server/routes/map/controllers/geojson.js +187 -187
  158. package/server/routes/map/controllers/jsonData.js +205 -205
  159. package/server/routes/map/controllers/layerList.js +102 -102
  160. package/server/routes/map/controllers/map.js +123 -123
  161. package/server/routes/map/controllers/mapCatalog.js +72 -72
  162. package/server/routes/map/controllers/mapCatalogAttribute.js +55 -55
  163. package/server/routes/map/controllers/mapFeatures.js +128 -128
  164. package/server/routes/map/controllers/mapFormat.js +234 -234
  165. package/server/routes/map/controllers/mapTiles.js +152 -152
  166. package/server/routes/map/controllers/maps.js +15 -15
  167. package/server/routes/map/controllers/marker_icon.js +43 -43
  168. package/server/routes/map/controllers/vtile.js +172 -172
  169. package/server/routes/map/index.mjs +169 -169
  170. package/server/routes/map/maps/add.map.js +43 -43
  171. package/server/routes/map/maps/del.map.js +18 -18
  172. package/server/routes/map/maps/get.map.js +118 -118
  173. package/server/routes/map/vtile1.js +179 -179
  174. package/server/routes/map/widgets/add.widget.js +38 -38
  175. package/server/routes/map/widgets/del.widget.js +22 -22
  176. package/server/routes/map/widgets/get.widget.js +40 -40
  177. package/server/routes/mapnik/controllers/clearTiles.js +106 -106
  178. package/server/routes/mapnik/controllers/createXml.js +67 -67
  179. package/server/routes/mapnik/controllers/createXmlMulti.js +76 -76
  180. package/server/routes/mapnik/controllers/fileSearch.js +38 -38
  181. package/server/routes/mapnik/controllers/fileStat.js +28 -28
  182. package/server/routes/mapnik/controllers/mapnikLogger.js +29 -29
  183. package/server/routes/mapnik/controllers/mapnikStat.js +19 -19
  184. package/server/routes/mapnik/controllers/pretile.js +144 -144
  185. package/server/routes/mapnik/controllers/rasterInfo.js +57 -57
  186. package/server/routes/mapnik/controllers/readDir.js +22 -22
  187. package/server/routes/mapnik/controllers/rtile.js +150 -150
  188. package/server/routes/mapnik/controllers/uploadRaster.js +157 -157
  189. package/server/routes/mapnik/functions/cartoBounds.js +32 -32
  190. package/server/routes/mapnik/functions/convertBoundToTile.js +27 -27
  191. package/server/routes/mapnik/functions/uploadXML.js +113 -113
  192. package/server/routes/mapnik/index.js +40 -40
  193. package/server/routes/permissions/controllers/catalog.permissions.edit.js +22 -22
  194. package/server/routes/permissions/controllers/catalog.permissions.js +7 -7
  195. package/server/routes/permissions/controllers/gis.catalog.js +80 -80
  196. package/server/routes/permissions/controllers/utils/get.permissions.js +59 -59
  197. package/server/routes/permissions/index.mjs +18 -18
  198. package/server/routes/root.mjs +3 -3
  199. package/utils.js +13 -13
  200. package/dist/cartocss-KfS-aCRn.js +0 -1053
  201. package/dist/raster-CKQiGAgN.js +0 -792
@@ -0,0 +1,1065 @@
1
+ import { openBlock as _, createElementBlock as z, createElementVNode as o, defineComponent as Y, computed as L, createTextVNode as Ee, createVNode as E, defineAsyncComponent as ye, useModel as Xe, ref as x, withCtx as J, toDisplayString as T, unref as ve, mergeModels as Ze, watch as I, onUnmounted as Ke, createCommentVNode as q, onBeforeUnmount as je, onMounted as et, withDirectives as tt, vModelText as at, createBlock as R, normalizeClass as $e, normalizeStyle as ot, Fragment as Le, renderList as nt, resolveDynamicComponent as st } from "vue";
2
+ import { useRouter as lt, useRoute as rt } from "vue-router";
3
+ import { notify as P } from "@opengis/core";
4
+ import { _ as ut, f as Ae, o as it, p as ct, q as dt, M as ft, i as mt, j as Ve, m as pt } from "./index-8aAArh78.js";
5
+ import { S as yt, C as vt } from "./CardIcon-BCll_4SB.js";
6
+ import { _ as ht, a as gt, b as bt, c as xt } from "./HeaderActions.vue_vue_type_script_setup_true_lang-EZGjVDor.js";
7
+ import { _ as Ne } from "./MonacoEditor.vue_vue_type_script_setup_true_lang-D3ZPeXMw.js";
8
+ import { V as wt } from "./vs-datatable-DVC6-2mA.js";
9
+ import { _ as Me } from "./ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-BJ-zsrml.js";
10
+ const _t = {}, kt = {
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ width: "24",
13
+ height: "24",
14
+ viewBox: "0 0 24 24",
15
+ fill: "none",
16
+ stroke: "currentColor",
17
+ "stroke-width": "2",
18
+ "stroke-linecap": "round",
19
+ "stroke-linejoin": "round",
20
+ class: "lucide lucide-table"
21
+ };
22
+ function Ct(N, u) {
23
+ return _(), z("svg", kt, [...u[0] || (u[0] = [
24
+ o("path", { d: "M12 3v18" }, null, -1),
25
+ o("rect", {
26
+ width: "18",
27
+ height: "18",
28
+ x: "3",
29
+ y: "3",
30
+ rx: "2"
31
+ }, null, -1),
32
+ o("path", { d: "M3 9h18" }, null, -1),
33
+ o("path", { d: "M3 15h18" }, null, -1)
34
+ ])]);
35
+ }
36
+ const St = /* @__PURE__ */ ut(_t, [["render", Ct]]), $t = { class: "flex flex-col h-full" }, Lt = { class: "flex justify-end mb-3 gap-2" }, Vt = /* @__PURE__ */ Y({
37
+ __name: "cartocss-css-tab",
38
+ props: {
39
+ modelValue: {}
40
+ },
41
+ emits: ["update:modelValue", "save"],
42
+ setup(N, { emit: u }) {
43
+ const r = N, A = u, V = L({
44
+ get: () => r.modelValue,
45
+ set: (w) => A("update:modelValue", w)
46
+ });
47
+ return (w, k) => (_(), z("div", $t, [
48
+ o("div", Lt, [
49
+ o("button", {
50
+ type: "button",
51
+ class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
52
+ onClick: k[0] || (k[0] = (f) => w.$emit("save"))
53
+ }, [...k[2] || (k[2] = [
54
+ o("svg", {
55
+ xmlns: "http://www.w3.org/2000/svg",
56
+ width: "24",
57
+ height: "24",
58
+ viewBox: "0 0 24 24",
59
+ fill: "none",
60
+ stroke: "currentColor",
61
+ "stroke-width": "2",
62
+ "stroke-linecap": "round",
63
+ "stroke-linejoin": "round",
64
+ class: "h-3.5 w-3.5"
65
+ }, [
66
+ o("path", { d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a 2 2 0 0 1-2-2V5a 2 2 0 0 1 2-2z" }),
67
+ o("path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a 1 1 0 0 0-1 1v7" }),
68
+ o("path", { d: "M7 3v4a1 1 0 0 0 1 1h7" })
69
+ ], -1),
70
+ Ee(" Зберегти ", -1)
71
+ ])])
72
+ ]),
73
+ E(Ne, {
74
+ modelValue: V.value,
75
+ "onUpdate:modelValue": k[1] || (k[1] = (f) => V.value = f),
76
+ language: "cartocss",
77
+ class: "flex-1 rounded-lg overflow-hidden"
78
+ }, null, 8, ["modelValue"])
79
+ ]));
80
+ }
81
+ }), Mt = { class: "flex flex-col flex-1 min-h-0" }, zt = { class: "flex justify-between mb-3 gap-2" }, Et = { class: "text-left" }, jt = { class: "font-medium text-gray-900" }, At = { class: "text-xs text-gray-500" }, Nt = { class: "flex justify-center gap-2" }, Bt = ["checked", "onChange"], qt = { class: "text-sm font-medium text-gray-900" }, Tt = /* @__PURE__ */ Y({
82
+ __name: "cartocss-data-tab",
83
+ props: {
84
+ modelValue: { default: [] },
85
+ modelModifiers: {}
86
+ },
87
+ emits: /* @__PURE__ */ Ze(["save"], ["update:modelValue"]),
88
+ setup(N, { emit: u }) {
89
+ const r = [
90
+ { key: "table", label: "Таблиця", slot: "datasetCell" },
91
+ {
92
+ key: "active",
93
+ label: "Активний",
94
+ slot: "activeCell",
95
+ width: "140px"
96
+ },
97
+ {
98
+ key: "zoom",
99
+ label: "Min Зум",
100
+ slot: "zoomCell",
101
+ width: "140px"
102
+ }
103
+ ], A = ye(
104
+ () => import("@opengis/core").then((y) => y.VsModal)
105
+ ), V = ye(() => import("@opengis/form")), w = Xe(N, "modelValue"), k = u, f = x(!1), v = x({
106
+ table: "",
107
+ query: "",
108
+ srid: "",
109
+ key: "",
110
+ columns: "",
111
+ gcol: "",
112
+ minzoom: "",
113
+ maxzoom: "",
114
+ proj4text: "",
115
+ active: !0
116
+ }), i = {
117
+ table: { type: "text", label: "Таблиця", validators: ["required"] },
118
+ key: { type: "text", label: "Ключ", validators: ["required"] },
119
+ query: { type: "text", label: "Query" },
120
+ columns: { type: "text", label: "Колонки" },
121
+ gcol: { type: "text", label: "Колонка geometry" },
122
+ srid: { type: "number", label: "SRID" },
123
+ proj4text: { type: "text", label: "PROJ4" },
124
+ active: { type: "switcher", label: "Активна" },
125
+ minzoom: { type: "number", label: "Min Зум", col: 6 },
126
+ maxzoom: { type: "number", label: "Max Зум", col: 6 }
127
+ };
128
+ function d() {
129
+ v.value = {
130
+ table: "",
131
+ query: "",
132
+ srid: "",
133
+ key: "",
134
+ columns: "",
135
+ gcol: "",
136
+ minzoom: "",
137
+ maxzoom: "",
138
+ proj4text: "",
139
+ active: !0
140
+ }, f.value = !0;
141
+ }
142
+ function c() {
143
+ f.value = !1;
144
+ }
145
+ function B() {
146
+ var m, C;
147
+ const y = (m = v.value.table) == null ? void 0 : m.trim(), p = (C = v.value.key) == null ? void 0 : C.trim();
148
+ if (!y || !p) {
149
+ P({
150
+ type: "warning",
151
+ title: "Перевірка",
152
+ message: "Вкажіть таблицю та підпис"
153
+ });
154
+ return;
155
+ }
156
+ w.value = [
157
+ ...Array.isArray(w.value) ? w.value : [],
158
+ { ...v.value, table: y, key: p }
159
+ ], f.value = !1;
160
+ }
161
+ function l(y, p) {
162
+ var C;
163
+ const m = ((C = p == null ? void 0 : p.target) == null ? void 0 : C.checked) ?? !1;
164
+ y.active = m, w.value = Array.isArray(w.value) ? [...w.value] : [];
165
+ }
166
+ return (y, p) => (_(), z("div", Mt, [
167
+ o("div", zt, [
168
+ o("button", {
169
+ type: "button",
170
+ class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium bg-gradient-to-r from-gray-500 to-gray-400 text-white h-9 px-4 py-2 hover:from-gray-600 hover:to-gray-500",
171
+ onClick: d
172
+ }, " Додати таблицю "),
173
+ o("button", {
174
+ type: "button",
175
+ class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
176
+ onClick: p[0] || (p[0] = (m) => k("save"))
177
+ }, " Зберегти ")
178
+ ]),
179
+ E(wt, {
180
+ modelValue: w.value,
181
+ "onUpdate:modelValue": p[1] || (p[1] = (m) => w.value = m),
182
+ "columns-scheme": r,
183
+ "form-scheme": i,
184
+ "add-button": !1,
185
+ "main-col-width": "260px"
186
+ }, {
187
+ datasetCell: J(({ row: m }) => [
188
+ o("div", Et, [
189
+ o("div", jt, T(m.table), 1),
190
+ o("div", At, T(m.key), 1)
191
+ ])
192
+ ]),
193
+ activeCell: J(({ row: m }) => [
194
+ o("label", Nt, [
195
+ o("input", {
196
+ type: "checkbox",
197
+ class: "h-4 w-4 text-sky-500 border-gray-300 rounded focus:ring-sky-300",
198
+ checked: m.active,
199
+ onChange: (C) => l(m, C)
200
+ }, null, 40, Bt)
201
+ ])
202
+ ]),
203
+ zoomCell: J(({ row: m }) => [
204
+ o("div", qt, T(m.zoom), 1)
205
+ ]),
206
+ _: 1
207
+ }, 8, ["modelValue"]),
208
+ E(ve(A), {
209
+ teleport: "#modal",
210
+ visible: f.value,
211
+ "onUpdate:visible": p[3] || (p[3] = (m) => f.value = m),
212
+ title: "Нова таблиця CartoCSS"
213
+ }, {
214
+ footer: J(() => [
215
+ o("div", { class: "flex justify-end gap-2 p-4 border-т" }, [
216
+ o("button", {
217
+ type: "button",
218
+ class: "px-4 py-2 rounded bg-gray-100 text-gray-700",
219
+ onClick: c
220
+ }, " Скасувати "),
221
+ o("button", {
222
+ type: "button",
223
+ class: "px-4 py-2 rounded bg-blue-600 text-white",
224
+ onClick: B
225
+ }, " Додати ")
226
+ ])
227
+ ]),
228
+ default: J(() => [
229
+ E(ve(V), {
230
+ values: v.value,
231
+ "onUpdate:values": p[2] || (p[2] = (m) => v.value = m),
232
+ schema: i
233
+ }, null, 8, ["values"])
234
+ ]),
235
+ _: 1
236
+ }, 8, ["visible"])
237
+ ]));
238
+ }
239
+ }), Dt = { class: "flex flex-col flex-1 min-h-0 gap-4" }, Ut = { class: "h-[calc(100vh-230px)] rounded-md border border-gray-200 bg-white" }, It = /* @__PURE__ */ Y({
240
+ __name: "cartocss-card-tab",
241
+ props: {
242
+ card: {},
243
+ table: {}
244
+ },
245
+ emits: ["save"],
246
+ setup(N, { emit: u }) {
247
+ const r = N, A = u, V = x(r.table), w = x(r.card), k = ye(() => import("@opengis/form").then((v) => v.VsInputText));
248
+ function f() {
249
+ A("save", {
250
+ card_html: w.value,
251
+ card_table: V.value
252
+ });
253
+ }
254
+ return (v, i) => (_(), z("div", Dt, [
255
+ o("div", { class: "flex items-center justify-end gap-3" }, [
256
+ o("button", {
257
+ type: "button",
258
+ class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
259
+ onClick: f
260
+ }, [...i[2] || (i[2] = [
261
+ o("svg", {
262
+ xmlns: "http://www.w3.org/2000/svg",
263
+ width: "24",
264
+ height: "24",
265
+ viewBox: "0 0 24 24",
266
+ fill: "none",
267
+ stroke: "currentColor",
268
+ "stroke-width": "2",
269
+ "stroke-linecap": "round",
270
+ "stroke-linejoin": "round",
271
+ class: "h-3.5 w-3.5"
272
+ }, [
273
+ o("path", { d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a 2 2 0 0 1-2-2V5a 2 2 0 0 1 2-2z" }),
274
+ o("path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a 1 1 0 0 0-1 1v7" }),
275
+ o("path", { d: "M7 3v4a1 1 0 0 0 1 1h7" })
276
+ ], -1),
277
+ Ee(" Зберегти картку ", -1)
278
+ ])])
279
+ ]),
280
+ o("div", null, [
281
+ E(ve(k), {
282
+ modelValue: V.value,
283
+ "onUpdate:modelValue": i[0] || (i[0] = (d) => V.value = d)
284
+ }, null, 8, ["modelValue"])
285
+ ]),
286
+ o("div", Ut, [
287
+ E(Ne, {
288
+ modelValue: w.value,
289
+ "onUpdate:modelValue": i[1] || (i[1] = (d) => w.value = d),
290
+ language: "html",
291
+ theme: "vs-light",
292
+ class: "h-full w-full rounded-md"
293
+ }, null, 8, ["modelValue"])
294
+ ])
295
+ ]));
296
+ }
297
+ }), Pt = /* @__PURE__ */ Y({
298
+ __name: "CartocssLayerLoader",
299
+ props: {
300
+ layerId: { type: String, required: !0 },
301
+ tileUrl: { type: String, default: "" },
302
+ title: { type: String, default: "" },
303
+ active: { type: Boolean, default: !1 },
304
+ owner: { type: String, default: "" },
305
+ opacity: { type: Number, default: 1 }
306
+ },
307
+ setup(N) {
308
+ const u = N, r = Ae(), {
309
+ activateTemporaryLayer: A,
310
+ deactivateTemporaryLayer: V,
311
+ setTemporaryLayerOpacity: w
312
+ } = it(r.map), k = L(() => {
313
+ var c;
314
+ const d = `${(c = u == null ? void 0 : u.tileUrl) == null ? void 0 : c.trim()}`;
315
+ return d ? typeof window > "u" || typeof location > "u" || /^https?:\/\//i.test(d) ? d : d.startsWith("//") ? `${window.location.protocol}${d}` : d.startsWith("/") ? `${location.origin}${d}` : `${location.origin}/${d}` : "";
316
+ });
317
+ let f = "", v = "";
318
+ function i() {
319
+ const d = u.active && !!k.value;
320
+ f && (!d || f !== u.layerId) && (V(f, v || void 0), f = "", v = ""), d && (A(
321
+ {
322
+ id: u.layerId,
323
+ title: u.title || u.layerId,
324
+ url: k.value,
325
+ opacity: u.opacity
326
+ },
327
+ {},
328
+ u.owner
329
+ ), f = u.layerId, v = u.owner || "");
330
+ }
331
+ return I(
332
+ () => [u.layerId, k.value, u.active, u.owner],
333
+ i,
334
+ { immediate: !0 }
335
+ ), I(
336
+ () => u.opacity,
337
+ (d) => {
338
+ !f || !u.active || w(f, d, v || void 0);
339
+ },
340
+ { immediate: !0 }
341
+ ), Ke(() => {
342
+ f && (V(f, v || void 0), f = "", v = "");
343
+ }), (d, c) => q("", !0);
344
+ }
345
+ }), Ot = /* @__PURE__ */ Y({
346
+ __name: "CartocssMapClickListener",
347
+ props: {
348
+ cartocssId: {},
349
+ infoEnabled: { type: [Boolean, null] }
350
+ },
351
+ setup(N) {
352
+ const u = N, r = L(() => u.cartocssId ?? null), A = L(() => !!u.infoEnabled), { map: V, ready: w } = Ae(), k = (l) => {
353
+ !l || typeof window > "u" || window.dispatchEvent(
354
+ new CustomEvent(dt, { detail: l })
355
+ );
356
+ }, f = async (l) => {
357
+ const y = await fetch(`/api/map-format?${l.toString()}`);
358
+ if (!y.ok)
359
+ throw new Error(`API returned ${y.status}`);
360
+ return y.json();
361
+ };
362
+ let v = null, i = null;
363
+ const d = (l) => {
364
+ if (!l) return null;
365
+ if (typeof l == "string")
366
+ try {
367
+ return JSON.parse(l);
368
+ } catch {
369
+ return null;
370
+ }
371
+ return l;
372
+ }, c = async (l, y) => {
373
+ var C;
374
+ const p = r.value ? `external:${r.value},${String(l)}` : null, m = new URLSearchParams({
375
+ layer: r.value ?? "",
376
+ id: String(l)
377
+ });
378
+ try {
379
+ const $ = await f(m), D = typeof $.html == "string" ? $.html : null, j = d(
380
+ ((C = $ == null ? void 0 : $.data) == null ? void 0 : C.geom) ?? ($ == null ? void 0 : $.geom) ?? null
381
+ );
382
+ (D || j) && k({
383
+ html: D,
384
+ geometry: j ?? y,
385
+ infoToken: p
386
+ });
387
+ } catch ($) {
388
+ console.warn("CartoCSS map-format (id) error", $);
389
+ }
390
+ }, B = async (l) => {
391
+ var C, $, D, j;
392
+ if (!r.value) return;
393
+ if (!A.value) {
394
+ P({
395
+ type: "error",
396
+ title: "CartoCSS",
397
+ message: "Картка не налаштована"
398
+ });
399
+ return;
400
+ }
401
+ const y = (C = l == null ? void 0 : l.lngLat) == null ? void 0 : C.lng, p = ($ = l == null ? void 0 : l.lngLat) == null ? void 0 : $.lat;
402
+ if (typeof y != "number" || typeof p != "number") return;
403
+ const m = new URLSearchParams({
404
+ layer: r.value,
405
+ lat: p.toFixed(6),
406
+ lng: y.toFixed(6)
407
+ });
408
+ try {
409
+ const g = await f(m), Z = d(
410
+ ((D = g == null ? void 0 : g.data) == null ? void 0 : D.geom) ?? (g == null ? void 0 : g.geom) ?? null
411
+ ), G = ((j = g == null ? void 0 : g.data) == null ? void 0 : j.id) ?? (g == null ? void 0 : g.id);
412
+ if (G != null) {
413
+ await c(G, Z);
414
+ return;
415
+ }
416
+ ct({ html: g == null ? void 0 : g.html }) && k({
417
+ html: g == null ? void 0 : g.html,
418
+ geometry: Z,
419
+ infoToken: null
420
+ });
421
+ } catch (g) {
422
+ console.warn("CartoCSS map-format error", g);
423
+ }
424
+ };
425
+ return w().then(() => {
426
+ i = V.value, i && (i.on("click", B), v = () => i == null ? void 0 : i.off("click", B));
427
+ }), je(() => {
428
+ v == null || v(), v = null, i = null;
429
+ }), () => {
430
+ };
431
+ }
432
+ }), Ft = { class: "flex h-full bg-gradient-to-br from-slate-50 to-white" }, Rt = { class: "flex-1 relative overflow-hidden" }, Qt = { class: "absolute top-0 left-0 w-full z-20" }, Ht = { class: "px-4 sm:px-6 py-4 border-b border-gray-200 bg-white shadow-sm" }, Jt = { class: "flex items-start justify-between gap-4" }, Yt = { class: "flex-1 min-w-0" }, Gt = { class: "flex items-center text-sm text-gray-500 mb-3" }, Wt = { class: "text-gray-900 font-medium truncate max-w-xs" }, Xt = { class: "flex items-center justify-between gap-4" }, Zt = { class: "flex-1 min-w-0" }, Kt = { class: "flex items-center gap-3 mb-1" }, ea = { class: "text-base font-semibold text-gray-900 truncate" }, ta = {
433
+ key: 0,
434
+ class: "px-2 py-0.5 bg-green-50 border border-green-200 rounded flex-shrink-0"
435
+ }, aa = { class: "text-xs font-medium text-green-700" }, oa = ["title"], na = { class: "w-full h-full bg-gradient-to-br from-sky-50 via-white to-blue-50 flex items-center justify-center relative pt-[115px]" }, sa = { class: "relative w-full h-full" }, la = { class: "absolute top-[5.5rem] left-4 z-30 flex flex-col items-start gap-2" }, ra = { class: "rounded-2xl bg-white/90 px-3 py-2 text-xs font-medium text-slate-600 shadow-sm backdrop-blur" }, ua = { class: "flex items-center gap-2" }, ia = { class: "rounded-2xl bg-white/90 px-3 py-2 text-xs font-medium text-slate-600 shadow-sm backdrop-blur" }, ca = { class: "inline-flex items-center gap-2 text-[11px] text-slate-600" }, da = ["checked"], fa = { class: "absolute top-4 left-4 z-20" }, ma = { class: "absolute top-[6.5rem] right-2 space-y-1 z-20" }, pa = {
436
+ key: 0,
437
+ class: "absolute bottom-4 left-1/2 z-30 -translate-x-1/2 rounded-2xl border border-sky-200 bg-white/95 px-4 py-2 text-xs font-medium text-slate-700 shadow-lg backdrop-blur"
438
+ }, ya = { class: "flex-1 flex flex-col h-full" }, va = {
439
+ key: 0,
440
+ class: "px-3 pt-3 pb-2 border-b border-gray-100"
441
+ }, ha = ["aria-selected", "onClick"], ga = { class: "leading-none" }, ba = { class: "flex flex-col flex-1 overflow-y-hidden p-3" }, xa = {
442
+ key: 0,
443
+ class: "flex-1 flex items-center justify-center text-sm text-gray-500"
444
+ }, wa = "cartocss-demo-001", _a = "OpenGIS", ze = 2, re = 5, ka = 5, Na = /* @__PURE__ */ Y({
445
+ __name: "cartocss",
446
+ setup(N) {
447
+ const u = lt(), r = rt(), A = x(null), V = L(() => {
448
+ var t;
449
+ const e = (t = r.matched[r.matched.length - 1]) == null ? void 0 : t.path;
450
+ return (typeof e == "string" && e ? e : r.path).replace(/\/:id\??$/, "") || "/";
451
+ }), w = L(() => {
452
+ var a;
453
+ const e = (a = r.meta) == null ? void 0 : a.title;
454
+ return typeof e == "string" && e.trim() ? e : "CartoCSS";
455
+ });
456
+ function k() {
457
+ u.push(V.value);
458
+ }
459
+ const f = [
460
+ { key: "css", label: "CSS", icon: yt },
461
+ { key: "data", label: "Дані", icon: St },
462
+ { key: "metadata", label: "Метадані", icon: ht },
463
+ { key: "card", label: "Картка", icon: vt }
464
+ ], v = f.map((e) => e.key), i = x(
465
+ v.includes(r.query.tab) ? r.query.tab : "css"
466
+ ), d = x(!0), c = x(null), B = L(
467
+ () => {
468
+ var e;
469
+ return (e = c.value) != null && e.source_path ? f.filter((a) => a.key === "card" || a.key === "metadata") : f;
470
+ }
471
+ ), l = L(
472
+ () => r.params.id || wa
473
+ ), y = x({
474
+ id: l.value,
475
+ name: "",
476
+ description: ""
477
+ });
478
+ let p = null;
479
+ const m = x(!1);
480
+ function C(e) {
481
+ if (Array.isArray(e)) return C(e[0]);
482
+ if (typeof e != "string" && typeof e != "number") return null;
483
+ const a = typeof e == "number" ? e : Number(e.trim());
484
+ return Number.isFinite(a) ? a : null;
485
+ }
486
+ function $(e, a) {
487
+ return e.toFixed(a);
488
+ }
489
+ function D(e, a, t) {
490
+ const n = 0.5 * 10 ** -t;
491
+ return Math.abs(e - a) > n;
492
+ }
493
+ function j() {
494
+ var e;
495
+ return (e = A.value) == null ? void 0 : e.ctx;
496
+ }
497
+ function g() {
498
+ var h, S, F, U;
499
+ const e = (S = (h = j()) == null ? void 0 : h.map) == null ? void 0 : S.value;
500
+ if (!e) return;
501
+ const a = C(r.query.z), t = C(r.query.x), n = C(r.query.y);
502
+ if (a == null || t == null || n == null) return;
503
+ const s = (F = e.getCenter) == null ? void 0 : F.call(e), b = (U = e.getZoom) == null ? void 0 : U.call(e);
504
+ (!s || D(s.lng, t, re) || D(s.lat, n, re) || D(b ?? 0, a, ze)) && (m.value = !0, e.jumpTo({ center: [t, n], zoom: a }), m.value = !1);
505
+ }
506
+ function Z() {
507
+ var s, b, M, h;
508
+ if (m.value) return;
509
+ const e = (b = (s = j()) == null ? void 0 : s.map) == null ? void 0 : b.value;
510
+ if (!e) return;
511
+ const a = (M = e.getCenter) == null ? void 0 : M.call(e), t = (h = e.getZoom) == null ? void 0 : h.call(e);
512
+ if (!a || t == null) return;
513
+ const n = {
514
+ ...r.query,
515
+ z: $(t, ze),
516
+ x: $(a.lng, re),
517
+ y: $(a.lat, re)
518
+ };
519
+ r.query.z === n.z && r.query.x === n.x && r.query.y === n.y || u.replace({ query: n });
520
+ }
521
+ function G(e) {
522
+ typeof document > "u" || (document.title = e ? `${e} — CartoCSS` : _a);
523
+ }
524
+ const K = x(""), ee = x([]), ue = x(!1), te = x(!1), ie = x(""), ce = x(0), ae = x(!1), oe = x(1), de = x(!0), O = x(!1), W = x(null), Be = L(() => `cartocss-layer-${l.value}`), qe = L(
525
+ () => `${Math.round(oe.value * 100)}%`
526
+ ), Te = L(
527
+ () => `cartocss-extent-${l.value}`
528
+ ), De = L(
529
+ () => `cartocss-extent-draft-${l.value}`
530
+ ), he = L(() => {
531
+ var s;
532
+ const e = (s = ie.value) == null ? void 0 : s.trim();
533
+ if (!e) return "";
534
+ const a = e.includes("?") ? "&" : "?", t = `${e}${a}nottl=1`, n = ce.value;
535
+ return n ? `${e}${a}ts=${n}&nocache=1` : t;
536
+ }), ge = x(""), be = x(""), xe = L(() => {
537
+ var b;
538
+ const e = (b = c.value) == null ? void 0 : b.bounds;
539
+ if (!Array.isArray(e) || e.length < 4) return null;
540
+ const [a, t, n, s] = e;
541
+ return [a, t, n, s].some(
542
+ (M) => typeof M != "number" || Number.isNaN(M)
543
+ ) ? null : [(a + n) / 2, (t + s) / 2];
544
+ }), Ue = L(() => {
545
+ var b;
546
+ const e = (b = c.value) == null ? void 0 : b.bounds;
547
+ if (!Array.isArray(e) || e.length < 4) return null;
548
+ const [a, t, n, s] = e;
549
+ return [a, t, n, s].some(
550
+ (M) => typeof M != "number" || Number.isNaN(M)
551
+ ) ? null : [a, t, n, s];
552
+ }), fe = L(() => {
553
+ const e = c.value;
554
+ return e ? [
555
+ e.description,
556
+ e.group_id ? `Група: ${e.group_id}` : null,
557
+ e.source_path ? `Шлях: ${e.source_path}` : null,
558
+ e.is_public === !0 ? "Публічний" : "Не публічний",
559
+ e.enabled === !0 ? "Активний" : "Неактивний"
560
+ ].filter(Boolean).join(", ") : "";
561
+ }), we = L(() => {
562
+ var a;
563
+ const e = (a = c.value) == null ? void 0 : a.group_id;
564
+ return e ? String(e).toUpperCase() : "";
565
+ });
566
+ let Q = null, X = !1, H = null;
567
+ function ne(e) {
568
+ return Number(e.toFixed(ka));
569
+ }
570
+ function _e(e, a) {
571
+ const [t, n] = e, [s, b] = a;
572
+ return [
573
+ ne(Math.min(t, s)),
574
+ ne(Math.min(n, b)),
575
+ ne(Math.max(t, s)),
576
+ ne(Math.max(n, b))
577
+ ];
578
+ }
579
+ function Ie(e) {
580
+ const [a, t, n, s] = e;
581
+ return {
582
+ type: "Polygon",
583
+ coordinates: [
584
+ [
585
+ [a, t],
586
+ [n, t],
587
+ [n, s],
588
+ [a, s],
589
+ [a, t]
590
+ ]
591
+ ]
592
+ };
593
+ }
594
+ function me(e) {
595
+ var n, s, b;
596
+ const a = (s = (n = j()) == null ? void 0 : n.map) == null ? void 0 : s.value, t = (b = a == null ? void 0 : a.getCanvas) == null ? void 0 : b.call(a);
597
+ t != null && t.style && (t.style.cursor = e);
598
+ }
599
+ async function Pe(e, a) {
600
+ if (!(!l.value || !c.value)) {
601
+ te.value = !0;
602
+ try {
603
+ const t = Ie(e), n = await fetch(`/api/gis-css/${l.value}`, {
604
+ method: "POST",
605
+ headers: { "Content-Type": "application/json" },
606
+ body: JSON.stringify({ geom: t })
607
+ });
608
+ if (!n.ok)
609
+ throw new Error(`Failed to save cartocss bounds: ${n.status}`);
610
+ P({
611
+ type: "success",
612
+ title: "Bounds збережено",
613
+ message: "Нові межі успішно збережено."
614
+ }), await se(l.value, { bustCache: !0 });
615
+ } catch (t) {
616
+ console.error("Failed to save CartoCSS bounds", t), c.value && (c.value = {
617
+ ...c.value,
618
+ bounds: a ? [...a] : null
619
+ }), P({
620
+ type: "error",
621
+ title: "Помилка",
622
+ message: "Не вдалося зберегти Bounds"
623
+ });
624
+ } finally {
625
+ te.value = !1;
626
+ }
627
+ }
628
+ }
629
+ function ke(e) {
630
+ var t, n, s;
631
+ const a = (n = (t = j()) == null ? void 0 : t.map) == null ? void 0 : n.value;
632
+ if ((s = a == null ? void 0 : a.dragPan) != null && s.enable && a.dragPan.enable(), (e == null ? void 0 : e.length) === 4 && c.value) {
633
+ const b = Array.isArray(c.value.bounds) ? [...c.value.bounds] : null;
634
+ c.value = {
635
+ ...c.value,
636
+ bounds: [...e]
637
+ }, Pe(e, b);
638
+ }
639
+ Q = null, X = !1, W.value = null, O.value = !1, me("");
640
+ }
641
+ function pe() {
642
+ ke(null);
643
+ }
644
+ function Oe() {
645
+ var b, M;
646
+ const e = (M = (b = j()) == null ? void 0 : b.map) == null ? void 0 : M.value;
647
+ if (!e) return;
648
+ const a = (h) => {
649
+ var F, U, le;
650
+ if (!O.value || ((F = h == null ? void 0 : h.originalEvent) == null ? void 0 : F.button) != null && h.originalEvent.button !== 0)
651
+ return;
652
+ const S = h == null ? void 0 : h.lngLat;
653
+ S && (Q = [S.lng, S.lat], X = !0, W.value = [S.lng, S.lat, S.lng, S.lat], (le = (U = e.dragPan) == null ? void 0 : U.disable) == null || le.call(U));
654
+ }, t = (h) => {
655
+ if (!O.value || !X || !Q)
656
+ return;
657
+ const S = h == null ? void 0 : h.lngLat;
658
+ S && (W.value = _e(Q, [
659
+ S.lng,
660
+ S.lat
661
+ ]));
662
+ }, n = (h) => {
663
+ if (!O.value || !X || !Q)
664
+ return;
665
+ const S = h == null ? void 0 : h.lngLat;
666
+ if (!S) {
667
+ pe();
668
+ return;
669
+ }
670
+ const F = _e(Q, [
671
+ S.lng,
672
+ S.lat
673
+ ]), [U, le, Ge, We] = F;
674
+ if (!(Math.abs(Ge - U) > 0 && Math.abs(We - le) > 0)) {
675
+ P({
676
+ type: "warning",
677
+ title: "Bounds не змінено",
678
+ message: "Потрібно протягнути прямокутник з ненульовою площею."
679
+ }), pe();
680
+ return;
681
+ }
682
+ ke(F);
683
+ }, s = (h) => {
684
+ O.value && h.key === "Escape" && (h.preventDefault(), pe());
685
+ };
686
+ e.on("mousedown", a), e.on("mousemove", t), e.on("mouseup", n), window.addEventListener("keydown", s), H = () => {
687
+ e.off("mousedown", a), e.off("mousemove", t), e.off("mouseup", n), window.removeEventListener("keydown", s);
688
+ };
689
+ }
690
+ async function Fe() {
691
+ var t;
692
+ const e = j();
693
+ !(e != null && e.ready) || (await e.ready(), !((t = e.map) == null ? void 0 : t.value)) || (H || Oe(), O.value = !0, X = !1, Q = null, W.value = null, me("crosshair"), P({
694
+ type: "info",
695
+ title: "Редагування Bounds",
696
+ message: "Протягніть прямокутник на карті, щоб задати нові межі."
697
+ }));
698
+ }
699
+ I(
700
+ l,
701
+ (e) => {
702
+ e && se(e);
703
+ },
704
+ { immediate: !0 }
705
+ ), I(
706
+ () => {
707
+ var e;
708
+ return (e = y.value) == null ? void 0 : e.name;
709
+ },
710
+ (e) => G(e),
711
+ { immediate: !0 }
712
+ );
713
+ async function Re() {
714
+ var n;
715
+ const e = j();
716
+ if (!(e != null && e.ready)) return;
717
+ await e.ready(), g();
718
+ const a = (n = e.map) == null ? void 0 : n.value;
719
+ if (!a) return;
720
+ const t = () => Z();
721
+ a.on("moveend", t), a.on("zoomend", t), p = () => {
722
+ a.off("moveend", t), a.off("zoomend", t);
723
+ };
724
+ }
725
+ I(
726
+ () => [r.query.z, r.query.x, r.query.y],
727
+ () => {
728
+ g();
729
+ }
730
+ ), et(() => {
731
+ Re();
732
+ }), je(() => {
733
+ p == null || p(), p = null, H == null || H(), H = null, me("");
734
+ }), I(
735
+ () => r.query.tab,
736
+ (e) => {
737
+ e && B.value.some((a) => a.key === e) && i.value !== e && (i.value = e);
738
+ }
739
+ ), I(
740
+ B,
741
+ (e) => {
742
+ e.length && !e.some((a) => a.key === i.value) && (i.value = e[0].key);
743
+ },
744
+ { immediate: !0 }
745
+ ), I(i, (e) => {
746
+ r.query.tab !== e && B.value.some((a) => a.key === e) && u.replace({ query: { ...r.query, tab: e } });
747
+ }), I(
748
+ () => c.value,
749
+ (e) => {
750
+ const a = e == null ? void 0 : e.card_html;
751
+ ge.value = a, be.value = e == null ? void 0 : e.card_table;
752
+ },
753
+ { immediate: !0 }
754
+ );
755
+ function Ce() {
756
+ l.value && se(l.value, { bustCache: !0 });
757
+ }
758
+ async function Qe(e, a) {
759
+ if (l.value) {
760
+ te.value = !0;
761
+ try {
762
+ const t = await fetch(`/api/gis-css/${l.value}`, {
763
+ method: "POST",
764
+ headers: { "Content-Type": "application/json" },
765
+ body: JSON.stringify(e)
766
+ });
767
+ if (!t.ok) throw new Error(`Failed to save cartocss: ${t.status}`);
768
+ P({ type: "success", title: "Збережено", message: a }), await se(l.value, { bustCache: !0 });
769
+ } catch (t) {
770
+ console.error("Failed to save CartoCSS", t), P({
771
+ type: "error",
772
+ title: "Помилка",
773
+ message: "Не вдалося зберегти CartoCSS"
774
+ });
775
+ } finally {
776
+ te.value = !1;
777
+ }
778
+ }
779
+ }
780
+ function He(e) {
781
+ if (!e) return null;
782
+ if (typeof e == "string")
783
+ try {
784
+ return JSON.parse(e);
785
+ } catch (a) {
786
+ return console.warn("Failed to parse CartoCSS config", a), null;
787
+ }
788
+ return typeof e == "object" ? e : null;
789
+ }
790
+ function Je(e) {
791
+ const a = Array.isArray(e) ? e : e == null ? void 0 : e.datasets;
792
+ return Array.isArray(a) ? a.map((t, n) => ({
793
+ table: (t == null ? void 0 : t.table) || (t == null ? void 0 : t.id) || `dataset_${n + 1}`,
794
+ query: (t == null ? void 0 : t.query) || "",
795
+ srid: (t == null ? void 0 : t.srid) || "",
796
+ gcol: (t == null ? void 0 : t.gcol) || "",
797
+ key: (t == null ? void 0 : t.key) || (t == null ? void 0 : t.label) || "Без підпису",
798
+ active: typeof (t == null ? void 0 : t.active) == "boolean" ? t.active : !0,
799
+ minzoom: typeof (t == null ? void 0 : t.zoom) > "u" ? "" : String(t.zoom),
800
+ maxzoom: typeof (t == null ? void 0 : t.maxzoom) > "u" ? "" : String(t.maxzoom),
801
+ columns: (t == null ? void 0 : t.columns) || "",
802
+ proj4text: (t == null ? void 0 : t.proj4text) || ""
803
+ })) : [];
804
+ }
805
+ async function se(e, a) {
806
+ ue.value = !0;
807
+ try {
808
+ const t = await fetch(`/api/gis-css/${e}`);
809
+ if (!t.ok) throw new Error(`Failed to load cartocss: ${t.status}`);
810
+ const n = await t.json(), s = (n == null ? void 0 : n.message) || n || {};
811
+ c.value = s, y.value = {
812
+ id: s.cartocss_key || e,
813
+ name: s.name || y.value.name,
814
+ description: s.description || y.value.description
815
+ }, K.value = typeof s.style == "string" ? s.style : "";
816
+ const b = He(s.config ?? []);
817
+ ee.value = Je(b);
818
+ const M = typeof s.url == "string" ? s.url : "";
819
+ ie.value = M, ae.value = !!(M && s.enabled !== !1), ce.value = a != null && a.bustCache ? Date.now() : 0;
820
+ } catch (t) {
821
+ console.error("Failed to fetch CartoCSS", t), ae.value = !1, ie.value = "", ce.value = 0, c.value = null;
822
+ } finally {
823
+ ue.value = !1;
824
+ }
825
+ }
826
+ async function Se() {
827
+ await Qe(
828
+ {
829
+ style: K.value || "",
830
+ config: ee.value
831
+ },
832
+ "CartoCSS оновлено"
833
+ );
834
+ }
835
+ async function Ye(e) {
836
+ const a = await fetch(`/api/gis-css/${l.value}`, {
837
+ method: "POST",
838
+ headers: { "Content-Type": "application/json" },
839
+ body: JSON.stringify(e)
840
+ });
841
+ if (!a.ok) throw new Error(`Failed to save cartocss: ${a.status}`);
842
+ P({
843
+ type: "success",
844
+ title: "Збережено",
845
+ message: "Картка CartoCSS оновлена"
846
+ });
847
+ }
848
+ return (e, a) => (_(), z("div", Ft, [
849
+ o("div", Rt, [
850
+ o("div", Qt, [
851
+ o("div", Ht, [
852
+ o("div", Jt, [
853
+ o("div", Yt, [
854
+ o("div", Gt, [
855
+ o("button", {
856
+ type: "button",
857
+ class: "hover:text-gray-700 cursor-pointer transition-colors",
858
+ onClick: k
859
+ }, T(w.value), 1),
860
+ a[5] || (a[5] = o("svg", {
861
+ xmlns: "http://www.w3.org/2000/svg",
862
+ width: "24",
863
+ height: "24",
864
+ viewBox: "0 0 24 24",
865
+ fill: "none",
866
+ stroke: "currentColor",
867
+ "stroke-width": "2",
868
+ "stroke-linecap": "round",
869
+ "stroke-linejoin": "round",
870
+ class: "lucide lucide-chevron-right w-4 h-4 mx-1"
871
+ }, [
872
+ o("path", { d: "m9 18 6-6-6-6" })
873
+ ], -1)),
874
+ o("span", Wt, T(y.value.name || "CartoCSS"), 1)
875
+ ]),
876
+ o("div", Xt, [
877
+ o("div", Zt, [
878
+ o("div", Kt, [
879
+ o("h1", ea, T(y.value.name || "CartoCSS"), 1),
880
+ we.value ? (_(), z("div", ta, [
881
+ o("span", aa, T(we.value), 1)
882
+ ])) : q("", !0)
883
+ ]),
884
+ fe.value ? (_(), z("p", {
885
+ key: 0,
886
+ class: "text-xs text-gray-500 truncate",
887
+ title: fe.value
888
+ }, T(fe.value), 9, oa)) : q("", !0)
889
+ ])
890
+ ])
891
+ ]),
892
+ E(gt, {
893
+ class: "flex-shrink-0",
894
+ "entity-id": l.value,
895
+ "entity-info": y.value,
896
+ "form-endpoint": (t) => `/api/form/gis.cartocss.table/${t}`,
897
+ "save-endpoint": (t) => `/api/gis-css/${t}`,
898
+ "entity-label": "CartoCSS",
899
+ "save-method": "post",
900
+ onSaved: Ce
901
+ }, null, 8, ["entity-id", "entity-info", "form-endpoint", "save-endpoint"])
902
+ ])
903
+ ])
904
+ ]),
905
+ o("div", na, [
906
+ o("div", sa, [
907
+ E(ft, {
908
+ ref_key: "mapViewRef",
909
+ ref: A
910
+ }, {
911
+ default: J(() => {
912
+ var t, n;
913
+ return [
914
+ o("div", la, [
915
+ o("div", ra, [
916
+ o("div", ua, [
917
+ a[6] || (a[6] = o("span", null, "Прозорість:", -1)),
918
+ tt(o("input", {
919
+ "onUpdate:modelValue": a[0] || (a[0] = (s) => oe.value = s),
920
+ type: "range",
921
+ min: "0",
922
+ max: "1",
923
+ step: "0.01",
924
+ class: "h-1 w-28 cursor-pointer appearance-none rounded-full bg-slate-300 focus:outline-none",
925
+ style: { "accent-color": "#3b82f6" }
926
+ }, null, 512), [
927
+ [
928
+ at,
929
+ oe.value,
930
+ void 0,
931
+ { number: !0 }
932
+ ]
933
+ ]),
934
+ o("span", null, T(qe.value), 1)
935
+ ])
936
+ ]),
937
+ o("div", ia, [
938
+ o("label", ca, [
939
+ o("input", {
940
+ type: "checkbox",
941
+ class: "h-3.5 w-3.5 rounded border-slate-300 text-blue-600 focus:ring-blue-200",
942
+ checked: de.value,
943
+ onChange: a[1] || (a[1] = (s) => de.value = s.target.checked)
944
+ }, null, 40, da),
945
+ a[7] || (a[7] = o("span", null, "Межі css", -1))
946
+ ])
947
+ ])
948
+ ]),
949
+ o("div", fa, [
950
+ E(mt)
951
+ ]),
952
+ o("div", ma, [
953
+ E(Ve),
954
+ xe.value ? (_(), R(Ve, {
955
+ key: 0,
956
+ targetCenter: xe.value,
957
+ targetLabel: "Центр даних",
958
+ targetAriaLabel: "Перейти до центру даних"
959
+ }, null, 8, ["targetCenter"])) : q("", !0)
960
+ ]),
961
+ O.value ? (_(), z("div", pa, " Потягніть на карті, щоб намалювати нові Bounds. Esc скасовує редагування. ")) : q("", !0),
962
+ he.value ? (_(), R(Pt, {
963
+ key: 1,
964
+ "layer-id": Be.value,
965
+ "tile-url": he.value,
966
+ active: ae.value,
967
+ opacity: oe.value,
968
+ title: y.value.name,
969
+ owner: l.value
970
+ }, null, 8, ["layer-id", "tile-url", "active", "opacity", "title", "owner"])) : q("", !0),
971
+ E(Me, {
972
+ extent: de.value ? Ue.value : null,
973
+ "layer-id": Te.value
974
+ }, null, 8, ["extent", "layer-id"]),
975
+ E(Me, {
976
+ extent: W.value,
977
+ "layer-id": De.value,
978
+ "line-color": "#0ea5e9",
979
+ "line-width": 3
980
+ }, null, 8, ["extent", "layer-id"]),
981
+ E(Ot, {
982
+ "cartocss-id": l.value,
983
+ bounds: ((t = c.value) == null ? void 0 : t.bounds) ?? null,
984
+ active: ae.value && !O.value,
985
+ "info-enabled": (n = c.value) == null ? void 0 : n.info
986
+ }, null, 8, ["cartocss-id", "bounds", "active", "info-enabled"]),
987
+ E(pt, { "map-id": l.value }, null, 8, ["map-id"])
988
+ ];
989
+ }),
990
+ _: 1
991
+ }, 512)
992
+ ])
993
+ ]),
994
+ c.value ? (_(), R(bt, {
995
+ key: 0,
996
+ open: d.value,
997
+ onToggle: a[2] || (a[2] = (t) => d.value = !d.value)
998
+ }, null, 8, ["open"])) : q("", !0)
999
+ ]),
1000
+ c.value ? (_(), z("div", {
1001
+ key: 0,
1002
+ class: $e(["bg-white border-l border-gray-100 flex flex-col overflow-hidden shadow-lg flex-shrink-0 transition-[width] duration-100 ease-in-out", d.value ? "w-[650px]" : "w-0"])
1003
+ }, [
1004
+ o("div", ya, [
1005
+ B.value.length > 1 ? (_(), z("div", va, [
1006
+ o("div", {
1007
+ class: "items-center justify-center text-muted-foreground grid w-full h-12 p-1 bg-gray-50 rounded-xl shadow-sm",
1008
+ style: ot({
1009
+ gridTemplateColumns: `repeat(${B.value.length}, minmax(0, 1fr))`
1010
+ })
1011
+ }, [
1012
+ (_(!0), z(Le, null, nt(B.value, (t) => (_(), z("button", {
1013
+ key: t.key,
1014
+ type: "button",
1015
+ role: "tab",
1016
+ "aria-selected": i.value === t.key,
1017
+ class: $e([
1018
+ "whitespace-nowrap flex flex-col items-center justify-center gap-0.5 py-1 px-1 text-[9px] font-medium transition-all duration-300 hover:bg-white/70 rounded-lg group",
1019
+ i.value === t.key ? "bg-white shadow-sm text-gray-700" : ""
1020
+ ]),
1021
+ onClick: (n) => i.value = t.key
1022
+ }, [
1023
+ (_(), R(st(t.icon), { class: "h-3.5 w-3.5 mb-0.5" })),
1024
+ o("span", ga, T(t.label), 1)
1025
+ ], 10, ha))), 128))
1026
+ ], 4)
1027
+ ])) : q("", !0),
1028
+ o("div", ba, [
1029
+ ue.value ? (_(), z("div", xa, " Завантаження стилю… ")) : (_(), z(Le, { key: 1 }, [
1030
+ i.value === "css" ? (_(), R(Vt, {
1031
+ key: 0,
1032
+ modelValue: K.value,
1033
+ "onUpdate:modelValue": a[3] || (a[3] = (t) => K.value = t),
1034
+ class: "flex-1 min-h-0",
1035
+ onSave: Se
1036
+ }, null, 8, ["modelValue"])) : i.value === "data" ? (_(), R(Tt, {
1037
+ key: 1,
1038
+ modelValue: ee.value,
1039
+ "onUpdate:modelValue": a[4] || (a[4] = (t) => ee.value = t),
1040
+ class: "flex-1 min-h-0 flex flex-col",
1041
+ onSave: Se
1042
+ }, null, 8, ["modelValue"])) : i.value === "card" ? (_(), R(It, {
1043
+ key: 2,
1044
+ card: ge.value,
1045
+ table: be.value,
1046
+ class: "flex-1 min-h-0",
1047
+ onSave: Ye
1048
+ }, null, 8, ["card", "table"])) : i.value === "metadata" ? (_(), R(xt, {
1049
+ key: 3,
1050
+ data: c.value,
1051
+ "entity-id": l.value,
1052
+ "entity-type": "css",
1053
+ onSaved: Ce,
1054
+ onEditCssBounds: Fe
1055
+ }, null, 8, ["data", "entity-id"])) : q("", !0)
1056
+ ], 64))
1057
+ ])
1058
+ ])
1059
+ ], 2)) : q("", !0)
1060
+ ]));
1061
+ }
1062
+ });
1063
+ export {
1064
+ Na as default
1065
+ };