@opengis/surveyor 0.0.0-stage → 0.0.1

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 (138) hide show
  1. package/README.md +46 -3
  2. package/README.npm.md +51 -0
  3. package/dist/chunks/AppIcon-C-4QykTP.js +85 -0
  4. package/dist/chunks/AppealDetailField-DNRGpnyD.js +58 -0
  5. package/dist/chunks/AppealStatusBadge-CefimzY3.js +132 -0
  6. package/dist/chunks/AppealStatusBadge-Cu-UzdzA.js +171 -0
  7. package/dist/chunks/ApplicationHistorySection-PwToBfej.js +769 -0
  8. package/dist/chunks/BaseModal-DrTTkLmR.js +85 -0
  9. package/dist/chunks/FormFilePicker-CKVdZJU9.js +76 -0
  10. package/dist/chunks/MapLayerMenu-AUeTqgEp.js +145 -0
  11. package/dist/chunks/RegistryForm-pvIcFR-V.js +99 -0
  12. package/dist/chunks/RegistryFormModal-BjGu7Upv.js +85 -0
  13. package/dist/chunks/RegistryToolbar-CiUgsjpU.js +452 -0
  14. package/dist/chunks/UserAccessBadge-DyZDv7Oo.js +44 -0
  15. package/dist/chunks/UserTypeBadge-LvnMuKGo.js +188 -0
  16. package/dist/chunks/VerifiedBadge-B6droMOf.js +34 -0
  17. package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
  18. package/dist/chunks/account-types-Br7gx_D_.js +35 -0
  19. package/dist/chunks/account_types-DLL1w122.js +25 -0
  20. package/dist/chunks/appealMapLayers-CQMK3rrz.js +115 -0
  21. package/dist/chunks/application_status-BhNGiY2I.js +45 -0
  22. package/dist/chunks/applications-CsCsndMV.js +132 -0
  23. package/dist/chunks/buildSchema-nkA4Y0YG.js +37 -0
  24. package/dist/chunks/card--DHsMNBd.js +330 -0
  25. package/dist/chunks/card-9LaB42Ol.js +538 -0
  26. package/dist/chunks/card-BZn5CDw9.js +739 -0
  27. package/dist/chunks/card-CNqXSyqX.js +297 -0
  28. package/dist/chunks/card-CgGOgGyd.js +973 -0
  29. package/dist/chunks/card-DCyBFoDZ.js +607 -0
  30. package/dist/chunks/certificates-DueBDDvc.js +424 -0
  31. package/dist/chunks/create-l28e-bWl.js +1033 -0
  32. package/dist/chunks/filterQuery-B9XNx1f1.js +99 -0
  33. package/dist/chunks/form-CdGS1nVO.js +315 -0
  34. package/dist/chunks/form-QTkkzwbC.js +89 -0
  35. package/dist/chunks/geometry-DyhIVRcw.js +67 -0
  36. package/dist/chunks/map-BW3iOhQg.js +2763 -0
  37. package/dist/chunks/map-layers-qxWjos2V.js +400 -0
  38. package/dist/chunks/mapLayersApi-CWoQ2be-.js +251 -0
  39. package/dist/chunks/organizations-BtuMZ5s_.js +14 -0
  40. package/dist/chunks/organizations-CZOINYMq.js +476 -0
  41. package/dist/chunks/profile-CuxlkEev.js +243 -0
  42. package/dist/chunks/profile-DxZHxGum.js +164 -0
  43. package/dist/chunks/requests-Bt8fEdRc.js +530 -0
  44. package/dist/chunks/requests-DQJIhz00.js +232 -0
  45. package/dist/chunks/resendSurveyorRegistration-DopjOHaM.js +27 -0
  46. package/dist/chunks/resources-Cl_EvaIy.js +129 -0
  47. package/dist/chunks/rolldown-runtime-Dy4uBu1J.js +11 -0
  48. package/dist/chunks/surveyorAccount-BceNQypZ.js +78 -0
  49. package/dist/chunks/users-DlaogjC_.js +291 -0
  50. package/dist/chunks/work_types-Hwme-FEX.js +34 -0
  51. package/dist/index.css +3 -0
  52. package/dist/index.js +259 -0
  53. package/migrations/20260924120000_surveyor_schema.sql +450 -0
  54. package/migrations/20261008170000_address_lookup.sql +20 -0
  55. package/migrations/20261016120000_map_layers.sql +156 -0
  56. package/migrations/20261016150000_password_reset.sql +15 -0
  57. package/migrations/20261016170000_address_lookup_format.sql +37 -0
  58. package/migrations/20261016180000_settlement_lookup.sql +16 -0
  59. package/migrations/20261019170000_actor_lookup.sql +15 -0
  60. package/package.json +75 -4
  61. package/plugin.js +10 -0
  62. package/server/app.ts +50 -0
  63. package/server/dictionaries/index.ts +17 -0
  64. package/server/dictionaries/surveyor/account_types.ts +12 -0
  65. package/server/dictionaries/surveyor/application_status.ts +16 -0
  66. package/server/dictionaries/surveyor/map_layer_components.ts +11 -0
  67. package/server/dictionaries/surveyor/map_layer_groups.ts +10 -0
  68. package/server/dictionaries/surveyor/map_layer_types.ts +11 -0
  69. package/server/dictionaries/surveyor/work_types.ts +15 -0
  70. package/server/dictionaries/surveyor/yes_no.ts +11 -0
  71. package/server/embed.ts +49 -0
  72. package/server/fastify.d.ts +12 -0
  73. package/server/index.ts +23 -0
  74. package/server/modules/surveyor/route.ts +410 -0
  75. package/server/modules/surveyor/schema.ts +439 -0
  76. package/server/modules/surveyor/services/applicationTile.ts +53 -0
  77. package/server/modules/surveyor/services/cancelApplication.ts +74 -0
  78. package/server/modules/surveyor/services/changeSurveyorPassword.ts +52 -0
  79. package/server/modules/surveyor/services/changeSurveyorPasswordByAdmin.ts +41 -0
  80. package/server/modules/surveyor/services/completeApplication.ts +46 -0
  81. package/server/modules/surveyor/services/completeSurveyorRegistration.ts +48 -0
  82. package/server/modules/surveyor/services/createApplication.ts +169 -0
  83. package/server/modules/surveyor/services/geometryExport.ts +34 -0
  84. package/server/modules/surveyor/services/geometryImport.ts +66 -0
  85. package/server/modules/surveyor/services/getSurveyorUser.ts +56 -0
  86. package/server/modules/surveyor/services/identifyApplications.ts +82 -0
  87. package/server/modules/surveyor/services/issueSourceData.ts +55 -0
  88. package/server/modules/surveyor/services/loginSurveyor.ts +67 -0
  89. package/server/modules/surveyor/services/mapLayers.ts +61 -0
  90. package/server/modules/surveyor/services/rasterExport.ts +15 -0
  91. package/server/modules/surveyor/services/registerSurveyor.ts +161 -0
  92. package/server/modules/surveyor/services/requestPasswordReset.ts +49 -0
  93. package/server/modules/surveyor/services/resendRegistration.ts +42 -0
  94. package/server/modules/surveyor/services/resetSurveyorPassword.ts +53 -0
  95. package/server/modules/surveyor/services/searchApplications.ts +63 -0
  96. package/server/modules/surveyor/services/submitSurvey.ts +70 -0
  97. package/server/modules/surveyor/services/updateSurveyorAccountStatus.ts +52 -0
  98. package/server/modules/surveyor/services/updateSurveyorStatus.ts +53 -0
  99. package/server/modules/surveyor/services/vectorExport.ts +86 -0
  100. package/server/modules/surveyor/services/verifyApplication.ts +59 -0
  101. package/server/modules/surveyor/utils/accessibleApplication.ts +37 -0
  102. package/server/modules/surveyor/utils/application.ts +68 -0
  103. package/server/modules/surveyor/utils/export.ts +39 -0
  104. package/server/modules/surveyor/utils/firstBoundary.ts +48 -0
  105. package/server/modules/surveyor/utils/mail.ts +161 -0
  106. package/server/modules/surveyor/utils/permissions.ts +29 -0
  107. package/server/modules/surveyor/utils/registration.ts +33 -0
  108. package/server/modules/surveyor/utils/shared.ts +305 -0
  109. package/server/modules/surveyor/utils/templates/ds.surveyor_admin_password.pt.hbs +79 -0
  110. package/server/modules/surveyor/utils/templates/ds.surveyor_password_reset.pt.hbs +79 -0
  111. package/server/modules/surveyor/utils/templates/ds.surveyor_registration.pt.hbs +80 -0
  112. package/server/modules/surveyor/utils/templates/ds.surveyor_send_mail.pt.hbs +79 -0
  113. package/server/modules/surveyor/utils/vectorLayer.ts +41 -0
  114. package/server/plugins/convertVector.ts +74 -0
  115. package/server/plugins/proto/convertVector.proto +21 -0
  116. package/server/plugins/swagger.ts +54 -0
  117. package/server/plugins/vite.dev.ts +52 -0
  118. package/server/plugins/vite.prod.ts +55 -0
  119. package/server/resources/helpers/actor_lookup.ts +5 -0
  120. package/server/resources/helpers/address_lookup.ts +8 -0
  121. package/server/resources/helpers/settlement_lookup.ts +7 -0
  122. package/server/resources/helpers/user_lookup.ts +5 -0
  123. package/server/resources/index.ts +30 -0
  124. package/server/resources/surveyor-admin/application_comments.ts +24 -0
  125. package/server/resources/surveyor-admin/application_status_history.ts +46 -0
  126. package/server/resources/surveyor-admin/applications.ts +125 -0
  127. package/server/resources/surveyor-admin/certificates.ts +87 -0
  128. package/server/resources/surveyor-admin/map_layers.ts +69 -0
  129. package/server/resources/surveyor-admin/organization_surveyors.ts +32 -0
  130. package/server/resources/surveyor-admin/organizations.ts +61 -0
  131. package/server/resources/surveyor-admin/surveyors.ts +71 -0
  132. package/server/resources/surveyor-user/application_status_history.ts +52 -0
  133. package/server/resources/surveyor-user/applications.ts +131 -0
  134. package/server/resources/surveyor-user/certificates.ts +67 -0
  135. package/server/resources/surveyor-user/organizations.ts +40 -0
  136. package/server/resources/surveyor-user/surveyors.ts +69 -0
  137. package/server/tsconfig.json +3 -0
  138. package/surveyor-types.d.ts +30 -0
@@ -0,0 +1,769 @@
1
+ import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
+ import { a as t, c as n, i as r, n as i, r as a, t as o, u as s } from "./appealMapLayers-CQMK3rrz.js";
3
+ import { t as c } from "./application_status-BhNGiY2I.js";
4
+ import { a as l, d as u, i as d, l as f, r as p, s as m, t as ee, u as h } from "./mapLayersApi-CWoQ2be-.js";
5
+ import { i as te, n as ne, t as g } from "./geometry-DyhIVRcw.js";
6
+ import { t as re } from "./MapLayerMenu-AUeTqgEp.js";
7
+ import { Fragment as _, computed as v, createCommentVNode as y, createElementBlock as b, createElementVNode as x, createTextVNode as S, createVNode as C, defineComponent as w, normalizeClass as T, onMounted as ie, onUnmounted as ae, openBlock as E, ref as D, renderList as O, shallowRef as oe, toDisplayString as k, vModelText as A, watch as j, withDirectives as M, withKeys as N, withModifiers as P } from "vue";
8
+ import { ChevronDown as F, Crosshair as se, History as I, MapPin as ce, MapPinned as le, MessageSquare as L, Send as R, ZoomIn as ue, ZoomOut as de } from "lucide-vue-next";
9
+ //#region shared/map/components/AppealDetailMap.vue?vue&type=script&setup=true&lang.ts
10
+ var z = /*@__PURE__*/ w({
11
+ __name: "AppealDetailMap",
12
+ props: {
13
+ geom: {
14
+ type: null,
15
+ required: !0
16
+ },
17
+ address: {
18
+ type: [String, null],
19
+ required: !1
20
+ },
21
+ area: {
22
+ type: [
23
+ String,
24
+ Number,
25
+ null
26
+ ],
27
+ required: !1
28
+ },
29
+ location: {
30
+ type: [String, null],
31
+ required: !1
32
+ },
33
+ expanded: {
34
+ type: Boolean,
35
+ required: !1,
36
+ default: !1
37
+ },
38
+ variant: {
39
+ type: String,
40
+ required: !1,
41
+ default: "embedded"
42
+ }
43
+ },
44
+ setup(e, { expose: c }) {
45
+ c();
46
+ let _ = e, y = r, b = i, x = a, S = [30.5234, 50.4501], C = {
47
+ padding: 30,
48
+ maxZoom: 17
49
+ }, w = D(null), T = D(null), E = oe(null), O = D(""), k = D(!0), A = D(o), M = D([]), N = D(n), P = D([]);
50
+ function F(e) {
51
+ return A.value.find((t) => t.id === e) ?? A.value[0] ?? o[0];
52
+ }
53
+ function I(e) {
54
+ return e.kind === "applications";
55
+ }
56
+ function L() {
57
+ let e = t.find(I);
58
+ if (!e) throw Error("Static applications overlay is missing");
59
+ let n = typeof window < "u" ? window.location.origin : "";
60
+ return {
61
+ ...e,
62
+ tiles: e.tiles.map((e) => e.startsWith("/") ? `${n}${e}` : e)
63
+ };
64
+ }
65
+ async function R() {
66
+ let e = await ee("application-card");
67
+ A.value = e.baseLayers, N.value = e.defaultBaseId;
68
+ let t = e.overlays.filter((e) => e.kind !== "geometry" && e.kind !== "applications"), n = e.overlays.find(I) ?? L(), r = {
69
+ id: n.id,
70
+ label: n.label,
71
+ kind: "applications",
72
+ tiles: n.tiles,
73
+ sourceLayer: n.sourceLayer,
74
+ opacity: n.opacity,
75
+ hasFilters: n.hasFilters,
76
+ defaultVisible: !1
77
+ };
78
+ M.value = [r, ...t], P.value = M.value.filter((e) => e.defaultVisible).map((e) => e.id);
79
+ }
80
+ let z = null, B, V = null, H = null, U = !1, W = v(() => te(_.geom)), G = v(() => W.value ? ne(W.value) : null), K = v(() => G.value ? g(G.value) : null), fe = v(() => _.variant === "panel" ? "relative min-h-[320px] w-full flex-1" : ["relative w-full transition-all duration-300", _.expanded ? "h-[520px]" : "h-[340px]"]);
81
+ function q() {
82
+ return {
83
+ type: "FeatureCollection",
84
+ features: W.value ? [{
85
+ type: "Feature",
86
+ geometry: W.value,
87
+ properties: {}
88
+ }] : []
89
+ };
90
+ }
91
+ function J(e) {
92
+ G.value && e.fitBounds(G.value, {
93
+ ...C,
94
+ duration: 500
95
+ });
96
+ }
97
+ function Y(e, t) {
98
+ let n = q(), r = e.getSource(y);
99
+ r?.setData ? r.setData(n) : (e.addSource(y, {
100
+ type: "geojson",
101
+ data: n
102
+ }), e.addLayer({
103
+ id: b,
104
+ type: "fill",
105
+ source: y,
106
+ paint: {
107
+ "fill-color": "#3b82f6",
108
+ "fill-opacity": .35
109
+ }
110
+ }), e.addLayer({
111
+ id: x,
112
+ type: "line",
113
+ source: y,
114
+ paint: {
115
+ "line-color": "#2563eb",
116
+ "line-width": 3
117
+ }
118
+ })), pe(e, t), me(e, t);
119
+ }
120
+ function X(e, t) {
121
+ let n = e.trim(), r = n.match(/^(.+?)\s*\(([^)]+)\)\s*,?\s*(.*)$/);
122
+ if (r) {
123
+ let e = r[1].trim(), t = r[2].trim();
124
+ return {
125
+ title: [e, r[3].trim()].filter(Boolean).join(" "),
126
+ subtitle: t
127
+ };
128
+ }
129
+ let i = n.split(",").map((e) => e.trim()).filter(Boolean);
130
+ if (i.length >= 2) {
131
+ let e = i[i.length - 1], n = i.slice(0, -1).join(", "), r = t?.trim();
132
+ return r && !n.includes(r) ? {
133
+ title: [n, e].filter(Boolean).join(" "),
134
+ subtitle: r
135
+ } : {
136
+ title: n,
137
+ subtitle: e
138
+ };
139
+ }
140
+ return {
141
+ title: n,
142
+ subtitle: t?.trim() || ""
143
+ };
144
+ }
145
+ function Z() {
146
+ let e = _.address?.trim(), t = _.location?.trim(), n = !!(e && e !== "—"), r = !!(t && t !== "—");
147
+ return !n && !r ? null : n ? X(e, r ? t : void 0) : {
148
+ title: t,
149
+ subtitle: ""
150
+ };
151
+ }
152
+ function Q() {
153
+ let e = document.createElement("div");
154
+ return e.className = "appeal-map-pin", e.innerHTML = "\n <svg width=\"28\" height=\"36\" viewBox=\"0 0 28 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M14 0C6.268 0 0 6.268 0 14c0 10.5 14 22 14 22s14-11.5 14-22C28 6.268 21.732 0 14 0z\" fill=\"#2563EB\"/>\n <circle cx=\"14\" cy=\"14\" r=\"5.5\" fill=\"white\"/>\n </svg>\n ", e;
155
+ }
156
+ function pe(e, t) {
157
+ H?.remove(), H = null, K.value && (H = new t.Marker({
158
+ element: Q(),
159
+ anchor: "bottom"
160
+ }).setLngLat(K.value).addTo(e));
161
+ }
162
+ function me(e, t) {
163
+ V?.remove(), V = null;
164
+ let n = Z();
165
+ if (!K.value || !n) return;
166
+ let { title: r, subtitle: i } = n, a = document.createElement("div");
167
+ a.className = "appeal-map-popup-body";
168
+ let o = document.createElement("p");
169
+ if (o.className = "appeal-map-popup-title", o.textContent = r, a.appendChild(o), i) {
170
+ let e = document.createElement("p");
171
+ e.className = "appeal-map-popup-subtitle", e.textContent = i, a.appendChild(e);
172
+ }
173
+ V = new t.Popup({
174
+ closeButton: !0,
175
+ closeOnClick: !1,
176
+ offset: 36,
177
+ maxWidth: "260px",
178
+ className: "appeal-map-popup",
179
+ anchor: "bottom"
180
+ }).setLngLat(K.value).setDOMContent(a).addTo(e);
181
+ }
182
+ function $(e) {
183
+ l(e, F(N.value), d(e, M.value, [b]));
184
+ }
185
+ function he(e) {
186
+ m(e, M.value, P.value, b);
187
+ }
188
+ function ge(e) {
189
+ N.value !== e && (N.value = e);
190
+ }
191
+ function _e(e) {
192
+ let t = P.value;
193
+ P.value = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
194
+ }
195
+ function ve() {
196
+ let e = z, t = T.value, n = w.value;
197
+ if (!e || !t || !n || E.value || n.clientWidth === 0 || n.clientHeight === 0) return;
198
+ let r = new e.Map({
199
+ container: t,
200
+ style: s(F(N.value)),
201
+ ...G.value ? {
202
+ bounds: G.value,
203
+ fitBoundsOptions: C
204
+ } : {
205
+ center: S,
206
+ zoom: 16
207
+ },
208
+ attributionControl: !1,
209
+ locale: h
210
+ });
211
+ r.on("load", () => {
212
+ r.resize(), Y(r, e), he(r), k.value = !1;
213
+ }), r.on("error", (e) => {
214
+ console.warn("[AppealDetailMap]", e?.error ?? e);
215
+ }), E.value = r;
216
+ }
217
+ function ye() {
218
+ E.value?.zoomIn({ duration: 250 });
219
+ }
220
+ function be() {
221
+ E.value?.zoomOut({ duration: 250 });
222
+ }
223
+ function xe() {
224
+ let e = E.value;
225
+ e && J(e);
226
+ }
227
+ function Se() {
228
+ let e = E.value, t = z;
229
+ if (!e || !t) return;
230
+ let n = () => {
231
+ Y(e, t), J(e);
232
+ };
233
+ e.isStyleLoaded() ? n() : e.once("load", n);
234
+ }
235
+ j(() => [
236
+ W.value,
237
+ _.address,
238
+ _.location
239
+ ], Se), j(N, () => {
240
+ let e = E.value;
241
+ if (!e) return;
242
+ let t = () => $(e);
243
+ e.isStyleLoaded() ? t() : e.once("load", t);
244
+ }), j(P, () => {
245
+ let e = E.value;
246
+ e?.isStyleLoaded() && p(e, M.value, P.value);
247
+ }), ie(async () => {
248
+ try {
249
+ let [e] = await Promise.all([u(), R()]);
250
+ z = e;
251
+ } catch (e) {
252
+ console.error(e), k.value = !1, O.value = f;
253
+ return;
254
+ }
255
+ !U && w.value && (B = new ResizeObserver(() => {
256
+ E.value ? E.value.resize() : ve();
257
+ }), B.observe(w.value));
258
+ }), ae(() => {
259
+ U = !0, B?.disconnect(), V?.remove(), V = null, H?.remove(), H = null, E.value?.remove(), E.value = null;
260
+ });
261
+ let Ce = {
262
+ props: _,
263
+ POLYGON_SOURCE_ID: y,
264
+ POLYGON_FILL_ID: b,
265
+ POLYGON_LINE_ID: x,
266
+ FALLBACK_CENTER: S,
267
+ FIT_OPTIONS: C,
268
+ mapAreaRef: w,
269
+ containerRef: T,
270
+ mapRef: E,
271
+ mapLoadError: O,
272
+ mapLoading: k,
273
+ baseLayers: A,
274
+ overlayLayers: M,
275
+ activeBaseId: N,
276
+ activeOverlayIds: P,
277
+ baseLayer: F,
278
+ isApplications: I,
279
+ fallbackApplicationsOverlay: L,
280
+ loadLayerSettings: R,
281
+ get ml() {
282
+ return z;
283
+ },
284
+ set ml(e) {
285
+ z = e;
286
+ },
287
+ get resizeObserver() {
288
+ return B;
289
+ },
290
+ set resizeObserver(e) {
291
+ B = e;
292
+ },
293
+ get addressPopup() {
294
+ return V;
295
+ },
296
+ set addressPopup(e) {
297
+ V = e;
298
+ },
299
+ get addressMarker() {
300
+ return H;
301
+ },
302
+ set addressMarker(e) {
303
+ H = e;
304
+ },
305
+ get disposed() {
306
+ return U;
307
+ },
308
+ set disposed(e) {
309
+ U = e;
310
+ },
311
+ geometry: W,
312
+ bounds: G,
313
+ center: K,
314
+ mapAreaClass: fe,
315
+ buildGeoJson: q,
316
+ fitToGeometry: J,
317
+ ensureLayers: Y,
318
+ splitAddressLabel: X,
319
+ resolvePopupText: Z,
320
+ createPinElement: Q,
321
+ showAddressMarker: pe,
322
+ showAddressPopup: me,
323
+ remountBasemap: $,
324
+ remountOverlays: he,
325
+ selectBase: ge,
326
+ toggleOverlay: _e,
327
+ initMap: ve,
328
+ zoomIn: ye,
329
+ zoomOut: be,
330
+ resetView: xe,
331
+ refreshLayers: Se,
332
+ get Crosshair() {
333
+ return se;
334
+ },
335
+ get MapPin() {
336
+ return ce;
337
+ },
338
+ get MapPinned() {
339
+ return le;
340
+ },
341
+ get ZoomIn() {
342
+ return ue;
343
+ },
344
+ get ZoomOut() {
345
+ return de;
346
+ },
347
+ MapLayerMenu: re
348
+ };
349
+ return Object.defineProperty(Ce, "__isScriptSetup", {
350
+ enumerable: !1,
351
+ value: !0
352
+ }), Ce;
353
+ }
354
+ }), B = {
355
+ key: 0,
356
+ class: "flex shrink-0 items-center justify-between border-b border-slate-100 px-5 py-3.5"
357
+ }, V = { class: "flex items-center gap-2.5" }, H = {
358
+ ref: "containerRef",
359
+ class: "absolute inset-0 h-full w-full"
360
+ }, U = {
361
+ key: 0,
362
+ class: "absolute inset-0 z-[5] flex items-center justify-center bg-white/90 px-4 text-center text-sm text-red-600"
363
+ }, W = {
364
+ key: 1,
365
+ class: "absolute inset-0 z-[5] flex items-center justify-center bg-white/80 text-sm text-slate-500"
366
+ }, G = { class: "absolute right-3 top-3 z-10 flex flex-col gap-1.5" }, K = {
367
+ key: 1,
368
+ class: "flex shrink-0 items-center gap-2 border-t border-slate-100 px-5 py-2.5 text-xs text-slate-400"
369
+ }, fe = { class: "break-words" };
370
+ function q(e, t, n, r, i, a) {
371
+ return E(), b("div", { class: T(n.variant === "panel" ? "flex h-full flex-col rounded-xl border border-slate-200 bg-white shadow-card" : void 0) }, [
372
+ n.variant === "panel" ? (E(), b("header", B, [x("div", V, [C(r.MapPinned, {
373
+ class: "h-[18px] w-[18px] text-brand-600",
374
+ "stroke-width": 2,
375
+ "aria-hidden": "true"
376
+ }), t[0] ||= x("h2", { class: "text-[15px] font-semibold text-slate-800" }, "Інтерактивна карта", -1)]), t[1] ||= x("span", { class: "rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-500" }, " Межі заявки ", -1)])) : y("", !0),
377
+ x("div", {
378
+ ref: "mapAreaRef",
379
+ class: T(r.mapAreaClass)
380
+ }, [
381
+ x("div", H, null, 512),
382
+ r.mapLoadError ? (E(), b("p", U, k(r.mapLoadError), 1)) : r.mapLoading ? (E(), b("p", W, " Завантаження карти… ")) : y("", !0),
383
+ C(r.MapLayerMenu, {
384
+ "base-id": r.activeBaseId,
385
+ "active-overlay-ids": r.activeOverlayIds,
386
+ "base-layers": r.baseLayers,
387
+ overlays: r.overlayLayers,
388
+ onSelectBase: r.selectBase,
389
+ onToggleOverlay: r.toggleOverlay
390
+ }, null, 8, [
391
+ "base-id",
392
+ "active-overlay-ids",
393
+ "base-layers",
394
+ "overlays"
395
+ ]),
396
+ x("div", G, [
397
+ x("button", {
398
+ type: "button",
399
+ title: "Збільшити",
400
+ "aria-label": "Збільшити",
401
+ class: "flex h-9 w-9 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-600 shadow-card transition-colors hover:bg-brand-50 hover:text-brand-600",
402
+ onClick: r.zoomIn
403
+ }, [C(r.ZoomIn, {
404
+ class: "h-4 w-4",
405
+ "stroke-width": 2,
406
+ "aria-hidden": "true"
407
+ })]),
408
+ x("button", {
409
+ type: "button",
410
+ title: "Зменшити",
411
+ "aria-label": "Зменшити",
412
+ class: "flex h-9 w-9 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-600 shadow-card transition-colors hover:bg-brand-50 hover:text-brand-600",
413
+ onClick: r.zoomOut
414
+ }, [C(r.ZoomOut, {
415
+ class: "h-4 w-4",
416
+ "stroke-width": 2,
417
+ "aria-hidden": "true"
418
+ })]),
419
+ x("button", {
420
+ type: "button",
421
+ title: "Відновити масштаб",
422
+ "aria-label": "Відновити масштаб",
423
+ class: "flex h-9 w-9 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-600 shadow-card transition-colors hover:bg-brand-50 hover:text-brand-600",
424
+ onClick: r.resetView
425
+ }, [C(r.Crosshair, {
426
+ class: "h-4 w-4",
427
+ "stroke-width": 2,
428
+ "aria-hidden": "true"
429
+ })])
430
+ ])
431
+ ], 2),
432
+ n.variant === "panel" ? (E(), b("footer", K, [
433
+ C(r.MapPin, {
434
+ class: "h-3 w-3 shrink-0",
435
+ "stroke-width": 2,
436
+ "aria-hidden": "true"
437
+ }),
438
+ x("span", null, "Площа ділянки: " + k(n.area ?? "—") + " га", 1),
439
+ t[2] ||= x("span", { class: "text-slate-300" }, "·", -1),
440
+ x("span", fe, k(n.location), 1)
441
+ ])) : y("", !0)
442
+ ], 2);
443
+ }
444
+ var J = /*#__PURE__*/ e(z, [
445
+ ["render", q],
446
+ ["__scopeId", "data-v-ded53fc4"],
447
+ ["__file", "C:/softpro/surveyor/shared/map/components/AppealDetailMap.vue"]
448
+ ]);
449
+ //#endregion
450
+ //#region shared/comments/applicationNotesApi.ts
451
+ function Y(e, t) {
452
+ return `/api/resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}/notes`;
453
+ }
454
+ async function X(e) {
455
+ let t = await e.text();
456
+ try {
457
+ let n = JSON.parse(t);
458
+ return (typeof n.error == "object" ? n.error?.message : void 0) || n.message || n.detail || t || `HTTP ${e.status}`;
459
+ } catch {
460
+ return t || `HTTP ${e.status}`;
461
+ }
462
+ }
463
+ async function Z(e, t) {
464
+ let n = "".replace(/\/$/, ""), r = await fetch(`${n}${Y(e, t)}`, { credentials: "include" });
465
+ if (!r.ok) throw Error(await X(r));
466
+ return [...(await r.json()).rows ?? []].sort((e, t) => String(e.created_at ?? "").localeCompare(String(t.created_at ?? "")));
467
+ }
468
+ async function Q(e, t, n) {
469
+ let r = n.trim();
470
+ if (!r) throw Error("Введіть текст коментаря");
471
+ let i = "".replace(/\/$/, ""), a = await fetch(`${i}${Y(e, t)}`, {
472
+ method: "POST",
473
+ credentials: "include",
474
+ headers: { "Content-Type": "application/json" },
475
+ body: JSON.stringify({ body: r })
476
+ });
477
+ if (!a.ok) throw Error(await X(a));
478
+ return a.json();
479
+ }
480
+ //#endregion
481
+ //#region shared/comments/noteDisplay.ts
482
+ function pe(e) {
483
+ return e.split(/\s+/).map((e) => e[0]).filter(Boolean).join("").slice(0, 2).toUpperCase();
484
+ }
485
+ function me(e) {
486
+ if (!e) return "";
487
+ let t = e.match(/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})/);
488
+ if (t) return `${t[3]}.${t[2]}.${t[1]} ${t[4]}:${t[5]}`;
489
+ let n = e.match(/^(\d{4})-(\d{2})-(\d{2})/);
490
+ return n ? `${n[3]}.${n[2]}.${n[1]}` : e;
491
+ }
492
+ function $(e) {
493
+ return {
494
+ name: "Користувач",
495
+ initials: e.created_by?.trim().slice(0, 2).toUpperCase() || "К"
496
+ };
497
+ }
498
+ //#endregion
499
+ //#region shared/comments/ApplicationCommentsSection.vue?vue&type=script&setup=true&lang.ts
500
+ var he = /*@__PURE__*/ w({
501
+ __name: "ApplicationCommentsSection",
502
+ props: {
503
+ applicationId: {
504
+ type: String,
505
+ required: !0
506
+ },
507
+ resource: {
508
+ type: String,
509
+ required: !0
510
+ },
511
+ variant: {
512
+ type: String,
513
+ required: !1,
514
+ default: "cabinet"
515
+ },
516
+ currentAuthor: {
517
+ type: Object,
518
+ required: !0
519
+ },
520
+ resolveAuthor: {
521
+ type: Function,
522
+ required: !1
523
+ }
524
+ },
525
+ setup(e, { expose: t }) {
526
+ t();
527
+ let n = e, r = D([]), i = D({}), a = D(!0), o = D(""), s = D(""), c = D(!1), l = D(""), u = v(() => n.variant === "admin"), d = v(() => u.value ? "rounded-2xl border border-slate-200 bg-white shadow-card" : "overflow-hidden rounded-2xl border border-gray-200 bg-white"), f = v(() => u.value ? "flex items-center gap-2.5 border-b border-slate-100 px-5 py-3.5" : "flex items-center gap-2 border-b border-gray-100 bg-gray-50/60 px-5 py-3"), p = v(() => u.value ? "text-[15px] font-semibold text-slate-800" : "text-xs font-semibold uppercase tracking-wider text-gray-500"), m = v(() => (u.value, "flex flex-col gap-4 p-5"));
528
+ function ee(e) {
529
+ return i.value[e.note_id] ?? n.resolveAuthor?.(e) ?? $(e);
530
+ }
531
+ async function h() {
532
+ if (n.applicationId) {
533
+ a.value = !0, o.value = "";
534
+ try {
535
+ r.value = await Z(n.resource, n.applicationId), i.value = {};
536
+ } catch (e) {
537
+ r.value = [], o.value = e instanceof Error ? e.message : "Не вдалося завантажити коментарі";
538
+ } finally {
539
+ a.value = !1;
540
+ }
541
+ }
542
+ }
543
+ async function te() {
544
+ let e = s.value.trim();
545
+ if (e && !c.value && n.applicationId) {
546
+ c.value = !0, l.value = "";
547
+ try {
548
+ let t = await Q(n.resource, n.applicationId, e);
549
+ i.value = {
550
+ ...i.value,
551
+ [t.note_id]: n.currentAuthor
552
+ }, r.value = [...r.value, t].sort((e, t) => String(e.created_at ?? "").localeCompare(String(t.created_at ?? ""))), s.value = "";
553
+ } catch (e) {
554
+ l.value = e instanceof Error ? e.message : "Не вдалося надіслати коментар";
555
+ } finally {
556
+ c.value = !1;
557
+ }
558
+ }
559
+ }
560
+ function ne(e) {
561
+ e.preventDefault(), te();
562
+ }
563
+ j(() => n.applicationId, () => {
564
+ h();
565
+ }, { immediate: !0 });
566
+ let g = {
567
+ props: n,
568
+ notes: r,
569
+ localAuthors: i,
570
+ loading: a,
571
+ loadError: o,
572
+ draft: s,
573
+ sending: c,
574
+ sendError: l,
575
+ isAdmin: u,
576
+ sectionClass: d,
577
+ headerClass: f,
578
+ titleClass: p,
579
+ bodyClass: m,
580
+ authorFor: ee,
581
+ loadNotes: h,
582
+ submit: te,
583
+ onSubmit: ne,
584
+ get MessageSquare() {
585
+ return L;
586
+ },
587
+ get Send() {
588
+ return R;
589
+ },
590
+ get formatNoteDateTime() {
591
+ return me;
592
+ }
593
+ };
594
+ return Object.defineProperty(g, "__isScriptSetup", {
595
+ enumerable: !1,
596
+ value: !0
597
+ }), g;
598
+ }
599
+ }), ge = {
600
+ key: 1,
601
+ class: "text-center text-sm text-red-600"
602
+ }, _e = {
603
+ key: 1,
604
+ class: "flex flex-col gap-4"
605
+ }, ve = { class: "min-w-0 flex-1" }, ye = { class: "flex flex-wrap items-baseline justify-between gap-x-2" }, be = { class: "text-[14px] font-semibold text-slate-800" }, xe = { class: "text-xs text-slate-400" }, Se = {
606
+ key: 0,
607
+ class: "mb-1.5 text-xs font-medium text-brand-600"
608
+ }, Ce = { class: "whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600" }, we = {
609
+ key: 1,
610
+ class: "rounded-xl bg-gray-50 px-4 py-3"
611
+ }, Te = { class: "mb-1 flex items-center justify-between gap-2" }, Ee = { class: "text-xs font-semibold text-gray-800" }, De = { class: "text-xs text-gray-400" }, Oe = {
612
+ key: 0,
613
+ class: "mb-1 text-xs font-medium text-[#2663EB]"
614
+ }, ke = { class: "whitespace-pre-wrap text-sm text-gray-700" }, Ae = { class: "relative min-w-0 flex-1" }, je = [
615
+ "disabled",
616
+ "placeholder",
617
+ "onKeydown"
618
+ ], Me = ["disabled"], Ne = ["disabled"], Pe = {
619
+ key: 2,
620
+ class: "text-xs text-red-600"
621
+ };
622
+ function Fe(e, t, n, r, i, a) {
623
+ return E(), b("section", { class: T(r.sectionClass) }, [x("header", { class: T(r.headerClass) }, [C(r.MessageSquare, {
624
+ class: T(["shrink-0", r.isAdmin ? "h-[18px] w-[18px] text-brand-600" : "h-3.5 w-3.5 text-gray-400"]),
625
+ "stroke-width": 2,
626
+ "aria-hidden": "true"
627
+ }, null, 8, ["class"]), x("h2", { class: T(r.titleClass) }, "Коментарі", 2)], 2), x("div", { class: T(r.bodyClass) }, [r.loading ? (E(), b("p", {
628
+ key: 0,
629
+ class: T(["text-center text-sm", r.isAdmin ? "text-slate-400" : "text-gray-400"])
630
+ }, " Завантаження… ", 2)) : r.loadError ? (E(), b("p", ge, k(r.loadError), 1)) : (E(), b(_, { key: 2 }, [
631
+ r.notes.length === 0 ? (E(), b("p", {
632
+ key: 0,
633
+ class: T(["text-center text-sm italic", r.isAdmin ? "py-2 text-slate-400" : "py-4 text-gray-400"])
634
+ }, " Коментарів ще немає ", 2)) : (E(), b("ul", _e, [(E(!0), b(_, null, O(r.notes, (e) => (E(), b("li", {
635
+ key: e.note_id,
636
+ class: "flex gap-3"
637
+ }, [x("div", { class: T(["flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-[13px] font-semibold", r.isAdmin ? "bg-brand-100 text-brand-700" : "bg-[#2663EB] text-white text-xs"]) }, k(r.authorFor(e).initials), 3), x("div", ve, [r.isAdmin ? (E(), b(_, { key: 0 }, [
638
+ x("div", ye, [x("span", be, k(r.authorFor(e).name), 1), x("time", xe, k(r.formatNoteDateTime(e.created_at)), 1)]),
639
+ r.authorFor(e).role ? (E(), b("p", Se, k(r.authorFor(e).role), 1)) : y("", !0),
640
+ x("p", Ce, k(e.body), 1)
641
+ ], 64)) : (E(), b("div", we, [
642
+ x("div", Te, [x("span", Ee, k(r.authorFor(e).name), 1), x("time", De, k(r.formatNoteDateTime(e.created_at)), 1)]),
643
+ r.authorFor(e).role ? (E(), b("p", Oe, k(r.authorFor(e).role), 1)) : y("", !0),
644
+ x("p", ke, k(e.body), 1)
645
+ ]))])]))), 128))])),
646
+ x("form", {
647
+ class: T(["flex items-start gap-3 border-t pt-4", r.isAdmin ? "border-slate-100" : "border-gray-100"]),
648
+ onSubmit: r.onSubmit
649
+ }, [
650
+ x("div", { class: T(["mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-xs font-semibold", r.isAdmin ? "bg-brand-100 text-brand-700" : "bg-[#2663EB] text-white"]) }, k(n.currentAuthor.initials), 3),
651
+ x("div", Ae, [M(x("textarea", {
652
+ "onUpdate:modelValue": t[0] ||= (e) => r.draft = e,
653
+ rows: "3",
654
+ disabled: r.sending,
655
+ placeholder: r.isAdmin ? "Додати коментар…" : "Напишіть коментар...",
656
+ class: T(["w-full resize-none rounded-xl border px-4 py-3 text-sm transition-colors focus:outline-none focus:ring-2 disabled:opacity-60", r.isAdmin ? "border-slate-200 bg-slate-50 text-slate-700 placeholder:text-slate-400 focus:border-brand-400 focus:bg-white focus:ring-brand-400/30" : "border-gray-200 pr-12 text-gray-900 placeholder:text-gray-400 focus:border-[#2663EB] focus:ring-[#2663EB]/20"]),
657
+ onKeydown: N(P(r.submit, ["exact", "prevent"]), ["enter"])
658
+ }, null, 42, je), [[A, r.draft]]), r.isAdmin ? y("", !0) : (E(), b("button", {
659
+ key: 0,
660
+ type: "submit",
661
+ disabled: !r.draft.trim() || r.sending,
662
+ class: "absolute bottom-3 right-3 rounded-lg bg-[#2663EB] p-1.5 text-white transition-all hover:bg-[#1d52cc] active:scale-95 disabled:cursor-not-allowed disabled:opacity-40",
663
+ "aria-label": "Надіслати"
664
+ }, [C(r.Send, {
665
+ class: "h-3.5 w-3.5",
666
+ "stroke-width": 2
667
+ })], 8, Me))]),
668
+ r.isAdmin ? (E(), b("button", {
669
+ key: 0,
670
+ type: "submit",
671
+ disabled: !r.draft.trim() || r.sending,
672
+ class: "inline-flex shrink-0 items-center gap-1.5 rounded-lg bg-brand-600 px-4 py-2.5 text-sm font-medium text-white shadow-card transition-all hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-40"
673
+ }, [C(r.Send, {
674
+ class: "h-3.5 w-3.5",
675
+ "stroke-width": 2
676
+ }), S(" " + k(r.sending ? "Надсилання…" : "Надіслати"), 1)], 8, Ne)) : y("", !0)
677
+ ], 34),
678
+ r.sendError ? (E(), b("p", Pe, k(r.sendError), 1)) : y("", !0)
679
+ ], 64))], 2)], 2);
680
+ }
681
+ var Ie = /*#__PURE__*/ e(he, [["render", Fe], ["__file", "C:/softpro/surveyor/shared/comments/ApplicationCommentsSection.vue"]]), Le = /*@__PURE__*/ w({
682
+ __name: "ApplicationHistorySection",
683
+ props: {
684
+ items: {
685
+ type: [Array, null],
686
+ required: !1,
687
+ default: () => []
688
+ },
689
+ variant: {
690
+ type: String,
691
+ required: !1,
692
+ default: "cabinet"
693
+ }
694
+ },
695
+ setup(e, { expose: t }) {
696
+ t();
697
+ let n = e, r = D(!0), i = v(() => n.variant === "admin"), a = v(() => [...n.items ?? []].sort((e, t) => String(e.created_at ?? "").localeCompare(String(t.created_at ?? "")))), o = v(() => i.value ? "rounded-xl border border-slate-200 bg-white shadow-card" : "overflow-hidden rounded-2xl border border-gray-200 bg-white"), s = v(() => i.value ? "flex items-center gap-2.5 border-b border-slate-100 px-5 py-3.5" : "flex items-center gap-2 border-b border-gray-100 bg-gray-50/60 px-5 py-3"), l = v(() => i.value ? "text-[15px] font-semibold text-slate-800" : "text-xs font-semibold uppercase tracking-wider text-gray-500"), u = v(() => i.value ? "px-5 py-4" : "p-5");
698
+ function d(e, t) {
699
+ return t?.text?.trim() || (e ? c.items.find((t) => t.code === e)?.name ?? e : "");
700
+ }
701
+ function f(e) {
702
+ let t = d(e.status_from, e.status_from_data), n = d(e.status_to, e.status_to_data) || "—";
703
+ return t ? `${t} → ${n}` : n;
704
+ }
705
+ function p(e) {
706
+ if (!e) return "";
707
+ let t = e.match(/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})/);
708
+ if (t) return `${t[3]}.${t[2]}.${t[1]} ${t[4]}:${t[5]}`;
709
+ let n = e.match(/^(\d{4})-(\d{2})-(\d{2})/);
710
+ return n ? `${n[3]}.${n[2]}.${n[1]}` : e;
711
+ }
712
+ let m = {
713
+ props: n,
714
+ open: r,
715
+ isAdmin: i,
716
+ events: a,
717
+ sectionClass: o,
718
+ headerClass: s,
719
+ titleClass: l,
720
+ bodyClass: u,
721
+ statusLabel: d,
722
+ historyTitle: f,
723
+ formatDateTime: p,
724
+ get ChevronDown() {
725
+ return F;
726
+ },
727
+ get History() {
728
+ return I;
729
+ }
730
+ };
731
+ return Object.defineProperty(m, "__isScriptSetup", {
732
+ enumerable: !1,
733
+ value: !0
734
+ }), m;
735
+ }
736
+ }), Re = {
737
+ key: 0,
738
+ class: "relative list-none"
739
+ }, ze = { class: "relative z-10 mt-1 shrink-0" }, Be = { class: "min-w-0 flex-1" }, Ve = { class: "flex flex-wrap items-baseline justify-between gap-x-2 gap-y-1" };
740
+ function He(e, t, n, r, i, a) {
741
+ return E(), b("section", { class: T(r.sectionClass) }, [x("header", { class: T(r.headerClass) }, [C(r.History, {
742
+ class: T(["shrink-0", r.isAdmin ? "h-[18px] w-[18px] text-brand-600" : "h-3.5 w-3.5 text-gray-400"]),
743
+ "stroke-width": 2,
744
+ "aria-hidden": "true"
745
+ }, null, 8, ["class"]), x("h2", { class: T(r.titleClass) }, "Історія", 2)], 2), x("div", { class: T(r.bodyClass) }, [x("button", {
746
+ type: "button",
747
+ class: T(["mb-3 flex w-full items-center justify-between text-xs font-medium transition-colors", r.isAdmin ? "text-slate-500 hover:text-brand-600" : "text-gray-500 hover:text-[#2663EB]"]),
748
+ onClick: t[0] ||= (e) => r.open = !r.open
749
+ }, [x("span", null, k(r.open ? "Згорнути" : `Розгорнути (${r.events.length} подій)`), 1), C(r.ChevronDown, {
750
+ class: T(["h-4 w-4 transition-transform", r.open ? "" : "rotate-180"]),
751
+ "aria-hidden": "true"
752
+ }, null, 8, ["class"])], 2), r.open && r.events.length ? (E(), b("ol", Re, [t[1] ||= x("div", { class: "absolute bottom-2 left-[7px] top-2 w-px bg-slate-200" }, null, -1), (E(!0), b(_, null, O(r.events, (e, t) => (E(), b("li", {
753
+ key: e.history_id,
754
+ class: "relative flex gap-4 pb-6 last:pb-0"
755
+ }, [x("div", ze, [x("span", { class: T(["block h-[15px] w-[15px] rounded-full border-2 border-white", t === r.events.length - 1 ? "bg-brand-500" : "bg-slate-300"]) }, null, 2)]), x("div", Be, [
756
+ x("div", Ve, [x("p", { class: T(["text-[14px] font-semibold", r.isAdmin ? "text-slate-800" : "text-gray-900"]) }, k(r.historyTitle(e)), 3), x("time", { class: T(["text-xs", r.isAdmin ? "text-slate-400" : "text-gray-400"]) }, k(r.formatDateTime(e.created_at) || "—"), 3)]),
757
+ e.reason ? (E(), b("p", {
758
+ key: 0,
759
+ class: T(["mt-1 text-[13px] leading-relaxed", r.isAdmin ? "text-slate-600" : "text-gray-600"])
760
+ }, k(e.reason), 3)) : y("", !0),
761
+ x("p", { class: T(["mt-1 text-xs", r.isAdmin ? "text-slate-400" : "text-gray-400"]) }, k(e.changed_by_data?.text || "—"), 3)
762
+ ])]))), 128))])) : r.events.length ? y("", !0) : (E(), b("p", {
763
+ key: 1,
764
+ class: T(["text-sm", r.isAdmin ? "text-slate-400" : "text-gray-400"])
765
+ }, " Історія відсутня. ", 2))], 2)], 2);
766
+ }
767
+ var Ue = /*#__PURE__*/ e(Le, [["render", He], ["__file", "C:/softpro/surveyor/shared/history/ApplicationHistorySection.vue"]]);
768
+ //#endregion
769
+ export { J as i, Ie as n, pe as r, Ue as t };