@calenderjs/react 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,1513 @@
1
+ import require$$0, { forwardRef, useRef, useState, useEffect, useImperativeHandle, useCallback, useMemo } from "react";
2
+ var jsxRuntime = { exports: {} };
3
+ var reactJsxRuntime_production_min = {};
4
+ var hasRequiredReactJsxRuntime_production_min;
5
+ function requireReactJsxRuntime_production_min() {
6
+ if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
7
+ hasRequiredReactJsxRuntime_production_min = 1;
8
+ var f = require$$0, k = /* @__PURE__ */ Symbol.for("react.element"), l = /* @__PURE__ */ Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
9
+ function q(c, a, g) {
10
+ var b, d = {}, e = null, h = null;
11
+ void 0 !== g && (e = "" + g);
12
+ void 0 !== a.key && (e = "" + a.key);
13
+ void 0 !== a.ref && (h = a.ref);
14
+ for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
15
+ if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
16
+ return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
17
+ }
18
+ reactJsxRuntime_production_min.Fragment = l;
19
+ reactJsxRuntime_production_min.jsx = q;
20
+ reactJsxRuntime_production_min.jsxs = q;
21
+ return reactJsxRuntime_production_min;
22
+ }
23
+ var reactJsxRuntime_development = {};
24
+ var hasRequiredReactJsxRuntime_development;
25
+ function requireReactJsxRuntime_development() {
26
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
27
+ hasRequiredReactJsxRuntime_development = 1;
28
+ if (process.env.NODE_ENV !== "production") {
29
+ (function() {
30
+ var React = require$$0;
31
+ var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
32
+ var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
33
+ var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
34
+ var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
35
+ var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
36
+ var REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider");
37
+ var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
38
+ var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
39
+ var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
40
+ var REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list");
41
+ var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
42
+ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
43
+ var REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen");
44
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
45
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
46
+ function getIteratorFn(maybeIterable) {
47
+ if (maybeIterable === null || typeof maybeIterable !== "object") {
48
+ return null;
49
+ }
50
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
51
+ if (typeof maybeIterator === "function") {
52
+ return maybeIterator;
53
+ }
54
+ return null;
55
+ }
56
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
57
+ function error(format) {
58
+ {
59
+ {
60
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
61
+ args[_key2 - 1] = arguments[_key2];
62
+ }
63
+ printWarning("error", format, args);
64
+ }
65
+ }
66
+ }
67
+ function printWarning(level, format, args) {
68
+ {
69
+ var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
70
+ var stack = ReactDebugCurrentFrame2.getStackAddendum();
71
+ if (stack !== "") {
72
+ format += "%s";
73
+ args = args.concat([stack]);
74
+ }
75
+ var argsWithFormat = args.map(function(item) {
76
+ return String(item);
77
+ });
78
+ argsWithFormat.unshift("Warning: " + format);
79
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
80
+ }
81
+ }
82
+ var enableScopeAPI = false;
83
+ var enableCacheElement = false;
84
+ var enableTransitionTracing = false;
85
+ var enableLegacyHidden = false;
86
+ var enableDebugTracing = false;
87
+ var REACT_MODULE_REFERENCE;
88
+ {
89
+ REACT_MODULE_REFERENCE = /* @__PURE__ */ Symbol.for("react.module.reference");
90
+ }
91
+ function isValidElementType(type) {
92
+ if (typeof type === "string" || typeof type === "function") {
93
+ return true;
94
+ }
95
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
96
+ return true;
97
+ }
98
+ if (typeof type === "object" && type !== null) {
99
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
100
+ // types supported by any Flight configuration anywhere since
101
+ // we don't know which Flight build this will end up being used
102
+ // with.
103
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
104
+ return true;
105
+ }
106
+ }
107
+ return false;
108
+ }
109
+ function getWrappedName(outerType, innerType, wrapperName) {
110
+ var displayName = outerType.displayName;
111
+ if (displayName) {
112
+ return displayName;
113
+ }
114
+ var functionName = innerType.displayName || innerType.name || "";
115
+ return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
116
+ }
117
+ function getContextName(type) {
118
+ return type.displayName || "Context";
119
+ }
120
+ function getComponentNameFromType(type) {
121
+ if (type == null) {
122
+ return null;
123
+ }
124
+ {
125
+ if (typeof type.tag === "number") {
126
+ error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
127
+ }
128
+ }
129
+ if (typeof type === "function") {
130
+ return type.displayName || type.name || null;
131
+ }
132
+ if (typeof type === "string") {
133
+ return type;
134
+ }
135
+ switch (type) {
136
+ case REACT_FRAGMENT_TYPE:
137
+ return "Fragment";
138
+ case REACT_PORTAL_TYPE:
139
+ return "Portal";
140
+ case REACT_PROFILER_TYPE:
141
+ return "Profiler";
142
+ case REACT_STRICT_MODE_TYPE:
143
+ return "StrictMode";
144
+ case REACT_SUSPENSE_TYPE:
145
+ return "Suspense";
146
+ case REACT_SUSPENSE_LIST_TYPE:
147
+ return "SuspenseList";
148
+ }
149
+ if (typeof type === "object") {
150
+ switch (type.$$typeof) {
151
+ case REACT_CONTEXT_TYPE:
152
+ var context = type;
153
+ return getContextName(context) + ".Consumer";
154
+ case REACT_PROVIDER_TYPE:
155
+ var provider = type;
156
+ return getContextName(provider._context) + ".Provider";
157
+ case REACT_FORWARD_REF_TYPE:
158
+ return getWrappedName(type, type.render, "ForwardRef");
159
+ case REACT_MEMO_TYPE:
160
+ var outerName = type.displayName || null;
161
+ if (outerName !== null) {
162
+ return outerName;
163
+ }
164
+ return getComponentNameFromType(type.type) || "Memo";
165
+ case REACT_LAZY_TYPE: {
166
+ var lazyComponent = type;
167
+ var payload = lazyComponent._payload;
168
+ var init = lazyComponent._init;
169
+ try {
170
+ return getComponentNameFromType(init(payload));
171
+ } catch (x) {
172
+ return null;
173
+ }
174
+ }
175
+ }
176
+ }
177
+ return null;
178
+ }
179
+ var assign = Object.assign;
180
+ var disabledDepth = 0;
181
+ var prevLog;
182
+ var prevInfo;
183
+ var prevWarn;
184
+ var prevError;
185
+ var prevGroup;
186
+ var prevGroupCollapsed;
187
+ var prevGroupEnd;
188
+ function disabledLog() {
189
+ }
190
+ disabledLog.__reactDisabledLog = true;
191
+ function disableLogs() {
192
+ {
193
+ if (disabledDepth === 0) {
194
+ prevLog = console.log;
195
+ prevInfo = console.info;
196
+ prevWarn = console.warn;
197
+ prevError = console.error;
198
+ prevGroup = console.group;
199
+ prevGroupCollapsed = console.groupCollapsed;
200
+ prevGroupEnd = console.groupEnd;
201
+ var props = {
202
+ configurable: true,
203
+ enumerable: true,
204
+ value: disabledLog,
205
+ writable: true
206
+ };
207
+ Object.defineProperties(console, {
208
+ info: props,
209
+ log: props,
210
+ warn: props,
211
+ error: props,
212
+ group: props,
213
+ groupCollapsed: props,
214
+ groupEnd: props
215
+ });
216
+ }
217
+ disabledDepth++;
218
+ }
219
+ }
220
+ function reenableLogs() {
221
+ {
222
+ disabledDepth--;
223
+ if (disabledDepth === 0) {
224
+ var props = {
225
+ configurable: true,
226
+ enumerable: true,
227
+ writable: true
228
+ };
229
+ Object.defineProperties(console, {
230
+ log: assign({}, props, {
231
+ value: prevLog
232
+ }),
233
+ info: assign({}, props, {
234
+ value: prevInfo
235
+ }),
236
+ warn: assign({}, props, {
237
+ value: prevWarn
238
+ }),
239
+ error: assign({}, props, {
240
+ value: prevError
241
+ }),
242
+ group: assign({}, props, {
243
+ value: prevGroup
244
+ }),
245
+ groupCollapsed: assign({}, props, {
246
+ value: prevGroupCollapsed
247
+ }),
248
+ groupEnd: assign({}, props, {
249
+ value: prevGroupEnd
250
+ })
251
+ });
252
+ }
253
+ if (disabledDepth < 0) {
254
+ error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
255
+ }
256
+ }
257
+ }
258
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
259
+ var prefix;
260
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
261
+ {
262
+ if (prefix === void 0) {
263
+ try {
264
+ throw Error();
265
+ } catch (x) {
266
+ var match = x.stack.trim().match(/\n( *(at )?)/);
267
+ prefix = match && match[1] || "";
268
+ }
269
+ }
270
+ return "\n" + prefix + name;
271
+ }
272
+ }
273
+ var reentry = false;
274
+ var componentFrameCache;
275
+ {
276
+ var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
277
+ componentFrameCache = new PossiblyWeakMap();
278
+ }
279
+ function describeNativeComponentFrame(fn, construct) {
280
+ if (!fn || reentry) {
281
+ return "";
282
+ }
283
+ {
284
+ var frame = componentFrameCache.get(fn);
285
+ if (frame !== void 0) {
286
+ return frame;
287
+ }
288
+ }
289
+ var control;
290
+ reentry = true;
291
+ var previousPrepareStackTrace = Error.prepareStackTrace;
292
+ Error.prepareStackTrace = void 0;
293
+ var previousDispatcher;
294
+ {
295
+ previousDispatcher = ReactCurrentDispatcher.current;
296
+ ReactCurrentDispatcher.current = null;
297
+ disableLogs();
298
+ }
299
+ try {
300
+ if (construct) {
301
+ var Fake = function() {
302
+ throw Error();
303
+ };
304
+ Object.defineProperty(Fake.prototype, "props", {
305
+ set: function() {
306
+ throw Error();
307
+ }
308
+ });
309
+ if (typeof Reflect === "object" && Reflect.construct) {
310
+ try {
311
+ Reflect.construct(Fake, []);
312
+ } catch (x) {
313
+ control = x;
314
+ }
315
+ Reflect.construct(fn, [], Fake);
316
+ } else {
317
+ try {
318
+ Fake.call();
319
+ } catch (x) {
320
+ control = x;
321
+ }
322
+ fn.call(Fake.prototype);
323
+ }
324
+ } else {
325
+ try {
326
+ throw Error();
327
+ } catch (x) {
328
+ control = x;
329
+ }
330
+ fn();
331
+ }
332
+ } catch (sample) {
333
+ if (sample && control && typeof sample.stack === "string") {
334
+ var sampleLines = sample.stack.split("\n");
335
+ var controlLines = control.stack.split("\n");
336
+ var s = sampleLines.length - 1;
337
+ var c = controlLines.length - 1;
338
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
339
+ c--;
340
+ }
341
+ for (; s >= 1 && c >= 0; s--, c--) {
342
+ if (sampleLines[s] !== controlLines[c]) {
343
+ if (s !== 1 || c !== 1) {
344
+ do {
345
+ s--;
346
+ c--;
347
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
348
+ var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
349
+ if (fn.displayName && _frame.includes("<anonymous>")) {
350
+ _frame = _frame.replace("<anonymous>", fn.displayName);
351
+ }
352
+ {
353
+ if (typeof fn === "function") {
354
+ componentFrameCache.set(fn, _frame);
355
+ }
356
+ }
357
+ return _frame;
358
+ }
359
+ } while (s >= 1 && c >= 0);
360
+ }
361
+ break;
362
+ }
363
+ }
364
+ }
365
+ } finally {
366
+ reentry = false;
367
+ {
368
+ ReactCurrentDispatcher.current = previousDispatcher;
369
+ reenableLogs();
370
+ }
371
+ Error.prepareStackTrace = previousPrepareStackTrace;
372
+ }
373
+ var name = fn ? fn.displayName || fn.name : "";
374
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
375
+ {
376
+ if (typeof fn === "function") {
377
+ componentFrameCache.set(fn, syntheticFrame);
378
+ }
379
+ }
380
+ return syntheticFrame;
381
+ }
382
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
383
+ {
384
+ return describeNativeComponentFrame(fn, false);
385
+ }
386
+ }
387
+ function shouldConstruct(Component) {
388
+ var prototype = Component.prototype;
389
+ return !!(prototype && prototype.isReactComponent);
390
+ }
391
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
392
+ if (type == null) {
393
+ return "";
394
+ }
395
+ if (typeof type === "function") {
396
+ {
397
+ return describeNativeComponentFrame(type, shouldConstruct(type));
398
+ }
399
+ }
400
+ if (typeof type === "string") {
401
+ return describeBuiltInComponentFrame(type);
402
+ }
403
+ switch (type) {
404
+ case REACT_SUSPENSE_TYPE:
405
+ return describeBuiltInComponentFrame("Suspense");
406
+ case REACT_SUSPENSE_LIST_TYPE:
407
+ return describeBuiltInComponentFrame("SuspenseList");
408
+ }
409
+ if (typeof type === "object") {
410
+ switch (type.$$typeof) {
411
+ case REACT_FORWARD_REF_TYPE:
412
+ return describeFunctionComponentFrame(type.render);
413
+ case REACT_MEMO_TYPE:
414
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
415
+ case REACT_LAZY_TYPE: {
416
+ var lazyComponent = type;
417
+ var payload = lazyComponent._payload;
418
+ var init = lazyComponent._init;
419
+ try {
420
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
421
+ } catch (x) {
422
+ }
423
+ }
424
+ }
425
+ }
426
+ return "";
427
+ }
428
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
429
+ var loggedTypeFailures = {};
430
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
431
+ function setCurrentlyValidatingElement(element) {
432
+ {
433
+ if (element) {
434
+ var owner = element._owner;
435
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
436
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
437
+ } else {
438
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
439
+ }
440
+ }
441
+ }
442
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
443
+ {
444
+ var has = Function.call.bind(hasOwnProperty);
445
+ for (var typeSpecName in typeSpecs) {
446
+ if (has(typeSpecs, typeSpecName)) {
447
+ var error$1 = void 0;
448
+ try {
449
+ if (typeof typeSpecs[typeSpecName] !== "function") {
450
+ var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
451
+ err.name = "Invariant Violation";
452
+ throw err;
453
+ }
454
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
455
+ } catch (ex) {
456
+ error$1 = ex;
457
+ }
458
+ if (error$1 && !(error$1 instanceof Error)) {
459
+ setCurrentlyValidatingElement(element);
460
+ error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
461
+ setCurrentlyValidatingElement(null);
462
+ }
463
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
464
+ loggedTypeFailures[error$1.message] = true;
465
+ setCurrentlyValidatingElement(element);
466
+ error("Failed %s type: %s", location, error$1.message);
467
+ setCurrentlyValidatingElement(null);
468
+ }
469
+ }
470
+ }
471
+ }
472
+ }
473
+ var isArrayImpl = Array.isArray;
474
+ function isArray(a) {
475
+ return isArrayImpl(a);
476
+ }
477
+ function typeName(value) {
478
+ {
479
+ var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
480
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
481
+ return type;
482
+ }
483
+ }
484
+ function willCoercionThrow(value) {
485
+ {
486
+ try {
487
+ testStringCoercion(value);
488
+ return false;
489
+ } catch (e) {
490
+ return true;
491
+ }
492
+ }
493
+ }
494
+ function testStringCoercion(value) {
495
+ return "" + value;
496
+ }
497
+ function checkKeyStringCoercion(value) {
498
+ {
499
+ if (willCoercionThrow(value)) {
500
+ error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
501
+ return testStringCoercion(value);
502
+ }
503
+ }
504
+ }
505
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
506
+ var RESERVED_PROPS = {
507
+ key: true,
508
+ ref: true,
509
+ __self: true,
510
+ __source: true
511
+ };
512
+ var specialPropKeyWarningShown;
513
+ var specialPropRefWarningShown;
514
+ function hasValidRef(config) {
515
+ {
516
+ if (hasOwnProperty.call(config, "ref")) {
517
+ var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
518
+ if (getter && getter.isReactWarning) {
519
+ return false;
520
+ }
521
+ }
522
+ }
523
+ return config.ref !== void 0;
524
+ }
525
+ function hasValidKey(config) {
526
+ {
527
+ if (hasOwnProperty.call(config, "key")) {
528
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
529
+ if (getter && getter.isReactWarning) {
530
+ return false;
531
+ }
532
+ }
533
+ }
534
+ return config.key !== void 0;
535
+ }
536
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
537
+ {
538
+ if (typeof config.ref === "string" && ReactCurrentOwner.current && self) ;
539
+ }
540
+ }
541
+ function defineKeyPropWarningGetter(props, displayName) {
542
+ {
543
+ var warnAboutAccessingKey = function() {
544
+ if (!specialPropKeyWarningShown) {
545
+ specialPropKeyWarningShown = true;
546
+ error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
547
+ }
548
+ };
549
+ warnAboutAccessingKey.isReactWarning = true;
550
+ Object.defineProperty(props, "key", {
551
+ get: warnAboutAccessingKey,
552
+ configurable: true
553
+ });
554
+ }
555
+ }
556
+ function defineRefPropWarningGetter(props, displayName) {
557
+ {
558
+ var warnAboutAccessingRef = function() {
559
+ if (!specialPropRefWarningShown) {
560
+ specialPropRefWarningShown = true;
561
+ error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
562
+ }
563
+ };
564
+ warnAboutAccessingRef.isReactWarning = true;
565
+ Object.defineProperty(props, "ref", {
566
+ get: warnAboutAccessingRef,
567
+ configurable: true
568
+ });
569
+ }
570
+ }
571
+ var ReactElement = function(type, key, ref, self, source, owner, props) {
572
+ var element = {
573
+ // This tag allows us to uniquely identify this as a React Element
574
+ $$typeof: REACT_ELEMENT_TYPE,
575
+ // Built-in properties that belong on the element
576
+ type,
577
+ key,
578
+ ref,
579
+ props,
580
+ // Record the component responsible for creating this element.
581
+ _owner: owner
582
+ };
583
+ {
584
+ element._store = {};
585
+ Object.defineProperty(element._store, "validated", {
586
+ configurable: false,
587
+ enumerable: false,
588
+ writable: true,
589
+ value: false
590
+ });
591
+ Object.defineProperty(element, "_self", {
592
+ configurable: false,
593
+ enumerable: false,
594
+ writable: false,
595
+ value: self
596
+ });
597
+ Object.defineProperty(element, "_source", {
598
+ configurable: false,
599
+ enumerable: false,
600
+ writable: false,
601
+ value: source
602
+ });
603
+ if (Object.freeze) {
604
+ Object.freeze(element.props);
605
+ Object.freeze(element);
606
+ }
607
+ }
608
+ return element;
609
+ };
610
+ function jsxDEV(type, config, maybeKey, source, self) {
611
+ {
612
+ var propName;
613
+ var props = {};
614
+ var key = null;
615
+ var ref = null;
616
+ if (maybeKey !== void 0) {
617
+ {
618
+ checkKeyStringCoercion(maybeKey);
619
+ }
620
+ key = "" + maybeKey;
621
+ }
622
+ if (hasValidKey(config)) {
623
+ {
624
+ checkKeyStringCoercion(config.key);
625
+ }
626
+ key = "" + config.key;
627
+ }
628
+ if (hasValidRef(config)) {
629
+ ref = config.ref;
630
+ warnIfStringRefCannotBeAutoConverted(config, self);
631
+ }
632
+ for (propName in config) {
633
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
634
+ props[propName] = config[propName];
635
+ }
636
+ }
637
+ if (type && type.defaultProps) {
638
+ var defaultProps = type.defaultProps;
639
+ for (propName in defaultProps) {
640
+ if (props[propName] === void 0) {
641
+ props[propName] = defaultProps[propName];
642
+ }
643
+ }
644
+ }
645
+ if (key || ref) {
646
+ var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
647
+ if (key) {
648
+ defineKeyPropWarningGetter(props, displayName);
649
+ }
650
+ if (ref) {
651
+ defineRefPropWarningGetter(props, displayName);
652
+ }
653
+ }
654
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
655
+ }
656
+ }
657
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
658
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
659
+ function setCurrentlyValidatingElement$1(element) {
660
+ {
661
+ if (element) {
662
+ var owner = element._owner;
663
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
664
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
665
+ } else {
666
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
667
+ }
668
+ }
669
+ }
670
+ var propTypesMisspellWarningShown;
671
+ {
672
+ propTypesMisspellWarningShown = false;
673
+ }
674
+ function isValidElement(object) {
675
+ {
676
+ return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
677
+ }
678
+ }
679
+ function getDeclarationErrorAddendum() {
680
+ {
681
+ if (ReactCurrentOwner$1.current) {
682
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
683
+ if (name) {
684
+ return "\n\nCheck the render method of `" + name + "`.";
685
+ }
686
+ }
687
+ return "";
688
+ }
689
+ }
690
+ function getSourceInfoErrorAddendum(source) {
691
+ {
692
+ return "";
693
+ }
694
+ }
695
+ var ownerHasKeyUseWarning = {};
696
+ function getCurrentComponentErrorInfo(parentType) {
697
+ {
698
+ var info = getDeclarationErrorAddendum();
699
+ if (!info) {
700
+ var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
701
+ if (parentName) {
702
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
703
+ }
704
+ }
705
+ return info;
706
+ }
707
+ }
708
+ function validateExplicitKey(element, parentType) {
709
+ {
710
+ if (!element._store || element._store.validated || element.key != null) {
711
+ return;
712
+ }
713
+ element._store.validated = true;
714
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
715
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
716
+ return;
717
+ }
718
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
719
+ var childOwner = "";
720
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
721
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
722
+ }
723
+ setCurrentlyValidatingElement$1(element);
724
+ error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
725
+ setCurrentlyValidatingElement$1(null);
726
+ }
727
+ }
728
+ function validateChildKeys(node, parentType) {
729
+ {
730
+ if (typeof node !== "object") {
731
+ return;
732
+ }
733
+ if (isArray(node)) {
734
+ for (var i = 0; i < node.length; i++) {
735
+ var child = node[i];
736
+ if (isValidElement(child)) {
737
+ validateExplicitKey(child, parentType);
738
+ }
739
+ }
740
+ } else if (isValidElement(node)) {
741
+ if (node._store) {
742
+ node._store.validated = true;
743
+ }
744
+ } else if (node) {
745
+ var iteratorFn = getIteratorFn(node);
746
+ if (typeof iteratorFn === "function") {
747
+ if (iteratorFn !== node.entries) {
748
+ var iterator = iteratorFn.call(node);
749
+ var step;
750
+ while (!(step = iterator.next()).done) {
751
+ if (isValidElement(step.value)) {
752
+ validateExplicitKey(step.value, parentType);
753
+ }
754
+ }
755
+ }
756
+ }
757
+ }
758
+ }
759
+ }
760
+ function validatePropTypes(element) {
761
+ {
762
+ var type = element.type;
763
+ if (type === null || type === void 0 || typeof type === "string") {
764
+ return;
765
+ }
766
+ var propTypes;
767
+ if (typeof type === "function") {
768
+ propTypes = type.propTypes;
769
+ } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
770
+ // Inner props are checked in the reconciler.
771
+ type.$$typeof === REACT_MEMO_TYPE)) {
772
+ propTypes = type.propTypes;
773
+ } else {
774
+ return;
775
+ }
776
+ if (propTypes) {
777
+ var name = getComponentNameFromType(type);
778
+ checkPropTypes(propTypes, element.props, "prop", name, element);
779
+ } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
780
+ propTypesMisspellWarningShown = true;
781
+ var _name = getComponentNameFromType(type);
782
+ error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
783
+ }
784
+ if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
785
+ error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
786
+ }
787
+ }
788
+ }
789
+ function validateFragmentProps(fragment) {
790
+ {
791
+ var keys = Object.keys(fragment.props);
792
+ for (var i = 0; i < keys.length; i++) {
793
+ var key = keys[i];
794
+ if (key !== "children" && key !== "key") {
795
+ setCurrentlyValidatingElement$1(fragment);
796
+ error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
797
+ setCurrentlyValidatingElement$1(null);
798
+ break;
799
+ }
800
+ }
801
+ if (fragment.ref !== null) {
802
+ setCurrentlyValidatingElement$1(fragment);
803
+ error("Invalid attribute `ref` supplied to `React.Fragment`.");
804
+ setCurrentlyValidatingElement$1(null);
805
+ }
806
+ }
807
+ }
808
+ var didWarnAboutKeySpread = {};
809
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
810
+ {
811
+ var validType = isValidElementType(type);
812
+ if (!validType) {
813
+ var info = "";
814
+ if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
815
+ info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
816
+ }
817
+ var sourceInfo = getSourceInfoErrorAddendum();
818
+ if (sourceInfo) {
819
+ info += sourceInfo;
820
+ } else {
821
+ info += getDeclarationErrorAddendum();
822
+ }
823
+ var typeString;
824
+ if (type === null) {
825
+ typeString = "null";
826
+ } else if (isArray(type)) {
827
+ typeString = "array";
828
+ } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
829
+ typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
830
+ info = " Did you accidentally export a JSX literal instead of a component?";
831
+ } else {
832
+ typeString = typeof type;
833
+ }
834
+ error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
835
+ }
836
+ var element = jsxDEV(type, props, key, source, self);
837
+ if (element == null) {
838
+ return element;
839
+ }
840
+ if (validType) {
841
+ var children = props.children;
842
+ if (children !== void 0) {
843
+ if (isStaticChildren) {
844
+ if (isArray(children)) {
845
+ for (var i = 0; i < children.length; i++) {
846
+ validateChildKeys(children[i], type);
847
+ }
848
+ if (Object.freeze) {
849
+ Object.freeze(children);
850
+ }
851
+ } else {
852
+ error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
853
+ }
854
+ } else {
855
+ validateChildKeys(children, type);
856
+ }
857
+ }
858
+ }
859
+ {
860
+ if (hasOwnProperty.call(props, "key")) {
861
+ var componentName = getComponentNameFromType(type);
862
+ var keys = Object.keys(props).filter(function(k) {
863
+ return k !== "key";
864
+ });
865
+ var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
866
+ if (!didWarnAboutKeySpread[componentName + beforeExample]) {
867
+ var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
868
+ error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
869
+ didWarnAboutKeySpread[componentName + beforeExample] = true;
870
+ }
871
+ }
872
+ }
873
+ if (type === REACT_FRAGMENT_TYPE) {
874
+ validateFragmentProps(element);
875
+ } else {
876
+ validatePropTypes(element);
877
+ }
878
+ return element;
879
+ }
880
+ }
881
+ function jsxWithValidationStatic(type, props, key) {
882
+ {
883
+ return jsxWithValidation(type, props, key, true);
884
+ }
885
+ }
886
+ function jsxWithValidationDynamic(type, props, key) {
887
+ {
888
+ return jsxWithValidation(type, props, key, false);
889
+ }
890
+ }
891
+ var jsx = jsxWithValidationDynamic;
892
+ var jsxs = jsxWithValidationStatic;
893
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
894
+ reactJsxRuntime_development.jsx = jsx;
895
+ reactJsxRuntime_development.jsxs = jsxs;
896
+ })();
897
+ }
898
+ return reactJsxRuntime_development;
899
+ }
900
+ var hasRequiredJsxRuntime;
901
+ function requireJsxRuntime() {
902
+ if (hasRequiredJsxRuntime) return jsxRuntime.exports;
903
+ hasRequiredJsxRuntime = 1;
904
+ if (process.env.NODE_ENV === "production") {
905
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
906
+ } else {
907
+ jsxRuntime.exports = requireReactJsxRuntime_development();
908
+ }
909
+ return jsxRuntime.exports;
910
+ }
911
+ var jsxRuntimeExports = requireJsxRuntime();
912
+ let calendarRegistered = false;
913
+ const registerCalendar = () => {
914
+ if (typeof window !== "undefined" && !calendarRegistered) {
915
+ import("@calenderjs/calendar");
916
+ calendarRegistered = true;
917
+ }
918
+ };
919
+ const Calendar = forwardRef(
920
+ ({
921
+ view = "month",
922
+ date,
923
+ events,
924
+ user,
925
+ onDateChange,
926
+ onViewChange,
927
+ onEventClick,
928
+ onDateDoubleClick,
929
+ className,
930
+ style,
931
+ ...rest
932
+ }, ref) => {
933
+ const calendarRef = useRef(null);
934
+ const [isClient, setIsClient] = useState(false);
935
+ useEffect(() => {
936
+ setIsClient(true);
937
+ registerCalendar();
938
+ }, []);
939
+ useImperativeHandle(ref, () => ({
940
+ getElement: () => calendarRef.current,
941
+ setView: (newView) => {
942
+ if (calendarRef.current) {
943
+ calendarRef.current.view = newView;
944
+ }
945
+ },
946
+ setDate: (newDate) => {
947
+ if (calendarRef.current) {
948
+ const date2 = typeof newDate === "string" ? new Date(newDate) : newDate;
949
+ calendarRef.current.date = date2;
950
+ }
951
+ },
952
+ goToToday: () => {
953
+ if (calendarRef.current) {
954
+ calendarRef.current.date = /* @__PURE__ */ new Date();
955
+ }
956
+ }
957
+ }));
958
+ useEffect(() => {
959
+ if (!calendarRef.current) return;
960
+ const element = calendarRef.current;
961
+ if (view !== void 0) {
962
+ element.view = view;
963
+ }
964
+ if (date !== void 0) {
965
+ element.date = date instanceof Date ? date : new Date(date);
966
+ }
967
+ if (events !== void 0) {
968
+ element.events = events;
969
+ }
970
+ if (user !== void 0) {
971
+ element.user = user;
972
+ }
973
+ }, [view, date, events, user]);
974
+ useEffect(() => {
975
+ if (!calendarRef.current) return;
976
+ const element = calendarRef.current;
977
+ const handleDateChange = (e) => {
978
+ onDateChange?.(e);
979
+ };
980
+ const handleViewChange = (e) => {
981
+ onViewChange?.(
982
+ e
983
+ );
984
+ };
985
+ const handleEventClick = (e) => {
986
+ onEventClick?.(e);
987
+ };
988
+ const handleDateDoubleClick = (e) => {
989
+ onDateDoubleClick?.(e);
990
+ };
991
+ element.addEventListener("date-change", handleDateChange);
992
+ element.addEventListener("view-change", handleViewChange);
993
+ element.addEventListener("event-click", handleEventClick);
994
+ element.addEventListener(
995
+ "date-double-click",
996
+ handleDateDoubleClick
997
+ );
998
+ return () => {
999
+ element.removeEventListener("date-change", handleDateChange);
1000
+ element.removeEventListener("view-change", handleViewChange);
1001
+ element.removeEventListener("event-click", handleEventClick);
1002
+ element.removeEventListener(
1003
+ "date-double-click",
1004
+ handleDateDoubleClick
1005
+ );
1006
+ };
1007
+ }, [onDateChange, onViewChange, onEventClick, onDateDoubleClick]);
1008
+ if (!isClient) {
1009
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
1010
+ "div",
1011
+ {
1012
+ className,
1013
+ style: { ...style, minHeight: "600px", display: "flex", alignItems: "center", justifyContent: "center" },
1014
+ ...rest,
1015
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "加载中..." })
1016
+ }
1017
+ );
1018
+ }
1019
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
1020
+ "wsx-calendar",
1021
+ {
1022
+ ref: calendarRef,
1023
+ className,
1024
+ style,
1025
+ ...rest
1026
+ }
1027
+ );
1028
+ }
1029
+ );
1030
+ Calendar.displayName = "Calendar";
1031
+ function ResizableSplitter({
1032
+ left,
1033
+ right,
1034
+ initialLeftWidth = 40,
1035
+ minLeftWidth = 20,
1036
+ maxLeftWidth = 80,
1037
+ className = ""
1038
+ }) {
1039
+ const [leftWidth, setLeftWidth] = useState(initialLeftWidth);
1040
+ const [isDragging, setIsDragging] = useState(false);
1041
+ const containerRef = useRef(null);
1042
+ const splitterRef = useRef(null);
1043
+ const handleMouseDown = useCallback((e) => {
1044
+ e.preventDefault();
1045
+ setIsDragging(true);
1046
+ }, []);
1047
+ const handleMouseMove = useCallback(
1048
+ (e) => {
1049
+ if (!isDragging || !containerRef.current) return;
1050
+ const containerRect = containerRef.current.getBoundingClientRect();
1051
+ const newLeftWidth = (e.clientX - containerRect.left) / containerRect.width * 100;
1052
+ const clampedWidth = Math.max(
1053
+ minLeftWidth,
1054
+ Math.min(maxLeftWidth, newLeftWidth)
1055
+ );
1056
+ setLeftWidth(clampedWidth);
1057
+ },
1058
+ [isDragging, minLeftWidth, maxLeftWidth]
1059
+ );
1060
+ const handleMouseUp = useCallback(() => {
1061
+ setIsDragging(false);
1062
+ }, []);
1063
+ useEffect(() => {
1064
+ if (isDragging) {
1065
+ document.addEventListener("mousemove", handleMouseMove);
1066
+ document.addEventListener("mouseup", handleMouseUp);
1067
+ document.body.style.cursor = "col-resize";
1068
+ document.body.style.userSelect = "none";
1069
+ return () => {
1070
+ document.removeEventListener("mousemove", handleMouseMove);
1071
+ document.removeEventListener("mouseup", handleMouseUp);
1072
+ document.body.style.cursor = "";
1073
+ document.body.style.userSelect = "";
1074
+ };
1075
+ }
1076
+ }, [isDragging, handleMouseMove, handleMouseUp]);
1077
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1078
+ "div",
1079
+ {
1080
+ ref: containerRef,
1081
+ className: `resizable-splitter ${className}`,
1082
+ style: {
1083
+ display: "flex",
1084
+ width: "100%",
1085
+ height: "100%",
1086
+ position: "relative"
1087
+ },
1088
+ children: [
1089
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1090
+ "div",
1091
+ {
1092
+ style: {
1093
+ width: `${leftWidth}%`,
1094
+ height: "100%",
1095
+ overflow: "hidden",
1096
+ display: "flex",
1097
+ flexDirection: "column"
1098
+ },
1099
+ children: left
1100
+ }
1101
+ ),
1102
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1103
+ "div",
1104
+ {
1105
+ ref: splitterRef,
1106
+ onMouseDown: handleMouseDown,
1107
+ style: {
1108
+ width: "var(--resizable-splitter-width, 4px)",
1109
+ height: "100%",
1110
+ cursor: "col-resize",
1111
+ backgroundColor: "var(--resizable-splitter-bg-color, #ddd)",
1112
+ position: "relative",
1113
+ flexShrink: 0,
1114
+ transition: isDragging ? "none" : "var(--resizable-splitter-transition, background-color 0.2s)"
1115
+ },
1116
+ onMouseEnter: (e) => {
1117
+ if (!isDragging) {
1118
+ e.currentTarget.style.backgroundColor = "var(--resizable-splitter-hover-bg-color, #bbb)";
1119
+ }
1120
+ },
1121
+ onMouseLeave: (e) => {
1122
+ if (!isDragging) {
1123
+ e.currentTarget.style.backgroundColor = "var(--resizable-splitter-bg-color, #ddd)";
1124
+ }
1125
+ },
1126
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1127
+ "div",
1128
+ {
1129
+ style: {
1130
+ position: "absolute",
1131
+ top: "50%",
1132
+ left: "50%",
1133
+ transform: "translate(-50%, -50%)",
1134
+ width: "var(--resizable-splitter-handle-width, 20px)",
1135
+ height: "var(--resizable-splitter-handle-height, 40px)",
1136
+ borderRadius: "var(--resizable-splitter-handle-border-radius, 4px)",
1137
+ backgroundColor: "var(--resizable-splitter-handle-bg-color, rgba(0,0,0,0.1))",
1138
+ display: "flex",
1139
+ alignItems: "center",
1140
+ justifyContent: "center",
1141
+ pointerEvents: "none"
1142
+ },
1143
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
1144
+ "div",
1145
+ {
1146
+ style: {
1147
+ display: "flex",
1148
+ flexDirection: "column",
1149
+ gap: "var(--resizable-splitter-dot-gap, 2px)"
1150
+ },
1151
+ children: [
1152
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1153
+ "div",
1154
+ {
1155
+ style: {
1156
+ width: "var(--resizable-splitter-dot-size, 3px)",
1157
+ height: "var(--resizable-splitter-dot-size, 3px)",
1158
+ borderRadius: "50%",
1159
+ backgroundColor: "var(--resizable-splitter-dot-color, #999)"
1160
+ }
1161
+ }
1162
+ ),
1163
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1164
+ "div",
1165
+ {
1166
+ style: {
1167
+ width: "var(--resizable-splitter-dot-size, 3px)",
1168
+ height: "var(--resizable-splitter-dot-size, 3px)",
1169
+ borderRadius: "50%",
1170
+ backgroundColor: "var(--resizable-splitter-dot-color, #999)"
1171
+ }
1172
+ }
1173
+ ),
1174
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1175
+ "div",
1176
+ {
1177
+ style: {
1178
+ width: "var(--resizable-splitter-dot-size, 3px)",
1179
+ height: "var(--resizable-splitter-dot-size, 3px)",
1180
+ borderRadius: "50%",
1181
+ backgroundColor: "var(--resizable-splitter-dot-color, #999)"
1182
+ }
1183
+ }
1184
+ )
1185
+ ]
1186
+ }
1187
+ )
1188
+ }
1189
+ )
1190
+ }
1191
+ ),
1192
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
1193
+ "div",
1194
+ {
1195
+ style: {
1196
+ flex: 1,
1197
+ height: "100%",
1198
+ overflow: "hidden",
1199
+ display: "flex",
1200
+ flexDirection: "column"
1201
+ },
1202
+ children: right
1203
+ }
1204
+ )
1205
+ ]
1206
+ }
1207
+ );
1208
+ }
1209
+ let r = false;
1210
+ function o(e) {
1211
+ r || (r = true, e.languages.register({ id: "event-dsl" }), e.languages.setMonarchTokensProvider("event-dsl", {
1212
+ // 关键字
1213
+ keywords: [
1214
+ "type",
1215
+ "name",
1216
+ "description",
1217
+ "fields",
1218
+ "validate",
1219
+ "display",
1220
+ "behavior",
1221
+ "required",
1222
+ "of",
1223
+ "and",
1224
+ "or",
1225
+ "not",
1226
+ "between",
1227
+ "in",
1228
+ "is",
1229
+ "equals",
1230
+ "not equals",
1231
+ "when",
1232
+ "conflict",
1233
+ "recurring",
1234
+ "constraints"
1235
+ ],
1236
+ // 操作符
1237
+ operators: [">=", "<=", ">", "<", "=", "!=", "mod"],
1238
+ // 类型
1239
+ types: [
1240
+ "string",
1241
+ "number",
1242
+ "boolean",
1243
+ "email",
1244
+ "url",
1245
+ "date",
1246
+ "time",
1247
+ "datetime",
1248
+ "list"
1249
+ ],
1250
+ // 符号
1251
+ symbols: /[=><!?:&|+\-*\/\^%]+/,
1252
+ // 转义序列
1253
+ escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
1254
+ // 词法规则
1255
+ tokenizer: {
1256
+ root: [
1257
+ // 关键字
1258
+ [
1259
+ /\b(type|name|description|fields|validate|display|behavior|required|and|or|not|between|in|is|equals|when|conflict|recurring|constraints)\b/,
1260
+ "keyword"
1261
+ ],
1262
+ // 类型
1263
+ [
1264
+ /\b(string|number|boolean|email|url|date|time|datetime|list)\b/,
1265
+ "type"
1266
+ ],
1267
+ // 操作符
1268
+ [/>=|<=|>|<|==|!=|mod/, "operator"],
1269
+ // 字符串字面量(双引号)
1270
+ [/"[^"]*"/, "string"],
1271
+ // 字符串字面量(单引号)
1272
+ [/'[^']*'/, "string"],
1273
+ // 数字
1274
+ [/\d+/, "number"],
1275
+ // 布尔值
1276
+ [/\b(true|false)\b/, "number"],
1277
+ // 颜色值(十六进制)
1278
+ [/#[0-9A-Fa-f]{6}/, "string"],
1279
+ // 字段访问(如 attendees.count, startTime.hour)
1280
+ [
1281
+ /[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)+/,
1282
+ "variable"
1283
+ ],
1284
+ // 标识符
1285
+ [/[a-zA-Z_][a-zA-Z0-9_]*/, "identifier"],
1286
+ // 注释(以 # 开头)
1287
+ [/#.*$/, "comment"],
1288
+ // 列表项(以 - 开头)
1289
+ [/^\s*-\s*/, "keyword"],
1290
+ // 冒号(用于键值对)
1291
+ [/:/, "delimiter"],
1292
+ // 空白字符
1293
+ { include: "@whitespace" }
1294
+ ],
1295
+ whitespace: [[/[ \t\r\n]+/, "white"]]
1296
+ }
1297
+ }), e.languages.registerCompletionItemProvider("event-dsl", {
1298
+ provideCompletionItems: (l, n) => {
1299
+ const i = l.getWordUntilPosition(n), t = {
1300
+ startLineNumber: n.lineNumber,
1301
+ endLineNumber: n.lineNumber,
1302
+ startColumn: i.startColumn,
1303
+ endColumn: i.endColumn
1304
+ };
1305
+ return { suggestions: [
1306
+ // 顶级关键字
1307
+ {
1308
+ label: "type",
1309
+ kind: e.languages.CompletionItemKind.Keyword,
1310
+ insertText: "type: ${1:event-type}",
1311
+ insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet,
1312
+ documentation: "定义事件类型",
1313
+ range: t
1314
+ },
1315
+ {
1316
+ label: "name",
1317
+ kind: e.languages.CompletionItemKind.Keyword,
1318
+ insertText: 'name: "${1:事件名称}"',
1319
+ insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet,
1320
+ documentation: "事件类型名称",
1321
+ range: t
1322
+ },
1323
+ {
1324
+ label: "description",
1325
+ kind: e.languages.CompletionItemKind.Keyword,
1326
+ insertText: 'description: "${1:事件描述}"',
1327
+ insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet,
1328
+ documentation: "事件类型描述",
1329
+ range: t
1330
+ },
1331
+ {
1332
+ label: "fields",
1333
+ kind: e.languages.CompletionItemKind.Keyword,
1334
+ insertText: "fields:\n - ${1:fieldName}: ${2:string}",
1335
+ insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet,
1336
+ documentation: "定义事件字段",
1337
+ range: t
1338
+ },
1339
+ {
1340
+ label: "validate",
1341
+ kind: e.languages.CompletionItemKind.Keyword,
1342
+ insertText: "validate:\n ${1:field} ${2:>=} ${3:value}",
1343
+ insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet,
1344
+ documentation: "定义验证规则",
1345
+ range: t
1346
+ },
1347
+ {
1348
+ label: "display",
1349
+ kind: e.languages.CompletionItemKind.Keyword,
1350
+ insertText: 'display:\n color: "${1:#4285f4}"\n icon: "${2:icon-name}"',
1351
+ insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet,
1352
+ documentation: "定义显示属性",
1353
+ range: t
1354
+ },
1355
+ {
1356
+ label: "behavior",
1357
+ kind: e.languages.CompletionItemKind.Keyword,
1358
+ insertText: "behavior:\n editable: ${1:true}\n draggable: ${2:true}",
1359
+ insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet,
1360
+ documentation: "定义行为属性",
1361
+ range: t
1362
+ },
1363
+ // 字段类型
1364
+ {
1365
+ label: "string",
1366
+ kind: e.languages.CompletionItemKind.TypeParameter,
1367
+ insertText: "string",
1368
+ documentation: "字符串类型",
1369
+ range: t
1370
+ },
1371
+ {
1372
+ label: "number",
1373
+ kind: e.languages.CompletionItemKind.TypeParameter,
1374
+ insertText: "number",
1375
+ documentation: "数字类型",
1376
+ range: t
1377
+ },
1378
+ {
1379
+ label: "boolean",
1380
+ kind: e.languages.CompletionItemKind.TypeParameter,
1381
+ insertText: "boolean",
1382
+ documentation: "布尔类型",
1383
+ range: t
1384
+ },
1385
+ {
1386
+ label: "email",
1387
+ kind: e.languages.CompletionItemKind.TypeParameter,
1388
+ insertText: "email",
1389
+ documentation: "邮箱类型",
1390
+ range: t
1391
+ },
1392
+ {
1393
+ label: "list of",
1394
+ kind: e.languages.CompletionItemKind.TypeParameter,
1395
+ insertText: "list of ${1:string}",
1396
+ insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet,
1397
+ documentation: "列表类型",
1398
+ range: t
1399
+ },
1400
+ // 操作符
1401
+ {
1402
+ label: ">=",
1403
+ kind: e.languages.CompletionItemKind.Operator,
1404
+ insertText: ">=",
1405
+ documentation: "大于等于",
1406
+ range: t
1407
+ },
1408
+ {
1409
+ label: "<=",
1410
+ kind: e.languages.CompletionItemKind.Operator,
1411
+ insertText: "<=",
1412
+ documentation: "小于等于",
1413
+ range: t
1414
+ },
1415
+ {
1416
+ label: "between",
1417
+ kind: e.languages.CompletionItemKind.Operator,
1418
+ insertText: "between ${1:min} and ${2:max}",
1419
+ insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet,
1420
+ documentation: "范围检查",
1421
+ range: t
1422
+ }
1423
+ ] };
1424
+ }
1425
+ }), e.editor.defineTheme("event-dsl-theme", {
1426
+ base: "vs",
1427
+ inherit: true,
1428
+ rules: [
1429
+ { token: "keyword", foreground: "0000ff", fontStyle: "bold" },
1430
+ { token: "type", foreground: "267f99" },
1431
+ { token: "string", foreground: "a31515" },
1432
+ { token: "number", foreground: "098658" },
1433
+ { token: "operator", foreground: "000000", fontStyle: "bold" },
1434
+ { token: "comment", foreground: "008000", fontStyle: "italic" },
1435
+ { token: "variable", foreground: "001080" }
1436
+ ],
1437
+ colors: {}
1438
+ }), e.editor.defineTheme("event-dsl-theme-dark", {
1439
+ base: "vs-dark",
1440
+ inherit: true,
1441
+ rules: [
1442
+ { token: "keyword", foreground: "569cd6", fontStyle: "bold" },
1443
+ { token: "type", foreground: "4ec9b0" },
1444
+ { token: "string", foreground: "ce9178" },
1445
+ { token: "number", foreground: "b5cea8" },
1446
+ { token: "operator", foreground: "d4d4d4", fontStyle: "bold" },
1447
+ { token: "comment", foreground: "6a9955", fontStyle: "italic" },
1448
+ { token: "variable", foreground: "9cdcfe" }
1449
+ ],
1450
+ colors: {}
1451
+ }));
1452
+ }
1453
+ function EventEditor({
1454
+ value = "",
1455
+ onChange,
1456
+ height = "100%",
1457
+ darkMode = false,
1458
+ className = "",
1459
+ style,
1460
+ options,
1461
+ onMount,
1462
+ EditorComponent
1463
+ }) {
1464
+ const handleMount = (editor, monaco) => {
1465
+ o(monaco);
1466
+ onMount?.(editor, monaco);
1467
+ };
1468
+ const editorOptions = useMemo(
1469
+ () => ({
1470
+ minimap: { enabled: false },
1471
+ fontSize: 14,
1472
+ wordWrap: "on",
1473
+ lineNumbers: "on",
1474
+ scrollBeyondLastLine: false,
1475
+ suggestOnTriggerCharacters: true,
1476
+ quickSuggestions: true,
1477
+ tabSize: 2,
1478
+ autoIndent: "full",
1479
+ ...options
1480
+ }),
1481
+ [options]
1482
+ );
1483
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
1484
+ "div",
1485
+ {
1486
+ className: `event-editor ${className}`,
1487
+ style: {
1488
+ ...style,
1489
+ height: typeof height === "number" ? `${height}px` : height,
1490
+ width: "100%",
1491
+ backgroundColor: darkMode ? "var(--event-editor-bg-color-dark, #1e1e1e)" : "var(--event-editor-bg-color, #fff)"
1492
+ },
1493
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1494
+ EditorComponent,
1495
+ {
1496
+ height: "100%",
1497
+ language: "event-dsl",
1498
+ value,
1499
+ onChange,
1500
+ theme: darkMode ? "event-dsl-theme-dark" : "event-dsl-theme",
1501
+ onMount: handleMount,
1502
+ options: editorOptions
1503
+ }
1504
+ )
1505
+ }
1506
+ );
1507
+ }
1508
+ export {
1509
+ Calendar,
1510
+ EventEditor,
1511
+ ResizableSplitter
1512
+ };
1513
+ //# sourceMappingURL=index.mjs.map