mechanica 1.0.5 → 1.0.6

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/editor.js CHANGED
@@ -1,8 +1,11 @@
1
- import { defineComponent, ref, watch, createElementBlock, openBlock, normalizeStyle, createElementVNode, shallowRef, onMounted, onBeforeUnmount, triggerRef, computed, inject, normalizeClass, createCommentVNode, renderSlot, createVNode, createTextVNode, toDisplayString, Transition, withCtx, getCurrentScope, onScopeDispose, toRef as toRef$1, readonly, customRef, toValue as toValue$1, getCurrentInstance, nextTick, unref, createBlock, createSlots, withDirectives, vModelText, vModelDynamic, Fragment, renderList, h, TransitionGroup, useSlots, Teleport, mergeProps, withModifiers, createStaticVNode, resolveDynamicComponent, isRef, reactive, vShow, shallowReactive, mergeModels, useModel, vModelCheckbox, isProxy, toRaw, resolveComponent, normalizeProps, guardReactiveProps, provide, createApp } from "vue";
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { defineComponent, ref, watch, createElementBlock, openBlock, normalizeStyle, createElementVNode, reactive, computed, shallowRef, onMounted, onBeforeUnmount, triggerRef, inject, normalizeClass, createCommentVNode, renderSlot, createVNode, createTextVNode, toDisplayString, Transition, withCtx, getCurrentScope, onScopeDispose, toRef as toRef$1, readonly, customRef, toValue as toValue$1, getCurrentInstance, nextTick, unref, createBlock, createSlots, withDirectives, vModelText, vModelDynamic, Fragment, renderList, h, TransitionGroup, useSlots, Teleport, mergeProps, withModifiers, mergeModels, useModel, createStaticVNode, resolveDynamicComponent, isRef, vShow, shallowReactive, vModelCheckbox, isProxy, toRaw, resolveComponent, normalizeProps, guardReactiveProps, provide, createApp } from "vue";
2
5
  import { g as getDefaultValue, d as defaultImageSrc, r as registerAliases, p as passDefaultValue } from "./schemaAliases-jUlXWmB3.js";
3
6
  import { blocksList as blocksList$1, addUpdateListener } from "virtual:builder-blocks";
4
7
  import { unfoldSchema } from "compact-json-schema";
5
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
8
+ const _sfc_main$O = /* @__PURE__ */ defineComponent({
6
9
  __name: "HoverFrame",
7
10
  props: {
8
11
  element: {},
@@ -44,7 +47,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
44
47
  };
45
48
  }
46
49
  });
47
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
50
+ const _sfc_main$N = /* @__PURE__ */ defineComponent({
48
51
  __name: "InsertedPlace",
49
52
  props: {
50
53
  top: {}
@@ -65,40 +68,40 @@ const _export_sfc = (sfc, props) => {
65
68
  }
66
69
  return target;
67
70
  };
68
- const _sfc_main$G = {};
69
- const _hoisted_1$z = {
71
+ const _sfc_main$M = {};
72
+ const _hoisted_1$D = {
70
73
  width: "16",
71
74
  height: "16",
72
75
  viewBox: "0 0 16 16",
73
76
  fill: "none",
74
77
  xmlns: "http://www.w3.org/2000/svg"
75
78
  };
76
- function _sfc_render$f(_ctx, _cache) {
77
- return openBlock(), createElementBlock("svg", _hoisted_1$z, _cache[0] || (_cache[0] = [
79
+ function _sfc_render$g(_ctx, _cache) {
80
+ return openBlock(), createElementBlock("svg", _hoisted_1$D, _cache[0] || (_cache[0] = [
78
81
  createElementVNode("path", {
79
82
  d: "M10.707 14.364C10.8945 14.1764 10.9998 13.9221 10.9998 13.657C10.9998 13.3918 10.8945 13.1375 10.707 12.95L5.75705 7.99995L10.707 3.04995C10.8892 2.86135 10.99 2.60875 10.9877 2.34655C10.9854 2.08435 10.8803 1.83354 10.6949 1.64813C10.5095 1.46272 10.2586 1.35756 9.99645 1.35528C9.73425 1.353 9.48165 1.45379 9.29305 1.63595L3.63605 7.29295C3.44858 7.48048 3.34326 7.73479 3.34326 7.99995C3.34326 8.26512 3.44858 8.51942 3.63605 8.70695L9.29305 14.364C9.48058 14.5514 9.73488 14.6567 10 14.6567C10.2652 14.6567 10.5195 14.5514 10.707 14.364Z",
80
83
  fill: "currentColor"
81
84
  }, null, -1)
82
85
  ]));
83
86
  }
84
- const ChevronLeftIcon = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["render", _sfc_render$f]]);
85
- const _sfc_main$F = {};
86
- const _hoisted_1$y = {
87
+ const ChevronLeftIcon = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$g]]);
88
+ const _sfc_main$L = {};
89
+ const _hoisted_1$C = {
87
90
  width: "16",
88
91
  height: "16",
89
92
  viewBox: "0 0 16 16",
90
93
  fill: "none",
91
94
  xmlns: "http://www.w3.org/2000/svg"
92
95
  };
93
- function _sfc_render$e(_ctx, _cache) {
94
- return openBlock(), createElementBlock("svg", _hoisted_1$y, _cache[0] || (_cache[0] = [
96
+ function _sfc_render$f(_ctx, _cache) {
97
+ return openBlock(), createElementBlock("svg", _hoisted_1$C, _cache[0] || (_cache[0] = [
95
98
  createElementVNode("path", {
96
99
  d: "M5.29295 1.63605C5.10548 1.82358 5.00017 2.07788 5.00017 2.34305C5.00017 2.60821 5.10548 2.86252 5.29295 3.05005L10.243 8.00005L5.29295 12.95C5.11079 13.1387 5.01 13.3913 5.01228 13.6534C5.01456 13.9156 5.11972 14.1665 5.30513 14.3519C5.49054 14.5373 5.74135 14.6424 6.00355 14.6447C6.26575 14.647 6.51835 14.5462 6.70695 14.364L12.364 8.70705C12.5514 8.51952 12.6567 8.26521 12.6567 8.00005C12.6567 7.73488 12.5514 7.48058 12.364 7.29305L6.70695 1.63605C6.51942 1.44858 6.26512 1.34326 5.99995 1.34326C5.73479 1.34326 5.48048 1.44858 5.29295 1.63605Z",
97
100
  fill: "currentColor"
98
101
  }, null, -1)
99
102
  ]));
100
103
  }
101
- const ChevronRightIcon = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["render", _sfc_render$e]]);
104
+ const ChevronRightIcon = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$f]]);
102
105
  const findParent$1 = (el, callback) => {
103
106
  if (callback(el)) return el;
104
107
  if (!el.parentElement) return null;
@@ -273,6 +276,134 @@ const cloneDeep = (obj) => {
273
276
  }
274
277
  return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, cloneDeep(value)]));
275
278
  };
279
+ const isEqual$1 = (a, b) => {
280
+ if (a === b) return true;
281
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
282
+ if (Array.isArray(a)) {
283
+ if (!Array.isArray(b) || a.length !== b.length) return false;
284
+ for (let i = 0; i < a.length; i++) {
285
+ if (!isEqual$1(a[i], b[i])) return false;
286
+ }
287
+ return true;
288
+ }
289
+ for (let key in a) {
290
+ if (!isEqual$1(a[key], b[key])) return false;
291
+ }
292
+ return true;
293
+ };
294
+ let globalErrorHandler = (_error, _errors) => {
295
+ };
296
+ const setUseFormErrorHandler = (handler) => {
297
+ globalErrorHandler = handler;
298
+ };
299
+ const useForm = (defaultValues, options = {}) => {
300
+ const pending = ref(false);
301
+ const values = reactive(cloneDeep(defaultValues));
302
+ const errors = reactive({});
303
+ const oldValues = {};
304
+ watch(values, () => {
305
+ for (let [key, value] of Object.entries(values)) {
306
+ if (key in errors && value !== oldValues[key]) {
307
+ delete errors[key];
308
+ }
309
+ }
310
+ Object.assign(oldValues, values);
311
+ });
312
+ const requiredSet = computed(() => {
313
+ return new Set(options.required);
314
+ });
315
+ const setError = (key, error) => {
316
+ errors[key] = error;
317
+ };
318
+ const register = (key) => {
319
+ return {
320
+ modelValue: values[key],
321
+ "onUpdate:modelValue": (value) => values[key] = value,
322
+ error: errors[key],
323
+ name: key,
324
+ required: requiredSet.value.has(key)
325
+ };
326
+ };
327
+ const checkRequired = (keys) => {
328
+ for (let key of keys ?? options.required ?? []) {
329
+ const val = values[key];
330
+ if (val === null || (typeof val === "string" && !val.trim() || Array.isArray(val) && val.length === 0)) {
331
+ setError(key, { code: "required" });
332
+ return false;
333
+ }
334
+ }
335
+ return true;
336
+ };
337
+ const requiredFilled = computed(() => {
338
+ for (let key of options.required ?? []) {
339
+ const val = values[key];
340
+ if (val === null || typeof val === "string" && !val.trim() || Array.isArray(val) && val.length === 0) {
341
+ return false;
342
+ }
343
+ }
344
+ return true;
345
+ });
346
+ const handleError = (e) => {
347
+ globalErrorHandler(e, errors);
348
+ for (let key in errors) {
349
+ if (!(key in values) && key !== "_global") {
350
+ delete errors[key];
351
+ }
352
+ }
353
+ };
354
+ const handleSubmit = (submit) => async (e) => {
355
+ e.preventDefault();
356
+ if (!checkRequired()) return;
357
+ delete errors["_global"];
358
+ pending.value = true;
359
+ try {
360
+ await submit(values);
361
+ } catch (e2) {
362
+ handleError(e2);
363
+ throw e2;
364
+ } finally {
365
+ pending.value = false;
366
+ }
367
+ };
368
+ const updateDefaultValues = (newValues) => {
369
+ for (let [key, value] of Object.entries(newValues)) {
370
+ if (key in values) {
371
+ values[key] = cloneDeep(value);
372
+ defaultValues[key] = value;
373
+ }
374
+ }
375
+ changeFlag.value = true;
376
+ changeFlag.value = false;
377
+ };
378
+ const updateDefaultValuesWatch = (data, map) => {
379
+ watch(data, (data2) => {
380
+ if (!data2) return;
381
+ updateDefaultValues(map ? map(data2) : data2);
382
+ }, { immediate: true });
383
+ };
384
+ const changeFlag = ref(false);
385
+ const setChange = () => {
386
+ changeFlag.value = true;
387
+ };
388
+ const hasChange = computed(() => {
389
+ if (changeFlag.value) return true;
390
+ return !isEqual$1(values, defaultValues);
391
+ });
392
+ return {
393
+ handleSubmit,
394
+ register,
395
+ setError,
396
+ errors,
397
+ checkRequired,
398
+ updateDefaultValues,
399
+ updateDefaultValuesWatch,
400
+ pending,
401
+ values,
402
+ hasChange,
403
+ setChange,
404
+ requiredFilled
405
+ };
406
+ };
276
407
  class MultiMap {
277
408
  constructor() {
278
409
  this._map = /* @__PURE__ */ new Map();
@@ -352,14 +483,14 @@ const events = new MultiMap();
352
483
  const getArgKey = (args) => {
353
484
  return args.length === 0 ? "" : JSON.stringify(args);
354
485
  };
355
- const getEntryOrCreate = (request, argKey, defaultValue) => {
356
- const existsValue = dataMap.get(request, argKey);
486
+ const getEntryOrCreate = (request2, argKey, defaultValue) => {
487
+ const existsValue = dataMap.get(request2, argKey);
357
488
  if (existsValue) return existsValue;
358
- dataMap.set(request, argKey, defaultValue);
489
+ dataMap.set(request2, argKey, defaultValue);
359
490
  return defaultValue;
360
491
  };
361
- const useRequestExt = (options, request, ...args) => {
362
- const defaultValue = dataMap.get(request, getArgKey(args));
492
+ const useRequestExt = (options, request2, ...args) => {
493
+ const defaultValue = dataMap.get(request2, getArgKey(args));
363
494
  const pending = shallowRef(defaultValue === null);
364
495
  const data = shallowRef((defaultValue == null ? void 0 : defaultValue.data) ?? null);
365
496
  const error = shallowRef(null);
@@ -375,7 +506,7 @@ const useRequestExt = (options, request, ...args) => {
375
506
  data.value = returnDataValue;
376
507
  return;
377
508
  }
378
- const entry = getEntryOrCreate(request, argKey, { data: null, lastUpdate: -1, updatedManually: false });
509
+ const entry = getEntryOrCreate(request2, argKey, { data: null, lastUpdate: -1, updatedManually: false });
379
510
  data.value = entry.data;
380
511
  pending.value = entry.data === null;
381
512
  lastArgs = args2;
@@ -384,7 +515,7 @@ const useRequestExt = (options, request, ...args) => {
384
515
  return;
385
516
  }
386
517
  try {
387
- const resp = await makeRequestWithoutCache(entry, request, ...args2);
518
+ const resp = await makeRequestWithoutCache(entry, request2, ...args2);
388
519
  if (currentArgKey === argKey) {
389
520
  data.value = resp;
390
521
  }
@@ -398,7 +529,7 @@ const useRequestExt = (options, request, ...args) => {
398
529
  const lazyMutate = async (...args2) => {
399
530
  const argKey = getArgKey(args2);
400
531
  currentArgKey = argKey;
401
- const entry = dataMap.get(request, argKey);
532
+ const entry = dataMap.get(request2, argKey);
402
533
  if (entry !== null && entry.lastUpdate > 0 && Date.now() < entry.lastUpdate + 1e3 * 30) {
403
534
  data.value = entry.data;
404
535
  error.value = null;
@@ -416,18 +547,18 @@ const useRequestExt = (options, request, ...args) => {
416
547
  lazyMutate(...args);
417
548
  });
418
549
  onMounted(() => {
419
- events.add(request, mutateWithLastArgs);
550
+ events.add(request2, mutateWithLastArgs);
420
551
  });
421
552
  onBeforeUnmount(() => {
422
- events.remove(request, mutateWithLastArgs);
553
+ events.remove(request2, mutateWithLastArgs);
423
554
  });
424
555
  return { data, error, pending, mutate, lazyMutate, setReturnData };
425
556
  };
426
- const useRequest = (request, ...args) => useRequestExt({}, request, ...args);
427
- const makeRequestWithoutCache = async (entry, request, ...args) => {
557
+ const useRequest = (request2, ...args) => useRequestExt({}, request2, ...args);
558
+ const makeRequestWithoutCache = async (entry, request2, ...args) => {
428
559
  if (!entry.promise) {
429
560
  const promise = (async () => {
430
- const resp = await request(...args);
561
+ const resp = await request2(...args);
431
562
  entry.data = resp;
432
563
  entry.lastUpdate = Date.now();
433
564
  delete entry.promise;
@@ -505,15 +636,15 @@ class BlockDropEvent extends Event {
505
636
  this.content = content;
506
637
  }
507
638
  }
508
- const _hoisted_1$x = {
639
+ const _hoisted_1$B = {
509
640
  key: 0,
510
641
  class: "v-form-control__label"
511
642
  };
512
- const _hoisted_2$a = {
643
+ const _hoisted_2$c = {
513
644
  key: 0,
514
645
  class: "v-form-control__required-marker"
515
646
  };
516
- const _hoisted_3$7 = {
647
+ const _hoisted_3$8 = {
517
648
  key: 1,
518
649
  class: "v-form-control__outline"
519
650
  };
@@ -525,7 +656,7 @@ const _hoisted_5$2 = {
525
656
  key: 0,
526
657
  class: "v-form-control__error"
527
658
  };
528
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
659
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
529
660
  __name: "VFormControl",
530
661
  props: {
531
662
  error: {},
@@ -550,11 +681,11 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
550
681
  return openBlock(), createElementBlock("div", {
551
682
  class: normalizeClass(["v-form-control", { error: !!props.error, disabled: props.disabled }])
552
683
  }, [
553
- !!props.label ? (openBlock(), createElementBlock("label", _hoisted_1$x, [
684
+ !!props.label ? (openBlock(), createElementBlock("label", _hoisted_1$B, [
554
685
  createTextVNode(toDisplayString(props.label), 1),
555
- props.required ? (openBlock(), createElementBlock("span", _hoisted_2$a, "*")) : createCommentVNode("", true)
686
+ props.required ? (openBlock(), createElementBlock("span", _hoisted_2$c, "*")) : createCommentVNode("", true)
556
687
  ])) : createCommentVNode("", true),
557
- props.outline ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
688
+ props.outline ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
558
689
  renderSlot(_ctx.$slots, "default")
559
690
  ])) : renderSlot(_ctx.$slots, "default", { key: 2 }),
560
691
  _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
@@ -1005,17 +1136,17 @@ function useVModel(props, key, emit, options = {}) {
1005
1136
  });
1006
1137
  }
1007
1138
  }
1008
- const _hoisted_1$w = {
1139
+ const _hoisted_1$A = {
1009
1140
  key: 0,
1010
1141
  class: "v-input__start-adornment"
1011
1142
  };
1012
- const _hoisted_2$9 = ["placeholder", "rows", "name"];
1013
- const _hoisted_3$6 = ["placeholder", "type", "name"];
1143
+ const _hoisted_2$b = ["placeholder", "rows", "name"];
1144
+ const _hoisted_3$7 = ["placeholder", "type", "name"];
1014
1145
  const _hoisted_4$4 = {
1015
1146
  key: 3,
1016
1147
  class: "v-input__max-length"
1017
1148
  };
1018
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
1149
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
1019
1150
  __name: "VInput",
1020
1151
  props: {
1021
1152
  modelValue: {},
@@ -1086,7 +1217,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1086
1217
  useTextareaAutosize({ element: inputRef, input: model });
1087
1218
  }
1088
1219
  return (_ctx, _cache) => {
1089
- return openBlock(), createBlock(_sfc_main$E, {
1220
+ return openBlock(), createBlock(_sfc_main$K, {
1090
1221
  class: normalizeClass(["v-input", { large: _ctx.large, multiline: _ctx.multiline }]),
1091
1222
  error: error.value,
1092
1223
  label: _ctx.label,
@@ -1096,7 +1227,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1096
1227
  }, createSlots({
1097
1228
  default: withCtx(() => [
1098
1229
  renderSlot(_ctx.$slots, "start-adornment"),
1099
- props.prefix ? (openBlock(), createElementBlock("div", _hoisted_1$w, toDisplayString(props.prefix), 1)) : createCommentVNode("", true),
1230
+ props.prefix ? (openBlock(), createElementBlock("div", _hoisted_1$A, toDisplayString(props.prefix), 1)) : createCommentVNode("", true),
1100
1231
  props.multiline ? withDirectives((openBlock(), createElementBlock("textarea", {
1101
1232
  key: 1,
1102
1233
  ref_key: "inputRef",
@@ -1106,7 +1237,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1106
1237
  rows: props.rows,
1107
1238
  class: "scroll",
1108
1239
  name: props.name
1109
- }, null, 8, _hoisted_2$9)), [
1240
+ }, null, 8, _hoisted_2$b)), [
1110
1241
  [vModelText, model.value]
1111
1242
  ]) : withDirectives((openBlock(), createElementBlock("input", {
1112
1243
  key: 2,
@@ -1116,7 +1247,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1116
1247
  placeholder: props.placeholder,
1117
1248
  type: inputType.value,
1118
1249
  name: props.name
1119
- }, null, 8, _hoisted_3$6)), [
1250
+ }, null, 8, _hoisted_3$7)), [
1120
1251
  [vModelDynamic, model.value]
1121
1252
  ]),
1122
1253
  props.maxLength ? (openBlock(), createElementBlock("div", _hoisted_4$4, toDisplayString(model.value.length) + " / " + toDisplayString(props.maxLength), 1)) : createCommentVNode("", true),
@@ -1135,16 +1266,16 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1135
1266
  };
1136
1267
  }
1137
1268
  });
1138
- const _hoisted_1$v = { class: "blocks-list" };
1139
- const _hoisted_2$8 = { class: "page-editor-blocks__group" };
1140
- const _hoisted_3$5 = { class: "title" };
1269
+ const _hoisted_1$z = { class: "blocks-list" };
1270
+ const _hoisted_2$a = { class: "page-editor-blocks__group" };
1271
+ const _hoisted_3$6 = { class: "title" };
1141
1272
  const _hoisted_4$3 = { class: "blocks-list__blocks" };
1142
1273
  const _hoisted_5$1 = ["onMousedown"];
1143
1274
  const _hoisted_6$1 = {
1144
1275
  key: 0,
1145
1276
  class: "page-editor__nothing-found"
1146
1277
  };
1147
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
1278
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
1148
1279
  __name: "BlocksList",
1149
1280
  props: {
1150
1281
  blocks: {}
@@ -1193,16 +1324,16 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1193
1324
  });
1194
1325
  };
1195
1326
  return (_ctx, _cache) => {
1196
- return openBlock(), createElementBlock("div", _hoisted_1$v, [
1197
- createVNode(_sfc_main$D, {
1327
+ return openBlock(), createElementBlock("div", _hoisted_1$z, [
1328
+ createVNode(_sfc_main$J, {
1198
1329
  modelValue: searchValue.value,
1199
1330
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
1200
1331
  placeholder: "Поиск...",
1201
1332
  class: "page-editor-blocks__search"
1202
1333
  }, null, 8, ["modelValue"]),
1203
1334
  (openBlock(true), createElementBlock(Fragment, null, renderList(groupBlocks.value, (group) => {
1204
- return openBlock(), createElementBlock("div", _hoisted_2$8, [
1205
- createElementVNode("div", _hoisted_3$5, toDisplayString(groupNames[group.name] ?? group.name), 1),
1335
+ return openBlock(), createElementBlock("div", _hoisted_2$a, [
1336
+ createElementVNode("div", _hoisted_3$6, toDisplayString(groupNames[group.name] ?? group.name), 1),
1206
1337
  createElementVNode("div", _hoisted_4$3, [
1207
1338
  (openBlock(true), createElementBlock(Fragment, null, renderList(group.blocks, (item) => {
1208
1339
  return openBlock(), createElementBlock("button", {
@@ -1497,8 +1628,8 @@ const deleteFromArray = (arr, item) => {
1497
1628
  const uid$1 = () => {
1498
1629
  return Math.trunc(Math.random() * 1e5).toString(16);
1499
1630
  };
1500
- const _hoisted_1$u = ["onClick"];
1501
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
1631
+ const _hoisted_1$y = ["onClick"];
1632
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
1502
1633
  __name: "VTabs",
1503
1634
  props: {
1504
1635
  items: {},
@@ -1552,7 +1683,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1552
1683
  key: item.id,
1553
1684
  class: normalizeClass(["v-tabs__tab", { active: unref(model) === item.id }]),
1554
1685
  onClick: ($event) => model.value = item.id
1555
- }, toDisplayString(item.title), 11, _hoisted_1$u);
1686
+ }, toDisplayString(item.title), 11, _hoisted_1$y);
1556
1687
  }), 128))
1557
1688
  ]),
1558
1689
  _: 1
@@ -1565,8 +1696,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1565
1696
  };
1566
1697
  }
1567
1698
  });
1568
- const _hoisted_1$t = { class: "v-tabs-pages" };
1569
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
1699
+ const _hoisted_1$x = { class: "v-tabs-pages" };
1700
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
1570
1701
  __name: "VTabsPages",
1571
1702
  props: {
1572
1703
  page: {},
@@ -1585,7 +1716,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
1585
1716
  }
1586
1717
  });
1587
1718
  return (_ctx, _cache) => {
1588
- return openBlock(), createElementBlock("div", _hoisted_1$t, [
1719
+ return openBlock(), createElementBlock("div", _hoisted_1$x, [
1589
1720
  createVNode(Transition, { name: transitionClass.value }, {
1590
1721
  default: withCtx(() => [
1591
1722
  (openBlock(), createElementBlock("div", {
@@ -1601,16 +1732,16 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
1601
1732
  };
1602
1733
  }
1603
1734
  });
1604
- const _sfc_main$z = {};
1605
- const _hoisted_1$s = {
1735
+ const _sfc_main$F = {};
1736
+ const _hoisted_1$w = {
1606
1737
  width: "20",
1607
1738
  height: "20",
1608
1739
  viewBox: "0 0 20 20",
1609
1740
  fill: "none",
1610
1741
  xmlns: "http://www.w3.org/2000/svg"
1611
1742
  };
1612
- function _sfc_render$d(_ctx, _cache) {
1613
- return openBlock(), createElementBlock("svg", _hoisted_1$s, _cache[0] || (_cache[0] = [
1743
+ function _sfc_render$e(_ctx, _cache) {
1744
+ return openBlock(), createElementBlock("svg", _hoisted_1$w, _cache[0] || (_cache[0] = [
1614
1745
  createElementVNode("path", {
1615
1746
  "fill-rule": "evenodd",
1616
1747
  "clip-rule": "evenodd",
@@ -1619,8 +1750,8 @@ function _sfc_render$d(_ctx, _cache) {
1619
1750
  }, null, -1)
1620
1751
  ]));
1621
1752
  }
1622
- const CollapseArrowIcon = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$d]]);
1623
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
1753
+ const CollapseArrowIcon = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["render", _sfc_render$e]]);
1754
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
1624
1755
  __name: "VCollapse",
1625
1756
  props: {
1626
1757
  open: { type: Boolean },
@@ -1708,7 +1839,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
1708
1839
  }
1709
1840
  });
1710
1841
  const margin = 8;
1711
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
1842
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1712
1843
  ...{
1713
1844
  inheritAttrs: false
1714
1845
  },
@@ -1876,54 +2007,54 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1876
2007
  };
1877
2008
  }
1878
2009
  });
1879
- const _sfc_main$w = {};
1880
- const _hoisted_1$r = {
2010
+ const _sfc_main$C = {};
2011
+ const _hoisted_1$v = {
1881
2012
  width: "16",
1882
2013
  height: "16",
1883
2014
  viewBox: "0 0 16 16",
1884
2015
  fill: "none",
1885
2016
  xmlns: "http://www.w3.org/2000/svg"
1886
2017
  };
1887
- function _sfc_render$c(_ctx, _cache) {
1888
- return openBlock(), createElementBlock("svg", _hoisted_1$r, _cache[0] || (_cache[0] = [
2018
+ function _sfc_render$d(_ctx, _cache) {
2019
+ return openBlock(), createElementBlock("svg", _hoisted_1$v, _cache[0] || (_cache[0] = [
1889
2020
  createElementVNode("path", {
1890
2021
  d: "M14.364 5.293C14.1764 5.10553 13.9221 5.00021 13.657 5.00021C13.3918 5.00021 13.1375 5.10553 12.95 5.293L7.99995 10.243L3.04995 5.293C2.86135 5.11084 2.60875 5.01005 2.34655 5.01232C2.08435 5.0146 1.83354 5.11977 1.64813 5.30518C1.46272 5.49059 1.35756 5.7414 1.35528 6.0036C1.353 6.26579 1.45379 6.5184 1.63595 6.707L7.29295 12.364C7.48048 12.5515 7.73479 12.6568 7.99995 12.6568C8.26512 12.6568 8.51942 12.5515 8.70695 12.364L14.364 6.707C14.5514 6.51947 14.6567 6.26516 14.6567 6C14.6567 5.73483 14.5514 5.48053 14.364 5.293Z",
1891
2022
  fill: "currentColor"
1892
2023
  }, null, -1)
1893
2024
  ]));
1894
2025
  }
1895
- const ArrowDownIcon = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$c]]);
1896
- const _sfc_main$v = {};
1897
- const _hoisted_1$q = { class: "v-icon-button" };
1898
- function _sfc_render$b(_ctx, _cache) {
1899
- return openBlock(), createElementBlock("button", _hoisted_1$q, [
2026
+ const ArrowDownIcon = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$d]]);
2027
+ const _sfc_main$B = {};
2028
+ const _hoisted_1$u = { class: "v-icon-button" };
2029
+ function _sfc_render$c(_ctx, _cache) {
2030
+ return openBlock(), createElementBlock("button", _hoisted_1$u, [
1900
2031
  renderSlot(_ctx.$slots, "default")
1901
2032
  ]);
1902
2033
  }
1903
- const VIconButton = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$b]]);
1904
- const _sfc_main$u = {};
1905
- const _hoisted_1$p = {
2034
+ const VIconButton = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$c]]);
2035
+ const _sfc_main$A = {};
2036
+ const _hoisted_1$t = {
1906
2037
  width: "16",
1907
2038
  height: "16",
1908
2039
  viewBox: "0 0 16 16",
1909
2040
  fill: "none",
1910
2041
  xmlns: "http://www.w3.org/2000/svg"
1911
2042
  };
1912
- function _sfc_render$a(_ctx, _cache) {
1913
- return openBlock(), createElementBlock("svg", _hoisted_1$p, _cache[0] || (_cache[0] = [
2043
+ function _sfc_render$b(_ctx, _cache) {
2044
+ return openBlock(), createElementBlock("svg", _hoisted_1$t, _cache[0] || (_cache[0] = [
1914
2045
  createElementVNode("path", {
1915
2046
  d: "M9.31382 7.9L12.8488 4.364C12.9443 4.27176 13.0205 4.16141 13.0729 4.03941C13.1253 3.9174 13.1529 3.78618 13.1541 3.6534C13.1552 3.52062 13.1299 3.38894 13.0796 3.26605C13.0294 3.14315 12.9551 3.0315 12.8612 2.93761C12.7673 2.84371 12.6557 2.76946 12.5328 2.71918C12.4099 2.6689 12.2782 2.6436 12.1454 2.64475C12.0126 2.64591 11.8814 2.67349 11.7594 2.7259C11.6374 2.77831 11.5271 2.85449 11.4348 2.95L7.89882 6.485L4.36382 2.95C4.27157 2.85449 4.16123 2.77831 4.03922 2.7259C3.91722 2.67349 3.786 2.64591 3.65322 2.64475C3.52044 2.6436 3.38876 2.6689 3.26587 2.71918C3.14297 2.76946 3.03132 2.84371 2.93742 2.93761C2.84353 3.0315 2.76928 3.14315 2.719 3.26605C2.66872 3.38894 2.64342 3.52062 2.64457 3.6534C2.64572 3.78618 2.67331 3.9174 2.72572 4.03941C2.77813 4.16141 2.85431 4.27176 2.94982 4.364L6.48482 7.899L2.94982 11.435C2.85431 11.5273 2.77813 11.6376 2.72572 11.7596C2.67331 11.8816 2.64572 12.0128 2.64457 12.1456C2.64342 12.2784 2.66872 12.4101 2.719 12.533C2.76928 12.6559 2.84353 12.7675 2.93742 12.8614C3.03132 12.9553 3.14297 13.0295 3.26587 13.0798C3.38876 13.1301 3.52044 13.1554 3.65322 13.1543C3.786 13.1531 3.91722 13.1255 4.03922 13.0731C4.16123 13.0207 4.27157 12.9445 4.36382 12.849L7.89882 9.314L11.4348 12.849C11.5271 12.9445 11.6374 13.0207 11.7594 13.0731C11.8814 13.1255 12.0126 13.1531 12.1454 13.1543C12.2782 13.1554 12.4099 13.1301 12.5328 13.0798C12.6557 13.0295 12.7673 12.9553 12.8612 12.8614C12.9551 12.7675 13.0294 12.6559 13.0796 12.533C13.1299 12.4101 13.1552 12.2784 13.1541 12.1456C13.1529 12.0128 13.1253 11.8816 13.0729 11.7596C13.0205 11.6376 12.9443 11.5273 12.8488 11.435L9.31382 7.9Z",
1916
2047
  fill: "currentColor"
1917
2048
  }, null, -1)
1918
2049
  ]));
1919
2050
  }
1920
- const CloseMinIcon = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$a]]);
1921
- const _hoisted_1$o = { key: 0 };
1922
- const _hoisted_2$7 = {
2051
+ const CloseMinIcon = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$b]]);
2052
+ const _hoisted_1$s = { key: 0 };
2053
+ const _hoisted_2$9 = {
1923
2054
  key: 1,
1924
2055
  class: "v-select__placeholder"
1925
2056
  };
1926
- const _hoisted_3$4 = { class: "v-select__actions" };
2057
+ const _hoisted_3$5 = { class: "v-select__actions" };
1927
2058
  const _hoisted_4$2 = { class: "v-select__menu" };
1928
2059
  const _hoisted_5 = {
1929
2060
  key: 0,
@@ -1934,11 +2065,10 @@ const _hoisted_6 = {
1934
2065
  class: "group-title"
1935
2066
  };
1936
2067
  const _hoisted_7 = ["onClick"];
1937
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
2068
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
1938
2069
  __name: "VSelect",
1939
- props: {
2070
+ props: /* @__PURE__ */ mergeModels({
1940
2071
  items: {},
1941
- modelValue: {},
1942
2072
  placeholder: {},
1943
2073
  nullable: { type: Boolean },
1944
2074
  visualValue: {},
@@ -1946,12 +2076,14 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1946
2076
  label: {},
1947
2077
  required: { type: Boolean },
1948
2078
  disabled: { type: Boolean }
1949
- },
2079
+ }, {
2080
+ "modelValue": { default: null },
2081
+ "modelModifiers": {}
2082
+ }),
1950
2083
  emits: ["update:modelValue"],
1951
- setup(__props, { emit: __emit }) {
2084
+ setup(__props) {
1952
2085
  const props = __props;
1953
- const emit = __emit;
1954
- const model = useVModel(props, "modelValue", emit, { passive: true, defaultValue: null });
2086
+ const model = useModel(__props, "modelValue");
1955
2087
  const currentItem = computed(() => {
1956
2088
  if (model.value === null) return null;
1957
2089
  return props.items.find((item) => typeof item !== "string" && item.id === model.value) ?? null;
@@ -1969,7 +2101,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1969
2101
  opened.value = false;
1970
2102
  };
1971
2103
  return (_ctx, _cache) => {
1972
- return openBlock(), createBlock(_sfc_main$E, {
2104
+ return openBlock(), createBlock(_sfc_main$K, {
1973
2105
  outline: "",
1974
2106
  class: "v-select",
1975
2107
  label: props.label,
@@ -1978,7 +2110,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1978
2110
  required: props.required
1979
2111
  }, {
1980
2112
  default: withCtx(() => [
1981
- createVNode(_sfc_main$x, {
2113
+ createVNode(_sfc_main$D, {
1982
2114
  open: opened.value,
1983
2115
  "onUpdate:open": _cache[0] || (_cache[0] = ($event) => opened.value = $event),
1984
2116
  placement: "bottom",
@@ -1989,12 +2121,12 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1989
2121
  createElementVNode("button", mergeProps({
1990
2122
  class: ["v-select__activator", { opened: opened.value }]
1991
2123
  }, activatorProps), [
1992
- currentItem.value ? (openBlock(), createElementBlock("div", _hoisted_1$o, toDisplayString(currentItem.value.title), 1)) : (openBlock(), createElementBlock("div", _hoisted_2$7, toDisplayString(props.placeholder ?? "Выберите значение"), 1)),
2124
+ currentItem.value ? (openBlock(), createElementBlock("div", _hoisted_1$s, toDisplayString(currentItem.value.title), 1)) : (openBlock(), createElementBlock("div", _hoisted_2$9, toDisplayString(props.placeholder ?? "Выберите значение"), 1)),
1993
2125
  createVNode(ArrowDownIcon)
1994
2126
  ], 16),
1995
- createElementVNode("div", _hoisted_3$4, [
2127
+ createElementVNode("div", _hoisted_3$5, [
1996
2128
  renderSlot(_ctx.$slots, "default"),
1997
- _ctx.nullable && unref(model) ? (openBlock(), createBlock(VIconButton, {
2129
+ _ctx.nullable && model.value ? (openBlock(), createBlock(VIconButton, {
1998
2130
  key: 0,
1999
2131
  title: "Очистить значение",
2000
2132
  class: "v-select__delete-button",
@@ -2013,7 +2145,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2013
2145
  return openBlock(), createElementBlock(Fragment, null, [
2014
2146
  item === "" ? (openBlock(), createElementBlock("div", _hoisted_5)) : typeof item === "string" ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(item), 1)) : (openBlock(), createElementBlock("button", {
2015
2147
  key: 2,
2016
- class: normalizeClass({ active: item.id === unref(model) }),
2148
+ class: normalizeClass({ active: item.id === model.value }),
2017
2149
  onClick: ($event) => onItemClick(item)
2018
2150
  }, [
2019
2151
  renderSlot(_ctx.$slots, "item", { item }, () => [
@@ -2032,8 +2164,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2032
2164
  };
2033
2165
  }
2034
2166
  });
2035
- const _hoisted_1$n = { class: "json-editor__array" };
2036
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
2167
+ const _hoisted_1$r = { class: "json-editor__array" };
2168
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
2037
2169
  __name: "JsonEditorArray",
2038
2170
  props: {
2039
2171
  label: {},
@@ -2066,20 +2198,20 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
2066
2198
  return `${props.label} (${length.value})`;
2067
2199
  });
2068
2200
  return (_ctx, _cache) => {
2069
- return openBlock(), createElementBlock("div", _hoisted_1$n, [
2070
- createVNode(_sfc_main$y, {
2201
+ return openBlock(), createElementBlock("div", _hoisted_1$r, [
2202
+ createVNode(_sfc_main$E, {
2071
2203
  label: label.value,
2072
2204
  open: props.expanded
2073
2205
  }, {
2074
2206
  default: withCtx(() => [
2075
- createVNode(_sfc_main$D, {
2207
+ createVNode(_sfc_main$J, {
2076
2208
  label: "Количество элементов",
2077
2209
  modelValue: length.value,
2078
2210
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => length.value = $event),
2079
2211
  type: "number"
2080
2212
  }, null, 8, ["modelValue"]),
2081
2213
  (openBlock(true), createElementBlock(Fragment, null, renderList(length.value, (index) => {
2082
- return openBlock(), createBlock(_sfc_main$6, {
2214
+ return openBlock(), createBlock(_sfc_main$c, {
2083
2215
  key: index,
2084
2216
  schema: props.schema.items,
2085
2217
  name: `${props.schema.itemName ?? "Элемент"} ${index}`,
@@ -2095,38 +2227,38 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
2095
2227
  };
2096
2228
  }
2097
2229
  });
2098
- const _sfc_main$r = {};
2099
- const _hoisted_1$m = {
2230
+ const _sfc_main$x = {};
2231
+ const _hoisted_1$q = {
2100
2232
  width: "46",
2101
2233
  height: "28",
2102
2234
  viewBox: "0 0 46 28",
2103
2235
  fill: "none",
2104
2236
  xmlns: "http://www.w3.org/2000/svg"
2105
2237
  };
2106
- function _sfc_render$9(_ctx, _cache) {
2107
- return openBlock(), createElementBlock("svg", _hoisted_1$m, _cache[0] || (_cache[0] = [
2238
+ function _sfc_render$a(_ctx, _cache) {
2239
+ return openBlock(), createElementBlock("svg", _hoisted_1$q, _cache[0] || (_cache[0] = [
2108
2240
  createStaticVNode('<mask id="mask0_1044_6" style="mask-type:luminance;" maskUnits="userSpaceOnUse" x="0" y="0" width="46" height="28"><path d="M45.5 0H0.5V28H45.5V0Z" fill="white"></path></mask><g mask="url(#mask0_1044_6)"><path d="M23.5 27.8537C35.9264 27.8537 46 25.6664 46 22.9683C46 20.2702 35.9264 18.083 23.5 18.083C11.0736 18.083 1 20.2702 1 22.9683C1 25.6664 11.0736 27.8537 23.5 27.8537Z" fill="#D7D7D7"></path><path d="M39.6719 9.5459L32.538 1.51859C32.1955 0.971432 31.6956 0.640625 31.169 0.640625H15.831C15.3044 0.640625 14.8045 0.971432 14.462 1.51789L7.32812 9.5466V15.9946H39.6719V9.5459Z" stroke="#A0A0A0" stroke-width="0.703125"></path><path d="M30.2591 11.7594C30.2591 10.6393 30.958 9.71457 31.825 9.71387H39.6719V22.3718C39.6719 23.8534 38.7437 25.0678 37.5977 25.0678H9.40234C8.25625 25.0678 7.32812 23.8527 7.32812 22.3718V9.71387H15.175C16.042 9.71387 16.7409 10.6372 16.7409 11.7573V11.7727C16.7409 12.8928 17.4475 13.7973 18.3138 13.7973H28.6862C29.5525 13.7973 30.2591 12.8845 30.2591 11.7643V11.7594Z" fill="#FAFAFA" stroke="#A0A0A0" stroke-width="0.703125"></path></g>', 2)
2109
2241
  ]));
2110
2242
  }
2111
- const EmptyFileIcon = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$9]]);
2112
- const _sfc_main$q = {};
2113
- const _hoisted_1$l = {
2243
+ const EmptyFileIcon = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$a]]);
2244
+ const _sfc_main$w = {};
2245
+ const _hoisted_1$p = {
2114
2246
  width: "24",
2115
2247
  height: "24",
2116
2248
  viewBox: "0 0 24 24",
2117
2249
  fill: "none",
2118
2250
  xmlns: "http://www.w3.org/2000/svg"
2119
2251
  };
2120
- function _sfc_render$8(_ctx, _cache) {
2121
- return openBlock(), createElementBlock("svg", _hoisted_1$l, _cache[0] || (_cache[0] = [
2252
+ function _sfc_render$9(_ctx, _cache) {
2253
+ return openBlock(), createElementBlock("svg", _hoisted_1$p, _cache[0] || (_cache[0] = [
2122
2254
  createElementVNode("path", {
2123
2255
  d: "M14 18C14 18.5304 13.7893 19.0391 13.4142 19.4142C13.0391 19.7893 12.5304 20 12 20C11.4696 20 10.9609 19.7893 10.5858 19.4142C10.2107 19.0391 10 18.5304 10 18C10 17.4696 10.2107 16.9609 10.5858 16.5858C10.9609 16.2107 11.4696 16 12 16C12.5304 16 13.0391 16.2107 13.4142 16.5858C13.7893 16.9609 14 17.4696 14 18ZM14 12C14 12.5304 13.7893 13.0391 13.4142 13.4142C13.0391 13.7893 12.5304 14 12 14C11.4696 14 10.9609 13.7893 10.5858 13.4142C10.2107 13.0391 10 12.5304 10 12C10 11.4696 10.2107 10.9609 10.5858 10.5858C10.9609 10.2107 11.4696 10 12 10C12.5304 10 13.0391 10.2107 13.4142 10.5858C13.7893 10.9609 14 11.4696 14 12ZM12 8C12.5304 8 13.0391 7.78929 13.4142 7.41421C13.7893 7.03914 14 6.53043 14 6C14 5.46957 13.7893 4.96086 13.4142 4.58579C13.0391 4.21071 12.5304 4 12 4C11.4696 4 10.9609 4.21071 10.5858 4.58579C10.2107 4.96086 10 5.46957 10 6C10 6.53043 10.2107 7.03914 10.5858 7.41421C10.9609 7.78929 11.4696 8 12 8Z",
2124
2256
  fill: "currentColor"
2125
2257
  }, null, -1)
2126
2258
  ]));
2127
2259
  }
2128
- const MoreIcon = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$8]]);
2129
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
2260
+ const MoreIcon = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$9]]);
2261
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
2130
2262
  __name: "VButton",
2131
2263
  props: {
2132
2264
  component: {},
@@ -2179,13 +2311,14 @@ const useContextMenu = (creator) => {
2179
2311
  open
2180
2312
  };
2181
2313
  };
2182
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
2314
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
2183
2315
  __name: "VContextMenu",
2184
2316
  props: {
2185
2317
  open: { type: Boolean },
2186
2318
  placement: {},
2187
2319
  anchorPosition: {},
2188
2320
  offset: {},
2321
+ fitAnchor: { type: Boolean },
2189
2322
  items: { type: [Array, Function] }
2190
2323
  },
2191
2324
  emits: ["update:open"],
@@ -2219,18 +2352,19 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
2219
2352
  return (_ctx, _cache) => {
2220
2353
  return openBlock(), createElementBlock(Fragment, null, [
2221
2354
  renderSlot(_ctx.$slots, "activator", { props: activatorProps }),
2222
- createVNode(_sfc_main$x, {
2355
+ createVNode(_sfc_main$D, {
2223
2356
  open: unref(open),
2224
2357
  "onUpdate:open": _cache[0] || (_cache[0] = ($event) => isRef(open) ? open.value = $event : null),
2225
2358
  element: activatorElement.value,
2226
2359
  anchorPosition: props.anchorPosition,
2227
2360
  placement: props.placement ?? "bottom-start",
2228
2361
  offset: _ctx.offset,
2362
+ fitAnchor: props.fitAnchor,
2229
2363
  class: "v-context-menu"
2230
2364
  }, {
2231
2365
  default: withCtx(() => [
2232
2366
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
2233
- return openBlock(), createBlock(_sfc_main$p, mergeProps({ ref_for: true }, item.props, {
2367
+ return openBlock(), createBlock(_sfc_main$v, mergeProps({ ref_for: true }, item.props, {
2234
2368
  class: "v-context-menu__item",
2235
2369
  onClick: ($event) => onItemClick(item)
2236
2370
  }), {
@@ -2242,7 +2376,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
2242
2376
  }), 256))
2243
2377
  ]),
2244
2378
  _: 1
2245
- }, 8, ["open", "element", "anchorPosition", "placement", "offset"])
2379
+ }, 8, ["open", "element", "anchorPosition", "placement", "offset", "fitAnchor"])
2246
2380
  ], 64);
2247
2381
  };
2248
2382
  }
@@ -2271,7 +2405,7 @@ const createDialogSystem = () => {
2271
2405
  };
2272
2406
  };
2273
2407
  const useDialog = () => inject("dialogStore");
2274
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
2408
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2275
2409
  __name: "VDialogProvider",
2276
2410
  setup(__props) {
2277
2411
  const dialogStore = inject("dialogStore");
@@ -2308,7 +2442,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2308
2442
  default: withCtx(() => [
2309
2443
  unref(dialogStore).isOpen.value ? (openBlock(), createElementBlock("div", {
2310
2444
  key: 0,
2311
- class: "v-dialog-backdrop",
2445
+ class: "v-dialog-backdrop editor-component",
2312
2446
  onMousedown: onMouseDown,
2313
2447
  onMouseup: onMouseUp
2314
2448
  }, [
@@ -2328,15 +2462,15 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2328
2462
  };
2329
2463
  }
2330
2464
  });
2331
- const _hoisted_1$k = {
2465
+ const _hoisted_1$o = {
2332
2466
  key: 0,
2333
2467
  class: "v-dialog__header heading"
2334
2468
  };
2335
- const _hoisted_2$6 = {
2469
+ const _hoisted_2$8 = {
2336
2470
  key: 1,
2337
2471
  class: "v-dialog__actions"
2338
2472
  };
2339
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
2473
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
2340
2474
  __name: "VDialog",
2341
2475
  props: {
2342
2476
  "content:class": {},
@@ -2352,7 +2486,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2352
2486
  role: "dialog"
2353
2487
  }, {
2354
2488
  default: withCtx(() => [
2355
- unref(slots).header ? (openBlock(), createElementBlock("div", _hoisted_1$k, [
2489
+ unref(slots).header ? (openBlock(), createElementBlock("div", _hoisted_1$o, [
2356
2490
  renderSlot(_ctx.$slots, "header"),
2357
2491
  createVNode(VIconButton, {
2358
2492
  role: "button",
@@ -2370,7 +2504,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2370
2504
  }, [
2371
2505
  renderSlot(_ctx.$slots, "default")
2372
2506
  ], 2),
2373
- unref(slots).actions ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
2507
+ unref(slots).actions ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
2374
2508
  renderSlot(_ctx.$slots, "actions")
2375
2509
  ])) : createCommentVNode("", true)
2376
2510
  ]),
@@ -2379,13 +2513,13 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2379
2513
  };
2380
2514
  }
2381
2515
  });
2382
- const _hoisted_1$j = {
2516
+ const _hoisted_1$n = {
2383
2517
  key: 0,
2384
2518
  class: "project-images__grid"
2385
2519
  };
2386
- const _hoisted_2$5 = ["onClick"];
2387
- const _hoisted_3$3 = ["src"];
2388
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
2520
+ const _hoisted_2$7 = ["onClick"];
2521
+ const _hoisted_3$4 = ["src"];
2522
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
2389
2523
  __name: "ProjectImagesDialog",
2390
2524
  props: {
2391
2525
  fileRequest: { type: Function },
@@ -2400,20 +2534,20 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2400
2534
  dialog.back();
2401
2535
  };
2402
2536
  return (_ctx, _cache) => {
2403
- return openBlock(), createBlock(_sfc_main$m, { style: { "width": "900px" } }, {
2537
+ return openBlock(), createBlock(_sfc_main$s, { style: { "width": "900px" } }, {
2404
2538
  header: withCtx(() => _cache[0] || (_cache[0] = [
2405
2539
  createTextVNode("Изображения проекта")
2406
2540
  ])),
2407
2541
  default: withCtx(() => [
2408
- unref(data) ? (openBlock(), createElementBlock("div", _hoisted_1$j, [
2542
+ unref(data) ? (openBlock(), createElementBlock("div", _hoisted_1$n, [
2409
2543
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(data), (item) => {
2410
2544
  return openBlock(), createElementBlock("button", {
2411
2545
  onClick: ($event) => openImage(item)
2412
2546
  }, [
2413
2547
  createElementVNode("img", {
2414
2548
  src: item.previewSrc ?? item.src
2415
- }, null, 8, _hoisted_3$3)
2416
- ], 8, _hoisted_2$5);
2549
+ }, null, 8, _hoisted_3$4)
2550
+ ], 8, _hoisted_2$7);
2417
2551
  }), 256))
2418
2552
  ])) : createCommentVNode("", true)
2419
2553
  ]),
@@ -2422,14 +2556,14 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2422
2556
  };
2423
2557
  }
2424
2558
  });
2425
- const _hoisted_1$i = {
2559
+ const _hoisted_1$m = {
2426
2560
  key: 0,
2427
2561
  class: "v-image-uploader__drag-label"
2428
2562
  };
2429
- const _hoisted_2$4 = { class: "v-image-uploader__image-preview" };
2430
- const _hoisted_3$2 = ["src"];
2563
+ const _hoisted_2$6 = { class: "v-image-uploader__image-preview" };
2564
+ const _hoisted_3$3 = ["src"];
2431
2565
  const _hoisted_4$1 = { class: "v-image-uploader__image-info" };
2432
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
2566
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2433
2567
  __name: "VImageUploader",
2434
2568
  props: {
2435
2569
  accept: {},
@@ -2495,10 +2629,10 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2495
2629
  emit("update:modelValue", image);
2496
2630
  };
2497
2631
  if (fileRequest) {
2498
- contextMenuItems.push({ title: "Выбрать из файлов проекта", onClick: () => dialog.open(_sfc_main$l, { fileRequest, onOpenImage }) });
2632
+ contextMenuItems.push({ title: "Выбрать из файлов проекта", onClick: () => dialog.open(_sfc_main$r, { fileRequest, onOpenImage }) });
2499
2633
  }
2500
2634
  return (_ctx, _cache) => {
2501
- return openBlock(), createBlock(_sfc_main$E, {
2635
+ return openBlock(), createBlock(_sfc_main$K, {
2502
2636
  class: normalizeClass(["v-image-uploader", { drag: drag.value }]),
2503
2637
  error: _ctx.error,
2504
2638
  label: _ctx.label,
@@ -2510,7 +2644,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2510
2644
  onDragleave: onDragLeave
2511
2645
  }, {
2512
2646
  default: withCtx(() => [
2513
- drag.value ? (openBlock(), createElementBlock("div", _hoisted_1$i, "Отпустите файл здесь")) : !props.modelValue || props.modelValue.src === unref(defaultImageSrc) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2647
+ drag.value ? (openBlock(), createElementBlock("div", _hoisted_1$m, "Отпустите файл здесь")) : !props.modelValue || props.modelValue.src === unref(defaultImageSrc) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2514
2648
  createVNode(EmptyFileIcon),
2515
2649
  createElementVNode("div", null, [
2516
2650
  createElementVNode("a", {
@@ -2518,7 +2652,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2518
2652
  }, "Загрузите изображение"),
2519
2653
  _cache[1] || (_cache[1] = createElementVNode("br", null, null, -1)),
2520
2654
  _cache[2] || (_cache[2] = createTextVNode("или перетащите сюда ")),
2521
- contextMenuItems.length > 0 ? (openBlock(), createBlock(_sfc_main$o, {
2655
+ contextMenuItems.length > 0 ? (openBlock(), createBlock(_sfc_main$u, {
2522
2656
  key: 0,
2523
2657
  items: contextMenuItems,
2524
2658
  placement: "bottom-end"
@@ -2535,11 +2669,11 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2535
2669
  })) : createCommentVNode("", true)
2536
2670
  ])
2537
2671
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2538
- createElementVNode("div", _hoisted_2$4, [
2672
+ createElementVNode("div", _hoisted_2$6, [
2539
2673
  createElementVNode("img", {
2540
2674
  src: props.modelValue.previewSrc ?? props.modelValue.src,
2541
2675
  alt: "Preview Image"
2542
- }, null, 8, _hoisted_3$2),
2676
+ }, null, 8, _hoisted_3$3),
2543
2677
  createVNode(VIconButton, {
2544
2678
  class: "v-image-uploader__delete-button",
2545
2679
  onClick: removeImage
@@ -2560,33 +2694,33 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2560
2694
  };
2561
2695
  }
2562
2696
  });
2563
- const _sfc_main$j = {};
2564
- const _hoisted_1$h = {
2697
+ const _sfc_main$p = {};
2698
+ const _hoisted_1$l = {
2565
2699
  width: "18",
2566
2700
  height: "18",
2567
2701
  viewBox: "0 0 18 18",
2568
2702
  fill: "none",
2569
2703
  xmlns: "http://www.w3.org/2000/svg"
2570
2704
  };
2571
- function _sfc_render$7(_ctx, _cache) {
2572
- return openBlock(), createElementBlock("svg", _hoisted_1$h, _cache[0] || (_cache[0] = [
2705
+ function _sfc_render$8(_ctx, _cache) {
2706
+ return openBlock(), createElementBlock("svg", _hoisted_1$l, _cache[0] || (_cache[0] = [
2573
2707
  createElementVNode("path", {
2574
2708
  d: "M14.0326 5.40749C13.9629 5.33719 13.8799 5.28139 13.7885 5.24332C13.6971 5.20524 13.5991 5.18564 13.5001 5.18564C13.4011 5.18564 13.303 5.20524 13.2117 5.24332C13.1203 5.28139 13.0373 5.33719 12.9676 5.40749L7.38008 11.0025L5.03258 8.64749C4.96019 8.57756 4.87474 8.52257 4.7811 8.48567C4.68745 8.44877 4.58746 8.43067 4.48683 8.43241C4.38619 8.43415 4.28688 8.4557 4.19457 8.49582C4.10227 8.53594 4.01876 8.59385 3.94883 8.66624C3.87891 8.73863 3.82392 8.82408 3.78702 8.91773C3.75011 9.01137 3.73202 9.11136 3.73376 9.212C3.7355 9.31263 3.75704 9.41194 3.79716 9.50425C3.83728 9.59656 3.89519 9.68006 3.96758 9.74999L6.84758 12.63C6.91731 12.7003 7.00026 12.7561 7.09165 12.7942C7.18305 12.8322 7.28108 12.8518 7.38008 12.8518C7.47909 12.8518 7.57712 12.8322 7.66852 12.7942C7.75991 12.7561 7.84286 12.7003 7.91258 12.63L14.0326 6.50999C14.1087 6.43976 14.1695 6.35452 14.211 6.25964C14.2526 6.16477 14.274 6.06231 14.274 5.95874C14.274 5.85516 14.2526 5.75271 14.211 5.65783C14.1695 5.56296 14.1087 5.47772 14.0326 5.40749Z",
2575
2709
  fill: "currentColor"
2576
2710
  }, null, -1)
2577
2711
  ]));
2578
2712
  }
2579
- const CheckIcon = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$7]]);
2580
- const _hoisted_1$g = {
2713
+ const CheckIcon = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$8]]);
2714
+ const _hoisted_1$k = {
2581
2715
  key: 0,
2582
2716
  class: "v-checkbox__label left"
2583
2717
  };
2584
- const _hoisted_2$3 = ["name"];
2585
- const _hoisted_3$1 = {
2718
+ const _hoisted_2$5 = ["name"];
2719
+ const _hoisted_3$2 = {
2586
2720
  key: 1,
2587
2721
  class: "v-checkbox__label"
2588
2722
  };
2589
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
2723
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
2590
2724
  __name: "VCheckbox",
2591
2725
  props: /* @__PURE__ */ mergeModels({
2592
2726
  label: {},
@@ -2618,7 +2752,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2618
2752
  onClick,
2619
2753
  onKeydown: onClick
2620
2754
  }, [
2621
- labelPosition.value === "left" ? (openBlock(), createElementBlock("div", _hoisted_1$g, [
2755
+ labelPosition.value === "left" ? (openBlock(), createElementBlock("div", _hoisted_1$k, [
2622
2756
  renderSlot(_ctx.$slots, "label", {}, () => [
2623
2757
  createTextVNode(toDisplayString(props.label), 1)
2624
2758
  ])
@@ -2632,10 +2766,10 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2632
2766
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
2633
2767
  type: "checkbox",
2634
2768
  name: props.name
2635
- }, null, 8, _hoisted_2$3), [
2769
+ }, null, 8, _hoisted_2$5), [
2636
2770
  [vModelCheckbox, model.value]
2637
2771
  ]),
2638
- labelPosition.value === "right" ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
2772
+ labelPosition.value === "right" ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
2639
2773
  renderSlot(_ctx.$slots, "label", {}, () => [
2640
2774
  createTextVNode(toDisplayString(props.label), 1)
2641
2775
  ])
@@ -2655,16 +2789,16 @@ const capitalize = (text) => {
2655
2789
  const spaceCamelCase = (str) => {
2656
2790
  return capitalize(str.replace(/([A-Z])/g, " $1").trimStart());
2657
2791
  };
2658
- const _sfc_main$h = {};
2659
- const _hoisted_1$f = {
2792
+ const _sfc_main$n = {};
2793
+ const _hoisted_1$j = {
2660
2794
  width: "24",
2661
2795
  height: "24",
2662
2796
  viewBox: "0 0 24 24",
2663
2797
  fill: "none",
2664
2798
  xmlns: "http://www.w3.org/2000/svg"
2665
2799
  };
2666
- function _sfc_render$6(_ctx, _cache) {
2667
- return openBlock(), createElementBlock("svg", _hoisted_1$f, _cache[0] || (_cache[0] = [
2800
+ function _sfc_render$7(_ctx, _cache) {
2801
+ return openBlock(), createElementBlock("svg", _hoisted_1$j, _cache[0] || (_cache[0] = [
2668
2802
  createElementVNode("path", {
2669
2803
  "fill-rule": "evenodd",
2670
2804
  "clip-rule": "evenodd",
@@ -2673,9 +2807,9 @@ function _sfc_render$6(_ctx, _cache) {
2673
2807
  }, null, -1)
2674
2808
  ]));
2675
2809
  }
2676
- const EditIcon = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$6]]);
2677
- const _hoisted_1$e = { class: "v-link-editor__custom" };
2678
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
2810
+ const EditIcon = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$7]]);
2811
+ const _hoisted_1$i = { class: "v-link-editor__custom" };
2812
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2679
2813
  __name: "VLinkEditor",
2680
2814
  props: /* @__PURE__ */ mergeModels({
2681
2815
  nullable: { type: Boolean }
@@ -2730,7 +2864,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2730
2864
  return arr;
2731
2865
  });
2732
2866
  return (_ctx, _cache) => {
2733
- return openBlock(), createBlock(_sfc_main$t, {
2867
+ return openBlock(), createBlock(_sfc_main$z, {
2734
2868
  class: "v-link-editor",
2735
2869
  modelValue: linkType.value,
2736
2870
  "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => linkType.value = $event),
@@ -2738,7 +2872,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2738
2872
  nullable: props.nullable
2739
2873
  }, {
2740
2874
  default: withCtx(() => [
2741
- model.value && model.value.id ? (openBlock(), createBlock(_sfc_main$x, {
2875
+ model.value && model.value.id ? (openBlock(), createBlock(_sfc_main$D, {
2742
2876
  key: 0,
2743
2877
  offset: 4,
2744
2878
  placement: "bottom-end"
@@ -2754,27 +2888,27 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2754
2888
  default: withCtx(() => {
2755
2889
  var _a;
2756
2890
  return [
2757
- createElementVNode("div", _hoisted_1$e, [
2758
- model.value.id === "_external" ? (openBlock(), createBlock(_sfc_main$D, {
2891
+ createElementVNode("div", _hoisted_1$i, [
2892
+ model.value.id === "_external" ? (openBlock(), createBlock(_sfc_main$J, {
2759
2893
  key: 0,
2760
2894
  modelValue: model.value.url,
2761
2895
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value.url = $event),
2762
2896
  label: "URL ссылки",
2763
2897
  autofocus: ""
2764
2898
  }, null, 8, ["modelValue"])) : createCommentVNode("", true),
2765
- model.value.id !== "_external" ? (openBlock(), createBlock(_sfc_main$D, {
2899
+ model.value.id !== "_external" ? (openBlock(), createBlock(_sfc_main$J, {
2766
2900
  key: 1,
2767
2901
  modelValue: model.value.query,
2768
2902
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.value.query = $event),
2769
2903
  label: "Якорь",
2770
2904
  prefix: (_a = model.value) == null ? void 0 : _a.url
2771
2905
  }, null, 8, ["modelValue", "prefix"])) : createCommentVNode("", true),
2772
- createVNode(_sfc_main$D, {
2906
+ createVNode(_sfc_main$J, {
2773
2907
  modelValue: model.value.title,
2774
2908
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => model.value.title = $event),
2775
2909
  label: "Заголовок"
2776
2910
  }, null, 8, ["modelValue"]),
2777
- createVNode(_sfc_main$i, {
2911
+ createVNode(_sfc_main$o, {
2778
2912
  modelValue: model.value.openNewTab,
2779
2913
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => model.value.openNewTab = $event),
2780
2914
  label: "Открывать в новой вкладке"
@@ -2790,10 +2924,10 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2790
2924
  };
2791
2925
  }
2792
2926
  });
2793
- var __defProp = Object.defineProperty;
2794
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2795
- var __publicField = (obj, key, value) => {
2796
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2927
+ var __defProp2 = Object.defineProperty;
2928
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2929
+ var __publicField2 = (obj, key, value) => {
2930
+ __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
2797
2931
  return value;
2798
2932
  };
2799
2933
  function tryOnScopeDispose(fn) {
@@ -2933,12 +3067,12 @@ const isEqual = (a, b) => {
2933
3067
  };
2934
3068
  class TextEditorHistory {
2935
3069
  constructor(store) {
2936
- __publicField(this, "actions", []);
2937
- __publicField(this, "currentCursor", 0);
2938
- __publicField(this, "blocksIds", "");
2939
- __publicField(this, "cachedBlocksJson", "");
2940
- __publicField(this, "store");
2941
- __publicField(this, "tickStarted", false);
3070
+ __publicField2(this, "actions", []);
3071
+ __publicField2(this, "currentCursor", 0);
3072
+ __publicField2(this, "blocksIds", "");
3073
+ __publicField2(this, "cachedBlocksJson", "");
3074
+ __publicField2(this, "store");
3075
+ __publicField2(this, "tickStarted", false);
2942
3076
  this.store = store;
2943
3077
  window.showHistory = () => console.log(this.actions);
2944
3078
  }
@@ -3019,22 +3153,22 @@ class TextEditorHistory {
3019
3153
  }
3020
3154
  class TextEditorStore {
3021
3155
  constructor() {
3022
- __publicField(this, "history", new TextEditorHistory(this));
3023
- __publicField(this, "blocks", reactive([{ id: uid(), text: "", styles: [] }]));
3024
- __publicField(this, "selection", reactive({
3156
+ __publicField2(this, "history", new TextEditorHistory(this));
3157
+ __publicField2(this, "blocks", reactive([{ id: uid(), text: "", styles: [] }]));
3158
+ __publicField2(this, "selection", reactive({
3025
3159
  anchor: { blockId: this.blocks[0].id, offset: 0 },
3026
3160
  focus: { blockId: this.blocks[0].id, offset: 0 }
3027
3161
  }));
3028
- __publicField(this, "_isCollapsed", computed(() => {
3162
+ __publicField2(this, "_isCollapsed", computed(() => {
3029
3163
  return this.selection.anchor.blockId === this.selection.focus.blockId && this.selection.anchor.offset === this.selection.focus.offset;
3030
3164
  }));
3031
- __publicField(this, "isFocused", ref(false));
3032
- __publicField(this, "_currentBlock", computed(() => {
3165
+ __publicField2(this, "isFocused", ref(false));
3166
+ __publicField2(this, "_currentBlock", computed(() => {
3033
3167
  if (this.selection.anchor.blockId !== this.selection.focus.blockId)
3034
3168
  return null;
3035
3169
  return this.blocks.find((item) => item.id === this.selection.anchor.blockId) ?? null;
3036
3170
  }));
3037
- __publicField(this, "_selectedText", computed(() => {
3171
+ __publicField2(this, "_selectedText", computed(() => {
3038
3172
  if (this.isCollapsed)
3039
3173
  return "";
3040
3174
  const [start, end, startIndex, endIndex] = this.startAndEnd;
@@ -3046,7 +3180,7 @@ class TextEditorStore {
3046
3180
  const arr = [startText, ...this.blocks.slice(startIndex + 1, endIndex).map((block) => block.text), endText];
3047
3181
  return arr.join("\n");
3048
3182
  }));
3049
- __publicField(this, "_currentStyles", computed(() => {
3183
+ __publicField2(this, "_currentStyles", computed(() => {
3050
3184
  const [start, end, startIndex, endIndex] = this.startAndEnd;
3051
3185
  const styles = /* @__PURE__ */ new Map();
3052
3186
  if (startIndex < 0)
@@ -4012,11 +4146,11 @@ const codeParser = (text) => {
4012
4146
  }
4013
4147
  return arr;
4014
4148
  };
4015
- const _hoisted_1$d = {
4149
+ const _hoisted_1$h = {
4016
4150
  class: "code-editor",
4017
4151
  contenteditable: false
4018
4152
  };
4019
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
4153
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
4020
4154
  __name: "RichTextEditorCode",
4021
4155
  props: {
4022
4156
  modelValue: {}
@@ -4044,7 +4178,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4044
4178
  }
4045
4179
  };
4046
4180
  return (_ctx, _cache) => {
4047
- return openBlock(), createElementBlock("div", _hoisted_1$d, [
4181
+ return openBlock(), createElementBlock("div", _hoisted_1$h, [
4048
4182
  createVNode(unref(_sfc_main$1$1), {
4049
4183
  modelValue: model.value,
4050
4184
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
@@ -4059,113 +4193,113 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4059
4193
  };
4060
4194
  }
4061
4195
  });
4062
- const _sfc_main$e = {};
4063
- const _hoisted_1$c = {
4196
+ const _sfc_main$k = {};
4197
+ const _hoisted_1$g = {
4064
4198
  width: "16",
4065
4199
  height: "16",
4066
4200
  viewBox: "0 0 16 16",
4067
4201
  fill: "none",
4068
4202
  xmlns: "http://www.w3.org/2000/svg"
4069
4203
  };
4070
- function _sfc_render$5(_ctx, _cache) {
4071
- return openBlock(), createElementBlock("svg", _hoisted_1$c, _cache[0] || (_cache[0] = [
4204
+ function _sfc_render$6(_ctx, _cache) {
4205
+ return openBlock(), createElementBlock("svg", _hoisted_1$g, _cache[0] || (_cache[0] = [
4072
4206
  createElementVNode("path", {
4073
4207
  d: "M4 2H8.5C9.14255 2.0002 9.77266 2.17723 10.3213 2.51171C10.8699 2.84618 11.3159 3.32519 11.6105 3.89627C11.905 4.46734 12.0367 5.10846 11.9911 5.7494C11.9455 6.39033 11.7244 7.00636 11.352 7.53C11.9979 7.93183 12.4953 8.53322 12.7688 9.24307C13.0423 9.95292 13.077 10.7326 12.8676 11.4639C12.6583 12.1952 12.2163 12.8384 11.6086 13.2961C11.001 13.7537 10.2607 14.0008 9.5 14H4C3.73478 14 3.48043 13.8946 3.29289 13.7071C3.10536 13.5196 3 13.2652 3 13V3C3 2.73478 3.10536 2.48043 3.29289 2.29289C3.48043 2.10536 3.73478 2 4 2ZM5 9V12H9.5C9.89782 12 10.2794 11.842 10.5607 11.5607C10.842 11.2794 11 10.8978 11 10.5C11 10.1022 10.842 9.72064 10.5607 9.43934C10.2794 9.15804 9.89782 9 9.5 9H5ZM8.5 7C8.89782 7 9.27936 6.84196 9.56066 6.56066C9.84196 6.27936 10 5.89782 10 5.5C10 5.10218 9.84196 4.72064 9.56066 4.43934C9.27936 4.15804 8.89782 4 8.5 4H5V7H8.5Z",
4074
4208
  fill: "currentColor"
4075
4209
  }, null, -1)
4076
4210
  ]));
4077
4211
  }
4078
- const TextBoldIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$5]]);
4079
- const _sfc_main$d = {};
4080
- const _hoisted_1$b = {
4212
+ const TextBoldIcon = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$6]]);
4213
+ const _sfc_main$j = {};
4214
+ const _hoisted_1$f = {
4081
4215
  width: "16",
4082
4216
  height: "16",
4083
4217
  viewBox: "0 0 16 16",
4084
4218
  fill: "none",
4085
4219
  xmlns: "http://www.w3.org/2000/svg"
4086
4220
  };
4087
- function _sfc_render$4(_ctx, _cache) {
4088
- return openBlock(), createElementBlock("svg", _hoisted_1$b, _cache[0] || (_cache[0] = [
4221
+ function _sfc_render$5(_ctx, _cache) {
4222
+ return openBlock(), createElementBlock("svg", _hoisted_1$f, _cache[0] || (_cache[0] = [
4089
4223
  createElementVNode("path", {
4090
4224
  d: "M6 2.75C6 2.55109 6.07902 2.36032 6.21967 2.21967C6.36032 2.07902 6.55109 2 6.75 2H13.25C13.4489 2 13.6397 2.07902 13.7803 2.21967C13.921 2.36032 14 2.55109 14 2.75C14 2.94891 13.921 3.13968 13.7803 3.28033C13.6397 3.42098 13.4489 3.5 13.25 3.5H10.745L6.887 12.5H9.25C9.44891 12.5 9.63968 12.579 9.78033 12.7197C9.92098 12.8603 10 13.0511 10 13.25C10 13.4489 9.92098 13.6397 9.78033 13.7803C9.63968 13.921 9.44891 14 9.25 14H2.75C2.55109 14 2.36032 13.921 2.21967 13.7803C2.07902 13.6397 2 13.4489 2 13.25C2 13.0511 2.07902 12.8603 2.21967 12.7197C2.36032 12.579 2.55109 12.5 2.75 12.5H5.255L9.113 3.5H6.75C6.55109 3.5 6.36032 3.42098 6.21967 3.28033C6.07902 3.13968 6 2.94891 6 2.75Z",
4091
4225
  fill: "currentColor"
4092
4226
  }, null, -1)
4093
4227
  ]));
4094
4228
  }
4095
- const TextItalicIcon = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$4]]);
4096
- const _sfc_main$c = {};
4097
- const _hoisted_1$a = {
4229
+ const TextItalicIcon = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$5]]);
4230
+ const _sfc_main$i = {};
4231
+ const _hoisted_1$e = {
4098
4232
  width: "16",
4099
4233
  height: "16",
4100
4234
  viewBox: "0 0 16 16",
4101
4235
  fill: "none",
4102
4236
  xmlns: "http://www.w3.org/2000/svg"
4103
4237
  };
4104
- function _sfc_render$3(_ctx, _cache) {
4105
- return openBlock(), createElementBlock("svg", _hoisted_1$a, _cache[0] || (_cache[0] = [
4238
+ function _sfc_render$4(_ctx, _cache) {
4239
+ return openBlock(), createElementBlock("svg", _hoisted_1$e, _cache[0] || (_cache[0] = [
4106
4240
  createElementVNode("path", {
4107
4241
  d: "M8 11.0625C9.16032 11.0625 10.2731 10.6016 11.0936 9.78109C11.9141 8.96062 12.375 7.84782 12.375 6.6875V2.3125C12.375 2.08044 12.2828 1.85788 12.1187 1.69378C11.9546 1.52969 11.7321 1.4375 11.5 1.4375C11.2679 1.4375 11.0454 1.52969 10.8813 1.69378C10.7172 1.85788 10.625 2.08044 10.625 2.3125V6.6875C10.625 7.38369 10.3484 8.05137 9.85616 8.54366C9.36387 9.03594 8.69619 9.3125 8 9.3125C7.30381 9.3125 6.63613 9.03594 6.14384 8.54366C5.65156 8.05137 5.375 7.38369 5.375 6.6875V2.3125C5.375 2.08044 5.28281 1.85788 5.11872 1.69378C4.95462 1.52969 4.73206 1.4375 4.5 1.4375C4.26794 1.4375 4.04538 1.52969 3.88128 1.69378C3.71719 1.85788 3.625 2.08044 3.625 2.3125V6.6875C3.625 7.84782 4.08594 8.96062 4.90641 9.78109C5.72688 10.6016 6.83968 11.0625 8 11.0625ZM12.375 12.8125H3.625C3.39294 12.8125 3.17038 12.9047 3.00628 13.0688C2.84219 13.2329 2.75 13.4554 2.75 13.6875C2.75 13.9196 2.84219 14.1421 3.00628 14.3062C3.17038 14.4703 3.39294 14.5625 3.625 14.5625H12.375C12.6071 14.5625 12.8296 14.4703 12.9937 14.3062C13.1578 14.1421 13.25 13.9196 13.25 13.6875C13.25 13.4554 13.1578 13.2329 12.9937 13.0688C12.8296 12.9047 12.6071 12.8125 12.375 12.8125Z",
4108
4242
  fill: "currentColor"
4109
4243
  }, null, -1)
4110
4244
  ]));
4111
4245
  }
4112
- const TextUnderlineIcon = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$3]]);
4113
- const _sfc_main$b = {};
4114
- const _hoisted_1$9 = {
4246
+ const TextUnderlineIcon = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$4]]);
4247
+ const _sfc_main$h = {};
4248
+ const _hoisted_1$d = {
4115
4249
  width: "16",
4116
4250
  height: "16",
4117
4251
  viewBox: "0 0 16 16",
4118
4252
  fill: "none",
4119
4253
  xmlns: "http://www.w3.org/2000/svg"
4120
4254
  };
4121
- function _sfc_render$2(_ctx, _cache) {
4122
- return openBlock(), createElementBlock("svg", _hoisted_1$9, _cache[0] || (_cache[0] = [
4255
+ function _sfc_render$3(_ctx, _cache) {
4256
+ return openBlock(), createElementBlock("svg", _hoisted_1$d, _cache[0] || (_cache[0] = [
4123
4257
  createElementVNode("path", {
4124
4258
  d: "M11.055 8.5C11.579 9.036 11.87 9.757 11.866 10.507C11.8673 10.9659 11.7676 11.4195 11.574 11.8357C11.3805 12.2518 11.0978 12.6203 10.746 12.915C9.948 13.597 8.748 14 7.096 14C5.39 14 3.992 13.393 3.194 12.623C3.06263 12.4823 2.99028 12.2966 2.99188 12.1041C2.99349 11.9117 3.06893 11.7272 3.20264 11.5887C3.33634 11.4503 3.5181 11.3684 3.7104 11.3601C3.90269 11.3518 4.09084 11.4176 4.236 11.544C4.716 12.007 5.723 12.5 7.096 12.5C8.518 12.5 9.328 12.154 9.772 11.774C10.207 11.402 10.366 10.935 10.366 10.507C10.366 10.035 10.158 9.65 9.719 9.31C9.271 8.964 8.603 8.687 7.768 8.5H1.75C1.55109 8.5 1.36032 8.42098 1.21967 8.28033C1.07902 8.13968 1 7.94891 1 7.75C1 7.55109 1.07902 7.36032 1.21967 7.21967C1.36032 7.07902 1.55109 7 1.75 7H14.25C14.4489 7 14.6397 7.07902 14.7803 7.21967C14.921 7.36032 15 7.55109 15 7.75C15 7.94891 14.921 8.13968 14.7803 8.28033C14.6397 8.42098 14.4489 8.5 14.25 8.5H11.055ZM7.581 3.25C5.545 3.25 4.803 4.332 4.803 5.036C4.803 5.09067 4.805 5.143 4.809 5.193C4.82412 5.39138 4.75981 5.58764 4.63022 5.73861C4.50063 5.88958 4.31638 5.98288 4.118 5.998C3.91962 6.01312 3.72336 5.94881 3.57239 5.81922C3.42142 5.68963 3.32812 5.50538 3.313 5.307C3.3066 5.21681 3.30327 5.12642 3.303 5.036C3.303 3.204 5.053 1.75 7.581 1.75C8.999 1.75 10.302 2.33 11.095 2.843C11.1777 2.89645 11.2491 2.96567 11.3051 3.04671C11.3611 3.12775 11.4006 3.21902 11.4213 3.31532C11.442 3.41161 11.4435 3.51104 11.4258 3.60793C11.4081 3.70482 11.3714 3.79727 11.318 3.88C11.2646 3.96273 11.1953 4.03413 11.1143 4.09011C11.0333 4.14609 10.942 4.18556 10.8457 4.20627C10.7494 4.22698 10.65 4.22852 10.5531 4.2108C10.4562 4.19308 10.3637 4.15645 10.281 4.103C9.641 3.689 8.619 3.25 7.581 3.25Z",
4125
4259
  fill: "currentColor"
4126
4260
  }, null, -1)
4127
4261
  ]));
4128
4262
  }
4129
- const TextStrikethroughIcon = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$2]]);
4130
- const _sfc_main$a = {};
4131
- const _hoisted_1$8 = {
4263
+ const TextStrikethroughIcon = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$3]]);
4264
+ const _sfc_main$g = {};
4265
+ const _hoisted_1$c = {
4132
4266
  width: "16",
4133
4267
  height: "16",
4134
4268
  viewBox: "0 0 16 16",
4135
4269
  fill: "none",
4136
4270
  xmlns: "http://www.w3.org/2000/svg"
4137
4271
  };
4138
- function _sfc_render$1(_ctx, _cache) {
4139
- return openBlock(), createElementBlock("svg", _hoisted_1$8, _cache[0] || (_cache[0] = [
4272
+ function _sfc_render$2(_ctx, _cache) {
4273
+ return openBlock(), createElementBlock("svg", _hoisted_1$c, _cache[0] || (_cache[0] = [
4140
4274
  createElementVNode("path", {
4141
4275
  d: "M14.8574 13.3334V2.66669C14.8574 1.8286 14.1716 1.14288 13.3335 1.14288H2.66688C1.82878 1.14288 1.14307 1.8286 1.14307 2.66669V13.3334C1.14307 14.1715 1.82878 14.8572 2.66688 14.8572H13.3335C14.1716 14.8572 14.8574 14.1715 14.8574 13.3334ZM5.33354 9.14288L7.2383 11.4362L9.90497 8.00003L13.3335 12.5715H2.66688L5.33354 9.14288Z",
4142
4276
  fill: "currentColor"
4143
4277
  }, null, -1)
4144
4278
  ]));
4145
4279
  }
4146
- const ImageSolidIcon = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$1]]);
4147
- const _sfc_main$9 = {};
4148
- const _hoisted_1$7 = {
4280
+ const ImageSolidIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$2]]);
4281
+ const _sfc_main$f = {};
4282
+ const _hoisted_1$b = {
4149
4283
  width: "16",
4150
4284
  height: "16",
4151
4285
  viewBox: "0 0 16 16",
4152
4286
  fill: "none",
4153
4287
  xmlns: "http://www.w3.org/2000/svg"
4154
4288
  };
4155
- function _sfc_render(_ctx, _cache) {
4156
- return openBlock(), createElementBlock("svg", _hoisted_1$7, _cache[0] || (_cache[0] = [
4289
+ function _sfc_render$1(_ctx, _cache) {
4290
+ return openBlock(), createElementBlock("svg", _hoisted_1$b, _cache[0] || (_cache[0] = [
4157
4291
  createElementVNode("path", {
4158
4292
  d: "M10.189 2.04806C10.605 2.19806 10.8186 2.65181 10.6674 3.06281L6.83704 13.4788C6.68504 13.8898 6.22664 14.1013 5.81144 13.9521C5.39544 13.8021 5.18184 13.3483 5.33304 12.9373L9.16344 2.52131C9.31544 2.11031 9.77384 1.89881 10.189 2.04806ZM1.93144 8.19206L4.76024 10.9926C5.07224 11.3016 5.07224 11.8026 4.76024 12.1116C4.68811 12.1847 4.60063 12.243 4.50329 12.2829C4.40596 12.3228 4.30087 12.3434 4.19464 12.3434C4.08841 12.3434 3.98332 12.3228 3.88599 12.2829C3.78865 12.243 3.70117 12.1847 3.62904 12.1116L0.234639 8.75231C0.084409 8.59988 0.000976562 8.39997 0.000976562 8.19244C0.000976562 7.9849 0.084409 7.78499 0.234639 7.63256L3.62904 4.27256C3.70117 4.19944 3.78865 4.1411 3.88599 4.1012C3.98332 4.0613 4.08841 4.0407 4.19464 4.0407C4.30087 4.0407 4.40596 4.0613 4.50329 4.1012C4.60063 4.1411 4.68811 4.19944 4.76024 4.27256C4.9107 4.42503 4.99427 4.6251 4.99427 4.83281C4.99427 5.04052 4.9107 5.24059 4.76024 5.39306L1.93144 8.19206ZM14.069 8.19206L11.2402 5.39306C11.09 5.24063 11.0066 5.04072 11.0066 4.83319C11.0066 4.62565 11.09 4.42574 11.2402 4.27331C11.3124 4.20019 11.3998 4.14185 11.4972 4.10195C11.5945 4.06205 11.6996 4.04145 11.8058 4.04145C11.9121 4.04145 12.0172 4.06205 12.1145 4.10195C12.2118 4.14185 12.2993 4.20019 12.3714 4.27331L15.7658 7.63256C16.0778 7.94156 16.0778 8.44256 15.7658 8.75231L12.3714 12.1108C12.2993 12.1839 12.2118 12.2423 12.1145 12.2822C12.0172 12.3221 11.9121 12.3427 11.8058 12.3427C11.6996 12.3427 11.5945 12.3221 11.4972 12.2822C11.3998 12.2423 11.3124 12.1839 11.2402 12.1108C11.0902 11.9584 11.0069 11.7587 11.0069 11.5513C11.0069 11.344 11.0902 11.1442 11.2402 10.9918L14.069 8.19206Z",
4159
4293
  fill: "currentColor"
4160
4294
  }, null, -1)
4161
4295
  ]));
4162
4296
  }
4163
- const CodeIcon = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render]]);
4164
- const _hoisted_1$6 = { class: "rich-text-editor__controls" };
4165
- const _hoisted_2$2 = { class: "rich-text-editor__actions-group" };
4166
- const _hoisted_3 = ["onClick"];
4297
+ const CodeIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$1]]);
4298
+ const _hoisted_1$a = { class: "rich-text-editor__controls" };
4299
+ const _hoisted_2$4 = { class: "rich-text-editor__actions-group" };
4300
+ const _hoisted_3$1 = ["onClick"];
4167
4301
  const _hoisted_4 = { class: "rich-text-editor__actions-group" };
4168
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4302
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4169
4303
  __name: "RichTextEditorDialog",
4170
4304
  props: /* @__PURE__ */ mergeModels({
4171
4305
  label: {}
@@ -4254,26 +4388,26 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4254
4388
  (_a = textEditorRef.value) == null ? void 0 : _a.insertBlock({ type: "image", editable: false, text: "" });
4255
4389
  };
4256
4390
  return (_ctx, _cache) => {
4257
- return openBlock(), createBlock(_sfc_main$m, { class: "rich-text-editor__dialog" }, {
4391
+ return openBlock(), createBlock(_sfc_main$s, { class: "rich-text-editor__dialog" }, {
4258
4392
  header: withCtx(() => [
4259
4393
  createTextVNode(toDisplayString(props.label ?? "Редактирование текста"), 1)
4260
4394
  ]),
4261
4395
  default: withCtx(() => [
4262
- createElementVNode("div", _hoisted_1$6, [
4263
- createVNode(_sfc_main$t, {
4396
+ createElementVNode("div", _hoisted_1$a, [
4397
+ createVNode(_sfc_main$z, {
4264
4398
  modelValue: blockType.value,
4265
4399
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => blockType.value = $event),
4266
4400
  items: blockTypes,
4267
4401
  style: { "width": "200px" }
4268
4402
  }, null, 8, ["modelValue"]),
4269
- createElementVNode("div", _hoisted_2$2, [
4403
+ createElementVNode("div", _hoisted_2$4, [
4270
4404
  (openBlock(true), createElementBlock(Fragment, null, renderList(styles.value, (item) => {
4271
4405
  return openBlock(), createElementBlock("button", {
4272
4406
  class: normalizeClass({ active: item.active }),
4273
4407
  onClick: item.onClick
4274
4408
  }, [
4275
4409
  (openBlock(), createBlock(resolveDynamicComponent(item.icon)))
4276
- ], 10, _hoisted_3);
4410
+ ], 10, _hoisted_3$1);
4277
4411
  }), 256))
4278
4412
  ]),
4279
4413
  createElementVNode("div", _hoisted_4, [
@@ -4302,7 +4436,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4302
4436
  onKeydown: onKeyDown
4303
4437
  }, {
4304
4438
  code: withCtx(({ props: props2, block }) => [
4305
- createVNode(_sfc_main$f, mergeProps({
4439
+ createVNode(_sfc_main$l, mergeProps({
4306
4440
  modelValue: block.text,
4307
4441
  "onUpdate:modelValue": ($event) => block.text = $event
4308
4442
  }, props2, {
@@ -4319,7 +4453,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4319
4453
  image: withCtx(({ props: props2, block }) => {
4320
4454
  var _a;
4321
4455
  return [
4322
- createVNode(_sfc_main$k, mergeProps({
4456
+ createVNode(_sfc_main$q, mergeProps({
4323
4457
  modelValue: block.image,
4324
4458
  "onUpdate:modelValue": ($event) => block.image = $event
4325
4459
  }, props2, {
@@ -4343,8 +4477,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4343
4477
  };
4344
4478
  }
4345
4479
  });
4346
- const _hoisted_1$5 = { class: "v-form-control__outline" };
4347
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4480
+ const _hoisted_1$9 = { class: "v-form-control__outline" };
4481
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4348
4482
  __name: "VRichTextEditor",
4349
4483
  props: /* @__PURE__ */ mergeModels({
4350
4484
  label: {}
@@ -4358,26 +4492,26 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4358
4492
  const model = useModel(__props, "modelValue");
4359
4493
  const dialog = useDialog();
4360
4494
  const openTextEditor = () => {
4361
- dialog.open(_sfc_main$8, {
4495
+ dialog.open(_sfc_main$e, {
4362
4496
  label: props.label,
4363
4497
  modelValue: model.value,
4364
4498
  ["onUpdate:modelValue"]: (val) => model.value = val
4365
4499
  });
4366
4500
  };
4367
4501
  return (_ctx, _cache) => {
4368
- return openBlock(), createBlock(_sfc_main$E, {
4502
+ return openBlock(), createBlock(_sfc_main$K, {
4369
4503
  label: props.label,
4370
4504
  class: "rich-text-editor"
4371
4505
  }, {
4372
4506
  default: withCtx(() => [
4373
- createElementVNode("div", _hoisted_1$5, [
4507
+ createElementVNode("div", _hoisted_1$9, [
4374
4508
  createVNode(unref(_sfc_main$1$1), {
4375
4509
  modelValue: model.value,
4376
4510
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
4377
4511
  class: "rich-text-editor__editor"
4378
4512
  }, null, 8, ["modelValue"])
4379
4513
  ]),
4380
- createVNode(_sfc_main$p, { onClick: openTextEditor }, {
4514
+ createVNode(_sfc_main$v, { onClick: openTextEditor }, {
4381
4515
  default: withCtx(() => _cache[1] || (_cache[1] = [
4382
4516
  createTextVNode("Редактировать")
4383
4517
  ])),
@@ -4390,11 +4524,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4390
4524
  };
4391
4525
  }
4392
4526
  });
4393
- const _hoisted_1$4 = {
4527
+ const _hoisted_1$8 = {
4394
4528
  key: 3,
4395
4529
  class: "json-editor__object"
4396
4530
  };
4397
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4531
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4398
4532
  __name: "JsonEditor",
4399
4533
  props: /* @__PURE__ */ mergeModels({
4400
4534
  schema: {},
@@ -4427,26 +4561,26 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4427
4561
  };
4428
4562
  return (_ctx, _cache) => {
4429
4563
  const _component_JsonEditor = resolveComponent("JsonEditor", true);
4430
- return props.schema.type === "object" && props.schema.format === "image" ? (openBlock(), createBlock(_sfc_main$k, {
4564
+ return props.schema.type === "object" && props.schema.format === "image" ? (openBlock(), createBlock(_sfc_main$q, {
4431
4565
  key: 0,
4432
4566
  modelValue: vModel.value,
4433
4567
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vModel.value = $event),
4434
4568
  label: props.schema.name ?? props.name,
4435
4569
  schema: props.schema
4436
- }, null, 8, ["modelValue", "label", "schema"])) : props.schema.type === "object" && props.schema.format === "smartLink" ? (openBlock(), createBlock(_sfc_main$g, {
4570
+ }, null, 8, ["modelValue", "label", "schema"])) : props.schema.type === "object" && props.schema.format === "smartLink" ? (openBlock(), createBlock(_sfc_main$m, {
4437
4571
  key: 1,
4438
4572
  modelValue: vModel.value,
4439
4573
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vModel.value = $event),
4440
4574
  label: props.schema.name ?? props.name,
4441
4575
  schema: props.schema,
4442
4576
  nullable: props.schema.nullable || props.nullable
4443
- }, null, 8, ["modelValue", "label", "schema", "nullable"])) : props.schema.type === "array" && props.schema.format === "richText" ? (openBlock(), createBlock(_sfc_main$7, {
4577
+ }, null, 8, ["modelValue", "label", "schema", "nullable"])) : props.schema.type === "array" && props.schema.format === "richText" ? (openBlock(), createBlock(_sfc_main$d, {
4444
4578
  key: 2,
4445
4579
  modelValue: vModel.value,
4446
4580
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vModel.value = $event),
4447
4581
  label: props.schema.name ?? props.name,
4448
4582
  schema: props.schema
4449
- }, null, 8, ["modelValue", "label", "schema"])) : props.schema.type === "object" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
4583
+ }, null, 8, ["modelValue", "label", "schema"])) : props.schema.type === "object" ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
4450
4584
  props.flat ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(props.schema.properties, (item, key) => {
4451
4585
  var _a;
4452
4586
  return openBlock(), createBlock(_component_JsonEditor, {
@@ -4458,7 +4592,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4458
4592
  name: unref(spaceCamelCase)(key),
4459
4593
  nullable: !((_a = props.schema.required) == null ? void 0 : _a.includes(key))
4460
4594
  }, null, 8, ["modelValue", "onUpdate:modelValue", "schema", "expanded", "name", "nullable"]);
4461
- }), 128)) : (openBlock(), createBlock(_sfc_main$y, {
4595
+ }), 128)) : (openBlock(), createBlock(_sfc_main$E, {
4462
4596
  key: 1,
4463
4597
  label: props.schema.name ?? props.name,
4464
4598
  open: props.expanded
@@ -4479,26 +4613,26 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4479
4613
  ]),
4480
4614
  _: 1
4481
4615
  }, 8, ["label", "open"]))
4482
- ])) : props.schema.type === "array" ? (openBlock(), createBlock(_sfc_main$s, {
4616
+ ])) : props.schema.type === "array" ? (openBlock(), createBlock(_sfc_main$y, {
4483
4617
  key: 4,
4484
4618
  modelValue: vModel.value,
4485
4619
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vModel.value = $event),
4486
4620
  schema: props.schema,
4487
4621
  label: props.schema.name ?? props.name,
4488
4622
  expanded: props.expanded
4489
- }, null, 8, ["modelValue", "schema", "label", "expanded"])) : props.schema.type === "string" && props.schema.enum ? (openBlock(), createBlock(_sfc_main$t, {
4623
+ }, null, 8, ["modelValue", "schema", "label", "expanded"])) : props.schema.type === "string" && props.schema.enum ? (openBlock(), createBlock(_sfc_main$z, {
4490
4624
  key: 5,
4491
4625
  nullable: props.schema.nullable || props.nullable,
4492
4626
  items: getItems(props.schema),
4493
4627
  modelValue: vModel.value,
4494
4628
  "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vModel.value = $event),
4495
4629
  label: props.schema.name ?? props.name
4496
- }, null, 8, ["nullable", "items", "modelValue", "label"])) : props.schema.type === "boolean" ? (openBlock(), createBlock(_sfc_main$i, {
4630
+ }, null, 8, ["nullable", "items", "modelValue", "label"])) : props.schema.type === "boolean" ? (openBlock(), createBlock(_sfc_main$o, {
4497
4631
  key: 6,
4498
4632
  modelValue: vModel.value,
4499
4633
  "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vModel.value = $event),
4500
4634
  label: props.schema.name ?? props.name
4501
- }, null, 8, ["modelValue", "label"])) : (openBlock(), createBlock(_sfc_main$D, {
4635
+ }, null, 8, ["modelValue", "label"])) : (openBlock(), createBlock(_sfc_main$J, {
4502
4636
  key: 7,
4503
4637
  modelValue: vModel.value,
4504
4638
  "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => vModel.value = $event),
@@ -4508,8 +4642,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4508
4642
  };
4509
4643
  }
4510
4644
  });
4511
- const _hoisted_1$3 = { key: 2 };
4512
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4645
+ const _hoisted_1$7 = { key: 2 };
4646
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4513
4647
  __name: "BlocksEditor",
4514
4648
  props: {
4515
4649
  blocksList: {},
@@ -4579,24 +4713,24 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4579
4713
  }, ["stop"]))
4580
4714
  }, [
4581
4715
  renderSlot(_ctx.$slots, "default"),
4582
- createVNode(_sfc_main$B, {
4716
+ createVNode(_sfc_main$H, {
4583
4717
  modelValue: currentTab.value,
4584
4718
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currentTab.value = $event),
4585
4719
  items: tabs.value
4586
4720
  }, null, 8, ["modelValue", "items"]),
4587
- createVNode(_sfc_main$A, { page: currentTab.value }, {
4721
+ createVNode(_sfc_main$G, { page: currentTab.value }, {
4588
4722
  blocks: withCtx(() => [
4589
- createVNode(_sfc_main$C, { blocks: _ctx.blocksList }, null, 8, ["blocks"])
4723
+ createVNode(_sfc_main$I, { blocks: _ctx.blocksList }, null, 8, ["blocks"])
4590
4724
  ]),
4591
4725
  blockEdit: withCtx(() => [
4592
- currentBlock.value && currentContentBlock.value ? (openBlock(), createBlock(_sfc_main$6, {
4726
+ currentBlock.value && currentContentBlock.value ? (openBlock(), createBlock(_sfc_main$c, {
4593
4727
  key: currentContentBlock.value.id,
4594
4728
  schema: currentBlock.value.props,
4595
4729
  modelValue: currentContentBlock.value.data,
4596
4730
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => currentContentBlock.value.data = $event),
4597
4731
  flat: ""
4598
4732
  }, null, 8, ["schema", "modelValue"])) : currentDataEntry.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
4599
- props.dataEntryScopes ? (openBlock(), createBlock(_sfc_main$t, {
4733
+ props.dataEntryScopes ? (openBlock(), createBlock(_sfc_main$z, {
4600
4734
  key: 0,
4601
4735
  modelValue: props.dataEntryScopes[currentDataEntry.value.id],
4602
4736
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => props.dataEntryScopes[currentDataEntry.value.id] = $event),
@@ -4604,14 +4738,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4604
4738
  label: "Применить настройки",
4605
4739
  items: settingSelectItems
4606
4740
  }, null, 8, ["modelValue"])) : createCommentVNode("", true),
4607
- (openBlock(), createBlock(_sfc_main$6, {
4741
+ (openBlock(), createBlock(_sfc_main$c, {
4608
4742
  key: currentDataEntry.value.id,
4609
4743
  schema: currentDataEntry.value.props,
4610
4744
  modelValue: _ctx.state.data[currentDataEntry.value.id],
4611
4745
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.state.data[currentDataEntry.value.id] = $event),
4612
4746
  flat: ""
4613
4747
  }, null, 8, ["schema", "modelValue"]))
4614
- ], 64)) : (openBlock(), createElementBlock("div", _hoisted_1$3, "Схема для блока не найдена"))
4748
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_1$7, "Схема для блока не найдена"))
4615
4749
  ]),
4616
4750
  _: 1
4617
4751
  }, 8, ["page"])
@@ -4619,9 +4753,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4619
4753
  };
4620
4754
  }
4621
4755
  });
4622
- const _hoisted_1$2 = ["onBlockdrop", "onMousedown", "onMouseenter", "onClick", "onContextmenu"];
4623
- const _hoisted_2$1 = ["onBlockdrop"];
4624
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4756
+ const _hoisted_1$6 = ["onBlockdrop", "onMousedown", "onMouseenter", "onClick", "onContextmenu"];
4757
+ const _hoisted_2$3 = ["onBlockdrop"];
4758
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4625
4759
  __name: "ContentHierarchy",
4626
4760
  props: {
4627
4761
  contentBlocks: {},
@@ -4855,23 +4989,23 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4855
4989
  onMouseleave: _cache[0] || (_cache[0] = ($event) => emit("update:hoverBlockId", null)),
4856
4990
  onClick: ($event) => emit("update:activeBlockId", item.content.id),
4857
4991
  onContextmenu: withModifiers(($event) => unref(contextMenu).open($event, item.content), ["stop"])
4858
- }, toDisplayString(item.block.name), 47, _hoisted_1$2);
4992
+ }, toDisplayString(item.block.name), 47, _hoisted_1$6);
4859
4993
  }), 256)),
4860
4994
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(places), (item) => {
4861
4995
  return openBlock(), createElementBlock("div", {
4862
4996
  class: "page-editor-hierarhy__place",
4863
4997
  style: normalizeStyle(item.style),
4864
4998
  onBlockdrop: ($event) => onPlaceBlockDrop($event, item.index)
4865
- }, null, 44, _hoisted_2$1);
4999
+ }, null, 44, _hoisted_2$3);
4866
5000
  }), 256)),
4867
- createVNode(_sfc_main$o, normalizeProps(guardReactiveProps(unref(contextMenu).props)), null, 16)
5001
+ createVNode(_sfc_main$u, normalizeProps(guardReactiveProps(unref(contextMenu).props)), null, 16)
4868
5002
  ], 512);
4869
5003
  };
4870
5004
  }
4871
5005
  });
4872
- const _hoisted_1$1 = { key: 0 };
4873
- const _hoisted_2 = ["onClick"];
4874
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
5006
+ const _hoisted_1$5 = { key: 0 };
5007
+ const _hoisted_2$2 = ["onClick"];
5008
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4875
5009
  __name: "ContentSettings",
4876
5010
  props: /* @__PURE__ */ mergeModels({
4877
5011
  dataEntries: {}
@@ -4884,19 +5018,19 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
4884
5018
  const props = __props;
4885
5019
  const model = useModel(__props, "modelValue");
4886
5020
  return (_ctx, _cache) => {
4887
- return props.dataEntries.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
5021
+ return props.dataEntries.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
4888
5022
  (openBlock(true), createElementBlock(Fragment, null, renderList(props.dataEntries, (item) => {
4889
5023
  var _a;
4890
5024
  return openBlock(), createElementBlock("div", {
4891
5025
  class: normalizeClass(["page-editor-hierarchy__item", { active: ((_a = model.value) == null ? void 0 : _a.slice(5)) === item.id }]),
4892
5026
  onClick: ($event) => model.value = "data:" + item.id
4893
- }, toDisplayString(item.title ?? item.id), 11, _hoisted_2);
5027
+ }, toDisplayString(item.title ?? item.id), 11, _hoisted_2$2);
4894
5028
  }), 256))
4895
5029
  ])) : createCommentVNode("", true);
4896
5030
  };
4897
5031
  }
4898
5032
  });
4899
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5033
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4900
5034
  __name: "HierarchySidebar",
4901
5035
  props: {
4902
5036
  state: {},
@@ -4914,13 +5048,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4914
5048
  }, [
4915
5049
  renderSlot(_ctx.$slots, "default"),
4916
5050
  _cache[4] || (_cache[4] = createElementVNode("div", { class: "title" }, "Настройки", -1)),
4917
- createVNode(_sfc_main$3, {
5051
+ createVNode(_sfc_main$9, {
4918
5052
  modelValue: props.control.activeBlockId.value,
4919
5053
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => props.control.activeBlockId.value = $event),
4920
5054
  dataEntries: props.dataEntries
4921
5055
  }, null, 8, ["modelValue", "dataEntries"]),
4922
5056
  _cache[5] || (_cache[5] = createElementVNode("div", { class: "title" }, "Блоки", -1)),
4923
- createVNode(_sfc_main$4, {
5057
+ createVNode(_sfc_main$a, {
4924
5058
  "hover-block-id": props.control.hoverBlockId.value,
4925
5059
  "onUpdate:hoverBlockId": _cache[1] || (_cache[1] = ($event) => props.control.hoverBlockId.value = $event),
4926
5060
  "active-block-id": props.control.activeBlockId.value,
@@ -5088,6 +5222,440 @@ const useControlComponent = (_activeBlockId) => {
5088
5222
  onScroll
5089
5223
  };
5090
5224
  };
5225
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
5226
+ __name: "FormColumn",
5227
+ props: {
5228
+ spacing: {},
5229
+ size: {}
5230
+ },
5231
+ setup(__props) {
5232
+ const props = __props;
5233
+ return (_ctx, _cache) => {
5234
+ return openBlock(), createElementBlock("div", {
5235
+ class: normalizeClass(["form-column", [
5236
+ props.spacing ? `spacing-${props.spacing}` : void 0,
5237
+ props.size ? `size-${props.size}` : void 0
5238
+ ]])
5239
+ }, [
5240
+ renderSlot(_ctx.$slots, "default")
5241
+ ], 2);
5242
+ };
5243
+ }
5244
+ });
5245
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
5246
+ __name: "CreatePageDialog",
5247
+ props: {
5248
+ folders: {},
5249
+ folderId: {},
5250
+ item: {},
5251
+ onCreate: { type: Function }
5252
+ },
5253
+ setup(__props) {
5254
+ const props = __props;
5255
+ const { register, handleSubmit, pending, values, updateDefaultValues } = useForm({
5256
+ name: "",
5257
+ path: "/",
5258
+ folderId: props.folderId ?? null
5259
+ });
5260
+ if (props.item) {
5261
+ updateDefaultValues(props.item);
5262
+ }
5263
+ const folders = computed(() => {
5264
+ const arr = props.folders ? props.folders.map((item) => ({ id: item.id, title: item.name })) : [];
5265
+ return arr;
5266
+ });
5267
+ const currentFoler = computed(() => {
5268
+ if (!values.folderId) return null;
5269
+ return props.folders.find((item) => item.id === values.folderId);
5270
+ });
5271
+ const dialog = useDialog();
5272
+ const apply = handleSubmit(async (values2) => {
5273
+ await props.onCreate(values2);
5274
+ dialog.close();
5275
+ });
5276
+ return (_ctx, _cache) => {
5277
+ return openBlock(), createBlock(_sfc_main$s, { style: { "width": "500px" } }, {
5278
+ header: withCtx(() => [
5279
+ createTextVNode(toDisplayString(props.item ? "Редактировать" : "Создать") + " страницу", 1)
5280
+ ]),
5281
+ actions: withCtx(() => [
5282
+ createVNode(_sfc_main$v, {
5283
+ disabled: unref(pending),
5284
+ large: "",
5285
+ onClick: unref(apply)
5286
+ }, {
5287
+ default: withCtx(() => [
5288
+ createTextVNode(toDisplayString(props.item ? "Сохранить" : "Создать"), 1)
5289
+ ]),
5290
+ _: 1
5291
+ }, 8, ["disabled", "onClick"])
5292
+ ]),
5293
+ default: withCtx(() => [
5294
+ createVNode(_sfc_main$7, null, {
5295
+ default: withCtx(() => {
5296
+ var _a;
5297
+ return [
5298
+ createVNode(_sfc_main$J, mergeProps(unref(register)("name"), {
5299
+ label: "Название страницы",
5300
+ autofocus: ""
5301
+ }), null, 16),
5302
+ createVNode(_sfc_main$J, mergeProps(unref(register)("path"), {
5303
+ prefix: (_a = currentFoler.value) == null ? void 0 : _a.path,
5304
+ label: "URL адрес"
5305
+ }), null, 16, ["prefix"]),
5306
+ folders.value.length > 0 ? (openBlock(), createBlock(_sfc_main$z, mergeProps({
5307
+ key: 0,
5308
+ nullable: ""
5309
+ }, unref(register)("folderId"), {
5310
+ items: folders.value,
5311
+ label: "Папка"
5312
+ }), null, 16, ["items"])) : createCommentVNode("", true)
5313
+ ];
5314
+ }),
5315
+ _: 1
5316
+ })
5317
+ ]),
5318
+ _: 1
5319
+ });
5320
+ };
5321
+ }
5322
+ });
5323
+ const _hoisted_1$4 = { class: "v-table__header" };
5324
+ const _hoisted_2$1 = { key: 0 };
5325
+ const _hoisted_3 = {
5326
+ key: 0,
5327
+ class: "v-table__group-label"
5328
+ };
5329
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
5330
+ __name: "VTable",
5331
+ props: /* @__PURE__ */ mergeModels({
5332
+ data: {},
5333
+ clickable: { type: Boolean },
5334
+ checkable: { type: Boolean },
5335
+ to: { type: Function },
5336
+ useHref: { type: Boolean },
5337
+ groupBy: {},
5338
+ columns: {}
5339
+ }, {
5340
+ "modelValue": { default: /* @__PURE__ */ new Set() },
5341
+ "modelModifiers": {}
5342
+ }),
5343
+ emits: /* @__PURE__ */ mergeModels(["itemclick", "itemcontext"], ["update:modelValue"]),
5344
+ setup(__props, { emit: __emit }) {
5345
+ const props = __props;
5346
+ const emit = __emit;
5347
+ const modelValue = useModel(__props, "modelValue");
5348
+ const is = (item) => {
5349
+ var _a;
5350
+ const to = (_a = props.to) == null ? void 0 : _a.call(props, item);
5351
+ if (to) {
5352
+ return props.useHref ? "a" : "router-link";
5353
+ }
5354
+ if (props.clickable) return "button";
5355
+ return "div";
5356
+ };
5357
+ const bind = (item) => {
5358
+ var _a;
5359
+ const to = (_a = props.to) == null ? void 0 : _a.call(props, item);
5360
+ if (to) {
5361
+ return props.useHref ? { href: to } : { to };
5362
+ } else {
5363
+ return {};
5364
+ }
5365
+ };
5366
+ const gridStyle = computed(() => {
5367
+ const arr = Object.values(props.columns).map((item) => item.width ?? "1fr");
5368
+ if (props.checkable) {
5369
+ arr.unshift("52px");
5370
+ }
5371
+ return {
5372
+ gridTemplateColumns: arr.join(" ")
5373
+ };
5374
+ });
5375
+ const checkboxClick = (e) => {
5376
+ var _a;
5377
+ if (e.target === e.currentTarget) {
5378
+ (_a = e.target.querySelector(".v-checkbox")) == null ? void 0 : _a.dispatchEvent(new MouseEvent("click"));
5379
+ }
5380
+ };
5381
+ return (_ctx, _cache) => {
5382
+ return openBlock(), createElementBlock("div", {
5383
+ class: "v-table",
5384
+ style: normalizeStyle(gridStyle.value)
5385
+ }, [
5386
+ createElementVNode("div", _hoisted_1$4, [
5387
+ props.checkable ? (openBlock(), createElementBlock("div", _hoisted_2$1)) : createCommentVNode("", true),
5388
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (item) => {
5389
+ return openBlock(), createElementBlock("div", null, toDisplayString(item.title), 1);
5390
+ }), 256))
5391
+ ]),
5392
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data, (item, index) => {
5393
+ var _a;
5394
+ return openBlock(), createBlock(resolveDynamicComponent(is(item)), mergeProps({ key: index }, { ref_for: true }, bind(item), {
5395
+ class: ["v-table__row", { hasGroup: props.groupBy && item[props.groupBy] && item[props.groupBy] !== ((_a = _ctx.data[index - 1]) == null ? void 0 : _a[props.groupBy]) }],
5396
+ onClick: ($event) => emit("itemclick", item),
5397
+ onContextmenu: ($event) => emit("itemcontext", $event, item)
5398
+ }), {
5399
+ default: withCtx(() => {
5400
+ var _a2;
5401
+ return [
5402
+ props.groupBy && item[props.groupBy] && item[props.groupBy] !== ((_a2 = _ctx.data[index - 1]) == null ? void 0 : _a2[props.groupBy]) ? (openBlock(), createElementBlock("div", _hoisted_3, " Папка " + toDisplayString(item[props.groupBy]), 1)) : createCommentVNode("", true),
5403
+ props.checkable ? (openBlock(), createElementBlock("div", {
5404
+ key: 1,
5405
+ class: "v-table__check",
5406
+ onClick: withModifiers(checkboxClick, ["prevent", "stop"])
5407
+ }, [
5408
+ createVNode(_sfc_main$o, {
5409
+ modelValue: modelValue.value.has(item),
5410
+ "onUpdate:modelValue": ($event) => modelValue.value.has(item) ? modelValue.value.delete(item) : modelValue.value.add(item)
5411
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
5412
+ ])) : createCommentVNode("", true),
5413
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (column, key) => {
5414
+ return openBlock(), createElementBlock("div", {
5415
+ key,
5416
+ class: normalizeClass(column.class)
5417
+ }, [
5418
+ renderSlot(_ctx.$slots, key, {
5419
+ item,
5420
+ cell: item[key]
5421
+ }, () => [
5422
+ createTextVNode(toDisplayString(column.map ? column.map(item) : item[key]), 1)
5423
+ ])
5424
+ ], 2);
5425
+ }), 128))
5426
+ ];
5427
+ }),
5428
+ _: 2
5429
+ }, 1040, ["class", "onClick", "onContextmenu"]);
5430
+ }), 128))
5431
+ ], 4);
5432
+ };
5433
+ }
5434
+ });
5435
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
5436
+ __name: "OpenPageDialog",
5437
+ setup(__props) {
5438
+ const pagesRequest = inject("pagesRequest");
5439
+ const { data } = useRequest(pagesRequest);
5440
+ const columns = {
5441
+ name: { title: "Название страницы" },
5442
+ path: { title: "Путь" }
5443
+ };
5444
+ return (_ctx, _cache) => {
5445
+ return openBlock(), createBlock(_sfc_main$s, { class: "standart" }, {
5446
+ header: withCtx(() => _cache[0] || (_cache[0] = [
5447
+ createTextVNode(" Страницы проекта ")
5448
+ ])),
5449
+ default: withCtx(() => [
5450
+ unref(data) ? (openBlock(), createBlock(_sfc_main$5, {
5451
+ key: 0,
5452
+ data: unref(data),
5453
+ columns,
5454
+ "group-by": "folderPath",
5455
+ class: "open-page-dialog__table",
5456
+ useHref: "",
5457
+ to: (item) => item.path
5458
+ }, null, 8, ["data", "to"])) : createCommentVNode("", true)
5459
+ ]),
5460
+ _: 1
5461
+ });
5462
+ };
5463
+ }
5464
+ });
5465
+ const _hoisted_1$3 = { class: "form-row" };
5466
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
5467
+ __name: "PageSettingsDialog",
5468
+ props: {
5469
+ page: {},
5470
+ onConfirm: { type: Function }
5471
+ },
5472
+ setup(__props) {
5473
+ var _a, _b;
5474
+ const props = __props;
5475
+ const { register, handleSubmit } = useForm({
5476
+ name: props.page.name,
5477
+ path: props.page.path,
5478
+ title: ((_a = props.page.meta) == null ? void 0 : _a.title) ?? "",
5479
+ description: ((_b = props.page.meta) == null ? void 0 : _b.description) ?? ""
5480
+ });
5481
+ const dialog = useDialog();
5482
+ const apply = handleSubmit(async (values) => {
5483
+ await props.onConfirm(values);
5484
+ dialog.close();
5485
+ });
5486
+ return (_ctx, _cache) => {
5487
+ return openBlock(), createBlock(_sfc_main$s, { class: "standart" }, {
5488
+ header: withCtx(() => _cache[0] || (_cache[0] = [
5489
+ createTextVNode("Настройки страницы")
5490
+ ])),
5491
+ actions: withCtx(() => [
5492
+ createVNode(_sfc_main$v, {
5493
+ large: "",
5494
+ onClick: unref(apply)
5495
+ }, {
5496
+ default: withCtx(() => _cache[1] || (_cache[1] = [
5497
+ createTextVNode("Сохранить")
5498
+ ])),
5499
+ _: 1,
5500
+ __: [1]
5501
+ }, 8, ["onClick"])
5502
+ ]),
5503
+ default: withCtx(() => [
5504
+ createVNode(_sfc_main$7, null, {
5505
+ default: withCtx(() => [
5506
+ createElementVNode("div", _hoisted_1$3, [
5507
+ createVNode(_sfc_main$J, mergeProps(unref(register)("name"), { label: "Название страницы" }), null, 16),
5508
+ createVNode(_sfc_main$J, mergeProps(unref(register)("path"), { label: "Путь к странице" }), null, 16)
5509
+ ]),
5510
+ createVNode(_sfc_main$J, mergeProps(unref(register)("title"), { label: "Title" }), null, 16),
5511
+ createVNode(_sfc_main$J, mergeProps(unref(register)("description"), {
5512
+ label: "Description",
5513
+ multiline: ""
5514
+ }), null, 16)
5515
+ ]),
5516
+ _: 1
5517
+ })
5518
+ ]),
5519
+ _: 1
5520
+ });
5521
+ };
5522
+ }
5523
+ });
5524
+ const _sfc_main$2 = {};
5525
+ const _hoisted_1$2 = {
5526
+ width: "24",
5527
+ height: "24",
5528
+ viewBox: "0 0 24 24",
5529
+ fill: "none",
5530
+ xmlns: "http://www.w3.org/2000/svg"
5531
+ };
5532
+ function _sfc_render(_ctx, _cache) {
5533
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [
5534
+ createElementVNode("path", {
5535
+ d: "M8 15L12 19L16 15M16 9L12 5L8 9",
5536
+ stroke: "currentColor",
5537
+ "stroke-width": "2",
5538
+ "stroke-linecap": "round",
5539
+ "stroke-linejoin": "round"
5540
+ }, null, -1)
5541
+ ]));
5542
+ }
5543
+ const SortIcon = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]);
5544
+ class HTTPError extends Error {
5545
+ constructor(body, statusCode = 401) {
5546
+ super();
5547
+ __publicField(this, "body");
5548
+ __publicField(this, "statusCode");
5549
+ this.body = body;
5550
+ this.statusCode = statusCode;
5551
+ }
5552
+ }
5553
+ setUseFormErrorHandler((e, errors) => {
5554
+ var _a;
5555
+ if (e instanceof HTTPError && typeof ((_a = e.body) == null ? void 0 : _a.error) === "object") {
5556
+ for (let [key, error] of Object.entries(e.body.error)) {
5557
+ if (typeof error === "string") {
5558
+ errors[key] = error;
5559
+ } else if (typeof error === "object" && error) {
5560
+ errors[key] = error;
5561
+ }
5562
+ }
5563
+ } else {
5564
+ errors["_global"] = e.body ?? "Error";
5565
+ }
5566
+ });
5567
+ const request = async (url, body, options = {}) => {
5568
+ var _a, _b;
5569
+ const headers = {};
5570
+ if (body && !(body instanceof FormData)) {
5571
+ headers["Content-Type"] = "application/json";
5572
+ }
5573
+ const resp = await fetch(url, {
5574
+ method: options.method || (body ? "POST" : "GET"),
5575
+ body: !body || body instanceof FormData || typeof body === "string" ? body : JSON.stringify(body),
5576
+ headers
5577
+ });
5578
+ let response = null;
5579
+ if ((_a = resp.headers.get("content-type")) == null ? void 0 : _a.startsWith("application/json")) {
5580
+ response = await resp.json();
5581
+ }
5582
+ if ((_b = resp.headers.get("content-type")) == null ? void 0 : _b.startsWith("text/plain")) {
5583
+ response = await resp.text();
5584
+ }
5585
+ if (resp.status >= 400) {
5586
+ throw new HTTPError(response, resp.status);
5587
+ }
5588
+ if (options.responseContentType === "blob") {
5589
+ response = await resp.blob();
5590
+ }
5591
+ return response;
5592
+ };
5593
+ const _hoisted_1$1 = ["onClick"];
5594
+ const _hoisted_2 = { class: "pages-selector__title" };
5595
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5596
+ ...{
5597
+ inheritAttrs: false
5598
+ },
5599
+ __name: "PageSelector",
5600
+ props: {
5601
+ state: {}
5602
+ },
5603
+ setup(__props) {
5604
+ const props = __props;
5605
+ const pagesRequest = inject("pagesRequest");
5606
+ const foldersRequest = inject("foldersRequest");
5607
+ useRequest(pagesRequest);
5608
+ const { data: folders } = useRequest(foldersRequest);
5609
+ const currentPage = computed(() => {
5610
+ return props.state.currentPage;
5611
+ });
5612
+ const dialog = useDialog();
5613
+ const createNewPage = () => {
5614
+ dialog.open(_sfc_main$6, { folders: folders.value, onCreate: async (values) => {
5615
+ await request("/@mechanica/pages", values);
5616
+ } });
5617
+ };
5618
+ const openPage = () => {
5619
+ dialog.open(_sfc_main$4);
5620
+ };
5621
+ const openPageSettingsDialog = () => {
5622
+ dialog.open(_sfc_main$3, { page: props.state.currentPage, onConfirm: async (values) => {
5623
+ await request(`/@mechanica/pages?path=${encodeURIComponent(props.state.currentPage.path)}`, values);
5624
+ props.state.currentPage.meta.title = values.title;
5625
+ props.state.currentPage.meta.description = values.description;
5626
+ props.state.currentPage.name = values.name;
5627
+ } });
5628
+ };
5629
+ const menuItems = computed(() => [
5630
+ { title: "Настройки страницы", onClick: openPageSettingsDialog },
5631
+ { title: "Открыть страницу...", onClick: openPage },
5632
+ { title: "Новая страница...", onClick: createNewPage }
5633
+ ]);
5634
+ return (_ctx, _cache) => {
5635
+ return openBlock(), createBlock(_sfc_main$u, {
5636
+ placement: "bottom",
5637
+ fitAnchor: "",
5638
+ offset: 4,
5639
+ items: menuItems.value
5640
+ }, {
5641
+ activator: withCtx(({ props: props2 }) => {
5642
+ var _a;
5643
+ return [
5644
+ createElementVNode("button", mergeProps(_ctx.$attrs, {
5645
+ class: "pages-selector",
5646
+ onClick: props2.onClick
5647
+ }), [
5648
+ createElementVNode("div", _hoisted_2, toDisplayString((_a = currentPage.value) == null ? void 0 : _a.name), 1),
5649
+ _cache[0] || (_cache[0] = createElementVNode("div", { class: "pages-selector__subtitle" }, "Текущая страница", -1)),
5650
+ createVNode(SortIcon)
5651
+ ], 16, _hoisted_1$1)
5652
+ ];
5653
+ }),
5654
+ _: 1
5655
+ }, 8, ["items"]);
5656
+ };
5657
+ }
5658
+ });
5091
5659
  registerAliases();
5092
5660
  const blocksList = shallowRef(blocksList$1.map((file) => ({
5093
5661
  ...file.blockSchema,
@@ -5110,34 +5678,6 @@ const processState = (state) => {
5110
5678
  processBlocks(state.content, blocksMap.value);
5111
5679
  return state;
5112
5680
  };
5113
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5114
- __name: "PageSelector",
5115
- setup(__props) {
5116
- const pagesRequest = inject("pagesRequest");
5117
- const { data } = useRequest(pagesRequest);
5118
- const currentPage = ref();
5119
- const pages = computed(() => {
5120
- return data.value ?? [];
5121
- });
5122
- watch(currentPage, async (newPage) => {
5123
- var _a;
5124
- const resp = await fetch(`/${newPage}`);
5125
- const html = await resp.text();
5126
- const _state = (_a = html.match(/window\.state=({.+})/)) == null ? void 0 : _a[1];
5127
- const state = _state && JSON.parse(_state);
5128
- processState(state);
5129
- Object.assign(window.state, state);
5130
- window.history.pushState({}, "", newPage === "index" ? "/" : `/${newPage}`);
5131
- });
5132
- return (_ctx, _cache) => {
5133
- return openBlock(), createBlock(_sfc_main$t, {
5134
- modelValue: currentPage.value,
5135
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currentPage.value = $event),
5136
- items: pages.value
5137
- }, null, 8, ["modelValue", "items"]);
5138
- };
5139
- }
5140
- });
5141
5681
  const _hoisted_1 = { class: "editor-hierarchy__header" };
5142
5682
  const _sfc_main = /* @__PURE__ */ defineComponent({
5143
5683
  __name: "EditorApp",
@@ -5173,14 +5713,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5173
5713
  }
5174
5714
  const state2 = cloneDeep(newState);
5175
5715
  const scopedData = splitData(state2.data, dataEntryScopes.value);
5176
- console.log(state2.data);
5177
5716
  state2.data = scopedData["page"];
5178
5717
  saveBlocks(state2.content, blocksMap.value);
5179
- fetch("/@mechanica/save", {
5180
- method: "POST",
5181
- body: JSON.stringify(state2),
5182
- headers: { "content-type": "application-json" }
5183
- });
5718
+ request(`/@mechanica/save?path=${window.location.pathname}`, state2);
5184
5719
  }, { debounce: 500 });
5185
5720
  provide("fileUploader", async (file) => {
5186
5721
  const resp = await fetch("/@mechanica/upload", {
@@ -5192,12 +5727,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5192
5727
  return obj;
5193
5728
  });
5194
5729
  provide("fileRequest", async () => {
5195
- const resp = await fetch("/@mechanica/images");
5196
- return await resp.json();
5730
+ return await request("/@mechanica/images");
5197
5731
  });
5198
5732
  provide("pagesRequest", async () => {
5199
- const resp = await fetch("/@mechanica/pages");
5200
- return await resp.json();
5733
+ return await request("/@mechanica/pages");
5734
+ });
5735
+ provide("foldersRequest", async () => {
5736
+ return await request("/@mechanica/folders");
5201
5737
  });
5202
5738
  const dataEntries2 = inject("dataEntries");
5203
5739
  const dataEntryScopes = ref(state.dataEntryScopes ?? {});
@@ -5214,7 +5750,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5214
5750
  return openBlock(), createElementBlock(Fragment, null, [
5215
5751
  createVNode(Transition, null, {
5216
5752
  default: withCtx(() => [
5217
- controlsOpened.value ? (openBlock(), createBlock(_sfc_main$2, {
5753
+ controlsOpened.value ? (openBlock(), createBlock(_sfc_main$8, {
5218
5754
  key: 0,
5219
5755
  control: unref(control),
5220
5756
  state,
@@ -5224,7 +5760,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5224
5760
  }, {
5225
5761
  default: withCtx(() => [
5226
5762
  createElementVNode("div", _hoisted_1, [
5227
- createVNode(_sfc_main$1, { class: "pages-selector" })
5763
+ createVNode(_sfc_main$1, { state }, null, 8, ["state"])
5228
5764
  ]),
5229
5765
  createElementVNode("button", {
5230
5766
  class: "editor-sidebar__close-button",
@@ -5238,22 +5774,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5238
5774
  ]),
5239
5775
  _: 1
5240
5776
  }),
5241
- controlsOpened.value ? (openBlock(), createBlock(_sfc_main$I, {
5777
+ controlsOpened.value ? (openBlock(), createBlock(_sfc_main$O, {
5242
5778
  key: 0,
5243
5779
  element: unref(control).hoverBlockElement.value
5244
5780
  }, null, 8, ["element"])) : createCommentVNode("", true),
5245
- controlsOpened.value ? (openBlock(), createBlock(_sfc_main$I, {
5781
+ controlsOpened.value ? (openBlock(), createBlock(_sfc_main$O, {
5246
5782
  key: 1,
5247
5783
  element: unref(control).activeBlockElement.value,
5248
5784
  resizable: ""
5249
5785
  }, null, 8, ["element"])) : createCommentVNode("", true),
5250
- unref(control).insertedPlace.value ? (openBlock(), createBlock(_sfc_main$H, {
5786
+ unref(control).insertedPlace.value ? (openBlock(), createBlock(_sfc_main$N, {
5251
5787
  key: 2,
5252
5788
  top: unref(control).insertedPlace.value.top
5253
5789
  }, null, 8, ["top"])) : createCommentVNode("", true),
5254
5790
  createVNode(Transition, null, {
5255
5791
  default: withCtx(() => [
5256
- controlsOpened.value ? (openBlock(), createBlock(_sfc_main$5, {
5792
+ controlsOpened.value ? (openBlock(), createBlock(_sfc_main$b, {
5257
5793
  key: 0,
5258
5794
  class: "editor-sidebar-right editor-component",
5259
5795
  onBlockdrop: _cache[2] || (_cache[2] = withModifiers(() => {
@@ -5302,7 +5838,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5302
5838
  ]),
5303
5839
  _: 1
5304
5840
  }),
5305
- createVNode(_sfc_main$n)
5841
+ createVNode(_sfc_main$t)
5306
5842
  ], 64);
5307
5843
  };
5308
5844
  }