@retailcrm/embed-ui-v1-components 0.9.11-alpha.1 → 0.9.11-alpha.2

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/remote.cjs CHANGED
@@ -1,1026 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const remote = require("@omnicajs/vue-remote/remote");
3
4
  const vue = require("vue");
4
- require("@remote-ui/rpc");
5
5
  const isEqual = require("lodash.isequal");
6
6
  const imagePreview = require("@retailcrm/image-preview");
7
+ const locale = require("date-fns/locale");
7
8
  const dateFns = require("date-fns");
8
- const ACTION_MOUNT = "mount";
9
- const ACTION_INSERT_CHILD = "insert-child";
10
- const ACTION_REMOVE_CHILD = "remove-child";
11
- const ACTION_UPDATE_TEXT = "update-text";
12
- const ACTION_UPDATE_PROPERTIES = "update-properties";
13
- const ACTION_INVOKE = "invoke";
14
- const KIND_COMMENT = "comment";
15
- const KIND_COMPONENT = "component";
16
- const KIND_FRAGMENT = "fragment";
17
- const KIND_ROOT = "root";
18
- const KIND_TEXT = "text";
19
- const ROOT_ID = "~";
20
- const addMethod = (o, name, fn) => {
21
- return Object.defineProperty(o, name, {
22
- value: fn,
23
- configurable: true,
24
- writable: false,
25
- enumerable: false
26
- });
27
- };
28
- const arraify = (value) => Array.isArray(value) ? [...value] : [value];
29
- const capture = (o, freeze) => {
30
- return freeze ? Object.freeze(o) : o;
31
- };
32
- const isFunction = (value) => {
33
- return typeof value === "function";
34
- };
35
- const isObject = (value) => {
36
- if (value == null || typeof value !== "object") {
37
- return false;
38
- }
39
- const prototype = Object.getPrototypeOf(value);
40
- return prototype == null || prototype === Object.prototype;
41
- };
42
- const keysOf = (o) => Object.keys(o);
43
- const visitArray = (value, visited, visit) => {
44
- const result = [];
45
- visited.set(value, result);
46
- for (const nested of value) {
47
- result.push(visit(nested, visited));
48
- }
49
- return result;
50
- };
51
- const visitObject = (value, visited, visit) => {
52
- const result = {};
53
- visited.set(value, result);
54
- for (const key of keysOf(value)) {
55
- result[key] = visit(value[key], visited);
56
- }
57
- return result;
58
- };
59
- const REMOTE_SLOT = "RemoteSlot";
60
- const HTMLTagList = [
61
- "a",
62
- "abbr",
63
- "address",
64
- "area",
65
- "article",
66
- "aside",
67
- "audio",
68
- "b",
69
- "base",
70
- "bdi",
71
- "bdo",
72
- "blockquote",
73
- "body",
74
- "br",
75
- "button",
76
- "canvas",
77
- "caption",
78
- "cite",
79
- "code",
80
- "col",
81
- "colgroup",
82
- "datalist",
83
- "dd",
84
- "del",
85
- "details",
86
- "dfn",
87
- "dialog",
88
- "div",
89
- "dl",
90
- "dt",
91
- "em",
92
- "embed",
93
- "fieldset",
94
- "figcaption",
95
- "figure",
96
- "footer",
97
- "form",
98
- "h1",
99
- "h2",
100
- "h3",
101
- "h4",
102
- "h5",
103
- "h6",
104
- "head",
105
- "header",
106
- "hgroup",
107
- "hr",
108
- "html",
109
- "i",
110
- "iframe",
111
- "img",
112
- "input",
113
- "ins",
114
- "kbd",
115
- "keygen",
116
- "label",
117
- "legend",
118
- "li",
119
- "link",
120
- "main",
121
- "map",
122
- "mark",
123
- "menu",
124
- "menuitem",
125
- "meta",
126
- "meter",
127
- "nav",
128
- "noscript",
129
- "object",
130
- "ol",
131
- "optgroup",
132
- "option",
133
- "output",
134
- "p",
135
- "param",
136
- "picture",
137
- "pre",
138
- "progress",
139
- "q",
140
- "rp",
141
- "rt",
142
- "ruby",
143
- "s",
144
- "samp",
145
- "script",
146
- "section",
147
- "select",
148
- "small",
149
- "source",
150
- "span",
151
- "strong",
152
- "style",
153
- "sub",
154
- "summary",
155
- "sup",
156
- "table",
157
- "tbody",
158
- "td",
159
- "textarea",
160
- "tfoot",
161
- "th",
162
- "thead",
163
- "time",
164
- "title",
165
- "tr",
166
- "track",
167
- "u",
168
- "ul",
169
- "var",
170
- "video",
171
- "wbr"
172
- ];
173
- const MathMLTagList = [
174
- "math",
175
- "maction",
176
- "maligngroup",
177
- "malignmark",
178
- "menclose",
179
- "merror",
180
- "mfenced",
181
- "mfrac",
182
- "mglyph",
183
- "mi",
184
- "mlabeledtr",
185
- "mlongdiv",
186
- "mmultiscripts",
187
- "mn",
188
- "mo",
189
- "mover",
190
- "mpadded",
191
- "mphantom",
192
- "mroot",
193
- "mrow",
194
- "ms",
195
- "mscarries",
196
- "mscarry",
197
- "msgroup",
198
- "msline",
199
- "mstack",
200
- "mspace",
201
- "msqrt",
202
- "msrow",
203
- "mstyle",
204
- "msub",
205
- "msup",
206
- "msubsup",
207
- "mtable",
208
- "mtd",
209
- "mtext",
210
- "mtr",
211
- "munder",
212
- "munderover",
213
- "none",
214
- "semantics",
215
- "annotation",
216
- "annotation-xml"
217
- ];
218
- const SVGTagList = [
219
- "a",
220
- "altGlyph",
221
- "altGlyphDef",
222
- "altGlyphItem",
223
- "animate",
224
- "animateColor",
225
- "animateMotion",
226
- "animateTransform",
227
- "circle",
228
- "clipPath",
229
- "color-profile",
230
- "cursor",
231
- "defs",
232
- "desc",
233
- "discard",
234
- "ellipse",
235
- "feBlend",
236
- "feColorMatrix",
237
- "feComponentTransfer",
238
- "feComposite",
239
- "feConvolveMatrix",
240
- "feDiffuseLighting",
241
- "feDisplacementMap",
242
- "feDistantLight",
243
- "feDropShadow",
244
- "feFlood",
245
- "feFuncA",
246
- "feFuncB",
247
- "feFuncG",
248
- "feFuncR",
249
- "feGaussianBlur",
250
- "feImage",
251
- "feMerge",
252
- "feMergeNode",
253
- "feMorphology",
254
- "feOffset",
255
- "fePointLight",
256
- "feSpecularLighting",
257
- "feSpotLight",
258
- "feTile",
259
- "feTurbulence",
260
- "filter",
261
- "font",
262
- "font-face",
263
- "font-face-format",
264
- "font-face-name",
265
- "font-face-src",
266
- "font-face-uri",
267
- "foreignObject",
268
- "g",
269
- "glyph",
270
- "glyphRef",
271
- "hkern",
272
- "image",
273
- "line",
274
- "linearGradient",
275
- "marker",
276
- "mask",
277
- "metadata",
278
- "missing-glyph",
279
- "mpath",
280
- "path",
281
- "pattern",
282
- "polygon",
283
- "polyline",
284
- "radialGradient",
285
- "rect",
286
- "script",
287
- "set",
288
- "stop",
289
- "style",
290
- "svg",
291
- "switch",
292
- "symbol",
293
- "text",
294
- "textPath",
295
- "title",
296
- "tref",
297
- "tspan",
298
- "use",
299
- "view",
300
- "vkern"
301
- ];
302
- function isRemoteFragment(value) {
303
- return value != null && value.kind === KIND_FRAGMENT;
304
- }
305
- const normalizeChild = (child, root) => typeof child === "string" ? root.createText(child) : child;
306
- const normalizeChildren = (children, root) => children.map((child) => normalizeChild(child, root));
307
- const traverse = (element, each) => {
308
- const _traverse = (element2) => {
309
- if ("children" in element2) {
310
- for (const child of element2.children) {
311
- each(child);
312
- _traverse(child);
313
- }
314
- }
315
- };
316
- _traverse(element);
317
- };
318
- function attach(context, parent, node) {
319
- const { progenitors, parents } = context;
320
- const progenitor = parent.kind === KIND_ROOT ? parent : parent.progenitor;
321
- if (progenitor) {
322
- progenitors.set(node, progenitor);
323
- }
324
- parents.set(node, parent);
325
- attachFragments(context, node);
326
- traverse(node, (descendant) => {
327
- if (progenitor) {
328
- progenitors.set(descendant, progenitor);
329
- }
330
- attachFragments(context, descendant);
331
- });
332
- }
333
- function attachFragments(context, node) {
334
- if (node.kind === KIND_COMPONENT) {
335
- Object.values(node.properties).forEach((prop) => {
336
- if (isRemoteFragment(prop)) {
337
- attach(context, node, prop);
338
- }
339
- });
340
- }
341
- }
342
- function detach(context, node) {
343
- const { progenitors, parents } = context;
344
- progenitors.delete(node);
345
- parents.delete(node);
346
- traverse(node, (descendant) => {
347
- progenitors.delete(descendant);
348
- detachFragments(context, descendant);
349
- });
350
- detachFragments(context, node);
351
- }
352
- function detachFragments(context, node) {
353
- if (node.kind !== KIND_COMPONENT) {
354
- return;
355
- }
356
- const properties = node.properties;
357
- for (const key of Object.keys(properties)) {
358
- const p = properties[key];
359
- if (isRemoteFragment(p)) {
360
- detach(context, p);
361
- }
362
- }
363
- }
364
- const update = (context, node, remote, local) => {
365
- var _a;
366
- if (context.mounted && (node.kind === KIND_ROOT || ((_a = node.progenitor) == null ? void 0 : _a.kind) === KIND_ROOT)) {
367
- remote(context.channel);
368
- }
369
- local();
370
- };
371
- function dataOf(context, parent) {
372
- switch (parent == null ? void 0 : parent.kind) {
373
- case KIND_COMPONENT:
374
- return context.components.get(parent);
375
- case KIND_FRAGMENT:
376
- return context.fragments.get(parent);
377
- case KIND_ROOT:
378
- return context;
379
- }
380
- }
381
- const insertToArray = (target, el, before) => {
382
- if (before == null) {
383
- target.push(el);
384
- } else {
385
- target.splice(target.indexOf(before), 0, el);
386
- }
387
- return target;
388
- };
389
- const remoteFromArray = (target, index) => {
390
- const result = [...target];
391
- result.splice(index, 1);
392
- return result;
393
- };
394
- const insert = (context, parent, child, before = null) => {
395
- const currentParent = child.parent;
396
- const currentIndex = (currentParent == null ? void 0 : currentParent.children.indexOf(child)) ?? -1;
397
- attach(context, parent, child);
398
- let newChildren;
399
- const parentData = dataOf(context, parent);
400
- if (currentParent) {
401
- const currentParentData = dataOf(context, currentParent);
402
- const currentChildren = remoteFromArray(currentParentData.children, currentIndex);
403
- if (currentParent === parent) {
404
- newChildren = currentChildren;
405
- } else {
406
- currentParentData.children = capture(currentChildren, context.strict);
407
- newChildren = [...parentData.children];
408
- }
409
- } else {
410
- newChildren = [...parentData.children];
411
- }
412
- parentData.children = capture(insertToArray(newChildren, child, before), context.strict);
413
- };
414
- const appendChild = (context, parent, child) => {
415
- if (!context.nodes.has(child)) {
416
- throw new Error("Cannot append a node that was not created by this remote root");
417
- }
418
- const currentParent = child.parent;
419
- const currentIndex = (currentParent == null ? void 0 : currentParent.children.indexOf(child)) ?? -1;
420
- return update(context, parent, (channel) => {
421
- channel(
422
- ACTION_INSERT_CHILD,
423
- parent.id,
424
- currentIndex < 0 ? parent.children.length : parent.children.length - 1,
425
- child.serialize(),
426
- currentParent ? currentParent.id : false
427
- );
428
- }, () => insert(context, parent, child));
429
- };
430
- const insertBefore = (context, parent, child, before) => {
431
- if (!context.nodes.has(child)) {
432
- throw new Error("Cannot insert a node that was not created by this remote root");
433
- }
434
- if (before && before.id === child.id) return;
435
- if (before && !parent.children.includes(before)) {
436
- throw new DOMException(
437
- "Cannot add a child before an element that is not a child of the target parent.",
438
- "HierarchyRequestError"
439
- );
440
- }
441
- const oldIndex = parent.children.indexOf(child) ?? -1;
442
- const oldParent = child.parent;
443
- const beforeIndex = before ? parent.children.indexOf(before) : -1;
444
- return update(context, parent, (channel) => channel(
445
- ACTION_INSERT_CHILD,
446
- parent.id,
447
- beforeIndex < 0 ? parent.children.length : oldIndex < 0 || oldIndex > beforeIndex ? beforeIndex : beforeIndex - 1,
448
- child.serialize(),
449
- oldParent ? oldParent.id : false
450
- ), () => insert(context, parent, child, before));
451
- };
452
- const removeChild = (context, parent, child) => {
453
- const data = dataOf(context, parent);
454
- return update(context, parent, (channel) => channel(
455
- ACTION_REMOVE_CHILD,
456
- parent.id,
457
- parent.children.indexOf(child)
458
- ), () => {
459
- detach(context, child);
460
- data.children = capture(remoteFromArray(
461
- data.children,
462
- data.children.indexOf(child)
463
- ), context.strict);
464
- });
465
- };
466
- const addAttachMethod = (context) => addMethod(context, "attach", (parent, node) => attach(context, parent, node));
467
- const addDetachMethod = (context) => addMethod(context, "detach", (node) => detach(context, node));
468
- const addAppendMethod$1 = (context) => addMethod(context, "append", (parent, children) => {
469
- for (const child of children) {
470
- appendChild(context, parent, child);
471
- }
472
- });
473
- const addUpdateMethod = (context) => addMethod(context, "update", (node, remote, local) => update(context, node, remote, local));
474
- const addReplaceMethod$1 = (context) => addMethod(context, "replace", (parent, children) => {
475
- for (const child of parent.children) {
476
- removeChild(context, parent, child);
477
- }
478
- for (const child of children) {
479
- appendChild(context, parent, child);
480
- }
481
- });
482
- const addCollectMethod = (context) => addMethod(context, "collect", (node) => {
483
- if (context.nodes.has(node)) {
484
- return;
485
- }
486
- context.nodes.add(node);
487
- Object.defineProperty(node, "parent", {
488
- get: () => context.parents.get(node) ?? null,
489
- configurable: true,
490
- enumerable: true
491
- });
492
- Object.defineProperty(node, "progenitor", {
493
- get: () => context.progenitors.get(node) ?? null,
494
- configurable: true,
495
- enumerable: true
496
- });
497
- });
498
- const addInvokeMethod = (context) => addMethod(context, "invoke", (node, method, payload) => {
499
- if (!context.nodes.has(node)) {
500
- throw new Error("Cannot invoke method for a node that was not created by this remote root");
501
- }
502
- return new Promise((resolve, reject) => {
503
- context.channel(
504
- ACTION_INVOKE,
505
- node.id,
506
- method,
507
- payload,
508
- resolve,
509
- reject
510
- );
511
- });
512
- });
513
- const createRemoteRootData = (channel, { components, strict = true } = {}) => {
514
- if (strict) {
515
- Object.freeze(components);
516
- }
517
- return {
518
- strict,
519
- mounted: false,
520
- channel,
521
- children: [],
522
- nodes: /* @__PURE__ */ new WeakSet(),
523
- parents: /* @__PURE__ */ new WeakMap(),
524
- progenitors: /* @__PURE__ */ new WeakMap(),
525
- components: /* @__PURE__ */ new WeakMap(),
526
- fragments: /* @__PURE__ */ new WeakMap()
527
- };
528
- };
529
- const createTreeContext = (channel, options = {}) => {
530
- const context = createRemoteRootData(channel, options);
531
- let lastId = 0;
532
- addMethod(context, "nextId", () => `${++lastId}`);
533
- addCollectMethod(context);
534
- addAttachMethod(context);
535
- addDetachMethod(context);
536
- addAppendMethod$1(context);
537
- addUpdateMethod(context);
538
- addMethod(context, "insert", (parent, child, before) => insertBefore(context, parent, child, before));
539
- addMethod(context, "removeChild", (parent, child) => removeChild(context, parent, child));
540
- addReplaceMethod$1(context);
541
- addInvokeMethod(context);
542
- return context;
543
- };
544
- const createRemoteComment = (content, root, context) => {
545
- const id = context.nextId();
546
- const data = { text: content };
547
- const node = {
548
- kind: KIND_COMMENT,
549
- get id() {
550
- return id;
551
- },
552
- get root() {
553
- return root;
554
- },
555
- get text() {
556
- return data.text;
557
- },
558
- update: (text) => context.update(
559
- node,
560
- (channel) => channel(ACTION_UPDATE_TEXT, node.id, text),
561
- () => data.text = text
562
- ),
563
- serialize: () => ({ id, kind: KIND_COMMENT, text: data.text }),
564
- remove: () => {
565
- var _a;
566
- return (_a = node.parent) == null ? void 0 : _a.removeChild(node);
567
- },
568
- print: () => `Comment(${data.text})`
569
- };
570
- context.collect(node);
571
- return node;
572
- };
573
- const isProxy = (value) => {
574
- return value instanceof Function && "__current" in value;
575
- };
576
- const toProxy = (value) => {
577
- const _proxy = (...args) => {
578
- return _proxy.__current ? _proxy.__current(...args) : void 0;
579
- };
580
- Object.defineProperty(_proxy, "__current", {
581
- value,
582
- configurable: false,
583
- enumerable: false,
584
- writable: true
585
- });
586
- return _proxy;
587
- };
588
- function proxyFunctionsIn(value, visited = /* @__PURE__ */ new Map()) {
589
- if (visited.has(value)) {
590
- return visited.get(value);
591
- }
592
- if (isRemoteFragment(value)) {
593
- visited.set(value, value);
594
- return value;
595
- }
596
- if (Array.isArray(value)) {
597
- return visitArray(value, visited, proxyFunctionsIn);
598
- }
599
- if (isObject(value)) {
600
- return visitObject(value, visited, proxyFunctionsIn);
601
- }
602
- if (isFunction(value)) {
603
- const proxy = toProxy(value);
604
- visited.set(value, proxy);
605
- return proxy;
606
- }
607
- visited.set(value, value);
608
- return value;
609
- }
610
- const collectProxies = (value, visited = /* @__PURE__ */ new Set()) => {
611
- if (visited.has(value)) {
612
- return void 0;
613
- }
614
- visited.add(value);
615
- if (Array.isArray(value)) {
616
- return value.reduce((all, element) => {
617
- const nested = collectProxies(element, visited);
618
- return nested ? [...all, ...nested] : all;
619
- }, []);
620
- }
621
- if (isObject(value)) {
622
- return keysOf(value).reduce((all, key) => {
623
- const nested = collectProxies(value[key], visited);
624
- return nested ? [...all, ...nested] : all;
625
- }, []);
626
- }
627
- return isProxy(value) ? [value] : void 0;
628
- };
629
- const prepareProxiesUnset = (value) => {
630
- var _a;
631
- return ((_a = collectProxies(value)) == null ? void 0 : _a.map((p) => [p, void 0])) ?? [];
632
- };
633
- function prepareProxies(oldValue, newValue, visited = /* @__PURE__ */ new Set()) {
634
- if (visited.has(oldValue)) {
635
- return [oldValue, [], true];
636
- }
637
- visited.add(oldValue);
638
- if (isProxy(oldValue)) {
639
- return isFunction(newValue) ? [oldValue, [[oldValue, newValue]], true] : [proxyFunctionsIn(newValue), [], false];
640
- }
641
- if (Array.isArray(oldValue)) {
642
- return !Array.isArray(newValue) ? [proxyFunctionsIn(newValue), prepareProxiesUnset(oldValue), false] : prepareProxiesInArray(oldValue, newValue, visited);
643
- }
644
- if (isObject(oldValue) && !isRemoteFragment(oldValue)) {
645
- return !isObject(newValue) ? [proxyFunctionsIn(newValue), prepareProxiesUnset(oldValue), false] : prepareProxiesInObject(oldValue, newValue, visited);
646
- }
647
- return [newValue, [], oldValue === newValue];
648
- }
649
- function prepareProxiesInObject(oldValue, newValue, visited) {
650
- const normalized = {};
651
- const records = [];
652
- let changed = false;
653
- for (const key of keysOf(oldValue)) {
654
- const oldEl = oldValue[key];
655
- if (!(key in newValue)) {
656
- records.push(...prepareProxiesUnset(oldEl));
657
- changed = true;
658
- }
659
- const newEl = newValue[key];
660
- const [updated, record, skip] = prepareProxies(oldEl, newEl, visited);
661
- records.push(...record);
662
- if (!skip) {
663
- normalized[key] = updated;
664
- changed = true;
665
- }
666
- }
667
- for (const key of keysOf(newValue)) {
668
- if (!(key in normalized)) {
669
- normalized[key] = proxyFunctionsIn(newValue[key]);
670
- changed = true;
671
- }
672
- }
673
- return [normalized, records, !changed];
674
- }
675
- function prepareProxiesInArray(oldValue, newValue, visited) {
676
- const normalized = [];
677
- const records = [];
678
- let changed = false;
679
- for (let i = 0; i < Math.max(oldValue.length, newValue.length); i++) {
680
- const oldEl = oldValue[i];
681
- const newEl = newValue[i];
682
- if (i >= newValue.length) {
683
- records.push(...prepareProxiesUnset(oldEl));
684
- changed = true;
685
- continue;
686
- }
687
- if (i >= oldValue.length) {
688
- normalized[i] = proxyFunctionsIn(newEl);
689
- changed = true;
690
- continue;
691
- }
692
- const [updated, record, skip] = prepareProxies(oldEl, newEl, visited);
693
- records.push(...record);
694
- normalized[i] = skip ? oldEl : updated;
695
- changed = !skip || changed;
696
- }
697
- return [normalized, records, !changed];
698
- }
699
- const updateProxies = (records) => {
700
- for (const [fn, current] of records) {
701
- if (fn.__current !== current) {
702
- fn.__current = current;
703
- }
704
- }
705
- };
706
- function createRemoteComponent(type, properties, children, root, context) {
707
- const id = context.nextId();
708
- const descriptor = typeof type === "object" && "type" in type ? type : null;
709
- const data = createRemoteComponentData(properties, children, root, context);
710
- const node = {
711
- kind: KIND_COMPONENT,
712
- get id() {
713
- return id;
714
- },
715
- get type() {
716
- return descriptor ? descriptor.type : type;
717
- },
718
- get root() {
719
- return root;
720
- },
721
- get children() {
722
- return data.children;
723
- },
724
- get properties() {
725
- return data.properties.original;
726
- },
727
- append: (...children2) => context.append(
728
- node,
729
- normalizeChildren(children2, root)
730
- ),
731
- insertBefore: (child, before) => context.insert(
732
- node,
733
- normalizeChild(child, root),
734
- before
735
- ),
736
- updateProperties: (properties2) => updateProperties(
737
- context,
738
- node,
739
- properties2
740
- ),
741
- replace: (...children2) => context.replace(
742
- node,
743
- normalizeChildren(children2, root)
744
- ),
745
- removeChild: (child) => context.removeChild(node, child),
746
- remove: () => node.parent ? context.removeChild(node.parent, node) : null,
747
- invoke: (method, ...payload) => !descriptor || (descriptor == null ? void 0 : descriptor.hasMethod(method)) ? context.invoke(node, method, payload) : Promise.reject(`Method ${method} is not supported`),
748
- serialize: () => ({
749
- id,
750
- kind: KIND_COMPONENT,
751
- type,
752
- properties: data.properties.serializable,
753
- children: data.children.map((c) => c.serialize())
754
- }),
755
- print: () => _print(id, type, data.properties.original, data.children)
756
- };
757
- context.collect(node);
758
- context.components.set(node, data);
759
- data.children.forEach((c) => context.attach(node, c));
760
- return node;
761
- }
762
- const RESERVED = ["children"];
763
- const notReserved = (name) => !RESERVED.includes(name);
764
- function createRemoteComponentData(properties, children, root, context) {
765
- const original = properties ?? {};
766
- const serializable = {};
767
- for (const key of keysOf(original).filter(notReserved)) {
768
- serializable[key] = proxyFunctionsIn(serializeProperty(original[key]));
769
- }
770
- return {
771
- properties: {
772
- original: capture(original, context.strict),
773
- serializable
774
- },
775
- children: capture(normalizeChildren(children, root), context.strict)
776
- };
777
- }
778
- function updateProperties(context, component, properties) {
779
- const componentData = context.components.get(component);
780
- const normalized = {};
781
- const records = [];
782
- let changed = false;
783
- for (const key of keysOf(properties).filter(notReserved)) {
784
- const oldOriginal = componentData.properties.original[key];
785
- const newOriginal = properties[key];
786
- const oldSerializable = componentData.properties.serializable[key];
787
- const newSerializable = serializeProperty(newOriginal);
788
- if (oldSerializable === newSerializable && (newSerializable == null || typeof newSerializable !== "object")) {
789
- continue;
790
- }
791
- const [value, record, skip] = prepareProxies(oldSerializable, newSerializable);
792
- records.push(...record);
793
- if (!skip) {
794
- normalized[key] = value;
795
- changed = true;
796
- if (isRemoteFragment(oldOriginal)) {
797
- context.detach(oldOriginal);
798
- }
799
- if (isRemoteFragment(newOriginal)) {
800
- context.attach(component, newOriginal);
801
- }
802
- }
803
- }
804
- return context.update(component, (channel) => {
805
- if (changed) {
806
- channel(ACTION_UPDATE_PROPERTIES, component.id, normalized);
807
- }
808
- }, () => {
809
- componentData.properties.original = capture({ ...componentData.properties.original, ...properties }, context.strict);
810
- componentData.properties.serializable = { ...componentData.properties.serializable, ...normalized };
811
- updateProxies(records);
812
- });
813
- }
814
- function serializeProperty(property) {
815
- return isRemoteFragment(property) ? property.serialize() : property;
816
- }
817
- function _print(id, type, _properties, children) {
818
- const _head = `${typeof type === "string" ? type : type.type}:${id}`;
819
- const _children = children.map((c) => typeof c === "string" ? c : c.print());
820
- const _body = _children.length > 0 ? `
821
- ${_indent(_children.join(",\n"))}
822
- ` : "";
823
- return `${_head}[${_body}]`;
824
- }
825
- function _indent(text) {
826
- return text.split("\n").map((line) => ` ${line}`).join("\n");
827
- }
828
- const createRemoteFragment = (root, context) => {
829
- const id = context.nextId();
830
- const data = { children: capture([], context.strict) };
831
- const fragment = {
832
- kind: KIND_FRAGMENT,
833
- get id() {
834
- return id;
835
- },
836
- get root() {
837
- return root;
838
- },
839
- get children() {
840
- return data.children;
841
- },
842
- append: (...children) => context.append(fragment, normalizeChildren(children, root)),
843
- insertBefore: (child, before) => context.insert(
844
- fragment,
845
- normalizeChild(child, root),
846
- before
847
- ),
848
- replace: (...children) => context.replace(fragment, normalizeChildren(children, root)),
849
- removeChild: (child) => context.removeChild(fragment, child),
850
- serialize: () => ({
851
- id,
852
- kind: KIND_FRAGMENT,
853
- children: data.children.map((c) => c.serialize())
854
- })
855
- };
856
- context.collect(fragment);
857
- context.fragments.set(fragment, data);
858
- return fragment;
859
- };
860
- const createRemoteText = (content, root, context) => {
861
- const id = context.nextId();
862
- const data = { text: content };
863
- const node = {
864
- kind: KIND_TEXT,
865
- get id() {
866
- return id;
867
- },
868
- get root() {
869
- return root;
870
- },
871
- get text() {
872
- return data.text;
873
- },
874
- update: (text) => context.update(
875
- node,
876
- (channel) => channel(ACTION_UPDATE_TEXT, node.id, text),
877
- () => data.text = text
878
- ),
879
- serialize: () => ({ id, kind: KIND_TEXT, text: data.text }),
880
- remove: () => {
881
- var _a;
882
- return (_a = node.parent) == null ? void 0 : _a.removeChild(node);
883
- },
884
- print: () => `Text(${data.text})`
885
- };
886
- context.collect(node);
887
- return node;
888
- };
889
- function createRemoteRoot$1(channel, {
890
- components,
891
- strict = true
892
- } = {}) {
893
- const context = createTreeContext(channel, {
894
- components,
895
- strict
896
- });
897
- const root = {
898
- kind: KIND_ROOT,
899
- options: capture({ strict, components }, strict),
900
- get id() {
901
- return ROOT_ID;
902
- },
903
- get children() {
904
- return context.children;
905
- },
906
- removeChild: (child) => context.removeChild(root, child)
907
- };
908
- addCreateCommentMethod(root, context);
909
- addCreateComponentMethod(root, context);
910
- addCreateFragmentMethod(root, context);
911
- addCreateTextMethod(root, context);
912
- addMountMethod(root, context);
913
- addAppendMethod(root, context);
914
- addInsertMethod(root, context);
915
- addReplaceMethod(root, context);
916
- return root;
917
- }
918
- function addCreateCommentMethod(root, context) {
919
- addMethod(root, "createComment", (text = "") => {
920
- return createRemoteComment(text, root, context);
921
- });
922
- }
923
- function addCreateComponentMethod(root, context) {
924
- addMethod(root, "createComponent", (type, ...rest) => {
925
- const components = root.options.components;
926
- if (components && !components.some((c) => c === type || c.type === type)) {
927
- throw new Error(`Unsupported component: ${type}`);
928
- }
929
- const _type = (components == null ? void 0 : components.find((c) => c === type || c.type === type)) ?? type;
930
- const [properties, children, ...restChildren] = rest;
931
- return createRemoteComponent(_type, properties, [
932
- ...arraify(children ?? []),
933
- ...restChildren
934
- ], root, context);
935
- });
936
- }
937
- function addCreateFragmentMethod(root, context) {
938
- addMethod(root, "createFragment", () => createRemoteFragment(root, context));
939
- }
940
- function addCreateTextMethod(root, context) {
941
- addMethod(root, "createText", (text = "") => {
942
- return createRemoteText(text, root, context);
943
- });
944
- }
945
- function addMountMethod(root, context) {
946
- addMethod(root, "mount", () => {
947
- if (context.mounted) {
948
- return Promise.resolve();
949
- }
950
- context.mounted = true;
951
- return Promise.resolve(context.channel(
952
- ACTION_MOUNT,
953
- context.children.map((c) => c.serialize())
954
- ));
955
- });
956
- }
957
- function addAppendMethod(root, context) {
958
- addMethod(root, "append", (...children) => {
959
- context.append(root, normalizeChildren(children, root));
960
- });
961
- }
962
- function addInsertMethod(root, context) {
963
- addMethod(root, "insertBefore", (child, before) => {
964
- context.insert(root, normalizeChild(child, root), before);
965
- });
966
- }
967
- function addReplaceMethod(root, context) {
968
- addMethod(root, "replace", (...children) => {
969
- context.replace(root, normalizeChildren(children, root));
970
- });
971
- }
972
- const createRemoteRoot = (channel, options = {}) => createRemoteRoot$1(channel, {
973
- ...options,
974
- components: [
975
- ...HTMLTagList,
976
- ...MathMLTagList,
977
- ...SVGTagList,
978
- REMOTE_SLOT,
979
- ...options.components ?? []
980
- ]
981
- });
982
- const toRemoteSlots = (named, slots) => {
983
- const actual = named.filter((slotName) => slotName in slots);
984
- if (actual.length === 0) {
985
- return slots;
986
- }
987
- return {
988
- default: () => {
989
- var _a;
990
- return [
991
- ..."default" in slots ? [(_a = slots.default) == null ? void 0 : _a.call(slots)] : [],
992
- ...actual.map((slotName) => vue.h(REMOTE_SLOT, { name: slotName }, {
993
- default: slots[slotName]
994
- }))
995
- ];
996
- }
997
- };
998
- };
999
- const capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
1000
- const fallthroughEvents = (emits, emit) => {
1001
- if (emits === void 0) {
1002
- return {};
1003
- }
1004
- const events2 = Array.isArray(emits) ? emits : Object.keys(emits);
1005
- return events2.reduce((processed, event) => {
1006
- processed["on" + capitalize(event)] = (...args) => emit(event, ...args);
1007
- return processed;
1008
- }, {});
1009
- };
1010
- const defineRemoteComponent = (type, emits = void 0, slots = []) => vue.defineComponent({
1011
- name: type,
1012
- inheritAttrs: false,
1013
- ...emits ? { emits } : {},
1014
- setup(props, { attrs, emit, slots: internalSlots }) {
1015
- return () => vue.h(type, {
1016
- ...props,
1017
- ...attrs,
1018
- ...fallthroughEvents(emits, emit)
1019
- }, toRemoteSlots(slots, internalSlots));
1020
- }
1021
- });
1022
9
  const UiAddButtonType = "UiAddButton";
1023
- const UiAddButton = defineRemoteComponent(
10
+ const UiAddButton = remote.defineRemoteComponent(
1024
11
  UiAddButtonType,
1025
12
  ["click", "focus", "blur"],
1026
13
  [
@@ -1029,7 +16,7 @@ const UiAddButton = defineRemoteComponent(
1029
16
  ]
1030
17
  );
1031
18
  const UiAlertType = "UiAlert";
1032
- const UiAlert = defineRemoteComponent(
19
+ const UiAlert = remote.defineRemoteComponent(
1033
20
  UiAlertType,
1034
21
  [
1035
22
  "showing",
@@ -1039,16 +26,16 @@ const UiAlert = defineRemoteComponent(
1039
26
  ]
1040
27
  );
1041
28
  const UiAvatarType = "UiAvatar";
1042
- const UiAvatar = defineRemoteComponent(UiAvatarType);
29
+ const UiAvatar = remote.defineRemoteComponent(UiAvatarType);
1043
30
  const UiAvatarListType = "UiAvatarList";
1044
- const UiAvatarList = defineRemoteComponent(UiAvatarListType);
31
+ const UiAvatarList = remote.defineRemoteComponent(UiAvatarListType);
1045
32
  const UiButtonType = "UiButton";
1046
- const UiButton = defineRemoteComponent(
33
+ const UiButton = remote.defineRemoteComponent(
1047
34
  UiButtonType,
1048
35
  ["click", "focus", "blur"]
1049
36
  );
1050
37
  const UiCalendarType = "UiCalendar";
1051
- const UiCalendar = defineRemoteComponent(
38
+ const UiCalendar = remote.defineRemoteComponent(
1052
39
  UiCalendarType,
1053
40
  [
1054
41
  "change",
@@ -1056,12 +43,12 @@ const UiCalendar = defineRemoteComponent(
1056
43
  ]
1057
44
  );
1058
45
  const UiCheckboxType = "UiCheckbox";
1059
- const UiCheckbox = defineRemoteComponent(
46
+ const UiCheckbox = remote.defineRemoteComponent(
1060
47
  UiCheckboxType,
1061
48
  ["click", "focus", "blur"]
1062
49
  );
1063
50
  const UiCollapseType = "UiCollapse";
1064
- const UiCollapse = defineRemoteComponent(
51
+ const UiCollapse = remote.defineRemoteComponent(
1065
52
  UiCollapseType,
1066
53
  [
1067
54
  "collapsed",
@@ -1074,7 +61,7 @@ const UiCollapse = defineRemoteComponent(
1074
61
  ]
1075
62
  );
1076
63
  const UiCollapseBoxType = "UiCollapseBox";
1077
- const UiCollapseBox = defineRemoteComponent(
64
+ const UiCollapseBox = remote.defineRemoteComponent(
1078
65
  UiCollapseBoxType,
1079
66
  [
1080
67
  "collapsed",
@@ -1095,7 +82,7 @@ const UiCollapseBox = defineRemoteComponent(
1095
82
  ]
1096
83
  );
1097
84
  const UiCollapseGroupType = "UiCollapseGroup";
1098
- const UiCollapseGroup = defineRemoteComponent(
85
+ const UiCollapseGroup = remote.defineRemoteComponent(
1099
86
  UiCollapseGroupType,
1100
87
  [
1101
88
  "expand-cancelled",
@@ -1107,7 +94,7 @@ const UiCollapseGroup = defineRemoteComponent(
1107
94
  ]
1108
95
  );
1109
96
  const UiCopyButtonType = "UiCopyButton";
1110
- const UiCopyButton = defineRemoteComponent(
97
+ const UiCopyButton = remote.defineRemoteComponent(
1111
98
  UiCopyButtonType,
1112
99
  ["click", "focus", "blur"],
1113
100
  [
@@ -1117,9 +104,9 @@ const UiCopyButton = defineRemoteComponent(
1117
104
  ]
1118
105
  );
1119
106
  const UiDateType = "UiDate";
1120
- const UiDate = defineRemoteComponent(UiDateType);
107
+ const UiDate = remote.defineRemoteComponent(UiDateType);
1121
108
  const UiDatePickerType = "UiDatePicker";
1122
- const UiDatePicker = defineRemoteComponent(
109
+ const UiDatePicker = remote.defineRemoteComponent(
1123
110
  UiDatePickerType,
1124
111
  [
1125
112
  "open",
@@ -1129,7 +116,7 @@ const UiDatePicker = defineRemoteComponent(
1129
116
  ]
1130
117
  );
1131
118
  const UiErrorType = "UiError";
1132
- const UiError = defineRemoteComponent(
119
+ const UiError = remote.defineRemoteComponent(
1133
120
  UiErrorType,
1134
121
  ["click", "focus", "blur"]
1135
122
  );
@@ -1149,13 +136,13 @@ function render$2(_ctx, _cache) {
1149
136
  }
1150
137
  const IconHelp = { render: render$2 };
1151
138
  const UiPopperType = "UiPopper";
1152
- const UiPopper = defineRemoteComponent(UiPopperType);
139
+ const UiPopper = remote.defineRemoteComponent(UiPopperType);
1153
140
  const UiPopperConnectorType = "UiPopperConnector";
1154
- const UiPopperConnector = defineRemoteComponent(UiPopperConnectorType);
141
+ const UiPopperConnector = remote.defineRemoteComponent(UiPopperConnectorType);
1155
142
  const UiPopperTargetType = "UiPopperTarget";
1156
- const UiPopperTarget = defineRemoteComponent(UiPopperTargetType);
143
+ const UiPopperTarget = remote.defineRemoteComponent(UiPopperTargetType);
1157
144
  const UiTooltipType = "UiTooltip";
1158
- const UiTooltip = defineRemoteComponent(UiTooltipType);
145
+ const UiTooltip = remote.defineRemoteComponent(UiTooltipType);
1159
146
  const _hoisted_1$4 = { class: "ui-v1-field__headline" };
1160
147
  const _hoisted_2$1 = ["id", "for"];
1161
148
  const _hoisted_3$1 = {
@@ -1300,7 +287,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
1300
287
  }
1301
288
  });
1302
289
  const UiInfoboxType = "UiInfobox";
1303
- const UiInfobox = defineRemoteComponent(
290
+ const UiInfobox = remote.defineRemoteComponent(
1304
291
  UiInfoboxType,
1305
292
  [
1306
293
  "show",
@@ -1316,18 +303,18 @@ const UiInfobox = defineRemoteComponent(
1316
303
  ]
1317
304
  );
1318
305
  const UiLinkType = "UiLink";
1319
- const UiLink = defineRemoteComponent(
306
+ const UiLink = remote.defineRemoteComponent(
1320
307
  UiLinkType,
1321
308
  ["click", "focus", "blur"],
1322
309
  ["icon"]
1323
310
  );
1324
311
  const UiLoaderType = "UiLoader";
1325
- const UiLoader = defineRemoteComponent(
312
+ const UiLoader = remote.defineRemoteComponent(
1326
313
  UiLoaderType,
1327
314
  ["click", "focus", "blur"]
1328
315
  );
1329
316
  const UiModalSidebarType = "UiModalSidebar";
1330
- const UiModalSidebar = defineRemoteComponent(
317
+ const UiModalSidebar = remote.defineRemoteComponent(
1331
318
  UiModalSidebarType,
1332
319
  [
1333
320
  "open",
@@ -1348,7 +335,7 @@ const UiModalSidebar = defineRemoteComponent(
1348
335
  ]
1349
336
  );
1350
337
  const UiModalWindowType = "UiModalWindow";
1351
- const UiModalWindow = defineRemoteComponent(
338
+ const UiModalWindow = remote.defineRemoteComponent(
1352
339
  UiModalWindowType,
1353
340
  [
1354
341
  "open",
@@ -1369,7 +356,7 @@ const UiModalWindow = defineRemoteComponent(
1369
356
  ]
1370
357
  );
1371
358
  const UiModalWindowSurfaceType = "UiModalWindowSurface";
1372
- const UiModalWindowSurface = defineRemoteComponent(
359
+ const UiModalWindowSurface = remote.defineRemoteComponent(
1373
360
  UiModalWindowSurfaceType,
1374
361
  [
1375
362
  "open",
@@ -1386,7 +373,7 @@ const UiModalWindowSurface = defineRemoteComponent(
1386
373
  ]
1387
374
  );
1388
375
  const UiNumberStepperType = "UiNumberStepper";
1389
- const UiNumberStepper = defineRemoteComponent(
376
+ const UiNumberStepper = remote.defineRemoteComponent(
1390
377
  UiNumberStepperType,
1391
378
  [
1392
379
  "change",
@@ -1399,12 +386,12 @@ const UiNumberStepper = defineRemoteComponent(
1399
386
  ]
1400
387
  );
1401
388
  const UiRadioType = "UiRadio";
1402
- const UiRadio = defineRemoteComponent(
389
+ const UiRadio = remote.defineRemoteComponent(
1403
390
  UiRadioType,
1404
391
  ["click", "focus", "blur"]
1405
392
  );
1406
393
  const UiScrollBoxType = "UiScrollBox";
1407
- const UiScrollBox = defineRemoteComponent(
394
+ const UiScrollBox = remote.defineRemoteComponent(
1408
395
  UiScrollBoxType,
1409
396
  [
1410
397
  "click",
@@ -1415,17 +402,17 @@ const UiScrollBox = defineRemoteComponent(
1415
402
  ]
1416
403
  );
1417
404
  const UiSliderType = "UiSlider";
1418
- const UiSlider = defineRemoteComponent(
405
+ const UiSlider = remote.defineRemoteComponent(
1419
406
  UiSliderType,
1420
407
  ["update:value"]
1421
408
  );
1422
409
  const UiSwitchType = "UiSwitch";
1423
- const UiSwitch = defineRemoteComponent(
410
+ const UiSwitch = remote.defineRemoteComponent(
1424
411
  UiSwitchType,
1425
412
  ["click", "focus", "blur"]
1426
413
  );
1427
414
  const UiTagType = "UiTag";
1428
- const UiTag = defineRemoteComponent(
415
+ const UiTag = remote.defineRemoteComponent(
1429
416
  UiTagType,
1430
417
  ["click", "focus", "blur", "remove"]
1431
418
  );
@@ -1449,12 +436,12 @@ const events = [
1449
436
  "clear"
1450
437
  ];
1451
438
  const UiTextboxType = "UiTextbox";
1452
- const UiTextbox = defineRemoteComponent(
439
+ const UiTextbox = remote.defineRemoteComponent(
1453
440
  UiTextboxType,
1454
441
  events
1455
442
  );
1456
443
  const UiTimePickerType = "UiTimePicker";
1457
- const UiTimePicker = defineRemoteComponent(
444
+ const UiTimePicker = remote.defineRemoteComponent(
1458
445
  UiTimePickerType,
1459
446
  [
1460
447
  "change",
@@ -1464,19 +451,19 @@ const UiTimePicker = defineRemoteComponent(
1464
451
  ]
1465
452
  );
1466
453
  const UiToolbarButtonType = "UiToolbarButton";
1467
- const UiToolbarButton = defineRemoteComponent(
454
+ const UiToolbarButton = remote.defineRemoteComponent(
1468
455
  UiToolbarButtonType,
1469
456
  ["click", "focus", "blur"]
1470
457
  );
1471
458
  const UiToolbarLinkType = "UiToolbarLink";
1472
- const UiToolbarLink = defineRemoteComponent(
459
+ const UiToolbarLink = remote.defineRemoteComponent(
1473
460
  UiToolbarLinkType,
1474
461
  ["click", "focus", "blur"]
1475
462
  );
1476
463
  const UiTransitionType = "UiTransition";
1477
- const UiTransition = defineRemoteComponent(UiTransitionType);
464
+ const UiTransition = remote.defineRemoteComponent(UiTransitionType);
1478
465
  const UiYandexMapType = "UiYandexMap";
1479
- const UiYandexMap = defineRemoteComponent(
466
+ const UiYandexMap = remote.defineRemoteComponent(
1480
467
  UiYandexMapType,
1481
468
  [
1482
469
  "change",
@@ -1484,7 +471,7 @@ const UiYandexMap = defineRemoteComponent(
1484
471
  ]
1485
472
  );
1486
473
  const UiMenuItemType = "UiMenuItem";
1487
- const UiMenuItem = defineRemoteComponent(
474
+ const UiMenuItem = remote.defineRemoteComponent(
1488
475
  UiMenuItemType,
1489
476
  [],
1490
477
  [
@@ -1496,7 +483,7 @@ const UiMenuItem = defineRemoteComponent(
1496
483
  ]
1497
484
  );
1498
485
  const UiMenuItemGroupType = "UiMenuItemGroup";
1499
- const UiMenuItemGroup = defineRemoteComponent(
486
+ const UiMenuItemGroup = remote.defineRemoteComponent(
1500
487
  UiMenuItemGroupType,
1501
488
  [],
1502
489
  [
@@ -1546,11 +533,11 @@ const compile = (messages, path, values = void 0) => {
1546
533
  const fail = (message) => {
1547
534
  throw new Error(message);
1548
535
  };
1549
- const t = (locale, messages, path, values = void 0) => {
536
+ const t = (locale2, messages, path, values = void 0) => {
1550
537
  const keys = path.split(".");
1551
- if (locale) {
1552
- const message = compile(messages[locale] ?? {}, keys, values);
1553
- return typeof message !== "object" ? message : fail(`Translation for "${locale}:${path}" is not translatable`);
538
+ if (locale2) {
539
+ const message = compile(messages[locale2] ?? {}, keys, values);
540
+ return typeof message !== "object" ? message : fail(`Translation for "${locale2}:${path}" is not translatable`);
1554
541
  }
1555
542
  return void 0;
1556
543
  };
@@ -1576,35 +563,35 @@ class I18n {
1576
563
  };
1577
564
  this.fallback = options?.fallback;
1578
565
  }
1579
- t(locale, path, values = void 0) {
566
+ t(locale2, path, values = void 0) {
1580
567
  try {
1581
- const _t = (locale2) => t(locale2, this.messages, path, values);
1582
- return _t(locale) ?? _t(this.fallback) ?? fail(`Translation for "${path}" does not exists`);
568
+ const _t = (locale22) => t(locale22, this.messages, path, values);
569
+ return _t(locale2) ?? _t(this.fallback) ?? fail(`Translation for "${path}" does not exists`);
1583
570
  } catch (e) {
1584
571
  if (this.parent) {
1585
- return this.parent.t(locale, path, values);
572
+ return this.parent.t(locale2, path, values);
1586
573
  }
1587
574
  throw e;
1588
575
  }
1589
576
  }
1590
- tc(locale, path, choice, values = void 0) {
577
+ tc(locale2, path, choice, values = void 0) {
1591
578
  return plural(
1592
579
  this.t(
1593
- locale,
580
+ locale2,
1594
581
  path,
1595
582
  values
1596
583
  ),
1597
584
  choice,
1598
- this.pluralization[locale]
585
+ this.pluralization[locale2]
1599
586
  );
1600
587
  }
1601
- compute(locale, key, values) {
588
+ compute(locale2, key, values) {
1602
589
  const computed = this.computed[key];
1603
590
  if (computed) {
1604
- return computed(localize$3(this, locale), values);
591
+ return computed(localize(this, locale2), values);
1605
592
  }
1606
593
  if (this.parent) {
1607
- return this.parent.compute(locale, key, values);
594
+ return this.parent.compute(locale2, key, values);
1608
595
  }
1609
596
  return fail("Key " + key + " is not registered");
1610
597
  }
@@ -1616,15 +603,15 @@ class I18n {
1616
603
  }, this);
1617
604
  }
1618
605
  }
1619
- const localize$3 = (i18n, locale) => ({
606
+ const localize = (i18n, locale2) => ({
1620
607
  t(path, values = void 0) {
1621
- return i18n.t(locale, path, values);
608
+ return i18n.t(locale2, path, values);
1622
609
  },
1623
610
  tc(path, choice, values = void 0) {
1624
- return i18n.tc(locale, path, choice, values);
611
+ return i18n.tc(locale2, path, choice, values);
1625
612
  },
1626
613
  compute(key, values) {
1627
- return i18n.compute(locale, key, values);
614
+ return i18n.compute(locale2, key, values);
1628
615
  }
1629
616
  });
1630
617
  const fallback = "en-GB";
@@ -1636,9 +623,9 @@ const define = (options = void 0, parent = void 0) => {
1636
623
  const extend = (i18n2, options2 = void 0) => options2 ? i18n2.extend(options2) : i18n2;
1637
624
  return {
1638
625
  i18n,
1639
- init: (locale, options2 = void 0) => localize$3(
626
+ init: (locale2, options2 = void 0) => localize(
1640
627
  extend(i18n, options2),
1641
- locale
628
+ locale2
1642
629
  ),
1643
630
  fallback
1644
631
  };
@@ -1698,6 +685,7 @@ const FilterKey = Symbol("UiSelectFilter");
1698
685
  const FilteredKey = Symbol("UiSelectFiltered");
1699
686
  const TickerKey = Symbol("UiSelectTicker");
1700
687
  const MultipleKey = Symbol("UiSelectMultiple");
688
+ const ActiveOptionIdKey = Symbol("UiSelectActiveOptionId");
1701
689
  const FastenedKey = Symbol("UiSelectFastened");
1702
690
  const UnregisterOptionKey = Symbol("UiSelectUnregisterOption");
1703
691
  const RegisterOptionKey = Symbol("UiSelectRegisterOption");
@@ -1707,19 +695,20 @@ const RegisterHeaderOptionKey = Symbol("UiSelectOptionGroupRegisterHeaderOption"
1707
695
  const UnregisterHeaderOptionKey = Symbol("UiSelectOptionGroupUnregisterHeaderOption");
1708
696
  const I18nInjectKey = Symbol("$embedI18n");
1709
697
  const UiSelectTriggerType = "UiSelectTrigger";
1710
- const UiSelectTrigger = defineRemoteComponent(
698
+ const UiSelectTrigger = remote.defineRemoteComponent(
1711
699
  UiSelectTriggerType,
1712
700
  [
1713
701
  "input",
1714
702
  "focus",
1715
703
  "blur",
704
+ "keydown",
1716
705
  "clear",
1717
706
  "update:value",
1718
707
  "update:expanded"
1719
708
  ]
1720
709
  );
1721
710
  const UiSelectPopperType = "UiSelectPopper";
1722
- const UiSelectPopper = defineRemoteComponent(
711
+ const UiSelectPopper = remote.defineRemoteComponent(
1723
712
  UiSelectPopperType,
1724
713
  [
1725
714
  "update:visible",
@@ -1731,7 +720,7 @@ const UiSelectPopper = defineRemoteComponent(
1731
720
  ]
1732
721
  );
1733
722
  const UiSelectOptionType = "UiSelectOption";
1734
- defineRemoteComponent(
723
+ remote.defineRemoteComponent(
1735
724
  UiSelectOptionType
1736
725
  );
1737
726
  const _hoisted_1$3 = {
@@ -1859,11 +848,14 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
1859
848
  filter: "",
1860
849
  value: props.value
1861
850
  });
851
+ const localId = uid("ui-v1-select");
852
+ const resolvedId = vue.computed(() => props.id ?? localId);
1862
853
  const i18n = vue.computed(() => _18n.init(vue.inject(I18nInjectKey, null)?.locale ?? _18n.fallback));
1863
854
  const noResult = vue.computed(() => i18n.value.t("search.noResult", { filter: state.filter }));
1864
855
  const optionsRegistry = vue.ref([]);
856
+ const activeOptionId = vue.ref(null);
1865
857
  const selection = vue.computed(() => {
1866
- const model = arraify2(state.value);
858
+ const model = arraify(state.value);
1867
859
  const selectedOptions = [];
1868
860
  model.forEach((item) => {
1869
861
  const option = optionsRegistry.value.find((o) => equals(o.value, item));
@@ -1873,9 +865,10 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
1873
865
  });
1874
866
  return selectedOptions;
1875
867
  });
1876
- const arraify2 = (value) => Array.isArray(value) ? [...value] : typeof value === "number" || typeof value === "boolean" || value ? [value] : [];
868
+ const arraify = (value) => Array.isArray(value) ? [...value] : typeof value === "number" || typeof value === "boolean" || value ? [value] : [];
1877
869
  const equals = (a, b) => props.equalsFn(a, b);
1878
870
  const contains = (array, value) => array.some((v) => equals(v, value));
871
+ const navigableOptions = vue.computed(() => optionsRegistry.value.filter((option) => option.isMatched() && !option.disabled));
1879
872
  vue.provide(RegisterKey, (option) => {
1880
873
  if (optionsRegistry.value.some((item) => item.id === option.id)) {
1881
874
  throw new Error(`[UiSelect] Component with id ${option.id} already registered. Unregister it before using again.`);
@@ -1887,6 +880,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
1887
880
  if (option) {
1888
881
  option.label = data.label;
1889
882
  option.value = data.value;
883
+ option.disabled = data.disabled;
1890
884
  }
1891
885
  });
1892
886
  vue.provide(UnregisterKey, (id) => {
@@ -1900,7 +894,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
1900
894
  }));
1901
895
  vue.provide(ToggleKey, (value) => {
1902
896
  if (props.multiple) {
1903
- const model = arraify2(state.value);
897
+ const model = arraify(state.value);
1904
898
  const index = model.findIndex((item) => equals(item, value));
1905
899
  if (index !== -1) {
1906
900
  model.splice(index, 1);
@@ -1920,29 +914,149 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
1920
914
  vue.provide(FilteredKey, vue.computed(() => props.filterable && state.filter.length > 0));
1921
915
  vue.provide(TickerKey, vue.computed(() => props.ticker));
1922
916
  vue.provide(MultipleKey, vue.computed(() => props.multiple));
917
+ vue.provide(ActiveOptionIdKey, vue.computed(() => activeOptionId.value));
1923
918
  const onInput = (value) => {
1924
919
  state.filter = value;
1925
920
  };
921
+ const resolveHighlightedOption = (mode = "selected-first") => {
922
+ const options = navigableOptions.value;
923
+ if (options.length === 0) {
924
+ activeOptionId.value = null;
925
+ return;
926
+ }
927
+ if (mode === "first") {
928
+ activeOptionId.value = options[0].id;
929
+ return;
930
+ }
931
+ if (mode === "last") {
932
+ activeOptionId.value = options[options.length - 1].id;
933
+ return;
934
+ }
935
+ const selectedOption = options.find((option) => {
936
+ return Array.isArray(state.value) ? contains(state.value, option.value) : equals(state.value, option.value);
937
+ });
938
+ activeOptionId.value = selectedOption?.id ?? options[0].id;
939
+ };
940
+ const moveHighlight = (step) => {
941
+ const options = navigableOptions.value;
942
+ if (options.length === 0) {
943
+ activeOptionId.value = null;
944
+ return;
945
+ }
946
+ const currentIndex = options.findIndex((option) => option.id === activeOptionId.value);
947
+ const nextIndex = currentIndex === -1 ? step > 0 ? 0 : options.length - 1 : (currentIndex + step + options.length) % options.length;
948
+ activeOptionId.value = options[nextIndex].id;
949
+ };
950
+ const selectHighlightedOption = () => {
951
+ const option = navigableOptions.value.find((item) => item.id === activeOptionId.value);
952
+ if (!option) {
953
+ return;
954
+ }
955
+ if (props.multiple) {
956
+ const model = arraify(state.value);
957
+ const index = model.findIndex((item) => equals(item, option.value));
958
+ if (index !== -1) {
959
+ model.splice(index, 1);
960
+ } else {
961
+ model.push(option.value);
962
+ }
963
+ state.value = model;
964
+ } else {
965
+ state.value = option.value;
966
+ close();
967
+ }
968
+ };
969
+ const onKeyDown = (event) => {
970
+ if (props.disabled || props.readonly) {
971
+ return;
972
+ }
973
+ if (event.key === "Escape") {
974
+ close();
975
+ return;
976
+ }
977
+ if (event.key === "Tab") {
978
+ close();
979
+ return;
980
+ }
981
+ if (event.key === "Home") {
982
+ if (!state.expanded) {
983
+ state.expanded = true;
984
+ }
985
+ resolveHighlightedOption("first");
986
+ return;
987
+ }
988
+ if (event.key === "End") {
989
+ if (!state.expanded) {
990
+ state.expanded = true;
991
+ }
992
+ resolveHighlightedOption("last");
993
+ return;
994
+ }
995
+ if (event.key === "ArrowDown") {
996
+ if (!state.expanded) {
997
+ state.expanded = true;
998
+ resolveHighlightedOption("first");
999
+ return;
1000
+ }
1001
+ moveHighlight(1);
1002
+ return;
1003
+ }
1004
+ if (event.key === "ArrowUp") {
1005
+ if (!state.expanded) {
1006
+ state.expanded = true;
1007
+ resolveHighlightedOption("last");
1008
+ return;
1009
+ }
1010
+ moveHighlight(-1);
1011
+ return;
1012
+ }
1013
+ if (event.key === "Enter") {
1014
+ if (!state.expanded) {
1015
+ state.expanded = true;
1016
+ resolveHighlightedOption("selected-first");
1017
+ return;
1018
+ }
1019
+ selectHighlightedOption();
1020
+ }
1021
+ };
1926
1022
  const close = () => {
1927
1023
  if (state.expanded) {
1928
1024
  state.expanded = false;
1929
1025
  state.filter = "";
1026
+ activeOptionId.value = null;
1930
1027
  }
1931
1028
  };
1932
1029
  vue.watch(() => props.expanded, (newVal) => {
1933
1030
  state.expanded = newVal;
1934
1031
  if (!newVal) {
1935
1032
  state.filter = "";
1033
+ activeOptionId.value = null;
1936
1034
  }
1937
1035
  });
1938
1036
  vue.watch(() => props.value, (newVal) => {
1939
1037
  state.value = newVal;
1940
1038
  });
1039
+ vue.watch(() => state.expanded, (expanded) => {
1040
+ if (expanded) {
1041
+ resolveHighlightedOption("selected-first");
1042
+ } else {
1043
+ activeOptionId.value = null;
1044
+ }
1045
+ });
1046
+ vue.watch(navigableOptions, () => {
1047
+ if (!state.expanded) {
1048
+ return;
1049
+ }
1050
+ const exists = navigableOptions.value.some((option) => option.id === activeOptionId.value);
1051
+ if (!exists) {
1052
+ resolveHighlightedOption("selected-first");
1053
+ }
1054
+ });
1941
1055
  return (_ctx, _cache) => {
1942
1056
  return vue.openBlock(), vue.createBlock(vue.unref(UiPopperConnector), null, {
1943
1057
  default: vue.withCtx(() => [
1944
1058
  vue.createVNode(vue.unref(UiSelectTrigger), {
1945
- id: __props.id,
1059
+ id: resolvedId.value,
1946
1060
  value: state.value,
1947
1061
  multiple: __props.multiple,
1948
1062
  selection: selection.value,
@@ -1956,12 +1070,14 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
1956
1070
  "placeholder-only": __props.placeholderOnly,
1957
1071
  placeholder: __props.placeholder,
1958
1072
  "textbox-size": __props.textboxSize,
1073
+ "active-descendant": activeOptionId.value,
1959
1074
  onInput,
1075
+ onKeydown: onKeyDown,
1960
1076
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => state.value = $event),
1961
1077
  "onUpdate:expanded": _cache[1] || (_cache[1] = ($event) => state.expanded = $event)
1962
- }, null, 8, ["id", "value", "multiple", "selection", "filter", "filterable", "clearable", "expanded", "invalid", "disabled", "readonly", "placeholder-only", "placeholder", "textbox-size"]),
1078
+ }, null, 8, ["id", "value", "multiple", "selection", "filter", "filterable", "clearable", "expanded", "invalid", "disabled", "readonly", "placeholder-only", "placeholder", "textbox-size", "active-descendant"]),
1963
1079
  vue.createVNode(vue.unref(UiSelectPopper), {
1964
- id: __props.id,
1080
+ id: resolvedId.value,
1965
1081
  disabled: __props.disabled || __props.readonly,
1966
1082
  multiple: __props.multiple,
1967
1083
  opened: state.expanded,
@@ -2026,7 +1142,7 @@ var SIZE = /* @__PURE__ */ ((SIZE2) => {
2026
1142
  SIZE2["LG"] = "lg";
2027
1143
  return SIZE2;
2028
1144
  })(SIZE || {});
2029
- const _hoisted_1 = ["aria-selected"];
1145
+ const _hoisted_1 = ["id", "aria-selected", "aria-current"];
2030
1146
  const _hoisted_2 = ["innerHTML"];
2031
1147
  const _hoisted_3 = ["innerHTML"];
2032
1148
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
@@ -2082,8 +1198,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2082
1198
  IsSelectedKey,
2083
1199
  vue.computed(() => () => false)
2084
1200
  );
2085
- const syncInSelect = vue.inject(SyncKey, () => {
2086
- });
1201
+ const syncInSelect = vue.inject(SyncKey, (() => void 0));
2087
1202
  const registerInGroup = vue.inject(RegisterOptionKey, () => {
2088
1203
  });
2089
1204
  const registerInSelect = vue.inject(RegisterKey, () => {
@@ -2095,6 +1210,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2095
1210
  const toggle = vue.inject(ToggleKey, () => {
2096
1211
  });
2097
1212
  const fastened = vue.inject(FastenedKey, false);
1213
+ const activeOptionId = vue.inject(ActiveOptionIdKey, vue.ref(null));
2098
1214
  const filter = vue.inject(FilterKey, vue.ref(""));
2099
1215
  const filtered = vue.inject(FilteredKey, vue.ref(false));
2100
1216
  const ticker = vue.inject(TickerKey, vue.ref(false));
@@ -2105,6 +1221,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2105
1221
  description: filtered.value ? highlight$1(props.description, "font-weight: 600;") : props.description
2106
1222
  }));
2107
1223
  const matched = vue.computed(() => texts.value.label !== props.label || texts.value.description !== props.description);
1224
+ const active = vue.computed(() => props.active || activeOptionId.value === id);
2108
1225
  const selected2 = vue.computed(() => props.active || isSelected.value(props.value));
2109
1226
  const hidden = vue.computed(() => !(fastened || !filtered.value || matched.value));
2110
1227
  const onClick = () => {
@@ -2114,12 +1231,14 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2114
1231
  };
2115
1232
  const off = vue.watch([
2116
1233
  () => props.label,
2117
- () => props.value
2118
- ], ([newLabel, newValue], [oldLabel, oldValue]) => {
2119
- if (newLabel !== oldLabel || !isEqual(newValue, oldValue)) {
1234
+ () => props.value,
1235
+ () => props.disabled
1236
+ ], ([newLabel, newValue, newDisabled], [oldLabel, oldValue, oldDisabled]) => {
1237
+ if (newLabel !== oldLabel || !isEqual(newValue, oldValue) || newDisabled !== oldDisabled) {
2120
1238
  syncInSelect(id, {
2121
1239
  label: newLabel,
2122
- value: newValue
1240
+ value: newValue,
1241
+ disabled: newDisabled
2123
1242
  });
2124
1243
  }
2125
1244
  });
@@ -2128,6 +1247,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2128
1247
  id,
2129
1248
  value: props.value,
2130
1249
  label: props.label,
1250
+ disabled: props.disabled,
2131
1251
  isMatched: () => !filtered.value || matched.value
2132
1252
  };
2133
1253
  registerInSelect(option);
@@ -2139,10 +1259,12 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2139
1259
  unregisterInGroup(id);
2140
1260
  });
2141
1261
  return (_ctx, _cache) => {
2142
- return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(_ctx.$attrs, {
1262
+ return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({ id: vue.unref(id) }, _ctx.$attrs, {
2143
1263
  "aria-selected": selected2.value ? "true" : "false",
1264
+ "aria-current": active.value ? "true" : void 0,
2144
1265
  class: {
2145
1266
  "ui-v1-select-option": true,
1267
+ "ui-v1-select-option_active": active.value,
2146
1268
  "ui-v1-select-option_selected": selected2.value,
2147
1269
  "ui-v1-select-option_disabled": __props.disabled,
2148
1270
  "ui-v1-select-option_hidden": hidden.value
@@ -2156,6 +1278,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2156
1278
  }, () => [
2157
1279
  vue.createVNode(vue.unref(UiMenuItem), {
2158
1280
  accent: __props.accent,
1281
+ active: active.value,
2159
1282
  counter: __props.counter,
2160
1283
  disabled: __props.disabled,
2161
1284
  size: __props.size,
@@ -2199,7 +1322,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2199
1322
  ]),
2200
1323
  key: "1"
2201
1324
  } : void 0
2202
- ]), 1032, ["accent", "counter", "disabled", "size", "ticker"])
1325
+ ]), 1032, ["accent", "active", "counter", "disabled", "size", "ticker"])
2203
1326
  ])
2204
1327
  ], 16, _hoisted_1);
2205
1328
  };
@@ -2373,7 +1496,7 @@ const createEndpointRoot = async (channel) => {
2373
1496
  "UiTransition",
2374
1497
  "UiYandexMap"
2375
1498
  ];
2376
- return createRemoteRoot(channel, {
1499
+ return remote.createRemoteRoot(channel, {
2377
1500
  components: defaultRemoteEndpointComponents
2378
1501
  });
2379
1502
  };
@@ -2390,1607 +1513,12 @@ const usePreview = (workers = vue.ref([])) => {
2390
1513
  preview: (url, resize = void 0, crop = void 0) => imagePreview.preview(_workers.value, url, resize, crop)
2391
1514
  };
2392
1515
  };
2393
- function buildFormatLongFn(args) {
2394
- return (options = {}) => {
2395
- const width = options.width ? String(options.width) : args.defaultWidth;
2396
- const format = args.formats[width] || args.formats[args.defaultWidth];
2397
- return format;
2398
- };
2399
- }
2400
- function buildLocalizeFn(args) {
2401
- return (value, options) => {
2402
- const context = options?.context ? String(options.context) : "standalone";
2403
- let valuesArray;
2404
- if (context === "formatting" && args.formattingValues) {
2405
- const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
2406
- const width = options?.width ? String(options.width) : defaultWidth;
2407
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
2408
- } else {
2409
- const defaultWidth = args.defaultWidth;
2410
- const width = options?.width ? String(options.width) : args.defaultWidth;
2411
- valuesArray = args.values[width] || args.values[defaultWidth];
2412
- }
2413
- const index = args.argumentCallback ? args.argumentCallback(value) : value;
2414
- return valuesArray[index];
2415
- };
2416
- }
2417
- function buildMatchFn(args) {
2418
- return (string, options = {}) => {
2419
- const width = options.width;
2420
- const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
2421
- const matchResult = string.match(matchPattern);
2422
- if (!matchResult) {
2423
- return null;
2424
- }
2425
- const matchedString = matchResult[0];
2426
- const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
2427
- const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
2428
- // [TODO] -- I challenge you to fix the type
2429
- findKey(parsePatterns, (pattern) => pattern.test(matchedString))
2430
- );
2431
- let value;
2432
- value = args.valueCallback ? args.valueCallback(key) : key;
2433
- value = options.valueCallback ? (
2434
- // [TODO] -- I challenge you to fix the type
2435
- options.valueCallback(value)
2436
- ) : value;
2437
- const rest = string.slice(matchedString.length);
2438
- return { value, rest };
2439
- };
2440
- }
2441
- function findKey(object, predicate) {
2442
- for (const key in object) {
2443
- if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
2444
- return key;
2445
- }
2446
- }
2447
- return void 0;
2448
- }
2449
- function findIndex(array, predicate) {
2450
- for (let key = 0; key < array.length; key++) {
2451
- if (predicate(array[key])) {
2452
- return key;
2453
- }
2454
- }
2455
- return void 0;
2456
- }
2457
- function buildMatchPatternFn(args) {
2458
- return (string, options = {}) => {
2459
- const matchResult = string.match(args.matchPattern);
2460
- if (!matchResult) return null;
2461
- const matchedString = matchResult[0];
2462
- const parseResult = string.match(args.parsePattern);
2463
- if (!parseResult) return null;
2464
- let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
2465
- value = options.valueCallback ? options.valueCallback(value) : value;
2466
- const rest = string.slice(matchedString.length);
2467
- return { value, rest };
2468
- };
2469
- }
2470
- const constructFromSymbol = Symbol.for("constructDateFrom");
2471
- function constructFrom(date, value) {
2472
- if (typeof date === "function") return date(value);
2473
- if (date && typeof date === "object" && constructFromSymbol in date)
2474
- return date[constructFromSymbol](value);
2475
- if (date instanceof Date) return new date.constructor(value);
2476
- return new Date(value);
2477
- }
2478
- function normalizeDates(context, ...dates) {
2479
- const normalize = constructFrom.bind(
2480
- null,
2481
- context || dates.find((date) => typeof date === "object")
2482
- );
2483
- return dates.map(normalize);
2484
- }
2485
- let defaultOptions = {};
2486
- function getDefaultOptions() {
2487
- return defaultOptions;
2488
- }
2489
- function toDate(argument, context) {
2490
- return constructFrom(context || argument, argument);
2491
- }
2492
- function startOfWeek(date, options) {
2493
- const defaultOptions2 = getDefaultOptions();
2494
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
2495
- const _date = toDate(date, options?.in);
2496
- const day = _date.getDay();
2497
- const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
2498
- _date.setDate(_date.getDate() - diff);
2499
- _date.setHours(0, 0, 0, 0);
2500
- return _date;
2501
- }
2502
- function isSameWeek(laterDate, earlierDate, options) {
2503
- const [laterDate_, earlierDate_] = normalizeDates(
2504
- options?.in,
2505
- laterDate,
2506
- earlierDate
2507
- );
2508
- return +startOfWeek(laterDate_, options) === +startOfWeek(earlierDate_, options);
2509
- }
2510
- const formatDistanceLocale$2 = {
2511
- lessThanXSeconds: {
2512
- one: "less than a second",
2513
- other: "less than {{count}} seconds"
2514
- },
2515
- xSeconds: {
2516
- one: "1 second",
2517
- other: "{{count}} seconds"
2518
- },
2519
- halfAMinute: "half a minute",
2520
- lessThanXMinutes: {
2521
- one: "less than a minute",
2522
- other: "less than {{count}} minutes"
2523
- },
2524
- xMinutes: {
2525
- one: "1 minute",
2526
- other: "{{count}} minutes"
2527
- },
2528
- aboutXHours: {
2529
- one: "about 1 hour",
2530
- other: "about {{count}} hours"
2531
- },
2532
- xHours: {
2533
- one: "1 hour",
2534
- other: "{{count}} hours"
2535
- },
2536
- xDays: {
2537
- one: "1 day",
2538
- other: "{{count}} days"
2539
- },
2540
- aboutXWeeks: {
2541
- one: "about 1 week",
2542
- other: "about {{count}} weeks"
2543
- },
2544
- xWeeks: {
2545
- one: "1 week",
2546
- other: "{{count}} weeks"
2547
- },
2548
- aboutXMonths: {
2549
- one: "about 1 month",
2550
- other: "about {{count}} months"
2551
- },
2552
- xMonths: {
2553
- one: "1 month",
2554
- other: "{{count}} months"
2555
- },
2556
- aboutXYears: {
2557
- one: "about 1 year",
2558
- other: "about {{count}} years"
2559
- },
2560
- xYears: {
2561
- one: "1 year",
2562
- other: "{{count}} years"
2563
- },
2564
- overXYears: {
2565
- one: "over 1 year",
2566
- other: "over {{count}} years"
2567
- },
2568
- almostXYears: {
2569
- one: "almost 1 year",
2570
- other: "almost {{count}} years"
2571
- }
2572
- };
2573
- const formatDistance$2 = (token, count, options) => {
2574
- let result;
2575
- const tokenValue = formatDistanceLocale$2[token];
2576
- if (typeof tokenValue === "string") {
2577
- result = tokenValue;
2578
- } else if (count === 1) {
2579
- result = tokenValue.one;
2580
- } else {
2581
- result = tokenValue.other.replace("{{count}}", count.toString());
2582
- }
2583
- if (options?.addSuffix) {
2584
- if (options.comparison && options.comparison > 0) {
2585
- return "in " + result;
2586
- } else {
2587
- return result + " ago";
2588
- }
2589
- }
2590
- return result;
2591
- };
2592
- const formatRelativeLocale$2 = {
2593
- lastWeek: "'last' eeee 'at' p",
2594
- yesterday: "'yesterday at' p",
2595
- today: "'today at' p",
2596
- tomorrow: "'tomorrow at' p",
2597
- nextWeek: "eeee 'at' p",
2598
- other: "P"
2599
- };
2600
- const formatRelative$2 = (token, _date, _baseDate, _options) => formatRelativeLocale$2[token];
2601
- const eraValues$2 = {
2602
- narrow: ["B", "A"],
2603
- abbreviated: ["BC", "AD"],
2604
- wide: ["Before Christ", "Anno Domini"]
2605
- };
2606
- const quarterValues$2 = {
2607
- narrow: ["1", "2", "3", "4"],
2608
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
2609
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
2610
- };
2611
- const monthValues$2 = {
2612
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
2613
- abbreviated: [
2614
- "Jan",
2615
- "Feb",
2616
- "Mar",
2617
- "Apr",
2618
- "May",
2619
- "Jun",
2620
- "Jul",
2621
- "Aug",
2622
- "Sep",
2623
- "Oct",
2624
- "Nov",
2625
- "Dec"
2626
- ],
2627
- wide: [
2628
- "January",
2629
- "February",
2630
- "March",
2631
- "April",
2632
- "May",
2633
- "June",
2634
- "July",
2635
- "August",
2636
- "September",
2637
- "October",
2638
- "November",
2639
- "December"
2640
- ]
2641
- };
2642
- const dayValues$2 = {
2643
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
2644
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
2645
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
2646
- wide: [
2647
- "Sunday",
2648
- "Monday",
2649
- "Tuesday",
2650
- "Wednesday",
2651
- "Thursday",
2652
- "Friday",
2653
- "Saturday"
2654
- ]
2655
- };
2656
- const dayPeriodValues$2 = {
2657
- narrow: {
2658
- am: "a",
2659
- pm: "p",
2660
- midnight: "mi",
2661
- noon: "n",
2662
- morning: "morning",
2663
- afternoon: "afternoon",
2664
- evening: "evening",
2665
- night: "night"
2666
- },
2667
- abbreviated: {
2668
- am: "AM",
2669
- pm: "PM",
2670
- midnight: "midnight",
2671
- noon: "noon",
2672
- morning: "morning",
2673
- afternoon: "afternoon",
2674
- evening: "evening",
2675
- night: "night"
2676
- },
2677
- wide: {
2678
- am: "a.m.",
2679
- pm: "p.m.",
2680
- midnight: "midnight",
2681
- noon: "noon",
2682
- morning: "morning",
2683
- afternoon: "afternoon",
2684
- evening: "evening",
2685
- night: "night"
2686
- }
2687
- };
2688
- const formattingDayPeriodValues$2 = {
2689
- narrow: {
2690
- am: "a",
2691
- pm: "p",
2692
- midnight: "mi",
2693
- noon: "n",
2694
- morning: "in the morning",
2695
- afternoon: "in the afternoon",
2696
- evening: "in the evening",
2697
- night: "at night"
2698
- },
2699
- abbreviated: {
2700
- am: "AM",
2701
- pm: "PM",
2702
- midnight: "midnight",
2703
- noon: "noon",
2704
- morning: "in the morning",
2705
- afternoon: "in the afternoon",
2706
- evening: "in the evening",
2707
- night: "at night"
2708
- },
2709
- wide: {
2710
- am: "a.m.",
2711
- pm: "p.m.",
2712
- midnight: "midnight",
2713
- noon: "noon",
2714
- morning: "in the morning",
2715
- afternoon: "in the afternoon",
2716
- evening: "in the evening",
2717
- night: "at night"
2718
- }
2719
- };
2720
- const ordinalNumber$2 = (dirtyNumber, _options) => {
2721
- const number = Number(dirtyNumber);
2722
- const rem100 = number % 100;
2723
- if (rem100 > 20 || rem100 < 10) {
2724
- switch (rem100 % 10) {
2725
- case 1:
2726
- return number + "st";
2727
- case 2:
2728
- return number + "nd";
2729
- case 3:
2730
- return number + "rd";
2731
- }
2732
- }
2733
- return number + "th";
2734
- };
2735
- const localize$2 = {
2736
- ordinalNumber: ordinalNumber$2,
2737
- era: buildLocalizeFn({
2738
- values: eraValues$2,
2739
- defaultWidth: "wide"
2740
- }),
2741
- quarter: buildLocalizeFn({
2742
- values: quarterValues$2,
2743
- defaultWidth: "wide",
2744
- argumentCallback: (quarter) => quarter - 1
2745
- }),
2746
- month: buildLocalizeFn({
2747
- values: monthValues$2,
2748
- defaultWidth: "wide"
2749
- }),
2750
- day: buildLocalizeFn({
2751
- values: dayValues$2,
2752
- defaultWidth: "wide"
2753
- }),
2754
- dayPeriod: buildLocalizeFn({
2755
- values: dayPeriodValues$2,
2756
- defaultWidth: "wide",
2757
- formattingValues: formattingDayPeriodValues$2,
2758
- defaultFormattingWidth: "wide"
2759
- })
2760
- };
2761
- const matchOrdinalNumberPattern$2 = /^(\d+)(th|st|nd|rd)?/i;
2762
- const parseOrdinalNumberPattern$2 = /\d+/i;
2763
- const matchEraPatterns$2 = {
2764
- narrow: /^(b|a)/i,
2765
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
2766
- wide: /^(before christ|before common era|anno domini|common era)/i
2767
- };
2768
- const parseEraPatterns$2 = {
2769
- any: [/^b/i, /^(a|c)/i]
2770
- };
2771
- const matchQuarterPatterns$2 = {
2772
- narrow: /^[1234]/i,
2773
- abbreviated: /^q[1234]/i,
2774
- wide: /^[1234](th|st|nd|rd)? quarter/i
2775
- };
2776
- const parseQuarterPatterns$2 = {
2777
- any: [/1/i, /2/i, /3/i, /4/i]
2778
- };
2779
- const matchMonthPatterns$2 = {
2780
- narrow: /^[jfmasond]/i,
2781
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
2782
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
2783
- };
2784
- const parseMonthPatterns$2 = {
2785
- narrow: [
2786
- /^j/i,
2787
- /^f/i,
2788
- /^m/i,
2789
- /^a/i,
2790
- /^m/i,
2791
- /^j/i,
2792
- /^j/i,
2793
- /^a/i,
2794
- /^s/i,
2795
- /^o/i,
2796
- /^n/i,
2797
- /^d/i
2798
- ],
2799
- any: [
2800
- /^ja/i,
2801
- /^f/i,
2802
- /^mar/i,
2803
- /^ap/i,
2804
- /^may/i,
2805
- /^jun/i,
2806
- /^jul/i,
2807
- /^au/i,
2808
- /^s/i,
2809
- /^o/i,
2810
- /^n/i,
2811
- /^d/i
2812
- ]
2813
- };
2814
- const matchDayPatterns$2 = {
2815
- narrow: /^[smtwf]/i,
2816
- short: /^(su|mo|tu|we|th|fr|sa)/i,
2817
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
2818
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
2819
- };
2820
- const parseDayPatterns$2 = {
2821
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
2822
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
2823
- };
2824
- const matchDayPeriodPatterns$2 = {
2825
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
2826
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
2827
- };
2828
- const parseDayPeriodPatterns$2 = {
2829
- any: {
2830
- am: /^a/i,
2831
- pm: /^p/i,
2832
- midnight: /^mi/i,
2833
- noon: /^no/i,
2834
- morning: /morning/i,
2835
- afternoon: /afternoon/i,
2836
- evening: /evening/i,
2837
- night: /night/i
2838
- }
2839
- };
2840
- const match$2 = {
2841
- ordinalNumber: buildMatchPatternFn({
2842
- matchPattern: matchOrdinalNumberPattern$2,
2843
- parsePattern: parseOrdinalNumberPattern$2,
2844
- valueCallback: (value) => parseInt(value, 10)
2845
- }),
2846
- era: buildMatchFn({
2847
- matchPatterns: matchEraPatterns$2,
2848
- defaultMatchWidth: "wide",
2849
- parsePatterns: parseEraPatterns$2,
2850
- defaultParseWidth: "any"
2851
- }),
2852
- quarter: buildMatchFn({
2853
- matchPatterns: matchQuarterPatterns$2,
2854
- defaultMatchWidth: "wide",
2855
- parsePatterns: parseQuarterPatterns$2,
2856
- defaultParseWidth: "any",
2857
- valueCallback: (index) => index + 1
2858
- }),
2859
- month: buildMatchFn({
2860
- matchPatterns: matchMonthPatterns$2,
2861
- defaultMatchWidth: "wide",
2862
- parsePatterns: parseMonthPatterns$2,
2863
- defaultParseWidth: "any"
2864
- }),
2865
- day: buildMatchFn({
2866
- matchPatterns: matchDayPatterns$2,
2867
- defaultMatchWidth: "wide",
2868
- parsePatterns: parseDayPatterns$2,
2869
- defaultParseWidth: "any"
2870
- }),
2871
- dayPeriod: buildMatchFn({
2872
- matchPatterns: matchDayPeriodPatterns$2,
2873
- defaultMatchWidth: "any",
2874
- parsePatterns: parseDayPeriodPatterns$2,
2875
- defaultParseWidth: "any"
2876
- })
2877
- };
2878
- const dateFormats$2 = {
2879
- full: "EEEE, d MMMM yyyy",
2880
- long: "d MMMM yyyy",
2881
- medium: "d MMM yyyy",
2882
- short: "dd/MM/yyyy"
2883
- };
2884
- const timeFormats$2 = {
2885
- full: "HH:mm:ss zzzz",
2886
- long: "HH:mm:ss z",
2887
- medium: "HH:mm:ss",
2888
- short: "HH:mm"
2889
- };
2890
- const dateTimeFormats$2 = {
2891
- full: "{{date}} 'at' {{time}}",
2892
- long: "{{date}} 'at' {{time}}",
2893
- medium: "{{date}}, {{time}}",
2894
- short: "{{date}}, {{time}}"
2895
- };
2896
- const formatLong$2 = {
2897
- date: buildFormatLongFn({
2898
- formats: dateFormats$2,
2899
- defaultWidth: "full"
2900
- }),
2901
- time: buildFormatLongFn({
2902
- formats: timeFormats$2,
2903
- defaultWidth: "full"
2904
- }),
2905
- dateTime: buildFormatLongFn({
2906
- formats: dateTimeFormats$2,
2907
- defaultWidth: "full"
2908
- })
2909
- };
2910
- const enGB = {
2911
- code: "en-GB",
2912
- formatDistance: formatDistance$2,
2913
- formatLong: formatLong$2,
2914
- formatRelative: formatRelative$2,
2915
- localize: localize$2,
2916
- match: match$2,
2917
- options: {
2918
- weekStartsOn: 1,
2919
- firstWeekContainsDate: 4
2920
- }
2921
- };
2922
- const formatDistanceLocale$1 = {
2923
- lessThanXSeconds: {
2924
- one: "menos de un segundo",
2925
- other: "menos de {{count}} segundos"
2926
- },
2927
- xSeconds: {
2928
- one: "1 segundo",
2929
- other: "{{count}} segundos"
2930
- },
2931
- halfAMinute: "medio minuto",
2932
- lessThanXMinutes: {
2933
- one: "menos de un minuto",
2934
- other: "menos de {{count}} minutos"
2935
- },
2936
- xMinutes: {
2937
- one: "1 minuto",
2938
- other: "{{count}} minutos"
2939
- },
2940
- aboutXHours: {
2941
- one: "alrededor de 1 hora",
2942
- other: "alrededor de {{count}} horas"
2943
- },
2944
- xHours: {
2945
- one: "1 hora",
2946
- other: "{{count}} horas"
2947
- },
2948
- xDays: {
2949
- one: "1 día",
2950
- other: "{{count}} días"
2951
- },
2952
- aboutXWeeks: {
2953
- one: "alrededor de 1 semana",
2954
- other: "alrededor de {{count}} semanas"
2955
- },
2956
- xWeeks: {
2957
- one: "1 semana",
2958
- other: "{{count}} semanas"
2959
- },
2960
- aboutXMonths: {
2961
- one: "alrededor de 1 mes",
2962
- other: "alrededor de {{count}} meses"
2963
- },
2964
- xMonths: {
2965
- one: "1 mes",
2966
- other: "{{count}} meses"
2967
- },
2968
- aboutXYears: {
2969
- one: "alrededor de 1 año",
2970
- other: "alrededor de {{count}} años"
2971
- },
2972
- xYears: {
2973
- one: "1 año",
2974
- other: "{{count}} años"
2975
- },
2976
- overXYears: {
2977
- one: "más de 1 año",
2978
- other: "más de {{count}} años"
2979
- },
2980
- almostXYears: {
2981
- one: "casi 1 año",
2982
- other: "casi {{count}} años"
2983
- }
2984
- };
2985
- const formatDistance$1 = (token, count, options) => {
2986
- let result;
2987
- const tokenValue = formatDistanceLocale$1[token];
2988
- if (typeof tokenValue === "string") {
2989
- result = tokenValue;
2990
- } else if (count === 1) {
2991
- result = tokenValue.one;
2992
- } else {
2993
- result = tokenValue.other.replace("{{count}}", count.toString());
2994
- }
2995
- if (options?.addSuffix) {
2996
- if (options.comparison && options.comparison > 0) {
2997
- return "en " + result;
2998
- } else {
2999
- return "hace " + result;
3000
- }
3001
- }
3002
- return result;
3003
- };
3004
- const dateFormats$1 = {
3005
- full: "EEEE, d 'de' MMMM 'de' y",
3006
- long: "d 'de' MMMM 'de' y",
3007
- medium: "d MMM y",
3008
- short: "dd/MM/y"
3009
- };
3010
- const timeFormats$1 = {
3011
- full: "HH:mm:ss zzzz",
3012
- long: "HH:mm:ss z",
3013
- medium: "HH:mm:ss",
3014
- short: "HH:mm"
3015
- };
3016
- const dateTimeFormats$1 = {
3017
- full: "{{date}} 'a las' {{time}}",
3018
- long: "{{date}} 'a las' {{time}}",
3019
- medium: "{{date}}, {{time}}",
3020
- short: "{{date}}, {{time}}"
3021
- };
3022
- const formatLong$1 = {
3023
- date: buildFormatLongFn({
3024
- formats: dateFormats$1,
3025
- defaultWidth: "full"
3026
- }),
3027
- time: buildFormatLongFn({
3028
- formats: timeFormats$1,
3029
- defaultWidth: "full"
3030
- }),
3031
- dateTime: buildFormatLongFn({
3032
- formats: dateTimeFormats$1,
3033
- defaultWidth: "full"
3034
- })
3035
- };
3036
- const formatRelativeLocale$1 = {
3037
- lastWeek: "'el' eeee 'pasado a la' p",
3038
- yesterday: "'ayer a la' p",
3039
- today: "'hoy a la' p",
3040
- tomorrow: "'mañana a la' p",
3041
- nextWeek: "eeee 'a la' p",
3042
- other: "P"
3043
- };
3044
- const formatRelativeLocalePlural = {
3045
- lastWeek: "'el' eeee 'pasado a las' p",
3046
- yesterday: "'ayer a las' p",
3047
- today: "'hoy a las' p",
3048
- tomorrow: "'mañana a las' p",
3049
- nextWeek: "eeee 'a las' p",
3050
- other: "P"
3051
- };
3052
- const formatRelative$1 = (token, date, _baseDate, _options) => {
3053
- if (date.getHours() !== 1) {
3054
- return formatRelativeLocalePlural[token];
3055
- } else {
3056
- return formatRelativeLocale$1[token];
3057
- }
3058
- };
3059
- const eraValues$1 = {
3060
- narrow: ["AC", "DC"],
3061
- abbreviated: ["AC", "DC"],
3062
- wide: ["antes de cristo", "después de cristo"]
3063
- };
3064
- const quarterValues$1 = {
3065
- narrow: ["1", "2", "3", "4"],
3066
- abbreviated: ["T1", "T2", "T3", "T4"],
3067
- wide: ["1º trimestre", "2º trimestre", "3º trimestre", "4º trimestre"]
3068
- };
3069
- const monthValues$1 = {
3070
- narrow: ["e", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"],
3071
- abbreviated: [
3072
- "ene",
3073
- "feb",
3074
- "mar",
3075
- "abr",
3076
- "may",
3077
- "jun",
3078
- "jul",
3079
- "ago",
3080
- "sep",
3081
- "oct",
3082
- "nov",
3083
- "dic"
3084
- ],
3085
- wide: [
3086
- "enero",
3087
- "febrero",
3088
- "marzo",
3089
- "abril",
3090
- "mayo",
3091
- "junio",
3092
- "julio",
3093
- "agosto",
3094
- "septiembre",
3095
- "octubre",
3096
- "noviembre",
3097
- "diciembre"
3098
- ]
3099
- };
3100
- const dayValues$1 = {
3101
- narrow: ["d", "l", "m", "m", "j", "v", "s"],
3102
- short: ["do", "lu", "ma", "mi", "ju", "vi", "sá"],
3103
- abbreviated: ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"],
3104
- wide: [
3105
- "domingo",
3106
- "lunes",
3107
- "martes",
3108
- "miércoles",
3109
- "jueves",
3110
- "viernes",
3111
- "sábado"
3112
- ]
3113
- };
3114
- const dayPeriodValues$1 = {
3115
- narrow: {
3116
- am: "a",
3117
- pm: "p",
3118
- midnight: "mn",
3119
- noon: "md",
3120
- morning: "mañana",
3121
- afternoon: "tarde",
3122
- evening: "tarde",
3123
- night: "noche"
3124
- },
3125
- abbreviated: {
3126
- am: "AM",
3127
- pm: "PM",
3128
- midnight: "medianoche",
3129
- noon: "mediodia",
3130
- morning: "mañana",
3131
- afternoon: "tarde",
3132
- evening: "tarde",
3133
- night: "noche"
3134
- },
3135
- wide: {
3136
- am: "a.m.",
3137
- pm: "p.m.",
3138
- midnight: "medianoche",
3139
- noon: "mediodia",
3140
- morning: "mañana",
3141
- afternoon: "tarde",
3142
- evening: "tarde",
3143
- night: "noche"
3144
- }
3145
- };
3146
- const formattingDayPeriodValues$1 = {
3147
- narrow: {
3148
- am: "a",
3149
- pm: "p",
3150
- midnight: "mn",
3151
- noon: "md",
3152
- morning: "de la mañana",
3153
- afternoon: "de la tarde",
3154
- evening: "de la tarde",
3155
- night: "de la noche"
3156
- },
3157
- abbreviated: {
3158
- am: "AM",
3159
- pm: "PM",
3160
- midnight: "medianoche",
3161
- noon: "mediodia",
3162
- morning: "de la mañana",
3163
- afternoon: "de la tarde",
3164
- evening: "de la tarde",
3165
- night: "de la noche"
3166
- },
3167
- wide: {
3168
- am: "a.m.",
3169
- pm: "p.m.",
3170
- midnight: "medianoche",
3171
- noon: "mediodia",
3172
- morning: "de la mañana",
3173
- afternoon: "de la tarde",
3174
- evening: "de la tarde",
3175
- night: "de la noche"
3176
- }
3177
- };
3178
- const ordinalNumber$1 = (dirtyNumber, _options) => {
3179
- const number = Number(dirtyNumber);
3180
- return number + "º";
3181
- };
3182
- const localize$1 = {
3183
- ordinalNumber: ordinalNumber$1,
3184
- era: buildLocalizeFn({
3185
- values: eraValues$1,
3186
- defaultWidth: "wide"
3187
- }),
3188
- quarter: buildLocalizeFn({
3189
- values: quarterValues$1,
3190
- defaultWidth: "wide",
3191
- argumentCallback: (quarter) => Number(quarter) - 1
3192
- }),
3193
- month: buildLocalizeFn({
3194
- values: monthValues$1,
3195
- defaultWidth: "wide"
3196
- }),
3197
- day: buildLocalizeFn({
3198
- values: dayValues$1,
3199
- defaultWidth: "wide"
3200
- }),
3201
- dayPeriod: buildLocalizeFn({
3202
- values: dayPeriodValues$1,
3203
- defaultWidth: "wide",
3204
- formattingValues: formattingDayPeriodValues$1,
3205
- defaultFormattingWidth: "wide"
3206
- })
3207
- };
3208
- const matchOrdinalNumberPattern$1 = /^(\d+)(º)?/i;
3209
- const parseOrdinalNumberPattern$1 = /\d+/i;
3210
- const matchEraPatterns$1 = {
3211
- narrow: /^(ac|dc|a|d)/i,
3212
- abbreviated: /^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,
3213
- wide: /^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i
3214
- };
3215
- const parseEraPatterns$1 = {
3216
- any: [/^ac/i, /^dc/i],
3217
- wide: [
3218
- /^(antes de cristo|antes de la era com[uú]n)/i,
3219
- /^(despu[eé]s de cristo|era com[uú]n)/i
3220
- ]
3221
- };
3222
- const matchQuarterPatterns$1 = {
3223
- narrow: /^[1234]/i,
3224
- abbreviated: /^T[1234]/i,
3225
- wide: /^[1234](º)? trimestre/i
3226
- };
3227
- const parseQuarterPatterns$1 = {
3228
- any: [/1/i, /2/i, /3/i, /4/i]
3229
- };
3230
- const matchMonthPatterns$1 = {
3231
- narrow: /^[efmajsond]/i,
3232
- abbreviated: /^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,
3233
- wide: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i
3234
- };
3235
- const parseMonthPatterns$1 = {
3236
- narrow: [
3237
- /^e/i,
3238
- /^f/i,
3239
- /^m/i,
3240
- /^a/i,
3241
- /^m/i,
3242
- /^j/i,
3243
- /^j/i,
3244
- /^a/i,
3245
- /^s/i,
3246
- /^o/i,
3247
- /^n/i,
3248
- /^d/i
3249
- ],
3250
- any: [
3251
- /^en/i,
3252
- /^feb/i,
3253
- /^mar/i,
3254
- /^abr/i,
3255
- /^may/i,
3256
- /^jun/i,
3257
- /^jul/i,
3258
- /^ago/i,
3259
- /^sep/i,
3260
- /^oct/i,
3261
- /^nov/i,
3262
- /^dic/i
3263
- ]
3264
- };
3265
- const matchDayPatterns$1 = {
3266
- narrow: /^[dlmjvs]/i,
3267
- short: /^(do|lu|ma|mi|ju|vi|s[áa])/i,
3268
- abbreviated: /^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,
3269
- wide: /^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i
3270
- };
3271
- const parseDayPatterns$1 = {
3272
- narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],
3273
- any: [/^do/i, /^lu/i, /^ma/i, /^mi/i, /^ju/i, /^vi/i, /^sa/i]
3274
- };
3275
- const matchDayPeriodPatterns$1 = {
3276
- narrow: /^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,
3277
- any: /^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i
3278
- };
3279
- const parseDayPeriodPatterns$1 = {
3280
- any: {
3281
- am: /^a/i,
3282
- pm: /^p/i,
3283
- midnight: /^mn/i,
3284
- noon: /^md/i,
3285
- morning: /mañana/i,
3286
- afternoon: /tarde/i,
3287
- evening: /tarde/i,
3288
- night: /noche/i
3289
- }
3290
- };
3291
- const match$1 = {
3292
- ordinalNumber: buildMatchPatternFn({
3293
- matchPattern: matchOrdinalNumberPattern$1,
3294
- parsePattern: parseOrdinalNumberPattern$1,
3295
- valueCallback: function(value) {
3296
- return parseInt(value, 10);
3297
- }
3298
- }),
3299
- era: buildMatchFn({
3300
- matchPatterns: matchEraPatterns$1,
3301
- defaultMatchWidth: "wide",
3302
- parsePatterns: parseEraPatterns$1,
3303
- defaultParseWidth: "any"
3304
- }),
3305
- quarter: buildMatchFn({
3306
- matchPatterns: matchQuarterPatterns$1,
3307
- defaultMatchWidth: "wide",
3308
- parsePatterns: parseQuarterPatterns$1,
3309
- defaultParseWidth: "any",
3310
- valueCallback: (index) => index + 1
3311
- }),
3312
- month: buildMatchFn({
3313
- matchPatterns: matchMonthPatterns$1,
3314
- defaultMatchWidth: "wide",
3315
- parsePatterns: parseMonthPatterns$1,
3316
- defaultParseWidth: "any"
3317
- }),
3318
- day: buildMatchFn({
3319
- matchPatterns: matchDayPatterns$1,
3320
- defaultMatchWidth: "wide",
3321
- parsePatterns: parseDayPatterns$1,
3322
- defaultParseWidth: "any"
3323
- }),
3324
- dayPeriod: buildMatchFn({
3325
- matchPatterns: matchDayPeriodPatterns$1,
3326
- defaultMatchWidth: "any",
3327
- parsePatterns: parseDayPeriodPatterns$1,
3328
- defaultParseWidth: "any"
3329
- })
3330
- };
3331
- const es = {
3332
- code: "es",
3333
- formatDistance: formatDistance$1,
3334
- formatLong: formatLong$1,
3335
- formatRelative: formatRelative$1,
3336
- localize: localize$1,
3337
- match: match$1,
3338
- options: {
3339
- weekStartsOn: 1,
3340
- firstWeekContainsDate: 1
3341
- }
3342
- };
3343
- function declension(scheme, count) {
3344
- if (scheme.one !== void 0 && count === 1) {
3345
- return scheme.one;
3346
- }
3347
- const rem10 = count % 10;
3348
- const rem100 = count % 100;
3349
- if (rem10 === 1 && rem100 !== 11) {
3350
- return scheme.singularNominative.replace("{{count}}", String(count));
3351
- } else if (rem10 >= 2 && rem10 <= 4 && (rem100 < 10 || rem100 > 20)) {
3352
- return scheme.singularGenitive.replace("{{count}}", String(count));
3353
- } else {
3354
- return scheme.pluralGenitive.replace("{{count}}", String(count));
3355
- }
3356
- }
3357
- function buildLocalizeTokenFn(scheme) {
3358
- return (count, options) => {
3359
- if (options?.addSuffix) {
3360
- if (options.comparison && options.comparison > 0) {
3361
- if (scheme.future) {
3362
- return declension(scheme.future, count);
3363
- } else {
3364
- return "через " + declension(scheme.regular, count);
3365
- }
3366
- } else {
3367
- if (scheme.past) {
3368
- return declension(scheme.past, count);
3369
- } else {
3370
- return declension(scheme.regular, count) + " назад";
3371
- }
3372
- }
3373
- } else {
3374
- return declension(scheme.regular, count);
3375
- }
3376
- };
3377
- }
3378
- const formatDistanceLocale = {
3379
- lessThanXSeconds: buildLocalizeTokenFn({
3380
- regular: {
3381
- one: "меньше секунды",
3382
- singularNominative: "меньше {{count}} секунды",
3383
- singularGenitive: "меньше {{count}} секунд",
3384
- pluralGenitive: "меньше {{count}} секунд"
3385
- },
3386
- future: {
3387
- one: "меньше, чем через секунду",
3388
- singularNominative: "меньше, чем через {{count}} секунду",
3389
- singularGenitive: "меньше, чем через {{count}} секунды",
3390
- pluralGenitive: "меньше, чем через {{count}} секунд"
3391
- }
3392
- }),
3393
- xSeconds: buildLocalizeTokenFn({
3394
- regular: {
3395
- singularNominative: "{{count}} секунда",
3396
- singularGenitive: "{{count}} секунды",
3397
- pluralGenitive: "{{count}} секунд"
3398
- },
3399
- past: {
3400
- singularNominative: "{{count}} секунду назад",
3401
- singularGenitive: "{{count}} секунды назад",
3402
- pluralGenitive: "{{count}} секунд назад"
3403
- },
3404
- future: {
3405
- singularNominative: "через {{count}} секунду",
3406
- singularGenitive: "через {{count}} секунды",
3407
- pluralGenitive: "через {{count}} секунд"
3408
- }
3409
- }),
3410
- halfAMinute: (_count, options) => {
3411
- if (options?.addSuffix) {
3412
- if (options.comparison && options.comparison > 0) {
3413
- return "через полминуты";
3414
- } else {
3415
- return "полминуты назад";
3416
- }
3417
- }
3418
- return "полминуты";
3419
- },
3420
- lessThanXMinutes: buildLocalizeTokenFn({
3421
- regular: {
3422
- one: "меньше минуты",
3423
- singularNominative: "меньше {{count}} минуты",
3424
- singularGenitive: "меньше {{count}} минут",
3425
- pluralGenitive: "меньше {{count}} минут"
3426
- },
3427
- future: {
3428
- one: "меньше, чем через минуту",
3429
- singularNominative: "меньше, чем через {{count}} минуту",
3430
- singularGenitive: "меньше, чем через {{count}} минуты",
3431
- pluralGenitive: "меньше, чем через {{count}} минут"
3432
- }
3433
- }),
3434
- xMinutes: buildLocalizeTokenFn({
3435
- regular: {
3436
- singularNominative: "{{count}} минута",
3437
- singularGenitive: "{{count}} минуты",
3438
- pluralGenitive: "{{count}} минут"
3439
- },
3440
- past: {
3441
- singularNominative: "{{count}} минуту назад",
3442
- singularGenitive: "{{count}} минуты назад",
3443
- pluralGenitive: "{{count}} минут назад"
3444
- },
3445
- future: {
3446
- singularNominative: "через {{count}} минуту",
3447
- singularGenitive: "через {{count}} минуты",
3448
- pluralGenitive: "через {{count}} минут"
3449
- }
3450
- }),
3451
- aboutXHours: buildLocalizeTokenFn({
3452
- regular: {
3453
- singularNominative: "около {{count}} часа",
3454
- singularGenitive: "около {{count}} часов",
3455
- pluralGenitive: "около {{count}} часов"
3456
- },
3457
- future: {
3458
- singularNominative: "приблизительно через {{count}} час",
3459
- singularGenitive: "приблизительно через {{count}} часа",
3460
- pluralGenitive: "приблизительно через {{count}} часов"
3461
- }
3462
- }),
3463
- xHours: buildLocalizeTokenFn({
3464
- regular: {
3465
- singularNominative: "{{count}} час",
3466
- singularGenitive: "{{count}} часа",
3467
- pluralGenitive: "{{count}} часов"
3468
- }
3469
- }),
3470
- xDays: buildLocalizeTokenFn({
3471
- regular: {
3472
- singularNominative: "{{count}} день",
3473
- singularGenitive: "{{count}} дня",
3474
- pluralGenitive: "{{count}} дней"
3475
- }
3476
- }),
3477
- aboutXWeeks: buildLocalizeTokenFn({
3478
- regular: {
3479
- singularNominative: "около {{count}} недели",
3480
- singularGenitive: "около {{count}} недель",
3481
- pluralGenitive: "около {{count}} недель"
3482
- },
3483
- future: {
3484
- singularNominative: "приблизительно через {{count}} неделю",
3485
- singularGenitive: "приблизительно через {{count}} недели",
3486
- pluralGenitive: "приблизительно через {{count}} недель"
3487
- }
3488
- }),
3489
- xWeeks: buildLocalizeTokenFn({
3490
- regular: {
3491
- singularNominative: "{{count}} неделя",
3492
- singularGenitive: "{{count}} недели",
3493
- pluralGenitive: "{{count}} недель"
3494
- }
3495
- }),
3496
- aboutXMonths: buildLocalizeTokenFn({
3497
- regular: {
3498
- singularNominative: "около {{count}} месяца",
3499
- singularGenitive: "около {{count}} месяцев",
3500
- pluralGenitive: "около {{count}} месяцев"
3501
- },
3502
- future: {
3503
- singularNominative: "приблизительно через {{count}} месяц",
3504
- singularGenitive: "приблизительно через {{count}} месяца",
3505
- pluralGenitive: "приблизительно через {{count}} месяцев"
3506
- }
3507
- }),
3508
- xMonths: buildLocalizeTokenFn({
3509
- regular: {
3510
- singularNominative: "{{count}} месяц",
3511
- singularGenitive: "{{count}} месяца",
3512
- pluralGenitive: "{{count}} месяцев"
3513
- }
3514
- }),
3515
- aboutXYears: buildLocalizeTokenFn({
3516
- regular: {
3517
- singularNominative: "около {{count}} года",
3518
- singularGenitive: "около {{count}} лет",
3519
- pluralGenitive: "около {{count}} лет"
3520
- },
3521
- future: {
3522
- singularNominative: "приблизительно через {{count}} год",
3523
- singularGenitive: "приблизительно через {{count}} года",
3524
- pluralGenitive: "приблизительно через {{count}} лет"
3525
- }
3526
- }),
3527
- xYears: buildLocalizeTokenFn({
3528
- regular: {
3529
- singularNominative: "{{count}} год",
3530
- singularGenitive: "{{count}} года",
3531
- pluralGenitive: "{{count}} лет"
3532
- }
3533
- }),
3534
- overXYears: buildLocalizeTokenFn({
3535
- regular: {
3536
- singularNominative: "больше {{count}} года",
3537
- singularGenitive: "больше {{count}} лет",
3538
- pluralGenitive: "больше {{count}} лет"
3539
- },
3540
- future: {
3541
- singularNominative: "больше, чем через {{count}} год",
3542
- singularGenitive: "больше, чем через {{count}} года",
3543
- pluralGenitive: "больше, чем через {{count}} лет"
3544
- }
3545
- }),
3546
- almostXYears: buildLocalizeTokenFn({
3547
- regular: {
3548
- singularNominative: "почти {{count}} год",
3549
- singularGenitive: "почти {{count}} года",
3550
- pluralGenitive: "почти {{count}} лет"
3551
- },
3552
- future: {
3553
- singularNominative: "почти через {{count}} год",
3554
- singularGenitive: "почти через {{count}} года",
3555
- pluralGenitive: "почти через {{count}} лет"
3556
- }
3557
- })
3558
- };
3559
- const formatDistance = (token, count, options) => {
3560
- return formatDistanceLocale[token](count, options);
3561
- };
3562
- const dateFormats = {
3563
- full: "EEEE, d MMMM y 'г.'",
3564
- long: "d MMMM y 'г.'",
3565
- medium: "d MMM y 'г.'",
3566
- short: "dd.MM.y"
3567
- };
3568
- const timeFormats = {
3569
- full: "H:mm:ss zzzz",
3570
- long: "H:mm:ss z",
3571
- medium: "H:mm:ss",
3572
- short: "H:mm"
3573
- };
3574
- const dateTimeFormats = {
3575
- any: "{{date}}, {{time}}"
3576
- };
3577
- const formatLong = {
3578
- date: buildFormatLongFn({
3579
- formats: dateFormats,
3580
- defaultWidth: "full"
3581
- }),
3582
- time: buildFormatLongFn({
3583
- formats: timeFormats,
3584
- defaultWidth: "full"
3585
- }),
3586
- dateTime: buildFormatLongFn({
3587
- formats: dateTimeFormats,
3588
- defaultWidth: "any"
3589
- })
3590
- };
3591
- const accusativeWeekdays = [
3592
- "воскресенье",
3593
- "понедельник",
3594
- "вторник",
3595
- "среду",
3596
- "четверг",
3597
- "пятницу",
3598
- "субботу"
3599
- ];
3600
- function lastWeek(day) {
3601
- const weekday = accusativeWeekdays[day];
3602
- switch (day) {
3603
- case 0:
3604
- return "'в прошлое " + weekday + " в' p";
3605
- case 1:
3606
- case 2:
3607
- case 4:
3608
- return "'в прошлый " + weekday + " в' p";
3609
- case 3:
3610
- case 5:
3611
- case 6:
3612
- return "'в прошлую " + weekday + " в' p";
3613
- }
3614
- }
3615
- function thisWeek(day) {
3616
- const weekday = accusativeWeekdays[day];
3617
- if (day === 2) {
3618
- return "'во " + weekday + " в' p";
3619
- } else {
3620
- return "'в " + weekday + " в' p";
3621
- }
3622
- }
3623
- function nextWeek(day) {
3624
- const weekday = accusativeWeekdays[day];
3625
- switch (day) {
3626
- case 0:
3627
- return "'в следующее " + weekday + " в' p";
3628
- case 1:
3629
- case 2:
3630
- case 4:
3631
- return "'в следующий " + weekday + " в' p";
3632
- case 3:
3633
- case 5:
3634
- case 6:
3635
- return "'в следующую " + weekday + " в' p";
3636
- }
3637
- }
3638
- const formatRelativeLocale = {
3639
- lastWeek: (date, baseDate, options) => {
3640
- const day = date.getDay();
3641
- if (isSameWeek(date, baseDate, options)) {
3642
- return thisWeek(day);
3643
- } else {
3644
- return lastWeek(day);
3645
- }
3646
- },
3647
- yesterday: "'вчера в' p",
3648
- today: "'сегодня в' p",
3649
- tomorrow: "'завтра в' p",
3650
- nextWeek: (date, baseDate, options) => {
3651
- const day = date.getDay();
3652
- if (isSameWeek(date, baseDate, options)) {
3653
- return thisWeek(day);
3654
- } else {
3655
- return nextWeek(day);
3656
- }
3657
- },
3658
- other: "P"
3659
- };
3660
- const formatRelative = (token, date, baseDate, options) => {
3661
- const format = formatRelativeLocale[token];
3662
- if (typeof format === "function") {
3663
- return format(date, baseDate, options);
3664
- }
3665
- return format;
3666
- };
3667
- const eraValues = {
3668
- narrow: ["до н.э.", "н.э."],
3669
- abbreviated: ["до н. э.", "н. э."],
3670
- wide: ["до нашей эры", "нашей эры"]
3671
- };
3672
- const quarterValues = {
3673
- narrow: ["1", "2", "3", "4"],
3674
- abbreviated: ["1-й кв.", "2-й кв.", "3-й кв.", "4-й кв."],
3675
- wide: ["1-й квартал", "2-й квартал", "3-й квартал", "4-й квартал"]
3676
- };
3677
- const monthValues = {
3678
- narrow: ["Я", "Ф", "М", "А", "М", "И", "И", "А", "С", "О", "Н", "Д"],
3679
- abbreviated: [
3680
- "янв.",
3681
- "фев.",
3682
- "март",
3683
- "апр.",
3684
- "май",
3685
- "июнь",
3686
- "июль",
3687
- "авг.",
3688
- "сент.",
3689
- "окт.",
3690
- "нояб.",
3691
- "дек."
3692
- ],
3693
- wide: [
3694
- "январь",
3695
- "февраль",
3696
- "март",
3697
- "апрель",
3698
- "май",
3699
- "июнь",
3700
- "июль",
3701
- "август",
3702
- "сентябрь",
3703
- "октябрь",
3704
- "ноябрь",
3705
- "декабрь"
3706
- ]
3707
- };
3708
- const formattingMonthValues = {
3709
- narrow: ["Я", "Ф", "М", "А", "М", "И", "И", "А", "С", "О", "Н", "Д"],
3710
- abbreviated: [
3711
- "янв.",
3712
- "фев.",
3713
- "мар.",
3714
- "апр.",
3715
- "мая",
3716
- "июн.",
3717
- "июл.",
3718
- "авг.",
3719
- "сент.",
3720
- "окт.",
3721
- "нояб.",
3722
- "дек."
3723
- ],
3724
- wide: [
3725
- "января",
3726
- "февраля",
3727
- "марта",
3728
- "апреля",
3729
- "мая",
3730
- "июня",
3731
- "июля",
3732
- "августа",
3733
- "сентября",
3734
- "октября",
3735
- "ноября",
3736
- "декабря"
3737
- ]
3738
- };
3739
- const dayValues = {
3740
- narrow: ["В", "П", "В", "С", "Ч", "П", "С"],
3741
- short: ["вс", "пн", "вт", "ср", "чт", "пт", "сб"],
3742
- abbreviated: ["вск", "пнд", "втр", "срд", "чтв", "птн", "суб"],
3743
- wide: [
3744
- "воскресенье",
3745
- "понедельник",
3746
- "вторник",
3747
- "среда",
3748
- "четверг",
3749
- "пятница",
3750
- "суббота"
3751
- ]
3752
- };
3753
- const dayPeriodValues = {
3754
- narrow: {
3755
- am: "ДП",
3756
- pm: "ПП",
3757
- midnight: "полн.",
3758
- noon: "полд.",
3759
- morning: "утро",
3760
- afternoon: "день",
3761
- evening: "веч.",
3762
- night: "ночь"
3763
- },
3764
- abbreviated: {
3765
- am: "ДП",
3766
- pm: "ПП",
3767
- midnight: "полн.",
3768
- noon: "полд.",
3769
- morning: "утро",
3770
- afternoon: "день",
3771
- evening: "веч.",
3772
- night: "ночь"
3773
- },
3774
- wide: {
3775
- am: "ДП",
3776
- pm: "ПП",
3777
- midnight: "полночь",
3778
- noon: "полдень",
3779
- morning: "утро",
3780
- afternoon: "день",
3781
- evening: "вечер",
3782
- night: "ночь"
3783
- }
3784
- };
3785
- const formattingDayPeriodValues = {
3786
- narrow: {
3787
- am: "ДП",
3788
- pm: "ПП",
3789
- midnight: "полн.",
3790
- noon: "полд.",
3791
- morning: "утра",
3792
- afternoon: "дня",
3793
- evening: "веч.",
3794
- night: "ночи"
3795
- },
3796
- abbreviated: {
3797
- am: "ДП",
3798
- pm: "ПП",
3799
- midnight: "полн.",
3800
- noon: "полд.",
3801
- morning: "утра",
3802
- afternoon: "дня",
3803
- evening: "веч.",
3804
- night: "ночи"
3805
- },
3806
- wide: {
3807
- am: "ДП",
3808
- pm: "ПП",
3809
- midnight: "полночь",
3810
- noon: "полдень",
3811
- morning: "утра",
3812
- afternoon: "дня",
3813
- evening: "вечера",
3814
- night: "ночи"
3815
- }
3816
- };
3817
- const ordinalNumber = (dirtyNumber, options) => {
3818
- const number = Number(dirtyNumber);
3819
- const unit = options?.unit;
3820
- let suffix;
3821
- if (unit === "date") {
3822
- suffix = "-е";
3823
- } else if (unit === "week" || unit === "minute" || unit === "second") {
3824
- suffix = "-я";
3825
- } else {
3826
- suffix = "-й";
3827
- }
3828
- return number + suffix;
3829
- };
3830
- const localize = {
3831
- ordinalNumber,
3832
- era: buildLocalizeFn({
3833
- values: eraValues,
3834
- defaultWidth: "wide"
3835
- }),
3836
- quarter: buildLocalizeFn({
3837
- values: quarterValues,
3838
- defaultWidth: "wide",
3839
- argumentCallback: (quarter) => quarter - 1
3840
- }),
3841
- month: buildLocalizeFn({
3842
- values: monthValues,
3843
- defaultWidth: "wide",
3844
- formattingValues: formattingMonthValues,
3845
- defaultFormattingWidth: "wide"
3846
- }),
3847
- day: buildLocalizeFn({
3848
- values: dayValues,
3849
- defaultWidth: "wide"
3850
- }),
3851
- dayPeriod: buildLocalizeFn({
3852
- values: dayPeriodValues,
3853
- defaultWidth: "any",
3854
- formattingValues: formattingDayPeriodValues,
3855
- defaultFormattingWidth: "wide"
3856
- })
3857
- };
3858
- const matchOrdinalNumberPattern = /^(\d+)(-?(е|я|й|ое|ье|ая|ья|ый|ой|ий|ый))?/i;
3859
- const parseOrdinalNumberPattern = /\d+/i;
3860
- const matchEraPatterns = {
3861
- narrow: /^((до )?н\.?\s?э\.?)/i,
3862
- abbreviated: /^((до )?н\.?\s?э\.?)/i,
3863
- wide: /^(до нашей эры|нашей эры|наша эра)/i
3864
- };
3865
- const parseEraPatterns = {
3866
- any: [/^д/i, /^н/i]
3867
- };
3868
- const matchQuarterPatterns = {
3869
- narrow: /^[1234]/i,
3870
- abbreviated: /^[1234](-?[ыои]?й?)? кв.?/i,
3871
- wide: /^[1234](-?[ыои]?й?)? квартал/i
3872
- };
3873
- const parseQuarterPatterns = {
3874
- any: [/1/i, /2/i, /3/i, /4/i]
3875
- };
3876
- const matchMonthPatterns = {
3877
- narrow: /^[яфмаисонд]/i,
3878
- abbreviated: /^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,
3879
- wide: /^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i
3880
- };
3881
- const parseMonthPatterns = {
3882
- narrow: [
3883
- /^я/i,
3884
- /^ф/i,
3885
- /^м/i,
3886
- /^а/i,
3887
- /^м/i,
3888
- /^и/i,
3889
- /^и/i,
3890
- /^а/i,
3891
- /^с/i,
3892
- /^о/i,
3893
- /^н/i,
3894
- /^я/i
3895
- ],
3896
- any: [
3897
- /^я/i,
3898
- /^ф/i,
3899
- /^мар/i,
3900
- /^ап/i,
3901
- /^ма[йя]/i,
3902
- /^июн/i,
3903
- /^июл/i,
3904
- /^ав/i,
3905
- /^с/i,
3906
- /^о/i,
3907
- /^н/i,
3908
- /^д/i
3909
- ]
3910
- };
3911
- const matchDayPatterns = {
3912
- narrow: /^[впсч]/i,
3913
- short: /^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,
3914
- abbreviated: /^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,
3915
- wide: /^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i
3916
- };
3917
- const parseDayPatterns = {
3918
- narrow: [/^в/i, /^п/i, /^в/i, /^с/i, /^ч/i, /^п/i, /^с/i],
3919
- any: [/^в[ос]/i, /^п[он]/i, /^в/i, /^ср/i, /^ч/i, /^п[ят]/i, /^с[уб]/i]
3920
- };
3921
- const matchDayPeriodPatterns = {
3922
- narrow: /^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,
3923
- abbreviated: /^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,
3924
- wide: /^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i
3925
- };
3926
- const parseDayPeriodPatterns = {
3927
- any: {
3928
- am: /^дп/i,
3929
- pm: /^пп/i,
3930
- midnight: /^полн/i,
3931
- noon: /^полд/i,
3932
- morning: /^у/i,
3933
- afternoon: /^д[ен]/i,
3934
- evening: /^в/i,
3935
- night: /^н/i
3936
- }
3937
- };
3938
- const match = {
3939
- ordinalNumber: buildMatchPatternFn({
3940
- matchPattern: matchOrdinalNumberPattern,
3941
- parsePattern: parseOrdinalNumberPattern,
3942
- valueCallback: (value) => parseInt(value, 10)
3943
- }),
3944
- era: buildMatchFn({
3945
- matchPatterns: matchEraPatterns,
3946
- defaultMatchWidth: "wide",
3947
- parsePatterns: parseEraPatterns,
3948
- defaultParseWidth: "any"
3949
- }),
3950
- quarter: buildMatchFn({
3951
- matchPatterns: matchQuarterPatterns,
3952
- defaultMatchWidth: "wide",
3953
- parsePatterns: parseQuarterPatterns,
3954
- defaultParseWidth: "any",
3955
- valueCallback: (index) => index + 1
3956
- }),
3957
- month: buildMatchFn({
3958
- matchPatterns: matchMonthPatterns,
3959
- defaultMatchWidth: "wide",
3960
- parsePatterns: parseMonthPatterns,
3961
- defaultParseWidth: "any"
3962
- }),
3963
- day: buildMatchFn({
3964
- matchPatterns: matchDayPatterns,
3965
- defaultMatchWidth: "wide",
3966
- parsePatterns: parseDayPatterns,
3967
- defaultParseWidth: "any"
3968
- }),
3969
- dayPeriod: buildMatchFn({
3970
- matchPatterns: matchDayPeriodPatterns,
3971
- defaultMatchWidth: "wide",
3972
- parsePatterns: parseDayPeriodPatterns,
3973
- defaultParseWidth: "any"
3974
- })
3975
- };
3976
- const ru = {
3977
- code: "ru",
3978
- formatDistance,
3979
- formatLong,
3980
- formatRelative,
3981
- localize,
3982
- match,
3983
- options: {
3984
- weekStartsOn: 1,
3985
- firstWeekContainsDate: 1
3986
- }
3987
- };
3988
- const formatDateLat = (date) => dateFns.format(date, "dd/MM/yyyy", { locale: enGB });
3989
- const formatDateEs = (date) => dateFns.format(date, "dd.MM.yyyy", { locale: es });
3990
- const formatDateRu = (date) => dateFns.format(date, "dd.MM.yyyy", { locale: ru });
3991
- const formatTime = (date) => dateFns.format(date, "HH:mm", { locale: enGB });
3992
- const formatDate = (date, locale = void 0) => {
3993
- switch (locale ?? detectLocale()) {
1516
+ const formatDateLat = (date) => dateFns.format(date, "dd/MM/yyyy", { locale: locale.enGB });
1517
+ const formatDateEs = (date) => dateFns.format(date, "dd.MM.yyyy", { locale: locale.es });
1518
+ const formatDateRu = (date) => dateFns.format(date, "dd.MM.yyyy", { locale: locale.ru });
1519
+ const formatTime = (date) => dateFns.format(date, "HH:mm", { locale: locale.enGB });
1520
+ const formatDate = (date, locale2 = void 0) => {
1521
+ switch (locale2 ?? detectLocale()) {
3994
1522
  case "es-ES":
3995
1523
  return formatDateEs(date);
3996
1524
  case "ru-RU":
@@ -3999,22 +1527,22 @@ const formatDate = (date, locale = void 0) => {
3999
1527
  return formatDateLat(date);
4000
1528
  }
4001
1529
  };
4002
- const formatDateTime = (date, locale = void 0) => dateFns.format(date, "Pp", {
1530
+ const formatDateTime = (date, locale$1 = void 0) => dateFns.format(date, "Pp", {
4003
1531
  locale: {
4004
- "en-GB": enGB,
4005
- "es-ES": es,
4006
- "ru-RU": ru
4007
- }[locale ?? detectLocale()] ?? enGB
1532
+ "en-GB": locale.enGB,
1533
+ "es-ES": locale.es,
1534
+ "ru-RU": locale.ru
1535
+ }[locale$1 ?? detectLocale()] ?? locale.enGB
4008
1536
  });
4009
1537
  function detectLocale() {
4010
1538
  const instance = vue.getCurrentInstance();
4011
1539
  const i18n = instance?.appContext?.app?.config?.globalProperties?.$i18n;
4012
1540
  if (i18n) {
4013
1541
  try {
4014
- const locale = (typeof i18n.locale === "object" ? i18n.locale.value : i18n.locale) ?? "en-GB";
4015
- if (locale.startsWith("en")) return "en-GB";
4016
- if (locale.startsWith("es")) return "es-ES";
4017
- if (locale.startsWith("ru")) return "ru-RU";
1542
+ const locale2 = (typeof i18n.locale === "object" ? i18n.locale.value : i18n.locale) ?? "en-GB";
1543
+ if (locale2.startsWith("en")) return "en-GB";
1544
+ if (locale2.startsWith("es")) return "es-ES";
1545
+ if (locale2.startsWith("ru")) return "ru-RU";
4018
1546
  } catch (error) {
4019
1547
  console.warn("Error detecting locale:", error);
4020
1548
  }