UNPKG

1.58 MBJavaScriptView Raw
1/*
2* @nebula.js/stardust v2.12.0
3* Copyright (c) 2022 QlikTech International AB
4* Released under the MIT license.
5*/
6
7(function (global, factory) {
8 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
9 typeof define === 'function' && define.amd ? define(['exports'], factory) :
10 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.stardust = {}));
11})(this, (function (exports) { 'use strict';
12
13 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
14
15 function getDefaultExportFromCjs (x) {
16 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
17 }
18
19 var runtime = {exports: {}};
20
21 /**
22 * Copyright (c) 2014-present, Facebook, Inc.
23 *
24 * This source code is licensed under the MIT license found in the
25 * LICENSE file in the root directory of this source tree.
26 */
27
28 (function (module) {
29 var runtime = (function (exports) {
30
31 var Op = Object.prototype;
32 var hasOwn = Op.hasOwnProperty;
33 var undefined$1; // More compressible than void 0.
34 var $Symbol = typeof Symbol === "function" ? Symbol : {};
35 var iteratorSymbol = $Symbol.iterator || "@@iterator";
36 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
37 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
38
39 function define(obj, key, value) {
40 Object.defineProperty(obj, key, {
41 value: value,
42 enumerable: true,
43 configurable: true,
44 writable: true
45 });
46 return obj[key];
47 }
48 try {
49 // IE 8 has a broken Object.defineProperty that only works on DOM objects.
50 define({}, "");
51 } catch (err) {
52 define = function(obj, key, value) {
53 return obj[key] = value;
54 };
55 }
56
57 function wrap(innerFn, outerFn, self, tryLocsList) {
58 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
59 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
60 var generator = Object.create(protoGenerator.prototype);
61 var context = new Context(tryLocsList || []);
62
63 // The ._invoke method unifies the implementations of the .next,
64 // .throw, and .return methods.
65 generator._invoke = makeInvokeMethod(innerFn, self, context);
66
67 return generator;
68 }
69 exports.wrap = wrap;
70
71 // Try/catch helper to minimize deoptimizations. Returns a completion
72 // record like context.tryEntries[i].completion. This interface could
73 // have been (and was previously) designed to take a closure to be
74 // invoked without arguments, but in all the cases we care about we
75 // already have an existing method we want to call, so there's no need
76 // to create a new function object. We can even get away with assuming
77 // the method takes exactly one argument, since that happens to be true
78 // in every case, so we don't have to touch the arguments object. The
79 // only additional allocation required is the completion record, which
80 // has a stable shape and so hopefully should be cheap to allocate.
81 function tryCatch(fn, obj, arg) {
82 try {
83 return { type: "normal", arg: fn.call(obj, arg) };
84 } catch (err) {
85 return { type: "throw", arg: err };
86 }
87 }
88
89 var GenStateSuspendedStart = "suspendedStart";
90 var GenStateSuspendedYield = "suspendedYield";
91 var GenStateExecuting = "executing";
92 var GenStateCompleted = "completed";
93
94 // Returning this object from the innerFn has the same effect as
95 // breaking out of the dispatch switch statement.
96 var ContinueSentinel = {};
97
98 // Dummy constructor functions that we use as the .constructor and
99 // .constructor.prototype properties for functions that return Generator
100 // objects. For full spec compliance, you may wish to configure your
101 // minifier not to mangle the names of these two functions.
102 function Generator() {}
103 function GeneratorFunction() {}
104 function GeneratorFunctionPrototype() {}
105
106 // This is a polyfill for %IteratorPrototype% for environments that
107 // don't natively support it.
108 var IteratorPrototype = {};
109 define(IteratorPrototype, iteratorSymbol, function () {
110 return this;
111 });
112
113 var getProto = Object.getPrototypeOf;
114 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
115 if (NativeIteratorPrototype &&
116 NativeIteratorPrototype !== Op &&
117 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
118 // This environment has a native %IteratorPrototype%; use it instead
119 // of the polyfill.
120 IteratorPrototype = NativeIteratorPrototype;
121 }
122
123 var Gp = GeneratorFunctionPrototype.prototype =
124 Generator.prototype = Object.create(IteratorPrototype);
125 GeneratorFunction.prototype = GeneratorFunctionPrototype;
126 define(Gp, "constructor", GeneratorFunctionPrototype);
127 define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
128 GeneratorFunction.displayName = define(
129 GeneratorFunctionPrototype,
130 toStringTagSymbol,
131 "GeneratorFunction"
132 );
133
134 // Helper for defining the .next, .throw, and .return methods of the
135 // Iterator interface in terms of a single ._invoke method.
136 function defineIteratorMethods(prototype) {
137 ["next", "throw", "return"].forEach(function(method) {
138 define(prototype, method, function(arg) {
139 return this._invoke(method, arg);
140 });
141 });
142 }
143
144 exports.isGeneratorFunction = function(genFun) {
145 var ctor = typeof genFun === "function" && genFun.constructor;
146 return ctor
147 ? ctor === GeneratorFunction ||
148 // For the native GeneratorFunction constructor, the best we can
149 // do is to check its .name property.
150 (ctor.displayName || ctor.name) === "GeneratorFunction"
151 : false;
152 };
153
154 exports.mark = function(genFun) {
155 if (Object.setPrototypeOf) {
156 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
157 } else {
158 genFun.__proto__ = GeneratorFunctionPrototype;
159 define(genFun, toStringTagSymbol, "GeneratorFunction");
160 }
161 genFun.prototype = Object.create(Gp);
162 return genFun;
163 };
164
165 // Within the body of any async function, `await x` is transformed to
166 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
167 // `hasOwn.call(value, "__await")` to determine if the yielded value is
168 // meant to be awaited.
169 exports.awrap = function(arg) {
170 return { __await: arg };
171 };
172
173 function AsyncIterator(generator, PromiseImpl) {
174 function invoke(method, arg, resolve, reject) {
175 var record = tryCatch(generator[method], generator, arg);
176 if (record.type === "throw") {
177 reject(record.arg);
178 } else {
179 var result = record.arg;
180 var value = result.value;
181 if (value &&
182 typeof value === "object" &&
183 hasOwn.call(value, "__await")) {
184 return PromiseImpl.resolve(value.__await).then(function(value) {
185 invoke("next", value, resolve, reject);
186 }, function(err) {
187 invoke("throw", err, resolve, reject);
188 });
189 }
190
191 return PromiseImpl.resolve(value).then(function(unwrapped) {
192 // When a yielded Promise is resolved, its final value becomes
193 // the .value of the Promise<{value,done}> result for the
194 // current iteration.
195 result.value = unwrapped;
196 resolve(result);
197 }, function(error) {
198 // If a rejected Promise was yielded, throw the rejection back
199 // into the async generator function so it can be handled there.
200 return invoke("throw", error, resolve, reject);
201 });
202 }
203 }
204
205 var previousPromise;
206
207 function enqueue(method, arg) {
208 function callInvokeWithMethodAndArg() {
209 return new PromiseImpl(function(resolve, reject) {
210 invoke(method, arg, resolve, reject);
211 });
212 }
213
214 return previousPromise =
215 // If enqueue has been called before, then we want to wait until
216 // all previous Promises have been resolved before calling invoke,
217 // so that results are always delivered in the correct order. If
218 // enqueue has not been called before, then it is important to
219 // call invoke immediately, without waiting on a callback to fire,
220 // so that the async generator function has the opportunity to do
221 // any necessary setup in a predictable way. This predictability
222 // is why the Promise constructor synchronously invokes its
223 // executor callback, and why async functions synchronously
224 // execute code before the first await. Since we implement simple
225 // async functions in terms of async generators, it is especially
226 // important to get this right, even though it requires care.
227 previousPromise ? previousPromise.then(
228 callInvokeWithMethodAndArg,
229 // Avoid propagating failures to Promises returned by later
230 // invocations of the iterator.
231 callInvokeWithMethodAndArg
232 ) : callInvokeWithMethodAndArg();
233 }
234
235 // Define the unified helper method that is used to implement .next,
236 // .throw, and .return (see defineIteratorMethods).
237 this._invoke = enqueue;
238 }
239
240 defineIteratorMethods(AsyncIterator.prototype);
241 define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
242 return this;
243 });
244 exports.AsyncIterator = AsyncIterator;
245
246 // Note that simple async functions are implemented on top of
247 // AsyncIterator objects; they just return a Promise for the value of
248 // the final result produced by the iterator.
249 exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
250 if (PromiseImpl === void 0) PromiseImpl = Promise;
251
252 var iter = new AsyncIterator(
253 wrap(innerFn, outerFn, self, tryLocsList),
254 PromiseImpl
255 );
256
257 return exports.isGeneratorFunction(outerFn)
258 ? iter // If outerFn is a generator, return the full iterator.
259 : iter.next().then(function(result) {
260 return result.done ? result.value : iter.next();
261 });
262 };
263
264 function makeInvokeMethod(innerFn, self, context) {
265 var state = GenStateSuspendedStart;
266
267 return function invoke(method, arg) {
268 if (state === GenStateExecuting) {
269 throw new Error("Generator is already running");
270 }
271
272 if (state === GenStateCompleted) {
273 if (method === "throw") {
274 throw arg;
275 }
276
277 // Be forgiving, per 25.3.3.3.3 of the spec:
278 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
279 return doneResult();
280 }
281
282 context.method = method;
283 context.arg = arg;
284
285 while (true) {
286 var delegate = context.delegate;
287 if (delegate) {
288 var delegateResult = maybeInvokeDelegate(delegate, context);
289 if (delegateResult) {
290 if (delegateResult === ContinueSentinel) continue;
291 return delegateResult;
292 }
293 }
294
295 if (context.method === "next") {
296 // Setting context._sent for legacy support of Babel's
297 // function.sent implementation.
298 context.sent = context._sent = context.arg;
299
300 } else if (context.method === "throw") {
301 if (state === GenStateSuspendedStart) {
302 state = GenStateCompleted;
303 throw context.arg;
304 }
305
306 context.dispatchException(context.arg);
307
308 } else if (context.method === "return") {
309 context.abrupt("return", context.arg);
310 }
311
312 state = GenStateExecuting;
313
314 var record = tryCatch(innerFn, self, context);
315 if (record.type === "normal") {
316 // If an exception is thrown from innerFn, we leave state ===
317 // GenStateExecuting and loop back for another invocation.
318 state = context.done
319 ? GenStateCompleted
320 : GenStateSuspendedYield;
321
322 if (record.arg === ContinueSentinel) {
323 continue;
324 }
325
326 return {
327 value: record.arg,
328 done: context.done
329 };
330
331 } else if (record.type === "throw") {
332 state = GenStateCompleted;
333 // Dispatch the exception by looping back around to the
334 // context.dispatchException(context.arg) call above.
335 context.method = "throw";
336 context.arg = record.arg;
337 }
338 }
339 };
340 }
341
342 // Call delegate.iterator[context.method](context.arg) and handle the
343 // result, either by returning a { value, done } result from the
344 // delegate iterator, or by modifying context.method and context.arg,
345 // setting context.delegate to null, and returning the ContinueSentinel.
346 function maybeInvokeDelegate(delegate, context) {
347 var method = delegate.iterator[context.method];
348 if (method === undefined$1) {
349 // A .throw or .return when the delegate iterator has no .throw
350 // method always terminates the yield* loop.
351 context.delegate = null;
352
353 if (context.method === "throw") {
354 // Note: ["return"] must be used for ES3 parsing compatibility.
355 if (delegate.iterator["return"]) {
356 // If the delegate iterator has a return method, give it a
357 // chance to clean up.
358 context.method = "return";
359 context.arg = undefined$1;
360 maybeInvokeDelegate(delegate, context);
361
362 if (context.method === "throw") {
363 // If maybeInvokeDelegate(context) changed context.method from
364 // "return" to "throw", let that override the TypeError below.
365 return ContinueSentinel;
366 }
367 }
368
369 context.method = "throw";
370 context.arg = new TypeError(
371 "The iterator does not provide a 'throw' method");
372 }
373
374 return ContinueSentinel;
375 }
376
377 var record = tryCatch(method, delegate.iterator, context.arg);
378
379 if (record.type === "throw") {
380 context.method = "throw";
381 context.arg = record.arg;
382 context.delegate = null;
383 return ContinueSentinel;
384 }
385
386 var info = record.arg;
387
388 if (! info) {
389 context.method = "throw";
390 context.arg = new TypeError("iterator result is not an object");
391 context.delegate = null;
392 return ContinueSentinel;
393 }
394
395 if (info.done) {
396 // Assign the result of the finished delegate to the temporary
397 // variable specified by delegate.resultName (see delegateYield).
398 context[delegate.resultName] = info.value;
399
400 // Resume execution at the desired location (see delegateYield).
401 context.next = delegate.nextLoc;
402
403 // If context.method was "throw" but the delegate handled the
404 // exception, let the outer generator proceed normally. If
405 // context.method was "next", forget context.arg since it has been
406 // "consumed" by the delegate iterator. If context.method was
407 // "return", allow the original .return call to continue in the
408 // outer generator.
409 if (context.method !== "return") {
410 context.method = "next";
411 context.arg = undefined$1;
412 }
413
414 } else {
415 // Re-yield the result returned by the delegate method.
416 return info;
417 }
418
419 // The delegate iterator is finished, so forget it and continue with
420 // the outer generator.
421 context.delegate = null;
422 return ContinueSentinel;
423 }
424
425 // Define Generator.prototype.{next,throw,return} in terms of the
426 // unified ._invoke helper method.
427 defineIteratorMethods(Gp);
428
429 define(Gp, toStringTagSymbol, "Generator");
430
431 // A Generator should always return itself as the iterator object when the
432 // @@iterator function is called on it. Some browsers' implementations of the
433 // iterator prototype chain incorrectly implement this, causing the Generator
434 // object to not be returned from this call. This ensures that doesn't happen.
435 // See https://github.com/facebook/regenerator/issues/274 for more details.
436 define(Gp, iteratorSymbol, function() {
437 return this;
438 });
439
440 define(Gp, "toString", function() {
441 return "[object Generator]";
442 });
443
444 function pushTryEntry(locs) {
445 var entry = { tryLoc: locs[0] };
446
447 if (1 in locs) {
448 entry.catchLoc = locs[1];
449 }
450
451 if (2 in locs) {
452 entry.finallyLoc = locs[2];
453 entry.afterLoc = locs[3];
454 }
455
456 this.tryEntries.push(entry);
457 }
458
459 function resetTryEntry(entry) {
460 var record = entry.completion || {};
461 record.type = "normal";
462 delete record.arg;
463 entry.completion = record;
464 }
465
466 function Context(tryLocsList) {
467 // The root entry object (effectively a try statement without a catch
468 // or a finally block) gives us a place to store values thrown from
469 // locations where there is no enclosing try statement.
470 this.tryEntries = [{ tryLoc: "root" }];
471 tryLocsList.forEach(pushTryEntry, this);
472 this.reset(true);
473 }
474
475 exports.keys = function(object) {
476 var keys = [];
477 for (var key in object) {
478 keys.push(key);
479 }
480 keys.reverse();
481
482 // Rather than returning an object with a next method, we keep
483 // things simple and return the next function itself.
484 return function next() {
485 while (keys.length) {
486 var key = keys.pop();
487 if (key in object) {
488 next.value = key;
489 next.done = false;
490 return next;
491 }
492 }
493
494 // To avoid creating an additional object, we just hang the .value
495 // and .done properties off the next function object itself. This
496 // also ensures that the minifier will not anonymize the function.
497 next.done = true;
498 return next;
499 };
500 };
501
502 function values(iterable) {
503 if (iterable) {
504 var iteratorMethod = iterable[iteratorSymbol];
505 if (iteratorMethod) {
506 return iteratorMethod.call(iterable);
507 }
508
509 if (typeof iterable.next === "function") {
510 return iterable;
511 }
512
513 if (!isNaN(iterable.length)) {
514 var i = -1, next = function next() {
515 while (++i < iterable.length) {
516 if (hasOwn.call(iterable, i)) {
517 next.value = iterable[i];
518 next.done = false;
519 return next;
520 }
521 }
522
523 next.value = undefined$1;
524 next.done = true;
525
526 return next;
527 };
528
529 return next.next = next;
530 }
531 }
532
533 // Return an iterator with no values.
534 return { next: doneResult };
535 }
536 exports.values = values;
537
538 function doneResult() {
539 return { value: undefined$1, done: true };
540 }
541
542 Context.prototype = {
543 constructor: Context,
544
545 reset: function(skipTempReset) {
546 this.prev = 0;
547 this.next = 0;
548 // Resetting context._sent for legacy support of Babel's
549 // function.sent implementation.
550 this.sent = this._sent = undefined$1;
551 this.done = false;
552 this.delegate = null;
553
554 this.method = "next";
555 this.arg = undefined$1;
556
557 this.tryEntries.forEach(resetTryEntry);
558
559 if (!skipTempReset) {
560 for (var name in this) {
561 // Not sure about the optimal order of these conditions:
562 if (name.charAt(0) === "t" &&
563 hasOwn.call(this, name) &&
564 !isNaN(+name.slice(1))) {
565 this[name] = undefined$1;
566 }
567 }
568 }
569 },
570
571 stop: function() {
572 this.done = true;
573
574 var rootEntry = this.tryEntries[0];
575 var rootRecord = rootEntry.completion;
576 if (rootRecord.type === "throw") {
577 throw rootRecord.arg;
578 }
579
580 return this.rval;
581 },
582
583 dispatchException: function(exception) {
584 if (this.done) {
585 throw exception;
586 }
587
588 var context = this;
589 function handle(loc, caught) {
590 record.type = "throw";
591 record.arg = exception;
592 context.next = loc;
593
594 if (caught) {
595 // If the dispatched exception was caught by a catch block,
596 // then let that catch block handle the exception normally.
597 context.method = "next";
598 context.arg = undefined$1;
599 }
600
601 return !! caught;
602 }
603
604 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
605 var entry = this.tryEntries[i];
606 var record = entry.completion;
607
608 if (entry.tryLoc === "root") {
609 // Exception thrown outside of any try block that could handle
610 // it, so set the completion value of the entire function to
611 // throw the exception.
612 return handle("end");
613 }
614
615 if (entry.tryLoc <= this.prev) {
616 var hasCatch = hasOwn.call(entry, "catchLoc");
617 var hasFinally = hasOwn.call(entry, "finallyLoc");
618
619 if (hasCatch && hasFinally) {
620 if (this.prev < entry.catchLoc) {
621 return handle(entry.catchLoc, true);
622 } else if (this.prev < entry.finallyLoc) {
623 return handle(entry.finallyLoc);
624 }
625
626 } else if (hasCatch) {
627 if (this.prev < entry.catchLoc) {
628 return handle(entry.catchLoc, true);
629 }
630
631 } else if (hasFinally) {
632 if (this.prev < entry.finallyLoc) {
633 return handle(entry.finallyLoc);
634 }
635
636 } else {
637 throw new Error("try statement without catch or finally");
638 }
639 }
640 }
641 },
642
643 abrupt: function(type, arg) {
644 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
645 var entry = this.tryEntries[i];
646 if (entry.tryLoc <= this.prev &&
647 hasOwn.call(entry, "finallyLoc") &&
648 this.prev < entry.finallyLoc) {
649 var finallyEntry = entry;
650 break;
651 }
652 }
653
654 if (finallyEntry &&
655 (type === "break" ||
656 type === "continue") &&
657 finallyEntry.tryLoc <= arg &&
658 arg <= finallyEntry.finallyLoc) {
659 // Ignore the finally entry if control is not jumping to a
660 // location outside the try/catch block.
661 finallyEntry = null;
662 }
663
664 var record = finallyEntry ? finallyEntry.completion : {};
665 record.type = type;
666 record.arg = arg;
667
668 if (finallyEntry) {
669 this.method = "next";
670 this.next = finallyEntry.finallyLoc;
671 return ContinueSentinel;
672 }
673
674 return this.complete(record);
675 },
676
677 complete: function(record, afterLoc) {
678 if (record.type === "throw") {
679 throw record.arg;
680 }
681
682 if (record.type === "break" ||
683 record.type === "continue") {
684 this.next = record.arg;
685 } else if (record.type === "return") {
686 this.rval = this.arg = record.arg;
687 this.method = "return";
688 this.next = "end";
689 } else if (record.type === "normal" && afterLoc) {
690 this.next = afterLoc;
691 }
692
693 return ContinueSentinel;
694 },
695
696 finish: function(finallyLoc) {
697 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
698 var entry = this.tryEntries[i];
699 if (entry.finallyLoc === finallyLoc) {
700 this.complete(entry.completion, entry.afterLoc);
701 resetTryEntry(entry);
702 return ContinueSentinel;
703 }
704 }
705 },
706
707 "catch": function(tryLoc) {
708 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
709 var entry = this.tryEntries[i];
710 if (entry.tryLoc === tryLoc) {
711 var record = entry.completion;
712 if (record.type === "throw") {
713 var thrown = record.arg;
714 resetTryEntry(entry);
715 }
716 return thrown;
717 }
718 }
719
720 // The context.catch method must only be called with a location
721 // argument that corresponds to a known catch block.
722 throw new Error("illegal catch attempt");
723 },
724
725 delegateYield: function(iterable, resultName, nextLoc) {
726 this.delegate = {
727 iterator: values(iterable),
728 resultName: resultName,
729 nextLoc: nextLoc
730 };
731
732 if (this.method === "next") {
733 // Deliberately forget the last sent value so that we don't
734 // accidentally pass it on to the delegate.
735 this.arg = undefined$1;
736 }
737
738 return ContinueSentinel;
739 }
740 };
741
742 // Regardless of whether this script is executing as a CommonJS module
743 // or not, return the runtime object so that we can declare the variable
744 // regeneratorRuntime in the outer scope, which allows this module to be
745 // injected easily by `bin/regenerator --include-runtime script.js`.
746 return exports;
747
748 }(
749 // If this script is executing as a CommonJS module, use module.exports
750 // as the regeneratorRuntime namespace. Otherwise create a new empty
751 // object. Either way, the resulting object will be used to initialize
752 // the regeneratorRuntime variable at the top of this file.
753 module.exports
754 ));
755
756 try {
757 regeneratorRuntime = runtime;
758 } catch (accidentalStrictMode) {
759 // This module should not be running in strict mode, so the above
760 // assignment should always work unless something is misconfigured. Just
761 // in case runtime.js accidentally runs in strict mode, in modern engines
762 // we can explicitly access globalThis. In older engines we can escape
763 // strict mode using a global Function call. This could conceivably fail
764 // if a Content Security Policy forbids using Function, but in that case
765 // the proper solution is to fix the accidental strict mode problem. If
766 // you've misconfigured your bundler to force strict mode and applied a
767 // CSP to forbid Function, and you're not willing to fix either of those
768 // problems, please detail your unique predicament in a GitHub issue.
769 if (typeof globalThis === "object") {
770 globalThis.regeneratorRuntime = runtime;
771 } else {
772 Function("r", "regeneratorRuntime = r")(runtime);
773 }
774 }
775 } (runtime));
776
777 function ownKeys(object, enumerableOnly) {
778 var keys = Object.keys(object);
779
780 if (Object.getOwnPropertySymbols) {
781 var symbols = Object.getOwnPropertySymbols(object);
782 enumerableOnly && (symbols = symbols.filter(function (sym) {
783 return Object.getOwnPropertyDescriptor(object, sym).enumerable;
784 })), keys.push.apply(keys, symbols);
785 }
786
787 return keys;
788 }
789
790 function _objectSpread2(target) {
791 for (var i = 1; i < arguments.length; i++) {
792 var source = null != arguments[i] ? arguments[i] : {};
793 i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
794 _defineProperty$2(target, key, source[key]);
795 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
796 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
797 });
798 }
799
800 return target;
801 }
802
803 function _defineProperty$2(obj, key, value) {
804 if (key in obj) {
805 Object.defineProperty(obj, key, {
806 value: value,
807 enumerable: true,
808 configurable: true,
809 writable: true
810 });
811 } else {
812 obj[key] = value;
813 }
814
815 return obj;
816 }
817
818 function _extends$b() {
819 _extends$b = Object.assign || function (target) {
820 for (var i = 1; i < arguments.length; i++) {
821 var source = arguments[i];
822
823 for (var key in source) {
824 if (Object.prototype.hasOwnProperty.call(source, key)) {
825 target[key] = source[key];
826 }
827 }
828 }
829
830 return target;
831 };
832
833 return _extends$b.apply(this, arguments);
834 }
835
836 function _objectWithoutPropertiesLoose$4(source, excluded) {
837 if (source == null) return {};
838 var target = {};
839 var sourceKeys = Object.keys(source);
840 var key, i;
841
842 for (i = 0; i < sourceKeys.length; i++) {
843 key = sourceKeys[i];
844 if (excluded.indexOf(key) >= 0) continue;
845 target[key] = source[key];
846 }
847
848 return target;
849 }
850
851 function _objectWithoutProperties$2(source, excluded) {
852 if (source == null) return {};
853
854 var target = _objectWithoutPropertiesLoose$4(source, excluded);
855
856 var key, i;
857
858 if (Object.getOwnPropertySymbols) {
859 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
860
861 for (i = 0; i < sourceSymbolKeys.length; i++) {
862 key = sourceSymbolKeys[i];
863 if (excluded.indexOf(key) >= 0) continue;
864 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
865 target[key] = source[key];
866 }
867 }
868
869 return target;
870 }
871
872 const format = function () {
873 let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
874 let args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
875 const arr = typeof args === 'string' || typeof args === 'number' ? [args] : args;
876 return message.replace(/\{(\d+)\}/g, (match, number) => typeof arr[number] !== 'undefined' ? arr[number] : match);
877 };
878
879 function translator() {
880 let {
881 initial = 'en-US',
882 fallback = 'en-US'
883 } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
884 const dictionaries = {};
885 let currentLocale = initial;
886 /**
887 * @class Translator
888 */
889
890 const api =
891 /** @lends Translator# */
892 {
893 language: lang => {
894 if (lang) {
895 currentLocale = lang;
896 }
897
898 return currentLocale;
899 },
900
901 /**
902 * Registers a string in multiple locales
903 * @param {object} item
904 * @param {string} item.id
905 * @param {object<string,string>} item.locale
906 * @example
907 * translator.add({
908 * id: 'company.hello_user',
909 * locale: {
910 * 'en-US': 'Hello {0}',
911 * 'sv-SE': 'Hej {0}'
912 * }
913 * });
914 * translator.get('company.hello_user', ['John']); // Hello John
915 */
916 add: item => {
917 // TODO - disallow override?
918 const {
919 id,
920 locale
921 } = item;
922 Object.keys(locale).forEach(lang => {
923 if (!dictionaries[lang]) {
924 dictionaries[lang] = {};
925 }
926
927 dictionaries[lang][id] = locale[lang];
928 });
929 },
930
931 /**
932 * Translates a string for current locale.
933 * @param {string} str - ID of the registered string.
934 * @param {Array<string>=} args - Values passed down for string interpolation.
935 * @returns {string} The translated string.
936 */
937 get(str, args) {
938 let v;
939
940 if (dictionaries[currentLocale] && typeof dictionaries[currentLocale][str] !== 'undefined') {
941 v = dictionaries[currentLocale][str];
942 } else if (dictionaries[fallback] && typeof dictionaries[fallback][str] !== 'undefined') {
943 v = dictionaries[fallback][str];
944 } else {
945 v = str;
946 }
947
948 return typeof args !== 'undefined' ? format(v, args) : v;
949 }
950
951 };
952 return api;
953 }
954
955 const locale = function () {
956 let {
957 initial = 'en-US',
958 fallback = 'en-US'
959 } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
960 const t = translator({
961 initial,
962 fallback
963 });
964 return {
965 translator: t
966 };
967 };
968
969 var Cancel$1 = {
970 id: "Cancel",
971 locale: {
972 "de-DE": "Abbrechen",
973 "en-US": "Cancel",
974 "es-ES": "Cancelar",
975 "fr-FR": "Annuler",
976 "it-IT": "Annulla",
977 "ja-JP": "キャンセル",
978 "ko-KR": "취소",
979 "nl-NL": "Annuleren",
980 "pl-PL": "Anuluj",
981 "pt-BR": "Cancelar",
982 "ru-RU": "Отмена",
983 "sv-SE": "Avbryt",
984 "tr-TR": "İptal",
985 "zh-CN": "取消",
986 "zh-TW": "取消"
987 }
988 };
989 var CurrentSelections_All = {
990 id: "CurrentSelections.All",
991 locale: {
992 "de-DE": "ALLES",
993 "en-US": "ALL",
994 "es-ES": "TODOS",
995 "fr-FR": "TOUS",
996 "it-IT": "TUTTI",
997 "ja-JP": "すべて",
998 "ko-KR": "모두",
999 "nl-NL": "ALLE",
1000 "pl-PL": "WSZYSTKO",
1001 "pt-BR": "TODOS",
1002 "ru-RU": "ВСЕ",
1003 "sv-SE": "ALLA",
1004 "tr-TR": "TÜMÜ",
1005 "zh-CN": "全部",
1006 "zh-TW": "全部"
1007 }
1008 };
1009 var CurrentSelections_Of = {
1010 id: "CurrentSelections.Of",
1011 locale: {
1012 "de-DE": "{0} von {1}",
1013 "en-US": "{0} of {1}",
1014 "es-ES": "{0} de {1}",
1015 "fr-FR": "{0} sur {1}",
1016 "it-IT": "{0} di {1}",
1017 "ja-JP": "{0}/ {1}",
1018 "ko-KR": "{0} / {1}",
1019 "nl-NL": "{0} van {1}",
1020 "pl-PL": "{0} z {1}",
1021 "pt-BR": "{0} de {1}",
1022 "ru-RU": "{0} из {1}",
1023 "sv-SE": "{0} av {1}",
1024 "tr-TR": "{0} / {1}",
1025 "zh-CN": "{0}/ {1}",
1026 "zh-TW": "{0}/ {1}"
1027 }
1028 };
1029 var Listbox_Lock = {
1030 id: "Listbox.Lock",
1031 locale: {
1032 "de-DE": "Auswahlen sperren",
1033 "en-US": "Lock selections",
1034 "es-ES": "Bloquear selecciones",
1035 "fr-FR": "Verrouiller les sélections",
1036 "it-IT": "Blocca selezioni",
1037 "ja-JP": "選択をロック",
1038 "ko-KR": "선택 내용 잠금",
1039 "nl-NL": "Selecties vergrendelen",
1040 "pl-PL": "Zablokuj wybory",
1041 "pt-BR": "Bloquear seleções",
1042 "ru-RU": "Заблокировать выборки",
1043 "sv-SE": "Lås urval",
1044 "tr-TR": "Seçimleri kilitle",
1045 "zh-CN": "锁定选择项",
1046 "zh-TW": "鎖定選項"
1047 }
1048 };
1049 var Listbox_Search = {
1050 id: "Listbox.Search",
1051 locale: {
1052 "de-DE": "In Listenfeld suchen",
1053 "en-US": "Search in listbox",
1054 "es-ES": "Buscar en cuadro de lista",
1055 "fr-FR": "Rechercher dans la liste de sélection",
1056 "it-IT": "Cerca nella casella di elenco",
1057 "ja-JP": "リストボックス内を検索",
1058 "ko-KR": "목록 상자에서 검색",
1059 "nl-NL": "Zoeken in keuzelijst",
1060 "pl-PL": "Wyszukaj w liście wartości",
1061 "pt-BR": "Pesquisar na caixa de listagem",
1062 "ru-RU": "Поиск в списке",
1063 "sv-SE": "Sök i listruta",
1064 "tr-TR": "Liste kutusunda ara",
1065 "zh-CN": "在列表框中搜索",
1066 "zh-TW": "在清單方塊中搜尋"
1067 }
1068 };
1069 var Listbox_Unlock = {
1070 id: "Listbox.Unlock",
1071 locale: {
1072 "de-DE": "Auswahlen entsperren",
1073 "en-US": "Unlock selections",
1074 "es-ES": "Desbloquear selecciones",
1075 "fr-FR": "Déverrouiller les sélections",
1076 "it-IT": "Sblocca selezioni",
1077 "ja-JP": "選択をロック解除",
1078 "ko-KR": "선택 내용 잠금 해제",
1079 "nl-NL": "Selecties ontgrendelen",
1080 "pl-PL": "Odblokuj wybory",
1081 "pt-BR": "Desbloquear seleções",
1082 "ru-RU": "Разблокировать выборки",
1083 "sv-SE": "Lås upp urval",
1084 "tr-TR": "Seçimlerin kilidini aç",
1085 "zh-CN": "将选择项解锁",
1086 "zh-TW": "解鎖選項"
1087 }
1088 };
1089 var Menu_More = {
1090 id: "Menu.More",
1091 locale: {
1092 "de-DE": "Mehr",
1093 "en-US": "More",
1094 "es-ES": "Más",
1095 "fr-FR": "Plus",
1096 "it-IT": "Altro",
1097 "ja-JP": "詳細",
1098 "ko-KR": "자세히",
1099 "nl-NL": "Meer",
1100 "pl-PL": "Więcej",
1101 "pt-BR": "Mais",
1102 "ru-RU": "Дополнительно",
1103 "sv-SE": "Mer",
1104 "tr-TR": "Daha fazla",
1105 "zh-CN": "更多",
1106 "zh-TW": "更多"
1107 }
1108 };
1109 var Navigate_Back = {
1110 id: "Navigate.Back",
1111 locale: {
1112 "de-DE": "Schritt zurück",
1113 "en-US": "Step back",
1114 "es-ES": "Atrás",
1115 "fr-FR": "Retour en arrière",
1116 "it-IT": "Torna indietro",
1117 "ja-JP": "1 段階戻る",
1118 "ko-KR": "이전 단계",
1119 "nl-NL": "Stap terug",
1120 "pl-PL": "Krok do tyłu",
1121 "pt-BR": "Voltar uma etapa",
1122 "ru-RU": "Шаг назад",
1123 "sv-SE": "Gå bakåt",
1124 "tr-TR": "Bir adım geri",
1125 "zh-CN": "后退",
1126 "zh-TW": "倒退"
1127 }
1128 };
1129 var Navigate_Forward = {
1130 id: "Navigate.Forward",
1131 locale: {
1132 "de-DE": "Schritt vor",
1133 "en-US": "Step forward",
1134 "es-ES": "Avanzar",
1135 "fr-FR": "Étape suivante",
1136 "it-IT": "Vai avanti",
1137 "ja-JP": "1段階進む",
1138 "ko-KR": "다음 단계",
1139 "nl-NL": "Stap vooruit",
1140 "pl-PL": "Krok do przodu",
1141 "pt-BR": "Avançar uma etapa",
1142 "ru-RU": "Шаг вперед",
1143 "sv-SE": "Gå framåt",
1144 "tr-TR": "Bir adım ileri",
1145 "zh-CN": "前进",
1146 "zh-TW": "前進"
1147 }
1148 };
1149 var OK = {
1150 id: "OK",
1151 locale: {
1152 "de-DE": "OK",
1153 "en-US": "OK",
1154 "es-ES": "Aceptar",
1155 "fr-FR": "OK",
1156 "it-IT": "OK",
1157 "ja-JP": "OK",
1158 "ko-KR": "확인",
1159 "nl-NL": "OK",
1160 "pl-PL": "OK",
1161 "pt-BR": "OK",
1162 "ru-RU": "ОК",
1163 "sv-SE": "OK",
1164 "tr-TR": "Tamam",
1165 "zh-CN": "确定",
1166 "zh-TW": "確定"
1167 }
1168 };
1169 var Object_Update_Active = {
1170 id: "Object.Update.Active",
1171 locale: {
1172 "de-DE": "Laden von Daten",
1173 "en-US": "Updating data",
1174 "es-ES": "Cargando datos",
1175 "fr-FR": "Chargement de données en cours",
1176 "it-IT": "Caricamento dati in corso",
1177 "ja-JP": "データのロード中",
1178 "ko-KR": "데이터 로드 중",
1179 "nl-NL": "Gegevens worden geladen",
1180 "pl-PL": "Ładowanie danych",
1181 "pt-BR": "Carregando dados",
1182 "ru-RU": "Загрузка данных",
1183 "sv-SE": "Laddar data",
1184 "tr-TR": "Veriler yükleniyor",
1185 "zh-CN": "加载数据",
1186 "zh-TW": "正在載入資料"
1187 }
1188 };
1189 var Object_Update_Cancelled = {
1190 id: "Object.Update.Cancelled",
1191 locale: {
1192 "de-DE": "Datenaktualisierung wurde abgebrochen",
1193 "en-US": "Data update was cancelled",
1194 "es-ES": "Se ha cancelado la actualización de datos",
1195 "fr-FR": "Mise à jour des données annulée",
1196 "it-IT": "Aggiornamento dati annullato",
1197 "ja-JP": "データの更新がキャンセルされました",
1198 "ko-KR": "데이터 업데이트가 취소되었습니다.",
1199 "nl-NL": "Gegevensupdate is geannuleerd",
1200 "pl-PL": "Aktualizacja danych została anulowana",
1201 "pt-BR": "A atualização de dados foi cancelada",
1202 "ru-RU": "Обновление данных отменено",
1203 "sv-SE": "Datauppdateringen avbröts.",
1204 "tr-TR": "Veri güncelleştirme iptal edildi",
1205 "zh-CN": "数据更新已取消",
1206 "zh-TW": "資料更新已取消"
1207 }
1208 };
1209 var Retry$1 = {
1210 id: "Retry",
1211 locale: {
1212 "de-DE": "Wiederholen",
1213 "en-US": "Retry",
1214 "es-ES": "Intentar de nuevo",
1215 "fr-FR": "Réessayer",
1216 "it-IT": "Riprova",
1217 "ja-JP": "再試行",
1218 "ko-KR": "다시 시도",
1219 "nl-NL": "Opnieuw",
1220 "pl-PL": "Ponów próbę",
1221 "pt-BR": "Tentar novamente",
1222 "ru-RU": "Повторить попытку",
1223 "sv-SE": "Försök igen",
1224 "tr-TR": "Yeniden dene",
1225 "zh-CN": "重试",
1226 "zh-TW": "重試"
1227 }
1228 };
1229 var Selection_Cancel = {
1230 id: "Selection.Cancel",
1231 locale: {
1232 "de-DE": "Auswahl abbrechen",
1233 "en-US": "Cancel selection",
1234 "es-ES": "Cancelar selección",
1235 "fr-FR": "Annuler la sélection",
1236 "it-IT": "Annulla selezione",
1237 "ja-JP": "選択のキャンセル",
1238 "ko-KR": "선택 취소",
1239 "nl-NL": "Selectie annuleren",
1240 "pl-PL": "Anuluj selekcję",
1241 "pt-BR": "Cancelar seleção",
1242 "ru-RU": "Отменить выборку",
1243 "sv-SE": "Avbryt urval",
1244 "tr-TR": "Seçimi iptal et",
1245 "zh-CN": "取消选择",
1246 "zh-TW": "取消選取"
1247 }
1248 };
1249 var Selection_Clear = {
1250 id: "Selection.Clear",
1251 locale: {
1252 "de-DE": "Auswahl löschen",
1253 "en-US": "Clear selection",
1254 "es-ES": "Borrar selección",
1255 "fr-FR": "Effacer la sélection",
1256 "it-IT": "Cancella selezione",
1257 "ja-JP": "選択をクリア",
1258 "ko-KR": "선택 해제",
1259 "nl-NL": "Selectie wissen",
1260 "pl-PL": "Wyczyść selekcję",
1261 "pt-BR": "Limpar seleção",
1262 "ru-RU": "Очистить выбор",
1263 "sv-SE": "Rensa urval",
1264 "tr-TR": "Seçimi temizle",
1265 "zh-CN": "清除选择",
1266 "zh-TW": "清除選項"
1267 }
1268 };
1269 var Selection_ClearAll = {
1270 id: "Selection.ClearAll",
1271 locale: {
1272 "de-DE": "Alle Auswahlen löschen",
1273 "en-US": "Clear all selections",
1274 "es-ES": "Borrar todas las selecciones",
1275 "fr-FR": "Effacer toutes les sélections",
1276 "it-IT": "Cancella tutte le selezioni",
1277 "ja-JP": "選択をすべてクリアする",
1278 "ko-KR": "모든 선택 해제",
1279 "nl-NL": "Alle selecties wissen",
1280 "pl-PL": "Wyczyść wszystkie selekcje",
1281 "pt-BR": "Limpar todas as seleções",
1282 "ru-RU": "Очистить от всех выборок",
1283 "sv-SE": "Radera alla urval",
1284 "tr-TR": "Tüm seçimleri temizle",
1285 "zh-CN": "清除所有选择项",
1286 "zh-TW": "清除所有選項"
1287 }
1288 };
1289 var Selection_ClearAllStates = {
1290 id: "Selection.ClearAllStates",
1291 locale: {
1292 "de-DE": "Alle Status löschen",
1293 "en-US": "Clear all states",
1294 "es-ES": "Borrar todos los estados",
1295 "fr-FR": "Effacer tous les états",
1296 "it-IT": "Cancella tutti gli stati",
1297 "ja-JP": "全ステートをクリア",
1298 "ko-KR": "모든 상태 지우기",
1299 "nl-NL": "Alle states wissen",
1300 "pl-PL": "Wyczyść wszystkie stany",
1301 "pt-BR": "Limpar todos os estados",
1302 "ru-RU": "Очистить все состояния",
1303 "sv-SE": "Rensa alla tillstånd",
1304 "tr-TR": "Tüm durumları temizle",
1305 "zh-CN": "清除所有状态",
1306 "zh-TW": "清除所有狀態"
1307 }
1308 };
1309 var Selection_Confirm = {
1310 id: "Selection.Confirm",
1311 locale: {
1312 "de-DE": "Auswahl bestätigen",
1313 "en-US": "Confirm selection",
1314 "es-ES": "Confirmar selección",
1315 "fr-FR": "Confirmer la sélection",
1316 "it-IT": "Conferma selezione",
1317 "ja-JP": "選択の確認",
1318 "ko-KR": "선택 확인",
1319 "nl-NL": "Selectie bevestigen",
1320 "pl-PL": "Potwierdź selekcję",
1321 "pt-BR": "Confirmar seleção",
1322 "ru-RU": "Подтвердить выборку",
1323 "sv-SE": "Bekräfta urval",
1324 "tr-TR": "Seçimi onayla",
1325 "zh-CN": "确认选择",
1326 "zh-TW": "確認選取"
1327 }
1328 };
1329 var Selection_Menu = {
1330 id: "Selection.Menu",
1331 locale: {
1332 "de-DE": "Auswahlmenü",
1333 "en-US": "Selection menu",
1334 "es-ES": "Menú de selección",
1335 "fr-FR": "Menu Sélection",
1336 "it-IT": "Menu Selezione",
1337 "ja-JP": "選択メニュー",
1338 "ko-KR": "선택 메뉴",
1339 "nl-NL": "Selectiemenu",
1340 "pl-PL": "Menu selekcji",
1341 "pt-BR": "Menu de seleção",
1342 "ru-RU": "Меню \"Выборка\"",
1343 "sv-SE": "Urvalsmeny",
1344 "tr-TR": "Seçim menüsü",
1345 "zh-CN": "选择菜单",
1346 "zh-TW": "選項功能表"
1347 }
1348 };
1349 var Selection_SelectAll = {
1350 id: "Selection.SelectAll",
1351 locale: {
1352 "de-DE": "Alle auswählen",
1353 "en-US": "Select all",
1354 "es-ES": "Seleccionar todo",
1355 "fr-FR": "Sélectionner tout",
1356 "it-IT": "Seleziona tutto",
1357 "ja-JP": "すべて選択",
1358 "ko-KR": "모두 선택",
1359 "nl-NL": "Alles selecteren",
1360 "pl-PL": "Wybierz wszystko",
1361 "pt-BR": "Selecionar todos",
1362 "ru-RU": "Выбрать все",
1363 "sv-SE": "Välj alla",
1364 "tr-TR": "Tümünü seç",
1365 "zh-CN": "全选",
1366 "zh-TW": "全選"
1367 }
1368 };
1369 var Selection_SelectAlternative = {
1370 id: "Selection.SelectAlternative",
1371 locale: {
1372 "de-DE": "Alternative Werte auswählen",
1373 "en-US": "Select alternative",
1374 "es-ES": "Seleccionar alternativos",
1375 "fr-FR": "Sélectionner des valeurs alternatives",
1376 "it-IT": "Seleziona alternativi",
1377 "ja-JP": "代替値を選択",
1378 "ko-KR": "대안 선택",
1379 "nl-NL": "Alternatief selecteren",
1380 "pl-PL": "Wybierz alternatywę",
1381 "pt-BR": "Selecionar alternativa",
1382 "ru-RU": "Выбрать альтернативные",
1383 "sv-SE": "Välj alternativ",
1384 "tr-TR": "Alternatifi seç",
1385 "zh-CN": "选择替代项",
1386 "zh-TW": "選取替代選項"
1387 }
1388 };
1389 var Selection_SelectExcluded = {
1390 id: "Selection.SelectExcluded",
1391 locale: {
1392 "de-DE": "Ausgeschlossene Werte auswählen",
1393 "en-US": "Select excluded",
1394 "es-ES": "Seleccionar excluidos",
1395 "fr-FR": "Sélectionner les valeurs exclues",
1396 "it-IT": "Seleziona esclusi",
1397 "ja-JP": "除外値を選択",
1398 "ko-KR": "제외 항목 선택",
1399 "nl-NL": "Uitgesloten waarden selecteren",
1400 "pl-PL": "Wybierz wykluczone",
1401 "pt-BR": "Selecionar excluído",
1402 "ru-RU": "Выбрать исключенные",
1403 "sv-SE": "Välj uteslutna",
1404 "tr-TR": "Hariç tutulanı seç",
1405 "zh-CN": "选择排除项",
1406 "zh-TW": "選取排除值"
1407 }
1408 };
1409 var Selection_SelectPossible = {
1410 id: "Selection.SelectPossible",
1411 locale: {
1412 "de-DE": "Wählbare Werte auswählen",
1413 "en-US": "Select possible",
1414 "es-ES": "Seleccionar posibles",
1415 "fr-FR": "Sélectionner les valeurs possibles",
1416 "it-IT": "Seleziona possibili",
1417 "ja-JP": "絞込値を選択",
1418 "ko-KR": "사용 가능 항목 선택",
1419 "nl-NL": "Mogelijke waarden selecteren",
1420 "pl-PL": "Wybierz możliwe",
1421 "pt-BR": "Selecionar possível",
1422 "ru-RU": "Выбрать возможные",
1423 "sv-SE": "Välj möjliga",
1424 "tr-TR": "Olasıyı seç",
1425 "zh-CN": "选择可能值",
1426 "zh-TW": "選取可能值"
1427 }
1428 };
1429 var Visualization_Incomplete = {
1430 id: "Visualization.Incomplete",
1431 locale: {
1432 "de-DE": "Unvollständige Visualisierung",
1433 "en-US": "Incomplete visualization",
1434 "es-ES": "Visualización incompleta",
1435 "fr-FR": "Visualisation incomplète",
1436 "it-IT": "Visualizzazione incompleta",
1437 "ja-JP": "未完了のビジュアライゼーション",
1438 "ko-KR": "완료되지 않은 시각화",
1439 "nl-NL": "Onvolledige visualisatie",
1440 "pl-PL": "Niekompletna wizualizacja",
1441 "pt-BR": "Visualização incompleta",
1442 "ru-RU": "Незавершенная визуализация",
1443 "sv-SE": "Ofullständig visualisering",
1444 "tr-TR": "Tamamlanmamış görselleştirme",
1445 "zh-CN": "不完整的可视化",
1446 "zh-TW": "視覺化未完成"
1447 }
1448 };
1449 var Visualization_Incomplete_Dimensions = {
1450 id: "Visualization.Incomplete.Dimensions",
1451 locale: {
1452 "de-DE": "{0} von {1} Dimensionen",
1453 "en-US": "{0} of {1} dimensions",
1454 "es-ES": "{0} de {1} dimensiones",
1455 "fr-FR": "{0} dimensions sur {1}",
1456 "it-IT": "{0} di {1} dimensioni",
1457 "ja-JP": "{0} / {1} 軸",
1458 "ko-KR": "{1} 차원의 {0}",
1459 "nl-NL": "{0} van {1} dimensies",
1460 "pl-PL": "{0} z {1} wymiarów",
1461 "pt-BR": "{0} de {1} dimensões",
1462 "ru-RU": "Измерения: {0} из {1}",
1463 "sv-SE": "{0} av {1} dimensioner",
1464 "tr-TR": "{0}/{1} boyut",
1465 "zh-CN": "{0} / {1} 个维度",
1466 "zh-TW": "{1} 個維度中的 {0} 個"
1467 }
1468 };
1469 var Visualization_Incomplete_Measures = {
1470 id: "Visualization.Incomplete.Measures",
1471 locale: {
1472 "de-DE": "{0} von {1} Kennzahlen",
1473 "en-US": "{0} of {1} measures",
1474 "es-ES": "{0} de {1} medidas",
1475 "fr-FR": "{0} mesures sur {1}",
1476 "it-IT": "{0} di {1} misure",
1477 "ja-JP": "{0} / {1} メジャー",
1478 "ko-KR": "{1} 측정값의 {0}",
1479 "nl-NL": "{0} van {1} metingen",
1480 "pl-PL": "{0} z {1} miar",
1481 "pt-BR": "{0} de {1} medidas",
1482 "ru-RU": "Меры: {0} из {1}",
1483 "sv-SE": "{0} av {1} mått",
1484 "tr-TR": "{0}/{1} hesaplama",
1485 "zh-CN": "{0} / {1} 个度量",
1486 "zh-TW": "{1} 個量值中的 {0} 個"
1487 }
1488 };
1489 var Visualization_Invalid_Dimension = {
1490 id: "Visualization.Invalid.Dimension",
1491 locale: {
1492 "de-DE": "Ungültige Dimension",
1493 "en-US": "Invalid dimension",
1494 "es-ES": "Dimensión no válida",
1495 "fr-FR": "Dimension non valide",
1496 "it-IT": "Dimensione non valida",
1497 "ja-JP": "無効な軸です",
1498 "ko-KR": "잘못된 차원",
1499 "nl-NL": "Ongeldige dimensie",
1500 "pl-PL": "Nieprawidłowy wymiar",
1501 "pt-BR": "Dimensão inválida",
1502 "ru-RU": "Недопустимое измерение",
1503 "sv-SE": "Ogiltig dimension",
1504 "tr-TR": "Geçersiz boyut",
1505 "zh-CN": "无效维度",
1506 "zh-TW": "維度無效"
1507 }
1508 };
1509 var Visualization_Invalid_Measure = {
1510 id: "Visualization.Invalid.Measure",
1511 locale: {
1512 "de-DE": "Ungültige Kennzahl",
1513 "en-US": "Invalid measure",
1514 "es-ES": "Medida no válida",
1515 "fr-FR": "Mesure non valide",
1516 "it-IT": "Misura non valida",
1517 "ja-JP": "無効なメジャーです",
1518 "ko-KR": "잘못된 측정값",
1519 "nl-NL": "Ongeldige meting",
1520 "pl-PL": "Nieprawidłowa miara",
1521 "pt-BR": "Medida inválida",
1522 "ru-RU": "Недопустимая мера",
1523 "sv-SE": "Ogiltigt mått",
1524 "tr-TR": "Geçersiz hesaplama",
1525 "zh-CN": "无效度量项",
1526 "zh-TW": "量值無效"
1527 }
1528 };
1529 var Visualization_LayoutError = {
1530 id: "Visualization.LayoutError",
1531 locale: {
1532 "de-DE": "Fehler",
1533 "en-US": "Error",
1534 "es-ES": "Error",
1535 "fr-FR": "Erreur",
1536 "it-IT": "Errore",
1537 "ja-JP": "エラー",
1538 "ko-KR": "오류",
1539 "nl-NL": "Fout",
1540 "pl-PL": "Błąd",
1541 "pt-BR": "Erro",
1542 "ru-RU": "Ошибка",
1543 "sv-SE": "Fel",
1544 "tr-TR": "Hata",
1545 "zh-CN": "错误",
1546 "zh-TW": "錯誤"
1547 }
1548 };
1549 var Visualization_UnfulfilledCalculationCondition = {
1550 id: "Visualization.UnfulfilledCalculationCondition",
1551 locale: {
1552 "de-DE": "Die Berechnungsbedingung ist nicht erfüllt",
1553 "en-US": "The calculation condition is not fulfilled",
1554 "es-ES": "La condición de cálculo no se cumple",
1555 "fr-FR": "Condition de calcul non remplie",
1556 "it-IT": "La condizione di calcolo non è soddisfatta",
1557 "ja-JP": "演算実行条件が満たされていません",
1558 "ko-KR": "계산 조건이 충족되지 않았습니다.",
1559 "nl-NL": "Er is niet aan de berekeningsvoorwaarde voldaan",
1560 "pl-PL": "Warunek obliczenia nie jest spełniony",
1561 "pt-BR": "A condição de cálculo não foi atendida",
1562 "ru-RU": "Условие вычисления не выполнено",
1563 "sv-SE": "Beräkningsvillkoret uppfylls inte",
1564 "tr-TR": "Hesaplama koşulu yerine getirilmedi",
1565 "zh-CN": "不满足计算条件",
1566 "zh-TW": "不符計算條件"
1567 }
1568 };
1569 var all = {
1570 Cancel: Cancel$1,
1571 CurrentSelections_All: CurrentSelections_All,
1572 CurrentSelections_Of: CurrentSelections_Of,
1573 Listbox_Lock: Listbox_Lock,
1574 Listbox_Search: Listbox_Search,
1575 Listbox_Unlock: Listbox_Unlock,
1576 Menu_More: Menu_More,
1577 Navigate_Back: Navigate_Back,
1578 Navigate_Forward: Navigate_Forward,
1579 OK: OK,
1580 Object_Update_Active: Object_Update_Active,
1581 Object_Update_Cancelled: Object_Update_Cancelled,
1582 Retry: Retry$1,
1583 Selection_Cancel: Selection_Cancel,
1584 Selection_Clear: Selection_Clear,
1585 Selection_ClearAll: Selection_ClearAll,
1586 Selection_ClearAllStates: Selection_ClearAllStates,
1587 Selection_Confirm: Selection_Confirm,
1588 Selection_Menu: Selection_Menu,
1589 Selection_SelectAll: Selection_SelectAll,
1590 Selection_SelectAlternative: Selection_SelectAlternative,
1591 Selection_SelectExcluded: Selection_SelectExcluded,
1592 Selection_SelectPossible: Selection_SelectPossible,
1593 Visualization_Incomplete: Visualization_Incomplete,
1594 Visualization_Incomplete_Dimensions: Visualization_Incomplete_Dimensions,
1595 Visualization_Incomplete_Measures: Visualization_Incomplete_Measures,
1596 Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
1597 Visualization_Invalid_Measure: Visualization_Invalid_Measure,
1598 Visualization_LayoutError: Visualization_LayoutError,
1599 Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
1600 };
1601
1602 function appLocaleFn(language) {
1603 const l = locale({
1604 initial: language
1605 });
1606 Object.keys(all).forEach(key => {
1607 l.translator.add(all[key]);
1608 });
1609 return {
1610 translator: l.translator
1611 };
1612 }
1613
1614 /**
1615 * Utility functions
1616 */
1617
1618 var util = {};
1619
1620 util.isObject = function isObject(arg) {
1621 return typeof arg === 'object' && arg !== null;
1622 };
1623
1624 util.isNumber = function isNumber(arg) {
1625 return typeof arg === 'number';
1626 };
1627
1628 util.isUndefined = function isUndefined(arg) {
1629 return arg === void 0;
1630 };
1631
1632 util.isFunction = function isFunction(arg){
1633 return typeof arg === 'function';
1634 };
1635
1636
1637 /**
1638 * EventEmitter class
1639 */
1640
1641 function EventEmitter() {
1642 EventEmitter.init.call(this);
1643 }
1644 var nodeEventEmitter = EventEmitter;
1645
1646 // Backwards-compat with node 0.10.x
1647 EventEmitter.EventEmitter = EventEmitter;
1648
1649 EventEmitter.prototype._events = undefined;
1650 EventEmitter.prototype._maxListeners = undefined;
1651
1652 // By default EventEmitters will print a warning if more than 10 listeners are
1653 // added to it. This is a useful default which helps finding memory leaks.
1654 EventEmitter.defaultMaxListeners = 10;
1655
1656 EventEmitter.init = function() {
1657 this._events = this._events || {};
1658 this._maxListeners = this._maxListeners || undefined;
1659 };
1660
1661 // Obviously not all Emitters should be limited to 10. This function allows
1662 // that to be increased. Set to zero for unlimited.
1663 EventEmitter.prototype.setMaxListeners = function(n) {
1664 if (!util.isNumber(n) || n < 0 || isNaN(n))
1665 throw TypeError('n must be a positive number');
1666 this._maxListeners = n;
1667 return this;
1668 };
1669
1670 EventEmitter.prototype.emit = function(type) {
1671 var er, handler, len, args, i, listeners;
1672
1673 if (!this._events)
1674 this._events = {};
1675
1676 // If there is no 'error' event listener then throw.
1677 if (type === 'error' && !this._events.error) {
1678 er = arguments[1];
1679 if (er instanceof Error) {
1680 throw er; // Unhandled 'error' event
1681 } else {
1682 throw Error('Uncaught, unspecified "error" event.');
1683 }
1684 }
1685
1686 handler = this._events[type];
1687
1688 if (util.isUndefined(handler))
1689 return false;
1690
1691 if (util.isFunction(handler)) {
1692 switch (arguments.length) {
1693 // fast cases
1694 case 1:
1695 handler.call(this);
1696 break;
1697 case 2:
1698 handler.call(this, arguments[1]);
1699 break;
1700 case 3:
1701 handler.call(this, arguments[1], arguments[2]);
1702 break;
1703 // slower
1704 default:
1705 len = arguments.length;
1706 args = new Array(len - 1);
1707 for (i = 1; i < len; i++)
1708 args[i - 1] = arguments[i];
1709 handler.apply(this, args);
1710 }
1711 } else if (util.isObject(handler)) {
1712 len = arguments.length;
1713 args = new Array(len - 1);
1714 for (i = 1; i < len; i++)
1715 args[i - 1] = arguments[i];
1716
1717 listeners = handler.slice();
1718 len = listeners.length;
1719 for (i = 0; i < len; i++)
1720 listeners[i].apply(this, args);
1721 }
1722
1723 return true;
1724 };
1725
1726 EventEmitter.prototype.addListener = function(type, listener) {
1727 var m;
1728
1729 if (!util.isFunction(listener))
1730 throw TypeError('listener must be a function');
1731
1732 if (!this._events)
1733 this._events = {};
1734
1735 // To avoid recursion in the case that type === "newListener"! Before
1736 // adding it to the listeners, first emit "newListener".
1737 if (this._events.newListener)
1738 this.emit('newListener', type,
1739 util.isFunction(listener.listener) ?
1740 listener.listener : listener);
1741
1742 if (!this._events[type])
1743 // Optimize the case of one listener. Don't need the extra array object.
1744 this._events[type] = listener;
1745 else if (util.isObject(this._events[type]))
1746 // If we've already got an array, just append.
1747 this._events[type].push(listener);
1748 else
1749 // Adding the second element, need to change to array.
1750 this._events[type] = [this._events[type], listener];
1751
1752 // Check for listener leak
1753 if (util.isObject(this._events[type]) && !this._events[type].warned) {
1754 var m;
1755 if (!util.isUndefined(this._maxListeners)) {
1756 m = this._maxListeners;
1757 } else {
1758 m = EventEmitter.defaultMaxListeners;
1759 }
1760
1761 if (m && m > 0 && this._events[type].length > m) {
1762 this._events[type].warned = true;
1763
1764 if (util.isFunction(console.error)) {
1765 console.error('(node) warning: possible EventEmitter memory ' +
1766 'leak detected. %d listeners added. ' +
1767 'Use emitter.setMaxListeners() to increase limit.',
1768 this._events[type].length);
1769 }
1770 if (util.isFunction(console.trace))
1771 console.trace();
1772 }
1773 }
1774
1775 return this;
1776 };
1777
1778 EventEmitter.prototype.on = EventEmitter.prototype.addListener;
1779
1780 EventEmitter.prototype.once = function(type, listener) {
1781 if (!util.isFunction(listener))
1782 throw TypeError('listener must be a function');
1783
1784 var fired = false;
1785
1786 function g() {
1787 this.removeListener(type, g);
1788
1789 if (!fired) {
1790 fired = true;
1791 listener.apply(this, arguments);
1792 }
1793 }
1794
1795 g.listener = listener;
1796 this.on(type, g);
1797
1798 return this;
1799 };
1800
1801 // emits a 'removeListener' event iff the listener was removed
1802 EventEmitter.prototype.removeListener = function(type, listener) {
1803 var list, position, length, i;
1804
1805 if (!util.isFunction(listener))
1806 throw TypeError('listener must be a function');
1807
1808 if (!this._events || !this._events[type])
1809 return this;
1810
1811 list = this._events[type];
1812 length = list.length;
1813 position = -1;
1814
1815 if (list === listener ||
1816 (util.isFunction(list.listener) && list.listener === listener)) {
1817 delete this._events[type];
1818 if (this._events.removeListener)
1819 this.emit('removeListener', type, listener);
1820
1821 } else if (util.isObject(list)) {
1822 for (i = length; i-- > 0;) {
1823 if (list[i] === listener ||
1824 (list[i].listener && list[i].listener === listener)) {
1825 position = i;
1826 break;
1827 }
1828 }
1829
1830 if (position < 0)
1831 return this;
1832
1833 if (list.length === 1) {
1834 list.length = 0;
1835 delete this._events[type];
1836 } else {
1837 list.splice(position, 1);
1838 }
1839
1840 if (this._events.removeListener)
1841 this.emit('removeListener', type, listener);
1842 }
1843
1844 return this;
1845 };
1846
1847 EventEmitter.prototype.removeAllListeners = function(type) {
1848 var key, listeners;
1849
1850 if (!this._events)
1851 return this;
1852
1853 // not listening for removeListener, no need to emit
1854 if (!this._events.removeListener) {
1855 if (arguments.length === 0)
1856 this._events = {};
1857 else if (this._events[type])
1858 delete this._events[type];
1859 return this;
1860 }
1861
1862 // emit removeListener for all listeners on all events
1863 if (arguments.length === 0) {
1864 for (key in this._events) {
1865 if (key === 'removeListener') continue;
1866 this.removeAllListeners(key);
1867 }
1868 this.removeAllListeners('removeListener');
1869 this._events = {};
1870 return this;
1871 }
1872
1873 listeners = this._events[type];
1874
1875 if (util.isFunction(listeners)) {
1876 this.removeListener(type, listeners);
1877 } else if (Array.isArray(listeners)) {
1878 // LIFO order
1879 while (listeners.length)
1880 this.removeListener(type, listeners[listeners.length - 1]);
1881 }
1882 delete this._events[type];
1883
1884 return this;
1885 };
1886
1887 EventEmitter.prototype.listeners = function(type) {
1888 var ret;
1889 if (!this._events || !this._events[type])
1890 ret = [];
1891 else if (util.isFunction(this._events[type]))
1892 ret = [this._events[type]];
1893 else
1894 ret = this._events[type].slice();
1895 return ret;
1896 };
1897
1898 EventEmitter.listenerCount = function(emitter, type) {
1899 var ret;
1900 if (!emitter._events || !emitter._events[type])
1901 ret = 0;
1902 else if (util.isFunction(emitter._events[type]))
1903 ret = 1;
1904 else
1905 ret = emitter._events[type].length;
1906 return ret;
1907 };
1908
1909 var hasOwn = Object.prototype.hasOwnProperty;
1910 var toStr = Object.prototype.toString;
1911 var defineProperty$2 = Object.defineProperty;
1912 var gOPD = Object.getOwnPropertyDescriptor;
1913
1914 var isArray$1 = function isArray(arr) {
1915 if (typeof Array.isArray === 'function') {
1916 return Array.isArray(arr);
1917 }
1918
1919 return toStr.call(arr) === '[object Array]';
1920 };
1921
1922 var isPlainObject$1 = function isPlainObject(obj) {
1923 if (!obj || toStr.call(obj) !== '[object Object]') {
1924 return false;
1925 }
1926
1927 var hasOwnConstructor = hasOwn.call(obj, 'constructor');
1928 var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
1929 // Not own constructor property must be Object
1930 if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
1931 return false;
1932 }
1933
1934 // Own properties are enumerated firstly, so to speed up,
1935 // if last one is own, then all properties are own.
1936 var key;
1937 for (key in obj) { /**/ }
1938
1939 return typeof key === 'undefined' || hasOwn.call(obj, key);
1940 };
1941
1942 // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
1943 var setProperty$1 = function setProperty(target, options) {
1944 if (defineProperty$2 && options.name === '__proto__') {
1945 defineProperty$2(target, options.name, {
1946 enumerable: true,
1947 configurable: true,
1948 value: options.newValue,
1949 writable: true
1950 });
1951 } else {
1952 target[options.name] = options.newValue;
1953 }
1954 };
1955
1956 // Return undefined instead of __proto__ if '__proto__' is not an own property
1957 var getProperty = function getProperty(obj, name) {
1958 if (name === '__proto__') {
1959 if (!hasOwn.call(obj, name)) {
1960 return void 0;
1961 } else if (gOPD) {
1962 // In early versions of node, obj['__proto__'] is buggy when obj has
1963 // __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
1964 return gOPD(obj, name).value;
1965 }
1966 }
1967
1968 return obj[name];
1969 };
1970
1971 var extend$2 = function extend() {
1972 var options, name, src, copy, copyIsArray, clone;
1973 var target = arguments[0];
1974 var i = 1;
1975 var length = arguments.length;
1976 var deep = false;
1977
1978 // Handle a deep copy situation
1979 if (typeof target === 'boolean') {
1980 deep = target;
1981 target = arguments[1] || {};
1982 // skip the boolean and the target
1983 i = 2;
1984 }
1985 if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
1986 target = {};
1987 }
1988
1989 for (; i < length; ++i) {
1990 options = arguments[i];
1991 // Only deal with non-null/undefined values
1992 if (options != null) {
1993 // Extend the base object
1994 for (name in options) {
1995 src = getProperty(target, name);
1996 copy = getProperty(options, name);
1997
1998 // Prevent never-ending loop
1999 if (target !== copy) {
2000 // Recurse if we're merging plain objects or arrays
2001 if (deep && copy && (isPlainObject$1(copy) || (copyIsArray = isArray$1(copy)))) {
2002 if (copyIsArray) {
2003 copyIsArray = false;
2004 clone = src && isArray$1(src) ? src : [];
2005 } else {
2006 clone = src && isPlainObject$1(src) ? src : {};
2007 }
2008
2009 // Never move original objects, clone them
2010 setProperty$1(target, { name: name, newValue: extend(deep, clone, copy) });
2011
2012 // Don't bring in undefined values
2013 } else if (typeof copy !== 'undefined') {
2014 setProperty$1(target, { name: name, newValue: copy });
2015 }
2016 }
2017 }
2018 }
2019 }
2020
2021 // Return the modified object
2022 return target;
2023 };
2024
2025 var fontSize$1 = "13px";
2026 var fontFamily$1 = "'Source Sans Pro', 'Arial', 'sans-serif'";
2027 var backgroundColor = "transparent";
2028 var dataColors = {
2029 primaryColor: "#26a0a7",
2030 othersColor: "#a5a5a5",
2031 errorColor: "#ff4444",
2032 nullColor: "#d2d2d2"
2033 };
2034 var scales = [
2035 {
2036 name: "Sequential Gradient",
2037 translation: "properties.colorScheme.sequential",
2038 type: "gradient",
2039 propertyValue: "sg",
2040 scale: [
2041 "#26a0a7",
2042 "#c7ea8b"
2043 ]
2044 },
2045 {
2046 name: "Sequential Classes",
2047 translation: "properties.colorScheme.sequentialC",
2048 propertyValue: "sc",
2049 type: "class",
2050 scale: [
2051 "#26a0a7",
2052 "#c7ea8b"
2053 ]
2054 },
2055 {
2056 name: "Diverging gradient",
2057 translation: "properties.colorScheme.diverging",
2058 propertyValue: "dg",
2059 type: "gradient",
2060 scale: [
2061 "#26a0a7",
2062 "#c3ea8c",
2063 "#ec983d"
2064 ]
2065 },
2066 {
2067 name: "Diverging Classes",
2068 translation: "properties.colorScheme.divergingC",
2069 propertyValue: "dc",
2070 type: "class",
2071 scale: [
2072 "#26a0a7",
2073 "#c3ea8c",
2074 "#ec983d"
2075 ]
2076 }
2077 ];
2078 var palettes = {
2079 data: [
2080 {
2081 name: "12 Colors",
2082 translation: "properties.colorNumberOfColors.12",
2083 propertyValue: "12",
2084 type: "pyramid",
2085 scale: [
2086 [
2087 "#26A0A7"
2088 ],
2089 [
2090 "#26A0A7",
2091 "#EC983D"
2092 ],
2093 [
2094 "#26A0A7",
2095 "#CBE989",
2096 "#EC983D"
2097 ],
2098 [
2099 "#26A0A7",
2100 "#79D69F",
2101 "#F9EC86",
2102 "#EC983D"
2103 ],
2104 [
2105 "#26A0A7",
2106 "#79D69F",
2107 "#CBE989",
2108 "#F9EC86",
2109 "#EC983D"
2110 ],
2111 [
2112 "#26A0A7",
2113 "#65D3DA",
2114 "#79D69F",
2115 "#CBE989",
2116 "#F9EC86",
2117 "#EC983D"
2118 ],
2119 [
2120 "#26A0A7",
2121 "#65D3DA",
2122 "#79D69F",
2123 "#CBE989",
2124 "#F9EC86",
2125 "#EC983D",
2126 "#D76C6C"
2127 ],
2128 [
2129 "#26A0A7",
2130 "#65D3DA",
2131 "#79D69F",
2132 "#CBE989",
2133 "#F9EC86",
2134 "#FAD144",
2135 "#EC983D",
2136 "#D76C6C"
2137 ],
2138 [
2139 "#138185",
2140 "#26A0A7",
2141 "#65D3DA",
2142 "#79D69F",
2143 "#CBE989",
2144 "#F9EC86",
2145 "#FAD144",
2146 "#EC983D",
2147 "#D76C6C"
2148 ],
2149 [
2150 "#138185",
2151 "#26A0A7",
2152 "#65D3DA",
2153 "#79D69F",
2154 "#CBE989",
2155 "#EBF898",
2156 "#F9EC86",
2157 "#FAD144",
2158 "#EC983D",
2159 "#D76C6C"
2160 ],
2161 [
2162 "#138185",
2163 "#26A0A7",
2164 "#65D3DA",
2165 "#79D69F",
2166 "#CBE989",
2167 "#EBF898",
2168 "#F9EC86",
2169 "#FAD144",
2170 "#EC983D",
2171 "#D76C6C",
2172 "#A54343"
2173 ],
2174 [
2175 "#138185",
2176 "#26A0A7",
2177 "#65D3DA",
2178 "#79D69F",
2179 "#70BA6E",
2180 "#CBE989",
2181 "#EBF898",
2182 "#F9EC86",
2183 "#FAD144",
2184 "#EC983D",
2185 "#D76C6C",
2186 "#A54343"
2187 ]
2188 ]
2189 }
2190 ],
2191 ui: [
2192 {
2193 name: "Palette",
2194 colors: [
2195 "#b0afae",
2196 "#7b7a78",
2197 "#a54343",
2198 "#d76c6c",
2199 "#ec983d",
2200 "#ecc43d",
2201 "#f9ec86",
2202 "#cbe989",
2203 "#70ba6e",
2204 "#578b60",
2205 "#79d69f",
2206 "#26a0a7",
2207 "#138185",
2208 "#65d3da",
2209 "#ffffff",
2210 "#000000"
2211 ]
2212 }
2213 ]
2214 };
2215 var baseRawJSON = {
2216 fontSize: fontSize$1,
2217 fontFamily: fontFamily$1,
2218 backgroundColor: backgroundColor,
2219 dataColors: dataColors,
2220 scales: scales,
2221 palettes: palettes
2222 };
2223
2224 var _variables$1 = {
2225 "@B20": "#333333",
2226 "@B35": "#595959",
2227 "@B45": "#737373",
2228 "@B50": "#808080",
2229 "@B60": "#999999",
2230 "@B80": "#cccccc",
2231 "@B90": "#e6e6e6",
2232 "@B98": "#fbfbfb",
2233 "@B100": "#ffffff",
2234 "@H1": "24px",
2235 "@H2": "18px",
2236 "@H3": "14px",
2237 "@H4": "13px",
2238 "@H5": "12px",
2239 "@H6": "10px"
2240 };
2241 var type$1 = "light";
2242 var color$3 = "@B35";
2243 var lightRawJSON = {
2244 _variables: _variables$1,
2245 type: type$1,
2246 color: color$3
2247 };
2248
2249 var _variables = {
2250 "@B20": "#333333",
2251 "@B35": "#595959",
2252 "@B45": "#737373",
2253 "@B50": "#808080",
2254 "@B60": "#999999",
2255 "@B80": "#cccccc",
2256 "@B90": "#e6e6e6",
2257 "@B98": "#fbfbfb",
2258 "@B100": "#ffffff",
2259 "@H1": "24px",
2260 "@H2": "18px",
2261 "@H3": "14px",
2262 "@H4": "13px",
2263 "@H5": "12px",
2264 "@H6": "10px"
2265 };
2266 var type = "dark";
2267 var color$2 = "@B98";
2268 var darkRawJSON = {
2269 _variables: _variables,
2270 type: type,
2271 color: color$2
2272 };
2273
2274 function setTheme(t, resolve) {
2275 const colorRawJSON = t.type === 'dark' ? darkRawJSON : lightRawJSON;
2276 const root = extend$2(true, {}, baseRawJSON, colorRawJSON); // avoid merging known array objects as it could cause issues if they are of different types (pyramid vs class) or length
2277
2278 const rawThemeJSON = extend$2(true, {}, root, {
2279 scales: null,
2280 palettes: {
2281 data: null,
2282 ui: null
2283 }
2284 }, t);
2285
2286 if (!rawThemeJSON.palettes.data || !rawThemeJSON.palettes.data.length) {
2287 rawThemeJSON.palettes.data = root.palettes.data;
2288 }
2289
2290 if (!rawThemeJSON.palettes.ui || !rawThemeJSON.palettes.ui.length) {
2291 rawThemeJSON.palettes.ui = root.palettes.ui;
2292 }
2293
2294 if (!rawThemeJSON.scales || !rawThemeJSON.scales.length) {
2295 rawThemeJSON.scales = root.scales;
2296 }
2297
2298 const resolvedThemeJSON = resolve(rawThemeJSON);
2299 return resolvedThemeJSON;
2300 }
2301
2302 /**
2303 * @interface Theme~ScalePalette
2304 * @property {string} key
2305 * @property {'gradient'|'class-pyramid'} type
2306 * @property {string[]|Array<Array<string>>} colors
2307 */
2308
2309 /**
2310 * @interface Theme~DataPalette
2311 * @property {string} key
2312 * @property {'pyramid'|'row'} type
2313 * @property {string[]|Array<Array<string>>} colors
2314 */
2315
2316 /**
2317 * @interface Theme~ColorPickerPalette
2318 * @property {string} key
2319 * @property {string[]} colors
2320 */
2321 function theme$1(resolvedTheme) {
2322 let uiPalette;
2323 return {
2324 dataScales() {
2325 const pals = [];
2326 resolvedTheme.scales.forEach(s => {
2327 pals.push({
2328 key: s.propertyValue,
2329 name: s.name,
2330 translation: s.translation,
2331 scheme: true,
2332 // indicate that this is scheme that can be used to generate more colors
2333 type: s.type,
2334 // gradient, class, pyramid, row
2335 colors: s.scale
2336 });
2337 });
2338 return pals;
2339 },
2340
2341 dataPalettes() {
2342 const pals = [];
2343 resolvedTheme.palettes.data.forEach(s => {
2344 pals.push({
2345 key: s.propertyValue,
2346 name: s.name,
2347 translation: s.translation,
2348 type: s.type,
2349 colors: s.scale
2350 });
2351 });
2352 return pals;
2353 },
2354
2355 uiPalettes() {
2356 const pals = [];
2357 resolvedTheme.palettes.ui.forEach(s => {
2358 pals.push({
2359 key: 'ui',
2360 name: s.name,
2361 translation: s.translation,
2362 type: 'row',
2363 colors: s.colors
2364 });
2365 });
2366 return pals;
2367 },
2368
2369 dataColors() {
2370 /** @interface Theme~DataColorSpecials */
2371 return (
2372 /** @lends Theme~DataColorSpecials */
2373 {
2374 /** @type {string} */
2375 primary: resolvedTheme.dataColors.primaryColor,
2376
2377 /** @type {string} */
2378 nil: resolvedTheme.dataColors.nullColor,
2379
2380 /** @type {string} */
2381 others: resolvedTheme.dataColors.othersColor
2382 }
2383 );
2384 },
2385
2386 uiColor(c) {
2387 if (c.index < 0 || typeof c.index === 'undefined') {
2388 return c.color;
2389 }
2390
2391 if (typeof uiPalette === 'undefined') {
2392 uiPalette = this.uiPalettes()[0] || false;
2393 }
2394
2395 if (!uiPalette) {
2396 return c.color;
2397 }
2398
2399 if (typeof uiPalette.colors[c.index] === 'undefined') {
2400 return c.color;
2401 }
2402
2403 return uiPalette.colors[c.index];
2404 }
2405
2406 };
2407 }
2408
2409 function define(constructor, factory, prototype) {
2410 constructor.prototype = factory.prototype = prototype;
2411 prototype.constructor = constructor;
2412 }
2413
2414 function extend$1(parent, definition) {
2415 var prototype = Object.create(parent.prototype);
2416 for (var key in definition) prototype[key] = definition[key];
2417 return prototype;
2418 }
2419
2420 function Color() {}
2421
2422 var darker = 0.7;
2423 var brighter = 1 / darker;
2424
2425 var reI = "\\s*([+-]?\\d+)\\s*",
2426 reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
2427 reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
2428 reHex = /^#([0-9a-f]{3,8})$/,
2429 reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
2430 reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
2431 reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
2432 reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
2433 reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
2434 reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
2435
2436 var named = {
2437 aliceblue: 0xf0f8ff,
2438 antiquewhite: 0xfaebd7,
2439 aqua: 0x00ffff,
2440 aquamarine: 0x7fffd4,
2441 azure: 0xf0ffff,
2442 beige: 0xf5f5dc,
2443 bisque: 0xffe4c4,
2444 black: 0x000000,
2445 blanchedalmond: 0xffebcd,
2446 blue: 0x0000ff,
2447 blueviolet: 0x8a2be2,
2448 brown: 0xa52a2a,
2449 burlywood: 0xdeb887,
2450 cadetblue: 0x5f9ea0,
2451 chartreuse: 0x7fff00,
2452 chocolate: 0xd2691e,
2453 coral: 0xff7f50,
2454 cornflowerblue: 0x6495ed,
2455 cornsilk: 0xfff8dc,
2456 crimson: 0xdc143c,
2457 cyan: 0x00ffff,
2458 darkblue: 0x00008b,
2459 darkcyan: 0x008b8b,
2460 darkgoldenrod: 0xb8860b,
2461 darkgray: 0xa9a9a9,
2462 darkgreen: 0x006400,
2463 darkgrey: 0xa9a9a9,
2464 darkkhaki: 0xbdb76b,
2465 darkmagenta: 0x8b008b,
2466 darkolivegreen: 0x556b2f,
2467 darkorange: 0xff8c00,
2468 darkorchid: 0x9932cc,
2469 darkred: 0x8b0000,
2470 darksalmon: 0xe9967a,
2471 darkseagreen: 0x8fbc8f,
2472 darkslateblue: 0x483d8b,
2473 darkslategray: 0x2f4f4f,
2474 darkslategrey: 0x2f4f4f,
2475 darkturquoise: 0x00ced1,
2476 darkviolet: 0x9400d3,
2477 deeppink: 0xff1493,
2478 deepskyblue: 0x00bfff,
2479 dimgray: 0x696969,
2480 dimgrey: 0x696969,
2481 dodgerblue: 0x1e90ff,
2482 firebrick: 0xb22222,
2483 floralwhite: 0xfffaf0,
2484 forestgreen: 0x228b22,
2485 fuchsia: 0xff00ff,
2486 gainsboro: 0xdcdcdc,
2487 ghostwhite: 0xf8f8ff,
2488 gold: 0xffd700,
2489 goldenrod: 0xdaa520,
2490 gray: 0x808080,
2491 green: 0x008000,
2492 greenyellow: 0xadff2f,
2493 grey: 0x808080,
2494 honeydew: 0xf0fff0,
2495 hotpink: 0xff69b4,
2496 indianred: 0xcd5c5c,
2497 indigo: 0x4b0082,
2498 ivory: 0xfffff0,
2499 khaki: 0xf0e68c,
2500 lavender: 0xe6e6fa,
2501 lavenderblush: 0xfff0f5,
2502 lawngreen: 0x7cfc00,
2503 lemonchiffon: 0xfffacd,
2504 lightblue: 0xadd8e6,
2505 lightcoral: 0xf08080,
2506 lightcyan: 0xe0ffff,
2507 lightgoldenrodyellow: 0xfafad2,
2508 lightgray: 0xd3d3d3,
2509 lightgreen: 0x90ee90,
2510 lightgrey: 0xd3d3d3,
2511 lightpink: 0xffb6c1,
2512 lightsalmon: 0xffa07a,
2513 lightseagreen: 0x20b2aa,
2514 lightskyblue: 0x87cefa,
2515 lightslategray: 0x778899,
2516 lightslategrey: 0x778899,
2517 lightsteelblue: 0xb0c4de,
2518 lightyellow: 0xffffe0,
2519 lime: 0x00ff00,
2520 limegreen: 0x32cd32,
2521 linen: 0xfaf0e6,
2522 magenta: 0xff00ff,
2523 maroon: 0x800000,
2524 mediumaquamarine: 0x66cdaa,
2525 mediumblue: 0x0000cd,
2526 mediumorchid: 0xba55d3,
2527 mediumpurple: 0x9370db,
2528 mediumseagreen: 0x3cb371,
2529 mediumslateblue: 0x7b68ee,
2530 mediumspringgreen: 0x00fa9a,
2531 mediumturquoise: 0x48d1cc,
2532 mediumvioletred: 0xc71585,
2533 midnightblue: 0x191970,
2534 mintcream: 0xf5fffa,
2535 mistyrose: 0xffe4e1,
2536 moccasin: 0xffe4b5,
2537 navajowhite: 0xffdead,
2538 navy: 0x000080,
2539 oldlace: 0xfdf5e6,
2540 olive: 0x808000,
2541 olivedrab: 0x6b8e23,
2542 orange: 0xffa500,
2543 orangered: 0xff4500,
2544 orchid: 0xda70d6,
2545 palegoldenrod: 0xeee8aa,
2546 palegreen: 0x98fb98,
2547 paleturquoise: 0xafeeee,
2548 palevioletred: 0xdb7093,
2549 papayawhip: 0xffefd5,
2550 peachpuff: 0xffdab9,
2551 peru: 0xcd853f,
2552 pink: 0xffc0cb,
2553 plum: 0xdda0dd,
2554 powderblue: 0xb0e0e6,
2555 purple: 0x800080,
2556 rebeccapurple: 0x663399,
2557 red: 0xff0000,
2558 rosybrown: 0xbc8f8f,
2559 royalblue: 0x4169e1,
2560 saddlebrown: 0x8b4513,
2561 salmon: 0xfa8072,
2562 sandybrown: 0xf4a460,
2563 seagreen: 0x2e8b57,
2564 seashell: 0xfff5ee,
2565 sienna: 0xa0522d,
2566 silver: 0xc0c0c0,
2567 skyblue: 0x87ceeb,
2568 slateblue: 0x6a5acd,
2569 slategray: 0x708090,
2570 slategrey: 0x708090,
2571 snow: 0xfffafa,
2572 springgreen: 0x00ff7f,
2573 steelblue: 0x4682b4,
2574 tan: 0xd2b48c,
2575 teal: 0x008080,
2576 thistle: 0xd8bfd8,
2577 tomato: 0xff6347,
2578 turquoise: 0x40e0d0,
2579 violet: 0xee82ee,
2580 wheat: 0xf5deb3,
2581 white: 0xffffff,
2582 whitesmoke: 0xf5f5f5,
2583 yellow: 0xffff00,
2584 yellowgreen: 0x9acd32
2585 };
2586
2587 define(Color, color$1, {
2588 copy: function(channels) {
2589 return Object.assign(new this.constructor, this, channels);
2590 },
2591 displayable: function() {
2592 return this.rgb().displayable();
2593 },
2594 hex: color_formatHex, // Deprecated! Use color.formatHex.
2595 formatHex: color_formatHex,
2596 formatHsl: color_formatHsl,
2597 formatRgb: color_formatRgb,
2598 toString: color_formatRgb
2599 });
2600
2601 function color_formatHex() {
2602 return this.rgb().formatHex();
2603 }
2604
2605 function color_formatHsl() {
2606 return hslConvert(this).formatHsl();
2607 }
2608
2609 function color_formatRgb() {
2610 return this.rgb().formatRgb();
2611 }
2612
2613 function color$1(format) {
2614 var m, l;
2615 format = (format + "").trim().toLowerCase();
2616 return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
2617 : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
2618 : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
2619 : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
2620 : null) // invalid hex
2621 : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
2622 : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
2623 : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
2624 : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
2625 : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
2626 : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
2627 : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
2628 : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
2629 : null;
2630 }
2631
2632 function rgbn(n) {
2633 return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
2634 }
2635
2636 function rgba(r, g, b, a) {
2637 if (a <= 0) r = g = b = NaN;
2638 return new Rgb(r, g, b, a);
2639 }
2640
2641 function rgbConvert(o) {
2642 if (!(o instanceof Color)) o = color$1(o);
2643 if (!o) return new Rgb;
2644 o = o.rgb();
2645 return new Rgb(o.r, o.g, o.b, o.opacity);
2646 }
2647
2648 function rgb(r, g, b, opacity) {
2649 return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
2650 }
2651
2652 function Rgb(r, g, b, opacity) {
2653 this.r = +r;
2654 this.g = +g;
2655 this.b = +b;
2656 this.opacity = +opacity;
2657 }
2658
2659 define(Rgb, rgb, extend$1(Color, {
2660 brighter: function(k) {
2661 k = k == null ? brighter : Math.pow(brighter, k);
2662 return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
2663 },
2664 darker: function(k) {
2665 k = k == null ? darker : Math.pow(darker, k);
2666 return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
2667 },
2668 rgb: function() {
2669 return this;
2670 },
2671 displayable: function() {
2672 return (-0.5 <= this.r && this.r < 255.5)
2673 && (-0.5 <= this.g && this.g < 255.5)
2674 && (-0.5 <= this.b && this.b < 255.5)
2675 && (0 <= this.opacity && this.opacity <= 1);
2676 },
2677 hex: rgb_formatHex, // Deprecated! Use color.formatHex.
2678 formatHex: rgb_formatHex,
2679 formatRgb: rgb_formatRgb,
2680 toString: rgb_formatRgb
2681 }));
2682
2683 function rgb_formatHex() {
2684 return "#" + hex(this.r) + hex(this.g) + hex(this.b);
2685 }
2686
2687 function rgb_formatRgb() {
2688 var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
2689 return (a === 1 ? "rgb(" : "rgba(")
2690 + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
2691 + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
2692 + Math.max(0, Math.min(255, Math.round(this.b) || 0))
2693 + (a === 1 ? ")" : ", " + a + ")");
2694 }
2695
2696 function hex(value) {
2697 value = Math.max(0, Math.min(255, Math.round(value) || 0));
2698 return (value < 16 ? "0" : "") + value.toString(16);
2699 }
2700
2701 function hsla(h, s, l, a) {
2702 if (a <= 0) h = s = l = NaN;
2703 else if (l <= 0 || l >= 1) h = s = NaN;
2704 else if (s <= 0) h = NaN;
2705 return new Hsl(h, s, l, a);
2706 }
2707
2708 function hslConvert(o) {
2709 if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
2710 if (!(o instanceof Color)) o = color$1(o);
2711 if (!o) return new Hsl;
2712 if (o instanceof Hsl) return o;
2713 o = o.rgb();
2714 var r = o.r / 255,
2715 g = o.g / 255,
2716 b = o.b / 255,
2717 min = Math.min(r, g, b),
2718 max = Math.max(r, g, b),
2719 h = NaN,
2720 s = max - min,
2721 l = (max + min) / 2;
2722 if (s) {
2723 if (r === max) h = (g - b) / s + (g < b) * 6;
2724 else if (g === max) h = (b - r) / s + 2;
2725 else h = (r - g) / s + 4;
2726 s /= l < 0.5 ? max + min : 2 - max - min;
2727 h *= 60;
2728 } else {
2729 s = l > 0 && l < 1 ? 0 : h;
2730 }
2731 return new Hsl(h, s, l, o.opacity);
2732 }
2733
2734 function hsl(h, s, l, opacity) {
2735 return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
2736 }
2737
2738 function Hsl(h, s, l, opacity) {
2739 this.h = +h;
2740 this.s = +s;
2741 this.l = +l;
2742 this.opacity = +opacity;
2743 }
2744
2745 define(Hsl, hsl, extend$1(Color, {
2746 brighter: function(k) {
2747 k = k == null ? brighter : Math.pow(brighter, k);
2748 return new Hsl(this.h, this.s, this.l * k, this.opacity);
2749 },
2750 darker: function(k) {
2751 k = k == null ? darker : Math.pow(darker, k);
2752 return new Hsl(this.h, this.s, this.l * k, this.opacity);
2753 },
2754 rgb: function() {
2755 var h = this.h % 360 + (this.h < 0) * 360,
2756 s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
2757 l = this.l,
2758 m2 = l + (l < 0.5 ? l : 1 - l) * s,
2759 m1 = 2 * l - m2;
2760 return new Rgb(
2761 hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
2762 hsl2rgb(h, m1, m2),
2763 hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
2764 this.opacity
2765 );
2766 },
2767 displayable: function() {
2768 return (0 <= this.s && this.s <= 1 || isNaN(this.s))
2769 && (0 <= this.l && this.l <= 1)
2770 && (0 <= this.opacity && this.opacity <= 1);
2771 },
2772 formatHsl: function() {
2773 var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
2774 return (a === 1 ? "hsl(" : "hsla(")
2775 + (this.h || 0) + ", "
2776 + (this.s || 0) * 100 + "%, "
2777 + (this.l || 0) * 100 + "%"
2778 + (a === 1 ? ")" : ", " + a + ")");
2779 }
2780 }));
2781
2782 /* From FvD 13.37, CSS Color Module Level 3 */
2783 function hsl2rgb(h, m1, m2) {
2784 return (h < 60 ? m1 + (m2 - m1) * h / 60
2785 : h < 180 ? m2
2786 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
2787 : m1) * 255;
2788 }
2789
2790 const radians = Math.PI / 180;
2791 const degrees = 180 / Math.PI;
2792
2793 // https://observablehq.com/@mbostock/lab-and-rgb
2794 const K$1 = 18,
2795 Xn = 0.96422,
2796 Yn = 1,
2797 Zn = 0.82521,
2798 t0 = 4 / 29,
2799 t1 = 6 / 29,
2800 t2 = 3 * t1 * t1,
2801 t3 = t1 * t1 * t1;
2802
2803 function labConvert(o) {
2804 if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
2805 if (o instanceof Hcl) return hcl2lab(o);
2806 if (!(o instanceof Rgb)) o = rgbConvert(o);
2807 var r = rgb2lrgb(o.r),
2808 g = rgb2lrgb(o.g),
2809 b = rgb2lrgb(o.b),
2810 y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
2811 if (r === g && g === b) x = z = y; else {
2812 x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
2813 z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
2814 }
2815 return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
2816 }
2817
2818 function lab(l, a, b, opacity) {
2819 return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
2820 }
2821
2822 function Lab(l, a, b, opacity) {
2823 this.l = +l;
2824 this.a = +a;
2825 this.b = +b;
2826 this.opacity = +opacity;
2827 }
2828
2829 define(Lab, lab, extend$1(Color, {
2830 brighter: function(k) {
2831 return new Lab(this.l + K$1 * (k == null ? 1 : k), this.a, this.b, this.opacity);
2832 },
2833 darker: function(k) {
2834 return new Lab(this.l - K$1 * (k == null ? 1 : k), this.a, this.b, this.opacity);
2835 },
2836 rgb: function() {
2837 var y = (this.l + 16) / 116,
2838 x = isNaN(this.a) ? y : y + this.a / 500,
2839 z = isNaN(this.b) ? y : y - this.b / 200;
2840 x = Xn * lab2xyz(x);
2841 y = Yn * lab2xyz(y);
2842 z = Zn * lab2xyz(z);
2843 return new Rgb(
2844 lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
2845 lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
2846 lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
2847 this.opacity
2848 );
2849 }
2850 }));
2851
2852 function xyz2lab(t) {
2853 return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
2854 }
2855
2856 function lab2xyz(t) {
2857 return t > t1 ? t * t * t : t2 * (t - t0);
2858 }
2859
2860 function lrgb2rgb(x) {
2861 return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
2862 }
2863
2864 function rgb2lrgb(x) {
2865 return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
2866 }
2867
2868 function hclConvert(o) {
2869 if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
2870 if (!(o instanceof Lab)) o = labConvert(o);
2871 if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
2872 var h = Math.atan2(o.b, o.a) * degrees;
2873 return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
2874 }
2875
2876 function hcl(h, c, l, opacity) {
2877 return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
2878 }
2879
2880 function Hcl(h, c, l, opacity) {
2881 this.h = +h;
2882 this.c = +c;
2883 this.l = +l;
2884 this.opacity = +opacity;
2885 }
2886
2887 function hcl2lab(o) {
2888 if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
2889 var h = o.h * radians;
2890 return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
2891 }
2892
2893 define(Hcl, hcl, extend$1(Color, {
2894 brighter: function(k) {
2895 return new Hcl(this.h, this.c, this.l + K$1 * (k == null ? 1 : k), this.opacity);
2896 },
2897 darker: function(k) {
2898 return new Hcl(this.h, this.c, this.l - K$1 * (k == null ? 1 : k), this.opacity);
2899 },
2900 rgb: function() {
2901 return hcl2lab(this).rgb();
2902 }
2903 }));
2904
2905 var A$2 = -0.14861,
2906 B$3 = +1.78277,
2907 C$2 = -0.29227,
2908 D$3 = -0.90649,
2909 E$3 = +1.97294,
2910 ED = E$3 * D$3,
2911 EB = E$3 * B$3,
2912 BC_DA = B$3 * C$2 - D$3 * A$2;
2913
2914 function cubehelixConvert(o) {
2915 if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
2916 if (!(o instanceof Rgb)) o = rgbConvert(o);
2917 var r = o.r / 255,
2918 g = o.g / 255,
2919 b = o.b / 255,
2920 l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
2921 bl = b - l,
2922 k = (E$3 * (g - l) - C$2 * bl) / D$3,
2923 s = Math.sqrt(k * k + bl * bl) / (E$3 * l * (1 - l)), // NaN if l=0 or l=1
2924 h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;
2925 return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
2926 }
2927
2928 function cubehelix(h, s, l, opacity) {
2929 return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
2930 }
2931
2932 function Cubehelix(h, s, l, opacity) {
2933 this.h = +h;
2934 this.s = +s;
2935 this.l = +l;
2936 this.opacity = +opacity;
2937 }
2938
2939 define(Cubehelix, cubehelix, extend$1(Color, {
2940 brighter: function(k) {
2941 k = k == null ? brighter : Math.pow(brighter, k);
2942 return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
2943 },
2944 darker: function(k) {
2945 k = k == null ? darker : Math.pow(darker, k);
2946 return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
2947 },
2948 rgb: function() {
2949 var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,
2950 l = +this.l,
2951 a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
2952 cosh = Math.cos(h),
2953 sinh = Math.sin(h);
2954 return new Rgb(
2955 255 * (l + a * (A$2 * cosh + B$3 * sinh)),
2956 255 * (l + a * (C$2 * cosh + D$3 * sinh)),
2957 255 * (l + a * (E$3 * cosh)),
2958 this.opacity
2959 );
2960 }
2961 }));
2962
2963 /**
2964 * Gets this mapping between the scaled value and the color parts
2965 * @ignore
2966 * @param {Number} scaledValue - A value between 0 and 1 representing a value in the data scaled between the max and min boundaries of the data. Values are clamped to 0 and 1.
2967 * @param {Number} numEdges - Number of parts that makes up this scale
2968 */
2969
2970 function limitFunction(scaledValue, numParts) {
2971 /*
2972 * Color-Scale doesn't calculate exact color blends based of the scaled value. It instead shifts the value inwards to achieve
2973 * a better color representation at the edges. Primarily this is done to allow setting custom limits to where each color begins
2974 * and ends. If a color begins and ends at 1, it should not be visible. The simplest way to achive this is to remove 1 and 0
2975 * from the possible numbers that can be used. Colors that are not equal to 1 or 0 should not be affected.
2976 */
2977 // The following is done to keep the scaled value above 0 and below 1. This shifts values that hits an exact boundary upwards.
2978 // eslint-disable-next-line no-param-reassign
2979 scaledValue = Math.min(Math.max(scaledValue, 0.000000000001), 0.999999999999);
2980 return numParts - scaledValue * numParts;
2981 }
2982
2983 function getLevel(scale, level) {
2984 return Math.min(level || scale.startLevel, scale.colorParts.length - 1);
2985 }
2986
2987 function blend(c1, c2, t) {
2988 const r = Math.floor(c1.r + (c2.r - c1.r) * t);
2989 const g = Math.floor(c1.g + (c2.g - c1.g) * t);
2990 const b = Math.floor(c1.b + (c2.b - c1.b) * t);
2991 const a = Math.floor(c1.opacity + (c2.opacity - c1.opacity) * t);
2992 return rgb(r, g, b, a);
2993 }
2994
2995 class ColorScale {
2996 constructor(nanColor) {
2997 this.colorParts = [];
2998 this.startLevel = 0;
2999 this.max = 1;
3000 this.min = 0;
3001 this.nanColor = color$1(nanColor);
3002 }
3003 /**
3004 * Adds a part to this color scale. The input colors span one part of the gradient, colors between them are interpolated. Input two equal colors for a solid scale part.
3005 * @ignore
3006 * @param {String|Number} color1 - First color to be used, in formats defined by Color
3007 * @param {String|Number} color2 - Second color to be used, in formats defined by Color
3008 * @param {Number} level - Which level of the color pyramid to add this part to.
3009 */
3010
3011
3012 addColorPart(color1, color2, level) {
3013 // eslint-disable-next-line no-param-reassign
3014 level = level || 0;
3015 this.startLevel = Math.max(level, this.startLevel);
3016
3017 if (!this.colorParts[level]) {
3018 this.colorParts[level] = [];
3019 }
3020
3021 this.colorParts[level].push([color$1(color1), color$1(color2)]);
3022 }
3023 /**
3024 * Gets the color which represents the input value
3025 * @ignore
3026 * @param {Number} scaledValue - A value between 0 and 1 representing a value in the data scaled between the max and min boundaries of the data. Values are clamped to 0 and 1.
3027 */
3028
3029
3030 getColor(value, level) {
3031 const scaledValue = value - this.min;
3032
3033 if (Number.isNaN(+value) || Number.isNaN(+scaledValue)) {
3034 return this.nanColor;
3035 } // eslint-disable-next-line no-param-reassign
3036
3037
3038 level = getLevel(this, level);
3039 const k = limitFunction(scaledValue, this.colorParts[level].length);
3040 let f = Math.floor(k);
3041 f = f === k ? f - 1 : f; // To fulfill equal or greater than: 329-<330
3042
3043 const part = this.colorParts[level][f];
3044 const c1 = part[0];
3045 const c2 = part[1]; // For absolute edges we return the colors at the limit
3046
3047 if (value === this.min) {
3048 return c2;
3049 }
3050
3051 if (value === this.max) {
3052 return c1;
3053 }
3054
3055 const t = k - f;
3056 const uc = blend(c1, c2, t);
3057 return uc;
3058 }
3059
3060 }
3061
3062 /* Calculates a value that expands from 0.5 out to 0 and 1
3063 * Ex for size 8:
3064 * current -> percent
3065 * 0 -> 0.0625 4 -> 0.3125
3066 * 1 -> 0.125 5 -> 0.375
3067 * 2 -> 0.1875 6 -> 0.4375
3068 * 3 -> 0.25 7 -> 0.5
3069 */
3070
3071 function getScaleValue(value, current, size) {
3072 const percent = 0.25 + (current + 1) / size * 0.25;
3073 const min = 0.5 - percent;
3074 const max = 0.5 + percent;
3075 const span = max - min;
3076 return min + value / 1 * span;
3077 }
3078
3079 function setupColorScale(colors, nanColor, gradient) {
3080 const newColors = [];
3081 const cs = new ColorScale(nanColor);
3082 newColors.push(colors[0]);
3083
3084 if (!gradient) {
3085 newColors.push(colors[0]);
3086 }
3087
3088 let i = 1;
3089
3090 for (; i < colors.length - 1; i++) {
3091 newColors.push(colors[i]);
3092 newColors.push(colors[i]);
3093 }
3094
3095 newColors.push(colors[i]);
3096
3097 if (!gradient) {
3098 newColors.push(colors[i]);
3099 }
3100
3101 for (let j = 0; j < newColors.length; j += 2) {
3102 cs.addColorPart(newColors[j], newColors[j + 1]);
3103 }
3104
3105 return cs;
3106 }
3107
3108 function generateLevel(scale, current, size) {
3109 const level = [];
3110
3111 for (let j = 0; j < current + 1; j++) {
3112 let c;
3113
3114 switch (current) {
3115 case 0:
3116 c = scale.getColor(0.5);
3117 break;
3118
3119 default:
3120 {
3121 const scaled = getScaleValue(1 / current * j, current, size);
3122 c = scale.getColor(scaled);
3123 break;
3124 }
3125 }
3126
3127 level.push(color$1(c).formatHex());
3128 }
3129
3130 return level;
3131 }
3132 /**
3133 * Generates a pyramid of colors from a minimum of 2 colors
3134 *
3135 * @ignore
3136 * @internal
3137 * @param {Array} colors an array of colors to generate from
3138 * @param {number} size the integer size of the base of the pyramid
3139 * @returns {Array} A 2 dimensional array containing the levels of the color pyramid
3140 */
3141
3142
3143 function createPyramidFromColors(colors, size, nanColor) {
3144 const gradientScale = setupColorScale(colors, nanColor, true);
3145 const baseLevel = generateLevel(gradientScale, size - 1, size);
3146 const scale = setupColorScale(baseLevel, nanColor, false);
3147 const pyramid = [null];
3148
3149 for (let i = 0; i < size; i++) {
3150 pyramid.push(generateLevel(scale, i, size));
3151 }
3152
3153 return pyramid;
3154 }
3155
3156 function generateOrdinalScales(scalesDef) {
3157 let nanColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#d2d2d2';
3158 scalesDef.forEach(def => {
3159 if (def.type === 'class') {
3160 // generate pyramid
3161 const pyramid = createPyramidFromColors(def.scale, Math.max(def.scale.length, 7), nanColor); // eslint-disable-next-line no-param-reassign
3162
3163 def.scale = pyramid; // eslint-disable-next-line no-param-reassign
3164
3165 def.type = 'class-pyramid';
3166 }
3167 });
3168 }
3169
3170 /**
3171 * Creates the following array of paths
3172 * object.barChart - legend.title - fontSize
3173 * object - legend.title - fontSize
3174 * legend.title - fontSize
3175 * object.barChart - legend - fontSize
3176 * object - legend - fontSize
3177 * legend - fontSize
3178 * object.barChart - fontSize
3179 * object - fontSize
3180 * fontSize
3181 * @ignore
3182 */
3183
3184 function constructPaths(pathSteps, baseSteps) {
3185 const ret = [];
3186 let localBaseSteps;
3187 let baseLength;
3188
3189 if (pathSteps) {
3190 let pathLength = pathSteps.length;
3191
3192 while (pathLength >= 0) {
3193 localBaseSteps = baseSteps.slice();
3194 baseLength = localBaseSteps.length;
3195
3196 while (baseLength >= 0) {
3197 ret.push(localBaseSteps.concat(pathSteps));
3198 localBaseSteps.pop();
3199 baseLength--;
3200 }
3201
3202 pathSteps.pop();
3203 pathLength--;
3204 }
3205 } else {
3206 localBaseSteps = baseSteps.slice();
3207 baseLength = localBaseSteps.length;
3208
3209 while (baseLength >= 0) {
3210 ret.push(localBaseSteps.concat());
3211 localBaseSteps.pop();
3212 baseLength--;
3213 }
3214 }
3215
3216 return ret;
3217 }
3218
3219 function getObject$1(root, steps) {
3220 let obj = root;
3221
3222 for (let i = 0; i < steps.length; i++) {
3223 if (obj[steps[i]]) {
3224 obj = obj[steps[i]];
3225 } else {
3226 return undefined;
3227 }
3228 }
3229
3230 return obj;
3231 }
3232
3233 function searchPathArray(pathArray, attribute, theme) {
3234 const attributeArray = attribute.split('.');
3235
3236 for (let i = 0; i < pathArray.length; i++) {
3237 const restult = getObject$1(theme, [...pathArray[i], ...attributeArray]);
3238 if (restult !== undefined) return restult;
3239 }
3240
3241 return undefined;
3242 }
3243
3244 function searchValue(path, attribute, baseSteps, component) {
3245 let pathArray;
3246
3247 if (path === '') {
3248 pathArray = constructPaths(null, baseSteps);
3249 } else {
3250 const steps = path.split('.');
3251 pathArray = constructPaths(steps, baseSteps);
3252 }
3253
3254 return searchPathArray(pathArray, attribute, component);
3255 }
3256
3257 function styleResolver(basePath, themeJSON) {
3258 const basePathSteps = basePath.split('.');
3259 const api = {
3260 /**
3261 *
3262 * Get the value of a style attribute, starting in the given base path + path
3263 * Ex: Base path: "object.barChart", Path: "legend.title", Attribute: "fontSize"
3264 * Will search in, and fall back to:
3265 * object.barChart - legend.title - fontSize
3266 * object - legend.title - fontSize
3267 * legend.title - fontSize
3268 * object.barChart - legend - fontSize
3269 * object - legend - fontSize
3270 * legend - fontSize
3271 * object.barChart - fontSize
3272 * object - fontSize
3273 * fontSize
3274 * When attributes separated by dots is provided, they are required in the theme JSON file
3275 * Ex. Base path: "object" , Path: "legend", ", Attribute: "title.fontSize"
3276 * title: {fontSize: ...} must be matched and the rest is the same as above
3277 * If you want a exact match, you can use `getStyle('object', '', 'legend.title.fontSize');`
3278 * @ignore
3279 *
3280 * @param {string} component String of properties separated by dots to search in
3281 * @param {string} attribute Name of the style attribute
3282 * @returns {string|undefined} The style value of the resolved path, undefined if not found
3283 */
3284 getStyle(component, attribute) {
3285 // TODO - object overrides
3286 // TODO - feature flag on font-family?
3287 // TODO - caching
3288 const baseSteps = basePathSteps.concat();
3289 const result = searchValue(component, attribute, baseSteps, themeJSON); // TODO - support functions
3290
3291 return result;
3292 }
3293
3294 };
3295 return api;
3296 }
3297 /**
3298 * Iterate the object tree and resolve variables and functions.
3299 * @ignore
3300 * @param {Object} - objTree
3301 * @param {Object} - variables
3302 */
3303
3304 function resolveVariables(objTree, variables) {
3305 Object.keys(objTree).forEach(key => {
3306 if (typeof objTree[key] === 'object' && objTree[key] !== null) {
3307 resolveVariables(objTree[key], variables);
3308 } else if (typeof objTree[key] === 'string' && objTree[key].charAt(0) === '@') {
3309 // Resolve variables
3310 objTree[key] = variables[objTree[key]]; // eslint-disable-line no-param-reassign
3311 }
3312 });
3313 }
3314
3315 styleResolver.resolveRawTheme = raw => {
3316 // TODO - validate format
3317 const c = extend$2(true, {}, raw);
3318 resolveVariables(c, c._variables); // eslint-disable-line
3319 // generate class-pyramid
3320
3321 if (c.scales) {
3322 generateOrdinalScales(c.scales, c.dataColors && c.dataColors.nullColor);
3323 }
3324
3325 return c;
3326 };
3327
3328 function luminance(colStr) {
3329 const c = color$1(colStr).rgb();
3330 const {
3331 r,
3332 g,
3333 b
3334 } = c; // https://www.w3.org/TR/WCAG20/#relativeluminancedef
3335
3336 const [sR, sG, sB] = [r, g, b].map(v => v / 255);
3337 const [R, G, B] = [sR, sG, sB].map(v => v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);
3338 return +(0.2126 * R + 0.7152 * G + 0.0722 * B).toFixed(5);
3339 }
3340
3341 // https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html#contrast-ratiodef
3342 function contrast(L1, L2) {
3343 return +((Math.max(L1, L2) + 0.05) / (Math.min(L1, L2) + 0.05)).toFixed(5);
3344 }
3345
3346 /* eslint no-cond-assign: 0 */
3347 const MAX_SIZE = 1000;
3348 function colorFn() {
3349 let colors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['#333333', '#ffffff'];
3350 let cache = {};
3351 let n = 0;
3352 const luminances = colors.map(luminance);
3353 return {
3354 getBestContrastColor(colorString) {
3355 if (!cache[colorString]) {
3356 if (n > MAX_SIZE) {
3357 cache = {};
3358 n = 0;
3359 }
3360
3361 const L = luminance(colorString);
3362 const contrasts = luminances.map(lum => contrast(L, lum));
3363 const c = colors[contrasts.indexOf(Math.max(...contrasts))];
3364 cache[colorString] = c;
3365 n++;
3366 }
3367
3368 return cache[colorString];
3369 }
3370
3371 };
3372 }
3373
3374 function theme() {
3375 let resolvedThemeJSON;
3376 let styleResolverInstanceCache = {};
3377 let paletteResolver;
3378 let contraster;
3379 /**
3380 * @class
3381 * @alias Theme
3382 */
3383
3384 const externalAPI =
3385 /** @lends Theme# */
3386 {
3387 /**
3388 * @returns {Theme~ScalePalette[]}
3389 */
3390 getDataColorScales() {
3391 return paletteResolver.dataScales();
3392 },
3393
3394 /**
3395 * @returns {Theme~DataPalette[]}
3396 */
3397 getDataColorPalettes() {
3398 return paletteResolver.dataPalettes();
3399 },
3400
3401 /**
3402 * @returns {Theme~ColorPickerPalette[]}
3403 */
3404 getDataColorPickerPalettes() {
3405 return paletteResolver.uiPalettes();
3406 },
3407
3408 /**
3409 * @returns {Theme~DataColorSpecials}
3410 */
3411 getDataColorSpecials() {
3412 return paletteResolver.dataColors();
3413 },
3414
3415 /**
3416 * Resolve a color object using the color picker palette from the provided JSON theme.
3417 * @param {object} c
3418 * @param {number=} c.index
3419 * @param {string=} c.color
3420 * @returns {string} The resolved color.
3421 *
3422 * @example
3423 * theme.getColorPickerColor({ index: 1 });
3424 * theme.getColorPickerColor({ color: 'red' });
3425 */
3426 getColorPickerColor() {
3427 return paletteResolver.uiColor(...arguments);
3428 },
3429
3430 /**
3431 * Get the best contrasting color against the specified `color`.
3432 * This is typically used to find a suitable text color for a label placed on an arbitrarily colored background.
3433 *
3434 * The returned colors are derived from the theme.
3435 * @param {string} color - A color to measure the contrast against
3436 * @returns {string} - The color that has the best contrast against the specified `color`.
3437 * @example
3438 * theme.getContrastingColorTo('#400');
3439 */
3440 getContrastingColorTo(color) {
3441 return contraster.getBestContrastColor(color);
3442 },
3443
3444 /**
3445 * Get the value of a style attribute in the theme
3446 * by searching in the theme's JSON structure.
3447 * The search starts at the specified base path
3448 * and continues upwards until the value is found.
3449 * If possible it will get the attribute's value using the given path.
3450 * When attributes separated by dots are provided, such as 'hover.color',
3451 * they are required in the theme JSON file
3452 *
3453 * @param {string} basePath - Base path in the theme's JSON structure to start the search in (specified as a name path separated by dots).
3454 * @param {string} path - Expected path for the attribute (specified as a name path separated by dots).
3455 * @param {string} attribute - Name of the style attribute. (specified as a name attribute separated by dots).
3456 * @returns {string|undefined} The style value or undefined if not found
3457 *
3458 * @example
3459 * theme.getStyle('object', 'title.main', 'fontSize');
3460 * theme.getStyle('object', 'title', 'main.fontSize');
3461 * theme.getStyle('object', '', 'title.main.fontSize');
3462 * theme.getStyle('', '', 'fontSize');
3463 */
3464 getStyle(basePath, path, attribute) {
3465 if (!styleResolverInstanceCache[basePath]) {
3466 styleResolverInstanceCache[basePath] = styleResolver(basePath, resolvedThemeJSON);
3467 }
3468
3469 return styleResolverInstanceCache[basePath].getStyle(path, attribute);
3470 }
3471
3472 };
3473 const internalAPI = {
3474 /**
3475 * @private
3476 * @param {object} t Raw JSON theme
3477 */
3478 setTheme(t, name) {
3479 resolvedThemeJSON = setTheme(t, styleResolver.resolveRawTheme);
3480 styleResolverInstanceCache = {};
3481 paletteResolver = theme$1(resolvedThemeJSON); // try to determine if the theme color is light or dark
3482
3483 const textColor = externalAPI.getStyle('', '', 'color');
3484 const textColorLuminance = luminance(textColor); // if it appears dark, create an inverse that is light and vice versa
3485
3486 const inverseTextColor = textColorLuminance < 0.2 ? '#ffffff' : '#333333'; // instantiate a contraster that uses those two colors when determining the best contrast for an arbitrary color
3487
3488 contraster = colorFn([textColor, inverseTextColor]);
3489 externalAPI.emit('changed');
3490
3491 externalAPI.name = () => name;
3492 }
3493
3494 };
3495 Object.keys(nodeEventEmitter.prototype).forEach(key => {
3496 externalAPI[key] = nodeEventEmitter.prototype[key];
3497 });
3498 nodeEventEmitter.init(externalAPI);
3499 internalAPI.setTheme({}, 'light');
3500 return {
3501 externalAPI,
3502 internalAPI
3503 };
3504 }
3505
3506 /* eslint no-underscore-dangle:0 */
3507
3508 const timed = (t, v) => new Promise(resolve => {
3509 setTimeout(() => resolve(v), t);
3510 });
3511
3512 const LOAD_THEME_TIMEOUT = 5000;
3513 function appTheme() {
3514 let {
3515 themes = [],
3516 root
3517 } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3518 const wrappedTheme = theme();
3519
3520 const setTheme = async themeId => {
3521 const found = themes.filter(t => t.id === themeId)[0];
3522 let muiTheme = themeId === 'dark' ? 'dark' : 'light';
3523
3524 if (found && found.load) {
3525 try {
3526 const raw = await Promise.race([found.load(), timed(LOAD_THEME_TIMEOUT, {
3527 __timedOut: true
3528 })]);
3529
3530 if (raw.__timedOut) {
3531 if (true) {
3532 console.warn("Timeout when loading theme '".concat(themeId, "'")); // eslint-disable-line no-console
3533 }
3534 } else {
3535 muiTheme = raw.type === 'dark' ? 'dark' : 'light';
3536 wrappedTheme.internalAPI.setTheme(raw, themeId);
3537 root.setMuiThemeName(muiTheme);
3538 }
3539 } catch (e) {
3540 {
3541 console.error(e); // eslint-disable-line no-console
3542 }
3543 }
3544 } else {
3545 wrappedTheme.internalAPI.setTheme({
3546 type: muiTheme
3547 }, themeId);
3548 root.setMuiThemeName(muiTheme);
3549 }
3550 };
3551
3552 return {
3553 setTheme,
3554 externalAPI: wrappedTheme.externalAPI
3555 };
3556 }
3557
3558 // from https://patrickhlauke.github.io/touch/touchscreen-detection/ (MIT License)
3559 function detectTouchscreen() {
3560 let result = false;
3561
3562 if (window.PointerEvent && 'maxTouchPoints' in navigator) {
3563 // if Pointer Events are supported, just check maxTouchPoints
3564 if (navigator.maxTouchPoints > 0) {
3565 result = true;
3566 }
3567 } else if (window.matchMedia && window.matchMedia('(any-pointer:coarse)').matches) {
3568 // check for any-pointer:coarse which mostly means touchscreen
3569 result = true;
3570 } else if (window.TouchEvent || 'ontouchstart' in window) {
3571 // last resort - check for exposed touch events API / event handler
3572 result = true;
3573 }
3574
3575 return result;
3576 }
3577
3578 function deviceTypeFn(deviceType) {
3579 if (deviceType !== 'auto') {
3580 return deviceType;
3581 }
3582
3583 return detectTouchscreen() ? 'touch' : 'desktop';
3584 }
3585
3586 var react = {exports: {}};
3587
3588 var react_production_min = {};
3589
3590 /*
3591 object-assign
3592 (c) Sindre Sorhus
3593 @license MIT
3594 */
3595 /* eslint-disable no-unused-vars */
3596 var getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
3597 var hasOwnProperty = Object.prototype.hasOwnProperty;
3598 var propIsEnumerable = Object.prototype.propertyIsEnumerable;
3599
3600 function toObject(val) {
3601 if (val === null || val === undefined) {
3602 throw new TypeError('Object.assign cannot be called with null or undefined');
3603 }
3604
3605 return Object(val);
3606 }
3607
3608 function shouldUseNative() {
3609 try {
3610 if (!Object.assign) {
3611 return false;
3612 }
3613
3614 // Detect buggy property enumeration order in older V8 versions.
3615
3616 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
3617 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
3618 test1[5] = 'de';
3619 if (Object.getOwnPropertyNames(test1)[0] === '5') {
3620 return false;
3621 }
3622
3623 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3624 var test2 = {};
3625 for (var i = 0; i < 10; i++) {
3626 test2['_' + String.fromCharCode(i)] = i;
3627 }
3628 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
3629 return test2[n];
3630 });
3631 if (order2.join('') !== '0123456789') {
3632 return false;
3633 }
3634
3635 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3636 var test3 = {};
3637 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
3638 test3[letter] = letter;
3639 });
3640 if (Object.keys(Object.assign({}, test3)).join('') !==
3641 'abcdefghijklmnopqrst') {
3642 return false;
3643 }
3644
3645 return true;
3646 } catch (err) {
3647 // We don't expect any of the above to throw, but better to be safe.
3648 return false;
3649 }
3650 }
3651
3652 var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
3653 var from;
3654 var to = toObject(target);
3655 var symbols;
3656
3657 for (var s = 1; s < arguments.length; s++) {
3658 from = Object(arguments[s]);
3659
3660 for (var key in from) {
3661 if (hasOwnProperty.call(from, key)) {
3662 to[key] = from[key];
3663 }
3664 }
3665
3666 if (getOwnPropertySymbols$1) {
3667 symbols = getOwnPropertySymbols$1(from);
3668 for (var i = 0; i < symbols.length; i++) {
3669 if (propIsEnumerable.call(from, symbols[i])) {
3670 to[symbols[i]] = from[symbols[i]];
3671 }
3672 }
3673 }
3674 }
3675
3676 return to;
3677 };
3678
3679 /** @license React v17.0.2
3680 * react.production.min.js
3681 *
3682 * Copyright (c) Facebook, Inc. and its affiliates.
3683 *
3684 * This source code is licensed under the MIT license found in the
3685 * LICENSE file in the root directory of this source tree.
3686 */
3687 var l$1=objectAssign,n$1=60103,p$1=60106;react_production_min.Fragment=60107;react_production_min.StrictMode=60108;react_production_min.Profiler=60114;var q$1=60109,r$2=60110,t=60112;react_production_min.Suspense=60113;var u$1=60115,v$1=60116;
3688 if("function"===typeof Symbol&&Symbol.for){var w$1=Symbol.for;n$1=w$1("react.element");p$1=w$1("react.portal");react_production_min.Fragment=w$1("react.fragment");react_production_min.StrictMode=w$1("react.strict_mode");react_production_min.Profiler=w$1("react.profiler");q$1=w$1("react.provider");r$2=w$1("react.context");t=w$1("react.forward_ref");react_production_min.Suspense=w$1("react.suspense");u$1=w$1("react.memo");v$1=w$1("react.lazy");}var x$1="function"===typeof Symbol&&Symbol.iterator;
3689 function y$2(a){if(null===a||"object"!==typeof a)return null;a=x$1&&a[x$1]||a["@@iterator"];return "function"===typeof a?a:null}function z$1(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return "Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
3690 var A$1={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B$2={};function C$1(a,b,c){this.props=a;this.context=b;this.refs=B$2;this.updater=c||A$1;}C$1.prototype.isReactComponent={};C$1.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error(z$1(85));this.updater.enqueueSetState(this,a,b,"setState");};C$1.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};
3691 function D$2(){}D$2.prototype=C$1.prototype;function E$2(a,b,c){this.props=a;this.context=b;this.refs=B$2;this.updater=c||A$1;}var F$2=E$2.prototype=new D$2;F$2.constructor=E$2;l$1(F$2,C$1.prototype);F$2.isPureReactComponent=!0;var G$2={current:null},H$2=Object.prototype.hasOwnProperty,I$2={key:!0,ref:!0,__self:!0,__source:!0};
3692 function J(a,b,c){var e,d={},k=null,h=null;if(null!=b)for(e in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)H$2.call(b,e)&&!I$2.hasOwnProperty(e)&&(d[e]=b[e]);var g=arguments.length-2;if(1===g)d.children=c;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];d.children=f;}if(a&&a.defaultProps)for(e in g=a.defaultProps,g)void 0===d[e]&&(d[e]=g[e]);return {$$typeof:n$1,type:a,key:k,ref:h,props:d,_owner:G$2.current}}
3693 function K(a,b){return {$$typeof:n$1,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function L(a){return "object"===typeof a&&null!==a&&a.$$typeof===n$1}function escape$1(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var M$1=/\/+/g;function N$1(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape$1(""+a.key):b.toString(36)}
3694 function O$1(a,b,c,e,d){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case n$1:case p$1:h=!0;}}if(h)return h=a,d=d(h),a=""===e?"."+N$1(h,0):e,Array.isArray(d)?(c="",null!=a&&(c=a.replace(M$1,"$&/")+"/"),O$1(d,b,c,"",function(a){return a})):null!=d&&(L(d)&&(d=K(d,c+(!d.key||h&&h.key===d.key?"":(""+d.key).replace(M$1,"$&/")+"/")+a)),b.push(d)),1;h=0;e=""===e?".":e+":";if(Array.isArray(a))for(var g=
3695 0;g<a.length;g++){k=a[g];var f=e+N$1(k,g);h+=O$1(k,b,c,f,d);}else if(f=y$2(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=e+N$1(k,g++),h+=O$1(k,b,c,f,d);else if("object"===k)throw b=""+a,Error(z$1(31,"[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b));return h}function P$1(a,b,c){if(null==a)return a;var e=[],d=0;O$1(a,e,"","",function(a){return b.call(c,a,d++)});return e}
3696 function Q(a){if(-1===a._status){var b=a._result;b=b();a._status=0;a._result=b;b.then(function(b){0===a._status&&(b=b.default,a._status=1,a._result=b);},function(b){0===a._status&&(a._status=2,a._result=b);});}if(1===a._status)return a._result;throw a._result;}var R$1={current:null};function S$1(){var a=R$1.current;if(null===a)throw Error(z$1(321));return a}var T$1={ReactCurrentDispatcher:R$1,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:G$2,IsSomeRendererActing:{current:!1},assign:l$1};
3697 react_production_min.Children={map:P$1,forEach:function(a,b,c){P$1(a,function(){b.apply(this,arguments);},c);},count:function(a){var b=0;P$1(a,function(){b++;});return b},toArray:function(a){return P$1(a,function(a){return a})||[]},only:function(a){if(!L(a))throw Error(z$1(143));return a}};react_production_min.Component=C$1;react_production_min.PureComponent=E$2;react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T$1;
3698 react_production_min.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(z$1(267,a));var e=l$1({},a.props),d=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=G$2.current);void 0!==b.key&&(d=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)H$2.call(b,f)&&!I$2.hasOwnProperty(f)&&(e[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)e.children=c;else if(1<f){g=Array(f);for(var m=0;m<f;m++)g[m]=arguments[m+2];e.children=g;}return {$$typeof:n$1,type:a.type,
3699 key:d,ref:k,props:e,_owner:h}};react_production_min.createContext=function(a,b){void 0===b&&(b=null);a={$$typeof:r$2,_calculateChangedBits:b,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:q$1,_context:a};return a.Consumer=a};react_production_min.createElement=J;react_production_min.createFactory=function(a){var b=J.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}};react_production_min.forwardRef=function(a){return {$$typeof:t,render:a}};react_production_min.isValidElement=L;
3700 react_production_min.lazy=function(a){return {$$typeof:v$1,_payload:{_status:-1,_result:a},_init:Q}};react_production_min.memo=function(a,b){return {$$typeof:u$1,type:a,compare:void 0===b?null:b}};react_production_min.useCallback=function(a,b){return S$1().useCallback(a,b)};react_production_min.useContext=function(a,b){return S$1().useContext(a,b)};react_production_min.useDebugValue=function(){};react_production_min.useEffect=function(a,b){return S$1().useEffect(a,b)};react_production_min.useImperativeHandle=function(a,b,c){return S$1().useImperativeHandle(a,b,c)};
3701 react_production_min.useLayoutEffect=function(a,b){return S$1().useLayoutEffect(a,b)};react_production_min.useMemo=function(a,b){return S$1().useMemo(a,b)};react_production_min.useReducer=function(a,b,c){return S$1().useReducer(a,b,c)};react_production_min.useRef=function(a){return S$1().useRef(a)};react_production_min.useState=function(a){return S$1().useState(a)};react_production_min.version="17.0.2";
3702
3703 (function (module) {
3704
3705 {
3706 module.exports = react_production_min;
3707 }
3708 } (react));
3709
3710 var React = /*@__PURE__*/getDefaultExportFromCjs(react.exports);
3711
3712 var reactDom = {exports: {}};
3713
3714 var reactDom_production_min = {};
3715
3716 var scheduler = {exports: {}};
3717
3718 var scheduler_production_min = {};
3719
3720 /** @license React v0.20.2
3721 * scheduler.production.min.js
3722 *
3723 * Copyright (c) Facebook, Inc. and its affiliates.
3724 *
3725 * This source code is licensed under the MIT license found in the
3726 * LICENSE file in the root directory of this source tree.
3727 */
3728
3729 (function (exports) {
3730 var f,g,h,k;if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()};}else {var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q};}
3731 if("undefined"===typeof window||"function"!==typeof MessageChannel){var t=null,u=null,w=function(){if(null!==t)try{var a=exports.unstable_now();t(!0,a);t=null;}catch(b){throw setTimeout(w,0),b;}};f=function(a){null!==t?setTimeout(f,0,a):(t=a,setTimeout(w,0));};g=function(a,b){u=setTimeout(a,b);};h=function(){clearTimeout(u);};exports.unstable_shouldYield=function(){return !1};k=exports.unstable_forceFrameRate=function(){};}else {var x=window.setTimeout,y=window.clearTimeout;if("undefined"!==typeof console){var z=
3732 window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");"function"!==typeof z&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");}var A=!1,B=null,C=-1,D=5,E=0;exports.unstable_shouldYield=function(){return exports.unstable_now()>=
3733 E};k=function(){};exports.unstable_forceFrameRate=function(a){0>a||125<a?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<a?Math.floor(1E3/a):5;};var F=new MessageChannel,G=F.port2;F.port1.onmessage=function(){if(null!==B){var a=exports.unstable_now();E=a+D;try{B(!0,a)?G.postMessage(null):(A=!1,B=null);}catch(b){throw G.postMessage(null),b;}}else A=!1;};f=function(a){B=a;A||(A=!0,G.postMessage(null));};g=function(a,b){C=
3734 x(function(){a(exports.unstable_now());},b);};h=function(){y(C);C=-1;};}function H(a,b){var c=a.length;a.push(b);a:for(;;){var d=c-1>>>1,e=a[d];if(void 0!==e&&0<I(e,b))a[d]=b,a[c]=e,c=d;else break a}}function J(a){a=a[0];return void 0===a?null:a}
3735 function K(a){var b=a[0];if(void 0!==b){var c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length;d<e;){var m=2*(d+1)-1,n=a[m],v=m+1,r=a[v];if(void 0!==n&&0>I(n,c))void 0!==r&&0>I(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>I(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function I(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var L=[],M=[],N=1,O=null,P=3,Q=!1,R=!1,S=!1;
3736 function T(a){for(var b=J(M);null!==b;){if(null===b.callback)K(M);else if(b.startTime<=a)K(M),b.sortIndex=b.expirationTime,H(L,b);else break;b=J(M);}}function U(a){S=!1;T(a);if(!R)if(null!==J(L))R=!0,f(V);else {var b=J(M);null!==b&&g(U,b.startTime-a);}}
3737 function V(a,b){R=!1;S&&(S=!1,h());Q=!0;var c=P;try{T(b);for(O=J(L);null!==O&&(!(O.expirationTime>b)||a&&!exports.unstable_shouldYield());){var d=O.callback;if("function"===typeof d){O.callback=null;P=O.priorityLevel;var e=d(O.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?O.callback=e:O===J(L)&&K(L);T(b);}else K(L);O=J(L);}if(null!==O)var m=!0;else {var n=J(M);null!==n&&g(U,n.startTime-b);m=!1;}return m}finally{O=null,P=c,Q=!1;}}var W=k;exports.unstable_IdlePriority=5;
3738 exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null;};exports.unstable_continueExecution=function(){R||Q||(R=!0,f(V));};exports.unstable_getCurrentPriorityLevel=function(){return P};exports.unstable_getFirstCallbackNode=function(){return J(L)};
3739 exports.unstable_next=function(a){switch(P){case 1:case 2:case 3:var b=3;break;default:b=P;}var c=P;P=b;try{return a()}finally{P=c;}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=W;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3;}var c=P;P=a;try{return b()}finally{P=c;}};
3740 exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0<c?d+c:d):c=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3;}e=c+e;a={id:N++,callback:b,priorityLevel:a,startTime:c,expirationTime:e,sortIndex:-1};c>d?(a.sortIndex=c,H(M,a),null===J(L)&&a===J(M)&&(S?h():S=!0,g(U,c-d))):(a.sortIndex=e,H(L,a),R||Q||(R=!0,f(V)));return a};
3741 exports.unstable_wrapCallback=function(a){var b=P;return function(){var c=P;P=b;try{return a.apply(this,arguments)}finally{P=c;}}};
3742 } (scheduler_production_min));
3743
3744 (function (module) {
3745
3746 {
3747 module.exports = scheduler_production_min;
3748 }
3749 } (scheduler));
3750
3751 /** @license React v17.0.2
3752 * react-dom.production.min.js
3753 *
3754 * Copyright (c) Facebook, Inc. and its affiliates.
3755 *
3756 * This source code is licensed under the MIT license found in the
3757 * LICENSE file in the root directory of this source tree.
3758 */
3759 var aa=react.exports,m$1=objectAssign,r$1=scheduler.exports;function y$1(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return "Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!aa)throw Error(y$1(227));var ba=new Set,ca={};function da(a,b){ea(a,b);ea(a+"Capture",b);}
3760 function ea(a,b){ca[a]=b;for(a=0;a<b.length;a++)ba.add(b[a]);}
3761 var fa=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),ha=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ia=Object.prototype.hasOwnProperty,
3762 ja={},ka={};function la(a){if(ia.call(ka,a))return !0;if(ia.call(ja,a))return !1;if(ha.test(a))return ka[a]=!0;ja[a]=!0;return !1}function ma(a,b,c,d){if(null!==c&&0===c.type)return !1;switch(typeof b){case "function":case "symbol":return !0;case "boolean":if(d)return !1;if(null!==c)return !c.acceptsBooleans;a=a.toLowerCase().slice(0,5);return "data-"!==a&&"aria-"!==a;default:return !1}}
3763 function na(a,b,c,d){if(null===b||"undefined"===typeof b||ma(a,b,c,d))return !0;if(d)return !1;if(null!==c)switch(c.type){case 3:return !b;case 4:return !1===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return !1}function B$1(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g;}var D$1={};
3764 "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){D$1[a]=new B$1(a,0,!1,a,null,!1,!1);});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];D$1[b]=new B$1(b,1,!1,a[1],null,!1,!1);});["contentEditable","draggable","spellCheck","value"].forEach(function(a){D$1[a]=new B$1(a,2,!1,a.toLowerCase(),null,!1,!1);});
3765 ["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){D$1[a]=new B$1(a,2,!1,a,null,!1,!1);});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){D$1[a]=new B$1(a,3,!1,a.toLowerCase(),null,!1,!1);});
3766 ["checked","multiple","muted","selected"].forEach(function(a){D$1[a]=new B$1(a,3,!0,a,null,!1,!1);});["capture","download"].forEach(function(a){D$1[a]=new B$1(a,4,!1,a,null,!1,!1);});["cols","rows","size","span"].forEach(function(a){D$1[a]=new B$1(a,6,!1,a,null,!1,!1);});["rowSpan","start"].forEach(function(a){D$1[a]=new B$1(a,5,!1,a.toLowerCase(),null,!1,!1);});var oa=/[\-:]([a-z])/g;function pa(a){return a[1].toUpperCase()}
3767 "accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(oa,
3768 pa);D$1[b]=new B$1(b,1,!1,a,null,!1,!1);});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(oa,pa);D$1[b]=new B$1(b,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1);});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(oa,pa);D$1[b]=new B$1(b,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1);});["tabIndex","crossOrigin"].forEach(function(a){D$1[a]=new B$1(a,1,!1,a.toLowerCase(),null,!1,!1);});
3769 D$1.xlinkHref=new B$1("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(a){D$1[a]=new B$1(a,1,!1,a.toLowerCase(),null,!0,!0);});
3770 function qa(a,b,c,d){var e=D$1.hasOwnProperty(b)?D$1[b]:null;var f=null!==e?0===e.type:d?!1:!(2<b.length)||"o"!==b[0]&&"O"!==b[0]||"n"!==b[1]&&"N"!==b[1]?!1:!0;f||(na(b,c,e,d)&&(c=null),d||null===e?la(b)&&(null===c?a.removeAttribute(b):a.setAttribute(b,""+c)):e.mustUseProperty?a[e.propertyName]=null===c?3===e.type?!1:"":c:(b=e.attributeName,d=e.attributeNamespace,null===c?a.removeAttribute(b):(e=e.type,c=3===e||4===e&&!0===c?"":""+c,d?a.setAttributeNS(d,b,c):a.setAttribute(b,c))));}
3771 var ra=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,sa=60103,ta=60106,ua=60107,wa=60108,xa=60114,ya=60109,za=60110,Aa=60112,Ba=60113,Ca=60120,Da=60115,Ea=60116,Fa=60121,Ga=60128,Ha=60129,Ia=60130,Ja=60131;
3772 if("function"===typeof Symbol&&Symbol.for){var E$1=Symbol.for;sa=E$1("react.element");ta=E$1("react.portal");ua=E$1("react.fragment");wa=E$1("react.strict_mode");xa=E$1("react.profiler");ya=E$1("react.provider");za=E$1("react.context");Aa=E$1("react.forward_ref");Ba=E$1("react.suspense");Ca=E$1("react.suspense_list");Da=E$1("react.memo");Ea=E$1("react.lazy");Fa=E$1("react.block");E$1("react.scope");Ga=E$1("react.opaque.id");Ha=E$1("react.debug_trace_mode");Ia=E$1("react.offscreen");Ja=E$1("react.legacy_hidden");}
3773 var Ka="function"===typeof Symbol&&Symbol.iterator;function La(a){if(null===a||"object"!==typeof a)return null;a=Ka&&a[Ka]||a["@@iterator"];return "function"===typeof a?a:null}var Ma;function Na(a){if(void 0===Ma)try{throw Error();}catch(c){var b=c.stack.trim().match(/\n( *(at )?)/);Ma=b&&b[1]||"";}return "\n"+Ma+a}var Oa=!1;
3774 function Pa(a,b){if(!a||Oa)return "";Oa=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(b)if(b=function(){throw Error();},Object.defineProperty(b.prototype,"props",{set:function(){throw Error();}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(b,[]);}catch(k){var d=k;}Reflect.construct(a,[],b);}else {try{b.call();}catch(k){d=k;}a.call(b.prototype);}else {try{throw Error();}catch(k){d=k;}a();}}catch(k){if(k&&d&&"string"===typeof k.stack){for(var e=k.stack.split("\n"),
3775 f=d.stack.split("\n"),g=e.length-1,h=f.length-1;1<=g&&0<=h&&e[g]!==f[h];)h--;for(;1<=g&&0<=h;g--,h--)if(e[g]!==f[h]){if(1!==g||1!==h){do if(g--,h--,0>h||e[g]!==f[h])return "\n"+e[g].replace(" at new "," at ");while(1<=g&&0<=h)}break}}}finally{Oa=!1,Error.prepareStackTrace=c;}return (a=a?a.displayName||a.name:"")?Na(a):""}
3776 function Qa(a){switch(a.tag){case 5:return Na(a.type);case 16:return Na("Lazy");case 13:return Na("Suspense");case 19:return Na("SuspenseList");case 0:case 2:case 15:return a=Pa(a.type,!1),a;case 11:return a=Pa(a.type.render,!1),a;case 22:return a=Pa(a.type._render,!1),a;case 1:return a=Pa(a.type,!0),a;default:return ""}}
3777 function Ra(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case ua:return "Fragment";case ta:return "Portal";case xa:return "Profiler";case wa:return "StrictMode";case Ba:return "Suspense";case Ca:return "SuspenseList"}if("object"===typeof a)switch(a.$$typeof){case za:return (a.displayName||"Context")+".Consumer";case ya:return (a._context.displayName||"Context")+".Provider";case Aa:var b=a.render;b=b.displayName||b.name||"";
3778 return a.displayName||(""!==b?"ForwardRef("+b+")":"ForwardRef");case Da:return Ra(a.type);case Fa:return Ra(a._render);case Ea:b=a._payload;a=a._init;try{return Ra(a(b))}catch(c){}}return null}function Sa(a){switch(typeof a){case "boolean":case "number":case "object":case "string":case "undefined":return a;default:return ""}}function Ta(a){var b=a.type;return (a=a.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===b||"radio"===b)}
3779 function Ua(a){var b=Ta(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=""+a[b];if(!a.hasOwnProperty(b)&&"undefined"!==typeof c&&"function"===typeof c.get&&"function"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=""+a;f.call(this,a);}});Object.defineProperty(a,b,{enumerable:c.enumerable});return {getValue:function(){return d},setValue:function(a){d=""+a;},stopTracking:function(){a._valueTracker=
3780 null;delete a[b];}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a));}function Wa(a){if(!a)return !1;var b=a._valueTracker;if(!b)return !0;var c=b.getValue();var d="";a&&(d=Ta(a)?a.checked?"true":"false":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||("undefined"!==typeof document?document:void 0);if("undefined"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}
3781 function Ya(a,b){var c=b.checked;return m$1({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?"":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:"checkbox"===b.type||"radio"===b.type?null!=b.checked:null!=b.value};}function $a(a,b){b=b.checked;null!=b&&qa(a,"checked",b,!1);}
3782 function ab(a,b){$a(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if("number"===d){if(0===c&&""===a.value||a.value!=c)a.value=""+c;}else a.value!==""+c&&(a.value=""+c);else if("submit"===d||"reset"===d){a.removeAttribute("value");return}b.hasOwnProperty("value")?bb(a,b.type,c):b.hasOwnProperty("defaultValue")&&bb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked);}
3783 function cb(a,b,c){if(b.hasOwnProperty("value")||b.hasOwnProperty("defaultValue")){var d=b.type;if(!("submit"!==d&&"reset"!==d||void 0!==b.value&&null!==b.value))return;b=""+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b;}c=a.name;""!==c&&(a.name="");a.defaultChecked=!!a._wrapperState.initialChecked;""!==c&&(a.name=c);}
3784 function bb(a,b,c){if("number"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+c&&(a.defaultValue=""+c);}function db(a){var b="";aa.Children.forEach(a,function(a){null!=a&&(b+=a);});return b}function eb(a,b){a=m$1({children:void 0},b);if(b=db(b.children))a.children=b;return a}
3785 function fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e<c.length;e++)b["$"+c[e]]=!0;for(c=0;c<a.length;c++)e=b.hasOwnProperty("$"+a[c].value),a[c].selected!==e&&(a[c].selected=e),e&&d&&(a[c].defaultSelected=!0);}else {c=""+Sa(c);b=null;for(e=0;e<a.length;e++){if(a[e].value===c){a[e].selected=!0;d&&(a[e].defaultSelected=!0);return}null!==b||a[e].disabled||(b=a[e]);}null!==b&&(b.selected=!0);}}
3786 function gb(a,b){if(null!=b.dangerouslySetInnerHTML)throw Error(y$1(91));return m$1({},b,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function hb(a,b){var c=b.value;if(null==c){c=b.children;b=b.defaultValue;if(null!=c){if(null!=b)throw Error(y$1(92));if(Array.isArray(c)){if(!(1>=c.length))throw Error(y$1(93));c=c[0];}b=c;}null==b&&(b="");c=b;}a._wrapperState={initialValue:Sa(c)};}
3787 function ib(a,b){var c=Sa(b.value),d=Sa(b.defaultValue);null!=c&&(c=""+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=""+d);}function jb(a){var b=a.textContent;b===a._wrapperState.initialValue&&""!==b&&null!==b&&(a.value=b);}var kb={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};
3788 function lb(a){switch(a){case "svg":return "http://www.w3.org/2000/svg";case "math":return "http://www.w3.org/1998/Math/MathML";default:return "http://www.w3.org/1999/xhtml"}}function mb(a,b){return null==a||"http://www.w3.org/1999/xhtml"===a?lb(b):"http://www.w3.org/2000/svg"===a&&"foreignObject"===b?"http://www.w3.org/1999/xhtml":a}
3789 var nb,ob=function(a){return "undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)});}:a}(function(a,b){if(a.namespaceURI!==kb.svg||"innerHTML"in a)a.innerHTML=b;else {nb=nb||document.createElement("div");nb.innerHTML="<svg>"+b.valueOf().toString()+"</svg>";for(b=nb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild);}});
3790 function pb(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b;}
3791 var qb={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,
3792 floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rb=["Webkit","ms","Moz","O"];Object.keys(qb).forEach(function(a){rb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);qb[b]=qb[a];});});function sb(a,b,c){return null==b||"boolean"===typeof b||""===b?"":c||"number"!==typeof b||0===b||qb.hasOwnProperty(a)&&qb[a]?(""+b).trim():b+"px"}
3793 function tb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf("--"),e=sb(c,b[c],d);"float"===c&&(c="cssFloat");d?a.setProperty(c,e):a[c]=e;}}var ub=m$1({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});
3794 function vb(a,b){if(b){if(ub[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(y$1(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(y$1(60));if(!("object"===typeof b.dangerouslySetInnerHTML&&"__html"in b.dangerouslySetInnerHTML))throw Error(y$1(61));}if(null!=b.style&&"object"!==typeof b.style)throw Error(y$1(62));}}
3795 function wb(a,b){if(-1===a.indexOf("-"))return "string"===typeof b.is;switch(a){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":return !1;default:return !0}}function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;
3796 function Bb(a){if(a=Cb(a)){if("function"!==typeof yb)throw Error(y$1(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b));}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a;}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a<b.length;a++)Bb(b[a]);}}function Gb(a,b){return a(b)}function Hb(a,b,c,d,e){return a(b,c,d,e)}function Ib(){}var Jb=Gb,Kb=!1,Lb=!1;function Mb(){if(null!==zb||null!==Ab)Ib(),Fb();}
3797 function Nb(a,b,c){if(Lb)return a(b,c);Lb=!0;try{return Jb(a,b,c)}finally{Lb=!1,Mb();}}
3798 function Ob(a,b){var c=a.stateNode;if(null===c)return null;var d=Db(c);if(null===d)return null;c=d[b];a:switch(b){case "onClick":case "onClickCapture":case "onDoubleClick":case "onDoubleClickCapture":case "onMouseDown":case "onMouseDownCapture":case "onMouseMove":case "onMouseMoveCapture":case "onMouseUp":case "onMouseUpCapture":case "onMouseEnter":(d=!d.disabled)||(a=a.type,d=!("button"===a||"input"===a||"select"===a||"textarea"===a));a=!d;break a;default:a=!1;}if(a)return null;if(c&&"function"!==
3799 typeof c)throw Error(y$1(231,b,typeof c));return c}var Pb=!1;if(fa)try{var Qb={};Object.defineProperty(Qb,"passive",{get:function(){Pb=!0;}});window.addEventListener("test",Qb,Qb);window.removeEventListener("test",Qb,Qb);}catch(a){Pb=!1;}function Rb(a,b,c,d,e,f,g,h,k){var l=Array.prototype.slice.call(arguments,3);try{b.apply(c,l);}catch(n){this.onError(n);}}var Sb=!1,Tb=null,Ub=!1,Vb=null,Wb={onError:function(a){Sb=!0;Tb=a;}};function Xb(a,b,c,d,e,f,g,h,k){Sb=!1;Tb=null;Rb.apply(Wb,arguments);}
3800 function Yb(a,b,c,d,e,f,g,h,k){Xb.apply(this,arguments);if(Sb){if(Sb){var l=Tb;Sb=!1;Tb=null;}else throw Error(y$1(198));Ub||(Ub=!0,Vb=l);}}function Zb(a){var b=a,c=a;if(a.alternate)for(;b.return;)b=b.return;else {a=b;do b=a,0!==(b.flags&1026)&&(c=b.return),a=b.return;while(a)}return 3===b.tag?c:null}function $b(a){if(13===a.tag){var b=a.memoizedState;null===b&&(a=a.alternate,null!==a&&(b=a.memoizedState));if(null!==b)return b.dehydrated}return null}function ac(a){if(Zb(a)!==a)throw Error(y$1(188));}
3801 function bc(a){var b=a.alternate;if(!b){b=Zb(a);if(null===b)throw Error(y$1(188));return b!==a?null:a}for(var c=a,d=b;;){var e=c.return;if(null===e)break;var f=e.alternate;if(null===f){d=e.return;if(null!==d){c=d;continue}break}if(e.child===f.child){for(f=e.child;f;){if(f===c)return ac(e),a;if(f===d)return ac(e),b;f=f.sibling;}throw Error(y$1(188));}if(c.return!==d.return)c=e,d=f;else {for(var g=!1,h=e.child;h;){if(h===c){g=!0;c=e;d=f;break}if(h===d){g=!0;d=e;c=f;break}h=h.sibling;}if(!g){for(h=f.child;h;){if(h===
3802 c){g=!0;c=f;d=e;break}if(h===d){g=!0;d=f;c=e;break}h=h.sibling;}if(!g)throw Error(y$1(189));}}if(c.alternate!==d)throw Error(y$1(190));}if(3!==c.tag)throw Error(y$1(188));return c.stateNode.current===c?a:b}function cc(a){a=bc(a);if(!a)return null;for(var b=a;;){if(5===b.tag||6===b.tag)return b;if(b.child)b.child.return=b,b=b.child;else {if(b===a)break;for(;!b.sibling;){if(!b.return||b.return===a)return null;b=b.return;}b.sibling.return=b.return;b=b.sibling;}}return null}
3803 function dc(a,b){for(var c=a.alternate;null!==b;){if(b===a||b===c)return !0;b=b.return;}return !1}var ec,fc,gc,hc,ic=!1,jc=[],kc=null,lc=null,mc=null,nc=new Map,oc=new Map,pc=[],qc="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");
3804 function rc(a,b,c,d,e){return {blockedOn:a,domEventName:b,eventSystemFlags:c|16,nativeEvent:e,targetContainers:[d]}}function sc(a,b){switch(a){case "focusin":case "focusout":kc=null;break;case "dragenter":case "dragleave":lc=null;break;case "mouseover":case "mouseout":mc=null;break;case "pointerover":case "pointerout":nc.delete(b.pointerId);break;case "gotpointercapture":case "lostpointercapture":oc.delete(b.pointerId);}}
3805 function tc(a,b,c,d,e,f){if(null===a||a.nativeEvent!==f)return a=rc(b,c,d,e,f),null!==b&&(b=Cb(b),null!==b&&fc(b)),a;a.eventSystemFlags|=d;b=a.targetContainers;null!==e&&-1===b.indexOf(e)&&b.push(e);return a}
3806 function uc(a,b,c,d,e){switch(b){case "focusin":return kc=tc(kc,a,b,c,d,e),!0;case "dragenter":return lc=tc(lc,a,b,c,d,e),!0;case "mouseover":return mc=tc(mc,a,b,c,d,e),!0;case "pointerover":var f=e.pointerId;nc.set(f,tc(nc.get(f)||null,a,b,c,d,e));return !0;case "gotpointercapture":return f=e.pointerId,oc.set(f,tc(oc.get(f)||null,a,b,c,d,e)),!0}return !1}
3807 function vc(a){var b=wc(a.target);if(null!==b){var c=Zb(b);if(null!==c)if(b=c.tag,13===b){if(b=$b(c),null!==b){a.blockedOn=b;hc(a.lanePriority,function(){r$1.unstable_runWithPriority(a.priority,function(){gc(c);});});return}}else if(3===b&&c.stateNode.hydrate){a.blockedOn=3===c.tag?c.stateNode.containerInfo:null;return}}a.blockedOn=null;}
3808 function xc(a){if(null!==a.blockedOn)return !1;for(var b=a.targetContainers;0<b.length;){var c=yc(a.domEventName,a.eventSystemFlags,b[0],a.nativeEvent);if(null!==c)return b=Cb(c),null!==b&&fc(b),a.blockedOn=c,!1;b.shift();}return !0}function zc(a,b,c){xc(a)&&c.delete(b);}
3809 function Ac(){for(ic=!1;0<jc.length;){var a=jc[0];if(null!==a.blockedOn){a=Cb(a.blockedOn);null!==a&&ec(a);break}for(var b=a.targetContainers;0<b.length;){var c=yc(a.domEventName,a.eventSystemFlags,b[0],a.nativeEvent);if(null!==c){a.blockedOn=c;break}b.shift();}null===a.blockedOn&&jc.shift();}null!==kc&&xc(kc)&&(kc=null);null!==lc&&xc(lc)&&(lc=null);null!==mc&&xc(mc)&&(mc=null);nc.forEach(zc);oc.forEach(zc);}
3810 function Bc(a,b){a.blockedOn===b&&(a.blockedOn=null,ic||(ic=!0,r$1.unstable_scheduleCallback(r$1.unstable_NormalPriority,Ac)));}
3811 function Cc(a){function b(b){return Bc(b,a)}if(0<jc.length){Bc(jc[0],a);for(var c=1;c<jc.length;c++){var d=jc[c];d.blockedOn===a&&(d.blockedOn=null);}}null!==kc&&Bc(kc,a);null!==lc&&Bc(lc,a);null!==mc&&Bc(mc,a);nc.forEach(b);oc.forEach(b);for(c=0;c<pc.length;c++)d=pc[c],d.blockedOn===a&&(d.blockedOn=null);for(;0<pc.length&&(c=pc[0],null===c.blockedOn);)vc(c),null===c.blockedOn&&pc.shift();}
3812 function Dc(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}var Ec={animationend:Dc("Animation","AnimationEnd"),animationiteration:Dc("Animation","AnimationIteration"),animationstart:Dc("Animation","AnimationStart"),transitionend:Dc("Transition","TransitionEnd")},Fc={},Gc={};
3813 fa&&(Gc=document.createElement("div").style,"AnimationEvent"in window||(delete Ec.animationend.animation,delete Ec.animationiteration.animation,delete Ec.animationstart.animation),"TransitionEvent"in window||delete Ec.transitionend.transition);function Hc(a){if(Fc[a])return Fc[a];if(!Ec[a])return a;var b=Ec[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in Gc)return Fc[a]=b[c];return a}
3814 var Ic=Hc("animationend"),Jc=Hc("animationiteration"),Kc=Hc("animationstart"),Lc=Hc("transitionend"),Mc=new Map,Nc=new Map,Oc=["abort","abort",Ic,"animationEnd",Jc,"animationIteration",Kc,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart",
3815 "lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Lc,"transitionEnd","waiting","waiting"];function Pc(a,b){for(var c=0;c<a.length;c+=2){var d=a[c],e=a[c+1];e="on"+(e[0].toUpperCase()+e.slice(1));Nc.set(d,b);Mc.set(d,e);da(e,[d]);}}var Qc=r$1.unstable_now;Qc();var F$1=8;
3816 function Rc(a){if(0!==(1&a))return F$1=15,1;if(0!==(2&a))return F$1=14,2;if(0!==(4&a))return F$1=13,4;var b=24&a;if(0!==b)return F$1=12,b;if(0!==(a&32))return F$1=11,32;b=192&a;if(0!==b)return F$1=10,b;if(0!==(a&256))return F$1=9,256;b=3584&a;if(0!==b)return F$1=8,b;if(0!==(a&4096))return F$1=7,4096;b=4186112&a;if(0!==b)return F$1=6,b;b=62914560&a;if(0!==b)return F$1=5,b;if(a&67108864)return F$1=4,67108864;if(0!==(a&134217728))return F$1=3,134217728;b=805306368&a;if(0!==b)return F$1=2,b;if(0!==(1073741824&a))return F$1=1,1073741824;
3817 F$1=8;return a}function Sc(a){switch(a){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function Tc(a){switch(a){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(y$1(358,a));}}
3818 function Uc(a,b){var c=a.pendingLanes;if(0===c)return F$1=0;var d=0,e=0,f=a.expiredLanes,g=a.suspendedLanes,h=a.pingedLanes;if(0!==f)d=f,e=F$1=15;else if(f=c&134217727,0!==f){var k=f&~g;0!==k?(d=Rc(k),e=F$1):(h&=f,0!==h&&(d=Rc(h),e=F$1));}else f=c&~g,0!==f?(d=Rc(f),e=F$1):0!==h&&(d=Rc(h),e=F$1);if(0===d)return 0;d=31-Vc(d);d=c&((0>d?0:1<<d)<<1)-1;if(0!==b&&b!==d&&0===(b&g)){Rc(b);if(e<=F$1)return b;F$1=e;}b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0<b;)c=31-Vc(b),e=1<<c,d|=a[c],b&=~e;return d}
3819 function Wc(a){a=a.pendingLanes&-1073741825;return 0!==a?a:a&1073741824?1073741824:0}function Xc(a,b){switch(a){case 15:return 1;case 14:return 2;case 12:return a=Yc(24&~b),0===a?Xc(10,b):a;case 10:return a=Yc(192&~b),0===a?Xc(8,b):a;case 8:return a=Yc(3584&~b),0===a&&(a=Yc(4186112&~b),0===a&&(a=512)),a;case 2:return b=Yc(805306368&~b),0===b&&(b=268435456),b}throw Error(y$1(358,a));}function Yc(a){return a&-a}function Zc(a){for(var b=[],c=0;31>c;c++)b.push(a);return b}
3820 function $c(a,b,c){a.pendingLanes|=b;var d=b-1;a.suspendedLanes&=d;a.pingedLanes&=d;a=a.eventTimes;b=31-Vc(b);a[b]=c;}var Vc=Math.clz32?Math.clz32:ad,bd=Math.log,cd=Math.LN2;function ad(a){return 0===a?32:31-(bd(a)/cd|0)|0}var dd=r$1.unstable_UserBlockingPriority,ed=r$1.unstable_runWithPriority,fd=!0;function gd(a,b,c,d){Kb||Ib();var e=hd,f=Kb;Kb=!0;try{Hb(e,a,b,c,d);}finally{(Kb=f)||Mb();}}function id(a,b,c,d){ed(dd,hd.bind(null,a,b,c,d));}
3821 function hd(a,b,c,d){if(fd){var e;if((e=0===(b&4))&&0<jc.length&&-1<qc.indexOf(a))a=rc(null,a,b,c,d),jc.push(a);else {var f=yc(a,b,c,d);if(null===f)e&&sc(a,d);else {if(e){if(-1<qc.indexOf(a)){a=rc(f,a,b,c,d);jc.push(a);return}if(uc(f,a,b,c,d))return;sc(a,d);}jd(a,b,d,null,c);}}}}
3822 function yc(a,b,c,d){var e=xb(d);e=wc(e);if(null!==e){var f=Zb(e);if(null===f)e=null;else {var g=f.tag;if(13===g){e=$b(f);if(null!==e)return e;e=null;}else if(3===g){if(f.stateNode.hydrate)return 3===f.tag?f.stateNode.containerInfo:null;e=null;}else f!==e&&(e=null);}}jd(a,b,d,e,c);return null}var kd=null,ld=null,md=null;
3823 function nd(){if(md)return md;var a,b=ld,c=b.length,d,e="value"in kd?kd.value:kd.textContent,f=e.length;for(a=0;a<c&&b[a]===e[a];a++);var g=c-a;for(d=1;d<=g&&b[c-d]===e[f-d];d++);return md=e.slice(a,1<d?1-d:void 0)}function od(a){var b=a.keyCode;"charCode"in a?(a=a.charCode,0===a&&13===b&&(a=13)):a=b;10===a&&(a=13);return 32<=a||13===a?a:0}function pd(){return !0}function qd(){return !1}
3824 function rd(a){function b(b,d,e,f,g){this._reactName=b;this._targetInst=e;this.type=d;this.nativeEvent=f;this.target=g;this.currentTarget=null;for(var c in a)a.hasOwnProperty(c)&&(b=a[c],this[c]=b?b(f):f[c]);this.isDefaultPrevented=(null!=f.defaultPrevented?f.defaultPrevented:!1===f.returnValue)?pd:qd;this.isPropagationStopped=qd;return this}m$1(b.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&
3825 (a.returnValue=!1),this.isDefaultPrevented=pd);},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=pd);},persist:function(){},isPersistent:pd});return b}
3826 var sd={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},td=rd(sd),ud=m$1({},sd,{view:0,detail:0}),vd=rd(ud),wd,xd,yd,Ad=m$1({},ud,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zd,button:0,buttons:0,relatedTarget:function(a){return void 0===a.relatedTarget?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){if("movementX"in
3827 a)return a.movementX;a!==yd&&(yd&&"mousemove"===a.type?(wd=a.screenX-yd.screenX,xd=a.screenY-yd.screenY):xd=wd=0,yd=a);return wd},movementY:function(a){return "movementY"in a?a.movementY:xd}}),Bd=rd(Ad),Cd=m$1({},Ad,{dataTransfer:0}),Dd=rd(Cd),Ed=m$1({},ud,{relatedTarget:0}),Fd=rd(Ed),Gd=m$1({},sd,{animationName:0,elapsedTime:0,pseudoElement:0}),Hd=rd(Gd),Id=m$1({},sd,{clipboardData:function(a){return "clipboardData"in a?a.clipboardData:window.clipboardData}}),Jd=rd(Id),Kd=m$1({},sd,{data:0}),Ld=rd(Kd),Md={Esc:"Escape",
3828 Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nd={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",
3829 119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Od={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pd(a){var b=this.nativeEvent;return b.getModifierState?b.getModifierState(a):(a=Od[a])?!!b[a]:!1}function zd(){return Pd}
3830 var Qd=m$1({},ud,{key:function(a){if(a.key){var b=Md[a.key]||a.key;if("Unidentified"!==b)return b}return "keypress"===a.type?(a=od(a),13===a?"Enter":String.fromCharCode(a)):"keydown"===a.type||"keyup"===a.type?Nd[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zd,charCode:function(a){return "keypress"===a.type?od(a):0},keyCode:function(a){return "keydown"===a.type||"keyup"===a.type?a.keyCode:0},which:function(a){return "keypress"===
3831 a.type?od(a):"keydown"===a.type||"keyup"===a.type?a.keyCode:0}}),Rd=rd(Qd),Sd=m$1({},Ad,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Td=rd(Sd),Ud=m$1({},ud,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zd}),Vd=rd(Ud),Wd=m$1({},sd,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xd=rd(Wd),Yd=m$1({},Ad,{deltaX:function(a){return "deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},
3832 deltaY:function(a){return "deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),Zd=rd(Yd),$d=[9,13,27,32],ae=fa&&"CompositionEvent"in window,be=null;fa&&"documentMode"in document&&(be=document.documentMode);var ce=fa&&"TextEvent"in window&&!be,de=fa&&(!ae||be&&8<be&&11>=be),ee=String.fromCharCode(32),fe=!1;
3833 function ge(a,b){switch(a){case "keyup":return -1!==$d.indexOf(b.keyCode);case "keydown":return 229!==b.keyCode;case "keypress":case "mousedown":case "focusout":return !0;default:return !1}}function he(a){a=a.detail;return "object"===typeof a&&"data"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case "compositionend":return he(b);case "keypress":if(32!==b.which)return null;fe=!0;return ee;case "textInput":return a=b.data,a===ee&&fe?null:a;default:return null}}
3834 function ke(a,b){if(ie)return "compositionend"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case "paste":return null;case "keypress":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1<b.char.length)return b.char;if(b.which)return String.fromCharCode(b.which)}return null;case "compositionend":return de&&"ko"!==b.locale?null:b.data;default:return null}}
3835 var le={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function me(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return "input"===b?!!le[a.type]:"textarea"===b?!0:!1}function ne(a,b,c,d){Eb(d);b=oe(b,"onChange");0<b.length&&(c=new td("onChange","change",null,c,d),a.push({event:c,listeners:b}));}var pe=null,qe=null;function re(a){se(a,0);}function te(a){var b=ue(a);if(Wa(b))return a}
3836 function ve(a,b){if("change"===a)return b}var we=!1;if(fa){var xe;if(fa){var ye="oninput"in document;if(!ye){var ze=document.createElement("div");ze.setAttribute("oninput","return;");ye="function"===typeof ze.oninput;}xe=ye;}else xe=!1;we=xe&&(!document.documentMode||9<document.documentMode);}function Ae(){pe&&(pe.detachEvent("onpropertychange",Be),qe=pe=null);}function Be(a){if("value"===a.propertyName&&te(qe)){var b=[];ne(b,qe,a,xb(a));a=re;if(Kb)a(b);else {Kb=!0;try{Gb(a,b);}finally{Kb=!1,Mb();}}}}
3837 function Ce(a,b,c){"focusin"===a?(Ae(),pe=b,qe=c,pe.attachEvent("onpropertychange",Be)):"focusout"===a&&Ae();}function De(a){if("selectionchange"===a||"keyup"===a||"keydown"===a)return te(qe)}function Ee(a,b){if("click"===a)return te(b)}function Fe(a,b){if("input"===a||"change"===a)return te(b)}function Ge(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var He="function"===typeof Object.is?Object.is:Ge,Ie=Object.prototype.hasOwnProperty;
3838 function Je(a,b){if(He(a,b))return !0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return !1;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return !1;for(d=0;d<c.length;d++)if(!Ie.call(b,c[d])||!He(a[c[d]],b[c[d]]))return !1;return !0}function Ke(a){for(;a&&a.firstChild;)a=a.firstChild;return a}
3839 function Le(a,b){var c=Ke(a);a=0;for(var d;c;){if(3===c.nodeType){d=a+c.textContent.length;if(a<=b&&d>=b)return {node:c,offset:b-a};a=d;}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode;}c=void 0;}c=Ke(c);}}function Me(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Me(a,b.parentNode):"contains"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}
3840 function Ne(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c="string"===typeof b.contentWindow.location.href;}catch(d){c=!1;}if(c)a=b.contentWindow;else break;b=Xa(a.document);}return b}function Oe(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&("text"===a.type||"search"===a.type||"tel"===a.type||"url"===a.type||"password"===a.type)||"textarea"===b||"true"===a.contentEditable)}
3841 var Pe=fa&&"documentMode"in document&&11>=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;
3842 function Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,"selectionStart"in d&&Oe(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Je(Se,d)||(Se=d,d=oe(Re,"onSelect"),0<d.length&&(b=new td("onSelect","select",null,b,c),a.push({event:b,listeners:d}),b.target=Qe)));}
3843 Pc("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),
3844 0);Pc("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1);Pc(Oc,2);for(var Ve="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),We=0;We<Ve.length;We++)Nc.set(Ve[We],0);ea("onMouseEnter",["mouseout","mouseover"]);
3845 ea("onMouseLeave",["mouseout","mouseover"]);ea("onPointerEnter",["pointerout","pointerover"]);ea("onPointerLeave",["pointerout","pointerover"]);da("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));da("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));da("onBeforeInput",["compositionend","keypress","textInput","paste"]);da("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));
3846 da("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));da("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xe="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ye=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xe));
3847 function Ze(a,b,c){var d=a.type||"unknown-event";a.currentTarget=c;Yb(d,b,void 0,a);a.currentTarget=null;}
3848 function se(a,b){b=0!==(b&4);for(var c=0;c<a.length;c++){var d=a[c],e=d.event;d=d.listeners;a:{var f=void 0;if(b)for(var g=d.length-1;0<=g;g--){var h=d[g],k=h.instance,l=h.currentTarget;h=h.listener;if(k!==f&&e.isPropagationStopped())break a;Ze(e,h,l);f=k;}else for(g=0;g<d.length;g++){h=d[g];k=h.instance;l=h.currentTarget;h=h.listener;if(k!==f&&e.isPropagationStopped())break a;Ze(e,h,l);f=k;}}}if(Ub)throw a=Vb,Ub=!1,Vb=null,a;}
3849 function G$1(a,b){var c=$e(b),d=a+"__bubble";c.has(d)||(af(b,a,2,!1),c.add(d));}var bf="_reactListening"+Math.random().toString(36).slice(2);function cf(a){a[bf]||(a[bf]=!0,ba.forEach(function(b){Ye.has(b)||df(b,!1,a,null);df(b,!0,a,null);}));}
3850 function df(a,b,c,d){var e=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,f=c;"selectionchange"===a&&9!==c.nodeType&&(f=c.ownerDocument);if(null!==d&&!b&&Ye.has(a)){if("scroll"!==a)return;e|=2;f=d;}var g=$e(f),h=a+"__"+(b?"capture":"bubble");g.has(h)||(b&&(e|=4),af(f,a,e,b),g.add(h));}
3851 function af(a,b,c,d){var e=Nc.get(b);switch(void 0===e?2:e){case 0:e=gd;break;case 1:e=id;break;default:e=hd;}c=e.bind(null,b,c,a);e=void 0;!Pb||"touchstart"!==b&&"touchmove"!==b&&"wheel"!==b||(e=!0);d?void 0!==e?a.addEventListener(b,c,{capture:!0,passive:e}):a.addEventListener(b,c,!0):void 0!==e?a.addEventListener(b,c,{passive:e}):a.addEventListener(b,c,!1);}
3852 function jd(a,b,c,d,e){var f=d;if(0===(b&1)&&0===(b&2)&&null!==d)a:for(;;){if(null===d)return;var g=d.tag;if(3===g||4===g){var h=d.stateNode.containerInfo;if(h===e||8===h.nodeType&&h.parentNode===e)break;if(4===g)for(g=d.return;null!==g;){var k=g.tag;if(3===k||4===k)if(k=g.stateNode.containerInfo,k===e||8===k.nodeType&&k.parentNode===e)return;g=g.return;}for(;null!==h;){g=wc(h);if(null===g)return;k=g.tag;if(5===k||6===k){d=f=g;continue a}h=h.parentNode;}}d=d.return;}Nb(function(){var d=f,e=xb(c),g=[];
3853 a:{var h=Mc.get(a);if(void 0!==h){var k=td,x=a;switch(a){case "keypress":if(0===od(c))break a;case "keydown":case "keyup":k=Rd;break;case "focusin":x="focus";k=Fd;break;case "focusout":x="blur";k=Fd;break;case "beforeblur":case "afterblur":k=Fd;break;case "click":if(2===c.button)break a;case "auxclick":case "dblclick":case "mousedown":case "mousemove":case "mouseup":case "mouseout":case "mouseover":case "contextmenu":k=Bd;break;case "drag":case "dragend":case "dragenter":case "dragexit":case "dragleave":case "dragover":case "dragstart":case "drop":k=
3854 Dd;break;case "touchcancel":case "touchend":case "touchmove":case "touchstart":k=Vd;break;case Ic:case Jc:case Kc:k=Hd;break;case Lc:k=Xd;break;case "scroll":k=vd;break;case "wheel":k=Zd;break;case "copy":case "cut":case "paste":k=Jd;break;case "gotpointercapture":case "lostpointercapture":case "pointercancel":case "pointerdown":case "pointermove":case "pointerout":case "pointerover":case "pointerup":k=Td;}var w=0!==(b&4),z=!w&&"scroll"===a,u=w?null!==h?h+"Capture":null:h;w=[];for(var t=d,q;null!==
3855 t;){q=t;var v=q.stateNode;5===q.tag&&null!==v&&(q=v,null!==u&&(v=Ob(t,u),null!=v&&w.push(ef(t,v,q))));if(z)break;t=t.return;}0<w.length&&(h=new k(h,x,null,c,e),g.push({event:h,listeners:w}));}}if(0===(b&7)){a:{h="mouseover"===a||"pointerover"===a;k="mouseout"===a||"pointerout"===a;if(h&&0===(b&16)&&(x=c.relatedTarget||c.fromElement)&&(wc(x)||x[ff]))break a;if(k||h){h=e.window===e?e:(h=e.ownerDocument)?h.defaultView||h.parentWindow:window;if(k){if(x=c.relatedTarget||c.toElement,k=d,x=x?wc(x):null,null!==
3856 x&&(z=Zb(x),x!==z||5!==x.tag&&6!==x.tag))x=null;}else k=null,x=d;if(k!==x){w=Bd;v="onMouseLeave";u="onMouseEnter";t="mouse";if("pointerout"===a||"pointerover"===a)w=Td,v="onPointerLeave",u="onPointerEnter",t="pointer";z=null==k?h:ue(k);q=null==x?h:ue(x);h=new w(v,t+"leave",k,c,e);h.target=z;h.relatedTarget=q;v=null;wc(e)===d&&(w=new w(u,t+"enter",x,c,e),w.target=q,w.relatedTarget=z,v=w);z=v;if(k&&x)b:{w=k;u=x;t=0;for(q=w;q;q=gf(q))t++;q=0;for(v=u;v;v=gf(v))q++;for(;0<t-q;)w=gf(w),t--;for(;0<q-t;)u=
3857 gf(u),q--;for(;t--;){if(w===u||null!==u&&w===u.alternate)break b;w=gf(w);u=gf(u);}w=null;}else w=null;null!==k&&hf(g,h,k,w,!1);null!==x&&null!==z&&hf(g,z,x,w,!0);}}}a:{h=d?ue(d):window;k=h.nodeName&&h.nodeName.toLowerCase();if("select"===k||"input"===k&&"file"===h.type)var J=ve;else if(me(h))if(we)J=Fe;else {J=De;var K=Ce;}else (k=h.nodeName)&&"input"===k.toLowerCase()&&("checkbox"===h.type||"radio"===h.type)&&(J=Ee);if(J&&(J=J(a,d))){ne(g,J,c,e);break a}K&&K(a,h,d);"focusout"===a&&(K=h._wrapperState)&&
3858 K.controlled&&"number"===h.type&&bb(h,"number",h.value);}K=d?ue(d):window;switch(a){case "focusin":if(me(K)||"true"===K.contentEditable)Qe=K,Re=d,Se=null;break;case "focusout":Se=Re=Qe=null;break;case "mousedown":Te=!0;break;case "contextmenu":case "mouseup":case "dragend":Te=!1;Ue(g,c,e);break;case "selectionchange":if(Pe)break;case "keydown":case "keyup":Ue(g,c,e);}var Q;if(ae)b:{switch(a){case "compositionstart":var L="onCompositionStart";break b;case "compositionend":L="onCompositionEnd";break b;
3859 case "compositionupdate":L="onCompositionUpdate";break b}L=void 0;}else ie?ge(a,c)&&(L="onCompositionEnd"):"keydown"===a&&229===c.keyCode&&(L="onCompositionStart");L&&(de&&"ko"!==c.locale&&(ie||"onCompositionStart"!==L?"onCompositionEnd"===L&&ie&&(Q=nd()):(kd=e,ld="value"in kd?kd.value:kd.textContent,ie=!0)),K=oe(d,L),0<K.length&&(L=new Ld(L,a,null,c,e),g.push({event:L,listeners:K}),Q?L.data=Q:(Q=he(c),null!==Q&&(L.data=Q))));if(Q=ce?je(a,c):ke(a,c))d=oe(d,"onBeforeInput"),0<d.length&&(e=new Ld("onBeforeInput",
3860 "beforeinput",null,c,e),g.push({event:e,listeners:d}),e.data=Q);}se(g,b);});}function ef(a,b,c){return {instance:a,listener:b,currentTarget:c}}function oe(a,b){for(var c=b+"Capture",d=[];null!==a;){var e=a,f=e.stateNode;5===e.tag&&null!==f&&(e=f,f=Ob(a,c),null!=f&&d.unshift(ef(a,f,e)),f=Ob(a,b),null!=f&&d.push(ef(a,f,e)));a=a.return;}return d}function gf(a){if(null===a)return null;do a=a.return;while(a&&5!==a.tag);return a?a:null}
3861 function hf(a,b,c,d,e){for(var f=b._reactName,g=[];null!==c&&c!==d;){var h=c,k=h.alternate,l=h.stateNode;if(null!==k&&k===d)break;5===h.tag&&null!==l&&(h=l,e?(k=Ob(c,f),null!=k&&g.unshift(ef(c,k,h))):e||(k=Ob(c,f),null!=k&&g.push(ef(c,k,h))));c=c.return;}0!==g.length&&a.push({event:b,listeners:g});}function jf(){}var kf=null,lf=null;function mf(a,b){switch(a){case "button":case "input":case "select":case "textarea":return !!b.autoFocus}return !1}
3862 function nf(a,b){return "textarea"===a||"option"===a||"noscript"===a||"string"===typeof b.children||"number"===typeof b.children||"object"===typeof b.dangerouslySetInnerHTML&&null!==b.dangerouslySetInnerHTML&&null!=b.dangerouslySetInnerHTML.__html}var of="function"===typeof setTimeout?setTimeout:void 0,pf="function"===typeof clearTimeout?clearTimeout:void 0;function qf(a){1===a.nodeType?a.textContent="":9===a.nodeType&&(a=a.body,null!=a&&(a.textContent=""));}
3863 function rf(a){for(;null!=a;a=a.nextSibling){var b=a.nodeType;if(1===b||3===b)break}return a}function sf(a){a=a.previousSibling;for(var b=0;a;){if(8===a.nodeType){var c=a.data;if("$"===c||"$!"===c||"$?"===c){if(0===b)return a;b--;}else "/$"===c&&b++;}a=a.previousSibling;}return null}var tf=0;function uf(a){return {$$typeof:Ga,toString:a,valueOf:a}}var vf=Math.random().toString(36).slice(2),wf="__reactFiber$"+vf,xf="__reactProps$"+vf,ff="__reactContainer$"+vf,yf="__reactEvents$"+vf;
3864 function wc(a){var b=a[wf];if(b)return b;for(var c=a.parentNode;c;){if(b=c[ff]||c[wf]){c=b.alternate;if(null!==b.child||null!==c&&null!==c.child)for(a=sf(a);null!==a;){if(c=a[wf])return c;a=sf(a);}return b}a=c;c=a.parentNode;}return null}function Cb(a){a=a[wf]||a[ff];return !a||5!==a.tag&&6!==a.tag&&13!==a.tag&&3!==a.tag?null:a}function ue(a){if(5===a.tag||6===a.tag)return a.stateNode;throw Error(y$1(33));}function Db(a){return a[xf]||null}
3865 function $e(a){var b=a[yf];void 0===b&&(b=a[yf]=new Set);return b}var zf=[],Af=-1;function Bf(a){return {current:a}}function H$1(a){0>Af||(a.current=zf[Af],zf[Af]=null,Af--);}function I$1(a,b){Af++;zf[Af]=a.current;a.current=b;}var Cf={},M=Bf(Cf),N=Bf(!1),Df=Cf;
3866 function Ef(a,b){var c=a.type.contextTypes;if(!c)return Cf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function Ff(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Gf(){H$1(N);H$1(M);}function Hf(a,b,c){if(M.current!==Cf)throw Error(y$1(168));I$1(M,b);I$1(N,c);}
3867 function If(a,b,c){var d=a.stateNode;a=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in a))throw Error(y$1(108,Ra(b)||"Unknown",e));return m$1({},c,d)}function Jf(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Cf;Df=M.current;I$1(M,a);I$1(N,N.current);return !0}function Kf(a,b,c){var d=a.stateNode;if(!d)throw Error(y$1(169));c?(a=If(a,b,Df),d.__reactInternalMemoizedMergedChildContext=a,H$1(N),H$1(M),I$1(M,a)):H$1(N);I$1(N,c);}
3868 var Lf=null,Mf=null,Nf=r$1.unstable_runWithPriority,Of=r$1.unstable_scheduleCallback,Pf=r$1.unstable_cancelCallback,Qf=r$1.unstable_shouldYield,Rf=r$1.unstable_requestPaint,Sf=r$1.unstable_now,Tf=r$1.unstable_getCurrentPriorityLevel,Uf=r$1.unstable_ImmediatePriority,Vf=r$1.unstable_UserBlockingPriority,Wf=r$1.unstable_NormalPriority,Xf=r$1.unstable_LowPriority,Yf=r$1.unstable_IdlePriority,Zf={},$f=void 0!==Rf?Rf:function(){},ag=null,bg=null,cg=!1,dg=Sf(),O=1E4>dg?Sf:function(){return Sf()-dg};
3869 function eg(){switch(Tf()){case Uf:return 99;case Vf:return 98;case Wf:return 97;case Xf:return 96;case Yf:return 95;default:throw Error(y$1(332));}}function fg(a){switch(a){case 99:return Uf;case 98:return Vf;case 97:return Wf;case 96:return Xf;case 95:return Yf;default:throw Error(y$1(332));}}function gg(a,b){a=fg(a);return Nf(a,b)}function hg(a,b,c){a=fg(a);return Of(a,b,c)}function ig(){if(null!==bg){var a=bg;bg=null;Pf(a);}jg();}
3870 function jg(){if(!cg&&null!==ag){cg=!0;var a=0;try{var b=ag;gg(99,function(){for(;a<b.length;a++){var c=b[a];do c=c(!0);while(null!==c)}});ag=null;}catch(c){throw null!==ag&&(ag=ag.slice(a+1)),Of(Uf,ig),c;}finally{cg=!1;}}}var kg=ra.ReactCurrentBatchConfig;function lg(a,b){if(a&&a.defaultProps){b=m$1({},b);a=a.defaultProps;for(var c in a)void 0===b[c]&&(b[c]=a[c]);return b}return b}var mg=Bf(null),ng=null,og=null,pg=null;function qg(){pg=og=ng=null;}
3871 function rg(a){var b=mg.current;H$1(mg);a.type._context._currentValue=b;}function sg(a,b){for(;null!==a;){var c=a.alternate;if((a.childLanes&b)===b)if(null===c||(c.childLanes&b)===b)break;else c.childLanes|=b;else a.childLanes|=b,null!==c&&(c.childLanes|=b);a=a.return;}}function tg(a,b){ng=a;pg=og=null;a=a.dependencies;null!==a&&null!==a.firstContext&&(0!==(a.lanes&b)&&(ug=!0),a.firstContext=null);}
3872 function vg(a,b){if(pg!==a&&!1!==b&&0!==b){if("number"!==typeof b||1073741823===b)pg=a,b=1073741823;b={context:a,observedBits:b,next:null};if(null===og){if(null===ng)throw Error(y$1(308));og=b;ng.dependencies={lanes:0,firstContext:b,responders:null};}else og=og.next=b;}return a._currentValue}var wg=!1;function xg(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null};}
3873 function yg(a,b){a=a.updateQueue;b.updateQueue===a&&(b.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects});}function zg(a,b){return {eventTime:a,lane:b,tag:0,payload:null,callback:null,next:null}}function Ag(a,b){a=a.updateQueue;if(null!==a){a=a.shared;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b;}}
3874 function Bg(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&(d=d.updateQueue,c===d)){var e=null,f=null;c=c.firstBaseUpdate;if(null!==c){do{var g={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};null===f?e=f=g:f=f.next=g;c=c.next;}while(null!==c);null===f?e=f=b:f=f.next=b;}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,shared:d.shared,effects:d.effects};a.updateQueue=c;return}a=c.lastBaseUpdate;null===a?c.firstBaseUpdate=b:a.next=
3875 b;c.lastBaseUpdate=b;}
3876 function Cg(a,b,c,d){var e=a.updateQueue;wg=!1;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var k=h,l=k.next;k.next=null;null===g?f=l:g.next=l;g=k;var n=a.alternate;if(null!==n){n=n.updateQueue;var A=n.lastBaseUpdate;A!==g&&(null===A?n.firstBaseUpdate=l:A.next=l,n.lastBaseUpdate=k);}}if(null!==f){A=e.baseState;g=0;n=l=k=null;do{h=f.lane;var p=f.eventTime;if((d&h)===h){null!==n&&(n=n.next={eventTime:p,lane:0,tag:f.tag,payload:f.payload,callback:f.callback,
3877 next:null});a:{var C=a,x=f;h=b;p=c;switch(x.tag){case 1:C=x.payload;if("function"===typeof C){A=C.call(p,A,h);break a}A=C;break a;case 3:C.flags=C.flags&-4097|64;case 0:C=x.payload;h="function"===typeof C?C.call(p,A,h):C;if(null===h||void 0===h)break a;A=m$1({},A,h);break a;case 2:wg=!0;}}null!==f.callback&&(a.flags|=32,h=e.effects,null===h?e.effects=[f]:h.push(f));}else p={eventTime:p,lane:h,tag:f.tag,payload:f.payload,callback:f.callback,next:null},null===n?(l=n=p,k=A):n=n.next=p,g|=h;f=f.next;if(null===
3878 f)if(h=e.shared.pending,null===h)break;else f=h.next,h.next=null,e.lastBaseUpdate=h,e.shared.pending=null;}while(1);null===n&&(k=A);e.baseState=k;e.firstBaseUpdate=l;e.lastBaseUpdate=n;Dg|=g;a.lanes=g;a.memoizedState=A;}}function Eg(a,b,c){a=b.effects;b.effects=null;if(null!==a)for(b=0;b<a.length;b++){var d=a[b],e=d.callback;if(null!==e){d.callback=null;d=c;if("function"!==typeof e)throw Error(y$1(191,e));e.call(d);}}}var Fg=(new aa.Component).refs;
3879 function Gg(a,b,c,d){b=a.memoizedState;c=c(d,b);c=null===c||void 0===c?b:m$1({},b,c);a.memoizedState=c;0===a.lanes&&(a.updateQueue.baseState=c);}
3880 var Kg={isMounted:function(a){return (a=a._reactInternals)?Zb(a)===a:!1},enqueueSetState:function(a,b,c){a=a._reactInternals;var d=Hg(),e=Ig(a),f=zg(d,e);f.payload=b;void 0!==c&&null!==c&&(f.callback=c);Ag(a,f);Jg(a,e,d);},enqueueReplaceState:function(a,b,c){a=a._reactInternals;var d=Hg(),e=Ig(a),f=zg(d,e);f.tag=1;f.payload=b;void 0!==c&&null!==c&&(f.callback=c);Ag(a,f);Jg(a,e,d);},enqueueForceUpdate:function(a,b){a=a._reactInternals;var c=Hg(),d=Ig(a),e=zg(c,d);e.tag=2;void 0!==b&&null!==b&&(e.callback=
3881 b);Ag(a,e);Jg(a,d,c);}};function Lg(a,b,c,d,e,f,g){a=a.stateNode;return "function"===typeof a.shouldComponentUpdate?a.shouldComponentUpdate(d,f,g):b.prototype&&b.prototype.isPureReactComponent?!Je(c,d)||!Je(e,f):!0}
3882 function Mg(a,b,c){var d=!1,e=Cf;var f=b.contextType;"object"===typeof f&&null!==f?f=vg(f):(e=Ff(b)?Df:M.current,d=b.contextTypes,f=(d=null!==d&&void 0!==d)?Ef(a,e):Cf);b=new b(c,f);a.memoizedState=null!==b.state&&void 0!==b.state?b.state:null;b.updater=Kg;a.stateNode=b;b._reactInternals=a;d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=e,a.__reactInternalMemoizedMaskedChildContext=f);return b}
3883 function Ng(a,b,c,d){a=b.state;"function"===typeof b.componentWillReceiveProps&&b.componentWillReceiveProps(c,d);"function"===typeof b.UNSAFE_componentWillReceiveProps&&b.UNSAFE_componentWillReceiveProps(c,d);b.state!==a&&Kg.enqueueReplaceState(b,b.state,null);}
3884 function Og(a,b,c,d){var e=a.stateNode;e.props=c;e.state=a.memoizedState;e.refs=Fg;xg(a);var f=b.contextType;"object"===typeof f&&null!==f?e.context=vg(f):(f=Ff(b)?Df:M.current,e.context=Ef(a,f));Cg(a,c,e,d);e.state=a.memoizedState;f=b.getDerivedStateFromProps;"function"===typeof f&&(Gg(a,b,f,c),e.state=a.memoizedState);"function"===typeof b.getDerivedStateFromProps||"function"===typeof e.getSnapshotBeforeUpdate||"function"!==typeof e.UNSAFE_componentWillMount&&"function"!==typeof e.componentWillMount||
3885 (b=e.state,"function"===typeof e.componentWillMount&&e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),b!==e.state&&Kg.enqueueReplaceState(e,e.state,null),Cg(a,c,e,d),e.state=a.memoizedState);"function"===typeof e.componentDidMount&&(a.flags|=4);}var Pg=Array.isArray;
3886 function Qg(a,b,c){a=c.ref;if(null!==a&&"function"!==typeof a&&"object"!==typeof a){if(c._owner){c=c._owner;if(c){if(1!==c.tag)throw Error(y$1(309));var d=c.stateNode;}if(!d)throw Error(y$1(147,a));var e=""+a;if(null!==b&&null!==b.ref&&"function"===typeof b.ref&&b.ref._stringRef===e)return b.ref;b=function(a){var b=d.refs;b===Fg&&(b=d.refs={});null===a?delete b[e]:b[e]=a;};b._stringRef=e;return b}if("string"!==typeof a)throw Error(y$1(284));if(!c._owner)throw Error(y$1(290,a));}return a}
3887 function Rg(a,b){if("textarea"!==a.type)throw Error(y$1(31,"[object Object]"===Object.prototype.toString.call(b)?"object with keys {"+Object.keys(b).join(", ")+"}":b));}
3888 function Sg(a){function b(b,c){if(a){var d=b.lastEffect;null!==d?(d.nextEffect=c,b.lastEffect=c):b.firstEffect=b.lastEffect=c;c.nextEffect=null;c.flags=8;}}function c(c,d){if(!a)return null;for(;null!==d;)b(c,d),d=d.sibling;return null}function d(a,b){for(a=new Map;null!==b;)null!==b.key?a.set(b.key,b):a.set(b.index,b),b=b.sibling;return a}function e(a,b){a=Tg(a,b);a.index=0;a.sibling=null;return a}function f(b,c,d){b.index=d;if(!a)return c;d=b.alternate;if(null!==d)return d=d.index,d<c?(b.flags=2,
3889 c):d;b.flags=2;return c}function g(b){a&&null===b.alternate&&(b.flags=2);return b}function h(a,b,c,d){if(null===b||6!==b.tag)return b=Ug(c,a.mode,d),b.return=a,b;b=e(b,c);b.return=a;return b}function k(a,b,c,d){if(null!==b&&b.elementType===c.type)return d=e(b,c.props),d.ref=Qg(a,b,c),d.return=a,d;d=Vg(c.type,c.key,c.props,null,a.mode,d);d.ref=Qg(a,b,c);d.return=a;return d}function l(a,b,c,d){if(null===b||4!==b.tag||b.stateNode.containerInfo!==c.containerInfo||b.stateNode.implementation!==c.implementation)return b=
3890 Wg(c,a.mode,d),b.return=a,b;b=e(b,c.children||[]);b.return=a;return b}function n(a,b,c,d,f){if(null===b||7!==b.tag)return b=Xg(c,a.mode,d,f),b.return=a,b;b=e(b,c);b.return=a;return b}function A(a,b,c){if("string"===typeof b||"number"===typeof b)return b=Ug(""+b,a.mode,c),b.return=a,b;if("object"===typeof b&&null!==b){switch(b.$$typeof){case sa:return c=Vg(b.type,b.key,b.props,null,a.mode,c),c.ref=Qg(a,null,b),c.return=a,c;case ta:return b=Wg(b,a.mode,c),b.return=a,b}if(Pg(b)||La(b))return b=Xg(b,
3891 a.mode,c,null),b.return=a,b;Rg(a,b);}return null}function p(a,b,c,d){var e=null!==b?b.key:null;if("string"===typeof c||"number"===typeof c)return null!==e?null:h(a,b,""+c,d);if("object"===typeof c&&null!==c){switch(c.$$typeof){case sa:return c.key===e?c.type===ua?n(a,b,c.props.children,d,e):k(a,b,c,d):null;case ta:return c.key===e?l(a,b,c,d):null}if(Pg(c)||La(c))return null!==e?null:n(a,b,c,d,null);Rg(a,c);}return null}function C(a,b,c,d,e){if("string"===typeof d||"number"===typeof d)return a=a.get(c)||
3892 null,h(b,a,""+d,e);if("object"===typeof d&&null!==d){switch(d.$$typeof){case sa:return a=a.get(null===d.key?c:d.key)||null,d.type===ua?n(b,a,d.props.children,e,d.key):k(b,a,d,e);case ta:return a=a.get(null===d.key?c:d.key)||null,l(b,a,d,e)}if(Pg(d)||La(d))return a=a.get(c)||null,n(b,a,d,e,null);Rg(b,d);}return null}function x(e,g,h,k){for(var l=null,t=null,u=g,z=g=0,q=null;null!==u&&z<h.length;z++){u.index>z?(q=u,u=null):q=u.sibling;var n=p(e,u,h[z],k);if(null===n){null===u&&(u=q);break}a&&u&&null===
3893 n.alternate&&b(e,u);g=f(n,g,z);null===t?l=n:t.sibling=n;t=n;u=q;}if(z===h.length)return c(e,u),l;if(null===u){for(;z<h.length;z++)u=A(e,h[z],k),null!==u&&(g=f(u,g,z),null===t?l=u:t.sibling=u,t=u);return l}for(u=d(e,u);z<h.length;z++)q=C(u,e,z,h[z],k),null!==q&&(a&&null!==q.alternate&&u.delete(null===q.key?z:q.key),g=f(q,g,z),null===t?l=q:t.sibling=q,t=q);a&&u.forEach(function(a){return b(e,a)});return l}function w(e,g,h,k){var l=La(h);if("function"!==typeof l)throw Error(y$1(150));h=l.call(h);if(null==
3894 h)throw Error(y$1(151));for(var t=l=null,u=g,z=g=0,q=null,n=h.next();null!==u&&!n.done;z++,n=h.next()){u.index>z?(q=u,u=null):q=u.sibling;var w=p(e,u,n.value,k);if(null===w){null===u&&(u=q);break}a&&u&&null===w.alternate&&b(e,u);g=f(w,g,z);null===t?l=w:t.sibling=w;t=w;u=q;}if(n.done)return c(e,u),l;if(null===u){for(;!n.done;z++,n=h.next())n=A(e,n.value,k),null!==n&&(g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);return l}for(u=d(e,u);!n.done;z++,n=h.next())n=C(u,e,z,n.value,k),null!==n&&(a&&null!==n.alternate&&
3895 u.delete(null===n.key?z:n.key),g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);a&&u.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k="object"===typeof f&&null!==f&&f.type===ua&&null===f.key;k&&(f=f.props.children);var l="object"===typeof f&&null!==f;if(l)switch(f.$$typeof){case sa:a:{l=f.key;for(k=d;null!==k;){if(k.key===l){switch(k.tag){case 7:if(f.type===ua){c(a,k.sibling);d=e(k,f.props.children);d.return=a;a=d;break a}break;default:if(k.elementType===f.type){c(a,k.sibling);
3896 d=e(k,f.props);d.ref=Qg(a,k,f);d.return=a;a=d;break a}}c(a,k);break}else b(a,k);k=k.sibling;}f.type===ua?(d=Xg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Vg(f.type,f.key,f.props,null,a.mode,h),h.ref=Qg(a,d,f),h.return=a,a=h);}return g(a);case ta:a:{for(k=f.key;null!==d;){if(d.key===k)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else {c(a,d);break}else b(a,d);d=d.sibling;}d=
3897 Wg(f,a.mode,h);d.return=a;a=d;}return g(a)}if("string"===typeof f||"number"===typeof f)return f=""+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Ug(f,a.mode,h),d.return=a,a=d),g(a);if(Pg(f))return x(a,d,f,h);if(La(f))return w(a,d,f,h);l&&Rg(a,f);if("undefined"===typeof f&&!k)switch(a.tag){case 1:case 22:case 0:case 11:case 15:throw Error(y$1(152,Ra(a.type)||"Component"));}return c(a,d)}}var Yg=Sg(!0),Zg=Sg(!1),$g={},ah=Bf($g),bh=Bf($g),ch=Bf($g);
3898 function dh(a){if(a===$g)throw Error(y$1(174));return a}function eh(a,b){I$1(ch,b);I$1(bh,a);I$1(ah,$g);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:mb(null,"");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=mb(b,a);}H$1(ah);I$1(ah,b);}function fh(){H$1(ah);H$1(bh);H$1(ch);}function gh(a){dh(ch.current);var b=dh(ah.current);var c=mb(b,a.type);b!==c&&(I$1(bh,a),I$1(ah,c));}function hh(a){bh.current===a&&(H$1(ah),H$1(bh));}var P=Bf(0);
3899 function ih(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||"$?"===c.data||"$!"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&64))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return;}b.sibling.return=b.return;b=b.sibling;}return null}var jh=null,kh=null,lh=!1;
3900 function mh(a,b){var c=nh(5,null,null,0);c.elementType="DELETED";c.type="DELETED";c.stateNode=b;c.return=a;c.flags=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c;}function oh(a,b){switch(a.tag){case 5:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 6:return b=""===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;case 13:return !1;default:return !1}}
3901 function ph(a){if(lh){var b=kh;if(b){var c=b;if(!oh(a,b)){b=rf(c.nextSibling);if(!b||!oh(a,b)){a.flags=a.flags&-1025|2;lh=!1;jh=a;return}mh(jh,c);}jh=a;kh=rf(b.firstChild);}else a.flags=a.flags&-1025|2,lh=!1,jh=a;}}function qh(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag&&13!==a.tag;)a=a.return;jh=a;}
3902 function rh(a){if(a!==jh)return !1;if(!lh)return qh(a),lh=!0,!1;var b=a.type;if(5!==a.tag||"head"!==b&&"body"!==b&&!nf(b,a.memoizedProps))for(b=kh;b;)mh(a,b),b=rf(b.nextSibling);qh(a);if(13===a.tag){a=a.memoizedState;a=null!==a?a.dehydrated:null;if(!a)throw Error(y$1(317));a:{a=a.nextSibling;for(b=0;a;){if(8===a.nodeType){var c=a.data;if("/$"===c){if(0===b){kh=rf(a.nextSibling);break a}b--;}else "$"!==c&&"$!"!==c&&"$?"!==c||b++;}a=a.nextSibling;}kh=null;}}else kh=jh?rf(a.stateNode.nextSibling):null;return !0}
3903 function sh(){kh=jh=null;lh=!1;}var th=[];function uh(){for(var a=0;a<th.length;a++)th[a]._workInProgressVersionPrimary=null;th.length=0;}var vh=ra.ReactCurrentDispatcher,wh=ra.ReactCurrentBatchConfig,xh=0,R=null,S=null,T=null,yh=!1,zh=!1;function Ah(){throw Error(y$1(321));}function Bh(a,b){if(null===b)return !1;for(var c=0;c<b.length&&c<a.length;c++)if(!He(a[c],b[c]))return !1;return !0}
3904 function Ch(a,b,c,d,e,f){xh=f;R=b;b.memoizedState=null;b.updateQueue=null;b.lanes=0;vh.current=null===a||null===a.memoizedState?Dh:Eh;a=c(d,e);if(zh){f=0;do{zh=!1;if(!(25>f))throw Error(y$1(301));f+=1;T=S=null;b.updateQueue=null;vh.current=Fh;a=c(d,e);}while(zh)}vh.current=Gh;b=null!==S&&null!==S.next;xh=0;T=S=R=null;yh=!1;if(b)throw Error(y$1(300));return a}function Hh(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===T?R.memoizedState=T=a:T=T.next=a;return T}
3905 function Ih(){if(null===S){var a=R.alternate;a=null!==a?a.memoizedState:null;}else a=S.next;var b=null===T?R.memoizedState:T.next;if(null!==b)T=b,S=a;else {if(null===a)throw Error(y$1(310));S=a;a={memoizedState:S.memoizedState,baseState:S.baseState,baseQueue:S.baseQueue,queue:S.queue,next:null};null===T?R.memoizedState=T=a:T=T.next=a;}return T}function Jh(a,b){return "function"===typeof b?b(a):b}
3906 function Kh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y$1(311));c.lastRenderedReducer=a;var d=S,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var g=e.next;e.next=f.next;f.next=g;}d.baseQueue=e=f;c.pending=null;}if(null!==e){e=e.next;d=d.baseState;var h=g=f=null,k=e;do{var l=k.lane;if((xh&l)===l)null!==h&&(h=h.next={lane:0,action:k.action,eagerReducer:k.eagerReducer,eagerState:k.eagerState,next:null}),d=k.eagerReducer===a?k.eagerState:a(d,k.action);else {var n={lane:l,action:k.action,eagerReducer:k.eagerReducer,
3907 eagerState:k.eagerState,next:null};null===h?(g=h=n,f=d):h=h.next=n;R.lanes|=l;Dg|=l;}k=k.next;}while(null!==k&&k!==e);null===h?f=d:h.next=g;He(d,b.memoizedState)||(ug=!0);b.memoizedState=d;b.baseState=f;b.baseQueue=h;c.lastRenderedState=d;}return [b.memoizedState,c.dispatch]}
3908 function Lh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y$1(311));c.lastRenderedReducer=a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var g=e=e.next;do f=a(f,g.action),g=g.next;while(g!==e);He(f,b.memoizedState)||(ug=!0);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f;}return [f,d]}
3909 function Mh(a,b,c){var d=b._getVersion;d=d(b._source);var e=b._workInProgressVersionPrimary;if(null!==e)a=e===d;else if(a=a.mutableReadLanes,a=(xh&a)===a)b._workInProgressVersionPrimary=d,th.push(b);if(a)return c(b._source);th.push(b);throw Error(y$1(350));}
3910 function Nh(a,b,c,d){var e=U;if(null===e)throw Error(y$1(349));var f=b._getVersion,g=f(b._source),h=vh.current,k=h.useState(function(){return Mh(e,b,c)}),l=k[1],n=k[0];k=T;var A=a.memoizedState,p=A.refs,C=p.getSnapshot,x=A.source;A=A.subscribe;var w=R;a.memoizedState={refs:p,source:b,subscribe:d};h.useEffect(function(){p.getSnapshot=c;p.setSnapshot=l;var a=f(b._source);if(!He(g,a)){a=c(b._source);He(n,a)||(l(a),a=Ig(w),e.mutableReadLanes|=a&e.pendingLanes);a=e.mutableReadLanes;e.entangledLanes|=a;for(var d=
3911 e.entanglements,h=a;0<h;){var k=31-Vc(h),v=1<<k;d[k]|=a;h&=~v;}}},[c,b,d]);h.useEffect(function(){return d(b._source,function(){var a=p.getSnapshot,c=p.setSnapshot;try{c(a(b._source));var d=Ig(w);e.mutableReadLanes|=d&e.pendingLanes;}catch(q){c(function(){throw q;});}})},[b,d]);He(C,c)&&He(x,b)&&He(A,d)||(a={pending:null,dispatch:null,lastRenderedReducer:Jh,lastRenderedState:n},a.dispatch=l=Oh.bind(null,R,a),k.queue=a,k.baseQueue=null,n=Mh(e,b,c),k.memoizedState=k.baseState=n);return n}
3912 function Ph(a,b,c){var d=Ih();return Nh(d,a,b,c)}function Qh(a){var b=Hh();"function"===typeof a&&(a=a());b.memoizedState=b.baseState=a;a=b.queue={pending:null,dispatch:null,lastRenderedReducer:Jh,lastRenderedState:a};a=a.dispatch=Oh.bind(null,R,a);return [b.memoizedState,a]}
3913 function Rh(a,b,c,d){a={tag:a,create:b,destroy:c,deps:d,next:null};b=R.updateQueue;null===b?(b={lastEffect:null},R.updateQueue=b,b.lastEffect=a.next=a):(c=b.lastEffect,null===c?b.lastEffect=a.next=a:(d=c.next,c.next=a,a.next=d,b.lastEffect=a));return a}function Sh(a){var b=Hh();a={current:a};return b.memoizedState=a}function Th(){return Ih().memoizedState}function Uh(a,b,c,d){var e=Hh();R.flags|=a;e.memoizedState=Rh(1|b,c,void 0,void 0===d?null:d);}
3914 function Vh(a,b,c,d){var e=Ih();d=void 0===d?null:d;var f=void 0;if(null!==S){var g=S.memoizedState;f=g.destroy;if(null!==d&&Bh(d,g.deps)){Rh(b,c,f,d);return}}R.flags|=a;e.memoizedState=Rh(1|b,c,f,d);}function Wh(a,b){return Uh(516,4,a,b)}function Xh(a,b){return Vh(516,4,a,b)}function Yh(a,b){return Vh(4,2,a,b)}function Zh(a,b){if("function"===typeof b)return a=a(),b(a),function(){b(null);};if(null!==b&&void 0!==b)return a=a(),b.current=a,function(){b.current=null;}}
3915 function $h(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return Vh(4,2,Zh.bind(null,b,a),c)}function ai(){}function bi(a,b){var c=Ih();b=void 0===b?null:b;var d=c.memoizedState;if(null!==d&&null!==b&&Bh(b,d[1]))return d[0];c.memoizedState=[a,b];return a}function ci(a,b){var c=Ih();b=void 0===b?null:b;var d=c.memoizedState;if(null!==d&&null!==b&&Bh(b,d[1]))return d[0];a=a();c.memoizedState=[a,b];return a}
3916 function di(a,b){var c=eg();gg(98>c?98:c,function(){a(!0);});gg(97<c?97:c,function(){var c=wh.transition;wh.transition=1;try{a(!1),b();}finally{wh.transition=c;}});}
3917 function Oh(a,b,c){var d=Hg(),e=Ig(a),f={lane:e,action:c,eagerReducer:null,eagerState:null,next:null},g=b.pending;null===g?f.next=f:(f.next=g.next,g.next=f);b.pending=f;g=a.alternate;if(a===R||null!==g&&g===R)zh=yh=!0;else {if(0===a.lanes&&(null===g||0===g.lanes)&&(g=b.lastRenderedReducer,null!==g))try{var h=b.lastRenderedState,k=g(h,c);f.eagerReducer=g;f.eagerState=k;if(He(k,h))return}catch(l){}finally{}Jg(a,e,d);}}
3918 var Gh={readContext:vg,useCallback:Ah,useContext:Ah,useEffect:Ah,useImperativeHandle:Ah,useLayoutEffect:Ah,useMemo:Ah,useReducer:Ah,useRef:Ah,useState:Ah,useDebugValue:Ah,useDeferredValue:Ah,useTransition:Ah,useMutableSource:Ah,useOpaqueIdentifier:Ah,unstable_isNewReconciler:!1},Dh={readContext:vg,useCallback:function(a,b){Hh().memoizedState=[a,void 0===b?null:b];return a},useContext:vg,useEffect:Wh,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return Uh(4,2,Zh.bind(null,
3919 b,a),c)},useLayoutEffect:function(a,b){return Uh(4,2,a,b)},useMemo:function(a,b){var c=Hh();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Hh();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a=d.queue={pending:null,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};a=a.dispatch=Oh.bind(null,R,a);return [d.memoizedState,a]},useRef:Sh,useState:Qh,useDebugValue:ai,useDeferredValue:function(a){var b=Qh(a),c=b[0],d=b[1];Wh(function(){var b=wh.transition;
3920 wh.transition=1;try{d(a);}finally{wh.transition=b;}},[a]);return c},useTransition:function(){var a=Qh(!1),b=a[0];a=di.bind(null,a[1]);Sh(a);return [a,b]},useMutableSource:function(a,b,c){var d=Hh();d.memoizedState={refs:{getSnapshot:b,setSnapshot:null},source:a,subscribe:c};return Nh(d,a,b,c)},useOpaqueIdentifier:function(){if(lh){var a=!1,b=uf(function(){a||(a=!0,c("r:"+(tf++).toString(36)));throw Error(y$1(355));}),c=Qh(b)[1];0===(R.mode&2)&&(R.flags|=516,Rh(5,function(){c("r:"+(tf++).toString(36));},
3921 void 0,null));return b}b="r:"+(tf++).toString(36);Qh(b);return b},unstable_isNewReconciler:!1},Eh={readContext:vg,useCallback:bi,useContext:vg,useEffect:Xh,useImperativeHandle:$h,useLayoutEffect:Yh,useMemo:ci,useReducer:Kh,useRef:Th,useState:function(){return Kh(Jh)},useDebugValue:ai,useDeferredValue:function(a){var b=Kh(Jh),c=b[0],d=b[1];Xh(function(){var b=wh.transition;wh.transition=1;try{d(a);}finally{wh.transition=b;}},[a]);return c},useTransition:function(){var a=Kh(Jh)[0];return [Th().current,
3922 a]},useMutableSource:Ph,useOpaqueIdentifier:function(){return Kh(Jh)[0]},unstable_isNewReconciler:!1},Fh={readContext:vg,useCallback:bi,useContext:vg,useEffect:Xh,useImperativeHandle:$h,useLayoutEffect:Yh,useMemo:ci,useReducer:Lh,useRef:Th,useState:function(){return Lh(Jh)},useDebugValue:ai,useDeferredValue:function(a){var b=Lh(Jh),c=b[0],d=b[1];Xh(function(){var b=wh.transition;wh.transition=1;try{d(a);}finally{wh.transition=b;}},[a]);return c},useTransition:function(){var a=Lh(Jh)[0];return [Th().current,
3923 a]},useMutableSource:Ph,useOpaqueIdentifier:function(){return Lh(Jh)[0]},unstable_isNewReconciler:!1},ei=ra.ReactCurrentOwner,ug=!1;function fi(a,b,c,d){b.child=null===a?Zg(b,null,c,d):Yg(b,a.child,c,d);}function gi(a,b,c,d,e){c=c.render;var f=b.ref;tg(b,e);d=Ch(a,b,c,d,f,e);if(null!==a&&!ug)return b.updateQueue=a.updateQueue,b.flags&=-517,a.lanes&=~e,hi(a,b,e);b.flags|=1;fi(a,b,d,e);return b.child}
3924 function ii(a,b,c,d,e,f){if(null===a){var g=c.type;if("function"===typeof g&&!ji(g)&&void 0===g.defaultProps&&null===c.compare&&void 0===c.defaultProps)return b.tag=15,b.type=g,ki(a,b,g,d,e,f);a=Vg(c.type,null,d,b,b.mode,f);a.ref=b.ref;a.return=b;return b.child=a}g=a.child;if(0===(e&f)&&(e=g.memoizedProps,c=c.compare,c=null!==c?c:Je,c(e,d)&&a.ref===b.ref))return hi(a,b,f);b.flags|=1;a=Tg(g,d);a.ref=b.ref;a.return=b;return b.child=a}
3925 function ki(a,b,c,d,e,f){if(null!==a&&Je(a.memoizedProps,d)&&a.ref===b.ref)if(ug=!1,0!==(f&e))0!==(a.flags&16384)&&(ug=!0);else return b.lanes=a.lanes,hi(a,b,f);return li(a,b,c,d,f)}
3926 function mi(a,b,c){var d=b.pendingProps,e=d.children,f=null!==a?a.memoizedState:null;if("hidden"===d.mode||"unstable-defer-without-hiding"===d.mode)if(0===(b.mode&4))b.memoizedState={baseLanes:0},ni(b,c);else if(0!==(c&1073741824))b.memoizedState={baseLanes:0},ni(b,null!==f?f.baseLanes:c);else return a=null!==f?f.baseLanes|c:c,b.lanes=b.childLanes=1073741824,b.memoizedState={baseLanes:a},ni(b,a),null;else null!==f?(d=f.baseLanes|c,b.memoizedState=null):d=c,ni(b,d);fi(a,b,e,c);return b.child}
3927 function oi(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.flags|=128;}function li(a,b,c,d,e){var f=Ff(c)?Df:M.current;f=Ef(b,f);tg(b,e);c=Ch(a,b,c,d,f,e);if(null!==a&&!ug)return b.updateQueue=a.updateQueue,b.flags&=-517,a.lanes&=~e,hi(a,b,e);b.flags|=1;fi(a,b,c,e);return b.child}
3928 function pi(a,b,c,d,e){if(Ff(c)){var f=!0;Jf(b);}else f=!1;tg(b,e);if(null===b.stateNode)null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2),Mg(b,c,d),Og(b,c,d,e),d=!0;else if(null===a){var g=b.stateNode,h=b.memoizedProps;g.props=h;var k=g.context,l=c.contextType;"object"===typeof l&&null!==l?l=vg(l):(l=Ff(c)?Df:M.current,l=Ef(b,l));var n=c.getDerivedStateFromProps,A="function"===typeof n||"function"===typeof g.getSnapshotBeforeUpdate;A||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&
3929 "function"!==typeof g.componentWillReceiveProps||(h!==d||k!==l)&&Ng(b,g,d,l);wg=!1;var p=b.memoizedState;g.state=p;Cg(b,d,g,e);k=b.memoizedState;h!==d||p!==k||N.current||wg?("function"===typeof n&&(Gg(b,c,n,d),k=b.memoizedState),(h=wg||Lg(b,c,h,d,p,k,l))?(A||"function"!==typeof g.UNSAFE_componentWillMount&&"function"!==typeof g.componentWillMount||("function"===typeof g.componentWillMount&&g.componentWillMount(),"function"===typeof g.UNSAFE_componentWillMount&&g.UNSAFE_componentWillMount()),"function"===
3930 typeof g.componentDidMount&&(b.flags|=4)):("function"===typeof g.componentDidMount&&(b.flags|=4),b.memoizedProps=d,b.memoizedState=k),g.props=d,g.state=k,g.context=l,d=h):("function"===typeof g.componentDidMount&&(b.flags|=4),d=!1);}else {g=b.stateNode;yg(a,b);h=b.memoizedProps;l=b.type===b.elementType?h:lg(b.type,h);g.props=l;A=b.pendingProps;p=g.context;k=c.contextType;"object"===typeof k&&null!==k?k=vg(k):(k=Ff(c)?Df:M.current,k=Ef(b,k));var C=c.getDerivedStateFromProps;(n="function"===typeof C||
3931 "function"===typeof g.getSnapshotBeforeUpdate)||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==A||p!==k)&&Ng(b,g,d,k);wg=!1;p=b.memoizedState;g.state=p;Cg(b,d,g,e);var x=b.memoizedState;h!==A||p!==x||N.current||wg?("function"===typeof C&&(Gg(b,c,C,d),x=b.memoizedState),(l=wg||Lg(b,c,l,d,p,x,k))?(n||"function"!==typeof g.UNSAFE_componentWillUpdate&&"function"!==typeof g.componentWillUpdate||("function"===typeof g.componentWillUpdate&&g.componentWillUpdate(d,
3932 x,k),"function"===typeof g.UNSAFE_componentWillUpdate&&g.UNSAFE_componentWillUpdate(d,x,k)),"function"===typeof g.componentDidUpdate&&(b.flags|=4),"function"===typeof g.getSnapshotBeforeUpdate&&(b.flags|=256)):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&p===a.memoizedState||(b.flags|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&p===a.memoizedState||(b.flags|=256),b.memoizedProps=d,b.memoizedState=x),g.props=d,g.state=x,g.context=k,d=l):("function"!==typeof g.componentDidUpdate||
3933 h===a.memoizedProps&&p===a.memoizedState||(b.flags|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&p===a.memoizedState||(b.flags|=256),d=!1);}return qi(a,b,c,d,f,e)}
3934 function qi(a,b,c,d,e,f){oi(a,b);var g=0!==(b.flags&64);if(!d&&!g)return e&&Kf(b,c,!1),hi(a,b,f);d=b.stateNode;ei.current=b;var h=g&&"function"!==typeof c.getDerivedStateFromError?null:d.render();b.flags|=1;null!==a&&g?(b.child=Yg(b,a.child,null,f),b.child=Yg(b,null,h,f)):fi(a,b,h,f);b.memoizedState=d.state;e&&Kf(b,c,!0);return b.child}function ri(a){var b=a.stateNode;b.pendingContext?Hf(a,b.pendingContext,b.pendingContext!==b.context):b.context&&Hf(a,b.context,!1);eh(a,b.containerInfo);}
3935 var si={dehydrated:null,retryLane:0};
3936 function ti(a,b,c){var d=b.pendingProps,e=P.current,f=!1,g;(g=0!==(b.flags&64))||(g=null!==a&&null===a.memoizedState?!1:0!==(e&2));g?(f=!0,b.flags&=-65):null!==a&&null===a.memoizedState||void 0===d.fallback||!0===d.unstable_avoidThisFallback||(e|=1);I$1(P,e&1);if(null===a){void 0!==d.fallback&&ph(b);a=d.children;e=d.fallback;if(f)return a=ui(b,a,e,c),b.child.memoizedState={baseLanes:c},b.memoizedState=si,a;if("number"===typeof d.unstable_expectedLoadTime)return a=ui(b,a,e,c),b.child.memoizedState={baseLanes:c},
3937 b.memoizedState=si,b.lanes=33554432,a;c=vi({mode:"visible",children:a},b.mode,c,null);c.return=b;return b.child=c}if(null!==a.memoizedState){if(f)return d=wi(a,b,d.children,d.fallback,c),f=b.child,e=a.child.memoizedState,f.memoizedState=null===e?{baseLanes:c}:{baseLanes:e.baseLanes|c},f.childLanes=a.childLanes&~c,b.memoizedState=si,d;c=xi(a,b,d.children,c);b.memoizedState=null;return c}if(f)return d=wi(a,b,d.children,d.fallback,c),f=b.child,e=a.child.memoizedState,f.memoizedState=null===e?{baseLanes:c}:
3938 {baseLanes:e.baseLanes|c},f.childLanes=a.childLanes&~c,b.memoizedState=si,d;c=xi(a,b,d.children,c);b.memoizedState=null;return c}function ui(a,b,c,d){var e=a.mode,f=a.child;b={mode:"hidden",children:b};0===(e&2)&&null!==f?(f.childLanes=0,f.pendingProps=b):f=vi(b,e,0,null);c=Xg(c,e,d,null);f.return=a;c.return=a;f.sibling=c;a.child=f;return c}
3939 function xi(a,b,c,d){var e=a.child;a=e.sibling;c=Tg(e,{mode:"visible",children:c});0===(b.mode&2)&&(c.lanes=d);c.return=b;c.sibling=null;null!==a&&(a.nextEffect=null,a.flags=8,b.firstEffect=b.lastEffect=a);return b.child=c}
3940 function wi(a,b,c,d,e){var f=b.mode,g=a.child;a=g.sibling;var h={mode:"hidden",children:c};0===(f&2)&&b.child!==g?(c=b.child,c.childLanes=0,c.pendingProps=h,g=c.lastEffect,null!==g?(b.firstEffect=c.firstEffect,b.lastEffect=g,g.nextEffect=null):b.firstEffect=b.lastEffect=null):c=Tg(g,h);null!==a?d=Tg(a,d):(d=Xg(d,f,e,null),d.flags|=2);d.return=b;c.return=b;c.sibling=d;b.child=c;return d}function yi(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);sg(a.return,b);}
3941 function zi(a,b,c,d,e,f){var g=a.memoizedState;null===g?a.memoizedState={isBackwards:b,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:e,lastEffect:f}:(g.isBackwards=b,g.rendering=null,g.renderingStartTime=0,g.last=d,g.tail=c,g.tailMode=e,g.lastEffect=f);}
3942 function Ai(a,b,c){var d=b.pendingProps,e=d.revealOrder,f=d.tail;fi(a,b,d.children,c);d=P.current;if(0!==(d&2))d=d&1|2,b.flags|=64;else {if(null!==a&&0!==(a.flags&64))a:for(a=b.child;null!==a;){if(13===a.tag)null!==a.memoizedState&&yi(a,c);else if(19===a.tag)yi(a,c);else if(null!==a.child){a.child.return=a;a=a.child;continue}if(a===b)break a;for(;null===a.sibling;){if(null===a.return||a.return===b)break a;a=a.return;}a.sibling.return=a.return;a=a.sibling;}d&=1;}I$1(P,d);if(0===(b.mode&2))b.memoizedState=
3943 null;else switch(e){case "forwards":c=b.child;for(e=null;null!==c;)a=c.alternate,null!==a&&null===ih(a)&&(e=c),c=c.sibling;c=e;null===c?(e=b.child,b.child=null):(e=c.sibling,c.sibling=null);zi(b,!1,e,c,f,b.lastEffect);break;case "backwards":c=null;e=b.child;for(b.child=null;null!==e;){a=e.alternate;if(null!==a&&null===ih(a)){b.child=e;break}a=e.sibling;e.sibling=c;c=e;e=a;}zi(b,!0,c,null,f,b.lastEffect);break;case "together":zi(b,!1,null,null,void 0,b.lastEffect);break;default:b.memoizedState=null;}return b.child}
3944 function hi(a,b,c){null!==a&&(b.dependencies=a.dependencies);Dg|=b.lanes;if(0!==(c&b.childLanes)){if(null!==a&&b.child!==a.child)throw Error(y$1(153));if(null!==b.child){a=b.child;c=Tg(a,a.pendingProps);b.child=c;for(c.return=b;null!==a.sibling;)a=a.sibling,c=c.sibling=Tg(a,a.pendingProps),c.return=b;c.sibling=null;}return b.child}return null}var Bi,Ci,Di,Ei;
3945 Bi=function(a,b){for(var c=b.child;null!==c;){if(5===c.tag||6===c.tag)a.appendChild(c.stateNode);else if(4!==c.tag&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;}c.sibling.return=c.return;c=c.sibling;}};Ci=function(){};
3946 Di=function(a,b,c,d){var e=a.memoizedProps;if(e!==d){a=b.stateNode;dh(ah.current);var f=null;switch(c){case "input":e=Ya(a,e);d=Ya(a,d);f=[];break;case "option":e=eb(a,e);d=eb(a,d);f=[];break;case "select":e=m$1({},e,{value:void 0});d=m$1({},d,{value:void 0});f=[];break;case "textarea":e=gb(a,e);d=gb(a,d);f=[];break;default:"function"!==typeof e.onClick&&"function"===typeof d.onClick&&(a.onclick=jf);}vb(c,d);var g;c=null;for(l in e)if(!d.hasOwnProperty(l)&&e.hasOwnProperty(l)&&null!=e[l])if("style"===
3947 l){var h=e[l];for(g in h)h.hasOwnProperty(g)&&(c||(c={}),c[g]="");}else "dangerouslySetInnerHTML"!==l&&"children"!==l&&"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(ca.hasOwnProperty(l)?f||(f=[]):(f=f||[]).push(l,null));for(l in d){var k=d[l];h=null!=e?e[l]:void 0;if(d.hasOwnProperty(l)&&k!==h&&(null!=k||null!=h))if("style"===l)if(h){for(g in h)!h.hasOwnProperty(g)||k&&k.hasOwnProperty(g)||(c||(c={}),c[g]="");for(g in k)k.hasOwnProperty(g)&&h[g]!==k[g]&&(c||
3948 (c={}),c[g]=k[g]);}else c||(f||(f=[]),f.push(l,c)),c=k;else "dangerouslySetInnerHTML"===l?(k=k?k.__html:void 0,h=h?h.__html:void 0,null!=k&&h!==k&&(f=f||[]).push(l,k)):"children"===l?"string"!==typeof k&&"number"!==typeof k||(f=f||[]).push(l,""+k):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&(ca.hasOwnProperty(l)?(null!=k&&"onScroll"===l&&G$1("scroll",a),f||h===k||(f=[])):"object"===typeof k&&null!==k&&k.$$typeof===Ga?k.toString():(f=f||[]).push(l,k));}c&&(f=f||[]).push("style",
3949 c);var l=f;if(b.updateQueue=l)b.flags|=4;}};Ei=function(a,b,c,d){c!==d&&(b.flags|=4);};function Fi(a,b){if(!lh)switch(a.tailMode){case "hidden":b=a.tail;for(var c=null;null!==b;)null!==b.alternate&&(c=b),b=b.sibling;null===c?a.tail=null:c.sibling=null;break;case "collapsed":c=a.tail;for(var d=null;null!==c;)null!==c.alternate&&(d=c),c=c.sibling;null===d?b||null===a.tail?a.tail=null:a.tail.sibling=null:d.sibling=null;}}
3950 function Gi(a,b,c){var d=b.pendingProps;switch(b.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return Ff(b.type)&&Gf(),null;case 3:fh();H$1(N);H$1(M);uh();d=b.stateNode;d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null);if(null===a||null===a.child)rh(b)?b.flags|=4:d.hydrate||(b.flags|=256);Ci(b);return null;case 5:hh(b);var e=dh(ch.current);c=b.type;if(null!==a&&null!=b.stateNode)Di(a,b,c,d,e),a.ref!==b.ref&&(b.flags|=128);else {if(!d){if(null===
3951 b.stateNode)throw Error(y$1(166));return null}a=dh(ah.current);if(rh(b)){d=b.stateNode;c=b.type;var f=b.memoizedProps;d[wf]=b;d[xf]=f;switch(c){case "dialog":G$1("cancel",d);G$1("close",d);break;case "iframe":case "object":case "embed":G$1("load",d);break;case "video":case "audio":for(a=0;a<Xe.length;a++)G$1(Xe[a],d);break;case "source":G$1("error",d);break;case "img":case "image":case "link":G$1("error",d);G$1("load",d);break;case "details":G$1("toggle",d);break;case "input":Za(d,f);G$1("invalid",d);break;case "select":d._wrapperState=
3952 {wasMultiple:!!f.multiple};G$1("invalid",d);break;case "textarea":hb(d,f),G$1("invalid",d);}vb(c,f);a=null;for(var g in f)f.hasOwnProperty(g)&&(e=f[g],"children"===g?"string"===typeof e?d.textContent!==e&&(a=["children",e]):"number"===typeof e&&d.textContent!==""+e&&(a=["children",""+e]):ca.hasOwnProperty(g)&&null!=e&&"onScroll"===g&&G$1("scroll",d));switch(c){case "input":Va(d);cb(d,f,!0);break;case "textarea":Va(d);jb(d);break;case "select":case "option":break;default:"function"===typeof f.onClick&&(d.onclick=
3953 jf);}d=a;b.updateQueue=d;null!==d&&(b.flags|=4);}else {g=9===e.nodeType?e:e.ownerDocument;a===kb.html&&(a=lb(c));a===kb.html?"script"===c?(a=g.createElement("div"),a.innerHTML="<script>\x3c/script>",a=a.removeChild(a.firstChild)):"string"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),"select"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[wf]=b;a[xf]=d;Bi(a,b,!1,!1);b.stateNode=a;g=wb(c,d);switch(c){case "dialog":G$1("cancel",a);G$1("close",a);
3954 e=d;break;case "iframe":case "object":case "embed":G$1("load",a);e=d;break;case "video":case "audio":for(e=0;e<Xe.length;e++)G$1(Xe[e],a);e=d;break;case "source":G$1("error",a);e=d;break;case "img":case "image":case "link":G$1("error",a);G$1("load",a);e=d;break;case "details":G$1("toggle",a);e=d;break;case "input":Za(a,d);e=Ya(a,d);G$1("invalid",a);break;case "option":e=eb(a,d);break;case "select":a._wrapperState={wasMultiple:!!d.multiple};e=m$1({},d,{value:void 0});G$1("invalid",a);break;case "textarea":hb(a,d);e=
3955 gb(a,d);G$1("invalid",a);break;default:e=d;}vb(c,e);var h=e;for(f in h)if(h.hasOwnProperty(f)){var k=h[f];"style"===f?tb(a,k):"dangerouslySetInnerHTML"===f?(k=k?k.__html:void 0,null!=k&&ob(a,k)):"children"===f?"string"===typeof k?("textarea"!==c||""!==k)&&pb(a,k):"number"===typeof k&&pb(a,""+k):"suppressContentEditableWarning"!==f&&"suppressHydrationWarning"!==f&&"autoFocus"!==f&&(ca.hasOwnProperty(f)?null!=k&&"onScroll"===f&&G$1("scroll",a):null!=k&&qa(a,f,k,g));}switch(c){case "input":Va(a);cb(a,d,!1);
3956 break;case "textarea":Va(a);jb(a);break;case "option":null!=d.value&&a.setAttribute("value",""+Sa(d.value));break;case "select":a.multiple=!!d.multiple;f=d.value;null!=f?fb(a,!!d.multiple,f,!1):null!=d.defaultValue&&fb(a,!!d.multiple,d.defaultValue,!0);break;default:"function"===typeof e.onClick&&(a.onclick=jf);}mf(c,d)&&(b.flags|=4);}null!==b.ref&&(b.flags|=128);}return null;case 6:if(a&&null!=b.stateNode)Ei(a,b,a.memoizedProps,d);else {if("string"!==typeof d&&null===b.stateNode)throw Error(y$1(166));
3957 c=dh(ch.current);dh(ah.current);rh(b)?(d=b.stateNode,c=b.memoizedProps,d[wf]=b,d.nodeValue!==c&&(b.flags|=4)):(d=(9===c.nodeType?c:c.ownerDocument).createTextNode(d),d[wf]=b,b.stateNode=d);}return null;case 13:H$1(P);d=b.memoizedState;if(0!==(b.flags&64))return b.lanes=c,b;d=null!==d;c=!1;null===a?void 0!==b.memoizedProps.fallback&&rh(b):c=null!==a.memoizedState;if(d&&!c&&0!==(b.mode&2))if(null===a&&!0!==b.memoizedProps.unstable_avoidThisFallback||0!==(P.current&1))0===V&&(V=3);else {if(0===V||3===V)V=
3958 4;null===U||0===(Dg&134217727)&&0===(Hi&134217727)||Ii(U,W);}if(d||c)b.flags|=4;return null;case 4:return fh(),Ci(b),null===a&&cf(b.stateNode.containerInfo),null;case 10:return rg(b),null;case 17:return Ff(b.type)&&Gf(),null;case 19:H$1(P);d=b.memoizedState;if(null===d)return null;f=0!==(b.flags&64);g=d.rendering;if(null===g)if(f)Fi(d,!1);else {if(0!==V||null!==a&&0!==(a.flags&64))for(a=b.child;null!==a;){g=ih(a);if(null!==g){b.flags|=64;Fi(d,!1);f=g.updateQueue;null!==f&&(b.updateQueue=f,b.flags|=4);
3959 null===d.lastEffect&&(b.firstEffect=null);b.lastEffect=d.lastEffect;d=c;for(c=b.child;null!==c;)f=c,a=d,f.flags&=2,f.nextEffect=null,f.firstEffect=null,f.lastEffect=null,g=f.alternate,null===g?(f.childLanes=0,f.lanes=a,f.child=null,f.memoizedProps=null,f.memoizedState=null,f.updateQueue=null,f.dependencies=null,f.stateNode=null):(f.childLanes=g.childLanes,f.lanes=g.lanes,f.child=g.child,f.memoizedProps=g.memoizedProps,f.memoizedState=g.memoizedState,f.updateQueue=g.updateQueue,f.type=g.type,a=g.dependencies,
3960 f.dependencies=null===a?null:{lanes:a.lanes,firstContext:a.firstContext}),c=c.sibling;I$1(P,P.current&1|2);return b.child}a=a.sibling;}null!==d.tail&&O()>Ji&&(b.flags|=64,f=!0,Fi(d,!1),b.lanes=33554432);}else {if(!f)if(a=ih(g),null!==a){if(b.flags|=64,f=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Fi(d,!0),null===d.tail&&"hidden"===d.tailMode&&!g.alternate&&!lh)return b=b.lastEffect=d.lastEffect,null!==b&&(b.nextEffect=null),null}else 2*O()-d.renderingStartTime>Ji&&1073741824!==c&&(b.flags|=
3961 64,f=!0,Fi(d,!1),b.lanes=33554432);d.isBackwards?(g.sibling=b.child,b.child=g):(c=d.last,null!==c?c.sibling=g:b.child=g,d.last=g);}return null!==d.tail?(c=d.tail,d.rendering=c,d.tail=c.sibling,d.lastEffect=b.lastEffect,d.renderingStartTime=O(),c.sibling=null,b=P.current,I$1(P,f?b&1|2:b&1),c):null;case 23:case 24:return Ki(),null!==a&&null!==a.memoizedState!==(null!==b.memoizedState)&&"unstable-defer-without-hiding"!==d.mode&&(b.flags|=4),null}throw Error(y$1(156,b.tag));}
3962 function Li(a){switch(a.tag){case 1:Ff(a.type)&&Gf();var b=a.flags;return b&4096?(a.flags=b&-4097|64,a):null;case 3:fh();H$1(N);H$1(M);uh();b=a.flags;if(0!==(b&64))throw Error(y$1(285));a.flags=b&-4097|64;return a;case 5:return hh(a),null;case 13:return H$1(P),b=a.flags,b&4096?(a.flags=b&-4097|64,a):null;case 19:return H$1(P),null;case 4:return fh(),null;case 10:return rg(a),null;case 23:case 24:return Ki(),null;default:return null}}
3963 function Mi(a,b){try{var c="",d=b;do c+=Qa(d),d=d.return;while(d);var e=c;}catch(f){e="\nError generating stack: "+f.message+"\n"+f.stack;}return {value:a,source:b,stack:e}}function Ni(a,b){try{console.error(b.value);}catch(c){setTimeout(function(){throw c;});}}var Oi="function"===typeof WeakMap?WeakMap:Map;function Pi(a,b,c){c=zg(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Qi||(Qi=!0,Ri=d);Ni(a,b);};return c}
3964 function Si(a,b,c){c=zg(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if("function"===typeof d){var e=b.value;c.payload=function(){Ni(a,b);return d(e)};}var f=a.stateNode;null!==f&&"function"===typeof f.componentDidCatch&&(c.callback=function(){"function"!==typeof d&&(null===Ti?Ti=new Set([this]):Ti.add(this),Ni(a,b));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:""});});return c}var Ui="function"===typeof WeakSet?WeakSet:Set;
3965 function Vi(a){var b=a.ref;if(null!==b)if("function"===typeof b)try{b(null);}catch(c){Wi(a,c);}else b.current=null;}function Xi(a,b){switch(b.tag){case 0:case 11:case 15:case 22:return;case 1:if(b.flags&256&&null!==a){var c=a.memoizedProps,d=a.memoizedState;a=b.stateNode;b=a.getSnapshotBeforeUpdate(b.elementType===b.type?c:lg(b.type,c),d);a.__reactInternalSnapshotBeforeUpdate=b;}return;case 3:b.flags&256&&qf(b.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(y$1(163));}
3966 function Yi(a,b,c){switch(c.tag){case 0:case 11:case 15:case 22:b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{if(3===(a.tag&3)){var d=a.create;a.destroy=d();}a=a.next;}while(a!==b)}b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{var e=a;d=e.next;e=e.tag;0!==(e&4)&&0!==(e&1)&&(Zi(c,a),$i(c,a));a=d;}while(a!==b)}return;case 1:a=c.stateNode;c.flags&4&&(null===b?a.componentDidMount():(d=c.elementType===c.type?b.memoizedProps:lg(c.type,b.memoizedProps),a.componentDidUpdate(d,
3967 b.memoizedState,a.__reactInternalSnapshotBeforeUpdate)));b=c.updateQueue;null!==b&&Eg(c,b,a);return;case 3:b=c.updateQueue;if(null!==b){a=null;if(null!==c.child)switch(c.child.tag){case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode;}Eg(c,b,a);}return;case 5:a=c.stateNode;null===b&&c.flags&4&&mf(c.type,c.memoizedProps)&&a.focus();return;case 6:return;case 4:return;case 12:return;case 13:null===c.memoizedState&&(c=c.alternate,null!==c&&(c=c.memoizedState,null!==c&&(c=c.dehydrated,null!==c&&Cc(c))));
3968 return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(y$1(163));}
3969 function aj(a,b){for(var c=a;;){if(5===c.tag){var d=c.stateNode;if(b)d=d.style,"function"===typeof d.setProperty?d.setProperty("display","none","important"):d.display="none";else {d=c.stateNode;var e=c.memoizedProps.style;e=void 0!==e&&null!==e&&e.hasOwnProperty("display")?e.display:null;d.style.display=sb("display",e);}}else if(6===c.tag)c.stateNode.nodeValue=b?"":c.memoizedProps;else if((23!==c.tag&&24!==c.tag||null===c.memoizedState||c===a)&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===
3970 a)break;for(;null===c.sibling;){if(null===c.return||c.return===a)return;c=c.return;}c.sibling.return=c.return;c=c.sibling;}}
3971 function bj(a,b){if(Mf&&"function"===typeof Mf.onCommitFiberUnmount)try{Mf.onCommitFiberUnmount(Lf,b);}catch(f){}switch(b.tag){case 0:case 11:case 14:case 15:case 22:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){var c=a=a.next;do{var d=c,e=d.destroy;d=d.tag;if(void 0!==e)if(0!==(d&4))Zi(b,c);else {d=b;try{e();}catch(f){Wi(d,f);}}c=c.next;}while(c!==a)}break;case 1:Vi(b);a=b.stateNode;if("function"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps,a.state=b.memoizedState,a.componentWillUnmount();}catch(f){Wi(b,
3972 f);}break;case 5:Vi(b);break;case 4:cj(a,b);}}function dj(a){a.alternate=null;a.child=null;a.dependencies=null;a.firstEffect=null;a.lastEffect=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.return=null;a.updateQueue=null;}function ej(a){return 5===a.tag||3===a.tag||4===a.tag}
3973 function fj(a){a:{for(var b=a.return;null!==b;){if(ej(b))break a;b=b.return;}throw Error(y$1(160));}var c=b;b=c.stateNode;switch(c.tag){case 5:var d=!1;break;case 3:b=b.containerInfo;d=!0;break;case 4:b=b.containerInfo;d=!0;break;default:throw Error(y$1(161));}c.flags&16&&(pb(b,""),c.flags&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||ej(c.return)){c=null;break a}c=c.return;}c.sibling.return=c.return;for(c=c.sibling;5!==c.tag&&6!==c.tag&&18!==c.tag;){if(c.flags&2)continue b;if(null===
3974 c.child||4===c.tag)continue b;else c.child.return=c,c=c.child;}if(!(c.flags&2)){c=c.stateNode;break a}}d?gj(a,c,b):hj(a,c,b);}
3975 function gj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=jf));else if(4!==d&&(a=a.child,null!==a))for(gj(a,b,c),a=a.sibling;null!==a;)gj(a,b,c),a=a.sibling;}
3976 function hj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(hj(a,b,c),a=a.sibling;null!==a;)hj(a,b,c),a=a.sibling;}
3977 function cj(a,b){for(var c=b,d=!1,e,f;;){if(!d){d=c.return;a:for(;;){if(null===d)throw Error(y$1(160));e=d.stateNode;switch(d.tag){case 5:f=!1;break a;case 3:e=e.containerInfo;f=!0;break a;case 4:e=e.containerInfo;f=!0;break a}d=d.return;}d=!0;}if(5===c.tag||6===c.tag){a:for(var g=a,h=c,k=h;;)if(bj(g,k),null!==k.child&&4!==k.tag)k.child.return=k,k=k.child;else {if(k===h)break a;for(;null===k.sibling;){if(null===k.return||k.return===h)break a;k=k.return;}k.sibling.return=k.return;k=k.sibling;}f?(g=e,h=c.stateNode,
3978 8===g.nodeType?g.parentNode.removeChild(h):g.removeChild(h)):e.removeChild(c.stateNode);}else if(4===c.tag){if(null!==c.child){e=c.stateNode.containerInfo;f=!0;c.child.return=c;c=c.child;continue}}else if(bj(a,c),null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;4===c.tag&&(d=!1);}c.sibling.return=c.return;c=c.sibling;}}
3979 function ij(a,b){switch(b.tag){case 0:case 11:case 14:case 15:case 22:var c=b.updateQueue;c=null!==c?c.lastEffect:null;if(null!==c){var d=c=c.next;do 3===(d.tag&3)&&(a=d.destroy,d.destroy=void 0,void 0!==a&&a()),d=d.next;while(d!==c)}return;case 1:return;case 5:c=b.stateNode;if(null!=c){d=b.memoizedProps;var e=null!==a?a.memoizedProps:d;a=b.type;var f=b.updateQueue;b.updateQueue=null;if(null!==f){c[xf]=d;"input"===a&&"radio"===d.type&&null!=d.name&&$a(c,d);wb(a,e);b=wb(a,d);for(e=0;e<f.length;e+=
3980 2){var g=f[e],h=f[e+1];"style"===g?tb(c,h):"dangerouslySetInnerHTML"===g?ob(c,h):"children"===g?pb(c,h):qa(c,g,h,b);}switch(a){case "input":ab(c,d);break;case "textarea":ib(c,d);break;case "select":a=c._wrapperState.wasMultiple,c._wrapperState.wasMultiple=!!d.multiple,f=d.value,null!=f?fb(c,!!d.multiple,f,!1):a!==!!d.multiple&&(null!=d.defaultValue?fb(c,!!d.multiple,d.defaultValue,!0):fb(c,!!d.multiple,d.multiple?[]:"",!1));}}}return;case 6:if(null===b.stateNode)throw Error(y$1(162));b.stateNode.nodeValue=
3981 b.memoizedProps;return;case 3:c=b.stateNode;c.hydrate&&(c.hydrate=!1,Cc(c.containerInfo));return;case 12:return;case 13:null!==b.memoizedState&&(jj=O(),aj(b.child,!0));kj(b);return;case 19:kj(b);return;case 17:return;case 23:case 24:aj(b,null!==b.memoizedState);return}throw Error(y$1(163));}function kj(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Ui);b.forEach(function(b){var d=lj.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d));});}}
3982 function mj(a,b){return null!==a&&(a=a.memoizedState,null===a||null!==a.dehydrated)?(b=b.memoizedState,null!==b&&null===b.dehydrated):!1}var nj=Math.ceil,oj=ra.ReactCurrentDispatcher,pj=ra.ReactCurrentOwner,X=0,U=null,Y=null,W=0,qj=0,rj=Bf(0),V=0,sj=null,tj=0,Dg=0,Hi=0,uj=0,vj=null,jj=0,Ji=Infinity;function wj(){Ji=O()+500;}var Z=null,Qi=!1,Ri=null,Ti=null,xj=!1,yj=null,zj=90,Aj=[],Bj=[],Cj=null,Dj=0,Ej=null,Fj=-1,Gj=0,Hj=0,Ij=null,Jj=!1;function Hg(){return 0!==(X&48)?O():-1!==Fj?Fj:Fj=O()}
3983 function Ig(a){a=a.mode;if(0===(a&2))return 1;if(0===(a&4))return 99===eg()?1:2;0===Gj&&(Gj=tj);if(0!==kg.transition){0!==Hj&&(Hj=null!==vj?vj.pendingLanes:0);a=Gj;var b=4186112&~Hj;b&=-b;0===b&&(a=4186112&~a,b=a&-a,0===b&&(b=8192));return b}a=eg();0!==(X&4)&&98===a?a=Xc(12,Gj):(a=Sc(a),a=Xc(a,Gj));return a}
3984 function Jg(a,b,c){if(50<Dj)throw Dj=0,Ej=null,Error(y$1(185));a=Kj(a,b);if(null===a)return null;$c(a,b,c);a===U&&(Hi|=b,4===V&&Ii(a,W));var d=eg();1===b?0!==(X&8)&&0===(X&48)?Lj(a):(Mj(a,c),0===X&&(wj(),ig())):(0===(X&4)||98!==d&&99!==d||(null===Cj?Cj=new Set([a]):Cj.add(a)),Mj(a,c));vj=a;}function Kj(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);c=a;for(a=a.return;null!==a;)a.childLanes|=b,c=a.alternate,null!==c&&(c.childLanes|=b),c=a,a=a.return;return 3===c.tag?c.stateNode:null}
3985 function Mj(a,b){for(var c=a.callbackNode,d=a.suspendedLanes,e=a.pingedLanes,f=a.expirationTimes,g=a.pendingLanes;0<g;){var h=31-Vc(g),k=1<<h,l=f[h];if(-1===l){if(0===(k&d)||0!==(k&e)){l=b;Rc(k);var n=F$1;f[h]=10<=n?l+250:6<=n?l+5E3:-1;}}else l<=b&&(a.expiredLanes|=k);g&=~k;}d=Uc(a,a===U?W:0);b=F$1;if(0===d)null!==c&&(c!==Zf&&Pf(c),a.callbackNode=null,a.callbackPriority=0);else {if(null!==c){if(a.callbackPriority===b)return;c!==Zf&&Pf(c);}15===b?(c=Lj.bind(null,a),null===ag?(ag=[c],bg=Of(Uf,jg)):ag.push(c),
3986 c=Zf):14===b?c=hg(99,Lj.bind(null,a)):(c=Tc(b),c=hg(c,Nj.bind(null,a)));a.callbackPriority=b;a.callbackNode=c;}}
3987 function Nj(a){Fj=-1;Hj=Gj=0;if(0!==(X&48))throw Error(y$1(327));var b=a.callbackNode;if(Oj()&&a.callbackNode!==b)return null;var c=Uc(a,a===U?W:0);if(0===c)return null;var d=c;var e=X;X|=16;var f=Pj();if(U!==a||W!==d)wj(),Qj(a,d);do try{Rj();break}catch(h){Sj(a,h);}while(1);qg();oj.current=f;X=e;null!==Y?d=0:(U=null,W=0,d=V);if(0!==(tj&Hi))Qj(a,0);else if(0!==d){2===d&&(X|=64,a.hydrate&&(a.hydrate=!1,qf(a.containerInfo)),c=Wc(a),0!==c&&(d=Tj(a,c)));if(1===d)throw b=sj,Qj(a,0),Ii(a,c),Mj(a,O()),b;a.finishedWork=
3988 a.current.alternate;a.finishedLanes=c;switch(d){case 0:case 1:throw Error(y$1(345));case 2:Uj(a);break;case 3:Ii(a,c);if((c&62914560)===c&&(d=jj+500-O(),10<d)){if(0!==Uc(a,0))break;e=a.suspendedLanes;if((e&c)!==c){Hg();a.pingedLanes|=a.suspendedLanes&e;break}a.timeoutHandle=of(Uj.bind(null,a),d);break}Uj(a);break;case 4:Ii(a,c);if((c&4186112)===c)break;d=a.eventTimes;for(e=-1;0<c;){var g=31-Vc(c);f=1<<g;g=d[g];g>e&&(e=g);c&=~f;}c=e;c=O()-c;c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3E3>c?3E3:4320>
3989 c?4320:1960*nj(c/1960))-c;if(10<c){a.timeoutHandle=of(Uj.bind(null,a),c);break}Uj(a);break;case 5:Uj(a);break;default:throw Error(y$1(329));}}Mj(a,O());return a.callbackNode===b?Nj.bind(null,a):null}function Ii(a,b){b&=~uj;b&=~Hi;a.suspendedLanes|=b;a.pingedLanes&=~b;for(a=a.expirationTimes;0<b;){var c=31-Vc(b),d=1<<c;a[c]=-1;b&=~d;}}
3990 function Lj(a){if(0!==(X&48))throw Error(y$1(327));Oj();if(a===U&&0!==(a.expiredLanes&W)){var b=W;var c=Tj(a,b);0!==(tj&Hi)&&(b=Uc(a,b),c=Tj(a,b));}else b=Uc(a,0),c=Tj(a,b);0!==a.tag&&2===c&&(X|=64,a.hydrate&&(a.hydrate=!1,qf(a.containerInfo)),b=Wc(a),0!==b&&(c=Tj(a,b)));if(1===c)throw c=sj,Qj(a,0),Ii(a,b),Mj(a,O()),c;a.finishedWork=a.current.alternate;a.finishedLanes=b;Uj(a);Mj(a,O());return null}
3991 function Vj(){if(null!==Cj){var a=Cj;Cj=null;a.forEach(function(a){a.expiredLanes|=24&a.pendingLanes;Mj(a,O());});}ig();}function Wj(a,b){var c=X;X|=1;try{return a(b)}finally{X=c,0===X&&(wj(),ig());}}function Xj(a,b){var c=X;X&=-2;X|=8;try{return a(b)}finally{X=c,0===X&&(wj(),ig());}}function ni(a,b){I$1(rj,qj);qj|=b;tj|=b;}function Ki(){qj=rj.current;H$1(rj);}
3992 function Qj(a,b){a.finishedWork=null;a.finishedLanes=0;var c=a.timeoutHandle;-1!==c&&(a.timeoutHandle=-1,pf(c));if(null!==Y)for(c=Y.return;null!==c;){var d=c;switch(d.tag){case 1:d=d.type.childContextTypes;null!==d&&void 0!==d&&Gf();break;case 3:fh();H$1(N);H$1(M);uh();break;case 5:hh(d);break;case 4:fh();break;case 13:H$1(P);break;case 19:H$1(P);break;case 10:rg(d);break;case 23:case 24:Ki();}c=c.return;}U=a;Y=Tg(a.current,null);W=qj=tj=b;V=0;sj=null;uj=Hi=Dg=0;}
3993 function Sj(a,b){do{var c=Y;try{qg();vh.current=Gh;if(yh){for(var d=R.memoizedState;null!==d;){var e=d.queue;null!==e&&(e.pending=null);d=d.next;}yh=!1;}xh=0;T=S=R=null;zh=!1;pj.current=null;if(null===c||null===c.return){V=1;sj=b;Y=null;break}a:{var f=a,g=c.return,h=c,k=b;b=W;h.flags|=2048;h.firstEffect=h.lastEffect=null;if(null!==k&&"object"===typeof k&&"function"===typeof k.then){var l=k;if(0===(h.mode&2)){var n=h.alternate;n?(h.updateQueue=n.updateQueue,h.memoizedState=n.memoizedState,h.lanes=n.lanes):
3994 (h.updateQueue=null,h.memoizedState=null);}var A=0!==(P.current&1),p=g;do{var C;if(C=13===p.tag){var x=p.memoizedState;if(null!==x)C=null!==x.dehydrated?!0:!1;else {var w=p.memoizedProps;C=void 0===w.fallback?!1:!0!==w.unstable_avoidThisFallback?!0:A?!1:!0;}}if(C){var z=p.updateQueue;if(null===z){var u=new Set;u.add(l);p.updateQueue=u;}else z.add(l);if(0===(p.mode&2)){p.flags|=64;h.flags|=16384;h.flags&=-2981;if(1===h.tag)if(null===h.alternate)h.tag=17;else {var t=zg(-1,1);t.tag=2;Ag(h,t);}h.lanes|=1;break a}k=
3995 void 0;h=b;var q=f.pingCache;null===q?(q=f.pingCache=new Oi,k=new Set,q.set(l,k)):(k=q.get(l),void 0===k&&(k=new Set,q.set(l,k)));if(!k.has(h)){k.add(h);var v=Yj.bind(null,f,l,h);l.then(v,v);}p.flags|=4096;p.lanes=b;break a}p=p.return;}while(null!==p);k=Error((Ra(h.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.");}5!==V&&(V=2);k=Mi(k,h);p=
3996 g;do{switch(p.tag){case 3:f=k;p.flags|=4096;b&=-b;p.lanes|=b;var J=Pi(p,f,b);Bg(p,J);break a;case 1:f=k;var K=p.type,Q=p.stateNode;if(0===(p.flags&64)&&("function"===typeof K.getDerivedStateFromError||null!==Q&&"function"===typeof Q.componentDidCatch&&(null===Ti||!Ti.has(Q)))){p.flags|=4096;b&=-b;p.lanes|=b;var L=Si(p,f,b);Bg(p,L);break a}}p=p.return;}while(null!==p)}Zj(c);}catch(va){b=va;Y===c&&null!==c&&(Y=c=c.return);continue}break}while(1)}
3997 function Pj(){var a=oj.current;oj.current=Gh;return null===a?Gh:a}function Tj(a,b){var c=X;X|=16;var d=Pj();U===a&&W===b||Qj(a,b);do try{ak();break}catch(e){Sj(a,e);}while(1);qg();X=c;oj.current=d;if(null!==Y)throw Error(y$1(261));U=null;W=0;return V}function ak(){for(;null!==Y;)bk(Y);}function Rj(){for(;null!==Y&&!Qf();)bk(Y);}function bk(a){var b=ck(a.alternate,a,qj);a.memoizedProps=a.pendingProps;null===b?Zj(a):Y=b;pj.current=null;}
3998 function Zj(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&2048)){c=Gi(c,b,qj);if(null!==c){Y=c;return}c=b;if(24!==c.tag&&23!==c.tag||null===c.memoizedState||0!==(qj&1073741824)||0===(c.mode&4)){for(var d=0,e=c.child;null!==e;)d|=e.lanes|e.childLanes,e=e.sibling;c.childLanes=d;}null!==a&&0===(a.flags&2048)&&(null===a.firstEffect&&(a.firstEffect=b.firstEffect),null!==b.lastEffect&&(null!==a.lastEffect&&(a.lastEffect.nextEffect=b.firstEffect),a.lastEffect=b.lastEffect),1<b.flags&&(null!==
3999 a.lastEffect?a.lastEffect.nextEffect=b:a.firstEffect=b,a.lastEffect=b));}else {c=Li(b);if(null!==c){c.flags&=2047;Y=c;return}null!==a&&(a.firstEffect=a.lastEffect=null,a.flags|=2048);}b=b.sibling;if(null!==b){Y=b;return}Y=b=a;}while(null!==b);0===V&&(V=5);}function Uj(a){var b=eg();gg(99,dk.bind(null,a,b));return null}
4000 function dk(a,b){do Oj();while(null!==yj);if(0!==(X&48))throw Error(y$1(327));var c=a.finishedWork;if(null===c)return null;a.finishedWork=null;a.finishedLanes=0;if(c===a.current)throw Error(y$1(177));a.callbackNode=null;var d=c.lanes|c.childLanes,e=d,f=a.pendingLanes&~e;a.pendingLanes=e;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=e;a.mutableReadLanes&=e;a.entangledLanes&=e;e=a.entanglements;for(var g=a.eventTimes,h=a.expirationTimes;0<f;){var k=31-Vc(f),l=1<<k;e[k]=0;g[k]=-1;h[k]=-1;f&=~l;}null!==
4001 Cj&&0===(d&24)&&Cj.has(a)&&Cj.delete(a);a===U&&(Y=U=null,W=0);1<c.flags?null!==c.lastEffect?(c.lastEffect.nextEffect=c,d=c.firstEffect):d=c:d=c.firstEffect;if(null!==d){e=X;X|=32;pj.current=null;kf=fd;g=Ne();if(Oe(g)){if("selectionStart"in g)h={start:g.selectionStart,end:g.selectionEnd};else a:if(h=(h=g.ownerDocument)&&h.defaultView||window,(l=h.getSelection&&h.getSelection())&&0!==l.rangeCount){h=l.anchorNode;f=l.anchorOffset;k=l.focusNode;l=l.focusOffset;try{h.nodeType,k.nodeType;}catch(va){h=null;
4002 break a}var n=0,A=-1,p=-1,C=0,x=0,w=g,z=null;b:for(;;){for(var u;;){w!==h||0!==f&&3!==w.nodeType||(A=n+f);w!==k||0!==l&&3!==w.nodeType||(p=n+l);3===w.nodeType&&(n+=w.nodeValue.length);if(null===(u=w.firstChild))break;z=w;w=u;}for(;;){if(w===g)break b;z===h&&++C===f&&(A=n);z===k&&++x===l&&(p=n);if(null!==(u=w.nextSibling))break;w=z;z=w.parentNode;}w=u;}h=-1===A||-1===p?null:{start:A,end:p};}else h=null;h=h||{start:0,end:0};}else h=null;lf={focusedElem:g,selectionRange:h};fd=!1;Ij=null;Jj=!1;Z=d;do try{ek();}catch(va){if(null===
4003 Z)throw Error(y$1(330));Wi(Z,va);Z=Z.nextEffect;}while(null!==Z);Ij=null;Z=d;do try{for(g=a;null!==Z;){var t=Z.flags;t&16&&pb(Z.stateNode,"");if(t&128){var q=Z.alternate;if(null!==q){var v=q.ref;null!==v&&("function"===typeof v?v(null):v.current=null);}}switch(t&1038){case 2:fj(Z);Z.flags&=-3;break;case 6:fj(Z);Z.flags&=-3;ij(Z.alternate,Z);break;case 1024:Z.flags&=-1025;break;case 1028:Z.flags&=-1025;ij(Z.alternate,Z);break;case 4:ij(Z.alternate,Z);break;case 8:h=Z;cj(g,h);var J=h.alternate;dj(h);null!==
4004 J&&dj(J);}Z=Z.nextEffect;}}catch(va){if(null===Z)throw Error(y$1(330));Wi(Z,va);Z=Z.nextEffect;}while(null!==Z);v=lf;q=Ne();t=v.focusedElem;g=v.selectionRange;if(q!==t&&t&&t.ownerDocument&&Me(t.ownerDocument.documentElement,t)){null!==g&&Oe(t)&&(q=g.start,v=g.end,void 0===v&&(v=q),"selectionStart"in t?(t.selectionStart=q,t.selectionEnd=Math.min(v,t.value.length)):(v=(q=t.ownerDocument||document)&&q.defaultView||window,v.getSelection&&(v=v.getSelection(),h=t.textContent.length,J=Math.min(g.start,h),g=void 0===
4005 g.end?J:Math.min(g.end,h),!v.extend&&J>g&&(h=g,g=J,J=h),h=Le(t,J),f=Le(t,g),h&&f&&(1!==v.rangeCount||v.anchorNode!==h.node||v.anchorOffset!==h.offset||v.focusNode!==f.node||v.focusOffset!==f.offset)&&(q=q.createRange(),q.setStart(h.node,h.offset),v.removeAllRanges(),J>g?(v.addRange(q),v.extend(f.node,f.offset)):(q.setEnd(f.node,f.offset),v.addRange(q))))));q=[];for(v=t;v=v.parentNode;)1===v.nodeType&&q.push({element:v,left:v.scrollLeft,top:v.scrollTop});"function"===typeof t.focus&&t.focus();for(t=
4006 0;t<q.length;t++)v=q[t],v.element.scrollLeft=v.left,v.element.scrollTop=v.top;}fd=!!kf;lf=kf=null;a.current=c;Z=d;do try{for(t=a;null!==Z;){var K=Z.flags;K&36&&Yi(t,Z.alternate,Z);if(K&128){q=void 0;var Q=Z.ref;if(null!==Q){var L=Z.stateNode;switch(Z.tag){case 5:q=L;break;default:q=L;}"function"===typeof Q?Q(q):Q.current=q;}}Z=Z.nextEffect;}}catch(va){if(null===Z)throw Error(y$1(330));Wi(Z,va);Z=Z.nextEffect;}while(null!==Z);Z=null;$f();X=e;}else a.current=c;if(xj)xj=!1,yj=a,zj=b;else for(Z=d;null!==Z;)b=
4007 Z.nextEffect,Z.nextEffect=null,Z.flags&8&&(K=Z,K.sibling=null,K.stateNode=null),Z=b;d=a.pendingLanes;0===d&&(Ti=null);1===d?a===Ej?Dj++:(Dj=0,Ej=a):Dj=0;c=c.stateNode;if(Mf&&"function"===typeof Mf.onCommitFiberRoot)try{Mf.onCommitFiberRoot(Lf,c,void 0,64===(c.current.flags&64));}catch(va){}Mj(a,O());if(Qi)throw Qi=!1,a=Ri,Ri=null,a;if(0!==(X&8))return null;ig();return null}
4008 function ek(){for(;null!==Z;){var a=Z.alternate;Jj||null===Ij||(0!==(Z.flags&8)?dc(Z,Ij)&&(Jj=!0):13===Z.tag&&mj(a,Z)&&dc(Z,Ij)&&(Jj=!0));var b=Z.flags;0!==(b&256)&&Xi(a,Z);0===(b&512)||xj||(xj=!0,hg(97,function(){Oj();return null}));Z=Z.nextEffect;}}function Oj(){if(90!==zj){var a=97<zj?97:zj;zj=90;return gg(a,fk)}return !1}function $i(a,b){Aj.push(b,a);xj||(xj=!0,hg(97,function(){Oj();return null}));}function Zi(a,b){Bj.push(b,a);xj||(xj=!0,hg(97,function(){Oj();return null}));}
4009 function fk(){if(null===yj)return !1;var a=yj;yj=null;if(0!==(X&48))throw Error(y$1(331));var b=X;X|=32;var c=Bj;Bj=[];for(var d=0;d<c.length;d+=2){var e=c[d],f=c[d+1],g=e.destroy;e.destroy=void 0;if("function"===typeof g)try{g();}catch(k){if(null===f)throw Error(y$1(330));Wi(f,k);}}c=Aj;Aj=[];for(d=0;d<c.length;d+=2){e=c[d];f=c[d+1];try{var h=e.create;e.destroy=h();}catch(k){if(null===f)throw Error(y$1(330));Wi(f,k);}}for(h=a.current.firstEffect;null!==h;)a=h.nextEffect,h.nextEffect=null,h.flags&8&&(h.sibling=
4010 null,h.stateNode=null),h=a;X=b;ig();return !0}function gk(a,b,c){b=Mi(c,b);b=Pi(a,b,1);Ag(a,b);b=Hg();a=Kj(a,1);null!==a&&($c(a,1,b),Mj(a,b));}
4011 function Wi(a,b){if(3===a.tag)gk(a,a,b);else for(var c=a.return;null!==c;){if(3===c.tag){gk(c,a,b);break}else if(1===c.tag){var d=c.stateNode;if("function"===typeof c.type.getDerivedStateFromError||"function"===typeof d.componentDidCatch&&(null===Ti||!Ti.has(d))){a=Mi(b,a);var e=Si(c,a,1);Ag(c,e);e=Hg();c=Kj(c,1);if(null!==c)$c(c,1,e),Mj(c,e);else if("function"===typeof d.componentDidCatch&&(null===Ti||!Ti.has(d)))try{d.componentDidCatch(b,a);}catch(f){}break}}c=c.return;}}
4012 function Yj(a,b,c){var d=a.pingCache;null!==d&&d.delete(b);b=Hg();a.pingedLanes|=a.suspendedLanes&c;U===a&&(W&c)===c&&(4===V||3===V&&(W&62914560)===W&&500>O()-jj?Qj(a,0):uj|=c);Mj(a,b);}function lj(a,b){var c=a.stateNode;null!==c&&c.delete(b);b=0;0===b&&(b=a.mode,0===(b&2)?b=1:0===(b&4)?b=99===eg()?1:2:(0===Gj&&(Gj=tj),b=Yc(62914560&~Gj),0===b&&(b=4194304)));c=Hg();a=Kj(a,b);null!==a&&($c(a,b,c),Mj(a,c));}var ck;
4013 ck=function(a,b,c){var d=b.lanes;if(null!==a)if(a.memoizedProps!==b.pendingProps||N.current)ug=!0;else if(0!==(c&d))ug=0!==(a.flags&16384)?!0:!1;else {ug=!1;switch(b.tag){case 3:ri(b);sh();break;case 5:gh(b);break;case 1:Ff(b.type)&&Jf(b);break;case 4:eh(b,b.stateNode.containerInfo);break;case 10:d=b.memoizedProps.value;var e=b.type._context;I$1(mg,e._currentValue);e._currentValue=d;break;case 13:if(null!==b.memoizedState){if(0!==(c&b.child.childLanes))return ti(a,b,c);I$1(P,P.current&1);b=hi(a,b,c);return null!==
4014 b?b.sibling:null}I$1(P,P.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&64)){if(d)return Ai(a,b,c);b.flags|=64;}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);I$1(P,P.current);if(d)break;else return null;case 23:case 24:return b.lanes=0,mi(a,b,c)}return hi(a,b,c)}else ug=!1;b.lanes=0;switch(b.tag){case 2:d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=Ef(b,M.current);tg(b,c);e=Ch(null,b,d,a,e,c);b.flags|=1;if("object"===
4015 typeof e&&null!==e&&"function"===typeof e.render&&void 0===e.$$typeof){b.tag=1;b.memoizedState=null;b.updateQueue=null;if(Ff(d)){var f=!0;Jf(b);}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;xg(b);var g=d.getDerivedStateFromProps;"function"===typeof g&&Gg(b,d,g,a);e.updater=Kg;b.stateNode=e;e._reactInternals=b;Og(b,d,a,c);b=qi(null,b,d,!0,f,c);}else b.tag=0,fi(null,b,e,c),b=b.child;return b;case 16:e=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);
4016 a=b.pendingProps;f=e._init;e=f(e._payload);b.type=e;f=b.tag=hk(e);a=lg(e,a);switch(f){case 0:b=li(null,b,e,a,c);break a;case 1:b=pi(null,b,e,a,c);break a;case 11:b=gi(null,b,e,a,c);break a;case 14:b=ii(null,b,e,lg(e.type,a),d,c);break a}throw Error(y$1(306,e,""));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),li(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),pi(a,b,d,e,c);case 3:ri(b);d=b.updateQueue;if(null===a||null===d)throw Error(y$1(282));
4017 d=b.pendingProps;e=b.memoizedState;e=null!==e?e.element:null;yg(a,b);Cg(b,d,null,c);d=b.memoizedState.element;if(d===e)sh(),b=hi(a,b,c);else {e=b.stateNode;if(f=e.hydrate)kh=rf(b.stateNode.containerInfo.firstChild),jh=b,f=lh=!0;if(f){a=e.mutableSourceEagerHydrationData;if(null!=a)for(e=0;e<a.length;e+=2)f=a[e],f._workInProgressVersionPrimary=a[e+1],th.push(f);c=Zg(b,null,d,c);for(b.child=c;c;)c.flags=c.flags&-3|1024,c=c.sibling;}else fi(a,b,d,c),sh();b=b.child;}return b;case 5:return gh(b),null===a&&
4018 ph(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,nf(d,e)?g=null:null!==f&&nf(d,f)&&(b.flags|=16),oi(a,b),fi(a,b,g,c),b.child;case 6:return null===a&&ph(b),null;case 13:return ti(a,b,c);case 4:return eh(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Yg(b,null,d,c):fi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),gi(a,b,d,e,c);case 7:return fi(a,b,b.pendingProps,c),b.child;case 8:return fi(a,b,b.pendingProps.children,
4019 c),b.child;case 12:return fi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;g=b.memoizedProps;f=e.value;var h=b.type._context;I$1(mg,h._currentValue);h._currentValue=f;if(null!==g)if(h=g.value,f=He(h,f)?0:("function"===typeof d._calculateChangedBits?d._calculateChangedBits(h,f):1073741823)|0,0===f){if(g.children===e.children&&!N.current){b=hi(a,b,c);break a}}else for(h=b.child,null!==h&&(h.return=b);null!==h;){var k=h.dependencies;if(null!==k){g=h.child;for(var l=
4020 k.firstContext;null!==l;){if(l.context===d&&0!==(l.observedBits&f)){1===h.tag&&(l=zg(-1,c&-c),l.tag=2,Ag(h,l));h.lanes|=c;l=h.alternate;null!==l&&(l.lanes|=c);sg(h.return,c);k.lanes|=c;break}l=l.next;}}else g=10===h.tag?h.type===b.type?null:h.child:h.child;if(null!==g)g.return=h;else for(g=h;null!==g;){if(g===b){g=null;break}h=g.sibling;if(null!==h){h.return=g.return;g=h;break}g=g.return;}h=g;}fi(a,b,e.children,c);b=b.child;}return b;case 9:return e=b.type,f=b.pendingProps,d=f.children,tg(b,c),e=vg(e,
4021 f.unstable_observedBits),d=d(e),b.flags|=1,fi(a,b,d,c),b.child;case 14:return e=b.type,f=lg(e,b.pendingProps),f=lg(e.type,f),ii(a,b,e,f,d,c);case 15:return ki(a,b,b.type,b.pendingProps,d,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2),b.tag=1,Ff(d)?(a=!0,Jf(b)):a=!1,tg(b,c),Mg(b,d,e),Og(b,d,e,c),qi(null,b,d,!0,a,c);case 19:return Ai(a,b,c);case 23:return mi(a,b,c);case 24:return mi(a,b,c)}throw Error(y$1(156,b.tag));
4022 };function ik(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.flags=0;this.lastEffect=this.firstEffect=this.nextEffect=null;this.childLanes=this.lanes=0;this.alternate=null;}function nh(a,b,c,d){return new ik(a,b,c,d)}function ji(a){a=a.prototype;return !(!a||!a.isReactComponent)}
4023 function hk(a){if("function"===typeof a)return ji(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Aa)return 11;if(a===Da)return 14}return 2}
4024 function Tg(a,b){var c=a.alternate;null===c?(c=nh(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.nextEffect=null,c.firstEffect=null,c.lastEffect=null);c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};
4025 c.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}
4026 function Vg(a,b,c,d,e,f){var g=2;d=a;if("function"===typeof a)ji(a)&&(g=1);else if("string"===typeof a)g=5;else a:switch(a){case ua:return Xg(c.children,e,f,b);case Ha:g=8;e|=16;break;case wa:g=8;e|=1;break;case xa:return a=nh(12,c,b,e|8),a.elementType=xa,a.type=xa,a.lanes=f,a;case Ba:return a=nh(13,c,b,e),a.type=Ba,a.elementType=Ba,a.lanes=f,a;case Ca:return a=nh(19,c,b,e),a.elementType=Ca,a.lanes=f,a;case Ia:return vi(c,e,f,b);case Ja:return a=nh(24,c,b,e),a.elementType=Ja,a.lanes=f,a;default:if("object"===
4027 typeof a&&null!==a)switch(a.$$typeof){case ya:g=10;break a;case za:g=9;break a;case Aa:g=11;break a;case Da:g=14;break a;case Ea:g=16;d=null;break a;case Fa:g=22;break a}throw Error(y$1(130,null==a?a:typeof a,""));}b=nh(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Xg(a,b,c,d){a=nh(7,a,d,b);a.lanes=c;return a}function vi(a,b,c,d){a=nh(23,a,d,b);a.elementType=Ia;a.lanes=c;return a}function Ug(a,b,c){a=nh(6,a,null,b);a.lanes=c;return a}
4028 function Wg(a,b,c){b=nh(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}
4029 function jk(a,b,c){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.pendingContext=this.context=null;this.hydrate=c;this.callbackNode=null;this.callbackPriority=0;this.eventTimes=Zc(0);this.expirationTimes=Zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=Zc(0);this.mutableSourceEagerHydrationData=null;}
4030 function kk(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return {$$typeof:ta,key:null==d?null:""+d,children:a,containerInfo:b,implementation:c}}
4031 function lk(a,b,c,d){var e=b.current,f=Hg(),g=Ig(e);a:if(c){c=c._reactInternals;b:{if(Zb(c)!==c||1!==c.tag)throw Error(y$1(170));var h=c;do{switch(h.tag){case 3:h=h.stateNode.context;break b;case 1:if(Ff(h.type)){h=h.stateNode.__reactInternalMemoizedMergedChildContext;break b}}h=h.return;}while(null!==h);throw Error(y$1(171));}if(1===c.tag){var k=c.type;if(Ff(k)){c=If(c,k,h);break a}}c=h;}else c=Cf;null===b.context?b.context=c:b.pendingContext=c;b=zg(f,g);b.payload={element:a};d=void 0===d?null:d;null!==
4032 d&&(b.callback=d);Ag(e,b);Jg(e,g,f);return g}function mk(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 5:return a.child.stateNode;default:return a.child.stateNode}}function nk(a,b){a=a.memoizedState;if(null!==a&&null!==a.dehydrated){var c=a.retryLane;a.retryLane=0!==c&&c<b?c:b;}}function ok(a,b){nk(a,b);(a=a.alternate)&&nk(a,b);}function pk(){return null}
4033 function qk(a,b,c){var d=null!=c&&null!=c.hydrationOptions&&c.hydrationOptions.mutableSources||null;c=new jk(a,b,null!=c&&!0===c.hydrate);b=nh(3,null,null,2===b?7:1===b?3:0);c.current=b;b.stateNode=c;xg(b);a[ff]=c.current;cf(8===a.nodeType?a.parentNode:a);if(d)for(a=0;a<d.length;a++){b=d[a];var e=b._getVersion;e=e(b._source);null==c.mutableSourceEagerHydrationData?c.mutableSourceEagerHydrationData=[b,e]:c.mutableSourceEagerHydrationData.push(b,e);}this._internalRoot=c;}
4034 qk.prototype.render=function(a){lk(a,this._internalRoot,null,null);};qk.prototype.unmount=function(){var a=this._internalRoot,b=a.containerInfo;lk(null,a,null,function(){b[ff]=null;});};function rk(a){return !(!a||1!==a.nodeType&&9!==a.nodeType&&11!==a.nodeType&&(8!==a.nodeType||" react-mount-point-unstable "!==a.nodeValue))}
4035 function sk(a,b){b||(b=a?9===a.nodeType?a.documentElement:a.firstChild:null,b=!(!b||1!==b.nodeType||!b.hasAttribute("data-reactroot")));if(!b)for(var c;c=a.lastChild;)a.removeChild(c);return new qk(a,0,b?{hydrate:!0}:void 0)}
4036 function tk(a,b,c,d,e){var f=c._reactRootContainer;if(f){var g=f._internalRoot;if("function"===typeof e){var h=e;e=function(){var a=mk(g);h.call(a);};}lk(b,g,a,e);}else {f=c._reactRootContainer=sk(c,d);g=f._internalRoot;if("function"===typeof e){var k=e;e=function(){var a=mk(g);k.call(a);};}Xj(function(){lk(b,g,a,e);});}return mk(g)}ec=function(a){if(13===a.tag){var b=Hg();Jg(a,4,b);ok(a,4);}};fc=function(a){if(13===a.tag){var b=Hg();Jg(a,67108864,b);ok(a,67108864);}};
4037 gc=function(a){if(13===a.tag){var b=Hg(),c=Ig(a);Jg(a,c,b);ok(a,c);}};hc=function(a,b){return b()};
4038 yb=function(a,b,c){switch(b){case "input":ab(a,c);b=c.name;if("radio"===c.type&&null!=b){for(c=a;c.parentNode;)c=c.parentNode;c=c.querySelectorAll("input[name="+JSON.stringify(""+b)+'][type="radio"]');for(b=0;b<c.length;b++){var d=c[b];if(d!==a&&d.form===a.form){var e=Db(d);if(!e)throw Error(y$1(90));Wa(d);ab(d,e);}}}break;case "textarea":ib(a,c);break;case "select":b=c.value,null!=b&&fb(a,!!c.multiple,b,!1);}};Gb=Wj;
4039 Hb=function(a,b,c,d,e){var f=X;X|=4;try{return gg(98,a.bind(null,b,c,d,e))}finally{X=f,0===X&&(wj(),ig());}};Ib=function(){0===(X&49)&&(Vj(),Oj());};Jb=function(a,b){var c=X;X|=2;try{return a(b)}finally{X=c,0===X&&(wj(),ig());}};function uk(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!rk(b))throw Error(y$1(200));return kk(a,b,null,c)}var vk={Events:[Cb,ue,Db,Eb,Fb,Oj,{current:!1}]},wk={findFiberByHostInstance:wc,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"};
4040 var xk={bundleType:wk.bundleType,version:wk.version,rendererPackageName:wk.rendererPackageName,rendererConfig:wk.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ra.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){a=cc(a);return null===a?null:a.stateNode},findFiberByHostInstance:wk.findFiberByHostInstance||
4041 pk,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var yk=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yk.isDisabled&&yk.supportsFiber)try{Lf=yk.inject(xk),Mf=yk;}catch(a){}}reactDom_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vk;reactDom_production_min.createPortal=uk;
4042 reactDom_production_min.findDOMNode=function(a){if(null==a)return null;if(1===a.nodeType)return a;var b=a._reactInternals;if(void 0===b){if("function"===typeof a.render)throw Error(y$1(188));throw Error(y$1(268,Object.keys(a)));}a=cc(b);a=null===a?null:a.stateNode;return a};reactDom_production_min.flushSync=function(a,b){var c=X;if(0!==(c&48))return a(b);X|=1;try{if(a)return gg(99,a.bind(null,b))}finally{X=c,ig();}};reactDom_production_min.hydrate=function(a,b,c){if(!rk(b))throw Error(y$1(200));return tk(null,a,b,!0,c)};
4043 reactDom_production_min.render=function(a,b,c){if(!rk(b))throw Error(y$1(200));return tk(null,a,b,!1,c)};reactDom_production_min.unmountComponentAtNode=function(a){if(!rk(a))throw Error(y$1(40));return a._reactRootContainer?(Xj(function(){tk(null,null,a,!1,function(){a._reactRootContainer=null;a[ff]=null;});}),!0):!1};reactDom_production_min.unstable_batchedUpdates=Wj;reactDom_production_min.unstable_createPortal=function(a,b){return uk(a,b,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)};
4044 reactDom_production_min.unstable_renderSubtreeIntoContainer=function(a,b,c,d){if(!rk(c))throw Error(y$1(200));if(null==a||void 0===a._reactInternals)throw Error(y$1(38));return tk(a,b,c,!1,d)};reactDom_production_min.version="17.0.2";
4045
4046 (function (module) {
4047
4048 function checkDCE() {
4049 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
4050 if (
4051 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||
4052 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'
4053 ) {
4054 return;
4055 }
4056 try {
4057 // Verify that the code above has been dead code eliminated (DCE'd).
4058 __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
4059 } catch (err) {
4060 // DevTools shouldn't crash React, no matter what.
4061 // We should still report in case we break this code.
4062 console.error(err);
4063 }
4064 }
4065
4066 {
4067 // DCE check should happen before ReactDOM bundle executes so that
4068 // DevTools can report bad minification during injection.
4069 checkDCE();
4070 module.exports = reactDom_production_min;
4071 }
4072 } (reactDom));
4073
4074 var ReactDOM = /*@__PURE__*/getDefaultExportFromCjs(reactDom.exports);
4075
4076 function chainPropTypes(propType1, propType2) {
4077 {
4078 return function () {
4079 return null;
4080 };
4081 }
4082 }
4083
4084 function _extends$a() {
4085 _extends$a = Object.assign || function (target) {
4086 for (var i = 1; i < arguments.length; i++) {
4087 var source = arguments[i];
4088
4089 for (var key in source) {
4090 if (Object.prototype.hasOwnProperty.call(source, key)) {
4091 target[key] = source[key];
4092 }
4093 }
4094 }
4095
4096 return target;
4097 };
4098
4099 return _extends$a.apply(this, arguments);
4100 }
4101
4102 function _typeof2$2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2$2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2$2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2$2(obj); }
4103
4104 function _typeof$3(obj) {
4105 if (typeof Symbol === "function" && _typeof2$2(Symbol.iterator) === "symbol") {
4106 _typeof$3 = function _typeof(obj) {
4107 return _typeof2$2(obj);
4108 };
4109 } else {
4110 _typeof$3 = function _typeof(obj) {
4111 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2$2(obj);
4112 };
4113 }
4114
4115 return _typeof$3(obj);
4116 }
4117
4118 function isPlainObject(item) {
4119 return item && _typeof$3(item) === 'object' && item.constructor === Object;
4120 }
4121 function deepmerge(target, source) {
4122 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
4123 clone: true
4124 };
4125 var output = options.clone ? _extends$a({}, target) : target;
4126
4127 if (isPlainObject(target) && isPlainObject(source)) {
4128 Object.keys(source).forEach(function (key) {
4129 // Avoid prototype pollution
4130 if (key === '__proto__') {
4131 return;
4132 }
4133
4134 if (isPlainObject(source[key]) && key in target) {
4135 output[key] = deepmerge(target[key], source[key], options);
4136 } else {
4137 output[key] = source[key];
4138 }
4139 });
4140 }
4141
4142 return output;
4143 }
4144
4145 var propTypes = {exports: {}};
4146
4147 /**
4148 * Copyright (c) 2013-present, Facebook, Inc.
4149 *
4150 * This source code is licensed under the MIT license found in the
4151 * LICENSE file in the root directory of this source tree.
4152 */
4153
4154 var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
4155
4156 var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
4157
4158 /**
4159 * Copyright (c) 2013-present, Facebook, Inc.
4160 *
4161 * This source code is licensed under the MIT license found in the
4162 * LICENSE file in the root directory of this source tree.
4163 */
4164
4165 var ReactPropTypesSecret = ReactPropTypesSecret_1;
4166
4167 function emptyFunction() {}
4168 function emptyFunctionWithReset() {}
4169 emptyFunctionWithReset.resetWarningCache = emptyFunction;
4170
4171 var factoryWithThrowingShims = function() {
4172 function shim(props, propName, componentName, location, propFullName, secret) {
4173 if (secret === ReactPropTypesSecret) {
4174 // It is still safe when called from React.
4175 return;
4176 }
4177 var err = new Error(
4178 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
4179 'Use PropTypes.checkPropTypes() to call them. ' +
4180 'Read more at http://fb.me/use-check-prop-types'
4181 );
4182 err.name = 'Invariant Violation';
4183 throw err;
4184 } shim.isRequired = shim;
4185 function getShim() {
4186 return shim;
4187 } // Important!
4188 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
4189 var ReactPropTypes = {
4190 array: shim,
4191 bool: shim,
4192 func: shim,
4193 number: shim,
4194 object: shim,
4195 string: shim,
4196 symbol: shim,
4197
4198 any: shim,
4199 arrayOf: getShim,
4200 element: shim,
4201 elementType: shim,
4202 instanceOf: getShim,
4203 node: shim,
4204 objectOf: getShim,
4205 oneOf: getShim,
4206 oneOfType: getShim,
4207 shape: getShim,
4208 exact: getShim,
4209
4210 checkPropTypes: emptyFunctionWithReset,
4211 resetWarningCache: emptyFunction
4212 };
4213
4214 ReactPropTypes.PropTypes = ReactPropTypes;
4215
4216 return ReactPropTypes;
4217 };
4218
4219 /**
4220 * Copyright (c) 2013-present, Facebook, Inc.
4221 *
4222 * This source code is licensed under the MIT license found in the
4223 * LICENSE file in the root directory of this source tree.
4224 */
4225
4226 {
4227 // By explicitly using `prop-types` you are opting into new production behavior.
4228 // http://fb.me/prop-types-in-prod
4229 propTypes.exports = factoryWithThrowingShims();
4230 }
4231
4232 var elementAcceptingRef = chainPropTypes(propTypes.exports.element);
4233 elementAcceptingRef.isRequired = chainPropTypes(propTypes.exports.element.isRequired);
4234
4235 /**
4236 * WARNING: Don't import this directly.
4237 * Use `MuiError` from `@material-ui/utils/macros/MuiError.macro` instead.
4238 * @param {number} code
4239 */
4240 function formatMuiErrorMessage(code) {
4241 // Apply babel-plugin-transform-template-literals in loose mode
4242 // loose mode is safe iff we're concatenating primitives
4243 // see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose
4244
4245 /* eslint-disable prefer-template */
4246 var url = 'https://mui.com/production-error/?code=' + code;
4247
4248 for (var i = 1; i < arguments.length; i += 1) {
4249 // rest params over-transpile for this case
4250 // eslint-disable-next-line prefer-rest-params
4251 url += '&args[]=' + encodeURIComponent(arguments[i]);
4252 }
4253
4254 return 'Minified Material-UI error #' + code + '; visit ' + url + ' for the full message.';
4255 /* eslint-enable prefer-template */
4256 }
4257
4258 var reactIs$1 = {exports: {}};
4259
4260 var reactIs_production_min = {};
4261
4262 /** @license React v17.0.2
4263 * react-is.production.min.js
4264 *
4265 * Copyright (c) Facebook, Inc. and its affiliates.
4266 *
4267 * This source code is licensed under the MIT license found in the
4268 * LICENSE file in the root directory of this source tree.
4269 */
4270 var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;
4271 if("function"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x("react.element");c=x("react.portal");d=x("react.fragment");e=x("react.strict_mode");f=x("react.profiler");g=x("react.provider");h=x("react.context");k=x("react.forward_ref");l=x("react.suspense");m=x("react.suspense_list");n=x("react.memo");p=x("react.lazy");q=x("react.block");r=x("react.server.block");u=x("react.fundamental");v=x("react.debug_trace_mode");w=x("react.legacy_hidden");}
4272 function y(a){if("object"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=z;reactIs_production_min.Element=A;reactIs_production_min.ForwardRef=B;reactIs_production_min.Fragment=C;reactIs_production_min.Lazy=D;reactIs_production_min.Memo=E;reactIs_production_min.Portal=F;reactIs_production_min.Profiler=G;reactIs_production_min.StrictMode=H;
4273 reactIs_production_min.Suspense=I;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return y(a)===h};reactIs_production_min.isContextProvider=function(a){return y(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return y(a)===k};reactIs_production_min.isFragment=function(a){return y(a)===d};reactIs_production_min.isLazy=function(a){return y(a)===p};reactIs_production_min.isMemo=function(a){return y(a)===n};
4274 reactIs_production_min.isPortal=function(a){return y(a)===c};reactIs_production_min.isProfiler=function(a){return y(a)===f};reactIs_production_min.isStrictMode=function(a){return y(a)===e};reactIs_production_min.isSuspense=function(a){return y(a)===l};reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};
4275 reactIs_production_min.typeOf=y;
4276
4277 (function (module) {
4278
4279 {
4280 module.exports = reactIs_production_min;
4281 }
4282 } (reactIs$1));
4283
4284 /* eslint-disable */
4285 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
4286 typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
4287
4288 propTypes.exports.oneOfType([propTypes.exports.func, propTypes.exports.object]);
4289
4290 var hasSymbol = typeof Symbol === 'function' && Symbol.for;
4291 var nested = hasSymbol ? Symbol.for('mui.nested') : '__THEME_NESTED__';
4292
4293 /**
4294 * This is the list of the style rule name we use as drop in replacement for the built-in
4295 * pseudo classes (:checked, :disabled, :focused, etc.).
4296 *
4297 * Why do they exist in the first place?
4298 * These classes are used at a specificity of 2.
4299 * It allows them to override previously definied styles as well as
4300 * being untouched by simple user overrides.
4301 */
4302
4303 var pseudoClasses = ['checked', 'disabled', 'error', 'focused', 'focusVisible', 'required', 'expanded', 'selected']; // Returns a function which generates unique class names based on counters.
4304 // When new generator function is created, rule counter is reset.
4305 // We need to reset the rule counter for SSR for each request.
4306 //
4307 // It's inspired by
4308 // https://github.com/cssinjs/jss/blob/4e6a05dd3f7b6572fdd3ab216861d9e446c20331/src/utils/createGenerateClassName.js
4309
4310 function createGenerateClassName() {
4311 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4312 var _options$disableGloba = options.disableGlobal,
4313 disableGlobal = _options$disableGloba === void 0 ? false : _options$disableGloba,
4314 _options$productionPr = options.productionPrefix,
4315 productionPrefix = _options$productionPr === void 0 ? 'jss' : _options$productionPr,
4316 _options$seed = options.seed,
4317 seed = _options$seed === void 0 ? '' : _options$seed;
4318 var seedPrefix = seed === '' ? '' : "".concat(seed, "-");
4319 var ruleCounter = 0;
4320
4321 var getNextCounterId = function getNextCounterId() {
4322 ruleCounter += 1;
4323
4324 return ruleCounter;
4325 };
4326
4327 return function (rule, styleSheet) {
4328 var name = styleSheet.options.name; // Is a global static MUI style?
4329
4330 if (name && name.indexOf('Mui') === 0 && !styleSheet.options.link && !disableGlobal) {
4331 // We can use a shorthand class name, we never use the keys to style the components.
4332 if (pseudoClasses.indexOf(rule.key) !== -1) {
4333 return "Mui-".concat(rule.key);
4334 }
4335
4336 var prefix = "".concat(seedPrefix).concat(name, "-").concat(rule.key);
4337
4338 if (!styleSheet.options.theme[nested] || seed !== '') {
4339 return prefix;
4340 }
4341
4342 return "".concat(prefix, "-").concat(getNextCounterId());
4343 }
4344
4345 {
4346 return "".concat(seedPrefix).concat(productionPrefix).concat(getNextCounterId());
4347 }
4348 };
4349 }
4350
4351 /* eslint-disable no-restricted-syntax */
4352 function getThemeProps(params) {
4353 var theme = params.theme,
4354 name = params.name,
4355 props = params.props;
4356
4357 if (!theme || !theme.props || !theme.props[name]) {
4358 return props;
4359 } // Resolve default props, code borrow from React source.
4360 // https://github.com/facebook/react/blob/15a8f031838a553e41c0b66eb1bcf1da8448104d/packages/react/src/ReactElement.js#L221
4361
4362
4363 var defaultProps = theme.props[name];
4364 var propName;
4365
4366 for (propName in defaultProps) {
4367 if (props[propName] === undefined) {
4368 props[propName] = defaultProps[propName];
4369 }
4370 }
4371
4372 return props;
4373 }
4374
4375 function _extends$9() {
4376 _extends$9 = Object.assign || function (target) {
4377 for (var i = 1; i < arguments.length; i++) {
4378 var source = arguments[i];
4379
4380 for (var key in source) {
4381 if (Object.prototype.hasOwnProperty.call(source, key)) {
4382 target[key] = source[key];
4383 }
4384 }
4385 }
4386
4387 return target;
4388 };
4389
4390 return _extends$9.apply(this, arguments);
4391 }
4392
4393 var _typeof$2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4394
4395 var isBrowser$1 = (typeof window === "undefined" ? "undefined" : _typeof$2(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof$2(document)) === 'object' && document.nodeType === 9;
4396
4397 function _defineProperties$1(target, props) {
4398 for (var i = 0; i < props.length; i++) {
4399 var descriptor = props[i];
4400 descriptor.enumerable = descriptor.enumerable || false;
4401 descriptor.configurable = true;
4402 if ("value" in descriptor) descriptor.writable = true;
4403 Object.defineProperty(target, descriptor.key, descriptor);
4404 }
4405 }
4406
4407 function _createClass$1(Constructor, protoProps, staticProps) {
4408 if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
4409 if (staticProps) _defineProperties$1(Constructor, staticProps);
4410 return Constructor;
4411 }
4412
4413 function _inheritsLoose$2(subClass, superClass) {
4414 subClass.prototype = Object.create(superClass.prototype);
4415 subClass.prototype.constructor = subClass;
4416 subClass.__proto__ = superClass;
4417 }
4418
4419 function _assertThisInitialized$2(self) {
4420 if (self === void 0) {
4421 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4422 }
4423
4424 return self;
4425 }
4426
4427 function _objectWithoutPropertiesLoose$3(source, excluded) {
4428 if (source == null) return {};
4429 var target = {};
4430 var sourceKeys = Object.keys(source);
4431 var key, i;
4432
4433 for (i = 0; i < sourceKeys.length; i++) {
4434 key = sourceKeys[i];
4435 if (excluded.indexOf(key) >= 0) continue;
4436 target[key] = source[key];
4437 }
4438
4439 return target;
4440 }
4441
4442 var plainObjectConstrurctor = {}.constructor;
4443 function cloneStyle(style) {
4444 if (style == null || typeof style !== 'object') return style;
4445 if (Array.isArray(style)) return style.map(cloneStyle);
4446 if (style.constructor !== plainObjectConstrurctor) return style;
4447 var newStyle = {};
4448
4449 for (var name in style) {
4450 newStyle[name] = cloneStyle(style[name]);
4451 }
4452
4453 return newStyle;
4454 }
4455
4456 /**
4457 * Create a rule instance.
4458 */
4459
4460 function createRule(name, decl, options) {
4461 if (name === void 0) {
4462 name = 'unnamed';
4463 }
4464
4465 var jss = options.jss;
4466 var declCopy = cloneStyle(decl);
4467 var rule = jss.plugins.onCreateRule(name, declCopy, options);
4468 if (rule) return rule; // It is an at-rule and it has no instance.
4469
4470 if (name[0] === '@') ;
4471
4472 return null;
4473 }
4474
4475 var join = function join(value, by) {
4476 var result = '';
4477
4478 for (var i = 0; i < value.length; i++) {
4479 // Remove !important from the value, it will be readded later.
4480 if (value[i] === '!important') break;
4481 if (result) result += by;
4482 result += value[i];
4483 }
4484
4485 return result;
4486 };
4487
4488 /**
4489 * Converts array values to string.
4490 *
4491 * `margin: [['5px', '10px']]` > `margin: 5px 10px;`
4492 * `border: ['1px', '2px']` > `border: 1px, 2px;`
4493 * `margin: [['5px', '10px'], '!important']` > `margin: 5px 10px !important;`
4494 * `color: ['red', !important]` > `color: red !important;`
4495 */
4496 var toCssValue = function toCssValue(value, ignoreImportant) {
4497 if (ignoreImportant === void 0) {
4498 ignoreImportant = false;
4499 }
4500
4501 if (!Array.isArray(value)) return value;
4502 var cssValue = ''; // Support space separated values via `[['5px', '10px']]`.
4503
4504 if (Array.isArray(value[0])) {
4505 for (var i = 0; i < value.length; i++) {
4506 if (value[i] === '!important') break;
4507 if (cssValue) cssValue += ', ';
4508 cssValue += join(value[i], ' ');
4509 }
4510 } else cssValue = join(value, ', '); // Add !important, because it was ignored.
4511
4512
4513 if (!ignoreImportant && value[value.length - 1] === '!important') {
4514 cssValue += ' !important';
4515 }
4516
4517 return cssValue;
4518 };
4519
4520 /**
4521 * Indent a string.
4522 * http://jsperf.com/array-join-vs-for
4523 */
4524 function indentStr(str, indent) {
4525 var result = '';
4526
4527 for (var index = 0; index < indent; index++) {
4528 result += ' ';
4529 }
4530
4531 return result + str;
4532 }
4533 /**
4534 * Converts a Rule to CSS string.
4535 */
4536
4537
4538 function toCss(selector, style, options) {
4539 if (options === void 0) {
4540 options = {};
4541 }
4542
4543 var result = '';
4544 if (!style) return result;
4545 var _options = options,
4546 _options$indent = _options.indent,
4547 indent = _options$indent === void 0 ? 0 : _options$indent;
4548 var fallbacks = style.fallbacks;
4549 if (selector) indent++; // Apply fallbacks first.
4550
4551 if (fallbacks) {
4552 // Array syntax {fallbacks: [{prop: value}]}
4553 if (Array.isArray(fallbacks)) {
4554 for (var index = 0; index < fallbacks.length; index++) {
4555 var fallback = fallbacks[index];
4556
4557 for (var prop in fallback) {
4558 var value = fallback[prop];
4559
4560 if (value != null) {
4561 if (result) result += '\n';
4562 result += "" + indentStr(prop + ": " + toCssValue(value) + ";", indent);
4563 }
4564 }
4565 }
4566 } else {
4567 // Object syntax {fallbacks: {prop: value}}
4568 for (var _prop in fallbacks) {
4569 var _value = fallbacks[_prop];
4570
4571 if (_value != null) {
4572 if (result) result += '\n';
4573 result += "" + indentStr(_prop + ": " + toCssValue(_value) + ";", indent);
4574 }
4575 }
4576 }
4577 }
4578
4579 for (var _prop2 in style) {
4580 var _value2 = style[_prop2];
4581
4582 if (_value2 != null && _prop2 !== 'fallbacks') {
4583 if (result) result += '\n';
4584 result += "" + indentStr(_prop2 + ": " + toCssValue(_value2) + ";", indent);
4585 }
4586 } // Allow empty style in this case, because properties will be added dynamically.
4587
4588
4589 if (!result && !options.allowEmpty) return result; // When rule is being stringified before selector was defined.
4590
4591 if (!selector) return result;
4592 indent--;
4593 if (result) result = "\n" + result + "\n";
4594 return indentStr(selector + " {" + result, indent) + indentStr('}', indent);
4595 }
4596
4597 var escapeRegex = /([[\].#*$><+~=|^:(),"'`\s])/g;
4598 var nativeEscape = typeof CSS !== 'undefined' && CSS.escape;
4599 var escape = (function (str) {
4600 return nativeEscape ? nativeEscape(str) : str.replace(escapeRegex, '\\$1');
4601 });
4602
4603 var BaseStyleRule =
4604 /*#__PURE__*/
4605 function () {
4606 function BaseStyleRule(key, style, options) {
4607 this.type = 'style';
4608 this.key = void 0;
4609 this.isProcessed = false;
4610 this.style = void 0;
4611 this.renderer = void 0;
4612 this.renderable = void 0;
4613 this.options = void 0;
4614 var sheet = options.sheet,
4615 Renderer = options.Renderer;
4616 this.key = key;
4617 this.options = options;
4618 this.style = style;
4619 if (sheet) this.renderer = sheet.renderer;else if (Renderer) this.renderer = new Renderer();
4620 }
4621 /**
4622 * Get or set a style property.
4623 */
4624
4625
4626 var _proto = BaseStyleRule.prototype;
4627
4628 _proto.prop = function prop(name, value, options) {
4629 // It's a getter.
4630 if (value === undefined) return this.style[name]; // Don't do anything if the value has not changed.
4631
4632 var force = options ? options.force : false;
4633 if (!force && this.style[name] === value) return this;
4634 var newValue = value;
4635
4636 if (!options || options.process !== false) {
4637 newValue = this.options.jss.plugins.onChangeValue(value, name, this);
4638 }
4639
4640 var isEmpty = newValue == null || newValue === false;
4641 var isDefined = name in this.style; // Value is empty and wasn't defined before.
4642
4643 if (isEmpty && !isDefined && !force) return this; // We are going to remove this value.
4644
4645 var remove = isEmpty && isDefined;
4646 if (remove) delete this.style[name];else this.style[name] = newValue; // Renderable is defined if StyleSheet option `link` is true.
4647
4648 if (this.renderable && this.renderer) {
4649 if (remove) this.renderer.removeProperty(this.renderable, name);else this.renderer.setProperty(this.renderable, name, newValue);
4650 return this;
4651 }
4652
4653 var sheet = this.options.sheet;
4654
4655 if (sheet && sheet.attached) ;
4656
4657 return this;
4658 };
4659
4660 return BaseStyleRule;
4661 }();
4662 var StyleRule =
4663 /*#__PURE__*/
4664 function (_BaseStyleRule) {
4665 _inheritsLoose$2(StyleRule, _BaseStyleRule);
4666
4667 function StyleRule(key, style, options) {
4668 var _this;
4669
4670 _this = _BaseStyleRule.call(this, key, style, options) || this;
4671 _this.selectorText = void 0;
4672 _this.id = void 0;
4673 _this.renderable = void 0;
4674 var selector = options.selector,
4675 scoped = options.scoped,
4676 sheet = options.sheet,
4677 generateId = options.generateId;
4678
4679 if (selector) {
4680 _this.selectorText = selector;
4681 } else if (scoped !== false) {
4682 _this.id = generateId(_assertThisInitialized$2(_assertThisInitialized$2(_this)), sheet);
4683 _this.selectorText = "." + escape(_this.id);
4684 }
4685
4686 return _this;
4687 }
4688 /**
4689 * Set selector string.
4690 * Attention: use this with caution. Most browsers didn't implement
4691 * selectorText setter, so this may result in rerendering of entire Style Sheet.
4692 */
4693
4694
4695 var _proto2 = StyleRule.prototype;
4696
4697 /**
4698 * Apply rule to an element inline.
4699 */
4700 _proto2.applyTo = function applyTo(renderable) {
4701 var renderer = this.renderer;
4702
4703 if (renderer) {
4704 var json = this.toJSON();
4705
4706 for (var prop in json) {
4707 renderer.setProperty(renderable, prop, json[prop]);
4708 }
4709 }
4710
4711 return this;
4712 }
4713 /**
4714 * Returns JSON representation of the rule.
4715 * Fallbacks are not supported.
4716 * Useful for inline styles.
4717 */
4718 ;
4719
4720 _proto2.toJSON = function toJSON() {
4721 var json = {};
4722
4723 for (var prop in this.style) {
4724 var value = this.style[prop];
4725 if (typeof value !== 'object') json[prop] = value;else if (Array.isArray(value)) json[prop] = toCssValue(value);
4726 }
4727
4728 return json;
4729 }
4730 /**
4731 * Generates a CSS string.
4732 */
4733 ;
4734
4735 _proto2.toString = function toString(options) {
4736 var sheet = this.options.sheet;
4737 var link = sheet ? sheet.options.link : false;
4738 var opts = link ? _extends$9({}, options, {
4739 allowEmpty: true
4740 }) : options;
4741 return toCss(this.selectorText, this.style, opts);
4742 };
4743
4744 _createClass$1(StyleRule, [{
4745 key: "selector",
4746 set: function set(selector) {
4747 if (selector === this.selectorText) return;
4748 this.selectorText = selector;
4749 var renderer = this.renderer,
4750 renderable = this.renderable;
4751 if (!renderable || !renderer) return;
4752 var hasChanged = renderer.setSelector(renderable, selector); // If selector setter is not implemented, rerender the rule.
4753
4754 if (!hasChanged) {
4755 renderer.replaceRule(renderable, this);
4756 }
4757 }
4758 /**
4759 * Get selector string.
4760 */
4761 ,
4762 get: function get() {
4763 return this.selectorText;
4764 }
4765 }]);
4766
4767 return StyleRule;
4768 }(BaseStyleRule);
4769 var pluginStyleRule = {
4770 onCreateRule: function onCreateRule(name, style, options) {
4771 if (name[0] === '@' || options.parent && options.parent.type === 'keyframes') {
4772 return null;
4773 }
4774
4775 return new StyleRule(name, style, options);
4776 }
4777 };
4778
4779 var defaultToStringOptions = {
4780 indent: 1,
4781 children: true
4782 };
4783 var atRegExp = /@([\w-]+)/;
4784 /**
4785 * Conditional rule for @media, @supports
4786 */
4787
4788 var ConditionalRule =
4789 /*#__PURE__*/
4790 function () {
4791 function ConditionalRule(key, styles, options) {
4792 this.type = 'conditional';
4793 this.at = void 0;
4794 this.key = void 0;
4795 this.query = void 0;
4796 this.rules = void 0;
4797 this.options = void 0;
4798 this.isProcessed = false;
4799 this.renderable = void 0;
4800 this.key = key;
4801 var atMatch = key.match(atRegExp);
4802 this.at = atMatch ? atMatch[1] : 'unknown'; // Key might contain a unique suffix in case the `name` passed by user was duplicate.
4803
4804 this.query = options.name || "@" + this.at;
4805 this.options = options;
4806 this.rules = new RuleList(_extends$9({}, options, {
4807 parent: this
4808 }));
4809
4810 for (var name in styles) {
4811 this.rules.add(name, styles[name]);
4812 }
4813
4814 this.rules.process();
4815 }
4816 /**
4817 * Get a rule.
4818 */
4819
4820
4821 var _proto = ConditionalRule.prototype;
4822
4823 _proto.getRule = function getRule(name) {
4824 return this.rules.get(name);
4825 }
4826 /**
4827 * Get index of a rule.
4828 */
4829 ;
4830
4831 _proto.indexOf = function indexOf(rule) {
4832 return this.rules.indexOf(rule);
4833 }
4834 /**
4835 * Create and register rule, run plugins.
4836 */
4837 ;
4838
4839 _proto.addRule = function addRule(name, style, options) {
4840 var rule = this.rules.add(name, style, options);
4841 if (!rule) return null;
4842 this.options.jss.plugins.onProcessRule(rule);
4843 return rule;
4844 }
4845 /**
4846 * Generates a CSS string.
4847 */
4848 ;
4849
4850 _proto.toString = function toString(options) {
4851 if (options === void 0) {
4852 options = defaultToStringOptions;
4853 }
4854
4855 if (options.indent == null) options.indent = defaultToStringOptions.indent;
4856 if (options.children == null) options.children = defaultToStringOptions.children;
4857
4858 if (options.children === false) {
4859 return this.query + " {}";
4860 }
4861
4862 var children = this.rules.toString(options);
4863 return children ? this.query + " {\n" + children + "\n}" : '';
4864 };
4865
4866 return ConditionalRule;
4867 }();
4868 var keyRegExp = /@media|@supports\s+/;
4869 var pluginConditionalRule = {
4870 onCreateRule: function onCreateRule(key, styles, options) {
4871 return keyRegExp.test(key) ? new ConditionalRule(key, styles, options) : null;
4872 }
4873 };
4874
4875 var defaultToStringOptions$1 = {
4876 indent: 1,
4877 children: true
4878 };
4879 var nameRegExp = /@keyframes\s+([\w-]+)/;
4880 /**
4881 * Rule for @keyframes
4882 */
4883
4884 var KeyframesRule =
4885 /*#__PURE__*/
4886 function () {
4887 function KeyframesRule(key, frames, options) {
4888 this.type = 'keyframes';
4889 this.at = '@keyframes';
4890 this.key = void 0;
4891 this.name = void 0;
4892 this.id = void 0;
4893 this.rules = void 0;
4894 this.options = void 0;
4895 this.isProcessed = false;
4896 this.renderable = void 0;
4897 var nameMatch = key.match(nameRegExp);
4898
4899 if (nameMatch && nameMatch[1]) {
4900 this.name = nameMatch[1];
4901 } else {
4902 this.name = 'noname';
4903 }
4904
4905 this.key = this.type + "-" + this.name;
4906 this.options = options;
4907 var scoped = options.scoped,
4908 sheet = options.sheet,
4909 generateId = options.generateId;
4910 this.id = scoped === false ? this.name : escape(generateId(this, sheet));
4911 this.rules = new RuleList(_extends$9({}, options, {
4912 parent: this
4913 }));
4914
4915 for (var name in frames) {
4916 this.rules.add(name, frames[name], _extends$9({}, options, {
4917 parent: this
4918 }));
4919 }
4920
4921 this.rules.process();
4922 }
4923 /**
4924 * Generates a CSS string.
4925 */
4926
4927
4928 var _proto = KeyframesRule.prototype;
4929
4930 _proto.toString = function toString(options) {
4931 if (options === void 0) {
4932 options = defaultToStringOptions$1;
4933 }
4934
4935 if (options.indent == null) options.indent = defaultToStringOptions$1.indent;
4936 if (options.children == null) options.children = defaultToStringOptions$1.children;
4937
4938 if (options.children === false) {
4939 return this.at + " " + this.id + " {}";
4940 }
4941
4942 var children = this.rules.toString(options);
4943 if (children) children = "\n" + children + "\n";
4944 return this.at + " " + this.id + " {" + children + "}";
4945 };
4946
4947 return KeyframesRule;
4948 }();
4949 var keyRegExp$1 = /@keyframes\s+/;
4950 var refRegExp$1 = /\$([\w-]+)/g;
4951
4952 var findReferencedKeyframe = function findReferencedKeyframe(val, keyframes) {
4953 if (typeof val === 'string') {
4954 return val.replace(refRegExp$1, function (match, name) {
4955 if (name in keyframes) {
4956 return keyframes[name];
4957 }
4958 return match;
4959 });
4960 }
4961
4962 return val;
4963 };
4964 /**
4965 * Replace the reference for a animation name.
4966 */
4967
4968
4969 var replaceRef = function replaceRef(style, prop, keyframes) {
4970 var value = style[prop];
4971 var refKeyframe = findReferencedKeyframe(value, keyframes);
4972
4973 if (refKeyframe !== value) {
4974 style[prop] = refKeyframe;
4975 }
4976 };
4977
4978 var plugin = {
4979 onCreateRule: function onCreateRule(key, frames, options) {
4980 return typeof key === 'string' && keyRegExp$1.test(key) ? new KeyframesRule(key, frames, options) : null;
4981 },
4982 // Animation name ref replacer.
4983 onProcessStyle: function onProcessStyle(style, rule, sheet) {
4984 if (rule.type !== 'style' || !sheet) return style;
4985 if ('animation-name' in style) replaceRef(style, 'animation-name', sheet.keyframes);
4986 if ('animation' in style) replaceRef(style, 'animation', sheet.keyframes);
4987 return style;
4988 },
4989 onChangeValue: function onChangeValue(val, prop, rule) {
4990 var sheet = rule.options.sheet;
4991
4992 if (!sheet) {
4993 return val;
4994 }
4995
4996 switch (prop) {
4997 case 'animation':
4998 return findReferencedKeyframe(val, sheet.keyframes);
4999
5000 case 'animation-name':
5001 return findReferencedKeyframe(val, sheet.keyframes);
5002
5003 default:
5004 return val;
5005 }
5006 }
5007 };
5008
5009 var KeyframeRule =
5010 /*#__PURE__*/
5011 function (_BaseStyleRule) {
5012 _inheritsLoose$2(KeyframeRule, _BaseStyleRule);
5013
5014 function KeyframeRule() {
5015 var _this;
5016
5017 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5018 args[_key] = arguments[_key];
5019 }
5020
5021 _this = _BaseStyleRule.call.apply(_BaseStyleRule, [this].concat(args)) || this;
5022 _this.renderable = void 0;
5023 return _this;
5024 }
5025
5026 var _proto = KeyframeRule.prototype;
5027
5028 /**
5029 * Generates a CSS string.
5030 */
5031 _proto.toString = function toString(options) {
5032 var sheet = this.options.sheet;
5033 var link = sheet ? sheet.options.link : false;
5034 var opts = link ? _extends$9({}, options, {
5035 allowEmpty: true
5036 }) : options;
5037 return toCss(this.key, this.style, opts);
5038 };
5039
5040 return KeyframeRule;
5041 }(BaseStyleRule);
5042 var pluginKeyframeRule = {
5043 onCreateRule: function onCreateRule(key, style, options) {
5044 if (options.parent && options.parent.type === 'keyframes') {
5045 return new KeyframeRule(key, style, options);
5046 }
5047
5048 return null;
5049 }
5050 };
5051
5052 var FontFaceRule =
5053 /*#__PURE__*/
5054 function () {
5055 function FontFaceRule(key, style, options) {
5056 this.type = 'font-face';
5057 this.at = '@font-face';
5058 this.key = void 0;
5059 this.style = void 0;
5060 this.options = void 0;
5061 this.isProcessed = false;
5062 this.renderable = void 0;
5063 this.key = key;
5064 this.style = style;
5065 this.options = options;
5066 }
5067 /**
5068 * Generates a CSS string.
5069 */
5070
5071
5072 var _proto = FontFaceRule.prototype;
5073
5074 _proto.toString = function toString(options) {
5075 if (Array.isArray(this.style)) {
5076 var str = '';
5077
5078 for (var index = 0; index < this.style.length; index++) {
5079 str += toCss(this.at, this.style[index]);
5080 if (this.style[index + 1]) str += '\n';
5081 }
5082
5083 return str;
5084 }
5085
5086 return toCss(this.at, this.style, options);
5087 };
5088
5089 return FontFaceRule;
5090 }();
5091 var keyRegExp$2 = /@font-face/;
5092 var pluginFontFaceRule = {
5093 onCreateRule: function onCreateRule(key, style, options) {
5094 return keyRegExp$2.test(key) ? new FontFaceRule(key, style, options) : null;
5095 }
5096 };
5097
5098 var ViewportRule =
5099 /*#__PURE__*/
5100 function () {
5101 function ViewportRule(key, style, options) {
5102 this.type = 'viewport';
5103 this.at = '@viewport';
5104 this.key = void 0;
5105 this.style = void 0;
5106 this.options = void 0;
5107 this.isProcessed = false;
5108 this.renderable = void 0;
5109 this.key = key;
5110 this.style = style;
5111 this.options = options;
5112 }
5113 /**
5114 * Generates a CSS string.
5115 */
5116
5117
5118 var _proto = ViewportRule.prototype;
5119
5120 _proto.toString = function toString(options) {
5121 return toCss(this.key, this.style, options);
5122 };
5123
5124 return ViewportRule;
5125 }();
5126 var pluginViewportRule = {
5127 onCreateRule: function onCreateRule(key, style, options) {
5128 return key === '@viewport' || key === '@-ms-viewport' ? new ViewportRule(key, style, options) : null;
5129 }
5130 };
5131
5132 var SimpleRule =
5133 /*#__PURE__*/
5134 function () {
5135 function SimpleRule(key, value, options) {
5136 this.type = 'simple';
5137 this.key = void 0;
5138 this.value = void 0;
5139 this.options = void 0;
5140 this.isProcessed = false;
5141 this.renderable = void 0;
5142 this.key = key;
5143 this.value = value;
5144 this.options = options;
5145 }
5146 /**
5147 * Generates a CSS string.
5148 */
5149 // eslint-disable-next-line no-unused-vars
5150
5151
5152 var _proto = SimpleRule.prototype;
5153
5154 _proto.toString = function toString(options) {
5155 if (Array.isArray(this.value)) {
5156 var str = '';
5157
5158 for (var index = 0; index < this.value.length; index++) {
5159 str += this.key + " " + this.value[index] + ";";
5160 if (this.value[index + 1]) str += '\n';
5161 }
5162
5163 return str;
5164 }
5165
5166 return this.key + " " + this.value + ";";
5167 };
5168
5169 return SimpleRule;
5170 }();
5171 var keysMap = {
5172 '@charset': true,
5173 '@import': true,
5174 '@namespace': true
5175 };
5176 var pluginSimpleRule = {
5177 onCreateRule: function onCreateRule(key, value, options) {
5178 return key in keysMap ? new SimpleRule(key, value, options) : null;
5179 }
5180 };
5181
5182 var plugins$1 = [pluginStyleRule, pluginConditionalRule, plugin, pluginKeyframeRule, pluginFontFaceRule, pluginViewportRule, pluginSimpleRule];
5183
5184 var defaultUpdateOptions = {
5185 process: true
5186 };
5187 var forceUpdateOptions = {
5188 force: true,
5189 process: true
5190 /**
5191 * Contains rules objects and allows adding/removing etc.
5192 * Is used for e.g. by `StyleSheet` or `ConditionalRule`.
5193 */
5194
5195 };
5196
5197 var RuleList =
5198 /*#__PURE__*/
5199 function () {
5200 // Rules registry for access by .get() method.
5201 // It contains the same rule registered by name and by selector.
5202 // Original styles object.
5203 // Used to ensure correct rules order.
5204 function RuleList(options) {
5205 this.map = {};
5206 this.raw = {};
5207 this.index = [];
5208 this.counter = 0;
5209 this.options = void 0;
5210 this.classes = void 0;
5211 this.keyframes = void 0;
5212 this.options = options;
5213 this.classes = options.classes;
5214 this.keyframes = options.keyframes;
5215 }
5216 /**
5217 * Create and register rule.
5218 *
5219 * Will not render after Style Sheet was rendered the first time.
5220 */
5221
5222
5223 var _proto = RuleList.prototype;
5224
5225 _proto.add = function add(name, decl, ruleOptions) {
5226 var _this$options = this.options,
5227 parent = _this$options.parent,
5228 sheet = _this$options.sheet,
5229 jss = _this$options.jss,
5230 Renderer = _this$options.Renderer,
5231 generateId = _this$options.generateId,
5232 scoped = _this$options.scoped;
5233
5234 var options = _extends$9({
5235 classes: this.classes,
5236 parent: parent,
5237 sheet: sheet,
5238 jss: jss,
5239 Renderer: Renderer,
5240 generateId: generateId,
5241 scoped: scoped,
5242 name: name,
5243 keyframes: this.keyframes,
5244 selector: undefined
5245 }, ruleOptions); // When user uses .createStyleSheet(), duplicate names are not possible, but
5246 // `sheet.addRule()` opens the door for any duplicate rule name. When this happens
5247 // we need to make the key unique within this RuleList instance scope.
5248
5249
5250 var key = name;
5251
5252 if (name in this.raw) {
5253 key = name + "-d" + this.counter++;
5254 } // We need to save the original decl before creating the rule
5255 // because cache plugin needs to use it as a key to return a cached rule.
5256
5257
5258 this.raw[key] = decl;
5259
5260 if (key in this.classes) {
5261 // E.g. rules inside of @media container
5262 options.selector = "." + escape(this.classes[key]);
5263 }
5264
5265 var rule = createRule(key, decl, options);
5266 if (!rule) return null;
5267 this.register(rule);
5268 var index = options.index === undefined ? this.index.length : options.index;
5269 this.index.splice(index, 0, rule);
5270 return rule;
5271 }
5272 /**
5273 * Get a rule.
5274 */
5275 ;
5276
5277 _proto.get = function get(name) {
5278 return this.map[name];
5279 }
5280 /**
5281 * Delete a rule.
5282 */
5283 ;
5284
5285 _proto.remove = function remove(rule) {
5286 this.unregister(rule);
5287 delete this.raw[rule.key];
5288 this.index.splice(this.index.indexOf(rule), 1);
5289 }
5290 /**
5291 * Get index of a rule.
5292 */
5293 ;
5294
5295 _proto.indexOf = function indexOf(rule) {
5296 return this.index.indexOf(rule);
5297 }
5298 /**
5299 * Run `onProcessRule()` plugins on every rule.
5300 */
5301 ;
5302
5303 _proto.process = function process() {
5304 var plugins = this.options.jss.plugins; // We need to clone array because if we modify the index somewhere else during a loop
5305 // we end up with very hard-to-track-down side effects.
5306
5307 this.index.slice(0).forEach(plugins.onProcessRule, plugins);
5308 }
5309 /**
5310 * Register a rule in `.map`, `.classes` and `.keyframes` maps.
5311 */
5312 ;
5313
5314 _proto.register = function register(rule) {
5315 this.map[rule.key] = rule;
5316
5317 if (rule instanceof StyleRule) {
5318 this.map[rule.selector] = rule;
5319 if (rule.id) this.classes[rule.key] = rule.id;
5320 } else if (rule instanceof KeyframesRule && this.keyframes) {
5321 this.keyframes[rule.name] = rule.id;
5322 }
5323 }
5324 /**
5325 * Unregister a rule.
5326 */
5327 ;
5328
5329 _proto.unregister = function unregister(rule) {
5330 delete this.map[rule.key];
5331
5332 if (rule instanceof StyleRule) {
5333 delete this.map[rule.selector];
5334 delete this.classes[rule.key];
5335 } else if (rule instanceof KeyframesRule) {
5336 delete this.keyframes[rule.name];
5337 }
5338 }
5339 /**
5340 * Update the function values with a new data.
5341 */
5342 ;
5343
5344 _proto.update = function update() {
5345 var name;
5346 var data;
5347 var options;
5348
5349 if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'string') {
5350 name = arguments.length <= 0 ? undefined : arguments[0]; // $FlowFixMe[invalid-tuple-index]
5351
5352 data = arguments.length <= 1 ? undefined : arguments[1]; // $FlowFixMe[invalid-tuple-index]
5353
5354 options = arguments.length <= 2 ? undefined : arguments[2];
5355 } else {
5356 data = arguments.length <= 0 ? undefined : arguments[0]; // $FlowFixMe[invalid-tuple-index]
5357
5358 options = arguments.length <= 1 ? undefined : arguments[1];
5359 name = null;
5360 }
5361
5362 if (name) {
5363 this.updateOne(this.map[name], data, options);
5364 } else {
5365 for (var index = 0; index < this.index.length; index++) {
5366 this.updateOne(this.index[index], data, options);
5367 }
5368 }
5369 }
5370 /**
5371 * Execute plugins, update rule props.
5372 */
5373 ;
5374
5375 _proto.updateOne = function updateOne(rule, data, options) {
5376 if (options === void 0) {
5377 options = defaultUpdateOptions;
5378 }
5379
5380 var _this$options2 = this.options,
5381 plugins = _this$options2.jss.plugins,
5382 sheet = _this$options2.sheet; // It is a rules container like for e.g. ConditionalRule.
5383
5384 if (rule.rules instanceof RuleList) {
5385 rule.rules.update(data, options);
5386 return;
5387 }
5388
5389 var styleRule = rule;
5390 var style = styleRule.style;
5391 plugins.onUpdate(data, rule, sheet, options); // We rely on a new `style` ref in case it was mutated during onUpdate hook.
5392
5393 if (options.process && style && style !== styleRule.style) {
5394 // We need to run the plugins in case new `style` relies on syntax plugins.
5395 plugins.onProcessStyle(styleRule.style, styleRule, sheet); // Update and add props.
5396
5397 for (var prop in styleRule.style) {
5398 var nextValue = styleRule.style[prop];
5399 var prevValue = style[prop]; // We need to use `force: true` because `rule.style` has been updated during onUpdate hook, so `rule.prop()` will not update the CSSOM rule.
5400 // We do this comparison to avoid unneeded `rule.prop()` calls, since we have the old `style` object here.
5401
5402 if (nextValue !== prevValue) {
5403 styleRule.prop(prop, nextValue, forceUpdateOptions);
5404 }
5405 } // Remove props.
5406
5407
5408 for (var _prop in style) {
5409 var _nextValue = styleRule.style[_prop];
5410 var _prevValue = style[_prop]; // We need to use `force: true` because `rule.style` has been updated during onUpdate hook, so `rule.prop()` will not update the CSSOM rule.
5411 // We do this comparison to avoid unneeded `rule.prop()` calls, since we have the old `style` object here.
5412
5413 if (_nextValue == null && _nextValue !== _prevValue) {
5414 styleRule.prop(_prop, null, forceUpdateOptions);
5415 }
5416 }
5417 }
5418 }
5419 /**
5420 * Convert rules to a CSS string.
5421 */
5422 ;
5423
5424 _proto.toString = function toString(options) {
5425 var str = '';
5426 var sheet = this.options.sheet;
5427 var link = sheet ? sheet.options.link : false;
5428
5429 for (var index = 0; index < this.index.length; index++) {
5430 var rule = this.index[index];
5431 var css = rule.toString(options); // No need to render an empty rule.
5432
5433 if (!css && !link) continue;
5434 if (str) str += '\n';
5435 str += css;
5436 }
5437
5438 return str;
5439 };
5440
5441 return RuleList;
5442 }();
5443
5444 var StyleSheet =
5445 /*#__PURE__*/
5446 function () {
5447 function StyleSheet(styles, options) {
5448 this.options = void 0;
5449 this.deployed = void 0;
5450 this.attached = void 0;
5451 this.rules = void 0;
5452 this.renderer = void 0;
5453 this.classes = void 0;
5454 this.keyframes = void 0;
5455 this.queue = void 0;
5456 this.attached = false;
5457 this.deployed = false;
5458 this.classes = {};
5459 this.keyframes = {};
5460 this.options = _extends$9({}, options, {
5461 sheet: this,
5462 parent: this,
5463 classes: this.classes,
5464 keyframes: this.keyframes
5465 });
5466
5467 if (options.Renderer) {
5468 this.renderer = new options.Renderer(this);
5469 }
5470
5471 this.rules = new RuleList(this.options);
5472
5473 for (var name in styles) {
5474 this.rules.add(name, styles[name]);
5475 }
5476
5477 this.rules.process();
5478 }
5479 /**
5480 * Attach renderable to the render tree.
5481 */
5482
5483
5484 var _proto = StyleSheet.prototype;
5485
5486 _proto.attach = function attach() {
5487 if (this.attached) return this;
5488 if (this.renderer) this.renderer.attach();
5489 this.attached = true; // Order is important, because we can't use insertRule API if style element is not attached.
5490
5491 if (!this.deployed) this.deploy();
5492 return this;
5493 }
5494 /**
5495 * Remove renderable from render tree.
5496 */
5497 ;
5498
5499 _proto.detach = function detach() {
5500 if (!this.attached) return this;
5501 if (this.renderer) this.renderer.detach();
5502 this.attached = false;
5503 return this;
5504 }
5505 /**
5506 * Add a rule to the current stylesheet.
5507 * Will insert a rule also after the stylesheet has been rendered first time.
5508 */
5509 ;
5510
5511 _proto.addRule = function addRule(name, decl, options) {
5512 var queue = this.queue; // Plugins can create rules.
5513 // In order to preserve the right order, we need to queue all `.addRule` calls,
5514 // which happen after the first `rules.add()` call.
5515
5516 if (this.attached && !queue) this.queue = [];
5517 var rule = this.rules.add(name, decl, options);
5518 if (!rule) return null;
5519 this.options.jss.plugins.onProcessRule(rule);
5520
5521 if (this.attached) {
5522 if (!this.deployed) return rule; // Don't insert rule directly if there is no stringified version yet.
5523 // It will be inserted all together when .attach is called.
5524
5525 if (queue) queue.push(rule);else {
5526 this.insertRule(rule);
5527
5528 if (this.queue) {
5529 this.queue.forEach(this.insertRule, this);
5530 this.queue = undefined;
5531 }
5532 }
5533 return rule;
5534 } // We can't add rules to a detached style node.
5535 // We will redeploy the sheet once user will attach it.
5536
5537
5538 this.deployed = false;
5539 return rule;
5540 }
5541 /**
5542 * Insert rule into the StyleSheet
5543 */
5544 ;
5545
5546 _proto.insertRule = function insertRule(rule) {
5547 if (this.renderer) {
5548 this.renderer.insertRule(rule);
5549 }
5550 }
5551 /**
5552 * Create and add rules.
5553 * Will render also after Style Sheet was rendered the first time.
5554 */
5555 ;
5556
5557 _proto.addRules = function addRules(styles, options) {
5558 var added = [];
5559
5560 for (var name in styles) {
5561 var rule = this.addRule(name, styles[name], options);
5562 if (rule) added.push(rule);
5563 }
5564
5565 return added;
5566 }
5567 /**
5568 * Get a rule by name.
5569 */
5570 ;
5571
5572 _proto.getRule = function getRule(name) {
5573 return this.rules.get(name);
5574 }
5575 /**
5576 * Delete a rule by name.
5577 * Returns `true`: if rule has been deleted from the DOM.
5578 */
5579 ;
5580
5581 _proto.deleteRule = function deleteRule(name) {
5582 var rule = typeof name === 'object' ? name : this.rules.get(name);
5583
5584 if (!rule || // Style sheet was created without link: true and attached, in this case we
5585 // won't be able to remove the CSS rule from the DOM.
5586 this.attached && !rule.renderable) {
5587 return false;
5588 }
5589
5590 this.rules.remove(rule);
5591
5592 if (this.attached && rule.renderable && this.renderer) {
5593 return this.renderer.deleteRule(rule.renderable);
5594 }
5595
5596 return true;
5597 }
5598 /**
5599 * Get index of a rule.
5600 */
5601 ;
5602
5603 _proto.indexOf = function indexOf(rule) {
5604 return this.rules.indexOf(rule);
5605 }
5606 /**
5607 * Deploy pure CSS string to a renderable.
5608 */
5609 ;
5610
5611 _proto.deploy = function deploy() {
5612 if (this.renderer) this.renderer.deploy();
5613 this.deployed = true;
5614 return this;
5615 }
5616 /**
5617 * Update the function values with a new data.
5618 */
5619 ;
5620
5621 _proto.update = function update() {
5622 var _this$rules;
5623
5624 (_this$rules = this.rules).update.apply(_this$rules, arguments);
5625
5626 return this;
5627 }
5628 /**
5629 * Updates a single rule.
5630 */
5631 ;
5632
5633 _proto.updateOne = function updateOne(rule, data, options) {
5634 this.rules.updateOne(rule, data, options);
5635 return this;
5636 }
5637 /**
5638 * Convert rules to a CSS string.
5639 */
5640 ;
5641
5642 _proto.toString = function toString(options) {
5643 return this.rules.toString(options);
5644 };
5645
5646 return StyleSheet;
5647 }();
5648
5649 var PluginsRegistry =
5650 /*#__PURE__*/
5651 function () {
5652 function PluginsRegistry() {
5653 this.plugins = {
5654 internal: [],
5655 external: []
5656 };
5657 this.registry = void 0;
5658 }
5659
5660 var _proto = PluginsRegistry.prototype;
5661
5662 /**
5663 * Call `onCreateRule` hooks and return an object if returned by a hook.
5664 */
5665 _proto.onCreateRule = function onCreateRule(name, decl, options) {
5666 for (var i = 0; i < this.registry.onCreateRule.length; i++) {
5667 var rule = this.registry.onCreateRule[i](name, decl, options);
5668 if (rule) return rule;
5669 }
5670
5671 return null;
5672 }
5673 /**
5674 * Call `onProcessRule` hooks.
5675 */
5676 ;
5677
5678 _proto.onProcessRule = function onProcessRule(rule) {
5679 if (rule.isProcessed) return;
5680 var sheet = rule.options.sheet;
5681
5682 for (var i = 0; i < this.registry.onProcessRule.length; i++) {
5683 this.registry.onProcessRule[i](rule, sheet);
5684 }
5685
5686 if (rule.style) this.onProcessStyle(rule.style, rule, sheet);
5687 rule.isProcessed = true;
5688 }
5689 /**
5690 * Call `onProcessStyle` hooks.
5691 */
5692 ;
5693
5694 _proto.onProcessStyle = function onProcessStyle(style, rule, sheet) {
5695 for (var i = 0; i < this.registry.onProcessStyle.length; i++) {
5696 // $FlowFixMe[prop-missing]
5697 rule.style = this.registry.onProcessStyle[i](rule.style, rule, sheet);
5698 }
5699 }
5700 /**
5701 * Call `onProcessSheet` hooks.
5702 */
5703 ;
5704
5705 _proto.onProcessSheet = function onProcessSheet(sheet) {
5706 for (var i = 0; i < this.registry.onProcessSheet.length; i++) {
5707 this.registry.onProcessSheet[i](sheet);
5708 }
5709 }
5710 /**
5711 * Call `onUpdate` hooks.
5712 */
5713 ;
5714
5715 _proto.onUpdate = function onUpdate(data, rule, sheet, options) {
5716 for (var i = 0; i < this.registry.onUpdate.length; i++) {
5717 this.registry.onUpdate[i](data, rule, sheet, options);
5718 }
5719 }
5720 /**
5721 * Call `onChangeValue` hooks.
5722 */
5723 ;
5724
5725 _proto.onChangeValue = function onChangeValue(value, prop, rule) {
5726 var processedValue = value;
5727
5728 for (var i = 0; i < this.registry.onChangeValue.length; i++) {
5729 processedValue = this.registry.onChangeValue[i](processedValue, prop, rule);
5730 }
5731
5732 return processedValue;
5733 }
5734 /**
5735 * Register a plugin.
5736 */
5737 ;
5738
5739 _proto.use = function use(newPlugin, options) {
5740 if (options === void 0) {
5741 options = {
5742 queue: 'external'
5743 };
5744 }
5745
5746 var plugins = this.plugins[options.queue]; // Avoids applying same plugin twice, at least based on ref.
5747
5748 if (plugins.indexOf(newPlugin) !== -1) {
5749 return;
5750 }
5751
5752 plugins.push(newPlugin);
5753 this.registry = [].concat(this.plugins.external, this.plugins.internal).reduce(function (registry, plugin) {
5754 for (var name in plugin) {
5755 if (name in registry) {
5756 registry[name].push(plugin[name]);
5757 }
5758 }
5759
5760 return registry;
5761 }, {
5762 onCreateRule: [],
5763 onProcessRule: [],
5764 onProcessStyle: [],
5765 onProcessSheet: [],
5766 onChangeValue: [],
5767 onUpdate: []
5768 });
5769 };
5770
5771 return PluginsRegistry;
5772 }();
5773
5774 /**
5775 * Sheets registry to access them all at one place.
5776 */
5777 var SheetsRegistry =
5778 /*#__PURE__*/
5779 function () {
5780 function SheetsRegistry() {
5781 this.registry = [];
5782 }
5783
5784 var _proto = SheetsRegistry.prototype;
5785
5786 /**
5787 * Register a Style Sheet.
5788 */
5789 _proto.add = function add(sheet) {
5790 var registry = this.registry;
5791 var index = sheet.options.index;
5792 if (registry.indexOf(sheet) !== -1) return;
5793
5794 if (registry.length === 0 || index >= this.index) {
5795 registry.push(sheet);
5796 return;
5797 } // Find a position.
5798
5799
5800 for (var i = 0; i < registry.length; i++) {
5801 if (registry[i].options.index > index) {
5802 registry.splice(i, 0, sheet);
5803 return;
5804 }
5805 }
5806 }
5807 /**
5808 * Reset the registry.
5809 */
5810 ;
5811
5812 _proto.reset = function reset() {
5813 this.registry = [];
5814 }
5815 /**
5816 * Remove a Style Sheet.
5817 */
5818 ;
5819
5820 _proto.remove = function remove(sheet) {
5821 var index = this.registry.indexOf(sheet);
5822 this.registry.splice(index, 1);
5823 }
5824 /**
5825 * Convert all attached sheets to a CSS string.
5826 */
5827 ;
5828
5829 _proto.toString = function toString(_temp) {
5830 var _ref = _temp === void 0 ? {} : _temp,
5831 attached = _ref.attached,
5832 options = _objectWithoutPropertiesLoose$3(_ref, ["attached"]);
5833
5834 var css = '';
5835
5836 for (var i = 0; i < this.registry.length; i++) {
5837 var sheet = this.registry[i];
5838
5839 if (attached != null && sheet.attached !== attached) {
5840 continue;
5841 }
5842
5843 if (css) css += '\n';
5844 css += sheet.toString(options);
5845 }
5846
5847 return css;
5848 };
5849
5850 _createClass$1(SheetsRegistry, [{
5851 key: "index",
5852
5853 /**
5854 * Current highest index number.
5855 */
5856 get: function get() {
5857 return this.registry.length === 0 ? 0 : this.registry[this.registry.length - 1].options.index;
5858 }
5859 }]);
5860
5861 return SheetsRegistry;
5862 }();
5863
5864 /**
5865 * This is a global sheets registry. Only DomRenderer will add sheets to it.
5866 * On the server one should use an own SheetsRegistry instance and add the
5867 * sheets to it, because you need to make sure to create a new registry for
5868 * each request in order to not leak sheets across requests.
5869 */
5870
5871 var registry = new SheetsRegistry();
5872
5873 /* eslint-disable */
5874 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
5875 var globalThis$1 = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
5876
5877 var ns = '2f1acc6c3a606b082e5eef5e54414ffb';
5878 if (globalThis$1[ns] == null) globalThis$1[ns] = 0; // Bundle may contain multiple JSS versions at the same time. In order to identify
5879 // the current version with just one short number and use it for classes generation
5880 // we use a counter. Also it is more accurate, because user can manually reevaluate
5881 // the module.
5882
5883 var moduleId = globalThis$1[ns]++;
5884
5885 /**
5886 * Returns a function which generates unique class names based on counters.
5887 * When new generator function is created, rule counter is reseted.
5888 * We need to reset the rule counter for SSR for each request.
5889 */
5890 var createGenerateId = function createGenerateId(options) {
5891 if (options === void 0) {
5892 options = {};
5893 }
5894
5895 var ruleCounter = 0;
5896 return function (rule, sheet) {
5897 ruleCounter += 1;
5898
5899 var jssId = '';
5900 var prefix = '';
5901
5902 if (sheet) {
5903 if (sheet.options.classNamePrefix) {
5904 prefix = sheet.options.classNamePrefix;
5905 }
5906
5907 if (sheet.options.jss.id != null) {
5908 jssId = String(sheet.options.jss.id);
5909 }
5910 }
5911
5912 if (options.minify) {
5913 // Using "c" because a number can't be the first char in a class name.
5914 return "" + (prefix || 'c') + moduleId + jssId + ruleCounter;
5915 }
5916
5917 return prefix + rule.key + "-" + moduleId + (jssId ? "-" + jssId : '') + "-" + ruleCounter;
5918 };
5919 };
5920
5921 /**
5922 * Cache the value from the first time a function is called.
5923 */
5924 var memoize$1 = function memoize(fn) {
5925 var value;
5926 return function () {
5927 if (!value) value = fn();
5928 return value;
5929 };
5930 };
5931
5932 /**
5933 * Get a style property value.
5934 */
5935 var getPropertyValue = function getPropertyValue(cssRule, prop) {
5936 try {
5937 // Support CSSTOM.
5938 if (cssRule.attributeStyleMap) {
5939 return cssRule.attributeStyleMap.get(prop);
5940 }
5941
5942 return cssRule.style.getPropertyValue(prop);
5943 } catch (err) {
5944 // IE may throw if property is unknown.
5945 return '';
5946 }
5947 };
5948
5949 /**
5950 * Set a style property.
5951 */
5952 var setProperty = function setProperty(cssRule, prop, value) {
5953 try {
5954 var cssValue = value;
5955
5956 if (Array.isArray(value)) {
5957 cssValue = toCssValue(value, true);
5958
5959 if (value[value.length - 1] === '!important') {
5960 cssRule.style.setProperty(prop, cssValue, 'important');
5961 return true;
5962 }
5963 } // Support CSSTOM.
5964
5965
5966 if (cssRule.attributeStyleMap) {
5967 cssRule.attributeStyleMap.set(prop, cssValue);
5968 } else {
5969 cssRule.style.setProperty(prop, cssValue);
5970 }
5971 } catch (err) {
5972 // IE may throw if property is unknown.
5973 return false;
5974 }
5975
5976 return true;
5977 };
5978
5979 /**
5980 * Remove a style property.
5981 */
5982 var removeProperty = function removeProperty(cssRule, prop) {
5983 try {
5984 // Support CSSTOM.
5985 if (cssRule.attributeStyleMap) {
5986 cssRule.attributeStyleMap.delete(prop);
5987 } else {
5988 cssRule.style.removeProperty(prop);
5989 }
5990 } catch (err) {
5991 }
5992 };
5993
5994 /**
5995 * Set the selector.
5996 */
5997 var setSelector = function setSelector(cssRule, selectorText) {
5998 cssRule.selectorText = selectorText; // Return false if setter was not successful.
5999 // Currently works in chrome only.
6000
6001 return cssRule.selectorText === selectorText;
6002 };
6003 /**
6004 * Gets the `head` element upon the first call and caches it.
6005 * We assume it can't be null.
6006 */
6007
6008
6009 var getHead = memoize$1(function () {
6010 return document.querySelector('head');
6011 });
6012 /**
6013 * Find attached sheet with an index higher than the passed one.
6014 */
6015
6016 function findHigherSheet(registry, options) {
6017 for (var i = 0; i < registry.length; i++) {
6018 var sheet = registry[i];
6019
6020 if (sheet.attached && sheet.options.index > options.index && sheet.options.insertionPoint === options.insertionPoint) {
6021 return sheet;
6022 }
6023 }
6024
6025 return null;
6026 }
6027 /**
6028 * Find attached sheet with the highest index.
6029 */
6030
6031
6032 function findHighestSheet(registry, options) {
6033 for (var i = registry.length - 1; i >= 0; i--) {
6034 var sheet = registry[i];
6035
6036 if (sheet.attached && sheet.options.insertionPoint === options.insertionPoint) {
6037 return sheet;
6038 }
6039 }
6040
6041 return null;
6042 }
6043 /**
6044 * Find a comment with "jss" inside.
6045 */
6046
6047
6048 function findCommentNode(text) {
6049 var head = getHead();
6050
6051 for (var i = 0; i < head.childNodes.length; i++) {
6052 var node = head.childNodes[i];
6053
6054 if (node.nodeType === 8 && node.nodeValue.trim() === text) {
6055 return node;
6056 }
6057 }
6058
6059 return null;
6060 }
6061
6062 /**
6063 * Find a node before which we can insert the sheet.
6064 */
6065 function findPrevNode(options) {
6066 var registry$1 = registry.registry;
6067
6068 if (registry$1.length > 0) {
6069 // Try to insert before the next higher sheet.
6070 var sheet = findHigherSheet(registry$1, options);
6071
6072 if (sheet && sheet.renderer) {
6073 return {
6074 parent: sheet.renderer.element.parentNode,
6075 node: sheet.renderer.element
6076 };
6077 } // Otherwise insert after the last attached.
6078
6079
6080 sheet = findHighestSheet(registry$1, options);
6081
6082 if (sheet && sheet.renderer) {
6083 return {
6084 parent: sheet.renderer.element.parentNode,
6085 node: sheet.renderer.element.nextSibling
6086 };
6087 }
6088 } // Try to find a comment placeholder if registry is empty.
6089
6090
6091 var insertionPoint = options.insertionPoint;
6092
6093 if (insertionPoint && typeof insertionPoint === 'string') {
6094 var comment = findCommentNode(insertionPoint);
6095
6096 if (comment) {
6097 return {
6098 parent: comment.parentNode,
6099 node: comment.nextSibling
6100 };
6101 } // If user specifies an insertion point and it can't be found in the document -
6102 }
6103
6104 return false;
6105 }
6106 /**
6107 * Insert style element into the DOM.
6108 */
6109
6110
6111 function insertStyle(style, options) {
6112 var insertionPoint = options.insertionPoint;
6113 var nextNode = findPrevNode(options);
6114
6115 if (nextNode !== false && nextNode.parent) {
6116 nextNode.parent.insertBefore(style, nextNode.node);
6117 return;
6118 } // Works with iframes and any node types.
6119
6120
6121 if (insertionPoint && typeof insertionPoint.nodeType === 'number') {
6122 // https://stackoverflow.com/questions/41328728/force-casting-in-flow
6123 var insertionPointElement = insertionPoint;
6124 var parentNode = insertionPointElement.parentNode;
6125 if (parentNode) parentNode.insertBefore(style, insertionPointElement.nextSibling);
6126 return;
6127 }
6128
6129 getHead().appendChild(style);
6130 }
6131 /**
6132 * Read jss nonce setting from the page if the user has set it.
6133 */
6134
6135
6136 var getNonce = memoize$1(function () {
6137 var node = document.querySelector('meta[property="csp-nonce"]');
6138 return node ? node.getAttribute('content') : null;
6139 });
6140
6141 var _insertRule = function insertRule(container, rule, index) {
6142 try {
6143 if ('insertRule' in container) {
6144 var c = container;
6145 c.insertRule(rule, index);
6146 } // Keyframes rule.
6147 else if ('appendRule' in container) {
6148 var _c = container;
6149
6150 _c.appendRule(rule);
6151 }
6152 } catch (err) {
6153 return false;
6154 }
6155
6156 return container.cssRules[index];
6157 };
6158
6159 var getValidRuleInsertionIndex = function getValidRuleInsertionIndex(container, index) {
6160 var maxIndex = container.cssRules.length; // In case previous insertion fails, passed index might be wrong
6161
6162 if (index === undefined || index > maxIndex) {
6163 // eslint-disable-next-line no-param-reassign
6164 return maxIndex;
6165 }
6166
6167 return index;
6168 };
6169
6170 var createStyle = function createStyle() {
6171 var el = document.createElement('style'); // Without it, IE will have a broken source order specificity if we
6172 // insert rules after we insert the style tag.
6173 // It seems to kick-off the source order specificity algorithm.
6174
6175 el.textContent = '\n';
6176 return el;
6177 };
6178
6179 var DomRenderer =
6180 /*#__PURE__*/
6181 function () {
6182 // HTMLStyleElement needs fixing https://github.com/facebook/flow/issues/2696
6183 // Will be empty if link: true option is not set, because
6184 // it is only for use together with insertRule API.
6185 function DomRenderer(sheet) {
6186 this.getPropertyValue = getPropertyValue;
6187 this.setProperty = setProperty;
6188 this.removeProperty = removeProperty;
6189 this.setSelector = setSelector;
6190 this.element = void 0;
6191 this.sheet = void 0;
6192 this.hasInsertedRules = false;
6193 this.cssRules = [];
6194 // There is no sheet when the renderer is used from a standalone StyleRule.
6195 if (sheet) registry.add(sheet);
6196 this.sheet = sheet;
6197
6198 var _ref = this.sheet ? this.sheet.options : {},
6199 media = _ref.media,
6200 meta = _ref.meta,
6201 element = _ref.element;
6202
6203 this.element = element || createStyle();
6204 this.element.setAttribute('data-jss', '');
6205 if (media) this.element.setAttribute('media', media);
6206 if (meta) this.element.setAttribute('data-meta', meta);
6207 var nonce = getNonce();
6208 if (nonce) this.element.setAttribute('nonce', nonce);
6209 }
6210 /**
6211 * Insert style element into render tree.
6212 */
6213
6214
6215 var _proto = DomRenderer.prototype;
6216
6217 _proto.attach = function attach() {
6218 // In the case the element node is external and it is already in the DOM.
6219 if (this.element.parentNode || !this.sheet) return;
6220 insertStyle(this.element, this.sheet.options); // When rules are inserted using `insertRule` API, after `sheet.detach().attach()`
6221 // most browsers create a new CSSStyleSheet, except of all IEs.
6222
6223 var deployed = Boolean(this.sheet && this.sheet.deployed);
6224
6225 if (this.hasInsertedRules && deployed) {
6226 this.hasInsertedRules = false;
6227 this.deploy();
6228 }
6229 }
6230 /**
6231 * Remove style element from render tree.
6232 */
6233 ;
6234
6235 _proto.detach = function detach() {
6236 if (!this.sheet) return;
6237 var parentNode = this.element.parentNode;
6238 if (parentNode) parentNode.removeChild(this.element); // In the most browsers, rules inserted using insertRule() API will be lost when style element is removed.
6239 // Though IE will keep them and we need a consistent behavior.
6240
6241 if (this.sheet.options.link) {
6242 this.cssRules = [];
6243 this.element.textContent = '\n';
6244 }
6245 }
6246 /**
6247 * Inject CSS string into element.
6248 */
6249 ;
6250
6251 _proto.deploy = function deploy() {
6252 var sheet = this.sheet;
6253 if (!sheet) return;
6254
6255 if (sheet.options.link) {
6256 this.insertRules(sheet.rules);
6257 return;
6258 }
6259
6260 this.element.textContent = "\n" + sheet.toString() + "\n";
6261 }
6262 /**
6263 * Insert RuleList into an element.
6264 */
6265 ;
6266
6267 _proto.insertRules = function insertRules(rules, nativeParent) {
6268 for (var i = 0; i < rules.index.length; i++) {
6269 this.insertRule(rules.index[i], i, nativeParent);
6270 }
6271 }
6272 /**
6273 * Insert a rule into element.
6274 */
6275 ;
6276
6277 _proto.insertRule = function insertRule(rule, index, nativeParent) {
6278 if (nativeParent === void 0) {
6279 nativeParent = this.element.sheet;
6280 }
6281
6282 if (rule.rules) {
6283 var parent = rule;
6284 var latestNativeParent = nativeParent;
6285
6286 if (rule.type === 'conditional' || rule.type === 'keyframes') {
6287 var _insertionIndex = getValidRuleInsertionIndex(nativeParent, index); // We need to render the container without children first.
6288
6289
6290 latestNativeParent = _insertRule(nativeParent, parent.toString({
6291 children: false
6292 }), _insertionIndex);
6293
6294 if (latestNativeParent === false) {
6295 return false;
6296 }
6297
6298 this.refCssRule(rule, _insertionIndex, latestNativeParent);
6299 }
6300
6301 this.insertRules(parent.rules, latestNativeParent);
6302 return latestNativeParent;
6303 }
6304
6305 var ruleStr = rule.toString();
6306 if (!ruleStr) return false;
6307 var insertionIndex = getValidRuleInsertionIndex(nativeParent, index);
6308
6309 var nativeRule = _insertRule(nativeParent, ruleStr, insertionIndex);
6310
6311 if (nativeRule === false) {
6312 return false;
6313 }
6314
6315 this.hasInsertedRules = true;
6316 this.refCssRule(rule, insertionIndex, nativeRule);
6317 return nativeRule;
6318 };
6319
6320 _proto.refCssRule = function refCssRule(rule, index, cssRule) {
6321 rule.renderable = cssRule; // We only want to reference the top level rules, deleteRule API doesn't support removing nested rules
6322 // like rules inside media queries or keyframes
6323
6324 if (rule.options.parent instanceof StyleSheet) {
6325 this.cssRules[index] = cssRule;
6326 }
6327 }
6328 /**
6329 * Delete a rule.
6330 */
6331 ;
6332
6333 _proto.deleteRule = function deleteRule(cssRule) {
6334 var sheet = this.element.sheet;
6335 var index = this.indexOf(cssRule);
6336 if (index === -1) return false;
6337 sheet.deleteRule(index);
6338 this.cssRules.splice(index, 1);
6339 return true;
6340 }
6341 /**
6342 * Get index of a CSS Rule.
6343 */
6344 ;
6345
6346 _proto.indexOf = function indexOf(cssRule) {
6347 return this.cssRules.indexOf(cssRule);
6348 }
6349 /**
6350 * Generate a new CSS rule and replace the existing one.
6351 *
6352 * Only used for some old browsers because they can't set a selector.
6353 */
6354 ;
6355
6356 _proto.replaceRule = function replaceRule(cssRule, rule) {
6357 var index = this.indexOf(cssRule);
6358 if (index === -1) return false;
6359 this.element.sheet.deleteRule(index);
6360 this.cssRules.splice(index, 1);
6361 return this.insertRule(rule, index);
6362 }
6363 /**
6364 * Get all rules elements.
6365 */
6366 ;
6367
6368 _proto.getRules = function getRules() {
6369 return this.element.sheet.cssRules;
6370 };
6371
6372 return DomRenderer;
6373 }();
6374
6375 var instanceCounter = 0;
6376
6377 var Jss =
6378 /*#__PURE__*/
6379 function () {
6380 function Jss(options) {
6381 this.id = instanceCounter++;
6382 this.version = "10.5.1";
6383 this.plugins = new PluginsRegistry();
6384 this.options = {
6385 id: {
6386 minify: false
6387 },
6388 createGenerateId: createGenerateId,
6389 Renderer: isBrowser$1 ? DomRenderer : null,
6390 plugins: []
6391 };
6392 this.generateId = createGenerateId({
6393 minify: false
6394 });
6395
6396 for (var i = 0; i < plugins$1.length; i++) {
6397 this.plugins.use(plugins$1[i], {
6398 queue: 'internal'
6399 });
6400 }
6401
6402 this.setup(options);
6403 }
6404 /**
6405 * Prepares various options, applies plugins.
6406 * Should not be used twice on the same instance, because there is no plugins
6407 * deduplication logic.
6408 */
6409
6410
6411 var _proto = Jss.prototype;
6412
6413 _proto.setup = function setup(options) {
6414 if (options === void 0) {
6415 options = {};
6416 }
6417
6418 if (options.createGenerateId) {
6419 this.options.createGenerateId = options.createGenerateId;
6420 }
6421
6422 if (options.id) {
6423 this.options.id = _extends$9({}, this.options.id, options.id);
6424 }
6425
6426 if (options.createGenerateId || options.id) {
6427 this.generateId = this.options.createGenerateId(this.options.id);
6428 }
6429
6430 if (options.insertionPoint != null) this.options.insertionPoint = options.insertionPoint;
6431
6432 if ('Renderer' in options) {
6433 this.options.Renderer = options.Renderer;
6434 } // eslint-disable-next-line prefer-spread
6435
6436
6437 if (options.plugins) this.use.apply(this, options.plugins);
6438 return this;
6439 }
6440 /**
6441 * Create a Style Sheet.
6442 */
6443 ;
6444
6445 _proto.createStyleSheet = function createStyleSheet(styles, options) {
6446 if (options === void 0) {
6447 options = {};
6448 }
6449
6450 var _options = options,
6451 index = _options.index;
6452
6453 if (typeof index !== 'number') {
6454 index = registry.index === 0 ? 0 : registry.index + 1;
6455 }
6456
6457 var sheet = new StyleSheet(styles, _extends$9({}, options, {
6458 jss: this,
6459 generateId: options.generateId || this.generateId,
6460 insertionPoint: this.options.insertionPoint,
6461 Renderer: this.options.Renderer,
6462 index: index
6463 }));
6464 this.plugins.onProcessSheet(sheet);
6465 return sheet;
6466 }
6467 /**
6468 * Detach the Style Sheet and remove it from the registry.
6469 */
6470 ;
6471
6472 _proto.removeStyleSheet = function removeStyleSheet(sheet) {
6473 sheet.detach();
6474 registry.remove(sheet);
6475 return this;
6476 }
6477 /**
6478 * Create a rule without a Style Sheet.
6479 * [Deprecated] will be removed in the next major version.
6480 */
6481 ;
6482
6483 _proto.createRule = function createRule$1(name, style, options) {
6484 if (style === void 0) {
6485 style = {};
6486 }
6487
6488 if (options === void 0) {
6489 options = {};
6490 }
6491
6492 // Enable rule without name for inline styles.
6493 if (typeof name === 'object') {
6494 // $FlowFixMe[incompatible-call]
6495 return this.createRule(undefined, name, style);
6496 } // $FlowFixMe[incompatible-type]
6497
6498
6499 var ruleOptions = _extends$9({}, options, {
6500 name: name,
6501 jss: this,
6502 Renderer: this.options.Renderer
6503 });
6504
6505 if (!ruleOptions.generateId) ruleOptions.generateId = this.generateId;
6506 if (!ruleOptions.classes) ruleOptions.classes = {};
6507 if (!ruleOptions.keyframes) ruleOptions.keyframes = {};
6508
6509 var rule = createRule(name, style, ruleOptions);
6510
6511 if (rule) this.plugins.onProcessRule(rule);
6512 return rule;
6513 }
6514 /**
6515 * Register plugin. Passed function will be invoked with a rule instance.
6516 */
6517 ;
6518
6519 _proto.use = function use() {
6520 var _this = this;
6521
6522 for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
6523 plugins[_key] = arguments[_key];
6524 }
6525
6526 plugins.forEach(function (plugin) {
6527 _this.plugins.use(plugin);
6528 });
6529 return this;
6530 };
6531
6532 return Jss;
6533 }();
6534
6535 /**
6536 * Extracts a styles object with only props that contain function values.
6537 */
6538 function getDynamicStyles(styles) {
6539 var to = null;
6540
6541 for (var key in styles) {
6542 var value = styles[key];
6543 var type = typeof value;
6544
6545 if (type === 'function') {
6546 if (!to) to = {};
6547 to[key] = value;
6548 } else if (type === 'object' && value !== null && !Array.isArray(value)) {
6549 var extracted = getDynamicStyles(value);
6550
6551 if (extracted) {
6552 if (!to) to = {};
6553 to[key] = extracted;
6554 }
6555 }
6556 }
6557
6558 return to;
6559 }
6560
6561 /**
6562 * A better abstraction over CSS.
6563 *
6564 * @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present
6565 * @website https://github.com/cssinjs/jss
6566 * @license MIT
6567 */
6568
6569 /**
6570 * Export a constant indicating if this browser has CSSTOM support.
6571 * https://developers.google.com/web/updates/2018/03/cssom
6572 */
6573 var hasCSSTOMSupport = typeof CSS === 'object' && CSS != null && 'number' in CSS;
6574 /**
6575 * Creates a new instance of Jss.
6576 */
6577
6578 var create$4 = function create(options) {
6579 return new Jss(options);
6580 };
6581 /**
6582 * A global Jss instance.
6583 */
6584
6585 create$4();
6586
6587 var now$1 = Date.now();
6588 var fnValuesNs = "fnValues" + now$1;
6589 var fnRuleNs = "fnStyle" + ++now$1;
6590
6591 var functionPlugin = function functionPlugin() {
6592 return {
6593 onCreateRule: function onCreateRule(name, decl, options) {
6594 if (typeof decl !== 'function') return null;
6595 var rule = createRule(name, {}, options);
6596 rule[fnRuleNs] = decl;
6597 return rule;
6598 },
6599 onProcessStyle: function onProcessStyle(style, rule) {
6600 // We need to extract function values from the declaration, so that we can keep core unaware of them.
6601 // We need to do that only once.
6602 // We don't need to extract functions on each style update, since this can happen only once.
6603 // We don't support function values inside of function rules.
6604 if (fnValuesNs in rule || fnRuleNs in rule) return style;
6605 var fnValues = {};
6606
6607 for (var prop in style) {
6608 var value = style[prop];
6609 if (typeof value !== 'function') continue;
6610 delete style[prop];
6611 fnValues[prop] = value;
6612 } // $FlowFixMe[prop-missing]
6613
6614
6615 rule[fnValuesNs] = fnValues;
6616 return style;
6617 },
6618 onUpdate: function onUpdate(data, rule, sheet, options) {
6619 var styleRule = rule; // $FlowFixMe[prop-missing]
6620
6621 var fnRule = styleRule[fnRuleNs]; // If we have a style function, the entire rule is dynamic and style object
6622 // will be returned from that function.
6623
6624 if (fnRule) {
6625 // Empty object will remove all currently defined props
6626 // in case function rule returns a falsy value.
6627 styleRule.style = fnRule(data) || {};
6628 } // $FlowFixMe[prop-missing]
6629
6630
6631 var fnValues = styleRule[fnValuesNs]; // If we have a fn values map, it is a rule with function values.
6632
6633 if (fnValues) {
6634 for (var _prop in fnValues) {
6635 styleRule.prop(_prop, fnValues[_prop](data), options);
6636 }
6637 }
6638 }
6639 };
6640 };
6641
6642 function _extends$8() {
6643 _extends$8 = Object.assign || function (target) {
6644 for (var i = 1; i < arguments.length; i++) {
6645 var source = arguments[i];
6646
6647 for (var key in source) {
6648 if (Object.prototype.hasOwnProperty.call(source, key)) {
6649 target[key] = source[key];
6650 }
6651 }
6652 }
6653
6654 return target;
6655 };
6656
6657 return _extends$8.apply(this, arguments);
6658 }
6659
6660 var at = '@global';
6661 var atPrefix = '@global ';
6662
6663 var GlobalContainerRule =
6664 /*#__PURE__*/
6665 function () {
6666 function GlobalContainerRule(key, styles, options) {
6667 this.type = 'global';
6668 this.at = at;
6669 this.rules = void 0;
6670 this.options = void 0;
6671 this.key = void 0;
6672 this.isProcessed = false;
6673 this.key = key;
6674 this.options = options;
6675 this.rules = new RuleList(_extends$8({}, options, {
6676 parent: this
6677 }));
6678
6679 for (var selector in styles) {
6680 this.rules.add(selector, styles[selector]);
6681 }
6682
6683 this.rules.process();
6684 }
6685 /**
6686 * Get a rule.
6687 */
6688
6689
6690 var _proto = GlobalContainerRule.prototype;
6691
6692 _proto.getRule = function getRule(name) {
6693 return this.rules.get(name);
6694 }
6695 /**
6696 * Create and register rule, run plugins.
6697 */
6698 ;
6699
6700 _proto.addRule = function addRule(name, style, options) {
6701 var rule = this.rules.add(name, style, options);
6702 if (rule) this.options.jss.plugins.onProcessRule(rule);
6703 return rule;
6704 }
6705 /**
6706 * Get index of a rule.
6707 */
6708 ;
6709
6710 _proto.indexOf = function indexOf(rule) {
6711 return this.rules.indexOf(rule);
6712 }
6713 /**
6714 * Generates a CSS string.
6715 */
6716 ;
6717
6718 _proto.toString = function toString() {
6719 return this.rules.toString();
6720 };
6721
6722 return GlobalContainerRule;
6723 }();
6724
6725 var GlobalPrefixedRule =
6726 /*#__PURE__*/
6727 function () {
6728 function GlobalPrefixedRule(key, style, options) {
6729 this.type = 'global';
6730 this.at = at;
6731 this.options = void 0;
6732 this.rule = void 0;
6733 this.isProcessed = false;
6734 this.key = void 0;
6735 this.key = key;
6736 this.options = options;
6737 var selector = key.substr(atPrefix.length);
6738 this.rule = options.jss.createRule(selector, style, _extends$8({}, options, {
6739 parent: this
6740 }));
6741 }
6742
6743 var _proto2 = GlobalPrefixedRule.prototype;
6744
6745 _proto2.toString = function toString(options) {
6746 return this.rule ? this.rule.toString(options) : '';
6747 };
6748
6749 return GlobalPrefixedRule;
6750 }();
6751
6752 var separatorRegExp$1 = /\s*,\s*/g;
6753
6754 function addScope(selector, scope) {
6755 var parts = selector.split(separatorRegExp$1);
6756 var scoped = '';
6757
6758 for (var i = 0; i < parts.length; i++) {
6759 scoped += scope + " " + parts[i].trim();
6760 if (parts[i + 1]) scoped += ', ';
6761 }
6762
6763 return scoped;
6764 }
6765
6766 function handleNestedGlobalContainerRule(rule, sheet) {
6767 var options = rule.options,
6768 style = rule.style;
6769 var rules = style ? style[at] : null;
6770 if (!rules) return;
6771
6772 for (var name in rules) {
6773 sheet.addRule(name, rules[name], _extends$8({}, options, {
6774 selector: addScope(name, rule.selector)
6775 }));
6776 }
6777
6778 delete style[at];
6779 }
6780
6781 function handlePrefixedGlobalRule(rule, sheet) {
6782 var options = rule.options,
6783 style = rule.style;
6784
6785 for (var prop in style) {
6786 if (prop[0] !== '@' || prop.substr(0, at.length) !== at) continue;
6787 var selector = addScope(prop.substr(at.length), rule.selector);
6788 sheet.addRule(selector, style[prop], _extends$8({}, options, {
6789 selector: selector
6790 }));
6791 delete style[prop];
6792 }
6793 }
6794 /**
6795 * Convert nested rules to separate, remove them from original styles.
6796 *
6797 * @param {Rule} rule
6798 * @api public
6799 */
6800
6801
6802 function jssGlobal() {
6803 function onCreateRule(name, styles, options) {
6804 if (!name) return null;
6805
6806 if (name === at) {
6807 return new GlobalContainerRule(name, styles, options);
6808 }
6809
6810 if (name[0] === '@' && name.substr(0, atPrefix.length) === atPrefix) {
6811 return new GlobalPrefixedRule(name, styles, options);
6812 }
6813
6814 var parent = options.parent;
6815
6816 if (parent) {
6817 if (parent.type === 'global' || parent.options.parent && parent.options.parent.type === 'global') {
6818 options.scoped = false;
6819 }
6820 }
6821
6822 if (options.scoped === false) {
6823 options.selector = name;
6824 }
6825
6826 return null;
6827 }
6828
6829 function onProcessRule(rule, sheet) {
6830 if (rule.type !== 'style' || !sheet) return;
6831 handleNestedGlobalContainerRule(rule, sheet);
6832 handlePrefixedGlobalRule(rule, sheet);
6833 }
6834
6835 return {
6836 onCreateRule: onCreateRule,
6837 onProcessRule: onProcessRule
6838 };
6839 }
6840
6841 function _extends$7() {
6842 _extends$7 = Object.assign || function (target) {
6843 for (var i = 1; i < arguments.length; i++) {
6844 var source = arguments[i];
6845
6846 for (var key in source) {
6847 if (Object.prototype.hasOwnProperty.call(source, key)) {
6848 target[key] = source[key];
6849 }
6850 }
6851 }
6852
6853 return target;
6854 };
6855
6856 return _extends$7.apply(this, arguments);
6857 }
6858
6859 var separatorRegExp = /\s*,\s*/g;
6860 var parentRegExp = /&/g;
6861 var refRegExp = /\$([\w-]+)/g;
6862 /**
6863 * Convert nested rules to separate, remove them from original styles.
6864 *
6865 * @param {Rule} rule
6866 * @api public
6867 */
6868
6869 function jssNested() {
6870 // Get a function to be used for $ref replacement.
6871 function getReplaceRef(container, sheet) {
6872 return function (match, key) {
6873 var rule = container.getRule(key) || sheet && sheet.getRule(key);
6874
6875 if (rule) {
6876 rule = rule;
6877 return rule.selector;
6878 }
6879 return key;
6880 };
6881 }
6882
6883 function replaceParentRefs(nestedProp, parentProp) {
6884 var parentSelectors = parentProp.split(separatorRegExp);
6885 var nestedSelectors = nestedProp.split(separatorRegExp);
6886 var result = '';
6887
6888 for (var i = 0; i < parentSelectors.length; i++) {
6889 var parent = parentSelectors[i];
6890
6891 for (var j = 0; j < nestedSelectors.length; j++) {
6892 var nested = nestedSelectors[j];
6893 if (result) result += ', '; // Replace all & by the parent or prefix & with the parent.
6894
6895 result += nested.indexOf('&') !== -1 ? nested.replace(parentRegExp, parent) : parent + " " + nested;
6896 }
6897 }
6898
6899 return result;
6900 }
6901
6902 function getOptions(rule, container, prevOptions) {
6903 // Options has been already created, now we only increase index.
6904 if (prevOptions) return _extends$7({}, prevOptions, {
6905 index: prevOptions.index + 1 // $FlowFixMe[prop-missing]
6906
6907 });
6908 var nestingLevel = rule.options.nestingLevel;
6909 nestingLevel = nestingLevel === undefined ? 1 : nestingLevel + 1;
6910
6911 var options = _extends$7({}, rule.options, {
6912 nestingLevel: nestingLevel,
6913 index: container.indexOf(rule) + 1 // We don't need the parent name to be set options for chlid.
6914
6915 });
6916
6917 delete options.name;
6918 return options;
6919 }
6920
6921 function onProcessStyle(style, rule, sheet) {
6922 if (rule.type !== 'style') return style;
6923 var styleRule = rule;
6924 var container = styleRule.options.parent;
6925 var options;
6926 var replaceRef;
6927
6928 for (var prop in style) {
6929 var isNested = prop.indexOf('&') !== -1;
6930 var isNestedConditional = prop[0] === '@';
6931 if (!isNested && !isNestedConditional) continue;
6932 options = getOptions(styleRule, container, options);
6933
6934 if (isNested) {
6935 var selector = replaceParentRefs(prop, styleRule.selector); // Lazily create the ref replacer function just once for
6936 // all nested rules within the sheet.
6937
6938 if (!replaceRef) replaceRef = getReplaceRef(container, sheet); // Replace all $refs.
6939
6940 selector = selector.replace(refRegExp, replaceRef);
6941 container.addRule(selector, style[prop], _extends$7({}, options, {
6942 selector: selector
6943 }));
6944 } else if (isNestedConditional) {
6945 // Place conditional right after the parent rule to ensure right ordering.
6946 container.addRule(prop, {}, options) // Flow expects more options but they aren't required
6947 // And flow doesn't know this will always be a StyleRule which has the addRule method
6948 // $FlowFixMe[incompatible-use]
6949 // $FlowFixMe[prop-missing]
6950 .addRule(styleRule.key, style[prop], {
6951 selector: styleRule.selector
6952 });
6953 }
6954
6955 delete style[prop];
6956 }
6957
6958 return style;
6959 }
6960
6961 return {
6962 onProcessStyle: onProcessStyle
6963 };
6964 }
6965
6966 /* eslint-disable no-var, prefer-template */
6967 var uppercasePattern = /[A-Z]/g;
6968 var msPattern = /^ms-/;
6969 var cache$2 = {};
6970
6971 function toHyphenLower(match) {
6972 return '-' + match.toLowerCase()
6973 }
6974
6975 function hyphenateStyleName(name) {
6976 if (cache$2.hasOwnProperty(name)) {
6977 return cache$2[name]
6978 }
6979
6980 var hName = name.replace(uppercasePattern, toHyphenLower);
6981 return (cache$2[name] = msPattern.test(hName) ? '-' + hName : hName)
6982 }
6983
6984 /**
6985 * Convert camel cased property names to dash separated.
6986 *
6987 * @param {Object} style
6988 * @return {Object}
6989 */
6990
6991 function convertCase(style) {
6992 var converted = {};
6993
6994 for (var prop in style) {
6995 var key = prop.indexOf('--') === 0 ? prop : hyphenateStyleName(prop);
6996 converted[key] = style[prop];
6997 }
6998
6999 if (style.fallbacks) {
7000 if (Array.isArray(style.fallbacks)) converted.fallbacks = style.fallbacks.map(convertCase);else converted.fallbacks = convertCase(style.fallbacks);
7001 }
7002
7003 return converted;
7004 }
7005 /**
7006 * Allow camel cased property names by converting them back to dasherized.
7007 *
7008 * @param {Rule} rule
7009 */
7010
7011
7012 function camelCase() {
7013 function onProcessStyle(style) {
7014 if (Array.isArray(style)) {
7015 // Handle rules like @font-face, which can have multiple styles in an array
7016 for (var index = 0; index < style.length; index++) {
7017 style[index] = convertCase(style[index]);
7018 }
7019
7020 return style;
7021 }
7022
7023 return convertCase(style);
7024 }
7025
7026 function onChangeValue(value, prop, rule) {
7027 if (prop.indexOf('--') === 0) {
7028 return value;
7029 }
7030
7031 var hyphenatedProp = hyphenateStyleName(prop); // There was no camel case in place
7032
7033 if (prop === hyphenatedProp) return value;
7034 rule.prop(hyphenatedProp, value); // Core will ignore that property value we set the proper one above.
7035
7036 return null;
7037 }
7038
7039 return {
7040 onProcessStyle: onProcessStyle,
7041 onChangeValue: onChangeValue
7042 };
7043 }
7044
7045 var px = hasCSSTOMSupport && CSS ? CSS.px : 'px';
7046 var ms = hasCSSTOMSupport && CSS ? CSS.ms : 'ms';
7047 var percent = hasCSSTOMSupport && CSS ? CSS.percent : '%';
7048 /**
7049 * Generated jss-plugin-default-unit CSS property units
7050 *
7051 * @type object
7052 */
7053
7054 var defaultUnits = {
7055 // Animation properties
7056 'animation-delay': ms,
7057 'animation-duration': ms,
7058 // Background properties
7059 'background-position': px,
7060 'background-position-x': px,
7061 'background-position-y': px,
7062 'background-size': px,
7063 // Border Properties
7064 border: px,
7065 'border-bottom': px,
7066 'border-bottom-left-radius': px,
7067 'border-bottom-right-radius': px,
7068 'border-bottom-width': px,
7069 'border-left': px,
7070 'border-left-width': px,
7071 'border-radius': px,
7072 'border-right': px,
7073 'border-right-width': px,
7074 'border-top': px,
7075 'border-top-left-radius': px,
7076 'border-top-right-radius': px,
7077 'border-top-width': px,
7078 'border-width': px,
7079 'border-block': px,
7080 'border-block-end': px,
7081 'border-block-end-width': px,
7082 'border-block-start': px,
7083 'border-block-start-width': px,
7084 'border-block-width': px,
7085 'border-inline': px,
7086 'border-inline-end': px,
7087 'border-inline-end-width': px,
7088 'border-inline-start': px,
7089 'border-inline-start-width': px,
7090 'border-inline-width': px,
7091 'border-start-start-radius': px,
7092 'border-start-end-radius': px,
7093 'border-end-start-radius': px,
7094 'border-end-end-radius': px,
7095 // Margin properties
7096 margin: px,
7097 'margin-bottom': px,
7098 'margin-left': px,
7099 'margin-right': px,
7100 'margin-top': px,
7101 'margin-block': px,
7102 'margin-block-end': px,
7103 'margin-block-start': px,
7104 'margin-inline': px,
7105 'margin-inline-end': px,
7106 'margin-inline-start': px,
7107 // Padding properties
7108 padding: px,
7109 'padding-bottom': px,
7110 'padding-left': px,
7111 'padding-right': px,
7112 'padding-top': px,
7113 'padding-block': px,
7114 'padding-block-end': px,
7115 'padding-block-start': px,
7116 'padding-inline': px,
7117 'padding-inline-end': px,
7118 'padding-inline-start': px,
7119 // Mask properties
7120 'mask-position-x': px,
7121 'mask-position-y': px,
7122 'mask-size': px,
7123 // Width and height properties
7124 height: px,
7125 width: px,
7126 'min-height': px,
7127 'max-height': px,
7128 'min-width': px,
7129 'max-width': px,
7130 // Position properties
7131 bottom: px,
7132 left: px,
7133 top: px,
7134 right: px,
7135 inset: px,
7136 'inset-block': px,
7137 'inset-block-end': px,
7138 'inset-block-start': px,
7139 'inset-inline': px,
7140 'inset-inline-end': px,
7141 'inset-inline-start': px,
7142 // Shadow properties
7143 'box-shadow': px,
7144 'text-shadow': px,
7145 // Column properties
7146 'column-gap': px,
7147 'column-rule': px,
7148 'column-rule-width': px,
7149 'column-width': px,
7150 // Font and text properties
7151 'font-size': px,
7152 'font-size-delta': px,
7153 'letter-spacing': px,
7154 'text-decoration-thickness': px,
7155 'text-indent': px,
7156 'text-stroke': px,
7157 'text-stroke-width': px,
7158 'word-spacing': px,
7159 // Motion properties
7160 motion: px,
7161 'motion-offset': px,
7162 // Outline properties
7163 outline: px,
7164 'outline-offset': px,
7165 'outline-width': px,
7166 // Perspective properties
7167 perspective: px,
7168 'perspective-origin-x': percent,
7169 'perspective-origin-y': percent,
7170 // Transform properties
7171 'transform-origin': percent,
7172 'transform-origin-x': percent,
7173 'transform-origin-y': percent,
7174 'transform-origin-z': percent,
7175 // Transition properties
7176 'transition-delay': ms,
7177 'transition-duration': ms,
7178 // Alignment properties
7179 'vertical-align': px,
7180 'flex-basis': px,
7181 // Some random properties
7182 'shape-margin': px,
7183 size: px,
7184 gap: px,
7185 // Grid properties
7186 grid: px,
7187 'grid-gap': px,
7188 'row-gap': px,
7189 'grid-row-gap': px,
7190 'grid-column-gap': px,
7191 'grid-template-rows': px,
7192 'grid-template-columns': px,
7193 'grid-auto-rows': px,
7194 'grid-auto-columns': px,
7195 // Not existing properties.
7196 // Used to avoid issues with jss-plugin-expand integration.
7197 'box-shadow-x': px,
7198 'box-shadow-y': px,
7199 'box-shadow-blur': px,
7200 'box-shadow-spread': px,
7201 'font-line-height': px,
7202 'text-shadow-x': px,
7203 'text-shadow-y': px,
7204 'text-shadow-blur': px
7205 };
7206
7207 /**
7208 * Clones the object and adds a camel cased property version.
7209 */
7210 function addCamelCasedVersion(obj) {
7211 var regExp = /(-[a-z])/g;
7212
7213 var replace = function replace(str) {
7214 return str[1].toUpperCase();
7215 };
7216
7217 var newObj = {};
7218
7219 for (var _key in obj) {
7220 newObj[_key] = obj[_key];
7221 newObj[_key.replace(regExp, replace)] = obj[_key];
7222 }
7223
7224 return newObj;
7225 }
7226
7227 var units = addCamelCasedVersion(defaultUnits);
7228 /**
7229 * Recursive deep style passing function
7230 */
7231
7232 function iterate(prop, value, options) {
7233 if (value == null) return value;
7234
7235 if (Array.isArray(value)) {
7236 for (var i = 0; i < value.length; i++) {
7237 value[i] = iterate(prop, value[i], options);
7238 }
7239 } else if (typeof value === 'object') {
7240 if (prop === 'fallbacks') {
7241 for (var innerProp in value) {
7242 value[innerProp] = iterate(innerProp, value[innerProp], options);
7243 }
7244 } else {
7245 for (var _innerProp in value) {
7246 value[_innerProp] = iterate(prop + "-" + _innerProp, value[_innerProp], options);
7247 }
7248 }
7249 } else if (typeof value === 'number' && !Number.isNaN(value)) {
7250 var unit = options[prop] || units[prop]; // Add the unit if available, except for the special case of 0px.
7251
7252 if (unit && !(value === 0 && unit === px)) {
7253 return typeof unit === 'function' ? unit(value).toString() : "" + value + unit;
7254 }
7255
7256 return value.toString();
7257 }
7258
7259 return value;
7260 }
7261 /**
7262 * Add unit to numeric values.
7263 */
7264
7265
7266 function defaultUnit(options) {
7267 if (options === void 0) {
7268 options = {};
7269 }
7270
7271 var camelCasedOptions = addCamelCasedVersion(options);
7272
7273 function onProcessStyle(style, rule) {
7274 if (rule.type !== 'style') return style;
7275
7276 for (var prop in style) {
7277 style[prop] = iterate(prop, style[prop], camelCasedOptions);
7278 }
7279
7280 return style;
7281 }
7282
7283 function onChangeValue(value, prop) {
7284 return iterate(prop, value, camelCasedOptions);
7285 }
7286
7287 return {
7288 onProcessStyle: onProcessStyle,
7289 onChangeValue: onChangeValue
7290 };
7291 }
7292
7293 function _arrayLikeToArray(arr, len) {
7294 if (len == null || len > arr.length) len = arr.length;
7295
7296 for (var i = 0, arr2 = new Array(len); i < len; i++) {
7297 arr2[i] = arr[i];
7298 }
7299
7300 return arr2;
7301 }
7302
7303 function _arrayWithoutHoles$2(arr) {
7304 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
7305 }
7306
7307 function _iterableToArray$2(iter) {
7308 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
7309 }
7310
7311 function _unsupportedIterableToArray(o, minLen) {
7312 if (!o) return;
7313 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
7314 var n = Object.prototype.toString.call(o).slice(8, -1);
7315 if (n === "Object" && o.constructor) n = o.constructor.name;
7316 if (n === "Map" || n === "Set") return Array.from(o);
7317 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
7318 }
7319
7320 function _nonIterableSpread$2() {
7321 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7322 }
7323
7324 function _toConsumableArray$2(arr) {
7325 return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread$2();
7326 }
7327
7328 // Export javascript style and css style vendor prefixes.
7329 var js = '';
7330 var css = '';
7331 var vendor = '';
7332 var browser = '';
7333 var isTouch = isBrowser$1 && 'ontouchstart' in document.documentElement; // We should not do anything if required serverside.
7334
7335 if (isBrowser$1) {
7336 // Order matters. We need to check Webkit the last one because
7337 // other vendors use to add Webkit prefixes to some properties
7338 var jsCssMap = {
7339 Moz: '-moz-',
7340 ms: '-ms-',
7341 O: '-o-',
7342 Webkit: '-webkit-'
7343 };
7344
7345 var _document$createEleme = document.createElement('p'),
7346 style$1 = _document$createEleme.style;
7347
7348 var testProp = 'Transform';
7349
7350 for (var key in jsCssMap) {
7351 if (key + testProp in style$1) {
7352 js = key;
7353 css = jsCssMap[key];
7354 break;
7355 }
7356 } // Correctly detect the Edge browser.
7357
7358
7359 if (js === 'Webkit' && 'msHyphens' in style$1) {
7360 js = 'ms';
7361 css = jsCssMap.ms;
7362 browser = 'edge';
7363 } // Correctly detect the Safari browser.
7364
7365
7366 if (js === 'Webkit' && '-apple-trailing-word' in style$1) {
7367 vendor = 'apple';
7368 }
7369 }
7370 /**
7371 * Vendor prefix string for the current browser.
7372 *
7373 * @type {{js: String, css: String, vendor: String, browser: String}}
7374 * @api public
7375 */
7376
7377
7378 var prefix = {
7379 js: js,
7380 css: css,
7381 vendor: vendor,
7382 browser: browser,
7383 isTouch: isTouch
7384 };
7385
7386 /**
7387 * Test if a keyframe at-rule should be prefixed or not
7388 *
7389 * @param {String} vendor prefix string for the current browser.
7390 * @return {String}
7391 * @api public
7392 */
7393
7394 function supportedKeyframes(key) {
7395 // Keyframes is already prefixed. e.g. key = '@-webkit-keyframes a'
7396 if (key[1] === '-') return key; // No need to prefix IE/Edge. Older browsers will ignore unsupported rules.
7397 // https://caniuse.com/#search=keyframes
7398
7399 if (prefix.js === 'ms') return key;
7400 return "@" + prefix.css + "keyframes" + key.substr(10);
7401 }
7402
7403 // https://caniuse.com/#search=appearance
7404
7405 var appearence = {
7406 noPrefill: ['appearance'],
7407 supportedProperty: function supportedProperty(prop) {
7408 if (prop !== 'appearance') return false;
7409 if (prefix.js === 'ms') return "-webkit-" + prop;
7410 return prefix.css + prop;
7411 }
7412 };
7413
7414 // https://caniuse.com/#search=color-adjust
7415
7416 var colorAdjust = {
7417 noPrefill: ['color-adjust'],
7418 supportedProperty: function supportedProperty(prop) {
7419 if (prop !== 'color-adjust') return false;
7420 if (prefix.js === 'Webkit') return prefix.css + "print-" + prop;
7421 return prop;
7422 }
7423 };
7424
7425 var regExp = /[-\s]+(.)?/g;
7426 /**
7427 * Replaces the letter with the capital letter
7428 *
7429 * @param {String} match
7430 * @param {String} c
7431 * @return {String}
7432 * @api private
7433 */
7434
7435 function toUpper(match, c) {
7436 return c ? c.toUpperCase() : '';
7437 }
7438 /**
7439 * Convert dash separated strings to camel-cased.
7440 *
7441 * @param {String} str
7442 * @return {String}
7443 * @api private
7444 */
7445
7446
7447 function camelize(str) {
7448 return str.replace(regExp, toUpper);
7449 }
7450
7451 /**
7452 * Convert dash separated strings to pascal cased.
7453 *
7454 * @param {String} str
7455 * @return {String}
7456 * @api private
7457 */
7458
7459 function pascalize(str) {
7460 return camelize("-" + str);
7461 }
7462
7463 // but we can use a longhand property instead.
7464 // https://caniuse.com/#search=mask
7465
7466 var mask = {
7467 noPrefill: ['mask'],
7468 supportedProperty: function supportedProperty(prop, style) {
7469 if (!/^mask/.test(prop)) return false;
7470
7471 if (prefix.js === 'Webkit') {
7472 var longhand = 'mask-image';
7473
7474 if (camelize(longhand) in style) {
7475 return prop;
7476 }
7477
7478 if (prefix.js + pascalize(longhand) in style) {
7479 return prefix.css + prop;
7480 }
7481 }
7482
7483 return prop;
7484 }
7485 };
7486
7487 // https://caniuse.com/#search=text-orientation
7488
7489 var textOrientation = {
7490 noPrefill: ['text-orientation'],
7491 supportedProperty: function supportedProperty(prop) {
7492 if (prop !== 'text-orientation') return false;
7493
7494 if (prefix.vendor === 'apple' && !prefix.isTouch) {
7495 return prefix.css + prop;
7496 }
7497
7498 return prop;
7499 }
7500 };
7501
7502 // https://caniuse.com/#search=transform
7503
7504 var transform$1 = {
7505 noPrefill: ['transform'],
7506 supportedProperty: function supportedProperty(prop, style, options) {
7507 if (prop !== 'transform') return false;
7508
7509 if (options.transform) {
7510 return prop;
7511 }
7512
7513 return prefix.css + prop;
7514 }
7515 };
7516
7517 // https://caniuse.com/#search=transition
7518
7519 var transition = {
7520 noPrefill: ['transition'],
7521 supportedProperty: function supportedProperty(prop, style, options) {
7522 if (prop !== 'transition') return false;
7523
7524 if (options.transition) {
7525 return prop;
7526 }
7527
7528 return prefix.css + prop;
7529 }
7530 };
7531
7532 // https://caniuse.com/#search=writing-mode
7533
7534 var writingMode = {
7535 noPrefill: ['writing-mode'],
7536 supportedProperty: function supportedProperty(prop) {
7537 if (prop !== 'writing-mode') return false;
7538
7539 if (prefix.js === 'Webkit' || prefix.js === 'ms' && prefix.browser !== 'edge') {
7540 return prefix.css + prop;
7541 }
7542
7543 return prop;
7544 }
7545 };
7546
7547 // https://caniuse.com/#search=user-select
7548
7549 var userSelect = {
7550 noPrefill: ['user-select'],
7551 supportedProperty: function supportedProperty(prop) {
7552 if (prop !== 'user-select') return false;
7553
7554 if (prefix.js === 'Moz' || prefix.js === 'ms' || prefix.vendor === 'apple') {
7555 return prefix.css + prop;
7556 }
7557
7558 return prop;
7559 }
7560 };
7561
7562 // https://caniuse.com/#search=multicolumn
7563 // https://github.com/postcss/autoprefixer/issues/491
7564 // https://github.com/postcss/autoprefixer/issues/177
7565
7566 var breakPropsOld = {
7567 supportedProperty: function supportedProperty(prop, style) {
7568 if (!/^break-/.test(prop)) return false;
7569
7570 if (prefix.js === 'Webkit') {
7571 var jsProp = "WebkitColumn" + pascalize(prop);
7572 return jsProp in style ? prefix.css + "column-" + prop : false;
7573 }
7574
7575 if (prefix.js === 'Moz') {
7576 var _jsProp = "page" + pascalize(prop);
7577
7578 return _jsProp in style ? "page-" + prop : false;
7579 }
7580
7581 return false;
7582 }
7583 };
7584
7585 // See https://github.com/postcss/autoprefixer/issues/324.
7586
7587 var inlineLogicalOld = {
7588 supportedProperty: function supportedProperty(prop, style) {
7589 if (!/^(border|margin|padding)-inline/.test(prop)) return false;
7590 if (prefix.js === 'Moz') return prop;
7591 var newProp = prop.replace('-inline', '');
7592 return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
7593 }
7594 };
7595
7596 // Camelization is required because we can't test using.
7597 // CSS syntax for e.g. in FF.
7598
7599 var unprefixed = {
7600 supportedProperty: function supportedProperty(prop, style) {
7601 return camelize(prop) in style ? prop : false;
7602 }
7603 };
7604
7605 var prefixed = {
7606 supportedProperty: function supportedProperty(prop, style) {
7607 var pascalized = pascalize(prop); // Return custom CSS variable without prefixing.
7608
7609 if (prop[0] === '-') return prop; // Return already prefixed value without prefixing.
7610
7611 if (prop[0] === '-' && prop[1] === '-') return prop;
7612 if (prefix.js + pascalized in style) return prefix.css + prop; // Try webkit fallback.
7613
7614 if (prefix.js !== 'Webkit' && "Webkit" + pascalized in style) return "-webkit-" + prop;
7615 return false;
7616 }
7617 };
7618
7619 // https://caniuse.com/#search=scroll-snap
7620
7621 var scrollSnap = {
7622 supportedProperty: function supportedProperty(prop) {
7623 if (prop.substring(0, 11) !== 'scroll-snap') return false;
7624
7625 if (prefix.js === 'ms') {
7626 return "" + prefix.css + prop;
7627 }
7628
7629 return prop;
7630 }
7631 };
7632
7633 // https://caniuse.com/#search=overscroll-behavior
7634
7635 var overscrollBehavior = {
7636 supportedProperty: function supportedProperty(prop) {
7637 if (prop !== 'overscroll-behavior') return false;
7638
7639 if (prefix.js === 'ms') {
7640 return prefix.css + "scroll-chaining";
7641 }
7642
7643 return prop;
7644 }
7645 };
7646
7647 var propMap = {
7648 'flex-grow': 'flex-positive',
7649 'flex-shrink': 'flex-negative',
7650 'flex-basis': 'flex-preferred-size',
7651 'justify-content': 'flex-pack',
7652 order: 'flex-order',
7653 'align-items': 'flex-align',
7654 'align-content': 'flex-line-pack' // 'align-self' is handled by 'align-self' plugin.
7655
7656 }; // Support old flex spec from 2012.
7657
7658 var flex2012 = {
7659 supportedProperty: function supportedProperty(prop, style) {
7660 var newProp = propMap[prop];
7661 if (!newProp) return false;
7662 return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
7663 }
7664 };
7665
7666 var propMap$1 = {
7667 flex: 'box-flex',
7668 'flex-grow': 'box-flex',
7669 'flex-direction': ['box-orient', 'box-direction'],
7670 order: 'box-ordinal-group',
7671 'align-items': 'box-align',
7672 'flex-flow': ['box-orient', 'box-direction'],
7673 'justify-content': 'box-pack'
7674 };
7675 var propKeys = Object.keys(propMap$1);
7676
7677 var prefixCss = function prefixCss(p) {
7678 return prefix.css + p;
7679 }; // Support old flex spec from 2009.
7680
7681
7682 var flex2009 = {
7683 supportedProperty: function supportedProperty(prop, style, _ref) {
7684 var multiple = _ref.multiple;
7685
7686 if (propKeys.indexOf(prop) > -1) {
7687 var newProp = propMap$1[prop];
7688
7689 if (!Array.isArray(newProp)) {
7690 return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
7691 }
7692
7693 if (!multiple) return false;
7694
7695 for (var i = 0; i < newProp.length; i++) {
7696 if (!(prefix.js + pascalize(newProp[0]) in style)) {
7697 return false;
7698 }
7699 }
7700
7701 return newProp.map(prefixCss);
7702 }
7703
7704 return false;
7705 }
7706 };
7707
7708 // plugins = [
7709 // ...plugins,
7710 // breakPropsOld,
7711 // inlineLogicalOld,
7712 // unprefixed,
7713 // prefixed,
7714 // scrollSnap,
7715 // flex2012,
7716 // flex2009
7717 // ]
7718 // Plugins without 'noPrefill' value, going last.
7719 // 'flex-*' plugins should be at the bottom.
7720 // 'flex2009' going after 'flex2012'.
7721 // 'prefixed' going after 'unprefixed'
7722
7723 var plugins = [appearence, colorAdjust, mask, textOrientation, transform$1, transition, writingMode, userSelect, breakPropsOld, inlineLogicalOld, unprefixed, prefixed, scrollSnap, overscrollBehavior, flex2012, flex2009];
7724 var propertyDetectors = plugins.filter(function (p) {
7725 return p.supportedProperty;
7726 }).map(function (p) {
7727 return p.supportedProperty;
7728 });
7729 var noPrefill = plugins.filter(function (p) {
7730 return p.noPrefill;
7731 }).reduce(function (a, p) {
7732 a.push.apply(a, _toConsumableArray$2(p.noPrefill));
7733 return a;
7734 }, []);
7735
7736 var el;
7737 var cache$1 = {};
7738
7739 if (isBrowser$1) {
7740 el = document.createElement('p'); // We test every property on vendor prefix requirement.
7741 // Once tested, result is cached. It gives us up to 70% perf boost.
7742 // http://jsperf.com/element-style-object-access-vs-plain-object
7743 //
7744 // Prefill cache with known css properties to reduce amount of
7745 // properties we need to feature test at runtime.
7746 // http://davidwalsh.name/vendor-prefix
7747
7748 var computed = window.getComputedStyle(document.documentElement, '');
7749
7750 for (var key$1 in computed) {
7751 // eslint-disable-next-line no-restricted-globals
7752 if (!isNaN(key$1)) cache$1[computed[key$1]] = computed[key$1];
7753 } // Properties that cannot be correctly detected using the
7754 // cache prefill method.
7755
7756
7757 noPrefill.forEach(function (x) {
7758 return delete cache$1[x];
7759 });
7760 }
7761 /**
7762 * Test if a property is supported, returns supported property with vendor
7763 * prefix if required. Returns `false` if not supported.
7764 *
7765 * @param {String} prop dash separated
7766 * @param {Object} [options]
7767 * @return {String|Boolean}
7768 * @api public
7769 */
7770
7771
7772 function supportedProperty(prop, options) {
7773 if (options === void 0) {
7774 options = {};
7775 }
7776
7777 // For server-side rendering.
7778 if (!el) return prop; // Remove cache for benchmark tests or return property from the cache.
7779
7780 if (cache$1[prop] != null) {
7781 return cache$1[prop];
7782 } // Check if 'transition' or 'transform' natively supported in browser.
7783
7784
7785 if (prop === 'transition' || prop === 'transform') {
7786 options[prop] = prop in el.style;
7787 } // Find a plugin for current prefix property.
7788
7789
7790 for (var i = 0; i < propertyDetectors.length; i++) {
7791 cache$1[prop] = propertyDetectors[i](prop, el.style, options); // Break loop, if value found.
7792
7793 if (cache$1[prop]) break;
7794 } // Reset styles for current property.
7795 // Firefox can even throw an error for invalid properties, e.g., "0".
7796
7797
7798 try {
7799 el.style[prop] = '';
7800 } catch (err) {
7801 return false;
7802 }
7803
7804 return cache$1[prop];
7805 }
7806
7807 var cache$1$1 = {};
7808 var transitionProperties = {
7809 transition: 1,
7810 'transition-property': 1,
7811 '-webkit-transition': 1,
7812 '-webkit-transition-property': 1
7813 };
7814 var transPropsRegExp = /(^\s*[\w-]+)|, (\s*[\w-]+)(?![^()]*\))/g;
7815 var el$1;
7816 /**
7817 * Returns prefixed value transition/transform if needed.
7818 *
7819 * @param {String} match
7820 * @param {String} p1
7821 * @param {String} p2
7822 * @return {String}
7823 * @api private
7824 */
7825
7826 function prefixTransitionCallback(match, p1, p2) {
7827 if (p1 === 'var') return 'var';
7828 if (p1 === 'all') return 'all';
7829 if (p2 === 'all') return ', all';
7830 var prefixedValue = p1 ? supportedProperty(p1) : ", " + supportedProperty(p2);
7831 if (!prefixedValue) return p1 || p2;
7832 return prefixedValue;
7833 }
7834
7835 if (isBrowser$1) el$1 = document.createElement('p');
7836 /**
7837 * Returns prefixed value if needed. Returns `false` if value is not supported.
7838 *
7839 * @param {String} property
7840 * @param {String} value
7841 * @return {String|Boolean}
7842 * @api public
7843 */
7844
7845 function supportedValue(property, value) {
7846 // For server-side rendering.
7847 var prefixedValue = value;
7848 if (!el$1 || property === 'content') return value; // It is a string or a number as a string like '1'.
7849 // We want only prefixable values here.
7850 // eslint-disable-next-line no-restricted-globals
7851
7852 if (typeof prefixedValue !== 'string' || !isNaN(parseInt(prefixedValue, 10))) {
7853 return prefixedValue;
7854 } // Create cache key for current value.
7855
7856
7857 var cacheKey = property + prefixedValue; // Remove cache for benchmark tests or return value from cache.
7858
7859 if (cache$1$1[cacheKey] != null) {
7860 return cache$1$1[cacheKey];
7861 } // IE can even throw an error in some cases, for e.g. style.content = 'bar'.
7862
7863
7864 try {
7865 // Test value as it is.
7866 el$1.style[property] = prefixedValue;
7867 } catch (err) {
7868 // Return false if value not supported.
7869 cache$1$1[cacheKey] = false;
7870 return false;
7871 } // If 'transition' or 'transition-property' property.
7872
7873
7874 if (transitionProperties[property]) {
7875 prefixedValue = prefixedValue.replace(transPropsRegExp, prefixTransitionCallback);
7876 } else if (el$1.style[property] === '') {
7877 // Value with a vendor prefix.
7878 prefixedValue = prefix.css + prefixedValue; // Hardcode test to convert "flex" to "-ms-flexbox" for IE10.
7879
7880 if (prefixedValue === '-ms-flex') el$1.style[property] = '-ms-flexbox'; // Test prefixed value.
7881
7882 el$1.style[property] = prefixedValue; // Return false if value not supported.
7883
7884 if (el$1.style[property] === '') {
7885 cache$1$1[cacheKey] = false;
7886 return false;
7887 }
7888 } // Reset styles for current property.
7889
7890
7891 el$1.style[property] = ''; // Write current value to cache.
7892
7893 cache$1$1[cacheKey] = prefixedValue;
7894 return cache$1$1[cacheKey];
7895 }
7896
7897 /**
7898 * Add vendor prefix to a property name when needed.
7899 *
7900 * @api public
7901 */
7902
7903 function jssVendorPrefixer() {
7904 function onProcessRule(rule) {
7905 if (rule.type === 'keyframes') {
7906 var atRule = rule;
7907 atRule.at = supportedKeyframes(atRule.at);
7908 }
7909 }
7910
7911 function prefixStyle(style) {
7912 for (var prop in style) {
7913 var value = style[prop];
7914
7915 if (prop === 'fallbacks' && Array.isArray(value)) {
7916 style[prop] = value.map(prefixStyle);
7917 continue;
7918 }
7919
7920 var changeProp = false;
7921 var supportedProp = supportedProperty(prop);
7922 if (supportedProp && supportedProp !== prop) changeProp = true;
7923 var changeValue = false;
7924 var supportedValue$1 = supportedValue(supportedProp, toCssValue(value));
7925 if (supportedValue$1 && supportedValue$1 !== value) changeValue = true;
7926
7927 if (changeProp || changeValue) {
7928 if (changeProp) delete style[prop];
7929 style[supportedProp || prop] = supportedValue$1 || value;
7930 }
7931 }
7932
7933 return style;
7934 }
7935
7936 function onProcessStyle(style, rule) {
7937 if (rule.type !== 'style') return style;
7938 return prefixStyle(style);
7939 }
7940
7941 function onChangeValue(value, prop) {
7942 return supportedValue(prop, toCssValue(value)) || value;
7943 }
7944
7945 return {
7946 onProcessRule: onProcessRule,
7947 onProcessStyle: onProcessStyle,
7948 onChangeValue: onChangeValue
7949 };
7950 }
7951
7952 /**
7953 * Sort props by length.
7954 */
7955 function jssPropsSort() {
7956 var sort = function sort(prop0, prop1) {
7957 if (prop0.length === prop1.length) {
7958 return prop0 > prop1 ? 1 : -1;
7959 }
7960
7961 return prop0.length - prop1.length;
7962 };
7963
7964 return {
7965 onProcessStyle: function onProcessStyle(style, rule) {
7966 if (rule.type !== 'style') return style;
7967 var newStyle = {};
7968 var props = Object.keys(style).sort(sort);
7969
7970 for (var i = 0; i < props.length; i++) {
7971 newStyle[props[i]] = style[props[i]];
7972 }
7973
7974 return newStyle;
7975 }
7976 };
7977 }
7978
7979 function jssPreset() {
7980 return {
7981 plugins: [functionPlugin(), jssGlobal(), jssNested(), camelCase(), defaultUnit(), // Disable the vendor prefixer server-side, it does nothing.
7982 // This way, we can get a performance boost.
7983 // In the documentation, we are using `autoprefixer` to solve this problem.
7984 typeof window === 'undefined' ? null : jssVendorPrefixer(), jssPropsSort()]
7985 };
7986 }
7987
7988 function _objectWithoutPropertiesLoose$2(source, excluded) {
7989 if (source == null) return {};
7990 var target = {};
7991 var sourceKeys = Object.keys(source);
7992 var key, i;
7993
7994 for (i = 0; i < sourceKeys.length; i++) {
7995 key = sourceKeys[i];
7996 if (excluded.indexOf(key) >= 0) continue;
7997 target[key] = source[key];
7998 }
7999
8000 return target;
8001 }
8002
8003 function _objectWithoutProperties$1(source, excluded) {
8004 if (source == null) return {};
8005 var target = _objectWithoutPropertiesLoose$2(source, excluded);
8006 var key, i;
8007
8008 if (Object.getOwnPropertySymbols) {
8009 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
8010
8011 for (i = 0; i < sourceSymbolKeys.length; i++) {
8012 key = sourceSymbolKeys[i];
8013 if (excluded.indexOf(key) >= 0) continue;
8014 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8015 target[key] = source[key];
8016 }
8017 }
8018
8019 return target;
8020 }
8021
8022 function _extends$6() {
8023 _extends$6 = Object.assign || function (target) {
8024 for (var i = 1; i < arguments.length; i++) {
8025 var source = arguments[i];
8026
8027 for (var key in source) {
8028 if (Object.prototype.hasOwnProperty.call(source, key)) {
8029 target[key] = source[key];
8030 }
8031 }
8032 }
8033
8034 return target;
8035 };
8036
8037 return _extends$6.apply(this, arguments);
8038 }
8039
8040 function mergeClasses() {
8041 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8042 var baseClasses = options.baseClasses,
8043 newClasses = options.newClasses;
8044 options.Component;
8045
8046 if (!newClasses) {
8047 return baseClasses;
8048 }
8049
8050 var nextClasses = _extends$6({}, baseClasses);
8051
8052 Object.keys(newClasses).forEach(function (key) {
8053
8054 if (newClasses[key]) {
8055 nextClasses[key] = "".concat(baseClasses[key], " ").concat(newClasses[key]);
8056 }
8057 });
8058 return nextClasses;
8059 }
8060
8061 // Used https://github.com/thinkloop/multi-key-cache as inspiration
8062 var multiKeyStore = {
8063 set: function set(cache, key1, key2, value) {
8064 var subCache = cache.get(key1);
8065
8066 if (!subCache) {
8067 subCache = new Map();
8068 cache.set(key1, subCache);
8069 }
8070
8071 subCache.set(key2, value);
8072 },
8073 get: function get(cache, key1, key2) {
8074 var subCache = cache.get(key1);
8075 return subCache ? subCache.get(key2) : undefined;
8076 },
8077 delete: function _delete(cache, key1, key2) {
8078 var subCache = cache.get(key1);
8079 subCache.delete(key2);
8080 }
8081 };
8082
8083 var ThemeContext = React.createContext(null);
8084
8085 function useTheme$2() {
8086 var theme = React.useContext(ThemeContext);
8087
8088 return theme;
8089 }
8090
8091 var jss = create$4(jssPreset()); // Use a singleton or the provided one by the context.
8092 //
8093 // The counter-based approach doesn't tolerate any mistake.
8094 // It's much safer to use the same counter everywhere.
8095
8096 var generateClassName = createGenerateClassName(); // Exported for test purposes
8097
8098 var sheetsManager = new Map();
8099 var defaultOptions = {
8100 disableGeneration: false,
8101 generateClassName: generateClassName,
8102 jss: jss,
8103 sheetsCache: null,
8104 sheetsManager: sheetsManager,
8105 sheetsRegistry: null
8106 };
8107 var StylesContext = React.createContext(defaultOptions);
8108
8109 var injectFirstNode;
8110 function StylesProvider(props) {
8111 var children = props.children,
8112 _props$injectFirst = props.injectFirst,
8113 injectFirst = _props$injectFirst === void 0 ? false : _props$injectFirst,
8114 _props$disableGenerat = props.disableGeneration,
8115 disableGeneration = _props$disableGenerat === void 0 ? false : _props$disableGenerat,
8116 localOptions = _objectWithoutProperties$1(props, ["children", "injectFirst", "disableGeneration"]);
8117
8118 var outerOptions = React.useContext(StylesContext);
8119
8120 var context = _extends$6({}, outerOptions, {
8121 disableGeneration: disableGeneration
8122 }, localOptions);
8123
8124 if (!context.jss.options.insertionPoint && injectFirst && typeof window !== 'undefined') {
8125 if (!injectFirstNode) {
8126 var head = document.head;
8127 injectFirstNode = document.createComment('mui-inject-first');
8128 head.insertBefore(injectFirstNode, head.firstChild);
8129 }
8130
8131 context.jss = create$4({
8132 plugins: jssPreset().plugins,
8133 insertionPoint: injectFirstNode
8134 });
8135 }
8136
8137 return /*#__PURE__*/React.createElement(StylesContext.Provider, {
8138 value: context
8139 }, children);
8140 }
8141
8142 /* eslint-disable import/prefer-default-export */
8143 // Global index counter to preserve source order.
8144 // We create the style sheet during the creation of the component,
8145 // children are handled after the parents, so the order of style elements would be parent->child.
8146 // It is a problem though when a parent passes a className
8147 // which needs to override any child's styles.
8148 // StyleSheet of the child has a higher specificity, because of the source order.
8149 // So our solution is to render sheets them in the reverse order child->sheet, so
8150 // that parent has a higher specificity.
8151 var indexCounter = -1e9;
8152 function increment() {
8153 indexCounter += 1;
8154
8155 return indexCounter;
8156 }
8157
8158 // We use the same empty object to ref count the styles that don't need a theme object.
8159 var noopTheme = {};
8160
8161 function getStylesCreator(stylesOrCreator) {
8162 var themingEnabled = typeof stylesOrCreator === 'function';
8163
8164 return {
8165 create: function create(theme, name) {
8166 var styles;
8167
8168 try {
8169 styles = themingEnabled ? stylesOrCreator(theme) : stylesOrCreator;
8170 } catch (err) {
8171
8172 throw err;
8173 }
8174
8175 if (!name || !theme.overrides || !theme.overrides[name]) {
8176 return styles;
8177 }
8178
8179 var overrides = theme.overrides[name];
8180
8181 var stylesWithOverrides = _extends$6({}, styles);
8182
8183 Object.keys(overrides).forEach(function (key) {
8184
8185 stylesWithOverrides[key] = deepmerge(stylesWithOverrides[key], overrides[key]);
8186 });
8187 return stylesWithOverrides;
8188 },
8189 options: {}
8190 };
8191 }
8192
8193 function getClasses(_ref, classes, Component) {
8194 var state = _ref.state,
8195 stylesOptions = _ref.stylesOptions;
8196
8197 if (stylesOptions.disableGeneration) {
8198 return classes || {};
8199 }
8200
8201 if (!state.cacheClasses) {
8202 state.cacheClasses = {
8203 // Cache for the finalized classes value.
8204 value: null,
8205 // Cache for the last used classes prop pointer.
8206 lastProp: null,
8207 // Cache for the last used rendered classes pointer.
8208 lastJSS: {}
8209 };
8210 } // Tracks if either the rendered classes or classes prop has changed,
8211 // requiring the generation of a new finalized classes object.
8212
8213
8214 var generate = false;
8215
8216 if (state.classes !== state.cacheClasses.lastJSS) {
8217 state.cacheClasses.lastJSS = state.classes;
8218 generate = true;
8219 }
8220
8221 if (classes !== state.cacheClasses.lastProp) {
8222 state.cacheClasses.lastProp = classes;
8223 generate = true;
8224 }
8225
8226 if (generate) {
8227 state.cacheClasses.value = mergeClasses({
8228 baseClasses: state.cacheClasses.lastJSS,
8229 newClasses: classes,
8230 Component: Component
8231 });
8232 }
8233
8234 return state.cacheClasses.value;
8235 }
8236
8237 function attach(_ref2, props) {
8238 var state = _ref2.state,
8239 theme = _ref2.theme,
8240 stylesOptions = _ref2.stylesOptions,
8241 stylesCreator = _ref2.stylesCreator,
8242 name = _ref2.name;
8243
8244 if (stylesOptions.disableGeneration) {
8245 return;
8246 }
8247
8248 var sheetManager = multiKeyStore.get(stylesOptions.sheetsManager, stylesCreator, theme);
8249
8250 if (!sheetManager) {
8251 sheetManager = {
8252 refs: 0,
8253 staticSheet: null,
8254 dynamicStyles: null
8255 };
8256 multiKeyStore.set(stylesOptions.sheetsManager, stylesCreator, theme, sheetManager);
8257 }
8258
8259 var options = _extends$6({}, stylesCreator.options, stylesOptions, {
8260 theme: theme,
8261 flip: typeof stylesOptions.flip === 'boolean' ? stylesOptions.flip : theme.direction === 'rtl'
8262 });
8263
8264 options.generateId = options.serverGenerateClassName || options.generateClassName;
8265 var sheetsRegistry = stylesOptions.sheetsRegistry;
8266
8267 if (sheetManager.refs === 0) {
8268 var staticSheet;
8269
8270 if (stylesOptions.sheetsCache) {
8271 staticSheet = multiKeyStore.get(stylesOptions.sheetsCache, stylesCreator, theme);
8272 }
8273
8274 var styles = stylesCreator.create(theme, name);
8275
8276 if (!staticSheet) {
8277 staticSheet = stylesOptions.jss.createStyleSheet(styles, _extends$6({
8278 link: false
8279 }, options));
8280 staticSheet.attach();
8281
8282 if (stylesOptions.sheetsCache) {
8283 multiKeyStore.set(stylesOptions.sheetsCache, stylesCreator, theme, staticSheet);
8284 }
8285 }
8286
8287 if (sheetsRegistry) {
8288 sheetsRegistry.add(staticSheet);
8289 }
8290
8291 sheetManager.staticSheet = staticSheet;
8292 sheetManager.dynamicStyles = getDynamicStyles(styles);
8293 }
8294
8295 if (sheetManager.dynamicStyles) {
8296 var dynamicSheet = stylesOptions.jss.createStyleSheet(sheetManager.dynamicStyles, _extends$6({
8297 link: true
8298 }, options));
8299 dynamicSheet.update(props);
8300 dynamicSheet.attach();
8301 state.dynamicSheet = dynamicSheet;
8302 state.classes = mergeClasses({
8303 baseClasses: sheetManager.staticSheet.classes,
8304 newClasses: dynamicSheet.classes
8305 });
8306
8307 if (sheetsRegistry) {
8308 sheetsRegistry.add(dynamicSheet);
8309 }
8310 } else {
8311 state.classes = sheetManager.staticSheet.classes;
8312 }
8313
8314 sheetManager.refs += 1;
8315 }
8316
8317 function update$1(_ref3, props) {
8318 var state = _ref3.state;
8319
8320 if (state.dynamicSheet) {
8321 state.dynamicSheet.update(props);
8322 }
8323 }
8324
8325 function detach(_ref4) {
8326 var state = _ref4.state,
8327 theme = _ref4.theme,
8328 stylesOptions = _ref4.stylesOptions,
8329 stylesCreator = _ref4.stylesCreator;
8330
8331 if (stylesOptions.disableGeneration) {
8332 return;
8333 }
8334
8335 var sheetManager = multiKeyStore.get(stylesOptions.sheetsManager, stylesCreator, theme);
8336 sheetManager.refs -= 1;
8337 var sheetsRegistry = stylesOptions.sheetsRegistry;
8338
8339 if (sheetManager.refs === 0) {
8340 multiKeyStore.delete(stylesOptions.sheetsManager, stylesCreator, theme);
8341 stylesOptions.jss.removeStyleSheet(sheetManager.staticSheet);
8342
8343 if (sheetsRegistry) {
8344 sheetsRegistry.remove(sheetManager.staticSheet);
8345 }
8346 }
8347
8348 if (state.dynamicSheet) {
8349 stylesOptions.jss.removeStyleSheet(state.dynamicSheet);
8350
8351 if (sheetsRegistry) {
8352 sheetsRegistry.remove(state.dynamicSheet);
8353 }
8354 }
8355 }
8356
8357 function useSynchronousEffect(func, values) {
8358 var key = React.useRef([]);
8359 var output; // Store "generation" key. Just returns a new object every time
8360
8361 var currentKey = React.useMemo(function () {
8362 return {};
8363 }, values); // eslint-disable-line react-hooks/exhaustive-deps
8364 // "the first render", or "memo dropped the value"
8365
8366 if (key.current !== currentKey) {
8367 key.current = currentKey;
8368 output = func();
8369 }
8370
8371 React.useEffect(function () {
8372 return function () {
8373 if (output) {
8374 output();
8375 }
8376 };
8377 }, [currentKey] // eslint-disable-line react-hooks/exhaustive-deps
8378 );
8379 }
8380
8381 function makeStyles$1(stylesOrCreator) {
8382 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8383
8384 var name = options.name,
8385 classNamePrefixOption = options.classNamePrefix,
8386 Component = options.Component,
8387 _options$defaultTheme = options.defaultTheme,
8388 defaultTheme = _options$defaultTheme === void 0 ? noopTheme : _options$defaultTheme,
8389 stylesOptions2 = _objectWithoutProperties$1(options, ["name", "classNamePrefix", "Component", "defaultTheme"]);
8390
8391 var stylesCreator = getStylesCreator(stylesOrCreator);
8392 var classNamePrefix = name || classNamePrefixOption || 'makeStyles';
8393 stylesCreator.options = {
8394 index: increment(),
8395 name: name,
8396 meta: classNamePrefix,
8397 classNamePrefix: classNamePrefix
8398 };
8399
8400 var useStyles = function useStyles() {
8401 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8402 var theme = useTheme$2() || defaultTheme;
8403
8404 var stylesOptions = _extends$6({}, React.useContext(StylesContext), stylesOptions2);
8405
8406 var instance = React.useRef();
8407 var shouldUpdate = React.useRef();
8408 useSynchronousEffect(function () {
8409 var current = {
8410 name: name,
8411 state: {},
8412 stylesCreator: stylesCreator,
8413 stylesOptions: stylesOptions,
8414 theme: theme
8415 };
8416 attach(current, props);
8417 shouldUpdate.current = false;
8418 instance.current = current;
8419 return function () {
8420 detach(current);
8421 };
8422 }, [theme, stylesCreator]);
8423 React.useEffect(function () {
8424 if (shouldUpdate.current) {
8425 update$1(instance.current, props);
8426 }
8427
8428 shouldUpdate.current = true;
8429 });
8430 var classes = getClasses(instance.current, props.classes, Component);
8431
8432 return classes;
8433 };
8434
8435 return useStyles;
8436 }
8437
8438 function toVal$1(mix) {
8439 var k, y, str='';
8440
8441 if (typeof mix === 'string' || typeof mix === 'number') {
8442 str += mix;
8443 } else if (typeof mix === 'object') {
8444 if (Array.isArray(mix)) {
8445 for (k=0; k < mix.length; k++) {
8446 if (mix[k]) {
8447 if (y = toVal$1(mix[k])) {
8448 str && (str += ' ');
8449 str += y;
8450 }
8451 }
8452 }
8453 } else {
8454 for (k in mix) {
8455 if (mix[k]) {
8456 str && (str += ' ');
8457 str += k;
8458 }
8459 }
8460 }
8461 }
8462
8463 return str;
8464 }
8465
8466 function clsx$1 () {
8467 var i=0, tmp, x, str='';
8468 while (i < arguments.length) {
8469 if (tmp = arguments[i++]) {
8470 if (x = toVal$1(tmp)) {
8471 str && (str += ' ');
8472 str += x;
8473 }
8474 }
8475 }
8476 return str;
8477 }
8478
8479 var reactIs = reactIs$1.exports;
8480
8481 /**
8482 * Copyright 2015, Yahoo! Inc.
8483 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
8484 */
8485 var REACT_STATICS = {
8486 childContextTypes: true,
8487 contextType: true,
8488 contextTypes: true,
8489 defaultProps: true,
8490 displayName: true,
8491 getDefaultProps: true,
8492 getDerivedStateFromError: true,
8493 getDerivedStateFromProps: true,
8494 mixins: true,
8495 propTypes: true,
8496 type: true
8497 };
8498 var KNOWN_STATICS = {
8499 name: true,
8500 length: true,
8501 prototype: true,
8502 caller: true,
8503 callee: true,
8504 arguments: true,
8505 arity: true
8506 };
8507 var FORWARD_REF_STATICS = {
8508 '$$typeof': true,
8509 render: true,
8510 defaultProps: true,
8511 displayName: true,
8512 propTypes: true
8513 };
8514 var MEMO_STATICS = {
8515 '$$typeof': true,
8516 compare: true,
8517 defaultProps: true,
8518 displayName: true,
8519 propTypes: true,
8520 type: true
8521 };
8522 var TYPE_STATICS = {};
8523 TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
8524 TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
8525
8526 function getStatics(component) {
8527 // React v16.11 and below
8528 if (reactIs.isMemo(component)) {
8529 return MEMO_STATICS;
8530 } // React v16.12 and above
8531
8532
8533 return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
8534 }
8535
8536 var defineProperty$1 = Object.defineProperty;
8537 var getOwnPropertyNames = Object.getOwnPropertyNames;
8538 var getOwnPropertySymbols = Object.getOwnPropertySymbols;
8539 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
8540 var getPrototypeOf = Object.getPrototypeOf;
8541 var objectPrototype = Object.prototype;
8542 function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
8543 if (typeof sourceComponent !== 'string') {
8544 // don't hoist over string (html) components
8545 if (objectPrototype) {
8546 var inheritedComponent = getPrototypeOf(sourceComponent);
8547
8548 if (inheritedComponent && inheritedComponent !== objectPrototype) {
8549 hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
8550 }
8551 }
8552
8553 var keys = getOwnPropertyNames(sourceComponent);
8554
8555 if (getOwnPropertySymbols) {
8556 keys = keys.concat(getOwnPropertySymbols(sourceComponent));
8557 }
8558
8559 var targetStatics = getStatics(targetComponent);
8560 var sourceStatics = getStatics(sourceComponent);
8561
8562 for (var i = 0; i < keys.length; ++i) {
8563 var key = keys[i];
8564
8565 if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
8566 var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
8567
8568 try {
8569 // Avoid failures from read-only properties
8570 defineProperty$1(targetComponent, key, descriptor);
8571 } catch (e) {}
8572 }
8573 }
8574 }
8575
8576 return targetComponent;
8577 }
8578
8579 var hoistNonReactStatics_cjs = hoistNonReactStatics;
8580
8581 function omit$1(input, fields) {
8582 var output = {};
8583 Object.keys(input).forEach(function (prop) {
8584 if (fields.indexOf(prop) === -1) {
8585 output[prop] = input[prop];
8586 }
8587 });
8588 return output;
8589 } // styled-components's API removes the mapping between components and styles.
8590 // Using components as a low-level styling construct can be simpler.
8591
8592
8593 function styled$1(Component) {
8594 var componentCreator = function componentCreator(style) {
8595 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8596
8597 var name = options.name,
8598 stylesOptions = _objectWithoutProperties$1(options, ["name"]);
8599
8600 var classNamePrefix = name;
8601
8602 var stylesOrCreator = typeof style === 'function' ? function (theme) {
8603 return {
8604 root: function root(props) {
8605 return style(_extends$6({
8606 theme: theme
8607 }, props));
8608 }
8609 };
8610 } : {
8611 root: style
8612 };
8613 var useStyles = makeStyles$1(stylesOrCreator, _extends$6({
8614 Component: Component,
8615 name: name || Component.displayName,
8616 classNamePrefix: classNamePrefix
8617 }, stylesOptions));
8618 var filterProps;
8619
8620 if (style.filterProps) {
8621 filterProps = style.filterProps;
8622 delete style.filterProps;
8623 }
8624 /* eslint-disable react/forbid-foreign-prop-types */
8625
8626
8627 if (style.propTypes) {
8628 delete style.propTypes;
8629 }
8630 /* eslint-enable react/forbid-foreign-prop-types */
8631
8632
8633 var StyledComponent = /*#__PURE__*/React.forwardRef(function StyledComponent(props, ref) {
8634 var children = props.children,
8635 classNameProp = props.className,
8636 clone = props.clone,
8637 ComponentProp = props.component,
8638 other = _objectWithoutProperties$1(props, ["children", "className", "clone", "component"]);
8639
8640 var classes = useStyles(props);
8641 var className = clsx$1(classes.root, classNameProp);
8642 var spread = other;
8643
8644 if (filterProps) {
8645 spread = omit$1(spread, filterProps);
8646 }
8647
8648 if (clone) {
8649 return /*#__PURE__*/React.cloneElement(children, _extends$6({
8650 className: clsx$1(children.props.className, className)
8651 }, spread));
8652 }
8653
8654 if (typeof children === 'function') {
8655 return children(_extends$6({
8656 className: className
8657 }, spread));
8658 }
8659
8660 var FinalComponent = ComponentProp || Component;
8661 return /*#__PURE__*/React.createElement(FinalComponent, _extends$6({
8662 ref: ref,
8663 className: className
8664 }, spread), children);
8665 });
8666
8667 hoistNonReactStatics_cjs(StyledComponent, Component);
8668 return StyledComponent;
8669 };
8670
8671 return componentCreator;
8672 }
8673
8674 function mergeOuterLocalTheme(outerTheme, localTheme) {
8675 if (typeof localTheme === 'function') {
8676 var mergedTheme = localTheme(outerTheme);
8677
8678 return mergedTheme;
8679 }
8680
8681 return _extends$6({}, outerTheme, localTheme);
8682 }
8683 /**
8684 * This component takes a `theme` prop.
8685 * It makes the `theme` available down the React tree thanks to React context.
8686 * This component should preferably be used at **the root of your component tree**.
8687 */
8688
8689
8690 function ThemeProvider(props) {
8691 var children = props.children,
8692 localTheme = props.theme;
8693 var outerTheme = useTheme$2();
8694
8695 var theme = React.useMemo(function () {
8696 var output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
8697
8698 if (output != null) {
8699 output[nested] = outerTheme !== null;
8700 }
8701
8702 return output;
8703 }, [localTheme, outerTheme]);
8704 return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
8705 value: theme
8706 }, children);
8707 }
8708
8709 // It does not modify the component passed to it;
8710 // instead, it returns a new component, with a `classes` property.
8711
8712 var withStyles$1 = function withStyles(stylesOrCreator) {
8713 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8714 return function (Component) {
8715 var defaultTheme = options.defaultTheme,
8716 _options$withTheme = options.withTheme,
8717 withTheme = _options$withTheme === void 0 ? false : _options$withTheme,
8718 name = options.name,
8719 stylesOptions = _objectWithoutProperties$1(options, ["defaultTheme", "withTheme", "name"]);
8720
8721 var classNamePrefix = name;
8722
8723 var useStyles = makeStyles$1(stylesOrCreator, _extends$6({
8724 defaultTheme: defaultTheme,
8725 Component: Component,
8726 name: name || Component.displayName,
8727 classNamePrefix: classNamePrefix
8728 }, stylesOptions));
8729 var WithStyles = /*#__PURE__*/React.forwardRef(function WithStyles(props, ref) {
8730 props.classes;
8731 var innerRef = props.innerRef,
8732 other = _objectWithoutProperties$1(props, ["classes", "innerRef"]); // The wrapper receives only user supplied props, which could be a subset of
8733 // the actual props Component might receive due to merging with defaultProps.
8734 // So copying it here would give us the same result in the wrapper as well.
8735
8736
8737 var classes = useStyles(_extends$6({}, Component.defaultProps, props));
8738 var theme;
8739 var more = other;
8740
8741 if (typeof name === 'string' || withTheme) {
8742 // name and withTheme are invariant in the outer scope
8743 // eslint-disable-next-line react-hooks/rules-of-hooks
8744 theme = useTheme$2() || defaultTheme;
8745
8746 if (name) {
8747 more = getThemeProps({
8748 theme: theme,
8749 name: name,
8750 props: other
8751 });
8752 } // Provide the theme to the wrapped component.
8753 // So we don't have to use the `withTheme()` Higher-order Component.
8754
8755
8756 if (withTheme && !more.theme) {
8757 more.theme = theme;
8758 }
8759 }
8760
8761 return /*#__PURE__*/React.createElement(Component, _extends$6({
8762 ref: innerRef || ref,
8763 classes: classes
8764 }, more));
8765 });
8766
8767 hoistNonReactStatics_cjs(WithStyles, Component);
8768
8769 return WithStyles;
8770 };
8771 };
8772
8773 function withThemeCreator() {
8774 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8775 var defaultTheme = options.defaultTheme;
8776
8777 var withTheme = function withTheme(Component) {
8778
8779 var WithTheme = /*#__PURE__*/React.forwardRef(function WithTheme(props, ref) {
8780 var innerRef = props.innerRef,
8781 other = _objectWithoutProperties$1(props, ["innerRef"]);
8782
8783 var theme = useTheme$2() || defaultTheme;
8784 return /*#__PURE__*/React.createElement(Component, _extends$6({
8785 theme: theme,
8786 ref: innerRef || ref
8787 }, other));
8788 });
8789
8790 hoistNonReactStatics_cjs(WithTheme, Component);
8791
8792 return WithTheme;
8793 };
8794
8795 return withTheme;
8796 } // Provide the theme object as a prop to the input component.
8797 // It's an alternative API to useTheme().
8798 // We encourage the usage of useTheme() where possible.
8799
8800 withThemeCreator();
8801
8802 /* eslint-disable no-use-before-define */
8803
8804 /**
8805 * Returns a number whose value is limited to the given range.
8806 *
8807 * @param {number} value The value to be clamped
8808 * @param {number} min The lower boundary of the output range
8809 * @param {number} max The upper boundary of the output range
8810 * @returns {number} A number in the range [min, max]
8811 */
8812 function clamp$1(value) {
8813 var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
8814 var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
8815
8816 return Math.min(Math.max(min, value), max);
8817 }
8818 /**
8819 * Converts a color from CSS hex format to CSS rgb format.
8820 *
8821 * @param {string} color - Hex color, i.e. #nnn or #nnnnnn
8822 * @returns {string} A CSS rgb color string
8823 */
8824
8825
8826 function hexToRgb(color) {
8827 color = color.substr(1);
8828 var re = new RegExp(".{1,".concat(color.length >= 6 ? 2 : 1, "}"), 'g');
8829 var colors = color.match(re);
8830
8831 if (colors && colors[0].length === 1) {
8832 colors = colors.map(function (n) {
8833 return n + n;
8834 });
8835 }
8836
8837 return colors ? "rgb".concat(colors.length === 4 ? 'a' : '', "(").concat(colors.map(function (n, index) {
8838 return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000;
8839 }).join(', '), ")") : '';
8840 }
8841 /**
8842 * Converts a color from hsl format to rgb format.
8843 *
8844 * @param {string} color - HSL color values
8845 * @returns {string} rgb color values
8846 */
8847
8848 function hslToRgb(color) {
8849 color = decomposeColor(color);
8850 var _color = color,
8851 values = _color.values;
8852 var h = values[0];
8853 var s = values[1] / 100;
8854 var l = values[2] / 100;
8855 var a = s * Math.min(l, 1 - l);
8856
8857 var f = function f(n) {
8858 var k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (n + h / 30) % 12;
8859 return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
8860 };
8861
8862 var type = 'rgb';
8863 var rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];
8864
8865 if (color.type === 'hsla') {
8866 type += 'a';
8867 rgb.push(values[3]);
8868 }
8869
8870 return recomposeColor({
8871 type: type,
8872 values: rgb
8873 });
8874 }
8875 /**
8876 * Returns an object with the type and values of a color.
8877 *
8878 * Note: Does not support rgb % values.
8879 *
8880 * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
8881 * @returns {object} - A MUI color object: {type: string, values: number[]}
8882 */
8883
8884 function decomposeColor(color) {
8885 // Idempotent
8886 if (color.type) {
8887 return color;
8888 }
8889
8890 if (color.charAt(0) === '#') {
8891 return decomposeColor(hexToRgb(color));
8892 }
8893
8894 var marker = color.indexOf('(');
8895 var type = color.substring(0, marker);
8896
8897 if (['rgb', 'rgba', 'hsl', 'hsla'].indexOf(type) === -1) {
8898 throw new Error(formatMuiErrorMessage(3, color));
8899 }
8900
8901 var values = color.substring(marker + 1, color.length - 1).split(',');
8902 values = values.map(function (value) {
8903 return parseFloat(value);
8904 });
8905 return {
8906 type: type,
8907 values: values
8908 };
8909 }
8910 /**
8911 * Converts a color object with type and values to a string.
8912 *
8913 * @param {object} color - Decomposed color
8914 * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla'
8915 * @param {array} color.values - [n,n,n] or [n,n,n,n]
8916 * @returns {string} A CSS color string
8917 */
8918
8919 function recomposeColor(color) {
8920 var type = color.type;
8921 var values = color.values;
8922
8923 if (type.indexOf('rgb') !== -1) {
8924 // Only convert the first 3 values to int (i.e. not alpha)
8925 values = values.map(function (n, i) {
8926 return i < 3 ? parseInt(n, 10) : n;
8927 });
8928 } else if (type.indexOf('hsl') !== -1) {
8929 values[1] = "".concat(values[1], "%");
8930 values[2] = "".concat(values[2], "%");
8931 }
8932
8933 return "".concat(type, "(").concat(values.join(', '), ")");
8934 }
8935 /**
8936 * Calculates the contrast ratio between two colors.
8937 *
8938 * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
8939 *
8940 * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
8941 * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
8942 * @returns {number} A contrast ratio value in the range 0 - 21.
8943 */
8944
8945 function getContrastRatio(foreground, background) {
8946 var lumA = getLuminance(foreground);
8947 var lumB = getLuminance(background);
8948 return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
8949 }
8950 /**
8951 * The relative brightness of any point in a color space,
8952 * normalized to 0 for darkest black and 1 for lightest white.
8953 *
8954 * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
8955 *
8956 * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
8957 * @returns {number} The relative brightness of the color in the range 0 - 1
8958 */
8959
8960 function getLuminance(color) {
8961 color = decomposeColor(color);
8962 var rgb = color.type === 'hsl' ? decomposeColor(hslToRgb(color)).values : color.values;
8963 rgb = rgb.map(function (val) {
8964 val /= 255; // normalized
8965
8966 return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
8967 }); // Truncate at 3 digits
8968
8969 return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));
8970 }
8971 /**
8972 * Darken or lighten a color, depending on its luminance.
8973 * Light colors are darkened, dark colors are lightened.
8974 *
8975 * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
8976 * @param {number} coefficient=0.15 - multiplier in the range 0 - 1
8977 * @returns {string} A CSS color string. Hex input values are returned as rgb
8978 */
8979
8980 function emphasize(color) {
8981 var coefficient = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.15;
8982 return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);
8983 }
8984 /**
8985 * Set the absolute transparency of a color.
8986 * Any existing alpha value is overwritten.
8987 *
8988 * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
8989 * @param {number} value - value to set the alpha channel to in the range 0-1
8990 * @returns {string} A CSS color string. Hex input values are returned as rgb
8991 */
8992
8993 function alpha(color, value) {
8994 color = decomposeColor(color);
8995 value = clamp$1(value);
8996
8997 if (color.type === 'rgb' || color.type === 'hsl') {
8998 color.type += 'a';
8999 }
9000
9001 color.values[3] = value;
9002 return recomposeColor(color);
9003 }
9004 /**
9005 * Darkens a color.
9006 *
9007 * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
9008 * @param {number} coefficient - multiplier in the range 0 - 1
9009 * @returns {string} A CSS color string. Hex input values are returned as rgb
9010 */
9011
9012 function darken(color, coefficient) {
9013 color = decomposeColor(color);
9014 coefficient = clamp$1(coefficient);
9015
9016 if (color.type.indexOf('hsl') !== -1) {
9017 color.values[2] *= 1 - coefficient;
9018 } else if (color.type.indexOf('rgb') !== -1) {
9019 for (var i = 0; i < 3; i += 1) {
9020 color.values[i] *= 1 - coefficient;
9021 }
9022 }
9023
9024 return recomposeColor(color);
9025 }
9026 /**
9027 * Lightens a color.
9028 *
9029 * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
9030 * @param {number} coefficient - multiplier in the range 0 - 1
9031 * @returns {string} A CSS color string. Hex input values are returned as rgb
9032 */
9033
9034 function lighten(color, coefficient) {
9035 color = decomposeColor(color);
9036 coefficient = clamp$1(coefficient);
9037
9038 if (color.type.indexOf('hsl') !== -1) {
9039 color.values[2] += (100 - color.values[2]) * coefficient;
9040 } else if (color.type.indexOf('rgb') !== -1) {
9041 for (var i = 0; i < 3; i += 1) {
9042 color.values[i] += (255 - color.values[i]) * coefficient;
9043 }
9044 }
9045
9046 return recomposeColor(color);
9047 }
9048
9049 function _defineProperty$1(obj, key, value) {
9050 if (key in obj) {
9051 Object.defineProperty(obj, key, {
9052 value: value,
9053 enumerable: true,
9054 configurable: true,
9055 writable: true
9056 });
9057 } else {
9058 obj[key] = value;
9059 }
9060
9061 return obj;
9062 }
9063
9064 function _objectWithoutPropertiesLoose$1(source, excluded) {
9065 if (source == null) return {};
9066 var target = {};
9067 var sourceKeys = Object.keys(source);
9068 var key, i;
9069
9070 for (i = 0; i < sourceKeys.length; i++) {
9071 key = sourceKeys[i];
9072 if (excluded.indexOf(key) >= 0) continue;
9073 target[key] = source[key];
9074 }
9075
9076 return target;
9077 }
9078
9079 function _objectWithoutProperties(source, excluded) {
9080 if (source == null) return {};
9081 var target = _objectWithoutPropertiesLoose$1(source, excluded);
9082 var key, i;
9083
9084 if (Object.getOwnPropertySymbols) {
9085 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
9086
9087 for (i = 0; i < sourceSymbolKeys.length; i++) {
9088 key = sourceSymbolKeys[i];
9089 if (excluded.indexOf(key) >= 0) continue;
9090 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
9091 target[key] = source[key];
9092 }
9093 }
9094
9095 return target;
9096 }
9097
9098 function _extends$5() {
9099 _extends$5 = Object.assign || function (target) {
9100 for (var i = 1; i < arguments.length; i++) {
9101 var source = arguments[i];
9102
9103 for (var key in source) {
9104 if (Object.prototype.hasOwnProperty.call(source, key)) {
9105 target[key] = source[key];
9106 }
9107 }
9108 }
9109
9110 return target;
9111 };
9112
9113 return _extends$5.apply(this, arguments);
9114 }
9115
9116 // Sorted ASC by size. That's important.
9117 // It can't be configured as it's used statically for propTypes.
9118 var keys = ['xs', 'sm', 'md', 'lg', 'xl']; // Keep in mind that @media is inclusive by the CSS specification.
9119
9120 function createBreakpoints(breakpoints) {
9121 var _breakpoints$values = breakpoints.values,
9122 values = _breakpoints$values === void 0 ? {
9123 xs: 0,
9124 sm: 600,
9125 md: 960,
9126 lg: 1280,
9127 xl: 1920
9128 } : _breakpoints$values,
9129 _breakpoints$unit = breakpoints.unit,
9130 unit = _breakpoints$unit === void 0 ? 'px' : _breakpoints$unit,
9131 _breakpoints$step = breakpoints.step,
9132 step = _breakpoints$step === void 0 ? 5 : _breakpoints$step,
9133 other = _objectWithoutProperties(breakpoints, ["values", "unit", "step"]);
9134
9135 function up(key) {
9136 var value = typeof values[key] === 'number' ? values[key] : key;
9137 return "@media (min-width:".concat(value).concat(unit, ")");
9138 }
9139
9140 function down(key) {
9141 var endIndex = keys.indexOf(key) + 1;
9142 var upperbound = values[keys[endIndex]];
9143
9144 if (endIndex === keys.length) {
9145 // xl down applies to all sizes
9146 return up('xs');
9147 }
9148
9149 var value = typeof upperbound === 'number' && endIndex > 0 ? upperbound : key;
9150 return "@media (max-width:".concat(value - step / 100).concat(unit, ")");
9151 }
9152
9153 function between(start, end) {
9154 var endIndex = keys.indexOf(end);
9155
9156 if (endIndex === keys.length - 1) {
9157 return up(start);
9158 }
9159
9160 return "@media (min-width:".concat(typeof values[start] === 'number' ? values[start] : start).concat(unit, ") and ") + "(max-width:".concat((endIndex !== -1 && typeof values[keys[endIndex + 1]] === 'number' ? values[keys[endIndex + 1]] : end) - step / 100).concat(unit, ")");
9161 }
9162
9163 function only(key) {
9164 return between(key, key);
9165 }
9166
9167 function width(key) {
9168
9169 return values[key];
9170 }
9171
9172 return _extends$5({
9173 keys: keys,
9174 values: values,
9175 up: up,
9176 down: down,
9177 between: between,
9178 only: only,
9179 width: width
9180 }, other);
9181 }
9182
9183 function createMixins(breakpoints, spacing, mixins) {
9184 var _toolbar;
9185
9186 return _extends$5({
9187 gutters: function gutters() {
9188 var styles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9189 console.warn(['Material-UI: theme.mixins.gutters() is deprecated.', 'You can use the source of the mixin directly:', "\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n [theme.breakpoints.up('sm')]: {\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3),\n },\n "].join('\n'));
9190 return _extends$5({
9191 paddingLeft: spacing(2),
9192 paddingRight: spacing(2)
9193 }, styles, _defineProperty$1({}, breakpoints.up('sm'), _extends$5({
9194 paddingLeft: spacing(3),
9195 paddingRight: spacing(3)
9196 }, styles[breakpoints.up('sm')])));
9197 },
9198 toolbar: (_toolbar = {
9199 minHeight: 56
9200 }, _defineProperty$1(_toolbar, "".concat(breakpoints.up('xs'), " and (orientation: landscape)"), {
9201 minHeight: 48
9202 }), _defineProperty$1(_toolbar, breakpoints.up('sm'), {
9203 minHeight: 64
9204 }), _toolbar)
9205 }, mixins);
9206 }
9207
9208 var common = {
9209 black: '#000',
9210 white: '#fff'
9211 };
9212
9213 var grey = {
9214 50: '#fafafa',
9215 100: '#f5f5f5',
9216 200: '#eeeeee',
9217 300: '#e0e0e0',
9218 400: '#bdbdbd',
9219 500: '#9e9e9e',
9220 600: '#757575',
9221 700: '#616161',
9222 800: '#424242',
9223 900: '#212121',
9224 A100: '#d5d5d5',
9225 A200: '#aaaaaa',
9226 A400: '#303030',
9227 A700: '#616161'
9228 };
9229
9230 var indigo = {
9231 50: '#e8eaf6',
9232 100: '#c5cae9',
9233 200: '#9fa8da',
9234 300: '#7986cb',
9235 400: '#5c6bc0',
9236 500: '#3f51b5',
9237 600: '#3949ab',
9238 700: '#303f9f',
9239 800: '#283593',
9240 900: '#1a237e',
9241 A100: '#8c9eff',
9242 A200: '#536dfe',
9243 A400: '#3d5afe',
9244 A700: '#304ffe'
9245 };
9246
9247 var pink = {
9248 50: '#fce4ec',
9249 100: '#f8bbd0',
9250 200: '#f48fb1',
9251 300: '#f06292',
9252 400: '#ec407a',
9253 500: '#e91e63',
9254 600: '#d81b60',
9255 700: '#c2185b',
9256 800: '#ad1457',
9257 900: '#880e4f',
9258 A100: '#ff80ab',
9259 A200: '#ff4081',
9260 A400: '#f50057',
9261 A700: '#c51162'
9262 };
9263
9264 var red = {
9265 50: '#ffebee',
9266 100: '#ffcdd2',
9267 200: '#ef9a9a',
9268 300: '#e57373',
9269 400: '#ef5350',
9270 500: '#f44336',
9271 600: '#e53935',
9272 700: '#d32f2f',
9273 800: '#c62828',
9274 900: '#b71c1c',
9275 A100: '#ff8a80',
9276 A200: '#ff5252',
9277 A400: '#ff1744',
9278 A700: '#d50000'
9279 };
9280
9281 var orange = {
9282 50: '#fff3e0',
9283 100: '#ffe0b2',
9284 200: '#ffcc80',
9285 300: '#ffb74d',
9286 400: '#ffa726',
9287 500: '#ff9800',
9288 600: '#fb8c00',
9289 700: '#f57c00',
9290 800: '#ef6c00',
9291 900: '#e65100',
9292 A100: '#ffd180',
9293 A200: '#ffab40',
9294 A400: '#ff9100',
9295 A700: '#ff6d00'
9296 };
9297
9298 var blue = {
9299 50: '#e3f2fd',
9300 100: '#bbdefb',
9301 200: '#90caf9',
9302 300: '#64b5f6',
9303 400: '#42a5f5',
9304 500: '#2196f3',
9305 600: '#1e88e5',
9306 700: '#1976d2',
9307 800: '#1565c0',
9308 900: '#0d47a1',
9309 A100: '#82b1ff',
9310 A200: '#448aff',
9311 A400: '#2979ff',
9312 A700: '#2962ff'
9313 };
9314
9315 var green = {
9316 50: '#e8f5e9',
9317 100: '#c8e6c9',
9318 200: '#a5d6a7',
9319 300: '#81c784',
9320 400: '#66bb6a',
9321 500: '#4caf50',
9322 600: '#43a047',
9323 700: '#388e3c',
9324 800: '#2e7d32',
9325 900: '#1b5e20',
9326 A100: '#b9f6ca',
9327 A200: '#69f0ae',
9328 A400: '#00e676',
9329 A700: '#00c853'
9330 };
9331
9332 var light$1 = {
9333 // The colors used to style the text.
9334 text: {
9335 // The most important text.
9336 primary: 'rgba(0, 0, 0, 0.87)',
9337 // Secondary text.
9338 secondary: 'rgba(0, 0, 0, 0.54)',
9339 // Disabled text have even lower visual prominence.
9340 disabled: 'rgba(0, 0, 0, 0.38)',
9341 // Text hints.
9342 hint: 'rgba(0, 0, 0, 0.38)'
9343 },
9344 // The color used to divide different elements.
9345 divider: 'rgba(0, 0, 0, 0.12)',
9346 // The background colors used to style the surfaces.
9347 // Consistency between these values is important.
9348 background: {
9349 paper: common.white,
9350 default: grey[50]
9351 },
9352 // The colors used to style the action elements.
9353 action: {
9354 // The color of an active action like an icon button.
9355 active: 'rgba(0, 0, 0, 0.54)',
9356 // The color of an hovered action.
9357 hover: 'rgba(0, 0, 0, 0.04)',
9358 hoverOpacity: 0.04,
9359 // The color of a selected action.
9360 selected: 'rgba(0, 0, 0, 0.08)',
9361 selectedOpacity: 0.08,
9362 // The color of a disabled action.
9363 disabled: 'rgba(0, 0, 0, 0.26)',
9364 // The background color of a disabled action.
9365 disabledBackground: 'rgba(0, 0, 0, 0.12)',
9366 disabledOpacity: 0.38,
9367 focus: 'rgba(0, 0, 0, 0.12)',
9368 focusOpacity: 0.12,
9369 activatedOpacity: 0.12
9370 }
9371 };
9372 var dark$1 = {
9373 text: {
9374 primary: common.white,
9375 secondary: 'rgba(255, 255, 255, 0.7)',
9376 disabled: 'rgba(255, 255, 255, 0.5)',
9377 hint: 'rgba(255, 255, 255, 0.5)',
9378 icon: 'rgba(255, 255, 255, 0.5)'
9379 },
9380 divider: 'rgba(255, 255, 255, 0.12)',
9381 background: {
9382 paper: grey[800],
9383 default: '#303030'
9384 },
9385 action: {
9386 active: common.white,
9387 hover: 'rgba(255, 255, 255, 0.08)',
9388 hoverOpacity: 0.08,
9389 selected: 'rgba(255, 255, 255, 0.16)',
9390 selectedOpacity: 0.16,
9391 disabled: 'rgba(255, 255, 255, 0.3)',
9392 disabledBackground: 'rgba(255, 255, 255, 0.12)',
9393 disabledOpacity: 0.38,
9394 focus: 'rgba(255, 255, 255, 0.12)',
9395 focusOpacity: 0.12,
9396 activatedOpacity: 0.24
9397 }
9398 };
9399
9400 function addLightOrDark(intent, direction, shade, tonalOffset) {
9401 var tonalOffsetLight = tonalOffset.light || tonalOffset;
9402 var tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
9403
9404 if (!intent[direction]) {
9405 if (intent.hasOwnProperty(shade)) {
9406 intent[direction] = intent[shade];
9407 } else if (direction === 'light') {
9408 intent.light = lighten(intent.main, tonalOffsetLight);
9409 } else if (direction === 'dark') {
9410 intent.dark = darken(intent.main, tonalOffsetDark);
9411 }
9412 }
9413 }
9414
9415 function createPalette(palette) {
9416 var _palette$primary = palette.primary,
9417 primary = _palette$primary === void 0 ? {
9418 light: indigo[300],
9419 main: indigo[500],
9420 dark: indigo[700]
9421 } : _palette$primary,
9422 _palette$secondary = palette.secondary,
9423 secondary = _palette$secondary === void 0 ? {
9424 light: pink.A200,
9425 main: pink.A400,
9426 dark: pink.A700
9427 } : _palette$secondary,
9428 _palette$error = palette.error,
9429 error = _palette$error === void 0 ? {
9430 light: red[300],
9431 main: red[500],
9432 dark: red[700]
9433 } : _palette$error,
9434 _palette$warning = palette.warning,
9435 warning = _palette$warning === void 0 ? {
9436 light: orange[300],
9437 main: orange[500],
9438 dark: orange[700]
9439 } : _palette$warning,
9440 _palette$info = palette.info,
9441 info = _palette$info === void 0 ? {
9442 light: blue[300],
9443 main: blue[500],
9444 dark: blue[700]
9445 } : _palette$info,
9446 _palette$success = palette.success,
9447 success = _palette$success === void 0 ? {
9448 light: green[300],
9449 main: green[500],
9450 dark: green[700]
9451 } : _palette$success,
9452 _palette$type = palette.type,
9453 type = _palette$type === void 0 ? 'light' : _palette$type,
9454 _palette$contrastThre = palette.contrastThreshold,
9455 contrastThreshold = _palette$contrastThre === void 0 ? 3 : _palette$contrastThre,
9456 _palette$tonalOffset = palette.tonalOffset,
9457 tonalOffset = _palette$tonalOffset === void 0 ? 0.2 : _palette$tonalOffset,
9458 other = _objectWithoutProperties(palette, ["primary", "secondary", "error", "warning", "info", "success", "type", "contrastThreshold", "tonalOffset"]); // Use the same logic as
9459 // Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59
9460 // and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54
9461
9462
9463 function getContrastText(background) {
9464 var contrastText = getContrastRatio(background, dark$1.text.primary) >= contrastThreshold ? dark$1.text.primary : light$1.text.primary;
9465
9466 return contrastText;
9467 }
9468
9469 var augmentColor = function augmentColor(color) {
9470 var mainShade = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
9471 var lightShade = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 300;
9472 var darkShade = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 700;
9473 color = _extends$5({}, color);
9474
9475 if (!color.main && color[mainShade]) {
9476 color.main = color[mainShade];
9477 }
9478
9479 if (!color.main) {
9480 throw new Error(formatMuiErrorMessage(4, mainShade));
9481 }
9482
9483 if (typeof color.main !== 'string') {
9484 throw new Error(formatMuiErrorMessage(5, JSON.stringify(color.main)));
9485 }
9486
9487 addLightOrDark(color, 'light', lightShade, tonalOffset);
9488 addLightOrDark(color, 'dark', darkShade, tonalOffset);
9489
9490 if (!color.contrastText) {
9491 color.contrastText = getContrastText(color.main);
9492 }
9493
9494 return color;
9495 };
9496
9497 var types = {
9498 dark: dark$1,
9499 light: light$1
9500 };
9501
9502 var paletteOutput = deepmerge(_extends$5({
9503 // A collection of common colors.
9504 common: common,
9505 // The palette type, can be light or dark.
9506 type: type,
9507 // The colors used to represent primary interface elements for a user.
9508 primary: augmentColor(primary),
9509 // The colors used to represent secondary interface elements for a user.
9510 secondary: augmentColor(secondary, 'A400', 'A200', 'A700'),
9511 // The colors used to represent interface elements that the user should be made aware of.
9512 error: augmentColor(error),
9513 // The colors used to represent potentially dangerous actions or important messages.
9514 warning: augmentColor(warning),
9515 // The colors used to present information to the user that is neutral and not necessarily important.
9516 info: augmentColor(info),
9517 // The colors used to indicate the successful completion of an action that user triggered.
9518 success: augmentColor(success),
9519 // The grey colors.
9520 grey: grey,
9521 // Used by `getContrastText()` to maximize the contrast between
9522 // the background and the text.
9523 contrastThreshold: contrastThreshold,
9524 // Takes a background color and returns the text color that maximizes the contrast.
9525 getContrastText: getContrastText,
9526 // Generate a rich color object.
9527 augmentColor: augmentColor,
9528 // Used by the functions below to shift a color's luminance by approximately
9529 // two indexes within its tonal palette.
9530 // E.g., shift from Red 500 to Red 300 or Red 700.
9531 tonalOffset: tonalOffset
9532 }, types[type]), other);
9533 return paletteOutput;
9534 }
9535
9536 function round$1(value) {
9537 return Math.round(value * 1e5) / 1e5;
9538 }
9539
9540 function roundWithDeprecationWarning(value) {
9541
9542 return round$1(value);
9543 }
9544
9545 var caseAllCaps = {
9546 textTransform: 'uppercase'
9547 };
9548 var defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif';
9549 /**
9550 * @see @link{https://material.io/design/typography/the-type-system.html}
9551 * @see @link{https://material.io/design/typography/understanding-typography.html}
9552 */
9553
9554 function createTypography(palette, typography) {
9555 var _ref = typeof typography === 'function' ? typography(palette) : typography,
9556 _ref$fontFamily = _ref.fontFamily,
9557 fontFamily = _ref$fontFamily === void 0 ? defaultFontFamily : _ref$fontFamily,
9558 _ref$fontSize = _ref.fontSize,
9559 fontSize = _ref$fontSize === void 0 ? 14 : _ref$fontSize,
9560 _ref$fontWeightLight = _ref.fontWeightLight,
9561 fontWeightLight = _ref$fontWeightLight === void 0 ? 300 : _ref$fontWeightLight,
9562 _ref$fontWeightRegula = _ref.fontWeightRegular,
9563 fontWeightRegular = _ref$fontWeightRegula === void 0 ? 400 : _ref$fontWeightRegula,
9564 _ref$fontWeightMedium = _ref.fontWeightMedium,
9565 fontWeightMedium = _ref$fontWeightMedium === void 0 ? 500 : _ref$fontWeightMedium,
9566 _ref$fontWeightBold = _ref.fontWeightBold,
9567 fontWeightBold = _ref$fontWeightBold === void 0 ? 700 : _ref$fontWeightBold,
9568 _ref$htmlFontSize = _ref.htmlFontSize,
9569 htmlFontSize = _ref$htmlFontSize === void 0 ? 16 : _ref$htmlFontSize,
9570 allVariants = _ref.allVariants,
9571 pxToRem2 = _ref.pxToRem,
9572 other = _objectWithoutProperties(_ref, ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"]);
9573
9574 var coef = fontSize / 14;
9575
9576 var pxToRem = pxToRem2 || function (size) {
9577 return "".concat(size / htmlFontSize * coef, "rem");
9578 };
9579
9580 var buildVariant = function buildVariant(fontWeight, size, lineHeight, letterSpacing, casing) {
9581 return _extends$5({
9582 fontFamily: fontFamily,
9583 fontWeight: fontWeight,
9584 fontSize: pxToRem(size),
9585 // Unitless following https://meyerweb.com/eric/thoughts/2006/02/08/unitless-line-heights/
9586 lineHeight: lineHeight
9587 }, fontFamily === defaultFontFamily ? {
9588 letterSpacing: "".concat(round$1(letterSpacing / size), "em")
9589 } : {}, casing, allVariants);
9590 };
9591
9592 var variants = {
9593 h1: buildVariant(fontWeightLight, 96, 1.167, -1.5),
9594 h2: buildVariant(fontWeightLight, 60, 1.2, -0.5),
9595 h3: buildVariant(fontWeightRegular, 48, 1.167, 0),
9596 h4: buildVariant(fontWeightRegular, 34, 1.235, 0.25),
9597 h5: buildVariant(fontWeightRegular, 24, 1.334, 0),
9598 h6: buildVariant(fontWeightMedium, 20, 1.6, 0.15),
9599 subtitle1: buildVariant(fontWeightRegular, 16, 1.75, 0.15),
9600 subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1),
9601 body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15),
9602 body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
9603 button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
9604 caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
9605 overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps)
9606 };
9607 return deepmerge(_extends$5({
9608 htmlFontSize: htmlFontSize,
9609 pxToRem: pxToRem,
9610 round: roundWithDeprecationWarning,
9611 // TODO v5: remove
9612 fontFamily: fontFamily,
9613 fontSize: fontSize,
9614 fontWeightLight: fontWeightLight,
9615 fontWeightRegular: fontWeightRegular,
9616 fontWeightMedium: fontWeightMedium,
9617 fontWeightBold: fontWeightBold
9618 }, variants), other, {
9619 clone: false // No need to clone deep
9620
9621 });
9622 }
9623
9624 var shadowKeyUmbraOpacity = 0.2;
9625 var shadowKeyPenumbraOpacity = 0.14;
9626 var shadowAmbientShadowOpacity = 0.12;
9627
9628 function createShadow() {
9629 return ["".concat(arguments.length <= 0 ? undefined : arguments[0], "px ").concat(arguments.length <= 1 ? undefined : arguments[1], "px ").concat(arguments.length <= 2 ? undefined : arguments[2], "px ").concat(arguments.length <= 3 ? undefined : arguments[3], "px rgba(0,0,0,").concat(shadowKeyUmbraOpacity, ")"), "".concat(arguments.length <= 4 ? undefined : arguments[4], "px ").concat(arguments.length <= 5 ? undefined : arguments[5], "px ").concat(arguments.length <= 6 ? undefined : arguments[6], "px ").concat(arguments.length <= 7 ? undefined : arguments[7], "px rgba(0,0,0,").concat(shadowKeyPenumbraOpacity, ")"), "".concat(arguments.length <= 8 ? undefined : arguments[8], "px ").concat(arguments.length <= 9 ? undefined : arguments[9], "px ").concat(arguments.length <= 10 ? undefined : arguments[10], "px ").concat(arguments.length <= 11 ? undefined : arguments[11], "px rgba(0,0,0,").concat(shadowAmbientShadowOpacity, ")")].join(',');
9630 } // Values from https://github.com/material-components/material-components-web/blob/be8747f94574669cb5e7add1a7c54fa41a89cec7/packages/mdc-elevation/_variables.scss
9631
9632
9633 var shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
9634
9635 var shape = {
9636 borderRadius: 4
9637 };
9638
9639 function _defineProperty(obj, key, value) {
9640 if (key in obj) {
9641 Object.defineProperty(obj, key, {
9642 value: value,
9643 enumerable: true,
9644 configurable: true,
9645 writable: true
9646 });
9647 } else {
9648 obj[key] = value;
9649 }
9650
9651 return obj;
9652 }
9653
9654 function _arrayWithoutHoles$1(arr) {
9655 if (Array.isArray(arr)) {
9656 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
9657 arr2[i] = arr[i];
9658 }
9659
9660 return arr2;
9661 }
9662 }
9663
9664 function _iterableToArray$1(iter) {
9665 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
9666 }
9667
9668 function _nonIterableSpread$1() {
9669 throw new TypeError("Invalid attempt to spread non-iterable instance");
9670 }
9671
9672 function _toConsumableArray$1(arr) {
9673 return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _nonIterableSpread$1();
9674 }
9675
9676 function _extends$4() {
9677 _extends$4 = Object.assign || function (target) {
9678 for (var i = 1; i < arguments.length; i++) {
9679 var source = arguments[i];
9680
9681 for (var key in source) {
9682 if (Object.prototype.hasOwnProperty.call(source, key)) {
9683 target[key] = source[key];
9684 }
9685 }
9686 }
9687
9688 return target;
9689 };
9690
9691 return _extends$4.apply(this, arguments);
9692 }
9693
9694 function _typeof2$1(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2$1 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2$1 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2$1(obj); }
9695
9696 function _typeof$1(obj) {
9697 if (typeof Symbol === "function" && _typeof2$1(Symbol.iterator) === "symbol") {
9698 _typeof$1 = function _typeof(obj) {
9699 return _typeof2$1(obj);
9700 };
9701 } else {
9702 _typeof$1 = function _typeof(obj) {
9703 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2$1(obj);
9704 };
9705 }
9706
9707 return _typeof$1(obj);
9708 }
9709
9710 function merge(acc, item) {
9711 if (!item) {
9712 return acc;
9713 }
9714
9715 return deepmerge(acc, item, {
9716 clone: false // No need to clone deep, it's way faster.
9717
9718 });
9719 }
9720
9721 // For instance with the first breakpoint xs: [xs, sm[.
9722
9723 var values$1 = {
9724 xs: 0,
9725 sm: 600,
9726 md: 960,
9727 lg: 1280,
9728 xl: 1920
9729 };
9730 var defaultBreakpoints = {
9731 // Sorted ASC by size. That's important.
9732 // It can't be configured as it's used statically for propTypes.
9733 keys: ['xs', 'sm', 'md', 'lg', 'xl'],
9734 up: function up(key) {
9735 return "@media (min-width:".concat(values$1[key], "px)");
9736 }
9737 };
9738 function handleBreakpoints(props, propValue, styleFromPropValue) {
9739
9740 if (Array.isArray(propValue)) {
9741 var themeBreakpoints = props.theme.breakpoints || defaultBreakpoints;
9742 return propValue.reduce(function (acc, item, index) {
9743 acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);
9744 return acc;
9745 }, {});
9746 }
9747
9748 if (_typeof$1(propValue) === 'object') {
9749 var _themeBreakpoints = props.theme.breakpoints || defaultBreakpoints;
9750
9751 return Object.keys(propValue).reduce(function (acc, breakpoint) {
9752 acc[_themeBreakpoints.up(breakpoint)] = styleFromPropValue(propValue[breakpoint]);
9753 return acc;
9754 }, {});
9755 }
9756
9757 var output = styleFromPropValue(propValue);
9758 return output;
9759 }
9760
9761 function getPath$1(obj, path) {
9762 if (!path || typeof path !== 'string') {
9763 return null;
9764 }
9765
9766 return path.split('.').reduce(function (acc, item) {
9767 return acc && acc[item] ? acc[item] : null;
9768 }, obj);
9769 }
9770
9771 function style(options) {
9772 var prop = options.prop,
9773 _options$cssProperty = options.cssProperty,
9774 cssProperty = _options$cssProperty === void 0 ? options.prop : _options$cssProperty,
9775 themeKey = options.themeKey,
9776 transform = options.transform;
9777
9778 var fn = function fn(props) {
9779 if (props[prop] == null) {
9780 return null;
9781 }
9782
9783 var propValue = props[prop];
9784 var theme = props.theme;
9785 var themeMapping = getPath$1(theme, themeKey) || {};
9786
9787 var styleFromPropValue = function styleFromPropValue(propValueFinal) {
9788 var value;
9789
9790 if (typeof themeMapping === 'function') {
9791 value = themeMapping(propValueFinal);
9792 } else if (Array.isArray(themeMapping)) {
9793 value = themeMapping[propValueFinal] || propValueFinal;
9794 } else {
9795 value = getPath$1(themeMapping, propValueFinal) || propValueFinal;
9796
9797 if (transform) {
9798 value = transform(value);
9799 }
9800 }
9801
9802 if (cssProperty === false) {
9803 return value;
9804 }
9805
9806 return _defineProperty({}, cssProperty, value);
9807 };
9808
9809 return handleBreakpoints(props, propValue, styleFromPropValue);
9810 };
9811
9812 fn.propTypes = {};
9813 fn.filterProps = [prop];
9814 return fn;
9815 }
9816
9817 function compose() {
9818 for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
9819 styles[_key] = arguments[_key];
9820 }
9821
9822 var fn = function fn(props) {
9823 return styles.reduce(function (acc, style) {
9824 var output = style(props);
9825
9826 if (output) {
9827 return merge(acc, output);
9828 }
9829
9830 return acc;
9831 }, {});
9832 }; // Alternative approach that doesn't yield any performance gain.
9833 // const handlers = styles.reduce((acc, style) => {
9834 // style.filterProps.forEach(prop => {
9835 // acc[prop] = style;
9836 // });
9837 // return acc;
9838 // }, {});
9839 // const fn = props => {
9840 // return Object.keys(props).reduce((acc, prop) => {
9841 // if (handlers[prop]) {
9842 // return merge(acc, handlers[prop](props));
9843 // }
9844 // return acc;
9845 // }, {});
9846 // };
9847
9848
9849 fn.propTypes = {};
9850 fn.filterProps = styles.reduce(function (acc, style) {
9851 return acc.concat(style.filterProps);
9852 }, []);
9853 return fn;
9854 }
9855
9856 function getBorder(value) {
9857 if (typeof value !== 'number') {
9858 return value;
9859 }
9860
9861 return "".concat(value, "px solid");
9862 }
9863
9864 var border = style({
9865 prop: 'border',
9866 themeKey: 'borders',
9867 transform: getBorder
9868 });
9869 var borderTop = style({
9870 prop: 'borderTop',
9871 themeKey: 'borders',
9872 transform: getBorder
9873 });
9874 var borderRight = style({
9875 prop: 'borderRight',
9876 themeKey: 'borders',
9877 transform: getBorder
9878 });
9879 var borderBottom = style({
9880 prop: 'borderBottom',
9881 themeKey: 'borders',
9882 transform: getBorder
9883 });
9884 var borderLeft = style({
9885 prop: 'borderLeft',
9886 themeKey: 'borders',
9887 transform: getBorder
9888 });
9889 var borderColor = style({
9890 prop: 'borderColor',
9891 themeKey: 'palette'
9892 });
9893 var borderRadius$1 = style({
9894 prop: 'borderRadius',
9895 themeKey: 'shape'
9896 });
9897 var borders = compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderRadius$1);
9898
9899 function omit(input, fields) {
9900 var output = {};
9901 Object.keys(input).forEach(function (prop) {
9902 if (fields.indexOf(prop) === -1) {
9903 output[prop] = input[prop];
9904 }
9905 });
9906 return output;
9907 }
9908
9909 function styleFunctionSx(styleFunction) {
9910 var newStyleFunction = function newStyleFunction(props) {
9911 var output = styleFunction(props);
9912
9913 if (props.css) {
9914 return _extends$4({}, merge(output, styleFunction(_extends$4({
9915 theme: props.theme
9916 }, props.css))), omit(props.css, [styleFunction.filterProps]));
9917 }
9918
9919 if (props.sx) {
9920 return _extends$4({}, merge(output, styleFunction(_extends$4({
9921 theme: props.theme
9922 }, props.sx))), omit(props.sx, [styleFunction.filterProps]));
9923 }
9924
9925 return output;
9926 };
9927
9928 newStyleFunction.propTypes = {};
9929 newStyleFunction.filterProps = ['css', 'sx'].concat(_toConsumableArray$1(styleFunction.filterProps));
9930 return newStyleFunction;
9931 }
9932
9933 var displayPrint = style({
9934 prop: 'displayPrint',
9935 cssProperty: false,
9936 transform: function transform(value) {
9937 return {
9938 '@media print': {
9939 display: value
9940 }
9941 };
9942 }
9943 });
9944 var displayRaw = style({
9945 prop: 'display'
9946 });
9947 var overflow = style({
9948 prop: 'overflow'
9949 });
9950 var textOverflow = style({
9951 prop: 'textOverflow'
9952 });
9953 var visibility = style({
9954 prop: 'visibility'
9955 });
9956 var whiteSpace = style({
9957 prop: 'whiteSpace'
9958 });
9959 var display = compose(displayPrint, displayRaw, overflow, textOverflow, visibility, whiteSpace);
9960
9961 var flexBasis = style({
9962 prop: 'flexBasis'
9963 });
9964 var flexDirection = style({
9965 prop: 'flexDirection'
9966 });
9967 var flexWrap = style({
9968 prop: 'flexWrap'
9969 });
9970 var justifyContent = style({
9971 prop: 'justifyContent'
9972 });
9973 var alignItems = style({
9974 prop: 'alignItems'
9975 });
9976 var alignContent = style({
9977 prop: 'alignContent'
9978 });
9979 var order = style({
9980 prop: 'order'
9981 });
9982 var flex = style({
9983 prop: 'flex'
9984 });
9985 var flexGrow = style({
9986 prop: 'flexGrow'
9987 });
9988 var flexShrink = style({
9989 prop: 'flexShrink'
9990 });
9991 var alignSelf = style({
9992 prop: 'alignSelf'
9993 });
9994 var justifyItems = style({
9995 prop: 'justifyItems'
9996 });
9997 var justifySelf = style({
9998 prop: 'justifySelf'
9999 });
10000 var flexbox = compose(flexBasis, flexDirection, flexWrap, justifyContent, alignItems, alignContent, order, flex, flexGrow, flexShrink, alignSelf, justifyItems, justifySelf);
10001
10002 var gridGap = style({
10003 prop: 'gridGap'
10004 });
10005 var gridColumnGap = style({
10006 prop: 'gridColumnGap'
10007 });
10008 var gridRowGap = style({
10009 prop: 'gridRowGap'
10010 });
10011 var gridColumn = style({
10012 prop: 'gridColumn'
10013 });
10014 var gridRow = style({
10015 prop: 'gridRow'
10016 });
10017 var gridAutoFlow = style({
10018 prop: 'gridAutoFlow'
10019 });
10020 var gridAutoColumns = style({
10021 prop: 'gridAutoColumns'
10022 });
10023 var gridAutoRows = style({
10024 prop: 'gridAutoRows'
10025 });
10026 var gridTemplateColumns = style({
10027 prop: 'gridTemplateColumns'
10028 });
10029 var gridTemplateRows = style({
10030 prop: 'gridTemplateRows'
10031 });
10032 var gridTemplateAreas = style({
10033 prop: 'gridTemplateAreas'
10034 });
10035 var gridArea = style({
10036 prop: 'gridArea'
10037 });
10038 var grid = compose(gridGap, gridColumnGap, gridRowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);
10039
10040 var color = style({
10041 prop: 'color',
10042 themeKey: 'palette'
10043 });
10044 var bgcolor = style({
10045 prop: 'bgcolor',
10046 cssProperty: 'backgroundColor',
10047 themeKey: 'palette'
10048 });
10049 var palette = compose(color, bgcolor);
10050
10051 var position = style({
10052 prop: 'position'
10053 });
10054 var zIndex$1 = style({
10055 prop: 'zIndex',
10056 themeKey: 'zIndex'
10057 });
10058 var top = style({
10059 prop: 'top'
10060 });
10061 var right = style({
10062 prop: 'right'
10063 });
10064 var bottom = style({
10065 prop: 'bottom'
10066 });
10067 var left = style({
10068 prop: 'left'
10069 });
10070 var positions = compose(position, zIndex$1, top, right, bottom, left);
10071
10072 var boxShadow = style({
10073 prop: 'boxShadow',
10074 themeKey: 'shadows'
10075 });
10076
10077 function transform(value) {
10078 return value <= 1 ? "".concat(value * 100, "%") : value;
10079 }
10080
10081 var width = style({
10082 prop: 'width',
10083 transform: transform
10084 });
10085 var maxWidth = style({
10086 prop: 'maxWidth',
10087 transform: transform
10088 });
10089 var minWidth = style({
10090 prop: 'minWidth',
10091 transform: transform
10092 });
10093 var height = style({
10094 prop: 'height',
10095 transform: transform
10096 });
10097 var maxHeight = style({
10098 prop: 'maxHeight',
10099 transform: transform
10100 });
10101 var minHeight = style({
10102 prop: 'minHeight',
10103 transform: transform
10104 });
10105 style({
10106 prop: 'size',
10107 cssProperty: 'width',
10108 transform: transform
10109 });
10110 style({
10111 prop: 'size',
10112 cssProperty: 'height',
10113 transform: transform
10114 });
10115 var boxSizing = style({
10116 prop: 'boxSizing'
10117 });
10118 var sizing = compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);
10119
10120 function _arrayWithHoles$1(arr) {
10121 if (Array.isArray(arr)) return arr;
10122 }
10123
10124 function _iterableToArrayLimit$1(arr, i) {
10125 var _arr = [];
10126 var _n = true;
10127 var _d = false;
10128 var _e = undefined;
10129
10130 try {
10131 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
10132 _arr.push(_s.value);
10133
10134 if (i && _arr.length === i) break;
10135 }
10136 } catch (err) {
10137 _d = true;
10138 _e = err;
10139 } finally {
10140 try {
10141 if (!_n && _i["return"] != null) _i["return"]();
10142 } finally {
10143 if (_d) throw _e;
10144 }
10145 }
10146
10147 return _arr;
10148 }
10149
10150 function _nonIterableRest$1() {
10151 throw new TypeError("Invalid attempt to destructure non-iterable instance");
10152 }
10153
10154 function _slicedToArray$1(arr, i) {
10155 return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _nonIterableRest$1();
10156 }
10157
10158 function memoize(fn) {
10159 var cache = {};
10160 return function (arg) {
10161 if (cache[arg] === undefined) {
10162 cache[arg] = fn(arg);
10163 }
10164
10165 return cache[arg];
10166 };
10167 }
10168
10169 var properties = {
10170 m: 'margin',
10171 p: 'padding'
10172 };
10173 var directions = {
10174 t: 'Top',
10175 r: 'Right',
10176 b: 'Bottom',
10177 l: 'Left',
10178 x: ['Left', 'Right'],
10179 y: ['Top', 'Bottom']
10180 };
10181 var aliases = {
10182 marginX: 'mx',
10183 marginY: 'my',
10184 paddingX: 'px',
10185 paddingY: 'py'
10186 }; // memoize() impact:
10187 // From 300,000 ops/sec
10188 // To 350,000 ops/sec
10189
10190 var getCssProperties = memoize(function (prop) {
10191 // It's not a shorthand notation.
10192 if (prop.length > 2) {
10193 if (aliases[prop]) {
10194 prop = aliases[prop];
10195 } else {
10196 return [prop];
10197 }
10198 }
10199
10200 var _prop$split = prop.split(''),
10201 _prop$split2 = _slicedToArray$1(_prop$split, 2),
10202 a = _prop$split2[0],
10203 b = _prop$split2[1];
10204
10205 var property = properties[a];
10206 var direction = directions[b] || '';
10207 return Array.isArray(direction) ? direction.map(function (dir) {
10208 return property + dir;
10209 }) : [property + direction];
10210 });
10211 var spacingKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY'];
10212 function createUnarySpacing(theme) {
10213 var themeSpacing = theme.spacing || 8;
10214
10215 if (typeof themeSpacing === 'number') {
10216 return function (abs) {
10217
10218 return themeSpacing * abs;
10219 };
10220 }
10221
10222 if (Array.isArray(themeSpacing)) {
10223 return function (abs) {
10224
10225 return themeSpacing[abs];
10226 };
10227 }
10228
10229 if (typeof themeSpacing === 'function') {
10230 return themeSpacing;
10231 }
10232
10233 return function () {
10234 return undefined;
10235 };
10236 }
10237
10238 function getValue$1(transformer, propValue) {
10239 if (typeof propValue === 'string' || propValue == null) {
10240 return propValue;
10241 }
10242
10243 var abs = Math.abs(propValue);
10244 var transformed = transformer(abs);
10245
10246 if (propValue >= 0) {
10247 return transformed;
10248 }
10249
10250 if (typeof transformed === 'number') {
10251 return -transformed;
10252 }
10253
10254 return "-".concat(transformed);
10255 }
10256
10257 function getStyleFromPropValue(cssProperties, transformer) {
10258 return function (propValue) {
10259 return cssProperties.reduce(function (acc, cssProperty) {
10260 acc[cssProperty] = getValue$1(transformer, propValue);
10261 return acc;
10262 }, {});
10263 };
10264 }
10265
10266 function spacing(props) {
10267 var theme = props.theme;
10268 var transformer = createUnarySpacing(theme);
10269 return Object.keys(props).map(function (prop) {
10270 // Using a hash computation over an array iteration could be faster, but with only 28 items,
10271 // it's doesn't worth the bundle size.
10272 if (spacingKeys.indexOf(prop) === -1) {
10273 return null;
10274 }
10275
10276 var cssProperties = getCssProperties(prop);
10277 var styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
10278 var propValue = props[prop];
10279 return handleBreakpoints(props, propValue, styleFromPropValue);
10280 }).reduce(merge, {});
10281 }
10282
10283 spacing.propTypes = {};
10284 spacing.filterProps = spacingKeys;
10285
10286 var fontFamily = style({
10287 prop: 'fontFamily',
10288 themeKey: 'typography'
10289 });
10290 var fontSize = style({
10291 prop: 'fontSize',
10292 themeKey: 'typography'
10293 });
10294 var fontStyle = style({
10295 prop: 'fontStyle',
10296 themeKey: 'typography'
10297 });
10298 var fontWeight = style({
10299 prop: 'fontWeight',
10300 themeKey: 'typography'
10301 });
10302 var letterSpacing = style({
10303 prop: 'letterSpacing'
10304 });
10305 var lineHeight = style({
10306 prop: 'lineHeight'
10307 });
10308 var textAlign = style({
10309 prop: 'textAlign'
10310 });
10311 var typography = compose(fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign);
10312
10313 function createSpacing() {
10314 var spacingInput = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 8;
10315
10316 // Already transformed.
10317 if (spacingInput.mui) {
10318 return spacingInput;
10319 } // Material Design layouts are visually balanced. Most measurements align to an 8dp grid applied, which aligns both spacing and the overall layout.
10320 // Smaller components, such as icons and type, can align to a 4dp grid.
10321 // https://material.io/design/layout/understanding-layout.html#usage
10322
10323
10324 var transform = createUnarySpacing({
10325 spacing: spacingInput
10326 });
10327
10328 var spacing = function spacing() {
10329 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10330 args[_key] = arguments[_key];
10331 }
10332
10333 if (args.length === 0) {
10334 return transform(1);
10335 }
10336
10337 if (args.length === 1) {
10338 return transform(args[0]);
10339 }
10340
10341 return args.map(function (argument) {
10342 if (typeof argument === 'string') {
10343 return argument;
10344 }
10345
10346 var output = transform(argument);
10347 return typeof output === 'number' ? "".concat(output, "px") : output;
10348 }).join(' ');
10349 }; // Backward compatibility, to remove in v5.
10350
10351
10352 Object.defineProperty(spacing, 'unit', {
10353 get: function get() {
10354
10355 return spacingInput;
10356 }
10357 });
10358 spacing.mui = true;
10359 return spacing;
10360 }
10361
10362 // Follow https://material.google.com/motion/duration-easing.html#duration-easing-natural-easing-curves
10363 // to learn the context in which each easing should be used.
10364 var easing = {
10365 // This is the most common easing curve.
10366 easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
10367 // Objects enter the screen at full velocity from off-screen and
10368 // slowly decelerate to a resting point.
10369 easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)',
10370 // Objects leave the screen at full velocity. They do not decelerate when off-screen.
10371 easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
10372 // The sharp curve is used by objects that may return to the screen at any time.
10373 sharp: 'cubic-bezier(0.4, 0, 0.6, 1)'
10374 }; // Follow https://material.io/guidelines/motion/duration-easing.html#duration-easing-common-durations
10375 // to learn when use what timing
10376
10377 var duration = {
10378 shortest: 150,
10379 shorter: 200,
10380 short: 250,
10381 // most basic recommended timing
10382 standard: 300,
10383 // this is to be used in complex animations
10384 complex: 375,
10385 // recommended when something is entering screen
10386 enteringScreen: 225,
10387 // recommended when something is leaving screen
10388 leavingScreen: 195
10389 };
10390
10391 function formatMs(milliseconds) {
10392 return "".concat(Math.round(milliseconds), "ms");
10393 }
10394 /**
10395 * @param {string|Array} props
10396 * @param {object} param
10397 * @param {string} param.prop
10398 * @param {number} param.duration
10399 * @param {string} param.easing
10400 * @param {number} param.delay
10401 */
10402
10403
10404 var transitions = {
10405 easing: easing,
10406 duration: duration,
10407 create: function create() {
10408 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['all'];
10409 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10410
10411 var _options$duration = options.duration,
10412 durationOption = _options$duration === void 0 ? duration.standard : _options$duration,
10413 _options$easing = options.easing,
10414 easingOption = _options$easing === void 0 ? easing.easeInOut : _options$easing,
10415 _options$delay = options.delay,
10416 delay = _options$delay === void 0 ? 0 : _options$delay;
10417 _objectWithoutProperties(options, ["duration", "easing", "delay"]);
10418
10419 return (Array.isArray(props) ? props : [props]).map(function (animatedProp) {
10420 return "".concat(animatedProp, " ").concat(typeof durationOption === 'string' ? durationOption : formatMs(durationOption), " ").concat(easingOption, " ").concat(typeof delay === 'string' ? delay : formatMs(delay));
10421 }).join(',');
10422 },
10423 getAutoHeightDuration: function getAutoHeightDuration(height) {
10424 if (!height) {
10425 return 0;
10426 }
10427
10428 var constant = height / 36; // https://www.wolframalpha.com/input/?i=(4+%2B+15+*+(x+%2F+36+)+**+0.25+%2B+(x+%2F+36)+%2F+5)+*+10
10429
10430 return Math.round((4 + 15 * Math.pow(constant, 0.25) + constant / 5) * 10);
10431 }
10432 };
10433
10434 // We need to centralize the zIndex definitions as they work
10435 // like global values in the browser.
10436 var zIndex = {
10437 mobileStepper: 1000,
10438 speedDial: 1050,
10439 appBar: 1100,
10440 drawer: 1200,
10441 modal: 1300,
10442 snackbar: 1400,
10443 tooltip: 1500
10444 };
10445
10446 function createTheme() {
10447 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10448
10449 var _options$breakpoints = options.breakpoints,
10450 breakpointsInput = _options$breakpoints === void 0 ? {} : _options$breakpoints,
10451 _options$mixins = options.mixins,
10452 mixinsInput = _options$mixins === void 0 ? {} : _options$mixins,
10453 _options$palette = options.palette,
10454 paletteInput = _options$palette === void 0 ? {} : _options$palette,
10455 spacingInput = options.spacing,
10456 _options$typography = options.typography,
10457 typographyInput = _options$typography === void 0 ? {} : _options$typography,
10458 other = _objectWithoutProperties(options, ["breakpoints", "mixins", "palette", "spacing", "typography"]);
10459
10460 var palette = createPalette(paletteInput);
10461 var breakpoints = createBreakpoints(breakpointsInput);
10462 var spacing = createSpacing(spacingInput);
10463 var muiTheme = deepmerge({
10464 breakpoints: breakpoints,
10465 direction: 'ltr',
10466 mixins: createMixins(breakpoints, spacing, mixinsInput),
10467 overrides: {},
10468 // Inject custom styles
10469 palette: palette,
10470 props: {},
10471 // Provide default props
10472 shadows: shadows,
10473 typography: createTypography(palette, typographyInput),
10474 spacing: spacing,
10475 shape: shape,
10476 transitions: transitions,
10477 zIndex: zIndex
10478 }, other);
10479
10480 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
10481 args[_key - 1] = arguments[_key];
10482 }
10483
10484 muiTheme = args.reduce(function (acc, argument) {
10485 return deepmerge(acc, argument);
10486 }, muiTheme);
10487
10488 return muiTheme;
10489 }
10490
10491 var defaultTheme = createTheme();
10492
10493 function makeStyles(stylesOrCreator) {
10494 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10495 return makeStyles$1(stylesOrCreator, _extends$5({
10496 defaultTheme: defaultTheme
10497 }, options));
10498 }
10499
10500 var styled = function styled(Component) {
10501 var componentCreator = styled$1(Component);
10502 return function (style, options) {
10503 return componentCreator(style, _extends$5({
10504 defaultTheme: defaultTheme
10505 }, options));
10506 };
10507 };
10508
10509 function useTheme$1() {
10510 var theme = useTheme$2() || defaultTheme;
10511
10512 return theme;
10513 }
10514
10515 function withStyles(stylesOrCreator, options) {
10516 return withStyles$1(stylesOrCreator, _extends$5({
10517 defaultTheme: defaultTheme
10518 }, options));
10519 }
10520
10521 withThemeCreator({
10522 defaultTheme: defaultTheme
10523 });
10524
10525 var base = {
10526 typography: {
10527 fontSize: 14,
10528 htmlFontSize: 16,
10529 fontWeightLight: 300,
10530 fontWeightRegular: 400,
10531 fontWeightMedium: 600,
10532 fontFamily: ['"Source Sans Pro"', '"Segoe UI"', '"Helvetica Neue"', '-apple-system', 'Arial', 'sans-serif'].join(','),
10533 button: {
10534 textTransform: 'initial',
10535 fontWeight: 400
10536 }
10537 },
10538 shape: {
10539 borderRadius: 2
10540 },
10541 shadows: ['none', '0px 1px 2px 0px rgba(0,0,0,0.15)', '0px 1px 2px 0px rgba(0,0,0,0.15)', '0px 1px 2px 0px rgba(0,0,0,0.15)', '0px 1px 2px 0px rgba(0,0,0,0.15)', '0px 1px 2px 0px rgba(0,0,0,0.15)', '0px 1px 2px 0px rgba(0,0,0,0.15)', '0px 2px 4px 0px rgba(0,0,0,0.15)', '0px 2px 4px 0px rgba(0,0,0,0.15)', '0px 2px 4px 0px rgba(0,0,0,0.15)', '0px 2px 4px 0px rgba(0,0,0,0.15)', '0px 2px 4px 0px rgba(0,0,0,0.15)', '0px 2px 4px 0px rgba(0,0,0,0.15)', '0px 4px 10px 0px rgba(0,0,0,0.15)', '0px 4px 10px 0px rgba(0,0,0,0.15)', '0px 4px 10px 0px rgba(0,0,0,0.15)', '0px 4px 10px 0px rgba(0,0,0,0.15)', '0px 4px 10px 0px rgba(0,0,0,0.15)', '0px 4px 10px 0px rgba(0,0,0,0.15)', '0px 6px 20px 0px rgba(0,0,0,0.15)', '0px 6px 20px 0px rgba(0,0,0,0.15)', '0px 6px 20px 0px rgba(0,0,0,0.15)', '0px 6px 20px 0px rgba(0,0,0,0.15)', '0px 6px 20px 0px rgba(0,0,0,0.15)', '0px 6px 20px 0px rgba(0,0,0,0.15)'],
10542 props: {
10543 MuiButtonBase: {
10544 disableRipple: true,
10545 disableTouchRipple: true,
10546 focusRipple: false
10547 }
10548 }
10549 };
10550
10551 const colors = {
10552 green: '#009845',
10553 greenPale: '#0AAF54',
10554 red: '#DC423F',
10555 redPale: '#F05551',
10556 blue: '#3F8AB3',
10557 bluePale: '#469DCD',
10558 // greyscale
10559 grey100: '#ffffff',
10560 grey98: '#FBFBFB',
10561 grey95: '#F2F2F2',
10562 grey90: '#E6E6E6',
10563 grey85: '#D9D9D9',
10564 grey55: '#8C8C8C',
10565 grey30: '#4D4D4D',
10566 grey25: '#404040',
10567 grey20: '#333333',
10568 grey15: '#262626',
10569 grey10: '#1A1A1A',
10570 grey5: '#0E0E0E',
10571 grey0: '#000000'
10572 };
10573
10574 const light = {
10575 type: 'light',
10576 palette: {
10577 primary: {
10578 main: colors.grey25,
10579 contrastText: colors.grey100
10580 },
10581 secondary: {
10582 light: '#0AAF54',
10583 main: '#009845',
10584 dark: '#006937'
10585 },
10586 text: {
10587 primary: colors.grey25,
10588 secondary: 'rgba(0, 0, 0, 0.55)',
10589 disabled: 'rgba(0, 0, 0, 0.3)'
10590 },
10591 action: {
10592 active: colors.grey25,
10593 // color for actionable things like icon buttons
10594 hover: 'rgba(0, 0, 0, 0.03)',
10595 // color for hoverable things like list items
10596 hoverOpacity: 0.08,
10597 // used to fade primary/secondary colors
10598 selected: 'rgba(0, 0, 0, 0.05)',
10599 // focused things like list items
10600 disabled: 'rgba(0, 0, 0, 0.3)',
10601 // usually text
10602 disabledBackground: 'rgba(0, 0, 0, 0.12)'
10603 },
10604 background: {
10605 paper: colors.grey100,
10606 default: colors.grey100,
10607 // -- custom properties --
10608 lightest: colors.grey100,
10609 lighter: colors.grey98,
10610 darker: colors.grey95,
10611 darkest: colors.grey90
10612 },
10613 // --- custom stuff ---
10614 custom: {
10615 focusBorder: colors.blue,
10616 focusOutline: 'rgba(70, 157, 205, 0.3)',
10617 inputBackground: 'rgba(255, 255, 255, 1)'
10618 },
10619 selected: {
10620 main: colors.green,
10621 alternative: '#E4E4E4',
10622 excluded: '#BEBEBE',
10623 mainContrastText: colors.grey100,
10624 alternativeContrastText: colors.grey25,
10625 excludedContrastText: colors.grey25
10626 },
10627 btn: {
10628 normal: 'rgba(255, 255, 255, 0.6)',
10629 hover: 'rgba(0, 0, 0, 0.03)',
10630 active: 'rgba(0, 0, 0, 0.1)',
10631 disabled: 'rgba(255, 255, 255, 0.6)',
10632 border: 'rgba(0, 0, 0, 0.15)',
10633 borderHover: 'rgba(0, 0, 0, 0.15)'
10634 }
10635 }
10636 };
10637
10638 const dark = {
10639 type: 'dark',
10640 palette: {
10641 primary: {
10642 main: colors.grey20,
10643 contrastText: colors.grey100
10644 },
10645 secondary: {
10646 light: '#0AAF54',
10647 main: '#009845',
10648 dark: '#006937'
10649 },
10650 text: {
10651 primary: colors.grey100,
10652 secondary: 'rgba(255, 255, 255, 0.6)',
10653 disabled: 'rgba(255, 255, 255, 0.3)'
10654 },
10655 action: {
10656 // active: 'rgba(0, 0, 0, 0.55)',
10657 active: colors.grey100,
10658 hover: 'rgba(255, 255, 255, 0.05)',
10659 hoverOpacity: 0.08,
10660 selected: 'rgba(0, 0, 0, 0.03)',
10661 disabled: 'rgba(255, 255, 255, 0.3)',
10662 disabledBackground: 'rgba(0, 0, 0, 0.12)'
10663 },
10664 divider: 'rgba(0,0,0,0.3)',
10665 background: {
10666 default: '#323232',
10667 paper: '#323232',
10668 // -- custom properties --
10669 lightest: colors.grey25,
10670 lighter: colors.grey20,
10671 darker: colors.grey15,
10672 darkest: colors.grey10
10673 },
10674 // -- custom --
10675 custom: {
10676 focusBorder: colors.blue,
10677 focusOutline: 'rgba(70, 157, 205, 0.3)',
10678 inputBackground: 'rgba(0, 0, 0, 0.2)'
10679 },
10680 selected: {
10681 main: colors.green,
10682 alternative: colors.grey20,
10683 excluded: colors.grey10,
10684 mainContrastText: colors.grey100,
10685 alternativeContrastText: colors.grey100,
10686 excludedContrastText: colors.grey100
10687 },
10688 btn: {
10689 normal: 'rgba(255, 255, 255, 0.15)',
10690 hover: 'rgba(255, 255, 255, 0.25)',
10691 active: 'rgba(0, 0, 0, 0.6)',
10692 disabled: 'rgba(255, 255, 255, 0.15)',
10693 border: 'rgba(0, 0, 0, 0.15)',
10694 borderHover: 'rgba(0, 0, 0, 0.30)'
10695 }
10696 }
10697 };
10698
10699 const cache = {};
10700
10701 const overrides = theme => ({
10702 MuiTypography: {
10703 root: {
10704 color: theme.palette.text.primary
10705 }
10706 },
10707 MuiIconButton: {
10708 root: {
10709 padding: 7,
10710 borderRadius: 2,
10711 border: '1px solid transparent',
10712 // should ideally use $focusVisible, but that messes up focus in all other places where Iconbutton is used (Checkbox, Switch etc)
10713 '&:focus': {
10714 borderColor: theme.palette.custom.focusBorder,
10715 boxShadow: "0 0 0 2px ".concat(theme.palette.custom.focusOutline)
10716 }
10717 }
10718 },
10719 MuiOutlinedInput: {
10720 root: {
10721 backgroundColor: theme.palette.custom.inputBackground,
10722 '&:hover $notchedOutline': {
10723 borderColor: theme.palette.btn.border
10724 },
10725 '&$focused $notchedOutline': {
10726 borderColor: theme.palette.custom.focusBorder,
10727 borderWidth: 2
10728 }
10729 }
10730 },
10731 MuiButton: {
10732 outlined: {
10733 padding: '3px 11px',
10734 '&$focusVisible': {
10735 borderColor: theme.palette.custom.focusBorder,
10736 boxShadow: "0 0 0 2px ".concat(theme.palette.custom.focusOutline)
10737 }
10738 },
10739 contained: {
10740 color: theme.palette.text.primary,
10741 padding: '3px 11px',
10742 border: "1px solid ".concat(theme.palette.btn.border),
10743 backgroundColor: theme.palette.btn.normal,
10744 boxShadow: 'none',
10745 '&$focusVisible': {
10746 borderColor: theme.palette.custom.focusBorder,
10747 boxShadow: "0 0 0 2px ".concat(theme.palette.custom.focusOutline)
10748 },
10749 '&:hover': {
10750 backgroundColor: theme.palette.btn.hover,
10751 borderColor: theme.palette.btn.borderHover,
10752 boxShadow: 'none',
10753 '&$disabled': {
10754 backgroundColor: theme.palette.btn.disabled
10755 }
10756 },
10757 '&:active': {
10758 boxShadow: 'none',
10759 backgroundColor: theme.palette.btn.active
10760 },
10761 '&$disabled': {
10762 backgroundColor: theme.palette.btn.disabled
10763 }
10764 }
10765 },
10766 MuiExpansionPanelSummary: {
10767 content: {
10768 margin: '8px 0'
10769 }
10770 }
10771 });
10772
10773 function create$3(definition) {
10774 let def = light;
10775 let name = '';
10776
10777 if (typeof definition === 'string') {
10778 name = definition;
10779
10780 if (definition !== 'light' && definition !== 'dark') {
10781 console.warn("Invalid theme: '".concat(definition, "'"));
10782 } else if (definition === 'dark') {
10783 def = dark;
10784 }
10785 }
10786
10787 const key = JSON.stringify(def);
10788
10789 if (cache[key]) {
10790 return cache[key];
10791 }
10792
10793 const withDefaults = {
10794 palette: _objectSpread2(_objectSpread2({
10795 type: def.type
10796 }, base.palette), def.palette),
10797 typography: _objectSpread2({}, base.typography),
10798 shadows: base.shadows,
10799 props: _objectSpread2({}, base.props),
10800 shape: _objectSpread2({}, base.shape)
10801 };
10802 cache[key] = createTheme(_objectSpread2(_objectSpread2({}, withDefaults), {}, {
10803 overrides: overrides(withDefaults)
10804 }));
10805 cache[key].name = name;
10806 return cache[key];
10807 }
10808
10809 var InstanceContext = React.createContext({
10810 language: null,
10811 theme: null,
10812 translator: null,
10813 constraints: {}
10814 });
10815
10816 var createKeyStore = (function () {
10817 let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10818 let applyMiddleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => {};
10819 const sharedState = initialState;
10820 const hookListeners = [];
10821 const store = {
10822 get: key => sharedState[key],
10823 set: (key, value) => {
10824 if (typeof key === 'undefined' || typeof key === 'object') {
10825 throw new Error("Invalid key: ".concat(JSON.stringify(key)));
10826 }
10827
10828 sharedState[key] = value;
10829 applyMiddleware({
10830 type: 'SET',
10831 value
10832 });
10833 return value;
10834 },
10835 clear: key => {
10836 if (typeof key === 'undefined' || typeof key === 'object') {
10837 throw new Error("Invalid key: ".concat(JSON.stringify(key)));
10838 }
10839
10840 sharedState[key] = null;
10841 },
10842 dispatch: forceNewState => {
10843 hookListeners.forEach(listener => listener(forceNewState ? {} : sharedState));
10844 }
10845 };
10846
10847 const useKeyStore = () => {
10848 const [, setState] = react.exports.useState(sharedState);
10849 react.exports.useEffect(() => {
10850 hookListeners.push(setState);
10851 return () => {
10852 const ix = hookListeners.indexOf(setState);
10853 hookListeners.splice(ix, 1);
10854 };
10855 }, [setState]);
10856 return [store];
10857 };
10858
10859 return [useKeyStore, store];
10860 });
10861
10862 const [useRpcResultStore, rpcResultStore] = createKeyStore({});
10863 const [useRpcRequestStore, rpcRequestStore] = createKeyStore({});
10864 const [useRpcRequestSessionModelStore, rpcRequestSessionModelStore] = createKeyStore({});
10865 const [useRpcRequestModelStore, rpcRequestModelStore] = createKeyStore({});
10866 const [useModelChangedStore, modelChangedStore] = createKeyStore({});
10867 const [, modelInitializedStore] = createKeyStore({});
10868
10869 const modelStoreMiddleware = _ref => {
10870 let {
10871 type,
10872 value: model
10873 } = _ref;
10874 const initialized = modelInitializedStore.get(model.id);
10875 modelInitializedStore.set(model.id, {});
10876
10877 const onChanged = () => {
10878 rpcRequestStore.clear(model.id);
10879 modelChangedStore.set(model.id, {});
10880 modelChangedStore.dispatch(true); // Force new state to trigger hooks
10881 };
10882
10883 const unsubscribe = () => {
10884 model.removeListener('changed', onChanged);
10885 rpcResultStore.clear(model.id);
10886 rpcRequestStore.clear(model.id);
10887 rpcRequestSessionModelStore.clear(model.id);
10888 rpcRequestModelStore.clear(model.id);
10889 modelChangedStore.clear(model.id);
10890 modelInitializedStore.clear(model.id);
10891 };
10892
10893 switch (type) {
10894 case 'SET':
10895 if (!initialized) {
10896 model.on('changed', onChanged);
10897 model.once('closed', () => {
10898 unsubscribe();
10899 });
10900 }
10901
10902 break;
10903 }
10904
10905 return unsubscribe;
10906 };
10907
10908 const [useModelStore, modelStore] = createKeyStore({}, modelStoreMiddleware);
10909
10910 const subscribe = model => {
10911 const unsubscribe = modelStoreMiddleware({
10912 type: 'SET',
10913 value: model
10914 });
10915 return () => {
10916 unsubscribe();
10917 modelStore.clear(model.id);
10918 };
10919 };
10920
10921 const rpcReducer = (state, action) => {
10922 const {
10923 rpcResultStore,
10924 key,
10925 method
10926 } = action;
10927 let newState;
10928
10929 switch (action.type) {
10930 case 'INVALID':
10931 {
10932 newState = _objectSpread2(_objectSpread2({}, state), {}, {
10933 valid: false,
10934 invalid: true,
10935 validating: true,
10936 canCancel: true,
10937 canRetry: false,
10938 rpcRetry: false
10939 });
10940 break;
10941 }
10942
10943 case 'VALID':
10944 {
10945 newState = {
10946 result: _objectSpread2({}, action.result),
10947 invalid: false,
10948 valid: true,
10949 validating: false,
10950 canCancel: false,
10951 canRetry: false,
10952 rpcRetry: false
10953 };
10954 break;
10955 }
10956
10957 case 'CANCELLED':
10958 {
10959 newState = _objectSpread2(_objectSpread2({}, state), {}, {
10960 invalid: true,
10961 valid: false,
10962 validating: false,
10963 canCancel: false,
10964 canRetry: true,
10965 rpcRetry: false
10966 });
10967 break;
10968 }
10969
10970 default:
10971 throw new Error('Undefined action');
10972 }
10973
10974 let sharedState = rpcResultStore.get(key);
10975
10976 if (!sharedState) {
10977 sharedState = {};
10978 }
10979
10980 sharedState[method] = newState;
10981 rpcResultStore.set(key, sharedState);
10982 return newState;
10983 };
10984
10985 function useRpc(model, method) {
10986 const key = model ? "".concat(model.id) : null;
10987 const [rpcResultStore] = useRpcResultStore();
10988 const [state, dispatch] = react.exports.useReducer(rpcReducer, key ? rpcResultStore.get(key) : null);
10989 const [modelChangedStore] = useModelChangedStore();
10990 const [rpcRequestStore] = useRpcRequestStore();
10991 let rpcShared;
10992
10993 if (key) {
10994 rpcShared = rpcRequestStore.get(key);
10995
10996 if (!rpcShared) {
10997 rpcShared = {};
10998 rpcRequestStore.set(key, rpcShared);
10999 }
11000 }
11001
11002 const call = async skipRetry => {
11003 let cache = rpcShared[method];
11004
11005 if (!cache || cache && cache.rpcRetry) {
11006 const rpc = model[method]();
11007 cache = {
11008 rpc,
11009 rpcRetry: false
11010 };
11011 rpcShared[method] = cache;
11012 dispatch({
11013 type: 'INVALID',
11014 method,
11015 key,
11016 model,
11017 rpcResultStore,
11018 canCancel: true
11019 });
11020 }
11021
11022 try {
11023 // await sleep(5000);
11024 const result = await cache.rpc;
11025 dispatch({
11026 type: 'VALID',
11027 result,
11028 key,
11029 method,
11030 model,
11031 rpcResultStore
11032 });
11033 } catch (err) {
11034 if (err.code === 15 && !skipRetry) {
11035 // Request aborted. This will be called multiple times by hooks only retry once
11036 if (!cache.rpcRetry) {
11037 cache.rpcRetry = true;
11038 }
11039
11040 call(true);
11041 }
11042 }
11043 };
11044
11045 const longrunning = {
11046 cancel: async () => {
11047 const global = model.session.getObjectApi({
11048 handle: -1
11049 });
11050 await global.cancelRequest(rpcShared[method].rpc.requestId);
11051 dispatch({
11052 type: 'CANCELLED',
11053 key,
11054 method,
11055 model,
11056 rpcResultStore
11057 });
11058 },
11059 retry: () => {
11060 rpcShared[method].rpcRetry = true;
11061 call();
11062 }
11063 };
11064 react.exports.useEffect(() => {
11065 if (!model) return undefined;
11066 call();
11067 return undefined;
11068 }, [model, modelChangedStore.get(model && model.id), key, method]);
11069 return [// Result
11070 state && state.result, {
11071 validating: state && state.validating,
11072 canCancel: state && state.canCancel,
11073 canRetry: state && state.canRetry
11074 }, // Long running api e.g cancel retry
11075 longrunning];
11076 }
11077
11078 function useLayout$1(model) {
11079 return useRpc(model, 'getLayout');
11080 }
11081 function useAppLayout$1(model) {
11082 return useRpc(model, 'getAppLayout');
11083 }
11084
11085 function useSessionModel(definition, app) {
11086 const key = app ? "".concat(app.id, "/").concat(JSON.stringify(definition)) : null;
11087 const [modelStore] = useModelStore();
11088 const [rpcRequestSessionModelStore] = useRpcRequestSessionModelStore();
11089 const [model, setModel] = react.exports.useState();
11090 let rpcShared;
11091
11092 if (key) {
11093 rpcShared = rpcRequestSessionModelStore.get(key);
11094 }
11095
11096 for (var _len = arguments.length, deps = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
11097 deps[_key - 2] = arguments[_key];
11098 }
11099
11100 react.exports.useEffect(() => {
11101 if (!app) {
11102 return;
11103 } // Create new session object
11104
11105
11106 const create = async () => {
11107 if (!rpcShared) {
11108 const rpc = app.createSessionObject(definition);
11109 rpcShared = rpc;
11110 rpcRequestSessionModelStore.set(key, rpcShared);
11111 }
11112
11113 const newModel = await rpcShared;
11114 modelStore.set(key, newModel);
11115 setModel(newModel);
11116 };
11117
11118 create();
11119 }, [app, ...deps]);
11120 return [model];
11121 }
11122
11123 const definition = {
11124 qInfo: {
11125 qType: 'current-selections'
11126 },
11127 qSelectionObjectDef: {
11128 qStateName: '$'
11129 },
11130 alternateStates: []
11131 };
11132 function useCurrentSelectionsModel(app) {
11133 return useSessionModel(definition, app);
11134 }
11135
11136 const patchAlternateState = (currentSelectionsModel, currentSelectionsLayout, appLayout) => {
11137 const states = [...(appLayout.qStateNames || [])].map(s => ({
11138 stateName: s,
11139 // need this as reference in selection toolbar since qSelectionObject.qStateName is not in the layout
11140 qSelectionObjectDef: {
11141 qStateName: s
11142 }
11143 }));
11144 const existingStates = (currentSelectionsLayout && currentSelectionsLayout.alternateStates ? currentSelectionsLayout.alternateStates.map(s => s.stateName) : []).join('::');
11145 const newStates = (appLayout.qStateNames || []).map(s => s).join('::');
11146
11147 if (existingStates !== newStates) {
11148 currentSelectionsModel.applyPatches([{
11149 qOp: 'replace',
11150 qPath: '/alternateStates',
11151 qValue: JSON.stringify(states)
11152 }], true);
11153 }
11154 };
11155
11156 function useAppSelectionsNavigation(app) {
11157 const [currentSelectionsModel] = useCurrentSelectionsModel(app);
11158 const [currentSelectionsLayout] = useLayout$1(currentSelectionsModel);
11159 const [appLayout] = useAppLayout$1(app);
11160 const [navigationState, setNavigationState] = react.exports.useState(null);
11161 react.exports.useEffect(() => {
11162 if (!appLayout || !currentSelectionsModel || !currentSelectionsLayout) return;
11163 patchAlternateState(currentSelectionsModel, currentSelectionsLayout, appLayout);
11164 }, [appLayout, currentSelectionsModel, currentSelectionsLayout]);
11165 react.exports.useEffect(() => {
11166 if (!currentSelectionsLayout) return;
11167 let canGoBack = false;
11168 let canGoForward = false;
11169 let canClear = false;
11170 [currentSelectionsLayout, ...(currentSelectionsLayout.alternateStates || [])].forEach(state => {
11171 canGoBack = canGoBack || state.qSelectionObject && state.qSelectionObject.qBackCount > 0;
11172 canGoForward = canGoForward || state.qSelectionObject && state.qSelectionObject.qForwardCount > 0;
11173 canClear = canClear || (state.qSelectionObject && state.qSelectionObject.qSelections || []).filter(s => s.qLocked !== true).length > 0;
11174 });
11175 setNavigationState({
11176 canGoBack,
11177 canGoForward,
11178 canClear
11179 });
11180 }, [currentSelectionsLayout]);
11181 return [navigationState, currentSelectionsModel, currentSelectionsLayout];
11182 }
11183
11184 const [useAppSelectionsStore, appSelectionsStore] = createKeyStore({});
11185 const [useAppModalStore, appModalStore] = createKeyStore({});
11186 const [useObjectSelectionsStore, objectSelectionsStore] = createKeyStore({});
11187 const [useModalObjectStore, modalObjectStore] = createKeyStore({});
11188
11189 /* eslint no-underscore-dangle: 0 */
11190
11191 function createAppSelections(_ref) {
11192 let {
11193 app,
11194 currentSelectionsLayout,
11195 navState
11196 } = _ref;
11197 const key = "".concat(app.id);
11198
11199 const end = async function () {
11200 let accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
11201 const model = modalObjectStore.get(key);
11202
11203 if (model) {
11204 await model.endSelections(accept);
11205 modalObjectStore.clear(key);
11206 const objectSelections = objectSelectionsStore.get(model.id);
11207 objectSelections.emit('deactivated');
11208 }
11209 };
11210
11211 const begin = async function (model, path) {
11212 let accept = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
11213
11214 // Quick return if it's already in modal
11215 if (model === modalObjectStore.get(key)) {
11216 return;
11217 } // If other model is in modal state end it
11218
11219
11220 end(accept); // Pending modal
11221
11222 modalObjectStore.set(key, model);
11223 const p = Array.isArray(path) ? path : [path];
11224
11225 const beginSelections = async skipRetry => {
11226 try {
11227 await model.beginSelections(p);
11228 modalObjectStore.set(key, model); // We have a modal
11229 } catch (err) {
11230 if (err.code === 6003 && !skipRetry) {
11231 await app.abortModal(accept);
11232 beginSelections(true);
11233 } else {
11234 modalObjectStore.clear(key); // No modal
11235 }
11236 }
11237 };
11238
11239 await beginSelections();
11240 };
11241
11242 const appModal = {
11243 begin,
11244 end
11245 };
11246 appModalStore.set(key, appModal);
11247 /**
11248 * @class
11249 * @alias AppSelections
11250 */
11251
11252 const appSelections = {
11253 model: app,
11254
11255 isInModal() {
11256 return !!modalObjectStore.get(key);
11257 },
11258
11259 isModal(object) {
11260 // TODO check model state
11261 return object ? modalObjectStore.get(key) === object : !!modalObjectStore.get(key);
11262 },
11263
11264 canGoForward() {
11265 return navState.canGoForward;
11266 },
11267
11268 canGoBack() {
11269 return navState.canGoBack;
11270 },
11271
11272 canClear() {
11273 return navState.canClear;
11274 },
11275
11276 layout() {
11277 return currentSelectionsLayout;
11278 },
11279
11280 forward() {
11281 return appModal.end().then(() => app.forward());
11282 },
11283
11284 back() {
11285 return appModal.end().then(() => app.back());
11286 },
11287
11288 clear() {
11289 return appModal.end().then(() => app.clearAll());
11290 },
11291
11292 clearField(field) {
11293 let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$';
11294 return appModal.end().then(() => app.getField(field, state).then(f => f.clear()));
11295 }
11296
11297 };
11298 return appSelections;
11299 }
11300
11301 function useAppSelections(app) {
11302 if (!app.session) {
11303 // assume the app is mocked if session is undefined
11304 return [];
11305 }
11306
11307 const [navState, currentSelectionsModel, currentSelectionsLayout] = useAppSelectionsNavigation(app);
11308 const [appSelectionsStore] = useAppSelectionsStore();
11309 const key = app ? app.id : null;
11310 let appSelections = appSelectionsStore.get(key);
11311 react.exports.useEffect(() => {
11312 if (!app || !currentSelectionsModel || !currentSelectionsLayout || !navState || appSelections) return;
11313 appSelections = createAppSelections({
11314 app,
11315 currentSelectionsLayout,
11316 navState
11317 });
11318 appSelectionsStore.set(key, appSelections);
11319 appSelectionsStore.dispatch(true);
11320 }, [app, currentSelectionsModel, currentSelectionsLayout, navState]);
11321 return [appSelections, navState];
11322 }
11323
11324 const NEBULA_VERSION_HASH = "32d7" ;
11325 let counter = 0;
11326 const NebulaApp = react.exports.forwardRef((_ref, ref) => {
11327 let {
11328 initialContext,
11329 app
11330 } = _ref;
11331 const [appSelections] = useAppSelections(app);
11332 const [context, setContext] = react.exports.useState(initialContext);
11333 const [muiThemeName, setMuiThemeName] = react.exports.useState();
11334 const {
11335 theme,
11336 generator
11337 } = react.exports.useMemo(() => ({
11338 theme: create$3(muiThemeName),
11339 generator: createGenerateClassName({
11340 productionPrefix: "".concat(NEBULA_VERSION_HASH),
11341 disableGlobal: true,
11342 seed: "njs-".concat(counter++)
11343 })
11344 }), [muiThemeName]);
11345 const [components, setComponents] = react.exports.useState([]);
11346 react.exports.useImperativeHandle(ref, () => ({
11347 addComponent(component) {
11348 setComponents([...components, component]);
11349 },
11350
11351 removeComponent(component) {
11352 const ix = components.indexOf(component);
11353
11354 if (ix !== -1) {
11355 components.splice(ix, 1);
11356 setComponents([...components]);
11357 }
11358 },
11359
11360 setMuiThemeName,
11361 setContext,
11362 getAppSelections: () => appSelections
11363 }));
11364 return /*#__PURE__*/React.createElement(StylesProvider, {
11365 generateClassName: generator
11366 }, /*#__PURE__*/React.createElement(ThemeProvider, {
11367 theme: theme
11368 }, /*#__PURE__*/React.createElement(InstanceContext.Provider, {
11369 value: context
11370 }, components)));
11371 });
11372 function boot(_ref2) {
11373 let {
11374 app,
11375 context
11376 } = _ref2;
11377 let resolveRender;
11378 const rendered = new Promise(resolve => {
11379 resolveRender = resolve;
11380 });
11381 const appRef = React.createRef();
11382 const element = document.createElement('div');
11383 element.style.display = 'none';
11384 element.setAttribute('data-nebulajs-version', "2.12.0" );
11385 element.setAttribute('data-app-id', app.id);
11386 document.body.appendChild(element);
11387 ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
11388 ref: appRef,
11389 app: app,
11390 initialContext: context
11391 }), element, resolveRender);
11392 const cells = {};
11393 return [{
11394 toggleFocusOfCells(cellIdToFocus) {
11395 Object.keys(cells).forEach(i => {
11396 cells[i].current.toggleFocus(i === cellIdToFocus);
11397 });
11398 },
11399
11400 cells,
11401
11402 addCell(id, cell) {
11403 cells[id] = cell;
11404 },
11405
11406 add(component) {
11407 (async () => {
11408 await rendered;
11409 appRef.current.addComponent(component);
11410 })();
11411 },
11412
11413 remove(component) {
11414 (async () => {
11415 await rendered;
11416 appRef.current.removeComponent(component);
11417 })();
11418 },
11419
11420 setMuiThemeName(themeName) {
11421 (async () => {
11422 await rendered;
11423 appRef.current.setMuiThemeName(themeName);
11424 })();
11425 },
11426
11427 context(ctx) {
11428 (async () => {
11429 await rendered;
11430 appRef.current.setContext(ctx);
11431 })();
11432 },
11433
11434 getAppSelections: async () => {
11435 await rendered;
11436 return appRef.current.getAppSelections();
11437 }
11438 }, appRef, rendered];
11439 }
11440
11441 // It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
11442 //
11443 // A strict capitalization should uppercase the first letter of each word a the sentence.
11444 // We only handle the first word.
11445 function capitalize(string) {
11446 if (typeof string !== 'string') {
11447 throw new Error(formatMuiErrorMessage(7));
11448 }
11449
11450 return string.charAt(0).toUpperCase() + string.slice(1);
11451 }
11452
11453 /**
11454 * Safe chained function
11455 *
11456 * Will only create a new function if needed,
11457 * otherwise will pass back existing functions or null.
11458 *
11459 * @param {function} functions to chain
11460 * @returns {function|null}
11461 */
11462 function createChainedFunction() {
11463 for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
11464 funcs[_key] = arguments[_key];
11465 }
11466
11467 return funcs.reduce(function (acc, func) {
11468 if (func == null) {
11469 return acc;
11470 }
11471
11472 return function chainedFunction() {
11473 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
11474 args[_key2] = arguments[_key2];
11475 }
11476
11477 acc.apply(this, args);
11478 func.apply(this, args);
11479 };
11480 }, function () {});
11481 }
11482
11483 function toVal(mix) {
11484 var k, y, str='';
11485
11486 if (typeof mix === 'string' || typeof mix === 'number') {
11487 str += mix;
11488 } else if (typeof mix === 'object') {
11489 if (Array.isArray(mix)) {
11490 for (k=0; k < mix.length; k++) {
11491 if (mix[k]) {
11492 if (y = toVal(mix[k])) {
11493 str && (str += ' ');
11494 str += y;
11495 }
11496 }
11497 }
11498 } else {
11499 for (k in mix) {
11500 if (mix[k]) {
11501 str && (str += ' ');
11502 str += k;
11503 }
11504 }
11505 }
11506 }
11507
11508 return str;
11509 }
11510
11511 function clsx () {
11512 var i=0, tmp, x, str='';
11513 while (i < arguments.length) {
11514 if (tmp = arguments[i++]) {
11515 if (x = toVal(tmp)) {
11516 str && (str += ' ');
11517 str += x;
11518 }
11519 }
11520 }
11521 return str;
11522 }
11523
11524 var styles$1R = function styles(theme) {
11525 return {
11526 /* Styles applied to the root element. */
11527 root: {
11528 userSelect: 'none',
11529 width: '1em',
11530 height: '1em',
11531 display: 'inline-block',
11532 fill: 'currentColor',
11533 flexShrink: 0,
11534 fontSize: theme.typography.pxToRem(24),
11535 transition: theme.transitions.create('fill', {
11536 duration: theme.transitions.duration.shorter
11537 })
11538 },
11539
11540 /* Styles applied to the root element if `color="primary"`. */
11541 colorPrimary: {
11542 color: theme.palette.primary.main
11543 },
11544
11545 /* Styles applied to the root element if `color="secondary"`. */
11546 colorSecondary: {
11547 color: theme.palette.secondary.main
11548 },
11549
11550 /* Styles applied to the root element if `color="action"`. */
11551 colorAction: {
11552 color: theme.palette.action.active
11553 },
11554
11555 /* Styles applied to the root element if `color="error"`. */
11556 colorError: {
11557 color: theme.palette.error.main
11558 },
11559
11560 /* Styles applied to the root element if `color="disabled"`. */
11561 colorDisabled: {
11562 color: theme.palette.action.disabled
11563 },
11564
11565 /* Styles applied to the root element if `fontSize="inherit"`. */
11566 fontSizeInherit: {
11567 fontSize: 'inherit'
11568 },
11569
11570 /* Styles applied to the root element if `fontSize="small"`. */
11571 fontSizeSmall: {
11572 fontSize: theme.typography.pxToRem(20)
11573 },
11574
11575 /* Styles applied to the root element if `fontSize="large"`. */
11576 fontSizeLarge: {
11577 fontSize: theme.typography.pxToRem(35)
11578 }
11579 };
11580 };
11581 var SvgIcon$1 = /*#__PURE__*/react.exports.forwardRef(function SvgIcon(props, ref) {
11582 var children = props.children,
11583 classes = props.classes,
11584 className = props.className,
11585 _props$color = props.color,
11586 color = _props$color === void 0 ? 'inherit' : _props$color,
11587 _props$component = props.component,
11588 Component = _props$component === void 0 ? 'svg' : _props$component,
11589 _props$fontSize = props.fontSize,
11590 fontSize = _props$fontSize === void 0 ? 'medium' : _props$fontSize,
11591 htmlColor = props.htmlColor,
11592 titleAccess = props.titleAccess,
11593 _props$viewBox = props.viewBox,
11594 viewBox = _props$viewBox === void 0 ? '0 0 24 24' : _props$viewBox,
11595 other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "component", "fontSize", "htmlColor", "titleAccess", "viewBox"]);
11596
11597 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
11598 className: clsx(classes.root, className, color !== 'inherit' && classes["color".concat(capitalize(color))], fontSize !== 'default' && fontSize !== 'medium' && classes["fontSize".concat(capitalize(fontSize))]),
11599 focusable: "false",
11600 viewBox: viewBox,
11601 color: htmlColor,
11602 "aria-hidden": titleAccess ? undefined : true,
11603 role: titleAccess ? 'img' : undefined,
11604 ref: ref
11605 }, other), children, titleAccess ? /*#__PURE__*/react.exports.createElement("title", null, titleAccess) : null);
11606 });
11607 SvgIcon$1.muiName = 'SvgIcon';
11608 var SvgIcon$2 = withStyles(styles$1R, {
11609 name: 'MuiSvgIcon'
11610 })(SvgIcon$1);
11611
11612 /**
11613 * Private module reserved for @material-ui/x packages.
11614 */
11615
11616 function createSvgIcon(path, displayName) {
11617 var Component = function Component(props, ref) {
11618 return /*#__PURE__*/React.createElement(SvgIcon$2, _extends$5({
11619 ref: ref
11620 }, props), path);
11621 };
11622
11623 Component.muiName = SvgIcon$2.muiName;
11624 return /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(Component));
11625 }
11626
11627 // Corresponds to 10 frames at 60 Hz.
11628 // A few bytes payload overhead when lodash/debounce is ~3 kB and debounce ~300 B.
11629 function debounce$1(func) {
11630 var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 166;
11631 var timeout;
11632
11633 function debounced() {
11634 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
11635 args[_key] = arguments[_key];
11636 }
11637
11638 // eslint-disable-next-line consistent-this
11639 var that = this;
11640
11641 var later = function later() {
11642 func.apply(that, args);
11643 };
11644
11645 clearTimeout(timeout);
11646 timeout = setTimeout(later, wait);
11647 }
11648
11649 debounced.clear = function () {
11650 clearTimeout(timeout);
11651 };
11652
11653 return debounced;
11654 }
11655
11656 function isMuiElement(element, muiNames) {
11657 return /*#__PURE__*/react.exports.isValidElement(element) && muiNames.indexOf(element.type.muiName) !== -1;
11658 }
11659
11660 function ownerDocument(node) {
11661 return node && node.ownerDocument || document;
11662 }
11663
11664 function ownerWindow(node) {
11665 var doc = ownerDocument(node);
11666 return doc.defaultView || window;
11667 }
11668
11669 // TODO v5: consider to make it private
11670 function setRef(ref, value) {
11671 if (typeof ref === 'function') {
11672 ref(value);
11673 } else if (ref) {
11674 ref.current = value;
11675 }
11676 }
11677
11678 /* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
11679 function useControlled(_ref) {
11680 var controlled = _ref.controlled,
11681 defaultProp = _ref.default;
11682 _ref.name;
11683 _ref.state;
11684
11685 var _React$useRef = react.exports.useRef(controlled !== undefined),
11686 isControlled = _React$useRef.current;
11687
11688 var _React$useState = react.exports.useState(defaultProp),
11689 valueState = _React$useState[0],
11690 setValue = _React$useState[1];
11691
11692 var value = isControlled ? controlled : valueState;
11693
11694 var setValueIfUncontrolled = react.exports.useCallback(function (newValue) {
11695 if (!isControlled) {
11696 setValue(newValue);
11697 }
11698 }, []);
11699 return [value, setValueIfUncontrolled];
11700 }
11701
11702 var useEnhancedEffect$8 = typeof window !== 'undefined' ? react.exports.useLayoutEffect : react.exports.useEffect;
11703 /**
11704 * https://github.com/facebook/react/issues/14099#issuecomment-440013892
11705 *
11706 * @param {function} fn
11707 */
11708
11709 function useEventCallback(fn) {
11710 var ref = react.exports.useRef(fn);
11711 useEnhancedEffect$8(function () {
11712 ref.current = fn;
11713 });
11714 return react.exports.useCallback(function () {
11715 return (ref.current).apply(void 0, arguments);
11716 }, []);
11717 }
11718
11719 function useForkRef(refA, refB) {
11720 /**
11721 * This will create a new function if the ref props change and are defined.
11722 * This means react will call the old forkRef with `null` and the new forkRef
11723 * with the ref. Cleanup naturally emerges from this behavior
11724 */
11725 return react.exports.useMemo(function () {
11726 if (refA == null && refB == null) {
11727 return null;
11728 }
11729
11730 return function (refValue) {
11731 setRef(refA, refValue);
11732 setRef(refB, refValue);
11733 };
11734 }, [refA, refB]);
11735 }
11736
11737 /**
11738 * Private module reserved for @material-ui/x packages.
11739 */
11740
11741 function useId(idOverride) {
11742 var _React$useState = react.exports.useState(idOverride),
11743 defaultId = _React$useState[0],
11744 setDefaultId = _React$useState[1];
11745
11746 var id = idOverride || defaultId;
11747 react.exports.useEffect(function () {
11748 if (defaultId == null) {
11749 // Fallback to this default id when possible.
11750 // Use the random value for client-side rendering only.
11751 // We can't use it server-side.
11752 setDefaultId("mui-".concat(Math.round(Math.random() * 1e5)));
11753 }
11754 }, [defaultId]);
11755 return id;
11756 }
11757
11758 // based on https://github.com/WICG/focus-visible/blob/v4.1.5/src/focus-visible.js
11759 var hadKeyboardEvent = true;
11760 var hadFocusVisibleRecently = false;
11761 var hadFocusVisibleRecentlyTimeout = null;
11762 var inputTypesWhitelist = {
11763 text: true,
11764 search: true,
11765 url: true,
11766 tel: true,
11767 email: true,
11768 password: true,
11769 number: true,
11770 date: true,
11771 month: true,
11772 week: true,
11773 time: true,
11774 datetime: true,
11775 'datetime-local': true
11776 };
11777 /**
11778 * Computes whether the given element should automatically trigger the
11779 * `focus-visible` class being added, i.e. whether it should always match
11780 * `:focus-visible` when focused.
11781 * @param {Element} node
11782 * @return {boolean}
11783 */
11784
11785 function focusTriggersKeyboardModality(node) {
11786 var type = node.type,
11787 tagName = node.tagName;
11788
11789 if (tagName === 'INPUT' && inputTypesWhitelist[type] && !node.readOnly) {
11790 return true;
11791 }
11792
11793 if (tagName === 'TEXTAREA' && !node.readOnly) {
11794 return true;
11795 }
11796
11797 if (node.isContentEditable) {
11798 return true;
11799 }
11800
11801 return false;
11802 }
11803 /**
11804 * Keep track of our keyboard modality state with `hadKeyboardEvent`.
11805 * If the most recent user interaction was via the keyboard;
11806 * and the key press did not include a meta, alt/option, or control key;
11807 * then the modality is keyboard. Otherwise, the modality is not keyboard.
11808 * @param {KeyboardEvent} event
11809 */
11810
11811
11812 function handleKeyDown(event) {
11813 if (event.metaKey || event.altKey || event.ctrlKey) {
11814 return;
11815 }
11816
11817 hadKeyboardEvent = true;
11818 }
11819 /**
11820 * If at any point a user clicks with a pointing device, ensure that we change
11821 * the modality away from keyboard.
11822 * This avoids the situation where a user presses a key on an already focused
11823 * element, and then clicks on a different element, focusing it with a
11824 * pointing device, while we still think we're in keyboard modality.
11825 */
11826
11827
11828 function handlePointerDown() {
11829 hadKeyboardEvent = false;
11830 }
11831
11832 function handleVisibilityChange() {
11833 if (this.visibilityState === 'hidden') {
11834 // If the tab becomes active again, the browser will handle calling focus
11835 // on the element (Safari actually calls it twice).
11836 // If this tab change caused a blur on an element with focus-visible,
11837 // re-apply the class when the user switches back to the tab.
11838 if (hadFocusVisibleRecently) {
11839 hadKeyboardEvent = true;
11840 }
11841 }
11842 }
11843
11844 function prepare(doc) {
11845 doc.addEventListener('keydown', handleKeyDown, true);
11846 doc.addEventListener('mousedown', handlePointerDown, true);
11847 doc.addEventListener('pointerdown', handlePointerDown, true);
11848 doc.addEventListener('touchstart', handlePointerDown, true);
11849 doc.addEventListener('visibilitychange', handleVisibilityChange, true);
11850 }
11851
11852 function isFocusVisible(event) {
11853 var target = event.target;
11854
11855 try {
11856 return target.matches(':focus-visible');
11857 } catch (error) {} // browsers not implementing :focus-visible will throw a SyntaxError
11858 // we use our own heuristic for those browsers
11859 // rethrow might be better if it's not the expected error but do we really
11860 // want to crash if focus-visible malfunctioned?
11861 // no need for validFocusTarget check. the user does that by attaching it to
11862 // focusable events only
11863
11864
11865 return hadKeyboardEvent || focusTriggersKeyboardModality(target);
11866 }
11867 /**
11868 * Should be called if a blur event is fired on a focus-visible element
11869 */
11870
11871
11872 function handleBlurVisible() {
11873 // To detect a tab/window switch, we look for a blur event followed
11874 // rapidly by a visibility change.
11875 // If we don't see a visibility change within 100ms, it's probably a
11876 // regular focus change.
11877 hadFocusVisibleRecently = true;
11878 window.clearTimeout(hadFocusVisibleRecentlyTimeout);
11879 hadFocusVisibleRecentlyTimeout = window.setTimeout(function () {
11880 hadFocusVisibleRecently = false;
11881 }, 100);
11882 }
11883
11884 function useIsFocusVisible() {
11885 var ref = react.exports.useCallback(function (instance) {
11886 var node = reactDom.exports.findDOMNode(instance);
11887
11888 if (node != null) {
11889 prepare(node.ownerDocument);
11890 }
11891 }, []);
11892
11893 return {
11894 isFocusVisible: isFocusVisible,
11895 onBlurVisible: handleBlurVisible,
11896 ref: ref
11897 };
11898 }
11899
11900 function _arrayWithHoles(arr) {
11901 if (Array.isArray(arr)) return arr;
11902 }
11903
11904 function _iterableToArray(iter) {
11905 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
11906 }
11907
11908 function _nonIterableRest() {
11909 throw new TypeError("Invalid attempt to destructure non-iterable instance");
11910 }
11911
11912 function _toArray(arr) {
11913 return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest();
11914 }
11915
11916 function _iterableToArrayLimit(arr, i) {
11917 var _arr = [];
11918 var _n = true;
11919 var _d = false;
11920 var _e = undefined;
11921
11922 try {
11923 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
11924 _arr.push(_s.value);
11925
11926 if (i && _arr.length === i) break;
11927 }
11928 } catch (err) {
11929 _d = true;
11930 _e = err;
11931 } finally {
11932 try {
11933 if (!_n && _i["return"] != null) _i["return"]();
11934 } finally {
11935 if (_d) throw _e;
11936 }
11937 }
11938
11939 return _arr;
11940 }
11941
11942 function _slicedToArray(arr, i) {
11943 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
11944 }
11945
11946 function _extends$3() {
11947 _extends$3 = Object.assign || function (target) {
11948 for (var i = 1; i < arguments.length; i++) {
11949 var source = arguments[i];
11950
11951 for (var key in source) {
11952 if (Object.prototype.hasOwnProperty.call(source, key)) {
11953 target[key] = source[key];
11954 }
11955 }
11956 }
11957
11958 return target;
11959 };
11960
11961 return _extends$3.apply(this, arguments);
11962 }
11963
11964 function _objectWithoutPropertiesLoose(source, excluded) {
11965 if (source == null) return {};
11966 var target = {};
11967 var sourceKeys = Object.keys(source);
11968 var key, i;
11969
11970 for (i = 0; i < sourceKeys.length; i++) {
11971 key = sourceKeys[i];
11972 if (excluded.indexOf(key) >= 0) continue;
11973 target[key] = source[key];
11974 }
11975
11976 return target;
11977 }
11978
11979 function _inheritsLoose$1(subClass, superClass) {
11980 subClass.prototype = Object.create(superClass.prototype);
11981 subClass.prototype.constructor = subClass;
11982 subClass.__proto__ = superClass;
11983 }
11984
11985 function hasClass(element, className) {
11986 if (element.classList) return !!className && element.classList.contains(className);
11987 return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
11988 }
11989
11990 function addClass(element, className) {
11991 if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + " " + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + " " + className);
11992 }
11993
11994 function replaceClassName(origClass, classToRemove) {
11995 return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
11996 }
11997
11998 function removeClass$1(element, className) {
11999 if (element.classList) {
12000 element.classList.remove(className);
12001 } else if (typeof element.className === 'string') {
12002 element.className = replaceClassName(element.className, className);
12003 } else {
12004 element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
12005 }
12006 }
12007
12008 var config = {
12009 disabled: false
12010 };
12011
12012 var TransitionGroupContext = React.createContext(null);
12013
12014 var UNMOUNTED = 'unmounted';
12015 var EXITED = 'exited';
12016 var ENTERING = 'entering';
12017 var ENTERED = 'entered';
12018 var EXITING = 'exiting';
12019 /**
12020 * The Transition component lets you describe a transition from one component
12021 * state to another _over time_ with a simple declarative API. Most commonly
12022 * it's used to animate the mounting and unmounting of a component, but can also
12023 * be used to describe in-place transition states as well.
12024 *
12025 * ---
12026 *
12027 * **Note**: `Transition` is a platform-agnostic base component. If you're using
12028 * transitions in CSS, you'll probably want to use
12029 * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
12030 * instead. It inherits all the features of `Transition`, but contains
12031 * additional features necessary to play nice with CSS transitions (hence the
12032 * name of the component).
12033 *
12034 * ---
12035 *
12036 * By default the `Transition` component does not alter the behavior of the
12037 * component it renders, it only tracks "enter" and "exit" states for the
12038 * components. It's up to you to give meaning and effect to those states. For
12039 * example we can add styles to a component when it enters or exits:
12040 *
12041 * ```jsx
12042 * import { Transition } from 'react-transition-group';
12043 *
12044 * const duration = 300;
12045 *
12046 * const defaultStyle = {
12047 * transition: `opacity ${duration}ms ease-in-out`,
12048 * opacity: 0,
12049 * }
12050 *
12051 * const transitionStyles = {
12052 * entering: { opacity: 1 },
12053 * entered: { opacity: 1 },
12054 * exiting: { opacity: 0 },
12055 * exited: { opacity: 0 },
12056 * };
12057 *
12058 * const Fade = ({ in: inProp }) => (
12059 * <Transition in={inProp} timeout={duration}>
12060 * {state => (
12061 * <div style={{
12062 * ...defaultStyle,
12063 * ...transitionStyles[state]
12064 * }}>
12065 * I'm a fade Transition!
12066 * </div>
12067 * )}
12068 * </Transition>
12069 * );
12070 * ```
12071 *
12072 * There are 4 main states a Transition can be in:
12073 * - `'entering'`
12074 * - `'entered'`
12075 * - `'exiting'`
12076 * - `'exited'`
12077 *
12078 * Transition state is toggled via the `in` prop. When `true` the component
12079 * begins the "Enter" stage. During this stage, the component will shift from
12080 * its current transition state, to `'entering'` for the duration of the
12081 * transition and then to the `'entered'` stage once it's complete. Let's take
12082 * the following example (we'll use the
12083 * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
12084 *
12085 * ```jsx
12086 * function App() {
12087 * const [inProp, setInProp] = useState(false);
12088 * return (
12089 * <div>
12090 * <Transition in={inProp} timeout={500}>
12091 * {state => (
12092 * // ...
12093 * )}
12094 * </Transition>
12095 * <button onClick={() => setInProp(true)}>
12096 * Click to Enter
12097 * </button>
12098 * </div>
12099 * );
12100 * }
12101 * ```
12102 *
12103 * When the button is clicked the component will shift to the `'entering'` state
12104 * and stay there for 500ms (the value of `timeout`) before it finally switches
12105 * to `'entered'`.
12106 *
12107 * When `in` is `false` the same thing happens except the state moves from
12108 * `'exiting'` to `'exited'`.
12109 */
12110
12111 var Transition = /*#__PURE__*/function (_React$Component) {
12112 _inheritsLoose$1(Transition, _React$Component);
12113
12114 function Transition(props, context) {
12115 var _this;
12116
12117 _this = _React$Component.call(this, props, context) || this;
12118 var parentGroup = context; // In the context of a TransitionGroup all enters are really appears
12119
12120 var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
12121 var initialStatus;
12122 _this.appearStatus = null;
12123
12124 if (props.in) {
12125 if (appear) {
12126 initialStatus = EXITED;
12127 _this.appearStatus = ENTERING;
12128 } else {
12129 initialStatus = ENTERED;
12130 }
12131 } else {
12132 if (props.unmountOnExit || props.mountOnEnter) {
12133 initialStatus = UNMOUNTED;
12134 } else {
12135 initialStatus = EXITED;
12136 }
12137 }
12138
12139 _this.state = {
12140 status: initialStatus
12141 };
12142 _this.nextCallback = null;
12143 return _this;
12144 }
12145
12146 Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
12147 var nextIn = _ref.in;
12148
12149 if (nextIn && prevState.status === UNMOUNTED) {
12150 return {
12151 status: EXITED
12152 };
12153 }
12154
12155 return null;
12156 } // getSnapshotBeforeUpdate(prevProps) {
12157 // let nextStatus = null
12158 // if (prevProps !== this.props) {
12159 // const { status } = this.state
12160 // if (this.props.in) {
12161 // if (status !== ENTERING && status !== ENTERED) {
12162 // nextStatus = ENTERING
12163 // }
12164 // } else {
12165 // if (status === ENTERING || status === ENTERED) {
12166 // nextStatus = EXITING
12167 // }
12168 // }
12169 // }
12170 // return { nextStatus }
12171 // }
12172 ;
12173
12174 var _proto = Transition.prototype;
12175
12176 _proto.componentDidMount = function componentDidMount() {
12177 this.updateStatus(true, this.appearStatus);
12178 };
12179
12180 _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
12181 var nextStatus = null;
12182
12183 if (prevProps !== this.props) {
12184 var status = this.state.status;
12185
12186 if (this.props.in) {
12187 if (status !== ENTERING && status !== ENTERED) {
12188 nextStatus = ENTERING;
12189 }
12190 } else {
12191 if (status === ENTERING || status === ENTERED) {
12192 nextStatus = EXITING;
12193 }
12194 }
12195 }
12196
12197 this.updateStatus(false, nextStatus);
12198 };
12199
12200 _proto.componentWillUnmount = function componentWillUnmount() {
12201 this.cancelNextCallback();
12202 };
12203
12204 _proto.getTimeouts = function getTimeouts() {
12205 var timeout = this.props.timeout;
12206 var exit, enter, appear;
12207 exit = enter = appear = timeout;
12208
12209 if (timeout != null && typeof timeout !== 'number') {
12210 exit = timeout.exit;
12211 enter = timeout.enter; // TODO: remove fallback for next major
12212
12213 appear = timeout.appear !== undefined ? timeout.appear : enter;
12214 }
12215
12216 return {
12217 exit: exit,
12218 enter: enter,
12219 appear: appear
12220 };
12221 };
12222
12223 _proto.updateStatus = function updateStatus(mounting, nextStatus) {
12224 if (mounting === void 0) {
12225 mounting = false;
12226 }
12227
12228 if (nextStatus !== null) {
12229 // nextStatus will always be ENTERING or EXITING.
12230 this.cancelNextCallback();
12231
12232 if (nextStatus === ENTERING) {
12233 this.performEnter(mounting);
12234 } else {
12235 this.performExit();
12236 }
12237 } else if (this.props.unmountOnExit && this.state.status === EXITED) {
12238 this.setState({
12239 status: UNMOUNTED
12240 });
12241 }
12242 };
12243
12244 _proto.performEnter = function performEnter(mounting) {
12245 var _this2 = this;
12246
12247 var enter = this.props.enter;
12248 var appearing = this.context ? this.context.isMounting : mounting;
12249
12250 var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing],
12251 maybeNode = _ref2[0],
12252 maybeAppearing = _ref2[1];
12253
12254 var timeouts = this.getTimeouts();
12255 var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
12256 // if we are mounting and running this it means appear _must_ be set
12257
12258 if (!mounting && !enter || config.disabled) {
12259 this.safeSetState({
12260 status: ENTERED
12261 }, function () {
12262 _this2.props.onEntered(maybeNode);
12263 });
12264 return;
12265 }
12266
12267 this.props.onEnter(maybeNode, maybeAppearing);
12268 this.safeSetState({
12269 status: ENTERING
12270 }, function () {
12271 _this2.props.onEntering(maybeNode, maybeAppearing);
12272
12273 _this2.onTransitionEnd(enterTimeout, function () {
12274 _this2.safeSetState({
12275 status: ENTERED
12276 }, function () {
12277 _this2.props.onEntered(maybeNode, maybeAppearing);
12278 });
12279 });
12280 });
12281 };
12282
12283 _proto.performExit = function performExit() {
12284 var _this3 = this;
12285
12286 var exit = this.props.exit;
12287 var timeouts = this.getTimeouts();
12288 var maybeNode = this.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); // no exit animation skip right to EXITED
12289
12290 if (!exit || config.disabled) {
12291 this.safeSetState({
12292 status: EXITED
12293 }, function () {
12294 _this3.props.onExited(maybeNode);
12295 });
12296 return;
12297 }
12298
12299 this.props.onExit(maybeNode);
12300 this.safeSetState({
12301 status: EXITING
12302 }, function () {
12303 _this3.props.onExiting(maybeNode);
12304
12305 _this3.onTransitionEnd(timeouts.exit, function () {
12306 _this3.safeSetState({
12307 status: EXITED
12308 }, function () {
12309 _this3.props.onExited(maybeNode);
12310 });
12311 });
12312 });
12313 };
12314
12315 _proto.cancelNextCallback = function cancelNextCallback() {
12316 if (this.nextCallback !== null) {
12317 this.nextCallback.cancel();
12318 this.nextCallback = null;
12319 }
12320 };
12321
12322 _proto.safeSetState = function safeSetState(nextState, callback) {
12323 // This shouldn't be necessary, but there are weird race conditions with
12324 // setState callbacks and unmounting in testing, so always make sure that
12325 // we can cancel any pending setState callbacks after we unmount.
12326 callback = this.setNextCallback(callback);
12327 this.setState(nextState, callback);
12328 };
12329
12330 _proto.setNextCallback = function setNextCallback(callback) {
12331 var _this4 = this;
12332
12333 var active = true;
12334
12335 this.nextCallback = function (event) {
12336 if (active) {
12337 active = false;
12338 _this4.nextCallback = null;
12339 callback(event);
12340 }
12341 };
12342
12343 this.nextCallback.cancel = function () {
12344 active = false;
12345 };
12346
12347 return this.nextCallback;
12348 };
12349
12350 _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
12351 this.setNextCallback(handler);
12352 var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
12353 var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
12354
12355 if (!node || doesNotHaveTimeoutOrListener) {
12356 setTimeout(this.nextCallback, 0);
12357 return;
12358 }
12359
12360 if (this.props.addEndListener) {
12361 var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],
12362 maybeNode = _ref3[0],
12363 maybeNextCallback = _ref3[1];
12364
12365 this.props.addEndListener(maybeNode, maybeNextCallback);
12366 }
12367
12368 if (timeout != null) {
12369 setTimeout(this.nextCallback, timeout);
12370 }
12371 };
12372
12373 _proto.render = function render() {
12374 var status = this.state.status;
12375
12376 if (status === UNMOUNTED) {
12377 return null;
12378 }
12379
12380 var _this$props = this.props,
12381 children = _this$props.children;
12382 _this$props.in;
12383 _this$props.mountOnEnter;
12384 _this$props.unmountOnExit;
12385 _this$props.appear;
12386 _this$props.enter;
12387 _this$props.exit;
12388 _this$props.timeout;
12389 _this$props.addEndListener;
12390 _this$props.onEnter;
12391 _this$props.onEntering;
12392 _this$props.onEntered;
12393 _this$props.onExit;
12394 _this$props.onExiting;
12395 _this$props.onExited;
12396 _this$props.nodeRef;
12397 var childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
12398
12399 return (
12400 /*#__PURE__*/
12401 // allows for nested Transitions
12402 React.createElement(TransitionGroupContext.Provider, {
12403 value: null
12404 }, typeof children === 'function' ? children(status, childProps) : React.cloneElement(React.Children.only(children), childProps))
12405 );
12406 };
12407
12408 return Transition;
12409 }(React.Component);
12410
12411 Transition.contextType = TransitionGroupContext;
12412 Transition.propTypes = {}; // Name the function so it is clearer in the documentation
12413
12414 function noop$1() {}
12415
12416 Transition.defaultProps = {
12417 in: false,
12418 mountOnEnter: false,
12419 unmountOnExit: false,
12420 appear: false,
12421 enter: true,
12422 exit: true,
12423 onEnter: noop$1,
12424 onEntering: noop$1,
12425 onEntered: noop$1,
12426 onExit: noop$1,
12427 onExiting: noop$1,
12428 onExited: noop$1
12429 };
12430 Transition.UNMOUNTED = UNMOUNTED;
12431 Transition.EXITED = EXITED;
12432 Transition.ENTERING = ENTERING;
12433 Transition.ENTERED = ENTERED;
12434 Transition.EXITING = EXITING;
12435
12436 var _addClass = function addClass$1(node, classes) {
12437 return node && classes && classes.split(' ').forEach(function (c) {
12438 return addClass(node, c);
12439 });
12440 };
12441
12442 var removeClass = function removeClass(node, classes) {
12443 return node && classes && classes.split(' ').forEach(function (c) {
12444 return removeClass$1(node, c);
12445 });
12446 };
12447 /**
12448 * A transition component inspired by the excellent
12449 * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
12450 * use it if you're using CSS transitions or animations. It's built upon the
12451 * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
12452 * component, so it inherits all of its props.
12453 *
12454 * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
12455 * and `exit` states of the transition. The first class is applied and then a
12456 * second `*-active` class in order to activate the CSS transition. After the
12457 * transition, matching `*-done` class names are applied to persist the
12458 * transition state.
12459 *
12460 * ```jsx
12461 * function App() {
12462 * const [inProp, setInProp] = useState(false);
12463 * return (
12464 * <div>
12465 * <CSSTransition in={inProp} timeout={200} classNames="my-node">
12466 * <div>
12467 * {"I'll receive my-node-* classes"}
12468 * </div>
12469 * </CSSTransition>
12470 * <button type="button" onClick={() => setInProp(true)}>
12471 * Click to Enter
12472 * </button>
12473 * </div>
12474 * );
12475 * }
12476 * ```
12477 *
12478 * When the `in` prop is set to `true`, the child component will first receive
12479 * the class `example-enter`, then the `example-enter-active` will be added in
12480 * the next tick. `CSSTransition` [forces a
12481 * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
12482 * between before adding the `example-enter-active`. This is an important trick
12483 * because it allows us to transition between `example-enter` and
12484 * `example-enter-active` even though they were added immediately one after
12485 * another. Most notably, this is what makes it possible for us to animate
12486 * _appearance_.
12487 *
12488 * ```css
12489 * .my-node-enter {
12490 * opacity: 0;
12491 * }
12492 * .my-node-enter-active {
12493 * opacity: 1;
12494 * transition: opacity 200ms;
12495 * }
12496 * .my-node-exit {
12497 * opacity: 1;
12498 * }
12499 * .my-node-exit-active {
12500 * opacity: 0;
12501 * transition: opacity 200ms;
12502 * }
12503 * ```
12504 *
12505 * `*-active` classes represent which styles you want to animate **to**, so it's
12506 * important to add `transition` declaration only to them, otherwise transitions
12507 * might not behave as intended! This might not be obvious when the transitions
12508 * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
12509 * the example above (minus `transition`), but it becomes apparent in more
12510 * complex transitions.
12511 *
12512 * **Note**: If you're using the
12513 * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
12514 * prop, make sure to define styles for `.appear-*` classes as well.
12515 */
12516
12517
12518 var CSSTransition = /*#__PURE__*/function (_React$Component) {
12519 _inheritsLoose$1(CSSTransition, _React$Component);
12520
12521 function CSSTransition() {
12522 var _this;
12523
12524 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12525 args[_key] = arguments[_key];
12526 }
12527
12528 _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
12529 _this.appliedClasses = {
12530 appear: {},
12531 enter: {},
12532 exit: {}
12533 };
12534
12535 _this.onEnter = function (maybeNode, maybeAppearing) {
12536 var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),
12537 node = _this$resolveArgument[0],
12538 appearing = _this$resolveArgument[1];
12539
12540 _this.removeClasses(node, 'exit');
12541
12542 _this.addClass(node, appearing ? 'appear' : 'enter', 'base');
12543
12544 if (_this.props.onEnter) {
12545 _this.props.onEnter(maybeNode, maybeAppearing);
12546 }
12547 };
12548
12549 _this.onEntering = function (maybeNode, maybeAppearing) {
12550 var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),
12551 node = _this$resolveArgument2[0],
12552 appearing = _this$resolveArgument2[1];
12553
12554 var type = appearing ? 'appear' : 'enter';
12555
12556 _this.addClass(node, type, 'active');
12557
12558 if (_this.props.onEntering) {
12559 _this.props.onEntering(maybeNode, maybeAppearing);
12560 }
12561 };
12562
12563 _this.onEntered = function (maybeNode, maybeAppearing) {
12564 var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),
12565 node = _this$resolveArgument3[0],
12566 appearing = _this$resolveArgument3[1];
12567
12568 var type = appearing ? 'appear' : 'enter';
12569
12570 _this.removeClasses(node, type);
12571
12572 _this.addClass(node, type, 'done');
12573
12574 if (_this.props.onEntered) {
12575 _this.props.onEntered(maybeNode, maybeAppearing);
12576 }
12577 };
12578
12579 _this.onExit = function (maybeNode) {
12580 var _this$resolveArgument4 = _this.resolveArguments(maybeNode),
12581 node = _this$resolveArgument4[0];
12582
12583 _this.removeClasses(node, 'appear');
12584
12585 _this.removeClasses(node, 'enter');
12586
12587 _this.addClass(node, 'exit', 'base');
12588
12589 if (_this.props.onExit) {
12590 _this.props.onExit(maybeNode);
12591 }
12592 };
12593
12594 _this.onExiting = function (maybeNode) {
12595 var _this$resolveArgument5 = _this.resolveArguments(maybeNode),
12596 node = _this$resolveArgument5[0];
12597
12598 _this.addClass(node, 'exit', 'active');
12599
12600 if (_this.props.onExiting) {
12601 _this.props.onExiting(maybeNode);
12602 }
12603 };
12604
12605 _this.onExited = function (maybeNode) {
12606 var _this$resolveArgument6 = _this.resolveArguments(maybeNode),
12607 node = _this$resolveArgument6[0];
12608
12609 _this.removeClasses(node, 'exit');
12610
12611 _this.addClass(node, 'exit', 'done');
12612
12613 if (_this.props.onExited) {
12614 _this.props.onExited(maybeNode);
12615 }
12616 };
12617
12618 _this.resolveArguments = function (maybeNode, maybeAppearing) {
12619 return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`
12620 : [maybeNode, maybeAppearing];
12621 };
12622
12623 _this.getClassNames = function (type) {
12624 var classNames = _this.props.classNames;
12625 var isStringClassNames = typeof classNames === 'string';
12626 var prefix = isStringClassNames && classNames ? classNames + "-" : '';
12627 var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
12628 var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
12629 var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
12630 return {
12631 baseClassName: baseClassName,
12632 activeClassName: activeClassName,
12633 doneClassName: doneClassName
12634 };
12635 };
12636
12637 return _this;
12638 }
12639
12640 var _proto = CSSTransition.prototype;
12641
12642 _proto.addClass = function addClass(node, type, phase) {
12643 var className = this.getClassNames(type)[phase + "ClassName"];
12644
12645 var _this$getClassNames = this.getClassNames('enter'),
12646 doneClassName = _this$getClassNames.doneClassName;
12647
12648 if (type === 'appear' && phase === 'done' && doneClassName) {
12649 className += " " + doneClassName;
12650 } // This is for to force a repaint,
12651 // which is necessary in order to transition styles when adding a class name.
12652
12653
12654 if (phase === 'active') {
12655 /* eslint-disable no-unused-expressions */
12656 node && node.scrollTop;
12657 }
12658
12659 if (className) {
12660 this.appliedClasses[type][phase] = className;
12661
12662 _addClass(node, className);
12663 }
12664 };
12665
12666 _proto.removeClasses = function removeClasses(node, type) {
12667 var _this$appliedClasses$ = this.appliedClasses[type],
12668 baseClassName = _this$appliedClasses$.base,
12669 activeClassName = _this$appliedClasses$.active,
12670 doneClassName = _this$appliedClasses$.done;
12671 this.appliedClasses[type] = {};
12672
12673 if (baseClassName) {
12674 removeClass(node, baseClassName);
12675 }
12676
12677 if (activeClassName) {
12678 removeClass(node, activeClassName);
12679 }
12680
12681 if (doneClassName) {
12682 removeClass(node, doneClassName);
12683 }
12684 };
12685
12686 _proto.render = function render() {
12687 var _this$props = this.props;
12688 _this$props.classNames;
12689 var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
12690
12691 return /*#__PURE__*/React.createElement(Transition, _extends$3({}, props, {
12692 onEnter: this.onEnter,
12693 onEntered: this.onEntered,
12694 onEntering: this.onEntering,
12695 onExit: this.onExit,
12696 onExiting: this.onExiting,
12697 onExited: this.onExited
12698 }));
12699 };
12700
12701 return CSSTransition;
12702 }(React.Component);
12703
12704 CSSTransition.defaultProps = {
12705 classNames: ''
12706 };
12707 CSSTransition.propTypes = {};
12708
12709 function _assertThisInitialized$1(self) {
12710 if (self === void 0) {
12711 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12712 }
12713
12714 return self;
12715 }
12716
12717 /**
12718 * Given `this.props.children`, return an object mapping key to child.
12719 *
12720 * @param {*} children `this.props.children`
12721 * @return {object} Mapping of key to child
12722 */
12723
12724 function getChildMapping(children, mapFn) {
12725 var mapper = function mapper(child) {
12726 return mapFn && react.exports.isValidElement(child) ? mapFn(child) : child;
12727 };
12728
12729 var result = Object.create(null);
12730 if (children) react.exports.Children.map(children, function (c) {
12731 return c;
12732 }).forEach(function (child) {
12733 // run the map function here instead so that the key is the computed one
12734 result[child.key] = mapper(child);
12735 });
12736 return result;
12737 }
12738 /**
12739 * When you're adding or removing children some may be added or removed in the
12740 * same render pass. We want to show *both* since we want to simultaneously
12741 * animate elements in and out. This function takes a previous set of keys
12742 * and a new set of keys and merges them with its best guess of the correct
12743 * ordering. In the future we may expose some of the utilities in
12744 * ReactMultiChild to make this easy, but for now React itself does not
12745 * directly have this concept of the union of prevChildren and nextChildren
12746 * so we implement it here.
12747 *
12748 * @param {object} prev prev children as returned from
12749 * `ReactTransitionChildMapping.getChildMapping()`.
12750 * @param {object} next next children as returned from
12751 * `ReactTransitionChildMapping.getChildMapping()`.
12752 * @return {object} a key set that contains all keys in `prev` and all keys
12753 * in `next` in a reasonable order.
12754 */
12755
12756 function mergeChildMappings(prev, next) {
12757 prev = prev || {};
12758 next = next || {};
12759
12760 function getValueForKey(key) {
12761 return key in next ? next[key] : prev[key];
12762 } // For each key of `next`, the list of keys to insert before that key in
12763 // the combined list
12764
12765
12766 var nextKeysPending = Object.create(null);
12767 var pendingKeys = [];
12768
12769 for (var prevKey in prev) {
12770 if (prevKey in next) {
12771 if (pendingKeys.length) {
12772 nextKeysPending[prevKey] = pendingKeys;
12773 pendingKeys = [];
12774 }
12775 } else {
12776 pendingKeys.push(prevKey);
12777 }
12778 }
12779
12780 var i;
12781 var childMapping = {};
12782
12783 for (var nextKey in next) {
12784 if (nextKeysPending[nextKey]) {
12785 for (i = 0; i < nextKeysPending[nextKey].length; i++) {
12786 var pendingNextKey = nextKeysPending[nextKey][i];
12787 childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
12788 }
12789 }
12790
12791 childMapping[nextKey] = getValueForKey(nextKey);
12792 } // Finally, add the keys which didn't appear before any key in `next`
12793
12794
12795 for (i = 0; i < pendingKeys.length; i++) {
12796 childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
12797 }
12798
12799 return childMapping;
12800 }
12801
12802 function getProp(child, prop, props) {
12803 return props[prop] != null ? props[prop] : child.props[prop];
12804 }
12805
12806 function getInitialChildMapping(props, onExited) {
12807 return getChildMapping(props.children, function (child) {
12808 return react.exports.cloneElement(child, {
12809 onExited: onExited.bind(null, child),
12810 in: true,
12811 appear: getProp(child, 'appear', props),
12812 enter: getProp(child, 'enter', props),
12813 exit: getProp(child, 'exit', props)
12814 });
12815 });
12816 }
12817 function getNextChildMapping(nextProps, prevChildMapping, onExited) {
12818 var nextChildMapping = getChildMapping(nextProps.children);
12819 var children = mergeChildMappings(prevChildMapping, nextChildMapping);
12820 Object.keys(children).forEach(function (key) {
12821 var child = children[key];
12822 if (!react.exports.isValidElement(child)) return;
12823 var hasPrev = (key in prevChildMapping);
12824 var hasNext = (key in nextChildMapping);
12825 var prevChild = prevChildMapping[key];
12826 var isLeaving = react.exports.isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)
12827
12828 if (hasNext && (!hasPrev || isLeaving)) {
12829 // console.log('entering', key)
12830 children[key] = react.exports.cloneElement(child, {
12831 onExited: onExited.bind(null, child),
12832 in: true,
12833 exit: getProp(child, 'exit', nextProps),
12834 enter: getProp(child, 'enter', nextProps)
12835 });
12836 } else if (!hasNext && hasPrev && !isLeaving) {
12837 // item is old (exiting)
12838 // console.log('leaving', key)
12839 children[key] = react.exports.cloneElement(child, {
12840 in: false
12841 });
12842 } else if (hasNext && hasPrev && react.exports.isValidElement(prevChild)) {
12843 // item hasn't changed transition states
12844 // copy over the last transition props;
12845 // console.log('unchanged', key)
12846 children[key] = react.exports.cloneElement(child, {
12847 onExited: onExited.bind(null, child),
12848 in: prevChild.props.in,
12849 exit: getProp(child, 'exit', nextProps),
12850 enter: getProp(child, 'enter', nextProps)
12851 });
12852 }
12853 });
12854 return children;
12855 }
12856
12857 var values = Object.values || function (obj) {
12858 return Object.keys(obj).map(function (k) {
12859 return obj[k];
12860 });
12861 };
12862
12863 var defaultProps = {
12864 component: 'div',
12865 childFactory: function childFactory(child) {
12866 return child;
12867 }
12868 };
12869 /**
12870 * The `<TransitionGroup>` component manages a set of transition components
12871 * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
12872 * components, `<TransitionGroup>` is a state machine for managing the mounting
12873 * and unmounting of components over time.
12874 *
12875 * Consider the example below. As items are removed or added to the TodoList the
12876 * `in` prop is toggled automatically by the `<TransitionGroup>`.
12877 *
12878 * Note that `<TransitionGroup>` does not define any animation behavior!
12879 * Exactly _how_ a list item animates is up to the individual transition
12880 * component. This means you can mix and match animations across different list
12881 * items.
12882 */
12883
12884 var TransitionGroup = /*#__PURE__*/function (_React$Component) {
12885 _inheritsLoose$1(TransitionGroup, _React$Component);
12886
12887 function TransitionGroup(props, context) {
12888 var _this;
12889
12890 _this = _React$Component.call(this, props, context) || this;
12891
12892 var handleExited = _this.handleExited.bind(_assertThisInitialized$1(_this)); // Initial children should all be entering, dependent on appear
12893
12894
12895 _this.state = {
12896 contextValue: {
12897 isMounting: true
12898 },
12899 handleExited: handleExited,
12900 firstRender: true
12901 };
12902 return _this;
12903 }
12904
12905 var _proto = TransitionGroup.prototype;
12906
12907 _proto.componentDidMount = function componentDidMount() {
12908 this.mounted = true;
12909 this.setState({
12910 contextValue: {
12911 isMounting: false
12912 }
12913 });
12914 };
12915
12916 _proto.componentWillUnmount = function componentWillUnmount() {
12917 this.mounted = false;
12918 };
12919
12920 TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
12921 var prevChildMapping = _ref.children,
12922 handleExited = _ref.handleExited,
12923 firstRender = _ref.firstRender;
12924 return {
12925 children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
12926 firstRender: false
12927 };
12928 } // node is `undefined` when user provided `nodeRef` prop
12929 ;
12930
12931 _proto.handleExited = function handleExited(child, node) {
12932 var currentChildMapping = getChildMapping(this.props.children);
12933 if (child.key in currentChildMapping) return;
12934
12935 if (child.props.onExited) {
12936 child.props.onExited(node);
12937 }
12938
12939 if (this.mounted) {
12940 this.setState(function (state) {
12941 var children = _extends$3({}, state.children);
12942
12943 delete children[child.key];
12944 return {
12945 children: children
12946 };
12947 });
12948 }
12949 };
12950
12951 _proto.render = function render() {
12952 var _this$props = this.props,
12953 Component = _this$props.component,
12954 childFactory = _this$props.childFactory,
12955 props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
12956
12957 var contextValue = this.state.contextValue;
12958 var children = values(this.state.children).map(childFactory);
12959 delete props.appear;
12960 delete props.enter;
12961 delete props.exit;
12962
12963 if (Component === null) {
12964 return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {
12965 value: contextValue
12966 }, children);
12967 }
12968
12969 return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {
12970 value: contextValue
12971 }, /*#__PURE__*/React.createElement(Component, props, children));
12972 };
12973
12974 return TransitionGroup;
12975 }(React.Component);
12976
12977 TransitionGroup.propTypes = {};
12978 TransitionGroup.defaultProps = defaultProps;
12979
12980 /**
12981 * The `<ReplaceTransition>` component is a specialized `Transition` component
12982 * that animates between two children.
12983 *
12984 * ```jsx
12985 * <ReplaceTransition in>
12986 * <Fade><div>I appear first</div></Fade>
12987 * <Fade><div>I replace the above</div></Fade>
12988 * </ReplaceTransition>
12989 * ```
12990 */
12991
12992 var ReplaceTransition = /*#__PURE__*/function (_React$Component) {
12993 _inheritsLoose$1(ReplaceTransition, _React$Component);
12994
12995 function ReplaceTransition() {
12996 var _this;
12997
12998 for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
12999 _args[_key] = arguments[_key];
13000 }
13001
13002 _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
13003
13004 _this.handleEnter = function () {
13005 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
13006 args[_key2] = arguments[_key2];
13007 }
13008
13009 return _this.handleLifecycle('onEnter', 0, args);
13010 };
13011
13012 _this.handleEntering = function () {
13013 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
13014 args[_key3] = arguments[_key3];
13015 }
13016
13017 return _this.handleLifecycle('onEntering', 0, args);
13018 };
13019
13020 _this.handleEntered = function () {
13021 for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
13022 args[_key4] = arguments[_key4];
13023 }
13024
13025 return _this.handleLifecycle('onEntered', 0, args);
13026 };
13027
13028 _this.handleExit = function () {
13029 for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
13030 args[_key5] = arguments[_key5];
13031 }
13032
13033 return _this.handleLifecycle('onExit', 1, args);
13034 };
13035
13036 _this.handleExiting = function () {
13037 for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
13038 args[_key6] = arguments[_key6];
13039 }
13040
13041 return _this.handleLifecycle('onExiting', 1, args);
13042 };
13043
13044 _this.handleExited = function () {
13045 for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
13046 args[_key7] = arguments[_key7];
13047 }
13048
13049 return _this.handleLifecycle('onExited', 1, args);
13050 };
13051
13052 return _this;
13053 }
13054
13055 var _proto = ReplaceTransition.prototype;
13056
13057 _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
13058 var _child$props;
13059
13060 var children = this.props.children;
13061 var child = React.Children.toArray(children)[idx];
13062 if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
13063
13064 if (this.props[handler]) {
13065 var maybeNode = child.props.nodeRef ? undefined : ReactDOM.findDOMNode(this);
13066 this.props[handler](maybeNode);
13067 }
13068 };
13069
13070 _proto.render = function render() {
13071 var _this$props = this.props,
13072 children = _this$props.children,
13073 inProp = _this$props.in,
13074 props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
13075
13076 var _React$Children$toArr = React.Children.toArray(children),
13077 first = _React$Children$toArr[0],
13078 second = _React$Children$toArr[1];
13079
13080 delete props.onEnter;
13081 delete props.onEntering;
13082 delete props.onEntered;
13083 delete props.onExit;
13084 delete props.onExiting;
13085 delete props.onExited;
13086 return /*#__PURE__*/React.createElement(TransitionGroup, props, inProp ? React.cloneElement(first, {
13087 key: 'first',
13088 onEnter: this.handleEnter,
13089 onEntering: this.handleEntering,
13090 onEntered: this.handleEntered
13091 }) : React.cloneElement(second, {
13092 key: 'second',
13093 onEnter: this.handleExit,
13094 onEntering: this.handleExiting,
13095 onEntered: this.handleExited
13096 }));
13097 };
13098
13099 return ReplaceTransition;
13100 }(React.Component);
13101
13102 ReplaceTransition.propTypes = {};
13103
13104 var _leaveRenders, _enterRenders;
13105
13106 function areChildrenDifferent(oldChildren, newChildren) {
13107 if (oldChildren === newChildren) return false;
13108
13109 if (React.isValidElement(oldChildren) && React.isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) {
13110 return false;
13111 }
13112
13113 return true;
13114 }
13115 /**
13116 * Enum of modes for SwitchTransition component
13117 * @enum { string }
13118 */
13119
13120
13121 var modes = {
13122 out: 'out-in',
13123 in: 'in-out'
13124 };
13125
13126 var callHook = function callHook(element, name, cb) {
13127 return function () {
13128 var _element$props;
13129
13130 element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments);
13131 cb();
13132 };
13133 };
13134
13135 var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function (_ref) {
13136 var current = _ref.current,
13137 changeState = _ref.changeState;
13138 return React.cloneElement(current, {
13139 in: false,
13140 onExited: callHook(current, 'onExited', function () {
13141 changeState(ENTERING, null);
13142 })
13143 });
13144 }, _leaveRenders[modes.in] = function (_ref2) {
13145 var current = _ref2.current,
13146 changeState = _ref2.changeState,
13147 children = _ref2.children;
13148 return [current, React.cloneElement(children, {
13149 in: true,
13150 onEntered: callHook(children, 'onEntered', function () {
13151 changeState(ENTERING);
13152 })
13153 })];
13154 }, _leaveRenders);
13155 var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function (_ref3) {
13156 var children = _ref3.children,
13157 changeState = _ref3.changeState;
13158 return React.cloneElement(children, {
13159 in: true,
13160 onEntered: callHook(children, 'onEntered', function () {
13161 changeState(ENTERED, React.cloneElement(children, {
13162 in: true
13163 }));
13164 })
13165 });
13166 }, _enterRenders[modes.in] = function (_ref4) {
13167 var current = _ref4.current,
13168 children = _ref4.children,
13169 changeState = _ref4.changeState;
13170 return [React.cloneElement(current, {
13171 in: false,
13172 onExited: callHook(current, 'onExited', function () {
13173 changeState(ENTERED, React.cloneElement(children, {
13174 in: true
13175 }));
13176 })
13177 }), React.cloneElement(children, {
13178 in: true
13179 })];
13180 }, _enterRenders);
13181 /**
13182 * A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes).
13183 * You can use it when you want to control the render between state transitions.
13184 * Based on the selected mode and the child's key which is the `Transition` or `CSSTransition` component, the `SwitchTransition` makes a consistent transition between them.
13185 *
13186 * If the `out-in` mode is selected, the `SwitchTransition` waits until the old child leaves and then inserts a new child.
13187 * If the `in-out` mode is selected, the `SwitchTransition` inserts a new child first, waits for the new child to enter and then removes the old child.
13188 *
13189 * **Note**: If you want the animation to happen simultaneously
13190 * (that is, to have the old child removed and a new child inserted **at the same time**),
13191 * you should use
13192 * [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group)
13193 * instead.
13194 *
13195 * ```jsx
13196 * function App() {
13197 * const [state, setState] = useState(false);
13198 * return (
13199 * <SwitchTransition>
13200 * <CSSTransition
13201 * key={state ? "Goodbye, world!" : "Hello, world!"}
13202 * addEndListener={(node, done) => node.addEventListener("transitionend", done, false)}
13203 * classNames='fade'
13204 * >
13205 * <button onClick={() => setState(state => !state)}>
13206 * {state ? "Goodbye, world!" : "Hello, world!"}
13207 * </button>
13208 * </CSSTransition>
13209 * </SwitchTransition>
13210 * );
13211 * }
13212 * ```
13213 *
13214 * ```css
13215 * .fade-enter{
13216 * opacity: 0;
13217 * }
13218 * .fade-exit{
13219 * opacity: 1;
13220 * }
13221 * .fade-enter-active{
13222 * opacity: 1;
13223 * }
13224 * .fade-exit-active{
13225 * opacity: 0;
13226 * }
13227 * .fade-enter-active,
13228 * .fade-exit-active{
13229 * transition: opacity 500ms;
13230 * }
13231 * ```
13232 */
13233
13234 var SwitchTransition = /*#__PURE__*/function (_React$Component) {
13235 _inheritsLoose$1(SwitchTransition, _React$Component);
13236
13237 function SwitchTransition() {
13238 var _this;
13239
13240 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13241 args[_key] = arguments[_key];
13242 }
13243
13244 _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
13245 _this.state = {
13246 status: ENTERED,
13247 current: null
13248 };
13249 _this.appeared = false;
13250
13251 _this.changeState = function (status, current) {
13252 if (current === void 0) {
13253 current = _this.state.current;
13254 }
13255
13256 _this.setState({
13257 status: status,
13258 current: current
13259 });
13260 };
13261
13262 return _this;
13263 }
13264
13265 var _proto = SwitchTransition.prototype;
13266
13267 _proto.componentDidMount = function componentDidMount() {
13268 this.appeared = true;
13269 };
13270
13271 SwitchTransition.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
13272 if (props.children == null) {
13273 return {
13274 current: null
13275 };
13276 }
13277
13278 if (state.status === ENTERING && props.mode === modes.in) {
13279 return {
13280 status: ENTERING
13281 };
13282 }
13283
13284 if (state.current && areChildrenDifferent(state.current, props.children)) {
13285 return {
13286 status: EXITING
13287 };
13288 }
13289
13290 return {
13291 current: React.cloneElement(props.children, {
13292 in: true
13293 })
13294 };
13295 };
13296
13297 _proto.render = function render() {
13298 var _this$props = this.props,
13299 children = _this$props.children,
13300 mode = _this$props.mode,
13301 _this$state = this.state,
13302 status = _this$state.status,
13303 current = _this$state.current;
13304 var data = {
13305 children: children,
13306 current: current,
13307 changeState: this.changeState,
13308 status: status
13309 };
13310 var component;
13311
13312 switch (status) {
13313 case ENTERING:
13314 component = enterRenders[mode](data);
13315 break;
13316
13317 case EXITING:
13318 component = leaveRenders[mode](data);
13319 break;
13320
13321 case ENTERED:
13322 component = current;
13323 }
13324
13325 return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {
13326 value: {
13327 isMounting: !this.appeared
13328 }
13329 }, component);
13330 };
13331
13332 return SwitchTransition;
13333 }(React.Component);
13334
13335 SwitchTransition.propTypes = {};
13336 SwitchTransition.defaultProps = {
13337 mode: modes.out
13338 };
13339
13340 var reflow = function reflow(node) {
13341 return node.scrollTop;
13342 };
13343 function getTransitionProps(props, options) {
13344 var timeout = props.timeout,
13345 _props$style = props.style,
13346 style = _props$style === void 0 ? {} : _props$style;
13347 return {
13348 duration: style.transitionDuration || typeof timeout === 'number' ? timeout : timeout[options.mode] || 0,
13349 delay: style.transitionDelay
13350 };
13351 }
13352
13353 var styles$1Q = function styles(theme) {
13354 return {
13355 /* Styles applied to the root element. */
13356 root: {
13357 height: 0,
13358 overflow: 'hidden',
13359 transition: theme.transitions.create('height')
13360 },
13361
13362 /* Styles applied to the root element when the transition has entered. */
13363 entered: {
13364 height: 'auto',
13365 overflow: 'visible'
13366 },
13367
13368 /* Styles applied to the root element when the transition has exited and `collapsedSize` != 0px. */
13369 hidden: {
13370 visibility: 'hidden'
13371 },
13372
13373 /* Styles applied to the outer wrapper element. */
13374 wrapper: {
13375 // Hack to get children with a negative margin to not falsify the height computation.
13376 display: 'flex'
13377 },
13378
13379 /* Styles applied to the inner wrapper element. */
13380 wrapperInner: {
13381 width: '100%'
13382 }
13383 };
13384 };
13385 /**
13386 * The Collapse transition is used by the
13387 * [Vertical Stepper](/components/steppers/#vertical-stepper) StepContent component.
13388 * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
13389 */
13390
13391 var Collapse = /*#__PURE__*/react.exports.forwardRef(function Collapse(props, ref) {
13392 var children = props.children,
13393 classes = props.classes,
13394 className = props.className,
13395 collapsedHeight = props.collapsedHeight,
13396 _props$collapsedSize = props.collapsedSize,
13397 collapsedSizeProp = _props$collapsedSize === void 0 ? '0px' : _props$collapsedSize,
13398 _props$component = props.component,
13399 Component = _props$component === void 0 ? 'div' : _props$component,
13400 _props$disableStrictM = props.disableStrictModeCompat,
13401 disableStrictModeCompat = _props$disableStrictM === void 0 ? false : _props$disableStrictM,
13402 inProp = props.in,
13403 onEnter = props.onEnter,
13404 onEntered = props.onEntered,
13405 onEntering = props.onEntering,
13406 onExit = props.onExit,
13407 onExited = props.onExited,
13408 onExiting = props.onExiting,
13409 style = props.style,
13410 _props$timeout = props.timeout,
13411 timeout = _props$timeout === void 0 ? duration.standard : _props$timeout,
13412 _props$TransitionComp = props.TransitionComponent,
13413 TransitionComponent = _props$TransitionComp === void 0 ? Transition : _props$TransitionComp,
13414 other = _objectWithoutProperties(props, ["children", "classes", "className", "collapsedHeight", "collapsedSize", "component", "disableStrictModeCompat", "in", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "style", "timeout", "TransitionComponent"]);
13415
13416 var theme = useTheme$1();
13417 var timer = react.exports.useRef();
13418 var wrapperRef = react.exports.useRef(null);
13419 var autoTransitionDuration = react.exports.useRef();
13420 var collapsedSize = typeof (collapsedHeight || collapsedSizeProp) === 'number' ? "".concat(collapsedHeight || collapsedSizeProp, "px") : collapsedHeight || collapsedSizeProp;
13421 react.exports.useEffect(function () {
13422 return function () {
13423 clearTimeout(timer.current);
13424 };
13425 }, []);
13426 var enableStrictModeCompat = theme.unstable_strictMode && !disableStrictModeCompat;
13427 var nodeRef = react.exports.useRef(null);
13428 var handleRef = useForkRef(ref, enableStrictModeCompat ? nodeRef : undefined);
13429
13430 var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {
13431 return function (nodeOrAppearing, maybeAppearing) {
13432 if (callback) {
13433 var _ref = enableStrictModeCompat ? [nodeRef.current, nodeOrAppearing] : [nodeOrAppearing, maybeAppearing],
13434 _ref2 = _slicedToArray(_ref, 2),
13435 node = _ref2[0],
13436 isAppearing = _ref2[1]; // onEnterXxx and onExitXxx callbacks have a different arguments.length value.
13437
13438
13439 if (isAppearing === undefined) {
13440 callback(node);
13441 } else {
13442 callback(node, isAppearing);
13443 }
13444 }
13445 };
13446 };
13447
13448 var handleEnter = normalizedTransitionCallback(function (node, isAppearing) {
13449 node.style.height = collapsedSize;
13450
13451 if (onEnter) {
13452 onEnter(node, isAppearing);
13453 }
13454 });
13455 var handleEntering = normalizedTransitionCallback(function (node, isAppearing) {
13456 var wrapperHeight = wrapperRef.current ? wrapperRef.current.clientHeight : 0;
13457
13458 var _getTransitionProps = getTransitionProps({
13459 style: style,
13460 timeout: timeout
13461 }, {
13462 mode: 'enter'
13463 }),
13464 transitionDuration = _getTransitionProps.duration;
13465
13466 if (timeout === 'auto') {
13467 var duration2 = theme.transitions.getAutoHeightDuration(wrapperHeight);
13468 node.style.transitionDuration = "".concat(duration2, "ms");
13469 autoTransitionDuration.current = duration2;
13470 } else {
13471 node.style.transitionDuration = typeof transitionDuration === 'string' ? transitionDuration : "".concat(transitionDuration, "ms");
13472 }
13473
13474 node.style.height = "".concat(wrapperHeight, "px");
13475
13476 if (onEntering) {
13477 onEntering(node, isAppearing);
13478 }
13479 });
13480 var handleEntered = normalizedTransitionCallback(function (node, isAppearing) {
13481 node.style.height = 'auto';
13482
13483 if (onEntered) {
13484 onEntered(node, isAppearing);
13485 }
13486 });
13487 var handleExit = normalizedTransitionCallback(function (node) {
13488 var wrapperHeight = wrapperRef.current ? wrapperRef.current.clientHeight : 0;
13489 node.style.height = "".concat(wrapperHeight, "px");
13490
13491 if (onExit) {
13492 onExit(node);
13493 }
13494 });
13495 var handleExited = normalizedTransitionCallback(onExited);
13496 var handleExiting = normalizedTransitionCallback(function (node) {
13497 var wrapperHeight = wrapperRef.current ? wrapperRef.current.clientHeight : 0;
13498
13499 var _getTransitionProps2 = getTransitionProps({
13500 style: style,
13501 timeout: timeout
13502 }, {
13503 mode: 'exit'
13504 }),
13505 transitionDuration = _getTransitionProps2.duration;
13506
13507 if (timeout === 'auto') {
13508 var duration2 = theme.transitions.getAutoHeightDuration(wrapperHeight);
13509 node.style.transitionDuration = "".concat(duration2, "ms");
13510 autoTransitionDuration.current = duration2;
13511 } else {
13512 node.style.transitionDuration = typeof transitionDuration === 'string' ? transitionDuration : "".concat(transitionDuration, "ms");
13513 }
13514
13515 node.style.height = collapsedSize;
13516
13517 if (onExiting) {
13518 onExiting(node);
13519 }
13520 });
13521
13522 var addEndListener = function addEndListener(nodeOrNext, maybeNext) {
13523 var next = enableStrictModeCompat ? nodeOrNext : maybeNext;
13524
13525 if (timeout === 'auto') {
13526 timer.current = setTimeout(next, autoTransitionDuration.current || 0);
13527 }
13528 };
13529
13530 return /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
13531 in: inProp,
13532 onEnter: handleEnter,
13533 onEntered: handleEntered,
13534 onEntering: handleEntering,
13535 onExit: handleExit,
13536 onExited: handleExited,
13537 onExiting: handleExiting,
13538 addEndListener: addEndListener,
13539 nodeRef: enableStrictModeCompat ? nodeRef : undefined,
13540 timeout: timeout === 'auto' ? null : timeout
13541 }, other), function (state, childProps) {
13542 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
13543 className: clsx(classes.root, classes.container, className, {
13544 'entered': classes.entered,
13545 'exited': !inProp && collapsedSize === '0px' && classes.hidden
13546 }[state]),
13547 style: _extends$5({
13548 minHeight: collapsedSize
13549 }, style),
13550 ref: handleRef
13551 }, childProps), /*#__PURE__*/react.exports.createElement("div", {
13552 className: classes.wrapper,
13553 ref: wrapperRef
13554 }, /*#__PURE__*/react.exports.createElement("div", {
13555 className: classes.wrapperInner
13556 }, children)));
13557 });
13558 });
13559 Collapse.muiSupportAuto = true;
13560 var Collapse$1 = withStyles(styles$1Q, {
13561 name: 'MuiCollapse'
13562 })(Collapse);
13563
13564 var styles$1P = function styles(theme) {
13565 var elevations = {};
13566 theme.shadows.forEach(function (shadow, index) {
13567 elevations["elevation".concat(index)] = {
13568 boxShadow: shadow
13569 };
13570 });
13571 return _extends$5({
13572 /* Styles applied to the root element. */
13573 root: {
13574 backgroundColor: theme.palette.background.paper,
13575 color: theme.palette.text.primary,
13576 transition: theme.transitions.create('box-shadow')
13577 },
13578
13579 /* Styles applied to the root element if `square={false}`. */
13580 rounded: {
13581 borderRadius: theme.shape.borderRadius
13582 },
13583
13584 /* Styles applied to the root element if `variant="outlined"`. */
13585 outlined: {
13586 border: "1px solid ".concat(theme.palette.divider)
13587 }
13588 }, elevations);
13589 };
13590 var Paper = /*#__PURE__*/react.exports.forwardRef(function Paper(props, ref) {
13591 var classes = props.classes,
13592 className = props.className,
13593 _props$component = props.component,
13594 Component = _props$component === void 0 ? 'div' : _props$component,
13595 _props$square = props.square,
13596 square = _props$square === void 0 ? false : _props$square,
13597 _props$elevation = props.elevation,
13598 elevation = _props$elevation === void 0 ? 1 : _props$elevation,
13599 _props$variant = props.variant,
13600 variant = _props$variant === void 0 ? 'elevation' : _props$variant,
13601 other = _objectWithoutProperties(props, ["classes", "className", "component", "square", "elevation", "variant"]);
13602
13603 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
13604 className: clsx(classes.root, className, variant === 'outlined' ? classes.outlined : classes["elevation".concat(elevation)], !square && classes.rounded),
13605 ref: ref
13606 }, other));
13607 });
13608 var Paper$1 = withStyles(styles$1P, {
13609 name: 'MuiPaper'
13610 })(Paper);
13611
13612 /**
13613 * @ignore - internal component.
13614 * @type {React.Context<{} | {expanded: boolean, disabled: boolean, toggle: () => void}>}
13615 */
13616
13617 var AccordionContext = react.exports.createContext({});
13618
13619 var styles$1O = function styles(theme) {
13620 var transition = {
13621 duration: theme.transitions.duration.shortest
13622 };
13623 return {
13624 /* Styles applied to the root element. */
13625 root: {
13626 position: 'relative',
13627 transition: theme.transitions.create(['margin'], transition),
13628 '&:before': {
13629 position: 'absolute',
13630 left: 0,
13631 top: -1,
13632 right: 0,
13633 height: 1,
13634 content: '""',
13635 opacity: 1,
13636 backgroundColor: theme.palette.divider,
13637 transition: theme.transitions.create(['opacity', 'background-color'], transition)
13638 },
13639 '&:first-child': {
13640 '&:before': {
13641 display: 'none'
13642 }
13643 },
13644 '&$expanded': {
13645 margin: '16px 0',
13646 '&:first-child': {
13647 marginTop: 0
13648 },
13649 '&:last-child': {
13650 marginBottom: 0
13651 },
13652 '&:before': {
13653 opacity: 0
13654 }
13655 },
13656 '&$expanded + &': {
13657 '&:before': {
13658 display: 'none'
13659 }
13660 },
13661 '&$disabled': {
13662 backgroundColor: theme.palette.action.disabledBackground
13663 }
13664 },
13665
13666 /* Styles applied to the root element if `square={false}`. */
13667 rounded: {
13668 borderRadius: 0,
13669 '&:first-child': {
13670 borderTopLeftRadius: theme.shape.borderRadius,
13671 borderTopRightRadius: theme.shape.borderRadius
13672 },
13673 '&:last-child': {
13674 borderBottomLeftRadius: theme.shape.borderRadius,
13675 borderBottomRightRadius: theme.shape.borderRadius,
13676 // Fix a rendering issue on Edge
13677 '@supports (-ms-ime-align: auto)': {
13678 borderBottomLeftRadius: 0,
13679 borderBottomRightRadius: 0
13680 }
13681 }
13682 },
13683
13684 /* Styles applied to the root element if `expanded={true}`. */
13685 expanded: {},
13686
13687 /* Styles applied to the root element if `disabled={true}`. */
13688 disabled: {}
13689 };
13690 };
13691 var Accordion = /*#__PURE__*/react.exports.forwardRef(function Accordion(props, ref) {
13692 var childrenProp = props.children,
13693 classes = props.classes,
13694 className = props.className,
13695 _props$defaultExpande = props.defaultExpanded,
13696 defaultExpanded = _props$defaultExpande === void 0 ? false : _props$defaultExpande,
13697 _props$disabled = props.disabled,
13698 disabled = _props$disabled === void 0 ? false : _props$disabled,
13699 expandedProp = props.expanded,
13700 onChange = props.onChange,
13701 _props$square = props.square,
13702 square = _props$square === void 0 ? false : _props$square,
13703 _props$TransitionComp = props.TransitionComponent,
13704 TransitionComponent = _props$TransitionComp === void 0 ? Collapse$1 : _props$TransitionComp,
13705 TransitionProps = props.TransitionProps,
13706 other = _objectWithoutProperties(props, ["children", "classes", "className", "defaultExpanded", "disabled", "expanded", "onChange", "square", "TransitionComponent", "TransitionProps"]);
13707
13708 var _useControlled = useControlled({
13709 controlled: expandedProp,
13710 default: defaultExpanded,
13711 name: 'Accordion',
13712 state: 'expanded'
13713 }),
13714 _useControlled2 = _slicedToArray(_useControlled, 2),
13715 expanded = _useControlled2[0],
13716 setExpandedState = _useControlled2[1];
13717
13718 var handleChange = react.exports.useCallback(function (event) {
13719 setExpandedState(!expanded);
13720
13721 if (onChange) {
13722 onChange(event, !expanded);
13723 }
13724 }, [expanded, onChange, setExpandedState]);
13725
13726 var _React$Children$toArr = react.exports.Children.toArray(childrenProp),
13727 _React$Children$toArr2 = _toArray(_React$Children$toArr),
13728 summary = _React$Children$toArr2[0],
13729 children = _React$Children$toArr2.slice(1);
13730
13731 var contextValue = react.exports.useMemo(function () {
13732 return {
13733 expanded: expanded,
13734 disabled: disabled,
13735 toggle: handleChange
13736 };
13737 }, [expanded, disabled, handleChange]);
13738 return /*#__PURE__*/react.exports.createElement(Paper$1, _extends$5({
13739 className: clsx(classes.root, className, expanded && classes.expanded, disabled && classes.disabled, !square && classes.rounded),
13740 ref: ref,
13741 square: square
13742 }, other), /*#__PURE__*/react.exports.createElement(AccordionContext.Provider, {
13743 value: contextValue
13744 }, summary), /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
13745 in: expanded,
13746 timeout: "auto"
13747 }, TransitionProps), /*#__PURE__*/react.exports.createElement("div", {
13748 "aria-labelledby": summary.props.id,
13749 id: summary.props['aria-controls'],
13750 role: "region"
13751 }, children)));
13752 });
13753 withStyles(styles$1O, {
13754 name: 'MuiAccordion'
13755 })(Accordion);
13756
13757 var styles$1N = {
13758 /* Styles applied to the root element. */
13759 root: {
13760 display: 'flex',
13761 alignItems: 'center',
13762 padding: 8,
13763 justifyContent: 'flex-end'
13764 },
13765
13766 /* Styles applied to the root element if `disableSpacing={false}`. */
13767 spacing: {
13768 '& > :not(:first-child)': {
13769 marginLeft: 8
13770 }
13771 }
13772 };
13773 var AccordionActions = /*#__PURE__*/react.exports.forwardRef(function AccordionActions(props, ref) {
13774 var classes = props.classes,
13775 className = props.className,
13776 _props$disableSpacing = props.disableSpacing,
13777 disableSpacing = _props$disableSpacing === void 0 ? false : _props$disableSpacing,
13778 other = _objectWithoutProperties(props, ["classes", "className", "disableSpacing"]);
13779
13780 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
13781 className: clsx(classes.root, className, !disableSpacing && classes.spacing),
13782 ref: ref
13783 }, other));
13784 });
13785 withStyles(styles$1N, {
13786 name: 'MuiAccordionActions'
13787 })(AccordionActions);
13788
13789 var styles$1M = function styles(theme) {
13790 return {
13791 /* Styles applied to the root element. */
13792 root: {
13793 display: 'flex',
13794 padding: theme.spacing(1, 2, 2)
13795 }
13796 };
13797 };
13798 var AccordionDetails = /*#__PURE__*/react.exports.forwardRef(function AccordionDetails(props, ref) {
13799 var classes = props.classes,
13800 className = props.className,
13801 other = _objectWithoutProperties(props, ["classes", "className"]);
13802
13803 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
13804 className: clsx(classes.root, className),
13805 ref: ref
13806 }, other));
13807 });
13808 withStyles(styles$1M, {
13809 name: 'MuiAccordionDetails'
13810 })(AccordionDetails);
13811
13812 function _arrayWithoutHoles(arr) {
13813 if (Array.isArray(arr)) {
13814 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
13815 arr2[i] = arr[i];
13816 }
13817
13818 return arr2;
13819 }
13820 }
13821
13822 function _nonIterableSpread() {
13823 throw new TypeError("Invalid attempt to spread non-iterable instance");
13824 }
13825
13826 function _toConsumableArray(arr) {
13827 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
13828 }
13829
13830 var useEnhancedEffect$7 = typeof window === 'undefined' ? react.exports.useEffect : react.exports.useLayoutEffect;
13831 /**
13832 * @ignore - internal component.
13833 */
13834
13835 function Ripple(props) {
13836 var classes = props.classes,
13837 _props$pulsate = props.pulsate,
13838 pulsate = _props$pulsate === void 0 ? false : _props$pulsate,
13839 rippleX = props.rippleX,
13840 rippleY = props.rippleY,
13841 rippleSize = props.rippleSize,
13842 inProp = props.in,
13843 _props$onExited = props.onExited,
13844 onExited = _props$onExited === void 0 ? function () {} : _props$onExited,
13845 timeout = props.timeout;
13846
13847 var _React$useState = react.exports.useState(false),
13848 leaving = _React$useState[0],
13849 setLeaving = _React$useState[1];
13850
13851 var rippleClassName = clsx(classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
13852 var rippleStyles = {
13853 width: rippleSize,
13854 height: rippleSize,
13855 top: -(rippleSize / 2) + rippleY,
13856 left: -(rippleSize / 2) + rippleX
13857 };
13858 var childClassName = clsx(classes.child, leaving && classes.childLeaving, pulsate && classes.childPulsate);
13859 var handleExited = useEventCallback(onExited); // Ripple is used for user feedback (e.g. click or press) so we want to apply styles with the highest priority
13860
13861 useEnhancedEffect$7(function () {
13862 if (!inProp) {
13863 // react-transition-group#onExit
13864 setLeaving(true); // react-transition-group#onExited
13865
13866 var timeoutId = setTimeout(handleExited, timeout);
13867 return function () {
13868 clearTimeout(timeoutId);
13869 };
13870 }
13871
13872 return undefined;
13873 }, [handleExited, inProp, timeout]);
13874 return /*#__PURE__*/react.exports.createElement("span", {
13875 className: rippleClassName,
13876 style: rippleStyles
13877 }, /*#__PURE__*/react.exports.createElement("span", {
13878 className: childClassName
13879 }));
13880 }
13881
13882 var DURATION = 550;
13883 var DELAY_RIPPLE = 80;
13884 var styles$1L = function styles(theme) {
13885 return {
13886 /* Styles applied to the root element. */
13887 root: {
13888 overflow: 'hidden',
13889 pointerEvents: 'none',
13890 position: 'absolute',
13891 zIndex: 0,
13892 top: 0,
13893 right: 0,
13894 bottom: 0,
13895 left: 0,
13896 borderRadius: 'inherit'
13897 },
13898
13899 /* Styles applied to the internal `Ripple` components `ripple` class. */
13900 ripple: {
13901 opacity: 0,
13902 position: 'absolute'
13903 },
13904
13905 /* Styles applied to the internal `Ripple` components `rippleVisible` class. */
13906 rippleVisible: {
13907 opacity: 0.3,
13908 transform: 'scale(1)',
13909 animation: "$enter ".concat(DURATION, "ms ").concat(theme.transitions.easing.easeInOut)
13910 },
13911
13912 /* Styles applied to the internal `Ripple` components `ripplePulsate` class. */
13913 ripplePulsate: {
13914 animationDuration: "".concat(theme.transitions.duration.shorter, "ms")
13915 },
13916
13917 /* Styles applied to the internal `Ripple` components `child` class. */
13918 child: {
13919 opacity: 1,
13920 display: 'block',
13921 width: '100%',
13922 height: '100%',
13923 borderRadius: '50%',
13924 backgroundColor: 'currentColor'
13925 },
13926
13927 /* Styles applied to the internal `Ripple` components `childLeaving` class. */
13928 childLeaving: {
13929 opacity: 0,
13930 animation: "$exit ".concat(DURATION, "ms ").concat(theme.transitions.easing.easeInOut)
13931 },
13932
13933 /* Styles applied to the internal `Ripple` components `childPulsate` class. */
13934 childPulsate: {
13935 position: 'absolute',
13936 left: 0,
13937 top: 0,
13938 animation: "$pulsate 2500ms ".concat(theme.transitions.easing.easeInOut, " 200ms infinite")
13939 },
13940 '@keyframes enter': {
13941 '0%': {
13942 transform: 'scale(0)',
13943 opacity: 0.1
13944 },
13945 '100%': {
13946 transform: 'scale(1)',
13947 opacity: 0.3
13948 }
13949 },
13950 '@keyframes exit': {
13951 '0%': {
13952 opacity: 1
13953 },
13954 '100%': {
13955 opacity: 0
13956 }
13957 },
13958 '@keyframes pulsate': {
13959 '0%': {
13960 transform: 'scale(1)'
13961 },
13962 '50%': {
13963 transform: 'scale(0.92)'
13964 },
13965 '100%': {
13966 transform: 'scale(1)'
13967 }
13968 }
13969 };
13970 };
13971 /**
13972 * @ignore - internal component.
13973 *
13974 * TODO v5: Make private
13975 */
13976
13977 var TouchRipple = /*#__PURE__*/react.exports.forwardRef(function TouchRipple(props, ref) {
13978 var _props$center = props.center,
13979 centerProp = _props$center === void 0 ? false : _props$center,
13980 classes = props.classes,
13981 className = props.className,
13982 other = _objectWithoutProperties(props, ["center", "classes", "className"]);
13983
13984 var _React$useState = react.exports.useState([]),
13985 ripples = _React$useState[0],
13986 setRipples = _React$useState[1];
13987
13988 var nextKey = react.exports.useRef(0);
13989 var rippleCallback = react.exports.useRef(null);
13990 react.exports.useEffect(function () {
13991 if (rippleCallback.current) {
13992 rippleCallback.current();
13993 rippleCallback.current = null;
13994 }
13995 }, [ripples]); // Used to filter out mouse emulated events on mobile.
13996
13997 var ignoringMouseDown = react.exports.useRef(false); // We use a timer in order to only show the ripples for touch "click" like events.
13998 // We don't want to display the ripple for touch scroll events.
13999
14000 var startTimer = react.exports.useRef(null); // This is the hook called once the previous timeout is ready.
14001
14002 var startTimerCommit = react.exports.useRef(null);
14003 var container = react.exports.useRef(null);
14004 react.exports.useEffect(function () {
14005 return function () {
14006 clearTimeout(startTimer.current);
14007 };
14008 }, []);
14009 var startCommit = react.exports.useCallback(function (params) {
14010 var pulsate = params.pulsate,
14011 rippleX = params.rippleX,
14012 rippleY = params.rippleY,
14013 rippleSize = params.rippleSize,
14014 cb = params.cb;
14015 setRipples(function (oldRipples) {
14016 return [].concat(_toConsumableArray(oldRipples), [/*#__PURE__*/react.exports.createElement(Ripple, {
14017 key: nextKey.current,
14018 classes: classes,
14019 timeout: DURATION,
14020 pulsate: pulsate,
14021 rippleX: rippleX,
14022 rippleY: rippleY,
14023 rippleSize: rippleSize
14024 })]);
14025 });
14026 nextKey.current += 1;
14027 rippleCallback.current = cb;
14028 }, [classes]);
14029 var start = react.exports.useCallback(function () {
14030 var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14031 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
14032 var cb = arguments.length > 2 ? arguments[2] : undefined;
14033 var _options$pulsate = options.pulsate,
14034 pulsate = _options$pulsate === void 0 ? false : _options$pulsate,
14035 _options$center = options.center,
14036 center = _options$center === void 0 ? centerProp || options.pulsate : _options$center,
14037 _options$fakeElement = options.fakeElement,
14038 fakeElement = _options$fakeElement === void 0 ? false : _options$fakeElement;
14039
14040 if (event.type === 'mousedown' && ignoringMouseDown.current) {
14041 ignoringMouseDown.current = false;
14042 return;
14043 }
14044
14045 if (event.type === 'touchstart') {
14046 ignoringMouseDown.current = true;
14047 }
14048
14049 var element = fakeElement ? null : container.current;
14050 var rect = element ? element.getBoundingClientRect() : {
14051 width: 0,
14052 height: 0,
14053 left: 0,
14054 top: 0
14055 }; // Get the size of the ripple
14056
14057 var rippleX;
14058 var rippleY;
14059 var rippleSize;
14060
14061 if (center || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {
14062 rippleX = Math.round(rect.width / 2);
14063 rippleY = Math.round(rect.height / 2);
14064 } else {
14065 var _ref = event.touches ? event.touches[0] : event,
14066 clientX = _ref.clientX,
14067 clientY = _ref.clientY;
14068
14069 rippleX = Math.round(clientX - rect.left);
14070 rippleY = Math.round(clientY - rect.top);
14071 }
14072
14073 if (center) {
14074 rippleSize = Math.sqrt((2 * Math.pow(rect.width, 2) + Math.pow(rect.height, 2)) / 3); // For some reason the animation is broken on Mobile Chrome if the size if even.
14075
14076 if (rippleSize % 2 === 0) {
14077 rippleSize += 1;
14078 }
14079 } else {
14080 var sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
14081 var sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
14082 rippleSize = Math.sqrt(Math.pow(sizeX, 2) + Math.pow(sizeY, 2));
14083 } // Touche devices
14084
14085
14086 if (event.touches) {
14087 // check that this isn't another touchstart due to multitouch
14088 // otherwise we will only clear a single timer when unmounting while two
14089 // are running
14090 if (startTimerCommit.current === null) {
14091 // Prepare the ripple effect.
14092 startTimerCommit.current = function () {
14093 startCommit({
14094 pulsate: pulsate,
14095 rippleX: rippleX,
14096 rippleY: rippleY,
14097 rippleSize: rippleSize,
14098 cb: cb
14099 });
14100 }; // Delay the execution of the ripple effect.
14101
14102
14103 startTimer.current = setTimeout(function () {
14104 if (startTimerCommit.current) {
14105 startTimerCommit.current();
14106 startTimerCommit.current = null;
14107 }
14108 }, DELAY_RIPPLE); // We have to make a tradeoff with this value.
14109 }
14110 } else {
14111 startCommit({
14112 pulsate: pulsate,
14113 rippleX: rippleX,
14114 rippleY: rippleY,
14115 rippleSize: rippleSize,
14116 cb: cb
14117 });
14118 }
14119 }, [centerProp, startCommit]);
14120 var pulsate = react.exports.useCallback(function () {
14121 start({}, {
14122 pulsate: true
14123 });
14124 }, [start]);
14125 var stop = react.exports.useCallback(function (event, cb) {
14126 clearTimeout(startTimer.current); // The touch interaction occurs too quickly.
14127 // We still want to show ripple effect.
14128
14129 if (event.type === 'touchend' && startTimerCommit.current) {
14130 event.persist();
14131 startTimerCommit.current();
14132 startTimerCommit.current = null;
14133 startTimer.current = setTimeout(function () {
14134 stop(event, cb);
14135 });
14136 return;
14137 }
14138
14139 startTimerCommit.current = null;
14140 setRipples(function (oldRipples) {
14141 if (oldRipples.length > 0) {
14142 return oldRipples.slice(1);
14143 }
14144
14145 return oldRipples;
14146 });
14147 rippleCallback.current = cb;
14148 }, []);
14149 react.exports.useImperativeHandle(ref, function () {
14150 return {
14151 pulsate: pulsate,
14152 start: start,
14153 stop: stop
14154 };
14155 }, [pulsate, start, stop]);
14156 return /*#__PURE__*/react.exports.createElement("span", _extends$5({
14157 className: clsx(classes.root, className),
14158 ref: container
14159 }, other), /*#__PURE__*/react.exports.createElement(TransitionGroup, {
14160 component: null,
14161 exit: true
14162 }, ripples));
14163 });
14164 var TouchRipple$1 = withStyles(styles$1L, {
14165 flip: false,
14166 name: 'MuiTouchRipple'
14167 })( /*#__PURE__*/react.exports.memo(TouchRipple));
14168
14169 var styles$1K = {
14170 /* Styles applied to the root element. */
14171 root: {
14172 display: 'inline-flex',
14173 alignItems: 'center',
14174 justifyContent: 'center',
14175 position: 'relative',
14176 WebkitTapHighlightColor: 'transparent',
14177 backgroundColor: 'transparent',
14178 // Reset default value
14179 // We disable the focus ring for mouse, touch and keyboard users.
14180 outline: 0,
14181 border: 0,
14182 margin: 0,
14183 // Remove the margin in Safari
14184 borderRadius: 0,
14185 padding: 0,
14186 // Remove the padding in Firefox
14187 cursor: 'pointer',
14188 userSelect: 'none',
14189 verticalAlign: 'middle',
14190 '-moz-appearance': 'none',
14191 // Reset
14192 '-webkit-appearance': 'none',
14193 // Reset
14194 textDecoration: 'none',
14195 // So we take precedent over the style of a native <a /> element.
14196 color: 'inherit',
14197 '&::-moz-focus-inner': {
14198 borderStyle: 'none' // Remove Firefox dotted outline.
14199
14200 },
14201 '&$disabled': {
14202 pointerEvents: 'none',
14203 // Disable link interactions
14204 cursor: 'default'
14205 },
14206 '@media print': {
14207 colorAdjust: 'exact'
14208 }
14209 },
14210
14211 /* Pseudo-class applied to the root element if `disabled={true}`. */
14212 disabled: {},
14213
14214 /* Pseudo-class applied to the root element if keyboard focused. */
14215 focusVisible: {}
14216 };
14217 /**
14218 * `ButtonBase` contains as few styles as possible.
14219 * It aims to be a simple building block for creating a button.
14220 * It contains a load of style reset and some focus/ripple logic.
14221 */
14222
14223 var ButtonBase = /*#__PURE__*/react.exports.forwardRef(function ButtonBase(props, ref) {
14224 var action = props.action,
14225 buttonRefProp = props.buttonRef,
14226 _props$centerRipple = props.centerRipple,
14227 centerRipple = _props$centerRipple === void 0 ? false : _props$centerRipple,
14228 children = props.children,
14229 classes = props.classes,
14230 className = props.className,
14231 _props$component = props.component,
14232 component = _props$component === void 0 ? 'button' : _props$component,
14233 _props$disabled = props.disabled,
14234 disabled = _props$disabled === void 0 ? false : _props$disabled,
14235 _props$disableRipple = props.disableRipple,
14236 disableRipple = _props$disableRipple === void 0 ? false : _props$disableRipple,
14237 _props$disableTouchRi = props.disableTouchRipple,
14238 disableTouchRipple = _props$disableTouchRi === void 0 ? false : _props$disableTouchRi,
14239 _props$focusRipple = props.focusRipple,
14240 focusRipple = _props$focusRipple === void 0 ? false : _props$focusRipple,
14241 focusVisibleClassName = props.focusVisibleClassName,
14242 onBlur = props.onBlur,
14243 onClick = props.onClick,
14244 onFocus = props.onFocus,
14245 onFocusVisible = props.onFocusVisible,
14246 onKeyDown = props.onKeyDown,
14247 onKeyUp = props.onKeyUp,
14248 onMouseDown = props.onMouseDown,
14249 onMouseLeave = props.onMouseLeave,
14250 onMouseUp = props.onMouseUp,
14251 onTouchEnd = props.onTouchEnd,
14252 onTouchMove = props.onTouchMove,
14253 onTouchStart = props.onTouchStart,
14254 onDragLeave = props.onDragLeave,
14255 _props$tabIndex = props.tabIndex,
14256 tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
14257 TouchRippleProps = props.TouchRippleProps,
14258 _props$type = props.type,
14259 type = _props$type === void 0 ? 'button' : _props$type,
14260 other = _objectWithoutProperties(props, ["action", "buttonRef", "centerRipple", "children", "classes", "className", "component", "disabled", "disableRipple", "disableTouchRipple", "focusRipple", "focusVisibleClassName", "onBlur", "onClick", "onFocus", "onFocusVisible", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseLeave", "onMouseUp", "onTouchEnd", "onTouchMove", "onTouchStart", "onDragLeave", "tabIndex", "TouchRippleProps", "type"]);
14261
14262 var buttonRef = react.exports.useRef(null);
14263
14264 function getButtonNode() {
14265 // #StrictMode ready
14266 return reactDom.exports.findDOMNode(buttonRef.current);
14267 }
14268
14269 var rippleRef = react.exports.useRef(null);
14270
14271 var _React$useState = react.exports.useState(false),
14272 focusVisible = _React$useState[0],
14273 setFocusVisible = _React$useState[1];
14274
14275 if (disabled && focusVisible) {
14276 setFocusVisible(false);
14277 }
14278
14279 var _useIsFocusVisible = useIsFocusVisible(),
14280 isFocusVisible = _useIsFocusVisible.isFocusVisible,
14281 onBlurVisible = _useIsFocusVisible.onBlurVisible,
14282 focusVisibleRef = _useIsFocusVisible.ref;
14283
14284 react.exports.useImperativeHandle(action, function () {
14285 return {
14286 focusVisible: function focusVisible() {
14287 setFocusVisible(true);
14288 buttonRef.current.focus();
14289 }
14290 };
14291 }, []);
14292 react.exports.useEffect(function () {
14293 if (focusVisible && focusRipple && !disableRipple) {
14294 rippleRef.current.pulsate();
14295 }
14296 }, [disableRipple, focusRipple, focusVisible]);
14297
14298 function useRippleHandler(rippleAction, eventCallback) {
14299 var skipRippleAction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : disableTouchRipple;
14300 return useEventCallback(function (event) {
14301 if (eventCallback) {
14302 eventCallback(event);
14303 }
14304
14305 var ignore = skipRippleAction;
14306
14307 if (!ignore && rippleRef.current) {
14308 rippleRef.current[rippleAction](event);
14309 }
14310
14311 return true;
14312 });
14313 }
14314
14315 var handleMouseDown = useRippleHandler('start', onMouseDown);
14316 var handleDragLeave = useRippleHandler('stop', onDragLeave);
14317 var handleMouseUp = useRippleHandler('stop', onMouseUp);
14318 var handleMouseLeave = useRippleHandler('stop', function (event) {
14319 if (focusVisible) {
14320 event.preventDefault();
14321 }
14322
14323 if (onMouseLeave) {
14324 onMouseLeave(event);
14325 }
14326 });
14327 var handleTouchStart = useRippleHandler('start', onTouchStart);
14328 var handleTouchEnd = useRippleHandler('stop', onTouchEnd);
14329 var handleTouchMove = useRippleHandler('stop', onTouchMove);
14330 var handleBlur = useRippleHandler('stop', function (event) {
14331 if (focusVisible) {
14332 onBlurVisible(event);
14333 setFocusVisible(false);
14334 }
14335
14336 if (onBlur) {
14337 onBlur(event);
14338 }
14339 }, false);
14340 var handleFocus = useEventCallback(function (event) {
14341 // Fix for https://github.com/facebook/react/issues/7769
14342 if (!buttonRef.current) {
14343 buttonRef.current = event.currentTarget;
14344 }
14345
14346 if (isFocusVisible(event)) {
14347 setFocusVisible(true);
14348
14349 if (onFocusVisible) {
14350 onFocusVisible(event);
14351 }
14352 }
14353
14354 if (onFocus) {
14355 onFocus(event);
14356 }
14357 });
14358
14359 var isNonNativeButton = function isNonNativeButton() {
14360 var button = getButtonNode();
14361 return component && component !== 'button' && !(button.tagName === 'A' && button.href);
14362 };
14363 /**
14364 * IE 11 shim for https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
14365 */
14366
14367
14368 var keydownRef = react.exports.useRef(false);
14369 var handleKeyDown = useEventCallback(function (event) {
14370 // Check if key is already down to avoid repeats being counted as multiple activations
14371 if (focusRipple && !keydownRef.current && focusVisible && rippleRef.current && event.key === ' ') {
14372 keydownRef.current = true;
14373 event.persist();
14374 rippleRef.current.stop(event, function () {
14375 rippleRef.current.start(event);
14376 });
14377 }
14378
14379 if (event.target === event.currentTarget && isNonNativeButton() && event.key === ' ') {
14380 event.preventDefault();
14381 }
14382
14383 if (onKeyDown) {
14384 onKeyDown(event);
14385 } // Keyboard accessibility for non interactive elements
14386
14387
14388 if (event.target === event.currentTarget && isNonNativeButton() && event.key === 'Enter' && !disabled) {
14389 event.preventDefault();
14390
14391 if (onClick) {
14392 onClick(event);
14393 }
14394 }
14395 });
14396 var handleKeyUp = useEventCallback(function (event) {
14397 // calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed
14398 // https://codesandbox.io/s/button-keyup-preventdefault-dn7f0
14399 if (focusRipple && event.key === ' ' && rippleRef.current && focusVisible && !event.defaultPrevented) {
14400 keydownRef.current = false;
14401 event.persist();
14402 rippleRef.current.stop(event, function () {
14403 rippleRef.current.pulsate(event);
14404 });
14405 }
14406
14407 if (onKeyUp) {
14408 onKeyUp(event);
14409 } // Keyboard accessibility for non interactive elements
14410
14411
14412 if (onClick && event.target === event.currentTarget && isNonNativeButton() && event.key === ' ' && !event.defaultPrevented) {
14413 onClick(event);
14414 }
14415 });
14416 var ComponentProp = component;
14417
14418 if (ComponentProp === 'button' && other.href) {
14419 ComponentProp = 'a';
14420 }
14421
14422 var buttonProps = {};
14423
14424 if (ComponentProp === 'button') {
14425 buttonProps.type = type;
14426 buttonProps.disabled = disabled;
14427 } else {
14428 if (ComponentProp !== 'a' || !other.href) {
14429 buttonProps.role = 'button';
14430 }
14431
14432 buttonProps['aria-disabled'] = disabled;
14433 }
14434
14435 var handleUserRef = useForkRef(buttonRefProp, ref);
14436 var handleOwnRef = useForkRef(focusVisibleRef, buttonRef);
14437 var handleRef = useForkRef(handleUserRef, handleOwnRef);
14438
14439 var _React$useState2 = react.exports.useState(false),
14440 mountedState = _React$useState2[0],
14441 setMountedState = _React$useState2[1];
14442
14443 react.exports.useEffect(function () {
14444 setMountedState(true);
14445 }, []);
14446 var enableTouchRipple = mountedState && !disableRipple && !disabled;
14447
14448 return /*#__PURE__*/react.exports.createElement(ComponentProp, _extends$5({
14449 className: clsx(classes.root, className, focusVisible && [classes.focusVisible, focusVisibleClassName], disabled && classes.disabled),
14450 onBlur: handleBlur,
14451 onClick: onClick,
14452 onFocus: handleFocus,
14453 onKeyDown: handleKeyDown,
14454 onKeyUp: handleKeyUp,
14455 onMouseDown: handleMouseDown,
14456 onMouseLeave: handleMouseLeave,
14457 onMouseUp: handleMouseUp,
14458 onDragLeave: handleDragLeave,
14459 onTouchEnd: handleTouchEnd,
14460 onTouchMove: handleTouchMove,
14461 onTouchStart: handleTouchStart,
14462 ref: handleRef,
14463 tabIndex: disabled ? -1 : tabIndex
14464 }, buttonProps, other), children, enableTouchRipple ?
14465 /*#__PURE__*/
14466
14467 /* TouchRipple is only needed client-side, x2 boost on the server. */
14468 react.exports.createElement(TouchRipple$1, _extends$5({
14469 ref: rippleRef,
14470 center: centerRipple
14471 }, TouchRippleProps)) : null);
14472 });
14473 var ButtonBase$1 = withStyles(styles$1K, {
14474 name: 'MuiButtonBase'
14475 })(ButtonBase);
14476
14477 var styles$1J = function styles(theme) {
14478 return {
14479 /* Styles applied to the root element. */
14480 root: {
14481 textAlign: 'center',
14482 flex: '0 0 auto',
14483 fontSize: theme.typography.pxToRem(24),
14484 padding: 12,
14485 borderRadius: '50%',
14486 overflow: 'visible',
14487 // Explicitly set the default value to solve a bug on IE 11.
14488 color: theme.palette.action.active,
14489 transition: theme.transitions.create('background-color', {
14490 duration: theme.transitions.duration.shortest
14491 }),
14492 '&:hover': {
14493 backgroundColor: alpha(theme.palette.action.active, theme.palette.action.hoverOpacity),
14494 // Reset on touch devices, it doesn't add specificity
14495 '@media (hover: none)': {
14496 backgroundColor: 'transparent'
14497 }
14498 },
14499 '&$disabled': {
14500 backgroundColor: 'transparent',
14501 color: theme.palette.action.disabled
14502 }
14503 },
14504
14505 /* Styles applied to the root element if `edge="start"`. */
14506 edgeStart: {
14507 marginLeft: -12,
14508 '$sizeSmall&': {
14509 marginLeft: -3
14510 }
14511 },
14512
14513 /* Styles applied to the root element if `edge="end"`. */
14514 edgeEnd: {
14515 marginRight: -12,
14516 '$sizeSmall&': {
14517 marginRight: -3
14518 }
14519 },
14520
14521 /* Styles applied to the root element if `color="inherit"`. */
14522 colorInherit: {
14523 color: 'inherit'
14524 },
14525
14526 /* Styles applied to the root element if `color="primary"`. */
14527 colorPrimary: {
14528 color: theme.palette.primary.main,
14529 '&:hover': {
14530 backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),
14531 // Reset on touch devices, it doesn't add specificity
14532 '@media (hover: none)': {
14533 backgroundColor: 'transparent'
14534 }
14535 }
14536 },
14537
14538 /* Styles applied to the root element if `color="secondary"`. */
14539 colorSecondary: {
14540 color: theme.palette.secondary.main,
14541 '&:hover': {
14542 backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.hoverOpacity),
14543 // Reset on touch devices, it doesn't add specificity
14544 '@media (hover: none)': {
14545 backgroundColor: 'transparent'
14546 }
14547 }
14548 },
14549
14550 /* Pseudo-class applied to the root element if `disabled={true}`. */
14551 disabled: {},
14552
14553 /* Styles applied to the root element if `size="small"`. */
14554 sizeSmall: {
14555 padding: 3,
14556 fontSize: theme.typography.pxToRem(18)
14557 },
14558
14559 /* Styles applied to the children container element. */
14560 label: {
14561 width: '100%',
14562 display: 'flex',
14563 alignItems: 'inherit',
14564 justifyContent: 'inherit'
14565 }
14566 };
14567 };
14568 /**
14569 * Refer to the [Icons](/components/icons/) section of the documentation
14570 * regarding the available icon options.
14571 */
14572
14573 var IconButton = /*#__PURE__*/react.exports.forwardRef(function IconButton(props, ref) {
14574 var _props$edge = props.edge,
14575 edge = _props$edge === void 0 ? false : _props$edge,
14576 children = props.children,
14577 classes = props.classes,
14578 className = props.className,
14579 _props$color = props.color,
14580 color = _props$color === void 0 ? 'default' : _props$color,
14581 _props$disabled = props.disabled,
14582 disabled = _props$disabled === void 0 ? false : _props$disabled,
14583 _props$disableFocusRi = props.disableFocusRipple,
14584 disableFocusRipple = _props$disableFocusRi === void 0 ? false : _props$disableFocusRi,
14585 _props$size = props.size,
14586 size = _props$size === void 0 ? 'medium' : _props$size,
14587 other = _objectWithoutProperties(props, ["edge", "children", "classes", "className", "color", "disabled", "disableFocusRipple", "size"]);
14588
14589 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
14590 className: clsx(classes.root, className, color !== 'default' && classes["color".concat(capitalize(color))], disabled && classes.disabled, size === "small" && classes["size".concat(capitalize(size))], {
14591 'start': classes.edgeStart,
14592 'end': classes.edgeEnd
14593 }[edge]),
14594 centerRipple: true,
14595 focusRipple: !disableFocusRipple,
14596 disabled: disabled,
14597 ref: ref
14598 }, other), /*#__PURE__*/react.exports.createElement("span", {
14599 className: classes.label
14600 }, children));
14601 });
14602 var IconButton$1 = withStyles(styles$1J, {
14603 name: 'MuiIconButton'
14604 })(IconButton);
14605
14606 var styles$1I = function styles(theme) {
14607 var transition = {
14608 duration: theme.transitions.duration.shortest
14609 };
14610 return {
14611 /* Styles applied to the root element. */
14612 root: {
14613 display: 'flex',
14614 minHeight: 8 * 6,
14615 transition: theme.transitions.create(['min-height', 'background-color'], transition),
14616 padding: theme.spacing(0, 2),
14617 '&:hover:not($disabled)': {
14618 cursor: 'pointer'
14619 },
14620 '&$expanded': {
14621 minHeight: 64
14622 },
14623 '&$focused, &$focusVisible': {
14624 backgroundColor: theme.palette.action.focus
14625 },
14626 '&$disabled': {
14627 opacity: theme.palette.action.disabledOpacity
14628 }
14629 },
14630
14631 /* Pseudo-class applied to the root element, children wrapper element and `IconButton` component if `expanded={true}`. */
14632 expanded: {},
14633
14634 /* Pseudo-class applied to the ButtonBase root element if the button is keyboard focused. */
14635 focused: {},
14636
14637 /* Pseudo-class applied to the ButtonBase root element if the button is keyboard focused. */
14638 focusVisible: {},
14639
14640 /* Pseudo-class applied to the root element if `disabled={true}`. */
14641 disabled: {},
14642
14643 /* Styles applied to the children wrapper element. */
14644 content: {
14645 display: 'flex',
14646 flexGrow: 1,
14647 transition: theme.transitions.create(['margin'], transition),
14648 margin: '12px 0',
14649 '&$expanded': {
14650 margin: '20px 0'
14651 }
14652 },
14653
14654 /* Styles applied to the `IconButton` component when `expandIcon` is supplied. */
14655 expandIcon: {
14656 transform: 'rotate(0deg)',
14657 transition: theme.transitions.create('transform', transition),
14658 '&:hover': {
14659 // Disable the hover effect for the IconButton,
14660 // because a hover effect should apply to the entire Expand button and
14661 // not only to the IconButton.
14662 backgroundColor: 'transparent'
14663 },
14664 '&$expanded': {
14665 transform: 'rotate(180deg)'
14666 }
14667 }
14668 };
14669 };
14670 var AccordionSummary = /*#__PURE__*/react.exports.forwardRef(function AccordionSummary(props, ref) {
14671 var children = props.children,
14672 classes = props.classes,
14673 className = props.className,
14674 expandIcon = props.expandIcon,
14675 focusVisibleClassName = props.focusVisibleClassName,
14676 _props$IconButtonProp = props.IconButtonProps,
14677 IconButtonProps = _props$IconButtonProp === void 0 ? {} : _props$IconButtonProp,
14678 onClick = props.onClick,
14679 other = _objectWithoutProperties(props, ["children", "classes", "className", "expandIcon", "focusVisibleClassName", "IconButtonProps", "onClick"]);
14680
14681 var _React$useContext = react.exports.useContext(AccordionContext),
14682 _React$useContext$dis = _React$useContext.disabled,
14683 disabled = _React$useContext$dis === void 0 ? false : _React$useContext$dis,
14684 expanded = _React$useContext.expanded,
14685 toggle = _React$useContext.toggle;
14686
14687 var handleChange = function handleChange(event) {
14688 if (toggle) {
14689 toggle(event);
14690 }
14691
14692 if (onClick) {
14693 onClick(event);
14694 }
14695 };
14696
14697 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
14698 focusRipple: false,
14699 disableRipple: true,
14700 disabled: disabled,
14701 component: "div",
14702 "aria-expanded": expanded,
14703 className: clsx(classes.root, className, disabled && classes.disabled, expanded && classes.expanded),
14704 focusVisibleClassName: clsx(classes.focusVisible, classes.focused, focusVisibleClassName),
14705 onClick: handleChange,
14706 ref: ref
14707 }, other), /*#__PURE__*/react.exports.createElement("div", {
14708 className: clsx(classes.content, expanded && classes.expanded)
14709 }, children), expandIcon && /*#__PURE__*/react.exports.createElement(IconButton$1, _extends$5({
14710 className: clsx(classes.expandIcon, expanded && classes.expanded),
14711 edge: "end",
14712 component: "div",
14713 tabIndex: null,
14714 role: null,
14715 "aria-hidden": true
14716 }, IconButtonProps), expandIcon));
14717 });
14718 withStyles(styles$1I, {
14719 name: 'MuiAccordionSummary'
14720 })(AccordionSummary);
14721
14722 var styles$1H = function styles(theme) {
14723 var backgroundColorDefault = theme.palette.type === 'light' ? theme.palette.grey[100] : theme.palette.grey[900];
14724 return {
14725 /* Styles applied to the root element. */
14726 root: {
14727 display: 'flex',
14728 flexDirection: 'column',
14729 width: '100%',
14730 boxSizing: 'border-box',
14731 // Prevent padding issue with the Modal and fixed positioned AppBar.
14732 zIndex: theme.zIndex.appBar,
14733 flexShrink: 0
14734 },
14735
14736 /* Styles applied to the root element if `position="fixed"`. */
14737 positionFixed: {
14738 position: 'fixed',
14739 top: 0,
14740 left: 'auto',
14741 right: 0,
14742 '@media print': {
14743 // Prevent the app bar to be visible on each printed page.
14744 position: 'absolute'
14745 }
14746 },
14747
14748 /* Styles applied to the root element if `position="absolute"`. */
14749 positionAbsolute: {
14750 position: 'absolute',
14751 top: 0,
14752 left: 'auto',
14753 right: 0
14754 },
14755
14756 /* Styles applied to the root element if `position="sticky"`. */
14757 positionSticky: {
14758 // ⚠️ sticky is not supported by IE 11.
14759 position: 'sticky',
14760 top: 0,
14761 left: 'auto',
14762 right: 0
14763 },
14764
14765 /* Styles applied to the root element if `position="static"`. */
14766 positionStatic: {
14767 position: 'static'
14768 },
14769
14770 /* Styles applied to the root element if `position="relative"`. */
14771 positionRelative: {
14772 position: 'relative'
14773 },
14774
14775 /* Styles applied to the root element if `color="default"`. */
14776 colorDefault: {
14777 backgroundColor: backgroundColorDefault,
14778 color: theme.palette.getContrastText(backgroundColorDefault)
14779 },
14780
14781 /* Styles applied to the root element if `color="primary"`. */
14782 colorPrimary: {
14783 backgroundColor: theme.palette.primary.main,
14784 color: theme.palette.primary.contrastText
14785 },
14786
14787 /* Styles applied to the root element if `color="secondary"`. */
14788 colorSecondary: {
14789 backgroundColor: theme.palette.secondary.main,
14790 color: theme.palette.secondary.contrastText
14791 },
14792
14793 /* Styles applied to the root element if `color="inherit"`. */
14794 colorInherit: {
14795 color: 'inherit'
14796 },
14797
14798 /* Styles applied to the root element if `color="transparent"`. */
14799 colorTransparent: {
14800 backgroundColor: 'transparent',
14801 color: 'inherit'
14802 }
14803 };
14804 };
14805 var AppBar = /*#__PURE__*/react.exports.forwardRef(function AppBar(props, ref) {
14806 var classes = props.classes,
14807 className = props.className,
14808 _props$color = props.color,
14809 color = _props$color === void 0 ? 'primary' : _props$color,
14810 _props$position = props.position,
14811 position = _props$position === void 0 ? 'fixed' : _props$position,
14812 other = _objectWithoutProperties(props, ["classes", "className", "color", "position"]);
14813
14814 return /*#__PURE__*/react.exports.createElement(Paper$1, _extends$5({
14815 square: true,
14816 component: "header",
14817 elevation: 4,
14818 className: clsx(classes.root, classes["position".concat(capitalize(position))], classes["color".concat(capitalize(color))], className, position === 'fixed' && 'mui-fixed'),
14819 ref: ref
14820 }, other));
14821 });
14822 withStyles(styles$1H, {
14823 name: 'MuiAppBar'
14824 })(AppBar);
14825
14826 /**
14827 * @ignore - internal component.
14828 */
14829
14830 var Person = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
14831 d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"
14832 }));
14833
14834 var styles$1G = function styles(theme) {
14835 return {
14836 /* Styles applied to the root element. */
14837 root: {
14838 position: 'relative',
14839 display: 'flex',
14840 alignItems: 'center',
14841 justifyContent: 'center',
14842 flexShrink: 0,
14843 width: 40,
14844 height: 40,
14845 fontFamily: theme.typography.fontFamily,
14846 fontSize: theme.typography.pxToRem(20),
14847 lineHeight: 1,
14848 borderRadius: '50%',
14849 overflow: 'hidden',
14850 userSelect: 'none'
14851 },
14852
14853 /* Styles applied to the root element if not `src` or `srcSet`. */
14854 colorDefault: {
14855 color: theme.palette.background.default,
14856 backgroundColor: theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[600]
14857 },
14858
14859 /* Styles applied to the root element if `variant="circle"`. */
14860 circle: {},
14861
14862 /* Styles applied to the root element if `variant="circular"`. */
14863 circular: {},
14864
14865 /* Styles applied to the root element if `variant="rounded"`. */
14866 rounded: {
14867 borderRadius: theme.shape.borderRadius
14868 },
14869
14870 /* Styles applied to the root element if `variant="square"`. */
14871 square: {
14872 borderRadius: 0
14873 },
14874
14875 /* Styles applied to the img element if either `src` or `srcSet` is defined. */
14876 img: {
14877 width: '100%',
14878 height: '100%',
14879 textAlign: 'center',
14880 // Handle non-square image. The property isn't supported by IE 11.
14881 objectFit: 'cover',
14882 // Hide alt text.
14883 color: 'transparent',
14884 // Hide the image broken icon, only works on Chrome.
14885 textIndent: 10000
14886 },
14887
14888 /* Styles applied to the fallback icon */
14889 fallback: {
14890 width: '75%',
14891 height: '75%'
14892 }
14893 };
14894 };
14895
14896 function useLoaded(_ref) {
14897 var src = _ref.src,
14898 srcSet = _ref.srcSet;
14899
14900 var _React$useState = react.exports.useState(false),
14901 loaded = _React$useState[0],
14902 setLoaded = _React$useState[1];
14903
14904 react.exports.useEffect(function () {
14905 if (!src && !srcSet) {
14906 return undefined;
14907 }
14908
14909 setLoaded(false);
14910 var active = true;
14911 var image = new Image();
14912 image.src = src;
14913 image.srcSet = srcSet;
14914
14915 image.onload = function () {
14916 if (!active) {
14917 return;
14918 }
14919
14920 setLoaded('loaded');
14921 };
14922
14923 image.onerror = function () {
14924 if (!active) {
14925 return;
14926 }
14927
14928 setLoaded('error');
14929 };
14930
14931 return function () {
14932 active = false;
14933 };
14934 }, [src, srcSet]);
14935 return loaded;
14936 }
14937
14938 var Avatar = /*#__PURE__*/react.exports.forwardRef(function Avatar(props, ref) {
14939 var alt = props.alt,
14940 childrenProp = props.children,
14941 classes = props.classes,
14942 className = props.className,
14943 _props$component = props.component,
14944 Component = _props$component === void 0 ? 'div' : _props$component,
14945 imgProps = props.imgProps,
14946 sizes = props.sizes,
14947 src = props.src,
14948 srcSet = props.srcSet,
14949 _props$variant = props.variant,
14950 variant = _props$variant === void 0 ? 'circular' : _props$variant,
14951 other = _objectWithoutProperties(props, ["alt", "children", "classes", "className", "component", "imgProps", "sizes", "src", "srcSet", "variant"]);
14952
14953 var children = null; // Use a hook instead of onError on the img element to support server-side rendering.
14954
14955 var loaded = useLoaded({
14956 src: src,
14957 srcSet: srcSet
14958 });
14959 var hasImg = src || srcSet;
14960 var hasImgNotFailing = hasImg && loaded !== 'error';
14961
14962 if (hasImgNotFailing) {
14963 children = /*#__PURE__*/react.exports.createElement("img", _extends$5({
14964 alt: alt,
14965 src: src,
14966 srcSet: srcSet,
14967 sizes: sizes,
14968 className: classes.img
14969 }, imgProps));
14970 } else if (childrenProp != null) {
14971 children = childrenProp;
14972 } else if (hasImg && alt) {
14973 children = alt[0];
14974 } else {
14975 children = /*#__PURE__*/react.exports.createElement(Person, {
14976 className: classes.fallback
14977 });
14978 }
14979
14980 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
14981 className: clsx(classes.root, classes.system, classes[variant], className, !hasImgNotFailing && classes.colorDefault),
14982 ref: ref
14983 }, other), children);
14984 });
14985 withStyles(styles$1G, {
14986 name: 'MuiAvatar'
14987 })(Avatar);
14988
14989 var styles$1F = {
14990 entering: {
14991 opacity: 1
14992 },
14993 entered: {
14994 opacity: 1
14995 }
14996 };
14997 var defaultTimeout$1 = {
14998 enter: duration.enteringScreen,
14999 exit: duration.leavingScreen
15000 };
15001 /**
15002 * The Fade transition is used by the [Modal](/components/modal/) component.
15003 * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
15004 */
15005
15006 var Fade = /*#__PURE__*/react.exports.forwardRef(function Fade(props, ref) {
15007 var children = props.children,
15008 _props$disableStrictM = props.disableStrictModeCompat,
15009 disableStrictModeCompat = _props$disableStrictM === void 0 ? false : _props$disableStrictM,
15010 inProp = props.in,
15011 onEnter = props.onEnter,
15012 onEntered = props.onEntered,
15013 onEntering = props.onEntering,
15014 onExit = props.onExit,
15015 onExited = props.onExited,
15016 onExiting = props.onExiting,
15017 style = props.style,
15018 _props$TransitionComp = props.TransitionComponent,
15019 TransitionComponent = _props$TransitionComp === void 0 ? Transition : _props$TransitionComp,
15020 _props$timeout = props.timeout,
15021 timeout = _props$timeout === void 0 ? defaultTimeout$1 : _props$timeout,
15022 other = _objectWithoutProperties(props, ["children", "disableStrictModeCompat", "in", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "style", "TransitionComponent", "timeout"]);
15023
15024 var theme = useTheme$1();
15025 var enableStrictModeCompat = theme.unstable_strictMode && !disableStrictModeCompat;
15026 var nodeRef = react.exports.useRef(null);
15027 var foreignRef = useForkRef(children.ref, ref);
15028 var handleRef = useForkRef(enableStrictModeCompat ? nodeRef : undefined, foreignRef);
15029
15030 var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {
15031 return function (nodeOrAppearing, maybeAppearing) {
15032 if (callback) {
15033 var _ref = enableStrictModeCompat ? [nodeRef.current, nodeOrAppearing] : [nodeOrAppearing, maybeAppearing],
15034 _ref2 = _slicedToArray(_ref, 2),
15035 node = _ref2[0],
15036 isAppearing = _ref2[1]; // onEnterXxx and onExitXxx callbacks have a different arguments.length value.
15037
15038
15039 if (isAppearing === undefined) {
15040 callback(node);
15041 } else {
15042 callback(node, isAppearing);
15043 }
15044 }
15045 };
15046 };
15047
15048 var handleEntering = normalizedTransitionCallback(onEntering);
15049 var handleEnter = normalizedTransitionCallback(function (node, isAppearing) {
15050 reflow(node); // So the animation always start from the start.
15051
15052 var transitionProps = getTransitionProps({
15053 style: style,
15054 timeout: timeout
15055 }, {
15056 mode: 'enter'
15057 });
15058 node.style.webkitTransition = theme.transitions.create('opacity', transitionProps);
15059 node.style.transition = theme.transitions.create('opacity', transitionProps);
15060
15061 if (onEnter) {
15062 onEnter(node, isAppearing);
15063 }
15064 });
15065 var handleEntered = normalizedTransitionCallback(onEntered);
15066 var handleExiting = normalizedTransitionCallback(onExiting);
15067 var handleExit = normalizedTransitionCallback(function (node) {
15068 var transitionProps = getTransitionProps({
15069 style: style,
15070 timeout: timeout
15071 }, {
15072 mode: 'exit'
15073 });
15074 node.style.webkitTransition = theme.transitions.create('opacity', transitionProps);
15075 node.style.transition = theme.transitions.create('opacity', transitionProps);
15076
15077 if (onExit) {
15078 onExit(node);
15079 }
15080 });
15081 var handleExited = normalizedTransitionCallback(onExited);
15082 return /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
15083 appear: true,
15084 in: inProp,
15085 nodeRef: enableStrictModeCompat ? nodeRef : undefined,
15086 onEnter: handleEnter,
15087 onEntered: handleEntered,
15088 onEntering: handleEntering,
15089 onExit: handleExit,
15090 onExited: handleExited,
15091 onExiting: handleExiting,
15092 timeout: timeout
15093 }, other), function (state, childProps) {
15094 return /*#__PURE__*/react.exports.cloneElement(children, _extends$5({
15095 style: _extends$5({
15096 opacity: 0,
15097 visibility: state === 'exited' && !inProp ? 'hidden' : undefined
15098 }, styles$1F[state], style, children.props.style),
15099 ref: handleRef
15100 }, childProps));
15101 });
15102 });
15103
15104 var styles$1E = {
15105 /* Styles applied to the root element. */
15106 root: {
15107 // Improve scrollable dialog support.
15108 zIndex: -1,
15109 position: 'fixed',
15110 display: 'flex',
15111 alignItems: 'center',
15112 justifyContent: 'center',
15113 right: 0,
15114 bottom: 0,
15115 top: 0,
15116 left: 0,
15117 backgroundColor: 'rgba(0, 0, 0, 0.5)',
15118 WebkitTapHighlightColor: 'transparent'
15119 },
15120
15121 /* Styles applied to the root element if `invisible={true}`. */
15122 invisible: {
15123 backgroundColor: 'transparent'
15124 }
15125 };
15126 var Backdrop = /*#__PURE__*/react.exports.forwardRef(function Backdrop(props, ref) {
15127 var children = props.children,
15128 classes = props.classes,
15129 className = props.className,
15130 _props$invisible = props.invisible,
15131 invisible = _props$invisible === void 0 ? false : _props$invisible,
15132 open = props.open,
15133 transitionDuration = props.transitionDuration,
15134 _props$TransitionComp = props.TransitionComponent,
15135 TransitionComponent = _props$TransitionComp === void 0 ? Fade : _props$TransitionComp,
15136 other = _objectWithoutProperties(props, ["children", "classes", "className", "invisible", "open", "transitionDuration", "TransitionComponent"]);
15137
15138 return /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
15139 in: open,
15140 timeout: transitionDuration
15141 }, other), /*#__PURE__*/react.exports.createElement("div", {
15142 className: clsx(classes.root, className, invisible && classes.invisible),
15143 "aria-hidden": true,
15144 ref: ref
15145 }, children));
15146 });
15147 var Backdrop$1 = withStyles(styles$1E, {
15148 name: 'MuiBackdrop'
15149 })(Backdrop);
15150
15151 var RADIUS_STANDARD = 10;
15152 var RADIUS_DOT = 4;
15153 var styles$1D = function styles(theme) {
15154 return {
15155 /* Styles applied to the root element. */
15156 root: {
15157 position: 'relative',
15158 display: 'inline-flex',
15159 // For correct alignment with the text.
15160 verticalAlign: 'middle',
15161 flexShrink: 0
15162 },
15163
15164 /* Styles applied to the badge `span` element. */
15165 badge: {
15166 display: 'flex',
15167 flexDirection: 'row',
15168 flexWrap: 'wrap',
15169 justifyContent: 'center',
15170 alignContent: 'center',
15171 alignItems: 'center',
15172 position: 'absolute',
15173 boxSizing: 'border-box',
15174 fontFamily: theme.typography.fontFamily,
15175 fontWeight: theme.typography.fontWeightMedium,
15176 fontSize: theme.typography.pxToRem(12),
15177 minWidth: RADIUS_STANDARD * 2,
15178 lineHeight: 1,
15179 padding: '0 6px',
15180 height: RADIUS_STANDARD * 2,
15181 borderRadius: RADIUS_STANDARD,
15182 zIndex: 1,
15183 // Render the badge on top of potential ripples.
15184 transition: theme.transitions.create('transform', {
15185 easing: theme.transitions.easing.easeInOut,
15186 duration: theme.transitions.duration.enteringScreen
15187 })
15188 },
15189
15190 /* Styles applied to the root element if `color="primary"`. */
15191 colorPrimary: {
15192 backgroundColor: theme.palette.primary.main,
15193 color: theme.palette.primary.contrastText
15194 },
15195
15196 /* Styles applied to the root element if `color="secondary"`. */
15197 colorSecondary: {
15198 backgroundColor: theme.palette.secondary.main,
15199 color: theme.palette.secondary.contrastText
15200 },
15201
15202 /* Styles applied to the root element if `color="error"`. */
15203 colorError: {
15204 backgroundColor: theme.palette.error.main,
15205 color: theme.palette.error.contrastText
15206 },
15207
15208 /* Styles applied to the root element if `variant="dot"`. */
15209 dot: {
15210 borderRadius: RADIUS_DOT,
15211 height: RADIUS_DOT * 2,
15212 minWidth: RADIUS_DOT * 2,
15213 padding: 0
15214 },
15215
15216 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }} overlap="rectangle"`. */
15217 anchorOriginTopRightRectangle: {
15218 top: 0,
15219 right: 0,
15220 transform: 'scale(1) translate(50%, -50%)',
15221 transformOrigin: '100% 0%',
15222 '&$invisible': {
15223 transform: 'scale(0) translate(50%, -50%)'
15224 }
15225 },
15226
15227 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }} overlap="rectangular"`. */
15228 anchorOriginTopRightRectangular: {
15229 top: 0,
15230 right: 0,
15231 transform: 'scale(1) translate(50%, -50%)',
15232 transformOrigin: '100% 0%',
15233 '&$invisible': {
15234 transform: 'scale(0) translate(50%, -50%)'
15235 }
15236 },
15237
15238 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }} overlap="rectangle"`. */
15239 anchorOriginBottomRightRectangle: {
15240 bottom: 0,
15241 right: 0,
15242 transform: 'scale(1) translate(50%, 50%)',
15243 transformOrigin: '100% 100%',
15244 '&$invisible': {
15245 transform: 'scale(0) translate(50%, 50%)'
15246 }
15247 },
15248
15249 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }} overlap="rectangular"`. */
15250 anchorOriginBottomRightRectangular: {
15251 bottom: 0,
15252 right: 0,
15253 transform: 'scale(1) translate(50%, 50%)',
15254 transformOrigin: '100% 100%',
15255 '&$invisible': {
15256 transform: 'scale(0) translate(50%, 50%)'
15257 }
15258 },
15259
15260 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }} overlap="rectangle"`. */
15261 anchorOriginTopLeftRectangle: {
15262 top: 0,
15263 left: 0,
15264 transform: 'scale(1) translate(-50%, -50%)',
15265 transformOrigin: '0% 0%',
15266 '&$invisible': {
15267 transform: 'scale(0) translate(-50%, -50%)'
15268 }
15269 },
15270
15271 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }} overlap="rectangular"`. */
15272 anchorOriginTopLeftRectangular: {
15273 top: 0,
15274 left: 0,
15275 transform: 'scale(1) translate(-50%, -50%)',
15276 transformOrigin: '0% 0%',
15277 '&$invisible': {
15278 transform: 'scale(0) translate(-50%, -50%)'
15279 }
15280 },
15281
15282 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }} overlap="rectangle"`. */
15283 anchorOriginBottomLeftRectangle: {
15284 bottom: 0,
15285 left: 0,
15286 transform: 'scale(1) translate(-50%, 50%)',
15287 transformOrigin: '0% 100%',
15288 '&$invisible': {
15289 transform: 'scale(0) translate(-50%, 50%)'
15290 }
15291 },
15292
15293 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }} overlap="rectangular"`. */
15294 anchorOriginBottomLeftRectangular: {
15295 bottom: 0,
15296 left: 0,
15297 transform: 'scale(1) translate(-50%, 50%)',
15298 transformOrigin: '0% 100%',
15299 '&$invisible': {
15300 transform: 'scale(0) translate(-50%, 50%)'
15301 }
15302 },
15303
15304 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }} overlap="circle"`. */
15305 anchorOriginTopRightCircle: {
15306 top: '14%',
15307 right: '14%',
15308 transform: 'scale(1) translate(50%, -50%)',
15309 transformOrigin: '100% 0%',
15310 '&$invisible': {
15311 transform: 'scale(0) translate(50%, -50%)'
15312 }
15313 },
15314
15315 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }} overlap="circular"`. */
15316 anchorOriginTopRightCircular: {
15317 top: '14%',
15318 right: '14%',
15319 transform: 'scale(1) translate(50%, -50%)',
15320 transformOrigin: '100% 0%',
15321 '&$invisible': {
15322 transform: 'scale(0) translate(50%, -50%)'
15323 }
15324 },
15325
15326 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }} overlap="circle"`. */
15327 anchorOriginBottomRightCircle: {
15328 bottom: '14%',
15329 right: '14%',
15330 transform: 'scale(1) translate(50%, 50%)',
15331 transformOrigin: '100% 100%',
15332 '&$invisible': {
15333 transform: 'scale(0) translate(50%, 50%)'
15334 }
15335 },
15336
15337 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }} overlap="circular"`. */
15338 anchorOriginBottomRightCircular: {
15339 bottom: '14%',
15340 right: '14%',
15341 transform: 'scale(1) translate(50%, 50%)',
15342 transformOrigin: '100% 100%',
15343 '&$invisible': {
15344 transform: 'scale(0) translate(50%, 50%)'
15345 }
15346 },
15347
15348 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }} overlap="circle"`. */
15349 anchorOriginTopLeftCircle: {
15350 top: '14%',
15351 left: '14%',
15352 transform: 'scale(1) translate(-50%, -50%)',
15353 transformOrigin: '0% 0%',
15354 '&$invisible': {
15355 transform: 'scale(0) translate(-50%, -50%)'
15356 }
15357 },
15358
15359 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }} overlap="circular"`. */
15360 anchorOriginTopLeftCircular: {
15361 top: '14%',
15362 left: '14%',
15363 transform: 'scale(1) translate(-50%, -50%)',
15364 transformOrigin: '0% 0%',
15365 '&$invisible': {
15366 transform: 'scale(0) translate(-50%, -50%)'
15367 }
15368 },
15369
15370 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }} overlap="circle"`. */
15371 anchorOriginBottomLeftCircle: {
15372 bottom: '14%',
15373 left: '14%',
15374 transform: 'scale(1) translate(-50%, 50%)',
15375 transformOrigin: '0% 100%',
15376 '&$invisible': {
15377 transform: 'scale(0) translate(-50%, 50%)'
15378 }
15379 },
15380
15381 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }} overlap="circular"`. */
15382 anchorOriginBottomLeftCircular: {
15383 bottom: '14%',
15384 left: '14%',
15385 transform: 'scale(1) translate(-50%, 50%)',
15386 transformOrigin: '0% 100%',
15387 '&$invisible': {
15388 transform: 'scale(0) translate(-50%, 50%)'
15389 }
15390 },
15391
15392 /* Pseudo-class to the badge `span` element if `invisible={true}`. */
15393 invisible: {
15394 transition: theme.transitions.create('transform', {
15395 easing: theme.transitions.easing.easeInOut,
15396 duration: theme.transitions.duration.leavingScreen
15397 })
15398 }
15399 };
15400 };
15401 var Badge = /*#__PURE__*/react.exports.forwardRef(function Badge(props, ref) {
15402 var _props$anchorOrigin = props.anchorOrigin,
15403 anchorOrigin = _props$anchorOrigin === void 0 ? {
15404 vertical: 'top',
15405 horizontal: 'right'
15406 } : _props$anchorOrigin,
15407 badgeContent = props.badgeContent,
15408 children = props.children,
15409 classes = props.classes,
15410 className = props.className,
15411 _props$color = props.color,
15412 color = _props$color === void 0 ? 'default' : _props$color,
15413 _props$component = props.component,
15414 ComponentProp = _props$component === void 0 ? 'span' : _props$component,
15415 invisibleProp = props.invisible,
15416 _props$max = props.max,
15417 max = _props$max === void 0 ? 99 : _props$max,
15418 _props$overlap = props.overlap,
15419 overlap = _props$overlap === void 0 ? 'rectangle' : _props$overlap,
15420 _props$showZero = props.showZero,
15421 showZero = _props$showZero === void 0 ? false : _props$showZero,
15422 _props$variant = props.variant,
15423 variant = _props$variant === void 0 ? 'standard' : _props$variant,
15424 other = _objectWithoutProperties(props, ["anchorOrigin", "badgeContent", "children", "classes", "className", "color", "component", "invisible", "max", "overlap", "showZero", "variant"]);
15425
15426 var invisible = invisibleProp;
15427
15428 if (invisibleProp == null && (badgeContent === 0 && !showZero || badgeContent == null && variant !== 'dot')) {
15429 invisible = true;
15430 }
15431
15432 var displayValue = '';
15433
15434 if (variant !== 'dot') {
15435 displayValue = badgeContent > max ? "".concat(max, "+") : badgeContent;
15436 }
15437
15438 return /*#__PURE__*/react.exports.createElement(ComponentProp, _extends$5({
15439 className: clsx(classes.root, className),
15440 ref: ref
15441 }, other), children, /*#__PURE__*/react.exports.createElement("span", {
15442 className: clsx(classes.badge, classes["".concat(anchorOrigin.horizontal).concat(capitalize(anchorOrigin.vertical), "}")], classes["anchorOrigin".concat(capitalize(anchorOrigin.vertical)).concat(capitalize(anchorOrigin.horizontal)).concat(capitalize(overlap))], color !== 'default' && classes["color".concat(capitalize(color))], invisible && classes.invisible, variant === 'dot' && classes.dot)
15443 }, displayValue));
15444 });
15445 var Badge$1 = withStyles(styles$1D, {
15446 name: 'MuiBadge'
15447 })(Badge);
15448
15449 var styles$1C = function styles(theme) {
15450 return {
15451 /* Styles applied to the root element. */
15452 root: {
15453 display: 'flex',
15454 justifyContent: 'center',
15455 height: 56,
15456 backgroundColor: theme.palette.background.paper
15457 }
15458 };
15459 };
15460 var BottomNavigation = /*#__PURE__*/react.exports.forwardRef(function BottomNavigation(props, ref) {
15461 var children = props.children,
15462 classes = props.classes,
15463 className = props.className,
15464 _props$component = props.component,
15465 Component = _props$component === void 0 ? 'div' : _props$component,
15466 onChange = props.onChange,
15467 _props$showLabels = props.showLabels,
15468 showLabels = _props$showLabels === void 0 ? false : _props$showLabels,
15469 value = props.value,
15470 other = _objectWithoutProperties(props, ["children", "classes", "className", "component", "onChange", "showLabels", "value"]);
15471
15472 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
15473 className: clsx(classes.root, className),
15474 ref: ref
15475 }, other), react.exports.Children.map(children, function (child, childIndex) {
15476 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
15477 return null;
15478 }
15479
15480 var childValue = child.props.value === undefined ? childIndex : child.props.value;
15481 return /*#__PURE__*/react.exports.cloneElement(child, {
15482 selected: childValue === value,
15483 showLabel: child.props.showLabel !== undefined ? child.props.showLabel : showLabels,
15484 value: childValue,
15485 onChange: onChange
15486 });
15487 }));
15488 });
15489 withStyles(styles$1C, {
15490 name: 'MuiBottomNavigation'
15491 })(BottomNavigation);
15492
15493 var styles$1B = function styles(theme) {
15494 return {
15495 /* Styles applied to the root element. */
15496 root: {
15497 transition: theme.transitions.create(['color', 'padding-top'], {
15498 duration: theme.transitions.duration.short
15499 }),
15500 padding: '6px 12px 8px',
15501 minWidth: 80,
15502 maxWidth: 168,
15503 color: theme.palette.text.secondary,
15504 flex: '1',
15505 '&$iconOnly': {
15506 paddingTop: 16
15507 },
15508 '&$selected': {
15509 paddingTop: 6,
15510 color: theme.palette.primary.main
15511 }
15512 },
15513
15514 /* Pseudo-class applied to the root element if selected. */
15515 selected: {},
15516
15517 /* Pseudo-class applied to the root element if `showLabel={false}` and not selected. */
15518 iconOnly: {},
15519
15520 /* Styles applied to the span element that wraps the icon and label. */
15521 wrapper: {
15522 display: 'inline-flex',
15523 alignItems: 'center',
15524 justifyContent: 'center',
15525 width: '100%',
15526 flexDirection: 'column'
15527 },
15528
15529 /* Styles applied to the label's span element. */
15530 label: {
15531 fontFamily: theme.typography.fontFamily,
15532 fontSize: theme.typography.pxToRem(12),
15533 opacity: 1,
15534 transition: 'font-size 0.2s, opacity 0.2s',
15535 transitionDelay: '0.1s',
15536 '&$iconOnly': {
15537 opacity: 0,
15538 transitionDelay: '0s'
15539 },
15540 '&$selected': {
15541 fontSize: theme.typography.pxToRem(14)
15542 }
15543 }
15544 };
15545 };
15546 var BottomNavigationAction = /*#__PURE__*/react.exports.forwardRef(function BottomNavigationAction(props, ref) {
15547 var classes = props.classes,
15548 className = props.className,
15549 icon = props.icon,
15550 label = props.label,
15551 onChange = props.onChange,
15552 onClick = props.onClick,
15553 selected = props.selected,
15554 showLabel = props.showLabel,
15555 value = props.value,
15556 other = _objectWithoutProperties(props, ["classes", "className", "icon", "label", "onChange", "onClick", "selected", "showLabel", "value"]);
15557
15558 var handleChange = function handleChange(event) {
15559 if (onChange) {
15560 onChange(event, value);
15561 }
15562
15563 if (onClick) {
15564 onClick(event);
15565 }
15566 };
15567
15568 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
15569 ref: ref,
15570 className: clsx(classes.root, className, selected ? classes.selected : !showLabel && classes.iconOnly),
15571 focusRipple: true,
15572 onClick: handleChange
15573 }, other), /*#__PURE__*/react.exports.createElement("span", {
15574 className: classes.wrapper
15575 }, icon, /*#__PURE__*/react.exports.createElement("span", {
15576 className: clsx(classes.label, selected ? classes.selected : !showLabel && classes.iconOnly)
15577 }, label)));
15578 });
15579 withStyles(styles$1B, {
15580 name: 'MuiBottomNavigationAction'
15581 })(BottomNavigationAction);
15582
15583 var styleFunction = styleFunctionSx(compose(borders, display, flexbox, grid, positions, palette, boxShadow, sizing, spacing, typography));
15584 /**
15585 * @ignore - do not document.
15586 */
15587
15588 var Box = styled('div')(styleFunction, {
15589 name: 'MuiBox'
15590 });
15591
15592 var styles$1A = function styles(theme) {
15593 return {
15594 /* Styles applied to the root element. */
15595 root: {
15596 margin: 0
15597 },
15598
15599 /* Styles applied to the root element if `variant="body2"`. */
15600 body2: theme.typography.body2,
15601
15602 /* Styles applied to the root element if `variant="body1"`. */
15603 body1: theme.typography.body1,
15604
15605 /* Styles applied to the root element if `variant="caption"`. */
15606 caption: theme.typography.caption,
15607
15608 /* Styles applied to the root element if `variant="button"`. */
15609 button: theme.typography.button,
15610
15611 /* Styles applied to the root element if `variant="h1"`. */
15612 h1: theme.typography.h1,
15613
15614 /* Styles applied to the root element if `variant="h2"`. */
15615 h2: theme.typography.h2,
15616
15617 /* Styles applied to the root element if `variant="h3"`. */
15618 h3: theme.typography.h3,
15619
15620 /* Styles applied to the root element if `variant="h4"`. */
15621 h4: theme.typography.h4,
15622
15623 /* Styles applied to the root element if `variant="h5"`. */
15624 h5: theme.typography.h5,
15625
15626 /* Styles applied to the root element if `variant="h6"`. */
15627 h6: theme.typography.h6,
15628
15629 /* Styles applied to the root element if `variant="subtitle1"`. */
15630 subtitle1: theme.typography.subtitle1,
15631
15632 /* Styles applied to the root element if `variant="subtitle2"`. */
15633 subtitle2: theme.typography.subtitle2,
15634
15635 /* Styles applied to the root element if `variant="overline"`. */
15636 overline: theme.typography.overline,
15637
15638 /* Styles applied to the root element if `variant="srOnly"`. Only accessible to screen readers. */
15639 srOnly: {
15640 position: 'absolute',
15641 height: 1,
15642 width: 1,
15643 overflow: 'hidden'
15644 },
15645
15646 /* Styles applied to the root element if `align="left"`. */
15647 alignLeft: {
15648 textAlign: 'left'
15649 },
15650
15651 /* Styles applied to the root element if `align="center"`. */
15652 alignCenter: {
15653 textAlign: 'center'
15654 },
15655
15656 /* Styles applied to the root element if `align="right"`. */
15657 alignRight: {
15658 textAlign: 'right'
15659 },
15660
15661 /* Styles applied to the root element if `align="justify"`. */
15662 alignJustify: {
15663 textAlign: 'justify'
15664 },
15665
15666 /* Styles applied to the root element if `nowrap={true}`. */
15667 noWrap: {
15668 overflow: 'hidden',
15669 textOverflow: 'ellipsis',
15670 whiteSpace: 'nowrap'
15671 },
15672
15673 /* Styles applied to the root element if `gutterBottom={true}`. */
15674 gutterBottom: {
15675 marginBottom: '0.35em'
15676 },
15677
15678 /* Styles applied to the root element if `paragraph={true}`. */
15679 paragraph: {
15680 marginBottom: 16
15681 },
15682
15683 /* Styles applied to the root element if `color="inherit"`. */
15684 colorInherit: {
15685 color: 'inherit'
15686 },
15687
15688 /* Styles applied to the root element if `color="primary"`. */
15689 colorPrimary: {
15690 color: theme.palette.primary.main
15691 },
15692
15693 /* Styles applied to the root element if `color="secondary"`. */
15694 colorSecondary: {
15695 color: theme.palette.secondary.main
15696 },
15697
15698 /* Styles applied to the root element if `color="textPrimary"`. */
15699 colorTextPrimary: {
15700 color: theme.palette.text.primary
15701 },
15702
15703 /* Styles applied to the root element if `color="textSecondary"`. */
15704 colorTextSecondary: {
15705 color: theme.palette.text.secondary
15706 },
15707
15708 /* Styles applied to the root element if `color="error"`. */
15709 colorError: {
15710 color: theme.palette.error.main
15711 },
15712
15713 /* Styles applied to the root element if `display="inline"`. */
15714 displayInline: {
15715 display: 'inline'
15716 },
15717
15718 /* Styles applied to the root element if `display="block"`. */
15719 displayBlock: {
15720 display: 'block'
15721 }
15722 };
15723 };
15724 var defaultVariantMapping = {
15725 h1: 'h1',
15726 h2: 'h2',
15727 h3: 'h3',
15728 h4: 'h4',
15729 h5: 'h5',
15730 h6: 'h6',
15731 subtitle1: 'h6',
15732 subtitle2: 'h6',
15733 body1: 'p',
15734 body2: 'p'
15735 };
15736 var Typography = /*#__PURE__*/react.exports.forwardRef(function Typography(props, ref) {
15737 var _props$align = props.align,
15738 align = _props$align === void 0 ? 'inherit' : _props$align,
15739 classes = props.classes,
15740 className = props.className,
15741 _props$color = props.color,
15742 color = _props$color === void 0 ? 'initial' : _props$color,
15743 component = props.component,
15744 _props$display = props.display,
15745 display = _props$display === void 0 ? 'initial' : _props$display,
15746 _props$gutterBottom = props.gutterBottom,
15747 gutterBottom = _props$gutterBottom === void 0 ? false : _props$gutterBottom,
15748 _props$noWrap = props.noWrap,
15749 noWrap = _props$noWrap === void 0 ? false : _props$noWrap,
15750 _props$paragraph = props.paragraph,
15751 paragraph = _props$paragraph === void 0 ? false : _props$paragraph,
15752 _props$variant = props.variant,
15753 variant = _props$variant === void 0 ? 'body1' : _props$variant,
15754 _props$variantMapping = props.variantMapping,
15755 variantMapping = _props$variantMapping === void 0 ? defaultVariantMapping : _props$variantMapping,
15756 other = _objectWithoutProperties(props, ["align", "classes", "className", "color", "component", "display", "gutterBottom", "noWrap", "paragraph", "variant", "variantMapping"]);
15757
15758 var Component = component || (paragraph ? 'p' : variantMapping[variant] || defaultVariantMapping[variant]) || 'span';
15759 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
15760 className: clsx(classes.root, className, variant !== 'inherit' && classes[variant], color !== 'initial' && classes["color".concat(capitalize(color))], noWrap && classes.noWrap, gutterBottom && classes.gutterBottom, paragraph && classes.paragraph, align !== 'inherit' && classes["align".concat(capitalize(align))], display !== 'initial' && classes["display".concat(capitalize(display))]),
15761 ref: ref
15762 }, other));
15763 });
15764 var Typography$1 = withStyles(styles$1A, {
15765 name: 'MuiTypography'
15766 })(Typography);
15767
15768 /**
15769 * @ignore - internal component.
15770 */
15771
15772 var MoreHorizIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
15773 d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
15774 }));
15775
15776 var styles$1z = function styles(theme) {
15777 return {
15778 root: {
15779 display: 'flex',
15780 marginLeft: theme.spacing(0.5),
15781 marginRight: theme.spacing(0.5),
15782 backgroundColor: theme.palette.grey[100],
15783 color: theme.palette.grey[700],
15784 borderRadius: 2,
15785 cursor: 'pointer',
15786 '&:hover, &:focus': {
15787 backgroundColor: theme.palette.grey[200]
15788 },
15789 '&:active': {
15790 boxShadow: theme.shadows[0],
15791 backgroundColor: emphasize(theme.palette.grey[200], 0.12)
15792 }
15793 },
15794 icon: {
15795 width: 24,
15796 height: 16
15797 }
15798 };
15799 };
15800 /**
15801 * @ignore - internal component.
15802 */
15803
15804
15805 function BreadcrumbCollapsed(props) {
15806 var classes = props.classes,
15807 other = _objectWithoutProperties(props, ["classes"]);
15808
15809 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
15810 component: "li",
15811 className: classes.root,
15812 focusRipple: true
15813 }, other), /*#__PURE__*/react.exports.createElement(MoreHorizIcon, {
15814 className: classes.icon
15815 }));
15816 }
15817 var BreadcrumbCollapsed$1 = withStyles(styles$1z, {
15818 name: 'PrivateBreadcrumbCollapsed'
15819 })(BreadcrumbCollapsed);
15820
15821 var styles$1y = {
15822 /* Styles applied to the root element. */
15823 root: {},
15824
15825 /* Styles applied to the ol element. */
15826 ol: {
15827 display: 'flex',
15828 flexWrap: 'wrap',
15829 alignItems: 'center',
15830 padding: 0,
15831 margin: 0,
15832 listStyle: 'none'
15833 },
15834
15835 /* Styles applied to the li element. */
15836 li: {},
15837
15838 /* Styles applied to the separator element. */
15839 separator: {
15840 display: 'flex',
15841 userSelect: 'none',
15842 marginLeft: 8,
15843 marginRight: 8
15844 }
15845 };
15846
15847 function insertSeparators(items, className, separator) {
15848 return items.reduce(function (acc, current, index) {
15849 if (index < items.length - 1) {
15850 acc = acc.concat(current, /*#__PURE__*/react.exports.createElement("li", {
15851 "aria-hidden": true,
15852 key: "separator-".concat(index),
15853 className: className
15854 }, separator));
15855 } else {
15856 acc.push(current);
15857 }
15858
15859 return acc;
15860 }, []);
15861 }
15862
15863 var Breadcrumbs = /*#__PURE__*/react.exports.forwardRef(function Breadcrumbs(props, ref) {
15864 var children = props.children,
15865 classes = props.classes,
15866 className = props.className,
15867 _props$component = props.component,
15868 Component = _props$component === void 0 ? 'nav' : _props$component,
15869 _props$expandText = props.expandText,
15870 expandText = _props$expandText === void 0 ? 'Show path' : _props$expandText,
15871 _props$itemsAfterColl = props.itemsAfterCollapse,
15872 itemsAfterCollapse = _props$itemsAfterColl === void 0 ? 1 : _props$itemsAfterColl,
15873 _props$itemsBeforeCol = props.itemsBeforeCollapse,
15874 itemsBeforeCollapse = _props$itemsBeforeCol === void 0 ? 1 : _props$itemsBeforeCol,
15875 _props$maxItems = props.maxItems,
15876 maxItems = _props$maxItems === void 0 ? 8 : _props$maxItems,
15877 _props$separator = props.separator,
15878 separator = _props$separator === void 0 ? '/' : _props$separator,
15879 other = _objectWithoutProperties(props, ["children", "classes", "className", "component", "expandText", "itemsAfterCollapse", "itemsBeforeCollapse", "maxItems", "separator"]);
15880
15881 var _React$useState = react.exports.useState(false),
15882 expanded = _React$useState[0],
15883 setExpanded = _React$useState[1];
15884
15885 var renderItemsBeforeAndAfter = function renderItemsBeforeAndAfter(allItems) {
15886 var handleClickExpand = function handleClickExpand(event) {
15887 setExpanded(true); // The clicked element received the focus but gets removed from the DOM.
15888 // Let's keep the focus in the component after expanding.
15889
15890 var focusable = event.currentTarget.parentNode.querySelector('a[href],button,[tabindex]');
15891
15892 if (focusable) {
15893 focusable.focus();
15894 }
15895 }; // This defends against someone passing weird input, to ensure that if all
15896 // items would be shown anyway, we just show all items without the EllipsisItem
15897
15898
15899 if (itemsBeforeCollapse + itemsAfterCollapse >= allItems.length) {
15900
15901 return allItems;
15902 }
15903
15904 return [].concat(_toConsumableArray(allItems.slice(0, itemsBeforeCollapse)), [/*#__PURE__*/react.exports.createElement(BreadcrumbCollapsed$1, {
15905 "aria-label": expandText,
15906 key: "ellipsis",
15907 onClick: handleClickExpand
15908 })], _toConsumableArray(allItems.slice(allItems.length - itemsAfterCollapse, allItems.length)));
15909 };
15910
15911 var allItems = react.exports.Children.toArray(children).filter(function (child) {
15912
15913 return /*#__PURE__*/react.exports.isValidElement(child);
15914 }).map(function (child, index) {
15915 return /*#__PURE__*/react.exports.createElement("li", {
15916 className: classes.li,
15917 key: "child-".concat(index)
15918 }, child);
15919 });
15920 return /*#__PURE__*/react.exports.createElement(Typography$1, _extends$5({
15921 ref: ref,
15922 component: Component,
15923 color: "textSecondary",
15924 className: clsx(classes.root, className)
15925 }, other), /*#__PURE__*/react.exports.createElement("ol", {
15926 className: classes.ol
15927 }, insertSeparators(expanded || maxItems && allItems.length <= maxItems ? allItems : renderItemsBeforeAndAfter(allItems), classes.separator, separator)));
15928 });
15929 withStyles(styles$1y, {
15930 name: 'MuiBreadcrumbs'
15931 })(Breadcrumbs);
15932
15933 var styles$1x = function styles(theme) {
15934 return {
15935 /* Styles applied to the root element. */
15936 root: _extends$5({}, theme.typography.button, {
15937 boxSizing: 'border-box',
15938 minWidth: 64,
15939 padding: '6px 16px',
15940 borderRadius: theme.shape.borderRadius,
15941 color: theme.palette.text.primary,
15942 transition: theme.transitions.create(['background-color', 'box-shadow', 'border'], {
15943 duration: theme.transitions.duration.short
15944 }),
15945 '&:hover': {
15946 textDecoration: 'none',
15947 backgroundColor: alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity),
15948 // Reset on touch devices, it doesn't add specificity
15949 '@media (hover: none)': {
15950 backgroundColor: 'transparent'
15951 },
15952 '&$disabled': {
15953 backgroundColor: 'transparent'
15954 }
15955 },
15956 '&$disabled': {
15957 color: theme.palette.action.disabled
15958 }
15959 }),
15960
15961 /* Styles applied to the span element that wraps the children. */
15962 label: {
15963 width: '100%',
15964 // Ensure the correct width for iOS Safari
15965 display: 'inherit',
15966 alignItems: 'inherit',
15967 justifyContent: 'inherit'
15968 },
15969
15970 /* Styles applied to the root element if `variant="text"`. */
15971 text: {
15972 padding: '6px 8px'
15973 },
15974
15975 /* Styles applied to the root element if `variant="text"` and `color="primary"`. */
15976 textPrimary: {
15977 color: theme.palette.primary.main,
15978 '&:hover': {
15979 backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),
15980 // Reset on touch devices, it doesn't add specificity
15981 '@media (hover: none)': {
15982 backgroundColor: 'transparent'
15983 }
15984 }
15985 },
15986
15987 /* Styles applied to the root element if `variant="text"` and `color="secondary"`. */
15988 textSecondary: {
15989 color: theme.palette.secondary.main,
15990 '&:hover': {
15991 backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.hoverOpacity),
15992 // Reset on touch devices, it doesn't add specificity
15993 '@media (hover: none)': {
15994 backgroundColor: 'transparent'
15995 }
15996 }
15997 },
15998
15999 /* Styles applied to the root element if `variant="outlined"`. */
16000 outlined: {
16001 padding: '5px 15px',
16002 border: "1px solid ".concat(theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'),
16003 '&$disabled': {
16004 border: "1px solid ".concat(theme.palette.action.disabledBackground)
16005 }
16006 },
16007
16008 /* Styles applied to the root element if `variant="outlined"` and `color="primary"`. */
16009 outlinedPrimary: {
16010 color: theme.palette.primary.main,
16011 border: "1px solid ".concat(alpha(theme.palette.primary.main, 0.5)),
16012 '&:hover': {
16013 border: "1px solid ".concat(theme.palette.primary.main),
16014 backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),
16015 // Reset on touch devices, it doesn't add specificity
16016 '@media (hover: none)': {
16017 backgroundColor: 'transparent'
16018 }
16019 }
16020 },
16021
16022 /* Styles applied to the root element if `variant="outlined"` and `color="secondary"`. */
16023 outlinedSecondary: {
16024 color: theme.palette.secondary.main,
16025 border: "1px solid ".concat(alpha(theme.palette.secondary.main, 0.5)),
16026 '&:hover': {
16027 border: "1px solid ".concat(theme.palette.secondary.main),
16028 backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.hoverOpacity),
16029 // Reset on touch devices, it doesn't add specificity
16030 '@media (hover: none)': {
16031 backgroundColor: 'transparent'
16032 }
16033 },
16034 '&$disabled': {
16035 border: "1px solid ".concat(theme.palette.action.disabled)
16036 }
16037 },
16038
16039 /* Styles applied to the root element if `variant="contained"`. */
16040 contained: {
16041 color: theme.palette.getContrastText(theme.palette.grey[300]),
16042 backgroundColor: theme.palette.grey[300],
16043 boxShadow: theme.shadows[2],
16044 '&:hover': {
16045 backgroundColor: theme.palette.grey.A100,
16046 boxShadow: theme.shadows[4],
16047 // Reset on touch devices, it doesn't add specificity
16048 '@media (hover: none)': {
16049 boxShadow: theme.shadows[2],
16050 backgroundColor: theme.palette.grey[300]
16051 },
16052 '&$disabled': {
16053 backgroundColor: theme.palette.action.disabledBackground
16054 }
16055 },
16056 '&$focusVisible': {
16057 boxShadow: theme.shadows[6]
16058 },
16059 '&:active': {
16060 boxShadow: theme.shadows[8]
16061 },
16062 '&$disabled': {
16063 color: theme.palette.action.disabled,
16064 boxShadow: theme.shadows[0],
16065 backgroundColor: theme.palette.action.disabledBackground
16066 }
16067 },
16068
16069 /* Styles applied to the root element if `variant="contained"` and `color="primary"`. */
16070 containedPrimary: {
16071 color: theme.palette.primary.contrastText,
16072 backgroundColor: theme.palette.primary.main,
16073 '&:hover': {
16074 backgroundColor: theme.palette.primary.dark,
16075 // Reset on touch devices, it doesn't add specificity
16076 '@media (hover: none)': {
16077 backgroundColor: theme.palette.primary.main
16078 }
16079 }
16080 },
16081
16082 /* Styles applied to the root element if `variant="contained"` and `color="secondary"`. */
16083 containedSecondary: {
16084 color: theme.palette.secondary.contrastText,
16085 backgroundColor: theme.palette.secondary.main,
16086 '&:hover': {
16087 backgroundColor: theme.palette.secondary.dark,
16088 // Reset on touch devices, it doesn't add specificity
16089 '@media (hover: none)': {
16090 backgroundColor: theme.palette.secondary.main
16091 }
16092 }
16093 },
16094
16095 /* Styles applied to the root element if `disableElevation={true}`. */
16096 disableElevation: {
16097 boxShadow: 'none',
16098 '&:hover': {
16099 boxShadow: 'none'
16100 },
16101 '&$focusVisible': {
16102 boxShadow: 'none'
16103 },
16104 '&:active': {
16105 boxShadow: 'none'
16106 },
16107 '&$disabled': {
16108 boxShadow: 'none'
16109 }
16110 },
16111
16112 /* Pseudo-class applied to the ButtonBase root element if the button is keyboard focused. */
16113 focusVisible: {},
16114
16115 /* Pseudo-class applied to the root element if `disabled={true}`. */
16116 disabled: {},
16117
16118 /* Styles applied to the root element if `color="inherit"`. */
16119 colorInherit: {
16120 color: 'inherit',
16121 borderColor: 'currentColor'
16122 },
16123
16124 /* Styles applied to the root element if `size="small"` and `variant="text"`. */
16125 textSizeSmall: {
16126 padding: '4px 5px',
16127 fontSize: theme.typography.pxToRem(13)
16128 },
16129
16130 /* Styles applied to the root element if `size="large"` and `variant="text"`. */
16131 textSizeLarge: {
16132 padding: '8px 11px',
16133 fontSize: theme.typography.pxToRem(15)
16134 },
16135
16136 /* Styles applied to the root element if `size="small"` and `variant="outlined"`. */
16137 outlinedSizeSmall: {
16138 padding: '3px 9px',
16139 fontSize: theme.typography.pxToRem(13)
16140 },
16141
16142 /* Styles applied to the root element if `size="large"` and `variant="outlined"`. */
16143 outlinedSizeLarge: {
16144 padding: '7px 21px',
16145 fontSize: theme.typography.pxToRem(15)
16146 },
16147
16148 /* Styles applied to the root element if `size="small"` and `variant="contained"`. */
16149 containedSizeSmall: {
16150 padding: '4px 10px',
16151 fontSize: theme.typography.pxToRem(13)
16152 },
16153
16154 /* Styles applied to the root element if `size="large"` and `variant="contained"`. */
16155 containedSizeLarge: {
16156 padding: '8px 22px',
16157 fontSize: theme.typography.pxToRem(15)
16158 },
16159
16160 /* Styles applied to the root element if `size="small"`. */
16161 sizeSmall: {},
16162
16163 /* Styles applied to the root element if `size="large"`. */
16164 sizeLarge: {},
16165
16166 /* Styles applied to the root element if `fullWidth={true}`. */
16167 fullWidth: {
16168 width: '100%'
16169 },
16170
16171 /* Styles applied to the startIcon element if supplied. */
16172 startIcon: {
16173 display: 'inherit',
16174 marginRight: 8,
16175 marginLeft: -4,
16176 '&$iconSizeSmall': {
16177 marginLeft: -2
16178 }
16179 },
16180
16181 /* Styles applied to the endIcon element if supplied. */
16182 endIcon: {
16183 display: 'inherit',
16184 marginRight: -4,
16185 marginLeft: 8,
16186 '&$iconSizeSmall': {
16187 marginRight: -2
16188 }
16189 },
16190
16191 /* Styles applied to the icon element if supplied and `size="small"`. */
16192 iconSizeSmall: {
16193 '& > *:first-child': {
16194 fontSize: 18
16195 }
16196 },
16197
16198 /* Styles applied to the icon element if supplied and `size="medium"`. */
16199 iconSizeMedium: {
16200 '& > *:first-child': {
16201 fontSize: 20
16202 }
16203 },
16204
16205 /* Styles applied to the icon element if supplied and `size="large"`. */
16206 iconSizeLarge: {
16207 '& > *:first-child': {
16208 fontSize: 22
16209 }
16210 }
16211 };
16212 };
16213 var Button = /*#__PURE__*/react.exports.forwardRef(function Button(props, ref) {
16214 var children = props.children,
16215 classes = props.classes,
16216 className = props.className,
16217 _props$color = props.color,
16218 color = _props$color === void 0 ? 'default' : _props$color,
16219 _props$component = props.component,
16220 component = _props$component === void 0 ? 'button' : _props$component,
16221 _props$disabled = props.disabled,
16222 disabled = _props$disabled === void 0 ? false : _props$disabled,
16223 _props$disableElevati = props.disableElevation,
16224 disableElevation = _props$disableElevati === void 0 ? false : _props$disableElevati,
16225 _props$disableFocusRi = props.disableFocusRipple,
16226 disableFocusRipple = _props$disableFocusRi === void 0 ? false : _props$disableFocusRi,
16227 endIconProp = props.endIcon,
16228 focusVisibleClassName = props.focusVisibleClassName,
16229 _props$fullWidth = props.fullWidth,
16230 fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
16231 _props$size = props.size,
16232 size = _props$size === void 0 ? 'medium' : _props$size,
16233 startIconProp = props.startIcon,
16234 _props$type = props.type,
16235 type = _props$type === void 0 ? 'button' : _props$type,
16236 _props$variant = props.variant,
16237 variant = _props$variant === void 0 ? 'text' : _props$variant,
16238 other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "component", "disabled", "disableElevation", "disableFocusRipple", "endIcon", "focusVisibleClassName", "fullWidth", "size", "startIcon", "type", "variant"]);
16239
16240 var startIcon = startIconProp && /*#__PURE__*/react.exports.createElement("span", {
16241 className: clsx(classes.startIcon, classes["iconSize".concat(capitalize(size))])
16242 }, startIconProp);
16243 var endIcon = endIconProp && /*#__PURE__*/react.exports.createElement("span", {
16244 className: clsx(classes.endIcon, classes["iconSize".concat(capitalize(size))])
16245 }, endIconProp);
16246 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
16247 className: clsx(classes.root, classes[variant], className, color === 'inherit' ? classes.colorInherit : color !== 'default' && classes["".concat(variant).concat(capitalize(color))], size !== 'medium' && [classes["".concat(variant, "Size").concat(capitalize(size))], classes["size".concat(capitalize(size))]], disableElevation && classes.disableElevation, disabled && classes.disabled, fullWidth && classes.fullWidth),
16248 component: component,
16249 disabled: disabled,
16250 focusRipple: !disableFocusRipple,
16251 focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),
16252 ref: ref,
16253 type: type
16254 }, other), /*#__PURE__*/react.exports.createElement("span", {
16255 className: classes.label
16256 }, startIcon, children, endIcon));
16257 });
16258 var Button$1 = withStyles(styles$1x, {
16259 name: 'MuiButton'
16260 })(Button);
16261
16262 // eslint-disable-next-line no-unused-expressions
16263
16264 Button$1.styles;
16265 var styles$1w = function styles(theme) {
16266 return {
16267 /* Styles applied to the root element. */
16268 root: {
16269 display: 'inline-flex',
16270 borderRadius: theme.shape.borderRadius
16271 },
16272
16273 /* Styles applied to the root element if `variant="contained"`. */
16274 contained: {
16275 boxShadow: theme.shadows[2]
16276 },
16277
16278 /* Styles applied to the root element if `disableElevation={true}`. */
16279 disableElevation: {
16280 boxShadow: 'none'
16281 },
16282
16283 /* Pseudo-class applied to child elements if `disabled={true}`. */
16284 disabled: {},
16285
16286 /* Styles applied to the root element if `fullWidth={true}`. */
16287 fullWidth: {
16288 width: '100%'
16289 },
16290
16291 /* Styles applied to the root element if `orientation="vertical"`. */
16292 vertical: {
16293 flexDirection: 'column'
16294 },
16295
16296 /* Styles applied to the children. */
16297 grouped: {
16298 minWidth: 40
16299 },
16300
16301 /* Styles applied to the children if `orientation="horizontal"`. */
16302 groupedHorizontal: {
16303 '&:not(:first-child)': {
16304 borderTopLeftRadius: 0,
16305 borderBottomLeftRadius: 0
16306 },
16307 '&:not(:last-child)': {
16308 borderTopRightRadius: 0,
16309 borderBottomRightRadius: 0
16310 }
16311 },
16312
16313 /* Styles applied to the children if `orientation="vertical"`. */
16314 groupedVertical: {
16315 '&:not(:first-child)': {
16316 borderTopRightRadius: 0,
16317 borderTopLeftRadius: 0
16318 },
16319 '&:not(:last-child)': {
16320 borderBottomRightRadius: 0,
16321 borderBottomLeftRadius: 0
16322 }
16323 },
16324
16325 /* Styles applied to the children if `variant="text"`. */
16326 groupedText: {},
16327
16328 /* Styles applied to the children if `variant="text"` and `orientation="horizontal"`. */
16329 groupedTextHorizontal: {
16330 '&:not(:last-child)': {
16331 borderRight: "1px solid ".concat(theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)')
16332 }
16333 },
16334
16335 /* Styles applied to the children if `variant="text"` and `orientation="vertical"`. */
16336 groupedTextVertical: {
16337 '&:not(:last-child)': {
16338 borderBottom: "1px solid ".concat(theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)')
16339 }
16340 },
16341
16342 /* Styles applied to the children if `variant="text"` and `color="primary"`. */
16343 groupedTextPrimary: {
16344 '&:not(:last-child)': {
16345 borderColor: alpha(theme.palette.primary.main, 0.5)
16346 }
16347 },
16348
16349 /* Styles applied to the children if `variant="text"` and `color="secondary"`. */
16350 groupedTextSecondary: {
16351 '&:not(:last-child)': {
16352 borderColor: alpha(theme.palette.secondary.main, 0.5)
16353 }
16354 },
16355
16356 /* Styles applied to the children if `variant="outlined"`. */
16357 groupedOutlined: {},
16358
16359 /* Styles applied to the children if `variant="outlined"` and `orientation="horizontal"`. */
16360 groupedOutlinedHorizontal: {
16361 '&:not(:first-child)': {
16362 marginLeft: -1
16363 },
16364 '&:not(:last-child)': {
16365 borderRightColor: 'transparent'
16366 }
16367 },
16368
16369 /* Styles applied to the children if `variant="outlined"` and `orientation="vertical"`. */
16370 groupedOutlinedVertical: {
16371 '&:not(:first-child)': {
16372 marginTop: -1
16373 },
16374 '&:not(:last-child)': {
16375 borderBottomColor: 'transparent'
16376 }
16377 },
16378
16379 /* Styles applied to the children if `variant="outlined"` and `color="primary"`. */
16380 groupedOutlinedPrimary: {
16381 '&:hover': {
16382 borderColor: theme.palette.primary.main
16383 }
16384 },
16385
16386 /* Styles applied to the children if `variant="outlined"` and `color="secondary"`. */
16387 groupedOutlinedSecondary: {
16388 '&:hover': {
16389 borderColor: theme.palette.secondary.main
16390 }
16391 },
16392
16393 /* Styles applied to the children if `variant="contained"`. */
16394 groupedContained: {
16395 boxShadow: 'none'
16396 },
16397
16398 /* Styles applied to the children if `variant="contained"` and `orientation="horizontal"`. */
16399 groupedContainedHorizontal: {
16400 '&:not(:last-child)': {
16401 borderRight: "1px solid ".concat(theme.palette.grey[400]),
16402 '&$disabled': {
16403 borderRight: "1px solid ".concat(theme.palette.action.disabled)
16404 }
16405 }
16406 },
16407
16408 /* Styles applied to the children if `variant="contained"` and `orientation="vertical"`. */
16409 groupedContainedVertical: {
16410 '&:not(:last-child)': {
16411 borderBottom: "1px solid ".concat(theme.palette.grey[400]),
16412 '&$disabled': {
16413 borderBottom: "1px solid ".concat(theme.palette.action.disabled)
16414 }
16415 }
16416 },
16417
16418 /* Styles applied to the children if `variant="contained"` and `color="primary"`. */
16419 groupedContainedPrimary: {
16420 '&:not(:last-child)': {
16421 borderColor: theme.palette.primary.dark
16422 }
16423 },
16424
16425 /* Styles applied to the children if `variant="contained"` and `color="secondary"`. */
16426 groupedContainedSecondary: {
16427 '&:not(:last-child)': {
16428 borderColor: theme.palette.secondary.dark
16429 }
16430 }
16431 };
16432 };
16433 var ButtonGroup = /*#__PURE__*/react.exports.forwardRef(function ButtonGroup(props, ref) {
16434 var children = props.children,
16435 classes = props.classes,
16436 className = props.className,
16437 _props$color = props.color,
16438 color = _props$color === void 0 ? 'default' : _props$color,
16439 _props$component = props.component,
16440 Component = _props$component === void 0 ? 'div' : _props$component,
16441 _props$disabled = props.disabled,
16442 disabled = _props$disabled === void 0 ? false : _props$disabled,
16443 _props$disableElevati = props.disableElevation,
16444 disableElevation = _props$disableElevati === void 0 ? false : _props$disableElevati,
16445 _props$disableFocusRi = props.disableFocusRipple,
16446 disableFocusRipple = _props$disableFocusRi === void 0 ? false : _props$disableFocusRi,
16447 _props$disableRipple = props.disableRipple,
16448 disableRipple = _props$disableRipple === void 0 ? false : _props$disableRipple,
16449 _props$fullWidth = props.fullWidth,
16450 fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
16451 _props$orientation = props.orientation,
16452 orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
16453 _props$size = props.size,
16454 size = _props$size === void 0 ? 'medium' : _props$size,
16455 _props$variant = props.variant,
16456 variant = _props$variant === void 0 ? 'outlined' : _props$variant,
16457 other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "component", "disabled", "disableElevation", "disableFocusRipple", "disableRipple", "fullWidth", "orientation", "size", "variant"]);
16458
16459 var buttonClassName = clsx(classes.grouped, classes["grouped".concat(capitalize(orientation))], classes["grouped".concat(capitalize(variant))], classes["grouped".concat(capitalize(variant)).concat(capitalize(orientation))], classes["grouped".concat(capitalize(variant)).concat(color !== 'default' ? capitalize(color) : '')], disabled && classes.disabled);
16460 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
16461 role: "group",
16462 className: clsx(classes.root, className, fullWidth && classes.fullWidth, disableElevation && classes.disableElevation, variant === 'contained' && classes.contained, orientation === 'vertical' && classes.vertical),
16463 ref: ref
16464 }, other), react.exports.Children.map(children, function (child) {
16465 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
16466 return null;
16467 }
16468
16469 return /*#__PURE__*/react.exports.cloneElement(child, {
16470 className: clsx(buttonClassName, child.props.className),
16471 color: child.props.color || color,
16472 disabled: child.props.disabled || disabled,
16473 disableElevation: child.props.disableElevation || disableElevation,
16474 disableFocusRipple: disableFocusRipple,
16475 disableRipple: disableRipple,
16476 fullWidth: fullWidth,
16477 size: child.props.size || size,
16478 variant: child.props.variant || variant
16479 });
16480 }));
16481 });
16482 withStyles(styles$1w, {
16483 name: 'MuiButtonGroup'
16484 })(ButtonGroup);
16485
16486 var styles$1v = {
16487 /* Styles applied to the root element. */
16488 root: {
16489 overflow: 'hidden'
16490 }
16491 };
16492 var Card = /*#__PURE__*/react.exports.forwardRef(function Card(props, ref) {
16493 var classes = props.classes,
16494 className = props.className,
16495 _props$raised = props.raised,
16496 raised = _props$raised === void 0 ? false : _props$raised,
16497 other = _objectWithoutProperties(props, ["classes", "className", "raised"]);
16498
16499 return /*#__PURE__*/react.exports.createElement(Paper$1, _extends$5({
16500 className: clsx(classes.root, className),
16501 elevation: raised ? 8 : 1,
16502 ref: ref
16503 }, other));
16504 });
16505 withStyles(styles$1v, {
16506 name: 'MuiCard'
16507 })(Card);
16508
16509 var styles$1u = function styles(theme) {
16510 return {
16511 /* Styles applied to the root element. */
16512 root: {
16513 display: 'block',
16514 textAlign: 'inherit',
16515 width: '100%',
16516 '&:hover $focusHighlight': {
16517 opacity: theme.palette.action.hoverOpacity
16518 },
16519 '&$focusVisible $focusHighlight': {
16520 opacity: 0.12
16521 }
16522 },
16523
16524 /* Pseudo-class applied to the ButtonBase root element if the action area is keyboard focused. */
16525 focusVisible: {},
16526
16527 /* Styles applied to the overlay that covers the action area when it is keyboard focused. */
16528 focusHighlight: {
16529 overflow: 'hidden',
16530 pointerEvents: 'none',
16531 position: 'absolute',
16532 top: 0,
16533 right: 0,
16534 bottom: 0,
16535 left: 0,
16536 borderRadius: 'inherit',
16537 opacity: 0,
16538 backgroundColor: 'currentcolor',
16539 transition: theme.transitions.create('opacity', {
16540 duration: theme.transitions.duration.short
16541 })
16542 }
16543 };
16544 };
16545 var CardActionArea = /*#__PURE__*/react.exports.forwardRef(function CardActionArea(props, ref) {
16546 var children = props.children,
16547 classes = props.classes,
16548 className = props.className,
16549 focusVisibleClassName = props.focusVisibleClassName,
16550 other = _objectWithoutProperties(props, ["children", "classes", "className", "focusVisibleClassName"]);
16551
16552 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
16553 className: clsx(classes.root, className),
16554 focusVisibleClassName: clsx(focusVisibleClassName, classes.focusVisible),
16555 ref: ref
16556 }, other), children, /*#__PURE__*/react.exports.createElement("span", {
16557 className: classes.focusHighlight
16558 }));
16559 });
16560 withStyles(styles$1u, {
16561 name: 'MuiCardActionArea'
16562 })(CardActionArea);
16563
16564 var styles$1t = {
16565 /* Styles applied to the root element. */
16566 root: {
16567 display: 'flex',
16568 alignItems: 'center',
16569 padding: 8
16570 },
16571
16572 /* Styles applied to the root element if `disableSpacing={false}`. */
16573 spacing: {
16574 '& > :not(:first-child)': {
16575 marginLeft: 8
16576 }
16577 }
16578 };
16579 var CardActions = /*#__PURE__*/react.exports.forwardRef(function CardActions(props, ref) {
16580 var _props$disableSpacing = props.disableSpacing,
16581 disableSpacing = _props$disableSpacing === void 0 ? false : _props$disableSpacing,
16582 classes = props.classes,
16583 className = props.className,
16584 other = _objectWithoutProperties(props, ["disableSpacing", "classes", "className"]);
16585
16586 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
16587 className: clsx(classes.root, className, !disableSpacing && classes.spacing),
16588 ref: ref
16589 }, other));
16590 });
16591 withStyles(styles$1t, {
16592 name: 'MuiCardActions'
16593 })(CardActions);
16594
16595 var styles$1s = {
16596 /* Styles applied to the root element. */
16597 root: {
16598 padding: 16,
16599 '&:last-child': {
16600 paddingBottom: 24
16601 }
16602 }
16603 };
16604 var CardContent = /*#__PURE__*/react.exports.forwardRef(function CardContent(props, ref) {
16605 var classes = props.classes,
16606 className = props.className,
16607 _props$component = props.component,
16608 Component = _props$component === void 0 ? 'div' : _props$component,
16609 other = _objectWithoutProperties(props, ["classes", "className", "component"]);
16610
16611 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
16612 className: clsx(classes.root, className),
16613 ref: ref
16614 }, other));
16615 });
16616 withStyles(styles$1s, {
16617 name: 'MuiCardContent'
16618 })(CardContent);
16619
16620 var styles$1r = {
16621 /* Styles applied to the root element. */
16622 root: {
16623 display: 'flex',
16624 alignItems: 'center',
16625 padding: 16
16626 },
16627
16628 /* Styles applied to the avatar element. */
16629 avatar: {
16630 flex: '0 0 auto',
16631 marginRight: 16
16632 },
16633
16634 /* Styles applied to the action element. */
16635 action: {
16636 flex: '0 0 auto',
16637 alignSelf: 'flex-start',
16638 marginTop: -8,
16639 marginRight: -8
16640 },
16641
16642 /* Styles applied to the content wrapper element. */
16643 content: {
16644 flex: '1 1 auto'
16645 },
16646
16647 /* Styles applied to the title Typography element. */
16648 title: {},
16649
16650 /* Styles applied to the subheader Typography element. */
16651 subheader: {}
16652 };
16653 var CardHeader = /*#__PURE__*/react.exports.forwardRef(function CardHeader(props, ref) {
16654 var action = props.action,
16655 avatar = props.avatar,
16656 classes = props.classes,
16657 className = props.className,
16658 _props$component = props.component,
16659 Component = _props$component === void 0 ? 'div' : _props$component,
16660 _props$disableTypogra = props.disableTypography,
16661 disableTypography = _props$disableTypogra === void 0 ? false : _props$disableTypogra,
16662 subheaderProp = props.subheader,
16663 subheaderTypographyProps = props.subheaderTypographyProps,
16664 titleProp = props.title,
16665 titleTypographyProps = props.titleTypographyProps,
16666 other = _objectWithoutProperties(props, ["action", "avatar", "classes", "className", "component", "disableTypography", "subheader", "subheaderTypographyProps", "title", "titleTypographyProps"]);
16667
16668 var title = titleProp;
16669
16670 if (title != null && title.type !== Typography$1 && !disableTypography) {
16671 title = /*#__PURE__*/react.exports.createElement(Typography$1, _extends$5({
16672 variant: avatar ? 'body2' : 'h5',
16673 className: classes.title,
16674 component: "span",
16675 display: "block"
16676 }, titleTypographyProps), title);
16677 }
16678
16679 var subheader = subheaderProp;
16680
16681 if (subheader != null && subheader.type !== Typography$1 && !disableTypography) {
16682 subheader = /*#__PURE__*/react.exports.createElement(Typography$1, _extends$5({
16683 variant: avatar ? 'body2' : 'body1',
16684 className: classes.subheader,
16685 color: "textSecondary",
16686 component: "span",
16687 display: "block"
16688 }, subheaderTypographyProps), subheader);
16689 }
16690
16691 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
16692 className: clsx(classes.root, className),
16693 ref: ref
16694 }, other), avatar && /*#__PURE__*/react.exports.createElement("div", {
16695 className: classes.avatar
16696 }, avatar), /*#__PURE__*/react.exports.createElement("div", {
16697 className: classes.content
16698 }, title, subheader), action && /*#__PURE__*/react.exports.createElement("div", {
16699 className: classes.action
16700 }, action));
16701 });
16702 withStyles(styles$1r, {
16703 name: 'MuiCardHeader'
16704 })(CardHeader);
16705
16706 var styles$1q = {
16707 /* Styles applied to the root element. */
16708 root: {
16709 display: 'block',
16710 backgroundSize: 'cover',
16711 backgroundRepeat: 'no-repeat',
16712 backgroundPosition: 'center'
16713 },
16714
16715 /* Styles applied to the root element if `component="video, audio, picture, iframe, or img"`. */
16716 media: {
16717 width: '100%'
16718 },
16719
16720 /* Styles applied to the root element if `component="picture or img"`. */
16721 img: {
16722 // ⚠️ object-fit is not supported by IE 11.
16723 objectFit: 'cover'
16724 }
16725 };
16726 var MEDIA_COMPONENTS = ['video', 'audio', 'picture', 'iframe', 'img'];
16727 var CardMedia = /*#__PURE__*/react.exports.forwardRef(function CardMedia(props, ref) {
16728 var children = props.children,
16729 classes = props.classes,
16730 className = props.className,
16731 _props$component = props.component,
16732 Component = _props$component === void 0 ? 'div' : _props$component,
16733 image = props.image,
16734 src = props.src,
16735 style = props.style,
16736 other = _objectWithoutProperties(props, ["children", "classes", "className", "component", "image", "src", "style"]);
16737
16738 var isMediaComponent = MEDIA_COMPONENTS.indexOf(Component) !== -1;
16739 var composedStyle = !isMediaComponent && image ? _extends$5({
16740 backgroundImage: "url(\"".concat(image, "\")")
16741 }, style) : style;
16742 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
16743 className: clsx(classes.root, className, isMediaComponent && classes.media, "picture img".indexOf(Component) !== -1 && classes.img),
16744 ref: ref,
16745 style: composedStyle,
16746 src: isMediaComponent ? image || src : undefined
16747 }, other), children);
16748 });
16749 withStyles(styles$1q, {
16750 name: 'MuiCardMedia'
16751 })(CardMedia);
16752
16753 /**
16754 * @ignore - internal component.
16755 */
16756
16757 var FormControlContext = react.exports.createContext();
16758
16759 function useFormControl$1() {
16760 return react.exports.useContext(FormControlContext);
16761 }
16762
16763 function useFormControl() {
16764 return react.exports.useContext(FormControlContext);
16765 }
16766
16767 var styles$1p = {
16768 root: {
16769 padding: 9
16770 },
16771 checked: {},
16772 disabled: {},
16773 input: {
16774 cursor: 'inherit',
16775 position: 'absolute',
16776 opacity: 0,
16777 width: '100%',
16778 height: '100%',
16779 top: 0,
16780 left: 0,
16781 margin: 0,
16782 padding: 0,
16783 zIndex: 1
16784 }
16785 };
16786 /**
16787 * @ignore - internal component.
16788 */
16789
16790 var SwitchBase = /*#__PURE__*/react.exports.forwardRef(function SwitchBase(props, ref) {
16791 var autoFocus = props.autoFocus,
16792 checkedProp = props.checked,
16793 checkedIcon = props.checkedIcon,
16794 classes = props.classes,
16795 className = props.className,
16796 defaultChecked = props.defaultChecked,
16797 disabledProp = props.disabled,
16798 icon = props.icon,
16799 id = props.id,
16800 inputProps = props.inputProps,
16801 inputRef = props.inputRef,
16802 name = props.name,
16803 onBlur = props.onBlur,
16804 onChange = props.onChange,
16805 onFocus = props.onFocus,
16806 readOnly = props.readOnly,
16807 required = props.required,
16808 tabIndex = props.tabIndex,
16809 type = props.type,
16810 value = props.value,
16811 other = _objectWithoutProperties(props, ["autoFocus", "checked", "checkedIcon", "classes", "className", "defaultChecked", "disabled", "icon", "id", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "readOnly", "required", "tabIndex", "type", "value"]);
16812
16813 var _useControlled = useControlled({
16814 controlled: checkedProp,
16815 default: Boolean(defaultChecked),
16816 name: 'SwitchBase',
16817 state: 'checked'
16818 }),
16819 _useControlled2 = _slicedToArray(_useControlled, 2),
16820 checked = _useControlled2[0],
16821 setCheckedState = _useControlled2[1];
16822
16823 var muiFormControl = useFormControl();
16824
16825 var handleFocus = function handleFocus(event) {
16826 if (onFocus) {
16827 onFocus(event);
16828 }
16829
16830 if (muiFormControl && muiFormControl.onFocus) {
16831 muiFormControl.onFocus(event);
16832 }
16833 };
16834
16835 var handleBlur = function handleBlur(event) {
16836 if (onBlur) {
16837 onBlur(event);
16838 }
16839
16840 if (muiFormControl && muiFormControl.onBlur) {
16841 muiFormControl.onBlur(event);
16842 }
16843 };
16844
16845 var handleInputChange = function handleInputChange(event) {
16846 var newChecked = event.target.checked;
16847 setCheckedState(newChecked);
16848
16849 if (onChange) {
16850 // TODO v5: remove the second argument.
16851 onChange(event, newChecked);
16852 }
16853 };
16854
16855 var disabled = disabledProp;
16856
16857 if (muiFormControl) {
16858 if (typeof disabled === 'undefined') {
16859 disabled = muiFormControl.disabled;
16860 }
16861 }
16862
16863 var hasLabelFor = type === 'checkbox' || type === 'radio';
16864 return /*#__PURE__*/react.exports.createElement(IconButton$1, _extends$5({
16865 component: "span",
16866 className: clsx(classes.root, className, checked && classes.checked, disabled && classes.disabled),
16867 disabled: disabled,
16868 tabIndex: null,
16869 role: undefined,
16870 onFocus: handleFocus,
16871 onBlur: handleBlur,
16872 ref: ref
16873 }, other), /*#__PURE__*/react.exports.createElement("input", _extends$5({
16874 autoFocus: autoFocus,
16875 checked: checkedProp,
16876 defaultChecked: defaultChecked,
16877 className: classes.input,
16878 disabled: disabled,
16879 id: hasLabelFor && id,
16880 name: name,
16881 onChange: handleInputChange,
16882 readOnly: readOnly,
16883 ref: inputRef,
16884 required: required,
16885 tabIndex: tabIndex,
16886 type: type,
16887 value: value
16888 }, inputProps)), checked ? checkedIcon : icon);
16889 }); // NB: If changed, please update Checkbox, Switch and Radio
16890 var SwitchBase$1 = withStyles(styles$1p, {
16891 name: 'PrivateSwitchBase'
16892 })(SwitchBase);
16893
16894 /**
16895 * @ignore - internal component.
16896 */
16897
16898 var CheckBoxOutlineBlankIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
16899 d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
16900 }));
16901
16902 /**
16903 * @ignore - internal component.
16904 */
16905
16906 var CheckBoxIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
16907 d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
16908 }));
16909
16910 /**
16911 * @ignore - internal component.
16912 */
16913
16914 var IndeterminateCheckBoxIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
16915 d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"
16916 }));
16917
16918 var styles$1o = function styles(theme) {
16919 return {
16920 /* Styles applied to the root element. */
16921 root: {
16922 color: theme.palette.text.secondary
16923 },
16924
16925 /* Pseudo-class applied to the root element if `checked={true}`. */
16926 checked: {},
16927
16928 /* Pseudo-class applied to the root element if `disabled={true}`. */
16929 disabled: {},
16930
16931 /* Pseudo-class applied to the root element if `indeterminate={true}`. */
16932 indeterminate: {},
16933
16934 /* Styles applied to the root element if `color="primary"`. */
16935 colorPrimary: {
16936 '&$checked': {
16937 color: theme.palette.primary.main,
16938 '&:hover': {
16939 backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),
16940 // Reset on touch devices, it doesn't add specificity
16941 '@media (hover: none)': {
16942 backgroundColor: 'transparent'
16943 }
16944 }
16945 },
16946 '&$disabled': {
16947 color: theme.palette.action.disabled
16948 }
16949 },
16950
16951 /* Styles applied to the root element if `color="secondary"`. */
16952 colorSecondary: {
16953 '&$checked': {
16954 color: theme.palette.secondary.main,
16955 '&:hover': {
16956 backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.hoverOpacity),
16957 // Reset on touch devices, it doesn't add specificity
16958 '@media (hover: none)': {
16959 backgroundColor: 'transparent'
16960 }
16961 }
16962 },
16963 '&$disabled': {
16964 color: theme.palette.action.disabled
16965 }
16966 }
16967 };
16968 };
16969 var defaultCheckedIcon$1 = /*#__PURE__*/react.exports.createElement(CheckBoxIcon, null);
16970 var defaultIcon$1 = /*#__PURE__*/react.exports.createElement(CheckBoxOutlineBlankIcon, null);
16971 var defaultIndeterminateIcon = /*#__PURE__*/react.exports.createElement(IndeterminateCheckBoxIcon, null);
16972 var Checkbox = /*#__PURE__*/react.exports.forwardRef(function Checkbox(props, ref) {
16973 var _props$checkedIcon = props.checkedIcon,
16974 checkedIcon = _props$checkedIcon === void 0 ? defaultCheckedIcon$1 : _props$checkedIcon,
16975 classes = props.classes,
16976 _props$color = props.color,
16977 color = _props$color === void 0 ? 'secondary' : _props$color,
16978 _props$icon = props.icon,
16979 iconProp = _props$icon === void 0 ? defaultIcon$1 : _props$icon,
16980 _props$indeterminate = props.indeterminate,
16981 indeterminate = _props$indeterminate === void 0 ? false : _props$indeterminate,
16982 _props$indeterminateI = props.indeterminateIcon,
16983 indeterminateIconProp = _props$indeterminateI === void 0 ? defaultIndeterminateIcon : _props$indeterminateI,
16984 inputProps = props.inputProps,
16985 _props$size = props.size,
16986 size = _props$size === void 0 ? 'medium' : _props$size,
16987 other = _objectWithoutProperties(props, ["checkedIcon", "classes", "color", "icon", "indeterminate", "indeterminateIcon", "inputProps", "size"]);
16988
16989 var icon = indeterminate ? indeterminateIconProp : iconProp;
16990 var indeterminateIcon = indeterminate ? indeterminateIconProp : checkedIcon;
16991 return /*#__PURE__*/react.exports.createElement(SwitchBase$1, _extends$5({
16992 type: "checkbox",
16993 classes: {
16994 root: clsx(classes.root, classes["color".concat(capitalize(color))], indeterminate && classes.indeterminate),
16995 checked: classes.checked,
16996 disabled: classes.disabled
16997 },
16998 color: color,
16999 inputProps: _extends$5({
17000 'data-indeterminate': indeterminate
17001 }, inputProps),
17002 icon: /*#__PURE__*/react.exports.cloneElement(icon, {
17003 fontSize: icon.props.fontSize === undefined && size === "small" ? size : icon.props.fontSize
17004 }),
17005 checkedIcon: /*#__PURE__*/react.exports.cloneElement(indeterminateIcon, {
17006 fontSize: indeterminateIcon.props.fontSize === undefined && size === "small" ? size : indeterminateIcon.props.fontSize
17007 }),
17008 ref: ref
17009 }, other));
17010 });
17011 var Checkbox$1 = withStyles(styles$1o, {
17012 name: 'MuiCheckbox'
17013 })(Checkbox);
17014
17015 /**
17016 * @ignore - internal component.
17017 */
17018
17019 var CancelIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
17020 d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"
17021 }));
17022
17023 var styles$1n = function styles(theme) {
17024 var backgroundColor = theme.palette.type === 'light' ? theme.palette.grey[300] : theme.palette.grey[700];
17025 var deleteIconColor = alpha(theme.palette.text.primary, 0.26);
17026 return {
17027 /* Styles applied to the root element. */
17028 root: {
17029 fontFamily: theme.typography.fontFamily,
17030 fontSize: theme.typography.pxToRem(13),
17031 display: 'inline-flex',
17032 alignItems: 'center',
17033 justifyContent: 'center',
17034 height: 32,
17035 color: theme.palette.getContrastText(backgroundColor),
17036 backgroundColor: backgroundColor,
17037 borderRadius: 32 / 2,
17038 whiteSpace: 'nowrap',
17039 transition: theme.transitions.create(['background-color', 'box-shadow']),
17040 // label will inherit this from root, then `clickable` class overrides this for both
17041 cursor: 'default',
17042 // We disable the focus ring for mouse, touch and keyboard users.
17043 outline: 0,
17044 textDecoration: 'none',
17045 border: 'none',
17046 // Remove `button` border
17047 padding: 0,
17048 // Remove `button` padding
17049 verticalAlign: 'middle',
17050 boxSizing: 'border-box',
17051 '&$disabled': {
17052 opacity: 0.5,
17053 pointerEvents: 'none'
17054 },
17055 '& $avatar': {
17056 marginLeft: 5,
17057 marginRight: -6,
17058 width: 24,
17059 height: 24,
17060 color: theme.palette.type === 'light' ? theme.palette.grey[700] : theme.palette.grey[300],
17061 fontSize: theme.typography.pxToRem(12)
17062 },
17063 '& $avatarColorPrimary': {
17064 color: theme.palette.primary.contrastText,
17065 backgroundColor: theme.palette.primary.dark
17066 },
17067 '& $avatarColorSecondary': {
17068 color: theme.palette.secondary.contrastText,
17069 backgroundColor: theme.palette.secondary.dark
17070 },
17071 '& $avatarSmall': {
17072 marginLeft: 4,
17073 marginRight: -4,
17074 width: 18,
17075 height: 18,
17076 fontSize: theme.typography.pxToRem(10)
17077 }
17078 },
17079
17080 /* Styles applied to the root element if `size="small"`. */
17081 sizeSmall: {
17082 height: 24
17083 },
17084
17085 /* Styles applied to the root element if `color="primary"`. */
17086 colorPrimary: {
17087 backgroundColor: theme.palette.primary.main,
17088 color: theme.palette.primary.contrastText
17089 },
17090
17091 /* Styles applied to the root element if `color="secondary"`. */
17092 colorSecondary: {
17093 backgroundColor: theme.palette.secondary.main,
17094 color: theme.palette.secondary.contrastText
17095 },
17096
17097 /* Pseudo-class applied to the root element if `disabled={true}`. */
17098 disabled: {},
17099
17100 /* Styles applied to the root element if `onClick` is defined or `clickable={true}`. */
17101 clickable: {
17102 userSelect: 'none',
17103 WebkitTapHighlightColor: 'transparent',
17104 cursor: 'pointer',
17105 '&:hover, &:focus': {
17106 backgroundColor: emphasize(backgroundColor, 0.08)
17107 },
17108 '&:active': {
17109 boxShadow: theme.shadows[1]
17110 }
17111 },
17112
17113 /* Styles applied to the root element if `onClick` and `color="primary"` is defined or `clickable={true}`. */
17114 clickableColorPrimary: {
17115 '&:hover, &:focus': {
17116 backgroundColor: emphasize(theme.palette.primary.main, 0.08)
17117 }
17118 },
17119
17120 /* Styles applied to the root element if `onClick` and `color="secondary"` is defined or `clickable={true}`. */
17121 clickableColorSecondary: {
17122 '&:hover, &:focus': {
17123 backgroundColor: emphasize(theme.palette.secondary.main, 0.08)
17124 }
17125 },
17126
17127 /* Styles applied to the root element if `onDelete` is defined. */
17128 deletable: {
17129 '&:focus': {
17130 backgroundColor: emphasize(backgroundColor, 0.08)
17131 }
17132 },
17133
17134 /* Styles applied to the root element if `onDelete` and `color="primary"` is defined. */
17135 deletableColorPrimary: {
17136 '&:focus': {
17137 backgroundColor: emphasize(theme.palette.primary.main, 0.2)
17138 }
17139 },
17140
17141 /* Styles applied to the root element if `onDelete` and `color="secondary"` is defined. */
17142 deletableColorSecondary: {
17143 '&:focus': {
17144 backgroundColor: emphasize(theme.palette.secondary.main, 0.2)
17145 }
17146 },
17147
17148 /* Styles applied to the root element if `variant="outlined"`. */
17149 outlined: {
17150 backgroundColor: 'transparent',
17151 border: "1px solid ".concat(theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'),
17152 '$clickable&:hover, $clickable&:focus, $deletable&:focus': {
17153 backgroundColor: alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity)
17154 },
17155 '& $avatar': {
17156 marginLeft: 4
17157 },
17158 '& $avatarSmall': {
17159 marginLeft: 2
17160 },
17161 '& $icon': {
17162 marginLeft: 4
17163 },
17164 '& $iconSmall': {
17165 marginLeft: 2
17166 },
17167 '& $deleteIcon': {
17168 marginRight: 5
17169 },
17170 '& $deleteIconSmall': {
17171 marginRight: 3
17172 }
17173 },
17174
17175 /* Styles applied to the root element if `variant="outlined"` and `color="primary"`. */
17176 outlinedPrimary: {
17177 color: theme.palette.primary.main,
17178 border: "1px solid ".concat(theme.palette.primary.main),
17179 '$clickable&:hover, $clickable&:focus, $deletable&:focus': {
17180 backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity)
17181 }
17182 },
17183
17184 /* Styles applied to the root element if `variant="outlined"` and `color="secondary"`. */
17185 outlinedSecondary: {
17186 color: theme.palette.secondary.main,
17187 border: "1px solid ".concat(theme.palette.secondary.main),
17188 '$clickable&:hover, $clickable&:focus, $deletable&:focus': {
17189 backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.hoverOpacity)
17190 }
17191 },
17192 // TODO v5: remove
17193
17194 /* Styles applied to the `avatar` element. */
17195 avatar: {},
17196
17197 /* Styles applied to the `avatar` element if `size="small"`. */
17198 avatarSmall: {},
17199
17200 /* Styles applied to the `avatar` element if `color="primary"`. */
17201 avatarColorPrimary: {},
17202
17203 /* Styles applied to the `avatar` element if `color="secondary"`. */
17204 avatarColorSecondary: {},
17205
17206 /* Styles applied to the `icon` element. */
17207 icon: {
17208 color: theme.palette.type === 'light' ? theme.palette.grey[700] : theme.palette.grey[300],
17209 marginLeft: 5,
17210 marginRight: -6
17211 },
17212
17213 /* Styles applied to the `icon` element if `size="small"`. */
17214 iconSmall: {
17215 width: 18,
17216 height: 18,
17217 marginLeft: 4,
17218 marginRight: -4
17219 },
17220
17221 /* Styles applied to the `icon` element if `color="primary"`. */
17222 iconColorPrimary: {
17223 color: 'inherit'
17224 },
17225
17226 /* Styles applied to the `icon` element if `color="secondary"`. */
17227 iconColorSecondary: {
17228 color: 'inherit'
17229 },
17230
17231 /* Styles applied to the label `span` element. */
17232 label: {
17233 overflow: 'hidden',
17234 textOverflow: 'ellipsis',
17235 paddingLeft: 12,
17236 paddingRight: 12,
17237 whiteSpace: 'nowrap'
17238 },
17239
17240 /* Styles applied to the label `span` element if `size="small"`. */
17241 labelSmall: {
17242 paddingLeft: 8,
17243 paddingRight: 8
17244 },
17245
17246 /* Styles applied to the `deleteIcon` element. */
17247 deleteIcon: {
17248 WebkitTapHighlightColor: 'transparent',
17249 color: deleteIconColor,
17250 height: 22,
17251 width: 22,
17252 cursor: 'pointer',
17253 margin: '0 5px 0 -6px',
17254 '&:hover': {
17255 color: alpha(deleteIconColor, 0.4)
17256 }
17257 },
17258
17259 /* Styles applied to the `deleteIcon` element if `size="small"`. */
17260 deleteIconSmall: {
17261 height: 16,
17262 width: 16,
17263 marginRight: 4,
17264 marginLeft: -4
17265 },
17266
17267 /* Styles applied to the deleteIcon element if `color="primary"` and `variant="default"`. */
17268 deleteIconColorPrimary: {
17269 color: alpha(theme.palette.primary.contrastText, 0.7),
17270 '&:hover, &:active': {
17271 color: theme.palette.primary.contrastText
17272 }
17273 },
17274
17275 /* Styles applied to the deleteIcon element if `color="secondary"` and `variant="default"`. */
17276 deleteIconColorSecondary: {
17277 color: alpha(theme.palette.secondary.contrastText, 0.7),
17278 '&:hover, &:active': {
17279 color: theme.palette.secondary.contrastText
17280 }
17281 },
17282
17283 /* Styles applied to the deleteIcon element if `color="primary"` and `variant="outlined"`. */
17284 deleteIconOutlinedColorPrimary: {
17285 color: alpha(theme.palette.primary.main, 0.7),
17286 '&:hover, &:active': {
17287 color: theme.palette.primary.main
17288 }
17289 },
17290
17291 /* Styles applied to the deleteIcon element if `color="secondary"` and `variant="outlined"`. */
17292 deleteIconOutlinedColorSecondary: {
17293 color: alpha(theme.palette.secondary.main, 0.7),
17294 '&:hover, &:active': {
17295 color: theme.palette.secondary.main
17296 }
17297 }
17298 };
17299 };
17300
17301 function isDeleteKeyboardEvent(keyboardEvent) {
17302 return keyboardEvent.key === 'Backspace' || keyboardEvent.key === 'Delete';
17303 }
17304 /**
17305 * Chips represent complex entities in small blocks, such as a contact.
17306 */
17307
17308
17309 var Chip = /*#__PURE__*/react.exports.forwardRef(function Chip(props, ref) {
17310 var avatarProp = props.avatar,
17311 classes = props.classes,
17312 className = props.className,
17313 clickableProp = props.clickable,
17314 _props$color = props.color,
17315 color = _props$color === void 0 ? 'default' : _props$color,
17316 ComponentProp = props.component,
17317 deleteIconProp = props.deleteIcon,
17318 _props$disabled = props.disabled,
17319 disabled = _props$disabled === void 0 ? false : _props$disabled,
17320 iconProp = props.icon,
17321 label = props.label,
17322 onClick = props.onClick,
17323 onDelete = props.onDelete,
17324 onKeyDown = props.onKeyDown,
17325 onKeyUp = props.onKeyUp,
17326 _props$size = props.size,
17327 size = _props$size === void 0 ? 'medium' : _props$size,
17328 _props$variant = props.variant,
17329 variant = _props$variant === void 0 ? 'default' : _props$variant,
17330 other = _objectWithoutProperties(props, ["avatar", "classes", "className", "clickable", "color", "component", "deleteIcon", "disabled", "icon", "label", "onClick", "onDelete", "onKeyDown", "onKeyUp", "size", "variant"]);
17331
17332 var chipRef = react.exports.useRef(null);
17333 var handleRef = useForkRef(chipRef, ref);
17334
17335 var handleDeleteIconClick = function handleDeleteIconClick(event) {
17336 // Stop the event from bubbling up to the `Chip`
17337 event.stopPropagation();
17338
17339 if (onDelete) {
17340 onDelete(event);
17341 }
17342 };
17343
17344 var handleKeyDown = function handleKeyDown(event) {
17345 // Ignore events from children of `Chip`.
17346 if (event.currentTarget === event.target && isDeleteKeyboardEvent(event)) {
17347 // will be handled in keyUp, otherwise some browsers
17348 // might init navigation
17349 event.preventDefault();
17350 }
17351
17352 if (onKeyDown) {
17353 onKeyDown(event);
17354 }
17355 };
17356
17357 var handleKeyUp = function handleKeyUp(event) {
17358 // Ignore events from children of `Chip`.
17359 if (event.currentTarget === event.target) {
17360 if (onDelete && isDeleteKeyboardEvent(event)) {
17361 onDelete(event);
17362 } else if (event.key === 'Escape' && chipRef.current) {
17363 chipRef.current.blur();
17364 }
17365 }
17366
17367 if (onKeyUp) {
17368 onKeyUp(event);
17369 }
17370 };
17371
17372 var clickable = clickableProp !== false && onClick ? true : clickableProp;
17373 var small = size === 'small';
17374 var Component = ComponentProp || (clickable ? ButtonBase$1 : 'div');
17375 var moreProps = Component === ButtonBase$1 ? {
17376 component: 'div'
17377 } : {};
17378 var deleteIcon = null;
17379
17380 if (onDelete) {
17381 var customClasses = clsx(color !== 'default' && (variant === "default" ? classes["deleteIconColor".concat(capitalize(color))] : classes["deleteIconOutlinedColor".concat(capitalize(color))]), small && classes.deleteIconSmall);
17382 deleteIcon = deleteIconProp && /*#__PURE__*/react.exports.isValidElement(deleteIconProp) ? /*#__PURE__*/react.exports.cloneElement(deleteIconProp, {
17383 className: clsx(deleteIconProp.props.className, classes.deleteIcon, customClasses),
17384 onClick: handleDeleteIconClick
17385 }) : /*#__PURE__*/react.exports.createElement(CancelIcon, {
17386 className: clsx(classes.deleteIcon, customClasses),
17387 onClick: handleDeleteIconClick
17388 });
17389 }
17390
17391 var avatar = null;
17392
17393 if (avatarProp && /*#__PURE__*/react.exports.isValidElement(avatarProp)) {
17394 avatar = /*#__PURE__*/react.exports.cloneElement(avatarProp, {
17395 className: clsx(classes.avatar, avatarProp.props.className, small && classes.avatarSmall, color !== 'default' && classes["avatarColor".concat(capitalize(color))])
17396 });
17397 }
17398
17399 var icon = null;
17400
17401 if (iconProp && /*#__PURE__*/react.exports.isValidElement(iconProp)) {
17402 icon = /*#__PURE__*/react.exports.cloneElement(iconProp, {
17403 className: clsx(classes.icon, iconProp.props.className, small && classes.iconSmall, color !== 'default' && classes["iconColor".concat(capitalize(color))])
17404 });
17405 }
17406
17407 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
17408 role: clickable || onDelete ? 'button' : undefined,
17409 className: clsx(classes.root, className, color !== 'default' && [classes["color".concat(capitalize(color))], clickable && classes["clickableColor".concat(capitalize(color))], onDelete && classes["deletableColor".concat(capitalize(color))]], variant !== "default" && [classes.outlined, {
17410 'primary': classes.outlinedPrimary,
17411 'secondary': classes.outlinedSecondary
17412 }[color]], disabled && classes.disabled, small && classes.sizeSmall, clickable && classes.clickable, onDelete && classes.deletable),
17413 "aria-disabled": disabled ? true : undefined,
17414 tabIndex: clickable || onDelete ? 0 : undefined,
17415 onClick: onClick,
17416 onKeyDown: handleKeyDown,
17417 onKeyUp: handleKeyUp,
17418 ref: handleRef
17419 }, moreProps, other), avatar || icon, /*#__PURE__*/react.exports.createElement("span", {
17420 className: clsx(classes.label, small && classes.labelSmall)
17421 }, label), deleteIcon);
17422 });
17423 withStyles(styles$1n, {
17424 name: 'MuiChip'
17425 })(Chip);
17426
17427 var SIZE = 44;
17428 var styles$1m = function styles(theme) {
17429 return {
17430 /* Styles applied to the root element. */
17431 root: {
17432 display: 'inline-block'
17433 },
17434
17435 /* Styles applied to the root element if `variant="static"`. */
17436 static: {
17437 transition: theme.transitions.create('transform')
17438 },
17439
17440 /* Styles applied to the root element if `variant="indeterminate"`. */
17441 indeterminate: {
17442 animation: '$circular-rotate 1.4s linear infinite'
17443 },
17444
17445 /* Styles applied to the root element if `variant="determinate"`. */
17446 determinate: {
17447 transition: theme.transitions.create('transform')
17448 },
17449
17450 /* Styles applied to the root element if `color="primary"`. */
17451 colorPrimary: {
17452 color: theme.palette.primary.main
17453 },
17454
17455 /* Styles applied to the root element if `color="secondary"`. */
17456 colorSecondary: {
17457 color: theme.palette.secondary.main
17458 },
17459
17460 /* Styles applied to the `svg` element. */
17461 svg: {
17462 display: 'block' // Keeps the progress centered
17463
17464 },
17465
17466 /* Styles applied to the `circle` svg path. */
17467 circle: {
17468 stroke: 'currentColor' // Use butt to follow the specification, by chance, it's already the default CSS value.
17469 // strokeLinecap: 'butt',
17470
17471 },
17472
17473 /* Styles applied to the `circle` svg path if `variant="static"`. */
17474 circleStatic: {
17475 transition: theme.transitions.create('stroke-dashoffset')
17476 },
17477
17478 /* Styles applied to the `circle` svg path if `variant="indeterminate"`. */
17479 circleIndeterminate: {
17480 animation: '$circular-dash 1.4s ease-in-out infinite',
17481 // Some default value that looks fine waiting for the animation to kicks in.
17482 strokeDasharray: '80px, 200px',
17483 strokeDashoffset: '0px' // Add the unit to fix a Edge 16 and below bug.
17484
17485 },
17486
17487 /* Styles applied to the `circle` svg path if `variant="determinate"`. */
17488 circleDeterminate: {
17489 transition: theme.transitions.create('stroke-dashoffset')
17490 },
17491 '@keyframes circular-rotate': {
17492 '0%': {
17493 // Fix IE 11 wobbly
17494 transformOrigin: '50% 50%'
17495 },
17496 '100%': {
17497 transform: 'rotate(360deg)'
17498 }
17499 },
17500 '@keyframes circular-dash': {
17501 '0%': {
17502 strokeDasharray: '1px, 200px',
17503 strokeDashoffset: '0px'
17504 },
17505 '50%': {
17506 strokeDasharray: '100px, 200px',
17507 strokeDashoffset: '-15px'
17508 },
17509 '100%': {
17510 strokeDasharray: '100px, 200px',
17511 strokeDashoffset: '-125px'
17512 }
17513 },
17514
17515 /* Styles applied to the `circle` svg path if `disableShrink={true}`. */
17516 circleDisableShrink: {
17517 animation: 'none'
17518 }
17519 };
17520 };
17521 /**
17522 * ## ARIA
17523 *
17524 * If the progress bar is describing the loading progress of a particular region of a page,
17525 * you should use `aria-describedby` to point to the progress bar, and set the `aria-busy`
17526 * attribute to `true` on that region until it has finished loading.
17527 */
17528
17529 var CircularProgress = /*#__PURE__*/react.exports.forwardRef(function CircularProgress(props, ref) {
17530 var classes = props.classes,
17531 className = props.className,
17532 _props$color = props.color,
17533 color = _props$color === void 0 ? 'primary' : _props$color,
17534 _props$disableShrink = props.disableShrink,
17535 disableShrink = _props$disableShrink === void 0 ? false : _props$disableShrink,
17536 _props$size = props.size,
17537 size = _props$size === void 0 ? 40 : _props$size,
17538 style = props.style,
17539 _props$thickness = props.thickness,
17540 thickness = _props$thickness === void 0 ? 3.6 : _props$thickness,
17541 _props$value = props.value,
17542 value = _props$value === void 0 ? 0 : _props$value,
17543 _props$variant = props.variant,
17544 variant = _props$variant === void 0 ? 'indeterminate' : _props$variant,
17545 other = _objectWithoutProperties(props, ["classes", "className", "color", "disableShrink", "size", "style", "thickness", "value", "variant"]);
17546
17547 var circleStyle = {};
17548 var rootStyle = {};
17549 var rootProps = {};
17550
17551 if (variant === 'determinate' || variant === 'static') {
17552 var circumference = 2 * Math.PI * ((SIZE - thickness) / 2);
17553 circleStyle.strokeDasharray = circumference.toFixed(3);
17554 rootProps['aria-valuenow'] = Math.round(value);
17555 circleStyle.strokeDashoffset = "".concat(((100 - value) / 100 * circumference).toFixed(3), "px");
17556 rootStyle.transform = 'rotate(-90deg)';
17557 }
17558
17559 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
17560 className: clsx(classes.root, className, color !== 'inherit' && classes["color".concat(capitalize(color))], {
17561 'determinate': classes.determinate,
17562 'indeterminate': classes.indeterminate,
17563 'static': classes.static
17564 }[variant]),
17565 style: _extends$5({
17566 width: size,
17567 height: size
17568 }, rootStyle, style),
17569 ref: ref,
17570 role: "progressbar"
17571 }, rootProps, other), /*#__PURE__*/react.exports.createElement("svg", {
17572 className: classes.svg,
17573 viewBox: "".concat(SIZE / 2, " ").concat(SIZE / 2, " ").concat(SIZE, " ").concat(SIZE)
17574 }, /*#__PURE__*/react.exports.createElement("circle", {
17575 className: clsx(classes.circle, disableShrink && classes.circleDisableShrink, {
17576 'determinate': classes.circleDeterminate,
17577 'indeterminate': classes.circleIndeterminate,
17578 'static': classes.circleStatic
17579 }[variant]),
17580 style: circleStyle,
17581 cx: SIZE,
17582 cy: SIZE,
17583 r: (SIZE - thickness) / 2,
17584 fill: "none",
17585 strokeWidth: thickness
17586 })));
17587 });
17588 var CircularProgress$1 = withStyles(styles$1m, {
17589 name: 'MuiCircularProgress',
17590 flip: false
17591 })(CircularProgress);
17592
17593 function mapEventPropToEvent(eventProp) {
17594 return eventProp.substring(2).toLowerCase();
17595 }
17596
17597 function clickedRootScrollbar(event) {
17598 return document.documentElement.clientWidth < event.clientX || document.documentElement.clientHeight < event.clientY;
17599 }
17600 /**
17601 * Listen for click events that occur somewhere in the document, outside of the element itself.
17602 * For instance, if you need to hide a menu when people click anywhere else on your page.
17603 */
17604
17605
17606 function ClickAwayListener(props) {
17607 var children = props.children,
17608 _props$disableReactTr = props.disableReactTree,
17609 disableReactTree = _props$disableReactTr === void 0 ? false : _props$disableReactTr,
17610 _props$mouseEvent = props.mouseEvent,
17611 mouseEvent = _props$mouseEvent === void 0 ? 'onClick' : _props$mouseEvent,
17612 onClickAway = props.onClickAway,
17613 _props$touchEvent = props.touchEvent,
17614 touchEvent = _props$touchEvent === void 0 ? 'onTouchEnd' : _props$touchEvent;
17615 var movedRef = react.exports.useRef(false);
17616 var nodeRef = react.exports.useRef(null);
17617 var activatedRef = react.exports.useRef(false);
17618 var syntheticEventRef = react.exports.useRef(false);
17619 react.exports.useEffect(function () {
17620 // Ensure that this component is not "activated" synchronously.
17621 // https://github.com/facebook/react/issues/20074
17622 setTimeout(function () {
17623 activatedRef.current = true;
17624 }, 0);
17625 return function () {
17626 activatedRef.current = false;
17627 };
17628 }, []); // can be removed once we drop support for non ref forwarding class components
17629
17630 var handleOwnRef = react.exports.useCallback(function (instance) {
17631 // #StrictMode ready
17632 nodeRef.current = reactDom.exports.findDOMNode(instance);
17633 }, []);
17634 var handleRef = useForkRef(children.ref, handleOwnRef); // The handler doesn't take event.defaultPrevented into account:
17635 //
17636 // event.preventDefault() is meant to stop default behaviours like
17637 // clicking a checkbox to check it, hitting a button to submit a form,
17638 // and hitting left arrow to move the cursor in a text input etc.
17639 // Only special HTML elements have these default behaviors.
17640
17641 var handleClickAway = useEventCallback(function (event) {
17642 // Given developers can stop the propagation of the synthetic event,
17643 // we can only be confident with a positive value.
17644 var insideReactTree = syntheticEventRef.current;
17645 syntheticEventRef.current = false; // 1. IE 11 support, which trigger the handleClickAway even after the unbind
17646 // 2. The child might render null.
17647 // 3. Behave like a blur listener.
17648
17649 if (!activatedRef.current || !nodeRef.current || clickedRootScrollbar(event)) {
17650 return;
17651 } // Do not act if user performed touchmove
17652
17653
17654 if (movedRef.current) {
17655 movedRef.current = false;
17656 return;
17657 }
17658
17659 var insideDOM; // If not enough, can use https://github.com/DieterHolvoet/event-propagation-path/blob/master/propagationPath.js
17660
17661 if (event.composedPath) {
17662 insideDOM = event.composedPath().indexOf(nodeRef.current) > -1;
17663 } else {
17664 // TODO v6 remove dead logic https://caniuse.com/#search=composedPath.
17665 var doc = ownerDocument(nodeRef.current);
17666 insideDOM = !doc.documentElement.contains(event.target) || nodeRef.current.contains(event.target);
17667 }
17668
17669 if (!insideDOM && (disableReactTree || !insideReactTree)) {
17670 onClickAway(event);
17671 }
17672 }); // Keep track of mouse/touch events that bubbled up through the portal.
17673
17674 var createHandleSynthetic = function createHandleSynthetic(handlerName) {
17675 return function (event) {
17676 syntheticEventRef.current = true;
17677 var childrenPropsHandler = children.props[handlerName];
17678
17679 if (childrenPropsHandler) {
17680 childrenPropsHandler(event);
17681 }
17682 };
17683 };
17684
17685 var childrenProps = {
17686 ref: handleRef
17687 };
17688
17689 if (touchEvent !== false) {
17690 childrenProps[touchEvent] = createHandleSynthetic(touchEvent);
17691 }
17692
17693 react.exports.useEffect(function () {
17694 if (touchEvent !== false) {
17695 var mappedTouchEvent = mapEventPropToEvent(touchEvent);
17696 var doc = ownerDocument(nodeRef.current);
17697
17698 var handleTouchMove = function handleTouchMove() {
17699 movedRef.current = true;
17700 };
17701
17702 doc.addEventListener(mappedTouchEvent, handleClickAway);
17703 doc.addEventListener('touchmove', handleTouchMove);
17704 return function () {
17705 doc.removeEventListener(mappedTouchEvent, handleClickAway);
17706 doc.removeEventListener('touchmove', handleTouchMove);
17707 };
17708 }
17709
17710 return undefined;
17711 }, [handleClickAway, touchEvent]);
17712
17713 if (mouseEvent !== false) {
17714 childrenProps[mouseEvent] = createHandleSynthetic(mouseEvent);
17715 }
17716
17717 react.exports.useEffect(function () {
17718 if (mouseEvent !== false) {
17719 var mappedMouseEvent = mapEventPropToEvent(mouseEvent);
17720 var doc = ownerDocument(nodeRef.current);
17721 doc.addEventListener(mappedMouseEvent, handleClickAway);
17722 return function () {
17723 doc.removeEventListener(mappedMouseEvent, handleClickAway);
17724 };
17725 }
17726
17727 return undefined;
17728 }, [handleClickAway, mouseEvent]);
17729 return /*#__PURE__*/react.exports.createElement(react.exports.Fragment, null, /*#__PURE__*/react.exports.cloneElement(children, childrenProps));
17730 }
17731
17732 var styles$1l = function styles(theme) {
17733 return {
17734 /* Styles applied to the root element. */
17735 root: _defineProperty$1({
17736 width: '100%',
17737 marginLeft: 'auto',
17738 boxSizing: 'border-box',
17739 marginRight: 'auto',
17740 paddingLeft: theme.spacing(2),
17741 paddingRight: theme.spacing(2),
17742 display: 'block'
17743 }, theme.breakpoints.up('sm'), {
17744 paddingLeft: theme.spacing(3),
17745 paddingRight: theme.spacing(3)
17746 }),
17747
17748 /* Styles applied to the root element if `disableGutters={true}`. */
17749 disableGutters: {
17750 paddingLeft: 0,
17751 paddingRight: 0
17752 },
17753
17754 /* Styles applied to the root element if `fixed={true}`. */
17755 fixed: Object.keys(theme.breakpoints.values).reduce(function (acc, breakpoint) {
17756 var value = theme.breakpoints.values[breakpoint];
17757
17758 if (value !== 0) {
17759 acc[theme.breakpoints.up(breakpoint)] = {
17760 maxWidth: value
17761 };
17762 }
17763
17764 return acc;
17765 }, {}),
17766
17767 /* Styles applied to the root element if `maxWidth="xs"`. */
17768 maxWidthXs: _defineProperty$1({}, theme.breakpoints.up('xs'), {
17769 maxWidth: Math.max(theme.breakpoints.values.xs, 444)
17770 }),
17771
17772 /* Styles applied to the root element if `maxWidth="sm"`. */
17773 maxWidthSm: _defineProperty$1({}, theme.breakpoints.up('sm'), {
17774 maxWidth: theme.breakpoints.values.sm
17775 }),
17776
17777 /* Styles applied to the root element if `maxWidth="md"`. */
17778 maxWidthMd: _defineProperty$1({}, theme.breakpoints.up('md'), {
17779 maxWidth: theme.breakpoints.values.md
17780 }),
17781
17782 /* Styles applied to the root element if `maxWidth="lg"`. */
17783 maxWidthLg: _defineProperty$1({}, theme.breakpoints.up('lg'), {
17784 maxWidth: theme.breakpoints.values.lg
17785 }),
17786
17787 /* Styles applied to the root element if `maxWidth="xl"`. */
17788 maxWidthXl: _defineProperty$1({}, theme.breakpoints.up('xl'), {
17789 maxWidth: theme.breakpoints.values.xl
17790 })
17791 };
17792 };
17793 var Container = /*#__PURE__*/react.exports.forwardRef(function Container(props, ref) {
17794 var classes = props.classes,
17795 className = props.className,
17796 _props$component = props.component,
17797 Component = _props$component === void 0 ? 'div' : _props$component,
17798 _props$disableGutters = props.disableGutters,
17799 disableGutters = _props$disableGutters === void 0 ? false : _props$disableGutters,
17800 _props$fixed = props.fixed,
17801 fixed = _props$fixed === void 0 ? false : _props$fixed,
17802 _props$maxWidth = props.maxWidth,
17803 maxWidth = _props$maxWidth === void 0 ? 'lg' : _props$maxWidth,
17804 other = _objectWithoutProperties(props, ["classes", "className", "component", "disableGutters", "fixed", "maxWidth"]);
17805
17806 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
17807 className: clsx(classes.root, className, fixed && classes.fixed, disableGutters && classes.disableGutters, maxWidth !== false && classes["maxWidth".concat(capitalize(String(maxWidth)))]),
17808 ref: ref
17809 }, other));
17810 });
17811 withStyles(styles$1l, {
17812 name: 'MuiContainer'
17813 })(Container);
17814
17815 var html = {
17816 WebkitFontSmoothing: 'antialiased',
17817 // Antialiasing.
17818 MozOsxFontSmoothing: 'grayscale',
17819 // Antialiasing.
17820 // Change from `box-sizing: content-box` so that `width`
17821 // is not affected by `padding` or `border`.
17822 boxSizing: 'border-box'
17823 };
17824 var body = function body(theme) {
17825 return _extends$5({
17826 color: theme.palette.text.primary
17827 }, theme.typography.body2, {
17828 backgroundColor: theme.palette.background.default,
17829 '@media print': {
17830 // Save printer ink.
17831 backgroundColor: theme.palette.common.white
17832 }
17833 });
17834 };
17835 var styles$1k = function styles(theme) {
17836 return {
17837 '@global': {
17838 html: html,
17839 '*, *::before, *::after': {
17840 boxSizing: 'inherit'
17841 },
17842 'strong, b': {
17843 fontWeight: theme.typography.fontWeightBold
17844 },
17845 body: _extends$5({
17846 margin: 0
17847 }, body(theme), {
17848 // Add support for document.body.requestFullScreen().
17849 // Other elements, if background transparent, are not supported.
17850 '&::backdrop': {
17851 backgroundColor: theme.palette.background.default
17852 }
17853 })
17854 }
17855 };
17856 };
17857 /**
17858 * Kickstart an elegant, consistent, and simple baseline to build upon.
17859 */
17860
17861 function CssBaseline(props) {
17862 /* eslint-disable no-unused-vars */
17863 var _props$children = props.children,
17864 children = _props$children === void 0 ? null : _props$children;
17865 props.classes;
17866 /* eslint-enable no-unused-vars */
17867
17868 return /*#__PURE__*/react.exports.createElement(react.exports.Fragment, null, children);
17869 }
17870
17871 withStyles(styles$1k, {
17872 name: 'MuiCssBaseline'
17873 })(CssBaseline);
17874
17875 function getContainer$1(container) {
17876 container = typeof container === 'function' ? container() : container; // #StrictMode ready
17877
17878 return reactDom.exports.findDOMNode(container);
17879 }
17880
17881 var useEnhancedEffect$6 = typeof window !== 'undefined' ? react.exports.useLayoutEffect : react.exports.useEffect;
17882 /**
17883 * Portals provide a first-class way to render children into a DOM node
17884 * that exists outside the DOM hierarchy of the parent component.
17885 */
17886
17887 var Portal = /*#__PURE__*/react.exports.forwardRef(function Portal(props, ref) {
17888 var children = props.children,
17889 container = props.container,
17890 _props$disablePortal = props.disablePortal,
17891 disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal,
17892 onRendered = props.onRendered;
17893
17894 var _React$useState = react.exports.useState(null),
17895 mountNode = _React$useState[0],
17896 setMountNode = _React$useState[1];
17897
17898 var handleRef = useForkRef( /*#__PURE__*/react.exports.isValidElement(children) ? children.ref : null, ref);
17899 useEnhancedEffect$6(function () {
17900 if (!disablePortal) {
17901 setMountNode(getContainer$1(container) || document.body);
17902 }
17903 }, [container, disablePortal]);
17904 useEnhancedEffect$6(function () {
17905 if (mountNode && !disablePortal) {
17906 setRef(ref, mountNode);
17907 return function () {
17908 setRef(ref, null);
17909 };
17910 }
17911
17912 return undefined;
17913 }, [ref, mountNode, disablePortal]);
17914 useEnhancedEffect$6(function () {
17915 if (onRendered && (mountNode || disablePortal)) {
17916 onRendered();
17917 }
17918 }, [onRendered, mountNode, disablePortal]);
17919
17920 if (disablePortal) {
17921 if ( /*#__PURE__*/react.exports.isValidElement(children)) {
17922 return /*#__PURE__*/react.exports.cloneElement(children, {
17923 ref: handleRef
17924 });
17925 }
17926
17927 return children;
17928 }
17929
17930 return mountNode ? /*#__PURE__*/reactDom.exports.createPortal(children, mountNode) : mountNode;
17931 });
17932
17933 function _classCallCheck(instance, Constructor) {
17934 if (!(instance instanceof Constructor)) {
17935 throw new TypeError("Cannot call a class as a function");
17936 }
17937 }
17938
17939 function _defineProperties(target, props) {
17940 for (var i = 0; i < props.length; i++) {
17941 var descriptor = props[i];
17942 descriptor.enumerable = descriptor.enumerable || false;
17943 descriptor.configurable = true;
17944 if ("value" in descriptor) descriptor.writable = true;
17945 Object.defineProperty(target, descriptor.key, descriptor);
17946 }
17947 }
17948
17949 function _createClass(Constructor, protoProps, staticProps) {
17950 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17951 if (staticProps) _defineProperties(Constructor, staticProps);
17952 return Constructor;
17953 }
17954
17955 // A change of the browser zoom change the scrollbar size.
17956 // Credit https://github.com/twbs/bootstrap/blob/3ffe3a5d82f6f561b82ff78d82b32a7d14aed558/js/src/modal.js#L512-L519
17957 function getScrollbarSize() {
17958 var scrollDiv = document.createElement('div');
17959 scrollDiv.style.width = '99px';
17960 scrollDiv.style.height = '99px';
17961 scrollDiv.style.position = 'absolute';
17962 scrollDiv.style.top = '-9999px';
17963 scrollDiv.style.overflow = 'scroll';
17964 document.body.appendChild(scrollDiv);
17965 var scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
17966 document.body.removeChild(scrollDiv);
17967 return scrollbarSize;
17968 }
17969
17970 function isOverflowing(container) {
17971 var doc = ownerDocument(container);
17972
17973 if (doc.body === container) {
17974 return ownerWindow(doc).innerWidth > doc.documentElement.clientWidth;
17975 }
17976
17977 return container.scrollHeight > container.clientHeight;
17978 }
17979
17980 function ariaHidden(node, show) {
17981 if (show) {
17982 node.setAttribute('aria-hidden', 'true');
17983 } else {
17984 node.removeAttribute('aria-hidden');
17985 }
17986 }
17987
17988 function getPaddingRight(node) {
17989 return parseInt(window.getComputedStyle(node)['padding-right'], 10) || 0;
17990 }
17991
17992 function ariaHiddenSiblings(container, mountNode, currentNode) {
17993 var nodesToExclude = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
17994 var show = arguments.length > 4 ? arguments[4] : undefined;
17995 var blacklist = [mountNode, currentNode].concat(_toConsumableArray(nodesToExclude));
17996 var blacklistTagNames = ['TEMPLATE', 'SCRIPT', 'STYLE'];
17997 [].forEach.call(container.children, function (node) {
17998 if (node.nodeType === 1 && blacklist.indexOf(node) === -1 && blacklistTagNames.indexOf(node.tagName) === -1) {
17999 ariaHidden(node, show);
18000 }
18001 });
18002 }
18003
18004 function findIndexOf(containerInfo, callback) {
18005 var idx = -1;
18006 containerInfo.some(function (item, index) {
18007 if (callback(item)) {
18008 idx = index;
18009 return true;
18010 }
18011
18012 return false;
18013 });
18014 return idx;
18015 }
18016
18017 function handleContainer(containerInfo, props) {
18018 var restoreStyle = [];
18019 var restorePaddings = [];
18020 var container = containerInfo.container;
18021 var fixedNodes;
18022
18023 if (!props.disableScrollLock) {
18024 if (isOverflowing(container)) {
18025 // Compute the size before applying overflow hidden to avoid any scroll jumps.
18026 var scrollbarSize = getScrollbarSize();
18027 restoreStyle.push({
18028 value: container.style.paddingRight,
18029 key: 'padding-right',
18030 el: container
18031 }); // Use computed style, here to get the real padding to add our scrollbar width.
18032
18033 container.style['padding-right'] = "".concat(getPaddingRight(container) + scrollbarSize, "px"); // .mui-fixed is a global helper.
18034
18035 fixedNodes = ownerDocument(container).querySelectorAll('.mui-fixed');
18036 [].forEach.call(fixedNodes, function (node) {
18037 restorePaddings.push(node.style.paddingRight);
18038 node.style.paddingRight = "".concat(getPaddingRight(node) + scrollbarSize, "px");
18039 });
18040 } // Improve Gatsby support
18041 // https://css-tricks.com/snippets/css/force-vertical-scrollbar/
18042
18043
18044 var parent = container.parentElement;
18045 var scrollContainer = parent.nodeName === 'HTML' && window.getComputedStyle(parent)['overflow-y'] === 'scroll' ? parent : container; // Block the scroll even if no scrollbar is visible to account for mobile keyboard
18046 // screensize shrink.
18047
18048 restoreStyle.push({
18049 value: scrollContainer.style.overflow,
18050 key: 'overflow',
18051 el: scrollContainer
18052 });
18053 scrollContainer.style.overflow = 'hidden';
18054 }
18055
18056 var restore = function restore() {
18057 if (fixedNodes) {
18058 [].forEach.call(fixedNodes, function (node, i) {
18059 if (restorePaddings[i]) {
18060 node.style.paddingRight = restorePaddings[i];
18061 } else {
18062 node.style.removeProperty('padding-right');
18063 }
18064 });
18065 }
18066
18067 restoreStyle.forEach(function (_ref) {
18068 var value = _ref.value,
18069 el = _ref.el,
18070 key = _ref.key;
18071
18072 if (value) {
18073 el.style.setProperty(key, value);
18074 } else {
18075 el.style.removeProperty(key);
18076 }
18077 });
18078 };
18079
18080 return restore;
18081 }
18082
18083 function getHiddenSiblings(container) {
18084 var hiddenSiblings = [];
18085 [].forEach.call(container.children, function (node) {
18086 if (node.getAttribute && node.getAttribute('aria-hidden') === 'true') {
18087 hiddenSiblings.push(node);
18088 }
18089 });
18090 return hiddenSiblings;
18091 }
18092 /**
18093 * @ignore - do not document.
18094 *
18095 * Proper state management for containers and the modals in those containers.
18096 * Simplified, but inspired by react-overlay's ModalManager class.
18097 * Used by the Modal to ensure proper styling of containers.
18098 */
18099
18100
18101 var ModalManager = /*#__PURE__*/function () {
18102 function ModalManager() {
18103 _classCallCheck(this, ModalManager);
18104
18105 // this.modals[modalIndex] = modal
18106 this.modals = []; // this.containers[containerIndex] = {
18107 // modals: [],
18108 // container,
18109 // restore: null,
18110 // }
18111
18112 this.containers = [];
18113 }
18114
18115 _createClass(ModalManager, [{
18116 key: "add",
18117 value: function add(modal, container) {
18118 var modalIndex = this.modals.indexOf(modal);
18119
18120 if (modalIndex !== -1) {
18121 return modalIndex;
18122 }
18123
18124 modalIndex = this.modals.length;
18125 this.modals.push(modal); // If the modal we are adding is already in the DOM.
18126
18127 if (modal.modalRef) {
18128 ariaHidden(modal.modalRef, false);
18129 }
18130
18131 var hiddenSiblingNodes = getHiddenSiblings(container);
18132 ariaHiddenSiblings(container, modal.mountNode, modal.modalRef, hiddenSiblingNodes, true);
18133 var containerIndex = findIndexOf(this.containers, function (item) {
18134 return item.container === container;
18135 });
18136
18137 if (containerIndex !== -1) {
18138 this.containers[containerIndex].modals.push(modal);
18139 return modalIndex;
18140 }
18141
18142 this.containers.push({
18143 modals: [modal],
18144 container: container,
18145 restore: null,
18146 hiddenSiblingNodes: hiddenSiblingNodes
18147 });
18148 return modalIndex;
18149 }
18150 }, {
18151 key: "mount",
18152 value: function mount(modal, props) {
18153 var containerIndex = findIndexOf(this.containers, function (item) {
18154 return item.modals.indexOf(modal) !== -1;
18155 });
18156 var containerInfo = this.containers[containerIndex];
18157
18158 if (!containerInfo.restore) {
18159 containerInfo.restore = handleContainer(containerInfo, props);
18160 }
18161 }
18162 }, {
18163 key: "remove",
18164 value: function remove(modal) {
18165 var modalIndex = this.modals.indexOf(modal);
18166
18167 if (modalIndex === -1) {
18168 return modalIndex;
18169 }
18170
18171 var containerIndex = findIndexOf(this.containers, function (item) {
18172 return item.modals.indexOf(modal) !== -1;
18173 });
18174 var containerInfo = this.containers[containerIndex];
18175 containerInfo.modals.splice(containerInfo.modals.indexOf(modal), 1);
18176 this.modals.splice(modalIndex, 1); // If that was the last modal in a container, clean up the container.
18177
18178 if (containerInfo.modals.length === 0) {
18179 // The modal might be closed before it had the chance to be mounted in the DOM.
18180 if (containerInfo.restore) {
18181 containerInfo.restore();
18182 }
18183
18184 if (modal.modalRef) {
18185 // In case the modal wasn't in the DOM yet.
18186 ariaHidden(modal.modalRef, true);
18187 }
18188
18189 ariaHiddenSiblings(containerInfo.container, modal.mountNode, modal.modalRef, containerInfo.hiddenSiblingNodes, false);
18190 this.containers.splice(containerIndex, 1);
18191 } else {
18192 // Otherwise make sure the next top modal is visible to a screen reader.
18193 var nextTop = containerInfo.modals[containerInfo.modals.length - 1]; // as soon as a modal is adding its modalRef is undefined. it can't set
18194 // aria-hidden because the dom element doesn't exist either
18195 // when modal was unmounted before modalRef gets null
18196
18197 if (nextTop.modalRef) {
18198 ariaHidden(nextTop.modalRef, false);
18199 }
18200 }
18201
18202 return modalIndex;
18203 }
18204 }, {
18205 key: "isTopModal",
18206 value: function isTopModal(modal) {
18207 return this.modals.length > 0 && this.modals[this.modals.length - 1] === modal;
18208 }
18209 }]);
18210
18211 return ModalManager;
18212 }();
18213
18214 /* eslint-disable consistent-return, jsx-a11y/no-noninteractive-tabindex, camelcase */
18215 /**
18216 * Utility component that locks focus inside the component.
18217 */
18218
18219 function Unstable_TrapFocus(props) {
18220 var children = props.children,
18221 _props$disableAutoFoc = props.disableAutoFocus,
18222 disableAutoFocus = _props$disableAutoFoc === void 0 ? false : _props$disableAutoFoc,
18223 _props$disableEnforce = props.disableEnforceFocus,
18224 disableEnforceFocus = _props$disableEnforce === void 0 ? false : _props$disableEnforce,
18225 _props$disableRestore = props.disableRestoreFocus,
18226 disableRestoreFocus = _props$disableRestore === void 0 ? false : _props$disableRestore,
18227 getDoc = props.getDoc,
18228 isEnabled = props.isEnabled,
18229 open = props.open;
18230 var ignoreNextEnforceFocus = react.exports.useRef();
18231 var sentinelStart = react.exports.useRef(null);
18232 var sentinelEnd = react.exports.useRef(null);
18233 var nodeToRestore = react.exports.useRef();
18234 var rootRef = react.exports.useRef(null); // can be removed once we drop support for non ref forwarding class components
18235
18236 var handleOwnRef = react.exports.useCallback(function (instance) {
18237 // #StrictMode ready
18238 rootRef.current = reactDom.exports.findDOMNode(instance);
18239 }, []);
18240 var handleRef = useForkRef(children.ref, handleOwnRef);
18241 var prevOpenRef = react.exports.useRef();
18242 react.exports.useEffect(function () {
18243 prevOpenRef.current = open;
18244 }, [open]);
18245
18246 if (!prevOpenRef.current && open && typeof window !== 'undefined') {
18247 // WARNING: Potentially unsafe in concurrent mode.
18248 // The way the read on `nodeToRestore` is setup could make this actually safe.
18249 // Say we render `open={false}` -> `open={true}` but never commit.
18250 // We have now written a state that wasn't committed. But no committed effect
18251 // will read this wrong value. We only read from `nodeToRestore` in effects
18252 // that were committed on `open={true}`
18253 // WARNING: Prevents the instance from being garbage collected. Should only
18254 // hold a weak ref.
18255 nodeToRestore.current = getDoc().activeElement;
18256 }
18257
18258 react.exports.useEffect(function () {
18259 if (!open) {
18260 return;
18261 }
18262
18263 var doc = ownerDocument(rootRef.current); // We might render an empty child.
18264
18265 if (!disableAutoFocus && rootRef.current && !rootRef.current.contains(doc.activeElement)) {
18266 if (!rootRef.current.hasAttribute('tabIndex')) {
18267
18268 rootRef.current.setAttribute('tabIndex', -1);
18269 }
18270
18271 rootRef.current.focus();
18272 }
18273
18274 var contain = function contain() {
18275 var rootElement = rootRef.current; // Cleanup functions are executed lazily in React 17.
18276 // Contain can be called between the component being unmounted and its cleanup function being run.
18277
18278 if (rootElement === null) {
18279 return;
18280 }
18281
18282 if (!doc.hasFocus() || disableEnforceFocus || !isEnabled() || ignoreNextEnforceFocus.current) {
18283 ignoreNextEnforceFocus.current = false;
18284 return;
18285 }
18286
18287 if (rootRef.current && !rootRef.current.contains(doc.activeElement)) {
18288 rootRef.current.focus();
18289 }
18290 };
18291
18292 var loopFocus = function loopFocus(event) {
18293 // 9 = Tab
18294 if (disableEnforceFocus || !isEnabled() || event.keyCode !== 9) {
18295 return;
18296 } // Make sure the next tab starts from the right place.
18297
18298
18299 if (doc.activeElement === rootRef.current) {
18300 // We need to ignore the next contain as
18301 // it will try to move the focus back to the rootRef element.
18302 ignoreNextEnforceFocus.current = true;
18303
18304 if (event.shiftKey) {
18305 sentinelEnd.current.focus();
18306 } else {
18307 sentinelStart.current.focus();
18308 }
18309 }
18310 };
18311
18312 doc.addEventListener('focus', contain, true);
18313 doc.addEventListener('keydown', loopFocus, true); // With Edge, Safari and Firefox, no focus related events are fired when the focused area stops being a focused area
18314 // e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=559561.
18315 //
18316 // The whatwg spec defines how the browser should behave but does not explicitly mention any events:
18317 // https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule.
18318
18319 var interval = setInterval(function () {
18320 contain();
18321 }, 50);
18322 return function () {
18323 clearInterval(interval);
18324 doc.removeEventListener('focus', contain, true);
18325 doc.removeEventListener('keydown', loopFocus, true); // restoreLastFocus()
18326
18327 if (!disableRestoreFocus) {
18328 // In IE 11 it is possible for document.activeElement to be null resulting
18329 // in nodeToRestore.current being null.
18330 // Not all elements in IE 11 have a focus method.
18331 // Once IE 11 support is dropped the focus() call can be unconditional.
18332 if (nodeToRestore.current && nodeToRestore.current.focus) {
18333 nodeToRestore.current.focus();
18334 }
18335
18336 nodeToRestore.current = null;
18337 }
18338 };
18339 }, [disableAutoFocus, disableEnforceFocus, disableRestoreFocus, isEnabled, open]);
18340 return /*#__PURE__*/react.exports.createElement(react.exports.Fragment, null, /*#__PURE__*/react.exports.createElement("div", {
18341 tabIndex: 0,
18342 ref: sentinelStart,
18343 "data-test": "sentinelStart"
18344 }), /*#__PURE__*/react.exports.cloneElement(children, {
18345 ref: handleRef
18346 }), /*#__PURE__*/react.exports.createElement("div", {
18347 tabIndex: 0,
18348 ref: sentinelEnd,
18349 "data-test": "sentinelEnd"
18350 }));
18351 }
18352
18353 var styles$1j = {
18354 /* Styles applied to the root element. */
18355 root: {
18356 zIndex: -1,
18357 position: 'fixed',
18358 right: 0,
18359 bottom: 0,
18360 top: 0,
18361 left: 0,
18362 backgroundColor: 'rgba(0, 0, 0, 0.5)',
18363 WebkitTapHighlightColor: 'transparent'
18364 },
18365
18366 /* Styles applied to the root element if `invisible={true}`. */
18367 invisible: {
18368 backgroundColor: 'transparent'
18369 }
18370 };
18371 /**
18372 * @ignore - internal component.
18373 */
18374
18375 var SimpleBackdrop = /*#__PURE__*/react.exports.forwardRef(function SimpleBackdrop(props, ref) {
18376 var _props$invisible = props.invisible,
18377 invisible = _props$invisible === void 0 ? false : _props$invisible,
18378 open = props.open,
18379 other = _objectWithoutProperties(props, ["invisible", "open"]);
18380
18381 return open ? /*#__PURE__*/react.exports.createElement("div", _extends$5({
18382 "aria-hidden": true,
18383 ref: ref
18384 }, other, {
18385 style: _extends$5({}, styles$1j.root, invisible ? styles$1j.invisible : {}, other.style)
18386 })) : null;
18387 });
18388
18389 function getContainer(container) {
18390 container = typeof container === 'function' ? container() : container;
18391 return reactDom.exports.findDOMNode(container);
18392 }
18393
18394 function getHasTransition(props) {
18395 return props.children ? props.children.props.hasOwnProperty('in') : false;
18396 } // A modal manager used to track and manage the state of open Modals.
18397 // Modals don't open on the server so this won't conflict with concurrent requests.
18398
18399
18400 var defaultManager = new ModalManager();
18401 var styles$1i = function styles(theme) {
18402 return {
18403 /* Styles applied to the root element. */
18404 root: {
18405 position: 'fixed',
18406 zIndex: theme.zIndex.modal,
18407 right: 0,
18408 bottom: 0,
18409 top: 0,
18410 left: 0
18411 },
18412
18413 /* Styles applied to the root element if the `Modal` has exited. */
18414 hidden: {
18415 visibility: 'hidden'
18416 }
18417 };
18418 };
18419 /**
18420 * Modal is a lower-level construct that is leveraged by the following components:
18421 *
18422 * - [Dialog](/api/dialog/)
18423 * - [Drawer](/api/drawer/)
18424 * - [Menu](/api/menu/)
18425 * - [Popover](/api/popover/)
18426 *
18427 * If you are creating a modal dialog, you probably want to use the [Dialog](/api/dialog/) component
18428 * rather than directly using Modal.
18429 *
18430 * This component shares many concepts with [react-overlays](https://react-bootstrap.github.io/react-overlays/#modals).
18431 */
18432
18433 var Modal = /*#__PURE__*/react.exports.forwardRef(function Modal(inProps, ref) {
18434 var theme = useTheme$2();
18435 var props = getThemeProps({
18436 name: 'MuiModal',
18437 props: _extends$5({}, inProps),
18438 theme: theme
18439 });
18440
18441 var _props$BackdropCompon = props.BackdropComponent,
18442 BackdropComponent = _props$BackdropCompon === void 0 ? SimpleBackdrop : _props$BackdropCompon,
18443 BackdropProps = props.BackdropProps,
18444 children = props.children,
18445 _props$closeAfterTran = props.closeAfterTransition,
18446 closeAfterTransition = _props$closeAfterTran === void 0 ? false : _props$closeAfterTran,
18447 container = props.container,
18448 _props$disableAutoFoc = props.disableAutoFocus,
18449 disableAutoFocus = _props$disableAutoFoc === void 0 ? false : _props$disableAutoFoc,
18450 _props$disableBackdro = props.disableBackdropClick,
18451 disableBackdropClick = _props$disableBackdro === void 0 ? false : _props$disableBackdro,
18452 _props$disableEnforce = props.disableEnforceFocus,
18453 disableEnforceFocus = _props$disableEnforce === void 0 ? false : _props$disableEnforce,
18454 _props$disableEscapeK = props.disableEscapeKeyDown,
18455 disableEscapeKeyDown = _props$disableEscapeK === void 0 ? false : _props$disableEscapeK,
18456 _props$disablePortal = props.disablePortal,
18457 disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal,
18458 _props$disableRestore = props.disableRestoreFocus,
18459 disableRestoreFocus = _props$disableRestore === void 0 ? false : _props$disableRestore,
18460 _props$disableScrollL = props.disableScrollLock,
18461 disableScrollLock = _props$disableScrollL === void 0 ? false : _props$disableScrollL,
18462 _props$hideBackdrop = props.hideBackdrop,
18463 hideBackdrop = _props$hideBackdrop === void 0 ? false : _props$hideBackdrop,
18464 _props$keepMounted = props.keepMounted,
18465 keepMounted = _props$keepMounted === void 0 ? false : _props$keepMounted,
18466 _props$manager = props.manager,
18467 manager = _props$manager === void 0 ? defaultManager : _props$manager,
18468 onBackdropClick = props.onBackdropClick,
18469 onClose = props.onClose,
18470 onEscapeKeyDown = props.onEscapeKeyDown,
18471 onRendered = props.onRendered,
18472 open = props.open,
18473 other = _objectWithoutProperties(props, ["BackdropComponent", "BackdropProps", "children", "closeAfterTransition", "container", "disableAutoFocus", "disableBackdropClick", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "manager", "onBackdropClick", "onClose", "onEscapeKeyDown", "onRendered", "open"]);
18474
18475 var _React$useState = react.exports.useState(true),
18476 exited = _React$useState[0],
18477 setExited = _React$useState[1];
18478
18479 var modal = react.exports.useRef({});
18480 var mountNodeRef = react.exports.useRef(null);
18481 var modalRef = react.exports.useRef(null);
18482 var handleRef = useForkRef(modalRef, ref);
18483 var hasTransition = getHasTransition(props);
18484
18485 var getDoc = function getDoc() {
18486 return ownerDocument(mountNodeRef.current);
18487 };
18488
18489 var getModal = function getModal() {
18490 modal.current.modalRef = modalRef.current;
18491 modal.current.mountNode = mountNodeRef.current;
18492 return modal.current;
18493 };
18494
18495 var handleMounted = function handleMounted() {
18496 manager.mount(getModal(), {
18497 disableScrollLock: disableScrollLock
18498 }); // Fix a bug on Chrome where the scroll isn't initially 0.
18499
18500 modalRef.current.scrollTop = 0;
18501 };
18502
18503 var handleOpen = useEventCallback(function () {
18504 var resolvedContainer = getContainer(container) || getDoc().body;
18505 manager.add(getModal(), resolvedContainer); // The element was already mounted.
18506
18507 if (modalRef.current) {
18508 handleMounted();
18509 }
18510 });
18511 var isTopModal = react.exports.useCallback(function () {
18512 return manager.isTopModal(getModal());
18513 }, [manager]);
18514 var handlePortalRef = useEventCallback(function (node) {
18515 mountNodeRef.current = node;
18516
18517 if (!node) {
18518 return;
18519 }
18520
18521 if (onRendered) {
18522 onRendered();
18523 }
18524
18525 if (open && isTopModal()) {
18526 handleMounted();
18527 } else {
18528 ariaHidden(modalRef.current, true);
18529 }
18530 });
18531 var handleClose = react.exports.useCallback(function () {
18532 manager.remove(getModal());
18533 }, [manager]);
18534 react.exports.useEffect(function () {
18535 return function () {
18536 handleClose();
18537 };
18538 }, [handleClose]);
18539 react.exports.useEffect(function () {
18540 if (open) {
18541 handleOpen();
18542 } else if (!hasTransition || !closeAfterTransition) {
18543 handleClose();
18544 }
18545 }, [open, handleClose, hasTransition, closeAfterTransition, handleOpen]);
18546
18547 if (!keepMounted && !open && (!hasTransition || exited)) {
18548 return null;
18549 }
18550
18551 var handleEnter = function handleEnter() {
18552 setExited(false);
18553 };
18554
18555 var handleExited = function handleExited() {
18556 setExited(true);
18557
18558 if (closeAfterTransition) {
18559 handleClose();
18560 }
18561 };
18562
18563 var handleBackdropClick = function handleBackdropClick(event) {
18564 if (event.target !== event.currentTarget) {
18565 return;
18566 }
18567
18568 if (onBackdropClick) {
18569 onBackdropClick(event);
18570 }
18571
18572 if (!disableBackdropClick && onClose) {
18573 onClose(event, 'backdropClick');
18574 }
18575 };
18576
18577 var handleKeyDown = function handleKeyDown(event) {
18578 // The handler doesn't take event.defaultPrevented into account:
18579 //
18580 // event.preventDefault() is meant to stop default behaviours like
18581 // clicking a checkbox to check it, hitting a button to submit a form,
18582 // and hitting left arrow to move the cursor in a text input etc.
18583 // Only special HTML elements have these default behaviors.
18584 if (event.key !== 'Escape' || !isTopModal()) {
18585 return;
18586 }
18587
18588 if (onEscapeKeyDown) {
18589 onEscapeKeyDown(event);
18590 }
18591
18592 if (!disableEscapeKeyDown) {
18593 // Swallow the event, in case someone is listening for the escape key on the body.
18594 event.stopPropagation();
18595
18596 if (onClose) {
18597 onClose(event, 'escapeKeyDown');
18598 }
18599 }
18600 };
18601
18602 var inlineStyle = styles$1i(theme || {
18603 zIndex: zIndex
18604 });
18605 var childProps = {};
18606
18607 if (children.props.tabIndex === undefined) {
18608 childProps.tabIndex = children.props.tabIndex || '-1';
18609 } // It's a Transition like component
18610
18611
18612 if (hasTransition) {
18613 childProps.onEnter = createChainedFunction(handleEnter, children.props.onEnter);
18614 childProps.onExited = createChainedFunction(handleExited, children.props.onExited);
18615 }
18616
18617 return /*#__PURE__*/react.exports.createElement(Portal, {
18618 ref: handlePortalRef,
18619 container: container,
18620 disablePortal: disablePortal
18621 }, /*#__PURE__*/react.exports.createElement("div", _extends$5({
18622 ref: handleRef,
18623 onKeyDown: handleKeyDown,
18624 role: "presentation"
18625 }, other, {
18626 style: _extends$5({}, inlineStyle.root, !open && exited ? inlineStyle.hidden : {}, other.style)
18627 }), hideBackdrop ? null : /*#__PURE__*/react.exports.createElement(BackdropComponent, _extends$5({
18628 open: open,
18629 onClick: handleBackdropClick
18630 }, BackdropProps)), /*#__PURE__*/react.exports.createElement(Unstable_TrapFocus, {
18631 disableEnforceFocus: disableEnforceFocus,
18632 disableAutoFocus: disableAutoFocus,
18633 disableRestoreFocus: disableRestoreFocus,
18634 getDoc: getDoc,
18635 isEnabled: isTopModal,
18636 open: open
18637 }, /*#__PURE__*/react.exports.cloneElement(children, childProps))));
18638 });
18639
18640 var styles$1h = function styles(theme) {
18641 return {
18642 /* Styles applied to the root element. */
18643 root: {
18644 '@media print': {
18645 // Use !important to override the Modal inline-style.
18646 position: 'absolute !important'
18647 }
18648 },
18649
18650 /* Styles applied to the container element if `scroll="paper"`. */
18651 scrollPaper: {
18652 display: 'flex',
18653 justifyContent: 'center',
18654 alignItems: 'center'
18655 },
18656
18657 /* Styles applied to the container element if `scroll="body"`. */
18658 scrollBody: {
18659 overflowY: 'auto',
18660 overflowX: 'hidden',
18661 textAlign: 'center',
18662 '&:after': {
18663 content: '""',
18664 display: 'inline-block',
18665 verticalAlign: 'middle',
18666 height: '100%',
18667 width: '0'
18668 }
18669 },
18670
18671 /* Styles applied to the container element. */
18672 container: {
18673 height: '100%',
18674 '@media print': {
18675 height: 'auto'
18676 },
18677 // We disable the focus ring for mouse, touch and keyboard users.
18678 outline: 0
18679 },
18680
18681 /* Styles applied to the `Paper` component. */
18682 paper: {
18683 margin: 32,
18684 position: 'relative',
18685 overflowY: 'auto',
18686 // Fix IE 11 issue, to remove at some point.
18687 '@media print': {
18688 overflowY: 'visible',
18689 boxShadow: 'none'
18690 }
18691 },
18692
18693 /* Styles applied to the `Paper` component if `scroll="paper"`. */
18694 paperScrollPaper: {
18695 display: 'flex',
18696 flexDirection: 'column',
18697 maxHeight: 'calc(100% - 64px)'
18698 },
18699
18700 /* Styles applied to the `Paper` component if `scroll="body"`. */
18701 paperScrollBody: {
18702 display: 'inline-block',
18703 verticalAlign: 'middle',
18704 textAlign: 'left' // 'initial' doesn't work on IE 11
18705
18706 },
18707
18708 /* Styles applied to the `Paper` component if `maxWidth=false`. */
18709 paperWidthFalse: {
18710 maxWidth: 'calc(100% - 64px)'
18711 },
18712
18713 /* Styles applied to the `Paper` component if `maxWidth="xs"`. */
18714 paperWidthXs: {
18715 maxWidth: Math.max(theme.breakpoints.values.xs, 444),
18716 '&$paperScrollBody': _defineProperty$1({}, theme.breakpoints.down(Math.max(theme.breakpoints.values.xs, 444) + 32 * 2), {
18717 maxWidth: 'calc(100% - 64px)'
18718 })
18719 },
18720
18721 /* Styles applied to the `Paper` component if `maxWidth="sm"`. */
18722 paperWidthSm: {
18723 maxWidth: theme.breakpoints.values.sm,
18724 '&$paperScrollBody': _defineProperty$1({}, theme.breakpoints.down(theme.breakpoints.values.sm + 32 * 2), {
18725 maxWidth: 'calc(100% - 64px)'
18726 })
18727 },
18728
18729 /* Styles applied to the `Paper` component if `maxWidth="md"`. */
18730 paperWidthMd: {
18731 maxWidth: theme.breakpoints.values.md,
18732 '&$paperScrollBody': _defineProperty$1({}, theme.breakpoints.down(theme.breakpoints.values.md + 32 * 2), {
18733 maxWidth: 'calc(100% - 64px)'
18734 })
18735 },
18736
18737 /* Styles applied to the `Paper` component if `maxWidth="lg"`. */
18738 paperWidthLg: {
18739 maxWidth: theme.breakpoints.values.lg,
18740 '&$paperScrollBody': _defineProperty$1({}, theme.breakpoints.down(theme.breakpoints.values.lg + 32 * 2), {
18741 maxWidth: 'calc(100% - 64px)'
18742 })
18743 },
18744
18745 /* Styles applied to the `Paper` component if `maxWidth="xl"`. */
18746 paperWidthXl: {
18747 maxWidth: theme.breakpoints.values.xl,
18748 '&$paperScrollBody': _defineProperty$1({}, theme.breakpoints.down(theme.breakpoints.values.xl + 32 * 2), {
18749 maxWidth: 'calc(100% - 64px)'
18750 })
18751 },
18752
18753 /* Styles applied to the `Paper` component if `fullWidth={true}`. */
18754 paperFullWidth: {
18755 width: 'calc(100% - 64px)'
18756 },
18757
18758 /* Styles applied to the `Paper` component if `fullScreen={true}`. */
18759 paperFullScreen: {
18760 margin: 0,
18761 width: '100%',
18762 maxWidth: '100%',
18763 height: '100%',
18764 maxHeight: 'none',
18765 borderRadius: 0,
18766 '&$paperScrollBody': {
18767 margin: 0,
18768 maxWidth: '100%'
18769 }
18770 }
18771 };
18772 };
18773 var defaultTransitionDuration$1 = {
18774 enter: duration.enteringScreen,
18775 exit: duration.leavingScreen
18776 };
18777 /**
18778 * Dialogs are overlaid modal paper based components with a backdrop.
18779 */
18780
18781 var Dialog = /*#__PURE__*/react.exports.forwardRef(function Dialog(props, ref) {
18782 var BackdropProps = props.BackdropProps,
18783 children = props.children,
18784 classes = props.classes,
18785 className = props.className,
18786 _props$disableBackdro = props.disableBackdropClick,
18787 disableBackdropClick = _props$disableBackdro === void 0 ? false : _props$disableBackdro,
18788 _props$disableEscapeK = props.disableEscapeKeyDown,
18789 disableEscapeKeyDown = _props$disableEscapeK === void 0 ? false : _props$disableEscapeK,
18790 _props$fullScreen = props.fullScreen,
18791 fullScreen = _props$fullScreen === void 0 ? false : _props$fullScreen,
18792 _props$fullWidth = props.fullWidth,
18793 fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
18794 _props$maxWidth = props.maxWidth,
18795 maxWidth = _props$maxWidth === void 0 ? 'sm' : _props$maxWidth,
18796 onBackdropClick = props.onBackdropClick,
18797 onClose = props.onClose,
18798 onEnter = props.onEnter,
18799 onEntered = props.onEntered,
18800 onEntering = props.onEntering,
18801 onEscapeKeyDown = props.onEscapeKeyDown,
18802 onExit = props.onExit,
18803 onExited = props.onExited,
18804 onExiting = props.onExiting,
18805 open = props.open,
18806 _props$PaperComponent = props.PaperComponent,
18807 PaperComponent = _props$PaperComponent === void 0 ? Paper$1 : _props$PaperComponent,
18808 _props$PaperProps = props.PaperProps,
18809 PaperProps = _props$PaperProps === void 0 ? {} : _props$PaperProps,
18810 _props$scroll = props.scroll,
18811 scroll = _props$scroll === void 0 ? 'paper' : _props$scroll,
18812 _props$TransitionComp = props.TransitionComponent,
18813 TransitionComponent = _props$TransitionComp === void 0 ? Fade : _props$TransitionComp,
18814 _props$transitionDura = props.transitionDuration,
18815 transitionDuration = _props$transitionDura === void 0 ? defaultTransitionDuration$1 : _props$transitionDura,
18816 TransitionProps = props.TransitionProps,
18817 ariaDescribedby = props['aria-describedby'],
18818 ariaLabelledby = props['aria-labelledby'],
18819 other = _objectWithoutProperties(props, ["BackdropProps", "children", "classes", "className", "disableBackdropClick", "disableEscapeKeyDown", "fullScreen", "fullWidth", "maxWidth", "onBackdropClick", "onClose", "onEnter", "onEntered", "onEntering", "onEscapeKeyDown", "onExit", "onExited", "onExiting", "open", "PaperComponent", "PaperProps", "scroll", "TransitionComponent", "transitionDuration", "TransitionProps", "aria-describedby", "aria-labelledby"]);
18820
18821 var mouseDownTarget = react.exports.useRef();
18822
18823 var handleMouseDown = function handleMouseDown(event) {
18824 mouseDownTarget.current = event.target;
18825 };
18826
18827 var handleBackdropClick = function handleBackdropClick(event) {
18828 // Ignore the events not coming from the "backdrop"
18829 // We don't want to close the dialog when clicking the dialog content.
18830 if (event.target !== event.currentTarget) {
18831 return;
18832 } // Make sure the event starts and ends on the same DOM element.
18833
18834
18835 if (event.target !== mouseDownTarget.current) {
18836 return;
18837 }
18838
18839 mouseDownTarget.current = null;
18840
18841 if (onBackdropClick) {
18842 onBackdropClick(event);
18843 }
18844
18845 if (!disableBackdropClick && onClose) {
18846 onClose(event, 'backdropClick');
18847 }
18848 };
18849
18850 return /*#__PURE__*/react.exports.createElement(Modal, _extends$5({
18851 className: clsx(classes.root, className),
18852 BackdropComponent: Backdrop$1,
18853 BackdropProps: _extends$5({
18854 transitionDuration: transitionDuration
18855 }, BackdropProps),
18856 closeAfterTransition: true
18857 }, disableBackdropClick ? {
18858 disableBackdropClick: disableBackdropClick
18859 } : {}, {
18860 disableEscapeKeyDown: disableEscapeKeyDown,
18861 onEscapeKeyDown: onEscapeKeyDown,
18862 onClose: onClose,
18863 open: open,
18864 ref: ref
18865 }, other), /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
18866 appear: true,
18867 in: open,
18868 timeout: transitionDuration,
18869 onEnter: onEnter,
18870 onEntering: onEntering,
18871 onEntered: onEntered,
18872 onExit: onExit,
18873 onExiting: onExiting,
18874 onExited: onExited,
18875 role: "none presentation"
18876 }, TransitionProps), /*#__PURE__*/react.exports.createElement("div", {
18877 className: clsx(classes.container, classes["scroll".concat(capitalize(scroll))]),
18878 onMouseUp: handleBackdropClick,
18879 onMouseDown: handleMouseDown
18880 }, /*#__PURE__*/react.exports.createElement(PaperComponent, _extends$5({
18881 elevation: 24,
18882 role: "dialog",
18883 "aria-describedby": ariaDescribedby,
18884 "aria-labelledby": ariaLabelledby
18885 }, PaperProps, {
18886 className: clsx(classes.paper, classes["paperScroll".concat(capitalize(scroll))], classes["paperWidth".concat(capitalize(String(maxWidth)))], PaperProps.className, fullScreen && classes.paperFullScreen, fullWidth && classes.paperFullWidth)
18887 }), children))));
18888 });
18889 withStyles(styles$1h, {
18890 name: 'MuiDialog'
18891 })(Dialog);
18892
18893 var styles$1g = {
18894 /* Styles applied to the root element. */
18895 root: {
18896 display: 'flex',
18897 alignItems: 'center',
18898 padding: 8,
18899 justifyContent: 'flex-end',
18900 flex: '0 0 auto'
18901 },
18902
18903 /* Styles applied to the root element if `disableSpacing={false}`. */
18904 spacing: {
18905 '& > :not(:first-child)': {
18906 marginLeft: 8
18907 }
18908 }
18909 };
18910 var DialogActions = /*#__PURE__*/react.exports.forwardRef(function DialogActions(props, ref) {
18911 var _props$disableSpacing = props.disableSpacing,
18912 disableSpacing = _props$disableSpacing === void 0 ? false : _props$disableSpacing,
18913 classes = props.classes,
18914 className = props.className,
18915 other = _objectWithoutProperties(props, ["disableSpacing", "classes", "className"]);
18916
18917 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
18918 className: clsx(classes.root, className, !disableSpacing && classes.spacing),
18919 ref: ref
18920 }, other));
18921 });
18922 withStyles(styles$1g, {
18923 name: 'MuiDialogActions'
18924 })(DialogActions);
18925
18926 var styles$1f = function styles(theme) {
18927 return {
18928 /* Styles applied to the root element. */
18929 root: {
18930 flex: '1 1 auto',
18931 WebkitOverflowScrolling: 'touch',
18932 // Add iOS momentum scrolling.
18933 overflowY: 'auto',
18934 padding: '8px 24px',
18935 '&:first-child': {
18936 // dialog without title
18937 paddingTop: 20
18938 }
18939 },
18940
18941 /* Styles applied to the root element if `dividers={true}`. */
18942 dividers: {
18943 padding: '16px 24px',
18944 borderTop: "1px solid ".concat(theme.palette.divider),
18945 borderBottom: "1px solid ".concat(theme.palette.divider)
18946 }
18947 };
18948 };
18949 var DialogContent = /*#__PURE__*/react.exports.forwardRef(function DialogContent(props, ref) {
18950 var classes = props.classes,
18951 className = props.className,
18952 _props$dividers = props.dividers,
18953 dividers = _props$dividers === void 0 ? false : _props$dividers,
18954 other = _objectWithoutProperties(props, ["classes", "className", "dividers"]);
18955
18956 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
18957 className: clsx(classes.root, className, dividers && classes.dividers),
18958 ref: ref
18959 }, other));
18960 });
18961 withStyles(styles$1f, {
18962 name: 'MuiDialogContent'
18963 })(DialogContent);
18964
18965 var styles$1e = {
18966 /* Styles applied to the root element. */
18967 root: {
18968 marginBottom: 12
18969 }
18970 };
18971 var DialogContentText = /*#__PURE__*/react.exports.forwardRef(function DialogContentText(props, ref) {
18972 return /*#__PURE__*/react.exports.createElement(Typography$1, _extends$5({
18973 component: "p",
18974 variant: "body1",
18975 color: "textSecondary",
18976 ref: ref
18977 }, props));
18978 });
18979 withStyles(styles$1e, {
18980 name: 'MuiDialogContentText'
18981 })(DialogContentText);
18982
18983 var styles$1d = {
18984 /* Styles applied to the root element. */
18985 root: {
18986 margin: 0,
18987 padding: '16px 24px',
18988 flex: '0 0 auto'
18989 }
18990 };
18991 var DialogTitle = /*#__PURE__*/react.exports.forwardRef(function DialogTitle(props, ref) {
18992 var children = props.children,
18993 classes = props.classes,
18994 className = props.className,
18995 _props$disableTypogra = props.disableTypography,
18996 disableTypography = _props$disableTypogra === void 0 ? false : _props$disableTypogra,
18997 other = _objectWithoutProperties(props, ["children", "classes", "className", "disableTypography"]);
18998
18999 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
19000 className: clsx(classes.root, className),
19001 ref: ref
19002 }, other), disableTypography ? children : /*#__PURE__*/react.exports.createElement(Typography$1, {
19003 component: "h2",
19004 variant: "h6"
19005 }, children));
19006 });
19007 withStyles(styles$1d, {
19008 name: 'MuiDialogTitle'
19009 })(DialogTitle);
19010
19011 var styles$1c = function styles(theme) {
19012 return {
19013 /* Styles applied to the root element. */
19014 root: {
19015 height: 1,
19016 margin: 0,
19017 // Reset browser default style.
19018 border: 'none',
19019 flexShrink: 0,
19020 backgroundColor: theme.palette.divider
19021 },
19022
19023 /* Styles applied to the root element if `absolute={true}`. */
19024 absolute: {
19025 position: 'absolute',
19026 bottom: 0,
19027 left: 0,
19028 width: '100%'
19029 },
19030
19031 /* Styles applied to the root element if `variant="inset"`. */
19032 inset: {
19033 marginLeft: 72
19034 },
19035
19036 /* Styles applied to the root element if `light={true}`. */
19037 light: {
19038 backgroundColor: alpha(theme.palette.divider, 0.08)
19039 },
19040
19041 /* Styles applied to the root element if `variant="middle"`. */
19042 middle: {
19043 marginLeft: theme.spacing(2),
19044 marginRight: theme.spacing(2)
19045 },
19046
19047 /* Styles applied to the root element if `orientation="vertical"`. */
19048 vertical: {
19049 height: '100%',
19050 width: 1
19051 },
19052
19053 /* Styles applied to the root element if `flexItem={true}`. */
19054 flexItem: {
19055 alignSelf: 'stretch',
19056 height: 'auto'
19057 }
19058 };
19059 };
19060 var Divider = /*#__PURE__*/react.exports.forwardRef(function Divider(props, ref) {
19061 var _props$absolute = props.absolute,
19062 absolute = _props$absolute === void 0 ? false : _props$absolute,
19063 classes = props.classes,
19064 className = props.className,
19065 _props$component = props.component,
19066 Component = _props$component === void 0 ? 'hr' : _props$component,
19067 _props$flexItem = props.flexItem,
19068 flexItem = _props$flexItem === void 0 ? false : _props$flexItem,
19069 _props$light = props.light,
19070 light = _props$light === void 0 ? false : _props$light,
19071 _props$orientation = props.orientation,
19072 orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
19073 _props$role = props.role,
19074 role = _props$role === void 0 ? Component !== 'hr' ? 'separator' : undefined : _props$role,
19075 _props$variant = props.variant,
19076 variant = _props$variant === void 0 ? 'fullWidth' : _props$variant,
19077 other = _objectWithoutProperties(props, ["absolute", "classes", "className", "component", "flexItem", "light", "orientation", "role", "variant"]);
19078
19079 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
19080 className: clsx(classes.root, className, variant !== 'fullWidth' && classes[variant], absolute && classes.absolute, flexItem && classes.flexItem, light && classes.light, orientation === 'vertical' && classes.vertical),
19081 role: role,
19082 ref: ref
19083 }, other));
19084 });
19085 var Divider$1 = withStyles(styles$1c, {
19086 name: 'MuiDivider'
19087 })(Divider);
19088
19089 // Later, we gonna translate back the node to his original location
19090 // with `none`.`
19091
19092 function getTranslateValue(direction, node) {
19093 var rect = node.getBoundingClientRect();
19094 var transform;
19095
19096 if (node.fakeTransform) {
19097 transform = node.fakeTransform;
19098 } else {
19099 var computedStyle = window.getComputedStyle(node);
19100 transform = computedStyle.getPropertyValue('-webkit-transform') || computedStyle.getPropertyValue('transform');
19101 }
19102
19103 var offsetX = 0;
19104 var offsetY = 0;
19105
19106 if (transform && transform !== 'none' && typeof transform === 'string') {
19107 var transformValues = transform.split('(')[1].split(')')[0].split(',');
19108 offsetX = parseInt(transformValues[4], 10);
19109 offsetY = parseInt(transformValues[5], 10);
19110 }
19111
19112 if (direction === 'left') {
19113 return "translateX(".concat(window.innerWidth, "px) translateX(").concat(offsetX - rect.left, "px)");
19114 }
19115
19116 if (direction === 'right') {
19117 return "translateX(-".concat(rect.left + rect.width - offsetX, "px)");
19118 }
19119
19120 if (direction === 'up') {
19121 return "translateY(".concat(window.innerHeight, "px) translateY(").concat(offsetY - rect.top, "px)");
19122 } // direction === 'down'
19123
19124
19125 return "translateY(-".concat(rect.top + rect.height - offsetY, "px)");
19126 }
19127
19128 function setTranslateValue(direction, node) {
19129 var transform = getTranslateValue(direction, node);
19130
19131 if (transform) {
19132 node.style.webkitTransform = transform;
19133 node.style.transform = transform;
19134 }
19135 }
19136 var defaultTimeout = {
19137 enter: duration.enteringScreen,
19138 exit: duration.leavingScreen
19139 };
19140 /**
19141 * The Slide transition is used by the [Drawer](/components/drawers/) component.
19142 * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
19143 */
19144
19145 var Slide = /*#__PURE__*/react.exports.forwardRef(function Slide(props, ref) {
19146 var children = props.children,
19147 _props$direction = props.direction,
19148 direction = _props$direction === void 0 ? 'down' : _props$direction,
19149 inProp = props.in,
19150 onEnter = props.onEnter,
19151 onEntered = props.onEntered,
19152 onEntering = props.onEntering,
19153 onExit = props.onExit,
19154 onExited = props.onExited,
19155 onExiting = props.onExiting,
19156 style = props.style,
19157 _props$timeout = props.timeout,
19158 timeout = _props$timeout === void 0 ? defaultTimeout : _props$timeout,
19159 _props$TransitionComp = props.TransitionComponent,
19160 TransitionComponent = _props$TransitionComp === void 0 ? Transition : _props$TransitionComp,
19161 other = _objectWithoutProperties(props, ["children", "direction", "in", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "style", "timeout", "TransitionComponent"]);
19162
19163 var theme = useTheme$1();
19164 var childrenRef = react.exports.useRef(null);
19165 /**
19166 * used in cloneElement(children, { ref: handleRef })
19167 */
19168
19169 var handleOwnRef = react.exports.useCallback(function (instance) {
19170 // #StrictMode ready
19171 childrenRef.current = reactDom.exports.findDOMNode(instance);
19172 }, []);
19173 var handleRefIntermediary = useForkRef(children.ref, handleOwnRef);
19174 var handleRef = useForkRef(handleRefIntermediary, ref);
19175
19176 var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {
19177 return function (isAppearing) {
19178 if (callback) {
19179 // onEnterXxx and onExitXxx callbacks have a different arguments.length value.
19180 if (isAppearing === undefined) {
19181 callback(childrenRef.current);
19182 } else {
19183 callback(childrenRef.current, isAppearing);
19184 }
19185 }
19186 };
19187 };
19188
19189 var handleEnter = normalizedTransitionCallback(function (node, isAppearing) {
19190 setTranslateValue(direction, node);
19191 reflow(node);
19192
19193 if (onEnter) {
19194 onEnter(node, isAppearing);
19195 }
19196 });
19197 var handleEntering = normalizedTransitionCallback(function (node, isAppearing) {
19198 var transitionProps = getTransitionProps({
19199 timeout: timeout,
19200 style: style
19201 }, {
19202 mode: 'enter'
19203 });
19204 node.style.webkitTransition = theme.transitions.create('-webkit-transform', _extends$5({}, transitionProps, {
19205 easing: theme.transitions.easing.easeOut
19206 }));
19207 node.style.transition = theme.transitions.create('transform', _extends$5({}, transitionProps, {
19208 easing: theme.transitions.easing.easeOut
19209 }));
19210 node.style.webkitTransform = 'none';
19211 node.style.transform = 'none';
19212
19213 if (onEntering) {
19214 onEntering(node, isAppearing);
19215 }
19216 });
19217 var handleEntered = normalizedTransitionCallback(onEntered);
19218 var handleExiting = normalizedTransitionCallback(onExiting);
19219 var handleExit = normalizedTransitionCallback(function (node) {
19220 var transitionProps = getTransitionProps({
19221 timeout: timeout,
19222 style: style
19223 }, {
19224 mode: 'exit'
19225 });
19226 node.style.webkitTransition = theme.transitions.create('-webkit-transform', _extends$5({}, transitionProps, {
19227 easing: theme.transitions.easing.sharp
19228 }));
19229 node.style.transition = theme.transitions.create('transform', _extends$5({}, transitionProps, {
19230 easing: theme.transitions.easing.sharp
19231 }));
19232 setTranslateValue(direction, node);
19233
19234 if (onExit) {
19235 onExit(node);
19236 }
19237 });
19238 var handleExited = normalizedTransitionCallback(function (node) {
19239 // No need for transitions when the component is hidden
19240 node.style.webkitTransition = '';
19241 node.style.transition = '';
19242
19243 if (onExited) {
19244 onExited(node);
19245 }
19246 });
19247 var updatePosition = react.exports.useCallback(function () {
19248 if (childrenRef.current) {
19249 setTranslateValue(direction, childrenRef.current);
19250 }
19251 }, [direction]);
19252 react.exports.useEffect(function () {
19253 // Skip configuration where the position is screen size invariant.
19254 if (inProp || direction === 'down' || direction === 'right') {
19255 return undefined;
19256 }
19257
19258 var handleResize = debounce$1(function () {
19259 if (childrenRef.current) {
19260 setTranslateValue(direction, childrenRef.current);
19261 }
19262 });
19263 window.addEventListener('resize', handleResize);
19264 return function () {
19265 handleResize.clear();
19266 window.removeEventListener('resize', handleResize);
19267 };
19268 }, [direction, inProp]);
19269 react.exports.useEffect(function () {
19270 if (!inProp) {
19271 // We need to update the position of the drawer when the direction change and
19272 // when it's hidden.
19273 updatePosition();
19274 }
19275 }, [inProp, updatePosition]);
19276 return /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
19277 nodeRef: childrenRef,
19278 onEnter: handleEnter,
19279 onEntered: handleEntered,
19280 onEntering: handleEntering,
19281 onExit: handleExit,
19282 onExited: handleExited,
19283 onExiting: handleExiting,
19284 appear: true,
19285 in: inProp,
19286 timeout: timeout
19287 }, other), function (state, childProps) {
19288 return /*#__PURE__*/react.exports.cloneElement(children, _extends$5({
19289 ref: handleRef,
19290 style: _extends$5({
19291 visibility: state === 'exited' && !inProp ? 'hidden' : undefined
19292 }, style, children.props.style)
19293 }, childProps));
19294 });
19295 });
19296
19297 var styles$1b = function styles(theme) {
19298 return {
19299 /* Styles applied to the root element. */
19300 root: {},
19301
19302 /* Styles applied to the root element if `variant="permanent or persistent"`. */
19303 docked: {
19304 flex: '0 0 auto'
19305 },
19306
19307 /* Styles applied to the `Paper` component. */
19308 paper: {
19309 overflowY: 'auto',
19310 display: 'flex',
19311 flexDirection: 'column',
19312 height: '100%',
19313 flex: '1 0 auto',
19314 zIndex: theme.zIndex.drawer,
19315 WebkitOverflowScrolling: 'touch',
19316 // Add iOS momentum scrolling.
19317 // temporary style
19318 position: 'fixed',
19319 top: 0,
19320 // We disable the focus ring for mouse, touch and keyboard users.
19321 // At some point, it would be better to keep it for keyboard users.
19322 // :focus-ring CSS pseudo-class will help.
19323 outline: 0
19324 },
19325
19326 /* Styles applied to the `Paper` component if `anchor="left"`. */
19327 paperAnchorLeft: {
19328 left: 0,
19329 right: 'auto'
19330 },
19331
19332 /* Styles applied to the `Paper` component if `anchor="right"`. */
19333 paperAnchorRight: {
19334 left: 'auto',
19335 right: 0
19336 },
19337
19338 /* Styles applied to the `Paper` component if `anchor="top"`. */
19339 paperAnchorTop: {
19340 top: 0,
19341 left: 0,
19342 bottom: 'auto',
19343 right: 0,
19344 height: 'auto',
19345 maxHeight: '100%'
19346 },
19347
19348 /* Styles applied to the `Paper` component if `anchor="bottom"`. */
19349 paperAnchorBottom: {
19350 top: 'auto',
19351 left: 0,
19352 bottom: 0,
19353 right: 0,
19354 height: 'auto',
19355 maxHeight: '100%'
19356 },
19357
19358 /* Styles applied to the `Paper` component if `anchor="left"` and `variant` is not "temporary". */
19359 paperAnchorDockedLeft: {
19360 borderRight: "1px solid ".concat(theme.palette.divider)
19361 },
19362
19363 /* Styles applied to the `Paper` component if `anchor="top"` and `variant` is not "temporary". */
19364 paperAnchorDockedTop: {
19365 borderBottom: "1px solid ".concat(theme.palette.divider)
19366 },
19367
19368 /* Styles applied to the `Paper` component if `anchor="right"` and `variant` is not "temporary". */
19369 paperAnchorDockedRight: {
19370 borderLeft: "1px solid ".concat(theme.palette.divider)
19371 },
19372
19373 /* Styles applied to the `Paper` component if `anchor="bottom"` and `variant` is not "temporary". */
19374 paperAnchorDockedBottom: {
19375 borderTop: "1px solid ".concat(theme.palette.divider)
19376 },
19377
19378 /* Styles applied to the `Modal` component. */
19379 modal: {}
19380 };
19381 };
19382 var oppositeDirection = {
19383 left: 'right',
19384 right: 'left',
19385 top: 'down',
19386 bottom: 'up'
19387 };
19388 function isHorizontal(anchor) {
19389 return ['left', 'right'].indexOf(anchor) !== -1;
19390 }
19391 function getAnchor(theme, anchor) {
19392 return theme.direction === 'rtl' && isHorizontal(anchor) ? oppositeDirection[anchor] : anchor;
19393 }
19394 var defaultTransitionDuration = {
19395 enter: duration.enteringScreen,
19396 exit: duration.leavingScreen
19397 };
19398 /**
19399 * The props of the [Modal](/api/modal/) component are available
19400 * when `variant="temporary"` is set.
19401 */
19402
19403 var Drawer = /*#__PURE__*/react.exports.forwardRef(function Drawer(props, ref) {
19404 var _props$anchor = props.anchor,
19405 anchorProp = _props$anchor === void 0 ? 'left' : _props$anchor,
19406 BackdropProps = props.BackdropProps,
19407 children = props.children,
19408 classes = props.classes,
19409 className = props.className,
19410 _props$elevation = props.elevation,
19411 elevation = _props$elevation === void 0 ? 16 : _props$elevation,
19412 _props$ModalProps = props.ModalProps;
19413 _props$ModalProps = _props$ModalProps === void 0 ? {} : _props$ModalProps;
19414
19415 var BackdropPropsProp = _props$ModalProps.BackdropProps,
19416 ModalProps = _objectWithoutProperties(_props$ModalProps, ["BackdropProps"]),
19417 onClose = props.onClose,
19418 _props$open = props.open,
19419 open = _props$open === void 0 ? false : _props$open,
19420 _props$PaperProps = props.PaperProps,
19421 PaperProps = _props$PaperProps === void 0 ? {} : _props$PaperProps,
19422 SlideProps = props.SlideProps,
19423 _props$TransitionComp = props.TransitionComponent,
19424 TransitionComponent = _props$TransitionComp === void 0 ? Slide : _props$TransitionComp,
19425 _props$transitionDura = props.transitionDuration,
19426 transitionDuration = _props$transitionDura === void 0 ? defaultTransitionDuration : _props$transitionDura,
19427 _props$variant = props.variant,
19428 variant = _props$variant === void 0 ? 'temporary' : _props$variant,
19429 other = _objectWithoutProperties(props, ["anchor", "BackdropProps", "children", "classes", "className", "elevation", "ModalProps", "onClose", "open", "PaperProps", "SlideProps", "TransitionComponent", "transitionDuration", "variant"]);
19430
19431 var theme = useTheme$1(); // Let's assume that the Drawer will always be rendered on user space.
19432 // We use this state is order to skip the appear transition during the
19433 // initial mount of the component.
19434
19435 var mounted = react.exports.useRef(false);
19436 react.exports.useEffect(function () {
19437 mounted.current = true;
19438 }, []);
19439 var anchor = getAnchor(theme, anchorProp);
19440 var drawer = /*#__PURE__*/react.exports.createElement(Paper$1, _extends$5({
19441 elevation: variant === 'temporary' ? elevation : 0,
19442 square: true
19443 }, PaperProps, {
19444 className: clsx(classes.paper, classes["paperAnchor".concat(capitalize(anchor))], PaperProps.className, variant !== 'temporary' && classes["paperAnchorDocked".concat(capitalize(anchor))])
19445 }), children);
19446
19447 if (variant === 'permanent') {
19448 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
19449 className: clsx(classes.root, classes.docked, className),
19450 ref: ref
19451 }, other), drawer);
19452 }
19453
19454 var slidingDrawer = /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
19455 in: open,
19456 direction: oppositeDirection[anchor],
19457 timeout: transitionDuration,
19458 appear: mounted.current
19459 }, SlideProps), drawer);
19460
19461 if (variant === 'persistent') {
19462 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
19463 className: clsx(classes.root, classes.docked, className),
19464 ref: ref
19465 }, other), slidingDrawer);
19466 } // variant === temporary
19467
19468
19469 return /*#__PURE__*/react.exports.createElement(Modal, _extends$5({
19470 BackdropProps: _extends$5({}, BackdropProps, BackdropPropsProp, {
19471 transitionDuration: transitionDuration
19472 }),
19473 BackdropComponent: Backdrop$1,
19474 className: clsx(classes.root, classes.modal, className),
19475 open: open,
19476 onClose: onClose,
19477 ref: ref
19478 }, other, ModalProps), slidingDrawer);
19479 });
19480 withStyles(styles$1b, {
19481 name: 'MuiDrawer',
19482 flip: false
19483 })(Drawer);
19484
19485 /**
19486 * @ignore - internal component.
19487 * @type {React.Context<{} | {expanded: boolean, disabled: boolean, toggle: () => void}>}
19488 */
19489
19490 var ExpansionPanelContext = react.exports.createContext({});
19491
19492 var styles$1a = function styles(theme) {
19493 var transition = {
19494 duration: theme.transitions.duration.shortest
19495 };
19496 return {
19497 /* Styles applied to the root element. */
19498 root: {
19499 position: 'relative',
19500 transition: theme.transitions.create(['margin'], transition),
19501 '&:before': {
19502 position: 'absolute',
19503 left: 0,
19504 top: -1,
19505 right: 0,
19506 height: 1,
19507 content: '""',
19508 opacity: 1,
19509 backgroundColor: theme.palette.divider,
19510 transition: theme.transitions.create(['opacity', 'background-color'], transition)
19511 },
19512 '&:first-child': {
19513 '&:before': {
19514 display: 'none'
19515 }
19516 },
19517 '&$expanded': {
19518 margin: '16px 0',
19519 '&:first-child': {
19520 marginTop: 0
19521 },
19522 '&:last-child': {
19523 marginBottom: 0
19524 },
19525 '&:before': {
19526 opacity: 0
19527 }
19528 },
19529 '&$expanded + &': {
19530 '&:before': {
19531 display: 'none'
19532 }
19533 },
19534 '&$disabled': {
19535 backgroundColor: theme.palette.action.disabledBackground
19536 }
19537 },
19538
19539 /* Styles applied to the root element if `square={false}`. */
19540 rounded: {
19541 borderRadius: 0,
19542 '&:first-child': {
19543 borderTopLeftRadius: theme.shape.borderRadius,
19544 borderTopRightRadius: theme.shape.borderRadius
19545 },
19546 '&:last-child': {
19547 borderBottomLeftRadius: theme.shape.borderRadius,
19548 borderBottomRightRadius: theme.shape.borderRadius,
19549 // Fix a rendering issue on Edge
19550 '@supports (-ms-ime-align: auto)': {
19551 borderBottomLeftRadius: 0,
19552 borderBottomRightRadius: 0
19553 }
19554 }
19555 },
19556
19557 /* Styles applied to the root element if `expanded={true}`. */
19558 expanded: {},
19559
19560 /* Styles applied to the root element if `disabled={true}`. */
19561 disabled: {}
19562 };
19563 };
19564 /**
19565 * ⚠️ The ExpansionPanel component was renamed to Accordion to use a more common naming convention.
19566 *
19567 * You should use `import { Accordion } from '@material-ui/core'`
19568 * or `import Accordion from '@material-ui/core/Accordion'`.
19569 */
19570
19571 var ExpansionPanel = /*#__PURE__*/react.exports.forwardRef(function ExpansionPanel(props, ref) {
19572
19573 var childrenProp = props.children,
19574 classes = props.classes,
19575 className = props.className,
19576 _props$defaultExpande = props.defaultExpanded,
19577 defaultExpanded = _props$defaultExpande === void 0 ? false : _props$defaultExpande,
19578 _props$disabled = props.disabled,
19579 disabled = _props$disabled === void 0 ? false : _props$disabled,
19580 expandedProp = props.expanded,
19581 onChange = props.onChange,
19582 _props$square = props.square,
19583 square = _props$square === void 0 ? false : _props$square,
19584 _props$TransitionComp = props.TransitionComponent,
19585 TransitionComponent = _props$TransitionComp === void 0 ? Collapse$1 : _props$TransitionComp,
19586 TransitionProps = props.TransitionProps,
19587 other = _objectWithoutProperties(props, ["children", "classes", "className", "defaultExpanded", "disabled", "expanded", "onChange", "square", "TransitionComponent", "TransitionProps"]);
19588
19589 var _useControlled = useControlled({
19590 controlled: expandedProp,
19591 default: defaultExpanded,
19592 name: 'ExpansionPanel',
19593 state: 'expanded'
19594 }),
19595 _useControlled2 = _slicedToArray(_useControlled, 2),
19596 expanded = _useControlled2[0],
19597 setExpandedState = _useControlled2[1];
19598
19599 var handleChange = react.exports.useCallback(function (event) {
19600 setExpandedState(!expanded);
19601
19602 if (onChange) {
19603 onChange(event, !expanded);
19604 }
19605 }, [expanded, onChange, setExpandedState]);
19606
19607 var _React$Children$toArr = react.exports.Children.toArray(childrenProp),
19608 _React$Children$toArr2 = _toArray(_React$Children$toArr),
19609 summary = _React$Children$toArr2[0],
19610 children = _React$Children$toArr2.slice(1);
19611
19612 var contextValue = react.exports.useMemo(function () {
19613 return {
19614 expanded: expanded,
19615 disabled: disabled,
19616 toggle: handleChange
19617 };
19618 }, [expanded, disabled, handleChange]);
19619 return /*#__PURE__*/react.exports.createElement(Paper$1, _extends$5({
19620 className: clsx(classes.root, className, expanded && classes.expanded, disabled && classes.disabled, !square && classes.rounded),
19621 ref: ref,
19622 square: square
19623 }, other), /*#__PURE__*/react.exports.createElement(ExpansionPanelContext.Provider, {
19624 value: contextValue
19625 }, summary), /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
19626 in: expanded,
19627 timeout: "auto"
19628 }, TransitionProps), /*#__PURE__*/react.exports.createElement("div", {
19629 "aria-labelledby": summary.props.id,
19630 id: summary.props['aria-controls'],
19631 role: "region"
19632 }, children)));
19633 });
19634 withStyles(styles$1a, {
19635 name: 'MuiExpansionPanel'
19636 })(ExpansionPanel);
19637
19638 var styles$19 = {
19639 /* Styles applied to the root element. */
19640 root: {
19641 display: 'flex',
19642 alignItems: 'center',
19643 padding: 8,
19644 justifyContent: 'flex-end'
19645 },
19646
19647 /* Styles applied to the root element if `disableSpacing={false}`. */
19648 spacing: {
19649 '& > :not(:first-child)': {
19650 marginLeft: 8
19651 }
19652 }
19653 };
19654 /**
19655 * ⚠️ The ExpansionPanelActions component was renamed to AccordionActions to use a more common naming convention.
19656 *
19657 * You should use `import { AccordionActions } from '@material-ui/core'`
19658 * or `import AccordionActions from '@material-ui/core/AccordionActions'`.
19659 */
19660
19661 var ExpansionPanelActions = /*#__PURE__*/react.exports.forwardRef(function ExpansionPanelActions(props, ref) {
19662
19663 var classes = props.classes,
19664 className = props.className,
19665 _props$disableSpacing = props.disableSpacing,
19666 disableSpacing = _props$disableSpacing === void 0 ? false : _props$disableSpacing,
19667 other = _objectWithoutProperties(props, ["classes", "className", "disableSpacing"]);
19668
19669 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
19670 className: clsx(classes.root, className, !disableSpacing && classes.spacing),
19671 ref: ref
19672 }, other));
19673 });
19674 withStyles(styles$19, {
19675 name: 'MuiExpansionPanelActions'
19676 })(ExpansionPanelActions);
19677
19678 var styles$18 = function styles(theme) {
19679 return {
19680 /* Styles applied to the root element. */
19681 root: {
19682 display: 'flex',
19683 padding: theme.spacing(1, 2, 2)
19684 }
19685 };
19686 };
19687 /**
19688 * ⚠️ The ExpansionPanelDetails component was renamed to AccordionDetails to use a more common naming convention.
19689 *
19690 * You should use `import { AccordionDetails } from '@material-ui/core'`
19691 * or `import AccordionDetails from '@material-ui/core/AccordionDetails'`.
19692 */
19693
19694 var ExpansionPanelDetails = /*#__PURE__*/react.exports.forwardRef(function ExpansionPanelDetails(props, ref) {
19695
19696 var classes = props.classes,
19697 className = props.className,
19698 other = _objectWithoutProperties(props, ["classes", "className"]);
19699
19700 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
19701 className: clsx(classes.root, className),
19702 ref: ref
19703 }, other));
19704 });
19705 withStyles(styles$18, {
19706 name: 'MuiExpansionPanelDetails'
19707 })(ExpansionPanelDetails);
19708
19709 var styles$17 = function styles(theme) {
19710 var transition = {
19711 duration: theme.transitions.duration.shortest
19712 };
19713 return {
19714 /* Styles applied to the root element. */
19715 root: {
19716 display: 'flex',
19717 minHeight: 8 * 6,
19718 transition: theme.transitions.create(['min-height', 'background-color'], transition),
19719 padding: theme.spacing(0, 2),
19720 '&:hover:not($disabled)': {
19721 cursor: 'pointer'
19722 },
19723 '&$expanded': {
19724 minHeight: 64
19725 },
19726 '&$focused': {
19727 backgroundColor: theme.palette.action.focus
19728 },
19729 '&$disabled': {
19730 opacity: theme.palette.action.disabledOpacity
19731 }
19732 },
19733
19734 /* Pseudo-class applied to the root element, children wrapper element and `IconButton` component if `expanded={true}`. */
19735 expanded: {},
19736
19737 /* Pseudo-class applied to the root element if `focused={true}`. */
19738 focused: {},
19739
19740 /* Pseudo-class applied to the root element if `disabled={true}`. */
19741 disabled: {},
19742
19743 /* Styles applied to the children wrapper element. */
19744 content: {
19745 display: 'flex',
19746 flexGrow: 1,
19747 transition: theme.transitions.create(['margin'], transition),
19748 margin: '12px 0',
19749 '&$expanded': {
19750 margin: '20px 0'
19751 }
19752 },
19753
19754 /* Styles applied to the `IconButton` component when `expandIcon` is supplied. */
19755 expandIcon: {
19756 transform: 'rotate(0deg)',
19757 transition: theme.transitions.create('transform', transition),
19758 '&:hover': {
19759 // Disable the hover effect for the IconButton,
19760 // because a hover effect should apply to the entire Expand button and
19761 // not only to the IconButton.
19762 backgroundColor: 'transparent'
19763 },
19764 '&$expanded': {
19765 transform: 'rotate(180deg)'
19766 }
19767 }
19768 };
19769 };
19770 /**
19771 * ⚠️ The ExpansionPanelSummary component was renamed to AccordionSummary to use a more common naming convention.
19772 *
19773 * You should use `import { AccordionSummary } from '@material-ui/core'`
19774 * or `import AccordionSummary from '@material-ui/core/AccordionSummary'`.
19775 */
19776
19777 var ExpansionPanelSummary = /*#__PURE__*/react.exports.forwardRef(function ExpansionPanelSummary(props, ref) {
19778
19779 var children = props.children,
19780 classes = props.classes,
19781 className = props.className,
19782 expandIcon = props.expandIcon,
19783 IconButtonProps = props.IconButtonProps,
19784 onBlur = props.onBlur,
19785 onClick = props.onClick,
19786 onFocusVisible = props.onFocusVisible,
19787 other = _objectWithoutProperties(props, ["children", "classes", "className", "expandIcon", "IconButtonProps", "onBlur", "onClick", "onFocusVisible"]);
19788
19789 var _React$useState = react.exports.useState(false),
19790 focusedState = _React$useState[0],
19791 setFocusedState = _React$useState[1];
19792
19793 var handleFocusVisible = function handleFocusVisible(event) {
19794 setFocusedState(true);
19795
19796 if (onFocusVisible) {
19797 onFocusVisible(event);
19798 }
19799 };
19800
19801 var handleBlur = function handleBlur(event) {
19802 setFocusedState(false);
19803
19804 if (onBlur) {
19805 onBlur(event);
19806 }
19807 };
19808
19809 var _React$useContext = react.exports.useContext(ExpansionPanelContext),
19810 _React$useContext$dis = _React$useContext.disabled,
19811 disabled = _React$useContext$dis === void 0 ? false : _React$useContext$dis,
19812 expanded = _React$useContext.expanded,
19813 toggle = _React$useContext.toggle;
19814
19815 var handleChange = function handleChange(event) {
19816 if (toggle) {
19817 toggle(event);
19818 }
19819
19820 if (onClick) {
19821 onClick(event);
19822 }
19823 };
19824
19825 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
19826 focusRipple: false,
19827 disableRipple: true,
19828 disabled: disabled,
19829 component: "div",
19830 "aria-expanded": expanded,
19831 className: clsx(classes.root, className, disabled && classes.disabled, expanded && classes.expanded, focusedState && classes.focused),
19832 onFocusVisible: handleFocusVisible,
19833 onBlur: handleBlur,
19834 onClick: handleChange,
19835 ref: ref
19836 }, other), /*#__PURE__*/react.exports.createElement("div", {
19837 className: clsx(classes.content, expanded && classes.expanded)
19838 }, children), expandIcon && /*#__PURE__*/react.exports.createElement(IconButton$1, _extends$5({
19839 className: clsx(classes.expandIcon, expanded && classes.expanded),
19840 edge: "end",
19841 component: "div",
19842 tabIndex: null,
19843 role: null,
19844 "aria-hidden": true
19845 }, IconButtonProps), expandIcon));
19846 });
19847 withStyles(styles$17, {
19848 name: 'MuiExpansionPanelSummary'
19849 })(ExpansionPanelSummary);
19850
19851 var styles$16 = function styles(theme) {
19852 return {
19853 /* Styles applied to the root element. */
19854 root: _extends$5({}, theme.typography.button, {
19855 boxSizing: 'border-box',
19856 minHeight: 36,
19857 transition: theme.transitions.create(['background-color', 'box-shadow', 'border'], {
19858 duration: theme.transitions.duration.short
19859 }),
19860 borderRadius: '50%',
19861 padding: 0,
19862 minWidth: 0,
19863 width: 56,
19864 height: 56,
19865 boxShadow: theme.shadows[6],
19866 '&:active': {
19867 boxShadow: theme.shadows[12]
19868 },
19869 color: theme.palette.getContrastText(theme.palette.grey[300]),
19870 backgroundColor: theme.palette.grey[300],
19871 '&:hover': {
19872 backgroundColor: theme.palette.grey.A100,
19873 // Reset on touch devices, it doesn't add specificity
19874 '@media (hover: none)': {
19875 backgroundColor: theme.palette.grey[300]
19876 },
19877 '&$disabled': {
19878 backgroundColor: theme.palette.action.disabledBackground
19879 },
19880 textDecoration: 'none'
19881 },
19882 '&$focusVisible': {
19883 boxShadow: theme.shadows[6]
19884 },
19885 '&$disabled': {
19886 color: theme.palette.action.disabled,
19887 boxShadow: theme.shadows[0],
19888 backgroundColor: theme.palette.action.disabledBackground
19889 }
19890 }),
19891
19892 /* Styles applied to the span element that wraps the children. */
19893 label: {
19894 width: '100%',
19895 // assure the correct width for iOS Safari
19896 display: 'inherit',
19897 alignItems: 'inherit',
19898 justifyContent: 'inherit'
19899 },
19900
19901 /* Styles applied to the root element if `color="primary"`. */
19902 primary: {
19903 color: theme.palette.primary.contrastText,
19904 backgroundColor: theme.palette.primary.main,
19905 '&:hover': {
19906 backgroundColor: theme.palette.primary.dark,
19907 // Reset on touch devices, it doesn't add specificity
19908 '@media (hover: none)': {
19909 backgroundColor: theme.palette.primary.main
19910 }
19911 }
19912 },
19913
19914 /* Styles applied to the root element if `color="secondary"`. */
19915 secondary: {
19916 color: theme.palette.secondary.contrastText,
19917 backgroundColor: theme.palette.secondary.main,
19918 '&:hover': {
19919 backgroundColor: theme.palette.secondary.dark,
19920 // Reset on touch devices, it doesn't add specificity
19921 '@media (hover: none)': {
19922 backgroundColor: theme.palette.secondary.main
19923 }
19924 }
19925 },
19926
19927 /* Styles applied to the root element if `variant="extended"`. */
19928 extended: {
19929 borderRadius: 48 / 2,
19930 padding: '0 16px',
19931 width: 'auto',
19932 minHeight: 'auto',
19933 minWidth: 48,
19934 height: 48,
19935 '&$sizeSmall': {
19936 width: 'auto',
19937 padding: '0 8px',
19938 borderRadius: 34 / 2,
19939 minWidth: 34,
19940 height: 34
19941 },
19942 '&$sizeMedium': {
19943 width: 'auto',
19944 padding: '0 16px',
19945 borderRadius: 40 / 2,
19946 minWidth: 40,
19947 height: 40
19948 }
19949 },
19950
19951 /* Pseudo-class applied to the ButtonBase root element if the button is keyboard focused. */
19952 focusVisible: {},
19953
19954 /* Pseudo-class applied to the root element if `disabled={true}`. */
19955 disabled: {},
19956
19957 /* Styles applied to the root element if `color="inherit"`. */
19958 colorInherit: {
19959 color: 'inherit'
19960 },
19961
19962 /* Styles applied to the root element if `size="small"``. */
19963 sizeSmall: {
19964 width: 40,
19965 height: 40
19966 },
19967
19968 /* Styles applied to the root element if `size="medium"``. */
19969 sizeMedium: {
19970 width: 48,
19971 height: 48
19972 }
19973 };
19974 };
19975 var Fab = /*#__PURE__*/react.exports.forwardRef(function Fab(props, ref) {
19976 var children = props.children,
19977 classes = props.classes,
19978 className = props.className,
19979 _props$color = props.color,
19980 color = _props$color === void 0 ? 'default' : _props$color,
19981 _props$component = props.component,
19982 component = _props$component === void 0 ? 'button' : _props$component,
19983 _props$disabled = props.disabled,
19984 disabled = _props$disabled === void 0 ? false : _props$disabled,
19985 _props$disableFocusRi = props.disableFocusRipple,
19986 disableFocusRipple = _props$disableFocusRi === void 0 ? false : _props$disableFocusRi,
19987 focusVisibleClassName = props.focusVisibleClassName,
19988 _props$size = props.size,
19989 size = _props$size === void 0 ? 'large' : _props$size,
19990 _props$variant = props.variant,
19991 variant = _props$variant === void 0 ? 'circular' : _props$variant,
19992 other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "component", "disabled", "disableFocusRipple", "focusVisibleClassName", "size", "variant"]);
19993
19994 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
19995 className: clsx(classes.root, className, size !== 'large' && classes["size".concat(capitalize(size))], disabled && classes.disabled, variant === 'extended' && classes.extended, {
19996 'primary': classes.primary,
19997 'secondary': classes.secondary,
19998 'inherit': classes.colorInherit
19999 }[color]),
20000 component: component,
20001 disabled: disabled,
20002 focusRipple: !disableFocusRipple,
20003 focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),
20004 ref: ref
20005 }, other), /*#__PURE__*/react.exports.createElement("span", {
20006 className: classes.label
20007 }, children));
20008 });
20009 withStyles(styles$16, {
20010 name: 'MuiFab'
20011 })(Fab);
20012
20013 function formControlState(_ref) {
20014 var props = _ref.props,
20015 states = _ref.states,
20016 muiFormControl = _ref.muiFormControl;
20017 return states.reduce(function (acc, state) {
20018 acc[state] = props[state];
20019
20020 if (muiFormControl) {
20021 if (typeof props[state] === 'undefined') {
20022 acc[state] = muiFormControl[state];
20023 }
20024 }
20025
20026 return acc;
20027 }, {});
20028 }
20029
20030 function getStyleValue(computedStyle, property) {
20031 return parseInt(computedStyle[property], 10) || 0;
20032 }
20033
20034 var useEnhancedEffect$5 = typeof window !== 'undefined' ? react.exports.useLayoutEffect : react.exports.useEffect;
20035 var styles$15 = {
20036 /* Styles applied to the shadow textarea element. */
20037 shadow: {
20038 // Visibility needed to hide the extra text area on iPads
20039 visibility: 'hidden',
20040 // Remove from the content flow
20041 position: 'absolute',
20042 // Ignore the scrollbar width
20043 overflow: 'hidden',
20044 height: 0,
20045 top: 0,
20046 left: 0,
20047 // Create a new layer, increase the isolation of the computed values
20048 transform: 'translateZ(0)'
20049 }
20050 };
20051 var TextareaAutosize = /*#__PURE__*/react.exports.forwardRef(function TextareaAutosize(props, ref) {
20052 var onChange = props.onChange,
20053 rows = props.rows,
20054 rowsMax = props.rowsMax,
20055 rowsMinProp = props.rowsMin,
20056 maxRowsProp = props.maxRows,
20057 _props$minRows = props.minRows,
20058 minRowsProp = _props$minRows === void 0 ? 1 : _props$minRows,
20059 style = props.style,
20060 value = props.value,
20061 other = _objectWithoutProperties(props, ["onChange", "rows", "rowsMax", "rowsMin", "maxRows", "minRows", "style", "value"]);
20062
20063 var maxRows = maxRowsProp || rowsMax;
20064 var minRows = rows || rowsMinProp || minRowsProp;
20065
20066 var _React$useRef = react.exports.useRef(value != null),
20067 isControlled = _React$useRef.current;
20068
20069 var inputRef = react.exports.useRef(null);
20070 var handleRef = useForkRef(ref, inputRef);
20071 var shadowRef = react.exports.useRef(null);
20072 var renders = react.exports.useRef(0);
20073
20074 var _React$useState = react.exports.useState({}),
20075 state = _React$useState[0],
20076 setState = _React$useState[1];
20077
20078 var syncHeight = react.exports.useCallback(function () {
20079 var input = inputRef.current;
20080 var computedStyle = window.getComputedStyle(input);
20081 var inputShallow = shadowRef.current;
20082 inputShallow.style.width = computedStyle.width;
20083 inputShallow.value = input.value || props.placeholder || 'x';
20084
20085 if (inputShallow.value.slice(-1) === '\n') {
20086 // Certain fonts which overflow the line height will cause the textarea
20087 // to report a different scrollHeight depending on whether the last line
20088 // is empty. Make it non-empty to avoid this issue.
20089 inputShallow.value += ' ';
20090 }
20091
20092 var boxSizing = computedStyle['box-sizing'];
20093 var padding = getStyleValue(computedStyle, 'padding-bottom') + getStyleValue(computedStyle, 'padding-top');
20094 var border = getStyleValue(computedStyle, 'border-bottom-width') + getStyleValue(computedStyle, 'border-top-width'); // The height of the inner content
20095
20096 var innerHeight = inputShallow.scrollHeight - padding; // Measure height of a textarea with a single row
20097
20098 inputShallow.value = 'x';
20099 var singleRowHeight = inputShallow.scrollHeight - padding; // The height of the outer content
20100
20101 var outerHeight = innerHeight;
20102
20103 if (minRows) {
20104 outerHeight = Math.max(Number(minRows) * singleRowHeight, outerHeight);
20105 }
20106
20107 if (maxRows) {
20108 outerHeight = Math.min(Number(maxRows) * singleRowHeight, outerHeight);
20109 }
20110
20111 outerHeight = Math.max(outerHeight, singleRowHeight); // Take the box sizing into account for applying this value as a style.
20112
20113 var outerHeightStyle = outerHeight + (boxSizing === 'border-box' ? padding + border : 0);
20114 var overflow = Math.abs(outerHeight - innerHeight) <= 1;
20115 setState(function (prevState) {
20116 // Need a large enough difference to update the height.
20117 // This prevents infinite rendering loop.
20118 if (renders.current < 20 && (outerHeightStyle > 0 && Math.abs((prevState.outerHeightStyle || 0) - outerHeightStyle) > 1 || prevState.overflow !== overflow)) {
20119 renders.current += 1;
20120 return {
20121 overflow: overflow,
20122 outerHeightStyle: outerHeightStyle
20123 };
20124 }
20125
20126 return prevState;
20127 });
20128 }, [maxRows, minRows, props.placeholder]);
20129 react.exports.useEffect(function () {
20130 var handleResize = debounce$1(function () {
20131 renders.current = 0;
20132 syncHeight();
20133 });
20134 window.addEventListener('resize', handleResize);
20135 return function () {
20136 handleResize.clear();
20137 window.removeEventListener('resize', handleResize);
20138 };
20139 }, [syncHeight]);
20140 useEnhancedEffect$5(function () {
20141 syncHeight();
20142 });
20143 react.exports.useEffect(function () {
20144 renders.current = 0;
20145 }, [value]);
20146
20147 var handleChange = function handleChange(event) {
20148 renders.current = 0;
20149
20150 if (!isControlled) {
20151 syncHeight();
20152 }
20153
20154 if (onChange) {
20155 onChange(event);
20156 }
20157 };
20158
20159 return /*#__PURE__*/react.exports.createElement(react.exports.Fragment, null, /*#__PURE__*/react.exports.createElement("textarea", _extends$5({
20160 value: value,
20161 onChange: handleChange,
20162 ref: handleRef // Apply the rows prop to get a "correct" first SSR paint
20163 ,
20164 rows: minRows,
20165 style: _extends$5({
20166 height: state.outerHeightStyle,
20167 // Need a large enough difference to allow scrolling.
20168 // This prevents infinite rendering loop.
20169 overflow: state.overflow ? 'hidden' : null
20170 }, style)
20171 }, other)), /*#__PURE__*/react.exports.createElement("textarea", {
20172 "aria-hidden": true,
20173 className: props.className,
20174 readOnly: true,
20175 ref: shadowRef,
20176 tabIndex: -1,
20177 style: _extends$5({}, styles$15.shadow, style)
20178 }));
20179 });
20180
20181 // Supports determination of isControlled().
20182 // Controlled input accepts its current value as a prop.
20183 //
20184 // @see https://facebook.github.io/react/docs/forms.html#controlled-components
20185 // @param value
20186 // @returns {boolean} true if string (including '') or number (including zero)
20187 function hasValue(value) {
20188 return value != null && !(Array.isArray(value) && value.length === 0);
20189 } // Determine if field is empty or filled.
20190 // Response determines if label is presented above field or as placeholder.
20191 //
20192 // @param obj
20193 // @param SSR
20194 // @returns {boolean} False when not present or empty string.
20195 // True when any number or string with length.
20196
20197 function isFilled(obj) {
20198 var SSR = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
20199 return obj && (hasValue(obj.value) && obj.value !== '' || SSR && hasValue(obj.defaultValue) && obj.defaultValue !== '');
20200 } // Determine if an Input is adorned on start.
20201 // It's corresponding to the left with LTR.
20202 //
20203 // @param obj
20204 // @returns {boolean} False when no adornments.
20205 // True when adorned at the start.
20206
20207 function isAdornedStart(obj) {
20208 return obj.startAdornment;
20209 }
20210
20211 var styles$14 = function styles(theme) {
20212 var light = theme.palette.type === 'light';
20213 var placeholder = {
20214 color: 'currentColor',
20215 opacity: light ? 0.42 : 0.5,
20216 transition: theme.transitions.create('opacity', {
20217 duration: theme.transitions.duration.shorter
20218 })
20219 };
20220 var placeholderHidden = {
20221 opacity: '0 !important'
20222 };
20223 var placeholderVisible = {
20224 opacity: light ? 0.42 : 0.5
20225 };
20226 return {
20227 '@global': {
20228 '@keyframes mui-auto-fill': {},
20229 '@keyframes mui-auto-fill-cancel': {}
20230 },
20231
20232 /* Styles applied to the root element. */
20233 root: _extends$5({}, theme.typography.body1, {
20234 color: theme.palette.text.primary,
20235 lineHeight: '1.1876em',
20236 // Reset (19px), match the native input line-height
20237 boxSizing: 'border-box',
20238 // Prevent padding issue with fullWidth.
20239 position: 'relative',
20240 cursor: 'text',
20241 display: 'inline-flex',
20242 alignItems: 'center',
20243 '&$disabled': {
20244 color: theme.palette.text.disabled,
20245 cursor: 'default'
20246 }
20247 }),
20248
20249 /* Styles applied to the root element if the component is a descendant of `FormControl`. */
20250 formControl: {},
20251
20252 /* Styles applied to the root element if the component is focused. */
20253 focused: {},
20254
20255 /* Styles applied to the root element if `disabled={true}`. */
20256 disabled: {},
20257
20258 /* Styles applied to the root element if `startAdornment` is provided. */
20259 adornedStart: {},
20260
20261 /* Styles applied to the root element if `endAdornment` is provided. */
20262 adornedEnd: {},
20263
20264 /* Pseudo-class applied to the root element if `error={true}`. */
20265 error: {},
20266
20267 /* Styles applied to the `input` element if `margin="dense"`. */
20268 marginDense: {},
20269
20270 /* Styles applied to the root element if `multiline={true}`. */
20271 multiline: {
20272 padding: "".concat(8 - 2, "px 0 ").concat(8 - 1, "px"),
20273 '&$marginDense': {
20274 paddingTop: 4 - 1
20275 }
20276 },
20277
20278 /* Styles applied to the root element if the color is secondary. */
20279 colorSecondary: {},
20280
20281 /* Styles applied to the root element if `fullWidth={true}`. */
20282 fullWidth: {
20283 width: '100%'
20284 },
20285
20286 /* Styles applied to the `input` element. */
20287 input: {
20288 font: 'inherit',
20289 letterSpacing: 'inherit',
20290 color: 'currentColor',
20291 padding: "".concat(8 - 2, "px 0 ").concat(8 - 1, "px"),
20292 border: 0,
20293 boxSizing: 'content-box',
20294 background: 'none',
20295 height: '1.1876em',
20296 // Reset (19px), match the native input line-height
20297 margin: 0,
20298 // Reset for Safari
20299 WebkitTapHighlightColor: 'transparent',
20300 display: 'block',
20301 // Make the flex item shrink with Firefox
20302 minWidth: 0,
20303 width: '100%',
20304 // Fix IE 11 width issue
20305 animationName: 'mui-auto-fill-cancel',
20306 animationDuration: '10ms',
20307 '&::-webkit-input-placeholder': placeholder,
20308 '&::-moz-placeholder': placeholder,
20309 // Firefox 19+
20310 '&:-ms-input-placeholder': placeholder,
20311 // IE 11
20312 '&::-ms-input-placeholder': placeholder,
20313 // Edge
20314 '&:focus': {
20315 outline: 0
20316 },
20317 // Reset Firefox invalid required input style
20318 '&:invalid': {
20319 boxShadow: 'none'
20320 },
20321 '&::-webkit-search-decoration': {
20322 // Remove the padding when type=search.
20323 '-webkit-appearance': 'none'
20324 },
20325 // Show and hide the placeholder logic
20326 'label[data-shrink=false] + $formControl &': {
20327 '&::-webkit-input-placeholder': placeholderHidden,
20328 '&::-moz-placeholder': placeholderHidden,
20329 // Firefox 19+
20330 '&:-ms-input-placeholder': placeholderHidden,
20331 // IE 11
20332 '&::-ms-input-placeholder': placeholderHidden,
20333 // Edge
20334 '&:focus::-webkit-input-placeholder': placeholderVisible,
20335 '&:focus::-moz-placeholder': placeholderVisible,
20336 // Firefox 19+
20337 '&:focus:-ms-input-placeholder': placeholderVisible,
20338 // IE 11
20339 '&:focus::-ms-input-placeholder': placeholderVisible // Edge
20340
20341 },
20342 '&$disabled': {
20343 opacity: 1 // Reset iOS opacity
20344
20345 },
20346 '&:-webkit-autofill': {
20347 animationDuration: '5000s',
20348 animationName: 'mui-auto-fill'
20349 }
20350 },
20351
20352 /* Styles applied to the `input` element if `margin="dense"`. */
20353 inputMarginDense: {
20354 paddingTop: 4 - 1
20355 },
20356
20357 /* Styles applied to the `input` element if `multiline={true}`. */
20358 inputMultiline: {
20359 height: 'auto',
20360 resize: 'none',
20361 padding: 0
20362 },
20363
20364 /* Styles applied to the `input` element if `type="search"`. */
20365 inputTypeSearch: {
20366 // Improve type search style.
20367 '-moz-appearance': 'textfield',
20368 '-webkit-appearance': 'textfield'
20369 },
20370
20371 /* Styles applied to the `input` element if `startAdornment` is provided. */
20372 inputAdornedStart: {},
20373
20374 /* Styles applied to the `input` element if `endAdornment` is provided. */
20375 inputAdornedEnd: {},
20376
20377 /* Styles applied to the `input` element if `hiddenLabel={true}`. */
20378 inputHiddenLabel: {}
20379 };
20380 };
20381 var useEnhancedEffect$4 = typeof window === 'undefined' ? react.exports.useEffect : react.exports.useLayoutEffect;
20382 /**
20383 * `InputBase` contains as few styles as possible.
20384 * It aims to be a simple building block for creating an input.
20385 * It contains a load of style reset and some state logic.
20386 */
20387
20388 var InputBase = /*#__PURE__*/react.exports.forwardRef(function InputBase(props, ref) {
20389 var ariaDescribedby = props['aria-describedby'],
20390 autoComplete = props.autoComplete,
20391 autoFocus = props.autoFocus,
20392 classes = props.classes,
20393 className = props.className;
20394 props.color;
20395 var defaultValue = props.defaultValue,
20396 disabled = props.disabled,
20397 endAdornment = props.endAdornment;
20398 props.error;
20399 var _props$fullWidth = props.fullWidth,
20400 fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
20401 id = props.id,
20402 _props$inputComponent = props.inputComponent,
20403 inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,
20404 _props$inputProps = props.inputProps,
20405 inputPropsProp = _props$inputProps === void 0 ? {} : _props$inputProps,
20406 inputRefProp = props.inputRef;
20407 props.margin;
20408 var _props$multiline = props.multiline,
20409 multiline = _props$multiline === void 0 ? false : _props$multiline,
20410 name = props.name,
20411 onBlur = props.onBlur,
20412 onChange = props.onChange,
20413 onClick = props.onClick,
20414 onFocus = props.onFocus,
20415 onKeyDown = props.onKeyDown,
20416 onKeyUp = props.onKeyUp,
20417 placeholder = props.placeholder,
20418 readOnly = props.readOnly,
20419 renderSuffix = props.renderSuffix,
20420 rows = props.rows,
20421 rowsMax = props.rowsMax,
20422 rowsMin = props.rowsMin,
20423 maxRows = props.maxRows,
20424 minRows = props.minRows,
20425 startAdornment = props.startAdornment,
20426 _props$type = props.type,
20427 type = _props$type === void 0 ? 'text' : _props$type,
20428 valueProp = props.value,
20429 other = _objectWithoutProperties(props, ["aria-describedby", "autoComplete", "autoFocus", "classes", "className", "color", "defaultValue", "disabled", "endAdornment", "error", "fullWidth", "id", "inputComponent", "inputProps", "inputRef", "margin", "multiline", "name", "onBlur", "onChange", "onClick", "onFocus", "onKeyDown", "onKeyUp", "placeholder", "readOnly", "renderSuffix", "rows", "rowsMax", "rowsMin", "maxRows", "minRows", "startAdornment", "type", "value"]);
20430
20431 var value = inputPropsProp.value != null ? inputPropsProp.value : valueProp;
20432
20433 var _React$useRef = react.exports.useRef(value != null),
20434 isControlled = _React$useRef.current;
20435
20436 var inputRef = react.exports.useRef();
20437 var handleInputRefWarning = react.exports.useCallback(function (instance) {
20438 }, []);
20439 var handleInputPropsRefProp = useForkRef(inputPropsProp.ref, handleInputRefWarning);
20440 var handleInputRefProp = useForkRef(inputRefProp, handleInputPropsRefProp);
20441 var handleInputRef = useForkRef(inputRef, handleInputRefProp);
20442
20443 var _React$useState = react.exports.useState(false),
20444 focused = _React$useState[0],
20445 setFocused = _React$useState[1];
20446
20447 var muiFormControl = useFormControl$1();
20448
20449 var fcs = formControlState({
20450 props: props,
20451 muiFormControl: muiFormControl,
20452 states: ['color', 'disabled', 'error', 'hiddenLabel', 'margin', 'required', 'filled']
20453 });
20454 fcs.focused = muiFormControl ? muiFormControl.focused : focused; // The blur won't fire when the disabled state is set on a focused input.
20455 // We need to book keep the focused state manually.
20456
20457 react.exports.useEffect(function () {
20458 if (!muiFormControl && disabled && focused) {
20459 setFocused(false);
20460
20461 if (onBlur) {
20462 onBlur();
20463 }
20464 }
20465 }, [muiFormControl, disabled, focused, onBlur]);
20466 var onFilled = muiFormControl && muiFormControl.onFilled;
20467 var onEmpty = muiFormControl && muiFormControl.onEmpty;
20468 var checkDirty = react.exports.useCallback(function (obj) {
20469 if (isFilled(obj)) {
20470 if (onFilled) {
20471 onFilled();
20472 }
20473 } else if (onEmpty) {
20474 onEmpty();
20475 }
20476 }, [onFilled, onEmpty]);
20477 useEnhancedEffect$4(function () {
20478 if (isControlled) {
20479 checkDirty({
20480 value: value
20481 });
20482 }
20483 }, [value, checkDirty, isControlled]);
20484
20485 var handleFocus = function handleFocus(event) {
20486 // Fix a bug with IE 11 where the focus/blur events are triggered
20487 // while the input is disabled.
20488 if (fcs.disabled) {
20489 event.stopPropagation();
20490 return;
20491 }
20492
20493 if (onFocus) {
20494 onFocus(event);
20495 }
20496
20497 if (inputPropsProp.onFocus) {
20498 inputPropsProp.onFocus(event);
20499 }
20500
20501 if (muiFormControl && muiFormControl.onFocus) {
20502 muiFormControl.onFocus(event);
20503 } else {
20504 setFocused(true);
20505 }
20506 };
20507
20508 var handleBlur = function handleBlur(event) {
20509 if (onBlur) {
20510 onBlur(event);
20511 }
20512
20513 if (inputPropsProp.onBlur) {
20514 inputPropsProp.onBlur(event);
20515 }
20516
20517 if (muiFormControl && muiFormControl.onBlur) {
20518 muiFormControl.onBlur(event);
20519 } else {
20520 setFocused(false);
20521 }
20522 };
20523
20524 var handleChange = function handleChange(event) {
20525 if (!isControlled) {
20526 var element = event.target || inputRef.current;
20527
20528 if (element == null) {
20529 throw new Error(formatMuiErrorMessage(1));
20530 }
20531
20532 checkDirty({
20533 value: element.value
20534 });
20535 }
20536
20537 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
20538 args[_key - 1] = arguments[_key];
20539 }
20540
20541 if (inputPropsProp.onChange) {
20542 inputPropsProp.onChange.apply(inputPropsProp, [event].concat(args));
20543 } // Perform in the willUpdate
20544
20545
20546 if (onChange) {
20547 onChange.apply(void 0, [event].concat(args));
20548 }
20549 }; // Check the input state on mount, in case it was filled by the user
20550 // or auto filled by the browser before the hydration (for SSR).
20551
20552
20553 react.exports.useEffect(function () {
20554 checkDirty(inputRef.current);
20555 }, []); // eslint-disable-line react-hooks/exhaustive-deps
20556
20557 var handleClick = function handleClick(event) {
20558 if (inputRef.current && event.currentTarget === event.target) {
20559 inputRef.current.focus();
20560 }
20561
20562 if (onClick) {
20563 onClick(event);
20564 }
20565 };
20566
20567 var InputComponent = inputComponent;
20568
20569 var inputProps = _extends$5({}, inputPropsProp, {
20570 ref: handleInputRef
20571 });
20572
20573 if (typeof InputComponent !== 'string') {
20574 inputProps = _extends$5({
20575 // Rename ref to inputRef as we don't know the
20576 // provided `inputComponent` structure.
20577 inputRef: handleInputRef,
20578 type: type
20579 }, inputProps, {
20580 ref: null
20581 });
20582 } else if (multiline) {
20583 if (rows && !maxRows && !minRows && !rowsMax && !rowsMin) {
20584 InputComponent = 'textarea';
20585 } else {
20586 inputProps = _extends$5({
20587 minRows: rows || minRows,
20588 rowsMax: rowsMax,
20589 maxRows: maxRows
20590 }, inputProps);
20591 InputComponent = TextareaAutosize;
20592 }
20593 } else {
20594 inputProps = _extends$5({
20595 type: type
20596 }, inputProps);
20597 }
20598
20599 var handleAutoFill = function handleAutoFill(event) {
20600 // Provide a fake value as Chrome might not let you access it for security reasons.
20601 checkDirty(event.animationName === 'mui-auto-fill-cancel' ? inputRef.current : {
20602 value: 'x'
20603 });
20604 };
20605
20606 react.exports.useEffect(function () {
20607 if (muiFormControl) {
20608 muiFormControl.setAdornedStart(Boolean(startAdornment));
20609 }
20610 }, [muiFormControl, startAdornment]);
20611 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
20612 className: clsx(classes.root, classes["color".concat(capitalize(fcs.color || 'primary'))], className, fcs.disabled && classes.disabled, fcs.error && classes.error, fullWidth && classes.fullWidth, fcs.focused && classes.focused, muiFormControl && classes.formControl, multiline && classes.multiline, startAdornment && classes.adornedStart, endAdornment && classes.adornedEnd, fcs.margin === 'dense' && classes.marginDense),
20613 onClick: handleClick,
20614 ref: ref
20615 }, other), startAdornment, /*#__PURE__*/react.exports.createElement(FormControlContext.Provider, {
20616 value: null
20617 }, /*#__PURE__*/react.exports.createElement(InputComponent, _extends$5({
20618 "aria-invalid": fcs.error,
20619 "aria-describedby": ariaDescribedby,
20620 autoComplete: autoComplete,
20621 autoFocus: autoFocus,
20622 defaultValue: defaultValue,
20623 disabled: fcs.disabled,
20624 id: id,
20625 onAnimationStart: handleAutoFill,
20626 name: name,
20627 placeholder: placeholder,
20628 readOnly: readOnly,
20629 required: fcs.required,
20630 rows: rows,
20631 value: value,
20632 onKeyDown: onKeyDown,
20633 onKeyUp: onKeyUp
20634 }, inputProps, {
20635 className: clsx(classes.input, inputPropsProp.className, fcs.disabled && classes.disabled, multiline && classes.inputMultiline, fcs.hiddenLabel && classes.inputHiddenLabel, startAdornment && classes.inputAdornedStart, endAdornment && classes.inputAdornedEnd, type === 'search' && classes.inputTypeSearch, fcs.margin === 'dense' && classes.inputMarginDense),
20636 onBlur: handleBlur,
20637 onChange: handleChange,
20638 onFocus: handleFocus
20639 }))), endAdornment, renderSuffix ? renderSuffix(_extends$5({}, fcs, {
20640 startAdornment: startAdornment
20641 })) : null);
20642 });
20643 var InputBase$1 = withStyles(styles$14, {
20644 name: 'MuiInputBase'
20645 })(InputBase);
20646
20647 var styles$13 = function styles(theme) {
20648 var light = theme.palette.type === 'light';
20649 var bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
20650 var backgroundColor = light ? 'rgba(0, 0, 0, 0.09)' : 'rgba(255, 255, 255, 0.09)';
20651 return {
20652 /* Styles applied to the root element. */
20653 root: {
20654 position: 'relative',
20655 backgroundColor: backgroundColor,
20656 borderTopLeftRadius: theme.shape.borderRadius,
20657 borderTopRightRadius: theme.shape.borderRadius,
20658 transition: theme.transitions.create('background-color', {
20659 duration: theme.transitions.duration.shorter,
20660 easing: theme.transitions.easing.easeOut
20661 }),
20662 '&:hover': {
20663 backgroundColor: light ? 'rgba(0, 0, 0, 0.13)' : 'rgba(255, 255, 255, 0.13)',
20664 // Reset on touch devices, it doesn't add specificity
20665 '@media (hover: none)': {
20666 backgroundColor: backgroundColor
20667 }
20668 },
20669 '&$focused': {
20670 backgroundColor: light ? 'rgba(0, 0, 0, 0.09)' : 'rgba(255, 255, 255, 0.09)'
20671 },
20672 '&$disabled': {
20673 backgroundColor: light ? 'rgba(0, 0, 0, 0.12)' : 'rgba(255, 255, 255, 0.12)'
20674 }
20675 },
20676
20677 /* Styles applied to the root element if color secondary. */
20678 colorSecondary: {
20679 '&$underline:after': {
20680 borderBottomColor: theme.palette.secondary.main
20681 }
20682 },
20683
20684 /* Styles applied to the root element if `disableUnderline={false}`. */
20685 underline: {
20686 '&:after': {
20687 borderBottom: "2px solid ".concat(theme.palette.primary.main),
20688 left: 0,
20689 bottom: 0,
20690 // Doing the other way around crash on IE 11 "''" https://github.com/cssinjs/jss/issues/242
20691 content: '""',
20692 position: 'absolute',
20693 right: 0,
20694 transform: 'scaleX(0)',
20695 transition: theme.transitions.create('transform', {
20696 duration: theme.transitions.duration.shorter,
20697 easing: theme.transitions.easing.easeOut
20698 }),
20699 pointerEvents: 'none' // Transparent to the hover style.
20700
20701 },
20702 '&$focused:after': {
20703 transform: 'scaleX(1)'
20704 },
20705 '&$error:after': {
20706 borderBottomColor: theme.palette.error.main,
20707 transform: 'scaleX(1)' // error is always underlined in red
20708
20709 },
20710 '&:before': {
20711 borderBottom: "1px solid ".concat(bottomLineColor),
20712 left: 0,
20713 bottom: 0,
20714 // Doing the other way around crash on IE 11 "''" https://github.com/cssinjs/jss/issues/242
20715 content: '"\\00a0"',
20716 position: 'absolute',
20717 right: 0,
20718 transition: theme.transitions.create('border-bottom-color', {
20719 duration: theme.transitions.duration.shorter
20720 }),
20721 pointerEvents: 'none' // Transparent to the hover style.
20722
20723 },
20724 '&:hover:before': {
20725 borderBottom: "1px solid ".concat(theme.palette.text.primary)
20726 },
20727 '&$disabled:before': {
20728 borderBottomStyle: 'dotted'
20729 }
20730 },
20731
20732 /* Pseudo-class applied to the root element if the component is focused. */
20733 focused: {},
20734
20735 /* Pseudo-class applied to the root element if `disabled={true}`. */
20736 disabled: {},
20737
20738 /* Styles applied to the root element if `startAdornment` is provided. */
20739 adornedStart: {
20740 paddingLeft: 12
20741 },
20742
20743 /* Styles applied to the root element if `endAdornment` is provided. */
20744 adornedEnd: {
20745 paddingRight: 12
20746 },
20747
20748 /* Pseudo-class applied to the root element if `error={true}`. */
20749 error: {},
20750
20751 /* Styles applied to the `input` element if `margin="dense"`. */
20752 marginDense: {},
20753
20754 /* Styles applied to the root element if `multiline={true}`. */
20755 multiline: {
20756 padding: '27px 12px 10px',
20757 '&$marginDense': {
20758 paddingTop: 23,
20759 paddingBottom: 6
20760 }
20761 },
20762
20763 /* Styles applied to the `input` element. */
20764 input: {
20765 padding: '27px 12px 10px',
20766 '&:-webkit-autofill': {
20767 WebkitBoxShadow: theme.palette.type === 'light' ? null : '0 0 0 100px #266798 inset',
20768 WebkitTextFillColor: theme.palette.type === 'light' ? null : '#fff',
20769 caretColor: theme.palette.type === 'light' ? null : '#fff',
20770 borderTopLeftRadius: 'inherit',
20771 borderTopRightRadius: 'inherit'
20772 }
20773 },
20774
20775 /* Styles applied to the `input` element if `margin="dense"`. */
20776 inputMarginDense: {
20777 paddingTop: 23,
20778 paddingBottom: 6
20779 },
20780
20781 /* Styles applied to the `input` if in `<FormControl hiddenLabel />`. */
20782 inputHiddenLabel: {
20783 paddingTop: 18,
20784 paddingBottom: 19,
20785 '&$inputMarginDense': {
20786 paddingTop: 10,
20787 paddingBottom: 11
20788 }
20789 },
20790
20791 /* Styles applied to the `input` element if `multiline={true}`. */
20792 inputMultiline: {
20793 padding: 0
20794 },
20795
20796 /* Styles applied to the `input` element if `startAdornment` is provided. */
20797 inputAdornedStart: {
20798 paddingLeft: 0
20799 },
20800
20801 /* Styles applied to the `input` element if `endAdornment` is provided. */
20802 inputAdornedEnd: {
20803 paddingRight: 0
20804 }
20805 };
20806 };
20807 var FilledInput = /*#__PURE__*/react.exports.forwardRef(function FilledInput(props, ref) {
20808 var disableUnderline = props.disableUnderline,
20809 classes = props.classes,
20810 _props$fullWidth = props.fullWidth,
20811 fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
20812 _props$inputComponent = props.inputComponent,
20813 inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,
20814 _props$multiline = props.multiline,
20815 multiline = _props$multiline === void 0 ? false : _props$multiline,
20816 _props$type = props.type,
20817 type = _props$type === void 0 ? 'text' : _props$type,
20818 other = _objectWithoutProperties(props, ["disableUnderline", "classes", "fullWidth", "inputComponent", "multiline", "type"]);
20819
20820 return /*#__PURE__*/react.exports.createElement(InputBase$1, _extends$5({
20821 classes: _extends$5({}, classes, {
20822 root: clsx(classes.root, !disableUnderline && classes.underline),
20823 underline: null
20824 }),
20825 fullWidth: fullWidth,
20826 inputComponent: inputComponent,
20827 multiline: multiline,
20828 ref: ref,
20829 type: type
20830 }, other));
20831 });
20832 FilledInput.muiName = 'Input';
20833 var FilledInput$1 = withStyles(styles$13, {
20834 name: 'MuiFilledInput'
20835 })(FilledInput);
20836
20837 var styles$12 = {
20838 /* Styles applied to the root element. */
20839 root: {
20840 display: 'inline-flex',
20841 flexDirection: 'column',
20842 position: 'relative',
20843 // Reset fieldset default style.
20844 minWidth: 0,
20845 padding: 0,
20846 margin: 0,
20847 border: 0,
20848 verticalAlign: 'top' // Fix alignment issue on Safari.
20849
20850 },
20851
20852 /* Styles applied to the root element if `margin="normal"`. */
20853 marginNormal: {
20854 marginTop: 16,
20855 marginBottom: 8
20856 },
20857
20858 /* Styles applied to the root element if `margin="dense"`. */
20859 marginDense: {
20860 marginTop: 8,
20861 marginBottom: 4
20862 },
20863
20864 /* Styles applied to the root element if `fullWidth={true}`. */
20865 fullWidth: {
20866 width: '100%'
20867 }
20868 };
20869 /**
20870 * Provides context such as filled/focused/error/required for form inputs.
20871 * Relying on the context provides high flexibility and ensures that the state always stays
20872 * consistent across the children of the `FormControl`.
20873 * This context is used by the following components:
20874 *
20875 * - FormLabel
20876 * - FormHelperText
20877 * - Input
20878 * - InputLabel
20879 *
20880 * You can find one composition example below and more going to [the demos](/components/text-fields/#components).
20881 *
20882 * ```jsx
20883 * <FormControl>
20884 * <InputLabel htmlFor="my-input">Email address</InputLabel>
20885 * <Input id="my-input" aria-describedby="my-helper-text" />
20886 * <FormHelperText id="my-helper-text">We'll never share your email.</FormHelperText>
20887 * </FormControl>
20888 * ```
20889 *
20890 * ⚠️Only one input can be used within a FormControl.
20891 */
20892
20893 var FormControl = /*#__PURE__*/react.exports.forwardRef(function FormControl(props, ref) {
20894 var children = props.children,
20895 classes = props.classes,
20896 className = props.className,
20897 _props$color = props.color,
20898 color = _props$color === void 0 ? 'primary' : _props$color,
20899 _props$component = props.component,
20900 Component = _props$component === void 0 ? 'div' : _props$component,
20901 _props$disabled = props.disabled,
20902 disabled = _props$disabled === void 0 ? false : _props$disabled,
20903 _props$error = props.error,
20904 error = _props$error === void 0 ? false : _props$error,
20905 _props$fullWidth = props.fullWidth,
20906 fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
20907 visuallyFocused = props.focused,
20908 _props$hiddenLabel = props.hiddenLabel,
20909 hiddenLabel = _props$hiddenLabel === void 0 ? false : _props$hiddenLabel,
20910 _props$margin = props.margin,
20911 margin = _props$margin === void 0 ? 'none' : _props$margin,
20912 _props$required = props.required,
20913 required = _props$required === void 0 ? false : _props$required,
20914 size = props.size,
20915 _props$variant = props.variant,
20916 variant = _props$variant === void 0 ? 'standard' : _props$variant,
20917 other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "component", "disabled", "error", "fullWidth", "focused", "hiddenLabel", "margin", "required", "size", "variant"]);
20918
20919 var _React$useState = react.exports.useState(function () {
20920 // We need to iterate through the children and find the Input in order
20921 // to fully support server-side rendering.
20922 var initialAdornedStart = false;
20923
20924 if (children) {
20925 react.exports.Children.forEach(children, function (child) {
20926 if (!isMuiElement(child, ['Input', 'Select'])) {
20927 return;
20928 }
20929
20930 var input = isMuiElement(child, ['Select']) ? child.props.input : child;
20931
20932 if (input && isAdornedStart(input.props)) {
20933 initialAdornedStart = true;
20934 }
20935 });
20936 }
20937
20938 return initialAdornedStart;
20939 }),
20940 adornedStart = _React$useState[0],
20941 setAdornedStart = _React$useState[1];
20942
20943 var _React$useState2 = react.exports.useState(function () {
20944 // We need to iterate through the children and find the Input in order
20945 // to fully support server-side rendering.
20946 var initialFilled = false;
20947
20948 if (children) {
20949 react.exports.Children.forEach(children, function (child) {
20950 if (!isMuiElement(child, ['Input', 'Select'])) {
20951 return;
20952 }
20953
20954 if (isFilled(child.props, true)) {
20955 initialFilled = true;
20956 }
20957 });
20958 }
20959
20960 return initialFilled;
20961 }),
20962 filled = _React$useState2[0],
20963 setFilled = _React$useState2[1];
20964
20965 var _React$useState3 = react.exports.useState(false),
20966 _focused = _React$useState3[0],
20967 setFocused = _React$useState3[1];
20968
20969 var focused = visuallyFocused !== undefined ? visuallyFocused : _focused;
20970
20971 if (disabled && focused) {
20972 setFocused(false);
20973 }
20974
20975 var registerEffect;
20976
20977 var onFilled = react.exports.useCallback(function () {
20978 setFilled(true);
20979 }, []);
20980 var onEmpty = react.exports.useCallback(function () {
20981 setFilled(false);
20982 }, []);
20983 var childContext = {
20984 adornedStart: adornedStart,
20985 setAdornedStart: setAdornedStart,
20986 color: color,
20987 disabled: disabled,
20988 error: error,
20989 filled: filled,
20990 focused: focused,
20991 fullWidth: fullWidth,
20992 hiddenLabel: hiddenLabel,
20993 margin: (size === 'small' ? 'dense' : undefined) || margin,
20994 onBlur: function onBlur() {
20995 setFocused(false);
20996 },
20997 onEmpty: onEmpty,
20998 onFilled: onFilled,
20999 onFocus: function onFocus() {
21000 setFocused(true);
21001 },
21002 registerEffect: registerEffect,
21003 required: required,
21004 variant: variant
21005 };
21006 return /*#__PURE__*/react.exports.createElement(FormControlContext.Provider, {
21007 value: childContext
21008 }, /*#__PURE__*/react.exports.createElement(Component, _extends$5({
21009 className: clsx(classes.root, className, margin !== 'none' && classes["margin".concat(capitalize(margin))], fullWidth && classes.fullWidth),
21010 ref: ref
21011 }, other), children));
21012 });
21013 var FormControl$1 = withStyles(styles$12, {
21014 name: 'MuiFormControl'
21015 })(FormControl);
21016
21017 var styles$11 = function styles(theme) {
21018 return {
21019 /* Styles applied to the root element. */
21020 root: {
21021 display: 'inline-flex',
21022 alignItems: 'center',
21023 cursor: 'pointer',
21024 // For correct alignment with the text.
21025 verticalAlign: 'middle',
21026 WebkitTapHighlightColor: 'transparent',
21027 marginLeft: -11,
21028 marginRight: 16,
21029 // used for row presentation of radio/checkbox
21030 '&$disabled': {
21031 cursor: 'default'
21032 }
21033 },
21034
21035 /* Styles applied to the root element if `labelPlacement="start"`. */
21036 labelPlacementStart: {
21037 flexDirection: 'row-reverse',
21038 marginLeft: 16,
21039 // used for row presentation of radio/checkbox
21040 marginRight: -11
21041 },
21042
21043 /* Styles applied to the root element if `labelPlacement="top"`. */
21044 labelPlacementTop: {
21045 flexDirection: 'column-reverse',
21046 marginLeft: 16
21047 },
21048
21049 /* Styles applied to the root element if `labelPlacement="bottom"`. */
21050 labelPlacementBottom: {
21051 flexDirection: 'column',
21052 marginLeft: 16
21053 },
21054
21055 /* Pseudo-class applied to the root element if `disabled={true}`. */
21056 disabled: {},
21057
21058 /* Styles applied to the label's Typography component. */
21059 label: {
21060 '&$disabled': {
21061 color: theme.palette.text.disabled
21062 }
21063 }
21064 };
21065 };
21066 /**
21067 * Drop in replacement of the `Radio`, `Switch` and `Checkbox` component.
21068 * Use this component if you want to display an extra label.
21069 */
21070
21071 var FormControlLabel = /*#__PURE__*/react.exports.forwardRef(function FormControlLabel(props, ref) {
21072 props.checked;
21073 var classes = props.classes,
21074 className = props.className,
21075 control = props.control,
21076 disabledProp = props.disabled;
21077 props.inputRef;
21078 var label = props.label,
21079 _props$labelPlacement = props.labelPlacement,
21080 labelPlacement = _props$labelPlacement === void 0 ? 'end' : _props$labelPlacement;
21081 props.name;
21082 props.onChange;
21083 props.value;
21084 var other = _objectWithoutProperties(props, ["checked", "classes", "className", "control", "disabled", "inputRef", "label", "labelPlacement", "name", "onChange", "value"]);
21085
21086 var muiFormControl = useFormControl();
21087 var disabled = disabledProp;
21088
21089 if (typeof disabled === 'undefined' && typeof control.props.disabled !== 'undefined') {
21090 disabled = control.props.disabled;
21091 }
21092
21093 if (typeof disabled === 'undefined' && muiFormControl) {
21094 disabled = muiFormControl.disabled;
21095 }
21096
21097 var controlProps = {
21098 disabled: disabled
21099 };
21100 ['checked', 'name', 'onChange', 'value', 'inputRef'].forEach(function (key) {
21101 if (typeof control.props[key] === 'undefined' && typeof props[key] !== 'undefined') {
21102 controlProps[key] = props[key];
21103 }
21104 });
21105 return /*#__PURE__*/react.exports.createElement("label", _extends$5({
21106 className: clsx(classes.root, className, labelPlacement !== 'end' && classes["labelPlacement".concat(capitalize(labelPlacement))], disabled && classes.disabled),
21107 ref: ref
21108 }, other), /*#__PURE__*/react.exports.cloneElement(control, controlProps), /*#__PURE__*/react.exports.createElement(Typography$1, {
21109 component: "span",
21110 className: clsx(classes.label, disabled && classes.disabled)
21111 }, label));
21112 });
21113 var FormControlLabel$1 = withStyles(styles$11, {
21114 name: 'MuiFormControlLabel'
21115 })(FormControlLabel);
21116
21117 var styles$10 = {
21118 /* Styles applied to the root element. */
21119 root: {
21120 display: 'flex',
21121 flexDirection: 'column',
21122 flexWrap: 'wrap'
21123 },
21124
21125 /* Styles applied to the root element if `row={true}`. */
21126 row: {
21127 flexDirection: 'row'
21128 }
21129 };
21130 /**
21131 * `FormGroup` wraps controls such as `Checkbox` and `Switch`.
21132 * It provides compact row layout.
21133 * For the `Radio`, you should be using the `RadioGroup` component instead of this one.
21134 */
21135
21136 var FormGroup = /*#__PURE__*/react.exports.forwardRef(function FormGroup(props, ref) {
21137 var classes = props.classes,
21138 className = props.className,
21139 _props$row = props.row,
21140 row = _props$row === void 0 ? false : _props$row,
21141 other = _objectWithoutProperties(props, ["classes", "className", "row"]);
21142
21143 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
21144 className: clsx(classes.root, className, row && classes.row),
21145 ref: ref
21146 }, other));
21147 });
21148 withStyles(styles$10, {
21149 name: 'MuiFormGroup'
21150 })(FormGroup);
21151
21152 var styles$$ = function styles(theme) {
21153 return {
21154 /* Styles applied to the root element. */
21155 root: _extends$5({
21156 color: theme.palette.text.secondary
21157 }, theme.typography.caption, {
21158 textAlign: 'left',
21159 marginTop: 3,
21160 margin: 0,
21161 '&$disabled': {
21162 color: theme.palette.text.disabled
21163 },
21164 '&$error': {
21165 color: theme.palette.error.main
21166 }
21167 }),
21168
21169 /* Pseudo-class applied to the root element if `error={true}`. */
21170 error: {},
21171
21172 /* Pseudo-class applied to the root element if `disabled={true}`. */
21173 disabled: {},
21174
21175 /* Styles applied to the root element if `margin="dense"`. */
21176 marginDense: {
21177 marginTop: 4
21178 },
21179
21180 /* Styles applied to the root element if `variant="filled"` or `variant="outlined"`. */
21181 contained: {
21182 marginLeft: 14,
21183 marginRight: 14
21184 },
21185
21186 /* Pseudo-class applied to the root element if `focused={true}`. */
21187 focused: {},
21188
21189 /* Pseudo-class applied to the root element if `filled={true}`. */
21190 filled: {},
21191
21192 /* Pseudo-class applied to the root element if `required={true}`. */
21193 required: {}
21194 };
21195 };
21196 var FormHelperText = /*#__PURE__*/react.exports.forwardRef(function FormHelperText(props, ref) {
21197 var children = props.children,
21198 classes = props.classes,
21199 className = props.className,
21200 _props$component = props.component,
21201 Component = _props$component === void 0 ? 'p' : _props$component;
21202 props.disabled;
21203 props.error;
21204 props.filled;
21205 props.focused;
21206 props.margin;
21207 props.required;
21208 props.variant;
21209 var other = _objectWithoutProperties(props, ["children", "classes", "className", "component", "disabled", "error", "filled", "focused", "margin", "required", "variant"]);
21210
21211 var muiFormControl = useFormControl();
21212 var fcs = formControlState({
21213 props: props,
21214 muiFormControl: muiFormControl,
21215 states: ['variant', 'margin', 'disabled', 'error', 'filled', 'focused', 'required']
21216 });
21217 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
21218 className: clsx(classes.root, (fcs.variant === 'filled' || fcs.variant === 'outlined') && classes.contained, className, fcs.disabled && classes.disabled, fcs.error && classes.error, fcs.filled && classes.filled, fcs.focused && classes.focused, fcs.required && classes.required, fcs.margin === 'dense' && classes.marginDense),
21219 ref: ref
21220 }, other), children === ' ' ?
21221 /*#__PURE__*/
21222 // eslint-disable-next-line react/no-danger
21223 react.exports.createElement("span", {
21224 dangerouslySetInnerHTML: {
21225 __html: '&#8203;'
21226 }
21227 }) : children);
21228 });
21229 var FormHelperText$1 = withStyles(styles$$, {
21230 name: 'MuiFormHelperText'
21231 })(FormHelperText);
21232
21233 var styles$_ = function styles(theme) {
21234 return {
21235 /* Styles applied to the root element. */
21236 root: _extends$5({
21237 color: theme.palette.text.secondary
21238 }, theme.typography.body1, {
21239 lineHeight: 1,
21240 padding: 0,
21241 '&$focused': {
21242 color: theme.palette.primary.main
21243 },
21244 '&$disabled': {
21245 color: theme.palette.text.disabled
21246 },
21247 '&$error': {
21248 color: theme.palette.error.main
21249 }
21250 }),
21251
21252 /* Styles applied to the root element if the color is secondary. */
21253 colorSecondary: {
21254 '&$focused': {
21255 color: theme.palette.secondary.main
21256 }
21257 },
21258
21259 /* Pseudo-class applied to the root element if `focused={true}`. */
21260 focused: {},
21261
21262 /* Pseudo-class applied to the root element if `disabled={true}`. */
21263 disabled: {},
21264
21265 /* Pseudo-class applied to the root element if `error={true}`. */
21266 error: {},
21267
21268 /* Pseudo-class applied to the root element if `filled={true}`. */
21269 filled: {},
21270
21271 /* Pseudo-class applied to the root element if `required={true}`. */
21272 required: {},
21273
21274 /* Styles applied to the asterisk element. */
21275 asterisk: {
21276 '&$error': {
21277 color: theme.palette.error.main
21278 }
21279 }
21280 };
21281 };
21282 var FormLabel = /*#__PURE__*/react.exports.forwardRef(function FormLabel(props, ref) {
21283 var children = props.children,
21284 classes = props.classes,
21285 className = props.className;
21286 props.color;
21287 var _props$component = props.component,
21288 Component = _props$component === void 0 ? 'label' : _props$component;
21289 props.disabled;
21290 props.error;
21291 props.filled;
21292 props.focused;
21293 props.required;
21294 var other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "component", "disabled", "error", "filled", "focused", "required"]);
21295
21296 var muiFormControl = useFormControl();
21297 var fcs = formControlState({
21298 props: props,
21299 muiFormControl: muiFormControl,
21300 states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
21301 });
21302 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
21303 className: clsx(classes.root, classes["color".concat(capitalize(fcs.color || 'primary'))], className, fcs.disabled && classes.disabled, fcs.error && classes.error, fcs.filled && classes.filled, fcs.focused && classes.focused, fcs.required && classes.required),
21304 ref: ref
21305 }, other), children, fcs.required && /*#__PURE__*/react.exports.createElement("span", {
21306 "aria-hidden": true,
21307 className: clsx(classes.asterisk, fcs.error && classes.error)
21308 }, "\u2009", '*'));
21309 });
21310 var FormLabel$1 = withStyles(styles$_, {
21311 name: 'MuiFormLabel'
21312 })(FormLabel);
21313
21314 var SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
21315 var GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
21316
21317 function generateGrid(globalStyles, theme, breakpoint) {
21318 var styles = {};
21319 GRID_SIZES.forEach(function (size) {
21320 var key = "grid-".concat(breakpoint, "-").concat(size);
21321
21322 if (size === true) {
21323 // For the auto layouting
21324 styles[key] = {
21325 flexBasis: 0,
21326 flexGrow: 1,
21327 maxWidth: '100%'
21328 };
21329 return;
21330 }
21331
21332 if (size === 'auto') {
21333 styles[key] = {
21334 flexBasis: 'auto',
21335 flexGrow: 0,
21336 maxWidth: 'none'
21337 };
21338 return;
21339 } // Keep 7 significant numbers.
21340
21341
21342 var width = "".concat(Math.round(size / 12 * 10e7) / 10e5, "%"); // Close to the bootstrap implementation:
21343 // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41
21344
21345 styles[key] = {
21346 flexBasis: width,
21347 flexGrow: 0,
21348 maxWidth: width
21349 };
21350 }); // No need for a media query for the first size.
21351
21352 if (breakpoint === 'xs') {
21353 _extends$5(globalStyles, styles);
21354 } else {
21355 globalStyles[theme.breakpoints.up(breakpoint)] = styles;
21356 }
21357 }
21358
21359 function getOffset(val) {
21360 var div = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
21361 var parse = parseFloat(val);
21362 return "".concat(parse / div).concat(String(val).replace(String(parse), '') || 'px');
21363 }
21364
21365 function generateGutter(theme, breakpoint) {
21366 var styles = {};
21367 SPACINGS.forEach(function (spacing) {
21368 var themeSpacing = theme.spacing(spacing);
21369
21370 if (themeSpacing === 0) {
21371 return;
21372 }
21373
21374 styles["spacing-".concat(breakpoint, "-").concat(spacing)] = {
21375 margin: "-".concat(getOffset(themeSpacing, 2)),
21376 width: "calc(100% + ".concat(getOffset(themeSpacing), ")"),
21377 '& > $item': {
21378 padding: getOffset(themeSpacing, 2)
21379 }
21380 };
21381 });
21382 return styles;
21383 } // Default CSS values
21384 // flex: '0 1 auto',
21385 // flexDirection: 'row',
21386 // alignItems: 'flex-start',
21387 // flexWrap: 'nowrap',
21388 // justifyContent: 'flex-start',
21389
21390
21391 var styles$Z = function styles(theme) {
21392 return _extends$5({
21393 /* Styles applied to the root element. */
21394 root: {},
21395
21396 /* Styles applied to the root element if `container={true}`. */
21397 container: {
21398 boxSizing: 'border-box',
21399 display: 'flex',
21400 flexWrap: 'wrap',
21401 width: '100%'
21402 },
21403
21404 /* Styles applied to the root element if `item={true}`. */
21405 item: {
21406 boxSizing: 'border-box',
21407 margin: '0' // For instance, it's useful when used with a `figure` element.
21408
21409 },
21410
21411 /* Styles applied to the root element if `zeroMinWidth={true}`. */
21412 zeroMinWidth: {
21413 minWidth: 0
21414 },
21415
21416 /* Styles applied to the root element if `direction="column"`. */
21417 'direction-xs-column': {
21418 flexDirection: 'column'
21419 },
21420
21421 /* Styles applied to the root element if `direction="column-reverse"`. */
21422 'direction-xs-column-reverse': {
21423 flexDirection: 'column-reverse'
21424 },
21425
21426 /* Styles applied to the root element if `direction="row-reverse"`. */
21427 'direction-xs-row-reverse': {
21428 flexDirection: 'row-reverse'
21429 },
21430
21431 /* Styles applied to the root element if `wrap="nowrap"`. */
21432 'wrap-xs-nowrap': {
21433 flexWrap: 'nowrap'
21434 },
21435
21436 /* Styles applied to the root element if `wrap="reverse"`. */
21437 'wrap-xs-wrap-reverse': {
21438 flexWrap: 'wrap-reverse'
21439 },
21440
21441 /* Styles applied to the root element if `alignItems="center"`. */
21442 'align-items-xs-center': {
21443 alignItems: 'center'
21444 },
21445
21446 /* Styles applied to the root element if `alignItems="flex-start"`. */
21447 'align-items-xs-flex-start': {
21448 alignItems: 'flex-start'
21449 },
21450
21451 /* Styles applied to the root element if `alignItems="flex-end"`. */
21452 'align-items-xs-flex-end': {
21453 alignItems: 'flex-end'
21454 },
21455
21456 /* Styles applied to the root element if `alignItems="baseline"`. */
21457 'align-items-xs-baseline': {
21458 alignItems: 'baseline'
21459 },
21460
21461 /* Styles applied to the root element if `alignContent="center"`. */
21462 'align-content-xs-center': {
21463 alignContent: 'center'
21464 },
21465
21466 /* Styles applied to the root element if `alignContent="flex-start"`. */
21467 'align-content-xs-flex-start': {
21468 alignContent: 'flex-start'
21469 },
21470
21471 /* Styles applied to the root element if `alignContent="flex-end"`. */
21472 'align-content-xs-flex-end': {
21473 alignContent: 'flex-end'
21474 },
21475
21476 /* Styles applied to the root element if `alignContent="space-between"`. */
21477 'align-content-xs-space-between': {
21478 alignContent: 'space-between'
21479 },
21480
21481 /* Styles applied to the root element if `alignContent="space-around"`. */
21482 'align-content-xs-space-around': {
21483 alignContent: 'space-around'
21484 },
21485
21486 /* Styles applied to the root element if `justifyContent="center"`. */
21487 'justify-content-xs-center': {
21488 justifyContent: 'center'
21489 },
21490
21491 /* Styles applied to the root element if `justifyContent="flex-end"`. */
21492 'justify-content-xs-flex-end': {
21493 justifyContent: 'flex-end'
21494 },
21495
21496 /* Styles applied to the root element if `justifyContent="space-between"`. */
21497 'justify-content-xs-space-between': {
21498 justifyContent: 'space-between'
21499 },
21500
21501 /* Styles applied to the root element if `justifyContent="space-around"`. */
21502 'justify-content-xs-space-around': {
21503 justifyContent: 'space-around'
21504 },
21505
21506 /* Styles applied to the root element if `justifyContent="space-evenly"`. */
21507 'justify-content-xs-space-evenly': {
21508 justifyContent: 'space-evenly'
21509 }
21510 }, generateGutter(theme, 'xs'), theme.breakpoints.keys.reduce(function (accumulator, key) {
21511 // Use side effect over immutability for better performance.
21512 generateGrid(accumulator, theme, key);
21513 return accumulator;
21514 }, {}));
21515 };
21516 var Grid = /*#__PURE__*/react.exports.forwardRef(function Grid(props, ref) {
21517 var _props$alignContent = props.alignContent,
21518 alignContent = _props$alignContent === void 0 ? 'stretch' : _props$alignContent,
21519 _props$alignItems = props.alignItems,
21520 alignItems = _props$alignItems === void 0 ? 'stretch' : _props$alignItems,
21521 classes = props.classes,
21522 classNameProp = props.className,
21523 _props$component = props.component,
21524 Component = _props$component === void 0 ? 'div' : _props$component,
21525 _props$container = props.container,
21526 container = _props$container === void 0 ? false : _props$container,
21527 _props$direction = props.direction,
21528 direction = _props$direction === void 0 ? 'row' : _props$direction,
21529 _props$item = props.item,
21530 item = _props$item === void 0 ? false : _props$item,
21531 justify = props.justify,
21532 _props$justifyContent = props.justifyContent,
21533 justifyContent = _props$justifyContent === void 0 ? 'flex-start' : _props$justifyContent,
21534 _props$lg = props.lg,
21535 lg = _props$lg === void 0 ? false : _props$lg,
21536 _props$md = props.md,
21537 md = _props$md === void 0 ? false : _props$md,
21538 _props$sm = props.sm,
21539 sm = _props$sm === void 0 ? false : _props$sm,
21540 _props$spacing = props.spacing,
21541 spacing = _props$spacing === void 0 ? 0 : _props$spacing,
21542 _props$wrap = props.wrap,
21543 wrap = _props$wrap === void 0 ? 'wrap' : _props$wrap,
21544 _props$xl = props.xl,
21545 xl = _props$xl === void 0 ? false : _props$xl,
21546 _props$xs = props.xs,
21547 xs = _props$xs === void 0 ? false : _props$xs,
21548 _props$zeroMinWidth = props.zeroMinWidth,
21549 zeroMinWidth = _props$zeroMinWidth === void 0 ? false : _props$zeroMinWidth,
21550 other = _objectWithoutProperties(props, ["alignContent", "alignItems", "classes", "className", "component", "container", "direction", "item", "justify", "justifyContent", "lg", "md", "sm", "spacing", "wrap", "xl", "xs", "zeroMinWidth"]);
21551
21552 var className = clsx(classes.root, classNameProp, container && [classes.container, spacing !== 0 && classes["spacing-xs-".concat(String(spacing))]], item && classes.item, zeroMinWidth && classes.zeroMinWidth, direction !== 'row' && classes["direction-xs-".concat(String(direction))], wrap !== 'wrap' && classes["wrap-xs-".concat(String(wrap))], alignItems !== 'stretch' && classes["align-items-xs-".concat(String(alignItems))], alignContent !== 'stretch' && classes["align-content-xs-".concat(String(alignContent))], (justify || justifyContent) !== 'flex-start' && classes["justify-content-xs-".concat(String(justify || justifyContent))], xs !== false && classes["grid-xs-".concat(String(xs))], sm !== false && classes["grid-sm-".concat(String(sm))], md !== false && classes["grid-md-".concat(String(md))], lg !== false && classes["grid-lg-".concat(String(lg))], xl !== false && classes["grid-xl-".concat(String(xl))]);
21553 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
21554 className: className,
21555 ref: ref
21556 }, other));
21557 });
21558 var StyledGrid = withStyles(styles$Z, {
21559 name: 'MuiGrid'
21560 })(Grid);
21561
21562 var styles$Y = {
21563 /* Styles applied to the root element. */
21564 root: {
21565 display: 'flex',
21566 flexWrap: 'wrap',
21567 overflowY: 'auto',
21568 listStyle: 'none',
21569 padding: 0,
21570 WebkitOverflowScrolling: 'touch' // Add iOS momentum scrolling.
21571
21572 }
21573 };
21574 /**
21575 * ⚠️ The GridList component was renamed to ImageList to align with the current Material Design naming.
21576 *
21577 * You should use `import { ImageList } from '@material-ui/core'`
21578 * or `import ImageList from '@material-ui/core/ImageList'`.
21579 */
21580
21581 var GridList = /*#__PURE__*/react.exports.forwardRef(function GridList(props, ref) {
21582
21583 var _props$cellHeight = props.cellHeight,
21584 cellHeight = _props$cellHeight === void 0 ? 180 : _props$cellHeight,
21585 children = props.children,
21586 classes = props.classes,
21587 className = props.className,
21588 _props$cols = props.cols,
21589 cols = _props$cols === void 0 ? 2 : _props$cols,
21590 _props$component = props.component,
21591 Component = _props$component === void 0 ? 'ul' : _props$component,
21592 _props$spacing = props.spacing,
21593 spacing = _props$spacing === void 0 ? 4 : _props$spacing,
21594 style = props.style,
21595 other = _objectWithoutProperties(props, ["cellHeight", "children", "classes", "className", "cols", "component", "spacing", "style"]);
21596
21597 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
21598 className: clsx(classes.root, className),
21599 ref: ref,
21600 style: _extends$5({
21601 margin: -spacing / 2
21602 }, style)
21603 }, other), react.exports.Children.map(children, function (child) {
21604 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
21605 return null;
21606 }
21607
21608 var childCols = child.props.cols || 1;
21609 var childRows = child.props.rows || 1;
21610 return /*#__PURE__*/react.exports.cloneElement(child, {
21611 style: _extends$5({
21612 width: "".concat(100 / cols * childCols, "%"),
21613 height: cellHeight === 'auto' ? 'auto' : cellHeight * childRows + spacing,
21614 padding: spacing / 2
21615 }, child.props.style)
21616 });
21617 }));
21618 });
21619 withStyles(styles$Y, {
21620 name: 'MuiGridList'
21621 })(GridList);
21622
21623 var styles$X = {
21624 /* Styles applied to the root element. */
21625 root: {
21626 boxSizing: 'border-box',
21627 flexShrink: 0
21628 },
21629
21630 /* Styles applied to the `div` element that wraps the children. */
21631 tile: {
21632 position: 'relative',
21633 display: 'block',
21634 // In case it's not rendered with a div.
21635 height: '100%',
21636 overflow: 'hidden'
21637 },
21638
21639 /* Styles applied to an `img` element child, if needed to ensure it covers the tile. */
21640 imgFullHeight: {
21641 height: '100%',
21642 transform: 'translateX(-50%)',
21643 position: 'relative',
21644 left: '50%'
21645 },
21646
21647 /* Styles applied to an `img` element child, if needed to ensure it covers the tile. */
21648 imgFullWidth: {
21649 width: '100%',
21650 position: 'relative',
21651 transform: 'translateY(-50%)',
21652 top: '50%'
21653 }
21654 };
21655
21656 var fit$1 = function fit(imgEl, classes) {
21657 if (!imgEl || !imgEl.complete) {
21658 return;
21659 }
21660
21661 if (imgEl.width / imgEl.height > imgEl.parentElement.offsetWidth / imgEl.parentElement.offsetHeight) {
21662 var _imgEl$classList, _imgEl$classList2;
21663
21664 (_imgEl$classList = imgEl.classList).remove.apply(_imgEl$classList, _toConsumableArray(classes.imgFullWidth.split(' ')));
21665
21666 (_imgEl$classList2 = imgEl.classList).add.apply(_imgEl$classList2, _toConsumableArray(classes.imgFullHeight.split(' ')));
21667 } else {
21668 var _imgEl$classList3, _imgEl$classList4;
21669
21670 (_imgEl$classList3 = imgEl.classList).remove.apply(_imgEl$classList3, _toConsumableArray(classes.imgFullHeight.split(' ')));
21671
21672 (_imgEl$classList4 = imgEl.classList).add.apply(_imgEl$classList4, _toConsumableArray(classes.imgFullWidth.split(' ')));
21673 }
21674 };
21675
21676 function ensureImageCover$1(imgEl, classes) {
21677 if (!imgEl) {
21678 return;
21679 }
21680
21681 if (imgEl.complete) {
21682 fit$1(imgEl, classes);
21683 } else {
21684 imgEl.addEventListener('load', function () {
21685 fit$1(imgEl, classes);
21686 });
21687 }
21688 }
21689 /**
21690 * ⚠️ The GridList component was renamed to ImageList to align with the current Material Design naming.
21691 *
21692 * You should use `import { ImageListItem } from '@material-ui/core'`
21693 * or `import ImageListItem from '@material-ui/core/ImageListItem'`.
21694 */
21695
21696 var GridListTile = /*#__PURE__*/react.exports.forwardRef(function GridListTile(props, ref) {
21697
21698
21699 var children = props.children,
21700 classes = props.classes,
21701 className = props.className;
21702 props.cols;
21703 var _props$component = props.component,
21704 Component = _props$component === void 0 ? 'li' : _props$component;
21705 props.rows;
21706 var other = _objectWithoutProperties(props, ["children", "classes", "className", "cols", "component", "rows"]);
21707
21708 var imgRef = react.exports.useRef(null);
21709 react.exports.useEffect(function () {
21710 ensureImageCover$1(imgRef.current, classes);
21711 });
21712 react.exports.useEffect(function () {
21713 var handleResize = debounce$1(function () {
21714 fit$1(imgRef.current, classes);
21715 });
21716 window.addEventListener('resize', handleResize);
21717 return function () {
21718 handleResize.clear();
21719 window.removeEventListener('resize', handleResize);
21720 };
21721 }, [classes]);
21722 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
21723 className: clsx(classes.root, className),
21724 ref: ref
21725 }, other), /*#__PURE__*/react.exports.createElement("div", {
21726 className: classes.tile
21727 }, react.exports.Children.map(children, function (child) {
21728 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
21729 return null;
21730 }
21731
21732 if (child.type === 'img' || isMuiElement(child, ['Image'])) {
21733 return /*#__PURE__*/react.exports.cloneElement(child, {
21734 ref: imgRef
21735 });
21736 }
21737
21738 return child;
21739 })));
21740 });
21741 withStyles(styles$X, {
21742 name: 'MuiGridListTile'
21743 })(GridListTile);
21744
21745 var styles$W = function styles(theme) {
21746 return {
21747 /* Styles applied to the root element. */
21748 root: {
21749 position: 'absolute',
21750 left: 0,
21751 right: 0,
21752 height: 48,
21753 background: 'rgba(0, 0, 0, 0.5)',
21754 display: 'flex',
21755 alignItems: 'center',
21756 fontFamily: theme.typography.fontFamily
21757 },
21758
21759 /* Styles applied to the root element if `titlePosition="bottom"`. */
21760 titlePositionBottom: {
21761 bottom: 0
21762 },
21763
21764 /* Styles applied to the root element if `titlePosition="top"`. */
21765 titlePositionTop: {
21766 top: 0
21767 },
21768
21769 /* Styles applied to the root element if a `subtitle` is provided. */
21770 rootSubtitle: {
21771 height: 68
21772 },
21773
21774 /* Styles applied to the title and subtitle container element. */
21775 titleWrap: {
21776 flexGrow: 1,
21777 marginLeft: 16,
21778 marginRight: 16,
21779 color: theme.palette.common.white,
21780 overflow: 'hidden'
21781 },
21782
21783 /* Styles applied to the container element if `actionPosition="left"`. */
21784 titleWrapActionPosLeft: {
21785 marginLeft: 0
21786 },
21787
21788 /* Styles applied to the container element if `actionPosition="right"`. */
21789 titleWrapActionPosRight: {
21790 marginRight: 0
21791 },
21792
21793 /* Styles applied to the title container element. */
21794 title: {
21795 fontSize: theme.typography.pxToRem(16),
21796 lineHeight: '24px',
21797 textOverflow: 'ellipsis',
21798 overflow: 'hidden',
21799 whiteSpace: 'nowrap'
21800 },
21801
21802 /* Styles applied to the subtitle container element. */
21803 subtitle: {
21804 fontSize: theme.typography.pxToRem(12),
21805 lineHeight: 1,
21806 textOverflow: 'ellipsis',
21807 overflow: 'hidden',
21808 whiteSpace: 'nowrap'
21809 },
21810
21811 /* Styles applied to the actionIcon if supplied. */
21812 actionIcon: {},
21813
21814 /* Styles applied to the actionIcon if `actionPosition="left"`. */
21815 actionIconActionPosLeft: {
21816 order: -1
21817 }
21818 };
21819 };
21820 /**
21821 * ⚠️ The GridListTileBar component was renamed to ImageListItemBar to align with the current Material Design naming.
21822 *
21823 * You should use `import { ImageListItemBar } from '@material-ui/core'`
21824 * or `import ImageListItemBar from '@material-ui/core/ImageListItemBar'`.
21825 */
21826
21827 var GridListTileBar = /*#__PURE__*/react.exports.forwardRef(function GridListTileBar(props, ref) {
21828
21829 var actionIcon = props.actionIcon,
21830 _props$actionPosition = props.actionPosition,
21831 actionPosition = _props$actionPosition === void 0 ? 'right' : _props$actionPosition,
21832 classes = props.classes,
21833 className = props.className,
21834 subtitle = props.subtitle,
21835 title = props.title,
21836 _props$titlePosition = props.titlePosition,
21837 titlePosition = _props$titlePosition === void 0 ? 'bottom' : _props$titlePosition,
21838 other = _objectWithoutProperties(props, ["actionIcon", "actionPosition", "classes", "className", "subtitle", "title", "titlePosition"]);
21839
21840 var actionPos = actionIcon && actionPosition;
21841 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
21842 className: clsx(classes.root, className, titlePosition === 'top' ? classes.titlePositionTop : classes.titlePositionBottom, subtitle && classes.rootSubtitle),
21843 ref: ref
21844 }, other), /*#__PURE__*/react.exports.createElement("div", {
21845 className: clsx(classes.titleWrap, {
21846 'left': classes.titleWrapActionPosLeft,
21847 'right': classes.titleWrapActionPosRight
21848 }[actionPos])
21849 }, /*#__PURE__*/react.exports.createElement("div", {
21850 className: classes.title
21851 }, title), subtitle ? /*#__PURE__*/react.exports.createElement("div", {
21852 className: classes.subtitle
21853 }, subtitle) : null), actionIcon ? /*#__PURE__*/react.exports.createElement("div", {
21854 className: clsx(classes.actionIcon, actionPos === 'left' && classes.actionIconActionPosLeft)
21855 }, actionIcon) : null);
21856 });
21857 withStyles(styles$W, {
21858 name: 'MuiGridListTileBar'
21859 })(GridListTileBar);
21860
21861 function getScale(value) {
21862 return "scale(".concat(value, ", ").concat(Math.pow(value, 2), ")");
21863 }
21864
21865 var styles$V = {
21866 entering: {
21867 opacity: 1,
21868 transform: getScale(1)
21869 },
21870 entered: {
21871 opacity: 1,
21872 transform: 'none'
21873 }
21874 };
21875 /**
21876 * The Grow transition is used by the [Tooltip](/components/tooltips/) and
21877 * [Popover](/components/popover/) components.
21878 * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
21879 */
21880
21881 var Grow = /*#__PURE__*/react.exports.forwardRef(function Grow(props, ref) {
21882 var children = props.children,
21883 _props$disableStrictM = props.disableStrictModeCompat,
21884 disableStrictModeCompat = _props$disableStrictM === void 0 ? false : _props$disableStrictM,
21885 inProp = props.in,
21886 onEnter = props.onEnter,
21887 onEntered = props.onEntered,
21888 onEntering = props.onEntering,
21889 onExit = props.onExit,
21890 onExited = props.onExited,
21891 onExiting = props.onExiting,
21892 style = props.style,
21893 _props$timeout = props.timeout,
21894 timeout = _props$timeout === void 0 ? 'auto' : _props$timeout,
21895 _props$TransitionComp = props.TransitionComponent,
21896 TransitionComponent = _props$TransitionComp === void 0 ? Transition : _props$TransitionComp,
21897 other = _objectWithoutProperties(props, ["children", "disableStrictModeCompat", "in", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "style", "timeout", "TransitionComponent"]);
21898
21899 var timer = react.exports.useRef();
21900 var autoTimeout = react.exports.useRef();
21901 var theme = useTheme$1();
21902 var enableStrictModeCompat = theme.unstable_strictMode && !disableStrictModeCompat;
21903 var nodeRef = react.exports.useRef(null);
21904 var foreignRef = useForkRef(children.ref, ref);
21905 var handleRef = useForkRef(enableStrictModeCompat ? nodeRef : undefined, foreignRef);
21906
21907 var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {
21908 return function (nodeOrAppearing, maybeAppearing) {
21909 if (callback) {
21910 var _ref = enableStrictModeCompat ? [nodeRef.current, nodeOrAppearing] : [nodeOrAppearing, maybeAppearing],
21911 _ref2 = _slicedToArray(_ref, 2),
21912 node = _ref2[0],
21913 isAppearing = _ref2[1]; // onEnterXxx and onExitXxx callbacks have a different arguments.length value.
21914
21915
21916 if (isAppearing === undefined) {
21917 callback(node);
21918 } else {
21919 callback(node, isAppearing);
21920 }
21921 }
21922 };
21923 };
21924
21925 var handleEntering = normalizedTransitionCallback(onEntering);
21926 var handleEnter = normalizedTransitionCallback(function (node, isAppearing) {
21927 reflow(node); // So the animation always start from the start.
21928
21929 var _getTransitionProps = getTransitionProps({
21930 style: style,
21931 timeout: timeout
21932 }, {
21933 mode: 'enter'
21934 }),
21935 transitionDuration = _getTransitionProps.duration,
21936 delay = _getTransitionProps.delay;
21937
21938 var duration;
21939
21940 if (timeout === 'auto') {
21941 duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
21942 autoTimeout.current = duration;
21943 } else {
21944 duration = transitionDuration;
21945 }
21946
21947 node.style.transition = [theme.transitions.create('opacity', {
21948 duration: duration,
21949 delay: delay
21950 }), theme.transitions.create('transform', {
21951 duration: duration * 0.666,
21952 delay: delay
21953 })].join(',');
21954
21955 if (onEnter) {
21956 onEnter(node, isAppearing);
21957 }
21958 });
21959 var handleEntered = normalizedTransitionCallback(onEntered);
21960 var handleExiting = normalizedTransitionCallback(onExiting);
21961 var handleExit = normalizedTransitionCallback(function (node) {
21962 var _getTransitionProps2 = getTransitionProps({
21963 style: style,
21964 timeout: timeout
21965 }, {
21966 mode: 'exit'
21967 }),
21968 transitionDuration = _getTransitionProps2.duration,
21969 delay = _getTransitionProps2.delay;
21970
21971 var duration;
21972
21973 if (timeout === 'auto') {
21974 duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
21975 autoTimeout.current = duration;
21976 } else {
21977 duration = transitionDuration;
21978 }
21979
21980 node.style.transition = [theme.transitions.create('opacity', {
21981 duration: duration,
21982 delay: delay
21983 }), theme.transitions.create('transform', {
21984 duration: duration * 0.666,
21985 delay: delay || duration * 0.333
21986 })].join(',');
21987 node.style.opacity = '0';
21988 node.style.transform = getScale(0.75);
21989
21990 if (onExit) {
21991 onExit(node);
21992 }
21993 });
21994 var handleExited = normalizedTransitionCallback(onExited);
21995
21996 var addEndListener = function addEndListener(nodeOrNext, maybeNext) {
21997 var next = enableStrictModeCompat ? nodeOrNext : maybeNext;
21998
21999 if (timeout === 'auto') {
22000 timer.current = setTimeout(next, autoTimeout.current || 0);
22001 }
22002 };
22003
22004 react.exports.useEffect(function () {
22005 return function () {
22006 clearTimeout(timer.current);
22007 };
22008 }, []);
22009 return /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
22010 appear: true,
22011 in: inProp,
22012 nodeRef: enableStrictModeCompat ? nodeRef : undefined,
22013 onEnter: handleEnter,
22014 onEntered: handleEntered,
22015 onEntering: handleEntering,
22016 onExit: handleExit,
22017 onExited: handleExited,
22018 onExiting: handleExiting,
22019 addEndListener: addEndListener,
22020 timeout: timeout === 'auto' ? null : timeout
22021 }, other), function (state, childProps) {
22022 return /*#__PURE__*/react.exports.cloneElement(children, _extends$5({
22023 style: _extends$5({
22024 opacity: 0,
22025 transform: getScale(0.75),
22026 visibility: state === 'exited' && !inProp ? 'hidden' : undefined
22027 }, styles$V[state], style, children.props.style),
22028 ref: handleRef
22029 }, childProps));
22030 });
22031 });
22032 Grow.muiSupportAuto = true;
22033
22034 function useMediaQuery(queryInput) {
22035 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
22036 var theme = useTheme$2();
22037 var props = getThemeProps({
22038 theme: theme,
22039 name: 'MuiUseMediaQuery',
22040 props: {}
22041 });
22042
22043 var query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
22044 query = query.replace(/^@media( ?)/m, ''); // Wait for jsdom to support the match media feature.
22045 // All the browsers Material-UI support have this built-in.
22046 // This defensive check is here for simplicity.
22047 // Most of the time, the match media logic isn't central to people tests.
22048
22049 var supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
22050
22051 var _props$options = _extends$5({}, props, options),
22052 _props$options$defaul = _props$options.defaultMatches,
22053 defaultMatches = _props$options$defaul === void 0 ? false : _props$options$defaul,
22054 _props$options$matchM = _props$options.matchMedia,
22055 matchMedia = _props$options$matchM === void 0 ? supportMatchMedia ? window.matchMedia : null : _props$options$matchM,
22056 _props$options$noSsr = _props$options.noSsr,
22057 noSsr = _props$options$noSsr === void 0 ? false : _props$options$noSsr,
22058 _props$options$ssrMat = _props$options.ssrMatchMedia,
22059 ssrMatchMedia = _props$options$ssrMat === void 0 ? null : _props$options$ssrMat;
22060
22061 var _React$useState = react.exports.useState(function () {
22062 if (noSsr && supportMatchMedia) {
22063 return matchMedia(query).matches;
22064 }
22065
22066 if (ssrMatchMedia) {
22067 return ssrMatchMedia(query).matches;
22068 } // Once the component is mounted, we rely on the
22069 // event listeners to return the correct matches value.
22070
22071
22072 return defaultMatches;
22073 }),
22074 match = _React$useState[0],
22075 setMatch = _React$useState[1];
22076
22077 react.exports.useEffect(function () {
22078 var active = true;
22079
22080 if (!supportMatchMedia) {
22081 return undefined;
22082 }
22083
22084 var queryList = matchMedia(query);
22085
22086 var updateMatch = function updateMatch() {
22087 // Workaround Safari wrong implementation of matchMedia
22088 // TODO can we remove it?
22089 // https://github.com/mui-org/material-ui/pull/17315#issuecomment-528286677
22090 if (active) {
22091 setMatch(queryList.matches);
22092 }
22093 };
22094
22095 updateMatch();
22096 queryList.addListener(updateMatch);
22097 return function () {
22098 active = false;
22099 queryList.removeListener(updateMatch);
22100 };
22101 }, [query, matchMedia, supportMatchMedia]);
22102
22103 return match;
22104 }
22105
22106 var isWidthUp = function isWidthUp(breakpoint, width) {
22107 var inclusive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
22108
22109 if (inclusive) {
22110 return keys.indexOf(breakpoint) <= keys.indexOf(width);
22111 }
22112
22113 return keys.indexOf(breakpoint) < keys.indexOf(width);
22114 }; // By default, returns true if screen width is the same or less than the given breakpoint.
22115
22116 var isWidthDown = function isWidthDown(breakpoint, width) {
22117 var inclusive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
22118
22119 if (inclusive) {
22120 return keys.indexOf(width) <= keys.indexOf(breakpoint);
22121 }
22122
22123 return keys.indexOf(width) < keys.indexOf(breakpoint);
22124 };
22125 var useEnhancedEffect$3 = typeof window === 'undefined' ? react.exports.useEffect : react.exports.useLayoutEffect;
22126
22127 var withWidth = function withWidth() {
22128 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
22129 return function (Component) {
22130 var _options$withTheme = options.withTheme,
22131 withThemeOption = _options$withTheme === void 0 ? false : _options$withTheme,
22132 _options$noSSR = options.noSSR,
22133 noSSR = _options$noSSR === void 0 ? false : _options$noSSR,
22134 initialWidthOption = options.initialWidth;
22135
22136 function WithWidth(props) {
22137 var contextTheme = useTheme$1();
22138 var theme = props.theme || contextTheme;
22139
22140 var _getThemeProps = getThemeProps({
22141 theme: theme,
22142 name: 'MuiWithWidth',
22143 props: _extends$5({}, props)
22144 }),
22145 initialWidth = _getThemeProps.initialWidth,
22146 width = _getThemeProps.width,
22147 other = _objectWithoutProperties(_getThemeProps, ["initialWidth", "width"]);
22148
22149 var _React$useState = react.exports.useState(false),
22150 mountedState = _React$useState[0],
22151 setMountedState = _React$useState[1];
22152
22153 useEnhancedEffect$3(function () {
22154 setMountedState(true);
22155 }, []);
22156 /**
22157 * innerWidth |xs sm md lg xl
22158 * |-------|-------|-------|-------|------>
22159 * width | xs | sm | md | lg | xl
22160 */
22161
22162 var keys = theme.breakpoints.keys.slice().reverse();
22163 var widthComputed = keys.reduce(function (output, key) {
22164 // eslint-disable-next-line react-hooks/rules-of-hooks
22165 var matches = useMediaQuery(theme.breakpoints.up(key));
22166 return !output && matches ? key : output;
22167 }, null);
22168
22169 var more = _extends$5({
22170 width: width || (mountedState || noSSR ? widthComputed : undefined) || initialWidth || initialWidthOption
22171 }, withThemeOption ? {
22172 theme: theme
22173 } : {}, other); // When rendering the component on the server,
22174 // we have no idea about the client browser screen width.
22175 // In order to prevent blinks and help the reconciliation of the React tree
22176 // we are not rendering the child component.
22177 //
22178 // An alternative is to use the `initialWidth` property.
22179
22180
22181 if (more.width === undefined) {
22182 return null;
22183 }
22184
22185 return /*#__PURE__*/react.exports.createElement(Component, more);
22186 }
22187
22188 hoistNonReactStatics_cjs(WithWidth, Component);
22189 return WithWidth;
22190 };
22191 };
22192
22193 /**
22194 * @ignore - internal component.
22195 */
22196
22197 function HiddenJs(props) {
22198 var children = props.children,
22199 only = props.only,
22200 width = props.width;
22201 var theme = useTheme$1();
22202 var visible = true; // `only` check is faster to get out sooner if used.
22203
22204 if (only) {
22205 if (Array.isArray(only)) {
22206 for (var i = 0; i < only.length; i += 1) {
22207 var breakpoint = only[i];
22208
22209 if (width === breakpoint) {
22210 visible = false;
22211 break;
22212 }
22213 }
22214 } else if (only && width === only) {
22215 visible = false;
22216 }
22217 } // Allow `only` to be combined with other props. If already hidden, no need to check others.
22218
22219
22220 if (visible) {
22221 // determine visibility based on the smallest size up
22222 for (var _i = 0; _i < theme.breakpoints.keys.length; _i += 1) {
22223 var _breakpoint = theme.breakpoints.keys[_i];
22224 var breakpointUp = props["".concat(_breakpoint, "Up")];
22225 var breakpointDown = props["".concat(_breakpoint, "Down")];
22226
22227 if (breakpointUp && isWidthUp(_breakpoint, width) || breakpointDown && isWidthDown(_breakpoint, width)) {
22228 visible = false;
22229 break;
22230 }
22231 }
22232 }
22233
22234 if (!visible) {
22235 return null;
22236 }
22237
22238 return children;
22239 }
22240
22241 HiddenJs.propTypes = {
22242 /**
22243 * The content of the component.
22244 */
22245 children: propTypes.exports.node,
22246
22247 /**
22248 * @ignore
22249 */
22250 className: propTypes.exports.string,
22251
22252 /**
22253 * Specify which implementation to use. 'js' is the default, 'css' works better for
22254 * server-side rendering.
22255 */
22256 implementation: propTypes.exports.oneOf(['js', 'css']),
22257
22258 /**
22259 * You can use this prop when choosing the `js` implementation with server-side rendering.
22260 *
22261 * As `window.innerWidth` is unavailable on the server,
22262 * we default to rendering an empty component during the first mount.
22263 * You might want to use an heuristic to approximate
22264 * the screen width of the client browser screen width.
22265 *
22266 * For instance, you could be using the user-agent or the client-hints.
22267 * https://caniuse.com/#search=client%20hint
22268 */
22269 initialWidth: propTypes.exports.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
22270
22271 /**
22272 * If `true`, screens this size and down will be hidden.
22273 */
22274 lgDown: propTypes.exports.bool,
22275
22276 /**
22277 * If `true`, screens this size and up will be hidden.
22278 */
22279 lgUp: propTypes.exports.bool,
22280
22281 /**
22282 * If `true`, screens this size and down will be hidden.
22283 */
22284 mdDown: propTypes.exports.bool,
22285
22286 /**
22287 * If `true`, screens this size and up will be hidden.
22288 */
22289 mdUp: propTypes.exports.bool,
22290
22291 /**
22292 * Hide the given breakpoint(s).
22293 */
22294 only: propTypes.exports.oneOfType([propTypes.exports.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), propTypes.exports.arrayOf(propTypes.exports.oneOf(['xs', 'sm', 'md', 'lg', 'xl']))]),
22295
22296 /**
22297 * If `true`, screens this size and down will be hidden.
22298 */
22299 smDown: propTypes.exports.bool,
22300
22301 /**
22302 * If `true`, screens this size and up will be hidden.
22303 */
22304 smUp: propTypes.exports.bool,
22305
22306 /**
22307 * @ignore
22308 * width prop provided by withWidth decorator.
22309 */
22310 width: propTypes.exports.string.isRequired,
22311
22312 /**
22313 * If `true`, screens this size and down will be hidden.
22314 */
22315 xlDown: propTypes.exports.bool,
22316
22317 /**
22318 * If `true`, screens this size and up will be hidden.
22319 */
22320 xlUp: propTypes.exports.bool,
22321
22322 /**
22323 * If `true`, screens this size and down will be hidden.
22324 */
22325 xsDown: propTypes.exports.bool,
22326
22327 /**
22328 * If `true`, screens this size and up will be hidden.
22329 */
22330 xsUp: propTypes.exports.bool
22331 };
22332
22333 withWidth()(HiddenJs);
22334
22335 var styles$U = function styles(theme) {
22336 var hidden = {
22337 display: 'none'
22338 };
22339 return theme.breakpoints.keys.reduce(function (acc, key) {
22340 acc["only".concat(capitalize(key))] = _defineProperty$1({}, theme.breakpoints.only(key), hidden);
22341 acc["".concat(key, "Up")] = _defineProperty$1({}, theme.breakpoints.up(key), hidden);
22342 acc["".concat(key, "Down")] = _defineProperty$1({}, theme.breakpoints.down(key), hidden);
22343 return acc;
22344 }, {});
22345 };
22346 /**
22347 * @ignore - internal component.
22348 */
22349
22350
22351 function HiddenCss(props) {
22352 var children = props.children,
22353 classes = props.classes,
22354 className = props.className,
22355 only = props.only;
22356 _objectWithoutProperties(props, ["children", "classes", "className", "only"]);
22357
22358 var theme = useTheme$1();
22359
22360 var clsx = [];
22361
22362 if (className) {
22363 clsx.push(className);
22364 }
22365
22366 for (var i = 0; i < theme.breakpoints.keys.length; i += 1) {
22367 var breakpoint = theme.breakpoints.keys[i];
22368 var breakpointUp = props["".concat(breakpoint, "Up")];
22369 var breakpointDown = props["".concat(breakpoint, "Down")];
22370
22371 if (breakpointUp) {
22372 clsx.push(classes["".concat(breakpoint, "Up")]);
22373 }
22374
22375 if (breakpointDown) {
22376 clsx.push(classes["".concat(breakpoint, "Down")]);
22377 }
22378 }
22379
22380 if (only) {
22381 var onlyBreakpoints = Array.isArray(only) ? only : [only];
22382 onlyBreakpoints.forEach(function (breakpoint) {
22383 clsx.push(classes["only".concat(capitalize(breakpoint))]);
22384 });
22385 }
22386
22387 return /*#__PURE__*/react.exports.createElement("div", {
22388 className: clsx.join(' ')
22389 }, children);
22390 }
22391 withStyles(styles$U, {
22392 name: 'PrivateHiddenCss'
22393 })(HiddenCss);
22394
22395 var styles$T = function styles(theme) {
22396 return {
22397 /* Styles applied to the root element. */
22398 root: {
22399 userSelect: 'none',
22400 fontSize: theme.typography.pxToRem(24),
22401 width: '1em',
22402 height: '1em',
22403 // Chrome fix for https://bugs.chromium.org/p/chromium/issues/detail?id=820541
22404 // To remove at some point.
22405 overflow: 'hidden',
22406 flexShrink: 0
22407 },
22408
22409 /* Styles applied to the root element if `color="primary"`. */
22410 colorPrimary: {
22411 color: theme.palette.primary.main
22412 },
22413
22414 /* Styles applied to the root element if `color="secondary"`. */
22415 colorSecondary: {
22416 color: theme.palette.secondary.main
22417 },
22418
22419 /* Styles applied to the root element if `color="action"`. */
22420 colorAction: {
22421 color: theme.palette.action.active
22422 },
22423
22424 /* Styles applied to the root element if `color="error"`. */
22425 colorError: {
22426 color: theme.palette.error.main
22427 },
22428
22429 /* Styles applied to the root element if `color="disabled"`. */
22430 colorDisabled: {
22431 color: theme.palette.action.disabled
22432 },
22433
22434 /* Styles applied to the root element if `fontSize="inherit"`. */
22435 fontSizeInherit: {
22436 fontSize: 'inherit'
22437 },
22438
22439 /* Styles applied to the root element if `fontSize="small"`. */
22440 fontSizeSmall: {
22441 fontSize: theme.typography.pxToRem(20)
22442 },
22443
22444 /* Styles applied to the root element if `fontSize="large"`. */
22445 fontSizeLarge: {
22446 fontSize: theme.typography.pxToRem(36)
22447 }
22448 };
22449 };
22450 var Icon = /*#__PURE__*/react.exports.forwardRef(function Icon(props, ref) {
22451 var classes = props.classes,
22452 className = props.className,
22453 _props$color = props.color,
22454 color = _props$color === void 0 ? 'inherit' : _props$color,
22455 _props$component = props.component,
22456 Component = _props$component === void 0 ? 'span' : _props$component,
22457 _props$fontSize = props.fontSize,
22458 fontSize = _props$fontSize === void 0 ? 'medium' : _props$fontSize,
22459 other = _objectWithoutProperties(props, ["classes", "className", "color", "component", "fontSize"]);
22460
22461 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
22462 className: clsx('material-icons', classes.root, className, color !== 'inherit' && classes["color".concat(capitalize(color))], fontSize !== 'default' && fontSize !== 'medium' && classes["fontSize".concat(capitalize(fontSize))]),
22463 "aria-hidden": true,
22464 ref: ref
22465 }, other));
22466 });
22467 Icon.muiName = 'Icon';
22468 var Icon$1 = withStyles(styles$T, {
22469 name: 'MuiIcon'
22470 })(Icon);
22471
22472 var styles$S = {
22473 /* Styles applied to the root element. */
22474 root: {
22475 display: 'flex',
22476 flexWrap: 'wrap',
22477 overflowY: 'auto',
22478 listStyle: 'none',
22479 padding: 0,
22480 WebkitOverflowScrolling: 'touch' // Add iOS momentum scrolling.
22481
22482 }
22483 };
22484 var ImageList = /*#__PURE__*/react.exports.forwardRef(function ImageList(props, ref) {
22485 var cellHeight = props.cellHeight,
22486 children = props.children,
22487 classes = props.classes,
22488 className = props.className,
22489 _props$cols = props.cols,
22490 cols = _props$cols === void 0 ? 2 : _props$cols,
22491 _props$component = props.component,
22492 Component = _props$component === void 0 ? 'ul' : _props$component,
22493 _props$gap = props.gap,
22494 gapProp = _props$gap === void 0 ? 4 : _props$gap,
22495 _props$rowHeight = props.rowHeight,
22496 rowHeightProp = _props$rowHeight === void 0 ? 180 : _props$rowHeight,
22497 spacing = props.spacing,
22498 style = props.style,
22499 other = _objectWithoutProperties(props, ["cellHeight", "children", "classes", "className", "cols", "component", "gap", "rowHeight", "spacing", "style"]);
22500
22501 var gap = spacing || gapProp;
22502 var rowHeight = cellHeight || rowHeightProp;
22503 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
22504 className: clsx(classes.root, className),
22505 ref: ref,
22506 style: _extends$5({
22507 margin: -gap / 2
22508 }, style)
22509 }, other), react.exports.Children.map(children, function (child) {
22510 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
22511 return null;
22512 }
22513
22514 var childCols = child.props.cols || 1;
22515 var childRows = child.props.rows || 1;
22516 return /*#__PURE__*/react.exports.cloneElement(child, {
22517 style: _extends$5({
22518 width: "".concat(100 / cols * childCols, "%"),
22519 height: rowHeight === 'auto' ? 'auto' : rowHeight * childRows + gap,
22520 padding: gap / 2
22521 }, child.props.style)
22522 });
22523 }));
22524 });
22525 withStyles(styles$S, {
22526 name: 'MuiImageList'
22527 })(ImageList);
22528
22529 var styles$R = {
22530 /* Styles applied to the root element. */
22531 root: {
22532 boxSizing: 'border-box',
22533 flexShrink: 0
22534 },
22535
22536 /* Styles applied to the `div` element that wraps the children. */
22537 item: {
22538 position: 'relative',
22539 display: 'block',
22540 // In case it's not rendered with a div.
22541 height: '100%',
22542 overflow: 'hidden'
22543 },
22544
22545 /* Styles applied to an `img` element child, if needed to ensure it covers the item. */
22546 imgFullHeight: {
22547 height: '100%',
22548 transform: 'translateX(-50%)',
22549 position: 'relative',
22550 left: '50%'
22551 },
22552
22553 /* Styles applied to an `img` element child, if needed to ensure it covers the item. */
22554 imgFullWidth: {
22555 width: '100%',
22556 position: 'relative',
22557 transform: 'translateY(-50%)',
22558 top: '50%'
22559 }
22560 };
22561
22562 var fit = function fit(imgEl, classes) {
22563 if (!imgEl || !imgEl.complete) {
22564 return;
22565 }
22566
22567 if (imgEl.width / imgEl.height > imgEl.parentElement.offsetWidth / imgEl.parentElement.offsetHeight) {
22568 var _imgEl$classList, _imgEl$classList2;
22569
22570 (_imgEl$classList = imgEl.classList).remove.apply(_imgEl$classList, _toConsumableArray(classes.imgFullWidth.split(' ')));
22571
22572 (_imgEl$classList2 = imgEl.classList).add.apply(_imgEl$classList2, _toConsumableArray(classes.imgFullHeight.split(' ')));
22573 } else {
22574 var _imgEl$classList3, _imgEl$classList4;
22575
22576 (_imgEl$classList3 = imgEl.classList).remove.apply(_imgEl$classList3, _toConsumableArray(classes.imgFullHeight.split(' ')));
22577
22578 (_imgEl$classList4 = imgEl.classList).add.apply(_imgEl$classList4, _toConsumableArray(classes.imgFullWidth.split(' ')));
22579 }
22580 };
22581
22582 function ensureImageCover(imgEl, classes) {
22583 if (!imgEl) {
22584 return;
22585 }
22586
22587 if (imgEl.complete) {
22588 fit(imgEl, classes);
22589 } else {
22590 imgEl.addEventListener('load', function () {
22591 fit(imgEl, classes);
22592 });
22593 }
22594 }
22595
22596 var ImageListItem = /*#__PURE__*/react.exports.forwardRef(function ImageListItem(props, ref) {
22597 // cols rows default values are for docs only
22598 var children = props.children,
22599 classes = props.classes,
22600 className = props.className;
22601 props.cols;
22602 var _props$component = props.component,
22603 Component = _props$component === void 0 ? 'li' : _props$component;
22604 props.rows;
22605 var other = _objectWithoutProperties(props, ["children", "classes", "className", "cols", "component", "rows"]);
22606
22607 var imgRef = react.exports.useRef(null);
22608 react.exports.useEffect(function () {
22609 ensureImageCover(imgRef.current, classes);
22610 });
22611 react.exports.useEffect(function () {
22612 var handleResize = debounce$1(function () {
22613 fit(imgRef.current, classes);
22614 });
22615 window.addEventListener('resize', handleResize);
22616 return function () {
22617 handleResize.clear();
22618 window.removeEventListener('resize', handleResize);
22619 };
22620 }, [classes]);
22621 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
22622 className: clsx(classes.root, className),
22623 ref: ref
22624 }, other), /*#__PURE__*/react.exports.createElement("div", {
22625 className: classes.item
22626 }, react.exports.Children.map(children, function (child) {
22627 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
22628 return null;
22629 }
22630
22631 if (child.type === 'img' || isMuiElement(child, ['Image'])) {
22632 return /*#__PURE__*/react.exports.cloneElement(child, {
22633 ref: imgRef
22634 });
22635 }
22636
22637 return child;
22638 })));
22639 });
22640 withStyles(styles$R, {
22641 name: 'MuiImageListItem'
22642 })(ImageListItem);
22643
22644 var styles$Q = function styles(theme) {
22645 return {
22646 /* Styles applied to the root element. */
22647 root: {
22648 position: 'absolute',
22649 left: 0,
22650 right: 0,
22651 height: 48,
22652 background: 'rgba(0, 0, 0, 0.5)',
22653 display: 'flex',
22654 alignItems: 'center',
22655 fontFamily: theme.typography.fontFamily
22656 },
22657
22658 /* Styles applied to the root element if `position="bottom"`. */
22659 positionBottom: {
22660 bottom: 0
22661 },
22662
22663 /* Styles applied to the root element if `position="top"`. */
22664 positionTop: {
22665 top: 0
22666 },
22667
22668 /* Styles applied to the root element if a `subtitle` is provided. */
22669 rootSubtitle: {
22670 height: 68
22671 },
22672
22673 /* Styles applied to the title and subtitle container element. */
22674 titleWrap: {
22675 flexGrow: 1,
22676 marginLeft: 16,
22677 marginRight: 16,
22678 color: theme.palette.common.white,
22679 overflow: 'hidden'
22680 },
22681
22682 /* Styles applied to the container element if `actionPosition="left"`. */
22683 titleWrapActionPosLeft: {
22684 marginLeft: 0
22685 },
22686
22687 /* Styles applied to the container element if `actionPosition="right"`. */
22688 titleWrapActionPosRight: {
22689 marginRight: 0
22690 },
22691
22692 /* Styles applied to the title container element. */
22693 title: {
22694 fontSize: theme.typography.pxToRem(16),
22695 lineHeight: '24px',
22696 textOverflow: 'ellipsis',
22697 overflow: 'hidden',
22698 whiteSpace: 'nowrap'
22699 },
22700
22701 /* Styles applied to the subtitle container element. */
22702 subtitle: {
22703 fontSize: theme.typography.pxToRem(12),
22704 lineHeight: 1,
22705 textOverflow: 'ellipsis',
22706 overflow: 'hidden',
22707 whiteSpace: 'nowrap'
22708 },
22709
22710 /* Styles applied to the actionIcon if supplied. */
22711 actionIcon: {},
22712
22713 /* Styles applied to the actionIcon if `actionPosition="left"`. */
22714 actionIconActionPosLeft: {
22715 order: -1
22716 }
22717 };
22718 };
22719 var ImageListItemBar = /*#__PURE__*/react.exports.forwardRef(function ImageListItemBar(props, ref) {
22720 var actionIcon = props.actionIcon,
22721 _props$actionPosition = props.actionPosition,
22722 actionPosition = _props$actionPosition === void 0 ? 'right' : _props$actionPosition,
22723 classes = props.classes,
22724 className = props.className,
22725 subtitle = props.subtitle,
22726 title = props.title,
22727 _props$position = props.position,
22728 positionProp = _props$position === void 0 ? 'bottom' : _props$position,
22729 titlePosition = props.titlePosition,
22730 other = _objectWithoutProperties(props, ["actionIcon", "actionPosition", "classes", "className", "subtitle", "title", "position", "titlePosition"]);
22731
22732 var position = titlePosition || positionProp;
22733 var actionPos = actionIcon && actionPosition;
22734 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
22735 className: clsx(classes.root, className, subtitle && classes.rootSubtitle, {
22736 'bottom': classes.positionBottom,
22737 'top': classes.positionTop
22738 }[position]),
22739 ref: ref
22740 }, other), /*#__PURE__*/react.exports.createElement("div", {
22741 className: clsx(classes.titleWrap, {
22742 'left': classes.titleWrapActionPosLeft,
22743 'right': classes.titleWrapActionPosRight
22744 }[actionPos])
22745 }, /*#__PURE__*/react.exports.createElement("div", {
22746 className: classes.title
22747 }, title), subtitle ? /*#__PURE__*/react.exports.createElement("div", {
22748 className: classes.subtitle
22749 }, subtitle) : null), actionIcon ? /*#__PURE__*/react.exports.createElement("div", {
22750 className: clsx(classes.actionIcon, actionPos === 'left' && classes.actionIconActionPosLeft)
22751 }, actionIcon) : null);
22752 });
22753 withStyles(styles$Q, {
22754 name: 'MuiImageListItemBar'
22755 })(ImageListItemBar);
22756
22757 var styles$P = function styles(theme) {
22758 var light = theme.palette.type === 'light';
22759 var bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
22760 return {
22761 /* Styles applied to the root element. */
22762 root: {
22763 position: 'relative'
22764 },
22765
22766 /* Styles applied to the root element if the component is a descendant of `FormControl`. */
22767 formControl: {
22768 'label + &': {
22769 marginTop: 16
22770 }
22771 },
22772
22773 /* Styles applied to the root element if the component is focused. */
22774 focused: {},
22775
22776 /* Styles applied to the root element if `disabled={true}`. */
22777 disabled: {},
22778
22779 /* Styles applied to the root element if color secondary. */
22780 colorSecondary: {
22781 '&$underline:after': {
22782 borderBottomColor: theme.palette.secondary.main
22783 }
22784 },
22785
22786 /* Styles applied to the root element if `disableUnderline={false}`. */
22787 underline: {
22788 '&:after': {
22789 borderBottom: "2px solid ".concat(theme.palette.primary.main),
22790 left: 0,
22791 bottom: 0,
22792 // Doing the other way around crash on IE 11 "''" https://github.com/cssinjs/jss/issues/242
22793 content: '""',
22794 position: 'absolute',
22795 right: 0,
22796 transform: 'scaleX(0)',
22797 transition: theme.transitions.create('transform', {
22798 duration: theme.transitions.duration.shorter,
22799 easing: theme.transitions.easing.easeOut
22800 }),
22801 pointerEvents: 'none' // Transparent to the hover style.
22802
22803 },
22804 '&$focused:after': {
22805 transform: 'scaleX(1)'
22806 },
22807 '&$error:after': {
22808 borderBottomColor: theme.palette.error.main,
22809 transform: 'scaleX(1)' // error is always underlined in red
22810
22811 },
22812 '&:before': {
22813 borderBottom: "1px solid ".concat(bottomLineColor),
22814 left: 0,
22815 bottom: 0,
22816 // Doing the other way around crash on IE 11 "''" https://github.com/cssinjs/jss/issues/242
22817 content: '"\\00a0"',
22818 position: 'absolute',
22819 right: 0,
22820 transition: theme.transitions.create('border-bottom-color', {
22821 duration: theme.transitions.duration.shorter
22822 }),
22823 pointerEvents: 'none' // Transparent to the hover style.
22824
22825 },
22826 '&:hover:not($disabled):before': {
22827 borderBottom: "2px solid ".concat(theme.palette.text.primary),
22828 // Reset on touch devices, it doesn't add specificity
22829 '@media (hover: none)': {
22830 borderBottom: "1px solid ".concat(bottomLineColor)
22831 }
22832 },
22833 '&$disabled:before': {
22834 borderBottomStyle: 'dotted'
22835 }
22836 },
22837
22838 /* Pseudo-class applied to the root element if `error={true}`. */
22839 error: {},
22840
22841 /* Styles applied to the `input` element if `margin="dense"`. */
22842 marginDense: {},
22843
22844 /* Styles applied to the root element if `multiline={true}`. */
22845 multiline: {},
22846
22847 /* Styles applied to the root element if `fullWidth={true}`. */
22848 fullWidth: {},
22849
22850 /* Styles applied to the `input` element. */
22851 input: {},
22852
22853 /* Styles applied to the `input` element if `margin="dense"`. */
22854 inputMarginDense: {},
22855
22856 /* Styles applied to the `input` element if `multiline={true}`. */
22857 inputMultiline: {},
22858
22859 /* Styles applied to the `input` element if `type="search"`. */
22860 inputTypeSearch: {}
22861 };
22862 };
22863 var Input = /*#__PURE__*/react.exports.forwardRef(function Input(props, ref) {
22864 var disableUnderline = props.disableUnderline,
22865 classes = props.classes,
22866 _props$fullWidth = props.fullWidth,
22867 fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
22868 _props$inputComponent = props.inputComponent,
22869 inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,
22870 _props$multiline = props.multiline,
22871 multiline = _props$multiline === void 0 ? false : _props$multiline,
22872 _props$type = props.type,
22873 type = _props$type === void 0 ? 'text' : _props$type,
22874 other = _objectWithoutProperties(props, ["disableUnderline", "classes", "fullWidth", "inputComponent", "multiline", "type"]);
22875
22876 return /*#__PURE__*/react.exports.createElement(InputBase$1, _extends$5({
22877 classes: _extends$5({}, classes, {
22878 root: clsx(classes.root, !disableUnderline && classes.underline),
22879 underline: null
22880 }),
22881 fullWidth: fullWidth,
22882 inputComponent: inputComponent,
22883 multiline: multiline,
22884 ref: ref,
22885 type: type
22886 }, other));
22887 });
22888 Input.muiName = 'Input';
22889 var Input$1 = withStyles(styles$P, {
22890 name: 'MuiInput'
22891 })(Input);
22892
22893 var styles$O = {
22894 /* Styles applied to the root element. */
22895 root: {
22896 display: 'flex',
22897 height: '0.01em',
22898 // Fix IE 11 flexbox alignment. To remove at some point.
22899 maxHeight: '2em',
22900 alignItems: 'center',
22901 whiteSpace: 'nowrap'
22902 },
22903
22904 /* Styles applied to the root element if `variant="filled"`. */
22905 filled: {
22906 '&$positionStart:not($hiddenLabel)': {
22907 marginTop: 16
22908 }
22909 },
22910
22911 /* Styles applied to the root element if `position="start"`. */
22912 positionStart: {
22913 marginRight: 8
22914 },
22915
22916 /* Styles applied to the root element if `position="end"`. */
22917 positionEnd: {
22918 marginLeft: 8
22919 },
22920
22921 /* Styles applied to the root element if `disablePointerEvents=true`. */
22922 disablePointerEvents: {
22923 pointerEvents: 'none'
22924 },
22925
22926 /* Styles applied if the adornment is used inside <FormControl hiddenLabel />. */
22927 hiddenLabel: {},
22928
22929 /* Styles applied if the adornment is used inside <FormControl margin="dense" />. */
22930 marginDense: {}
22931 };
22932 var InputAdornment = /*#__PURE__*/react.exports.forwardRef(function InputAdornment(props, ref) {
22933 var children = props.children,
22934 classes = props.classes,
22935 className = props.className,
22936 _props$component = props.component,
22937 Component = _props$component === void 0 ? 'div' : _props$component,
22938 _props$disablePointer = props.disablePointerEvents,
22939 disablePointerEvents = _props$disablePointer === void 0 ? false : _props$disablePointer,
22940 _props$disableTypogra = props.disableTypography,
22941 disableTypography = _props$disableTypogra === void 0 ? false : _props$disableTypogra,
22942 position = props.position,
22943 variantProp = props.variant,
22944 other = _objectWithoutProperties(props, ["children", "classes", "className", "component", "disablePointerEvents", "disableTypography", "position", "variant"]);
22945
22946 var muiFormControl = useFormControl$1() || {};
22947 var variant = variantProp;
22948
22949 if (variantProp && muiFormControl.variant) ;
22950
22951 if (muiFormControl && !variant) {
22952 variant = muiFormControl.variant;
22953 }
22954
22955 return /*#__PURE__*/react.exports.createElement(FormControlContext.Provider, {
22956 value: null
22957 }, /*#__PURE__*/react.exports.createElement(Component, _extends$5({
22958 className: clsx(classes.root, className, position === 'end' ? classes.positionEnd : classes.positionStart, disablePointerEvents && classes.disablePointerEvents, muiFormControl.hiddenLabel && classes.hiddenLabel, variant === 'filled' && classes.filled, muiFormControl.margin === 'dense' && classes.marginDense),
22959 ref: ref
22960 }, other), typeof children === 'string' && !disableTypography ? /*#__PURE__*/react.exports.createElement(Typography$1, {
22961 color: "textSecondary"
22962 }, children) : children));
22963 });
22964 var InputAdornment$1 = withStyles(styles$O, {
22965 name: 'MuiInputAdornment'
22966 })(InputAdornment);
22967
22968 var styles$N = function styles(theme) {
22969 return {
22970 /* Styles applied to the root element. */
22971 root: {
22972 display: 'block',
22973 transformOrigin: 'top left'
22974 },
22975
22976 /* Pseudo-class applied to the root element if `focused={true}`. */
22977 focused: {},
22978
22979 /* Pseudo-class applied to the root element if `disabled={true}`. */
22980 disabled: {},
22981
22982 /* Pseudo-class applied to the root element if `error={true}`. */
22983 error: {},
22984
22985 /* Pseudo-class applied to the root element if `required={true}`. */
22986 required: {},
22987
22988 /* Pseudo-class applied to the asterisk element. */
22989 asterisk: {},
22990
22991 /* Styles applied to the root element if the component is a descendant of `FormControl`. */
22992 formControl: {
22993 position: 'absolute',
22994 left: 0,
22995 top: 0,
22996 // slight alteration to spec spacing to match visual spec result
22997 transform: 'translate(0, 24px) scale(1)'
22998 },
22999
23000 /* Styles applied to the root element if `margin="dense"`. */
23001 marginDense: {
23002 // Compensation for the `Input.inputDense` style.
23003 transform: 'translate(0, 21px) scale(1)'
23004 },
23005
23006 /* Styles applied to the `input` element if `shrink={true}`. */
23007 shrink: {
23008 transform: 'translate(0, 1.5px) scale(0.75)',
23009 transformOrigin: 'top left'
23010 },
23011
23012 /* Styles applied to the `input` element if `disableAnimation={false}`. */
23013 animated: {
23014 transition: theme.transitions.create(['color', 'transform'], {
23015 duration: theme.transitions.duration.shorter,
23016 easing: theme.transitions.easing.easeOut
23017 })
23018 },
23019
23020 /* Styles applied to the root element if `variant="filled"`. */
23021 filled: {
23022 // Chrome's autofill feature gives the input field a yellow background.
23023 // Since the input field is behind the label in the HTML tree,
23024 // the input field is drawn last and hides the label with an opaque background color.
23025 // zIndex: 1 will raise the label above opaque background-colors of input.
23026 zIndex: 1,
23027 pointerEvents: 'none',
23028 transform: 'translate(12px, 20px) scale(1)',
23029 '&$marginDense': {
23030 transform: 'translate(12px, 17px) scale(1)'
23031 },
23032 '&$shrink': {
23033 transform: 'translate(12px, 10px) scale(0.75)',
23034 '&$marginDense': {
23035 transform: 'translate(12px, 7px) scale(0.75)'
23036 }
23037 }
23038 },
23039
23040 /* Styles applied to the root element if `variant="outlined"`. */
23041 outlined: {
23042 // see comment above on filled.zIndex
23043 zIndex: 1,
23044 pointerEvents: 'none',
23045 transform: 'translate(14px, 20px) scale(1)',
23046 '&$marginDense': {
23047 transform: 'translate(14px, 12px) scale(1)'
23048 },
23049 '&$shrink': {
23050 transform: 'translate(14px, -6px) scale(0.75)'
23051 }
23052 }
23053 };
23054 };
23055 var InputLabel = /*#__PURE__*/react.exports.forwardRef(function InputLabel(props, ref) {
23056 var classes = props.classes,
23057 className = props.className,
23058 _props$disableAnimati = props.disableAnimation,
23059 disableAnimation = _props$disableAnimati === void 0 ? false : _props$disableAnimati;
23060 props.margin;
23061 var shrinkProp = props.shrink;
23062 props.variant;
23063 var other = _objectWithoutProperties(props, ["classes", "className", "disableAnimation", "margin", "shrink", "variant"]);
23064
23065 var muiFormControl = useFormControl();
23066 var shrink = shrinkProp;
23067
23068 if (typeof shrink === 'undefined' && muiFormControl) {
23069 shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;
23070 }
23071
23072 var fcs = formControlState({
23073 props: props,
23074 muiFormControl: muiFormControl,
23075 states: ['margin', 'variant']
23076 });
23077 return /*#__PURE__*/react.exports.createElement(FormLabel$1, _extends$5({
23078 "data-shrink": shrink,
23079 className: clsx(classes.root, className, muiFormControl && classes.formControl, !disableAnimation && classes.animated, shrink && classes.shrink, fcs.margin === 'dense' && classes.marginDense, {
23080 'filled': classes.filled,
23081 'outlined': classes.outlined
23082 }[fcs.variant]),
23083 classes: {
23084 focused: classes.focused,
23085 disabled: classes.disabled,
23086 error: classes.error,
23087 required: classes.required,
23088 asterisk: classes.asterisk
23089 },
23090 ref: ref
23091 }, other));
23092 });
23093 var InputLabel$1 = withStyles(styles$N, {
23094 name: 'MuiInputLabel'
23095 })(InputLabel);
23096
23097 var TRANSITION_DURATION = 4; // seconds
23098
23099 var styles$M = function styles(theme) {
23100 var getColor = function getColor(color) {
23101 return theme.palette.type === 'light' ? lighten(color, 0.62) : darken(color, 0.5);
23102 };
23103
23104 var backgroundPrimary = getColor(theme.palette.primary.main);
23105 var backgroundSecondary = getColor(theme.palette.secondary.main);
23106 return {
23107 /* Styles applied to the root element. */
23108 root: {
23109 position: 'relative',
23110 overflow: 'hidden',
23111 height: 4,
23112 '@media print': {
23113 colorAdjust: 'exact'
23114 }
23115 },
23116
23117 /* Styles applied to the root and bar2 element if `color="primary"`; bar2 if `variant="buffer"`. */
23118 colorPrimary: {
23119 backgroundColor: backgroundPrimary
23120 },
23121
23122 /* Styles applied to the root and bar2 elements if `color="secondary"`; bar2 if `variant="buffer"`. */
23123 colorSecondary: {
23124 backgroundColor: backgroundSecondary
23125 },
23126
23127 /* Styles applied to the root element if `variant="determinate"`. */
23128 determinate: {},
23129
23130 /* Styles applied to the root element if `variant="indeterminate"`. */
23131 indeterminate: {},
23132
23133 /* Styles applied to the root element if `variant="buffer"`. */
23134 buffer: {
23135 backgroundColor: 'transparent'
23136 },
23137
23138 /* Styles applied to the root element if `variant="query"`. */
23139 query: {
23140 transform: 'rotate(180deg)'
23141 },
23142
23143 /* Styles applied to the additional bar element if `variant="buffer"`. */
23144 dashed: {
23145 position: 'absolute',
23146 marginTop: 0,
23147 height: '100%',
23148 width: '100%',
23149 animation: '$buffer 3s infinite linear'
23150 },
23151
23152 /* Styles applied to the additional bar element if `variant="buffer"` and `color="primary"`. */
23153 dashedColorPrimary: {
23154 backgroundImage: "radial-gradient(".concat(backgroundPrimary, " 0%, ").concat(backgroundPrimary, " 16%, transparent 42%)"),
23155 backgroundSize: '10px 10px',
23156 backgroundPosition: '0 -23px'
23157 },
23158
23159 /* Styles applied to the additional bar element if `variant="buffer"` and `color="secondary"`. */
23160 dashedColorSecondary: {
23161 backgroundImage: "radial-gradient(".concat(backgroundSecondary, " 0%, ").concat(backgroundSecondary, " 16%, transparent 42%)"),
23162 backgroundSize: '10px 10px',
23163 backgroundPosition: '0 -23px'
23164 },
23165
23166 /* Styles applied to the layered bar1 and bar2 elements. */
23167 bar: {
23168 width: '100%',
23169 position: 'absolute',
23170 left: 0,
23171 bottom: 0,
23172 top: 0,
23173 transition: 'transform 0.2s linear',
23174 transformOrigin: 'left'
23175 },
23176
23177 /* Styles applied to the bar elements if `color="primary"`; bar2 if `variant` not "buffer". */
23178 barColorPrimary: {
23179 backgroundColor: theme.palette.primary.main
23180 },
23181
23182 /* Styles applied to the bar elements if `color="secondary"`; bar2 if `variant` not "buffer". */
23183 barColorSecondary: {
23184 backgroundColor: theme.palette.secondary.main
23185 },
23186
23187 /* Styles applied to the bar1 element if `variant="indeterminate or query"`. */
23188 bar1Indeterminate: {
23189 width: 'auto',
23190 animation: '$indeterminate1 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite'
23191 },
23192
23193 /* Styles applied to the bar1 element if `variant="determinate"`. */
23194 bar1Determinate: {
23195 transition: "transform .".concat(TRANSITION_DURATION, "s linear")
23196 },
23197
23198 /* Styles applied to the bar1 element if `variant="buffer"`. */
23199 bar1Buffer: {
23200 zIndex: 1,
23201 transition: "transform .".concat(TRANSITION_DURATION, "s linear")
23202 },
23203
23204 /* Styles applied to the bar2 element if `variant="indeterminate or query"`. */
23205 bar2Indeterminate: {
23206 width: 'auto',
23207 animation: '$indeterminate2 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite'
23208 },
23209
23210 /* Styles applied to the bar2 element if `variant="buffer"`. */
23211 bar2Buffer: {
23212 transition: "transform .".concat(TRANSITION_DURATION, "s linear")
23213 },
23214 // Legends:
23215 // || represents the viewport
23216 // - represents a light background
23217 // x represents a dark background
23218 '@keyframes indeterminate1': {
23219 // |-----|---x-||-----||-----|
23220 '0%': {
23221 left: '-35%',
23222 right: '100%'
23223 },
23224 // |-----|-----||-----||xxxx-|
23225 '60%': {
23226 left: '100%',
23227 right: '-90%'
23228 },
23229 '100%': {
23230 left: '100%',
23231 right: '-90%'
23232 }
23233 },
23234 '@keyframes indeterminate2': {
23235 // |xxxxx|xxxxx||-----||-----|
23236 '0%': {
23237 left: '-200%',
23238 right: '100%'
23239 },
23240 // |-----|-----||-----||-x----|
23241 '60%': {
23242 left: '107%',
23243 right: '-8%'
23244 },
23245 '100%': {
23246 left: '107%',
23247 right: '-8%'
23248 }
23249 },
23250 '@keyframes buffer': {
23251 '0%': {
23252 opacity: 1,
23253 backgroundPosition: '0 -23px'
23254 },
23255 '50%': {
23256 opacity: 0,
23257 backgroundPosition: '0 -23px'
23258 },
23259 '100%': {
23260 opacity: 1,
23261 backgroundPosition: '-200px -23px'
23262 }
23263 }
23264 };
23265 };
23266 /**
23267 * ## ARIA
23268 *
23269 * If the progress bar is describing the loading progress of a particular region of a page,
23270 * you should use `aria-describedby` to point to the progress bar, and set the `aria-busy`
23271 * attribute to `true` on that region until it has finished loading.
23272 */
23273
23274 var LinearProgress = /*#__PURE__*/react.exports.forwardRef(function LinearProgress(props, ref) {
23275 var classes = props.classes,
23276 className = props.className,
23277 _props$color = props.color,
23278 color = _props$color === void 0 ? 'primary' : _props$color,
23279 value = props.value,
23280 valueBuffer = props.valueBuffer,
23281 _props$variant = props.variant,
23282 variant = _props$variant === void 0 ? 'indeterminate' : _props$variant,
23283 other = _objectWithoutProperties(props, ["classes", "className", "color", "value", "valueBuffer", "variant"]);
23284
23285 var theme = useTheme$1();
23286 var rootProps = {};
23287 var inlineStyles = {
23288 bar1: {},
23289 bar2: {}
23290 };
23291
23292 if (variant === 'determinate' || variant === 'buffer') {
23293 if (value !== undefined) {
23294 rootProps['aria-valuenow'] = Math.round(value);
23295 rootProps['aria-valuemin'] = 0;
23296 rootProps['aria-valuemax'] = 100;
23297 var transform = value - 100;
23298
23299 if (theme.direction === 'rtl') {
23300 transform = -transform;
23301 }
23302
23303 inlineStyles.bar1.transform = "translateX(".concat(transform, "%)");
23304 }
23305 }
23306
23307 if (variant === 'buffer') {
23308 if (valueBuffer !== undefined) {
23309 var _transform = (valueBuffer || 0) - 100;
23310
23311 if (theme.direction === 'rtl') {
23312 _transform = -_transform;
23313 }
23314
23315 inlineStyles.bar2.transform = "translateX(".concat(_transform, "%)");
23316 }
23317 }
23318
23319 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
23320 className: clsx(classes.root, classes["color".concat(capitalize(color))], className, {
23321 'determinate': classes.determinate,
23322 'indeterminate': classes.indeterminate,
23323 'buffer': classes.buffer,
23324 'query': classes.query
23325 }[variant]),
23326 role: "progressbar"
23327 }, rootProps, {
23328 ref: ref
23329 }, other), variant === 'buffer' ? /*#__PURE__*/react.exports.createElement("div", {
23330 className: clsx(classes.dashed, classes["dashedColor".concat(capitalize(color))])
23331 }) : null, /*#__PURE__*/react.exports.createElement("div", {
23332 className: clsx(classes.bar, classes["barColor".concat(capitalize(color))], (variant === 'indeterminate' || variant === 'query') && classes.bar1Indeterminate, {
23333 'determinate': classes.bar1Determinate,
23334 'buffer': classes.bar1Buffer
23335 }[variant]),
23336 style: inlineStyles.bar1
23337 }), variant === 'determinate' ? null : /*#__PURE__*/react.exports.createElement("div", {
23338 className: clsx(classes.bar, (variant === 'indeterminate' || variant === 'query') && classes.bar2Indeterminate, variant === 'buffer' ? [classes["color".concat(capitalize(color))], classes.bar2Buffer] : classes["barColor".concat(capitalize(color))]),
23339 style: inlineStyles.bar2
23340 }));
23341 });
23342 var LinearProgress$1 = withStyles(styles$M, {
23343 name: 'MuiLinearProgress'
23344 })(LinearProgress);
23345
23346 var styles$L = {
23347 /* Styles applied to the root element. */
23348 root: {},
23349
23350 /* Styles applied to the root element if `underline="none"`. */
23351 underlineNone: {
23352 textDecoration: 'none'
23353 },
23354
23355 /* Styles applied to the root element if `underline="hover"`. */
23356 underlineHover: {
23357 textDecoration: 'none',
23358 '&:hover': {
23359 textDecoration: 'underline'
23360 }
23361 },
23362
23363 /* Styles applied to the root element if `underline="always"`. */
23364 underlineAlways: {
23365 textDecoration: 'underline'
23366 },
23367 // Same reset as ButtonBase.root
23368
23369 /* Styles applied to the root element if `component="button"`. */
23370 button: {
23371 position: 'relative',
23372 WebkitTapHighlightColor: 'transparent',
23373 backgroundColor: 'transparent',
23374 // Reset default value
23375 // We disable the focus ring for mouse, touch and keyboard users.
23376 outline: 0,
23377 border: 0,
23378 margin: 0,
23379 // Remove the margin in Safari
23380 borderRadius: 0,
23381 padding: 0,
23382 // Remove the padding in Firefox
23383 cursor: 'pointer',
23384 userSelect: 'none',
23385 verticalAlign: 'middle',
23386 '-moz-appearance': 'none',
23387 // Reset
23388 '-webkit-appearance': 'none',
23389 // Reset
23390 '&::-moz-focus-inner': {
23391 borderStyle: 'none' // Remove Firefox dotted outline.
23392
23393 },
23394 '&$focusVisible': {
23395 outline: 'auto'
23396 }
23397 },
23398
23399 /* Pseudo-class applied to the root element if the link is keyboard focused. */
23400 focusVisible: {}
23401 };
23402 var Link = /*#__PURE__*/react.exports.forwardRef(function Link(props, ref) {
23403 var classes = props.classes,
23404 className = props.className,
23405 _props$color = props.color,
23406 color = _props$color === void 0 ? 'primary' : _props$color,
23407 _props$component = props.component,
23408 component = _props$component === void 0 ? 'a' : _props$component,
23409 onBlur = props.onBlur,
23410 onFocus = props.onFocus,
23411 TypographyClasses = props.TypographyClasses,
23412 _props$underline = props.underline,
23413 underline = _props$underline === void 0 ? 'hover' : _props$underline,
23414 _props$variant = props.variant,
23415 variant = _props$variant === void 0 ? 'inherit' : _props$variant,
23416 other = _objectWithoutProperties(props, ["classes", "className", "color", "component", "onBlur", "onFocus", "TypographyClasses", "underline", "variant"]);
23417
23418 var _useIsFocusVisible = useIsFocusVisible(),
23419 isFocusVisible = _useIsFocusVisible.isFocusVisible,
23420 onBlurVisible = _useIsFocusVisible.onBlurVisible,
23421 focusVisibleRef = _useIsFocusVisible.ref;
23422
23423 var _React$useState = react.exports.useState(false),
23424 focusVisible = _React$useState[0],
23425 setFocusVisible = _React$useState[1];
23426
23427 var handlerRef = useForkRef(ref, focusVisibleRef);
23428
23429 var handleBlur = function handleBlur(event) {
23430 if (focusVisible) {
23431 onBlurVisible();
23432 setFocusVisible(false);
23433 }
23434
23435 if (onBlur) {
23436 onBlur(event);
23437 }
23438 };
23439
23440 var handleFocus = function handleFocus(event) {
23441 if (isFocusVisible(event)) {
23442 setFocusVisible(true);
23443 }
23444
23445 if (onFocus) {
23446 onFocus(event);
23447 }
23448 };
23449
23450 return /*#__PURE__*/react.exports.createElement(Typography$1, _extends$5({
23451 className: clsx(classes.root, classes["underline".concat(capitalize(underline))], className, focusVisible && classes.focusVisible, component === 'button' && classes.button),
23452 classes: TypographyClasses,
23453 color: color,
23454 component: component,
23455 onBlur: handleBlur,
23456 onFocus: handleFocus,
23457 ref: handlerRef,
23458 variant: variant
23459 }, other));
23460 });
23461 withStyles(styles$L, {
23462 name: 'MuiLink'
23463 })(Link);
23464
23465 /**
23466 * @ignore - internal component.
23467 */
23468
23469 var ListContext = react.exports.createContext({});
23470
23471 var styles$K = {
23472 /* Styles applied to the root element. */
23473 root: {
23474 listStyle: 'none',
23475 margin: 0,
23476 padding: 0,
23477 position: 'relative'
23478 },
23479
23480 /* Styles applied to the root element if `disablePadding={false}`. */
23481 padding: {
23482 paddingTop: 8,
23483 paddingBottom: 8
23484 },
23485
23486 /* Styles applied to the root element if dense. */
23487 dense: {},
23488
23489 /* Styles applied to the root element if a `subheader` is provided. */
23490 subheader: {
23491 paddingTop: 0
23492 }
23493 };
23494 var List = /*#__PURE__*/react.exports.forwardRef(function List(props, ref) {
23495 var children = props.children,
23496 classes = props.classes,
23497 className = props.className,
23498 _props$component = props.component,
23499 Component = _props$component === void 0 ? 'ul' : _props$component,
23500 _props$dense = props.dense,
23501 dense = _props$dense === void 0 ? false : _props$dense,
23502 _props$disablePadding = props.disablePadding,
23503 disablePadding = _props$disablePadding === void 0 ? false : _props$disablePadding,
23504 subheader = props.subheader,
23505 other = _objectWithoutProperties(props, ["children", "classes", "className", "component", "dense", "disablePadding", "subheader"]);
23506
23507 var context = react.exports.useMemo(function () {
23508 return {
23509 dense: dense
23510 };
23511 }, [dense]);
23512 return /*#__PURE__*/react.exports.createElement(ListContext.Provider, {
23513 value: context
23514 }, /*#__PURE__*/react.exports.createElement(Component, _extends$5({
23515 className: clsx(classes.root, className, dense && classes.dense, !disablePadding && classes.padding, subheader && classes.subheader),
23516 ref: ref
23517 }, other), subheader, children));
23518 });
23519 var List$1 = withStyles(styles$K, {
23520 name: 'MuiList'
23521 })(List);
23522
23523 var styles$J = function styles(theme) {
23524 return {
23525 /* Styles applied to the (normally root) `component` element. May be wrapped by a `container`. */
23526 root: {
23527 display: 'flex',
23528 justifyContent: 'flex-start',
23529 alignItems: 'center',
23530 position: 'relative',
23531 textDecoration: 'none',
23532 width: '100%',
23533 boxSizing: 'border-box',
23534 textAlign: 'left',
23535 paddingTop: 8,
23536 paddingBottom: 8,
23537 '&$focusVisible': {
23538 backgroundColor: theme.palette.action.selected
23539 },
23540 '&$selected, &$selected:hover': {
23541 backgroundColor: theme.palette.action.selected
23542 },
23543 '&$disabled': {
23544 opacity: 0.5
23545 }
23546 },
23547
23548 /* Styles applied to the `container` element if `children` includes `ListItemSecondaryAction`. */
23549 container: {
23550 position: 'relative'
23551 },
23552
23553 /* Pseudo-class applied to the `component`'s `focusVisibleClassName` prop if `button={true}`. */
23554 focusVisible: {},
23555
23556 /* Styles applied to the `component` element if dense. */
23557 dense: {
23558 paddingTop: 4,
23559 paddingBottom: 4
23560 },
23561
23562 /* Styles applied to the `component` element if `alignItems="flex-start"`. */
23563 alignItemsFlexStart: {
23564 alignItems: 'flex-start'
23565 },
23566
23567 /* Pseudo-class applied to the inner `component` element if `disabled={true}`. */
23568 disabled: {},
23569
23570 /* Styles applied to the inner `component` element if `divider={true}`. */
23571 divider: {
23572 borderBottom: "1px solid ".concat(theme.palette.divider),
23573 backgroundClip: 'padding-box'
23574 },
23575
23576 /* Styles applied to the inner `component` element if `disableGutters={false}`. */
23577 gutters: {
23578 paddingLeft: 16,
23579 paddingRight: 16
23580 },
23581
23582 /* Styles applied to the inner `component` element if `button={true}`. */
23583 button: {
23584 transition: theme.transitions.create('background-color', {
23585 duration: theme.transitions.duration.shortest
23586 }),
23587 '&:hover': {
23588 textDecoration: 'none',
23589 backgroundColor: theme.palette.action.hover,
23590 // Reset on touch devices, it doesn't add specificity
23591 '@media (hover: none)': {
23592 backgroundColor: 'transparent'
23593 }
23594 }
23595 },
23596
23597 /* Styles applied to the `component` element if `children` includes `ListItemSecondaryAction`. */
23598 secondaryAction: {
23599 // Add some space to avoid collision as `ListItemSecondaryAction`
23600 // is absolutely positioned.
23601 paddingRight: 48
23602 },
23603
23604 /* Pseudo-class applied to the root element if `selected={true}`. */
23605 selected: {}
23606 };
23607 };
23608 var useEnhancedEffect$2 = typeof window === 'undefined' ? react.exports.useEffect : react.exports.useLayoutEffect;
23609 /**
23610 * Uses an additional container component if `ListItemSecondaryAction` is the last child.
23611 */
23612
23613 var ListItem = /*#__PURE__*/react.exports.forwardRef(function ListItem(props, ref) {
23614 var _props$alignItems = props.alignItems,
23615 alignItems = _props$alignItems === void 0 ? 'center' : _props$alignItems,
23616 _props$autoFocus = props.autoFocus,
23617 autoFocus = _props$autoFocus === void 0 ? false : _props$autoFocus,
23618 _props$button = props.button,
23619 button = _props$button === void 0 ? false : _props$button,
23620 childrenProp = props.children,
23621 classes = props.classes,
23622 className = props.className,
23623 componentProp = props.component,
23624 _props$ContainerCompo = props.ContainerComponent,
23625 ContainerComponent = _props$ContainerCompo === void 0 ? 'li' : _props$ContainerCompo,
23626 _props$ContainerProps = props.ContainerProps;
23627 _props$ContainerProps = _props$ContainerProps === void 0 ? {} : _props$ContainerProps;
23628
23629 var ContainerClassName = _props$ContainerProps.className,
23630 ContainerProps = _objectWithoutProperties(_props$ContainerProps, ["className"]),
23631 _props$dense = props.dense,
23632 dense = _props$dense === void 0 ? false : _props$dense,
23633 _props$disabled = props.disabled,
23634 disabled = _props$disabled === void 0 ? false : _props$disabled,
23635 _props$disableGutters = props.disableGutters,
23636 disableGutters = _props$disableGutters === void 0 ? false : _props$disableGutters,
23637 _props$divider = props.divider,
23638 divider = _props$divider === void 0 ? false : _props$divider,
23639 focusVisibleClassName = props.focusVisibleClassName,
23640 _props$selected = props.selected,
23641 selected = _props$selected === void 0 ? false : _props$selected,
23642 other = _objectWithoutProperties(props, ["alignItems", "autoFocus", "button", "children", "classes", "className", "component", "ContainerComponent", "ContainerProps", "dense", "disabled", "disableGutters", "divider", "focusVisibleClassName", "selected"]);
23643
23644 var context = react.exports.useContext(ListContext);
23645 var childContext = {
23646 dense: dense || context.dense || false,
23647 alignItems: alignItems
23648 };
23649 var listItemRef = react.exports.useRef(null);
23650 useEnhancedEffect$2(function () {
23651 if (autoFocus) {
23652 if (listItemRef.current) {
23653 listItemRef.current.focus();
23654 }
23655 }
23656 }, [autoFocus]);
23657 var children = react.exports.Children.toArray(childrenProp);
23658 var hasSecondaryAction = children.length && isMuiElement(children[children.length - 1], ['ListItemSecondaryAction']);
23659 var handleOwnRef = react.exports.useCallback(function (instance) {
23660 // #StrictMode ready
23661 listItemRef.current = reactDom.exports.findDOMNode(instance);
23662 }, []);
23663 var handleRef = useForkRef(handleOwnRef, ref);
23664
23665 var componentProps = _extends$5({
23666 className: clsx(classes.root, className, childContext.dense && classes.dense, !disableGutters && classes.gutters, divider && classes.divider, disabled && classes.disabled, button && classes.button, alignItems !== "center" && classes.alignItemsFlexStart, hasSecondaryAction && classes.secondaryAction, selected && classes.selected),
23667 disabled: disabled
23668 }, other);
23669
23670 var Component = componentProp || 'li';
23671
23672 if (button) {
23673 componentProps.component = componentProp || 'div';
23674 componentProps.focusVisibleClassName = clsx(classes.focusVisible, focusVisibleClassName);
23675 Component = ButtonBase$1;
23676 }
23677
23678 if (hasSecondaryAction) {
23679 // Use div by default.
23680 Component = !componentProps.component && !componentProp ? 'div' : Component; // Avoid nesting of li > li.
23681
23682 if (ContainerComponent === 'li') {
23683 if (Component === 'li') {
23684 Component = 'div';
23685 } else if (componentProps.component === 'li') {
23686 componentProps.component = 'div';
23687 }
23688 }
23689
23690 return /*#__PURE__*/react.exports.createElement(ListContext.Provider, {
23691 value: childContext
23692 }, /*#__PURE__*/react.exports.createElement(ContainerComponent, _extends$5({
23693 className: clsx(classes.container, ContainerClassName),
23694 ref: handleRef
23695 }, ContainerProps), /*#__PURE__*/react.exports.createElement(Component, componentProps, children), children.pop()));
23696 }
23697
23698 return /*#__PURE__*/react.exports.createElement(ListContext.Provider, {
23699 value: childContext
23700 }, /*#__PURE__*/react.exports.createElement(Component, _extends$5({
23701 ref: handleRef
23702 }, componentProps), children));
23703 });
23704 var ListItem$1 = withStyles(styles$J, {
23705 name: 'MuiListItem'
23706 })(ListItem);
23707
23708 var styles$I = {
23709 /* Styles applied to the root element. */
23710 root: {
23711 minWidth: 56,
23712 flexShrink: 0
23713 },
23714
23715 /* Styles applied to the root element when the parent `ListItem` uses `alignItems="flex-start"`. */
23716 alignItemsFlexStart: {
23717 marginTop: 8
23718 }
23719 };
23720 /**
23721 * A simple wrapper to apply `List` styles to an `Avatar`.
23722 */
23723
23724 var ListItemAvatar = /*#__PURE__*/react.exports.forwardRef(function ListItemAvatar(props, ref) {
23725 var classes = props.classes,
23726 className = props.className,
23727 other = _objectWithoutProperties(props, ["classes", "className"]);
23728
23729 var context = react.exports.useContext(ListContext);
23730 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
23731 className: clsx(classes.root, className, context.alignItems === 'flex-start' && classes.alignItemsFlexStart),
23732 ref: ref
23733 }, other));
23734 });
23735 withStyles(styles$I, {
23736 name: 'MuiListItemAvatar'
23737 })(ListItemAvatar);
23738
23739 var styles$H = function styles(theme) {
23740 return {
23741 /* Styles applied to the root element. */
23742 root: {
23743 minWidth: 56,
23744 color: theme.palette.action.active,
23745 flexShrink: 0,
23746 display: 'inline-flex'
23747 },
23748
23749 /* Styles applied to the root element when the parent `ListItem` uses `alignItems="flex-start"`. */
23750 alignItemsFlexStart: {
23751 marginTop: 8
23752 }
23753 };
23754 };
23755 /**
23756 * A simple wrapper to apply `List` styles to an `Icon` or `SvgIcon`.
23757 */
23758
23759 var ListItemIcon = /*#__PURE__*/react.exports.forwardRef(function ListItemIcon(props, ref) {
23760 var classes = props.classes,
23761 className = props.className,
23762 other = _objectWithoutProperties(props, ["classes", "className"]);
23763
23764 var context = react.exports.useContext(ListContext);
23765 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
23766 className: clsx(classes.root, className, context.alignItems === 'flex-start' && classes.alignItemsFlexStart),
23767 ref: ref
23768 }, other));
23769 });
23770 var ListItemIcon$1 = withStyles(styles$H, {
23771 name: 'MuiListItemIcon'
23772 })(ListItemIcon);
23773
23774 var styles$G = {
23775 /* Styles applied to the root element. */
23776 root: {
23777 position: 'absolute',
23778 right: 16,
23779 top: '50%',
23780 transform: 'translateY(-50%)'
23781 }
23782 };
23783 /**
23784 * Must be used as the last child of ListItem to function properly.
23785 */
23786
23787 var ListItemSecondaryAction = /*#__PURE__*/react.exports.forwardRef(function ListItemSecondaryAction(props, ref) {
23788 var classes = props.classes,
23789 className = props.className,
23790 other = _objectWithoutProperties(props, ["classes", "className"]);
23791
23792 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
23793 className: clsx(classes.root, className),
23794 ref: ref
23795 }, other));
23796 });
23797 ListItemSecondaryAction.muiName = 'ListItemSecondaryAction';
23798 withStyles(styles$G, {
23799 name: 'MuiListItemSecondaryAction'
23800 })(ListItemSecondaryAction);
23801
23802 var styles$F = {
23803 /* Styles applied to the root element. */
23804 root: {
23805 flex: '1 1 auto',
23806 minWidth: 0,
23807 marginTop: 4,
23808 marginBottom: 4
23809 },
23810
23811 /* Styles applied to the `Typography` components if primary and secondary are set. */
23812 multiline: {
23813 marginTop: 6,
23814 marginBottom: 6
23815 },
23816
23817 /* Styles applied to the `Typography` components if dense. */
23818 dense: {},
23819
23820 /* Styles applied to the root element if `inset={true}`. */
23821 inset: {
23822 paddingLeft: 56
23823 },
23824
23825 /* Styles applied to the primary `Typography` component. */
23826 primary: {},
23827
23828 /* Styles applied to the secondary `Typography` component. */
23829 secondary: {}
23830 };
23831 var ListItemText = /*#__PURE__*/react.exports.forwardRef(function ListItemText(props, ref) {
23832 var children = props.children,
23833 classes = props.classes,
23834 className = props.className,
23835 _props$disableTypogra = props.disableTypography,
23836 disableTypography = _props$disableTypogra === void 0 ? false : _props$disableTypogra,
23837 _props$inset = props.inset,
23838 inset = _props$inset === void 0 ? false : _props$inset,
23839 primaryProp = props.primary,
23840 primaryTypographyProps = props.primaryTypographyProps,
23841 secondaryProp = props.secondary,
23842 secondaryTypographyProps = props.secondaryTypographyProps,
23843 other = _objectWithoutProperties(props, ["children", "classes", "className", "disableTypography", "inset", "primary", "primaryTypographyProps", "secondary", "secondaryTypographyProps"]);
23844
23845 var _React$useContext = react.exports.useContext(ListContext),
23846 dense = _React$useContext.dense;
23847
23848 var primary = primaryProp != null ? primaryProp : children;
23849
23850 if (primary != null && primary.type !== Typography$1 && !disableTypography) {
23851 primary = /*#__PURE__*/react.exports.createElement(Typography$1, _extends$5({
23852 variant: dense ? 'body2' : 'body1',
23853 className: classes.primary,
23854 component: "span",
23855 display: "block"
23856 }, primaryTypographyProps), primary);
23857 }
23858
23859 var secondary = secondaryProp;
23860
23861 if (secondary != null && secondary.type !== Typography$1 && !disableTypography) {
23862 secondary = /*#__PURE__*/react.exports.createElement(Typography$1, _extends$5({
23863 variant: "body2",
23864 className: classes.secondary,
23865 color: "textSecondary",
23866 display: "block"
23867 }, secondaryTypographyProps), secondary);
23868 }
23869
23870 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
23871 className: clsx(classes.root, className, dense && classes.dense, inset && classes.inset, primary && secondary && classes.multiline),
23872 ref: ref
23873 }, other), primary, secondary);
23874 });
23875 withStyles(styles$F, {
23876 name: 'MuiListItemText'
23877 })(ListItemText);
23878
23879 var styles$E = function styles(theme) {
23880 return {
23881 /* Styles applied to the root element. */
23882 root: {
23883 boxSizing: 'border-box',
23884 lineHeight: '48px',
23885 listStyle: 'none',
23886 color: theme.palette.text.secondary,
23887 fontFamily: theme.typography.fontFamily,
23888 fontWeight: theme.typography.fontWeightMedium,
23889 fontSize: theme.typography.pxToRem(14)
23890 },
23891
23892 /* Styles applied to the root element if `color="primary"`. */
23893 colorPrimary: {
23894 color: theme.palette.primary.main
23895 },
23896
23897 /* Styles applied to the root element if `color="inherit"`. */
23898 colorInherit: {
23899 color: 'inherit'
23900 },
23901
23902 /* Styles applied to the inner `component` element if `disableGutters={false}`. */
23903 gutters: {
23904 paddingLeft: 16,
23905 paddingRight: 16
23906 },
23907
23908 /* Styles applied to the root element if `inset={true}`. */
23909 inset: {
23910 paddingLeft: 72
23911 },
23912
23913 /* Styles applied to the root element if `disableSticky={false}`. */
23914 sticky: {
23915 position: 'sticky',
23916 top: 0,
23917 zIndex: 1,
23918 backgroundColor: 'inherit'
23919 }
23920 };
23921 };
23922 var ListSubheader = /*#__PURE__*/react.exports.forwardRef(function ListSubheader(props, ref) {
23923 var classes = props.classes,
23924 className = props.className,
23925 _props$color = props.color,
23926 color = _props$color === void 0 ? 'default' : _props$color,
23927 _props$component = props.component,
23928 Component = _props$component === void 0 ? 'li' : _props$component,
23929 _props$disableGutters = props.disableGutters,
23930 disableGutters = _props$disableGutters === void 0 ? false : _props$disableGutters,
23931 _props$disableSticky = props.disableSticky,
23932 disableSticky = _props$disableSticky === void 0 ? false : _props$disableSticky,
23933 _props$inset = props.inset,
23934 inset = _props$inset === void 0 ? false : _props$inset,
23935 other = _objectWithoutProperties(props, ["classes", "className", "color", "component", "disableGutters", "disableSticky", "inset"]);
23936
23937 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
23938 className: clsx(classes.root, className, color !== 'default' && classes["color".concat(capitalize(color))], inset && classes.inset, !disableSticky && classes.sticky, !disableGutters && classes.gutters),
23939 ref: ref
23940 }, other));
23941 });
23942 withStyles(styles$E, {
23943 name: 'MuiListSubheader'
23944 })(ListSubheader);
23945
23946 function getOffsetTop(rect, vertical) {
23947 var offset = 0;
23948
23949 if (typeof vertical === 'number') {
23950 offset = vertical;
23951 } else if (vertical === 'center') {
23952 offset = rect.height / 2;
23953 } else if (vertical === 'bottom') {
23954 offset = rect.height;
23955 }
23956
23957 return offset;
23958 }
23959 function getOffsetLeft(rect, horizontal) {
23960 var offset = 0;
23961
23962 if (typeof horizontal === 'number') {
23963 offset = horizontal;
23964 } else if (horizontal === 'center') {
23965 offset = rect.width / 2;
23966 } else if (horizontal === 'right') {
23967 offset = rect.width;
23968 }
23969
23970 return offset;
23971 }
23972
23973 function getTransformOriginValue(transformOrigin) {
23974 return [transformOrigin.horizontal, transformOrigin.vertical].map(function (n) {
23975 return typeof n === 'number' ? "".concat(n, "px") : n;
23976 }).join(' ');
23977 } // Sum the scrollTop between two elements.
23978
23979
23980 function getScrollParent$1(parent, child) {
23981 var element = child;
23982 var scrollTop = 0;
23983
23984 while (element && element !== parent) {
23985 element = element.parentElement;
23986 scrollTop += element.scrollTop;
23987 }
23988
23989 return scrollTop;
23990 }
23991
23992 function getAnchorEl$1(anchorEl) {
23993 return typeof anchorEl === 'function' ? anchorEl() : anchorEl;
23994 }
23995
23996 var styles$D = {
23997 /* Styles applied to the root element. */
23998 root: {},
23999
24000 /* Styles applied to the `Paper` component. */
24001 paper: {
24002 position: 'absolute',
24003 overflowY: 'auto',
24004 overflowX: 'hidden',
24005 // So we see the popover when it's empty.
24006 // It's most likely on issue on userland.
24007 minWidth: 16,
24008 minHeight: 16,
24009 maxWidth: 'calc(100% - 32px)',
24010 maxHeight: 'calc(100% - 32px)',
24011 // We disable the focus ring for mouse, touch and keyboard users.
24012 outline: 0
24013 }
24014 };
24015 var Popover = /*#__PURE__*/react.exports.forwardRef(function Popover(props, ref) {
24016 var action = props.action,
24017 anchorEl = props.anchorEl,
24018 _props$anchorOrigin = props.anchorOrigin,
24019 anchorOrigin = _props$anchorOrigin === void 0 ? {
24020 vertical: 'top',
24021 horizontal: 'left'
24022 } : _props$anchorOrigin,
24023 anchorPosition = props.anchorPosition,
24024 _props$anchorReferenc = props.anchorReference,
24025 anchorReference = _props$anchorReferenc === void 0 ? 'anchorEl' : _props$anchorReferenc,
24026 children = props.children,
24027 classes = props.classes,
24028 className = props.className,
24029 containerProp = props.container,
24030 _props$elevation = props.elevation,
24031 elevation = _props$elevation === void 0 ? 8 : _props$elevation,
24032 getContentAnchorEl = props.getContentAnchorEl,
24033 _props$marginThreshol = props.marginThreshold,
24034 marginThreshold = _props$marginThreshol === void 0 ? 16 : _props$marginThreshol,
24035 onEnter = props.onEnter,
24036 onEntered = props.onEntered,
24037 onEntering = props.onEntering,
24038 onExit = props.onExit,
24039 onExited = props.onExited,
24040 onExiting = props.onExiting,
24041 open = props.open,
24042 _props$PaperProps = props.PaperProps,
24043 PaperProps = _props$PaperProps === void 0 ? {} : _props$PaperProps,
24044 _props$transformOrigi = props.transformOrigin,
24045 transformOrigin = _props$transformOrigi === void 0 ? {
24046 vertical: 'top',
24047 horizontal: 'left'
24048 } : _props$transformOrigi,
24049 _props$TransitionComp = props.TransitionComponent,
24050 TransitionComponent = _props$TransitionComp === void 0 ? Grow : _props$TransitionComp,
24051 _props$transitionDura = props.transitionDuration,
24052 transitionDurationProp = _props$transitionDura === void 0 ? 'auto' : _props$transitionDura,
24053 _props$TransitionProp = props.TransitionProps,
24054 TransitionProps = _props$TransitionProp === void 0 ? {} : _props$TransitionProp,
24055 other = _objectWithoutProperties(props, ["action", "anchorEl", "anchorOrigin", "anchorPosition", "anchorReference", "children", "classes", "className", "container", "elevation", "getContentAnchorEl", "marginThreshold", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "open", "PaperProps", "transformOrigin", "TransitionComponent", "transitionDuration", "TransitionProps"]);
24056
24057 var paperRef = react.exports.useRef(); // Returns the top/left offset of the position
24058 // to attach to on the anchor element (or body if none is provided)
24059
24060 var getAnchorOffset = react.exports.useCallback(function (contentAnchorOffset) {
24061 if (anchorReference === 'anchorPosition') {
24062
24063 return anchorPosition;
24064 }
24065
24066 var resolvedAnchorEl = getAnchorEl$1(anchorEl); // If an anchor element wasn't provided, just use the parent body element of this Popover
24067
24068 var anchorElement = resolvedAnchorEl && resolvedAnchorEl.nodeType === 1 ? resolvedAnchorEl : ownerDocument(paperRef.current).body;
24069 var anchorRect = anchorElement.getBoundingClientRect();
24070
24071 var anchorVertical = contentAnchorOffset === 0 ? anchorOrigin.vertical : 'center';
24072 return {
24073 top: anchorRect.top + getOffsetTop(anchorRect, anchorVertical),
24074 left: anchorRect.left + getOffsetLeft(anchorRect, anchorOrigin.horizontal)
24075 };
24076 }, [anchorEl, anchorOrigin.horizontal, anchorOrigin.vertical, anchorPosition, anchorReference]); // Returns the vertical offset of inner content to anchor the transform on if provided
24077
24078 var getContentAnchorOffset = react.exports.useCallback(function (element) {
24079 var contentAnchorOffset = 0;
24080
24081 if (getContentAnchorEl && anchorReference === 'anchorEl') {
24082 var contentAnchorEl = getContentAnchorEl(element);
24083
24084 if (contentAnchorEl && element.contains(contentAnchorEl)) {
24085 var scrollTop = getScrollParent$1(element, contentAnchorEl);
24086 contentAnchorOffset = contentAnchorEl.offsetTop + contentAnchorEl.clientHeight / 2 - scrollTop || 0;
24087 } // != the default value
24088 }
24089
24090 return contentAnchorOffset;
24091 }, [anchorOrigin.vertical, anchorReference, getContentAnchorEl]); // Return the base transform origin using the element
24092 // and taking the content anchor offset into account if in use
24093
24094 var getTransformOrigin = react.exports.useCallback(function (elemRect) {
24095 var contentAnchorOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
24096 return {
24097 vertical: getOffsetTop(elemRect, transformOrigin.vertical) + contentAnchorOffset,
24098 horizontal: getOffsetLeft(elemRect, transformOrigin.horizontal)
24099 };
24100 }, [transformOrigin.horizontal, transformOrigin.vertical]);
24101 var getPositioningStyle = react.exports.useCallback(function (element) {
24102 // Check if the parent has requested anchoring on an inner content node
24103 var contentAnchorOffset = getContentAnchorOffset(element);
24104 var elemRect = {
24105 width: element.offsetWidth,
24106 height: element.offsetHeight
24107 }; // Get the transform origin point on the element itself
24108
24109 var elemTransformOrigin = getTransformOrigin(elemRect, contentAnchorOffset);
24110
24111 if (anchorReference === 'none') {
24112 return {
24113 top: null,
24114 left: null,
24115 transformOrigin: getTransformOriginValue(elemTransformOrigin)
24116 };
24117 } // Get the offset of of the anchoring element
24118
24119
24120 var anchorOffset = getAnchorOffset(contentAnchorOffset); // Calculate element positioning
24121
24122 var top = anchorOffset.top - elemTransformOrigin.vertical;
24123 var left = anchorOffset.left - elemTransformOrigin.horizontal;
24124 var bottom = top + elemRect.height;
24125 var right = left + elemRect.width; // Use the parent window of the anchorEl if provided
24126
24127 var containerWindow = ownerWindow(getAnchorEl$1(anchorEl)); // Window thresholds taking required margin into account
24128
24129 var heightThreshold = containerWindow.innerHeight - marginThreshold;
24130 var widthThreshold = containerWindow.innerWidth - marginThreshold; // Check if the vertical axis needs shifting
24131
24132 if (top < marginThreshold) {
24133 var diff = top - marginThreshold;
24134 top -= diff;
24135 elemTransformOrigin.vertical += diff;
24136 } else if (bottom > heightThreshold) {
24137 var _diff = bottom - heightThreshold;
24138
24139 top -= _diff;
24140 elemTransformOrigin.vertical += _diff;
24141 }
24142
24143
24144 if (left < marginThreshold) {
24145 var _diff2 = left - marginThreshold;
24146
24147 left -= _diff2;
24148 elemTransformOrigin.horizontal += _diff2;
24149 } else if (right > widthThreshold) {
24150 var _diff3 = right - widthThreshold;
24151
24152 left -= _diff3;
24153 elemTransformOrigin.horizontal += _diff3;
24154 }
24155
24156 return {
24157 top: "".concat(Math.round(top), "px"),
24158 left: "".concat(Math.round(left), "px"),
24159 transformOrigin: getTransformOriginValue(elemTransformOrigin)
24160 };
24161 }, [anchorEl, anchorReference, getAnchorOffset, getContentAnchorOffset, getTransformOrigin, marginThreshold]);
24162 var setPositioningStyles = react.exports.useCallback(function () {
24163 var element = paperRef.current;
24164
24165 if (!element) {
24166 return;
24167 }
24168
24169 var positioning = getPositioningStyle(element);
24170
24171 if (positioning.top !== null) {
24172 element.style.top = positioning.top;
24173 }
24174
24175 if (positioning.left !== null) {
24176 element.style.left = positioning.left;
24177 }
24178
24179 element.style.transformOrigin = positioning.transformOrigin;
24180 }, [getPositioningStyle]);
24181
24182 var handleEntering = function handleEntering(element, isAppearing) {
24183 if (onEntering) {
24184 onEntering(element, isAppearing);
24185 }
24186
24187 setPositioningStyles();
24188 };
24189
24190 var handlePaperRef = react.exports.useCallback(function (instance) {
24191 // #StrictMode ready
24192 paperRef.current = reactDom.exports.findDOMNode(instance);
24193 }, []);
24194 react.exports.useEffect(function () {
24195 if (open) {
24196 setPositioningStyles();
24197 }
24198 });
24199 react.exports.useImperativeHandle(action, function () {
24200 return open ? {
24201 updatePosition: function updatePosition() {
24202 setPositioningStyles();
24203 }
24204 } : null;
24205 }, [open, setPositioningStyles]);
24206 react.exports.useEffect(function () {
24207 if (!open) {
24208 return undefined;
24209 }
24210
24211 var handleResize = debounce$1(function () {
24212 setPositioningStyles();
24213 });
24214 window.addEventListener('resize', handleResize);
24215 return function () {
24216 handleResize.clear();
24217 window.removeEventListener('resize', handleResize);
24218 };
24219 }, [open, setPositioningStyles]);
24220 var transitionDuration = transitionDurationProp;
24221
24222 if (transitionDurationProp === 'auto' && !TransitionComponent.muiSupportAuto) {
24223 transitionDuration = undefined;
24224 } // If the container prop is provided, use that
24225 // If the anchorEl prop is provided, use its parent body element as the container
24226 // If neither are provided let the Modal take care of choosing the container
24227
24228
24229 var container = containerProp || (anchorEl ? ownerDocument(getAnchorEl$1(anchorEl)).body : undefined);
24230 return /*#__PURE__*/react.exports.createElement(Modal, _extends$5({
24231 container: container,
24232 open: open,
24233 ref: ref,
24234 BackdropProps: {
24235 invisible: true
24236 },
24237 className: clsx(classes.root, className)
24238 }, other), /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
24239 appear: true,
24240 in: open,
24241 onEnter: onEnter,
24242 onEntered: onEntered,
24243 onExit: onExit,
24244 onExited: onExited,
24245 onExiting: onExiting,
24246 timeout: transitionDuration
24247 }, TransitionProps, {
24248 onEntering: createChainedFunction(handleEntering, TransitionProps.onEntering)
24249 }), /*#__PURE__*/react.exports.createElement(Paper$1, _extends$5({
24250 elevation: elevation,
24251 ref: handlePaperRef
24252 }, PaperProps, {
24253 className: clsx(classes.paper, PaperProps.className)
24254 }), children)));
24255 });
24256 var Popover$1 = withStyles(styles$D, {
24257 name: 'MuiPopover'
24258 })(Popover);
24259
24260 function nextItem(list, item, disableListWrap) {
24261 if (list === item) {
24262 return list.firstChild;
24263 }
24264
24265 if (item && item.nextElementSibling) {
24266 return item.nextElementSibling;
24267 }
24268
24269 return disableListWrap ? null : list.firstChild;
24270 }
24271
24272 function previousItem(list, item, disableListWrap) {
24273 if (list === item) {
24274 return disableListWrap ? list.firstChild : list.lastChild;
24275 }
24276
24277 if (item && item.previousElementSibling) {
24278 return item.previousElementSibling;
24279 }
24280
24281 return disableListWrap ? null : list.lastChild;
24282 }
24283
24284 function textCriteriaMatches(nextFocus, textCriteria) {
24285 if (textCriteria === undefined) {
24286 return true;
24287 }
24288
24289 var text = nextFocus.innerText;
24290
24291 if (text === undefined) {
24292 // jsdom doesn't support innerText
24293 text = nextFocus.textContent;
24294 }
24295
24296 text = text.trim().toLowerCase();
24297
24298 if (text.length === 0) {
24299 return false;
24300 }
24301
24302 if (textCriteria.repeating) {
24303 return text[0] === textCriteria.keys[0];
24304 }
24305
24306 return text.indexOf(textCriteria.keys.join('')) === 0;
24307 }
24308
24309 function moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, traversalFunction, textCriteria) {
24310 var wrappedOnce = false;
24311 var nextFocus = traversalFunction(list, currentFocus, currentFocus ? disableListWrap : false);
24312
24313 while (nextFocus) {
24314 // Prevent infinite loop.
24315 if (nextFocus === list.firstChild) {
24316 if (wrappedOnce) {
24317 return;
24318 }
24319
24320 wrappedOnce = true;
24321 } // Same logic as useAutocomplete.js
24322
24323
24324 var nextFocusDisabled = disabledItemsFocusable ? false : nextFocus.disabled || nextFocus.getAttribute('aria-disabled') === 'true';
24325
24326 if (!nextFocus.hasAttribute('tabindex') || !textCriteriaMatches(nextFocus, textCriteria) || nextFocusDisabled) {
24327 // Move to the next element.
24328 nextFocus = traversalFunction(list, nextFocus, disableListWrap);
24329 } else {
24330 nextFocus.focus();
24331 return;
24332 }
24333 }
24334 }
24335
24336 var useEnhancedEffect$1 = typeof window === 'undefined' ? react.exports.useEffect : react.exports.useLayoutEffect;
24337 /**
24338 * A permanently displayed menu following https://www.w3.org/TR/wai-aria-practices/#menubutton.
24339 * It's exposed to help customization of the [`Menu`](/api/menu/) component. If you
24340 * use it separately you need to move focus into the component manually. Once
24341 * the focus is placed inside the component it is fully keyboard accessible.
24342 */
24343
24344 var MenuList = /*#__PURE__*/react.exports.forwardRef(function MenuList(props, ref) {
24345 var actions = props.actions,
24346 _props$autoFocus = props.autoFocus,
24347 autoFocus = _props$autoFocus === void 0 ? false : _props$autoFocus,
24348 _props$autoFocusItem = props.autoFocusItem,
24349 autoFocusItem = _props$autoFocusItem === void 0 ? false : _props$autoFocusItem,
24350 children = props.children,
24351 className = props.className,
24352 _props$disabledItemsF = props.disabledItemsFocusable,
24353 disabledItemsFocusable = _props$disabledItemsF === void 0 ? false : _props$disabledItemsF,
24354 _props$disableListWra = props.disableListWrap,
24355 disableListWrap = _props$disableListWra === void 0 ? false : _props$disableListWra,
24356 onKeyDown = props.onKeyDown,
24357 _props$variant = props.variant,
24358 variant = _props$variant === void 0 ? 'selectedMenu' : _props$variant,
24359 other = _objectWithoutProperties(props, ["actions", "autoFocus", "autoFocusItem", "children", "className", "disabledItemsFocusable", "disableListWrap", "onKeyDown", "variant"]);
24360
24361 var listRef = react.exports.useRef(null);
24362 var textCriteriaRef = react.exports.useRef({
24363 keys: [],
24364 repeating: true,
24365 previousKeyMatched: true,
24366 lastTime: null
24367 });
24368 useEnhancedEffect$1(function () {
24369 if (autoFocus) {
24370 listRef.current.focus();
24371 }
24372 }, [autoFocus]);
24373 react.exports.useImperativeHandle(actions, function () {
24374 return {
24375 adjustStyleForScrollbar: function adjustStyleForScrollbar(containerElement, theme) {
24376 // Let's ignore that piece of logic if users are already overriding the width
24377 // of the menu.
24378 var noExplicitWidth = !listRef.current.style.width;
24379
24380 if (containerElement.clientHeight < listRef.current.clientHeight && noExplicitWidth) {
24381 var scrollbarSize = "".concat(getScrollbarSize(), "px");
24382 listRef.current.style[theme.direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
24383 listRef.current.style.width = "calc(100% + ".concat(scrollbarSize, ")");
24384 }
24385
24386 return listRef.current;
24387 }
24388 };
24389 }, []);
24390
24391 var handleKeyDown = function handleKeyDown(event) {
24392 var list = listRef.current;
24393 var key = event.key;
24394 /**
24395 * @type {Element} - will always be defined since we are in a keydown handler
24396 * attached to an element. A keydown event is either dispatched to the activeElement
24397 * or document.body or document.documentElement. Only the first case will
24398 * trigger this specific handler.
24399 */
24400
24401 var currentFocus = ownerDocument(list).activeElement;
24402
24403 if (key === 'ArrowDown') {
24404 // Prevent scroll of the page
24405 event.preventDefault();
24406 moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, nextItem);
24407 } else if (key === 'ArrowUp') {
24408 event.preventDefault();
24409 moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, previousItem);
24410 } else if (key === 'Home') {
24411 event.preventDefault();
24412 moveFocus(list, null, disableListWrap, disabledItemsFocusable, nextItem);
24413 } else if (key === 'End') {
24414 event.preventDefault();
24415 moveFocus(list, null, disableListWrap, disabledItemsFocusable, previousItem);
24416 } else if (key.length === 1) {
24417 var criteria = textCriteriaRef.current;
24418 var lowerKey = key.toLowerCase();
24419 var currTime = performance.now();
24420
24421 if (criteria.keys.length > 0) {
24422 // Reset
24423 if (currTime - criteria.lastTime > 500) {
24424 criteria.keys = [];
24425 criteria.repeating = true;
24426 criteria.previousKeyMatched = true;
24427 } else if (criteria.repeating && lowerKey !== criteria.keys[0]) {
24428 criteria.repeating = false;
24429 }
24430 }
24431
24432 criteria.lastTime = currTime;
24433 criteria.keys.push(lowerKey);
24434 var keepFocusOnCurrent = currentFocus && !criteria.repeating && textCriteriaMatches(currentFocus, criteria);
24435
24436 if (criteria.previousKeyMatched && (keepFocusOnCurrent || moveFocus(list, currentFocus, false, disabledItemsFocusable, nextItem, criteria))) {
24437 event.preventDefault();
24438 } else {
24439 criteria.previousKeyMatched = false;
24440 }
24441 }
24442
24443 if (onKeyDown) {
24444 onKeyDown(event);
24445 }
24446 };
24447
24448 var handleOwnRef = react.exports.useCallback(function (instance) {
24449 // #StrictMode ready
24450 listRef.current = reactDom.exports.findDOMNode(instance);
24451 }, []);
24452 var handleRef = useForkRef(handleOwnRef, ref);
24453 /**
24454 * the index of the item should receive focus
24455 * in a `variant="selectedMenu"` it's the first `selected` item
24456 * otherwise it's the very first item.
24457 */
24458
24459 var activeItemIndex = -1; // since we inject focus related props into children we have to do a lookahead
24460 // to check if there is a `selected` item. We're looking for the last `selected`
24461 // item and use the first valid item as a fallback
24462
24463 react.exports.Children.forEach(children, function (child, index) {
24464 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
24465 return;
24466 }
24467
24468 if (!child.props.disabled) {
24469 if (variant === 'selectedMenu' && child.props.selected) {
24470 activeItemIndex = index;
24471 } else if (activeItemIndex === -1) {
24472 activeItemIndex = index;
24473 }
24474 }
24475 });
24476 var items = react.exports.Children.map(children, function (child, index) {
24477 if (index === activeItemIndex) {
24478 var newChildProps = {};
24479
24480 if (autoFocusItem) {
24481 newChildProps.autoFocus = true;
24482 }
24483
24484 if (child.props.tabIndex === undefined && variant === 'selectedMenu') {
24485 newChildProps.tabIndex = 0;
24486 }
24487
24488 return /*#__PURE__*/react.exports.cloneElement(child, newChildProps);
24489 }
24490
24491 return child;
24492 });
24493 return /*#__PURE__*/react.exports.createElement(List$1, _extends$5({
24494 role: "menu",
24495 ref: handleRef,
24496 className: className,
24497 onKeyDown: handleKeyDown,
24498 tabIndex: autoFocus ? 0 : -1
24499 }, other), items);
24500 });
24501
24502 var RTL_ORIGIN = {
24503 vertical: 'top',
24504 horizontal: 'right'
24505 };
24506 var LTR_ORIGIN = {
24507 vertical: 'top',
24508 horizontal: 'left'
24509 };
24510 var styles$C = {
24511 /* Styles applied to the `Paper` component. */
24512 paper: {
24513 // specZ: The maximum height of a simple menu should be one or more rows less than the view
24514 // height. This ensures a tapable area outside of the simple menu with which to dismiss
24515 // the menu.
24516 maxHeight: 'calc(100% - 96px)',
24517 // Add iOS momentum scrolling.
24518 WebkitOverflowScrolling: 'touch'
24519 },
24520
24521 /* Styles applied to the `List` component via `MenuList`. */
24522 list: {
24523 // We disable the focus ring for mouse, touch and keyboard users.
24524 outline: 0
24525 }
24526 };
24527 var Menu = /*#__PURE__*/react.exports.forwardRef(function Menu(props, ref) {
24528 var _props$autoFocus = props.autoFocus,
24529 autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,
24530 children = props.children,
24531 classes = props.classes,
24532 _props$disableAutoFoc = props.disableAutoFocusItem,
24533 disableAutoFocusItem = _props$disableAutoFoc === void 0 ? false : _props$disableAutoFoc,
24534 _props$MenuListProps = props.MenuListProps,
24535 MenuListProps = _props$MenuListProps === void 0 ? {} : _props$MenuListProps,
24536 onClose = props.onClose,
24537 onEnteringProp = props.onEntering,
24538 open = props.open,
24539 _props$PaperProps = props.PaperProps,
24540 PaperProps = _props$PaperProps === void 0 ? {} : _props$PaperProps,
24541 PopoverClasses = props.PopoverClasses,
24542 _props$transitionDura = props.transitionDuration,
24543 transitionDuration = _props$transitionDura === void 0 ? 'auto' : _props$transitionDura,
24544 _props$TransitionProp = props.TransitionProps;
24545 _props$TransitionProp = _props$TransitionProp === void 0 ? {} : _props$TransitionProp;
24546
24547 var onEntering = _props$TransitionProp.onEntering,
24548 TransitionProps = _objectWithoutProperties(_props$TransitionProp, ["onEntering"]),
24549 _props$variant = props.variant,
24550 variant = _props$variant === void 0 ? 'selectedMenu' : _props$variant,
24551 other = _objectWithoutProperties(props, ["autoFocus", "children", "classes", "disableAutoFocusItem", "MenuListProps", "onClose", "onEntering", "open", "PaperProps", "PopoverClasses", "transitionDuration", "TransitionProps", "variant"]);
24552
24553 var theme = useTheme$1();
24554 var autoFocusItem = autoFocus && !disableAutoFocusItem && open;
24555 var menuListActionsRef = react.exports.useRef(null);
24556 var contentAnchorRef = react.exports.useRef(null);
24557
24558 var getContentAnchorEl = function getContentAnchorEl() {
24559 return contentAnchorRef.current;
24560 };
24561
24562 var handleEntering = function handleEntering(element, isAppearing) {
24563 if (menuListActionsRef.current) {
24564 menuListActionsRef.current.adjustStyleForScrollbar(element, theme);
24565 }
24566
24567 if (onEnteringProp) {
24568 onEnteringProp(element, isAppearing);
24569 }
24570
24571 if (onEntering) {
24572 onEntering(element, isAppearing);
24573 }
24574 };
24575
24576 var handleListKeyDown = function handleListKeyDown(event) {
24577 if (event.key === 'Tab') {
24578 event.preventDefault();
24579
24580 if (onClose) {
24581 onClose(event, 'tabKeyDown');
24582 }
24583 }
24584 };
24585 /**
24586 * the index of the item should receive focus
24587 * in a `variant="selectedMenu"` it's the first `selected` item
24588 * otherwise it's the very first item.
24589 */
24590
24591
24592 var activeItemIndex = -1; // since we inject focus related props into children we have to do a lookahead
24593 // to check if there is a `selected` item. We're looking for the last `selected`
24594 // item and use the first valid item as a fallback
24595
24596 react.exports.Children.map(children, function (child, index) {
24597 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
24598 return;
24599 }
24600
24601 if (!child.props.disabled) {
24602 if (variant !== "menu" && child.props.selected) {
24603 activeItemIndex = index;
24604 } else if (activeItemIndex === -1) {
24605 activeItemIndex = index;
24606 }
24607 }
24608 });
24609 var items = react.exports.Children.map(children, function (child, index) {
24610 if (index === activeItemIndex) {
24611 return /*#__PURE__*/react.exports.cloneElement(child, {
24612 ref: function ref(instance) {
24613 // #StrictMode ready
24614 contentAnchorRef.current = reactDom.exports.findDOMNode(instance);
24615 setRef(child.ref, instance);
24616 }
24617 });
24618 }
24619
24620 return child;
24621 });
24622 return /*#__PURE__*/react.exports.createElement(Popover$1, _extends$5({
24623 getContentAnchorEl: getContentAnchorEl,
24624 classes: PopoverClasses,
24625 onClose: onClose,
24626 TransitionProps: _extends$5({
24627 onEntering: handleEntering
24628 }, TransitionProps),
24629 anchorOrigin: theme.direction === 'rtl' ? RTL_ORIGIN : LTR_ORIGIN,
24630 transformOrigin: theme.direction === 'rtl' ? RTL_ORIGIN : LTR_ORIGIN,
24631 PaperProps: _extends$5({}, PaperProps, {
24632 classes: _extends$5({}, PaperProps.classes, {
24633 root: classes.paper
24634 })
24635 }),
24636 open: open,
24637 ref: ref,
24638 transitionDuration: transitionDuration
24639 }, other), /*#__PURE__*/react.exports.createElement(MenuList, _extends$5({
24640 onKeyDown: handleListKeyDown,
24641 actions: menuListActionsRef,
24642 autoFocus: autoFocus && (activeItemIndex === -1 || disableAutoFocusItem),
24643 autoFocusItem: autoFocusItem,
24644 variant: variant
24645 }, MenuListProps, {
24646 className: clsx(classes.list, MenuListProps.className)
24647 }), items));
24648 });
24649 var Menu$1 = withStyles(styles$C, {
24650 name: 'MuiMenu'
24651 })(Menu);
24652
24653 var styles$B = function styles(theme) {
24654 return {
24655 /* Styles applied to the root element. */
24656 root: _extends$5({}, theme.typography.body1, _defineProperty$1({
24657 minHeight: 48,
24658 paddingTop: 6,
24659 paddingBottom: 6,
24660 boxSizing: 'border-box',
24661 width: 'auto',
24662 overflow: 'hidden',
24663 whiteSpace: 'nowrap'
24664 }, theme.breakpoints.up('sm'), {
24665 minHeight: 'auto'
24666 })),
24667 // TODO v5: remove
24668
24669 /* Styles applied to the root element if `disableGutters={false}`. */
24670 gutters: {},
24671
24672 /* Styles applied to the root element if `selected={true}`. */
24673 selected: {},
24674
24675 /* Styles applied to the root element if dense. */
24676 dense: _extends$5({}, theme.typography.body2, {
24677 minHeight: 'auto'
24678 })
24679 };
24680 };
24681 var MenuItem = /*#__PURE__*/react.exports.forwardRef(function MenuItem(props, ref) {
24682 var classes = props.classes,
24683 className = props.className,
24684 _props$component = props.component,
24685 component = _props$component === void 0 ? 'li' : _props$component,
24686 _props$disableGutters = props.disableGutters,
24687 disableGutters = _props$disableGutters === void 0 ? false : _props$disableGutters,
24688 ListItemClasses = props.ListItemClasses,
24689 _props$role = props.role,
24690 role = _props$role === void 0 ? 'menuitem' : _props$role,
24691 selected = props.selected,
24692 tabIndexProp = props.tabIndex,
24693 other = _objectWithoutProperties(props, ["classes", "className", "component", "disableGutters", "ListItemClasses", "role", "selected", "tabIndex"]);
24694
24695 var tabIndex;
24696
24697 if (!props.disabled) {
24698 tabIndex = tabIndexProp !== undefined ? tabIndexProp : -1;
24699 }
24700
24701 return /*#__PURE__*/react.exports.createElement(ListItem$1, _extends$5({
24702 button: true,
24703 role: role,
24704 tabIndex: tabIndex,
24705 component: component,
24706 selected: selected,
24707 disableGutters: disableGutters,
24708 classes: _extends$5({
24709 dense: classes.dense
24710 }, ListItemClasses),
24711 className: clsx(classes.root, className, selected && classes.selected, !disableGutters && classes.gutters),
24712 ref: ref
24713 }, other));
24714 });
24715 var MenuItem$1 = withStyles(styles$B, {
24716 name: 'MuiMenuItem'
24717 })(MenuItem);
24718
24719 var styles$A = function styles(theme) {
24720 return {
24721 /* Styles applied to the root element. */
24722 root: {
24723 display: 'flex',
24724 flexDirection: 'row',
24725 justifyContent: 'space-between',
24726 alignItems: 'center',
24727 background: theme.palette.background.default,
24728 padding: 8
24729 },
24730
24731 /* Styles applied to the root element if `position="bottom"`. */
24732 positionBottom: {
24733 position: 'fixed',
24734 bottom: 0,
24735 left: 0,
24736 right: 0,
24737 zIndex: theme.zIndex.mobileStepper
24738 },
24739
24740 /* Styles applied to the root element if `position="top"`. */
24741 positionTop: {
24742 position: 'fixed',
24743 top: 0,
24744 left: 0,
24745 right: 0,
24746 zIndex: theme.zIndex.mobileStepper
24747 },
24748
24749 /* Styles applied to the root element if `position="static"`. */
24750 positionStatic: {},
24751
24752 /* Styles applied to the dots container if `variant="dots"`. */
24753 dots: {
24754 display: 'flex',
24755 flexDirection: 'row'
24756 },
24757
24758 /* Styles applied to each dot if `variant="dots"`. */
24759 dot: {
24760 backgroundColor: theme.palette.action.disabled,
24761 borderRadius: '50%',
24762 width: 8,
24763 height: 8,
24764 margin: '0 2px'
24765 },
24766
24767 /* Styles applied to a dot if `variant="dots"` and this is the active step. */
24768 dotActive: {
24769 backgroundColor: theme.palette.primary.main
24770 },
24771
24772 /* Styles applied to the Linear Progress component if `variant="progress"`. */
24773 progress: {
24774 width: '50%'
24775 }
24776 };
24777 };
24778 var MobileStepper = /*#__PURE__*/react.exports.forwardRef(function MobileStepper(props, ref) {
24779 var _props$activeStep = props.activeStep,
24780 activeStep = _props$activeStep === void 0 ? 0 : _props$activeStep,
24781 backButton = props.backButton,
24782 classes = props.classes,
24783 className = props.className,
24784 LinearProgressProps = props.LinearProgressProps,
24785 nextButton = props.nextButton,
24786 _props$position = props.position,
24787 position = _props$position === void 0 ? 'bottom' : _props$position,
24788 steps = props.steps,
24789 _props$variant = props.variant,
24790 variant = _props$variant === void 0 ? 'dots' : _props$variant,
24791 other = _objectWithoutProperties(props, ["activeStep", "backButton", "classes", "className", "LinearProgressProps", "nextButton", "position", "steps", "variant"]);
24792
24793 return /*#__PURE__*/react.exports.createElement(Paper$1, _extends$5({
24794 square: true,
24795 elevation: 0,
24796 className: clsx(classes.root, classes["position".concat(capitalize(position))], className),
24797 ref: ref
24798 }, other), backButton, variant === 'text' && /*#__PURE__*/react.exports.createElement(react.exports.Fragment, null, activeStep + 1, " / ", steps), variant === 'dots' && /*#__PURE__*/react.exports.createElement("div", {
24799 className: classes.dots
24800 }, _toConsumableArray(new Array(steps)).map(function (_, index) {
24801 return /*#__PURE__*/react.exports.createElement("div", {
24802 key: index,
24803 className: clsx(classes.dot, index === activeStep && classes.dotActive)
24804 });
24805 })), variant === 'progress' && /*#__PURE__*/react.exports.createElement(LinearProgress$1, _extends$5({
24806 className: classes.progress,
24807 variant: "determinate",
24808 value: Math.ceil(activeStep / (steps - 1) * 100)
24809 }, LinearProgressProps)), nextButton);
24810 });
24811 withStyles(styles$A, {
24812 name: 'MuiMobileStepper'
24813 })(MobileStepper);
24814
24815 /**
24816 * @ignore - internal component.
24817 */
24818
24819 var NativeSelectInput = /*#__PURE__*/react.exports.forwardRef(function NativeSelectInput(props, ref) {
24820 var classes = props.classes,
24821 className = props.className,
24822 disabled = props.disabled,
24823 IconComponent = props.IconComponent,
24824 inputRef = props.inputRef,
24825 _props$variant = props.variant,
24826 variant = _props$variant === void 0 ? 'standard' : _props$variant,
24827 other = _objectWithoutProperties(props, ["classes", "className", "disabled", "IconComponent", "inputRef", "variant"]);
24828
24829 return /*#__PURE__*/react.exports.createElement(react.exports.Fragment, null, /*#__PURE__*/react.exports.createElement("select", _extends$5({
24830 className: clsx(classes.root, // TODO v5: merge root and select
24831 classes.select, classes[variant], className, disabled && classes.disabled),
24832 disabled: disabled,
24833 ref: inputRef || ref
24834 }, other)), props.multiple ? null : /*#__PURE__*/react.exports.createElement(IconComponent, {
24835 className: clsx(classes.icon, classes["icon".concat(capitalize(variant))], disabled && classes.disabled)
24836 }));
24837 });
24838
24839 /**
24840 * @ignore - internal component.
24841 */
24842
24843 var ArrowDropDownIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
24844 d: "M7 10l5 5 5-5z"
24845 }));
24846
24847 var styles$z = function styles(theme) {
24848 return {
24849 /* Styles applied to the select component `root` class. */
24850 root: {},
24851
24852 /* Styles applied to the select component `select` class. */
24853 select: {
24854 '-moz-appearance': 'none',
24855 // Reset
24856 '-webkit-appearance': 'none',
24857 // Reset
24858 // When interacting quickly, the text can end up selected.
24859 // Native select can't be selected either.
24860 userSelect: 'none',
24861 borderRadius: 0,
24862 // Reset
24863 minWidth: 16,
24864 // So it doesn't collapse.
24865 cursor: 'pointer',
24866 '&:focus': {
24867 // Show that it's not an text input
24868 backgroundColor: theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.05)' : 'rgba(255, 255, 255, 0.05)',
24869 borderRadius: 0 // Reset Chrome style
24870
24871 },
24872 // Remove IE 11 arrow
24873 '&::-ms-expand': {
24874 display: 'none'
24875 },
24876 '&$disabled': {
24877 cursor: 'default'
24878 },
24879 '&[multiple]': {
24880 height: 'auto'
24881 },
24882 '&:not([multiple]) option, &:not([multiple]) optgroup': {
24883 backgroundColor: theme.palette.background.paper
24884 },
24885 '&&': {
24886 paddingRight: 24
24887 }
24888 },
24889
24890 /* Styles applied to the select component if `variant="filled"`. */
24891 filled: {
24892 '&&': {
24893 paddingRight: 32
24894 }
24895 },
24896
24897 /* Styles applied to the select component if `variant="outlined"`. */
24898 outlined: {
24899 borderRadius: theme.shape.borderRadius,
24900 '&&': {
24901 paddingRight: 32
24902 }
24903 },
24904
24905 /* Styles applied to the select component `selectMenu` class. */
24906 selectMenu: {
24907 height: 'auto',
24908 // Resets for multpile select with chips
24909 minHeight: '1.1876em',
24910 // Required for select\text-field height consistency
24911 textOverflow: 'ellipsis',
24912 whiteSpace: 'nowrap',
24913 overflow: 'hidden'
24914 },
24915
24916 /* Pseudo-class applied to the select component `disabled` class. */
24917 disabled: {},
24918
24919 /* Styles applied to the icon component. */
24920 icon: {
24921 // We use a position absolute over a flexbox in order to forward the pointer events
24922 // to the input and to support wrapping tags..
24923 position: 'absolute',
24924 right: 0,
24925 top: 'calc(50% - 12px)',
24926 // Center vertically
24927 pointerEvents: 'none',
24928 // Don't block pointer events on the select under the icon.
24929 color: theme.palette.action.active,
24930 '&$disabled': {
24931 color: theme.palette.action.disabled
24932 }
24933 },
24934
24935 /* Styles applied to the icon component if the popup is open. */
24936 iconOpen: {
24937 transform: 'rotate(180deg)'
24938 },
24939
24940 /* Styles applied to the icon component if `variant="filled"`. */
24941 iconFilled: {
24942 right: 7
24943 },
24944
24945 /* Styles applied to the icon component if `variant="outlined"`. */
24946 iconOutlined: {
24947 right: 7
24948 },
24949
24950 /* Styles applied to the underlying native input component. */
24951 nativeInput: {
24952 bottom: 0,
24953 left: 0,
24954 position: 'absolute',
24955 opacity: 0,
24956 pointerEvents: 'none',
24957 width: '100%'
24958 }
24959 };
24960 };
24961 var defaultInput = /*#__PURE__*/react.exports.createElement(Input$1, null);
24962 /**
24963 * An alternative to `<Select native />` with a much smaller bundle size footprint.
24964 */
24965
24966 var NativeSelect = /*#__PURE__*/react.exports.forwardRef(function NativeSelect(props, ref) {
24967 var children = props.children,
24968 classes = props.classes,
24969 _props$IconComponent = props.IconComponent,
24970 IconComponent = _props$IconComponent === void 0 ? ArrowDropDownIcon : _props$IconComponent,
24971 _props$input = props.input,
24972 input = _props$input === void 0 ? defaultInput : _props$input,
24973 inputProps = props.inputProps;
24974 props.variant;
24975 var other = _objectWithoutProperties(props, ["children", "classes", "IconComponent", "input", "inputProps", "variant"]);
24976
24977 var muiFormControl = useFormControl();
24978 var fcs = formControlState({
24979 props: props,
24980 muiFormControl: muiFormControl,
24981 states: ['variant']
24982 });
24983 return /*#__PURE__*/react.exports.cloneElement(input, _extends$5({
24984 // Most of the logic is implemented in `NativeSelectInput`.
24985 // The `Select` component is a simple API wrapper to expose something better to play with.
24986 inputComponent: NativeSelectInput,
24987 inputProps: _extends$5({
24988 children: children,
24989 classes: classes,
24990 IconComponent: IconComponent,
24991 variant: fcs.variant,
24992 type: undefined
24993 }, inputProps, input ? input.props.inputProps : {}),
24994 ref: ref
24995 }, other));
24996 });
24997 NativeSelect.muiName = 'Select';
24998 withStyles(styles$z, {
24999 name: 'MuiNativeSelect'
25000 })(NativeSelect);
25001
25002 var styles$y = function styles(theme) {
25003 return {
25004 /* Styles applied to the root element. */
25005 root: {
25006 position: 'absolute',
25007 bottom: 0,
25008 right: 0,
25009 top: -5,
25010 left: 0,
25011 margin: 0,
25012 padding: '0 8px',
25013 pointerEvents: 'none',
25014 borderRadius: 'inherit',
25015 borderStyle: 'solid',
25016 borderWidth: 1,
25017 overflow: 'hidden'
25018 },
25019
25020 /* Styles applied to the legend element when `labelWidth` is provided. */
25021 legend: {
25022 textAlign: 'left',
25023 padding: 0,
25024 lineHeight: '11px',
25025 // sync with `height` in `legend` styles
25026 transition: theme.transitions.create('width', {
25027 duration: 150,
25028 easing: theme.transitions.easing.easeOut
25029 })
25030 },
25031
25032 /* Styles applied to the legend element. */
25033 legendLabelled: {
25034 display: 'block',
25035 width: 'auto',
25036 textAlign: 'left',
25037 padding: 0,
25038 height: 11,
25039 // sync with `lineHeight` in `legend` styles
25040 fontSize: '0.75em',
25041 visibility: 'hidden',
25042 maxWidth: 0.01,
25043 transition: theme.transitions.create('max-width', {
25044 duration: 50,
25045 easing: theme.transitions.easing.easeOut
25046 }),
25047 '& > span': {
25048 paddingLeft: 5,
25049 paddingRight: 5,
25050 display: 'inline-block'
25051 }
25052 },
25053
25054 /* Styles applied to the legend element is notched. */
25055 legendNotched: {
25056 maxWidth: 1000,
25057 transition: theme.transitions.create('max-width', {
25058 duration: 100,
25059 easing: theme.transitions.easing.easeOut,
25060 delay: 50
25061 })
25062 }
25063 };
25064 };
25065 /**
25066 * @ignore - internal component.
25067 */
25068
25069 var NotchedOutline = /*#__PURE__*/react.exports.forwardRef(function NotchedOutline(props, ref) {
25070 props.children;
25071 var classes = props.classes,
25072 className = props.className,
25073 label = props.label,
25074 labelWidthProp = props.labelWidth,
25075 notched = props.notched,
25076 style = props.style,
25077 other = _objectWithoutProperties(props, ["children", "classes", "className", "label", "labelWidth", "notched", "style"]);
25078
25079 var theme = useTheme$1();
25080 var align = theme.direction === 'rtl' ? 'right' : 'left';
25081
25082 if (label !== undefined) {
25083 return /*#__PURE__*/react.exports.createElement("fieldset", _extends$5({
25084 "aria-hidden": true,
25085 className: clsx(classes.root, className),
25086 ref: ref,
25087 style: style
25088 }, other), /*#__PURE__*/react.exports.createElement("legend", {
25089 className: clsx(classes.legendLabelled, notched && classes.legendNotched)
25090 }, label ? /*#__PURE__*/react.exports.createElement("span", null, label) : /*#__PURE__*/react.exports.createElement("span", {
25091 dangerouslySetInnerHTML: {
25092 __html: '&#8203;'
25093 }
25094 })));
25095 }
25096
25097 var labelWidth = labelWidthProp > 0 ? labelWidthProp * 0.75 + 8 : 0.01;
25098 return /*#__PURE__*/react.exports.createElement("fieldset", _extends$5({
25099 "aria-hidden": true,
25100 style: _extends$5(_defineProperty$1({}, "padding".concat(capitalize(align)), 8), style),
25101 className: clsx(classes.root, className),
25102 ref: ref
25103 }, other), /*#__PURE__*/react.exports.createElement("legend", {
25104 className: classes.legend,
25105 style: {
25106 // IE 11: fieldset with legend does not render
25107 // a border radius. This maintains consistency
25108 // by always having a legend rendered
25109 width: notched ? labelWidth : 0.01
25110 }
25111 }, /*#__PURE__*/react.exports.createElement("span", {
25112 dangerouslySetInnerHTML: {
25113 __html: '&#8203;'
25114 }
25115 })));
25116 });
25117 var NotchedOutline$1 = withStyles(styles$y, {
25118 name: 'PrivateNotchedOutline'
25119 })(NotchedOutline);
25120
25121 var styles$x = function styles(theme) {
25122 var borderColor = theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
25123 return {
25124 /* Styles applied to the root element. */
25125 root: {
25126 position: 'relative',
25127 borderRadius: theme.shape.borderRadius,
25128 '&:hover $notchedOutline': {
25129 borderColor: theme.palette.text.primary
25130 },
25131 // Reset on touch devices, it doesn't add specificity
25132 '@media (hover: none)': {
25133 '&:hover $notchedOutline': {
25134 borderColor: borderColor
25135 }
25136 },
25137 '&$focused $notchedOutline': {
25138 borderColor: theme.palette.primary.main,
25139 borderWidth: 2
25140 },
25141 '&$error $notchedOutline': {
25142 borderColor: theme.palette.error.main
25143 },
25144 '&$disabled $notchedOutline': {
25145 borderColor: theme.palette.action.disabled
25146 }
25147 },
25148
25149 /* Styles applied to the root element if the color is secondary. */
25150 colorSecondary: {
25151 '&$focused $notchedOutline': {
25152 borderColor: theme.palette.secondary.main
25153 }
25154 },
25155
25156 /* Styles applied to the root element if the component is focused. */
25157 focused: {},
25158
25159 /* Styles applied to the root element if `disabled={true}`. */
25160 disabled: {},
25161
25162 /* Styles applied to the root element if `startAdornment` is provided. */
25163 adornedStart: {
25164 paddingLeft: 14
25165 },
25166
25167 /* Styles applied to the root element if `endAdornment` is provided. */
25168 adornedEnd: {
25169 paddingRight: 14
25170 },
25171
25172 /* Pseudo-class applied to the root element if `error={true}`. */
25173 error: {},
25174
25175 /* Styles applied to the `input` element if `margin="dense"`. */
25176 marginDense: {},
25177
25178 /* Styles applied to the root element if `multiline={true}`. */
25179 multiline: {
25180 padding: '18.5px 14px',
25181 '&$marginDense': {
25182 paddingTop: 10.5,
25183 paddingBottom: 10.5
25184 }
25185 },
25186
25187 /* Styles applied to the `NotchedOutline` element. */
25188 notchedOutline: {
25189 borderColor: borderColor
25190 },
25191
25192 /* Styles applied to the `input` element. */
25193 input: {
25194 padding: '18.5px 14px',
25195 '&:-webkit-autofill': {
25196 WebkitBoxShadow: theme.palette.type === 'light' ? null : '0 0 0 100px #266798 inset',
25197 WebkitTextFillColor: theme.palette.type === 'light' ? null : '#fff',
25198 caretColor: theme.palette.type === 'light' ? null : '#fff',
25199 borderRadius: 'inherit'
25200 }
25201 },
25202
25203 /* Styles applied to the `input` element if `margin="dense"`. */
25204 inputMarginDense: {
25205 paddingTop: 10.5,
25206 paddingBottom: 10.5
25207 },
25208
25209 /* Styles applied to the `input` element if `multiline={true}`. */
25210 inputMultiline: {
25211 padding: 0
25212 },
25213
25214 /* Styles applied to the `input` element if `startAdornment` is provided. */
25215 inputAdornedStart: {
25216 paddingLeft: 0
25217 },
25218
25219 /* Styles applied to the `input` element if `endAdornment` is provided. */
25220 inputAdornedEnd: {
25221 paddingRight: 0
25222 }
25223 };
25224 };
25225 var OutlinedInput = /*#__PURE__*/react.exports.forwardRef(function OutlinedInput(props, ref) {
25226 var classes = props.classes,
25227 _props$fullWidth = props.fullWidth,
25228 fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
25229 _props$inputComponent = props.inputComponent,
25230 inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,
25231 label = props.label,
25232 _props$labelWidth = props.labelWidth,
25233 labelWidth = _props$labelWidth === void 0 ? 0 : _props$labelWidth,
25234 _props$multiline = props.multiline,
25235 multiline = _props$multiline === void 0 ? false : _props$multiline,
25236 notched = props.notched,
25237 _props$type = props.type,
25238 type = _props$type === void 0 ? 'text' : _props$type,
25239 other = _objectWithoutProperties(props, ["classes", "fullWidth", "inputComponent", "label", "labelWidth", "multiline", "notched", "type"]);
25240
25241 return /*#__PURE__*/react.exports.createElement(InputBase$1, _extends$5({
25242 renderSuffix: function renderSuffix(state) {
25243 return /*#__PURE__*/react.exports.createElement(NotchedOutline$1, {
25244 className: classes.notchedOutline,
25245 label: label,
25246 labelWidth: labelWidth,
25247 notched: typeof notched !== 'undefined' ? notched : Boolean(state.startAdornment || state.filled || state.focused)
25248 });
25249 },
25250 classes: _extends$5({}, classes, {
25251 root: clsx(classes.root, classes.underline),
25252 notchedOutline: null
25253 }),
25254 fullWidth: fullWidth,
25255 inputComponent: inputComponent,
25256 multiline: multiline,
25257 ref: ref,
25258 type: type
25259 }, other));
25260 });
25261 OutlinedInput.muiName = 'Input';
25262 var OutlinedInput$1 = withStyles(styles$x, {
25263 name: 'MuiOutlinedInput'
25264 })(OutlinedInput);
25265
25266 /**!
25267 * @fileOverview Kickass library to create and place poppers near their reference elements.
25268 * @version 1.16.1-lts
25269 * @license
25270 * Copyright (c) 2016 Federico Zivolo and contributors
25271 *
25272 * Permission is hereby granted, free of charge, to any person obtaining a copy
25273 * of this software and associated documentation files (the "Software"), to deal
25274 * in the Software without restriction, including without limitation the rights
25275 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25276 * copies of the Software, and to permit persons to whom the Software is
25277 * furnished to do so, subject to the following conditions:
25278 *
25279 * The above copyright notice and this permission notice shall be included in all
25280 * copies or substantial portions of the Software.
25281 *
25282 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25283 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25284 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25285 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25286 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25287 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25288 * SOFTWARE.
25289 */
25290 var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
25291
25292 var timeoutDuration = function () {
25293 var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
25294 for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
25295 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
25296 return 1;
25297 }
25298 }
25299 return 0;
25300 }();
25301
25302 function microtaskDebounce(fn) {
25303 var called = false;
25304 return function () {
25305 if (called) {
25306 return;
25307 }
25308 called = true;
25309 window.Promise.resolve().then(function () {
25310 called = false;
25311 fn();
25312 });
25313 };
25314 }
25315
25316 function taskDebounce(fn) {
25317 var scheduled = false;
25318 return function () {
25319 if (!scheduled) {
25320 scheduled = true;
25321 setTimeout(function () {
25322 scheduled = false;
25323 fn();
25324 }, timeoutDuration);
25325 }
25326 };
25327 }
25328
25329 var supportsMicroTasks = isBrowser && window.Promise;
25330
25331 /**
25332 * Create a debounced version of a method, that's asynchronously deferred
25333 * but called in the minimum time possible.
25334 *
25335 * @method
25336 * @memberof Popper.Utils
25337 * @argument {Function} fn
25338 * @returns {Function}
25339 */
25340 var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
25341
25342 /**
25343 * Check if the given variable is a function
25344 * @method
25345 * @memberof Popper.Utils
25346 * @argument {Any} functionToCheck - variable to check
25347 * @returns {Boolean} answer to: is a function?
25348 */
25349 function isFunction$1(functionToCheck) {
25350 var getType = {};
25351 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
25352 }
25353
25354 /**
25355 * Get CSS computed property of the given element
25356 * @method
25357 * @memberof Popper.Utils
25358 * @argument {Eement} element
25359 * @argument {String} property
25360 */
25361 function getStyleComputedProperty(element, property) {
25362 if (element.nodeType !== 1) {
25363 return [];
25364 }
25365 // NOTE: 1 DOM access here
25366 var window = element.ownerDocument.defaultView;
25367 var css = window.getComputedStyle(element, null);
25368 return property ? css[property] : css;
25369 }
25370
25371 /**
25372 * Returns the parentNode or the host of the element
25373 * @method
25374 * @memberof Popper.Utils
25375 * @argument {Element} element
25376 * @returns {Element} parent
25377 */
25378 function getParentNode(element) {
25379 if (element.nodeName === 'HTML') {
25380 return element;
25381 }
25382 return element.parentNode || element.host;
25383 }
25384
25385 /**
25386 * Returns the scrolling parent of the given element
25387 * @method
25388 * @memberof Popper.Utils
25389 * @argument {Element} element
25390 * @returns {Element} scroll parent
25391 */
25392 function getScrollParent(element) {
25393 // Return body, `getScroll` will take care to get the correct `scrollTop` from it
25394 if (!element) {
25395 return document.body;
25396 }
25397
25398 switch (element.nodeName) {
25399 case 'HTML':
25400 case 'BODY':
25401 return element.ownerDocument.body;
25402 case '#document':
25403 return element.body;
25404 }
25405
25406 // Firefox want us to check `-x` and `-y` variations as well
25407
25408 var _getStyleComputedProp = getStyleComputedProperty(element),
25409 overflow = _getStyleComputedProp.overflow,
25410 overflowX = _getStyleComputedProp.overflowX,
25411 overflowY = _getStyleComputedProp.overflowY;
25412
25413 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
25414 return element;
25415 }
25416
25417 return getScrollParent(getParentNode(element));
25418 }
25419
25420 /**
25421 * Returns the reference node of the reference object, or the reference object itself.
25422 * @method
25423 * @memberof Popper.Utils
25424 * @param {Element|Object} reference - the reference element (the popper will be relative to this)
25425 * @returns {Element} parent
25426 */
25427 function getReferenceNode(reference) {
25428 return reference && reference.referenceNode ? reference.referenceNode : reference;
25429 }
25430
25431 var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
25432 var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
25433
25434 /**
25435 * Determines if the browser is Internet Explorer
25436 * @method
25437 * @memberof Popper.Utils
25438 * @param {Number} version to check
25439 * @returns {Boolean} isIE
25440 */
25441 function isIE(version) {
25442 if (version === 11) {
25443 return isIE11;
25444 }
25445 if (version === 10) {
25446 return isIE10;
25447 }
25448 return isIE11 || isIE10;
25449 }
25450
25451 /**
25452 * Returns the offset parent of the given element
25453 * @method
25454 * @memberof Popper.Utils
25455 * @argument {Element} element
25456 * @returns {Element} offset parent
25457 */
25458 function getOffsetParent(element) {
25459 if (!element) {
25460 return document.documentElement;
25461 }
25462
25463 var noOffsetParent = isIE(10) ? document.body : null;
25464
25465 // NOTE: 1 DOM access here
25466 var offsetParent = element.offsetParent || null;
25467 // Skip hidden elements which don't have an offsetParent
25468 while (offsetParent === noOffsetParent && element.nextElementSibling) {
25469 offsetParent = (element = element.nextElementSibling).offsetParent;
25470 }
25471
25472 var nodeName = offsetParent && offsetParent.nodeName;
25473
25474 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
25475 return element ? element.ownerDocument.documentElement : document.documentElement;
25476 }
25477
25478 // .offsetParent will return the closest TH, TD or TABLE in case
25479 // no offsetParent is present, I hate this job...
25480 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
25481 return getOffsetParent(offsetParent);
25482 }
25483
25484 return offsetParent;
25485 }
25486
25487 function isOffsetContainer(element) {
25488 var nodeName = element.nodeName;
25489
25490 if (nodeName === 'BODY') {
25491 return false;
25492 }
25493 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
25494 }
25495
25496 /**
25497 * Finds the root node (document, shadowDOM root) of the given element
25498 * @method
25499 * @memberof Popper.Utils
25500 * @argument {Element} node
25501 * @returns {Element} root node
25502 */
25503 function getRoot(node) {
25504 if (node.parentNode !== null) {
25505 return getRoot(node.parentNode);
25506 }
25507
25508 return node;
25509 }
25510
25511 /**
25512 * Finds the offset parent common to the two provided nodes
25513 * @method
25514 * @memberof Popper.Utils
25515 * @argument {Element} element1
25516 * @argument {Element} element2
25517 * @returns {Element} common offset parent
25518 */
25519 function findCommonOffsetParent(element1, element2) {
25520 // This check is needed to avoid errors in case one of the elements isn't defined for any reason
25521 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
25522 return document.documentElement;
25523 }
25524
25525 // Here we make sure to give as "start" the element that comes first in the DOM
25526 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
25527 var start = order ? element1 : element2;
25528 var end = order ? element2 : element1;
25529
25530 // Get common ancestor container
25531 var range = document.createRange();
25532 range.setStart(start, 0);
25533 range.setEnd(end, 0);
25534 var commonAncestorContainer = range.commonAncestorContainer;
25535
25536 // Both nodes are inside #document
25537
25538 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
25539 if (isOffsetContainer(commonAncestorContainer)) {
25540 return commonAncestorContainer;
25541 }
25542
25543 return getOffsetParent(commonAncestorContainer);
25544 }
25545
25546 // one of the nodes is inside shadowDOM, find which one
25547 var element1root = getRoot(element1);
25548 if (element1root.host) {
25549 return findCommonOffsetParent(element1root.host, element2);
25550 } else {
25551 return findCommonOffsetParent(element1, getRoot(element2).host);
25552 }
25553 }
25554
25555 /**
25556 * Gets the scroll value of the given element in the given side (top and left)
25557 * @method
25558 * @memberof Popper.Utils
25559 * @argument {Element} element
25560 * @argument {String} side `top` or `left`
25561 * @returns {number} amount of scrolled pixels
25562 */
25563 function getScroll(element) {
25564 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
25565
25566 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
25567 var nodeName = element.nodeName;
25568
25569 if (nodeName === 'BODY' || nodeName === 'HTML') {
25570 var html = element.ownerDocument.documentElement;
25571 var scrollingElement = element.ownerDocument.scrollingElement || html;
25572 return scrollingElement[upperSide];
25573 }
25574
25575 return element[upperSide];
25576 }
25577
25578 /*
25579 * Sum or subtract the element scroll values (left and top) from a given rect object
25580 * @method
25581 * @memberof Popper.Utils
25582 * @param {Object} rect - Rect object you want to change
25583 * @param {HTMLElement} element - The element from the function reads the scroll values
25584 * @param {Boolean} subtract - set to true if you want to subtract the scroll values
25585 * @return {Object} rect - The modifier rect object
25586 */
25587 function includeScroll(rect, element) {
25588 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
25589
25590 var scrollTop = getScroll(element, 'top');
25591 var scrollLeft = getScroll(element, 'left');
25592 var modifier = subtract ? -1 : 1;
25593 rect.top += scrollTop * modifier;
25594 rect.bottom += scrollTop * modifier;
25595 rect.left += scrollLeft * modifier;
25596 rect.right += scrollLeft * modifier;
25597 return rect;
25598 }
25599
25600 /*
25601 * Helper to detect borders of a given element
25602 * @method
25603 * @memberof Popper.Utils
25604 * @param {CSSStyleDeclaration} styles
25605 * Result of `getStyleComputedProperty` on the given element
25606 * @param {String} axis - `x` or `y`
25607 * @return {number} borders - The borders size of the given axis
25608 */
25609
25610 function getBordersSize(styles, axis) {
25611 var sideA = axis === 'x' ? 'Left' : 'Top';
25612 var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
25613
25614 return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
25615 }
25616
25617 function getSize(axis, body, html, computedStyle) {
25618 return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
25619 }
25620
25621 function getWindowSizes(document) {
25622 var body = document.body;
25623 var html = document.documentElement;
25624 var computedStyle = isIE(10) && getComputedStyle(html);
25625
25626 return {
25627 height: getSize('Height', body, html, computedStyle),
25628 width: getSize('Width', body, html, computedStyle)
25629 };
25630 }
25631
25632 var classCallCheck$2 = function (instance, Constructor) {
25633 if (!(instance instanceof Constructor)) {
25634 throw new TypeError("Cannot call a class as a function");
25635 }
25636 };
25637
25638 var createClass$2 = function () {
25639 function defineProperties(target, props) {
25640 for (var i = 0; i < props.length; i++) {
25641 var descriptor = props[i];
25642 descriptor.enumerable = descriptor.enumerable || false;
25643 descriptor.configurable = true;
25644 if ("value" in descriptor) descriptor.writable = true;
25645 Object.defineProperty(target, descriptor.key, descriptor);
25646 }
25647 }
25648
25649 return function (Constructor, protoProps, staticProps) {
25650 if (protoProps) defineProperties(Constructor.prototype, protoProps);
25651 if (staticProps) defineProperties(Constructor, staticProps);
25652 return Constructor;
25653 };
25654 }();
25655
25656
25657
25658
25659
25660 var defineProperty = function (obj, key, value) {
25661 if (key in obj) {
25662 Object.defineProperty(obj, key, {
25663 value: value,
25664 enumerable: true,
25665 configurable: true,
25666 writable: true
25667 });
25668 } else {
25669 obj[key] = value;
25670 }
25671
25672 return obj;
25673 };
25674
25675 var _extends$2 = Object.assign || function (target) {
25676 for (var i = 1; i < arguments.length; i++) {
25677 var source = arguments[i];
25678
25679 for (var key in source) {
25680 if (Object.prototype.hasOwnProperty.call(source, key)) {
25681 target[key] = source[key];
25682 }
25683 }
25684 }
25685
25686 return target;
25687 };
25688
25689 /**
25690 * Given element offsets, generate an output similar to getBoundingClientRect
25691 * @method
25692 * @memberof Popper.Utils
25693 * @argument {Object} offsets
25694 * @returns {Object} ClientRect like output
25695 */
25696 function getClientRect(offsets) {
25697 return _extends$2({}, offsets, {
25698 right: offsets.left + offsets.width,
25699 bottom: offsets.top + offsets.height
25700 });
25701 }
25702
25703 /**
25704 * Get bounding client rect of given element
25705 * @method
25706 * @memberof Popper.Utils
25707 * @param {HTMLElement} element
25708 * @return {Object} client rect
25709 */
25710 function getBoundingClientRect(element) {
25711 var rect = {};
25712
25713 // IE10 10 FIX: Please, don't ask, the element isn't
25714 // considered in DOM in some circumstances...
25715 // This isn't reproducible in IE10 compatibility mode of IE11
25716 try {
25717 if (isIE(10)) {
25718 rect = element.getBoundingClientRect();
25719 var scrollTop = getScroll(element, 'top');
25720 var scrollLeft = getScroll(element, 'left');
25721 rect.top += scrollTop;
25722 rect.left += scrollLeft;
25723 rect.bottom += scrollTop;
25724 rect.right += scrollLeft;
25725 } else {
25726 rect = element.getBoundingClientRect();
25727 }
25728 } catch (e) {}
25729
25730 var result = {
25731 left: rect.left,
25732 top: rect.top,
25733 width: rect.right - rect.left,
25734 height: rect.bottom - rect.top
25735 };
25736
25737 // subtract scrollbar size from sizes
25738 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
25739 var width = sizes.width || element.clientWidth || result.width;
25740 var height = sizes.height || element.clientHeight || result.height;
25741
25742 var horizScrollbar = element.offsetWidth - width;
25743 var vertScrollbar = element.offsetHeight - height;
25744
25745 // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
25746 // we make this check conditional for performance reasons
25747 if (horizScrollbar || vertScrollbar) {
25748 var styles = getStyleComputedProperty(element);
25749 horizScrollbar -= getBordersSize(styles, 'x');
25750 vertScrollbar -= getBordersSize(styles, 'y');
25751
25752 result.width -= horizScrollbar;
25753 result.height -= vertScrollbar;
25754 }
25755
25756 return getClientRect(result);
25757 }
25758
25759 function getOffsetRectRelativeToArbitraryNode(children, parent) {
25760 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
25761
25762 var isIE10 = isIE(10);
25763 var isHTML = parent.nodeName === 'HTML';
25764 var childrenRect = getBoundingClientRect(children);
25765 var parentRect = getBoundingClientRect(parent);
25766 var scrollParent = getScrollParent(children);
25767
25768 var styles = getStyleComputedProperty(parent);
25769 var borderTopWidth = parseFloat(styles.borderTopWidth);
25770 var borderLeftWidth = parseFloat(styles.borderLeftWidth);
25771
25772 // In cases where the parent is fixed, we must ignore negative scroll in offset calc
25773 if (fixedPosition && isHTML) {
25774 parentRect.top = Math.max(parentRect.top, 0);
25775 parentRect.left = Math.max(parentRect.left, 0);
25776 }
25777 var offsets = getClientRect({
25778 top: childrenRect.top - parentRect.top - borderTopWidth,
25779 left: childrenRect.left - parentRect.left - borderLeftWidth,
25780 width: childrenRect.width,
25781 height: childrenRect.height
25782 });
25783 offsets.marginTop = 0;
25784 offsets.marginLeft = 0;
25785
25786 // Subtract margins of documentElement in case it's being used as parent
25787 // we do this only on HTML because it's the only element that behaves
25788 // differently when margins are applied to it. The margins are included in
25789 // the box of the documentElement, in the other cases not.
25790 if (!isIE10 && isHTML) {
25791 var marginTop = parseFloat(styles.marginTop);
25792 var marginLeft = parseFloat(styles.marginLeft);
25793
25794 offsets.top -= borderTopWidth - marginTop;
25795 offsets.bottom -= borderTopWidth - marginTop;
25796 offsets.left -= borderLeftWidth - marginLeft;
25797 offsets.right -= borderLeftWidth - marginLeft;
25798
25799 // Attach marginTop and marginLeft because in some circumstances we may need them
25800 offsets.marginTop = marginTop;
25801 offsets.marginLeft = marginLeft;
25802 }
25803
25804 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
25805 offsets = includeScroll(offsets, parent);
25806 }
25807
25808 return offsets;
25809 }
25810
25811 function getViewportOffsetRectRelativeToArtbitraryNode(element) {
25812 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
25813
25814 var html = element.ownerDocument.documentElement;
25815 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
25816 var width = Math.max(html.clientWidth, window.innerWidth || 0);
25817 var height = Math.max(html.clientHeight, window.innerHeight || 0);
25818
25819 var scrollTop = !excludeScroll ? getScroll(html) : 0;
25820 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
25821
25822 var offset = {
25823 top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
25824 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
25825 width: width,
25826 height: height
25827 };
25828
25829 return getClientRect(offset);
25830 }
25831
25832 /**
25833 * Check if the given element is fixed or is inside a fixed parent
25834 * @method
25835 * @memberof Popper.Utils
25836 * @argument {Element} element
25837 * @argument {Element} customContainer
25838 * @returns {Boolean} answer to "isFixed?"
25839 */
25840 function isFixed(element) {
25841 var nodeName = element.nodeName;
25842 if (nodeName === 'BODY' || nodeName === 'HTML') {
25843 return false;
25844 }
25845 if (getStyleComputedProperty(element, 'position') === 'fixed') {
25846 return true;
25847 }
25848 var parentNode = getParentNode(element);
25849 if (!parentNode) {
25850 return false;
25851 }
25852 return isFixed(parentNode);
25853 }
25854
25855 /**
25856 * Finds the first parent of an element that has a transformed property defined
25857 * @method
25858 * @memberof Popper.Utils
25859 * @argument {Element} element
25860 * @returns {Element} first transformed parent or documentElement
25861 */
25862
25863 function getFixedPositionOffsetParent(element) {
25864 // This check is needed to avoid errors in case one of the elements isn't defined for any reason
25865 if (!element || !element.parentElement || isIE()) {
25866 return document.documentElement;
25867 }
25868 var el = element.parentElement;
25869 while (el && getStyleComputedProperty(el, 'transform') === 'none') {
25870 el = el.parentElement;
25871 }
25872 return el || document.documentElement;
25873 }
25874
25875 /**
25876 * Computed the boundaries limits and return them
25877 * @method
25878 * @memberof Popper.Utils
25879 * @param {HTMLElement} popper
25880 * @param {HTMLElement} reference
25881 * @param {number} padding
25882 * @param {HTMLElement} boundariesElement - Element used to define the boundaries
25883 * @param {Boolean} fixedPosition - Is in fixed position mode
25884 * @returns {Object} Coordinates of the boundaries
25885 */
25886 function getBoundaries(popper, reference, padding, boundariesElement) {
25887 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
25888
25889 // NOTE: 1 DOM access here
25890
25891 var boundaries = { top: 0, left: 0 };
25892 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
25893
25894 // Handle viewport case
25895 if (boundariesElement === 'viewport') {
25896 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
25897 } else {
25898 // Handle other cases based on DOM element used as boundaries
25899 var boundariesNode = void 0;
25900 if (boundariesElement === 'scrollParent') {
25901 boundariesNode = getScrollParent(getParentNode(reference));
25902 if (boundariesNode.nodeName === 'BODY') {
25903 boundariesNode = popper.ownerDocument.documentElement;
25904 }
25905 } else if (boundariesElement === 'window') {
25906 boundariesNode = popper.ownerDocument.documentElement;
25907 } else {
25908 boundariesNode = boundariesElement;
25909 }
25910
25911 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
25912
25913 // In case of HTML, we need a different computation
25914 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
25915 var _getWindowSizes = getWindowSizes(popper.ownerDocument),
25916 height = _getWindowSizes.height,
25917 width = _getWindowSizes.width;
25918
25919 boundaries.top += offsets.top - offsets.marginTop;
25920 boundaries.bottom = height + offsets.top;
25921 boundaries.left += offsets.left - offsets.marginLeft;
25922 boundaries.right = width + offsets.left;
25923 } else {
25924 // for all the other DOM elements, this one is good
25925 boundaries = offsets;
25926 }
25927 }
25928
25929 // Add paddings
25930 padding = padding || 0;
25931 var isPaddingNumber = typeof padding === 'number';
25932 boundaries.left += isPaddingNumber ? padding : padding.left || 0;
25933 boundaries.top += isPaddingNumber ? padding : padding.top || 0;
25934 boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
25935 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
25936
25937 return boundaries;
25938 }
25939
25940 function getArea(_ref) {
25941 var width = _ref.width,
25942 height = _ref.height;
25943
25944 return width * height;
25945 }
25946
25947 /**
25948 * Utility used to transform the `auto` placement to the placement with more
25949 * available space.
25950 * @method
25951 * @memberof Popper.Utils
25952 * @argument {Object} data - The data object generated by update method
25953 * @argument {Object} options - Modifiers configuration and options
25954 * @returns {Object} The data object, properly modified
25955 */
25956 function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
25957 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
25958
25959 if (placement.indexOf('auto') === -1) {
25960 return placement;
25961 }
25962
25963 var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
25964
25965 var rects = {
25966 top: {
25967 width: boundaries.width,
25968 height: refRect.top - boundaries.top
25969 },
25970 right: {
25971 width: boundaries.right - refRect.right,
25972 height: boundaries.height
25973 },
25974 bottom: {
25975 width: boundaries.width,
25976 height: boundaries.bottom - refRect.bottom
25977 },
25978 left: {
25979 width: refRect.left - boundaries.left,
25980 height: boundaries.height
25981 }
25982 };
25983
25984 var sortedAreas = Object.keys(rects).map(function (key) {
25985 return _extends$2({
25986 key: key
25987 }, rects[key], {
25988 area: getArea(rects[key])
25989 });
25990 }).sort(function (a, b) {
25991 return b.area - a.area;
25992 });
25993
25994 var filteredAreas = sortedAreas.filter(function (_ref2) {
25995 var width = _ref2.width,
25996 height = _ref2.height;
25997 return width >= popper.clientWidth && height >= popper.clientHeight;
25998 });
25999
26000 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
26001
26002 var variation = placement.split('-')[1];
26003
26004 return computedPlacement + (variation ? '-' + variation : '');
26005 }
26006
26007 /**
26008 * Get offsets to the reference element
26009 * @method
26010 * @memberof Popper.Utils
26011 * @param {Object} state
26012 * @param {Element} popper - the popper element
26013 * @param {Element} reference - the reference element (the popper will be relative to this)
26014 * @param {Element} fixedPosition - is in fixed position mode
26015 * @returns {Object} An object containing the offsets which will be applied to the popper
26016 */
26017 function getReferenceOffsets(state, popper, reference) {
26018 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
26019
26020 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
26021 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
26022 }
26023
26024 /**
26025 * Get the outer sizes of the given element (offset size + margins)
26026 * @method
26027 * @memberof Popper.Utils
26028 * @argument {Element} element
26029 * @returns {Object} object containing width and height properties
26030 */
26031 function getOuterSizes(element) {
26032 var window = element.ownerDocument.defaultView;
26033 var styles = window.getComputedStyle(element);
26034 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
26035 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
26036 var result = {
26037 width: element.offsetWidth + y,
26038 height: element.offsetHeight + x
26039 };
26040 return result;
26041 }
26042
26043 /**
26044 * Get the opposite placement of the given one
26045 * @method
26046 * @memberof Popper.Utils
26047 * @argument {String} placement
26048 * @returns {String} flipped placement
26049 */
26050 function getOppositePlacement(placement) {
26051 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
26052 return placement.replace(/left|right|bottom|top/g, function (matched) {
26053 return hash[matched];
26054 });
26055 }
26056
26057 /**
26058 * Get offsets to the popper
26059 * @method
26060 * @memberof Popper.Utils
26061 * @param {Object} position - CSS position the Popper will get applied
26062 * @param {HTMLElement} popper - the popper element
26063 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
26064 * @param {String} placement - one of the valid placement options
26065 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
26066 */
26067 function getPopperOffsets(popper, referenceOffsets, placement) {
26068 placement = placement.split('-')[0];
26069
26070 // Get popper node sizes
26071 var popperRect = getOuterSizes(popper);
26072
26073 // Add position, width and height to our offsets object
26074 var popperOffsets = {
26075 width: popperRect.width,
26076 height: popperRect.height
26077 };
26078
26079 // depending by the popper placement we have to compute its offsets slightly differently
26080 var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
26081 var mainSide = isHoriz ? 'top' : 'left';
26082 var secondarySide = isHoriz ? 'left' : 'top';
26083 var measurement = isHoriz ? 'height' : 'width';
26084 var secondaryMeasurement = !isHoriz ? 'height' : 'width';
26085
26086 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
26087 if (placement === secondarySide) {
26088 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
26089 } else {
26090 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
26091 }
26092
26093 return popperOffsets;
26094 }
26095
26096 /**
26097 * Mimics the `find` method of Array
26098 * @method
26099 * @memberof Popper.Utils
26100 * @argument {Array} arr
26101 * @argument prop
26102 * @argument value
26103 * @returns index or -1
26104 */
26105 function find(arr, check) {
26106 // use native find if supported
26107 if (Array.prototype.find) {
26108 return arr.find(check);
26109 }
26110
26111 // use `filter` to obtain the same behavior of `find`
26112 return arr.filter(check)[0];
26113 }
26114
26115 /**
26116 * Return the index of the matching object
26117 * @method
26118 * @memberof Popper.Utils
26119 * @argument {Array} arr
26120 * @argument prop
26121 * @argument value
26122 * @returns index or -1
26123 */
26124 function findIndex(arr, prop, value) {
26125 // use native findIndex if supported
26126 if (Array.prototype.findIndex) {
26127 return arr.findIndex(function (cur) {
26128 return cur[prop] === value;
26129 });
26130 }
26131
26132 // use `find` + `indexOf` if `findIndex` isn't supported
26133 var match = find(arr, function (obj) {
26134 return obj[prop] === value;
26135 });
26136 return arr.indexOf(match);
26137 }
26138
26139 /**
26140 * Loop trough the list of modifiers and run them in order,
26141 * each of them will then edit the data object.
26142 * @method
26143 * @memberof Popper.Utils
26144 * @param {dataObject} data
26145 * @param {Array} modifiers
26146 * @param {String} ends - Optional modifier name used as stopper
26147 * @returns {dataObject}
26148 */
26149 function runModifiers(modifiers, data, ends) {
26150 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
26151
26152 modifiersToRun.forEach(function (modifier) {
26153 if (modifier['function']) {
26154 // eslint-disable-line dot-notation
26155 console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
26156 }
26157 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
26158 if (modifier.enabled && isFunction$1(fn)) {
26159 // Add properties to offsets to make them a complete clientRect object
26160 // we do this before each modifier to make sure the previous one doesn't
26161 // mess with these values
26162 data.offsets.popper = getClientRect(data.offsets.popper);
26163 data.offsets.reference = getClientRect(data.offsets.reference);
26164
26165 data = fn(data, modifier);
26166 }
26167 });
26168
26169 return data;
26170 }
26171
26172 /**
26173 * Updates the position of the popper, computing the new offsets and applying
26174 * the new style.<br />
26175 * Prefer `scheduleUpdate` over `update` because of performance reasons.
26176 * @method
26177 * @memberof Popper
26178 */
26179 function update() {
26180 // if popper is destroyed, don't perform any further update
26181 if (this.state.isDestroyed) {
26182 return;
26183 }
26184
26185 var data = {
26186 instance: this,
26187 styles: {},
26188 arrowStyles: {},
26189 attributes: {},
26190 flipped: false,
26191 offsets: {}
26192 };
26193
26194 // compute reference element offsets
26195 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
26196
26197 // compute auto placement, store placement inside the data object,
26198 // modifiers will be able to edit `placement` if needed
26199 // and refer to originalPlacement to know the original value
26200 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
26201
26202 // store the computed placement inside `originalPlacement`
26203 data.originalPlacement = data.placement;
26204
26205 data.positionFixed = this.options.positionFixed;
26206
26207 // compute the popper offsets
26208 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
26209
26210 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
26211
26212 // run the modifiers
26213 data = runModifiers(this.modifiers, data);
26214
26215 // the first `update` will call `onCreate` callback
26216 // the other ones will call `onUpdate` callback
26217 if (!this.state.isCreated) {
26218 this.state.isCreated = true;
26219 this.options.onCreate(data);
26220 } else {
26221 this.options.onUpdate(data);
26222 }
26223 }
26224
26225 /**
26226 * Helper used to know if the given modifier is enabled.
26227 * @method
26228 * @memberof Popper.Utils
26229 * @returns {Boolean}
26230 */
26231 function isModifierEnabled(modifiers, modifierName) {
26232 return modifiers.some(function (_ref) {
26233 var name = _ref.name,
26234 enabled = _ref.enabled;
26235 return enabled && name === modifierName;
26236 });
26237 }
26238
26239 /**
26240 * Get the prefixed supported property name
26241 * @method
26242 * @memberof Popper.Utils
26243 * @argument {String} property (camelCase)
26244 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
26245 */
26246 function getSupportedPropertyName(property) {
26247 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
26248 var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
26249
26250 for (var i = 0; i < prefixes.length; i++) {
26251 var prefix = prefixes[i];
26252 var toCheck = prefix ? '' + prefix + upperProp : property;
26253 if (typeof document.body.style[toCheck] !== 'undefined') {
26254 return toCheck;
26255 }
26256 }
26257 return null;
26258 }
26259
26260 /**
26261 * Destroys the popper.
26262 * @method
26263 * @memberof Popper
26264 */
26265 function destroy() {
26266 this.state.isDestroyed = true;
26267
26268 // touch DOM only if `applyStyle` modifier is enabled
26269 if (isModifierEnabled(this.modifiers, 'applyStyle')) {
26270 this.popper.removeAttribute('x-placement');
26271 this.popper.style.position = '';
26272 this.popper.style.top = '';
26273 this.popper.style.left = '';
26274 this.popper.style.right = '';
26275 this.popper.style.bottom = '';
26276 this.popper.style.willChange = '';
26277 this.popper.style[getSupportedPropertyName('transform')] = '';
26278 }
26279
26280 this.disableEventListeners();
26281
26282 // remove the popper if user explicitly asked for the deletion on destroy
26283 // do not use `remove` because IE11 doesn't support it
26284 if (this.options.removeOnDestroy) {
26285 this.popper.parentNode.removeChild(this.popper);
26286 }
26287 return this;
26288 }
26289
26290 /**
26291 * Get the window associated with the element
26292 * @argument {Element} element
26293 * @returns {Window}
26294 */
26295 function getWindow(element) {
26296 var ownerDocument = element.ownerDocument;
26297 return ownerDocument ? ownerDocument.defaultView : window;
26298 }
26299
26300 function attachToScrollParents(scrollParent, event, callback, scrollParents) {
26301 var isBody = scrollParent.nodeName === 'BODY';
26302 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
26303 target.addEventListener(event, callback, { passive: true });
26304
26305 if (!isBody) {
26306 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
26307 }
26308 scrollParents.push(target);
26309 }
26310
26311 /**
26312 * Setup needed event listeners used to update the popper position
26313 * @method
26314 * @memberof Popper.Utils
26315 * @private
26316 */
26317 function setupEventListeners(reference, options, state, updateBound) {
26318 // Resize event listener on window
26319 state.updateBound = updateBound;
26320 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
26321
26322 // Scroll event listener on scroll parents
26323 var scrollElement = getScrollParent(reference);
26324 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
26325 state.scrollElement = scrollElement;
26326 state.eventsEnabled = true;
26327
26328 return state;
26329 }
26330
26331 /**
26332 * It will add resize/scroll events and start recalculating
26333 * position of the popper element when they are triggered.
26334 * @method
26335 * @memberof Popper
26336 */
26337 function enableEventListeners() {
26338 if (!this.state.eventsEnabled) {
26339 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
26340 }
26341 }
26342
26343 /**
26344 * Remove event listeners used to update the popper position
26345 * @method
26346 * @memberof Popper.Utils
26347 * @private
26348 */
26349 function removeEventListeners(reference, state) {
26350 // Remove resize event listener on window
26351 getWindow(reference).removeEventListener('resize', state.updateBound);
26352
26353 // Remove scroll event listener on scroll parents
26354 state.scrollParents.forEach(function (target) {
26355 target.removeEventListener('scroll', state.updateBound);
26356 });
26357
26358 // Reset state
26359 state.updateBound = null;
26360 state.scrollParents = [];
26361 state.scrollElement = null;
26362 state.eventsEnabled = false;
26363 return state;
26364 }
26365
26366 /**
26367 * It will remove resize/scroll events and won't recalculate popper position
26368 * when they are triggered. It also won't trigger `onUpdate` callback anymore,
26369 * unless you call `update` method manually.
26370 * @method
26371 * @memberof Popper
26372 */
26373 function disableEventListeners() {
26374 if (this.state.eventsEnabled) {
26375 cancelAnimationFrame(this.scheduleUpdate);
26376 this.state = removeEventListeners(this.reference, this.state);
26377 }
26378 }
26379
26380 /**
26381 * Tells if a given input is a number
26382 * @method
26383 * @memberof Popper.Utils
26384 * @param {*} input to check
26385 * @return {Boolean}
26386 */
26387 function isNumeric(n) {
26388 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
26389 }
26390
26391 /**
26392 * Set the style to the given popper
26393 * @method
26394 * @memberof Popper.Utils
26395 * @argument {Element} element - Element to apply the style to
26396 * @argument {Object} styles
26397 * Object with a list of properties and values which will be applied to the element
26398 */
26399 function setStyles(element, styles) {
26400 Object.keys(styles).forEach(function (prop) {
26401 var unit = '';
26402 // add unit if the value is numeric and is one of the following
26403 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
26404 unit = 'px';
26405 }
26406 element.style[prop] = styles[prop] + unit;
26407 });
26408 }
26409
26410 /**
26411 * Set the attributes to the given popper
26412 * @method
26413 * @memberof Popper.Utils
26414 * @argument {Element} element - Element to apply the attributes to
26415 * @argument {Object} styles
26416 * Object with a list of properties and values which will be applied to the element
26417 */
26418 function setAttributes(element, attributes) {
26419 Object.keys(attributes).forEach(function (prop) {
26420 var value = attributes[prop];
26421 if (value !== false) {
26422 element.setAttribute(prop, attributes[prop]);
26423 } else {
26424 element.removeAttribute(prop);
26425 }
26426 });
26427 }
26428
26429 /**
26430 * @function
26431 * @memberof Modifiers
26432 * @argument {Object} data - The data object generated by `update` method
26433 * @argument {Object} data.styles - List of style properties - values to apply to popper element
26434 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
26435 * @argument {Object} options - Modifiers configuration and options
26436 * @returns {Object} The same data object
26437 */
26438 function applyStyle(data) {
26439 // any property present in `data.styles` will be applied to the popper,
26440 // in this way we can make the 3rd party modifiers add custom styles to it
26441 // Be aware, modifiers could override the properties defined in the previous
26442 // lines of this modifier!
26443 setStyles(data.instance.popper, data.styles);
26444
26445 // any property present in `data.attributes` will be applied to the popper,
26446 // they will be set as HTML attributes of the element
26447 setAttributes(data.instance.popper, data.attributes);
26448
26449 // if arrowElement is defined and arrowStyles has some properties
26450 if (data.arrowElement && Object.keys(data.arrowStyles).length) {
26451 setStyles(data.arrowElement, data.arrowStyles);
26452 }
26453
26454 return data;
26455 }
26456
26457 /**
26458 * Set the x-placement attribute before everything else because it could be used
26459 * to add margins to the popper margins needs to be calculated to get the
26460 * correct popper offsets.
26461 * @method
26462 * @memberof Popper.modifiers
26463 * @param {HTMLElement} reference - The reference element used to position the popper
26464 * @param {HTMLElement} popper - The HTML element used as popper
26465 * @param {Object} options - Popper.js options
26466 */
26467 function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
26468 // compute reference element offsets
26469 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
26470
26471 // compute auto placement, store placement inside the data object,
26472 // modifiers will be able to edit `placement` if needed
26473 // and refer to originalPlacement to know the original value
26474 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
26475
26476 popper.setAttribute('x-placement', placement);
26477
26478 // Apply `position` to popper before anything else because
26479 // without the position applied we can't guarantee correct computations
26480 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
26481
26482 return options;
26483 }
26484
26485 /**
26486 * @function
26487 * @memberof Popper.Utils
26488 * @argument {Object} data - The data object generated by `update` method
26489 * @argument {Boolean} shouldRound - If the offsets should be rounded at all
26490 * @returns {Object} The popper's position offsets rounded
26491 *
26492 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
26493 * good as it can be within reason.
26494 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
26495 *
26496 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
26497 * as well on High DPI screens).
26498 *
26499 * Firefox prefers no rounding for positioning and does not have blurriness on
26500 * high DPI screens.
26501 *
26502 * Only horizontal placement and left/right values need to be considered.
26503 */
26504 function getRoundedOffsets(data, shouldRound) {
26505 var _data$offsets = data.offsets,
26506 popper = _data$offsets.popper,
26507 reference = _data$offsets.reference;
26508 var round = Math.round,
26509 floor = Math.floor;
26510
26511 var noRound = function noRound(v) {
26512 return v;
26513 };
26514
26515 var referenceWidth = round(reference.width);
26516 var popperWidth = round(popper.width);
26517
26518 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
26519 var isVariation = data.placement.indexOf('-') !== -1;
26520 var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
26521 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
26522
26523 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
26524 var verticalToInteger = !shouldRound ? noRound : round;
26525
26526 return {
26527 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
26528 top: verticalToInteger(popper.top),
26529 bottom: verticalToInteger(popper.bottom),
26530 right: horizontalToInteger(popper.right)
26531 };
26532 }
26533
26534 var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
26535
26536 /**
26537 * @function
26538 * @memberof Modifiers
26539 * @argument {Object} data - The data object generated by `update` method
26540 * @argument {Object} options - Modifiers configuration and options
26541 * @returns {Object} The data object, properly modified
26542 */
26543 function computeStyle(data, options) {
26544 var x = options.x,
26545 y = options.y;
26546 var popper = data.offsets.popper;
26547
26548 // Remove this legacy support in Popper.js v2
26549
26550 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
26551 return modifier.name === 'applyStyle';
26552 }).gpuAcceleration;
26553 if (legacyGpuAccelerationOption !== undefined) {
26554 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
26555 }
26556 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
26557
26558 var offsetParent = getOffsetParent(data.instance.popper);
26559 var offsetParentRect = getBoundingClientRect(offsetParent);
26560
26561 // Styles
26562 var styles = {
26563 position: popper.position
26564 };
26565
26566 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
26567
26568 var sideA = x === 'bottom' ? 'top' : 'bottom';
26569 var sideB = y === 'right' ? 'left' : 'right';
26570
26571 // if gpuAcceleration is set to `true` and transform is supported,
26572 // we use `translate3d` to apply the position to the popper we
26573 // automatically use the supported prefixed version if needed
26574 var prefixedProperty = getSupportedPropertyName('transform');
26575
26576 // now, let's make a step back and look at this code closely (wtf?)
26577 // If the content of the popper grows once it's been positioned, it
26578 // may happen that the popper gets misplaced because of the new content
26579 // overflowing its reference element
26580 // To avoid this problem, we provide two options (x and y), which allow
26581 // the consumer to define the offset origin.
26582 // If we position a popper on top of a reference element, we can set
26583 // `x` to `top` to make the popper grow towards its top instead of
26584 // its bottom.
26585 var left = void 0,
26586 top = void 0;
26587 if (sideA === 'bottom') {
26588 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
26589 // and not the bottom of the html element
26590 if (offsetParent.nodeName === 'HTML') {
26591 top = -offsetParent.clientHeight + offsets.bottom;
26592 } else {
26593 top = -offsetParentRect.height + offsets.bottom;
26594 }
26595 } else {
26596 top = offsets.top;
26597 }
26598 if (sideB === 'right') {
26599 if (offsetParent.nodeName === 'HTML') {
26600 left = -offsetParent.clientWidth + offsets.right;
26601 } else {
26602 left = -offsetParentRect.width + offsets.right;
26603 }
26604 } else {
26605 left = offsets.left;
26606 }
26607 if (gpuAcceleration && prefixedProperty) {
26608 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
26609 styles[sideA] = 0;
26610 styles[sideB] = 0;
26611 styles.willChange = 'transform';
26612 } else {
26613 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
26614 var invertTop = sideA === 'bottom' ? -1 : 1;
26615 var invertLeft = sideB === 'right' ? -1 : 1;
26616 styles[sideA] = top * invertTop;
26617 styles[sideB] = left * invertLeft;
26618 styles.willChange = sideA + ', ' + sideB;
26619 }
26620
26621 // Attributes
26622 var attributes = {
26623 'x-placement': data.placement
26624 };
26625
26626 // Update `data` attributes, styles and arrowStyles
26627 data.attributes = _extends$2({}, attributes, data.attributes);
26628 data.styles = _extends$2({}, styles, data.styles);
26629 data.arrowStyles = _extends$2({}, data.offsets.arrow, data.arrowStyles);
26630
26631 return data;
26632 }
26633
26634 /**
26635 * Helper used to know if the given modifier depends from another one.<br />
26636 * It checks if the needed modifier is listed and enabled.
26637 * @method
26638 * @memberof Popper.Utils
26639 * @param {Array} modifiers - list of modifiers
26640 * @param {String} requestingName - name of requesting modifier
26641 * @param {String} requestedName - name of requested modifier
26642 * @returns {Boolean}
26643 */
26644 function isModifierRequired(modifiers, requestingName, requestedName) {
26645 var requesting = find(modifiers, function (_ref) {
26646 var name = _ref.name;
26647 return name === requestingName;
26648 });
26649
26650 var isRequired = !!requesting && modifiers.some(function (modifier) {
26651 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
26652 });
26653
26654 if (!isRequired) {
26655 var _requesting = '`' + requestingName + '`';
26656 var requested = '`' + requestedName + '`';
26657 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
26658 }
26659 return isRequired;
26660 }
26661
26662 /**
26663 * @function
26664 * @memberof Modifiers
26665 * @argument {Object} data - The data object generated by update method
26666 * @argument {Object} options - Modifiers configuration and options
26667 * @returns {Object} The data object, properly modified
26668 */
26669 function arrow(data, options) {
26670 var _data$offsets$arrow;
26671
26672 // arrow depends on keepTogether in order to work
26673 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
26674 return data;
26675 }
26676
26677 var arrowElement = options.element;
26678
26679 // if arrowElement is a string, suppose it's a CSS selector
26680 if (typeof arrowElement === 'string') {
26681 arrowElement = data.instance.popper.querySelector(arrowElement);
26682
26683 // if arrowElement is not found, don't run the modifier
26684 if (!arrowElement) {
26685 return data;
26686 }
26687 } else {
26688 // if the arrowElement isn't a query selector we must check that the
26689 // provided DOM node is child of its popper node
26690 if (!data.instance.popper.contains(arrowElement)) {
26691 console.warn('WARNING: `arrow.element` must be child of its popper element!');
26692 return data;
26693 }
26694 }
26695
26696 var placement = data.placement.split('-')[0];
26697 var _data$offsets = data.offsets,
26698 popper = _data$offsets.popper,
26699 reference = _data$offsets.reference;
26700
26701 var isVertical = ['left', 'right'].indexOf(placement) !== -1;
26702
26703 var len = isVertical ? 'height' : 'width';
26704 var sideCapitalized = isVertical ? 'Top' : 'Left';
26705 var side = sideCapitalized.toLowerCase();
26706 var altSide = isVertical ? 'left' : 'top';
26707 var opSide = isVertical ? 'bottom' : 'right';
26708 var arrowElementSize = getOuterSizes(arrowElement)[len];
26709
26710 //
26711 // extends keepTogether behavior making sure the popper and its
26712 // reference have enough pixels in conjunction
26713 //
26714
26715 // top/left side
26716 if (reference[opSide] - arrowElementSize < popper[side]) {
26717 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
26718 }
26719 // bottom/right side
26720 if (reference[side] + arrowElementSize > popper[opSide]) {
26721 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
26722 }
26723 data.offsets.popper = getClientRect(data.offsets.popper);
26724
26725 // compute center of the popper
26726 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
26727
26728 // Compute the sideValue using the updated popper offsets
26729 // take popper margin in account because we don't have this info available
26730 var css = getStyleComputedProperty(data.instance.popper);
26731 var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
26732 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
26733 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
26734
26735 // prevent arrowElement from being placed not contiguously to its popper
26736 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
26737
26738 data.arrowElement = arrowElement;
26739 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
26740
26741 return data;
26742 }
26743
26744 /**
26745 * Get the opposite placement variation of the given one
26746 * @method
26747 * @memberof Popper.Utils
26748 * @argument {String} placement variation
26749 * @returns {String} flipped placement variation
26750 */
26751 function getOppositeVariation(variation) {
26752 if (variation === 'end') {
26753 return 'start';
26754 } else if (variation === 'start') {
26755 return 'end';
26756 }
26757 return variation;
26758 }
26759
26760 /**
26761 * List of accepted placements to use as values of the `placement` option.<br />
26762 * Valid placements are:
26763 * - `auto`
26764 * - `top`
26765 * - `right`
26766 * - `bottom`
26767 * - `left`
26768 *
26769 * Each placement can have a variation from this list:
26770 * - `-start`
26771 * - `-end`
26772 *
26773 * Variations are interpreted easily if you think of them as the left to right
26774 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
26775 * is right.<br />
26776 * Vertically (`left` and `right`), `start` is top and `end` is bottom.
26777 *
26778 * Some valid examples are:
26779 * - `top-end` (on top of reference, right aligned)
26780 * - `right-start` (on right of reference, top aligned)
26781 * - `bottom` (on bottom, centered)
26782 * - `auto-end` (on the side with more space available, alignment depends by placement)
26783 *
26784 * @static
26785 * @type {Array}
26786 * @enum {String}
26787 * @readonly
26788 * @method placements
26789 * @memberof Popper
26790 */
26791 var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
26792
26793 // Get rid of `auto` `auto-start` and `auto-end`
26794 var validPlacements = placements.slice(3);
26795
26796 /**
26797 * Given an initial placement, returns all the subsequent placements
26798 * clockwise (or counter-clockwise).
26799 *
26800 * @method
26801 * @memberof Popper.Utils
26802 * @argument {String} placement - A valid placement (it accepts variations)
26803 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
26804 * @returns {Array} placements including their variations
26805 */
26806 function clockwise(placement) {
26807 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
26808
26809 var index = validPlacements.indexOf(placement);
26810 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
26811 return counter ? arr.reverse() : arr;
26812 }
26813
26814 var BEHAVIORS = {
26815 FLIP: 'flip',
26816 CLOCKWISE: 'clockwise',
26817 COUNTERCLOCKWISE: 'counterclockwise'
26818 };
26819
26820 /**
26821 * @function
26822 * @memberof Modifiers
26823 * @argument {Object} data - The data object generated by update method
26824 * @argument {Object} options - Modifiers configuration and options
26825 * @returns {Object} The data object, properly modified
26826 */
26827 function flip(data, options) {
26828 // if `inner` modifier is enabled, we can't use the `flip` modifier
26829 if (isModifierEnabled(data.instance.modifiers, 'inner')) {
26830 return data;
26831 }
26832
26833 if (data.flipped && data.placement === data.originalPlacement) {
26834 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
26835 return data;
26836 }
26837
26838 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
26839
26840 var placement = data.placement.split('-')[0];
26841 var placementOpposite = getOppositePlacement(placement);
26842 var variation = data.placement.split('-')[1] || '';
26843
26844 var flipOrder = [];
26845
26846 switch (options.behavior) {
26847 case BEHAVIORS.FLIP:
26848 flipOrder = [placement, placementOpposite];
26849 break;
26850 case BEHAVIORS.CLOCKWISE:
26851 flipOrder = clockwise(placement);
26852 break;
26853 case BEHAVIORS.COUNTERCLOCKWISE:
26854 flipOrder = clockwise(placement, true);
26855 break;
26856 default:
26857 flipOrder = options.behavior;
26858 }
26859
26860 flipOrder.forEach(function (step, index) {
26861 if (placement !== step || flipOrder.length === index + 1) {
26862 return data;
26863 }
26864
26865 placement = data.placement.split('-')[0];
26866 placementOpposite = getOppositePlacement(placement);
26867
26868 var popperOffsets = data.offsets.popper;
26869 var refOffsets = data.offsets.reference;
26870
26871 // using floor because the reference offsets may contain decimals we are not going to consider here
26872 var floor = Math.floor;
26873 var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
26874
26875 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
26876 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
26877 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
26878 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
26879
26880 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
26881
26882 // flip the variation if required
26883 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
26884
26885 // flips variation if reference element overflows boundaries
26886 var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
26887
26888 // flips variation if popper content overflows boundaries
26889 var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
26890
26891 var flippedVariation = flippedVariationByRef || flippedVariationByContent;
26892
26893 if (overlapsRef || overflowsBoundaries || flippedVariation) {
26894 // this boolean to detect any flip loop
26895 data.flipped = true;
26896
26897 if (overlapsRef || overflowsBoundaries) {
26898 placement = flipOrder[index + 1];
26899 }
26900
26901 if (flippedVariation) {
26902 variation = getOppositeVariation(variation);
26903 }
26904
26905 data.placement = placement + (variation ? '-' + variation : '');
26906
26907 // this object contains `position`, we want to preserve it along with
26908 // any additional property we may add in the future
26909 data.offsets.popper = _extends$2({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
26910
26911 data = runModifiers(data.instance.modifiers, data, 'flip');
26912 }
26913 });
26914 return data;
26915 }
26916
26917 /**
26918 * @function
26919 * @memberof Modifiers
26920 * @argument {Object} data - The data object generated by update method
26921 * @argument {Object} options - Modifiers configuration and options
26922 * @returns {Object} The data object, properly modified
26923 */
26924 function keepTogether(data) {
26925 var _data$offsets = data.offsets,
26926 popper = _data$offsets.popper,
26927 reference = _data$offsets.reference;
26928
26929 var placement = data.placement.split('-')[0];
26930 var floor = Math.floor;
26931 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
26932 var side = isVertical ? 'right' : 'bottom';
26933 var opSide = isVertical ? 'left' : 'top';
26934 var measurement = isVertical ? 'width' : 'height';
26935
26936 if (popper[side] < floor(reference[opSide])) {
26937 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
26938 }
26939 if (popper[opSide] > floor(reference[side])) {
26940 data.offsets.popper[opSide] = floor(reference[side]);
26941 }
26942
26943 return data;
26944 }
26945
26946 /**
26947 * Converts a string containing value + unit into a px value number
26948 * @function
26949 * @memberof {modifiers~offset}
26950 * @private
26951 * @argument {String} str - Value + unit string
26952 * @argument {String} measurement - `height` or `width`
26953 * @argument {Object} popperOffsets
26954 * @argument {Object} referenceOffsets
26955 * @returns {Number|String}
26956 * Value in pixels, or original string if no values were extracted
26957 */
26958 function toValue(str, measurement, popperOffsets, referenceOffsets) {
26959 // separate value from unit
26960 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
26961 var value = +split[1];
26962 var unit = split[2];
26963
26964 // If it's not a number it's an operator, I guess
26965 if (!value) {
26966 return str;
26967 }
26968
26969 if (unit.indexOf('%') === 0) {
26970 var element = void 0;
26971 switch (unit) {
26972 case '%p':
26973 element = popperOffsets;
26974 break;
26975 case '%':
26976 case '%r':
26977 default:
26978 element = referenceOffsets;
26979 }
26980
26981 var rect = getClientRect(element);
26982 return rect[measurement] / 100 * value;
26983 } else if (unit === 'vh' || unit === 'vw') {
26984 // if is a vh or vw, we calculate the size based on the viewport
26985 var size = void 0;
26986 if (unit === 'vh') {
26987 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
26988 } else {
26989 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
26990 }
26991 return size / 100 * value;
26992 } else {
26993 // if is an explicit pixel unit, we get rid of the unit and keep the value
26994 // if is an implicit unit, it's px, and we return just the value
26995 return value;
26996 }
26997 }
26998
26999 /**
27000 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
27001 * @function
27002 * @memberof {modifiers~offset}
27003 * @private
27004 * @argument {String} offset
27005 * @argument {Object} popperOffsets
27006 * @argument {Object} referenceOffsets
27007 * @argument {String} basePlacement
27008 * @returns {Array} a two cells array with x and y offsets in numbers
27009 */
27010 function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
27011 var offsets = [0, 0];
27012
27013 // Use height if placement is left or right and index is 0 otherwise use width
27014 // in this way the first offset will use an axis and the second one
27015 // will use the other one
27016 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
27017
27018 // Split the offset string to obtain a list of values and operands
27019 // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
27020 var fragments = offset.split(/(\+|\-)/).map(function (frag) {
27021 return frag.trim();
27022 });
27023
27024 // Detect if the offset string contains a pair of values or a single one
27025 // they could be separated by comma or space
27026 var divider = fragments.indexOf(find(fragments, function (frag) {
27027 return frag.search(/,|\s/) !== -1;
27028 }));
27029
27030 if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
27031 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
27032 }
27033
27034 // If divider is found, we divide the list of values and operands to divide
27035 // them by ofset X and Y.
27036 var splitRegex = /\s*,\s*|\s+/;
27037 var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
27038
27039 // Convert the values with units to absolute pixels to allow our computations
27040 ops = ops.map(function (op, index) {
27041 // Most of the units rely on the orientation of the popper
27042 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
27043 var mergeWithPrevious = false;
27044 return op
27045 // This aggregates any `+` or `-` sign that aren't considered operators
27046 // e.g.: 10 + +5 => [10, +, +5]
27047 .reduce(function (a, b) {
27048 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
27049 a[a.length - 1] = b;
27050 mergeWithPrevious = true;
27051 return a;
27052 } else if (mergeWithPrevious) {
27053 a[a.length - 1] += b;
27054 mergeWithPrevious = false;
27055 return a;
27056 } else {
27057 return a.concat(b);
27058 }
27059 }, [])
27060 // Here we convert the string values into number values (in px)
27061 .map(function (str) {
27062 return toValue(str, measurement, popperOffsets, referenceOffsets);
27063 });
27064 });
27065
27066 // Loop trough the offsets arrays and execute the operations
27067 ops.forEach(function (op, index) {
27068 op.forEach(function (frag, index2) {
27069 if (isNumeric(frag)) {
27070 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
27071 }
27072 });
27073 });
27074 return offsets;
27075 }
27076
27077 /**
27078 * @function
27079 * @memberof Modifiers
27080 * @argument {Object} data - The data object generated by update method
27081 * @argument {Object} options - Modifiers configuration and options
27082 * @argument {Number|String} options.offset=0
27083 * The offset value as described in the modifier description
27084 * @returns {Object} The data object, properly modified
27085 */
27086 function offset(data, _ref) {
27087 var offset = _ref.offset;
27088 var placement = data.placement,
27089 _data$offsets = data.offsets,
27090 popper = _data$offsets.popper,
27091 reference = _data$offsets.reference;
27092
27093 var basePlacement = placement.split('-')[0];
27094
27095 var offsets = void 0;
27096 if (isNumeric(+offset)) {
27097 offsets = [+offset, 0];
27098 } else {
27099 offsets = parseOffset(offset, popper, reference, basePlacement);
27100 }
27101
27102 if (basePlacement === 'left') {
27103 popper.top += offsets[0];
27104 popper.left -= offsets[1];
27105 } else if (basePlacement === 'right') {
27106 popper.top += offsets[0];
27107 popper.left += offsets[1];
27108 } else if (basePlacement === 'top') {
27109 popper.left += offsets[0];
27110 popper.top -= offsets[1];
27111 } else if (basePlacement === 'bottom') {
27112 popper.left += offsets[0];
27113 popper.top += offsets[1];
27114 }
27115
27116 data.popper = popper;
27117 return data;
27118 }
27119
27120 /**
27121 * @function
27122 * @memberof Modifiers
27123 * @argument {Object} data - The data object generated by `update` method
27124 * @argument {Object} options - Modifiers configuration and options
27125 * @returns {Object} The data object, properly modified
27126 */
27127 function preventOverflow(data, options) {
27128 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
27129
27130 // If offsetParent is the reference element, we really want to
27131 // go one step up and use the next offsetParent as reference to
27132 // avoid to make this modifier completely useless and look like broken
27133 if (data.instance.reference === boundariesElement) {
27134 boundariesElement = getOffsetParent(boundariesElement);
27135 }
27136
27137 // NOTE: DOM access here
27138 // resets the popper's position so that the document size can be calculated excluding
27139 // the size of the popper element itself
27140 var transformProp = getSupportedPropertyName('transform');
27141 var popperStyles = data.instance.popper.style; // assignment to help minification
27142 var top = popperStyles.top,
27143 left = popperStyles.left,
27144 transform = popperStyles[transformProp];
27145
27146 popperStyles.top = '';
27147 popperStyles.left = '';
27148 popperStyles[transformProp] = '';
27149
27150 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
27151
27152 // NOTE: DOM access here
27153 // restores the original style properties after the offsets have been computed
27154 popperStyles.top = top;
27155 popperStyles.left = left;
27156 popperStyles[transformProp] = transform;
27157
27158 options.boundaries = boundaries;
27159
27160 var order = options.priority;
27161 var popper = data.offsets.popper;
27162
27163 var check = {
27164 primary: function primary(placement) {
27165 var value = popper[placement];
27166 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
27167 value = Math.max(popper[placement], boundaries[placement]);
27168 }
27169 return defineProperty({}, placement, value);
27170 },
27171 secondary: function secondary(placement) {
27172 var mainSide = placement === 'right' ? 'left' : 'top';
27173 var value = popper[mainSide];
27174 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
27175 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
27176 }
27177 return defineProperty({}, mainSide, value);
27178 }
27179 };
27180
27181 order.forEach(function (placement) {
27182 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
27183 popper = _extends$2({}, popper, check[side](placement));
27184 });
27185
27186 data.offsets.popper = popper;
27187
27188 return data;
27189 }
27190
27191 /**
27192 * @function
27193 * @memberof Modifiers
27194 * @argument {Object} data - The data object generated by `update` method
27195 * @argument {Object} options - Modifiers configuration and options
27196 * @returns {Object} The data object, properly modified
27197 */
27198 function shift(data) {
27199 var placement = data.placement;
27200 var basePlacement = placement.split('-')[0];
27201 var shiftvariation = placement.split('-')[1];
27202
27203 // if shift shiftvariation is specified, run the modifier
27204 if (shiftvariation) {
27205 var _data$offsets = data.offsets,
27206 reference = _data$offsets.reference,
27207 popper = _data$offsets.popper;
27208
27209 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
27210 var side = isVertical ? 'left' : 'top';
27211 var measurement = isVertical ? 'width' : 'height';
27212
27213 var shiftOffsets = {
27214 start: defineProperty({}, side, reference[side]),
27215 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
27216 };
27217
27218 data.offsets.popper = _extends$2({}, popper, shiftOffsets[shiftvariation]);
27219 }
27220
27221 return data;
27222 }
27223
27224 /**
27225 * @function
27226 * @memberof Modifiers
27227 * @argument {Object} data - The data object generated by update method
27228 * @argument {Object} options - Modifiers configuration and options
27229 * @returns {Object} The data object, properly modified
27230 */
27231 function hide(data) {
27232 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
27233 return data;
27234 }
27235
27236 var refRect = data.offsets.reference;
27237 var bound = find(data.instance.modifiers, function (modifier) {
27238 return modifier.name === 'preventOverflow';
27239 }).boundaries;
27240
27241 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
27242 // Avoid unnecessary DOM access if visibility hasn't changed
27243 if (data.hide === true) {
27244 return data;
27245 }
27246
27247 data.hide = true;
27248 data.attributes['x-out-of-boundaries'] = '';
27249 } else {
27250 // Avoid unnecessary DOM access if visibility hasn't changed
27251 if (data.hide === false) {
27252 return data;
27253 }
27254
27255 data.hide = false;
27256 data.attributes['x-out-of-boundaries'] = false;
27257 }
27258
27259 return data;
27260 }
27261
27262 /**
27263 * @function
27264 * @memberof Modifiers
27265 * @argument {Object} data - The data object generated by `update` method
27266 * @argument {Object} options - Modifiers configuration and options
27267 * @returns {Object} The data object, properly modified
27268 */
27269 function inner(data) {
27270 var placement = data.placement;
27271 var basePlacement = placement.split('-')[0];
27272 var _data$offsets = data.offsets,
27273 popper = _data$offsets.popper,
27274 reference = _data$offsets.reference;
27275
27276 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
27277
27278 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
27279
27280 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
27281
27282 data.placement = getOppositePlacement(placement);
27283 data.offsets.popper = getClientRect(popper);
27284
27285 return data;
27286 }
27287
27288 /**
27289 * Modifier function, each modifier can have a function of this type assigned
27290 * to its `fn` property.<br />
27291 * These functions will be called on each update, this means that you must
27292 * make sure they are performant enough to avoid performance bottlenecks.
27293 *
27294 * @function ModifierFn
27295 * @argument {dataObject} data - The data object generated by `update` method
27296 * @argument {Object} options - Modifiers configuration and options
27297 * @returns {dataObject} The data object, properly modified
27298 */
27299
27300 /**
27301 * Modifiers are plugins used to alter the behavior of your poppers.<br />
27302 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
27303 * needed by the library.
27304 *
27305 * Usually you don't want to override the `order`, `fn` and `onLoad` props.
27306 * All the other properties are configurations that could be tweaked.
27307 * @namespace modifiers
27308 */
27309 var modifiers = {
27310 /**
27311 * Modifier used to shift the popper on the start or end of its reference
27312 * element.<br />
27313 * It will read the variation of the `placement` property.<br />
27314 * It can be one either `-end` or `-start`.
27315 * @memberof modifiers
27316 * @inner
27317 */
27318 shift: {
27319 /** @prop {number} order=100 - Index used to define the order of execution */
27320 order: 100,
27321 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
27322 enabled: true,
27323 /** @prop {ModifierFn} */
27324 fn: shift
27325 },
27326
27327 /**
27328 * The `offset` modifier can shift your popper on both its axis.
27329 *
27330 * It accepts the following units:
27331 * - `px` or unit-less, interpreted as pixels
27332 * - `%` or `%r`, percentage relative to the length of the reference element
27333 * - `%p`, percentage relative to the length of the popper element
27334 * - `vw`, CSS viewport width unit
27335 * - `vh`, CSS viewport height unit
27336 *
27337 * For length is intended the main axis relative to the placement of the popper.<br />
27338 * This means that if the placement is `top` or `bottom`, the length will be the
27339 * `width`. In case of `left` or `right`, it will be the `height`.
27340 *
27341 * You can provide a single value (as `Number` or `String`), or a pair of values
27342 * as `String` divided by a comma or one (or more) white spaces.<br />
27343 * The latter is a deprecated method because it leads to confusion and will be
27344 * removed in v2.<br />
27345 * Additionally, it accepts additions and subtractions between different units.
27346 * Note that multiplications and divisions aren't supported.
27347 *
27348 * Valid examples are:
27349 * ```
27350 * 10
27351 * '10%'
27352 * '10, 10'
27353 * '10%, 10'
27354 * '10 + 10%'
27355 * '10 - 5vh + 3%'
27356 * '-10px + 5vh, 5px - 6%'
27357 * ```
27358 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
27359 * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
27360 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
27361 *
27362 * @memberof modifiers
27363 * @inner
27364 */
27365 offset: {
27366 /** @prop {number} order=200 - Index used to define the order of execution */
27367 order: 200,
27368 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
27369 enabled: true,
27370 /** @prop {ModifierFn} */
27371 fn: offset,
27372 /** @prop {Number|String} offset=0
27373 * The offset value as described in the modifier description
27374 */
27375 offset: 0
27376 },
27377
27378 /**
27379 * Modifier used to prevent the popper from being positioned outside the boundary.
27380 *
27381 * A scenario exists where the reference itself is not within the boundaries.<br />
27382 * We can say it has "escaped the boundaries" — or just "escaped".<br />
27383 * In this case we need to decide whether the popper should either:
27384 *
27385 * - detach from the reference and remain "trapped" in the boundaries, or
27386 * - if it should ignore the boundary and "escape with its reference"
27387 *
27388 * When `escapeWithReference` is set to`true` and reference is completely
27389 * outside its boundaries, the popper will overflow (or completely leave)
27390 * the boundaries in order to remain attached to the edge of the reference.
27391 *
27392 * @memberof modifiers
27393 * @inner
27394 */
27395 preventOverflow: {
27396 /** @prop {number} order=300 - Index used to define the order of execution */
27397 order: 300,
27398 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
27399 enabled: true,
27400 /** @prop {ModifierFn} */
27401 fn: preventOverflow,
27402 /**
27403 * @prop {Array} [priority=['left','right','top','bottom']]
27404 * Popper will try to prevent overflow following these priorities by default,
27405 * then, it could overflow on the left and on top of the `boundariesElement`
27406 */
27407 priority: ['left', 'right', 'top', 'bottom'],
27408 /**
27409 * @prop {number} padding=5
27410 * Amount of pixel used to define a minimum distance between the boundaries
27411 * and the popper. This makes sure the popper always has a little padding
27412 * between the edges of its container
27413 */
27414 padding: 5,
27415 /**
27416 * @prop {String|HTMLElement} boundariesElement='scrollParent'
27417 * Boundaries used by the modifier. Can be `scrollParent`, `window`,
27418 * `viewport` or any DOM element.
27419 */
27420 boundariesElement: 'scrollParent'
27421 },
27422
27423 /**
27424 * Modifier used to make sure the reference and its popper stay near each other
27425 * without leaving any gap between the two. Especially useful when the arrow is
27426 * enabled and you want to ensure that it points to its reference element.
27427 * It cares only about the first axis. You can still have poppers with margin
27428 * between the popper and its reference element.
27429 * @memberof modifiers
27430 * @inner
27431 */
27432 keepTogether: {
27433 /** @prop {number} order=400 - Index used to define the order of execution */
27434 order: 400,
27435 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
27436 enabled: true,
27437 /** @prop {ModifierFn} */
27438 fn: keepTogether
27439 },
27440
27441 /**
27442 * This modifier is used to move the `arrowElement` of the popper to make
27443 * sure it is positioned between the reference element and its popper element.
27444 * It will read the outer size of the `arrowElement` node to detect how many
27445 * pixels of conjunction are needed.
27446 *
27447 * It has no effect if no `arrowElement` is provided.
27448 * @memberof modifiers
27449 * @inner
27450 */
27451 arrow: {
27452 /** @prop {number} order=500 - Index used to define the order of execution */
27453 order: 500,
27454 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
27455 enabled: true,
27456 /** @prop {ModifierFn} */
27457 fn: arrow,
27458 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
27459 element: '[x-arrow]'
27460 },
27461
27462 /**
27463 * Modifier used to flip the popper's placement when it starts to overlap its
27464 * reference element.
27465 *
27466 * Requires the `preventOverflow` modifier before it in order to work.
27467 *
27468 * **NOTE:** this modifier will interrupt the current update cycle and will
27469 * restart it if it detects the need to flip the placement.
27470 * @memberof modifiers
27471 * @inner
27472 */
27473 flip: {
27474 /** @prop {number} order=600 - Index used to define the order of execution */
27475 order: 600,
27476 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
27477 enabled: true,
27478 /** @prop {ModifierFn} */
27479 fn: flip,
27480 /**
27481 * @prop {String|Array} behavior='flip'
27482 * The behavior used to change the popper's placement. It can be one of
27483 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
27484 * placements (with optional variations)
27485 */
27486 behavior: 'flip',
27487 /**
27488 * @prop {number} padding=5
27489 * The popper will flip if it hits the edges of the `boundariesElement`
27490 */
27491 padding: 5,
27492 /**
27493 * @prop {String|HTMLElement} boundariesElement='viewport'
27494 * The element which will define the boundaries of the popper position.
27495 * The popper will never be placed outside of the defined boundaries
27496 * (except if `keepTogether` is enabled)
27497 */
27498 boundariesElement: 'viewport',
27499 /**
27500 * @prop {Boolean} flipVariations=false
27501 * The popper will switch placement variation between `-start` and `-end` when
27502 * the reference element overlaps its boundaries.
27503 *
27504 * The original placement should have a set variation.
27505 */
27506 flipVariations: false,
27507 /**
27508 * @prop {Boolean} flipVariationsByContent=false
27509 * The popper will switch placement variation between `-start` and `-end` when
27510 * the popper element overlaps its reference boundaries.
27511 *
27512 * The original placement should have a set variation.
27513 */
27514 flipVariationsByContent: false
27515 },
27516
27517 /**
27518 * Modifier used to make the popper flow toward the inner of the reference element.
27519 * By default, when this modifier is disabled, the popper will be placed outside
27520 * the reference element.
27521 * @memberof modifiers
27522 * @inner
27523 */
27524 inner: {
27525 /** @prop {number} order=700 - Index used to define the order of execution */
27526 order: 700,
27527 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
27528 enabled: false,
27529 /** @prop {ModifierFn} */
27530 fn: inner
27531 },
27532
27533 /**
27534 * Modifier used to hide the popper when its reference element is outside of the
27535 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
27536 * be used to hide with a CSS selector the popper when its reference is
27537 * out of boundaries.
27538 *
27539 * Requires the `preventOverflow` modifier before it in order to work.
27540 * @memberof modifiers
27541 * @inner
27542 */
27543 hide: {
27544 /** @prop {number} order=800 - Index used to define the order of execution */
27545 order: 800,
27546 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
27547 enabled: true,
27548 /** @prop {ModifierFn} */
27549 fn: hide
27550 },
27551
27552 /**
27553 * Computes the style that will be applied to the popper element to gets
27554 * properly positioned.
27555 *
27556 * Note that this modifier will not touch the DOM, it just prepares the styles
27557 * so that `applyStyle` modifier can apply it. This separation is useful
27558 * in case you need to replace `applyStyle` with a custom implementation.
27559 *
27560 * This modifier has `850` as `order` value to maintain backward compatibility
27561 * with previous versions of Popper.js. Expect the modifiers ordering method
27562 * to change in future major versions of the library.
27563 *
27564 * @memberof modifiers
27565 * @inner
27566 */
27567 computeStyle: {
27568 /** @prop {number} order=850 - Index used to define the order of execution */
27569 order: 850,
27570 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
27571 enabled: true,
27572 /** @prop {ModifierFn} */
27573 fn: computeStyle,
27574 /**
27575 * @prop {Boolean} gpuAcceleration=true
27576 * If true, it uses the CSS 3D transformation to position the popper.
27577 * Otherwise, it will use the `top` and `left` properties
27578 */
27579 gpuAcceleration: true,
27580 /**
27581 * @prop {string} [x='bottom']
27582 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
27583 * Change this if your popper should grow in a direction different from `bottom`
27584 */
27585 x: 'bottom',
27586 /**
27587 * @prop {string} [x='left']
27588 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
27589 * Change this if your popper should grow in a direction different from `right`
27590 */
27591 y: 'right'
27592 },
27593
27594 /**
27595 * Applies the computed styles to the popper element.
27596 *
27597 * All the DOM manipulations are limited to this modifier. This is useful in case
27598 * you want to integrate Popper.js inside a framework or view library and you
27599 * want to delegate all the DOM manipulations to it.
27600 *
27601 * Note that if you disable this modifier, you must make sure the popper element
27602 * has its position set to `absolute` before Popper.js can do its work!
27603 *
27604 * Just disable this modifier and define your own to achieve the desired effect.
27605 *
27606 * @memberof modifiers
27607 * @inner
27608 */
27609 applyStyle: {
27610 /** @prop {number} order=900 - Index used to define the order of execution */
27611 order: 900,
27612 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
27613 enabled: true,
27614 /** @prop {ModifierFn} */
27615 fn: applyStyle,
27616 /** @prop {Function} */
27617 onLoad: applyStyleOnLoad,
27618 /**
27619 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
27620 * @prop {Boolean} gpuAcceleration=true
27621 * If true, it uses the CSS 3D transformation to position the popper.
27622 * Otherwise, it will use the `top` and `left` properties
27623 */
27624 gpuAcceleration: undefined
27625 }
27626 };
27627
27628 /**
27629 * The `dataObject` is an object containing all the information used by Popper.js.
27630 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
27631 * @name dataObject
27632 * @property {Object} data.instance The Popper.js instance
27633 * @property {String} data.placement Placement applied to popper
27634 * @property {String} data.originalPlacement Placement originally defined on init
27635 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
27636 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
27637 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
27638 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
27639 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
27640 * @property {Object} data.boundaries Offsets of the popper boundaries
27641 * @property {Object} data.offsets The measurements of popper, reference and arrow elements
27642 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
27643 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
27644 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
27645 */
27646
27647 /**
27648 * Default options provided to Popper.js constructor.<br />
27649 * These can be overridden using the `options` argument of Popper.js.<br />
27650 * To override an option, simply pass an object with the same
27651 * structure of the `options` object, as the 3rd argument. For example:
27652 * ```
27653 * new Popper(ref, pop, {
27654 * modifiers: {
27655 * preventOverflow: { enabled: false }
27656 * }
27657 * })
27658 * ```
27659 * @type {Object}
27660 * @static
27661 * @memberof Popper
27662 */
27663 var Defaults = {
27664 /**
27665 * Popper's placement.
27666 * @prop {Popper.placements} placement='bottom'
27667 */
27668 placement: 'bottom',
27669
27670 /**
27671 * Set this to true if you want popper to position it self in 'fixed' mode
27672 * @prop {Boolean} positionFixed=false
27673 */
27674 positionFixed: false,
27675
27676 /**
27677 * Whether events (resize, scroll) are initially enabled.
27678 * @prop {Boolean} eventsEnabled=true
27679 */
27680 eventsEnabled: true,
27681
27682 /**
27683 * Set to true if you want to automatically remove the popper when
27684 * you call the `destroy` method.
27685 * @prop {Boolean} removeOnDestroy=false
27686 */
27687 removeOnDestroy: false,
27688
27689 /**
27690 * Callback called when the popper is created.<br />
27691 * By default, it is set to no-op.<br />
27692 * Access Popper.js instance with `data.instance`.
27693 * @prop {onCreate}
27694 */
27695 onCreate: function onCreate() {},
27696
27697 /**
27698 * Callback called when the popper is updated. This callback is not called
27699 * on the initialization/creation of the popper, but only on subsequent
27700 * updates.<br />
27701 * By default, it is set to no-op.<br />
27702 * Access Popper.js instance with `data.instance`.
27703 * @prop {onUpdate}
27704 */
27705 onUpdate: function onUpdate() {},
27706
27707 /**
27708 * List of modifiers used to modify the offsets before they are applied to the popper.
27709 * They provide most of the functionalities of Popper.js.
27710 * @prop {modifiers}
27711 */
27712 modifiers: modifiers
27713 };
27714
27715 /**
27716 * @callback onCreate
27717 * @param {dataObject} data
27718 */
27719
27720 /**
27721 * @callback onUpdate
27722 * @param {dataObject} data
27723 */
27724
27725 // Utils
27726 // Methods
27727 var Popper$1 = function () {
27728 /**
27729 * Creates a new Popper.js instance.
27730 * @class Popper
27731 * @param {Element|referenceObject} reference - The reference element used to position the popper
27732 * @param {Element} popper - The HTML / XML element used as the popper
27733 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
27734 * @return {Object} instance - The generated Popper.js instance
27735 */
27736 function Popper(reference, popper) {
27737 var _this = this;
27738
27739 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
27740 classCallCheck$2(this, Popper);
27741
27742 this.scheduleUpdate = function () {
27743 return requestAnimationFrame(_this.update);
27744 };
27745
27746 // make update() debounced, so that it only runs at most once-per-tick
27747 this.update = debounce(this.update.bind(this));
27748
27749 // with {} we create a new object with the options inside it
27750 this.options = _extends$2({}, Popper.Defaults, options);
27751
27752 // init state
27753 this.state = {
27754 isDestroyed: false,
27755 isCreated: false,
27756 scrollParents: []
27757 };
27758
27759 // get reference and popper elements (allow jQuery wrappers)
27760 this.reference = reference && reference.jquery ? reference[0] : reference;
27761 this.popper = popper && popper.jquery ? popper[0] : popper;
27762
27763 // Deep merge modifiers options
27764 this.options.modifiers = {};
27765 Object.keys(_extends$2({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
27766 _this.options.modifiers[name] = _extends$2({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
27767 });
27768
27769 // Refactoring modifiers' list (Object => Array)
27770 this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
27771 return _extends$2({
27772 name: name
27773 }, _this.options.modifiers[name]);
27774 })
27775 // sort the modifiers by order
27776 .sort(function (a, b) {
27777 return a.order - b.order;
27778 });
27779
27780 // modifiers have the ability to execute arbitrary code when Popper.js get inited
27781 // such code is executed in the same order of its modifier
27782 // they could add new properties to their options configuration
27783 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
27784 this.modifiers.forEach(function (modifierOptions) {
27785 if (modifierOptions.enabled && isFunction$1(modifierOptions.onLoad)) {
27786 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
27787 }
27788 });
27789
27790 // fire the first update to position the popper in the right place
27791 this.update();
27792
27793 var eventsEnabled = this.options.eventsEnabled;
27794 if (eventsEnabled) {
27795 // setup event listeners, they will take care of update the position in specific situations
27796 this.enableEventListeners();
27797 }
27798
27799 this.state.eventsEnabled = eventsEnabled;
27800 }
27801
27802 // We can't use class properties because they don't get listed in the
27803 // class prototype and break stuff like Sinon stubs
27804
27805
27806 createClass$2(Popper, [{
27807 key: 'update',
27808 value: function update$$1() {
27809 return update.call(this);
27810 }
27811 }, {
27812 key: 'destroy',
27813 value: function destroy$$1() {
27814 return destroy.call(this);
27815 }
27816 }, {
27817 key: 'enableEventListeners',
27818 value: function enableEventListeners$$1() {
27819 return enableEventListeners.call(this);
27820 }
27821 }, {
27822 key: 'disableEventListeners',
27823 value: function disableEventListeners$$1() {
27824 return disableEventListeners.call(this);
27825 }
27826
27827 /**
27828 * Schedules an update. It will run on the next UI update available.
27829 * @method scheduleUpdate
27830 * @memberof Popper
27831 */
27832
27833
27834 /**
27835 * Collection of utilities useful when writing custom modifiers.
27836 * Starting from version 1.7, this method is available only if you
27837 * include `popper-utils.js` before `popper.js`.
27838 *
27839 * **DEPRECATION**: This way to access PopperUtils is deprecated
27840 * and will be removed in v2! Use the PopperUtils module directly instead.
27841 * Due to the high instability of the methods contained in Utils, we can't
27842 * guarantee them to follow semver. Use them at your own risk!
27843 * @static
27844 * @private
27845 * @type {Object}
27846 * @deprecated since version 1.8
27847 * @member Utils
27848 * @memberof Popper
27849 */
27850
27851 }]);
27852 return Popper;
27853 }();
27854
27855 /**
27856 * The `referenceObject` is an object that provides an interface compatible with Popper.js
27857 * and lets you use it as replacement of a real DOM node.<br />
27858 * You can use this method to position a popper relatively to a set of coordinates
27859 * in case you don't have a DOM node to use as reference.
27860 *
27861 * ```
27862 * new Popper(referenceObject, popperNode);
27863 * ```
27864 *
27865 * NB: This feature isn't supported in Internet Explorer 10.
27866 * @name referenceObject
27867 * @property {Function} data.getBoundingClientRect
27868 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
27869 * @property {number} data.clientWidth
27870 * An ES6 getter that will return the width of the virtual reference element.
27871 * @property {number} data.clientHeight
27872 * An ES6 getter that will return the height of the virtual reference element.
27873 */
27874
27875
27876 Popper$1.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
27877 Popper$1.placements = placements;
27878 Popper$1.Defaults = Defaults;
27879
27880 function flipPlacement(placement, theme) {
27881 var direction = theme && theme.direction || 'ltr';
27882
27883 if (direction === 'ltr') {
27884 return placement;
27885 }
27886
27887 switch (placement) {
27888 case 'bottom-end':
27889 return 'bottom-start';
27890
27891 case 'bottom-start':
27892 return 'bottom-end';
27893
27894 case 'top-end':
27895 return 'top-start';
27896
27897 case 'top-start':
27898 return 'top-end';
27899
27900 default:
27901 return placement;
27902 }
27903 }
27904
27905 function getAnchorEl(anchorEl) {
27906 return typeof anchorEl === 'function' ? anchorEl() : anchorEl;
27907 }
27908
27909 var useEnhancedEffect = typeof window !== 'undefined' ? react.exports.useLayoutEffect : react.exports.useEffect;
27910 var defaultPopperOptions = {};
27911 /**
27912 * Poppers rely on the 3rd party library [Popper.js](https://popper.js.org/docs/v1/) for positioning.
27913 */
27914
27915 var Popper = /*#__PURE__*/react.exports.forwardRef(function Popper(props, ref) {
27916 var anchorEl = props.anchorEl,
27917 children = props.children,
27918 container = props.container,
27919 _props$disablePortal = props.disablePortal,
27920 disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal,
27921 _props$keepMounted = props.keepMounted,
27922 keepMounted = _props$keepMounted === void 0 ? false : _props$keepMounted,
27923 modifiers = props.modifiers,
27924 open = props.open,
27925 _props$placement = props.placement,
27926 initialPlacement = _props$placement === void 0 ? 'bottom' : _props$placement,
27927 _props$popperOptions = props.popperOptions,
27928 popperOptions = _props$popperOptions === void 0 ? defaultPopperOptions : _props$popperOptions,
27929 popperRefProp = props.popperRef,
27930 style = props.style,
27931 _props$transition = props.transition,
27932 transition = _props$transition === void 0 ? false : _props$transition,
27933 other = _objectWithoutProperties(props, ["anchorEl", "children", "container", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "style", "transition"]);
27934
27935 var tooltipRef = react.exports.useRef(null);
27936 var ownRef = useForkRef(tooltipRef, ref);
27937 var popperRef = react.exports.useRef(null);
27938 var handlePopperRef = useForkRef(popperRef, popperRefProp);
27939 var handlePopperRefRef = react.exports.useRef(handlePopperRef);
27940 useEnhancedEffect(function () {
27941 handlePopperRefRef.current = handlePopperRef;
27942 }, [handlePopperRef]);
27943 react.exports.useImperativeHandle(popperRefProp, function () {
27944 return popperRef.current;
27945 }, []);
27946
27947 var _React$useState = react.exports.useState(true),
27948 exited = _React$useState[0],
27949 setExited = _React$useState[1];
27950
27951 var theme = useTheme$2();
27952 var rtlPlacement = flipPlacement(initialPlacement, theme);
27953 /**
27954 * placement initialized from prop but can change during lifetime if modifiers.flip.
27955 * modifiers.flip is essentially a flip for controlled/uncontrolled behavior
27956 */
27957
27958 var _React$useState2 = react.exports.useState(rtlPlacement),
27959 placement = _React$useState2[0],
27960 setPlacement = _React$useState2[1];
27961
27962 react.exports.useEffect(function () {
27963 if (popperRef.current) {
27964 popperRef.current.update();
27965 }
27966 });
27967 var handleOpen = react.exports.useCallback(function () {
27968 if (!tooltipRef.current || !anchorEl || !open) {
27969 return;
27970 }
27971
27972 if (popperRef.current) {
27973 popperRef.current.destroy();
27974 handlePopperRefRef.current(null);
27975 }
27976
27977 var handlePopperUpdate = function handlePopperUpdate(data) {
27978 setPlacement(data.placement);
27979 };
27980
27981 getAnchorEl(anchorEl);
27982
27983 var popper = new Popper$1(getAnchorEl(anchorEl), tooltipRef.current, _extends$5({
27984 placement: rtlPlacement
27985 }, popperOptions, {
27986 modifiers: _extends$5({}, disablePortal ? {} : {
27987 // It's using scrollParent by default, we can use the viewport when using a portal.
27988 preventOverflow: {
27989 boundariesElement: 'window'
27990 }
27991 }, modifiers, popperOptions.modifiers),
27992 // We could have been using a custom modifier like react-popper is doing.
27993 // But it seems this is the best public API for this use case.
27994 onCreate: createChainedFunction(handlePopperUpdate, popperOptions.onCreate),
27995 onUpdate: createChainedFunction(handlePopperUpdate, popperOptions.onUpdate)
27996 }));
27997 handlePopperRefRef.current(popper);
27998 }, [anchorEl, disablePortal, modifiers, open, rtlPlacement, popperOptions]);
27999 var handleRef = react.exports.useCallback(function (node) {
28000 setRef(ownRef, node);
28001 handleOpen();
28002 }, [ownRef, handleOpen]);
28003
28004 var handleEnter = function handleEnter() {
28005 setExited(false);
28006 };
28007
28008 var handleClose = function handleClose() {
28009 if (!popperRef.current) {
28010 return;
28011 }
28012
28013 popperRef.current.destroy();
28014 handlePopperRefRef.current(null);
28015 };
28016
28017 var handleExited = function handleExited() {
28018 setExited(true);
28019 handleClose();
28020 };
28021
28022 react.exports.useEffect(function () {
28023 return function () {
28024 handleClose();
28025 };
28026 }, []);
28027 react.exports.useEffect(function () {
28028 if (!open && !transition) {
28029 // Otherwise handleExited will call this.
28030 handleClose();
28031 }
28032 }, [open, transition]);
28033
28034 if (!keepMounted && !open && (!transition || exited)) {
28035 return null;
28036 }
28037
28038 var childProps = {
28039 placement: placement
28040 };
28041
28042 if (transition) {
28043 childProps.TransitionProps = {
28044 in: open,
28045 onEnter: handleEnter,
28046 onExited: handleExited
28047 };
28048 }
28049
28050 return /*#__PURE__*/react.exports.createElement(Portal, {
28051 disablePortal: disablePortal,
28052 container: container
28053 }, /*#__PURE__*/react.exports.createElement("div", _extends$5({
28054 ref: handleRef,
28055 role: "tooltip"
28056 }, other, {
28057 style: _extends$5({
28058 // Prevents scroll issue, waiting for Popper.js to add this style once initiated.
28059 position: 'fixed',
28060 // Fix Popper.js display issue
28061 top: 0,
28062 left: 0,
28063 display: !open && keepMounted && !transition ? 'none' : null
28064 }, style)
28065 }), typeof children === 'function' ? children(childProps) : children));
28066 });
28067
28068 /**
28069 * @ignore - internal component.
28070 */
28071
28072 var RadioButtonUncheckedIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
28073 d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
28074 }));
28075
28076 /**
28077 * @ignore - internal component.
28078 */
28079
28080 var RadioButtonCheckedIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
28081 d: "M8.465 8.465C9.37 7.56 10.62 7 12 7C14.76 7 17 9.24 17 12C17 13.38 16.44 14.63 15.535 15.535C14.63 16.44 13.38 17 12 17C9.24 17 7 14.76 7 12C7 10.62 7.56 9.37 8.465 8.465Z"
28082 }));
28083
28084 var styles$w = function styles(theme) {
28085 return {
28086 root: {
28087 position: 'relative',
28088 display: 'flex',
28089 '&$checked $layer': {
28090 transform: 'scale(1)',
28091 transition: theme.transitions.create('transform', {
28092 easing: theme.transitions.easing.easeOut,
28093 duration: theme.transitions.duration.shortest
28094 })
28095 }
28096 },
28097 layer: {
28098 left: 0,
28099 position: 'absolute',
28100 transform: 'scale(0)',
28101 transition: theme.transitions.create('transform', {
28102 easing: theme.transitions.easing.easeIn,
28103 duration: theme.transitions.duration.shortest
28104 })
28105 },
28106 checked: {}
28107 };
28108 };
28109 /**
28110 * @ignore - internal component.
28111 */
28112
28113 function RadioButtonIcon(props) {
28114 var checked = props.checked,
28115 classes = props.classes,
28116 fontSize = props.fontSize;
28117 return /*#__PURE__*/react.exports.createElement("div", {
28118 className: clsx(classes.root, checked && classes.checked)
28119 }, /*#__PURE__*/react.exports.createElement(RadioButtonUncheckedIcon, {
28120 fontSize: fontSize
28121 }), /*#__PURE__*/react.exports.createElement(RadioButtonCheckedIcon, {
28122 fontSize: fontSize,
28123 className: classes.layer
28124 }));
28125 }
28126 var RadioButtonIcon$1 = withStyles(styles$w, {
28127 name: 'PrivateRadioButtonIcon'
28128 })(RadioButtonIcon);
28129
28130 /**
28131 * @ignore - internal component.
28132 */
28133
28134 var RadioGroupContext = react.exports.createContext();
28135
28136 function useRadioGroup() {
28137 return react.exports.useContext(RadioGroupContext);
28138 }
28139
28140 var styles$v = function styles(theme) {
28141 return {
28142 /* Styles applied to the root element. */
28143 root: {
28144 color: theme.palette.text.secondary
28145 },
28146
28147 /* Pseudo-class applied to the root element if `checked={true}`. */
28148 checked: {},
28149
28150 /* Pseudo-class applied to the root element if `disabled={true}`. */
28151 disabled: {},
28152
28153 /* Styles applied to the root element if `color="primary"`. */
28154 colorPrimary: {
28155 '&$checked': {
28156 color: theme.palette.primary.main,
28157 '&:hover': {
28158 backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),
28159 // Reset on touch devices, it doesn't add specificity
28160 '@media (hover: none)': {
28161 backgroundColor: 'transparent'
28162 }
28163 }
28164 },
28165 '&$disabled': {
28166 color: theme.palette.action.disabled
28167 }
28168 },
28169
28170 /* Styles applied to the root element if `color="secondary"`. */
28171 colorSecondary: {
28172 '&$checked': {
28173 color: theme.palette.secondary.main,
28174 '&:hover': {
28175 backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.hoverOpacity),
28176 // Reset on touch devices, it doesn't add specificity
28177 '@media (hover: none)': {
28178 backgroundColor: 'transparent'
28179 }
28180 }
28181 },
28182 '&$disabled': {
28183 color: theme.palette.action.disabled
28184 }
28185 }
28186 };
28187 };
28188 var defaultCheckedIcon = /*#__PURE__*/react.exports.createElement(RadioButtonIcon$1, {
28189 checked: true
28190 });
28191 var defaultIcon = /*#__PURE__*/react.exports.createElement(RadioButtonIcon$1, null);
28192 var Radio = /*#__PURE__*/react.exports.forwardRef(function Radio(props, ref) {
28193 var checkedProp = props.checked,
28194 classes = props.classes,
28195 _props$color = props.color,
28196 color = _props$color === void 0 ? 'secondary' : _props$color,
28197 nameProp = props.name,
28198 onChangeProp = props.onChange,
28199 _props$size = props.size,
28200 size = _props$size === void 0 ? 'medium' : _props$size,
28201 other = _objectWithoutProperties(props, ["checked", "classes", "color", "name", "onChange", "size"]);
28202
28203 var radioGroup = useRadioGroup();
28204 var checked = checkedProp;
28205 var onChange = createChainedFunction(onChangeProp, radioGroup && radioGroup.onChange);
28206 var name = nameProp;
28207
28208 if (radioGroup) {
28209 if (typeof checked === 'undefined') {
28210 checked = radioGroup.value === props.value;
28211 }
28212
28213 if (typeof name === 'undefined') {
28214 name = radioGroup.name;
28215 }
28216 }
28217
28218 return /*#__PURE__*/react.exports.createElement(SwitchBase$1, _extends$5({
28219 color: color,
28220 type: "radio",
28221 icon: /*#__PURE__*/react.exports.cloneElement(defaultIcon, {
28222 fontSize: size === 'small' ? 'small' : 'medium'
28223 }),
28224 checkedIcon: /*#__PURE__*/react.exports.cloneElement(defaultCheckedIcon, {
28225 fontSize: size === 'small' ? 'small' : 'medium'
28226 }),
28227 classes: {
28228 root: clsx(classes.root, classes["color".concat(capitalize(color))]),
28229 checked: classes.checked,
28230 disabled: classes.disabled
28231 },
28232 name: name,
28233 checked: checked,
28234 onChange: onChange,
28235 ref: ref
28236 }, other));
28237 });
28238 var Radio$1 = withStyles(styles$v, {
28239 name: 'MuiRadio'
28240 })(Radio);
28241
28242 function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
28243
28244 function _typeof(obj) {
28245 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
28246 _typeof = function _typeof(obj) {
28247 return _typeof2(obj);
28248 };
28249 } else {
28250 _typeof = function _typeof(obj) {
28251 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
28252 };
28253 }
28254
28255 return _typeof(obj);
28256 }
28257
28258 function areEqualValues(a, b) {
28259 if (_typeof(b) === 'object' && b !== null) {
28260 return a === b;
28261 }
28262
28263 return String(a) === String(b);
28264 }
28265
28266 function isEmpty$1(display) {
28267 return display == null || typeof display === 'string' && !display.trim();
28268 }
28269 /**
28270 * @ignore - internal component.
28271 */
28272
28273
28274 var SelectInput = /*#__PURE__*/react.exports.forwardRef(function SelectInput(props, ref) {
28275 var ariaLabel = props['aria-label'],
28276 autoFocus = props.autoFocus,
28277 autoWidth = props.autoWidth,
28278 children = props.children,
28279 classes = props.classes,
28280 className = props.className,
28281 defaultValue = props.defaultValue,
28282 disabled = props.disabled,
28283 displayEmpty = props.displayEmpty,
28284 IconComponent = props.IconComponent,
28285 inputRefProp = props.inputRef,
28286 labelId = props.labelId,
28287 _props$MenuProps = props.MenuProps,
28288 MenuProps = _props$MenuProps === void 0 ? {} : _props$MenuProps,
28289 multiple = props.multiple,
28290 name = props.name,
28291 onBlur = props.onBlur,
28292 onChange = props.onChange,
28293 onClose = props.onClose,
28294 onFocus = props.onFocus,
28295 onOpen = props.onOpen,
28296 openProp = props.open,
28297 readOnly = props.readOnly,
28298 renderValue = props.renderValue,
28299 _props$SelectDisplayP = props.SelectDisplayProps,
28300 SelectDisplayProps = _props$SelectDisplayP === void 0 ? {} : _props$SelectDisplayP,
28301 tabIndexProp = props.tabIndex;
28302 props.type;
28303 var valueProp = props.value,
28304 _props$variant = props.variant,
28305 variant = _props$variant === void 0 ? 'standard' : _props$variant,
28306 other = _objectWithoutProperties(props, ["aria-label", "autoFocus", "autoWidth", "children", "classes", "className", "defaultValue", "disabled", "displayEmpty", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"]);
28307
28308 var _useControlled = useControlled({
28309 controlled: valueProp,
28310 default: defaultValue,
28311 name: 'Select'
28312 }),
28313 _useControlled2 = _slicedToArray(_useControlled, 2),
28314 value = _useControlled2[0],
28315 setValue = _useControlled2[1];
28316
28317 var inputRef = react.exports.useRef(null);
28318
28319 var _React$useState = react.exports.useState(null),
28320 displayNode = _React$useState[0],
28321 setDisplayNode = _React$useState[1];
28322
28323 var _React$useRef = react.exports.useRef(openProp != null),
28324 isOpenControlled = _React$useRef.current;
28325
28326 var _React$useState2 = react.exports.useState(),
28327 menuMinWidthState = _React$useState2[0],
28328 setMenuMinWidthState = _React$useState2[1];
28329
28330 var _React$useState3 = react.exports.useState(false),
28331 openState = _React$useState3[0],
28332 setOpenState = _React$useState3[1];
28333
28334 var handleRef = useForkRef(ref, inputRefProp);
28335 react.exports.useImperativeHandle(handleRef, function () {
28336 return {
28337 focus: function focus() {
28338 displayNode.focus();
28339 },
28340 node: inputRef.current,
28341 value: value
28342 };
28343 }, [displayNode, value]);
28344 react.exports.useEffect(function () {
28345 if (autoFocus && displayNode) {
28346 displayNode.focus();
28347 }
28348 }, [autoFocus, displayNode]);
28349 react.exports.useEffect(function () {
28350 if (displayNode) {
28351 var label = ownerDocument(displayNode).getElementById(labelId);
28352
28353 if (label) {
28354 var handler = function handler() {
28355 if (getSelection().isCollapsed) {
28356 displayNode.focus();
28357 }
28358 };
28359
28360 label.addEventListener('click', handler);
28361 return function () {
28362 label.removeEventListener('click', handler);
28363 };
28364 }
28365 }
28366
28367 return undefined;
28368 }, [labelId, displayNode]);
28369
28370 var update = function update(open, event) {
28371 if (open) {
28372 if (onOpen) {
28373 onOpen(event);
28374 }
28375 } else if (onClose) {
28376 onClose(event);
28377 }
28378
28379 if (!isOpenControlled) {
28380 setMenuMinWidthState(autoWidth ? null : displayNode.clientWidth);
28381 setOpenState(open);
28382 }
28383 };
28384
28385 var handleMouseDown = function handleMouseDown(event) {
28386 // Ignore everything but left-click
28387 if (event.button !== 0) {
28388 return;
28389 } // Hijack the default focus behavior.
28390
28391
28392 event.preventDefault();
28393 displayNode.focus();
28394 update(true, event);
28395 };
28396
28397 var handleClose = function handleClose(event) {
28398 update(false, event);
28399 };
28400
28401 var childrenArray = react.exports.Children.toArray(children); // Support autofill.
28402
28403 var handleChange = function handleChange(event) {
28404 var index = childrenArray.map(function (child) {
28405 return child.props.value;
28406 }).indexOf(event.target.value);
28407
28408 if (index === -1) {
28409 return;
28410 }
28411
28412 var child = childrenArray[index];
28413 setValue(child.props.value);
28414
28415 if (onChange) {
28416 onChange(event, child);
28417 }
28418 };
28419
28420 var handleItemClick = function handleItemClick(child) {
28421 return function (event) {
28422 if (!multiple) {
28423 update(false, event);
28424 }
28425
28426 var newValue;
28427
28428 if (multiple) {
28429 newValue = Array.isArray(value) ? value.slice() : [];
28430 var itemIndex = value.indexOf(child.props.value);
28431
28432 if (itemIndex === -1) {
28433 newValue.push(child.props.value);
28434 } else {
28435 newValue.splice(itemIndex, 1);
28436 }
28437 } else {
28438 newValue = child.props.value;
28439 }
28440
28441 if (child.props.onClick) {
28442 child.props.onClick(event);
28443 }
28444
28445 if (value === newValue) {
28446 return;
28447 }
28448
28449 setValue(newValue);
28450
28451 if (onChange) {
28452 event.persist(); // Preact support, target is read only property on a native event.
28453
28454 Object.defineProperty(event, 'target', {
28455 writable: true,
28456 value: {
28457 value: newValue,
28458 name: name
28459 }
28460 });
28461 onChange(event, child);
28462 }
28463 };
28464 };
28465
28466 var handleKeyDown = function handleKeyDown(event) {
28467 if (!readOnly) {
28468 var validKeys = [' ', 'ArrowUp', 'ArrowDown', // The native select doesn't respond to enter on MacOS, but it's recommended by
28469 // https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html
28470 'Enter'];
28471
28472 if (validKeys.indexOf(event.key) !== -1) {
28473 event.preventDefault();
28474 update(true, event);
28475 }
28476 }
28477 };
28478
28479 var open = displayNode !== null && (isOpenControlled ? openProp : openState);
28480
28481 var handleBlur = function handleBlur(event) {
28482 // if open event.stopImmediatePropagation
28483 if (!open && onBlur) {
28484 event.persist(); // Preact support, target is read only property on a native event.
28485
28486 Object.defineProperty(event, 'target', {
28487 writable: true,
28488 value: {
28489 value: value,
28490 name: name
28491 }
28492 });
28493 onBlur(event);
28494 }
28495 };
28496
28497 delete other['aria-invalid'];
28498 var display;
28499 var displaySingle;
28500 var displayMultiple = [];
28501 var computeDisplay = false;
28502
28503 if (isFilled({
28504 value: value
28505 }) || displayEmpty) {
28506 if (renderValue) {
28507 display = renderValue(value);
28508 } else {
28509 computeDisplay = true;
28510 }
28511 }
28512
28513 var items = childrenArray.map(function (child) {
28514 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
28515 return null;
28516 }
28517
28518 var selected;
28519
28520 if (multiple) {
28521 if (!Array.isArray(value)) {
28522 throw new Error(formatMuiErrorMessage(2));
28523 }
28524
28525 selected = value.some(function (v) {
28526 return areEqualValues(v, child.props.value);
28527 });
28528
28529 if (selected && computeDisplay) {
28530 displayMultiple.push(child.props.children);
28531 }
28532 } else {
28533 selected = areEqualValues(value, child.props.value);
28534
28535 if (selected && computeDisplay) {
28536 displaySingle = child.props.children;
28537 }
28538 }
28539
28540 return /*#__PURE__*/react.exports.cloneElement(child, {
28541 'aria-selected': selected ? 'true' : undefined,
28542 onClick: handleItemClick(child),
28543 onKeyUp: function onKeyUp(event) {
28544 if (event.key === ' ') {
28545 // otherwise our MenuItems dispatches a click event
28546 // it's not behavior of the native <option> and causes
28547 // the select to close immediately since we open on space keydown
28548 event.preventDefault();
28549 }
28550
28551 if (child.props.onKeyUp) {
28552 child.props.onKeyUp(event);
28553 }
28554 },
28555 role: 'option',
28556 selected: selected,
28557 value: undefined,
28558 // The value is most likely not a valid HTML attribute.
28559 'data-value': child.props.value // Instead, we provide it as a data attribute.
28560
28561 });
28562 });
28563
28564 if (computeDisplay) {
28565 display = multiple ? displayMultiple.join(', ') : displaySingle;
28566 } // Avoid performing a layout computation in the render method.
28567
28568
28569 var menuMinWidth = menuMinWidthState;
28570
28571 if (!autoWidth && isOpenControlled && displayNode) {
28572 menuMinWidth = displayNode.clientWidth;
28573 }
28574
28575 var tabIndex;
28576
28577 if (typeof tabIndexProp !== 'undefined') {
28578 tabIndex = tabIndexProp;
28579 } else {
28580 tabIndex = disabled ? null : 0;
28581 }
28582
28583 var buttonId = SelectDisplayProps.id || (name ? "mui-component-select-".concat(name) : undefined);
28584 return /*#__PURE__*/react.exports.createElement(react.exports.Fragment, null, /*#__PURE__*/react.exports.createElement("div", _extends$5({
28585 className: clsx(classes.root, // TODO v5: merge root and select
28586 classes.select, classes.selectMenu, classes[variant], className, disabled && classes.disabled),
28587 ref: setDisplayNode,
28588 tabIndex: tabIndex,
28589 role: "button",
28590 "aria-disabled": disabled ? 'true' : undefined,
28591 "aria-expanded": open ? 'true' : undefined,
28592 "aria-haspopup": "listbox",
28593 "aria-label": ariaLabel,
28594 "aria-labelledby": [labelId, buttonId].filter(Boolean).join(' ') || undefined,
28595 onKeyDown: handleKeyDown,
28596 onMouseDown: disabled || readOnly ? null : handleMouseDown,
28597 onBlur: handleBlur,
28598 onFocus: onFocus
28599 }, SelectDisplayProps, {
28600 // The id is required for proper a11y
28601 id: buttonId
28602 }), isEmpty$1(display) ?
28603 /*#__PURE__*/
28604 // eslint-disable-next-line react/no-danger
28605 react.exports.createElement("span", {
28606 dangerouslySetInnerHTML: {
28607 __html: '&#8203;'
28608 }
28609 }) : display), /*#__PURE__*/react.exports.createElement("input", _extends$5({
28610 value: Array.isArray(value) ? value.join(',') : value,
28611 name: name,
28612 ref: inputRef,
28613 "aria-hidden": true,
28614 onChange: handleChange,
28615 tabIndex: -1,
28616 className: classes.nativeInput,
28617 autoFocus: autoFocus
28618 }, other)), /*#__PURE__*/react.exports.createElement(IconComponent, {
28619 className: clsx(classes.icon, classes["icon".concat(capitalize(variant))], open && classes.iconOpen, disabled && classes.disabled)
28620 }), /*#__PURE__*/react.exports.createElement(Menu$1, _extends$5({
28621 id: "menu-".concat(name || ''),
28622 anchorEl: displayNode,
28623 open: open,
28624 onClose: handleClose
28625 }, MenuProps, {
28626 MenuListProps: _extends$5({
28627 'aria-labelledby': labelId,
28628 role: 'listbox',
28629 disableListWrap: true
28630 }, MenuProps.MenuListProps),
28631 PaperProps: _extends$5({}, MenuProps.PaperProps, {
28632 style: _extends$5({
28633 minWidth: menuMinWidth
28634 }, MenuProps.PaperProps != null ? MenuProps.PaperProps.style : null)
28635 })
28636 }), items));
28637 });
28638
28639 var styles$u = styles$z;
28640
28641 var _ref$3 = /*#__PURE__*/react.exports.createElement(Input$1, null);
28642
28643 var _ref2$2 = /*#__PURE__*/react.exports.createElement(FilledInput$1, null);
28644
28645 var Select = /*#__PURE__*/react.exports.forwardRef(function Select(props, ref) {
28646 var _props$autoWidth = props.autoWidth,
28647 autoWidth = _props$autoWidth === void 0 ? false : _props$autoWidth,
28648 children = props.children,
28649 classes = props.classes,
28650 _props$displayEmpty = props.displayEmpty,
28651 displayEmpty = _props$displayEmpty === void 0 ? false : _props$displayEmpty,
28652 _props$IconComponent = props.IconComponent,
28653 IconComponent = _props$IconComponent === void 0 ? ArrowDropDownIcon : _props$IconComponent,
28654 id = props.id,
28655 input = props.input,
28656 inputProps = props.inputProps,
28657 label = props.label,
28658 labelId = props.labelId,
28659 _props$labelWidth = props.labelWidth,
28660 labelWidth = _props$labelWidth === void 0 ? 0 : _props$labelWidth,
28661 MenuProps = props.MenuProps,
28662 _props$multiple = props.multiple,
28663 multiple = _props$multiple === void 0 ? false : _props$multiple,
28664 _props$native = props.native,
28665 native = _props$native === void 0 ? false : _props$native,
28666 onClose = props.onClose,
28667 onOpen = props.onOpen,
28668 open = props.open,
28669 renderValue = props.renderValue,
28670 SelectDisplayProps = props.SelectDisplayProps,
28671 _props$variant = props.variant,
28672 variantProps = _props$variant === void 0 ? 'standard' : _props$variant,
28673 other = _objectWithoutProperties(props, ["autoWidth", "children", "classes", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "labelWidth", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"]);
28674
28675 var inputComponent = native ? NativeSelectInput : SelectInput;
28676 var muiFormControl = useFormControl();
28677 var fcs = formControlState({
28678 props: props,
28679 muiFormControl: muiFormControl,
28680 states: ['variant']
28681 });
28682 var variant = fcs.variant || variantProps;
28683 var InputComponent = input || {
28684 standard: _ref$3,
28685 outlined: /*#__PURE__*/react.exports.createElement(OutlinedInput$1, {
28686 label: label,
28687 labelWidth: labelWidth
28688 }),
28689 filled: _ref2$2
28690 }[variant];
28691 return /*#__PURE__*/react.exports.cloneElement(InputComponent, _extends$5({
28692 // Most of the logic is implemented in `SelectInput`.
28693 // The `Select` component is a simple API wrapper to expose something better to play with.
28694 inputComponent: inputComponent,
28695 inputProps: _extends$5({
28696 children: children,
28697 IconComponent: IconComponent,
28698 variant: variant,
28699 type: undefined,
28700 // We render a select. We can ignore the type provided by the `Input`.
28701 multiple: multiple
28702 }, native ? {
28703 id: id
28704 } : {
28705 autoWidth: autoWidth,
28706 displayEmpty: displayEmpty,
28707 labelId: labelId,
28708 MenuProps: MenuProps,
28709 onClose: onClose,
28710 onOpen: onOpen,
28711 open: open,
28712 renderValue: renderValue,
28713 SelectDisplayProps: _extends$5({
28714 id: id
28715 }, SelectDisplayProps)
28716 }, inputProps, {
28717 classes: inputProps ? mergeClasses({
28718 baseClasses: classes,
28719 newClasses: inputProps.classes,
28720 Component: Select
28721 }) : classes
28722 }, input ? input.props.inputProps : {}),
28723 ref: ref
28724 }, other));
28725 });
28726 Select.muiName = 'Select';
28727 var Select$1 = withStyles(styles$u, {
28728 name: 'MuiSelect'
28729 })(Select);
28730
28731 var styles$t = function styles(theme) {
28732 return {
28733 thumb: {
28734 '&$open': {
28735 '& $offset': {
28736 transform: 'scale(1) translateY(-10px)'
28737 }
28738 }
28739 },
28740 open: {},
28741 offset: _extends$5({
28742 zIndex: 1
28743 }, theme.typography.body2, {
28744 fontSize: theme.typography.pxToRem(12),
28745 lineHeight: 1.2,
28746 transition: theme.transitions.create(['transform'], {
28747 duration: theme.transitions.duration.shortest
28748 }),
28749 top: -34,
28750 transformOrigin: 'bottom center',
28751 transform: 'scale(0)',
28752 position: 'absolute'
28753 }),
28754 circle: {
28755 display: 'flex',
28756 alignItems: 'center',
28757 justifyContent: 'center',
28758 width: 32,
28759 height: 32,
28760 borderRadius: '50% 50% 50% 0',
28761 backgroundColor: 'currentColor',
28762 transform: 'rotate(-45deg)'
28763 },
28764 label: {
28765 color: theme.palette.primary.contrastText,
28766 transform: 'rotate(45deg)'
28767 }
28768 };
28769 };
28770 /**
28771 * @ignore - internal component.
28772 */
28773
28774
28775 function ValueLabel(props) {
28776 var children = props.children,
28777 classes = props.classes,
28778 className = props.className,
28779 open = props.open,
28780 value = props.value,
28781 valueLabelDisplay = props.valueLabelDisplay;
28782
28783 if (valueLabelDisplay === 'off') {
28784 return children;
28785 }
28786
28787 return /*#__PURE__*/react.exports.cloneElement(children, {
28788 className: clsx(children.props.className, (open || valueLabelDisplay === 'on') && classes.open, classes.thumb)
28789 }, /*#__PURE__*/react.exports.createElement("span", {
28790 className: clsx(classes.offset, className)
28791 }, /*#__PURE__*/react.exports.createElement("span", {
28792 className: classes.circle
28793 }, /*#__PURE__*/react.exports.createElement("span", {
28794 className: classes.label
28795 }, value))));
28796 }
28797
28798 var ValueLabel$1 = withStyles(styles$t, {
28799 name: 'PrivateValueLabel'
28800 })(ValueLabel);
28801
28802 function asc(a, b) {
28803 return a - b;
28804 }
28805
28806 function clamp(value, min, max) {
28807 return Math.min(Math.max(min, value), max);
28808 }
28809
28810 function findClosest(values, currentValue) {
28811 var _values$reduce = values.reduce(function (acc, value, index) {
28812 var distance = Math.abs(currentValue - value);
28813
28814 if (acc === null || distance < acc.distance || distance === acc.distance) {
28815 return {
28816 distance: distance,
28817 index: index
28818 };
28819 }
28820
28821 return acc;
28822 }, null),
28823 closestIndex = _values$reduce.index;
28824
28825 return closestIndex;
28826 }
28827
28828 function trackFinger(event, touchId) {
28829 if (touchId.current !== undefined && event.changedTouches) {
28830 for (var i = 0; i < event.changedTouches.length; i += 1) {
28831 var touch = event.changedTouches[i];
28832
28833 if (touch.identifier === touchId.current) {
28834 return {
28835 x: touch.clientX,
28836 y: touch.clientY
28837 };
28838 }
28839 }
28840
28841 return false;
28842 }
28843
28844 return {
28845 x: event.clientX,
28846 y: event.clientY
28847 };
28848 }
28849
28850 function valueToPercent(value, min, max) {
28851 return (value - min) * 100 / (max - min);
28852 }
28853
28854 function percentToValue(percent, min, max) {
28855 return (max - min) * percent + min;
28856 }
28857
28858 function getDecimalPrecision(num) {
28859 // This handles the case when num is very small (0.00000001), js will turn this into 1e-8.
28860 // When num is bigger than 1 or less than -1 it won't get converted to this notation so it's fine.
28861 if (Math.abs(num) < 1) {
28862 var parts = num.toExponential().split('e-');
28863 var matissaDecimalPart = parts[0].split('.')[1];
28864 return (matissaDecimalPart ? matissaDecimalPart.length : 0) + parseInt(parts[1], 10);
28865 }
28866
28867 var decimalPart = num.toString().split('.')[1];
28868 return decimalPart ? decimalPart.length : 0;
28869 }
28870
28871 function roundValueToStep(value, step, min) {
28872 var nearest = Math.round((value - min) / step) * step + min;
28873 return Number(nearest.toFixed(getDecimalPrecision(step)));
28874 }
28875
28876 function setValueIndex(_ref) {
28877 var values = _ref.values,
28878 source = _ref.source,
28879 newValue = _ref.newValue,
28880 index = _ref.index;
28881
28882 // Performance shortcut
28883 if (values[index] === newValue) {
28884 return source;
28885 }
28886
28887 var output = values.slice();
28888 output[index] = newValue;
28889 return output;
28890 }
28891
28892 function focusThumb(_ref2) {
28893 var sliderRef = _ref2.sliderRef,
28894 activeIndex = _ref2.activeIndex,
28895 setActive = _ref2.setActive;
28896
28897 if (!sliderRef.current.contains(document.activeElement) || Number(document.activeElement.getAttribute('data-index')) !== activeIndex) {
28898 sliderRef.current.querySelector("[role=\"slider\"][data-index=\"".concat(activeIndex, "\"]")).focus();
28899 }
28900
28901 if (setActive) {
28902 setActive(activeIndex);
28903 }
28904 }
28905
28906 var axisProps = {
28907 horizontal: {
28908 offset: function offset(percent) {
28909 return {
28910 left: "".concat(percent, "%")
28911 };
28912 },
28913 leap: function leap(percent) {
28914 return {
28915 width: "".concat(percent, "%")
28916 };
28917 }
28918 },
28919 'horizontal-reverse': {
28920 offset: function offset(percent) {
28921 return {
28922 right: "".concat(percent, "%")
28923 };
28924 },
28925 leap: function leap(percent) {
28926 return {
28927 width: "".concat(percent, "%")
28928 };
28929 }
28930 },
28931 vertical: {
28932 offset: function offset(percent) {
28933 return {
28934 bottom: "".concat(percent, "%")
28935 };
28936 },
28937 leap: function leap(percent) {
28938 return {
28939 height: "".concat(percent, "%")
28940 };
28941 }
28942 }
28943 };
28944
28945 var Identity = function Identity(x) {
28946 return x;
28947 };
28948
28949 var styles$s = function styles(theme) {
28950 return {
28951 /* Styles applied to the root element. */
28952 root: {
28953 height: 2,
28954 width: '100%',
28955 boxSizing: 'content-box',
28956 padding: '13px 0',
28957 display: 'inline-block',
28958 position: 'relative',
28959 cursor: 'pointer',
28960 touchAction: 'none',
28961 color: theme.palette.primary.main,
28962 WebkitTapHighlightColor: 'transparent',
28963 '&$disabled': {
28964 pointerEvents: 'none',
28965 cursor: 'default',
28966 color: theme.palette.grey[400]
28967 },
28968 '&$vertical': {
28969 width: 2,
28970 height: '100%',
28971 padding: '0 13px'
28972 },
28973 // The primary input mechanism of the device includes a pointing device of limited accuracy.
28974 '@media (pointer: coarse)': {
28975 // Reach 42px touch target, about ~8mm on screen.
28976 padding: '20px 0',
28977 '&$vertical': {
28978 padding: '0 20px'
28979 }
28980 },
28981 '@media print': {
28982 colorAdjust: 'exact'
28983 }
28984 },
28985
28986 /* Styles applied to the root element if `color="primary"`. */
28987 colorPrimary: {// TODO v5: move the style here
28988 },
28989
28990 /* Styles applied to the root element if `color="secondary"`. */
28991 colorSecondary: {
28992 color: theme.palette.secondary.main
28993 },
28994
28995 /* Styles applied to the root element if `marks` is provided with at least one label. */
28996 marked: {
28997 marginBottom: 20,
28998 '&$vertical': {
28999 marginBottom: 'auto',
29000 marginRight: 20
29001 }
29002 },
29003
29004 /* Pseudo-class applied to the root element if `orientation="vertical"`. */
29005 vertical: {},
29006
29007 /* Pseudo-class applied to the root and thumb element if `disabled={true}`. */
29008 disabled: {},
29009
29010 /* Styles applied to the rail element. */
29011 rail: {
29012 display: 'block',
29013 position: 'absolute',
29014 width: '100%',
29015 height: 2,
29016 borderRadius: 1,
29017 backgroundColor: 'currentColor',
29018 opacity: 0.38,
29019 '$vertical &': {
29020 height: '100%',
29021 width: 2
29022 }
29023 },
29024
29025 /* Styles applied to the track element. */
29026 track: {
29027 display: 'block',
29028 position: 'absolute',
29029 height: 2,
29030 borderRadius: 1,
29031 backgroundColor: 'currentColor',
29032 '$vertical &': {
29033 width: 2
29034 }
29035 },
29036
29037 /* Styles applied to the track element if `track={false}`. */
29038 trackFalse: {
29039 '& $track': {
29040 display: 'none'
29041 }
29042 },
29043
29044 /* Styles applied to the track element if `track="inverted"`. */
29045 trackInverted: {
29046 '& $track': {
29047 backgroundColor: // Same logic as the LinearProgress track color
29048 theme.palette.type === 'light' ? lighten(theme.palette.primary.main, 0.62) : darken(theme.palette.primary.main, 0.5)
29049 },
29050 '& $rail': {
29051 opacity: 1
29052 }
29053 },
29054
29055 /* Styles applied to the thumb element. */
29056 thumb: {
29057 position: 'absolute',
29058 width: 12,
29059 height: 12,
29060 marginLeft: -6,
29061 marginTop: -5,
29062 boxSizing: 'border-box',
29063 borderRadius: '50%',
29064 outline: 0,
29065 backgroundColor: 'currentColor',
29066 display: 'flex',
29067 alignItems: 'center',
29068 justifyContent: 'center',
29069 transition: theme.transitions.create(['box-shadow'], {
29070 duration: theme.transitions.duration.shortest
29071 }),
29072 '&::after': {
29073 position: 'absolute',
29074 content: '""',
29075 borderRadius: '50%',
29076 // reach 42px hit target (2 * 15 + thumb diameter)
29077 left: -15,
29078 top: -15,
29079 right: -15,
29080 bottom: -15
29081 },
29082 '&$focusVisible,&:hover': {
29083 boxShadow: "0px 0px 0px 8px ".concat(alpha(theme.palette.primary.main, 0.16)),
29084 '@media (hover: none)': {
29085 boxShadow: 'none'
29086 }
29087 },
29088 '&$active': {
29089 boxShadow: "0px 0px 0px 14px ".concat(alpha(theme.palette.primary.main, 0.16))
29090 },
29091 '&$disabled': {
29092 width: 8,
29093 height: 8,
29094 marginLeft: -4,
29095 marginTop: -3,
29096 '&:hover': {
29097 boxShadow: 'none'
29098 }
29099 },
29100 '$vertical &': {
29101 marginLeft: -5,
29102 marginBottom: -6
29103 },
29104 '$vertical &$disabled': {
29105 marginLeft: -3,
29106 marginBottom: -4
29107 }
29108 },
29109
29110 /* Styles applied to the thumb element if `color="primary"`. */
29111 thumbColorPrimary: {// TODO v5: move the style here
29112 },
29113
29114 /* Styles applied to the thumb element if `color="secondary"`. */
29115 thumbColorSecondary: {
29116 '&$focusVisible,&:hover': {
29117 boxShadow: "0px 0px 0px 8px ".concat(alpha(theme.palette.secondary.main, 0.16))
29118 },
29119 '&$active': {
29120 boxShadow: "0px 0px 0px 14px ".concat(alpha(theme.palette.secondary.main, 0.16))
29121 }
29122 },
29123
29124 /* Pseudo-class applied to the thumb element if it's active. */
29125 active: {},
29126
29127 /* Pseudo-class applied to the thumb element if keyboard focused. */
29128 focusVisible: {},
29129
29130 /* Styles applied to the thumb label element. */
29131 valueLabel: {
29132 // IE 11 centering bug, to remove from the customization demos once no longer supported
29133 left: 'calc(-50% - 4px)'
29134 },
29135
29136 /* Styles applied to the mark element. */
29137 mark: {
29138 position: 'absolute',
29139 width: 2,
29140 height: 2,
29141 borderRadius: 1,
29142 backgroundColor: 'currentColor'
29143 },
29144
29145 /* Styles applied to the mark element if active (depending on the value). */
29146 markActive: {
29147 backgroundColor: theme.palette.background.paper,
29148 opacity: 0.8
29149 },
29150
29151 /* Styles applied to the mark label element. */
29152 markLabel: _extends$5({}, theme.typography.body2, {
29153 color: theme.palette.text.secondary,
29154 position: 'absolute',
29155 top: 26,
29156 transform: 'translateX(-50%)',
29157 whiteSpace: 'nowrap',
29158 '$vertical &': {
29159 top: 'auto',
29160 left: 26,
29161 transform: 'translateY(50%)'
29162 },
29163 '@media (pointer: coarse)': {
29164 top: 40,
29165 '$vertical &': {
29166 left: 31
29167 }
29168 }
29169 }),
29170
29171 /* Styles applied to the mark label element if active (depending on the value). */
29172 markLabelActive: {
29173 color: theme.palette.text.primary
29174 }
29175 };
29176 };
29177 var Slider = /*#__PURE__*/react.exports.forwardRef(function Slider(props, ref) {
29178 var ariaLabel = props['aria-label'],
29179 ariaLabelledby = props['aria-labelledby'],
29180 ariaValuetext = props['aria-valuetext'],
29181 classes = props.classes,
29182 className = props.className,
29183 _props$color = props.color,
29184 color = _props$color === void 0 ? 'primary' : _props$color,
29185 _props$component = props.component,
29186 Component = _props$component === void 0 ? 'span' : _props$component,
29187 defaultValue = props.defaultValue,
29188 _props$disabled = props.disabled,
29189 disabled = _props$disabled === void 0 ? false : _props$disabled,
29190 getAriaLabel = props.getAriaLabel,
29191 getAriaValueText = props.getAriaValueText,
29192 _props$marks = props.marks,
29193 marksProp = _props$marks === void 0 ? false : _props$marks,
29194 _props$max = props.max,
29195 max = _props$max === void 0 ? 100 : _props$max,
29196 _props$min = props.min,
29197 min = _props$min === void 0 ? 0 : _props$min,
29198 name = props.name,
29199 onChange = props.onChange,
29200 onChangeCommitted = props.onChangeCommitted,
29201 onMouseDown = props.onMouseDown,
29202 _props$orientation = props.orientation,
29203 orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
29204 _props$scale = props.scale,
29205 scale = _props$scale === void 0 ? Identity : _props$scale,
29206 _props$step = props.step,
29207 step = _props$step === void 0 ? 1 : _props$step,
29208 _props$ThumbComponent = props.ThumbComponent,
29209 ThumbComponent = _props$ThumbComponent === void 0 ? 'span' : _props$ThumbComponent,
29210 _props$track = props.track,
29211 track = _props$track === void 0 ? 'normal' : _props$track,
29212 valueProp = props.value,
29213 _props$ValueLabelComp = props.ValueLabelComponent,
29214 ValueLabelComponent = _props$ValueLabelComp === void 0 ? ValueLabel$1 : _props$ValueLabelComp,
29215 _props$valueLabelDisp = props.valueLabelDisplay,
29216 valueLabelDisplay = _props$valueLabelDisp === void 0 ? 'off' : _props$valueLabelDisp,
29217 _props$valueLabelForm = props.valueLabelFormat,
29218 valueLabelFormat = _props$valueLabelForm === void 0 ? Identity : _props$valueLabelForm,
29219 other = _objectWithoutProperties(props, ["aria-label", "aria-labelledby", "aria-valuetext", "classes", "className", "color", "component", "defaultValue", "disabled", "getAriaLabel", "getAriaValueText", "marks", "max", "min", "name", "onChange", "onChangeCommitted", "onMouseDown", "orientation", "scale", "step", "ThumbComponent", "track", "value", "ValueLabelComponent", "valueLabelDisplay", "valueLabelFormat"]);
29220
29221 var theme = useTheme$1();
29222 var touchId = react.exports.useRef(); // We can't use the :active browser pseudo-classes.
29223 // - The active state isn't triggered when clicking on the rail.
29224 // - The active state isn't transfered when inversing a range slider.
29225
29226 var _React$useState = react.exports.useState(-1),
29227 active = _React$useState[0],
29228 setActive = _React$useState[1];
29229
29230 var _React$useState2 = react.exports.useState(-1),
29231 open = _React$useState2[0],
29232 setOpen = _React$useState2[1];
29233
29234 var _useControlled = useControlled({
29235 controlled: valueProp,
29236 default: defaultValue,
29237 name: 'Slider'
29238 }),
29239 _useControlled2 = _slicedToArray(_useControlled, 2),
29240 valueDerived = _useControlled2[0],
29241 setValueState = _useControlled2[1];
29242
29243 var range = Array.isArray(valueDerived);
29244 var values = range ? valueDerived.slice().sort(asc) : [valueDerived];
29245 values = values.map(function (value) {
29246 return clamp(value, min, max);
29247 });
29248 var marks = marksProp === true && step !== null ? _toConsumableArray(Array(Math.floor((max - min) / step) + 1)).map(function (_, index) {
29249 return {
29250 value: min + step * index
29251 };
29252 }) : marksProp || [];
29253
29254 var _useIsFocusVisible = useIsFocusVisible(),
29255 isFocusVisible = _useIsFocusVisible.isFocusVisible,
29256 onBlurVisible = _useIsFocusVisible.onBlurVisible,
29257 focusVisibleRef = _useIsFocusVisible.ref;
29258
29259 var _React$useState3 = react.exports.useState(-1),
29260 focusVisible = _React$useState3[0],
29261 setFocusVisible = _React$useState3[1];
29262
29263 var sliderRef = react.exports.useRef();
29264 var handleFocusRef = useForkRef(focusVisibleRef, sliderRef);
29265 var handleRef = useForkRef(ref, handleFocusRef);
29266 var handleFocus = useEventCallback(function (event) {
29267 var index = Number(event.currentTarget.getAttribute('data-index'));
29268
29269 if (isFocusVisible(event)) {
29270 setFocusVisible(index);
29271 }
29272
29273 setOpen(index);
29274 });
29275 var handleBlur = useEventCallback(function () {
29276 if (focusVisible !== -1) {
29277 setFocusVisible(-1);
29278 onBlurVisible();
29279 }
29280
29281 setOpen(-1);
29282 });
29283 var handleMouseOver = useEventCallback(function (event) {
29284 var index = Number(event.currentTarget.getAttribute('data-index'));
29285 setOpen(index);
29286 });
29287 var handleMouseLeave = useEventCallback(function () {
29288 setOpen(-1);
29289 });
29290 var isRtl = theme.direction === 'rtl';
29291 var handleKeyDown = useEventCallback(function (event) {
29292 var index = Number(event.currentTarget.getAttribute('data-index'));
29293 var value = values[index];
29294 var tenPercents = (max - min) / 10;
29295 var marksValues = marks.map(function (mark) {
29296 return mark.value;
29297 });
29298 var marksIndex = marksValues.indexOf(value);
29299 var newValue;
29300 var increaseKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
29301 var decreaseKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
29302
29303 switch (event.key) {
29304 case 'Home':
29305 newValue = min;
29306 break;
29307
29308 case 'End':
29309 newValue = max;
29310 break;
29311
29312 case 'PageUp':
29313 if (step) {
29314 newValue = value + tenPercents;
29315 }
29316
29317 break;
29318
29319 case 'PageDown':
29320 if (step) {
29321 newValue = value - tenPercents;
29322 }
29323
29324 break;
29325
29326 case increaseKey:
29327 case 'ArrowUp':
29328 if (step) {
29329 newValue = value + step;
29330 } else {
29331 newValue = marksValues[marksIndex + 1] || marksValues[marksValues.length - 1];
29332 }
29333
29334 break;
29335
29336 case decreaseKey:
29337 case 'ArrowDown':
29338 if (step) {
29339 newValue = value - step;
29340 } else {
29341 newValue = marksValues[marksIndex - 1] || marksValues[0];
29342 }
29343
29344 break;
29345
29346 default:
29347 return;
29348 } // Prevent scroll of the page
29349
29350
29351 event.preventDefault();
29352
29353 if (step) {
29354 newValue = roundValueToStep(newValue, step, min);
29355 }
29356
29357 newValue = clamp(newValue, min, max);
29358
29359 if (range) {
29360 var previousValue = newValue;
29361 newValue = setValueIndex({
29362 values: values,
29363 source: valueDerived,
29364 newValue: newValue,
29365 index: index
29366 }).sort(asc);
29367 focusThumb({
29368 sliderRef: sliderRef,
29369 activeIndex: newValue.indexOf(previousValue)
29370 });
29371 }
29372
29373 setValueState(newValue);
29374 setFocusVisible(index);
29375
29376 if (onChange) {
29377 onChange(event, newValue);
29378 }
29379
29380 if (onChangeCommitted) {
29381 onChangeCommitted(event, newValue);
29382 }
29383 });
29384 var previousIndex = react.exports.useRef();
29385 var axis = orientation;
29386
29387 if (isRtl && orientation !== "vertical") {
29388 axis += '-reverse';
29389 }
29390
29391 var getFingerNewValue = function getFingerNewValue(_ref3) {
29392 var finger = _ref3.finger,
29393 _ref3$move = _ref3.move,
29394 move = _ref3$move === void 0 ? false : _ref3$move,
29395 values2 = _ref3.values,
29396 source = _ref3.source;
29397 var slider = sliderRef.current;
29398
29399 var _slider$getBoundingCl = slider.getBoundingClientRect(),
29400 width = _slider$getBoundingCl.width,
29401 height = _slider$getBoundingCl.height,
29402 bottom = _slider$getBoundingCl.bottom,
29403 left = _slider$getBoundingCl.left;
29404
29405 var percent;
29406
29407 if (axis.indexOf('vertical') === 0) {
29408 percent = (bottom - finger.y) / height;
29409 } else {
29410 percent = (finger.x - left) / width;
29411 }
29412
29413 if (axis.indexOf('-reverse') !== -1) {
29414 percent = 1 - percent;
29415 }
29416
29417 var newValue;
29418 newValue = percentToValue(percent, min, max);
29419
29420 if (step) {
29421 newValue = roundValueToStep(newValue, step, min);
29422 } else {
29423 var marksValues = marks.map(function (mark) {
29424 return mark.value;
29425 });
29426 var closestIndex = findClosest(marksValues, newValue);
29427 newValue = marksValues[closestIndex];
29428 }
29429
29430 newValue = clamp(newValue, min, max);
29431 var activeIndex = 0;
29432
29433 if (range) {
29434 if (!move) {
29435 activeIndex = findClosest(values2, newValue);
29436 } else {
29437 activeIndex = previousIndex.current;
29438 }
29439
29440 var previousValue = newValue;
29441 newValue = setValueIndex({
29442 values: values2,
29443 source: source,
29444 newValue: newValue,
29445 index: activeIndex
29446 }).sort(asc);
29447 activeIndex = newValue.indexOf(previousValue);
29448 previousIndex.current = activeIndex;
29449 }
29450
29451 return {
29452 newValue: newValue,
29453 activeIndex: activeIndex
29454 };
29455 };
29456
29457 var handleTouchMove = useEventCallback(function (event) {
29458 var finger = trackFinger(event, touchId);
29459
29460 if (!finger) {
29461 return;
29462 }
29463
29464 var _getFingerNewValue = getFingerNewValue({
29465 finger: finger,
29466 move: true,
29467 values: values,
29468 source: valueDerived
29469 }),
29470 newValue = _getFingerNewValue.newValue,
29471 activeIndex = _getFingerNewValue.activeIndex;
29472
29473 focusThumb({
29474 sliderRef: sliderRef,
29475 activeIndex: activeIndex,
29476 setActive: setActive
29477 });
29478 setValueState(newValue);
29479
29480 if (onChange) {
29481 onChange(event, newValue);
29482 }
29483 });
29484 var handleTouchEnd = useEventCallback(function (event) {
29485 var finger = trackFinger(event, touchId);
29486
29487 if (!finger) {
29488 return;
29489 }
29490
29491 var _getFingerNewValue2 = getFingerNewValue({
29492 finger: finger,
29493 values: values,
29494 source: valueDerived
29495 }),
29496 newValue = _getFingerNewValue2.newValue;
29497
29498 setActive(-1);
29499
29500 if (event.type === 'touchend') {
29501 setOpen(-1);
29502 }
29503
29504 if (onChangeCommitted) {
29505 onChangeCommitted(event, newValue);
29506 }
29507
29508 touchId.current = undefined;
29509 var doc = ownerDocument(sliderRef.current);
29510 doc.removeEventListener('mousemove', handleTouchMove);
29511 doc.removeEventListener('mouseup', handleTouchEnd);
29512 doc.removeEventListener('touchmove', handleTouchMove);
29513 doc.removeEventListener('touchend', handleTouchEnd);
29514 });
29515 var handleTouchStart = useEventCallback(function (event) {
29516 // Workaround as Safari has partial support for touchAction: 'none'.
29517 event.preventDefault();
29518 var touch = event.changedTouches[0];
29519
29520 if (touch != null) {
29521 // A number that uniquely identifies the current finger in the touch session.
29522 touchId.current = touch.identifier;
29523 }
29524
29525 var finger = trackFinger(event, touchId);
29526
29527 var _getFingerNewValue3 = getFingerNewValue({
29528 finger: finger,
29529 values: values,
29530 source: valueDerived
29531 }),
29532 newValue = _getFingerNewValue3.newValue,
29533 activeIndex = _getFingerNewValue3.activeIndex;
29534
29535 focusThumb({
29536 sliderRef: sliderRef,
29537 activeIndex: activeIndex,
29538 setActive: setActive
29539 });
29540 setValueState(newValue);
29541
29542 if (onChange) {
29543 onChange(event, newValue);
29544 }
29545
29546 var doc = ownerDocument(sliderRef.current);
29547 doc.addEventListener('touchmove', handleTouchMove);
29548 doc.addEventListener('touchend', handleTouchEnd);
29549 });
29550 react.exports.useEffect(function () {
29551 var slider = sliderRef.current;
29552 slider.addEventListener('touchstart', handleTouchStart);
29553 var doc = ownerDocument(slider);
29554 return function () {
29555 slider.removeEventListener('touchstart', handleTouchStart);
29556 doc.removeEventListener('mousemove', handleTouchMove);
29557 doc.removeEventListener('mouseup', handleTouchEnd);
29558 doc.removeEventListener('touchmove', handleTouchMove);
29559 doc.removeEventListener('touchend', handleTouchEnd);
29560 };
29561 }, [handleTouchEnd, handleTouchMove, handleTouchStart]);
29562 var handleMouseDown = useEventCallback(function (event) {
29563 if (onMouseDown) {
29564 onMouseDown(event);
29565 }
29566
29567 event.preventDefault();
29568 var finger = trackFinger(event, touchId);
29569
29570 var _getFingerNewValue4 = getFingerNewValue({
29571 finger: finger,
29572 values: values,
29573 source: valueDerived
29574 }),
29575 newValue = _getFingerNewValue4.newValue,
29576 activeIndex = _getFingerNewValue4.activeIndex;
29577
29578 focusThumb({
29579 sliderRef: sliderRef,
29580 activeIndex: activeIndex,
29581 setActive: setActive
29582 });
29583 setValueState(newValue);
29584
29585 if (onChange) {
29586 onChange(event, newValue);
29587 }
29588
29589 var doc = ownerDocument(sliderRef.current);
29590 doc.addEventListener('mousemove', handleTouchMove);
29591 doc.addEventListener('mouseup', handleTouchEnd);
29592 });
29593 var trackOffset = valueToPercent(range ? values[0] : min, min, max);
29594 var trackLeap = valueToPercent(values[values.length - 1], min, max) - trackOffset;
29595
29596 var trackStyle = _extends$5({}, axisProps[axis].offset(trackOffset), axisProps[axis].leap(trackLeap));
29597
29598 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
29599 ref: handleRef,
29600 className: clsx(classes.root, classes["color".concat(capitalize(color))], className, disabled && classes.disabled, marks.length > 0 && marks.some(function (mark) {
29601 return mark.label;
29602 }) && classes.marked, track === false && classes.trackFalse, orientation === 'vertical' && classes.vertical, track === 'inverted' && classes.trackInverted),
29603 onMouseDown: handleMouseDown
29604 }, other), /*#__PURE__*/react.exports.createElement("span", {
29605 className: classes.rail
29606 }), /*#__PURE__*/react.exports.createElement("span", {
29607 className: classes.track,
29608 style: trackStyle
29609 }), /*#__PURE__*/react.exports.createElement("input", {
29610 value: values.join(','),
29611 name: name,
29612 type: "hidden"
29613 }), marks.map(function (mark, index) {
29614 var percent = valueToPercent(mark.value, min, max);
29615 var style = axisProps[axis].offset(percent);
29616 var markActive;
29617
29618 if (track === false) {
29619 markActive = values.indexOf(mark.value) !== -1;
29620 } else {
29621 markActive = track === 'normal' && (range ? mark.value >= values[0] && mark.value <= values[values.length - 1] : mark.value <= values[0]) || track === 'inverted' && (range ? mark.value <= values[0] || mark.value >= values[values.length - 1] : mark.value >= values[0]);
29622 }
29623
29624 return /*#__PURE__*/react.exports.createElement(react.exports.Fragment, {
29625 key: mark.value
29626 }, /*#__PURE__*/react.exports.createElement("span", {
29627 style: style,
29628 "data-index": index,
29629 className: clsx(classes.mark, markActive && classes.markActive)
29630 }), mark.label != null ? /*#__PURE__*/react.exports.createElement("span", {
29631 "aria-hidden": true,
29632 "data-index": index,
29633 style: style,
29634 className: clsx(classes.markLabel, markActive && classes.markLabelActive)
29635 }, mark.label) : null);
29636 }), values.map(function (value, index) {
29637 var percent = valueToPercent(value, min, max);
29638 var style = axisProps[axis].offset(percent);
29639 return /*#__PURE__*/react.exports.createElement(ValueLabelComponent, {
29640 key: index,
29641 valueLabelFormat: valueLabelFormat,
29642 valueLabelDisplay: valueLabelDisplay,
29643 className: classes.valueLabel,
29644 value: typeof valueLabelFormat === 'function' ? valueLabelFormat(scale(value), index) : valueLabelFormat,
29645 index: index,
29646 open: open === index || active === index || valueLabelDisplay === 'on',
29647 disabled: disabled
29648 }, /*#__PURE__*/react.exports.createElement(ThumbComponent, {
29649 className: clsx(classes.thumb, classes["thumbColor".concat(capitalize(color))], active === index && classes.active, disabled && classes.disabled, focusVisible === index && classes.focusVisible),
29650 tabIndex: disabled ? null : 0,
29651 role: "slider",
29652 style: style,
29653 "data-index": index,
29654 "aria-label": getAriaLabel ? getAriaLabel(index) : ariaLabel,
29655 "aria-labelledby": ariaLabelledby,
29656 "aria-orientation": orientation,
29657 "aria-valuemax": scale(max),
29658 "aria-valuemin": scale(min),
29659 "aria-valuenow": scale(value),
29660 "aria-valuetext": getAriaValueText ? getAriaValueText(scale(value), index) : ariaValuetext,
29661 onKeyDown: handleKeyDown,
29662 onFocus: handleFocus,
29663 onBlur: handleBlur,
29664 onMouseOver: handleMouseOver,
29665 onMouseLeave: handleMouseLeave
29666 }));
29667 }));
29668 });
29669 withStyles(styles$s, {
29670 name: 'MuiSlider'
29671 })(Slider);
29672
29673 var styles$r = function styles(theme) {
29674 var emphasis = theme.palette.type === 'light' ? 0.8 : 0.98;
29675 var backgroundColor = emphasize(theme.palette.background.default, emphasis);
29676 return {
29677 /* Styles applied to the root element. */
29678 root: _extends$5({}, theme.typography.body2, _defineProperty$1({
29679 color: theme.palette.getContrastText(backgroundColor),
29680 backgroundColor: backgroundColor,
29681 display: 'flex',
29682 alignItems: 'center',
29683 flexWrap: 'wrap',
29684 padding: '6px 16px',
29685 borderRadius: theme.shape.borderRadius,
29686 flexGrow: 1
29687 }, theme.breakpoints.up('sm'), {
29688 flexGrow: 'initial',
29689 minWidth: 288
29690 })),
29691
29692 /* Styles applied to the message wrapper element. */
29693 message: {
29694 padding: '8px 0'
29695 },
29696
29697 /* Styles applied to the action wrapper element if `action` is provided. */
29698 action: {
29699 display: 'flex',
29700 alignItems: 'center',
29701 marginLeft: 'auto',
29702 paddingLeft: 16,
29703 marginRight: -8
29704 }
29705 };
29706 };
29707 var SnackbarContent = /*#__PURE__*/react.exports.forwardRef(function SnackbarContent(props, ref) {
29708 var action = props.action,
29709 classes = props.classes,
29710 className = props.className,
29711 message = props.message,
29712 _props$role = props.role,
29713 role = _props$role === void 0 ? 'alert' : _props$role,
29714 other = _objectWithoutProperties(props, ["action", "classes", "className", "message", "role"]);
29715
29716 return /*#__PURE__*/react.exports.createElement(Paper$1, _extends$5({
29717 role: role,
29718 square: true,
29719 elevation: 6,
29720 className: clsx(classes.root, className),
29721 ref: ref
29722 }, other), /*#__PURE__*/react.exports.createElement("div", {
29723 className: classes.message
29724 }, message), action ? /*#__PURE__*/react.exports.createElement("div", {
29725 className: classes.action
29726 }, action) : null);
29727 });
29728 var SnackbarContent$1 = withStyles(styles$r, {
29729 name: 'MuiSnackbarContent'
29730 })(SnackbarContent);
29731
29732 var styles$q = function styles(theme) {
29733 var top1 = {
29734 top: 8
29735 };
29736 var bottom1 = {
29737 bottom: 8
29738 };
29739 var right = {
29740 justifyContent: 'flex-end'
29741 };
29742 var left = {
29743 justifyContent: 'flex-start'
29744 };
29745 var top3 = {
29746 top: 24
29747 };
29748 var bottom3 = {
29749 bottom: 24
29750 };
29751 var right3 = {
29752 right: 24
29753 };
29754 var left3 = {
29755 left: 24
29756 };
29757 var center = {
29758 left: '50%',
29759 right: 'auto',
29760 transform: 'translateX(-50%)'
29761 };
29762 return {
29763 /* Styles applied to the root element. */
29764 root: {
29765 zIndex: theme.zIndex.snackbar,
29766 position: 'fixed',
29767 display: 'flex',
29768 left: 8,
29769 right: 8,
29770 justifyContent: 'center',
29771 alignItems: 'center'
29772 },
29773
29774 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'center' }}`. */
29775 anchorOriginTopCenter: _extends$5({}, top1, _defineProperty$1({}, theme.breakpoints.up('sm'), _extends$5({}, top3, center))),
29776
29777 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'center' }}`. */
29778 anchorOriginBottomCenter: _extends$5({}, bottom1, _defineProperty$1({}, theme.breakpoints.up('sm'), _extends$5({}, bottom3, center))),
29779
29780 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'right' }}`. */
29781 anchorOriginTopRight: _extends$5({}, top1, right, _defineProperty$1({}, theme.breakpoints.up('sm'), _extends$5({
29782 left: 'auto'
29783 }, top3, right3))),
29784
29785 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'right' }}`. */
29786 anchorOriginBottomRight: _extends$5({}, bottom1, right, _defineProperty$1({}, theme.breakpoints.up('sm'), _extends$5({
29787 left: 'auto'
29788 }, bottom3, right3))),
29789
29790 /* Styles applied to the root element if `anchorOrigin={{ 'top', 'left' }}`. */
29791 anchorOriginTopLeft: _extends$5({}, top1, left, _defineProperty$1({}, theme.breakpoints.up('sm'), _extends$5({
29792 right: 'auto'
29793 }, top3, left3))),
29794
29795 /* Styles applied to the root element if `anchorOrigin={{ 'bottom', 'left' }}`. */
29796 anchorOriginBottomLeft: _extends$5({}, bottom1, left, _defineProperty$1({}, theme.breakpoints.up('sm'), _extends$5({
29797 right: 'auto'
29798 }, bottom3, left3)))
29799 };
29800 };
29801 var Snackbar = /*#__PURE__*/react.exports.forwardRef(function Snackbar(props, ref) {
29802 var action = props.action,
29803 _props$anchorOrigin = props.anchorOrigin;
29804 _props$anchorOrigin = _props$anchorOrigin === void 0 ? {
29805 vertical: 'bottom',
29806 horizontal: 'center'
29807 } : _props$anchorOrigin;
29808
29809 var vertical = _props$anchorOrigin.vertical,
29810 horizontal = _props$anchorOrigin.horizontal,
29811 _props$autoHideDurati = props.autoHideDuration,
29812 autoHideDuration = _props$autoHideDurati === void 0 ? null : _props$autoHideDurati,
29813 children = props.children,
29814 classes = props.classes,
29815 className = props.className,
29816 ClickAwayListenerProps = props.ClickAwayListenerProps,
29817 ContentProps = props.ContentProps,
29818 _props$disableWindowB = props.disableWindowBlurListener,
29819 disableWindowBlurListener = _props$disableWindowB === void 0 ? false : _props$disableWindowB,
29820 message = props.message,
29821 onClose = props.onClose,
29822 onEnter = props.onEnter,
29823 onEntered = props.onEntered,
29824 onEntering = props.onEntering,
29825 onExit = props.onExit,
29826 onExited = props.onExited,
29827 onExiting = props.onExiting,
29828 onMouseEnter = props.onMouseEnter,
29829 onMouseLeave = props.onMouseLeave,
29830 open = props.open,
29831 resumeHideDuration = props.resumeHideDuration,
29832 _props$TransitionComp = props.TransitionComponent,
29833 TransitionComponent = _props$TransitionComp === void 0 ? Grow : _props$TransitionComp,
29834 _props$transitionDura = props.transitionDuration,
29835 transitionDuration = _props$transitionDura === void 0 ? {
29836 enter: duration.enteringScreen,
29837 exit: duration.leavingScreen
29838 } : _props$transitionDura,
29839 TransitionProps = props.TransitionProps,
29840 other = _objectWithoutProperties(props, ["action", "anchorOrigin", "autoHideDuration", "children", "classes", "className", "ClickAwayListenerProps", "ContentProps", "disableWindowBlurListener", "message", "onClose", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "onMouseEnter", "onMouseLeave", "open", "resumeHideDuration", "TransitionComponent", "transitionDuration", "TransitionProps"]);
29841
29842 var timerAutoHide = react.exports.useRef();
29843
29844 var _React$useState = react.exports.useState(true),
29845 exited = _React$useState[0],
29846 setExited = _React$useState[1];
29847
29848 var handleClose = useEventCallback(function () {
29849 if (onClose) {
29850 onClose.apply(void 0, arguments);
29851 }
29852 });
29853 var setAutoHideTimer = useEventCallback(function (autoHideDurationParam) {
29854 if (!onClose || autoHideDurationParam == null) {
29855 return;
29856 }
29857
29858 clearTimeout(timerAutoHide.current);
29859 timerAutoHide.current = setTimeout(function () {
29860 handleClose(null, 'timeout');
29861 }, autoHideDurationParam);
29862 });
29863 react.exports.useEffect(function () {
29864 if (open) {
29865 setAutoHideTimer(autoHideDuration);
29866 }
29867
29868 return function () {
29869 clearTimeout(timerAutoHide.current);
29870 };
29871 }, [open, autoHideDuration, setAutoHideTimer]); // Pause the timer when the user is interacting with the Snackbar
29872 // or when the user hide the window.
29873
29874 var handlePause = function handlePause() {
29875 clearTimeout(timerAutoHide.current);
29876 }; // Restart the timer when the user is no longer interacting with the Snackbar
29877 // or when the window is shown back.
29878
29879
29880 var handleResume = react.exports.useCallback(function () {
29881 if (autoHideDuration != null) {
29882 setAutoHideTimer(resumeHideDuration != null ? resumeHideDuration : autoHideDuration * 0.5);
29883 }
29884 }, [autoHideDuration, resumeHideDuration, setAutoHideTimer]);
29885
29886 var handleMouseEnter = function handleMouseEnter(event) {
29887 if (onMouseEnter) {
29888 onMouseEnter(event);
29889 }
29890
29891 handlePause();
29892 };
29893
29894 var handleMouseLeave = function handleMouseLeave(event) {
29895 if (onMouseLeave) {
29896 onMouseLeave(event);
29897 }
29898
29899 handleResume();
29900 };
29901
29902 var handleClickAway = function handleClickAway(event) {
29903 if (onClose) {
29904 onClose(event, 'clickaway');
29905 }
29906 };
29907
29908 var handleExited = function handleExited() {
29909 setExited(true);
29910 };
29911
29912 var handleEnter = function handleEnter() {
29913 setExited(false);
29914 };
29915
29916 react.exports.useEffect(function () {
29917 if (!disableWindowBlurListener && open) {
29918 window.addEventListener('focus', handleResume);
29919 window.addEventListener('blur', handlePause);
29920 return function () {
29921 window.removeEventListener('focus', handleResume);
29922 window.removeEventListener('blur', handlePause);
29923 };
29924 }
29925
29926 return undefined;
29927 }, [disableWindowBlurListener, handleResume, open]); // So we only render active snackbars.
29928
29929 if (!open && exited) {
29930 return null;
29931 }
29932
29933 return /*#__PURE__*/react.exports.createElement(ClickAwayListener, _extends$5({
29934 onClickAway: handleClickAway
29935 }, ClickAwayListenerProps), /*#__PURE__*/react.exports.createElement("div", _extends$5({
29936 className: clsx(classes.root, classes["anchorOrigin".concat(capitalize(vertical)).concat(capitalize(horizontal))], className),
29937 onMouseEnter: handleMouseEnter,
29938 onMouseLeave: handleMouseLeave,
29939 ref: ref
29940 }, other), /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
29941 appear: true,
29942 in: open,
29943 onEnter: createChainedFunction(handleEnter, onEnter),
29944 onEntered: onEntered,
29945 onEntering: onEntering,
29946 onExit: onExit,
29947 onExited: createChainedFunction(handleExited, onExited),
29948 onExiting: onExiting,
29949 timeout: transitionDuration,
29950 direction: vertical === 'top' ? 'down' : 'up'
29951 }, TransitionProps), children || /*#__PURE__*/react.exports.createElement(SnackbarContent$1, _extends$5({
29952 message: message,
29953 action: action
29954 }, ContentProps)))));
29955 });
29956 withStyles(styles$q, {
29957 flip: false,
29958 name: 'MuiSnackbar'
29959 })(Snackbar);
29960
29961 var styles$p = {
29962 /* Styles applied to the root element. */
29963 root: {},
29964
29965 /* Styles applied to the root element if `orientation="horizontal"`. */
29966 horizontal: {
29967 paddingLeft: 8,
29968 paddingRight: 8
29969 },
29970
29971 /* Styles applied to the root element if `orientation="vertical"`. */
29972 vertical: {},
29973
29974 /* Styles applied to the root element if `alternativeLabel={true}`. */
29975 alternativeLabel: {
29976 flex: 1,
29977 position: 'relative'
29978 },
29979
29980 /* Pseudo-class applied to the root element if `completed={true}`. */
29981 completed: {}
29982 };
29983 var Step = /*#__PURE__*/react.exports.forwardRef(function Step(props, ref) {
29984 var _props$active = props.active,
29985 active = _props$active === void 0 ? false : _props$active,
29986 alternativeLabel = props.alternativeLabel,
29987 children = props.children,
29988 classes = props.classes,
29989 className = props.className,
29990 _props$completed = props.completed,
29991 completed = _props$completed === void 0 ? false : _props$completed,
29992 connectorProp = props.connector,
29993 _props$disabled = props.disabled,
29994 disabled = _props$disabled === void 0 ? false : _props$disabled,
29995 _props$expanded = props.expanded,
29996 expanded = _props$expanded === void 0 ? false : _props$expanded,
29997 index = props.index,
29998 last = props.last,
29999 orientation = props.orientation,
30000 other = _objectWithoutProperties(props, ["active", "alternativeLabel", "children", "classes", "className", "completed", "connector", "disabled", "expanded", "index", "last", "orientation"]);
30001
30002 var connector = connectorProp ? /*#__PURE__*/react.exports.cloneElement(connectorProp, {
30003 orientation: orientation,
30004 alternativeLabel: alternativeLabel,
30005 index: index,
30006 active: active,
30007 completed: completed,
30008 disabled: disabled
30009 }) : null;
30010 var newChildren = /*#__PURE__*/react.exports.createElement("div", _extends$5({
30011 className: clsx(classes.root, classes[orientation], className, alternativeLabel && classes.alternativeLabel, completed && classes.completed),
30012 ref: ref
30013 }, other), connector && alternativeLabel && index !== 0 ? connector : null, react.exports.Children.map(children, function (child) {
30014 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
30015 return null;
30016 }
30017
30018 return /*#__PURE__*/react.exports.cloneElement(child, _extends$5({
30019 active: active,
30020 alternativeLabel: alternativeLabel,
30021 completed: completed,
30022 disabled: disabled,
30023 expanded: expanded,
30024 last: last,
30025 icon: index + 1,
30026 orientation: orientation
30027 }, child.props));
30028 }));
30029
30030 if (connector && !alternativeLabel && index !== 0) {
30031 return /*#__PURE__*/react.exports.createElement(react.exports.Fragment, null, connector, newChildren);
30032 }
30033
30034 return newChildren;
30035 });
30036 withStyles(styles$p, {
30037 name: 'MuiStep'
30038 })(Step);
30039
30040 /**
30041 * @ignore - internal component.
30042 */
30043
30044 var CheckCircle = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
30045 d: "M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm-2 17l-5-5 1.4-1.4 3.6 3.6 7.6-7.6L19 8l-9 9z"
30046 }));
30047
30048 /**
30049 * @ignore - internal component.
30050 */
30051
30052 var Warning = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
30053 d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"
30054 }));
30055
30056 var styles$o = function styles(theme) {
30057 return {
30058 /* Styles applied to the root element. */
30059 root: {
30060 display: 'block',
30061 color: theme.palette.text.disabled,
30062 '&$completed': {
30063 color: theme.palette.primary.main
30064 },
30065 '&$active': {
30066 color: theme.palette.primary.main
30067 },
30068 '&$error': {
30069 color: theme.palette.error.main
30070 }
30071 },
30072
30073 /* Styles applied to the SVG text element. */
30074 text: {
30075 fill: theme.palette.primary.contrastText,
30076 fontSize: theme.typography.caption.fontSize,
30077 fontFamily: theme.typography.fontFamily
30078 },
30079
30080 /* Pseudo-class applied to the root element if `active={true}`. */
30081 active: {},
30082
30083 /* Pseudo-class applied to the root element if `completed={true}`. */
30084 completed: {},
30085
30086 /* Pseudo-class applied to the root element if `error={true}`. */
30087 error: {}
30088 };
30089 };
30090
30091 var _ref$2 = /*#__PURE__*/react.exports.createElement("circle", {
30092 cx: "12",
30093 cy: "12",
30094 r: "12"
30095 });
30096
30097 var StepIcon = /*#__PURE__*/react.exports.forwardRef(function StepIcon(props, ref) {
30098 var _props$completed = props.completed,
30099 completed = _props$completed === void 0 ? false : _props$completed,
30100 icon = props.icon,
30101 _props$active = props.active,
30102 active = _props$active === void 0 ? false : _props$active,
30103 _props$error = props.error,
30104 error = _props$error === void 0 ? false : _props$error,
30105 classes = props.classes;
30106
30107 if (typeof icon === 'number' || typeof icon === 'string') {
30108 var className = clsx(classes.root, active && classes.active, error && classes.error, completed && classes.completed);
30109
30110 if (error) {
30111 return /*#__PURE__*/react.exports.createElement(Warning, {
30112 className: className,
30113 ref: ref
30114 });
30115 }
30116
30117 if (completed) {
30118 return /*#__PURE__*/react.exports.createElement(CheckCircle, {
30119 className: className,
30120 ref: ref
30121 });
30122 }
30123
30124 return /*#__PURE__*/react.exports.createElement(SvgIcon$2, {
30125 className: className,
30126 ref: ref
30127 }, _ref$2, /*#__PURE__*/react.exports.createElement("text", {
30128 className: classes.text,
30129 x: "12",
30130 y: "16",
30131 textAnchor: "middle"
30132 }, icon));
30133 }
30134
30135 return icon;
30136 });
30137 var StepIcon$1 = withStyles(styles$o, {
30138 name: 'MuiStepIcon'
30139 })(StepIcon);
30140
30141 var styles$n = function styles(theme) {
30142 return {
30143 /* Styles applied to the root element. */
30144 root: {
30145 display: 'flex',
30146 alignItems: 'center',
30147 '&$alternativeLabel': {
30148 flexDirection: 'column'
30149 },
30150 '&$disabled': {
30151 cursor: 'default'
30152 }
30153 },
30154
30155 /* Styles applied to the root element if `orientation="horizontal"`. */
30156 horizontal: {},
30157
30158 /* Styles applied to the root element if `orientation="vertical"`. */
30159 vertical: {},
30160
30161 /* Styles applied to the `Typography` component which wraps `children`. */
30162 label: {
30163 color: theme.palette.text.secondary,
30164 '&$active': {
30165 color: theme.palette.text.primary,
30166 fontWeight: 500
30167 },
30168 '&$completed': {
30169 color: theme.palette.text.primary,
30170 fontWeight: 500
30171 },
30172 '&$alternativeLabel': {
30173 textAlign: 'center',
30174 marginTop: 16
30175 },
30176 '&$error': {
30177 color: theme.palette.error.main
30178 }
30179 },
30180
30181 /* Pseudo-class applied to the `Typography` component if `active={true}`. */
30182 active: {},
30183
30184 /* Pseudo-class applied to the `Typography` component if `completed={true}`. */
30185 completed: {},
30186
30187 /* Pseudo-class applied to the root element and `Typography` component if `error={true}`. */
30188 error: {},
30189
30190 /* Pseudo-class applied to the root element and `Typography` component if `disabled={true}`. */
30191 disabled: {},
30192
30193 /* Styles applied to the `icon` container element. */
30194 iconContainer: {
30195 flexShrink: 0,
30196 // Fix IE 11 issue
30197 display: 'flex',
30198 paddingRight: 8,
30199 '&$alternativeLabel': {
30200 paddingRight: 0
30201 }
30202 },
30203
30204 /* Pseudo-class applied to the root and icon container and `Typography` if `alternativeLabel={true}`. */
30205 alternativeLabel: {},
30206
30207 /* Styles applied to the container element which wraps `Typography` and `optional`. */
30208 labelContainer: {
30209 width: '100%'
30210 }
30211 };
30212 };
30213 var StepLabel = /*#__PURE__*/react.exports.forwardRef(function StepLabel(props, ref) {
30214 var _props$active = props.active,
30215 active = _props$active === void 0 ? false : _props$active,
30216 _props$alternativeLab = props.alternativeLabel,
30217 alternativeLabel = _props$alternativeLab === void 0 ? false : _props$alternativeLab,
30218 children = props.children,
30219 classes = props.classes,
30220 className = props.className,
30221 _props$completed = props.completed,
30222 completed = _props$completed === void 0 ? false : _props$completed,
30223 _props$disabled = props.disabled,
30224 disabled = _props$disabled === void 0 ? false : _props$disabled,
30225 _props$error = props.error,
30226 error = _props$error === void 0 ? false : _props$error;
30227 props.expanded;
30228 var icon = props.icon;
30229 props.last;
30230 var optional = props.optional,
30231 _props$orientation = props.orientation,
30232 orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
30233 StepIconComponentProp = props.StepIconComponent,
30234 StepIconProps = props.StepIconProps,
30235 other = _objectWithoutProperties(props, ["active", "alternativeLabel", "children", "classes", "className", "completed", "disabled", "error", "expanded", "icon", "last", "optional", "orientation", "StepIconComponent", "StepIconProps"]);
30236
30237 var StepIconComponent = StepIconComponentProp;
30238
30239 if (icon && !StepIconComponent) {
30240 StepIconComponent = StepIcon$1;
30241 }
30242
30243 return /*#__PURE__*/react.exports.createElement("span", _extends$5({
30244 className: clsx(classes.root, classes[orientation], className, disabled && classes.disabled, alternativeLabel && classes.alternativeLabel, error && classes.error),
30245 ref: ref
30246 }, other), icon || StepIconComponent ? /*#__PURE__*/react.exports.createElement("span", {
30247 className: clsx(classes.iconContainer, alternativeLabel && classes.alternativeLabel)
30248 }, /*#__PURE__*/react.exports.createElement(StepIconComponent, _extends$5({
30249 completed: completed,
30250 active: active,
30251 error: error,
30252 icon: icon
30253 }, StepIconProps))) : null, /*#__PURE__*/react.exports.createElement("span", {
30254 className: classes.labelContainer
30255 }, children ? /*#__PURE__*/react.exports.createElement(Typography$1, {
30256 variant: "body2",
30257 component: "span",
30258 display: "block",
30259 className: clsx(classes.label, alternativeLabel && classes.alternativeLabel, completed && classes.completed, active && classes.active, error && classes.error)
30260 }, children) : null, optional));
30261 });
30262 StepLabel.muiName = 'StepLabel';
30263 var StepLabel$1 = withStyles(styles$n, {
30264 name: 'MuiStepLabel'
30265 })(StepLabel);
30266
30267 var styles$m = {
30268 /* Styles applied to the root element. */
30269 root: {
30270 width: '100%',
30271 padding: '24px 16px',
30272 margin: '-24px -16px',
30273 boxSizing: 'content-box'
30274 },
30275
30276 /* Styles applied to the root element if `orientation="horizontal"`. */
30277 horizontal: {},
30278
30279 /* Styles applied to the root element if `orientation="vertical"`. */
30280 vertical: {
30281 justifyContent: 'flex-start',
30282 padding: '8px',
30283 margin: '-8px'
30284 },
30285
30286 /* Styles applied to the `ButtonBase` touch-ripple. */
30287 touchRipple: {
30288 color: 'rgba(0, 0, 0, 0.3)'
30289 }
30290 };
30291 var StepButton = /*#__PURE__*/react.exports.forwardRef(function StepButton(props, ref) {
30292 var active = props.active,
30293 alternativeLabel = props.alternativeLabel,
30294 children = props.children,
30295 classes = props.classes,
30296 className = props.className,
30297 completed = props.completed,
30298 disabled = props.disabled;
30299 props.expanded;
30300 var icon = props.icon;
30301 props.last;
30302 var optional = props.optional,
30303 orientation = props.orientation,
30304 other = _objectWithoutProperties(props, ["active", "alternativeLabel", "children", "classes", "className", "completed", "disabled", "expanded", "icon", "last", "optional", "orientation"]);
30305
30306 var childProps = {
30307 active: active,
30308 alternativeLabel: alternativeLabel,
30309 completed: completed,
30310 disabled: disabled,
30311 icon: icon,
30312 optional: optional,
30313 orientation: orientation
30314 };
30315 var child = isMuiElement(children, ['StepLabel']) ? /*#__PURE__*/react.exports.cloneElement(children, childProps) : /*#__PURE__*/react.exports.createElement(StepLabel$1, childProps, children);
30316 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
30317 focusRipple: true,
30318 disabled: disabled,
30319 TouchRippleProps: {
30320 className: classes.touchRipple
30321 },
30322 className: clsx(classes.root, classes[orientation], className),
30323 ref: ref
30324 }, other), child);
30325 });
30326 withStyles(styles$m, {
30327 name: 'MuiStepButton'
30328 })(StepButton);
30329
30330 var styles$l = function styles(theme) {
30331 return {
30332 /* Styles applied to the root element. */
30333 root: {
30334 flex: '1 1 auto'
30335 },
30336
30337 /* Styles applied to the root element if `orientation="horizontal"`. */
30338 horizontal: {},
30339
30340 /* Styles applied to the root element if `orientation="vertical"`. */
30341 vertical: {
30342 marginLeft: 12,
30343 // half icon
30344 padding: '0 0 8px'
30345 },
30346
30347 /* Styles applied to the root element if `alternativeLabel={true}`. */
30348 alternativeLabel: {
30349 position: 'absolute',
30350 top: 8 + 4,
30351 left: 'calc(-50% + 20px)',
30352 right: 'calc(50% + 20px)'
30353 },
30354
30355 /* Pseudo-class applied to the root element if `active={true}`. */
30356 active: {},
30357
30358 /* Pseudo-class applied to the root element if `completed={true}`. */
30359 completed: {},
30360
30361 /* Pseudo-class applied to the root element if `disabled={true}`. */
30362 disabled: {},
30363
30364 /* Styles applied to the line element. */
30365 line: {
30366 display: 'block',
30367 borderColor: theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[600]
30368 },
30369
30370 /* Styles applied to the root element if `orientation="horizontal"`. */
30371 lineHorizontal: {
30372 borderTopStyle: 'solid',
30373 borderTopWidth: 1
30374 },
30375
30376 /* Styles applied to the root element if `orientation="vertical"`. */
30377 lineVertical: {
30378 borderLeftStyle: 'solid',
30379 borderLeftWidth: 1,
30380 minHeight: 24
30381 }
30382 };
30383 };
30384 var StepConnector = /*#__PURE__*/react.exports.forwardRef(function StepConnector(props, ref) {
30385 var active = props.active,
30386 _props$alternativeLab = props.alternativeLabel,
30387 alternativeLabel = _props$alternativeLab === void 0 ? false : _props$alternativeLab,
30388 classes = props.classes,
30389 className = props.className,
30390 completed = props.completed,
30391 disabled = props.disabled;
30392 props.index;
30393 var _props$orientation = props.orientation,
30394 orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
30395 other = _objectWithoutProperties(props, ["active", "alternativeLabel", "classes", "className", "completed", "disabled", "index", "orientation"]);
30396
30397 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
30398 className: clsx(classes.root, classes[orientation], className, alternativeLabel && classes.alternativeLabel, active && classes.active, completed && classes.completed, disabled && classes.disabled),
30399 ref: ref
30400 }, other), /*#__PURE__*/react.exports.createElement("span", {
30401 className: clsx(classes.line, {
30402 'horizontal': classes.lineHorizontal,
30403 'vertical': classes.lineVertical
30404 }[orientation])
30405 }));
30406 });
30407 var StepConnector$1 = withStyles(styles$l, {
30408 name: 'MuiStepConnector'
30409 })(StepConnector);
30410
30411 var styles$k = function styles(theme) {
30412 return {
30413 /* Styles applied to the root element. */
30414 root: {
30415 marginTop: 8,
30416 marginLeft: 12,
30417 // half icon
30418 paddingLeft: 8 + 12,
30419 // margin + half icon
30420 paddingRight: 8,
30421 borderLeft: "1px solid ".concat(theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[600])
30422 },
30423
30424 /* Styles applied to the root element if `last={true}` (controlled by `Step`). */
30425 last: {
30426 borderLeft: 'none'
30427 },
30428
30429 /* Styles applied to the Transition component. */
30430 transition: {}
30431 };
30432 };
30433 var StepContent = /*#__PURE__*/react.exports.forwardRef(function StepContent(props, ref) {
30434 var active = props.active;
30435 props.alternativeLabel;
30436 var children = props.children,
30437 classes = props.classes,
30438 className = props.className;
30439 props.completed;
30440 var expanded = props.expanded,
30441 last = props.last;
30442 props.optional;
30443 props.orientation;
30444 var _props$TransitionComp = props.TransitionComponent,
30445 TransitionComponent = _props$TransitionComp === void 0 ? Collapse$1 : _props$TransitionComp,
30446 _props$transitionDura = props.transitionDuration,
30447 transitionDurationProp = _props$transitionDura === void 0 ? 'auto' : _props$transitionDura,
30448 TransitionProps = props.TransitionProps,
30449 other = _objectWithoutProperties(props, ["active", "alternativeLabel", "children", "classes", "className", "completed", "expanded", "last", "optional", "orientation", "TransitionComponent", "transitionDuration", "TransitionProps"]);
30450
30451 var transitionDuration = transitionDurationProp;
30452
30453 if (transitionDurationProp === 'auto' && !TransitionComponent.muiSupportAuto) {
30454 transitionDuration = undefined;
30455 }
30456
30457 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
30458 className: clsx(classes.root, className, last && classes.last),
30459 ref: ref
30460 }, other), /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
30461 in: active || expanded,
30462 className: classes.transition,
30463 timeout: transitionDuration,
30464 unmountOnExit: true
30465 }, TransitionProps), children));
30466 });
30467 withStyles(styles$k, {
30468 name: 'MuiStepContent'
30469 })(StepContent);
30470
30471 var styles$j = {
30472 /* Styles applied to the root element. */
30473 root: {
30474 display: 'flex',
30475 padding: 24
30476 },
30477
30478 /* Styles applied to the root element if `orientation="horizontal"`. */
30479 horizontal: {
30480 flexDirection: 'row',
30481 alignItems: 'center'
30482 },
30483
30484 /* Styles applied to the root element if `orientation="vertical"`. */
30485 vertical: {
30486 flexDirection: 'column'
30487 },
30488
30489 /* Styles applied to the root element if `alternativeLabel={true}`. */
30490 alternativeLabel: {
30491 alignItems: 'flex-start'
30492 }
30493 };
30494 var defaultConnector = /*#__PURE__*/react.exports.createElement(StepConnector$1, null);
30495 var Stepper = /*#__PURE__*/react.exports.forwardRef(function Stepper(props, ref) {
30496 var _props$activeStep = props.activeStep,
30497 activeStep = _props$activeStep === void 0 ? 0 : _props$activeStep,
30498 _props$alternativeLab = props.alternativeLabel,
30499 alternativeLabel = _props$alternativeLab === void 0 ? false : _props$alternativeLab,
30500 children = props.children,
30501 classes = props.classes,
30502 className = props.className,
30503 _props$connector = props.connector,
30504 connectorProp = _props$connector === void 0 ? defaultConnector : _props$connector,
30505 _props$nonLinear = props.nonLinear,
30506 nonLinear = _props$nonLinear === void 0 ? false : _props$nonLinear,
30507 _props$orientation = props.orientation,
30508 orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
30509 other = _objectWithoutProperties(props, ["activeStep", "alternativeLabel", "children", "classes", "className", "connector", "nonLinear", "orientation"]);
30510
30511 var connector = /*#__PURE__*/react.exports.isValidElement(connectorProp) ? /*#__PURE__*/react.exports.cloneElement(connectorProp, {
30512 orientation: orientation
30513 }) : null;
30514 var childrenArray = react.exports.Children.toArray(children);
30515 var steps = childrenArray.map(function (step, index) {
30516 var state = {
30517 index: index,
30518 active: false,
30519 completed: false,
30520 disabled: false
30521 };
30522
30523 if (activeStep === index) {
30524 state.active = true;
30525 } else if (!nonLinear && activeStep > index) {
30526 state.completed = true;
30527 } else if (!nonLinear && activeStep < index) {
30528 state.disabled = true;
30529 }
30530
30531 return /*#__PURE__*/react.exports.cloneElement(step, _extends$5({
30532 alternativeLabel: alternativeLabel,
30533 connector: connector,
30534 last: index + 1 === childrenArray.length,
30535 orientation: orientation
30536 }, state, step.props));
30537 });
30538 return /*#__PURE__*/react.exports.createElement(Paper$1, _extends$5({
30539 square: true,
30540 elevation: 0,
30541 className: clsx(classes.root, classes[orientation], className, alternativeLabel && classes.alternativeLabel),
30542 ref: ref
30543 }, other), steps);
30544 });
30545 withStyles(styles$j, {
30546 name: 'MuiStepper'
30547 })(Stepper);
30548
30549 var styles$i = function styles(theme) {
30550 return {
30551 /* Styles applied to the root element. */
30552 root: {
30553 position: 'fixed',
30554 top: 0,
30555 left: 0,
30556 bottom: 0,
30557 zIndex: theme.zIndex.drawer - 1
30558 },
30559 anchorLeft: {
30560 right: 'auto'
30561 },
30562 anchorRight: {
30563 left: 'auto',
30564 right: 0
30565 },
30566 anchorTop: {
30567 bottom: 'auto',
30568 right: 0
30569 },
30570 anchorBottom: {
30571 top: 'auto',
30572 bottom: 0,
30573 right: 0
30574 }
30575 };
30576 };
30577 /**
30578 * @ignore - internal component.
30579 */
30580
30581 var SwipeArea = /*#__PURE__*/react.exports.forwardRef(function SwipeArea(props, ref) {
30582 var anchor = props.anchor,
30583 classes = props.classes,
30584 className = props.className,
30585 width = props.width,
30586 other = _objectWithoutProperties(props, ["anchor", "classes", "className", "width"]);
30587
30588 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
30589 className: clsx(classes.root, classes["anchor".concat(capitalize(anchor))], className),
30590 ref: ref,
30591 style: _defineProperty$1({}, isHorizontal(anchor) ? 'width' : 'height', width)
30592 }, other));
30593 });
30594 withStyles(styles$i, {
30595 name: 'PrivateSwipeArea'
30596 })(SwipeArea);
30597
30598 typeof navigator !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent);
30599 ({
30600 enter: duration.enteringScreen,
30601 exit: duration.leavingScreen
30602 });
30603
30604 var styles$h = function styles(theme) {
30605 return {
30606 /* Styles applied to the root element. */
30607 root: {
30608 display: 'inline-flex',
30609 width: 34 + 12 * 2,
30610 height: 14 + 12 * 2,
30611 overflow: 'hidden',
30612 padding: 12,
30613 boxSizing: 'border-box',
30614 position: 'relative',
30615 flexShrink: 0,
30616 zIndex: 0,
30617 // Reset the stacking context.
30618 verticalAlign: 'middle',
30619 // For correct alignment with the text.
30620 '@media print': {
30621 colorAdjust: 'exact'
30622 }
30623 },
30624
30625 /* Styles applied to the root element if `edge="start"`. */
30626 edgeStart: {
30627 marginLeft: -8
30628 },
30629
30630 /* Styles applied to the root element if `edge="end"`. */
30631 edgeEnd: {
30632 marginRight: -8
30633 },
30634
30635 /* Styles applied to the internal `SwitchBase` component's `root` class. */
30636 switchBase: {
30637 position: 'absolute',
30638 top: 0,
30639 left: 0,
30640 zIndex: 1,
30641 // Render above the focus ripple.
30642 color: theme.palette.type === 'light' ? theme.palette.grey[50] : theme.palette.grey[400],
30643 transition: theme.transitions.create(['left', 'transform'], {
30644 duration: theme.transitions.duration.shortest
30645 }),
30646 '&$checked': {
30647 transform: 'translateX(20px)'
30648 },
30649 '&$disabled': {
30650 color: theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[800]
30651 },
30652 '&$checked + $track': {
30653 opacity: 0.5
30654 },
30655 '&$disabled + $track': {
30656 opacity: theme.palette.type === 'light' ? 0.12 : 0.1
30657 }
30658 },
30659
30660 /* Styles applied to the internal SwitchBase component's root element if `color="primary"`. */
30661 colorPrimary: {
30662 '&$checked': {
30663 color: theme.palette.primary.main,
30664 '&:hover': {
30665 backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),
30666 '@media (hover: none)': {
30667 backgroundColor: 'transparent'
30668 }
30669 }
30670 },
30671 '&$disabled': {
30672 color: theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[800]
30673 },
30674 '&$checked + $track': {
30675 backgroundColor: theme.palette.primary.main
30676 },
30677 '&$disabled + $track': {
30678 backgroundColor: theme.palette.type === 'light' ? theme.palette.common.black : theme.palette.common.white
30679 }
30680 },
30681
30682 /* Styles applied to the internal SwitchBase component's root element if `color="secondary"`. */
30683 colorSecondary: {
30684 '&$checked': {
30685 color: theme.palette.secondary.main,
30686 '&:hover': {
30687 backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.hoverOpacity),
30688 '@media (hover: none)': {
30689 backgroundColor: 'transparent'
30690 }
30691 }
30692 },
30693 '&$disabled': {
30694 color: theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[800]
30695 },
30696 '&$checked + $track': {
30697 backgroundColor: theme.palette.secondary.main
30698 },
30699 '&$disabled + $track': {
30700 backgroundColor: theme.palette.type === 'light' ? theme.palette.common.black : theme.palette.common.white
30701 }
30702 },
30703
30704 /* Styles applied to the root element if `size="small"`. */
30705 sizeSmall: {
30706 width: 40,
30707 height: 24,
30708 padding: 7,
30709 '& $thumb': {
30710 width: 16,
30711 height: 16
30712 },
30713 '& $switchBase': {
30714 padding: 4,
30715 '&$checked': {
30716 transform: 'translateX(16px)'
30717 }
30718 }
30719 },
30720
30721 /* Pseudo-class applied to the internal `SwitchBase` component's `checked` class. */
30722 checked: {},
30723
30724 /* Pseudo-class applied to the internal SwitchBase component's disabled class. */
30725 disabled: {},
30726
30727 /* Styles applied to the internal SwitchBase component's input element. */
30728 input: {
30729 left: '-100%',
30730 width: '300%'
30731 },
30732
30733 /* Styles used to create the thumb passed to the internal `SwitchBase` component `icon` prop. */
30734 thumb: {
30735 boxShadow: theme.shadows[1],
30736 backgroundColor: 'currentColor',
30737 width: 20,
30738 height: 20,
30739 borderRadius: '50%'
30740 },
30741
30742 /* Styles applied to the track element. */
30743 track: {
30744 height: '100%',
30745 width: '100%',
30746 borderRadius: 14 / 2,
30747 zIndex: -1,
30748 transition: theme.transitions.create(['opacity', 'background-color'], {
30749 duration: theme.transitions.duration.shortest
30750 }),
30751 backgroundColor: theme.palette.type === 'light' ? theme.palette.common.black : theme.palette.common.white,
30752 opacity: theme.palette.type === 'light' ? 0.38 : 0.3
30753 }
30754 };
30755 };
30756 var Switch = /*#__PURE__*/react.exports.forwardRef(function Switch(props, ref) {
30757 var classes = props.classes,
30758 className = props.className,
30759 _props$color = props.color,
30760 color = _props$color === void 0 ? 'secondary' : _props$color,
30761 _props$edge = props.edge,
30762 edge = _props$edge === void 0 ? false : _props$edge,
30763 _props$size = props.size,
30764 size = _props$size === void 0 ? 'medium' : _props$size,
30765 other = _objectWithoutProperties(props, ["classes", "className", "color", "edge", "size"]);
30766
30767 var icon = /*#__PURE__*/react.exports.createElement("span", {
30768 className: classes.thumb
30769 });
30770 return /*#__PURE__*/react.exports.createElement("span", {
30771 className: clsx(classes.root, className, {
30772 'start': classes.edgeStart,
30773 'end': classes.edgeEnd
30774 }[edge], size === "small" && classes["size".concat(capitalize(size))])
30775 }, /*#__PURE__*/react.exports.createElement(SwitchBase$1, _extends$5({
30776 type: "checkbox",
30777 icon: icon,
30778 checkedIcon: icon,
30779 classes: {
30780 root: clsx(classes.switchBase, classes["color".concat(capitalize(color))]),
30781 input: classes.input,
30782 checked: classes.checked,
30783 disabled: classes.disabled
30784 },
30785 ref: ref
30786 }, other)), /*#__PURE__*/react.exports.createElement("span", {
30787 className: classes.track
30788 }));
30789 });
30790 withStyles(styles$h, {
30791 name: 'MuiSwitch'
30792 })(Switch);
30793
30794 var styles$g = function styles(theme) {
30795 var _extends2;
30796
30797 return {
30798 /* Styles applied to the root element. */
30799 root: _extends$5({}, theme.typography.button, (_extends2 = {
30800 maxWidth: 264,
30801 minWidth: 72,
30802 position: 'relative',
30803 boxSizing: 'border-box',
30804 minHeight: 48,
30805 flexShrink: 0,
30806 padding: '6px 12px'
30807 }, _defineProperty$1(_extends2, theme.breakpoints.up('sm'), {
30808 padding: '6px 24px'
30809 }), _defineProperty$1(_extends2, "overflow", 'hidden'), _defineProperty$1(_extends2, "whiteSpace", 'normal'), _defineProperty$1(_extends2, "textAlign", 'center'), _defineProperty$1(_extends2, theme.breakpoints.up('sm'), {
30810 minWidth: 160
30811 }), _extends2)),
30812
30813 /* Styles applied to the root element if both `icon` and `label` are provided. */
30814 labelIcon: {
30815 minHeight: 72,
30816 paddingTop: 9,
30817 '& $wrapper > *:first-child': {
30818 marginBottom: 6
30819 }
30820 },
30821
30822 /* Styles applied to the root element if the parent [`Tabs`](/api/tabs/) has `textColor="inherit"`. */
30823 textColorInherit: {
30824 color: 'inherit',
30825 opacity: 0.7,
30826 '&$selected': {
30827 opacity: 1
30828 },
30829 '&$disabled': {
30830 opacity: 0.5
30831 }
30832 },
30833
30834 /* Styles applied to the root element if the parent [`Tabs`](/api/tabs/) has `textColor="primary"`. */
30835 textColorPrimary: {
30836 color: theme.palette.text.secondary,
30837 '&$selected': {
30838 color: theme.palette.primary.main
30839 },
30840 '&$disabled': {
30841 color: theme.palette.text.disabled
30842 }
30843 },
30844
30845 /* Styles applied to the root element if the parent [`Tabs`](/api/tabs/) has `textColor="secondary"`. */
30846 textColorSecondary: {
30847 color: theme.palette.text.secondary,
30848 '&$selected': {
30849 color: theme.palette.secondary.main
30850 },
30851 '&$disabled': {
30852 color: theme.palette.text.disabled
30853 }
30854 },
30855
30856 /* Pseudo-class applied to the root element if `selected={true}` (controlled by the Tabs component). */
30857 selected: {},
30858
30859 /* Pseudo-class applied to the root element if `disabled={true}` (controlled by the Tabs component). */
30860 disabled: {},
30861
30862 /* Styles applied to the root element if `fullWidth={true}` (controlled by the Tabs component). */
30863 fullWidth: {
30864 flexShrink: 1,
30865 flexGrow: 1,
30866 flexBasis: 0,
30867 maxWidth: 'none'
30868 },
30869
30870 /* Styles applied to the root element if `wrapped={true}`. */
30871 wrapped: {
30872 fontSize: theme.typography.pxToRem(12),
30873 lineHeight: 1.5
30874 },
30875
30876 /* Styles applied to the `icon` and `label`'s wrapper element. */
30877 wrapper: {
30878 display: 'inline-flex',
30879 alignItems: 'center',
30880 justifyContent: 'center',
30881 width: '100%',
30882 flexDirection: 'column'
30883 }
30884 };
30885 };
30886 var Tab = /*#__PURE__*/react.exports.forwardRef(function Tab(props, ref) {
30887 var classes = props.classes,
30888 className = props.className,
30889 _props$disabled = props.disabled,
30890 disabled = _props$disabled === void 0 ? false : _props$disabled,
30891 _props$disableFocusRi = props.disableFocusRipple,
30892 disableFocusRipple = _props$disableFocusRi === void 0 ? false : _props$disableFocusRi,
30893 fullWidth = props.fullWidth,
30894 icon = props.icon,
30895 indicator = props.indicator,
30896 label = props.label,
30897 onChange = props.onChange,
30898 onClick = props.onClick,
30899 onFocus = props.onFocus,
30900 selected = props.selected,
30901 selectionFollowsFocus = props.selectionFollowsFocus,
30902 _props$textColor = props.textColor,
30903 textColor = _props$textColor === void 0 ? 'inherit' : _props$textColor,
30904 value = props.value,
30905 _props$wrapped = props.wrapped,
30906 wrapped = _props$wrapped === void 0 ? false : _props$wrapped,
30907 other = _objectWithoutProperties(props, ["classes", "className", "disabled", "disableFocusRipple", "fullWidth", "icon", "indicator", "label", "onChange", "onClick", "onFocus", "selected", "selectionFollowsFocus", "textColor", "value", "wrapped"]);
30908
30909 var handleClick = function handleClick(event) {
30910 if (onChange) {
30911 onChange(event, value);
30912 }
30913
30914 if (onClick) {
30915 onClick(event);
30916 }
30917 };
30918
30919 var handleFocus = function handleFocus(event) {
30920 if (selectionFollowsFocus && !selected && onChange) {
30921 onChange(event, value);
30922 }
30923
30924 if (onFocus) {
30925 onFocus(event);
30926 }
30927 };
30928
30929 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
30930 focusRipple: !disableFocusRipple,
30931 className: clsx(classes.root, classes["textColor".concat(capitalize(textColor))], className, disabled && classes.disabled, selected && classes.selected, label && icon && classes.labelIcon, fullWidth && classes.fullWidth, wrapped && classes.wrapped),
30932 ref: ref,
30933 role: "tab",
30934 "aria-selected": selected,
30935 disabled: disabled,
30936 onClick: handleClick,
30937 onFocus: handleFocus,
30938 tabIndex: selected ? 0 : -1
30939 }, other), /*#__PURE__*/react.exports.createElement("span", {
30940 className: classes.wrapper
30941 }, icon, label), indicator);
30942 });
30943 withStyles(styles$g, {
30944 name: 'MuiTab'
30945 })(Tab);
30946
30947 /**
30948 * @ignore - internal component.
30949 */
30950
30951 var TableContext = react.exports.createContext();
30952
30953 var styles$f = function styles(theme) {
30954 return {
30955 /* Styles applied to the root element. */
30956 root: {
30957 display: 'table',
30958 width: '100%',
30959 borderCollapse: 'collapse',
30960 borderSpacing: 0,
30961 '& caption': _extends$5({}, theme.typography.body2, {
30962 padding: theme.spacing(2),
30963 color: theme.palette.text.secondary,
30964 textAlign: 'left',
30965 captionSide: 'bottom'
30966 })
30967 },
30968
30969 /* Styles applied to the root element if `stickyHeader={true}`. */
30970 stickyHeader: {
30971 borderCollapse: 'separate'
30972 }
30973 };
30974 };
30975 var defaultComponent$5 = 'table';
30976 var Table = /*#__PURE__*/react.exports.forwardRef(function Table(props, ref) {
30977 var classes = props.classes,
30978 className = props.className,
30979 _props$component = props.component,
30980 Component = _props$component === void 0 ? defaultComponent$5 : _props$component,
30981 _props$padding = props.padding,
30982 padding = _props$padding === void 0 ? 'normal' : _props$padding,
30983 _props$size = props.size,
30984 size = _props$size === void 0 ? 'medium' : _props$size,
30985 _props$stickyHeader = props.stickyHeader,
30986 stickyHeader = _props$stickyHeader === void 0 ? false : _props$stickyHeader,
30987 other = _objectWithoutProperties(props, ["classes", "className", "component", "padding", "size", "stickyHeader"]);
30988
30989 var table = react.exports.useMemo(function () {
30990 return {
30991 padding: padding,
30992 size: size,
30993 stickyHeader: stickyHeader
30994 };
30995 }, [padding, size, stickyHeader]);
30996 return /*#__PURE__*/react.exports.createElement(TableContext.Provider, {
30997 value: table
30998 }, /*#__PURE__*/react.exports.createElement(Component, _extends$5({
30999 role: Component === defaultComponent$5 ? null : 'table',
31000 ref: ref,
31001 className: clsx(classes.root, className, stickyHeader && classes.stickyHeader)
31002 }, other)));
31003 });
31004 withStyles(styles$f, {
31005 name: 'MuiTable'
31006 })(Table);
31007
31008 /**
31009 * @ignore - internal component.
31010 */
31011
31012 var Tablelvl2Context = react.exports.createContext();
31013
31014 var styles$e = {
31015 /* Styles applied to the root element. */
31016 root: {
31017 display: 'table-row-group'
31018 }
31019 };
31020 var tablelvl2$2 = {
31021 variant: 'body'
31022 };
31023 var defaultComponent$4 = 'tbody';
31024 var TableBody = /*#__PURE__*/react.exports.forwardRef(function TableBody(props, ref) {
31025 var classes = props.classes,
31026 className = props.className,
31027 _props$component = props.component,
31028 Component = _props$component === void 0 ? defaultComponent$4 : _props$component,
31029 other = _objectWithoutProperties(props, ["classes", "className", "component"]);
31030
31031 return /*#__PURE__*/react.exports.createElement(Tablelvl2Context.Provider, {
31032 value: tablelvl2$2
31033 }, /*#__PURE__*/react.exports.createElement(Component, _extends$5({
31034 className: clsx(classes.root, className),
31035 ref: ref,
31036 role: Component === defaultComponent$4 ? null : 'rowgroup'
31037 }, other)));
31038 });
31039 withStyles(styles$e, {
31040 name: 'MuiTableBody'
31041 })(TableBody);
31042
31043 var styles$d = function styles(theme) {
31044 return {
31045 /* Styles applied to the root element. */
31046 root: _extends$5({}, theme.typography.body2, {
31047 display: 'table-cell',
31048 verticalAlign: 'inherit',
31049 // Workaround for a rendering bug with spanned columns in Chrome 62.0.
31050 // Removes the alpha (sets it to 1), and lightens or darkens the theme color.
31051 borderBottom: "1px solid\n ".concat(theme.palette.type === 'light' ? lighten(alpha(theme.palette.divider, 1), 0.88) : darken(alpha(theme.palette.divider, 1), 0.68)),
31052 textAlign: 'left',
31053 padding: 16
31054 }),
31055
31056 /* Styles applied to the root element if `variant="head"` or `context.table.head`. */
31057 head: {
31058 color: theme.palette.text.primary,
31059 lineHeight: theme.typography.pxToRem(24),
31060 fontWeight: theme.typography.fontWeightMedium
31061 },
31062
31063 /* Styles applied to the root element if `variant="body"` or `context.table.body`. */
31064 body: {
31065 color: theme.palette.text.primary
31066 },
31067
31068 /* Styles applied to the root element if `variant="footer"` or `context.table.footer`. */
31069 footer: {
31070 color: theme.palette.text.secondary,
31071 lineHeight: theme.typography.pxToRem(21),
31072 fontSize: theme.typography.pxToRem(12)
31073 },
31074
31075 /* Styles applied to the root element if `size="small"`. */
31076 sizeSmall: {
31077 padding: '6px 24px 6px 16px',
31078 '&:last-child': {
31079 paddingRight: 16
31080 },
31081 '&$paddingCheckbox': {
31082 width: 24,
31083 // prevent the checkbox column from growing
31084 padding: '0 12px 0 16px',
31085 '&:last-child': {
31086 paddingLeft: 12,
31087 paddingRight: 16
31088 },
31089 '& > *': {
31090 padding: 0
31091 }
31092 }
31093 },
31094
31095 /* Styles applied to the root element if `padding="checkbox"`. */
31096 paddingCheckbox: {
31097 width: 48,
31098 // prevent the checkbox column from growing
31099 padding: '0 0 0 4px',
31100 '&:last-child': {
31101 paddingLeft: 0,
31102 paddingRight: 4
31103 }
31104 },
31105
31106 /* Styles applied to the root element if `padding="none"`. */
31107 paddingNone: {
31108 padding: 0,
31109 '&:last-child': {
31110 padding: 0
31111 }
31112 },
31113
31114 /* Styles applied to the root element if `align="left"`. */
31115 alignLeft: {
31116 textAlign: 'left'
31117 },
31118
31119 /* Styles applied to the root element if `align="center"`. */
31120 alignCenter: {
31121 textAlign: 'center'
31122 },
31123
31124 /* Styles applied to the root element if `align="right"`. */
31125 alignRight: {
31126 textAlign: 'right',
31127 flexDirection: 'row-reverse'
31128 },
31129
31130 /* Styles applied to the root element if `align="justify"`. */
31131 alignJustify: {
31132 textAlign: 'justify'
31133 },
31134
31135 /* Styles applied to the root element if `context.table.stickyHeader={true}`. */
31136 stickyHeader: {
31137 position: 'sticky',
31138 top: 0,
31139 left: 0,
31140 zIndex: 2,
31141 backgroundColor: theme.palette.background.default
31142 }
31143 };
31144 };
31145 /**
31146 * The component renders a `<th>` element when the parent context is a header
31147 * or otherwise a `<td>` element.
31148 */
31149
31150 var TableCell = /*#__PURE__*/react.exports.forwardRef(function TableCell(props, ref) {
31151 var _props$align = props.align,
31152 align = _props$align === void 0 ? 'inherit' : _props$align,
31153 classes = props.classes,
31154 className = props.className,
31155 component = props.component,
31156 paddingProp = props.padding,
31157 scopeProp = props.scope,
31158 sizeProp = props.size,
31159 sortDirection = props.sortDirection,
31160 variantProp = props.variant,
31161 other = _objectWithoutProperties(props, ["align", "classes", "className", "component", "padding", "scope", "size", "sortDirection", "variant"]);
31162
31163 var table = react.exports.useContext(TableContext);
31164 var tablelvl2 = react.exports.useContext(Tablelvl2Context);
31165 var isHeadCell = tablelvl2 && tablelvl2.variant === 'head';
31166 var role;
31167 var Component;
31168
31169 if (component) {
31170 Component = component;
31171 role = isHeadCell ? 'columnheader' : 'cell';
31172 } else {
31173 Component = isHeadCell ? 'th' : 'td';
31174 }
31175
31176 var scope = scopeProp;
31177
31178 if (!scope && isHeadCell) {
31179 scope = 'col';
31180 }
31181
31182 var padding = paddingProp || (table && table.padding ? table.padding : 'normal');
31183 var size = sizeProp || (table && table.size ? table.size : 'medium');
31184 var variant = variantProp || tablelvl2 && tablelvl2.variant;
31185 var ariaSort = null;
31186
31187 if (sortDirection) {
31188 ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
31189 }
31190
31191 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
31192 ref: ref,
31193 className: clsx(classes.root, classes[variant], className, align !== 'inherit' && classes["align".concat(capitalize(align))], padding !== 'normal' && classes["padding".concat(capitalize(padding))], size !== 'medium' && classes["size".concat(capitalize(size))], variant === 'head' && table && table.stickyHeader && classes.stickyHeader),
31194 "aria-sort": ariaSort,
31195 role: role,
31196 scope: scope
31197 }, other));
31198 });
31199 var TableCell$1 = withStyles(styles$d, {
31200 name: 'MuiTableCell'
31201 })(TableCell);
31202
31203 var styles$c = {
31204 /* Styles applied to the root element. */
31205 root: {
31206 width: '100%',
31207 overflowX: 'auto'
31208 }
31209 };
31210 var TableContainer = /*#__PURE__*/react.exports.forwardRef(function TableContainer(props, ref) {
31211 var classes = props.classes,
31212 className = props.className,
31213 _props$component = props.component,
31214 Component = _props$component === void 0 ? 'div' : _props$component,
31215 other = _objectWithoutProperties(props, ["classes", "className", "component"]);
31216
31217 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
31218 ref: ref,
31219 className: clsx(classes.root, className)
31220 }, other));
31221 });
31222 withStyles(styles$c, {
31223 name: 'MuiTableContainer'
31224 })(TableContainer);
31225
31226 var styles$b = {
31227 /* Styles applied to the root element. */
31228 root: {
31229 display: 'table-footer-group'
31230 }
31231 };
31232 var tablelvl2$1 = {
31233 variant: 'footer'
31234 };
31235 var defaultComponent$3 = 'tfoot';
31236 var TableFooter = /*#__PURE__*/react.exports.forwardRef(function TableFooter(props, ref) {
31237 var classes = props.classes,
31238 className = props.className,
31239 _props$component = props.component,
31240 Component = _props$component === void 0 ? defaultComponent$3 : _props$component,
31241 other = _objectWithoutProperties(props, ["classes", "className", "component"]);
31242
31243 return /*#__PURE__*/react.exports.createElement(Tablelvl2Context.Provider, {
31244 value: tablelvl2$1
31245 }, /*#__PURE__*/react.exports.createElement(Component, _extends$5({
31246 className: clsx(classes.root, className),
31247 ref: ref,
31248 role: Component === defaultComponent$3 ? null : 'rowgroup'
31249 }, other)));
31250 });
31251 withStyles(styles$b, {
31252 name: 'MuiTableFooter'
31253 })(TableFooter);
31254
31255 var styles$a = {
31256 /* Styles applied to the root element. */
31257 root: {
31258 display: 'table-header-group'
31259 }
31260 };
31261 var tablelvl2 = {
31262 variant: 'head'
31263 };
31264 var defaultComponent$2 = 'thead';
31265 var TableHead = /*#__PURE__*/react.exports.forwardRef(function TableHead(props, ref) {
31266 var classes = props.classes,
31267 className = props.className,
31268 _props$component = props.component,
31269 Component = _props$component === void 0 ? defaultComponent$2 : _props$component,
31270 other = _objectWithoutProperties(props, ["classes", "className", "component"]);
31271
31272 return /*#__PURE__*/react.exports.createElement(Tablelvl2Context.Provider, {
31273 value: tablelvl2
31274 }, /*#__PURE__*/react.exports.createElement(Component, _extends$5({
31275 className: clsx(classes.root, className),
31276 ref: ref,
31277 role: Component === defaultComponent$2 ? null : 'rowgroup'
31278 }, other)));
31279 });
31280 withStyles(styles$a, {
31281 name: 'MuiTableHead'
31282 })(TableHead);
31283
31284 var styles$9 = function styles(theme) {
31285 return {
31286 /* Styles applied to the root element. */
31287 root: {
31288 position: 'relative',
31289 display: 'flex',
31290 alignItems: 'center'
31291 },
31292
31293 /* Styles applied to the root element if `disableGutters={false}`. */
31294 gutters: _defineProperty$1({
31295 paddingLeft: theme.spacing(2),
31296 paddingRight: theme.spacing(2)
31297 }, theme.breakpoints.up('sm'), {
31298 paddingLeft: theme.spacing(3),
31299 paddingRight: theme.spacing(3)
31300 }),
31301
31302 /* Styles applied to the root element if `variant="regular"`. */
31303 regular: theme.mixins.toolbar,
31304
31305 /* Styles applied to the root element if `variant="dense"`. */
31306 dense: {
31307 minHeight: 48
31308 }
31309 };
31310 };
31311 var Toolbar = /*#__PURE__*/react.exports.forwardRef(function Toolbar(props, ref) {
31312 var classes = props.classes,
31313 className = props.className,
31314 _props$component = props.component,
31315 Component = _props$component === void 0 ? 'div' : _props$component,
31316 _props$disableGutters = props.disableGutters,
31317 disableGutters = _props$disableGutters === void 0 ? false : _props$disableGutters,
31318 _props$variant = props.variant,
31319 variant = _props$variant === void 0 ? 'regular' : _props$variant,
31320 other = _objectWithoutProperties(props, ["classes", "className", "component", "disableGutters", "variant"]);
31321
31322 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
31323 className: clsx(classes.root, classes[variant], className, !disableGutters && classes.gutters),
31324 ref: ref
31325 }, other));
31326 });
31327 var Toolbar$1 = withStyles(styles$9, {
31328 name: 'MuiToolbar'
31329 })(Toolbar);
31330
31331 /**
31332 * @ignore - internal component.
31333 */
31334
31335 var KeyboardArrowLeft = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
31336 d: "M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"
31337 }));
31338
31339 /**
31340 * @ignore - internal component.
31341 */
31342
31343 var KeyboardArrowRight = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
31344 d: "M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"
31345 }));
31346
31347 /**
31348 * @ignore - internal component.
31349 */
31350
31351 var _ref$1 = /*#__PURE__*/react.exports.createElement(KeyboardArrowRight, null);
31352
31353 var _ref2$1 = /*#__PURE__*/react.exports.createElement(KeyboardArrowLeft, null);
31354
31355 var _ref3 = /*#__PURE__*/react.exports.createElement(KeyboardArrowLeft, null);
31356
31357 var _ref4 = /*#__PURE__*/react.exports.createElement(KeyboardArrowRight, null);
31358
31359 var TablePaginationActions = /*#__PURE__*/react.exports.forwardRef(function TablePaginationActions(props, ref) {
31360 var backIconButtonProps = props.backIconButtonProps,
31361 count = props.count,
31362 nextIconButtonProps = props.nextIconButtonProps,
31363 _props$onChangePage = props.onChangePage,
31364 onChangePage = _props$onChangePage === void 0 ? function () {} : _props$onChangePage,
31365 _props$onPageChange = props.onPageChange,
31366 onPageChange = _props$onPageChange === void 0 ? function () {} : _props$onPageChange,
31367 page = props.page,
31368 rowsPerPage = props.rowsPerPage,
31369 other = _objectWithoutProperties(props, ["backIconButtonProps", "count", "nextIconButtonProps", "onChangePage", "onPageChange", "page", "rowsPerPage"]);
31370
31371 var theme = useTheme$1();
31372
31373 var handleBackButtonClick = function handleBackButtonClick(event) {
31374 onChangePage(event, page - 1);
31375 onPageChange(event, page - 1);
31376 };
31377
31378 var handleNextButtonClick = function handleNextButtonClick(event) {
31379 onChangePage(event, page + 1);
31380 onPageChange(event, page + 1);
31381 };
31382
31383 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
31384 ref: ref
31385 }, other), /*#__PURE__*/react.exports.createElement(IconButton$1, _extends$5({
31386 onClick: handleBackButtonClick,
31387 disabled: page === 0,
31388 color: "inherit"
31389 }, backIconButtonProps), theme.direction === 'rtl' ? _ref$1 : _ref2$1), /*#__PURE__*/react.exports.createElement(IconButton$1, _extends$5({
31390 onClick: handleNextButtonClick,
31391 disabled: count !== -1 ? page >= Math.ceil(count / rowsPerPage) - 1 : false,
31392 color: "inherit"
31393 }, nextIconButtonProps), theme.direction === 'rtl' ? _ref3 : _ref4));
31394 });
31395
31396 var styles$8 = function styles(theme) {
31397 return {
31398 /* Styles applied to the root element. */
31399 root: {
31400 color: theme.palette.text.primary,
31401 fontSize: theme.typography.pxToRem(14),
31402 overflow: 'auto',
31403 // Increase the specificity to override TableCell.
31404 '&:last-child': {
31405 padding: 0
31406 }
31407 },
31408
31409 /* Styles applied to the Toolbar component. */
31410 toolbar: {
31411 minHeight: 52,
31412 paddingRight: 2
31413 },
31414
31415 /* Styles applied to the spacer element. */
31416 spacer: {
31417 flex: '1 1 100%'
31418 },
31419
31420 /* Styles applied to the caption Typography components if `variant="caption"`. */
31421 caption: {
31422 flexShrink: 0
31423 },
31424 // TODO v5: `.selectRoot` should be merged with `.input`
31425
31426 /* Styles applied to the Select component root element. */
31427 selectRoot: {
31428 marginRight: 32,
31429 marginLeft: 8
31430 },
31431
31432 /* Styles applied to the Select component `select` class. */
31433 select: {
31434 paddingLeft: 8,
31435 paddingRight: 24,
31436 textAlign: 'right',
31437 textAlignLast: 'right' // Align <select> on Chrome.
31438
31439 },
31440 // TODO v5: remove
31441
31442 /* Styles applied to the Select component `icon` class. */
31443 selectIcon: {},
31444
31445 /* Styles applied to the `InputBase` component. */
31446 input: {
31447 color: 'inherit',
31448 fontSize: 'inherit',
31449 flexShrink: 0
31450 },
31451
31452 /* Styles applied to the MenuItem component. */
31453 menuItem: {},
31454
31455 /* Styles applied to the internal `TablePaginationActions` component. */
31456 actions: {
31457 flexShrink: 0,
31458 marginLeft: 20
31459 }
31460 };
31461 };
31462
31463 var defaultLabelDisplayedRows = function defaultLabelDisplayedRows(_ref) {
31464 var from = _ref.from,
31465 to = _ref.to,
31466 count = _ref.count;
31467 return "".concat(from, "-").concat(to, " of ").concat(count !== -1 ? count : "more than ".concat(to));
31468 };
31469
31470 var defaultRowsPerPageOptions = [10, 25, 50, 100];
31471 /**
31472 * A `TableCell` based component for placing inside `TableFooter` for pagination.
31473 */
31474
31475 var TablePagination = /*#__PURE__*/react.exports.forwardRef(function TablePagination(props, ref) {
31476 var _props$ActionsCompone = props.ActionsComponent,
31477 ActionsComponent = _props$ActionsCompone === void 0 ? TablePaginationActions : _props$ActionsCompone,
31478 backIconButtonProps = props.backIconButtonProps,
31479 _props$backIconButton = props.backIconButtonText,
31480 backIconButtonText = _props$backIconButton === void 0 ? 'Previous page' : _props$backIconButton,
31481 classes = props.classes,
31482 className = props.className,
31483 colSpanProp = props.colSpan,
31484 _props$component = props.component,
31485 Component = _props$component === void 0 ? TableCell$1 : _props$component,
31486 count = props.count,
31487 _props$labelDisplayed = props.labelDisplayedRows,
31488 labelDisplayedRows = _props$labelDisplayed === void 0 ? defaultLabelDisplayedRows : _props$labelDisplayed,
31489 _props$labelRowsPerPa = props.labelRowsPerPage,
31490 labelRowsPerPage = _props$labelRowsPerPa === void 0 ? 'Rows per page:' : _props$labelRowsPerPa,
31491 nextIconButtonProps = props.nextIconButtonProps,
31492 _props$nextIconButton = props.nextIconButtonText,
31493 nextIconButtonText = _props$nextIconButton === void 0 ? 'Next page' : _props$nextIconButton,
31494 onChangePage = props.onChangePage,
31495 onPageChange = props.onPageChange,
31496 onChangeRowsPerPageProp = props.onChangeRowsPerPage,
31497 onRowsPerPageChangeProp = props.onRowsPerPageChange,
31498 page = props.page,
31499 rowsPerPage = props.rowsPerPage,
31500 _props$rowsPerPageOpt = props.rowsPerPageOptions,
31501 rowsPerPageOptions = _props$rowsPerPageOpt === void 0 ? defaultRowsPerPageOptions : _props$rowsPerPageOpt,
31502 _props$SelectProps = props.SelectProps,
31503 SelectProps = _props$SelectProps === void 0 ? {} : _props$SelectProps,
31504 other = _objectWithoutProperties(props, ["ActionsComponent", "backIconButtonProps", "backIconButtonText", "classes", "className", "colSpan", "component", "count", "labelDisplayedRows", "labelRowsPerPage", "nextIconButtonProps", "nextIconButtonText", "onChangePage", "onPageChange", "onChangeRowsPerPage", "onRowsPerPageChange", "page", "rowsPerPage", "rowsPerPageOptions", "SelectProps"]);
31505
31506 var onChangeRowsPerPage = onChangeRowsPerPageProp || onRowsPerPageChangeProp;
31507 var colSpan;
31508
31509 if (Component === TableCell$1 || Component === 'td') {
31510 colSpan = colSpanProp || 1000; // col-span over everything
31511 }
31512
31513 var selectId = useId();
31514 var labelId = useId();
31515 var MenuItemComponent = SelectProps.native ? 'option' : MenuItem$1;
31516 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
31517 className: clsx(classes.root, className),
31518 colSpan: colSpan,
31519 ref: ref
31520 }, other), /*#__PURE__*/react.exports.createElement(Toolbar$1, {
31521 className: classes.toolbar
31522 }, /*#__PURE__*/react.exports.createElement("div", {
31523 className: classes.spacer
31524 }), rowsPerPageOptions.length > 1 && /*#__PURE__*/react.exports.createElement(Typography$1, {
31525 color: "inherit",
31526 variant: "body2",
31527 className: classes.caption,
31528 id: labelId
31529 }, labelRowsPerPage), rowsPerPageOptions.length > 1 && /*#__PURE__*/react.exports.createElement(Select$1, _extends$5({
31530 classes: {
31531 select: classes.select,
31532 icon: classes.selectIcon
31533 },
31534 input: /*#__PURE__*/react.exports.createElement(InputBase$1, {
31535 className: clsx(classes.input, classes.selectRoot)
31536 }),
31537 value: rowsPerPage,
31538 onChange: onChangeRowsPerPage,
31539 id: selectId,
31540 labelId: labelId
31541 }, SelectProps), rowsPerPageOptions.map(function (rowsPerPageOption) {
31542 return /*#__PURE__*/react.exports.createElement(MenuItemComponent, {
31543 className: classes.menuItem,
31544 key: rowsPerPageOption.value ? rowsPerPageOption.value : rowsPerPageOption,
31545 value: rowsPerPageOption.value ? rowsPerPageOption.value : rowsPerPageOption
31546 }, rowsPerPageOption.label ? rowsPerPageOption.label : rowsPerPageOption);
31547 })), /*#__PURE__*/react.exports.createElement(Typography$1, {
31548 color: "inherit",
31549 variant: "body2",
31550 className: classes.caption
31551 }, labelDisplayedRows({
31552 from: count === 0 ? 0 : page * rowsPerPage + 1,
31553 to: count !== -1 ? Math.min(count, (page + 1) * rowsPerPage) : (page + 1) * rowsPerPage,
31554 count: count === -1 ? -1 : count,
31555 page: page
31556 })), /*#__PURE__*/react.exports.createElement(ActionsComponent, {
31557 className: classes.actions,
31558 backIconButtonProps: _extends$5({
31559 title: backIconButtonText,
31560 'aria-label': backIconButtonText
31561 }, backIconButtonProps),
31562 count: count,
31563 nextIconButtonProps: _extends$5({
31564 title: nextIconButtonText,
31565 'aria-label': nextIconButtonText
31566 }, nextIconButtonProps),
31567 onChangePage: onChangePage,
31568 onPageChange: onPageChange,
31569 page: page,
31570 rowsPerPage: rowsPerPage
31571 })));
31572 });
31573 withStyles(styles$8, {
31574 name: 'MuiTablePagination'
31575 })(TablePagination);
31576
31577 var styles$7 = function styles(theme) {
31578 return {
31579 /* Styles applied to the root element. */
31580 root: {
31581 color: 'inherit',
31582 display: 'table-row',
31583 verticalAlign: 'middle',
31584 // We disable the focus ring for mouse, touch and keyboard users.
31585 outline: 0,
31586 '&$hover:hover': {
31587 backgroundColor: theme.palette.action.hover
31588 },
31589 '&$selected, &$selected:hover': {
31590 backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.selectedOpacity)
31591 }
31592 },
31593
31594 /* Pseudo-class applied to the root element if `selected={true}`. */
31595 selected: {},
31596
31597 /* Pseudo-class applied to the root element if `hover={true}`. */
31598 hover: {},
31599
31600 /* Styles applied to the root element if table variant="head". */
31601 head: {},
31602
31603 /* Styles applied to the root element if table variant="footer". */
31604 footer: {}
31605 };
31606 };
31607 var defaultComponent$1 = 'tr';
31608 /**
31609 * Will automatically set dynamic row height
31610 * based on the material table element parent (head, body, etc).
31611 */
31612
31613 var TableRow = /*#__PURE__*/react.exports.forwardRef(function TableRow(props, ref) {
31614 var classes = props.classes,
31615 className = props.className,
31616 _props$component = props.component,
31617 Component = _props$component === void 0 ? defaultComponent$1 : _props$component,
31618 _props$hover = props.hover,
31619 hover = _props$hover === void 0 ? false : _props$hover,
31620 _props$selected = props.selected,
31621 selected = _props$selected === void 0 ? false : _props$selected,
31622 other = _objectWithoutProperties(props, ["classes", "className", "component", "hover", "selected"]);
31623
31624 var tablelvl2 = react.exports.useContext(Tablelvl2Context);
31625 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
31626 ref: ref,
31627 className: clsx(classes.root, className, tablelvl2 && {
31628 'head': classes.head,
31629 'footer': classes.footer
31630 }[tablelvl2.variant], hover && classes.hover, selected && classes.selected),
31631 role: Component === defaultComponent$1 ? null : 'row'
31632 }, other));
31633 });
31634 withStyles(styles$7, {
31635 name: 'MuiTableRow'
31636 })(TableRow);
31637
31638 /**
31639 * @ignore - internal component.
31640 */
31641
31642 var ArrowDownwardIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
31643 d: "M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
31644 }));
31645
31646 var styles$6 = function styles(theme) {
31647 return {
31648 /* Styles applied to the root element. */
31649 root: {
31650 cursor: 'pointer',
31651 display: 'inline-flex',
31652 justifyContent: 'flex-start',
31653 flexDirection: 'inherit',
31654 alignItems: 'center',
31655 '&:focus': {
31656 color: theme.palette.text.secondary
31657 },
31658 '&:hover': {
31659 color: theme.palette.text.secondary,
31660 '& $icon': {
31661 opacity: 0.5
31662 }
31663 },
31664 '&$active': {
31665 color: theme.palette.text.primary,
31666 // && instead of & is a workaround for https://github.com/cssinjs/jss/issues/1045
31667 '&& $icon': {
31668 opacity: 1,
31669 color: theme.palette.text.secondary
31670 }
31671 }
31672 },
31673
31674 /* Pseudo-class applied to the root element if `active={true}`. */
31675 active: {},
31676
31677 /* Styles applied to the icon component. */
31678 icon: {
31679 fontSize: 18,
31680 marginRight: 4,
31681 marginLeft: 4,
31682 opacity: 0,
31683 transition: theme.transitions.create(['opacity', 'transform'], {
31684 duration: theme.transitions.duration.shorter
31685 }),
31686 userSelect: 'none'
31687 },
31688
31689 /* Styles applied to the icon component if `direction="desc"`. */
31690 iconDirectionDesc: {
31691 transform: 'rotate(0deg)'
31692 },
31693
31694 /* Styles applied to the icon component if `direction="asc"`. */
31695 iconDirectionAsc: {
31696 transform: 'rotate(180deg)'
31697 }
31698 };
31699 };
31700 /**
31701 * A button based label for placing inside `TableCell` for column sorting.
31702 */
31703
31704 var TableSortLabel = /*#__PURE__*/react.exports.forwardRef(function TableSortLabel(props, ref) {
31705 var _props$active = props.active,
31706 active = _props$active === void 0 ? false : _props$active,
31707 children = props.children,
31708 classes = props.classes,
31709 className = props.className,
31710 _props$direction = props.direction,
31711 direction = _props$direction === void 0 ? 'asc' : _props$direction,
31712 _props$hideSortIcon = props.hideSortIcon,
31713 hideSortIcon = _props$hideSortIcon === void 0 ? false : _props$hideSortIcon,
31714 _props$IconComponent = props.IconComponent,
31715 IconComponent = _props$IconComponent === void 0 ? ArrowDownwardIcon : _props$IconComponent,
31716 other = _objectWithoutProperties(props, ["active", "children", "classes", "className", "direction", "hideSortIcon", "IconComponent"]);
31717
31718 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
31719 className: clsx(classes.root, className, active && classes.active),
31720 component: "span",
31721 disableRipple: true,
31722 ref: ref
31723 }, other), children, hideSortIcon && !active ? null : /*#__PURE__*/react.exports.createElement(IconComponent, {
31724 className: clsx(classes.icon, classes["iconDirection".concat(capitalize(direction))])
31725 }));
31726 });
31727 withStyles(styles$6, {
31728 name: 'MuiTableSortLabel'
31729 })(TableSortLabel);
31730
31731 // Source from https://github.com/alitaheri/normalize-scroll-left
31732 var cachedType;
31733 /**
31734 * Based on the jquery plugin https://github.com/othree/jquery.rtl-scroll-type
31735 *
31736 * Types of scrollLeft, assuming scrollWidth=100 and direction is rtl.
31737 *
31738 * Type | <- Most Left | Most Right -> | Initial
31739 * ---------------- | ------------ | ------------- | -------
31740 * default | 0 | 100 | 100
31741 * negative (spec*) | -100 | 0 | 0
31742 * reverse | 100 | 0 | 0
31743 *
31744 * Edge 85: default
31745 * Safari 14: negative
31746 * Chrome 85: negative
31747 * Firefox 81: negative
31748 * IE 11: reverse
31749 *
31750 * spec* https://drafts.csswg.org/cssom-view/#dom-window-scroll
31751 */
31752
31753 function detectScrollType() {
31754 if (cachedType) {
31755 return cachedType;
31756 }
31757
31758 var dummy = document.createElement('div');
31759 var container = document.createElement('div');
31760 container.style.width = '10px';
31761 container.style.height = '1px';
31762 dummy.appendChild(container);
31763 dummy.dir = 'rtl';
31764 dummy.style.fontSize = '14px';
31765 dummy.style.width = '4px';
31766 dummy.style.height = '1px';
31767 dummy.style.position = 'absolute';
31768 dummy.style.top = '-1000px';
31769 dummy.style.overflow = 'scroll';
31770 document.body.appendChild(dummy);
31771 cachedType = 'reverse';
31772
31773 if (dummy.scrollLeft > 0) {
31774 cachedType = 'default';
31775 } else {
31776 dummy.scrollLeft = 1;
31777
31778 if (dummy.scrollLeft === 0) {
31779 cachedType = 'negative';
31780 }
31781 }
31782
31783 document.body.removeChild(dummy);
31784 return cachedType;
31785 } // Based on https://stackoverflow.com/a/24394376
31786
31787 function getNormalizedScrollLeft(element, direction) {
31788 var scrollLeft = element.scrollLeft; // Perform the calculations only when direction is rtl to avoid messing up the ltr bahavior
31789
31790 if (direction !== 'rtl') {
31791 return scrollLeft;
31792 }
31793
31794 var type = detectScrollType();
31795
31796 switch (type) {
31797 case 'negative':
31798 return element.scrollWidth - element.clientWidth + scrollLeft;
31799
31800 case 'reverse':
31801 return element.scrollWidth - element.clientWidth - scrollLeft;
31802
31803 default:
31804 return scrollLeft;
31805 }
31806 }
31807
31808 function easeInOutSin(time) {
31809 return (1 + Math.sin(Math.PI * time - Math.PI / 2)) / 2;
31810 }
31811
31812 function animate(property, element, to) {
31813 var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
31814 var cb = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {};
31815 var _options$ease = options.ease,
31816 ease = _options$ease === void 0 ? easeInOutSin : _options$ease,
31817 _options$duration = options.duration,
31818 duration = _options$duration === void 0 ? 300 : _options$duration;
31819 var start = null;
31820 var from = element[property];
31821 var cancelled = false;
31822
31823 var cancel = function cancel() {
31824 cancelled = true;
31825 };
31826
31827 var step = function step(timestamp) {
31828 if (cancelled) {
31829 cb(new Error('Animation cancelled'));
31830 return;
31831 }
31832
31833 if (start === null) {
31834 start = timestamp;
31835 }
31836
31837 var time = Math.min(1, (timestamp - start) / duration);
31838 element[property] = ease(time) * (to - from) + from;
31839
31840 if (time >= 1) {
31841 requestAnimationFrame(function () {
31842 cb(null);
31843 });
31844 return;
31845 }
31846
31847 requestAnimationFrame(step);
31848 };
31849
31850 if (from === to) {
31851 cb(new Error('Element already at target position'));
31852 return cancel;
31853 }
31854
31855 requestAnimationFrame(step);
31856 return cancel;
31857 }
31858
31859 var styles$5 = {
31860 width: 99,
31861 height: 99,
31862 position: 'absolute',
31863 top: -9999,
31864 overflow: 'scroll'
31865 };
31866 /**
31867 * @ignore - internal component.
31868 * The component originates from https://github.com/STORIS/react-scrollbar-size.
31869 * It has been moved into the core in order to minimize the bundle size.
31870 */
31871
31872 function ScrollbarSize(props) {
31873 var onChange = props.onChange,
31874 other = _objectWithoutProperties(props, ["onChange"]);
31875
31876 var scrollbarHeight = react.exports.useRef();
31877 var nodeRef = react.exports.useRef(null);
31878
31879 var setMeasurements = function setMeasurements() {
31880 scrollbarHeight.current = nodeRef.current.offsetHeight - nodeRef.current.clientHeight;
31881 };
31882
31883 react.exports.useEffect(function () {
31884 var handleResize = debounce$1(function () {
31885 var prevHeight = scrollbarHeight.current;
31886 setMeasurements();
31887
31888 if (prevHeight !== scrollbarHeight.current) {
31889 onChange(scrollbarHeight.current);
31890 }
31891 });
31892 window.addEventListener('resize', handleResize);
31893 return function () {
31894 handleResize.clear();
31895 window.removeEventListener('resize', handleResize);
31896 };
31897 }, [onChange]);
31898 react.exports.useEffect(function () {
31899 setMeasurements();
31900 onChange(scrollbarHeight.current);
31901 }, [onChange]);
31902 return /*#__PURE__*/react.exports.createElement("div", _extends$5({
31903 style: styles$5,
31904 ref: nodeRef
31905 }, other));
31906 }
31907
31908 var styles$4 = function styles(theme) {
31909 return {
31910 root: {
31911 position: 'absolute',
31912 height: 2,
31913 bottom: 0,
31914 width: '100%',
31915 transition: theme.transitions.create()
31916 },
31917 colorPrimary: {
31918 backgroundColor: theme.palette.primary.main
31919 },
31920 colorSecondary: {
31921 backgroundColor: theme.palette.secondary.main
31922 },
31923 vertical: {
31924 height: '100%',
31925 width: 2,
31926 right: 0
31927 }
31928 };
31929 };
31930 /**
31931 * @ignore - internal component.
31932 */
31933
31934 var TabIndicator = /*#__PURE__*/react.exports.forwardRef(function TabIndicator(props, ref) {
31935 var classes = props.classes,
31936 className = props.className,
31937 color = props.color,
31938 orientation = props.orientation,
31939 other = _objectWithoutProperties(props, ["classes", "className", "color", "orientation"]);
31940
31941 return /*#__PURE__*/react.exports.createElement("span", _extends$5({
31942 className: clsx(classes.root, classes["color".concat(capitalize(color))], className, orientation === 'vertical' && classes.vertical),
31943 ref: ref
31944 }, other));
31945 });
31946 var TabIndicator$1 = withStyles(styles$4, {
31947 name: 'PrivateTabIndicator'
31948 })(TabIndicator);
31949
31950 var styles$3 = {
31951 /* Styles applied to the root element. */
31952 root: {
31953 width: 40,
31954 flexShrink: 0,
31955 opacity: 0.8,
31956 '&$disabled': {
31957 opacity: 0
31958 }
31959 },
31960
31961 /* Styles applied to the root element if `orientation="vertical"`. */
31962 vertical: {
31963 width: '100%',
31964 height: 40,
31965 '& svg': {
31966 transform: 'rotate(90deg)'
31967 }
31968 },
31969
31970 /* Pseudo-class applied to the root element if `disabled={true}`. */
31971 disabled: {}
31972 };
31973
31974 var _ref = /*#__PURE__*/react.exports.createElement(KeyboardArrowLeft, {
31975 fontSize: "small"
31976 });
31977
31978 var _ref2 = /*#__PURE__*/react.exports.createElement(KeyboardArrowRight, {
31979 fontSize: "small"
31980 });
31981
31982 var TabScrollButton = /*#__PURE__*/react.exports.forwardRef(function TabScrollButton(props, ref) {
31983 var classes = props.classes,
31984 classNameProp = props.className,
31985 direction = props.direction,
31986 orientation = props.orientation,
31987 disabled = props.disabled,
31988 other = _objectWithoutProperties(props, ["classes", "className", "direction", "orientation", "disabled"]);
31989
31990 return /*#__PURE__*/react.exports.createElement(ButtonBase$1, _extends$5({
31991 component: "div",
31992 className: clsx(classes.root, classNameProp, disabled && classes.disabled, orientation === 'vertical' && classes.vertical),
31993 ref: ref,
31994 role: null,
31995 tabIndex: null
31996 }, other), direction === 'left' ? _ref : _ref2);
31997 });
31998 var TabScrollButton$1 = withStyles(styles$3, {
31999 name: 'MuiTabScrollButton'
32000 })(TabScrollButton);
32001
32002 var styles$2 = function styles(theme) {
32003 return {
32004 /* Styles applied to the root element. */
32005 root: {
32006 overflow: 'hidden',
32007 minHeight: 48,
32008 WebkitOverflowScrolling: 'touch',
32009 // Add iOS momentum scrolling.
32010 display: 'flex'
32011 },
32012
32013 /* Styles applied to the root element if `orientation="vertical"`. */
32014 vertical: {
32015 flexDirection: 'column'
32016 },
32017
32018 /* Styles applied to the flex container element. */
32019 flexContainer: {
32020 display: 'flex'
32021 },
32022
32023 /* Styles applied to the flex container element if `orientation="vertical"`. */
32024 flexContainerVertical: {
32025 flexDirection: 'column'
32026 },
32027
32028 /* Styles applied to the flex container element if `centered={true}` & `!variant="scrollable"`. */
32029 centered: {
32030 justifyContent: 'center'
32031 },
32032
32033 /* Styles applied to the tablist element. */
32034 scroller: {
32035 position: 'relative',
32036 display: 'inline-block',
32037 flex: '1 1 auto',
32038 whiteSpace: 'nowrap'
32039 },
32040
32041 /* Styles applied to the tablist element if `!variant="scrollable"`. */
32042 fixed: {
32043 overflowX: 'hidden',
32044 width: '100%'
32045 },
32046
32047 /* Styles applied to the tablist element if `variant="scrollable"`. */
32048 scrollable: {
32049 overflowX: 'scroll',
32050 // Hide dimensionless scrollbar on MacOS
32051 scrollbarWidth: 'none',
32052 // Firefox
32053 '&::-webkit-scrollbar': {
32054 display: 'none' // Safari + Chrome
32055
32056 }
32057 },
32058
32059 /* Styles applied to the `ScrollButtonComponent` component. */
32060 scrollButtons: {},
32061
32062 /* Styles applied to the `ScrollButtonComponent` component if `scrollButtons="auto"` or scrollButtons="desktop"`. */
32063 scrollButtonsDesktop: _defineProperty$1({}, theme.breakpoints.down('xs'), {
32064 display: 'none'
32065 }),
32066
32067 /* Styles applied to the `TabIndicator` component. */
32068 indicator: {}
32069 };
32070 };
32071 var Tabs = /*#__PURE__*/react.exports.forwardRef(function Tabs(props, ref) {
32072 var ariaLabel = props['aria-label'],
32073 ariaLabelledBy = props['aria-labelledby'],
32074 action = props.action,
32075 _props$centered = props.centered,
32076 centered = _props$centered === void 0 ? false : _props$centered,
32077 childrenProp = props.children,
32078 classes = props.classes,
32079 className = props.className,
32080 _props$component = props.component,
32081 Component = _props$component === void 0 ? 'div' : _props$component,
32082 _props$indicatorColor = props.indicatorColor,
32083 indicatorColor = _props$indicatorColor === void 0 ? 'secondary' : _props$indicatorColor,
32084 onChange = props.onChange,
32085 _props$orientation = props.orientation,
32086 orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
32087 _props$ScrollButtonCo = props.ScrollButtonComponent,
32088 ScrollButtonComponent = _props$ScrollButtonCo === void 0 ? TabScrollButton$1 : _props$ScrollButtonCo,
32089 _props$scrollButtons = props.scrollButtons,
32090 scrollButtons = _props$scrollButtons === void 0 ? 'auto' : _props$scrollButtons,
32091 selectionFollowsFocus = props.selectionFollowsFocus,
32092 _props$TabIndicatorPr = props.TabIndicatorProps,
32093 TabIndicatorProps = _props$TabIndicatorPr === void 0 ? {} : _props$TabIndicatorPr,
32094 TabScrollButtonProps = props.TabScrollButtonProps,
32095 _props$textColor = props.textColor,
32096 textColor = _props$textColor === void 0 ? 'inherit' : _props$textColor,
32097 value = props.value,
32098 _props$variant = props.variant,
32099 variant = _props$variant === void 0 ? 'standard' : _props$variant,
32100 other = _objectWithoutProperties(props, ["aria-label", "aria-labelledby", "action", "centered", "children", "classes", "className", "component", "indicatorColor", "onChange", "orientation", "ScrollButtonComponent", "scrollButtons", "selectionFollowsFocus", "TabIndicatorProps", "TabScrollButtonProps", "textColor", "value", "variant"]);
32101
32102 var theme = useTheme$1();
32103 var scrollable = variant === 'scrollable';
32104 var isRtl = theme.direction === 'rtl';
32105 var vertical = orientation === 'vertical';
32106 var scrollStart = vertical ? 'scrollTop' : 'scrollLeft';
32107 var start = vertical ? 'top' : 'left';
32108 var end = vertical ? 'bottom' : 'right';
32109 var clientSize = vertical ? 'clientHeight' : 'clientWidth';
32110 var size = vertical ? 'height' : 'width';
32111
32112 var _React$useState = react.exports.useState(false),
32113 mounted = _React$useState[0],
32114 setMounted = _React$useState[1];
32115
32116 var _React$useState2 = react.exports.useState({}),
32117 indicatorStyle = _React$useState2[0],
32118 setIndicatorStyle = _React$useState2[1];
32119
32120 var _React$useState3 = react.exports.useState({
32121 start: false,
32122 end: false
32123 }),
32124 displayScroll = _React$useState3[0],
32125 setDisplayScroll = _React$useState3[1];
32126
32127 var _React$useState4 = react.exports.useState({
32128 overflow: 'hidden',
32129 marginBottom: null
32130 }),
32131 scrollerStyle = _React$useState4[0],
32132 setScrollerStyle = _React$useState4[1];
32133
32134 var valueToIndex = new Map();
32135 var tabsRef = react.exports.useRef(null);
32136 var tabListRef = react.exports.useRef(null);
32137
32138 var getTabsMeta = function getTabsMeta() {
32139 var tabsNode = tabsRef.current;
32140 var tabsMeta;
32141
32142 if (tabsNode) {
32143 var rect = tabsNode.getBoundingClientRect(); // create a new object with ClientRect class props + scrollLeft
32144
32145 tabsMeta = {
32146 clientWidth: tabsNode.clientWidth,
32147 scrollLeft: tabsNode.scrollLeft,
32148 scrollTop: tabsNode.scrollTop,
32149 scrollLeftNormalized: getNormalizedScrollLeft(tabsNode, theme.direction),
32150 scrollWidth: tabsNode.scrollWidth,
32151 top: rect.top,
32152 bottom: rect.bottom,
32153 left: rect.left,
32154 right: rect.right
32155 };
32156 }
32157
32158 var tabMeta;
32159
32160 if (tabsNode && value !== false) {
32161 var _children = tabListRef.current.children;
32162
32163 if (_children.length > 0) {
32164 var tab = _children[valueToIndex.get(value)];
32165
32166 tabMeta = tab ? tab.getBoundingClientRect() : null;
32167 }
32168 }
32169
32170 return {
32171 tabsMeta: tabsMeta,
32172 tabMeta: tabMeta
32173 };
32174 };
32175
32176 var updateIndicatorState = useEventCallback(function () {
32177 var _newIndicatorStyle;
32178
32179 var _getTabsMeta = getTabsMeta(),
32180 tabsMeta = _getTabsMeta.tabsMeta,
32181 tabMeta = _getTabsMeta.tabMeta;
32182
32183 var startValue = 0;
32184
32185 if (tabMeta && tabsMeta) {
32186 if (vertical) {
32187 startValue = tabMeta.top - tabsMeta.top + tabsMeta.scrollTop;
32188 } else {
32189 var correction = isRtl ? tabsMeta.scrollLeftNormalized + tabsMeta.clientWidth - tabsMeta.scrollWidth : tabsMeta.scrollLeft;
32190 startValue = tabMeta.left - tabsMeta.left + correction;
32191 }
32192 }
32193
32194 var newIndicatorStyle = (_newIndicatorStyle = {}, _defineProperty$1(_newIndicatorStyle, start, startValue), _defineProperty$1(_newIndicatorStyle, size, tabMeta ? tabMeta[size] : 0), _newIndicatorStyle);
32195
32196 if (isNaN(indicatorStyle[start]) || isNaN(indicatorStyle[size])) {
32197 setIndicatorStyle(newIndicatorStyle);
32198 } else {
32199 var dStart = Math.abs(indicatorStyle[start] - newIndicatorStyle[start]);
32200 var dSize = Math.abs(indicatorStyle[size] - newIndicatorStyle[size]);
32201
32202 if (dStart >= 1 || dSize >= 1) {
32203 setIndicatorStyle(newIndicatorStyle);
32204 }
32205 }
32206 });
32207
32208 var scroll = function scroll(scrollValue) {
32209 animate(scrollStart, tabsRef.current, scrollValue);
32210 };
32211
32212 var moveTabsScroll = function moveTabsScroll(delta) {
32213 var scrollValue = tabsRef.current[scrollStart];
32214
32215 if (vertical) {
32216 scrollValue += delta;
32217 } else {
32218 scrollValue += delta * (isRtl ? -1 : 1); // Fix for Edge
32219
32220 scrollValue *= isRtl && detectScrollType() === 'reverse' ? -1 : 1;
32221 }
32222
32223 scroll(scrollValue);
32224 };
32225
32226 var handleStartScrollClick = function handleStartScrollClick() {
32227 moveTabsScroll(-tabsRef.current[clientSize]);
32228 };
32229
32230 var handleEndScrollClick = function handleEndScrollClick() {
32231 moveTabsScroll(tabsRef.current[clientSize]);
32232 };
32233
32234 var handleScrollbarSizeChange = react.exports.useCallback(function (scrollbarHeight) {
32235 setScrollerStyle({
32236 overflow: null,
32237 marginBottom: -scrollbarHeight
32238 });
32239 }, []);
32240
32241 var getConditionalElements = function getConditionalElements() {
32242 var conditionalElements = {};
32243 conditionalElements.scrollbarSizeListener = scrollable ? /*#__PURE__*/react.exports.createElement(ScrollbarSize, {
32244 className: classes.scrollable,
32245 onChange: handleScrollbarSizeChange
32246 }) : null;
32247 var scrollButtonsActive = displayScroll.start || displayScroll.end;
32248 var showScrollButtons = scrollable && (scrollButtons === 'auto' && scrollButtonsActive || scrollButtons === 'desktop' || scrollButtons === 'on');
32249 conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/react.exports.createElement(ScrollButtonComponent, _extends$5({
32250 orientation: orientation,
32251 direction: isRtl ? 'right' : 'left',
32252 onClick: handleStartScrollClick,
32253 disabled: !displayScroll.start,
32254 className: clsx(classes.scrollButtons, scrollButtons !== 'on' && classes.scrollButtonsDesktop)
32255 }, TabScrollButtonProps)) : null;
32256 conditionalElements.scrollButtonEnd = showScrollButtons ? /*#__PURE__*/react.exports.createElement(ScrollButtonComponent, _extends$5({
32257 orientation: orientation,
32258 direction: isRtl ? 'left' : 'right',
32259 onClick: handleEndScrollClick,
32260 disabled: !displayScroll.end,
32261 className: clsx(classes.scrollButtons, scrollButtons !== 'on' && classes.scrollButtonsDesktop)
32262 }, TabScrollButtonProps)) : null;
32263 return conditionalElements;
32264 };
32265
32266 var scrollSelectedIntoView = useEventCallback(function () {
32267 var _getTabsMeta2 = getTabsMeta(),
32268 tabsMeta = _getTabsMeta2.tabsMeta,
32269 tabMeta = _getTabsMeta2.tabMeta;
32270
32271 if (!tabMeta || !tabsMeta) {
32272 return;
32273 }
32274
32275 if (tabMeta[start] < tabsMeta[start]) {
32276 // left side of button is out of view
32277 var nextScrollStart = tabsMeta[scrollStart] + (tabMeta[start] - tabsMeta[start]);
32278 scroll(nextScrollStart);
32279 } else if (tabMeta[end] > tabsMeta[end]) {
32280 // right side of button is out of view
32281 var _nextScrollStart = tabsMeta[scrollStart] + (tabMeta[end] - tabsMeta[end]);
32282
32283 scroll(_nextScrollStart);
32284 }
32285 });
32286 var updateScrollButtonState = useEventCallback(function () {
32287 if (scrollable && scrollButtons !== 'off') {
32288 var _tabsRef$current = tabsRef.current,
32289 scrollTop = _tabsRef$current.scrollTop,
32290 scrollHeight = _tabsRef$current.scrollHeight,
32291 clientHeight = _tabsRef$current.clientHeight,
32292 scrollWidth = _tabsRef$current.scrollWidth,
32293 clientWidth = _tabsRef$current.clientWidth;
32294 var showStartScroll;
32295 var showEndScroll;
32296
32297 if (vertical) {
32298 showStartScroll = scrollTop > 1;
32299 showEndScroll = scrollTop < scrollHeight - clientHeight - 1;
32300 } else {
32301 var scrollLeft = getNormalizedScrollLeft(tabsRef.current, theme.direction); // use 1 for the potential rounding error with browser zooms.
32302
32303 showStartScroll = isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
32304 showEndScroll = !isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
32305 }
32306
32307 if (showStartScroll !== displayScroll.start || showEndScroll !== displayScroll.end) {
32308 setDisplayScroll({
32309 start: showStartScroll,
32310 end: showEndScroll
32311 });
32312 }
32313 }
32314 });
32315 react.exports.useEffect(function () {
32316 var handleResize = debounce$1(function () {
32317 updateIndicatorState();
32318 updateScrollButtonState();
32319 });
32320 var win = ownerWindow(tabsRef.current);
32321 win.addEventListener('resize', handleResize);
32322 return function () {
32323 handleResize.clear();
32324 win.removeEventListener('resize', handleResize);
32325 };
32326 }, [updateIndicatorState, updateScrollButtonState]);
32327 var handleTabsScroll = react.exports.useCallback(debounce$1(function () {
32328 updateScrollButtonState();
32329 }));
32330 react.exports.useEffect(function () {
32331 return function () {
32332 handleTabsScroll.clear();
32333 };
32334 }, [handleTabsScroll]);
32335 react.exports.useEffect(function () {
32336 setMounted(true);
32337 }, []);
32338 react.exports.useEffect(function () {
32339 updateIndicatorState();
32340 updateScrollButtonState();
32341 });
32342 react.exports.useEffect(function () {
32343 scrollSelectedIntoView();
32344 }, [scrollSelectedIntoView, indicatorStyle]);
32345 react.exports.useImperativeHandle(action, function () {
32346 return {
32347 updateIndicator: updateIndicatorState,
32348 updateScrollButtons: updateScrollButtonState
32349 };
32350 }, [updateIndicatorState, updateScrollButtonState]);
32351 var indicator = /*#__PURE__*/react.exports.createElement(TabIndicator$1, _extends$5({
32352 className: classes.indicator,
32353 orientation: orientation,
32354 color: indicatorColor
32355 }, TabIndicatorProps, {
32356 style: _extends$5({}, indicatorStyle, TabIndicatorProps.style)
32357 }));
32358 var childIndex = 0;
32359 var children = react.exports.Children.map(childrenProp, function (child) {
32360 if (! /*#__PURE__*/react.exports.isValidElement(child)) {
32361 return null;
32362 }
32363
32364 var childValue = child.props.value === undefined ? childIndex : child.props.value;
32365 valueToIndex.set(childValue, childIndex);
32366 var selected = childValue === value;
32367 childIndex += 1;
32368 return /*#__PURE__*/react.exports.cloneElement(child, {
32369 fullWidth: variant === 'fullWidth',
32370 indicator: selected && !mounted && indicator,
32371 selected: selected,
32372 selectionFollowsFocus: selectionFollowsFocus,
32373 onChange: onChange,
32374 textColor: textColor,
32375 value: childValue
32376 });
32377 });
32378
32379 var handleKeyDown = function handleKeyDown(event) {
32380 var target = event.target; // Keyboard navigation assumes that [role="tab"] are siblings
32381 // though we might warn in the future about nested, interactive elements
32382 // as a a11y violation
32383
32384 var role = target.getAttribute('role');
32385
32386 if (role !== 'tab') {
32387 return;
32388 }
32389
32390 var newFocusTarget = null;
32391 var previousItemKey = orientation !== "vertical" ? 'ArrowLeft' : 'ArrowUp';
32392 var nextItemKey = orientation !== "vertical" ? 'ArrowRight' : 'ArrowDown';
32393
32394 if (orientation !== "vertical" && theme.direction === 'rtl') {
32395 // swap previousItemKey with nextItemKey
32396 previousItemKey = 'ArrowRight';
32397 nextItemKey = 'ArrowLeft';
32398 }
32399
32400 switch (event.key) {
32401 case previousItemKey:
32402 newFocusTarget = target.previousElementSibling || tabListRef.current.lastChild;
32403 break;
32404
32405 case nextItemKey:
32406 newFocusTarget = target.nextElementSibling || tabListRef.current.firstChild;
32407 break;
32408
32409 case 'Home':
32410 newFocusTarget = tabListRef.current.firstChild;
32411 break;
32412
32413 case 'End':
32414 newFocusTarget = tabListRef.current.lastChild;
32415 break;
32416 }
32417
32418 if (newFocusTarget !== null) {
32419 newFocusTarget.focus();
32420 event.preventDefault();
32421 }
32422 };
32423
32424 var conditionalElements = getConditionalElements();
32425 return /*#__PURE__*/react.exports.createElement(Component, _extends$5({
32426 className: clsx(classes.root, className, vertical && classes.vertical),
32427 ref: ref
32428 }, other), conditionalElements.scrollButtonStart, conditionalElements.scrollbarSizeListener, /*#__PURE__*/react.exports.createElement("div", {
32429 className: clsx(classes.scroller, scrollable ? classes.scrollable : classes.fixed),
32430 style: scrollerStyle,
32431 ref: tabsRef,
32432 onScroll: handleTabsScroll
32433 }, /*#__PURE__*/react.exports.createElement("div", {
32434 "aria-label": ariaLabel,
32435 "aria-labelledby": ariaLabelledBy,
32436 className: clsx(classes.flexContainer, vertical && classes.flexContainerVertical, centered && !scrollable && classes.centered),
32437 onKeyDown: handleKeyDown,
32438 ref: tabListRef,
32439 role: "tablist"
32440 }, children), mounted && indicator), conditionalElements.scrollButtonEnd);
32441 });
32442 withStyles(styles$2, {
32443 name: 'MuiTabs'
32444 })(Tabs);
32445
32446 var variantComponent = {
32447 standard: Input$1,
32448 filled: FilledInput$1,
32449 outlined: OutlinedInput$1
32450 };
32451 var styles$1 = {
32452 /* Styles applied to the root element. */
32453 root: {}
32454 };
32455 /**
32456 * The `TextField` is a convenience wrapper for the most common cases (80%).
32457 * It cannot be all things to all people, otherwise the API would grow out of control.
32458 *
32459 * ## Advanced Configuration
32460 *
32461 * It's important to understand that the text field is a simple abstraction
32462 * on top of the following components:
32463 *
32464 * - [FormControl](/api/form-control/)
32465 * - [InputLabel](/api/input-label/)
32466 * - [FilledInput](/api/filled-input/)
32467 * - [OutlinedInput](/api/outlined-input/)
32468 * - [Input](/api/input/)
32469 * - [FormHelperText](/api/form-helper-text/)
32470 *
32471 * If you wish to alter the props applied to the `input` element, you can do so as follows:
32472 *
32473 * ```jsx
32474 * const inputProps = {
32475 * step: 300,
32476 * };
32477 *
32478 * return <TextField id="time" type="time" inputProps={inputProps} />;
32479 * ```
32480 *
32481 * For advanced cases, please look at the source of TextField by clicking on the
32482 * "Edit this page" button above. Consider either:
32483 *
32484 * - using the upper case props for passing values directly to the components
32485 * - using the underlying components directly as shown in the demos
32486 */
32487
32488 var TextField = /*#__PURE__*/react.exports.forwardRef(function TextField(props, ref) {
32489 var autoComplete = props.autoComplete,
32490 _props$autoFocus = props.autoFocus,
32491 autoFocus = _props$autoFocus === void 0 ? false : _props$autoFocus,
32492 children = props.children,
32493 classes = props.classes,
32494 className = props.className,
32495 _props$color = props.color,
32496 color = _props$color === void 0 ? 'primary' : _props$color,
32497 defaultValue = props.defaultValue,
32498 _props$disabled = props.disabled,
32499 disabled = _props$disabled === void 0 ? false : _props$disabled,
32500 _props$error = props.error,
32501 error = _props$error === void 0 ? false : _props$error,
32502 FormHelperTextProps = props.FormHelperTextProps,
32503 _props$fullWidth = props.fullWidth,
32504 fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
32505 helperText = props.helperText,
32506 hiddenLabel = props.hiddenLabel,
32507 id = props.id,
32508 InputLabelProps = props.InputLabelProps,
32509 inputProps = props.inputProps,
32510 InputProps = props.InputProps,
32511 inputRef = props.inputRef,
32512 label = props.label,
32513 _props$multiline = props.multiline,
32514 multiline = _props$multiline === void 0 ? false : _props$multiline,
32515 name = props.name,
32516 onBlur = props.onBlur,
32517 onChange = props.onChange,
32518 onFocus = props.onFocus,
32519 placeholder = props.placeholder,
32520 _props$required = props.required,
32521 required = _props$required === void 0 ? false : _props$required,
32522 rows = props.rows,
32523 rowsMax = props.rowsMax,
32524 maxRows = props.maxRows,
32525 minRows = props.minRows,
32526 _props$select = props.select,
32527 select = _props$select === void 0 ? false : _props$select,
32528 SelectProps = props.SelectProps,
32529 type = props.type,
32530 value = props.value,
32531 _props$variant = props.variant,
32532 variant = _props$variant === void 0 ? 'standard' : _props$variant,
32533 other = _objectWithoutProperties(props, ["autoComplete", "autoFocus", "children", "classes", "className", "color", "defaultValue", "disabled", "error", "FormHelperTextProps", "fullWidth", "helperText", "hiddenLabel", "id", "InputLabelProps", "inputProps", "InputProps", "inputRef", "label", "multiline", "name", "onBlur", "onChange", "onFocus", "placeholder", "required", "rows", "rowsMax", "maxRows", "minRows", "select", "SelectProps", "type", "value", "variant"]);
32534
32535 var InputMore = {};
32536
32537 if (variant === 'outlined') {
32538 if (InputLabelProps && typeof InputLabelProps.shrink !== 'undefined') {
32539 InputMore.notched = InputLabelProps.shrink;
32540 }
32541
32542 if (label) {
32543 var _InputLabelProps$requ;
32544
32545 var displayRequired = (_InputLabelProps$requ = InputLabelProps === null || InputLabelProps === void 0 ? void 0 : InputLabelProps.required) !== null && _InputLabelProps$requ !== void 0 ? _InputLabelProps$requ : required;
32546 InputMore.label = /*#__PURE__*/react.exports.createElement(react.exports.Fragment, null, label, displayRequired && "\xA0*");
32547 }
32548 }
32549
32550 if (select) {
32551 // unset defaults from textbox inputs
32552 if (!SelectProps || !SelectProps.native) {
32553 InputMore.id = undefined;
32554 }
32555
32556 InputMore['aria-describedby'] = undefined;
32557 }
32558
32559 var helperTextId = helperText && id ? "".concat(id, "-helper-text") : undefined;
32560 var inputLabelId = label && id ? "".concat(id, "-label") : undefined;
32561 var InputComponent = variantComponent[variant];
32562 var InputElement = /*#__PURE__*/react.exports.createElement(InputComponent, _extends$5({
32563 "aria-describedby": helperTextId,
32564 autoComplete: autoComplete,
32565 autoFocus: autoFocus,
32566 defaultValue: defaultValue,
32567 fullWidth: fullWidth,
32568 multiline: multiline,
32569 name: name,
32570 rows: rows,
32571 rowsMax: rowsMax,
32572 maxRows: maxRows,
32573 minRows: minRows,
32574 type: type,
32575 value: value,
32576 id: id,
32577 inputRef: inputRef,
32578 onBlur: onBlur,
32579 onChange: onChange,
32580 onFocus: onFocus,
32581 placeholder: placeholder,
32582 inputProps: inputProps
32583 }, InputMore, InputProps));
32584 return /*#__PURE__*/react.exports.createElement(FormControl$1, _extends$5({
32585 className: clsx(classes.root, className),
32586 disabled: disabled,
32587 error: error,
32588 fullWidth: fullWidth,
32589 hiddenLabel: hiddenLabel,
32590 ref: ref,
32591 required: required,
32592 color: color,
32593 variant: variant
32594 }, other), label && /*#__PURE__*/react.exports.createElement(InputLabel$1, _extends$5({
32595 htmlFor: id,
32596 id: inputLabelId
32597 }, InputLabelProps), label), select ? /*#__PURE__*/react.exports.createElement(Select$1, _extends$5({
32598 "aria-describedby": helperTextId,
32599 id: id,
32600 labelId: inputLabelId,
32601 value: value,
32602 input: InputElement
32603 }, SelectProps), children) : InputElement, helperText && /*#__PURE__*/react.exports.createElement(FormHelperText$1, _extends$5({
32604 id: helperTextId
32605 }, FormHelperTextProps), helperText));
32606 });
32607 withStyles(styles$1, {
32608 name: 'MuiTextField'
32609 })(TextField);
32610
32611 function round(value) {
32612 return Math.round(value * 1e5) / 1e5;
32613 }
32614
32615 function arrowGenerator() {
32616 return {
32617 '&[x-placement*="bottom"] $arrow': {
32618 top: 0,
32619 left: 0,
32620 marginTop: '-0.71em',
32621 marginLeft: 4,
32622 marginRight: 4,
32623 '&::before': {
32624 transformOrigin: '0 100%'
32625 }
32626 },
32627 '&[x-placement*="top"] $arrow': {
32628 bottom: 0,
32629 left: 0,
32630 marginBottom: '-0.71em',
32631 marginLeft: 4,
32632 marginRight: 4,
32633 '&::before': {
32634 transformOrigin: '100% 0'
32635 }
32636 },
32637 '&[x-placement*="right"] $arrow': {
32638 left: 0,
32639 marginLeft: '-0.71em',
32640 height: '1em',
32641 width: '0.71em',
32642 marginTop: 4,
32643 marginBottom: 4,
32644 '&::before': {
32645 transformOrigin: '100% 100%'
32646 }
32647 },
32648 '&[x-placement*="left"] $arrow': {
32649 right: 0,
32650 marginRight: '-0.71em',
32651 height: '1em',
32652 width: '0.71em',
32653 marginTop: 4,
32654 marginBottom: 4,
32655 '&::before': {
32656 transformOrigin: '0 0'
32657 }
32658 }
32659 };
32660 }
32661
32662 var styles = function styles(theme) {
32663 return {
32664 /* Styles applied to the Popper component. */
32665 popper: {
32666 zIndex: theme.zIndex.tooltip,
32667 pointerEvents: 'none' // disable jss-rtl plugin
32668
32669 },
32670
32671 /* Styles applied to the Popper component if `interactive={true}`. */
32672 popperInteractive: {
32673 pointerEvents: 'auto'
32674 },
32675
32676 /* Styles applied to the Popper component if `arrow={true}`. */
32677 popperArrow: arrowGenerator(),
32678
32679 /* Styles applied to the tooltip (label wrapper) element. */
32680 tooltip: {
32681 backgroundColor: alpha(theme.palette.grey[700], 0.9),
32682 borderRadius: theme.shape.borderRadius,
32683 color: theme.palette.common.white,
32684 fontFamily: theme.typography.fontFamily,
32685 padding: '4px 8px',
32686 fontSize: theme.typography.pxToRem(10),
32687 lineHeight: "".concat(round(14 / 10), "em"),
32688 maxWidth: 300,
32689 wordWrap: 'break-word',
32690 fontWeight: theme.typography.fontWeightMedium
32691 },
32692
32693 /* Styles applied to the tooltip (label wrapper) element if `arrow={true}`. */
32694 tooltipArrow: {
32695 position: 'relative',
32696 margin: '0'
32697 },
32698
32699 /* Styles applied to the arrow element. */
32700 arrow: {
32701 overflow: 'hidden',
32702 position: 'absolute',
32703 width: '1em',
32704 height: '0.71em'
32705 /* = width / sqrt(2) = (length of the hypotenuse) */
32706 ,
32707 boxSizing: 'border-box',
32708 color: alpha(theme.palette.grey[700], 0.9),
32709 '&::before': {
32710 content: '""',
32711 margin: 'auto',
32712 display: 'block',
32713 width: '100%',
32714 height: '100%',
32715 backgroundColor: 'currentColor',
32716 transform: 'rotate(45deg)'
32717 }
32718 },
32719
32720 /* Styles applied to the tooltip (label wrapper) element if the tooltip is opened by touch. */
32721 touch: {
32722 padding: '8px 16px',
32723 fontSize: theme.typography.pxToRem(14),
32724 lineHeight: "".concat(round(16 / 14), "em"),
32725 fontWeight: theme.typography.fontWeightRegular
32726 },
32727
32728 /* Styles applied to the tooltip (label wrapper) element if `placement` contains "left". */
32729 tooltipPlacementLeft: _defineProperty$1({
32730 transformOrigin: 'right center',
32731 margin: '0 24px '
32732 }, theme.breakpoints.up('sm'), {
32733 margin: '0 14px'
32734 }),
32735
32736 /* Styles applied to the tooltip (label wrapper) element if `placement` contains "right". */
32737 tooltipPlacementRight: _defineProperty$1({
32738 transformOrigin: 'left center',
32739 margin: '0 24px'
32740 }, theme.breakpoints.up('sm'), {
32741 margin: '0 14px'
32742 }),
32743
32744 /* Styles applied to the tooltip (label wrapper) element if `placement` contains "top". */
32745 tooltipPlacementTop: _defineProperty$1({
32746 transformOrigin: 'center bottom',
32747 margin: '24px 0'
32748 }, theme.breakpoints.up('sm'), {
32749 margin: '14px 0'
32750 }),
32751
32752 /* Styles applied to the tooltip (label wrapper) element if `placement` contains "bottom". */
32753 tooltipPlacementBottom: _defineProperty$1({
32754 transformOrigin: 'center top',
32755 margin: '24px 0'
32756 }, theme.breakpoints.up('sm'), {
32757 margin: '14px 0'
32758 })
32759 };
32760 };
32761 var hystersisOpen = false;
32762 var hystersisTimer = null;
32763 var Tooltip = /*#__PURE__*/react.exports.forwardRef(function Tooltip(props, ref) {
32764 var _props$arrow = props.arrow,
32765 arrow = _props$arrow === void 0 ? false : _props$arrow,
32766 children = props.children,
32767 classes = props.classes,
32768 _props$disableFocusLi = props.disableFocusListener,
32769 disableFocusListener = _props$disableFocusLi === void 0 ? false : _props$disableFocusLi,
32770 _props$disableHoverLi = props.disableHoverListener,
32771 disableHoverListener = _props$disableHoverLi === void 0 ? false : _props$disableHoverLi,
32772 _props$disableTouchLi = props.disableTouchListener,
32773 disableTouchListener = _props$disableTouchLi === void 0 ? false : _props$disableTouchLi,
32774 _props$enterDelay = props.enterDelay,
32775 enterDelay = _props$enterDelay === void 0 ? 100 : _props$enterDelay,
32776 _props$enterNextDelay = props.enterNextDelay,
32777 enterNextDelay = _props$enterNextDelay === void 0 ? 0 : _props$enterNextDelay,
32778 _props$enterTouchDela = props.enterTouchDelay,
32779 enterTouchDelay = _props$enterTouchDela === void 0 ? 700 : _props$enterTouchDela,
32780 idProp = props.id,
32781 _props$interactive = props.interactive,
32782 interactive = _props$interactive === void 0 ? false : _props$interactive,
32783 _props$leaveDelay = props.leaveDelay,
32784 leaveDelay = _props$leaveDelay === void 0 ? 0 : _props$leaveDelay,
32785 _props$leaveTouchDela = props.leaveTouchDelay,
32786 leaveTouchDelay = _props$leaveTouchDela === void 0 ? 1500 : _props$leaveTouchDela,
32787 onClose = props.onClose,
32788 onOpen = props.onOpen,
32789 openProp = props.open,
32790 _props$placement = props.placement,
32791 placement = _props$placement === void 0 ? 'bottom' : _props$placement,
32792 _props$PopperComponen = props.PopperComponent,
32793 PopperComponent = _props$PopperComponen === void 0 ? Popper : _props$PopperComponen,
32794 PopperProps = props.PopperProps,
32795 title = props.title,
32796 _props$TransitionComp = props.TransitionComponent,
32797 TransitionComponent = _props$TransitionComp === void 0 ? Grow : _props$TransitionComp,
32798 TransitionProps = props.TransitionProps,
32799 other = _objectWithoutProperties(props, ["arrow", "children", "classes", "disableFocusListener", "disableHoverListener", "disableTouchListener", "enterDelay", "enterNextDelay", "enterTouchDelay", "id", "interactive", "leaveDelay", "leaveTouchDelay", "onClose", "onOpen", "open", "placement", "PopperComponent", "PopperProps", "title", "TransitionComponent", "TransitionProps"]);
32800
32801 var theme = useTheme$1();
32802
32803 var _React$useState = react.exports.useState(),
32804 childNode = _React$useState[0],
32805 setChildNode = _React$useState[1];
32806
32807 var _React$useState2 = react.exports.useState(null),
32808 arrowRef = _React$useState2[0],
32809 setArrowRef = _React$useState2[1];
32810
32811 var ignoreNonTouchEvents = react.exports.useRef(false);
32812 var closeTimer = react.exports.useRef();
32813 var enterTimer = react.exports.useRef();
32814 var leaveTimer = react.exports.useRef();
32815 var touchTimer = react.exports.useRef();
32816
32817 var _useControlled = useControlled({
32818 controlled: openProp,
32819 default: false,
32820 name: 'Tooltip',
32821 state: 'open'
32822 }),
32823 _useControlled2 = _slicedToArray(_useControlled, 2),
32824 openState = _useControlled2[0],
32825 setOpenState = _useControlled2[1];
32826
32827 var open = openState;
32828
32829 var id = useId(idProp);
32830 react.exports.useEffect(function () {
32831 return function () {
32832 clearTimeout(closeTimer.current);
32833 clearTimeout(enterTimer.current);
32834 clearTimeout(leaveTimer.current);
32835 clearTimeout(touchTimer.current);
32836 };
32837 }, []);
32838
32839 var handleOpen = function handleOpen(event) {
32840 clearTimeout(hystersisTimer);
32841 hystersisOpen = true; // The mouseover event will trigger for every nested element in the tooltip.
32842 // We can skip rerendering when the tooltip is already open.
32843 // We are using the mouseover event instead of the mouseenter event to fix a hide/show issue.
32844
32845 setOpenState(true);
32846
32847 if (onOpen) {
32848 onOpen(event);
32849 }
32850 };
32851
32852 var handleEnter = function handleEnter() {
32853 var forward = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
32854 return function (event) {
32855 var childrenProps = children.props;
32856
32857 if (event.type === 'mouseover' && childrenProps.onMouseOver && forward) {
32858 childrenProps.onMouseOver(event);
32859 }
32860
32861 if (ignoreNonTouchEvents.current && event.type !== 'touchstart') {
32862 return;
32863 } // Remove the title ahead of time.
32864 // We don't want to wait for the next render commit.
32865 // We would risk displaying two tooltips at the same time (native + this one).
32866
32867
32868 if (childNode) {
32869 childNode.removeAttribute('title');
32870 }
32871
32872 clearTimeout(enterTimer.current);
32873 clearTimeout(leaveTimer.current);
32874
32875 if (enterDelay || hystersisOpen && enterNextDelay) {
32876 event.persist();
32877 enterTimer.current = setTimeout(function () {
32878 handleOpen(event);
32879 }, hystersisOpen ? enterNextDelay : enterDelay);
32880 } else {
32881 handleOpen(event);
32882 }
32883 };
32884 };
32885
32886 var _useIsFocusVisible = useIsFocusVisible(),
32887 isFocusVisible = _useIsFocusVisible.isFocusVisible,
32888 onBlurVisible = _useIsFocusVisible.onBlurVisible,
32889 focusVisibleRef = _useIsFocusVisible.ref;
32890
32891 var _React$useState3 = react.exports.useState(false),
32892 childIsFocusVisible = _React$useState3[0],
32893 setChildIsFocusVisible = _React$useState3[1];
32894
32895 var handleBlur = function handleBlur() {
32896 if (childIsFocusVisible) {
32897 setChildIsFocusVisible(false);
32898 onBlurVisible();
32899 }
32900 };
32901
32902 var handleFocus = function handleFocus() {
32903 var forward = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
32904 return function (event) {
32905 // Workaround for https://github.com/facebook/react/issues/7769
32906 // The autoFocus of React might trigger the event before the componentDidMount.
32907 // We need to account for this eventuality.
32908 if (!childNode) {
32909 setChildNode(event.currentTarget);
32910 }
32911
32912 if (isFocusVisible(event)) {
32913 setChildIsFocusVisible(true);
32914 handleEnter()(event);
32915 }
32916
32917 var childrenProps = children.props;
32918
32919 if (childrenProps.onFocus && forward) {
32920 childrenProps.onFocus(event);
32921 }
32922 };
32923 };
32924
32925 var handleClose = function handleClose(event) {
32926 clearTimeout(hystersisTimer);
32927 hystersisTimer = setTimeout(function () {
32928 hystersisOpen = false;
32929 }, 800 + leaveDelay);
32930 setOpenState(false);
32931
32932 if (onClose) {
32933 onClose(event);
32934 }
32935
32936 clearTimeout(closeTimer.current);
32937 closeTimer.current = setTimeout(function () {
32938 ignoreNonTouchEvents.current = false;
32939 }, theme.transitions.duration.shortest);
32940 };
32941
32942 var handleLeave = function handleLeave() {
32943 var forward = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
32944 return function (event) {
32945 var childrenProps = children.props;
32946
32947 if (event.type === 'blur') {
32948 if (childrenProps.onBlur && forward) {
32949 childrenProps.onBlur(event);
32950 }
32951
32952 handleBlur();
32953 }
32954
32955 if (event.type === 'mouseleave' && childrenProps.onMouseLeave && event.currentTarget === childNode) {
32956 childrenProps.onMouseLeave(event);
32957 }
32958
32959 clearTimeout(enterTimer.current);
32960 clearTimeout(leaveTimer.current);
32961 event.persist();
32962 leaveTimer.current = setTimeout(function () {
32963 handleClose(event);
32964 }, leaveDelay);
32965 };
32966 };
32967
32968 var detectTouchStart = function detectTouchStart(event) {
32969 ignoreNonTouchEvents.current = true;
32970 var childrenProps = children.props;
32971
32972 if (childrenProps.onTouchStart) {
32973 childrenProps.onTouchStart(event);
32974 }
32975 };
32976
32977 var handleTouchStart = function handleTouchStart(event) {
32978 detectTouchStart(event);
32979 clearTimeout(leaveTimer.current);
32980 clearTimeout(closeTimer.current);
32981 clearTimeout(touchTimer.current);
32982 event.persist();
32983 touchTimer.current = setTimeout(function () {
32984 handleEnter()(event);
32985 }, enterTouchDelay);
32986 };
32987
32988 var handleTouchEnd = function handleTouchEnd(event) {
32989 if (children.props.onTouchEnd) {
32990 children.props.onTouchEnd(event);
32991 }
32992
32993 clearTimeout(touchTimer.current);
32994 clearTimeout(leaveTimer.current);
32995 event.persist();
32996 leaveTimer.current = setTimeout(function () {
32997 handleClose(event);
32998 }, leaveTouchDelay);
32999 };
33000
33001 var handleUseRef = useForkRef(setChildNode, ref);
33002 var handleFocusRef = useForkRef(focusVisibleRef, handleUseRef); // can be removed once we drop support for non ref forwarding class components
33003
33004 var handleOwnRef = react.exports.useCallback(function (instance) {
33005 // #StrictMode ready
33006 setRef(handleFocusRef, reactDom.exports.findDOMNode(instance));
33007 }, [handleFocusRef]);
33008 var handleRef = useForkRef(children.ref, handleOwnRef); // There is no point in displaying an empty tooltip.
33009
33010 if (title === '') {
33011 open = false;
33012 } // For accessibility and SEO concerns, we render the title to the DOM node when
33013 // the tooltip is hidden. However, we have made a tradeoff when
33014 // `disableHoverListener` is set. This title logic is disabled.
33015 // It's allowing us to keep the implementation size minimal.
33016 // We are open to change the tradeoff.
33017
33018
33019 var shouldShowNativeTitle = !open && !disableHoverListener;
33020
33021 var childrenProps = _extends$5({
33022 'aria-describedby': open ? id : null,
33023 title: shouldShowNativeTitle && typeof title === 'string' ? title : null
33024 }, other, children.props, {
33025 className: clsx(other.className, children.props.className),
33026 onTouchStart: detectTouchStart,
33027 ref: handleRef
33028 });
33029
33030 var interactiveWrapperListeners = {};
33031
33032 if (!disableTouchListener) {
33033 childrenProps.onTouchStart = handleTouchStart;
33034 childrenProps.onTouchEnd = handleTouchEnd;
33035 }
33036
33037 if (!disableHoverListener) {
33038 childrenProps.onMouseOver = handleEnter();
33039 childrenProps.onMouseLeave = handleLeave();
33040
33041 if (interactive) {
33042 interactiveWrapperListeners.onMouseOver = handleEnter(false);
33043 interactiveWrapperListeners.onMouseLeave = handleLeave(false);
33044 }
33045 }
33046
33047 if (!disableFocusListener) {
33048 childrenProps.onFocus = handleFocus();
33049 childrenProps.onBlur = handleLeave();
33050
33051 if (interactive) {
33052 interactiveWrapperListeners.onFocus = handleFocus(false);
33053 interactiveWrapperListeners.onBlur = handleLeave(false);
33054 }
33055 }
33056
33057 var mergedPopperProps = react.exports.useMemo(function () {
33058 return deepmerge({
33059 popperOptions: {
33060 modifiers: {
33061 arrow: {
33062 enabled: Boolean(arrowRef),
33063 element: arrowRef
33064 }
33065 }
33066 }
33067 }, PopperProps);
33068 }, [arrowRef, PopperProps]);
33069 return /*#__PURE__*/react.exports.createElement(react.exports.Fragment, null, /*#__PURE__*/react.exports.cloneElement(children, childrenProps), /*#__PURE__*/react.exports.createElement(PopperComponent, _extends$5({
33070 className: clsx(classes.popper, interactive && classes.popperInteractive, arrow && classes.popperArrow),
33071 placement: placement,
33072 anchorEl: childNode,
33073 open: childNode ? open : false,
33074 id: childrenProps['aria-describedby'],
33075 transition: true
33076 }, interactiveWrapperListeners, mergedPopperProps), function (_ref) {
33077 var placementInner = _ref.placement,
33078 TransitionPropsInner = _ref.TransitionProps;
33079 return /*#__PURE__*/react.exports.createElement(TransitionComponent, _extends$5({
33080 timeout: theme.transitions.duration.shorter
33081 }, TransitionPropsInner, TransitionProps), /*#__PURE__*/react.exports.createElement("div", {
33082 className: clsx(classes.tooltip, classes["tooltipPlacement".concat(capitalize(placementInner.split('-')[0]))], ignoreNonTouchEvents.current && classes.touch, arrow && classes.tooltipArrow)
33083 }, title, arrow ? /*#__PURE__*/react.exports.createElement("span", {
33084 className: classes.arrow,
33085 ref: setArrowRef
33086 }) : null));
33087 }));
33088 });
33089 withStyles(styles, {
33090 name: 'MuiTooltip',
33091 flip: false
33092 })(Tooltip);
33093
33094 ({
33095 enter: duration.enteringScreen,
33096 exit: duration.leavingScreen
33097 });
33098
33099 function useRect$1() {
33100 const [node, setNode] = react.exports.useState();
33101 const [rect, setRect] = react.exports.useState();
33102 const callbackRef = react.exports.useCallback(ref => {
33103 if (!ref) {
33104 return;
33105 }
33106
33107 setNode(ref);
33108 }, []);
33109
33110 const handleResize = () => {
33111 const {
33112 left,
33113 top,
33114 width,
33115 height
33116 } = node.getBoundingClientRect();
33117 setRect({
33118 left,
33119 top,
33120 width,
33121 height
33122 });
33123 };
33124
33125 react.exports.useLayoutEffect(() => {
33126 if (!node) {
33127 return undefined;
33128 }
33129
33130 if (typeof ResizeObserver === 'function') {
33131 let resizeObserver = new ResizeObserver(handleResize);
33132 resizeObserver.observe(node);
33133 return () => {
33134 resizeObserver.unobserve(node);
33135 resizeObserver.disconnect(node);
33136 resizeObserver = null;
33137 };
33138 }
33139
33140 handleResize();
33141 window.addEventListener('resize', handleResize);
33142 return () => {
33143 window.removeEventListener('resize', handleResize);
33144 };
33145 }, [node]);
33146 return [callbackRef, rect, node];
33147 }
33148
33149 function getFontSize(size) {
33150 if (size === 'large') {
33151 return '20px';
33152 }
33153
33154 if (size === 'small') {
33155 return '12px';
33156 }
33157
33158 return '16px';
33159 }
33160
33161 function SvgIcon(_ref) {
33162 let {
33163 size,
33164 style = {},
33165 viewBox = '0 0 16 16',
33166 shapes = []
33167 } = _ref;
33168
33169 const s = _objectSpread2({
33170 fontSize: getFontSize(size),
33171 display: 'inline-block',
33172 fontStyle: 'normal',
33173 lineHeight: '0',
33174 textAlign: 'center',
33175 textTransform: 'none',
33176 verticalAlign: '-.125em',
33177 textRendering: 'optimizeLegibility',
33178 WebkitFontSmoothing: 'antialiased',
33179 MozOsxFontSmoothing: 'grayscale'
33180 }, style);
33181
33182 return /*#__PURE__*/React.createElement("i", {
33183 style: s
33184 }, /*#__PURE__*/React.createElement("svg", {
33185 xmlns: "http://www.w3.org/2000/svg",
33186 width: "1em",
33187 height: "1em",
33188 viewBox: viewBox,
33189 fill: "currentColor"
33190 }, shapes.map((_ref2, ix) => {
33191 let {
33192 type: Type,
33193 attrs
33194 } = _ref2;
33195 return (
33196 /*#__PURE__*/
33197 // eslint-disable-next-line react/no-array-index-key
33198 React.createElement(Type, _extends$b({
33199 key: ix
33200 }, attrs))
33201 );
33202 })));
33203 }
33204
33205 const remove = props => _objectSpread2(_objectSpread2({}, props), {}, {
33206 shapes: [{
33207 type: 'path',
33208 attrs: {
33209 d: 'M9.41421356,8 L11.8890873,5.52512627 C12.065864,5.34834957 12.0305087,4.95944084 11.8183766,4.74730881 L11.2526912,4.18162338 C11.0405592,3.96949135 10.6516504,3.93413601 10.4748737,4.1109127 L8,6.58578644 L5.52512627,4.1109127 C5.34834957,3.93413601 4.95944084,3.96949135 4.74730881,4.18162338 L4.25233406,4.67659813 C3.96949135,4.95944084 3.93413601,5.34834957 4.1109127,5.52512627 L6.58578644,8 L4.1109127,10.4748737 C3.93413601,10.6516504 3.96949135,11.0405592 4.18162338,11.2526912 L4.67659813,11.7476659 C4.95944084,12.0305087 5.34834957,12.065864 5.52512627,11.8890873 L8,9.41421356 L10.4748737,11.8890873 C10.6516504,12.065864 11.0405592,12.0305087 11.2526912,11.8183766 L11.8183766,11.2526912 C12.0305087,11.0405592 12.065864,10.6516504 11.8890873,10.4748737 L9.41421356,8 Z M8,0 C12.4,0 16,3.6 16,8 C16,12.4 12.4,16 8,16 C3.6,16 0,12.4 0,8 C0,3.6 3.6,0 8,0 Z'
33210 }
33211 }]
33212 });
33213
33214 var Remove = (props => SvgIcon(remove(props)));
33215
33216 const lock = props => _objectSpread2(_objectSpread2({}, props), {}, {
33217 shapes: [{
33218 type: 'path',
33219 attrs: {
33220 d: 'M13,7 L8,7 L13,7 L13,4.98151367 C13,2.23029964 10.7614237,0 8,0 C5.23857625,0 3,2.23029964 3,4.98151367 L3,7 L3.75,7 L3,7 L4.5,7 L4.5,5.33193359 C4.5,3.21561511 5.54860291,1.5 8,1.5 C10.4513971,1.5 11.5,3.21561511 11.5,5.33193359 L11.5,7 L12.25,7 L3,7 C2.44771525,7 2,7.44771525 2,8 L2,15 C2,15.5522847 2.44771525,16 3,16 L13,16 C13.5522847,16 14,15.5522847 14,15 L14,8 C14,7.44771525 13.5522847,7 13,7 L3,7 L13,7 Z'
33221 }
33222 }]
33223 });
33224
33225 var Lock = (props => SvgIcon(lock(props)));
33226
33227 const unlock = props => _objectSpread2(_objectSpread2({}, props), {}, {
33228 shapes: [{
33229 type: 'path',
33230 attrs: {
33231 d: 'M2.5,7 L11,7 C11.5522847,7 12,7.44771525 12,8 L12,15 C12,15.5522847 11.5522847,16 11,16 L1,16 C0.44771525,16 0,15.5522847 0,15 L0,8 C0,7.44771525 0.44771525,7 1,7 L1,4.98151367 C1,2.23029964 3.23857625,0 6,0 C8.4241995,0 10.4454541,1.71883353 10.9029715,4 L9.34209114,4 C8.9671727,2.54028848 7.9088888,1.5 6,1.5 C3.54860291,1.5 2.5,3.21561511 2.5,5.33193359 L2.5,7 Z'
33232 }
33233 }]
33234 });
33235
33236 var Unlock = (props => SvgIcon(unlock(props)));
33237
33238 function _extends$1() {
33239 _extends$1 = Object.assign || function (target) {
33240 for (var i = 1; i < arguments.length; i++) {
33241 var source = arguments[i];
33242
33243 for (var key in source) {
33244 if (Object.prototype.hasOwnProperty.call(source, key)) {
33245 target[key] = source[key];
33246 }
33247 }
33248 }
33249
33250 return target;
33251 };
33252
33253 return _extends$1.apply(this, arguments);
33254 }
33255
33256 function _assertThisInitialized(self) {
33257 if (self === void 0) {
33258 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
33259 }
33260
33261 return self;
33262 }
33263
33264 function _inheritsLoose(subClass, superClass) {
33265 subClass.prototype = Object.create(superClass.prototype);
33266 subClass.prototype.constructor = subClass;
33267 subClass.__proto__ = superClass;
33268 }
33269
33270 function areInputsEqual(newInputs, lastInputs) {
33271 if (newInputs.length !== lastInputs.length) {
33272 return false;
33273 }
33274
33275 for (var i = 0; i < newInputs.length; i++) {
33276 if (newInputs[i] !== lastInputs[i]) {
33277 return false;
33278 }
33279 }
33280
33281 return true;
33282 }
33283
33284 function index$1 (resultFn, isEqual) {
33285 if (isEqual === void 0) {
33286 isEqual = areInputsEqual;
33287 }
33288
33289 var lastThis;
33290 var lastArgs = [];
33291 var lastResult;
33292 var calledOnce = false;
33293
33294 var result = function result() {
33295 for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
33296 newArgs[_key] = arguments[_key];
33297 }
33298
33299 if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
33300 return lastResult;
33301 }
33302
33303 lastResult = resultFn.apply(this, newArgs);
33304 calledOnce = true;
33305 lastThis = this;
33306 lastArgs = newArgs;
33307 return lastResult;
33308 };
33309
33310 return result;
33311 }
33312
33313 // Animation frame based implementation of setTimeout.
33314 // Inspired by Joe Lambert, https://gist.github.com/joelambert/1002116#file-requesttimeout-js
33315 var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
33316 var now = hasNativePerformanceNow ? function () {
33317 return performance.now();
33318 } : function () {
33319 return Date.now();
33320 };
33321 function cancelTimeout(timeoutID) {
33322 cancelAnimationFrame(timeoutID.id);
33323 }
33324 function requestTimeout(callback, delay) {
33325 var start = now();
33326
33327 function tick() {
33328 if (now() - start >= delay) {
33329 callback.call(null);
33330 } else {
33331 timeoutID.id = requestAnimationFrame(tick);
33332 }
33333 }
33334
33335 var timeoutID = {
33336 id: requestAnimationFrame(tick)
33337 };
33338 return timeoutID;
33339 }
33340 var cachedRTLResult = null; // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
33341 // Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).
33342 // Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.
33343 // The safest way to check this is to intentionally set a negative offset,
33344 // and then verify that the subsequent "scroll" event matches the negative offset.
33345 // If it does not match, then we can assume a non-standard RTL scroll implementation.
33346
33347 function getRTLOffsetType(recalculate) {
33348 if (recalculate === void 0) {
33349 recalculate = false;
33350 }
33351
33352 if (cachedRTLResult === null || recalculate) {
33353 var outerDiv = document.createElement('div');
33354 var outerStyle = outerDiv.style;
33355 outerStyle.width = '50px';
33356 outerStyle.height = '50px';
33357 outerStyle.overflow = 'scroll';
33358 outerStyle.direction = 'rtl';
33359 var innerDiv = document.createElement('div');
33360 var innerStyle = innerDiv.style;
33361 innerStyle.width = '100px';
33362 innerStyle.height = '100px';
33363 outerDiv.appendChild(innerDiv);
33364 document.body.appendChild(outerDiv);
33365
33366 if (outerDiv.scrollLeft > 0) {
33367 cachedRTLResult = 'positive-descending';
33368 } else {
33369 outerDiv.scrollLeft = 1;
33370
33371 if (outerDiv.scrollLeft === 0) {
33372 cachedRTLResult = 'negative';
33373 } else {
33374 cachedRTLResult = 'positive-ascending';
33375 }
33376 }
33377
33378 document.body.removeChild(outerDiv);
33379 return cachedRTLResult;
33380 }
33381
33382 return cachedRTLResult;
33383 }
33384
33385 var IS_SCROLLING_DEBOUNCE_INTERVAL$1 = 150;
33386
33387 var defaultItemKey$1 = function defaultItemKey(index, data) {
33388 return index;
33389 }; // In DEV mode, this Set helps us only log a warning once per component instance.
33390
33391 function createListComponent(_ref) {
33392 var _class;
33393
33394 var getItemOffset = _ref.getItemOffset,
33395 getEstimatedTotalSize = _ref.getEstimatedTotalSize,
33396 getItemSize = _ref.getItemSize,
33397 getOffsetForIndexAndAlignment = _ref.getOffsetForIndexAndAlignment,
33398 getStartIndexForOffset = _ref.getStartIndexForOffset,
33399 getStopIndexForStartIndex = _ref.getStopIndexForStartIndex,
33400 initInstanceProps = _ref.initInstanceProps,
33401 shouldResetStyleCacheOnItemSizeChange = _ref.shouldResetStyleCacheOnItemSizeChange,
33402 validateProps = _ref.validateProps;
33403 return _class = /*#__PURE__*/function (_PureComponent) {
33404 _inheritsLoose(List, _PureComponent);
33405
33406 // Always use explicit constructor for React components.
33407 // It produces less code after transpilation. (#26)
33408 // eslint-disable-next-line no-useless-constructor
33409 function List(props) {
33410 var _this;
33411
33412 _this = _PureComponent.call(this, props) || this;
33413 _this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_this));
33414 _this._outerRef = void 0;
33415 _this._resetIsScrollingTimeoutId = null;
33416 _this.state = {
33417 instance: _assertThisInitialized(_this),
33418 isScrolling: false,
33419 scrollDirection: 'forward',
33420 scrollOffset: typeof _this.props.initialScrollOffset === 'number' ? _this.props.initialScrollOffset : 0,
33421 scrollUpdateWasRequested: false
33422 };
33423 _this._callOnItemsRendered = void 0;
33424 _this._callOnItemsRendered = index$1(function (overscanStartIndex, overscanStopIndex, visibleStartIndex, visibleStopIndex) {
33425 return _this.props.onItemsRendered({
33426 overscanStartIndex: overscanStartIndex,
33427 overscanStopIndex: overscanStopIndex,
33428 visibleStartIndex: visibleStartIndex,
33429 visibleStopIndex: visibleStopIndex
33430 });
33431 });
33432 _this._callOnScroll = void 0;
33433 _this._callOnScroll = index$1(function (scrollDirection, scrollOffset, scrollUpdateWasRequested) {
33434 return _this.props.onScroll({
33435 scrollDirection: scrollDirection,
33436 scrollOffset: scrollOffset,
33437 scrollUpdateWasRequested: scrollUpdateWasRequested
33438 });
33439 });
33440 _this._getItemStyle = void 0;
33441
33442 _this._getItemStyle = function (index) {
33443 var _this$props = _this.props,
33444 direction = _this$props.direction,
33445 itemSize = _this$props.itemSize,
33446 layout = _this$props.layout;
33447
33448 var itemStyleCache = _this._getItemStyleCache(shouldResetStyleCacheOnItemSizeChange && itemSize, shouldResetStyleCacheOnItemSizeChange && layout, shouldResetStyleCacheOnItemSizeChange && direction);
33449
33450 var style;
33451
33452 if (itemStyleCache.hasOwnProperty(index)) {
33453 style = itemStyleCache[index];
33454 } else {
33455 var _offset = getItemOffset(_this.props, index, _this._instanceProps);
33456
33457 var size = getItemSize(_this.props, index, _this._instanceProps); // TODO Deprecate direction "horizontal"
33458
33459 var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
33460 var isRtl = direction === 'rtl';
33461 var offsetHorizontal = isHorizontal ? _offset : 0;
33462 itemStyleCache[index] = style = {
33463 position: 'absolute',
33464 left: isRtl ? undefined : offsetHorizontal,
33465 right: isRtl ? offsetHorizontal : undefined,
33466 top: !isHorizontal ? _offset : 0,
33467 height: !isHorizontal ? size : '100%',
33468 width: isHorizontal ? size : '100%'
33469 };
33470 }
33471
33472 return style;
33473 };
33474
33475 _this._getItemStyleCache = void 0;
33476 _this._getItemStyleCache = index$1(function (_, __, ___) {
33477 return {};
33478 });
33479
33480 _this._onScrollHorizontal = function (event) {
33481 var _event$currentTarget = event.currentTarget,
33482 clientWidth = _event$currentTarget.clientWidth,
33483 scrollLeft = _event$currentTarget.scrollLeft,
33484 scrollWidth = _event$currentTarget.scrollWidth;
33485
33486 _this.setState(function (prevState) {
33487 if (prevState.scrollOffset === scrollLeft) {
33488 // Scroll position may have been updated by cDM/cDU,
33489 // In which case we don't need to trigger another render,
33490 // And we don't want to update state.isScrolling.
33491 return null;
33492 }
33493
33494 var direction = _this.props.direction;
33495 var scrollOffset = scrollLeft;
33496
33497 if (direction === 'rtl') {
33498 // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
33499 // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
33500 // It's also easier for this component if we convert offsets to the same format as they would be in for ltr.
33501 // So the simplest solution is to determine which browser behavior we're dealing with, and convert based on it.
33502 switch (getRTLOffsetType()) {
33503 case 'negative':
33504 scrollOffset = -scrollLeft;
33505 break;
33506
33507 case 'positive-descending':
33508 scrollOffset = scrollWidth - clientWidth - scrollLeft;
33509 break;
33510 }
33511 } // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.
33512
33513
33514 scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
33515 return {
33516 isScrolling: true,
33517 scrollDirection: prevState.scrollOffset < scrollLeft ? 'forward' : 'backward',
33518 scrollOffset: scrollOffset,
33519 scrollUpdateWasRequested: false
33520 };
33521 }, _this._resetIsScrollingDebounced);
33522 };
33523
33524 _this._onScrollVertical = function (event) {
33525 var _event$currentTarget2 = event.currentTarget,
33526 clientHeight = _event$currentTarget2.clientHeight,
33527 scrollHeight = _event$currentTarget2.scrollHeight,
33528 scrollTop = _event$currentTarget2.scrollTop;
33529
33530 _this.setState(function (prevState) {
33531 if (prevState.scrollOffset === scrollTop) {
33532 // Scroll position may have been updated by cDM/cDU,
33533 // In which case we don't need to trigger another render,
33534 // And we don't want to update state.isScrolling.
33535 return null;
33536 } // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.
33537
33538
33539 var scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
33540 return {
33541 isScrolling: true,
33542 scrollDirection: prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',
33543 scrollOffset: scrollOffset,
33544 scrollUpdateWasRequested: false
33545 };
33546 }, _this._resetIsScrollingDebounced);
33547 };
33548
33549 _this._outerRefSetter = function (ref) {
33550 var outerRef = _this.props.outerRef;
33551 _this._outerRef = ref;
33552
33553 if (typeof outerRef === 'function') {
33554 outerRef(ref);
33555 } else if (outerRef != null && typeof outerRef === 'object' && outerRef.hasOwnProperty('current')) {
33556 outerRef.current = ref;
33557 }
33558 };
33559
33560 _this._resetIsScrollingDebounced = function () {
33561 if (_this._resetIsScrollingTimeoutId !== null) {
33562 cancelTimeout(_this._resetIsScrollingTimeoutId);
33563 }
33564
33565 _this._resetIsScrollingTimeoutId = requestTimeout(_this._resetIsScrolling, IS_SCROLLING_DEBOUNCE_INTERVAL$1);
33566 };
33567
33568 _this._resetIsScrolling = function () {
33569 _this._resetIsScrollingTimeoutId = null;
33570
33571 _this.setState({
33572 isScrolling: false
33573 }, function () {
33574 // Clear style cache after state update has been committed.
33575 // This way we don't break pure sCU for items that don't use isScrolling param.
33576 _this._getItemStyleCache(-1, null);
33577 });
33578 };
33579
33580 return _this;
33581 }
33582
33583 List.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
33584 validateSharedProps$1(nextProps, prevState);
33585 validateProps(nextProps);
33586 return null;
33587 };
33588
33589 var _proto = List.prototype;
33590
33591 _proto.scrollTo = function scrollTo(scrollOffset) {
33592 scrollOffset = Math.max(0, scrollOffset);
33593 this.setState(function (prevState) {
33594 if (prevState.scrollOffset === scrollOffset) {
33595 return null;
33596 }
33597
33598 return {
33599 scrollDirection: prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',
33600 scrollOffset: scrollOffset,
33601 scrollUpdateWasRequested: true
33602 };
33603 }, this._resetIsScrollingDebounced);
33604 };
33605
33606 _proto.scrollToItem = function scrollToItem(index, align) {
33607 if (align === void 0) {
33608 align = 'auto';
33609 }
33610
33611 var itemCount = this.props.itemCount;
33612 var scrollOffset = this.state.scrollOffset;
33613 index = Math.max(0, Math.min(index, itemCount - 1));
33614 this.scrollTo(getOffsetForIndexAndAlignment(this.props, index, align, scrollOffset, this._instanceProps));
33615 };
33616
33617 _proto.componentDidMount = function componentDidMount() {
33618 var _this$props2 = this.props,
33619 direction = _this$props2.direction,
33620 initialScrollOffset = _this$props2.initialScrollOffset,
33621 layout = _this$props2.layout;
33622
33623 if (typeof initialScrollOffset === 'number' && this._outerRef != null) {
33624 var outerRef = this._outerRef; // TODO Deprecate direction "horizontal"
33625
33626 if (direction === 'horizontal' || layout === 'horizontal') {
33627 outerRef.scrollLeft = initialScrollOffset;
33628 } else {
33629 outerRef.scrollTop = initialScrollOffset;
33630 }
33631 }
33632
33633 this._callPropsCallbacks();
33634 };
33635
33636 _proto.componentDidUpdate = function componentDidUpdate() {
33637 var _this$props3 = this.props,
33638 direction = _this$props3.direction,
33639 layout = _this$props3.layout;
33640 var _this$state = this.state,
33641 scrollOffset = _this$state.scrollOffset,
33642 scrollUpdateWasRequested = _this$state.scrollUpdateWasRequested;
33643
33644 if (scrollUpdateWasRequested && this._outerRef != null) {
33645 var outerRef = this._outerRef; // TODO Deprecate direction "horizontal"
33646
33647 if (direction === 'horizontal' || layout === 'horizontal') {
33648 if (direction === 'rtl') {
33649 // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
33650 // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
33651 // So we need to determine which browser behavior we're dealing with, and mimic it.
33652 switch (getRTLOffsetType()) {
33653 case 'negative':
33654 outerRef.scrollLeft = -scrollOffset;
33655 break;
33656
33657 case 'positive-ascending':
33658 outerRef.scrollLeft = scrollOffset;
33659 break;
33660
33661 default:
33662 var clientWidth = outerRef.clientWidth,
33663 scrollWidth = outerRef.scrollWidth;
33664 outerRef.scrollLeft = scrollWidth - clientWidth - scrollOffset;
33665 break;
33666 }
33667 } else {
33668 outerRef.scrollLeft = scrollOffset;
33669 }
33670 } else {
33671 outerRef.scrollTop = scrollOffset;
33672 }
33673 }
33674
33675 this._callPropsCallbacks();
33676 };
33677
33678 _proto.componentWillUnmount = function componentWillUnmount() {
33679 if (this._resetIsScrollingTimeoutId !== null) {
33680 cancelTimeout(this._resetIsScrollingTimeoutId);
33681 }
33682 };
33683
33684 _proto.render = function render() {
33685 var _this$props4 = this.props,
33686 children = _this$props4.children,
33687 className = _this$props4.className,
33688 direction = _this$props4.direction,
33689 height = _this$props4.height,
33690 innerRef = _this$props4.innerRef,
33691 innerElementType = _this$props4.innerElementType,
33692 innerTagName = _this$props4.innerTagName,
33693 itemCount = _this$props4.itemCount,
33694 itemData = _this$props4.itemData,
33695 _this$props4$itemKey = _this$props4.itemKey,
33696 itemKey = _this$props4$itemKey === void 0 ? defaultItemKey$1 : _this$props4$itemKey,
33697 layout = _this$props4.layout,
33698 outerElementType = _this$props4.outerElementType,
33699 outerTagName = _this$props4.outerTagName,
33700 style = _this$props4.style,
33701 useIsScrolling = _this$props4.useIsScrolling,
33702 width = _this$props4.width;
33703 var isScrolling = this.state.isScrolling; // TODO Deprecate direction "horizontal"
33704
33705 var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
33706 var onScroll = isHorizontal ? this._onScrollHorizontal : this._onScrollVertical;
33707
33708 var _this$_getRangeToRend = this._getRangeToRender(),
33709 startIndex = _this$_getRangeToRend[0],
33710 stopIndex = _this$_getRangeToRend[1];
33711
33712 var items = [];
33713
33714 if (itemCount > 0) {
33715 for (var _index = startIndex; _index <= stopIndex; _index++) {
33716 items.push(react.exports.createElement(children, {
33717 data: itemData,
33718 key: itemKey(_index, itemData),
33719 index: _index,
33720 isScrolling: useIsScrolling ? isScrolling : undefined,
33721 style: this._getItemStyle(_index)
33722 }));
33723 }
33724 } // Read this value AFTER items have been created,
33725 // So their actual sizes (if variable) are taken into consideration.
33726
33727
33728 var estimatedTotalSize = getEstimatedTotalSize(this.props, this._instanceProps);
33729 return react.exports.createElement(outerElementType || outerTagName || 'div', {
33730 className: className,
33731 onScroll: onScroll,
33732 ref: this._outerRefSetter,
33733 style: _extends$1({
33734 position: 'relative',
33735 height: height,
33736 width: width,
33737 overflow: 'auto',
33738 WebkitOverflowScrolling: 'touch',
33739 willChange: 'transform',
33740 direction: direction
33741 }, style)
33742 }, react.exports.createElement(innerElementType || innerTagName || 'div', {
33743 children: items,
33744 ref: innerRef,
33745 style: {
33746 height: isHorizontal ? '100%' : estimatedTotalSize,
33747 pointerEvents: isScrolling ? 'none' : undefined,
33748 width: isHorizontal ? estimatedTotalSize : '100%'
33749 }
33750 }));
33751 };
33752
33753 _proto._callPropsCallbacks = function _callPropsCallbacks() {
33754 if (typeof this.props.onItemsRendered === 'function') {
33755 var itemCount = this.props.itemCount;
33756
33757 if (itemCount > 0) {
33758 var _this$_getRangeToRend2 = this._getRangeToRender(),
33759 _overscanStartIndex = _this$_getRangeToRend2[0],
33760 _overscanStopIndex = _this$_getRangeToRend2[1],
33761 _visibleStartIndex = _this$_getRangeToRend2[2],
33762 _visibleStopIndex = _this$_getRangeToRend2[3];
33763
33764 this._callOnItemsRendered(_overscanStartIndex, _overscanStopIndex, _visibleStartIndex, _visibleStopIndex);
33765 }
33766 }
33767
33768 if (typeof this.props.onScroll === 'function') {
33769 var _this$state2 = this.state,
33770 _scrollDirection = _this$state2.scrollDirection,
33771 _scrollOffset = _this$state2.scrollOffset,
33772 _scrollUpdateWasRequested = _this$state2.scrollUpdateWasRequested;
33773
33774 this._callOnScroll(_scrollDirection, _scrollOffset, _scrollUpdateWasRequested);
33775 }
33776 } // Lazily create and cache item styles while scrolling,
33777 // So that pure component sCU will prevent re-renders.
33778 // We maintain this cache, and pass a style prop rather than index,
33779 // So that List can clear cached styles and force item re-render if necessary.
33780 ;
33781
33782 _proto._getRangeToRender = function _getRangeToRender() {
33783 var _this$props5 = this.props,
33784 itemCount = _this$props5.itemCount,
33785 overscanCount = _this$props5.overscanCount;
33786 var _this$state3 = this.state,
33787 isScrolling = _this$state3.isScrolling,
33788 scrollDirection = _this$state3.scrollDirection,
33789 scrollOffset = _this$state3.scrollOffset;
33790
33791 if (itemCount === 0) {
33792 return [0, 0, 0, 0];
33793 }
33794
33795 var startIndex = getStartIndexForOffset(this.props, scrollOffset, this._instanceProps);
33796 var stopIndex = getStopIndexForStartIndex(this.props, startIndex, scrollOffset, this._instanceProps); // Overscan by one item in each direction so that tab/focus works.
33797 // If there isn't at least one extra item, tab loops back around.
33798
33799 var overscanBackward = !isScrolling || scrollDirection === 'backward' ? Math.max(1, overscanCount) : 1;
33800 var overscanForward = !isScrolling || scrollDirection === 'forward' ? Math.max(1, overscanCount) : 1;
33801 return [Math.max(0, startIndex - overscanBackward), Math.max(0, Math.min(itemCount - 1, stopIndex + overscanForward)), startIndex, stopIndex];
33802 };
33803
33804 return List;
33805 }(react.exports.PureComponent), _class.defaultProps = {
33806 direction: 'ltr',
33807 itemData: undefined,
33808 layout: 'vertical',
33809 overscanCount: 2,
33810 useIsScrolling: false
33811 }, _class;
33812 } // NOTE: I considered further wrapping individual items with a pure ListItem component.
33813 // This would avoid ever calling the render function for the same index more than once,
33814 // But it would also add the overhead of a lot of components/fibers.
33815 // I assume people already do this (render function returning a class component),
33816 // So my doing it would just unnecessarily double the wrappers.
33817
33818 var validateSharedProps$1 = function validateSharedProps(_ref2, _ref3) {
33819 _ref2.children;
33820 _ref2.direction;
33821 _ref2.height;
33822 _ref2.layout;
33823 _ref2.innerTagName;
33824 _ref2.outerTagName;
33825 _ref2.width;
33826 _ref3.instance;
33827 };
33828
33829 var FixedSizeList = /*#__PURE__*/createListComponent({
33830 getItemOffset: function getItemOffset(_ref, index) {
33831 var itemSize = _ref.itemSize;
33832 return index * itemSize;
33833 },
33834 getItemSize: function getItemSize(_ref2, index) {
33835 var itemSize = _ref2.itemSize;
33836 return itemSize;
33837 },
33838 getEstimatedTotalSize: function getEstimatedTotalSize(_ref3) {
33839 var itemCount = _ref3.itemCount,
33840 itemSize = _ref3.itemSize;
33841 return itemSize * itemCount;
33842 },
33843 getOffsetForIndexAndAlignment: function getOffsetForIndexAndAlignment(_ref4, index, align, scrollOffset) {
33844 var direction = _ref4.direction,
33845 height = _ref4.height,
33846 itemCount = _ref4.itemCount,
33847 itemSize = _ref4.itemSize,
33848 layout = _ref4.layout,
33849 width = _ref4.width;
33850 // TODO Deprecate direction "horizontal"
33851 var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
33852 var size = isHorizontal ? width : height;
33853 var lastItemOffset = Math.max(0, itemCount * itemSize - size);
33854 var maxOffset = Math.min(lastItemOffset, index * itemSize);
33855 var minOffset = Math.max(0, index * itemSize - size + itemSize);
33856
33857 if (align === 'smart') {
33858 if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
33859 align = 'auto';
33860 } else {
33861 align = 'center';
33862 }
33863 }
33864
33865 switch (align) {
33866 case 'start':
33867 return maxOffset;
33868
33869 case 'end':
33870 return minOffset;
33871
33872 case 'center':
33873 {
33874 // "Centered" offset is usually the average of the min and max.
33875 // But near the edges of the list, this doesn't hold true.
33876 var middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
33877
33878 if (middleOffset < Math.ceil(size / 2)) {
33879 return 0; // near the beginning
33880 } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
33881 return lastItemOffset; // near the end
33882 } else {
33883 return middleOffset;
33884 }
33885 }
33886
33887 case 'auto':
33888 default:
33889 if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
33890 return scrollOffset;
33891 } else if (scrollOffset < minOffset) {
33892 return minOffset;
33893 } else {
33894 return maxOffset;
33895 }
33896
33897 }
33898 },
33899 getStartIndexForOffset: function getStartIndexForOffset(_ref5, offset) {
33900 var itemCount = _ref5.itemCount,
33901 itemSize = _ref5.itemSize;
33902 return Math.max(0, Math.min(itemCount - 1, Math.floor(offset / itemSize)));
33903 },
33904 getStopIndexForStartIndex: function getStopIndexForStartIndex(_ref6, startIndex, scrollOffset) {
33905 var direction = _ref6.direction,
33906 height = _ref6.height,
33907 itemCount = _ref6.itemCount,
33908 itemSize = _ref6.itemSize,
33909 layout = _ref6.layout,
33910 width = _ref6.width;
33911 // TODO Deprecate direction "horizontal"
33912 var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
33913 var offset = startIndex * itemSize;
33914 var size = isHorizontal ? width : height;
33915 var numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
33916 return Math.max(0, Math.min(itemCount - 1, startIndex + numVisibleItems - 1 // -1 is because stop index is inclusive
33917 ));
33918 },
33919 initInstanceProps: function initInstanceProps(props) {// Noop
33920 },
33921 shouldResetStyleCacheOnItemSizeChange: true,
33922 validateProps: function validateProps(_ref7) {
33923 _ref7.itemSize;
33924 }
33925 });
33926
33927 function isRangeVisible(_ref) {
33928 var lastRenderedStartIndex = _ref.lastRenderedStartIndex,
33929 lastRenderedStopIndex = _ref.lastRenderedStopIndex,
33930 startIndex = _ref.startIndex,
33931 stopIndex = _ref.stopIndex;
33932
33933 return !(startIndex > lastRenderedStopIndex || stopIndex < lastRenderedStartIndex);
33934 }
33935
33936 function scanForUnloadedRanges(_ref) {
33937 var isItemLoaded = _ref.isItemLoaded,
33938 itemCount = _ref.itemCount,
33939 minimumBatchSize = _ref.minimumBatchSize,
33940 startIndex = _ref.startIndex,
33941 stopIndex = _ref.stopIndex;
33942
33943 var unloadedRanges = [];
33944
33945 var rangeStartIndex = null;
33946 var rangeStopIndex = null;
33947
33948 for (var _index = startIndex; _index <= stopIndex; _index++) {
33949 var loaded = isItemLoaded(_index);
33950
33951 if (!loaded) {
33952 rangeStopIndex = _index;
33953 if (rangeStartIndex === null) {
33954 rangeStartIndex = _index;
33955 }
33956 } else if (rangeStopIndex !== null) {
33957 unloadedRanges.push(rangeStartIndex, rangeStopIndex);
33958
33959 rangeStartIndex = rangeStopIndex = null;
33960 }
33961 }
33962
33963 // If :rangeStopIndex is not null it means we haven't ran out of unloaded rows.
33964 // Scan forward to try filling our :minimumBatchSize.
33965 if (rangeStopIndex !== null) {
33966 var potentialStopIndex = Math.min(Math.max(rangeStopIndex, rangeStartIndex + minimumBatchSize - 1), itemCount - 1);
33967
33968 for (var _index2 = rangeStopIndex + 1; _index2 <= potentialStopIndex; _index2++) {
33969 if (!isItemLoaded(_index2)) {
33970 rangeStopIndex = _index2;
33971 } else {
33972 break;
33973 }
33974 }
33975
33976 unloadedRanges.push(rangeStartIndex, rangeStopIndex);
33977 }
33978
33979 // Check to see if our first range ended prematurely.
33980 // In this case we should scan backwards to try filling our :minimumBatchSize.
33981 if (unloadedRanges.length) {
33982 while (unloadedRanges[1] - unloadedRanges[0] + 1 < minimumBatchSize && unloadedRanges[0] > 0) {
33983 var _index3 = unloadedRanges[0] - 1;
33984
33985 if (!isItemLoaded(_index3)) {
33986 unloadedRanges[0] = _index3;
33987 } else {
33988 break;
33989 }
33990 }
33991 }
33992
33993 return unloadedRanges;
33994 }
33995
33996 var classCallCheck$1 = function (instance, Constructor) {
33997 if (!(instance instanceof Constructor)) {
33998 throw new TypeError("Cannot call a class as a function");
33999 }
34000 };
34001
34002 var createClass$1 = function () {
34003 function defineProperties(target, props) {
34004 for (var i = 0; i < props.length; i++) {
34005 var descriptor = props[i];
34006 descriptor.enumerable = descriptor.enumerable || false;
34007 descriptor.configurable = true;
34008 if ("value" in descriptor) descriptor.writable = true;
34009 Object.defineProperty(target, descriptor.key, descriptor);
34010 }
34011 }
34012
34013 return function (Constructor, protoProps, staticProps) {
34014 if (protoProps) defineProperties(Constructor.prototype, protoProps);
34015 if (staticProps) defineProperties(Constructor, staticProps);
34016 return Constructor;
34017 };
34018 }();
34019
34020 var inherits$1 = function (subClass, superClass) {
34021 if (typeof superClass !== "function" && superClass !== null) {
34022 throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
34023 }
34024
34025 subClass.prototype = Object.create(superClass && superClass.prototype, {
34026 constructor: {
34027 value: subClass,
34028 enumerable: false,
34029 writable: true,
34030 configurable: true
34031 }
34032 });
34033 if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
34034 };
34035
34036 var possibleConstructorReturn$1 = function (self, call) {
34037 if (!self) {
34038 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
34039 }
34040
34041 return call && (typeof call === "object" || typeof call === "function") ? call : self;
34042 };
34043
34044 var InfiniteLoader = function (_PureComponent) {
34045 inherits$1(InfiniteLoader, _PureComponent);
34046
34047 function InfiniteLoader() {
34048 var _ref;
34049
34050 var _temp, _this, _ret;
34051
34052 classCallCheck$1(this, InfiniteLoader);
34053
34054 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
34055 args[_key] = arguments[_key];
34056 }
34057
34058 return _ret = (_temp = (_this = possibleConstructorReturn$1(this, (_ref = InfiniteLoader.__proto__ || Object.getPrototypeOf(InfiniteLoader)).call.apply(_ref, [this].concat(args))), _this), _this._lastRenderedStartIndex = -1, _this._lastRenderedStopIndex = -1, _this._memoizedUnloadedRanges = [], _this._onItemsRendered = function (_ref2) {
34059 var visibleStartIndex = _ref2.visibleStartIndex,
34060 visibleStopIndex = _ref2.visibleStopIndex;
34061
34062 _this._lastRenderedStartIndex = visibleStartIndex;
34063 _this._lastRenderedStopIndex = visibleStopIndex;
34064
34065 _this._ensureRowsLoaded(visibleStartIndex, visibleStopIndex);
34066 }, _this._setRef = function (listRef) {
34067 _this._listRef = listRef;
34068 }, _temp), possibleConstructorReturn$1(_this, _ret);
34069 }
34070
34071 createClass$1(InfiniteLoader, [{
34072 key: 'resetloadMoreItemsCache',
34073 value: function resetloadMoreItemsCache() {
34074 var autoReload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
34075
34076 this._memoizedUnloadedRanges = [];
34077
34078 if (autoReload) {
34079 this._ensureRowsLoaded(this._lastRenderedStartIndex, this._lastRenderedStopIndex);
34080 }
34081 }
34082 }, {
34083 key: 'componentDidMount',
34084 value: function componentDidMount() {
34085 }
34086 }, {
34087 key: 'render',
34088 value: function render() {
34089 var children = this.props.children;
34090
34091
34092 return children({
34093 onItemsRendered: this._onItemsRendered,
34094 ref: this._setRef
34095 });
34096 }
34097 }, {
34098 key: '_ensureRowsLoaded',
34099 value: function _ensureRowsLoaded(startIndex, stopIndex) {
34100 var _props = this.props,
34101 isItemLoaded = _props.isItemLoaded,
34102 itemCount = _props.itemCount,
34103 _props$minimumBatchSi = _props.minimumBatchSize,
34104 minimumBatchSize = _props$minimumBatchSi === undefined ? 10 : _props$minimumBatchSi,
34105 _props$threshold = _props.threshold,
34106 threshold = _props$threshold === undefined ? 15 : _props$threshold;
34107
34108
34109 var unloadedRanges = scanForUnloadedRanges({
34110 isItemLoaded: isItemLoaded,
34111 itemCount: itemCount,
34112 minimumBatchSize: minimumBatchSize,
34113 startIndex: Math.max(0, startIndex - threshold),
34114 stopIndex: Math.min(itemCount - 1, stopIndex + threshold)
34115 });
34116
34117 // Avoid calling load-rows unless range has changed.
34118 // This shouldn't be strictly necessary, but is maybe nice to do.
34119 if (this._memoizedUnloadedRanges.length !== unloadedRanges.length || this._memoizedUnloadedRanges.some(function (startOrStop, index) {
34120 return unloadedRanges[index] !== startOrStop;
34121 })) {
34122 this._memoizedUnloadedRanges = unloadedRanges;
34123 this._loadUnloadedRanges(unloadedRanges);
34124 }
34125 }
34126 }, {
34127 key: '_loadUnloadedRanges',
34128 value: function _loadUnloadedRanges(unloadedRanges) {
34129 var _this2 = this;
34130
34131 // loadMoreRows was renamed to loadMoreItems in v1.0.3; will be removed in v2.0
34132 var loadMoreItems = this.props.loadMoreItems || this.props.loadMoreRows;
34133
34134 var _loop = function _loop(i) {
34135 var startIndex = unloadedRanges[i];
34136 var stopIndex = unloadedRanges[i + 1];
34137 var promise = loadMoreItems(startIndex, stopIndex);
34138 if (promise != null) {
34139 promise.then(function () {
34140 // Refresh the visible rows if any of them have just been loaded.
34141 // Otherwise they will remain in their unloaded visual state.
34142 if (isRangeVisible({
34143 lastRenderedStartIndex: _this2._lastRenderedStartIndex,
34144 lastRenderedStopIndex: _this2._lastRenderedStopIndex,
34145 startIndex: startIndex,
34146 stopIndex: stopIndex
34147 })) {
34148 // Handle an unmount while promises are still in flight.
34149 if (_this2._listRef == null) {
34150 return;
34151 }
34152
34153 // Resize cached row sizes for VariableSizeList,
34154 // otherwise just re-render the list.
34155 if (typeof _this2._listRef.resetAfterIndex === 'function') {
34156 _this2._listRef.resetAfterIndex(startIndex, true);
34157 } else {
34158 // HACK reset temporarily cached item styles to force PureComponent to re-render.
34159 // This is pretty gross, but I'm okay with it for now.
34160 // Don't judge me.
34161 if (typeof _this2._listRef._getItemStyleCache === 'function') {
34162 _this2._listRef._getItemStyleCache(-1);
34163 }
34164 _this2._listRef.forceUpdate();
34165 }
34166 }
34167 });
34168 }
34169 };
34170
34171 for (var i = 0; i < unloadedRanges.length; i += 2) {
34172 _loop(i);
34173 }
34174 }
34175 }]);
34176 return InfiniteLoader;
34177 }(react.exports.PureComponent);
34178
34179 const SELECTED_STATES = ['S', 'XS'];
34180
34181 const flatten = arr => arr.reduce((prev, cur) => prev.concat(cur));
34182
34183 function isStateSelected(qState) {
34184 return SELECTED_STATES.includes(qState);
34185 }
34186
34187 function getUniques(arr) {
34188 return Array.isArray(arr) ? Array.from(new Set(arr)) : undefined;
34189 }
34190 function getSelectedValues(pages) {
34191 if (!pages || !pages.length) {
34192 return [];
34193 }
34194
34195 const elementNbrs = pages.map(page => {
34196 const elementNumbers = page.qMatrix.map(p => {
34197 const [p0] = p;
34198 return isStateSelected(p0.qState) ? p0.qElemNumber : false;
34199 });
34200 return elementNumbers.filter(n => n !== false);
34201 });
34202 return flatten(elementNbrs);
34203 }
34204 function applySelectionsOnPages(pages, elmNumbers) {
34205 let clearAllButElmNumbers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
34206
34207 const getNewSelectionState = qState => elmNumbers.length <= 1 && isStateSelected(qState) ? 'A' : 'S';
34208
34209 const matrices = pages.map(page => {
34210 const qMatrix = page.qMatrix.map(p => {
34211 const [p0] = p;
34212 const selectionMatchesElement = elmNumbers.includes(p0.qElemNumber);
34213 let qState;
34214
34215 if (clearAllButElmNumbers) {
34216 qState = selectionMatchesElement ? 'S' : 'A';
34217 } else {
34218 qState = selectionMatchesElement ? getNewSelectionState(p0.qState) : p0.qState;
34219 }
34220
34221 return [_objectSpread2(_objectSpread2({}, p0), {}, {
34222 qState
34223 }), p.slice(1)];
34224 });
34225 return _objectSpread2(_objectSpread2({}, page), {}, {
34226 qMatrix
34227 });
34228 });
34229 return matrices;
34230 }
34231 async function selectValues(_ref) {
34232 let {
34233 selections,
34234 elemNumbers,
34235 isSingleSelect = false
34236 } = _ref;
34237 let resolved = Promise.resolve(false);
34238 const hasNanValues = elemNumbers.some(elemNumber => Number.isNaN(elemNumber));
34239
34240 if (!hasNanValues) {
34241 const elemNumbersToSelect = elemNumbers;
34242 resolved = selections.select({
34243 method: 'selectListObjectValues',
34244 params: ['/qListObjectDef', elemNumbersToSelect, !isSingleSelect]
34245 }).then(success => success !== false).catch(() => false);
34246 }
34247
34248 return resolved;
34249 }
34250 function getElemNumbersFromPages(pages) {
34251 if (!pages || !pages.length) {
34252 return [];
34253 }
34254
34255 const elemNumbersArr = pages.map(page => {
34256 const qElemNumbers = page.qMatrix.map(p => {
34257 const [{
34258 qElemNumber
34259 }] = p;
34260 return qElemNumber;
34261 });
34262 return qElemNumbers;
34263 });
34264 const elemNumbers = flatten(elemNumbersArr);
34265 return elemNumbers;
34266 }
34267 /**
34268 * @ignore
34269 * @interface MinMaxResult
34270 * @property {number} min
34271 * @property {number} max
34272 */
34273
34274 /**
34275 * Returns the min and max indices of elemNumbersOrdered which contains
34276 * all numbers in elementNbrs.
34277 *
34278 * @ignore
34279 * @param {number[]} elementNbrs
34280 * @param {number[]} elemNumbersOrdered
34281 * @returns {MinMaxResult}
34282 */
34283
34284 function getMinMax(elementNbrs, elemNumbersOrdered) {
34285 let min = Infinity;
34286 let max = -Infinity;
34287 elementNbrs.forEach(nbr => {
34288 const index = elemNumbersOrdered.indexOf(nbr);
34289 min = index < min ? index : min;
34290 max = index > max ? index : max;
34291 });
34292 return {
34293 min,
34294 max
34295 };
34296 }
34297
34298 function fillRange(elementNbrs, elemNumbersOrdered) {
34299 if (!elementNbrs) {
34300 return [];
34301 }
34302
34303 if (elementNbrs.length <= 1) {
34304 return elementNbrs;
34305 } // Interpolate values algorithm
34306
34307
34308 const {
34309 min,
34310 max
34311 } = getMinMax(elementNbrs, elemNumbersOrdered);
34312 return elemNumbersOrdered.slice(min, max + 1);
34313 }
34314
34315 function useSelectionsInteractions(_ref) {
34316 let {
34317 layout,
34318 selections,
34319 pages = [],
34320 checkboxes = false,
34321 selectDisabled,
34322 doc = document,
34323 isSingleSelect: singleSelect = false
34324 } = _ref;
34325 const [instantPages, setInstantPages] = react.exports.useState(pages);
34326 const [mouseDown, setMouseDown] = react.exports.useState(false);
34327 const [selectingValues, setSelectingValues] = react.exports.useState(false);
34328 const [isSingleSelect, setIsSingleSelect] = react.exports.useState(singleSelect);
34329 const [selected, setSelected] = react.exports.useState([]);
34330 const [isRangeSelection, setIsRangeSelection] = react.exports.useState(false);
34331 const [preSelected, setPreSelected] = react.exports.useState([]);
34332 const elemNumbersOrdered = getElemNumbersFromPages(pages);
34333 react.exports.useEffect(() => {
34334 setIsSingleSelect(singleSelect);
34335 }, [singleSelect]); // Select values for real, by calling the backend.
34336
34337 const select = async function () {
34338 let elemNumbers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
34339 let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
34340
34341 if (selectDisabled()) {
34342 return;
34343 }
34344
34345 setSelectingValues(true);
34346 const filtered = additive ? elemNumbers.filter(n => !selected.includes(n)) : elemNumbers;
34347 await selectValues({
34348 selections,
34349 elemNumbers: filtered,
34350 isSingleSelect
34351 });
34352 setSelectingValues(false);
34353 setPreSelected([]);
34354 }; // Show estimated selection states instantly before applying the selections for real.
34355
34356
34357 const preSelect = function (elemNumbers) {
34358 let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
34359
34360 if (selectDisabled()) {
34361 return;
34362 }
34363
34364 setPreSelected(existing => {
34365 const uniques = getUniques([...existing, ...elemNumbers]);
34366 const filtered = additive ? uniques.filter(n => !selected.includes(n)) : uniques;
34367 const filled = additive ? fillRange(uniques, elemNumbersOrdered) : filtered;
34368 return filled;
34369 });
34370 };
34371
34372 const selectManually = function () {
34373 let elementIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
34374 let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
34375 setIsRangeSelection(false); // range is not supported for manual select
34376
34377 setMouseDown(true);
34378 preSelect(elementIds, additive || isRangeSelection);
34379 const p = select(elementIds, additive || isRangeSelection);
34380 setMouseDown(false);
34381 return p;
34382 };
34383
34384 const handleSingleSelectKey = event => {
34385 if (event.ctrlKey || event.metaKey) {
34386 setIsSingleSelect(true);
34387 event.currentTarget.focus(); // will not be focused otherwise
34388
34389 event.preventDefault();
34390 }
34391 };
34392
34393 const onClick = react.exports.useCallback(event => {
34394 if (selectingValues || selectDisabled()) {
34395 return;
34396 }
34397
34398 const elemNumber = +event.currentTarget.getAttribute('data-n');
34399 setPreSelected([elemNumber]);
34400 handleSingleSelectKey(event);
34401 }, [selectingValues, selectDisabled]);
34402 const onMouseDown = react.exports.useCallback(event => {
34403 if (selectingValues || selectDisabled()) {
34404 return;
34405 }
34406
34407 setIsRangeSelection(false);
34408 setMouseDown(true);
34409 const elemNumber = +event.currentTarget.getAttribute('data-n');
34410 setPreSelected([elemNumber]);
34411 handleSingleSelectKey(event);
34412 }, [selectingValues, selectDisabled]);
34413 const onMouseUp = react.exports.useCallback(event => {
34414 const elemNumber = +event.currentTarget.getAttribute('data-n');
34415
34416 if (isSingleSelect || !mouseDown || selectingValues || preSelected.length === 1 && preSelected[0] === elemNumber // prevent toggling again on mouseup
34417 ) {
34418 return;
34419 }
34420
34421 preSelect([elemNumber]);
34422 }, [mouseDown, selectingValues, preSelected, selected, isRangeSelection, selectDisabled]);
34423 const onMouseUpDoc = react.exports.useCallback(() => {
34424 // Ensure we end interactions when mouseup happens outside the Listbox.
34425 setMouseDown(false);
34426 setSelectingValues(false);
34427 setIsRangeSelection(false);
34428 setIsSingleSelect(singleSelect);
34429 }, [singleSelect]);
34430 const onMouseEnter = react.exports.useCallback(event => {
34431 if (isSingleSelect || !mouseDown || selectingValues || selectDisabled()) {
34432 return;
34433 }
34434
34435 setIsRangeSelection(true);
34436 const elemNumber = +event.currentTarget.getAttribute('data-n');
34437 preSelect([elemNumber], true);
34438 }, [mouseDown, selectingValues, isRangeSelection, preSelected, selected, selectDisabled, layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]);
34439 react.exports.useEffect(() => {
34440 // Perform selections of pre-selected values. This can
34441 // happen only when interactions have finished (mouseup).
34442 const interactionIsFinished = !mouseDown;
34443
34444 if (!preSelected || !preSelected.length || selectingValues || !interactionIsFinished || !layout) {
34445 return;
34446 }
34447
34448 select(preSelected, isRangeSelection);
34449 }, [preSelected, mouseDown, selectDisabled()]);
34450 react.exports.useEffect(() => {
34451 doc.addEventListener('mouseup', onMouseUpDoc);
34452 return () => {
34453 doc.removeEventListener('mouseup', onMouseUpDoc);
34454 };
34455 }, [onMouseUpDoc]);
34456 react.exports.useEffect(() => {
34457 if (selectingValues || mouseDown) {
34458 return;
34459 } // Keep track of (truely) selected fields so we can prevent toggling them on range select.
34460
34461
34462 const alreadySelected = getSelectedValues(pages);
34463 setSelected(alreadySelected);
34464 }, [pages]);
34465 react.exports.useEffect(() => {
34466 if (selectingValues || !pages || !checkboxes && !mouseDown) {
34467 return;
34468 } // Render pre-selections before they have been selected in Engine.
34469
34470
34471 const newPages = applySelectionsOnPages(pages, preSelected, isSingleSelect);
34472 setInstantPages(newPages);
34473 }, [preSelected]);
34474 const interactionEvents = {};
34475
34476 if (checkboxes) {
34477 Object.assign(interactionEvents, {
34478 onClick
34479 });
34480 } else {
34481 Object.assign(interactionEvents, {
34482 onMouseUp,
34483 onMouseDown,
34484 onMouseEnter
34485 });
34486 }
34487
34488 return {
34489 instantPages,
34490 interactionEvents,
34491 select: selectManually // preselect and select without having to trigger an event
34492
34493 };
34494 }
34495
34496 const tick = props => _objectSpread2(_objectSpread2({}, props), {}, {
34497 shapes: [{
34498 type: 'path',
34499 attrs: {
34500 d: 'M6,10 L13,3 L15,5 L8,12 L6,14 L1,9 L3,7 L6,10 Z'
34501 }
34502 }]
34503 });
34504
34505 var Tick = (props => SvgIcon(tick(props)));
34506
34507 const CheckboxChecked = "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath" + " fill-rule='evenodd' clip-rule='evenodd' d='M12 5c-.28 0-.53.11-.71.29L7 9.59l-2.29-2.3a1.003 " + "1.003 0 00-1.42 1.42l3 3c.18.18.43.29.71.29s.53-.11.71-.29l5-5A1.003 1.003 0 0012 5z' fill='%23fff'/%3E%3C/svg%3E\")";
34508
34509 const borderRadius = 3;
34510 const useStyles$e = makeStyles$1(theme => ({
34511 cbIcon: {
34512 borderRadius,
34513 width: 16,
34514 height: 16,
34515 boxShadow: 'inset 0 0 0 1px rgba(16,22,26,.2), inset 0 -1px 0 rgba(16,22,26,.1)',
34516 backgroundColor: '#f5f8fa',
34517 backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))',
34518 display: 'flex',
34519 alignItems: 'center',
34520 justifyContent: 'center'
34521 },
34522 cbIconChecked: {
34523 borderRadius,
34524 backgroundColor: theme.palette.selected.main,
34525 backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,0))',
34526 '&:before': {
34527 display: 'block',
34528 width: 16,
34529 height: 16,
34530 backgroundImage: CheckboxChecked,
34531 content: '""'
34532 }
34533 },
34534 cbIconExcluded: {
34535 borderRadius: borderRadius - 1,
34536 width: 12,
34537 height: 12,
34538 backgroundColor: theme.palette.selected.excluded
34539 },
34540 cbIconAlternative: {
34541 borderRadius: borderRadius - 1,
34542 width: 12,
34543 height: 12,
34544 backgroundColor: theme.palette.selected.alternative
34545 },
34546 checkbox: {
34547 margin: 0,
34548 '&:hover': {
34549 backgroundColor: 'inherit !important'
34550 }
34551 },
34552 dense: {
34553 padding: '4px 8px'
34554 }
34555 }));
34556
34557 const getIcon = function (styles) {
34558 let showGray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
34559 let excluded = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
34560 let alternative = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
34561 return /*#__PURE__*/React.createElement("span", {
34562 className: styles.cbIcon
34563 }, (excluded || alternative) && /*#__PURE__*/React.createElement("span", {
34564 className: [showGray && excluded && styles.cbIconExcluded, showGray && alternative && styles.cbIconAlternative].filter(Boolean).join(' ')
34565 }));
34566 };
34567
34568 function ListboxCheckbox(_ref) {
34569 let {
34570 checked,
34571 label,
34572 dense,
34573 excluded,
34574 alternative,
34575 showGray = true
34576 } = _ref;
34577 const styles = useStyles$e();
34578 return /*#__PURE__*/React.createElement(Checkbox$1, {
34579 edge: "start",
34580 checked: checked,
34581 disableRipple: true,
34582 className: [styles.checkbox, dense && styles.dense].filter(Boolean).join(' '),
34583 inputProps: {
34584 'aria-labelledby': label
34585 },
34586 name: label,
34587 icon: getIcon(styles, showGray, excluded, alternative),
34588 checkedIcon: /*#__PURE__*/React.createElement("span", {
34589 className: styles.cbIconChecked
34590 })
34591 });
34592 }
34593
34594 /**
34595 * @ignore
34596 * @interface Range
34597 * @property {number} qCharPos The (absolute) index where the highlighted range starts.
34598 * @property {number} qCharCount The length of the sub-string (starting from qChartPos) that should be highlighted.
34599 */
34600
34601 /**
34602 * @ignore
34603 * @interface Segment
34604 * @property {string} segment The sub-string/segment cut out from the original label.
34605 * @property {boolean} highlighted A flag which tells whether the segment should be highlighted or not.
34606 */
34607
34608 /**
34609 * @ignore
34610 * @param {string} label The label we want to create segments out of.
34611 * @param {Range} range The indexes which define how to create the segments.
34612 * @param {number=} [startIndex] An optional index which tells where we want to start the first segment from
34613 * (only relevant for creating the first unhighlighted segment of a string/sub-string).
34614 * @returns {Segment[]} An array of segments.
34615 */
34616 function getSegmentsFromRange(label, range) {
34617 let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
34618 const {
34619 qCharPos,
34620 qCharCount
34621 } = range;
34622 const segments = [];
34623
34624 if (qCharPos > startIndex) {
34625 // Create a non-highlighted section before the highighted section.
34626 segments.push([label.slice(startIndex, qCharPos), false]);
34627 } // Highlighted segment.
34628
34629
34630 segments.push([label.slice(qCharPos, qCharPos + qCharCount), true]);
34631 return segments;
34632 }
34633 /**
34634 * @ignore
34635 * @param {string} label The label we want to create segments out of.
34636 * @param {Range[]} ranges The ranges defining indices for cutting the string into segments.
34637 * @returns {Segment[]} An array of segments, covering the entire string label.
34638 */
34639
34640
34641 function getSegmentsFromRanges(label, ranges) {
34642 if (!ranges.length) {
34643 return [];
34644 }
34645
34646 const labels = ranges.reduce((acc, curr, ix) => {
34647 const startIndex = ix === 0 ? 0 : ranges[ix - 1].qCharPos + ranges[ix - 1].qCharCount;
34648 acc.push(...getSegmentsFromRange(label, curr, startIndex)); // Last non highlighted segment
34649
34650 const isLastRange = ix === ranges.length - 1;
34651 const endIndex = ranges[ix].qCharPos + ranges[ix].qCharCount;
34652
34653 if (isLastRange && endIndex < label.length) {
34654 acc.push([label.slice(endIndex), false]);
34655 }
34656
34657 return acc;
34658 }, []);
34659 return labels;
34660 }
34661
34662 const useStyles$d = makeStyles$1(() => ({
34663 denseRadioButton: {
34664 height: '100%',
34665 boxSizing: 'border-box',
34666 '& svg': {
34667 width: '0.7em',
34668 height: '0.7em'
34669 }
34670 },
34671 radioButton: {
34672 right: '5px'
34673 }
34674 }));
34675 function ListBoxRadioButton(_ref) {
34676 let {
34677 checked,
34678 label,
34679 dense
34680 } = _ref;
34681 const styles = useStyles$d();
34682 return /*#__PURE__*/React.createElement(Radio$1, {
34683 checked: checked,
34684 value: label,
34685 name: label,
34686 inputProps: {
34687 'aria-labelledby': label
34688 },
34689 className: dense ? styles.denseRadioButton : styles.radioButton,
34690 style: {
34691 backgroundColor: 'transparent'
34692 },
34693 disableRipple: true
34694 });
34695 }
34696
34697 const KEYS = Object.freeze({
34698 ENTER: 13,
34699 ESCAPE: 27,
34700 SPACE: 32,
34701 TAB: 9,
34702 BACKSPACE: 8,
34703 DELETE: 46,
34704 ALT: 18,
34705 CTRL: 17,
34706 SHIFT: 16,
34707 ARROW_UP: 38,
34708 ARROW_DOWN: 40,
34709 ARROW_LEFT: 37,
34710 ARROW_RIGHT: 39,
34711 PAGE_DOWN: 34,
34712 PAGE_UP: 33,
34713 HOME: 36,
34714 END: 35,
34715 F10: 121,
34716 A: 65,
34717 F: 70,
34718 ZERO: 48,
34719 NINE: 57,
34720 NUMPAD_ZERO: 96,
34721 NUMPAD_NINE: 105,
34722 SUBTRACTION: 189,
34723 DECIMAL: 190,
34724 NUMPAD_DECIMAL: 110,
34725 isArrow: key => key === KEYS.ARROW_UP || key === KEYS.ARROW_DOWN || key === KEYS.ARROW_LEFT || key === KEYS.ARROW_RIGHT
34726 });
34727
34728 function getFieldKeyboardNavigation(_ref) {
34729 let {
34730 select,
34731 confirm,
34732 cancel
34733 } = _ref;
34734
34735 const getElement = function (elm) {
34736 let next = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
34737 const parentElm = elm && elm.parentElement[next ? 'nextElementSibling' : 'previousElementSibling'];
34738 return parentElm && parentElm.querySelector('[role]');
34739 };
34740
34741 let startedRange = false;
34742
34743 const setStartedRange = val => {
34744 startedRange = val;
34745 };
34746
34747 const handleKeyDown = event => {
34748 let elementToFocus;
34749 const {
34750 keyCode,
34751 shiftKey = false
34752 } = event.nativeEvent;
34753
34754 switch (keyCode) {
34755 case KEYS.SHIFT:
34756 // This is to ensure we include the first value when starting a range selection.
34757 setStartedRange(true);
34758 break;
34759
34760 case KEYS.SPACE:
34761 select([+event.currentTarget.getAttribute('data-n')]);
34762 break;
34763
34764 case KEYS.ARROW_DOWN:
34765 case KEYS.ARROW_RIGHT:
34766 elementToFocus = getElement(event.currentTarget, true);
34767
34768 if (shiftKey && elementToFocus) {
34769 if (startedRange) {
34770 select([+event.currentTarget.getAttribute('data-n')], true);
34771 setStartedRange(false);
34772 }
34773
34774 select([+elementToFocus.getAttribute('data-n')], true);
34775 }
34776
34777 break;
34778
34779 case KEYS.ARROW_UP:
34780 case KEYS.ARROW_LEFT:
34781 elementToFocus = getElement(event.currentTarget, false);
34782
34783 if (shiftKey && elementToFocus) {
34784 if (startedRange) {
34785 select([+event.currentTarget.getAttribute('data-n')], true);
34786 setStartedRange(false);
34787 }
34788
34789 select([+elementToFocus.getAttribute('data-n')], true);
34790 }
34791
34792 break;
34793
34794 case KEYS.ENTER:
34795 confirm();
34796 break;
34797
34798 case KEYS.ESCAPE:
34799 cancel();
34800 return;
34801 // let it propagate to top-level
34802
34803 default:
34804 return;
34805 // don't stop propagation since we want to outsource keydown to other handlers.
34806 }
34807
34808 if (elementToFocus) {
34809 elementToFocus.focus();
34810 }
34811
34812 event.preventDefault();
34813 event.stopPropagation();
34814 };
34815
34816 return handleKeyDown;
34817 }
34818 function getListboxInlineKeyboardNavigation(_ref2) {
34819 let {
34820 setKeyboardActive
34821 } = _ref2;
34822
34823 const focusInsideListbox = element => {
34824 const fieldElement = element.querySelector('.search input, .value.selector, .value');
34825 setKeyboardActive(true);
34826
34827 if (fieldElement) {
34828 fieldElement.focus();
34829 }
34830 };
34831
34832 const focusContainer = element => {
34833 setKeyboardActive(false);
34834 element.focus();
34835 };
34836
34837 const handleKeyDown = event => {
34838 const {
34839 keyCode
34840 } = event.nativeEvent;
34841
34842 switch (keyCode) {
34843 // case KEYS.TAB: TODO: Focus confirm button using keyboard.focusSelection when we can access the useKeyboard hook.
34844 case KEYS.ENTER:
34845 case KEYS.SPACE:
34846 focusInsideListbox(event.currentTarget);
34847 break;
34848
34849 case KEYS.ESCAPE:
34850 focusContainer(event.currentTarget);
34851 break;
34852
34853 default:
34854 return;
34855 } // Note: We should not stop propagation here as it will block the containing app
34856 // from handling keydown events.
34857
34858
34859 event.preventDefault();
34860 };
34861
34862 return handleKeyDown;
34863 }
34864
34865 const ellipsis = {
34866 width: '100%',
34867 overflow: 'hidden',
34868 textOverflow: 'ellipsis'
34869 };
34870 const barPadPx = 4;
34871 const barBorderWidthPx = 1;
34872 const barWithCheckboxLeftPadPx = 29;
34873 const frequencyTextNone = '0';
34874
34875 const getSelectedStyle = _ref => {
34876 let {
34877 theme
34878 } = _ref;
34879 return {
34880 background: theme.palette.selected.main,
34881 color: theme.palette.selected.mainContrastText,
34882 '&:focus': {
34883 boxShadow: "inset 0 0 0 2px rgba(0, 0, 0, 0.3)",
34884 outline: 'none'
34885 },
34886 '& $cell': {
34887 paddingRight: 0
34888 }
34889 };
34890 };
34891
34892 const useStyles$c = makeStyles$1(theme => ({
34893 row: {
34894 flexWrap: 'nowrap',
34895 color: theme.palette.text.primary
34896 },
34897 rowBorderBottom: {
34898 borderBottom: "1px solid ".concat(theme.palette.divider)
34899 },
34900 column: {
34901 flexWrap: 'nowrap',
34902 borderRight: "1px solid ".concat(theme.palette.divider),
34903 color: theme.palette.text.primary
34904 },
34905 fieldRoot: {
34906 '&:focus': {
34907 boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
34908 },
34909 '&:focus-visible': {
34910 outline: 'none'
34911 }
34912 },
34913 // The interior wrapper for all field content.
34914 cell: {
34915 display: 'flex',
34916 alignItems: 'center',
34917 minWidth: 0,
34918 flexGrow: 1,
34919 // Note that this padding is overridden when using checkboxes.
34920 paddingLeft: '9px',
34921 paddingRight: '9px'
34922 },
34923 // The leaf node, containing the label text.
34924 labelText: _objectSpread2({
34925 flexBasis: 'max-content',
34926 lineHeight: '16px',
34927 userSelect: 'none',
34928 whiteSpace: 'pre'
34929 }, ellipsis),
34930 labelDense: {
34931 fontSize: 12
34932 },
34933 // Highlight is added to labelText spans, which are created as siblings to original labelText,
34934 // when a search string is matched.
34935 highlighted: {
34936 overflow: 'visible',
34937 width: '100%',
34938 '& > span': {
34939 width: '100%',
34940 backgroundColor: '#FFC72A'
34941 }
34942 },
34943 // Checkbox and label container.
34944 checkboxLabel: {
34945 margin: 0,
34946 width: '100%',
34947 height: '100%',
34948 // The checkbox's span
34949 '& > span:nth-child(1)': {
34950 paddingRight: '8px'
34951 },
34952 // The checkbox's label container.
34953 '& > span:nth-child(2)': _objectSpread2(_objectSpread2({}, ellipsis), {}, {
34954 display: 'flex',
34955 alignItems: 'center',
34956 paddingLeft: 0
34957 })
34958 },
34959 // The icons container holding tick and lock, shown inside fields.
34960 icon: {
34961 display: 'flex',
34962 padding: theme.spacing(1, 1, 1, 0)
34963 },
34964 // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
34965 S: _objectSpread2({}, getSelectedStyle({
34966 theme
34967 })),
34968 XS: _objectSpread2(_objectSpread2({}, getSelectedStyle({
34969 theme
34970 })), {}, {
34971 background: theme.palette.selected.excluded,
34972 color: theme.palette.selected.mainContrastText
34973 }),
34974 A: {
34975 background: theme.palette.selected.alternative,
34976 color: theme.palette.selected.alternativeContrastText
34977 },
34978 X: {
34979 background: theme.palette.selected.excluded,
34980 color: theme.palette.selected.mainContrastText
34981 },
34982 frequencyCount: {
34983 paddingLeft: '8px',
34984 paddingRight: '8px'
34985 },
34986 barContainer: {
34987 position: 'relative'
34988 },
34989 bar: {
34990 border: "".concat(barBorderWidthPx, "px solid"),
34991 borderColor: '#D9D9D9',
34992 height: '16px',
34993 position: 'absolute',
34994 zIndex: '-1',
34995 alignSelf: 'center',
34996 left: "".concat(barPadPx, "px"),
34997 transition: 'width 0.2s',
34998 backgroundColor: '#FAFAFA'
34999 },
35000 barSelected: {
35001 opacity: '30%',
35002 zIndex: '0',
35003 background: theme.palette.background.lighter
35004 },
35005 barWithCheckbox: {
35006 left: "".concat(barWithCheckboxLeftPadPx, "px")
35007 },
35008 barSelectedWithCheckbox: {
35009 background: '#BFE5D0',
35010 borderColor: '#BFE5D0'
35011 },
35012 excludedTextWithCheckbox: {
35013 color: '#828282'
35014 }
35015 }));
35016
35017 function RowColumn(_ref2) {
35018 let {
35019 index,
35020 style,
35021 data,
35022 column = false
35023 } = _ref2;
35024 const {
35025 onClick,
35026 onMouseDown,
35027 onMouseUp,
35028 onMouseEnter,
35029 pages,
35030 isLocked,
35031 checkboxes = false,
35032 dense = false,
35033 frequencyMode = 'N',
35034 isSingleSelect,
35035 actions,
35036 frequencyMax = '',
35037 histogram = false,
35038 keyboard,
35039 showGray = true
35040 } = data;
35041 const handleKeyDownCallback = react.exports.useCallback(getFieldKeyboardNavigation(actions), [actions]);
35042 const [isSelected, setSelected] = react.exports.useState(false);
35043 const [cell, setCell] = react.exports.useState();
35044 const classes = useStyles$c();
35045 const [classArr, setClassArr] = react.exports.useState([]);
35046 react.exports.useEffect(() => {
35047 if (!pages) {
35048 return;
35049 }
35050
35051 let c;
35052 const page = pages.filter(p => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight)[0];
35053
35054 if (page) {
35055 const area = page.qArea;
35056
35057 if (index >= area.qTop && index < area.qTop + area.qHeight) {
35058 [c] = page.qMatrix[index - area.qTop];
35059 }
35060 }
35061
35062 setCell(c);
35063 }, [pages]);
35064
35065 const isExcluded = c => c ? c.qState === 'X' || c.qState === 'XS' || c.qState === 'XL' : null;
35066
35067 const isAlternative = c => c ? c.qState === 'A' : null;
35068
35069 react.exports.useEffect(() => {
35070 if (!cell) {
35071 return;
35072 }
35073
35074 const selected = cell.qState === 'S' || cell.qState === 'XS' || cell.qState === 'L';
35075 setSelected(selected);
35076 const clazzArr = [column ? classes.column : classes.row];
35077 if (!(histogram && dense)) clazzArr.push(classes.rowBorderBottom);
35078
35079 if (!checkboxes) {
35080 if (cell.qState === 'XS') {
35081 clazzArr.push(showGray ? classes.XS : classes.S);
35082 } else if (cell.qState === 'S' || cell.qState === 'L') {
35083 clazzArr.push(classes.S);
35084 } else if (showGray && isAlternative(cell)) {
35085 clazzArr.push(classes.A);
35086 } else if (showGray && isExcluded(cell)) {
35087 clazzArr.push(classes.X);
35088 }
35089 }
35090
35091 setClassArr(clazzArr);
35092 }, [cell && cell.qState]);
35093
35094 const joinClassNames = namesArray => namesArray.filter(c => !!c).join(' ').trim();
35095
35096 const excludedOrAlternative = () => (isAlternative(cell) || isExcluded(cell)) && checkboxes;
35097
35098 const getValueField = _ref3 => {
35099 let {
35100 lbl,
35101 ix,
35102 color,
35103 highlighted = false
35104 } = _ref3;
35105 return /*#__PURE__*/React.createElement(Typography$1, {
35106 component: "span",
35107 variant: "body2",
35108 key: ix,
35109 className: joinClassNames([classes.labelText, highlighted && classes.highlighted, dense && classes.labelDense, showGray && excludedOrAlternative() && classes.excludedTextWithCheckbox]),
35110 color: color
35111 }, /*#__PURE__*/React.createElement("span", {
35112 style: {
35113 whiteSpace: 'pre'
35114 }
35115 }, lbl));
35116 };
35117
35118 const preventContextMenu = event => {
35119 if (checkboxes) {
35120 // Event will not propagate in the checkbox/radiobutton case
35121 onClick(event);
35122 }
35123
35124 event.preventDefault();
35125 };
35126
35127 const getCheckboxField = _ref4 => {
35128 let {
35129 lbl,
35130 color,
35131 qElemNumber
35132 } = _ref4;
35133 const cb = /*#__PURE__*/React.createElement(ListboxCheckbox, {
35134 label: lbl,
35135 checked: isSelected,
35136 dense: dense,
35137 excluded: isExcluded(cell),
35138 alternative: isAlternative(cell),
35139 showGray: showGray
35140 });
35141 const rb = /*#__PURE__*/React.createElement(ListBoxRadioButton, {
35142 label: lbl,
35143 checked: isSelected,
35144 dense: dense
35145 });
35146 const labelTag = typeof lbl === 'string' ? getValueField({
35147 lbl,
35148 color,
35149 highlighted: false
35150 }) : lbl;
35151 return /*#__PURE__*/React.createElement(FormControlLabel$1, {
35152 color: color,
35153 control: isSingleSelect ? rb : cb,
35154 className: classes.checkboxLabel,
35155 label: labelTag,
35156 key: qElemNumber
35157 });
35158 };
35159
35160 const label = cell ? cell.qText : '';
35161
35162 const getFrequencyText = () => {
35163 if (cell) {
35164 return cell.qFrequency ? cell.qFrequency : frequencyTextNone;
35165 }
35166
35167 return '';
35168 }; // Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
35169
35170
35171 const ranges = cell && cell.qHighlightRanges && cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
35172 const labels = getSegmentsFromRanges(label, ranges);
35173 const getField = checkboxes ? getCheckboxField : getValueField;
35174
35175 const getFieldWithRanges = _ref5 => {
35176 let {
35177 lbls
35178 } = _ref5;
35179 const labelsWithRanges = lbls.map((_ref6, ix) => {
35180 let [lbl, highlighted] = _ref6;
35181 return getValueField({
35182 ix,
35183 highlighted,
35184 lbl
35185 });
35186 });
35187 return checkboxes ? getCheckboxField({
35188 lbl: labelsWithRanges
35189 }) : labelsWithRanges;
35190 };
35191
35192 const iconStyles = {
35193 alignItems: 'center',
35194 display: 'flex'
35195 };
35196 const showLock = isSelected && isLocked;
35197 const showTick = !checkboxes && isSelected && !isLocked;
35198 const cellStyle = {
35199 display: 'flex',
35200 alignItems: 'center',
35201 minWidth: 0,
35202 flexGrow: 1,
35203 padding: checkboxes ? 0 : undefined
35204 };
35205
35206 const hasHistogramBar = () => cell && histogram && getFrequencyText() !== frequencyTextNone;
35207
35208 const getBarWidth = qFrequency => {
35209 const freqStr = String(qFrequency);
35210 const isPercent = freqStr.substring(freqStr.length - 1) === '%';
35211 const freq = parseFloat(isPercent ? freqStr : qFrequency);
35212 const rightSlice = checkboxes ? "(".concat(barWithCheckboxLeftPadPx, "px + ").concat(barPadPx + barBorderWidthPx * 2, "px)") : "".concat(barPadPx * 2 + barBorderWidthPx * 2, "px");
35213 const width = isPercent ? freq : freq / frequencyMax * 100;
35214 return "calc(".concat(width, "% - ").concat(rightSlice, ")");
35215 };
35216
35217 const isFirstElement = index === 0;
35218 return /*#__PURE__*/React.createElement("div", {
35219 className: classes.barContainer
35220 }, /*#__PURE__*/React.createElement(StyledGrid, {
35221 container: true,
35222 spacing: 0,
35223 className: joinClassNames(['value', ...classArr]),
35224 classes: {
35225 root: classes.fieldRoot
35226 },
35227 style: style,
35228 onClick: onClick,
35229 onMouseDown: onMouseDown,
35230 onMouseUp: onMouseUp,
35231 onMouseEnter: onMouseEnter,
35232 onKeyDown: handleKeyDownCallback,
35233 onContextMenu: preventContextMenu,
35234 role: column ? 'column' : 'row',
35235 tabIndex: isFirstElement && (!keyboard.enabled || keyboard.active) ? 0 : -1,
35236 "data-n": cell && cell.qElemNumber
35237 }, hasHistogramBar() && /*#__PURE__*/React.createElement("div", {
35238 className: joinClassNames([classes.bar, checkboxes && classes.barWithCheckbox, isSelected && (checkboxes ? classes.barSelectedWithCheckbox : classes.barSelected)]),
35239 style: {
35240 width: getBarWidth(cell.qFrequency)
35241 }
35242 }), /*#__PURE__*/React.createElement(StyledGrid, {
35243 item: true,
35244 style: cellStyle,
35245 className: joinClassNames([classes.cell, classes.selectedCell]),
35246 title: "".concat(label)
35247 }, ranges.length === 0 ? getField({
35248 lbl: label,
35249 color: 'inherit'
35250 }) : getFieldWithRanges({
35251 lbls: labels
35252 })), frequencyMode !== 'N' && /*#__PURE__*/React.createElement(StyledGrid, {
35253 item: true,
35254 style: {
35255 display: 'flex',
35256 alignItems: 'center'
35257 },
35258 className: classes.frequencyCount
35259 }, /*#__PURE__*/React.createElement(Typography$1, {
35260 noWrap: true,
35261 color: "inherit",
35262 variant: "body2",
35263 className: joinClassNames([dense && classes.labelDense, classes.labelText, showGray && excludedOrAlternative() && classes.excludedTextWithCheckbox])
35264 }, getFrequencyText())), (showLock || showTick) && /*#__PURE__*/React.createElement(StyledGrid, {
35265 item: true,
35266 className: classes.icon
35267 }, showLock && /*#__PURE__*/React.createElement(Lock, {
35268 style: iconStyles,
35269 size: "small"
35270 }), showTick && /*#__PURE__*/React.createElement(Tick, {
35271 style: iconStyles,
35272 size: "small"
35273 }))));
35274 }
35275
35276 const scrollBarThumb = '#BBB';
35277 const scrollBarThumbHover = '#555';
35278 const scrollBarBackground = '#f1f1f1';
35279 const useStyles$b = makeStyles$1(() => ({
35280 styledScrollbars: {
35281 scrollbarColor: "".concat(scrollBarThumb, " ").concat(scrollBarBackground),
35282 '&::-webkit-scrollbar': {
35283 width: 10,
35284 height: 10
35285 },
35286 '&::-webkit-scrollbar-track': {
35287 backgroundColor: scrollBarBackground
35288 },
35289 '&::-webkit-scrollbar-thumb': {
35290 backgroundColor: scrollBarThumb,
35291 borderRadius: '1rem'
35292 },
35293 '&::-webkit-scrollbar-thumb:hover': {
35294 backgroundColor: scrollBarThumbHover
35295 }
35296 }
35297 }));
35298
35299 function getSizeInfo(_ref) {
35300 let {
35301 isVertical,
35302 checkboxes,
35303 dense,
35304 height
35305 } = _ref;
35306 let sizeVertical = checkboxes ? 40 : 33;
35307
35308 if (dense) {
35309 sizeVertical = 20;
35310 }
35311
35312 const itemSize = isVertical ? sizeVertical : 200;
35313 const listHeight = height || 8 * itemSize;
35314 return {
35315 itemSize,
35316 listHeight
35317 };
35318 }
35319
35320 function ListBox(_ref2) {
35321 let {
35322 model,
35323 selections,
35324 direction,
35325 height,
35326 width,
35327 listLayout = 'vertical',
35328 frequencyMode = 'N',
35329 histogram = false,
35330 checkboxes = false,
35331 update = undefined,
35332 fetchStart = undefined,
35333 dense = false,
35334 keyboard = {},
35335 showGray = true,
35336 scrollState,
35337 sortByState,
35338 selectDisabled = () => false,
35339 setCount
35340 } = _ref2;
35341 const [layout] = useLayout$1(model);
35342 const isSingleSelect = !!(layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne);
35343 const [pages, setPages] = react.exports.useState(null);
35344 const [isLoadingData, setIsLoadingData] = react.exports.useState(false);
35345 const styles = useStyles$b();
35346 const {
35347 instantPages = [],
35348 interactionEvents,
35349 select
35350 } = useSelectionsInteractions({
35351 layout,
35352 selections,
35353 pages,
35354 checkboxes,
35355 selectDisabled,
35356 doc: document,
35357 isSingleSelect
35358 });
35359 const loaderRef = react.exports.useRef(null);
35360 const local = react.exports.useRef({
35361 queue: [],
35362 validPages: false
35363 });
35364 const listData = react.exports.useRef({
35365 pages: []
35366 });
35367 const isItemLoaded = react.exports.useCallback(index => {
35368 if (!pages || !local.current.validPages) {
35369 return false;
35370 }
35371
35372 local.current.checkIdx = index;
35373
35374 const isLoaded = p => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight;
35375
35376 const page = pages.filter(p => isLoaded(p))[0];
35377 return page && isLoaded(page);
35378 }, [layout, pages]); // The time from scroll end until new data is being fetched, may be exposed in API later on.
35379
35380 const scrollTimeout = 0;
35381 const loadMoreItems = react.exports.useCallback((startIndex, stopIndex) => {
35382 local.current.queue.push({
35383 start: startIndex,
35384 stop: stopIndex
35385 });
35386 const isScrolling = loaderRef.current ? loaderRef.current._listRef.state.isScrolling : false;
35387
35388 if (local.current.queue.length > 10) {
35389 local.current.queue.shift();
35390 }
35391
35392 clearTimeout(local.current.timeout);
35393 setIsLoadingData(true);
35394 return new Promise(resolve => {
35395 local.current.timeout = setTimeout(() => {
35396 const sorted = local.current.queue.slice(-2).sort((a, b) => a.start - b.start);
35397 const reqPromise = model.getListObjectData('/qListObjectDef', sorted.map(s => ({
35398 qTop: s.start,
35399 qHeight: s.stop - s.start + 1,
35400 qLeft: 0,
35401 qWidth: 1
35402 }))).then(p => {
35403 local.current.validPages = true;
35404 listData.current.pages = p;
35405 setPages(p);
35406 setIsLoadingData(false);
35407 resolve();
35408 });
35409 fetchStart && fetchStart(reqPromise);
35410 }, isScrolling ? scrollTimeout : 0);
35411 });
35412 }, [layout]);
35413
35414 const fetchData = () => {
35415 local.current.queue = [];
35416 local.current.validPages = false;
35417
35418 if (loaderRef.current) {
35419 loaderRef.current.resetloadMoreItemsCache(true); // Skip scrollToItem if we are in selections, or if we dont sort by state.
35420
35421 if (layout && layout.qSelectionInfo.qInSelections || sortByState === 0) {
35422 return;
35423 }
35424
35425 loaderRef.current._listRef.scrollToItem(0);
35426 }
35427 };
35428
35429 if (update) {
35430 // Hand over the update function for manual refresh from hosting application.
35431 update.call(null, fetchData);
35432 }
35433
35434 react.exports.useEffect(() => {
35435 fetchData();
35436
35437 if (typeof setCount === 'function' && layout) {
35438 setCount(layout.qListObject.qSize.qcy);
35439 }
35440 }, [layout]);
35441 react.exports.useEffect(() => {
35442 if (!instantPages || isLoadingData) {
35443 return;
35444 }
35445
35446 setPages(instantPages);
35447 }, [instantPages]);
35448 const [initScrollPosIsSet, setInitScrollPosIsSet] = react.exports.useState(false);
35449 react.exports.useEffect(() => {
35450 if (scrollState && !initScrollPosIsSet && loaderRef.current) {
35451 loaderRef.current._listRef.scrollToItem(scrollState.initScrollPos);
35452
35453 setInitScrollPosIsSet(true);
35454 }
35455 }, [loaderRef.current]);
35456
35457 if (!layout) {
35458 return null;
35459 }
35460
35461 const isVertical = listLayout !== 'horizontal';
35462 const count = layout.qListObject.qSize.qcy;
35463 const {
35464 itemSize,
35465 listHeight
35466 } = getSizeInfo({
35467 isVertical,
35468 checkboxes,
35469 dense,
35470 height
35471 });
35472 const isLocked = layout && layout.qListObject.qDimensionInfo.qLocked;
35473 const {
35474 frequencyMax
35475 } = layout;
35476 return /*#__PURE__*/React.createElement(InfiniteLoader, {
35477 isItemLoaded: isItemLoaded,
35478 itemCount: count,
35479 loadMoreItems: loadMoreItems,
35480 threshold: 0,
35481 minimumBatchSize: 100,
35482 ref: loaderRef
35483 }, _ref3 => {
35484 let {
35485 onItemsRendered,
35486 ref
35487 } = _ref3;
35488 local.current.listRef = ref;
35489 return /*#__PURE__*/React.createElement(FixedSizeList, {
35490 direction: direction,
35491 "data-testid": "fixed-size-list",
35492 useIsScrolling: true,
35493 style: {},
35494 height: listHeight,
35495 width: width,
35496 itemCount: count,
35497 layout: listLayout,
35498 className: styles.styledScrollbars,
35499 itemData: _objectSpread2(_objectSpread2({
35500 isLocked,
35501 column: !isVertical,
35502 pages
35503 }, isLocked || selectDisabled() ? {} : interactionEvents), {}, {
35504 checkboxes,
35505 dense,
35506 frequencyMode,
35507 isSingleSelect,
35508 actions: {
35509 select,
35510 confirm: () => selections && selections.confirm.call(selections),
35511 cancel: () => selections && selections.cancel.call(selections)
35512 },
35513 frequencyMax,
35514 histogram,
35515 keyboard,
35516 showGray
35517 }),
35518 itemSize: itemSize,
35519 onItemsRendered: renderProps => {
35520 if (scrollState) {
35521 scrollState.setScrollPos(renderProps.visibleStopIndex);
35522 }
35523
35524 onItemsRendered(_objectSpread2({}, renderProps));
35525 },
35526 ref: ref
35527 }, RowColumn);
35528 });
35529 }
35530
35531 const selectAll = props => _objectSpread2(_objectSpread2({}, props), {}, {
35532 shapes: [{
35533 type: 'path',
35534 attrs: {
35535 d: 'M15.4,9 C15.8,9 16,9.3 16,9.6 L16,15.4 C16,15.7 15.8,16 15.4,16 L9.6,16 C9.3,16 9,15.8 9,15.4 L9,9.6 C9,9.3 9.3,9 9.6,9 L15.4,9 Z M15,10 L10,10 L10,15 L15,15 L15,10 Z M6.5,0 C6.8,0 7,0.3 7,0.6 L7,6.4 C7,6.8 6.8,7 6.5,7 L0.6,7 C0.3,7 0,6.8 0,6.5 L0,0.6 C0,0.3 0.3,0 0.6,0 L6.5,0 Z M6,2.8 C6.3,2.5 6.3,2.1 6.1,1.8 C5.9,1.5 5.4,1.6 5.1,1.9 L3.1,3.9 L2.4,3.2 C2.1,2.9 1.7,2.9 1.4,3.1 C1.2,3.3 1.2,3.8 1.5,4.1 L2.7,5.3 C3,5.6 3.4,5.6 3.7,5.3 L3.8,5.3 L6,2.8 Z M6.5,9 C6.8,9 7,9.3 7,9.6 L7,15.4 C7,15.8 6.8,16 6.5,16 L0.6,16 C0.3,16 0,15.8 0,15.4 L0,9.6 C0,9.3 0.3,9 0.6,9 L6.5,9 Z M6,11.8 C6.3,11.5 6.3,11.1 6.1,10.8 C5.9,10.6 5.4,10.6 5.1,10.8 L3.1,12.8 L2.3,12 C2,11.7 1.6,11.7 1.3,12 C1.1,12.3 1.1,12.7 1.4,13 L2.6,14.2 C2.9,14.5 3.3,14.5 3.6,14.3 L3.7,14.2 L6,11.8 Z M15.4,0 C15.8,0 16,0.3 16,0.6 L16,6.4 C16,6.8 15.8,7 15.4,7 L9.6,7 C9.3,7 9,6.8 9,6.5 L9,0.6 C9,0.3 9.3,0 9.6,0 L15.4,0 Z M15,2.8 C15.3,2.5 15.3,2.1 15.1,1.8 C14.9,1.5 14.4,1.6 14.1,1.9 L12.1,3.9 L11.3,3.1 C11,2.8 10.6,2.8 10.3,3 C10,3.2 10.1,3.7 10.3,4 L11.5,5.2 C11.8,5.5 12.2,5.5 12.5,5.2 L15,2.8 Z'
35536 }
35537 }]
35538 });
35539
35540 const selectAlternative = props => _objectSpread2(_objectSpread2({}, props), {}, {
35541 shapes: [{
35542 type: 'path',
35543 attrs: {
35544 d: 'M6,15.5 C6,15.2238576 6.22385763,15 6.5,15 L9.5,15 C9.77614237,15 10,15.2238576 10,15.5 C10,15.7761424 9.77614237,16 9.5,16 L6.5,16 C6.22385763,16 6,15.7761424 6,15.5 Z M1,13.5 L1,14.5 C1,14.7761424 1.22385763,15 1.5,15 L2.5,15 C2.77614237,15 3,15.2238576 3,15.5 C3,15.7761424 2.77614237,16 2.5,16 L1,16 C0.44771525,16 6.76353751e-17,15.5522847 0,15 L0,13.5 C-3.38176876e-17,13.2238576 0.223857625,13 0.5,13 C0.776142375,13 1,13.2238576 1,13.5 Z M15,13.5 C15,13.2238576 15.2238576,13 15.5,13 C15.7761424,13 16,13.2238576 16,13.5 L16,15 C16,15.5522847 15.5522847,16 15,16 L13.5,16 C13.2238576,16 13,15.7761424 13,15.5 C13,15.2238576 13.2238576,15 13.5,15 L14.5,15 C14.7761424,15 15,14.7761424 15,14.5 L15,13.5 Z M1,6.5 L1,9.5 C1,9.77614237 0.776142375,10 0.5,10 C0.223857625,10 3.38176876e-17,9.77614237 0,9.5 L0,6.5 C-3.38176876e-17,6.22385763 0.223857625,6 0.5,6 C0.776142375,6 1,6.22385763 1,6.5 Z M16,6.5 L16,9.5 C16,9.77614237 15.7761424,10 15.5,10 C15.2238576,10 15,9.77614237 15,9.5 L15,6.5 C15,6.22385763 15.2238576,6 15.5,6 C15.7761424,6 16,6.22385763 16,6.5 Z M0,2.5 L0,1 C-6.76353751e-17,0.44771525 0.44771525,1.01453063e-16 1,0 L2.5,0 C2.77614237,-5.07265313e-17 3,0.223857625 3,0.5 C3,0.776142375 2.77614237,1 2.5,1 L1.5,1 C1.22385763,1 1,1.22385763 1,1.5 L1,2.5 C1,2.77614237 0.776142375,3 0.5,3 C0.223857625,3 3.38176876e-17,2.77614237 0,2.5 Z M6,0.5 C6,0.223857625 6.22385763,5.07265313e-17 6.5,0 L9.5,0 C9.77614237,-5.07265313e-17 10,0.223857625 10,0.5 C10,0.776142375 9.77614237,1 9.5,1 L6.5,1 C6.22385763,1 6,0.776142375 6,0.5 Z M15,2.5 L15,1.5 C15,1.22385763 14.7761424,1 14.5,1 L13.5,1 C13.2238576,1 13,0.776142375 13,0.5 C13,0.223857625 13.2238576,5.07265313e-17 13.5,0 L15,0 C15.5522847,-1.01453063e-16 16,0.44771525 16,1 L16,2.5 C16,2.77614237 15.7761424,3 15.5,3 C15.2238576,3 15,2.77614237 15,2.5 Z M4,4 L4,12 L12,4 L4,4 Z M4,3 L12,3 C12.5522847,3 13,3.44771525 13,4 L13,12 C13,12.5522847 12.5522847,13 12,13 L4,13 C3.44771525,13 3,12.5522847 3,12 L3,4 C3,3.44771525 3.44771525,3 4,3 Z'
35545 }
35546 }]
35547 });
35548
35549 const selectPossible = props => _objectSpread2(_objectSpread2({}, props), {}, {
35550 shapes: [{
35551 type: 'path',
35552 attrs: {
35553 d: 'M6,15.5 C6,15.2238576 6.22385763,15 6.5,15 L9.5,15 C9.77614237,15 10,15.2238576 10,15.5 C10,15.7761424 9.77614237,16 9.5,16 L6.5,16 C6.22385763,16 6,15.7761424 6,15.5 Z M1,13.5 L1,14.5 C1,14.7761424 1.22385763,15 1.5,15 L2.5,15 C2.77614237,15 3,15.2238576 3,15.5 C3,15.7761424 2.77614237,16 2.5,16 L1,16 C0.44771525,16 6.76353751e-17,15.5522847 0,15 L0,13.5 C-3.38176876e-17,13.2238576 0.223857625,13 0.5,13 C0.776142375,13 1,13.2238576 1,13.5 Z M15,13.5 C15,13.2238576 15.2238576,13 15.5,13 C15.7761424,13 16,13.2238576 16,13.5 L16,15 C16,15.5522847 15.5522847,16 15,16 L13.5,16 C13.2238576,16 13,15.7761424 13,15.5 C13,15.2238576 13.2238576,15 13.5,15 L14.5,15 C14.7761424,15 15,14.7761424 15,14.5 L15,13.5 Z M1,6.5 L1,9.5 C1,9.77614237 0.776142375,10 0.5,10 C0.223857625,10 3.38176876e-17,9.77614237 0,9.5 L0,6.5 C-3.38176876e-17,6.22385763 0.223857625,6 0.5,6 C0.776142375,6 1,6.22385763 1,6.5 Z M16,6.5 L16,9.5 C16,9.77614237 15.7761424,10 15.5,10 C15.2238576,10 15,9.77614237 15,9.5 L15,6.5 C15,6.22385763 15.2238576,6 15.5,6 C15.7761424,6 16,6.22385763 16,6.5 Z M0,2.5 L0,1 C-6.76353751e-17,0.44771525 0.44771525,1.01453063e-16 1,0 L2.5,0 C2.77614237,-5.07265313e-17 3,0.223857625 3,0.5 C3,0.776142375 2.77614237,1 2.5,1 L1.5,1 C1.22385763,1 1,1.22385763 1,1.5 L1,2.5 C1,2.77614237 0.776142375,3 0.5,3 C0.223857625,3 3.38176876e-17,2.77614237 0,2.5 Z M6,0.5 C6,0.223857625 6.22385763,5.07265313e-17 6.5,0 L9.5,0 C9.77614237,-5.07265313e-17 10,0.223857625 10,0.5 C10,0.776142375 9.77614237,1 9.5,1 L6.5,1 C6.22385763,1 6,0.776142375 6,0.5 Z M15,2.5 L15,1.5 C15,1.22385763 14.7761424,1 14.5,1 L13.5,1 C13.2238576,1 13,0.776142375 13,0.5 C13,0.223857625 13.2238576,5.07265313e-17 13.5,0 L15,0 C15.5522847,-1.01453063e-16 16,0.44771525 16,1 L16,2.5 C16,2.77614237 15.7761424,3 15.5,3 C15.2238576,3 15,2.77614237 15,2.5 Z M4,4 L4,12 L12,12 L12,4 L4,4 Z M4,3 L12,3 C12.5522847,3 13,3.44771525 13,4 L13,12 C13,12.5522847 12.5522847,13 12,13 L4,13 C3.44771525,13 3,12.5522847 3,12 L3,4 C3,3.44771525 3.44771525,3 4,3 Z'
35554 }
35555 }]
35556 });
35557
35558 const selectExcluded = props => _objectSpread2(_objectSpread2({}, props), {}, {
35559 shapes: [{
35560 type: 'path',
35561 attrs: {
35562 d: 'M6,15.5 C6,15.2238576 6.22385763,15 6.5,15 L9.5,15 C9.77614237,15 10,15.2238576 10,15.5 C10,15.7761424 9.77614237,16 9.5,16 L6.5,16 C6.22385763,16 6,15.7761424 6,15.5 Z M1,13.5 L1,14.5 C1,14.7761424 1.22385763,15 1.5,15 L2.5,15 C2.77614237,15 3,15.2238576 3,15.5 C3,15.7761424 2.77614237,16 2.5,16 L1,16 C0.44771525,16 6.76353751e-17,15.5522847 0,15 L0,13.5 C-3.38176876e-17,13.2238576 0.223857625,13 0.5,13 C0.776142375,13 1,13.2238576 1,13.5 Z M15,13.5 C15,13.2238576 15.2238576,13 15.5,13 C15.7761424,13 16,13.2238576 16,13.5 L16,15 C16,15.5522847 15.5522847,16 15,16 L13.5,16 C13.2238576,16 13,15.7761424 13,15.5 C13,15.2238576 13.2238576,15 13.5,15 L14.5,15 C14.7761424,15 15,14.7761424 15,14.5 L15,13.5 Z M1,6.5 L1,9.5 C1,9.77614237 0.776142375,10 0.5,10 C0.223857625,10 3.38176876e-17,9.77614237 0,9.5 L0,6.5 C-3.38176876e-17,6.22385763 0.223857625,6 0.5,6 C0.776142375,6 1,6.22385763 1,6.5 Z M16,6.5 L16,9.5 C16,9.77614237 15.7761424,10 15.5,10 C15.2238576,10 15,9.77614237 15,9.5 L15,6.5 C15,6.22385763 15.2238576,6 15.5,6 C15.7761424,6 16,6.22385763 16,6.5 Z M0,2.5 L0,1 C-6.76353751e-17,0.44771525 0.44771525,1.01453063e-16 1,0 L2.5,0 C2.77614237,-5.07265313e-17 3,0.223857625 3,0.5 C3,0.776142375 2.77614237,1 2.5,1 L1.5,1 C1.22385763,1 1,1.22385763 1,1.5 L1,2.5 C1,2.77614237 0.776142375,3 0.5,3 C0.223857625,3 3.38176876e-17,2.77614237 0,2.5 Z M6,0.5 C6,0.223857625 6.22385763,5.07265313e-17 6.5,0 L9.5,0 C9.77614237,-5.07265313e-17 10,0.223857625 10,0.5 C10,0.776142375 9.77614237,1 9.5,1 L6.5,1 C6.22385763,1 6,0.776142375 6,0.5 Z M15,2.5 L15,1.5 C15,1.22385763 14.7761424,1 14.5,1 L13.5,1 C13.2238576,1 13,0.776142375 13,0.5 C13,0.223857625 13.2238576,5.07265313e-17 13.5,0 L15,0 C15.5522847,-1.01453063e-16 16,0.44771525 16,1 L16,2.5 C16,2.77614237 15.7761424,3 15.5,3 C15.2238576,3 15,2.77614237 15,2.5 Z M4,3 L12,3 C12.5522847,3 13,3.44771525 13,4 L13,12 C13,12.5522847 12.5522847,13 12,13 L4,13 C3.44771525,13 3,12.5522847 3,12 L3,4 C3,3.44771525 3.44771525,3 4,3 Z'
35563 }
35564 }]
35565 });
35566
35567 var createListboxSelectionToolbar = (_ref => {
35568 let {
35569 layout,
35570 model,
35571 translator
35572 } = _ref;
35573
35574 if (layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne) {
35575 return [];
35576 }
35577
35578 const canSelectAll = () => ['qOption', 'qAlternative', 'qExcluded', 'qDeselected'].some(sc => layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0);
35579
35580 const canSelectPossible = () => ['qOption'].some(sc => layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0);
35581
35582 const canSelectAlternative = () => ['qAlternative'].some(sc => layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0);
35583
35584 const canSelectExcluded = () => ['qAlternative', 'qExcluded'].some(sc => layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0);
35585
35586 return [{
35587 key: 'selectAll',
35588 type: 'menu-icon-button',
35589 label: translator.get('Selection.SelectAll'),
35590 getSvgIconShape: selectAll,
35591 enabled: canSelectAll,
35592 action: () => {
35593 model.selectListObjectAll('/qListObjectDef');
35594 }
35595 }, {
35596 key: 'selectPossible',
35597 type: 'menu-icon-button',
35598 label: translator.get('Selection.SelectPossible'),
35599 getSvgIconShape: selectPossible,
35600 enabled: canSelectPossible,
35601 action: () => {
35602 model.selectListObjectPossible('/qListObjectDef');
35603 }
35604 }, {
35605 key: 'selectAlternative',
35606 type: 'menu-icon-button',
35607 label: translator.get('Selection.SelectAlternative'),
35608 getSvgIconShape: selectAlternative,
35609 enabled: canSelectAlternative,
35610 action: () => {
35611 model.selectListObjectAlternative('/qListObjectDef');
35612 }
35613 }, {
35614 key: 'selectExcluded',
35615 type: 'menu-icon-button',
35616 label: translator.get('Selection.SelectExcluded'),
35617 getSvgIconShape: selectExcluded,
35618 enabled: canSelectExcluded,
35619 action: () => {
35620 model.selectListObjectExcluded('/qListObjectDef');
35621 }
35622 }];
35623 });
35624
35625 const more = props => _objectSpread2(_objectSpread2({}, props), {}, {
35626 shapes: [{
35627 type: 'path',
35628 attrs: {
35629 d: 'M2,6.5 L3,6.5 C3.55228475,6.5 4,6.94771525 4,7.5 L4,8.5 C4,9.05228475 3.55228475,9.5 3,9.5 L2,9.5 C1.44771525,9.5 1,9.05228475 1,8.5 L1,7.5 C1,6.94771525 1.44771525,6.5 2,6.5 Z M7.5,6.5 L8.5,6.5 C9.05228475,6.5 9.5,6.94771525 9.5,7.5 L9.5,8.5 C9.5,9.05228475 9.05228475,9.5 8.5,9.5 L7.5,9.5 C6.94771525,9.5 6.5,9.05228475 6.5,8.5 L6.5,7.5 C6.5,6.94771525 6.94771525,6.5 7.5,6.5 Z M13,6.5 L14,6.5 C14.5522847,6.5 15,6.94771525 15,7.5 L15,8.5 C15,9.05228475 14.5522847,9.5 14,9.5 L13,9.5 C12.4477153,9.5 12,9.05228475 12,8.5 L12,7.5 C12,6.94771525 12.4477153,6.5 13,6.5 Z'
35630 }
35631 }]
35632 });
35633
35634 function useActionState(item) {
35635 const theme = useTheme$2();
35636 const disabled = typeof item.enabled === 'function' ? !item.enabled() : !!item.disabled;
35637 const hasSvgIconShape = typeof item.getSvgIconShape === 'function';
35638 return {
35639 hidden: item.hidden === true,
35640 disabled,
35641 style: {
35642 backgroundColor: item.active ? theme.palette.btn.active : undefined
35643 },
35644 hasSvgIconShape
35645 };
35646 }
35647
35648 /**
35649 * @interface
35650 * @extends HTMLElement
35651 * @since 2.0.0
35652 */
35653
35654 const ActionElement = {
35655 /** @type {'njs-cell-action'} */
35656 className: 'njs-cell-action'
35657 };
35658 const Item = React.forwardRef((_ref, ref) => {
35659 let {
35660 item,
35661 addAnchor = false
35662 } = _ref;
35663 const theme = useTheme$2();
35664 const {
35665 hidden,
35666 disabled,
35667 style,
35668 hasSvgIconShape
35669 } = useActionState(item);
35670 if (hidden) return null;
35671 const handleKeyDown = item.keyboardAction ? e => ['Enter', ' ', 'Spacebar'].includes(e.key) && item.keyboardAction() : null;
35672 return /*#__PURE__*/React.createElement(IconButton$1, {
35673 ref: !addAnchor ? ref : null,
35674 title: item.label,
35675 onClick: item.action,
35676 onKeyDown: handleKeyDown,
35677 disabled: disabled,
35678 style: style,
35679 className: ActionElement.className
35680 }, hasSvgIconShape && SvgIcon(item.getSvgIconShape()), addAnchor && /*#__PURE__*/React.createElement("div", {
35681 ref: ref,
35682 style: {
35683 bottom: -theme.spacing(0.5),
35684 right: 0,
35685 position: 'absolute',
35686 width: '100%',
35687 height: 0
35688 }
35689 }));
35690 });
35691
35692 const close = props => _objectSpread2(_objectSpread2({}, props), {}, {
35693 shapes: [{
35694 type: 'path',
35695 attrs: {
35696 d: 'M9.34535242,8 L13.3273238,11.9819714 C13.6988326,12.3534802 13.6988326,12.955815 13.3273238,13.3273238 C12.955815,13.6988326 12.3534802,13.6988326 11.9819714,13.3273238 L8,9.34535242 L4.01802863,13.3273238 C3.64651982,13.6988326 3.04418502,13.6988326 2.67267621,13.3273238 C2.3011674,12.955815 2.3011674,12.3534802 2.67267621,11.9819714 L6.65464758,8 L2.67267621,4.01802863 C2.3011674,3.64651982 2.3011674,3.04418502 2.67267621,2.67267621 C3.04418502,2.3011674 3.64651982,2.3011674 4.01802863,2.67267621 L8,6.65464758 L11.9819714,2.67267621 C12.3534802,2.3011674 12.955815,2.3011674 13.3273238,2.67267621 C13.6988326,3.04418502 13.6988326,3.64651982 13.3273238,4.01802863 L9.34535242,8 Z'
35697 }
35698 }]
35699 });
35700
35701 const clearSelections = props => _objectSpread2(_objectSpread2({}, props), {}, {
35702 shapes: [{
35703 type: 'path',
35704 attrs: {
35705 d: 'M6,15.5 L6,15.5 C6,15.2238576 6.22385763,15 6.5,15 L9.5,15 C9.77614237,15 10,15.2238576 10,15.5 L10,15.5 C10,15.7761424 9.77614237,16 9.5,16 L6.5,16 C6.22385763,16 6,15.7761424 6,15.5 Z M1,13.5 L1,14.5 C1,14.7761424 1.22385763,15 1.5,15 L2.5,15 C2.77614237,15 3,15.2238576 3,15.5 L3,15.5 C3,15.7761424 2.77614237,16 2.5,16 L1,16 C0.44771525,16 6.76353751e-17,15.5522847 0,15 L0,13.5 C-3.38176876e-17,13.2238576 0.223857625,13 0.5,13 L0.5,13 C0.776142375,13 1,13.2238576 1,13.5 Z M1,6.5 L1,9.5 C1,9.77614237 0.776142375,10 0.5,10 L0.5,10 C0.223857625,10 3.38176876e-17,9.77614237 0,9.5 L0,6.5 C-3.38176876e-17,6.22385763 0.223857625,6 0.5,6 L0.5,6 C0.776142375,6 1,6.22385763 1,6.5 Z M0,2.5 L0,1 C-6.76353751e-17,0.44771525 0.44771525,1.01453063e-16 1,0 L2.5,0 C2.77614237,-5.07265313e-17 3,0.223857625 3,0.5 L3,0.5 C3,0.776142375 2.77614237,1 2.5,1 L1.5,1 C1.22385763,1 1,1.22385763 1,1.5 L1,2.5 C1,2.77614237 0.776142375,3 0.5,3 L0.5,3 C0.223857625,3 3.38176876e-17,2.77614237 0,2.5 Z M6,0.5 L6,0.5 C6,0.223857625 6.22385763,5.07265313e-17 6.5,0 L9.5,0 C9.77614237,-5.07265313e-17 10,0.223857625 10,0.5 L10,0.5 C10,0.776142375 9.77614237,1 9.5,1 L6.5,1 C6.22385763,1 6,0.776142375 6,0.5 Z M15,2.5 L15,1.5 C15,1.22385763 14.7761424,1 14.5,1 L13.5,1 C13.2238576,1 13,0.776142375 13,0.5 L13,0.5 C13,0.223857625 13.2238576,5.07265313e-17 13.5,0 L15,0 C15.5522847,-1.01453063e-16 16,0.44771525 16,1 L16,2.5 C16,2.77614237 15.7761424,3 15.5,3 L15.5,3 C15.2238576,3 15,2.77614237 15,2.5 Z M9.1661442,6.1661442 C10.7210031,4.61128527 13.2789969,4.61128527 14.8338558,6.1661442 C16.3887147,7.72100313 16.3887147,10.2789969 14.8338558,11.8338558 C13.2789969,13.3887147 10.7210031,13.3887147 9.1661442,11.8338558 C7.61128527,10.2789969 7.61128527,7.77115987 9.1661442,6.1661442 Z M14.1316614,7.72100313 C14.3322884,7.52037618 14.3824451,7.169279 14.1316614,6.9184953 C13.8808777,6.6677116 13.5297806,6.71786834 13.3291536,6.9184953 L12.0250784,8.22257053 L10.7210031,6.9184953 C10.5203762,6.6677116 10.1191223,6.6677116 9.9184953,6.9184953 C9.6677116,7.11912226 9.6677116,7.52037618 9.9184953,7.72100313 L11.2225705,9.02507837 L9.9184953,10.3291536 C9.6677116,10.5297806 9.6677116,10.8808777 9.9184953,11.1316614 C10.169279,11.3824451 10.5203762,11.3824451 10.7210031,11.1316614 L12.0250784,9.82758621 L13.3291536,11.1316614 C13.5297806,11.3824451 13.8808777,11.3824451 14.1316614,11.1316614 C14.3322884,10.9310345 14.3824451,10.5297806 14.1316614,10.3291536 L12.8275862,9.02507837 L14.1316614,7.72100313 Z'
35706 }
35707 }]
35708 });
35709
35710 var ClearSelections = (props => SvgIcon(clearSelections(props)));
35711
35712 function useDefaultSelectionActions(_ref) {
35713 let {
35714 api,
35715 onConfirm = () => {},
35716 onCancel = () => {},
35717 onKeyDeactivate = () => {}
35718 } = _ref;
35719 const {
35720 translator
35721 } = react.exports.useContext(InstanceContext);
35722 return [{
35723 key: 'clear',
35724 type: 'icon-button',
35725 label: translator.get('Selection.Clear'),
35726 enabled: () => api.canClear(),
35727 action: () => api.clear(),
35728 getSvgIconShape: clearSelections
35729 }, {
35730 key: 'cancel',
35731 type: 'icon-button',
35732 label: translator.get('Selection.Cancel'),
35733 enabled: () => api.canCancel(),
35734 action: () => {
35735 onCancel();
35736 api.cancel();
35737 },
35738 keyboardAction: e => {
35739 onKeyDeactivate(e);
35740 onCancel();
35741 api.cancel();
35742 },
35743 getSvgIconShape: close
35744 }, {
35745 key: 'confirm',
35746 type: 'icon-button',
35747 label: translator.get('Selection.Confirm'),
35748 enabled: () => api.canConfirm(),
35749 action: () => {
35750 onConfirm();
35751 api.confirm();
35752 },
35753 keyboardAction: e => {
35754 onKeyDeactivate(e);
35755 onConfirm();
35756 api.confirm();
35757 },
35758 getSvgIconShape: tick
35759 }];
35760 }
35761
35762 const useStyles$a = makeStyles(theme => ({
35763 icon: {
35764 color: theme.palette.text.primary
35765 }
35766 }));
35767
35768 function MoreItem(_ref) {
35769 let {
35770 item,
35771 onActionClick = () => {}
35772 } = _ref;
35773 const {
35774 hidden,
35775 disabled,
35776 hasSvgIconShape
35777 } = useActionState(item);
35778 const {
35779 icon
35780 } = useStyles$a();
35781
35782 const handleClick = () => {
35783 item.action();
35784 onActionClick();
35785 };
35786
35787 return !hidden ? /*#__PURE__*/React.createElement(MenuItem$1, {
35788 title: item.label,
35789 onClick: handleClick,
35790 disabled: disabled
35791 }, hasSvgIconShape && /*#__PURE__*/React.createElement(ListItemIcon$1, {
35792 className: icon
35793 }, SvgIcon(item.getSvgIconShape())), /*#__PURE__*/React.createElement(Typography$1, {
35794 noWrap: true
35795 }, item.label)) : null;
35796 }
35797
35798 const More$1 = React.forwardRef((_ref2, ref) => {
35799 let {
35800 actions = [],
35801 show = true,
35802 alignTo,
35803 popoverProps = {},
35804 popoverPaperStyle = {},
35805 onCloseOrActionClick = () => {}
35806 } = _ref2;
35807 const showActions = actions.length > 0;
35808 return showActions && /*#__PURE__*/React.createElement(Popover$1 // eslint-disable-next-line react/jsx-props-no-spreading
35809 , _extends$b({}, popoverProps, {
35810 onClose: onCloseOrActionClick,
35811 ref: ref,
35812 open: show,
35813 anchorEl: alignTo.current,
35814 getContentAnchorEl: null,
35815 container: alignTo.current,
35816 disablePortal: true,
35817 hideBackdrop: true,
35818 style: {
35819 pointerEvents: 'none'
35820 },
35821 transitionDuration: 0,
35822 anchorOrigin: {
35823 vertical: 'bottom',
35824 horizontal: 'right'
35825 },
35826 transformOrigin: {
35827 vertical: 'top',
35828 horizontal: 'right'
35829 },
35830 PaperProps: {
35831 style: _objectSpread2({
35832 pointerEvents: 'auto',
35833 maxWidth: '250px'
35834 }, popoverPaperStyle)
35835 }
35836 }), /*#__PURE__*/React.createElement(MenuList, null, actions.map((item, ix) =>
35837 /*#__PURE__*/
35838 // eslint-disable-next-line react/no-array-index-key
35839 React.createElement(MoreItem, {
35840 key: ix,
35841 item: item,
35842 onActionClick: onCloseOrActionClick
35843 }))));
35844 });
35845
35846 /**
35847 * @interface
35848 * @extends HTMLElement
35849 * @since 2.1.0
35850 */
35851
35852 const ActionToolbarElement = {
35853 /** @type {'njs-action-toolbar-popover'} */
35854 className: 'njs-action-toolbar-popover'
35855 };
35856 const useStyles$9 = makeStyles(theme => ({
35857 itemSpacing: {
35858 padding: theme.spacing(0, 0.5)
35859 },
35860 firstItemSpacing: {
35861 padding: theme.spacing(0, 0.5, 0, 0)
35862 },
35863 lastItemSpacing: {
35864 padding: theme.spacing(0, 0, 0, 0.5)
35865 }
35866 }));
35867 const ActionsGroup = React.forwardRef((_ref, ref) => {
35868 let {
35869 actions = [],
35870 first = false,
35871 last = false,
35872 addAnchor = false
35873 } = _ref;
35874 const {
35875 itemSpacing,
35876 firstItemSpacing,
35877 lastItemSpacing
35878 } = useStyles$9();
35879 return actions.length > 0 ? /*#__PURE__*/React.createElement(StyledGrid, {
35880 item: true,
35881 container: true,
35882 spacing: 0,
35883 wrap: "nowrap"
35884 }, actions.map((e, ix) => {
35885 let cls = [];
35886 const isFirstItem = first && ix === 0;
35887 const isLastItem = last && actions.length - 1 === ix;
35888
35889 if (isFirstItem && !isLastItem) {
35890 cls = [firstItemSpacing];
35891 }
35892
35893 if (isLastItem && !isFirstItem) {
35894 cls = [...cls, lastItemSpacing];
35895 }
35896
35897 if (!isFirstItem && !isLastItem && cls.length === 0) {
35898 cls = [itemSpacing];
35899 }
35900
35901 return /*#__PURE__*/React.createElement(StyledGrid, {
35902 item: true,
35903 key: e.key,
35904 className: cls.join(' ').trim()
35905 }, /*#__PURE__*/React.createElement(Item, {
35906 key: e.key,
35907 item: e,
35908 ref: ix === 0 ? ref : null,
35909 addAnchor: addAnchor
35910 }));
35911 })) : null;
35912 });
35913 const popoverStyle = {
35914 pointerEvents: 'none'
35915 };
35916 const popoverAnchorOrigin = {
35917 vertical: 'top',
35918 horizontal: 'right'
35919 };
35920 const popoverTransformOrigin = {
35921 vertical: 'bottom',
35922 horizontal: 'right'
35923 };
35924
35925 function ActionsToolbar(_ref2) {
35926 let {
35927 show = true,
35928 actions = [],
35929 maxItems = 3,
35930 selections = {
35931 show: false,
35932 api: null,
35933 onConfirm: () => {},
35934 onCancel: () => {}
35935 },
35936 more: more$1 = {
35937 enabled: false,
35938 actions: [],
35939 alignTo: null,
35940 popoverProps: {},
35941 popoverPaperStyle: {}
35942 },
35943 popover = {
35944 show: false,
35945 anchorEl: null
35946 },
35947 focusHandler = null,
35948 actionsRefMock = null // for testing
35949
35950 } = _ref2;
35951 const defaultSelectionActions = useDefaultSelectionActions(selections);
35952 const {
35953 itemSpacing
35954 } = useStyles$9();
35955 const {
35956 translator,
35957 keyboardNavigation
35958 } = react.exports.useContext(InstanceContext);
35959 const [showMoreItems, setShowMoreItems] = react.exports.useState(false);
35960 const [moreEnabled, setMoreEnabled] = react.exports.useState(more$1.enabled);
35961 const [moreActions, setMoreActions] = react.exports.useState(more$1.actions);
35962 const [moreAlignTo, setMoreAlignTo] = react.exports.useState(more$1.alignTo);
35963 const moreRef = react.exports.useRef();
35964 const actionsRef = react.exports.useRef();
35965 const theme = useTheme$2();
35966 const dividerStyle = react.exports.useMemo(() => ({
35967 margin: theme.spacing(0.5, 0)
35968 }));
35969
35970 const getEnabledButton = last => {
35971 const actionsElement = actionsRef.current || actionsRefMock;
35972 if (!actionsElement) return null;
35973 const buttons = actionsElement.querySelectorAll('button:not(.Mui-disabled)');
35974 return buttons[last ? buttons.length - 1 : 0];
35975 };
35976
35977 react.exports.useEffect(() => () => setShowMoreItems(false), [popover.show]);
35978 react.exports.useEffect(() => {
35979 setMoreEnabled(more$1.enabled);
35980 }, [more$1.enabled]);
35981 react.exports.useEffect(() => {
35982 if (!focusHandler) return;
35983
35984 const focusFirst = () => {
35985 const enabledButton = getEnabledButton(false);
35986 enabledButton && enabledButton.focus();
35987 };
35988
35989 const focusLast = () => {
35990 const enabledButton = getEnabledButton(true);
35991 enabledButton && enabledButton.focus();
35992 };
35993
35994 focusHandler.on('focus_toolbar_first', focusFirst);
35995 focusHandler.on('focus_toolbar_last', focusLast);
35996 }, []);
35997 const newActions = react.exports.useMemo(() => actions.filter(a => !a.hidden), [actions]);
35998 if (!selections.show && newActions.length === 0) return null;
35999
36000 const handleCloseShowMoreItems = () => {
36001 setShowMoreItems(false);
36002 };
36003
36004 const moreItem = {
36005 key: 'more',
36006 label: translator.get('Menu.More'),
36007 // TODO: Add translation
36008 getSvgIconShape: more,
36009 hidden: false,
36010 enabled: () => moreEnabled,
36011 action: () => setShowMoreItems(!showMoreItems)
36012 };
36013
36014 if (newActions.length > maxItems) {
36015 const newMoreActions = newActions.splice(-(newActions.length - maxItems) - 1);
36016 setMoreEnabled(true);
36017 setMoreActions([...newMoreActions, ...more$1.actions]);
36018 setMoreAlignTo(moreRef);
36019 }
36020
36021 const tabCallback = // if keyboardNavigation is true, create a callback to handle tabbing from the first/last button in the toolbar that resets focus on the content
36022 keyboardNavigation && focusHandler && focusHandler.refocusContent ? evt => {
36023 if (evt.key !== 'Tab') return;
36024 const isTabbingOut = evt.shiftKey && getEnabledButton(false) === evt.target || !evt.shiftKey && getEnabledButton(true) === evt.target;
36025
36026 if (isTabbingOut) {
36027 evt.preventDefault();
36028 evt.stopPropagation();
36029 focusHandler.refocusContent();
36030 }
36031 } : null;
36032 const showActions = newActions.length > 0;
36033 const showMore = moreActions.length > 0;
36034 const showDivider = showActions && selections.show || showMore && selections.show;
36035 const Actions = /*#__PURE__*/React.createElement(StyledGrid, {
36036 ref: actionsRef,
36037 onKeyDown: tabCallback,
36038 container: true,
36039 spacing: 0,
36040 wrap: "nowrap"
36041 }, showActions && /*#__PURE__*/React.createElement(ActionsGroup, {
36042 actions: newActions,
36043 first: true,
36044 last: !showMore && !selections.show
36045 }), showMore && /*#__PURE__*/React.createElement(ActionsGroup, {
36046 ref: moreRef,
36047 actions: [moreItem],
36048 first: !showActions,
36049 last: !selections.show,
36050 addAnchor: true
36051 }), showDivider && /*#__PURE__*/React.createElement(StyledGrid, {
36052 item: true,
36053 className: itemSpacing,
36054 style: dividerStyle
36055 }, /*#__PURE__*/React.createElement(Divider$1, {
36056 orientation: "vertical"
36057 })), selections.show && /*#__PURE__*/React.createElement(ActionsGroup, {
36058 actions: defaultSelectionActions,
36059 first: !showActions && !showMore,
36060 last: true
36061 }), showMoreItems && /*#__PURE__*/React.createElement(More$1, {
36062 show: showMoreItems,
36063 actions: moreActions,
36064 alignTo: moreAlignTo,
36065 popoverProps: more$1.popoverProps,
36066 popoverPaperStyle: more$1.popoverPaperStyle,
36067 onCloseOrActionClick: handleCloseShowMoreItems
36068 }));
36069 return popover.show ? /*#__PURE__*/React.createElement(Popover$1, {
36070 disableEnforceFocus: true,
36071 disableAutoFocus: true,
36072 disableRestoreFocus: true,
36073 open: popover.show,
36074 anchorEl: popover.anchorEl,
36075 anchorOrigin: popoverAnchorOrigin,
36076 transformOrigin: popoverTransformOrigin,
36077 hideBackdrop: true,
36078 style: popoverStyle,
36079 PaperProps: {
36080 className: ActionToolbarElement.className,
36081 style: {
36082 pointerEvents: 'auto',
36083 padding: theme.spacing(1, 1)
36084 }
36085 }
36086 }, Actions) : show && Actions;
36087 }
36088
36089 const search = props => _objectSpread2(_objectSpread2({}, props), {}, {
36090 shapes: [{
36091 type: 'path',
36092 attrs: {
36093 d: 'M15.7873809,13.80959 C16.1870614,14.209868 15.9872212,15.1104934 15.4876205,15.5107714 C15.08794,15.9110493 14.1886588,16.2112578 13.7889782,15.8109798 L11.0911347,13.1091035 L10.9912145,12.5086866 L10.2917736,11.8082001 C9.19265216,12.5086866 7.89369045,13.0090341 6.49480859,13.0090341 C2.89768383,13.0090341 0,10.1070188 0,6.50451703 C0,2.90201529 2.89768383,0 6.49480859,0 C10.0919334,0 12.9896172,2.90201529 12.9896172,6.50451703 C12.9896172,7.90548992 12.4900165,9.20639333 11.7905756,10.3071577 L12.4900165,11.0076442 L13.0895373,11.1077137 L15.7873809,13.80959 Z M11.2909749,6.50451703 C11.2909749,5.20361362 10.7913743,4.00277971 9.89209309,3.00208478 C8.9928119,2.10145935 7.79377031,1.60111188 6.49480859,1.60111188 C5.19584688,1.60111188 3.99680529,2.10145935 2.99760397,3.00208478 C2.09832278,4.00277971 1.59872212,5.20361362 1.59872212,6.50451703 C1.59872212,7.80542043 2.09832278,9.00625434 2.99760397,9.90687978 C3.89688516,10.8075052 5.09592674,11.3078527 6.49480859,11.3078527 C7.79377031,11.4079222 8.9928119,10.9075747 9.89209309,9.90687978 C10.7913743,9.00625434 11.2909749,7.80542043 11.2909749,6.50451703 Z'
36094 }
36095 }]
36096 });
36097
36098 var SearchIcon = (props => SvgIcon(search(props)));
36099
36100 const useStyles$8 = makeStyles$1(theme => ({
36101 root: {
36102 border: 'none',
36103 borderRadius: 0,
36104 '& fieldset': {
36105 border: "1px solid ".concat(theme.palette.divider),
36106 borderWidth: '1px 0 1px 0',
36107 borderRadius: 0
36108 },
36109 '&:hover': {
36110 border: 'none'
36111 }
36112 },
36113 dense: {
36114 fontSize: 12,
36115 paddingLeft: theme.spacing(1),
36116 '& input': {
36117 paddingTop: '5px',
36118 paddingBottom: '5px'
36119 }
36120 }
36121 }));
36122 const TREE_PATH = '/qListObjectDef';
36123 function ListBoxSearch(_ref) {
36124 let {
36125 model,
36126 keyboard,
36127 dense = false
36128 } = _ref;
36129 const {
36130 translator
36131 } = react.exports.useContext(InstanceContext);
36132 const [value, setValue] = react.exports.useState('');
36133
36134 const onChange = e => {
36135 setValue(e.target.value);
36136 model.searchListObjectFor(TREE_PATH, e.target.value);
36137 };
36138
36139 const onKeyDown = e => {
36140 switch (e.key) {
36141 case 'Enter':
36142 model.acceptListObjectSearch(TREE_PATH, true);
36143 setValue('');
36144 break;
36145
36146 case 'Escape':
36147 model.abortListObjectSearch(TREE_PATH);
36148 break;
36149 }
36150 };
36151
36152 const classes = useStyles$8();
36153 return /*#__PURE__*/React.createElement(OutlinedInput$1, {
36154 startAdornment: /*#__PURE__*/React.createElement(InputAdornment$1, {
36155 position: "start"
36156 }, /*#__PURE__*/React.createElement(SearchIcon, {
36157 size: dense ? 'small' : 'normal'
36158 })),
36159 className: ['search', classes.root, dense && classes.dense].filter(Boolean).join(' '),
36160 margin: "dense",
36161 fullWidth: true,
36162 placeholder: translator.get('Listbox.Search'),
36163 value: value,
36164 onChange: onChange,
36165 onKeyDown: onKeyDown,
36166 inputProps: {
36167 tabIndex: keyboard && (!keyboard.enabled || keyboard.active) ? 0 : -1
36168 }
36169 });
36170 }
36171
36172 function eventmixin (obj) {
36173 /* eslint no-param-reassign: 0 */
36174 Object.keys(nodeEventEmitter.prototype).forEach(key => {
36175 obj[key] = nodeEventEmitter.prototype[key];
36176 });
36177 nodeEventEmitter.init(obj);
36178 return obj;
36179 }
36180
36181 /* eslint no-underscore-dangle: 0 */
36182
36183 const event = () => {
36184 let prevented = false;
36185 return {
36186 isPrevented: () => prevented,
36187 preventDefault: () => {
36188 prevented = true;
36189 }
36190 };
36191 };
36192
36193 function createObjectSelections(_ref) {
36194 let {
36195 appSelections,
36196 appModal,
36197 model
36198 } = _ref;
36199 let layout;
36200 let isActive = false;
36201 let hasSelected = false;
36202 /**
36203 * @class
36204 * @alias ObjectSelections
36205 */
36206
36207 const api =
36208 /** @lends ObjectSelections# */
36209 {
36210 // model,
36211 id: model.id,
36212
36213 setLayout(lyt) {
36214 layout = lyt;
36215 },
36216
36217 /**
36218 * @param {string[]} paths
36219 * @returns {Promise<undefined>}
36220 */
36221 begin(paths) {
36222 const e = event(); // TODO - event as parameter?
36223
36224 this.emit('activate', e);
36225
36226 if (e.isPrevented()) {
36227 return Promise.resolve();
36228 }
36229
36230 isActive = true;
36231 this.emit('activated');
36232 return appModal.begin(model, paths, true);
36233 },
36234
36235 /**
36236 * @returns {Promise<undefined>}
36237 */
36238 clear() {
36239 hasSelected = false;
36240 this.emit('cleared');
36241
36242 if (layout.qListObject) {
36243 return model.clearSelections('/qListObjectDef');
36244 }
36245
36246 return model.resetMadeSelections();
36247 },
36248
36249 /**
36250 * @returns {Promise<undefined>}
36251 */
36252 confirm() {
36253 hasSelected = false;
36254 isActive = false;
36255 this.emit('confirmed');
36256 this.emit('deactivated');
36257 return appModal.end(true);
36258 },
36259
36260 /**
36261 * @returns {Promise<undefined>}
36262 */
36263 cancel() {
36264 hasSelected = false;
36265 isActive = false;
36266 this.emit('canceled'); // FIXME - spelling?
36267
36268 this.emit('deactivated');
36269 return appModal.end(false);
36270 },
36271
36272 /**
36273 * @param {object} s
36274 * @param {string} s.method
36275 * @param {any[]} s.params
36276 * @returns {Promise<boolean>}
36277 */
36278 async select(s) {
36279 const b = this.begin([s.params[0]]);
36280
36281 if (!appSelections.isModal()) {
36282 return false;
36283 }
36284
36285 await b;
36286 const qSuccess = await model[s.method](...s.params);
36287 hasSelected = s.method !== 'resetMadeSelections';
36288
36289 if (!qSuccess) {
36290 model.resetMadeSelections();
36291 return false;
36292 }
36293
36294 return true;
36295 },
36296
36297 /**
36298 * @returns {boolean}
36299 */
36300 canClear() {
36301 if (layout && layout.qListObject && layout.qListObject.qDimensionInfo) {
36302 return !layout.qListObject.qDimensionInfo.qLocked && !layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne;
36303 }
36304
36305 return hasSelected;
36306 },
36307
36308 /**
36309 * @returns {boolean}
36310 */
36311 canConfirm() {
36312 if (layout && layout.qListObject && layout.qListObject.qDimensionInfo) {
36313 return !layout.qListObject.qDimensionInfo.qLocked;
36314 }
36315
36316 return hasSelected;
36317 },
36318
36319 /**
36320 * @returns {boolean}
36321 */
36322 canCancel() {
36323 if (layout && layout.qListObject && layout.qListObject.qDimensionInfo) {
36324 return !layout.qListObject.qDimensionInfo.qLocked;
36325 }
36326
36327 return true;
36328 },
36329
36330 /**
36331 * @returns {boolean}
36332 */
36333 isActive: () => isActive,
36334
36335 /**
36336 * @returns {boolean}
36337 */
36338 isModal: () => appSelections.isModal(model),
36339
36340 /**
36341 * @param {string[]} paths
36342 * @returns {Promise<undefined>}
36343 */
36344 goModal: paths => appModal.begin(model, paths, false),
36345
36346 /**
36347 * @param {boolean} [accept=false]
36348 * @returns {Promise<undefined>}
36349 */
36350 noModal: function () {
36351 let accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
36352 return appModal.end(accept);
36353 }
36354 };
36355 eventmixin(api);
36356 return api;
36357 }
36358
36359 function useObjectSelections(app, model) {
36360 const [appSelections] = useAppSelections(app);
36361 const [layout] = useLayout$1(model);
36362 const key = model ? model.id : null;
36363 const [appModalStore] = useAppModalStore();
36364 const [objectSelectionsStore] = useObjectSelectionsStore();
36365 const appModal = appModalStore.get(app.id);
36366 let objectSelections = objectSelectionsStore.get(key);
36367 react.exports.useEffect(() => {
36368 if (!appSelections || !model || objectSelections) return;
36369 objectSelections = createObjectSelections({
36370 appSelections,
36371 appModal,
36372 model
36373 });
36374 objectSelectionsStore.set(key, objectSelections);
36375 objectSelectionsStore.dispatch(true);
36376 }, [appSelections, model]);
36377 react.exports.useEffect(() => {
36378 if (!objectSelections) return;
36379 objectSelections.setLayout(layout);
36380 }, [objectSelections, layout]);
36381 return [objectSelections];
36382 }
36383
36384 function ListBoxPopover(_ref) {
36385 let {
36386 alignTo,
36387 show,
36388 close,
36389 app,
36390 fieldName,
36391 stateName = '$'
36392 } = _ref;
36393 const open = show && Boolean(alignTo.current);
36394 const theme = useTheme$2();
36395 const [model] = useSessionModel({
36396 qInfo: {
36397 qType: 'njsListbox'
36398 },
36399 qListObjectDef: {
36400 qStateName: stateName,
36401 qShowAlternatives: true,
36402 qInitialDataFetch: [{
36403 qTop: 0,
36404 qLeft: 0,
36405 qWidth: 0,
36406 qHeight: 0
36407 }],
36408 qDef: {
36409 qSortCriterias: [{
36410 qSortByState: 1,
36411 qSortByAscii: 1,
36412 qSortByNumeric: 1,
36413 qSortByLoadOrder: 1
36414 }],
36415 qFieldDefs: [fieldName]
36416 }
36417 }
36418 }, app, fieldName, stateName);
36419 const lock = react.exports.useCallback(() => {
36420 model.lock('/qListObjectDef');
36421 }, [model]);
36422 const unlock = react.exports.useCallback(() => {
36423 model.unlock('/qListObjectDef');
36424 }, [model]);
36425 const {
36426 translator
36427 } = react.exports.useContext(InstanceContext);
36428 const moreAlignTo = react.exports.useRef();
36429 const [selections] = useObjectSelections(app, model);
36430 const [layout] = useLayout$1(model);
36431 react.exports.useEffect(() => {
36432 if (selections && open) {
36433 if (!selections.isModal(model)) {
36434 selections.goModal('/qListObjectDef');
36435 }
36436 }
36437 }, [selections, open]);
36438
36439 if (!model || !layout || !translator) {
36440 return null;
36441 }
36442
36443 const isLocked = layout.qListObject.qDimensionInfo.qLocked === true;
36444
36445 const popoverClose = (e, reason) => {
36446 const accept = reason !== 'escapeKeyDown';
36447 selections.noModal(accept);
36448 close();
36449 };
36450
36451 const listboxSelectionToolbarItems = createListboxSelectionToolbar({
36452 layout,
36453 model,
36454 translator
36455 });
36456 const counts = layout.qListObject.qDimensionInfo.qStateCounts;
36457 const hasSelections = counts.qSelected + counts.qSelectedExcluded + counts.qLocked + counts.qLockedExcluded > 0;
36458 return /*#__PURE__*/React.createElement(Popover$1, {
36459 open: open,
36460 onClose: popoverClose,
36461 anchorEl: alignTo.current,
36462 anchorOrigin: {
36463 vertical: 'bottom',
36464 horizontal: 'center'
36465 },
36466 transformOrigin: {
36467 vertical: 'top',
36468 horizontal: 'center'
36469 },
36470 PaperProps: {
36471 style: {
36472 minWidth: '250px'
36473 }
36474 }
36475 }, /*#__PURE__*/React.createElement(StyledGrid, {
36476 container: true,
36477 direction: "column",
36478 spacing: 0
36479 }, /*#__PURE__*/React.createElement(StyledGrid, {
36480 item: true,
36481 container: true,
36482 style: {
36483 padding: theme.spacing(1)
36484 }
36485 }, /*#__PURE__*/React.createElement(StyledGrid, {
36486 item: true
36487 }, isLocked ? /*#__PURE__*/React.createElement(IconButton$1, {
36488 onClick: unlock,
36489 disabled: !isLocked
36490 }, /*#__PURE__*/React.createElement(Lock, {
36491 title: translator.get('Listbox.Unlock')
36492 })) : /*#__PURE__*/React.createElement(IconButton$1, {
36493 onClick: lock,
36494 disabled: !hasSelections
36495 }, /*#__PURE__*/React.createElement(Unlock, {
36496 title: translator.get('Listbox.Lock')
36497 }))), /*#__PURE__*/React.createElement(StyledGrid, {
36498 item: true,
36499 xs: true
36500 }), /*#__PURE__*/React.createElement(StyledGrid, {
36501 item: true
36502 }, /*#__PURE__*/React.createElement(ActionsToolbar, {
36503 more: {
36504 enabled: !isLocked,
36505 actions: listboxSelectionToolbarItems,
36506 alignTo: moreAlignTo,
36507 popoverProps: {
36508 elevation: 0
36509 },
36510 popoverPaperStyle: {
36511 boxShadow: '0 12px 8px -8px rgba(0, 0, 0, 0.2)',
36512 minWidth: '250px'
36513 }
36514 },
36515 selections: {
36516 show: true,
36517 api: selections,
36518 onConfirm: popoverClose,
36519 onCancel: () => popoverClose(null, 'escapeKeyDown')
36520 }
36521 }))), /*#__PURE__*/React.createElement(StyledGrid, {
36522 item: true,
36523 xs: true
36524 }, /*#__PURE__*/React.createElement("div", {
36525 ref: moreAlignTo
36526 }), /*#__PURE__*/React.createElement(ListBoxSearch, {
36527 model: model
36528 }), /*#__PURE__*/React.createElement(ListBox, {
36529 model: model,
36530 selections: selections,
36531 direction: "ltr"
36532 }))));
36533 }
36534
36535 const useStyles$7 = makeStyles$1(theme => ({
36536 item: {
36537 backgroundColor: theme.palette.background.paper,
36538 position: 'relative',
36539 cursor: 'pointer',
36540 padding: '4px',
36541 '&:hover': {
36542 backgroundColor: theme.palette.action.hover
36543 }
36544 }
36545 }));
36546 function OneField(_ref) {
36547 let {
36548 field,
36549 api,
36550 stateIx = 0,
36551 skipHandleShowListBoxPopover = false,
36552 moreAlignTo = null,
36553 onClose = () => {}
36554 } = _ref;
36555 const {
36556 translator
36557 } = react.exports.useContext(InstanceContext);
36558 const alignTo = moreAlignTo || react.exports.useRef();
36559 const theme = useTheme$2();
36560 const [showListBoxPopover, setShowListBoxPopover] = react.exports.useState(false);
36561 const classes = useStyles$7();
36562
36563 const handleShowListBoxPopover = e => {
36564 if (e.currentTarget.contains(e.target)) {
36565 // because click in popover will propagate to parent
36566 setShowListBoxPopover(!showListBoxPopover);
36567 }
36568 };
36569
36570 const handleCloseShowListBoxPopover = () => {
36571 setShowListBoxPopover(false);
36572 onClose();
36573 };
36574
36575 const selection = field.selections[stateIx];
36576
36577 if (typeof selection.qTotal === 'undefined') {
36578 selection.qTotal = 0;
36579 }
36580
36581 const counts = selection.qStateCounts || {
36582 qSelected: 0,
36583 qLocked: 0,
36584 qExcluded: 0,
36585 qLockedExcluded: 0,
36586 qSelectedExcluded: 0,
36587 qAlternative: 0
36588 };
36589 const green = (counts.qSelected + counts.qLocked) / selection.qTotal;
36590 const white = counts.qAlternative / selection.qTotal;
36591 const grey = (counts.qExcluded + counts.qLockedExcluded + counts.qSelectedExcluded) / selection.qTotal;
36592 const numSelected = counts.qSelected + counts.qSelectedExcluded + counts.qLocked + counts.qLockedExcluded; // Maintain modal state in app selections
36593
36594 const noSegments = numSelected === 0 && selection.qTotal === 0;
36595 let label = '';
36596
36597 if (selection.qTotal === numSelected && selection.qTotal > 1) {
36598 label = translator.get('CurrentSelections.All');
36599 } else if (numSelected > 1 && selection.qTotal) {
36600 label = translator.get('CurrentSelections.Of', [numSelected, selection.qTotal]);
36601 } else if (selection.qSelectedFieldSelectionInfo) {
36602 label = selection.qSelectedFieldSelectionInfo.map(v => v.qName).join(', ');
36603 }
36604
36605 if (field.states[stateIx] !== '$') {
36606 label = "".concat(field.states[stateIx], ": ").concat(label);
36607 }
36608
36609 const segments = [{
36610 color: theme.palette.selected.main,
36611 ratio: green
36612 }, {
36613 color: theme.palette.selected.alternative,
36614 ratio: white
36615 }, {
36616 color: theme.palette.selected.excluded,
36617 ratio: grey
36618 }];
36619 segments.forEach((s, i) => {
36620 s.offset = i ? segments[i - 1].offset + segments[i - 1].ratio : 0; // eslint-disable-line
36621 });
36622 let Header = null;
36623 let Icon = null;
36624 let SegmentsIndicator = null;
36625 let Component = null;
36626
36627 if (!moreAlignTo) {
36628 Header = /*#__PURE__*/React.createElement(StyledGrid, {
36629 item: true,
36630 xs: true,
36631 style: {
36632 minWidth: 0,
36633 flexGrow: 1,
36634 opacity: selection.qLocked ? '0.3' : ''
36635 }
36636 }, /*#__PURE__*/React.createElement(Typography$1, {
36637 noWrap: true,
36638 style: {
36639 fontSize: '12px',
36640 lineHeight: '16px',
36641 fontWeight: 600
36642 }
36643 }, selection.qField), /*#__PURE__*/React.createElement(Typography$1, {
36644 noWrap: true,
36645 style: {
36646 fontSize: '12px',
36647 opacity: 0.55,
36648 lineHeight: '16px'
36649 }
36650 }, label));
36651
36652 if (selection.qLocked) {
36653 Icon = /*#__PURE__*/React.createElement(StyledGrid, {
36654 item: true
36655 }, /*#__PURE__*/React.createElement(IconButton$1, null, /*#__PURE__*/React.createElement(Lock, null)));
36656 } else if (!selection.qOneAndOnlyOne) {
36657 Icon = /*#__PURE__*/React.createElement(StyledGrid, {
36658 item: true
36659 }, /*#__PURE__*/React.createElement(IconButton$1, {
36660 title: translator.get('Selection.Clear'),
36661 onClick: e => {
36662 e.stopPropagation();
36663 api.clearField(selection.qField, field.states[stateIx]);
36664 }
36665 }, /*#__PURE__*/React.createElement(Remove, null)));
36666 }
36667
36668 SegmentsIndicator = /*#__PURE__*/React.createElement("div", {
36669 style: {
36670 height: '4px',
36671 position: 'absolute',
36672 bottom: '0',
36673 left: '0',
36674 width: '100%'
36675 }
36676 }, noSegments === false && segments.map(s => /*#__PURE__*/React.createElement("div", {
36677 key: s.color,
36678 style: {
36679 position: 'absolute',
36680 background: s.color,
36681 height: '100%',
36682 top: 0,
36683 width: "".concat(s.ratio * 100, "%"),
36684 left: "".concat(s.offset * 100, "%")
36685 }
36686 })));
36687 Component = /*#__PURE__*/React.createElement(StyledGrid, {
36688 container: true,
36689 spacing: 0,
36690 ref: alignTo,
36691 className: classes.item,
36692 onClick: skipHandleShowListBoxPopover === false && handleShowListBoxPopover || null
36693 }, Header, Icon, SegmentsIndicator, showListBoxPopover && /*#__PURE__*/React.createElement(ListBoxPopover, {
36694 alignTo: alignTo,
36695 show: showListBoxPopover,
36696 close: handleCloseShowListBoxPopover,
36697 app: api.model,
36698 fieldName: selection.qField,
36699 stateName: field.states[stateIx]
36700 }));
36701 }
36702
36703 return moreAlignTo ? /*#__PURE__*/React.createElement(ListBoxPopover, {
36704 alignTo: alignTo,
36705 show: true,
36706 close: handleCloseShowListBoxPopover,
36707 app: api.model,
36708 fieldName: selection.qField,
36709 stateName: field.states[stateIx]
36710 }) : Component;
36711 }
36712
36713 const downArrow = props => _objectSpread2(_objectSpread2({}, props), {}, {
36714 shapes: [{
36715 type: 'path',
36716 attrs: {
36717 d: 'M8,9 L12.5,4.5 L14,6 L9.5,10.5 L8,12 L2,6 L3.5,4.5 L8,9 Z'
36718 }
36719 }]
36720 });
36721
36722 var DownArrow = (props => SvgIcon(downArrow(props)));
36723
36724 const useStyles$6 = makeStyles$1(theme => ({
36725 item: {
36726 backgroundColor: theme.palette.background.paper,
36727 position: 'relative',
36728 cursor: 'pointer',
36729 padding: '4px',
36730 '&:hover': {
36731 backgroundColor: theme.palette.action.hover
36732 },
36733 height: '100%',
36734 alignItems: 'center'
36735 },
36736 badge: {
36737 padding: theme.spacing(0, 1)
36738 }
36739 }));
36740 function MultiState(_ref) {
36741 let {
36742 field,
36743 api,
36744 moreAlignTo = null,
36745 onClose = () => {}
36746 } = _ref;
36747 const classes = useStyles$6(); // If originated from the `more` item show fields directly
36748
36749 const [showFields, setShowFields] = react.exports.useState(!!moreAlignTo);
36750 const [showStateIx, setShowStateIx] = react.exports.useState(-1); // If originated from the `more` item align it
36751
36752 const [anchorEl, setAnchorEl] = react.exports.useState(moreAlignTo ? moreAlignTo.current : null);
36753 const alignTo = moreAlignTo || react.exports.useRef();
36754 const {
36755 translator
36756 } = react.exports.useContext(InstanceContext);
36757 const clearAllStates = translator.get('Selection.ClearAllStates');
36758
36759 const handleShowFields = e => {
36760 if (e.currentTarget.contains(e.target)) {
36761 // because click in popover will propagate to parent
36762 setAnchorEl(e.currentTarget);
36763 alignTo.current = e.currentTarget;
36764 setShowFields(!showFields);
36765 }
36766 };
36767
36768 const handleCloseShowFields = () => {
36769 setShowFields(false);
36770 onClose();
36771 };
36772
36773 const handleShowState = (e, ix) => {
36774 e.stopPropagation();
36775 setShowFields(false);
36776 setShowStateIx(ix);
36777 };
36778
36779 const handleCloseShowState = () => {
36780 setShowStateIx(-1);
36781 onClose();
36782 };
36783
36784 const handleClearAllStates = () => {
36785 field.states.forEach(s => api.clearField(field.name, s));
36786 };
36787
36788 let Header = null;
36789
36790 if (!moreAlignTo) {
36791 Header = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledGrid, {
36792 item: true,
36793 xs: true,
36794 zeroMinWidth: true
36795 }, /*#__PURE__*/React.createElement(Badge$1, {
36796 className: classes.badge,
36797 color: "secondary",
36798 badgeContent: field.states.length
36799 }, /*#__PURE__*/React.createElement(Typography$1, {
36800 component: "span",
36801 noWrap: true,
36802 style: {
36803 fontSize: '12px',
36804 lineHeight: '16px',
36805 fontWeight: 600
36806 }
36807 }, field.name))), /*#__PURE__*/React.createElement(StyledGrid, {
36808 item: true
36809 }, /*#__PURE__*/React.createElement("div", {
36810 style: {
36811 width: '12px'
36812 }
36813 })), /*#__PURE__*/React.createElement(StyledGrid, {
36814 item: true
36815 }, /*#__PURE__*/React.createElement(IconButton$1, null, /*#__PURE__*/React.createElement(DownArrow, null))));
36816 }
36817
36818 const Fields = /*#__PURE__*/React.createElement(List$1, {
36819 dense: true
36820 }, /*#__PURE__*/React.createElement(ListItem$1, {
36821 title: clearAllStates,
36822 onClick: handleClearAllStates
36823 }, /*#__PURE__*/React.createElement(Button$1, {
36824 variant: "contained",
36825 fullWidth: true
36826 }, clearAllStates)), field.states.map((s, ix) =>
36827 /*#__PURE__*/
36828 // eslint-disable-next-line react/no-array-index-key
36829 React.createElement(ListItem$1, {
36830 key: ix,
36831 title: field.name,
36832 onClick: e => handleShowState(e, ix)
36833 }, /*#__PURE__*/React.createElement(Box, {
36834 border: 1,
36835 width: "100%",
36836 borderRadius: "borderRadius",
36837 borderColor: "divider"
36838 }, /*#__PURE__*/React.createElement(OneField, {
36839 field: field,
36840 api: api,
36841 stateIx: ix,
36842 skipHandleShowListBoxPopover: true
36843 })))));
36844 const PopoverFields = /*#__PURE__*/React.createElement(Popover$1, {
36845 open: showFields,
36846 onClose: handleCloseShowFields,
36847 anchorEl: anchorEl,
36848 anchorOrigin: {
36849 vertical: 'bottom',
36850 horizontal: 'center'
36851 },
36852 transformOrigin: {
36853 vertical: 'top',
36854 horizontal: 'center'
36855 },
36856 PaperProps: {
36857 style: {
36858 minWidth: '200px',
36859 width: '200px',
36860 pointerEvents: 'auto'
36861 }
36862 }
36863 }, Fields);
36864 const Component = moreAlignTo ? PopoverFields : /*#__PURE__*/React.createElement(StyledGrid, {
36865 container: true,
36866 spacing: 0,
36867 className: classes.item,
36868 onClick: handleShowFields
36869 }, Header, showFields && PopoverFields, showStateIx > -1 && /*#__PURE__*/React.createElement(ListBoxPopover, {
36870 alignTo: alignTo,
36871 show: showStateIx > -1,
36872 close: handleCloseShowState,
36873 app: api.model,
36874 fieldName: field.selections[showStateIx].qField,
36875 stateName: field.states[showStateIx]
36876 }));
36877 return moreAlignTo && showStateIx > -1 ? /*#__PURE__*/React.createElement(ListBoxPopover, {
36878 alignTo: alignTo,
36879 show: showStateIx > -1,
36880 close: handleCloseShowState,
36881 app: api.model,
36882 fieldName: field.selections[showStateIx].qField,
36883 stateName: field.states[showStateIx]
36884 }) : Component;
36885 }
36886
36887 const useStyles$5 = makeStyles$1(theme => ({
36888 item: {
36889 backgroundColor: theme.palette.background.paper,
36890 position: 'relative',
36891 cursor: 'pointer',
36892 padding: '4px',
36893 '&:hover': {
36894 backgroundColor: theme.palette.action.hover
36895 },
36896 height: '100%',
36897 alignItems: 'center'
36898 },
36899 badge: {
36900 padding: theme.spacing(0, 1)
36901 }
36902 }));
36903 function More(_ref) {
36904 let {
36905 items = [],
36906 api
36907 } = _ref;
36908 const classes = useStyles$5();
36909 const theme = useTheme$2();
36910 const [showMoreItems, setShowMoreItems] = react.exports.useState(false);
36911 const [showItemIx, setShowItemIx] = react.exports.useState(-1);
36912 const [anchorEl, setAnchorEl] = react.exports.useState(null);
36913 const alignTo = react.exports.useRef();
36914
36915 const handleShowMoreItems = e => {
36916 if (e.currentTarget.contains(e.target)) {
36917 // because click in popover will propagate to parent
36918 setAnchorEl(e.currentTarget);
36919 alignTo.current = e.currentTarget;
36920 setShowMoreItems(!showMoreItems);
36921 }
36922 };
36923
36924 const handleCloseShowMoreItem = () => {
36925 setShowMoreItems(false);
36926 };
36927
36928 const handleShowItem = (e, ix) => {
36929 e.stopPropagation();
36930 setShowMoreItems(false);
36931 setShowItemIx(ix);
36932 };
36933
36934 const handleCloseShowItem = () => {
36935 setShowItemIx(-1);
36936 };
36937
36938 let CurrentItem = null;
36939
36940 if (showItemIx > -1) {
36941 CurrentItem = items[showItemIx].states.length > 1 ? /*#__PURE__*/React.createElement(MultiState, {
36942 field: items[showItemIx],
36943 api: api,
36944 moreAlignTo: alignTo,
36945 onClose: handleCloseShowItem
36946 }) : /*#__PURE__*/React.createElement(OneField, {
36947 field: items[showItemIx],
36948 api: api,
36949 skipHandleShowListBoxPopover: true,
36950 moreAlignTo: alignTo,
36951 onClose: handleCloseShowItem
36952 });
36953 }
36954
36955 return /*#__PURE__*/React.createElement(StyledGrid, {
36956 container: true,
36957 spacing: 0,
36958 className: classes.item,
36959 onClick: handleShowMoreItems
36960 }, /*#__PURE__*/React.createElement(StyledGrid, {
36961 item: true
36962 }, /*#__PURE__*/React.createElement(Box, {
36963 borderRadius: theme.shape.borderRadius,
36964 style: {
36965 padding: '4px 8px 4px 8px',
36966 backgroundColor: theme.palette.selected.main,
36967 color: theme.palette.selected.mainContrastText
36968 }
36969 }, /*#__PURE__*/React.createElement(Typography$1, {
36970 noWrap: true,
36971 style: {
36972 fontSize: '12px',
36973 lineHeight: '16px',
36974 fontWeight: 600
36975 },
36976 color: "inherit"
36977 }, "+", items.length))), /*#__PURE__*/React.createElement(StyledGrid, {
36978 item: true
36979 }, /*#__PURE__*/React.createElement(IconButton$1, null, /*#__PURE__*/React.createElement(DownArrow, null))), showMoreItems && /*#__PURE__*/React.createElement(Popover$1, {
36980 open: showMoreItems,
36981 onClose: handleCloseShowMoreItem,
36982 anchorEl: anchorEl,
36983 anchorOrigin: {
36984 vertical: 'bottom',
36985 horizontal: 'center'
36986 },
36987 transformOrigin: {
36988 vertical: 'top',
36989 horizontal: 'center'
36990 },
36991 PaperProps: {
36992 style: {
36993 minWidth: '200px',
36994 width: '200px',
36995 pointerEvents: 'auto'
36996 }
36997 }
36998 }, /*#__PURE__*/React.createElement(List$1, {
36999 dense: true
37000 }, items.map((s, ix) =>
37001 /*#__PURE__*/
37002 // eslint-disable-next-line react/no-array-index-key
37003 React.createElement(ListItem$1, {
37004 key: ix,
37005 title: s.name,
37006 onClick: e => handleShowItem(e, ix)
37007 }, /*#__PURE__*/React.createElement(Box, {
37008 border: 1,
37009 width: "100%",
37010 borderRadius: "borderRadius",
37011 borderColor: "divider"
37012 }, s.states.length > 1 ? /*#__PURE__*/React.createElement(MultiState, {
37013 field: s,
37014 api: api
37015 }) : /*#__PURE__*/React.createElement(OneField, {
37016 field: s,
37017 api: api
37018 })))))), CurrentItem);
37019 }
37020
37021 const MIN_WIDTH$1 = 120;
37022 const MIN_WIDTH_MORE = 72;
37023
37024 function collect(qSelectionObject, fields) {
37025 let state = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '$';
37026 qSelectionObject.qSelections.forEach(selection => {
37027 const name = selection.qField;
37028 const field = fields[name] = fields[name] || {
37029 name,
37030 states: [],
37031 selections: []
37032 }; // eslint-disable-line
37033
37034 if (field.states.indexOf(state) === -1) {
37035 field.states.push(state);
37036 field.selections.push(selection);
37037 }
37038 });
37039 }
37040
37041 function getItems(layout) {
37042 if (!layout) {
37043 return [];
37044 }
37045
37046 const fields = {};
37047
37048 if (layout.qSelectionObject) {
37049 collect(layout.qSelectionObject, fields);
37050 }
37051
37052 if (layout.alternateStates) {
37053 layout.alternateStates.forEach(s => collect(s.qSelectionObject, fields, s.stateName));
37054 }
37055
37056 return Object.keys(fields).map(key => fields[key]);
37057 }
37058
37059 function SelectedFields(_ref) {
37060 let {
37061 api,
37062 app
37063 } = _ref;
37064 const theme = useTheme$2();
37065 const [currentSelectionsModel] = useCurrentSelectionsModel(app);
37066 const [layout] = useLayout$1(currentSelectionsModel);
37067 const [state, setState] = react.exports.useState({
37068 items: [],
37069 more: []
37070 });
37071 const [modalObjectStore] = useModalObjectStore();
37072 const [containerRef, containerRect] = useRect$1();
37073 const [maxItems, setMaxItems] = react.exports.useState(0);
37074
37075 const isInListboxPopover = () => {
37076 const object = modalObjectStore.get(app.id);
37077 return object && object.genericType === 'njsListbox';
37078 };
37079
37080 react.exports.useEffect(() => {
37081 if (!containerRect) return;
37082 const {
37083 width
37084 } = containerRect;
37085 const maxWidth = Math.floor(width) - MIN_WIDTH_MORE;
37086 const items = Math.floor(maxWidth / MIN_WIDTH$1);
37087 setMaxItems(items);
37088 }, [containerRect]);
37089 react.exports.useEffect(() => {
37090 if (!app || !currentSelectionsModel || !layout || !maxItems) {
37091 return;
37092 }
37093
37094 const items = getItems(layout);
37095 setState(currState => {
37096 const newItems = items; // Maintain modal state in app selections
37097
37098 if (isInListboxPopover() && newItems.length + 1 === currState.items.length) {
37099 const lastDeselectedField = currState.items.filter(f1 => newItems.some(f2 => f1.name === f2.name) === false)[0];
37100 const {
37101 qField
37102 } = lastDeselectedField.selections[0];
37103 lastDeselectedField.selections = [{
37104 qField
37105 }];
37106 const wasIx = currState.items.indexOf(lastDeselectedField);
37107 newItems.splice(wasIx, 0, lastDeselectedField);
37108 }
37109
37110 let newMoreItems = [];
37111
37112 if (maxItems < newItems.length) {
37113 newMoreItems = newItems.splice(maxItems - newItems.length);
37114 }
37115
37116 return {
37117 items: newItems,
37118 more: newMoreItems
37119 };
37120 });
37121 }, [app, currentSelectionsModel, layout, api.isInModal(), maxItems]);
37122 return /*#__PURE__*/React.createElement(StyledGrid, {
37123 ref: containerRef,
37124 container: true,
37125 spacing: 0,
37126 wrap: "nowrap",
37127 style: {
37128 height: '100%'
37129 }
37130 }, state.items.map(s => /*#__PURE__*/React.createElement(StyledGrid, {
37131 item: true,
37132 key: "".concat(s.states.join('::'), "::").concat(s.name),
37133 style: {
37134 position: 'relative',
37135 maxWidth: '240px',
37136 minWidth: "".concat(MIN_WIDTH$1, "px"),
37137 background: theme.palette.background.paper,
37138 borderRight: "1px solid ".concat(theme.palette.divider)
37139 }
37140 }, s.states.length > 1 ? /*#__PURE__*/React.createElement(MultiState, {
37141 field: s,
37142 api: api
37143 }) : /*#__PURE__*/React.createElement(OneField, {
37144 field: s,
37145 api: api
37146 }))), state.more.length > 0 && /*#__PURE__*/React.createElement(StyledGrid, {
37147 item: true,
37148 style: {
37149 position: 'relative',
37150 maxWidth: '98px',
37151 minWidth: "".concat(MIN_WIDTH_MORE, "px"),
37152 background: theme.palette.background.paper,
37153 borderRight: "1px solid ".concat(theme.palette.divider)
37154 }
37155 }, /*#__PURE__*/React.createElement(More, {
37156 items: state.more,
37157 api: api
37158 })));
37159 }
37160
37161 const selectionsBack = props => _objectSpread2(_objectSpread2({}, props), {}, {
37162 shapes: [{
37163 type: 'path',
37164 attrs: {
37165 d: 'M10,15.5 C10,15.7761424 9.77614237,16 9.5,16 L6.5,16 C6.22385763,16 6,15.7761424 6,15.5 C6,15.2238576 6.22385763,15 6.5,15 L9.5,15 C9.77614237,15 10,15.2238576 10,15.5 Z M15,13.5 C15,13.2238576 15.2238576,13 15.5,13 C15.7761424,13 16,13.2238576 16,13.5 L16,15 C16,15.5522847 15.5522847,16 15,16 L13.5,16 C13.2238576,16 13,15.7761424 13,15.5 C13,15.2238576 13.2238576,15 13.5,15 L14.5,15 C14.7761424,15 15,14.7761424 15,14.5 L15,13.5 Z M15,6.5 C15,6.22385763 15.2238576,6 15.5,6 C15.7761424,6 16,6.22385763 16,6.5 L16,9.5 C16,9.77614237 15.7761424,10 15.5,10 C15.2238576,10 15,9.77614237 15,9.5 L15,6.5 Z M16,2.5 C16,2.77614237 15.7761424,3 15.5,3 C15.2238576,3 15,2.77614237 15,2.5 L15,1.5 C15,1.22385763 14.7761424,1 14.5,1 L13.5,1 C13.2238576,1 13,0.776142375 13,0.5 C13,0.223857625 13.2238576,-5.07265313e-17 13.5,0 L15,0 C15.5522847,1.01453063e-16 16,0.44771525 16,1 L16,2.5 Z M10,0.5 C10,0.776142375 9.77614237,1 9.5,1 L6.5,1 C6.22385763,1 6,0.776142375 6,0.5 C6,0.223857625 6.22385763,-5.07265313e-17 6.5,0 L9.5,0 C9.77614237,5.07265313e-17 10,0.223857625 10,0.5 Z M1,2.5 C1,2.77614237 0.776142375,3 0.5,3 C0.223857625,3 5.18696197e-13,2.77614237 5.18696197e-13,2.5 L5.18696197e-13,1 C5.18696197e-13,0.44771525 0.44771525,-1.01453063e-16 1,0 L2.5,0 C2.77614237,5.07265313e-17 3,0.223857625 3,0.5 C3,0.776142375 2.77614237,1 2.5,1 L1.5,1 C1.22385763,1 1,1.22385763 1,1.5 L1,2.5 Z M1,13.5 L1,14.5 C1,14.7761424 1.22385763,15 1.5,15 L2.5,15 C2.77614237,15 3,15.2238576 3,15.5 C3,15.7761424 2.77614237,16 2.5,16 L1,16 C0.44771525,16 5.18696197e-13,15.5522847 5.18696197e-13,15 L5.18696197e-13,13.5 C5.18696197e-13,13.2238576 0.223857625,13 0.5,13 C0.776142375,13 1,13.2238576 1,13.5 Z M4,7 C7.49095643,7 10,10.1337595 10,12.1872632 C10,12.1872632 8.16051135,9.86624054 4,10 L4,12 C4,12 2.66666667,10.8333333 -1.0658141e-14,8.5 C-2.59348099e-13,8.5 1.33333333,7.33333333 4,5 C4,5 4,5.66666667 4,7 Z'
37166 }
37167 }]
37168 });
37169
37170 var SelectionsBack = (props => SvgIcon(selectionsBack(props)));
37171
37172 const selectionsForward = props => _objectSpread2(_objectSpread2({}, props), {}, {
37173 shapes: [{
37174 type: 'path',
37175 attrs: {
37176 d: 'M6,15.5 L6,15.5 C6,15.2238576 6.22385763,15 6.5,15 L9.5,15 C9.77614237,15 10,15.2238576 10,15.5 L10,15.5 C10,15.7761424 9.77614237,16 9.5,16 L6.5,16 C6.22385763,16 6,15.7761424 6,15.5 Z M1,13.5 L1,14.5 C1,14.7761424 1.22385763,15 1.5,15 L2.5,15 C2.77614237,15 3,15.2238576 3,15.5 L3,15.5 C3,15.7761424 2.77614237,16 2.5,16 L1,16 C0.44771525,16 6.76353751e-17,15.5522847 0,15 L0,13.5 C-3.38176876e-17,13.2238576 0.223857625,13 0.5,13 L0.5,13 C0.776142375,13 1,13.2238576 1,13.5 Z M1,6.5 L1,9.5 C1,9.77614237 0.776142375,10 0.5,10 L0.5,10 C0.223857625,10 3.38176876e-17,9.77614237 0,9.5 L0,6.5 C-3.38176876e-17,6.22385763 0.223857625,6 0.5,6 L0.5,6 C0.776142375,6 1,6.22385763 1,6.5 Z M0,2.5 L0,1 C-6.76353751e-17,0.44771525 0.44771525,1.01453063e-16 1,0 L2.5,0 C2.77614237,-5.07265313e-17 3,0.223857625 3,0.5 L3,0.5 C3,0.776142375 2.77614237,1 2.5,1 L1.5,1 C1.22385763,1 1,1.22385763 1,1.5 L1,2.5 C1,2.77614237 0.776142375,3 0.5,3 L0.5,3 C0.223857625,3 3.38176876e-17,2.77614237 0,2.5 Z M6,0.5 L6,0.5 C6,0.223857625 6.22385763,5.07265313e-17 6.5,0 L9.5,0 C9.77614237,-5.07265313e-17 10,0.223857625 10,0.5 L10,0.5 C10,0.776142375 9.77614237,1 9.5,1 L6.5,1 C6.22385763,1 6,0.776142375 6,0.5 Z M15,2.5 L15,1.5 C15,1.22385763 14.7761424,1 14.5,1 L13.5,1 C13.2238576,1 13,0.776142375 13,0.5 L13,0.5 C13,0.223857625 13.2238576,5.07265313e-17 13.5,0 L15,0 C15.5522847,-1.01453063e-16 16,0.44771525 16,1 L16,2.5 C16,2.77614237 15.7761424,3 15.5,3 L15.5,3 C15.2238576,3 15,2.77614237 15,2.5 Z M15,13.5 C15,13.2238576 15.2238576,13 15.5,13 C15.7761424,13 16,13.2238576 16,13.5 L16,15 C16,15.5522847 15.5522847,16 15,16 L13.5,16 C13.2238576,16 13,15.7761424 13,15.5 C13,15.2238576 13.2238576,15 13.5,15 L14.5,15 C14.7761424,15 15,14.7761424 15,14.5 L15,13.5 Z M12,7 C12,5.66666667 12,5 12,5 C14.6666667,7.33333333 16,8.5 16,8.5 C13.3333333,10.8333333 12,12 12,12 L12,10 C7.83948865,9.86624054 6,12.1872632 6,12.1872632 C6,10.1337595 8.50904357,7 12,7 Z'
37177 }
37178 }]
37179 });
37180
37181 var SelectionsForward = (props => SvgIcon(selectionsForward(props)));
37182
37183 function Nav(_ref) {
37184 let {
37185 api,
37186 app
37187 } = _ref;
37188 const {
37189 translator
37190 } = react.exports.useContext(InstanceContext);
37191 const [navState] = useAppSelectionsNavigation(app);
37192 return /*#__PURE__*/React.createElement(StyledGrid, {
37193 container: true,
37194 wrap: "nowrap",
37195 style: {
37196 height: '100%',
37197 alignItems: 'center',
37198 padding: '0 8px'
37199 }
37200 }, /*#__PURE__*/React.createElement(StyledGrid, {
37201 item: true
37202 }, /*#__PURE__*/React.createElement(IconButton$1, {
37203 style: {
37204 marginRight: '8px'
37205 },
37206 disabled: !navState || !navState.canGoBack,
37207 title: translator.get('Navigate.Back'),
37208 onClick: () => api.back()
37209 }, /*#__PURE__*/React.createElement(SelectionsBack, null))), /*#__PURE__*/React.createElement(StyledGrid, {
37210 item: true
37211 }, /*#__PURE__*/React.createElement(IconButton$1, {
37212 style: {
37213 marginRight: '8px'
37214 },
37215 disabled: !navState || !navState.canGoForward,
37216 title: translator.get('Navigate.Forward'),
37217 onClick: () => api.forward()
37218 }, /*#__PURE__*/React.createElement(SelectionsForward, null))), /*#__PURE__*/React.createElement(StyledGrid, {
37219 item: true
37220 }, /*#__PURE__*/React.createElement(IconButton$1, {
37221 disabled: !navState || !navState.canClear,
37222 title: translator.get('Selection.ClearAll'),
37223 onClick: () => api.clear()
37224 }, /*#__PURE__*/React.createElement(ClearSelections, null))));
37225 }
37226
37227 function AppSelections(_ref) {
37228 let {
37229 app
37230 } = _ref;
37231 const theme = useTheme$2();
37232 const [appSelections] = useAppSelections(app);
37233 if (!appSelections) return null;
37234 return /*#__PURE__*/React.createElement(StyledGrid, {
37235 container: true,
37236 spacing: 0,
37237 wrap: "nowrap",
37238 style: {
37239 backgroundColor: theme.palette.background.paper,
37240 minHeight: '40px'
37241 }
37242 }, /*#__PURE__*/React.createElement(StyledGrid, {
37243 item: true,
37244 style: {
37245 borderRight: "1px solid ".concat(theme.palette.divider)
37246 }
37247 }, /*#__PURE__*/React.createElement(Nav, {
37248 api: appSelections,
37249 app: app
37250 })), /*#__PURE__*/React.createElement(StyledGrid, {
37251 item: true,
37252 xs: true,
37253 style: {
37254 backgroundColor: theme.palette.background.darker,
37255 overflow: 'hidden'
37256 }
37257 }, /*#__PURE__*/React.createElement(SelectedFields, {
37258 api: appSelections,
37259 app: app
37260 })));
37261 }
37262 function mount(_ref2) {
37263 let {
37264 element,
37265 app
37266 } = _ref2;
37267 return ReactDOM.createPortal( /*#__PURE__*/React.createElement(AppSelections, {
37268 app: app
37269 }), element);
37270 }
37271
37272 var classCallCheck = function (instance, Constructor) {
37273 if (!(instance instanceof Constructor)) {
37274 throw new TypeError("Cannot call a class as a function");
37275 }
37276 };
37277
37278 var createClass = function () {
37279 function defineProperties(target, props) {
37280 for (var i = 0; i < props.length; i++) {
37281 var descriptor = props[i];
37282 descriptor.enumerable = descriptor.enumerable || false;
37283 descriptor.configurable = true;
37284 if ("value" in descriptor) descriptor.writable = true;
37285 Object.defineProperty(target, descriptor.key, descriptor);
37286 }
37287 }
37288
37289 return function (Constructor, protoProps, staticProps) {
37290 if (protoProps) defineProperties(Constructor.prototype, protoProps);
37291 if (staticProps) defineProperties(Constructor, staticProps);
37292 return Constructor;
37293 };
37294 }();
37295
37296 var _extends = Object.assign || function (target) {
37297 for (var i = 1; i < arguments.length; i++) {
37298 var source = arguments[i];
37299
37300 for (var key in source) {
37301 if (Object.prototype.hasOwnProperty.call(source, key)) {
37302 target[key] = source[key];
37303 }
37304 }
37305 }
37306
37307 return target;
37308 };
37309
37310 var inherits = function (subClass, superClass) {
37311 if (typeof superClass !== "function" && superClass !== null) {
37312 throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
37313 }
37314
37315 subClass.prototype = Object.create(superClass && superClass.prototype, {
37316 constructor: {
37317 value: subClass,
37318 enumerable: false,
37319 writable: true,
37320 configurable: true
37321 }
37322 });
37323 if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
37324 };
37325
37326 var possibleConstructorReturn = function (self, call) {
37327 if (!self) {
37328 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
37329 }
37330
37331 return call && (typeof call === "object" || typeof call === "function") ? call : self;
37332 };
37333
37334 var slicedToArray = function () {
37335 function sliceIterator(arr, i) {
37336 var _arr = [];
37337 var _n = true;
37338 var _d = false;
37339 var _e = undefined;
37340
37341 try {
37342 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
37343 _arr.push(_s.value);
37344
37345 if (i && _arr.length === i) break;
37346 }
37347 } catch (err) {
37348 _d = true;
37349 _e = err;
37350 } finally {
37351 try {
37352 if (!_n && _i["return"]) _i["return"]();
37353 } finally {
37354 if (_d) throw _e;
37355 }
37356 }
37357
37358 return _arr;
37359 }
37360
37361 return function (arr, i) {
37362 if (Array.isArray(arr)) {
37363 return arr;
37364 } else if (Symbol.iterator in Object(arr)) {
37365 return sliceIterator(arr, i);
37366 } else {
37367 throw new TypeError("Invalid attempt to destructure non-iterable instance");
37368 }
37369 };
37370 }();
37371
37372 /**
37373 * Detect Element Resize.
37374 * https://github.com/sdecima/javascript-detect-element-resize
37375 * Sebastian Decima
37376 *
37377 * Forked from version 0.5.3; includes the following modifications:
37378 * 1) Guard against unsafe 'window' and 'document' references (to support SSR).
37379 * 2) Defer initialization code via a top-level function wrapper (to support SSR).
37380 * 3) Avoid unnecessary reflows by not measuring size for scroll events bubbling from children.
37381 * 4) Add nonce for style element.
37382 **/
37383
37384 // Check `document` and `window` in case of server-side rendering
37385 var windowObject = void 0;
37386 if (typeof window !== 'undefined') {
37387 windowObject = window;
37388
37389 // eslint-disable-next-line no-restricted-globals
37390 } else if (typeof self !== 'undefined') {
37391 // eslint-disable-next-line no-restricted-globals
37392 windowObject = self;
37393 } else {
37394 windowObject = global;
37395 }
37396
37397 var cancelFrame = null;
37398 var requestFrame = null;
37399
37400 var TIMEOUT_DURATION = 20;
37401
37402 var clearTimeoutFn = windowObject.clearTimeout;
37403 var setTimeoutFn = windowObject.setTimeout;
37404
37405 var cancelAnimationFrameFn = windowObject.cancelAnimationFrame || windowObject.mozCancelAnimationFrame || windowObject.webkitCancelAnimationFrame;
37406
37407 var requestAnimationFrameFn = windowObject.requestAnimationFrame || windowObject.mozRequestAnimationFrame || windowObject.webkitRequestAnimationFrame;
37408
37409 if (cancelAnimationFrameFn == null || requestAnimationFrameFn == null) {
37410 // For environments that don't support animation frame,
37411 // fallback to a setTimeout based approach.
37412 cancelFrame = clearTimeoutFn;
37413 requestFrame = function requestAnimationFrameViaSetTimeout(callback) {
37414 return setTimeoutFn(callback, TIMEOUT_DURATION);
37415 };
37416 } else {
37417 // Counter intuitively, environments that support animation frames can be trickier.
37418 // Chrome's "Throttle non-visible cross-origin iframes" flag can prevent rAFs from being called.
37419 // In this case, we should fallback to a setTimeout() implementation.
37420 cancelFrame = function cancelFrame(_ref) {
37421 var _ref2 = slicedToArray(_ref, 2),
37422 animationFrameID = _ref2[0],
37423 timeoutID = _ref2[1];
37424
37425 cancelAnimationFrameFn(animationFrameID);
37426 clearTimeoutFn(timeoutID);
37427 };
37428 requestFrame = function requestAnimationFrameWithSetTimeoutFallback(callback) {
37429 var animationFrameID = requestAnimationFrameFn(function animationFrameCallback() {
37430 clearTimeoutFn(timeoutID);
37431 callback();
37432 });
37433
37434 var timeoutID = setTimeoutFn(function timeoutCallback() {
37435 cancelAnimationFrameFn(animationFrameID);
37436 callback();
37437 }, TIMEOUT_DURATION);
37438
37439 return [animationFrameID, timeoutID];
37440 };
37441 }
37442
37443 function createDetectElementResize(nonce) {
37444 var animationKeyframes = void 0;
37445 var animationName = void 0;
37446 var animationStartEvent = void 0;
37447 var animationStyle = void 0;
37448 var checkTriggers = void 0;
37449 var resetTriggers = void 0;
37450 var scrollListener = void 0;
37451
37452 var attachEvent = typeof document !== 'undefined' && document.attachEvent;
37453 if (!attachEvent) {
37454 resetTriggers = function resetTriggers(element) {
37455 var triggers = element.__resizeTriggers__,
37456 expand = triggers.firstElementChild,
37457 contract = triggers.lastElementChild,
37458 expandChild = expand.firstElementChild;
37459 contract.scrollLeft = contract.scrollWidth;
37460 contract.scrollTop = contract.scrollHeight;
37461 expandChild.style.width = expand.offsetWidth + 1 + 'px';
37462 expandChild.style.height = expand.offsetHeight + 1 + 'px';
37463 expand.scrollLeft = expand.scrollWidth;
37464 expand.scrollTop = expand.scrollHeight;
37465 };
37466
37467 checkTriggers = function checkTriggers(element) {
37468 return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height;
37469 };
37470
37471 scrollListener = function scrollListener(e) {
37472 // Don't measure (which forces) reflow for scrolls that happen inside of children!
37473 if (e.target.className && typeof e.target.className.indexOf === 'function' && e.target.className.indexOf('contract-trigger') < 0 && e.target.className.indexOf('expand-trigger') < 0) {
37474 return;
37475 }
37476
37477 var element = this;
37478 resetTriggers(this);
37479 if (this.__resizeRAF__) {
37480 cancelFrame(this.__resizeRAF__);
37481 }
37482 this.__resizeRAF__ = requestFrame(function animationFrame() {
37483 if (checkTriggers(element)) {
37484 element.__resizeLast__.width = element.offsetWidth;
37485 element.__resizeLast__.height = element.offsetHeight;
37486 element.__resizeListeners__.forEach(function forEachResizeListener(fn) {
37487 fn.call(element, e);
37488 });
37489 }
37490 });
37491 };
37492
37493 /* Detect CSS Animations support to detect element display/re-attach */
37494 var animation = false;
37495 var keyframeprefix = '';
37496 animationStartEvent = 'animationstart';
37497 var domPrefixes = 'Webkit Moz O ms'.split(' ');
37498 var startEvents = 'webkitAnimationStart animationstart oAnimationStart MSAnimationStart'.split(' ');
37499 var pfx = '';
37500 {
37501 var elm = document.createElement('fakeelement');
37502 if (elm.style.animationName !== undefined) {
37503 animation = true;
37504 }
37505
37506 if (animation === false) {
37507 for (var i = 0; i < domPrefixes.length; i++) {
37508 if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {
37509 pfx = domPrefixes[i];
37510 keyframeprefix = '-' + pfx.toLowerCase() + '-';
37511 animationStartEvent = startEvents[i];
37512 animation = true;
37513 break;
37514 }
37515 }
37516 }
37517 }
37518
37519 animationName = 'resizeanim';
37520 animationKeyframes = '@' + keyframeprefix + 'keyframes ' + animationName + ' { from { opacity: 0; } to { opacity: 0; } } ';
37521 animationStyle = keyframeprefix + 'animation: 1ms ' + animationName + '; ';
37522 }
37523
37524 var createStyles = function createStyles(doc) {
37525 if (!doc.getElementById('detectElementResize')) {
37526 //opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
37527 var css = (animationKeyframes ? animationKeyframes : '') + '.resize-triggers { ' + (animationStyle ? animationStyle : '') + 'visibility: hidden; opacity: 0; } ' + '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
37528 head = doc.head || doc.getElementsByTagName('head')[0],
37529 style = doc.createElement('style');
37530
37531 style.id = 'detectElementResize';
37532 style.type = 'text/css';
37533
37534 if (nonce != null) {
37535 style.setAttribute('nonce', nonce);
37536 }
37537
37538 if (style.styleSheet) {
37539 style.styleSheet.cssText = css;
37540 } else {
37541 style.appendChild(doc.createTextNode(css));
37542 }
37543
37544 head.appendChild(style);
37545 }
37546 };
37547
37548 var addResizeListener = function addResizeListener(element, fn) {
37549 if (attachEvent) {
37550 element.attachEvent('onresize', fn);
37551 } else {
37552 if (!element.__resizeTriggers__) {
37553 var doc = element.ownerDocument;
37554 var elementStyle = windowObject.getComputedStyle(element);
37555 if (elementStyle && elementStyle.position === 'static') {
37556 element.style.position = 'relative';
37557 }
37558 createStyles(doc);
37559 element.__resizeLast__ = {};
37560 element.__resizeListeners__ = [];
37561 (element.__resizeTriggers__ = doc.createElement('div')).className = 'resize-triggers';
37562 var expandTrigger = doc.createElement('div');
37563 expandTrigger.className = 'expand-trigger';
37564 expandTrigger.appendChild(doc.createElement('div'));
37565 var contractTrigger = doc.createElement('div');
37566 contractTrigger.className = 'contract-trigger';
37567 element.__resizeTriggers__.appendChild(expandTrigger);
37568 element.__resizeTriggers__.appendChild(contractTrigger);
37569 element.appendChild(element.__resizeTriggers__);
37570 resetTriggers(element);
37571 element.addEventListener('scroll', scrollListener, true);
37572
37573 /* Listen for a css animation to detect element display/re-attach */
37574 if (animationStartEvent) {
37575 element.__resizeTriggers__.__animationListener__ = function animationListener(e) {
37576 if (e.animationName === animationName) {
37577 resetTriggers(element);
37578 }
37579 };
37580 element.__resizeTriggers__.addEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
37581 }
37582 }
37583 element.__resizeListeners__.push(fn);
37584 }
37585 };
37586
37587 var removeResizeListener = function removeResizeListener(element, fn) {
37588 if (attachEvent) {
37589 element.detachEvent('onresize', fn);
37590 } else {
37591 element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
37592 if (!element.__resizeListeners__.length) {
37593 element.removeEventListener('scroll', scrollListener, true);
37594 if (element.__resizeTriggers__.__animationListener__) {
37595 element.__resizeTriggers__.removeEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
37596 element.__resizeTriggers__.__animationListener__ = null;
37597 }
37598 try {
37599 element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
37600 } catch (e) {
37601 // Preact compat; see developit/preact-compat/issues/228
37602 }
37603 }
37604 }
37605 };
37606
37607 return {
37608 addResizeListener: addResizeListener,
37609 removeResizeListener: removeResizeListener
37610 };
37611 }
37612
37613 var AutoSizer = function (_React$PureComponent) {
37614 inherits(AutoSizer, _React$PureComponent);
37615
37616 function AutoSizer() {
37617 var _ref;
37618
37619 var _temp, _this, _ret;
37620
37621 classCallCheck(this, AutoSizer);
37622
37623 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
37624 args[_key] = arguments[_key];
37625 }
37626
37627 return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = AutoSizer.__proto__ || Object.getPrototypeOf(AutoSizer)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
37628 height: _this.props.defaultHeight || 0,
37629 width: _this.props.defaultWidth || 0
37630 }, _this._onResize = function () {
37631 var _this$props = _this.props,
37632 disableHeight = _this$props.disableHeight,
37633 disableWidth = _this$props.disableWidth,
37634 onResize = _this$props.onResize;
37635
37636
37637 if (_this._parentNode) {
37638 // Guard against AutoSizer component being removed from the DOM immediately after being added.
37639 // This can result in invalid style values which can result in NaN values if we don't handle them.
37640 // See issue #150 for more context.
37641
37642 var _height = _this._parentNode.offsetHeight || 0;
37643 var _width = _this._parentNode.offsetWidth || 0;
37644
37645 var _style = window.getComputedStyle(_this._parentNode) || {};
37646 var paddingLeft = parseInt(_style.paddingLeft, 10) || 0;
37647 var paddingRight = parseInt(_style.paddingRight, 10) || 0;
37648 var paddingTop = parseInt(_style.paddingTop, 10) || 0;
37649 var paddingBottom = parseInt(_style.paddingBottom, 10) || 0;
37650
37651 var newHeight = _height - paddingTop - paddingBottom;
37652 var newWidth = _width - paddingLeft - paddingRight;
37653
37654 if (!disableHeight && _this.state.height !== newHeight || !disableWidth && _this.state.width !== newWidth) {
37655 _this.setState({
37656 height: _height - paddingTop - paddingBottom,
37657 width: _width - paddingLeft - paddingRight
37658 });
37659
37660 onResize({ height: _height, width: _width });
37661 }
37662 }
37663 }, _this._setRef = function (autoSizer) {
37664 _this._autoSizer = autoSizer;
37665 }, _temp), possibleConstructorReturn(_this, _ret);
37666 }
37667
37668 createClass(AutoSizer, [{
37669 key: 'componentDidMount',
37670 value: function componentDidMount() {
37671 var nonce = this.props.nonce;
37672
37673 if (this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement) {
37674 // Delay access of parentNode until mount.
37675 // This handles edge-cases where the component has already been unmounted before its ref has been set,
37676 // As well as libraries like react-lite which have a slightly different lifecycle.
37677 this._parentNode = this._autoSizer.parentNode;
37678
37679 // Defer requiring resize handler in order to support server-side rendering.
37680 // See issue #41
37681 this._detectElementResize = createDetectElementResize(nonce);
37682 this._detectElementResize.addResizeListener(this._parentNode, this._onResize);
37683
37684 this._onResize();
37685 }
37686 }
37687 }, {
37688 key: 'componentWillUnmount',
37689 value: function componentWillUnmount() {
37690 if (this._detectElementResize && this._parentNode) {
37691 this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
37692 }
37693 }
37694 }, {
37695 key: 'render',
37696 value: function render() {
37697 var _props = this.props,
37698 children = _props.children,
37699 className = _props.className,
37700 disableHeight = _props.disableHeight,
37701 disableWidth = _props.disableWidth,
37702 style = _props.style;
37703 var _state = this.state,
37704 height = _state.height,
37705 width = _state.width;
37706
37707 // Outer div should not force width/height since that may prevent containers from shrinking.
37708 // Inner component should overflow and use calculated width/height.
37709 // See issue #68 for more information.
37710
37711 var outerStyle = { overflow: 'visible' };
37712 var childParams = {};
37713
37714 // Avoid rendering children before the initial measurements have been collected.
37715 // At best this would just be wasting cycles.
37716 var bailoutOnChildren = false;
37717
37718 if (!disableHeight) {
37719 if (height === 0) {
37720 bailoutOnChildren = true;
37721 }
37722 outerStyle.height = 0;
37723 childParams.height = height;
37724 }
37725
37726 if (!disableWidth) {
37727 if (width === 0) {
37728 bailoutOnChildren = true;
37729 }
37730 outerStyle.width = 0;
37731 childParams.width = width;
37732 }
37733
37734 return react.exports.createElement(
37735 'div',
37736 {
37737 className: className,
37738 ref: this._setRef,
37739 style: _extends({}, outerStyle, style)
37740 },
37741 !bailoutOnChildren && children(childParams)
37742 );
37743 }
37744 }]);
37745 return AutoSizer;
37746 }(react.exports.PureComponent);
37747
37748 AutoSizer.defaultProps = {
37749 onResize: function onResize() {},
37750 disableHeight: false,
37751 disableWidth: false,
37752 style: {}
37753 };
37754
37755 /**
37756 * Hook that confirms selection when
37757 * user interact outside of passed element ref.
37758 */
37759
37760 function useConfirmUnfocus(ref, selections) {
37761 const [_isConfirmed, _setIsConfirmed] = react.exports.useState(false); // Wrap state in ref to use inside eventListener callback
37762
37763 const isConfirmedRef = react.exports.useRef(_isConfirmed);
37764
37765 const setIsConfirmed = c => {
37766 isConfirmedRef.current = c;
37767
37768 _setIsConfirmed(c);
37769 };
37770
37771 react.exports.useEffect(() => {
37772 const handleEvent = event => {
37773 const interactInside = ref.current && ref.current.contains(event.target);
37774 const isConfirmed = isConfirmedRef.current;
37775
37776 if (!interactInside && !isConfirmed) {
37777 selections && selections.confirm.call(selections);
37778 setIsConfirmed(true);
37779 } else if (interactInside) {
37780 setIsConfirmed(false);
37781 }
37782 };
37783
37784 document.addEventListener('mousedown', handleEvent);
37785 document.addEventListener('keydown', handleEvent);
37786 return () => {
37787 document.removeEventListener('mousedown', handleEvent);
37788 document.removeEventListener('keydown', handleEvent);
37789 };
37790 }, [ref, selections]);
37791 }
37792
37793 const useStyles$4 = makeStyles$1(() => ({
37794 listBoxHeader: {
37795 alignSelf: 'center',
37796 display: 'inline-flex'
37797 }
37798 }));
37799 function ListBoxInline(_ref) {
37800 let {
37801 app,
37802 fieldIdentifier,
37803 stateName = '$',
37804 options = {},
37805 fieldDef
37806 } = _ref;
37807 const {
37808 title,
37809 direction,
37810 listLayout,
37811 search = true,
37812 focusSearch = false,
37813 toolbar = true,
37814 rangeSelect = true,
37815 checkboxes = false,
37816 properties = {},
37817 sessionModel = undefined,
37818 selectionsApi = undefined,
37819 update = undefined,
37820 fetchStart = undefined,
37821 dense = false,
37822 selectDisabled = () => false,
37823 showGray = true,
37824 sortByState = 1,
37825 scrollState = undefined,
37826 setCount = undefined
37827 } = options;
37828 let {
37829 frequencyMode,
37830 histogram = false
37831 } = options;
37832
37833 if (fieldDef && fieldDef.failedToFetchFieldDef) {
37834 histogram = false;
37835 frequencyMode = 'N';
37836 }
37837
37838 switch (true) {
37839 case ['none', 'N', 'NX_FREQUENCY_NONE'].includes(frequencyMode):
37840 frequencyMode = 'N';
37841 break;
37842
37843 case ['value', 'V', 'NX_FREQUENCY_VALUE', 'default'].includes(frequencyMode):
37844 frequencyMode = 'V';
37845 break;
37846
37847 case ['percent', 'P', 'NX_FREQUENCY_PERCENT'].includes(frequencyMode):
37848 frequencyMode = 'P';
37849 break;
37850
37851 case ['relative', 'R', 'NX_FREQUENCY_RELATIVE'].includes(frequencyMode):
37852 frequencyMode = 'R';
37853 break;
37854
37855 default:
37856 frequencyMode = 'N';
37857 break;
37858 }
37859
37860 const getListdefFrequencyMode = () => histogram && frequencyMode === 'N' ? 'V' : frequencyMode; // Hook that will trigger update when used in useEffects.
37861 // Modified from: https://medium.com/@teh_builder/ref-objects-inside-useeffect-hooks-eb7c15198780
37862
37863
37864 const useRefWithCallback = () => {
37865 const [ref, setInternalRef] = react.exports.useState({});
37866 const setRef = react.exports.useCallback(node => {
37867 setInternalRef({
37868 current: node
37869 });
37870 }, [setInternalRef]);
37871 return [ref, setRef];
37872 };
37873
37874 const listdef = _objectSpread2({
37875 qInfo: {
37876 qType: 'njsListbox'
37877 },
37878 qListObjectDef: {
37879 qStateName: stateName,
37880 qShowAlternatives: true,
37881 qFrequencyMode: getListdefFrequencyMode(),
37882 qInitialDataFetch: [{
37883 qTop: 0,
37884 qLeft: 0,
37885 qWidth: 0,
37886 qHeight: 0
37887 }],
37888 qDef: {
37889 qSortCriterias: [{
37890 qSortByState: sortByState,
37891 qSortByAscii: 1,
37892 qSortByNumeric: 1,
37893 qSortByLoadOrder: 1
37894 }]
37895 }
37896 },
37897 title
37898 }, properties); // Something something lib dimension
37899
37900
37901 let fieldName;
37902
37903 if (fieldIdentifier.qLibraryId) {
37904 listdef.qListObjectDef.qLibraryId = fieldIdentifier.qLibraryId;
37905 fieldName = fieldIdentifier.qLibraryId;
37906 } else {
37907 listdef.qListObjectDef.qDef.qFieldDefs = [fieldIdentifier];
37908 fieldName = fieldIdentifier;
37909 }
37910
37911 if (frequencyMode !== 'N' || histogram) {
37912 const field = fieldIdentifier.qLibraryId ? fieldDef : fieldName;
37913 listdef.frequencyMax = {
37914 qValueExpression: "Max(AGGR(Count([".concat(field, "]), [").concat(field, "]))")
37915 };
37916 }
37917
37918 let [model] = useSessionModel(listdef, sessionModel ? null : app, fieldName, stateName);
37919
37920 if (sessionModel) {
37921 model = sessionModel;
37922 }
37923
37924 let selections = useObjectSelections(selectionsApi ? {} : app, model)[0];
37925
37926 if (selectionsApi) {
37927 selections = selectionsApi;
37928 }
37929
37930 const theme = useTheme$2();
37931 const classes = useStyles$4();
37932 const lock = react.exports.useCallback(() => {
37933 model.lock('/qListObjectDef');
37934 }, [model]);
37935 const unlock = react.exports.useCallback(() => {
37936 model.unlock('/qListObjectDef');
37937 }, [model]);
37938 const {
37939 translator,
37940 keyboardNavigation
37941 } = react.exports.useContext(InstanceContext);
37942 const moreAlignTo = react.exports.useRef();
37943 const [searchContainer, searchContainerRef] = useRefWithCallback();
37944 const [layout] = useLayout$1(model);
37945 const [showToolbar, setShowToolbar] = react.exports.useState(false);
37946 const [showSearch, setShowSearch] = react.exports.useState(false);
37947 const [keyboardActive, setKeyboardActive] = react.exports.useState(false);
37948 const handleKeyDown = getListboxInlineKeyboardNavigation({
37949 setKeyboardActive
37950 }); // Expose the keyboard flags in the same way as the keyboard hook does.
37951
37952 const keyboard = {
37953 enabled: keyboardNavigation,
37954 // this will be static until we can access the useKeyboard hook
37955 active: keyboardActive
37956 };
37957 react.exports.useEffect(() => {
37958 const show = () => setShowToolbar(true);
37959
37960 const hide = () => setShowToolbar(false);
37961
37962 if (selections) {
37963 if (!selections.isModal(model)) {
37964 selections.on('deactivated', hide);
37965 selections.on('activated', show);
37966 }
37967 }
37968
37969 return () => {
37970 if (selections) {
37971 selections.removeListener('deactivated', show);
37972 selections.removeListener('activated', hide);
37973 }
37974 };
37975 }, [selections]);
37976 react.exports.useEffect(() => {
37977 if (selections) {
37978 setShowToolbar(selections.isActive());
37979 }
37980 }, [selections]);
37981 const listBoxRef = react.exports.useRef(null);
37982 useConfirmUnfocus(listBoxRef, selections);
37983 react.exports.useEffect(() => {
37984 if (!searchContainer || !searchContainer.current) {
37985 return;
37986 } // Focus search field on toggle-show or when focusSearch is true.
37987
37988
37989 if (search && focusSearch || search === 'toggle' && showSearch) {
37990 const input = searchContainer.current.querySelector('input');
37991 input && input.focus();
37992 }
37993 }, [searchContainer && searchContainer.current, showSearch, search, focusSearch]);
37994
37995 if (!model || !layout || !translator) {
37996 return null;
37997 }
37998
37999 const isLocked = layout.qListObject.qDimensionInfo.qLocked === true;
38000 const listboxSelectionToolbarItems = toolbar ? createListboxSelectionToolbar({
38001 layout,
38002 model,
38003 translator
38004 }) : [];
38005 const counts = layout.qListObject.qDimensionInfo.qStateCounts;
38006 const hasSelections = counts.qSelected + counts.qSelectedExcluded + counts.qLocked + counts.qLockedExcluded > 0;
38007 const searchVisible = (search === true || search === 'toggle' && showSearch) && !selectDisabled();
38008 const minHeight = 49 + (searchVisible ? 40 : 0) + 49;
38009
38010 const onShowSearch = () => {
38011 const newValue = !showSearch;
38012 setShowSearch(newValue);
38013 };
38014
38015 const getSearchOrUnlock = () => search === 'toggle' && !hasSelections ? /*#__PURE__*/React.createElement(IconButton$1, {
38016 onClick: onShowSearch,
38017 tabIndex: -1,
38018 title: translator.get('Listbox.Search')
38019 }, /*#__PURE__*/React.createElement(SearchIcon, null)) : /*#__PURE__*/React.createElement(IconButton$1, {
38020 onClick: lock,
38021 tabIndex: -1,
38022 disabled: !hasSelections
38023 }, /*#__PURE__*/React.createElement(Unlock, null));
38024
38025 return /*#__PURE__*/React.createElement(StyledGrid, {
38026 container: true,
38027 tabIndex: keyboard.enabled && !keyboard.active ? 0 : -1,
38028 direction: "column",
38029 spacing: 0,
38030 style: {
38031 height: '100%',
38032 minHeight: "".concat(minHeight, "px")
38033 },
38034 onKeyDown: handleKeyDown,
38035 ref: listBoxRef
38036 }, toolbar && /*#__PURE__*/React.createElement(StyledGrid, {
38037 item: true,
38038 container: true,
38039 style: {
38040 padding: theme.spacing(1)
38041 }
38042 }, /*#__PURE__*/React.createElement(StyledGrid, {
38043 item: true
38044 }, isLocked ? /*#__PURE__*/React.createElement(IconButton$1, {
38045 tabIndex: -1,
38046 onClick: unlock,
38047 disabled: !isLocked
38048 }, /*#__PURE__*/React.createElement(Lock, {
38049 title: translator.get('Listbox.Unlock')
38050 })) : getSearchOrUnlock()), /*#__PURE__*/React.createElement(StyledGrid, {
38051 item: true,
38052 className: classes.listBoxHeader
38053 }, /*#__PURE__*/React.createElement(Typography$1, {
38054 variant: "h6",
38055 noWrap: true
38056 }, layout.title || layout.qListObject.qDimensionInfo.qFallbackTitle)), /*#__PURE__*/React.createElement(StyledGrid, {
38057 item: true,
38058 xs: true
38059 }), /*#__PURE__*/React.createElement(StyledGrid, {
38060 item: true
38061 }, /*#__PURE__*/React.createElement(ActionsToolbar, {
38062 more: {
38063 enabled: !isLocked,
38064 actions: listboxSelectionToolbarItems,
38065 alignTo: moreAlignTo,
38066 popoverProps: {
38067 elevation: 0
38068 },
38069 popoverPaperStyle: {
38070 boxShadow: '0 12px 8px -8px rgba(0, 0, 0, 0.2)',
38071 minWidth: '250px'
38072 }
38073 },
38074 selections: {
38075 show: showToolbar,
38076 api: selections,
38077 onConfirm: () => {},
38078 onCancel: () => {}
38079 }
38080 }))), searchVisible && /*#__PURE__*/React.createElement(StyledGrid, {
38081 item: true,
38082 ref: searchContainerRef
38083 }, /*#__PURE__*/React.createElement(ListBoxSearch, {
38084 model: model,
38085 dense: dense,
38086 keyboard: keyboard
38087 })), /*#__PURE__*/React.createElement(StyledGrid, {
38088 item: true,
38089 xs: true
38090 }, /*#__PURE__*/React.createElement("div", {
38091 ref: moreAlignTo
38092 }), /*#__PURE__*/React.createElement(AutoSizer, null, _ref2 => {
38093 let {
38094 height,
38095 width
38096 } = _ref2;
38097 return /*#__PURE__*/React.createElement(ListBox, {
38098 model: model,
38099 selections: selections,
38100 direction: direction,
38101 listLayout: listLayout,
38102 frequencyMode: frequencyMode,
38103 histogram: histogram,
38104 rangeSelect: rangeSelect,
38105 checkboxes: checkboxes,
38106 height: height,
38107 width: width,
38108 update: update,
38109 fetchStart: fetchStart,
38110 dense: dense,
38111 selectDisabled: selectDisabled,
38112 keyboard: keyboard,
38113 showGray: showGray,
38114 scrollState: scrollState,
38115 sortByState: sortByState,
38116 setCount: setCount
38117 });
38118 })));
38119 }
38120
38121 function ListBoxFetchMasterItem(_ref) {
38122 let {
38123 app,
38124 fieldIdentifier,
38125 stateName = '$',
38126 options = {}
38127 } = _ref;
38128 const [fieldDef, setFieldDef] = react.exports.useState('');
38129 const [isFetchingData, setIsFetchingData] = react.exports.useState(false);
38130 react.exports.useEffect(() => {
38131 async function fetchData() {
38132 setIsFetchingData(true);
38133
38134 try {
38135 const dim = await app.getDimension(fieldIdentifier.qLibraryId);
38136 const dimLayout = await dim.getLayout();
38137 setFieldDef(dimLayout.qDim.qFieldDefs ? dimLayout.qDim.qFieldDefs[0] : '');
38138 setIsFetchingData(false);
38139 } catch (e) {
38140 setIsFetchingData(false);
38141 setFieldDef({
38142 failedToFetchFieldDef: true
38143 });
38144 throw new Error("Disabling frequency count and histogram: ".concat(e && e.message));
38145 }
38146 }
38147
38148 fetchData();
38149 }, []);
38150
38151 if (isFetchingData) {
38152 return null;
38153 }
38154
38155 return /*#__PURE__*/React.createElement(ListBoxInline, {
38156 app: app,
38157 fieldIdentifier: fieldIdentifier,
38158 stateName: stateName,
38159 options: options,
38160 fieldDef: fieldDef
38161 });
38162 }
38163 function ListBoxPortal(_ref2) {
38164 let {
38165 app,
38166 fieldIdentifier,
38167 stateName,
38168 element,
38169 options
38170 } = _ref2;
38171 const isFrequencyMaxNeeded = options.histogram || options.frequencyMode !== 'N';
38172 const TheComponent = fieldIdentifier.qLibraryId && isFrequencyMaxNeeded ? ListBoxFetchMasterItem : ListBoxInline;
38173 return ReactDOM.createPortal( /*#__PURE__*/React.createElement(TheComponent, {
38174 app: app,
38175 fieldIdentifier: fieldIdentifier,
38176 stateName: stateName,
38177 element: element,
38178 options: options
38179 }), element);
38180 }
38181
38182 const idGen = [[10, 31], [0, 31], [0, 31], [0, 31], [0, 31], [0, 31]];
38183
38184 function toChar(_ref) {
38185 let [min, max] = _ref;
38186 return (min + (Math.random() * (max - min) | 0)).toString(32);
38187 }
38188
38189 function uid() {
38190 return idGen.map(toChar).join('');
38191 }
38192
38193 function addIndex(array, index) {
38194 for (let i = 0; i < array.length; ++i) {
38195 if (array[i] >= 0 && array[i] >= index) {
38196 ++array[i];
38197 }
38198 }
38199
38200 array.push(index);
38201 }
38202
38203 function removeIndex(array, index) {
38204 let removeIdx = 0;
38205
38206 for (let i = 0; i < array.length; ++i) {
38207 if (array[i] > index) {
38208 --array[i];
38209 } else if (array[i] === index) {
38210 removeIdx = i;
38211 }
38212 }
38213
38214 array.splice(removeIdx, 1);
38215 return removeIdx;
38216 }
38217
38218 const nxDimension = f => ({
38219 qDef: {
38220 qFieldDefs: [f]
38221 }
38222 });
38223
38224 const nxMeasure = f => ({
38225 qDef: {
38226 qDef: f
38227 }
38228 });
38229
38230 function hcHandler(_ref) {
38231 let {
38232 dc: hc,
38233 def,
38234 properties
38235 } = _ref;
38236 hc.qDimensions = hc.qDimensions || [];
38237 hc.qMeasures = hc.qMeasures || [];
38238 hc.qInterColumnSortOrder = hc.qInterColumnSortOrder || [];
38239 hc.qInitialDataFetch = hc.qInitialDataFetch || [];
38240 hc.qColumnOrder = hc.qColumnOrder || [];
38241 hc.qExpansionState = hc.qExpansionState || [];
38242 const objectProperties = properties;
38243 const handler = {
38244 dimensions() {
38245 return hc.qDimensions;
38246 },
38247
38248 measures() {
38249 return hc.qMeasures;
38250 },
38251
38252 addDimension(d) {
38253 const dimension = typeof d === 'string' ? nxDimension(d) : _objectSpread2(_objectSpread2({}, d), {}, {
38254 qDef: d.qDef || {}
38255 });
38256 dimension.qDef.cId = dimension.qDef.cId || uid(); // ====== add default objects and arrays for NxDimension =====
38257 // TODO - apply autosort properties based on tags
38258
38259 dimension.qDef.qSortCriterias = dimension.qDef.qSortCriterias || [{
38260 qSortByLoadOrder: 1,
38261 qSortByNumeric: 1,
38262 qSortByAscii: 1
38263 }];
38264 dimension.qOtherTotalSpec = dimension.qOtherTotalSpec || {};
38265 dimension.qAttributeExpressions = dimension.qAttributeExpressions || [];
38266 dimension.qAttributeDimensions = dimension.qAttributeDimensions || []; // ========= end defaults =============
38267
38268 if (hc.qDimensions.length < handler.maxDimensions()) {
38269 hc.qDimensions.push(dimension);
38270 addIndex(hc.qInterColumnSortOrder, hc.qDimensions.length - 1);
38271 def.dimensions.added(dimension, objectProperties);
38272 } else {
38273 hc.qLayoutExclude = hc.qLayoutExclude || {};
38274 hc.qLayoutExclude.qHyperCubeDef = hc.qLayoutExclude.qHyperCubeDef || {};
38275 hc.qLayoutExclude.qHyperCubeDef.qDimensions = hc.qLayoutExclude.qHyperCubeDef.qDimensions || [];
38276 hc.qLayoutExclude.qHyperCubeDef.qMeasures = hc.qLayoutExclude.qHyperCubeDef.qMeasures || [];
38277 hc.qLayoutExclude.qHyperCubeDef.qDimensions.push(dimension);
38278 }
38279 },
38280
38281 removeDimension(idx) {
38282 const dimension = hc.qDimensions.splice(idx, 1)[0];
38283 removeIndex(hc.qInterColumnSortOrder, idx);
38284 def.dimensions.removed(dimension, objectProperties, idx);
38285 },
38286
38287 addMeasure(m) {
38288 const measure = typeof m === 'string' ? nxMeasure(m) : _objectSpread2(_objectSpread2({}, m), {}, {
38289 qDef: m.qDef || {}
38290 });
38291 measure.qDef.cId = measure.qDef.cId || uid(); // ====== add default objects and arrays for NxMeasure =====
38292
38293 measure.qSortBy = measure.qSortBy || {
38294 qSortByLoadOrder: 1,
38295 qSortByNumeric: -1
38296 };
38297 measure.qAttributeDimensions = measure.qAttributeDimensions || [];
38298 measure.qAttributeExpressions = measure.qAttributeExpressions || [];
38299
38300 if (hc.qMeasures.length < handler.maxMeasures()) {
38301 hc.qMeasures.push(measure);
38302 addIndex(hc.qInterColumnSortOrder, hc.qDimensions.length + hc.qMeasures.length - 1);
38303 def.measures.added(measure, objectProperties);
38304 } else {
38305 hc.qLayoutExclude = hc.qLayoutExclude || {};
38306 hc.qLayoutExclude.qHyperCubeDef = hc.qLayoutExclude.qHyperCubeDef || {};
38307 hc.qLayoutExclude.qHyperCubeDef.qDimensions = hc.qLayoutExclude.qHyperCubeDef.qDimensions || [];
38308 hc.qLayoutExclude.qHyperCubeDef.qMeasures = hc.qLayoutExclude.qHyperCubeDef.qMeasures || [];
38309 hc.qLayoutExclude.qHyperCubeDef.qMeasures.push(measure);
38310 }
38311 },
38312
38313 removeMeasure(idx) {
38314 const measure = hc.qMeasures.splice(idx, 1)[0];
38315 removeIndex(hc.qInterColumnSortOrder, hc.qDimensions.length + idx);
38316 def.measures.removed(measure, objectProperties, idx);
38317 },
38318
38319 maxDimensions() {
38320 return def.dimensions.max(hc.qMeasures.length);
38321 },
38322
38323 maxMeasures() {
38324 return def.measures.max(hc.qDimensions.length);
38325 },
38326
38327 canAddDimension() {
38328 return hc.qDimensions.length < handler.maxDimensions();
38329 },
38330
38331 canAddMeasure() {
38332 return hc.qMeasures.length < handler.maxMeasures();
38333 }
38334
38335 };
38336 return handler;
38337 }
38338
38339 /**
38340 * @interface LibraryField
38341 * @property {string} qLibraryId
38342 * @property {'dimension'|'measure'} type
38343 */
38344
38345 function fieldType(f) {
38346 if ( // a string starting with '=' is just a convention we use
38347 typeof f === 'string' && f[0] === '=' || // based on NxMeasure and NxInlineMeasureDef
38348 typeof f === 'object' && f.qDef && f.qDef.qDef || // use 'type' instead of 'qType' since this is not a real property
38349 typeof f === 'object' && f.qLibraryId && f.type === 'measure') {
38350 return 'measure';
38351 }
38352
38353 return 'dimension';
38354 }
38355 function populateData(_ref) {
38356 let {
38357 sn,
38358 properties,
38359 fields
38360 } = _ref;
38361
38362 if (!fields.length) {
38363 return;
38364 }
38365
38366 const target = sn.qae.data.targets[0];
38367
38368 if (!target) {
38369 {
38370 console.warn('Attempting to add fields to an object without a specified data target'); // eslint-disable-line no-console
38371 }
38372
38373 return;
38374 }
38375
38376 const {
38377 propertyPath
38378 } = target;
38379 const parts = propertyPath.split('/');
38380 let p = properties;
38381
38382 for (let i = 0; i < parts.length; i++) {
38383 const s = parts[i];
38384 p = s ? p[s] : p;
38385 }
38386
38387 const hc = hcHandler({
38388 dc: p,
38389 def: target,
38390 properties
38391 });
38392 fields.forEach(f => {
38393 const type = fieldType(f);
38394
38395 if (type === 'measure') {
38396 hc.addMeasure(f);
38397 } else {
38398 hc.addDimension(f);
38399 }
38400 });
38401 }
38402
38403 /**
38404 * Used for exporting and importing properties between backend models. An object that exports to
38405 * ExportFormat should put dimensions and measures inside one data group. If an object has two hypercubes,
38406 * each of the cubes should export dimensions and measures in two separate data groups.
38407 * An object that imports from this structure is responsible for putting the existing properties where they should be
38408 * in the new model.
38409 * @interface ExportFormat
38410 * @since 1.1.0
38411 * @property {(ExportDataDef[])=} data
38412 * @property {object=} properties
38413 */
38414
38415 /**
38416 * @since 1.1.0
38417 * @interface ExportDataDef
38418 * @property {EngineAPI.INxDimension[]} dimensions
38419 * @property {EngineAPI.INxMeasure[]} measures
38420 * @property {EngineAPI.INxDimension[]} excludedDimensions
38421 * @property {EngineAPI.INxMeasure[]} excludedMeasures
38422 * @property {number[]} interColumnSortOrder
38423 */
38424
38425 /**
38426 * @since 1.1.0
38427 * @ignore
38428 * @param {number} nDataGroups
38429 * @return {ExportFormat}
38430 */
38431 function createExportFormat() {
38432 let nDataGroups = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
38433 const exportFormat = {
38434 data: [],
38435 properties: {}
38436 };
38437
38438 for (let i = 0; i < nDataGroups; ++i) {
38439 exportFormat.data.push({
38440 dimensions: [],
38441 measures: [],
38442 excludedDimensions: [],
38443 excludedMeasures: [],
38444 interColumnSortOrder: []
38445 });
38446 }
38447
38448 return exportFormat;
38449 }
38450
38451 /**
38452 * Gets a value from a data object structure.
38453 *
38454 * @ignore
38455 * @param data The data object.
38456 * @param reference Reference to the value.
38457 * @param defaultValue Default value to return if no value was found.
38458 * @returns {*} The default value if specified, otherwise undefined.
38459 */
38460 const getValue = (data, reference, defaultValue) => {
38461 if (data === undefined || data === null || reference === undefined || reference === null) {
38462 return defaultValue;
38463 }
38464
38465 const steps = reference.split('.');
38466 let dataContainer = data;
38467
38468 for (let i = 0; i < steps.length; ++i) {
38469 const step = steps[i];
38470
38471 if (step === '') {
38472 continue; // eslint-disable-line no-continue
38473 }
38474
38475 if (dataContainer[step] === undefined || dataContainer[step] === null) {
38476 return defaultValue;
38477 }
38478
38479 dataContainer = dataContainer[step];
38480 }
38481
38482 return dataContainer;
38483 };
38484 /**
38485 * Sets a value in a data object using a dot notated reference to point out the path.
38486 *
38487 * Example:
38488 * If data is an empty object, reference is "my.value" and value the is "x", then
38489 * the resulting data object will be: { my: { value: "x" } }
38490 *
38491 * @ignore
38492 * @param data The data object. Must be an object.
38493 * @param reference Reference to the value.
38494 * @param value Arbitrary value to set. If the value is set to undefined, the value property will be removed.
38495 */
38496
38497
38498 const setValue = (data, reference, value) => {
38499 if (data === undefined || data === null || reference === undefined || reference === null) {
38500 return;
38501 }
38502
38503 const steps = reference.split('.');
38504 const propertyName = steps[steps.length - 1];
38505 let dataContainer = data;
38506
38507 for (let i = 0; i < steps.length - 1; ++i) {
38508 const step = steps[i];
38509
38510 if (dataContainer[step] === undefined || dataContainer[step] === null) {
38511 dataContainer[step] = Number.isNaN(+steps[i + 1]) ? {} : [];
38512 }
38513
38514 dataContainer = dataContainer[step];
38515 }
38516
38517 if (typeof value !== 'undefined' && propertyName !== '__proto__' && propertyName !== 'constructor') {
38518 dataContainer[propertyName] = value;
38519 } else {
38520 delete dataContainer[propertyName];
38521 }
38522 };
38523
38524 const isEmpty = object => Object.keys(object).length === 0 && object.constructor === Object;
38525
38526 var utils = {
38527 getValue,
38528 setValue,
38529 isEmpty
38530 };
38531
38532 /* eslint-disable no-param-reassign */
38533
38534 /**
38535 * Returns true if the second array is a ordered subset of the first.
38536 *
38537 * @ignore
38538 * @param array1
38539 * @param array2
38540 * @returns {boolean}
38541 */
38542 function isOrderedSubset(outer, subset) {
38543 if (!outer || !subset || !outer.length || !subset.length) {
38544 return false;
38545 }
38546
38547 let start = outer.indexOf(subset[0]);
38548
38549 if (start !== -1) {
38550 for (let i = 0; i < subset.length; i++) {
38551 const next = outer.indexOf(subset[i]);
38552
38553 if (start > next) {
38554 return false;
38555 }
38556
38557 start = next;
38558 }
38559
38560 return true;
38561 }
38562
38563 return false;
38564 }
38565 /**
38566 * Used for adding an index to an index array. An index array contains indices from 0-N in any order and
38567 * is used for keeping track of how items in another arrayed could be presented in a specific order.
38568 *
38569 * @ignore
38570 * @param array
38571 * @param index
38572 */
38573
38574
38575 function indexAdded(array, index) {
38576 let i;
38577
38578 for (i = 0; i < array.length; ++i) {
38579 if (array[i] >= 0 && array[i] >= index) {
38580 ++array[i];
38581 }
38582 }
38583
38584 array.push(index);
38585 }
38586 /**
38587 * Used for removing an index from an index array. An index array contains indices from 0-N in any order and
38588 * is used for keeping track of how items in another arrayed could be presented in a specific order.
38589 *
38590 * @ignore
38591 * @param array
38592 * @param index
38593 */
38594
38595
38596 function indexRemoved(array, index) {
38597 let removeIndex = 0;
38598 let i;
38599
38600 for (i = 0; i < array.length; ++i) {
38601 if (array[i] > index) {
38602 --array[i];
38603 } else if (array[i] === index) {
38604 removeIndex = i;
38605 }
38606 }
38607
38608 array.splice(removeIndex, 1);
38609 return removeIndex;
38610 }
38611
38612 var arrayUtils = {
38613 isOrderedSubset,
38614 indexAdded,
38615 indexRemoved
38616 };
38617
38618 /* eslint-disable no-prototype-builtins */
38619 const MAX_SAFE_INTEGER = 2 ** 53 - 1;
38620 /**
38621 * Restore properties that were temporarily changed during conversion.
38622 *
38623 * @ignore
38624 * @param properties PropertyTree
38625 */
38626
38627 function restoreChangedProperties(properties) {
38628 Object.keys(properties.qLayoutExclude.changed).forEach(property => {
38629 if (properties.qLayoutExclude.changed[property].to === utils.getValue(properties, property)) {
38630 // only revert back to old value if the current value is the same as it was changed to during conversion
38631 utils.setValue(properties, property, properties.qLayoutExclude.changed[property].from);
38632 }
38633 });
38634 }
38635 /**
38636 * Used to check if a property key is part of the master item information
38637 *
38638 * @ignore
38639 * @param propertyName Name of the key in the properties object
38640 * @returns {boolean}
38641 */
38642
38643
38644 function isMasterItemProperty(propertyName) {
38645 return ['qMetaDef', 'descriptionExpression', 'labelExpression'].indexOf(propertyName) !== -1;
38646 }
38647
38648 function importCommonProperties(newProperties, exportFormat, initialProperties) {
38649 // always copy type and visualization
38650 const qType = utils.getValue(exportFormat, 'properties.qInfo.qType') === 'masterobject' ? 'masterobject' : utils.getValue(initialProperties, 'qInfo.qType');
38651 utils.setValue(newProperties, 'qInfo.qType', qType);
38652 newProperties.visualization = initialProperties.visualization;
38653 }
38654
38655 function copyPropertyIfExist(propertyName, source, target) {
38656 if (source.hasOwnProperty(propertyName)) {
38657 target[propertyName] = source[propertyName];
38658 }
38659 }
38660
38661 function copyPropertyOrSetDefault(propertyName, source, target, defaultValue) {
38662 if (source.hasOwnProperty(propertyName)) {
38663 target[propertyName] = source[propertyName];
38664 } else {
38665 target[propertyName] = defaultValue;
38666 }
38667 }
38668
38669 function getOthersLabel() {
38670 return 'Others'; // TODO: translator.get('properties.dimensionLimits.others')
38671 }
38672
38673 function createDefaultDimension(dimensionDef, dimensionProperties) {
38674 const def = extend$2(true, {}, dimensionProperties, dimensionDef);
38675
38676 if (!utils.getValue(def, 'qOtherTotalSpec.qOtherCounted')) {
38677 utils.setValue(def, 'qOtherTotalSpec.qOtherCounted', {
38678 qv: '10'
38679 });
38680 }
38681
38682 if (!utils.getValue(def, 'qOtherTotalSpec.qOtherLimit')) {
38683 utils.setValue(def, 'qOtherTotalSpec.qOtherLimit', {
38684 qv: '0'
38685 });
38686 }
38687
38688 if (!def.hasOwnProperty('othersLabel')) {
38689 def.othersLabel = getOthersLabel();
38690 }
38691
38692 return def;
38693 }
38694
38695 function createDefaultMeasure(measureDef, measureProperties) {
38696 return extend$2(true, {}, measureProperties, measureDef);
38697 }
38698
38699 function resolveValue$1(data, input, defaultValue) {
38700 if (typeof data === 'function') {
38701 return data(input);
38702 }
38703
38704 return !Number.isNaN(+data) ? data : defaultValue;
38705 }
38706
38707 function getHypercubePath(qae) {
38708 const path = utils.getValue(qae, 'data.targets.0.propertyPath', '');
38709 const steps = path.split('/');
38710
38711 if (steps.length && steps[steps.length - 1] === 'qHyperCubeDef') {
38712 steps.length -= 1;
38713 }
38714
38715 return steps.join('.');
38716 }
38717
38718 function getDefaultDimension() {
38719 return {
38720 qDef: {
38721 autoSort: true,
38722 cId: '',
38723 othersLabel: getOthersLabel()
38724 },
38725 qLibraryId: '',
38726 qNullSuppression: false,
38727 qOtherLabel: 'Others',
38728 qOtherTotalSpec: {
38729 qOtherLimitMode: 'OTHER_GE_LIMIT',
38730 qOtherMode: 'OTHER_OFF',
38731 qOtherSortMode: 'OTHER_SORT_DESCENDING',
38732 qSuppressOther: false
38733 }
38734 };
38735 }
38736
38737 function getDefaultMeasure() {
38738 return {
38739 qDef: {
38740 autoSort: true,
38741 cId: '',
38742 numFormatFromTemplate: true
38743 },
38744 qLibraryId: '',
38745 qTrendLines: []
38746 };
38747 }
38748
38749 function setInterColumnSortOrder(_ref) {
38750 let {
38751 exportFormat,
38752 newHyperCubeDef
38753 } = _ref;
38754 const dataGroup = exportFormat.data[0];
38755 const nCols = newHyperCubeDef.qDimensions.length + newHyperCubeDef.qMeasures.length;
38756 newHyperCubeDef.qInterColumnSortOrder = dataGroup.interColumnSortOrder.concat();
38757 let i = newHyperCubeDef.qInterColumnSortOrder.length;
38758
38759 if (i !== nCols) {
38760 if (newHyperCubeDef.qLayoutExclude) {
38761 // Store them if needed
38762 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qInterColumnSortOrder = dataGroup.interColumnSortOrder.concat();
38763 }
38764
38765 while (i !== nCols) {
38766 if (i < nCols) {
38767 arrayUtils.indexAdded(newHyperCubeDef.qInterColumnSortOrder, i);
38768 ++i;
38769 } else {
38770 --i;
38771 arrayUtils.indexRemoved(newHyperCubeDef.qInterColumnSortOrder, i);
38772 }
38773 }
38774 }
38775 }
38776
38777 function createNewProperties(_ref2) {
38778 let {
38779 exportFormat,
38780 initialProperties,
38781 hypercubePath
38782 } = _ref2;
38783 let newProperties = {
38784 qLayoutExclude: {
38785 disabled: {},
38786 quarantine: {}
38787 }
38788 };
38789 Object.keys(exportFormat.properties).forEach(key => {
38790 if (key === 'qLayoutExclude') {
38791 if (exportFormat.properties[key].quarantine) {
38792 newProperties.qLayoutExclude.quarantine = extend$2(true, {}, exportFormat.properties[key].quarantine);
38793 }
38794 } else if (key === 'qHyperCubeDef' && hypercubePath) {
38795 utils.setValue(newProperties, "".concat(hypercubePath, ".qHyperCubeDef"), exportFormat.properties.qHyperCubeDef);
38796 } else if (initialProperties.hasOwnProperty(key) || isMasterItemProperty(key)) {
38797 // TODO: qExtendsId ??
38798 newProperties[key] = exportFormat.properties[key];
38799 } else {
38800 newProperties.qLayoutExclude.disabled[key] = exportFormat.properties[key];
38801 }
38802 });
38803 newProperties = extend$2(true, {}, initialProperties, newProperties);
38804
38805 if (newProperties.components === null) {
38806 newProperties.components = [];
38807 }
38808
38809 return newProperties;
38810 }
38811
38812 function getMaxMinDimensionMeasure(_ref3) {
38813 let {
38814 exportFormat,
38815 dataDefinition = {}
38816 } = _ref3;
38817 const dataGroup = exportFormat.data[0];
38818 const dimensionDef = dataDefinition.dimensions || {
38819 max: 0
38820 };
38821 const measureDef = dataDefinition.measures || {
38822 max: 0
38823 };
38824 const maxMeasures = resolveValue$1(measureDef.max, dataGroup.dimensions.length, MAX_SAFE_INTEGER);
38825 const minMeasures = resolveValue$1(measureDef.min, dataGroup.dimensions.length, 0);
38826 const maxDimensions = resolveValue$1(dimensionDef.max, maxMeasures, MAX_SAFE_INTEGER);
38827 const minDimensions = resolveValue$1(dimensionDef.min, minMeasures, 0);
38828 return {
38829 maxDimensions,
38830 minDimensions,
38831 maxMeasures,
38832 minMeasures
38833 };
38834 }
38835
38836 function shouldInitLayoutExclude(_ref4) {
38837 let {
38838 exportFormat,
38839 maxDimensions,
38840 minDimensions,
38841 maxMeasures,
38842 minMeasures
38843 } = _ref4;
38844 const dataGroup = exportFormat.data[0];
38845 return dataGroup.dimensions.length > maxDimensions && maxDimensions > 0 || dataGroup.measures.length > maxMeasures && maxMeasures > 0 || dataGroup.excludedDimensions.length > 0 && dataGroup.dimensions.length + dataGroup.excludedDimensions.length > minDimensions || dataGroup.excludedMeasures.length > 0 && dataGroup.measures.length + dataGroup.excludedMeasures.length > minMeasures || !maxMeasures && dataGroup.measures.length > 0 || !maxDimensions && dataGroup.dimensions.length > 0;
38846 }
38847
38848 function initLayoutExclude(_ref5) {
38849 let {
38850 exportFormat,
38851 maxDimensions,
38852 minDimensions,
38853 maxMeasures,
38854 minMeasures,
38855 newHyperCubeDef
38856 } = _ref5;
38857 const dataGroup = exportFormat.data[0];
38858
38859 if (!newHyperCubeDef.qLayoutExclude) {
38860 newHyperCubeDef.qLayoutExclude = {};
38861 }
38862
38863 if (!newHyperCubeDef.qLayoutExclude.qHyperCubeDef) {
38864 newHyperCubeDef.qLayoutExclude.qHyperCubeDef = {};
38865 }
38866
38867 if (dataGroup.dimensions.length > maxDimensions && maxDimensions > 0 || dataGroup.excludedDimensions && dataGroup.excludedDimensions.length && dataGroup.dimensions.length + dataGroup.excludedDimensions.length > minDimensions) {
38868 if (!newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qDimensions) {
38869 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qDimensions = [];
38870 }
38871 }
38872
38873 if (dataGroup.measures.length > maxMeasures && maxMeasures > 0 || dataGroup.excludedMeasures && dataGroup.excludedMeasures.length && dataGroup.measures.length + dataGroup.excludedMeasures.length > minMeasures) {
38874 if (!newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qMeasures) {
38875 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qMeasures = [];
38876 }
38877 }
38878
38879 if (!maxMeasures && dataGroup.measures.length) {
38880 // if the object don't support measures put them in alternative measures instead
38881 if (!newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qMeasures) {
38882 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qMeasures = [];
38883 }
38884 }
38885
38886 if (!maxDimensions && dataGroup.dimensions.length) {
38887 // if the object don't support dimensions put them in alternative dimensions instead
38888 if (!newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qDimensions) {
38889 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qDimensions = [];
38890 }
38891 }
38892 }
38893
38894 function addDefaultDimensions(_ref6) {
38895 let {
38896 exportFormat,
38897 maxDimensions,
38898 minDimensions,
38899 newHyperCubeDef,
38900 defaultDimension
38901 } = _ref6;
38902 const dataGroup = exportFormat.data[0];
38903 let i;
38904
38905 if (maxDimensions > 0) {
38906 for (i = 0; i < dataGroup.dimensions.length; ++i) {
38907 if (newHyperCubeDef.qDimensions.length < maxDimensions) {
38908 newHyperCubeDef.qDimensions.push(createDefaultDimension(dataGroup.dimensions[i], defaultDimension));
38909 } else {
38910 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qDimensions.push(createDefaultDimension(dataGroup.dimensions[i], defaultDimension));
38911 }
38912 }
38913 } else if (dataGroup.dimensions.length) {
38914 for (i = 0; i < dataGroup.dimensions.length; ++i) {
38915 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qDimensions.push(createDefaultDimension(dataGroup.dimensions[i], defaultDimension));
38916 }
38917 }
38918
38919 if (dataGroup.excludedDimensions.length) {
38920 for (i = 0; i < dataGroup.excludedDimensions.length; ++i) {
38921 if (newHyperCubeDef.qDimensions.length < minDimensions) {
38922 newHyperCubeDef.qDimensions.push(createDefaultDimension(dataGroup.excludedDimensions[i], defaultDimension));
38923 } else {
38924 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qDimensions.push(createDefaultDimension(dataGroup.excludedDimensions[i], defaultDimension));
38925 }
38926 }
38927 }
38928 }
38929
38930 function addDefaultMeasures(_ref7) {
38931 let {
38932 exportFormat,
38933 maxMeasures,
38934 minMeasures,
38935 newHyperCubeDef,
38936 defaultMeasure
38937 } = _ref7;
38938 const dataGroup = exportFormat.data[0];
38939 let i;
38940
38941 if (maxMeasures > 0) {
38942 for (i = 0; i < dataGroup.measures.length; ++i) {
38943 if (newHyperCubeDef.qMeasures.length < maxMeasures) {
38944 newHyperCubeDef.qMeasures.push(createDefaultMeasure(dataGroup.measures[i], defaultMeasure));
38945 } else {
38946 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qMeasures.push(createDefaultMeasure(dataGroup.measures[i], defaultMeasure));
38947 }
38948 }
38949 } else if (dataGroup.measures.length) {
38950 for (i = 0; i < dataGroup.measures.length; ++i) {
38951 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qMeasures.push(createDefaultMeasure(dataGroup.measures[i], defaultMeasure));
38952 }
38953 }
38954
38955 if (dataGroup.excludedMeasures.length) {
38956 for (i = 0; i < dataGroup.excludedMeasures.length; ++i) {
38957 if (newHyperCubeDef.qMeasures.length < minMeasures) {
38958 newHyperCubeDef.qMeasures.push(createDefaultMeasure(dataGroup.excludedMeasures[i], defaultMeasure));
38959 } else {
38960 newHyperCubeDef.qLayoutExclude.qHyperCubeDef.qMeasures.push(createDefaultMeasure(dataGroup.excludedMeasures[i], defaultMeasure));
38961 }
38962 }
38963 }
38964 }
38965
38966 function updateDimensionsOnAdded(_ref8) {
38967 let {
38968 newProperties,
38969 dataDefinition,
38970 hypercubePath
38971 } = _ref8;
38972
38973 if (dataDefinition.dimensions && typeof dataDefinition.dimensions.added === 'function') {
38974 const newHyperCubeDef = utils.getValue(newProperties, hypercubePath || '').qHyperCubeDef;
38975 const dimensions = [...newHyperCubeDef.qDimensions];
38976 newHyperCubeDef.qDimensions = [];
38977 dimensions.forEach(dimension => {
38978 newHyperCubeDef.qDimensions.push(dimension);
38979 dataDefinition.dimensions.added(dimension, newProperties);
38980 });
38981 }
38982 }
38983
38984 function updateMeasuresOnAdded(_ref9) {
38985 let {
38986 newProperties,
38987 dataDefinition,
38988 hypercubePath
38989 } = _ref9;
38990
38991 if (dataDefinition.measures && typeof dataDefinition.measures.added === 'function') {
38992 const newHyperCubeDef = utils.getValue(newProperties, hypercubePath || '').qHyperCubeDef;
38993 const measures = [...newHyperCubeDef.qMeasures];
38994 newHyperCubeDef.qMeasures = [];
38995 measures.forEach(measure => {
38996 newHyperCubeDef.qMeasures.push(measure);
38997 dataDefinition.measures.added(measure, newProperties);
38998 });
38999 }
39000 }
39001
39002 var helpers = {
39003 restoreChangedProperties,
39004 isMasterItemProperty,
39005 importCommonProperties,
39006 copyPropertyIfExist,
39007 copyPropertyOrSetDefault,
39008 createDefaultDimension,
39009 createDefaultMeasure,
39010 resolveValue: resolveValue$1,
39011 getHypercubePath,
39012 getDefaultDimension,
39013 getDefaultMeasure,
39014 setInterColumnSortOrder,
39015 createNewProperties,
39016 getMaxMinDimensionMeasure,
39017 shouldInitLayoutExclude,
39018 initLayoutExclude,
39019 addDefaultDimensions,
39020 addDefaultMeasures,
39021 updateDimensionsOnAdded,
39022 updateMeasuresOnAdded
39023 };
39024
39025 /* eslint-disable no-prototype-builtins */
39026 function exportProperties(_ref) {
39027 let {
39028 propertyTree,
39029 hypercubePath
39030 } = _ref;
39031 const exportFormat = createExportFormat();
39032 const properties = propertyTree.qProperty;
39033 const hcdParent = utils.getValue(properties, hypercubePath || '');
39034 const hcd = hcdParent.qHyperCubeDef;
39035 const dataGroup = exportFormat.data[0];
39036
39037 if (!hcd.qInterColumnSortOrder) {
39038 hcd.qInterColumnSortOrder = [];
39039 } // export dimensions
39040
39041
39042 dataGroup.dimensions.push(...hcd.qDimensions); // excluded dimensions
39043
39044 if (hcd.qLayoutExclude && hcd.qLayoutExclude.qHyperCubeDef && hcd.qLayoutExclude.qHyperCubeDef.qDimensions) {
39045 dataGroup.excludedDimensions.push(...hcd.qLayoutExclude.qHyperCubeDef.qDimensions);
39046 } // export measures
39047
39048
39049 dataGroup.measures.push(...hcd.qMeasures); // excluded measures
39050
39051 if (hcd.qLayoutExclude && hcd.qLayoutExclude.qHyperCubeDef && hcd.qLayoutExclude.qHyperCubeDef.qMeasures) {
39052 dataGroup.excludedMeasures.push(...hcd.qLayoutExclude.qHyperCubeDef.qMeasures);
39053 } // export sort order
39054
39055
39056 dataGroup.interColumnSortOrder = hcd.qInterColumnSortOrder.concat(); // if we have a excluded sort order, try apply that instead
39057
39058 if (hcd.qLayoutExclude && hcd.qLayoutExclude.qHyperCubeDef && hcd.qLayoutExclude.qHyperCubeDef.qInterColumnSortOrder) {
39059 const order = hcd.qLayoutExclude.qHyperCubeDef.qInterColumnSortOrder.concat(); // If the exporting sort order hasn't changed compared to the excluded we can apply the full excluded instead
39060
39061 if (arrayUtils.isOrderedSubset(order, dataGroup.interColumnSortOrder)) {
39062 dataGroup.interColumnSortOrder = order;
39063 }
39064 }
39065
39066 delete hcd.qLayoutExclude;
39067 Object.keys(properties).forEach(prop => {
39068 exportFormat.properties[prop] = properties[prop];
39069 });
39070
39071 if (hypercubePath) {
39072 exportFormat.properties.qHyperCubeDef = hcdParent.qHyperCubeDef;
39073 delete hcdParent.qHyperCubeDef;
39074 }
39075
39076 if (!properties.qLayoutExclude) {
39077 properties.qLayoutExclude = {};
39078 }
39079
39080 if (properties.qLayoutExclude.disabled) {
39081 Object.keys(properties.qLayoutExclude.disabled).forEach(prop => {
39082 if (!exportFormat.properties.hasOwnProperty(prop)) {
39083 exportFormat.properties[prop] = properties.qLayoutExclude.disabled[prop];
39084 }
39085 });
39086 delete properties.qLayoutExclude.disabled;
39087 }
39088
39089 if (properties.qLayoutExclude.changed) {
39090 helpers.restoreChangedProperties(properties);
39091 delete properties.qLayoutExclude.changed;
39092 }
39093
39094 if (!properties.qLayoutExclude.quarantine || utils.isEmpty(properties.qLayoutExclude.quarantine)) {
39095 delete properties.qLayoutExclude;
39096 }
39097
39098 return exportFormat;
39099 }
39100
39101 /* eslint-disable no-param-reassign */
39102 function importProperties(_ref) {
39103 let {
39104 exportFormat,
39105 initialProperties = {},
39106 dataDefinition = {},
39107 defaultPropertyValues = {},
39108 hypercubePath
39109 } = _ref;
39110 const newPropertyTree = {
39111 qChildren: []
39112 };
39113 const newProperties = helpers.createNewProperties({
39114 exportFormat,
39115 initialProperties,
39116 hypercubePath
39117 });
39118 const initHyperCubeDef = utils.getValue(initialProperties, hypercubePath || '').qHyperCubeDef;
39119 const newHyperCubeDef = utils.getValue(newProperties, hypercubePath || '').qHyperCubeDef;
39120 const {
39121 maxDimensions,
39122 minDimensions,
39123 maxMeasures,
39124 minMeasures
39125 } = helpers.getMaxMinDimensionMeasure({
39126 exportFormat,
39127 dataDefinition
39128 });
39129 const {
39130 defaultDimension = helpers.getDefaultDimension(),
39131 defaultMeasure = helpers.getDefaultMeasure()
39132 } = defaultPropertyValues; // empty dimensions and measures of new hypercube
39133
39134 newHyperCubeDef.qDimensions.length = 0;
39135 newHyperCubeDef.qMeasures.length = 0; // create layout exclude structures if needed
39136
39137 if (helpers.shouldInitLayoutExclude({
39138 exportFormat,
39139 maxDimensions,
39140 minDimensions,
39141 maxMeasures,
39142 minMeasures
39143 })) {
39144 helpers.initLayoutExclude({
39145 exportFormat,
39146 maxDimensions,
39147 minDimensions,
39148 maxMeasures,
39149 minMeasures,
39150 newHyperCubeDef
39151 });
39152 } // and now fill them in.
39153
39154
39155 helpers.addDefaultDimensions({
39156 exportFormat,
39157 maxDimensions,
39158 minDimensions,
39159 newHyperCubeDef,
39160 defaultDimension
39161 });
39162 helpers.addDefaultMeasures({
39163 exportFormat,
39164 maxMeasures,
39165 minMeasures,
39166 newHyperCubeDef,
39167 defaultMeasure
39168 });
39169 helpers.setInterColumnSortOrder({
39170 exportFormat,
39171 newHyperCubeDef
39172 });
39173 helpers.copyPropertyIfExist('qMaxStackedCells', initHyperCubeDef, newHyperCubeDef);
39174 helpers.copyPropertyIfExist('qNoOfLeftDims', initHyperCubeDef, newHyperCubeDef);
39175 helpers.copyPropertyOrSetDefault('qInitialDataFetch', initHyperCubeDef, newHyperCubeDef, [{
39176 qTop: 0,
39177 qLeft: 0,
39178 qWidth: 0,
39179 qHeight: 0
39180 }]);
39181 helpers.copyPropertyOrSetDefault('qMode', initHyperCubeDef, newHyperCubeDef, 'S');
39182 helpers.copyPropertyOrSetDefault('qReductionMode', initHyperCubeDef, newHyperCubeDef, 'N');
39183 helpers.copyPropertyOrSetDefault('qSortbyYValue', initHyperCubeDef, newHyperCubeDef);
39184 helpers.copyPropertyOrSetDefault('qIndentMode', initHyperCubeDef, newHyperCubeDef);
39185 helpers.copyPropertyOrSetDefault('qShowTotalsAbove', initHyperCubeDef, newHyperCubeDef); // always copy type and visualization
39186
39187 helpers.importCommonProperties(newProperties, exportFormat, initialProperties);
39188 helpers.updateDimensionsOnAdded({
39189 newProperties,
39190 dataDefinition,
39191 hypercubePath
39192 });
39193 helpers.updateMeasuresOnAdded({
39194 newProperties,
39195 dataDefinition,
39196 hypercubePath
39197 });
39198 newPropertyTree.qProperty = newProperties;
39199 return newPropertyTree;
39200 }
39201
39202 /**
39203 * @interface hyperCubeConversion
39204 * @since 1.1.0
39205 * @implements {ConversionType}
39206 */
39207
39208 var hypercube = /** @lends hyperCubeConversion */
39209 {
39210 exportProperties: ar => exportProperties(ar),
39211 importProperties: ar => importProperties(ar)
39212 };
39213
39214 const getType$1 = async _ref => {
39215 let {
39216 halo,
39217 name,
39218 version
39219 } = _ref;
39220 const {
39221 types
39222 } = halo;
39223 const SN = await types.get({
39224 name,
39225 version
39226 }).supernova();
39227 return SN;
39228 };
39229
39230 const getPath = qae => utils.getValue(qae, 'data.targets.0.propertyPath');
39231
39232 const getDefaultExportPropertiesFn = path => {
39233 const steps = path.split('/');
39234
39235 if (steps.indexOf('qHyperCubeDef') > -1) {
39236 return hypercube.exportProperties;
39237 }
39238
39239 return undefined; // TODO: add listbox and other
39240 };
39241
39242 const getExportPropertiesFnc = qae => {
39243 if (qae.exportProperties) {
39244 return qae.exportProperties;
39245 }
39246
39247 const path = getPath(qae);
39248 return getDefaultExportPropertiesFn(path);
39249 };
39250
39251 const getDefaultImportPropertiesFnc = path => {
39252 const steps = path.split('/');
39253
39254 if (steps.indexOf('qHyperCubeDef') > -1) {
39255 return hypercube.importProperties;
39256 }
39257
39258 return undefined; // TODO: add listbox and other
39259 };
39260
39261 const getImportPropertiesFnc = qae => {
39262 if (qae.importProperties) {
39263 return qae.importProperties;
39264 }
39265
39266 const path = getPath(qae);
39267 return getDefaultImportPropertiesFnc(path);
39268 };
39269
39270 const convertTo = async _ref2 => {
39271 let {
39272 halo,
39273 model,
39274 cellRef,
39275 newType
39276 } = _ref2;
39277 const propertyTree = await model.getFullPropertyTree();
39278 const sourceQae = cellRef.current.getQae();
39279 const exportProperties = getExportPropertiesFnc(sourceQae);
39280 const targetSnType = await getType$1({
39281 halo,
39282 name: newType
39283 });
39284 const targetQae = targetSnType.qae;
39285 const importProperties = getImportPropertiesFnc(targetQae);
39286 const exportFormat = exportProperties({
39287 propertyTree,
39288 hypercubePath: helpers.getHypercubePath(sourceQae)
39289 });
39290 const initial = utils.getValue(targetQae, 'properties.initial', {});
39291
39292 const initialProperties = _objectSpread2({
39293 qInfo: {
39294 qType: newType
39295 },
39296 visualization: newType
39297 }, initial);
39298
39299 const newPropertyTree = importProperties({
39300 exportFormat,
39301 initialProperties,
39302 dataDefinition: utils.getValue(targetQae, 'data.targets.0.', {}),
39303 hypercubePath: helpers.getHypercubePath(targetQae)
39304 });
39305 return newPropertyTree;
39306 };
39307 /**
39308 * @interface ConversionType
39309 * @since 1.1.0
39310 * @property {importProperties} importProperties
39311 * @property {exportProperties} exportProperties
39312 */
39313
39314 /**
39315 * @interface
39316 * @alias Conversion
39317 * @since 1.1.0
39318 * @description Provides conversion functionality to extensions.
39319 * @example
39320 * import { conversion } from '@nebula.js/stardust';
39321 *
39322 * export default function() {
39323 * return {
39324 * qae: {
39325 * ...
39326 * importProperties: ( exportFormat, initialProperties ) => conversion.hyperCube.importProperties(exportFormat, initialProperties),
39327 * exportProperties: ( fullPropertyTree ) => conversion.hyperCube.exportProperties(fullPropertyTree)
39328 * },
39329 * ...
39330 * };
39331 * }
39332 *
39333 */
39334
39335 const conversion = {
39336 /**
39337 * @type {hyperCubeConversion}
39338 * @since 1.1.0
39339 * @description Provides conversion functionality to extensions with hyperCubes.
39340 */
39341 hypercube
39342 };
39343
39344 const warning = props => _objectSpread2(_objectSpread2({}, props), {}, {
39345 shapes: [{
39346 type: 'path',
39347 attrs: {
39348 d: 'M8.86225926,1.6 L15.7815749,13.5 C16.2829746,14.3 15.8818548,15 14.9793354,15 L1.04042422,15 C0.0853772072,15 -0.232971797,14.3650794 0.172002787,13.6135407 L7.05722041,1.6 C7.55862009,0.8 8.36085958,0.8 8.86225926,1.6 Z M7.962,2.007 C7.95987183,2.02476599 7.95607967,2.03712023 7.94920396,2.05249845 L1.1033193,14 L14.915544,14 L7.99777452,2.10265906 L7.97779697,2.06138411 L7.96394459,2.01964415 L7.962,2.007 Z M7.5,11 L8.5,11 C8.76666667,11 8.95432099,11.1580247 8.99272977,11.4038409 L9,11.5 L9,12.5 C9,12.7666667 8.84197531,12.954321 8.59615912,12.9927298 L8.5,13 L7.5,13 C7.23333333,13 7.04567901,12.8419753 7.00727023,12.5961591 L7,12.5 L7,11.5 C7,11.2333333 7.15802469,11.045679 7.40384088,11.0072702 L7.5,11 L8.5,11 L7.5,11 Z M7.5,5 L8.5,5 C8.76666667,5 8.95432099,5.15802469 8.99272977,5.40384088 L9,5.5 L9,9.5 C9,9.76666667 8.84197531,9.95432099 8.59615912,9.99272977 L8.5,10 L7.5,10 C7.23333333,10 7.04567901,9.84197531 7.00727023,9.59615912 L7,9.5 L7,5.5 C7,5.23333333 7.15802469,5.04567901 7.40384088,5.00727023 L7.5,5 L8.5,5 L7.5,5 Z'
39349 }
39350 }]
39351 });
39352
39353 var WarningTriangle = (props => SvgIcon(warning(props)));
39354
39355 /* eslint-disable react/no-array-index-key */
39356
39357 function DescriptionRow(_ref) {
39358 let {
39359 d
39360 } = _ref;
39361 const theme = useTheme$2();
39362 let color = 'inherit';
39363 let styleColor = theme.palette.success.main;
39364
39365 if (d.missing) {
39366 styleColor = theme.palette.warning.main;
39367 } else if (d.error) {
39368 color = 'error';
39369 styleColor = theme.palette.error.main;
39370 }
39371
39372 const style = {
39373 color: styleColor
39374 };
39375 const WrappedIcon = /*#__PURE__*/React.createElement(Typography$1, {
39376 style: {
39377 lineHeight: '30px',
39378 paddingRight: theme.spacing(1)
39379 }
39380 }, /*#__PURE__*/React.createElement(Icon$1, null, d.missing || d.error ? /*#__PURE__*/React.createElement(WarningTriangle, {
39381 style: style
39382 }) : /*#__PURE__*/React.createElement(Tick, {
39383 style: style
39384 })));
39385 return /*#__PURE__*/React.createElement(StyledGrid, {
39386 item: true,
39387 container: true,
39388 alignItems: "center",
39389 wrap: "nowrap"
39390 }, /*#__PURE__*/React.createElement(StyledGrid, {
39391 item: true
39392 }, WrappedIcon), /*#__PURE__*/React.createElement(StyledGrid, {
39393 container: true,
39394 item: true,
39395 zeroMinWidth: true,
39396 wrap: "nowrap"
39397 }, /*#__PURE__*/React.createElement(Typography$1, {
39398 noWrap: true,
39399 component: "p"
39400 }, /*#__PURE__*/React.createElement(Typography$1, {
39401 component: "span",
39402 variant: "subtitle2",
39403 color: color
39404 }, d.description), /*#__PURE__*/React.createElement(Typography$1, {
39405 component: "span"
39406 }, " "), /*#__PURE__*/React.createElement(Typography$1, {
39407 component: "span",
39408 variant: "subtitle2",
39409 color: d.error ? 'error' : 'inherit',
39410 style: {
39411 fontWeight: 400
39412 }
39413 }, d.label))));
39414 }
39415
39416 function Descriptions(_ref2) {
39417 let {
39418 data
39419 } = _ref2;
39420 const theme = useTheme$2();
39421 return /*#__PURE__*/React.createElement(StyledGrid, {
39422 container: true,
39423 item: true,
39424 style: {
39425 maxWidth: '300px',
39426 overflow: 'hidden'
39427 }
39428 }, data.map((e, ix) => {
39429 const Rows = e.descriptions.map((d, dix) => /*#__PURE__*/React.createElement(DescriptionRow, {
39430 d: d,
39431 key: dix
39432 }));
39433 return Rows.length > 0 && /*#__PURE__*/React.createElement(StyledGrid, {
39434 container: true,
39435 item: true,
39436 key: ix,
39437 direction: "column",
39438 style: {
39439 paddingBottom: theme.spacing(2)
39440 }
39441 }, /*#__PURE__*/React.createElement(Typography$1, {
39442 noWrap: true,
39443 key: ix,
39444 variant: "subtitle1",
39445 align: "left",
39446 color: "textSecondary"
39447 }, e.title), Rows);
39448 }));
39449 }
39450
39451 function Error$1(_ref3) {
39452 let {
39453 title = 'Error',
39454 message = '',
39455 data = []
39456 } = _ref3;
39457 return /*#__PURE__*/React.createElement(StyledGrid, {
39458 container: true,
39459 direction: "column",
39460 alignItems: "center",
39461 justifyContent: "center",
39462 style: {
39463 position: 'relative',
39464 height: '100%',
39465 width: '100%'
39466 }
39467 }, /*#__PURE__*/React.createElement(StyledGrid, {
39468 item: true
39469 }, /*#__PURE__*/React.createElement(WarningTriangle, {
39470 style: {
39471 fontSize: '38px'
39472 }
39473 })), /*#__PURE__*/React.createElement(StyledGrid, {
39474 item: true
39475 }, /*#__PURE__*/React.createElement(Typography$1, {
39476 variant: "h6",
39477 align: "center",
39478 "data-tid": "error-title"
39479 }, title)), /*#__PURE__*/React.createElement(StyledGrid, {
39480 item: true
39481 }, /*#__PURE__*/React.createElement(Typography$1, {
39482 variant: "subtitle1",
39483 align: "center",
39484 "data-tid": "error-message"
39485 }, message)), /*#__PURE__*/React.createElement(Descriptions, {
39486 data: data
39487 }));
39488 }
39489
39490 const _excluded$2 = ["size"];
39491 const useStyles$3 = makeStyles$1(theme => ({
39492 root: {
39493 position: 'relative',
39494 display: 'inline-block'
39495 },
39496 front: {
39497 color: theme.palette.secondary.main,
39498 animationDuration: '1500ms',
39499 position: 'absolute',
39500 left: 0
39501 },
39502 back: {
39503 color: theme.palette.divider
39504 }
39505 }));
39506 const SIZES = {
39507 small: 16,
39508 medium: 32,
39509 large: 64,
39510 xlarge: 128
39511 };
39512 function Progress(_ref) {
39513 let {
39514 size = 'medium'
39515 } = _ref,
39516 props = _objectWithoutProperties$2(_ref, _excluded$2);
39517
39518 const classes = useStyles$3();
39519 const s = SIZES[size];
39520 return /*#__PURE__*/React.createElement("div", {
39521 className: classes.root
39522 }, /*#__PURE__*/React.createElement(CircularProgress$1, _extends$b({
39523 variant: "determinate",
39524 value: 100,
39525 className: classes.back,
39526 size: s,
39527 thickness: 3
39528 }, props)), /*#__PURE__*/React.createElement(CircularProgress$1, _extends$b({
39529 variant: "indeterminate",
39530 disableShrink: true,
39531 className: classes.front,
39532 size: s,
39533 thickness: 3
39534 }, props)));
39535 }
39536
39537 const _excluded$1 = ["cancel", "translator"],
39538 _excluded2 = ["retry", "translator"];
39539 const useStyles$2 = makeStyles(() => ({
39540 stripes: {
39541 '&::before': {
39542 position: 'absolute',
39543 height: '100%',
39544 width: '100%',
39545 top: 0,
39546 left: 0,
39547 content: '""',
39548 backgroundSize: '14.14px 14.14px',
39549 backgroundImage: 'linear-gradient(135deg, currentColor 10%, rgba(0,0,0,0) 10%, rgba(0,0,0,0) 50%, currentColor 50%, currentColor 59%, rgba(0,0,0,0) 60%, rgba(0,0,0,0) 103%)',
39550 opacity: 0.1
39551 }
39552 }
39553 }));
39554 function Cancel(_ref) {
39555 let {
39556 cancel,
39557 translator
39558 } = _ref,
39559 props = _objectWithoutProperties$2(_ref, _excluded$1);
39560
39561 return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledGrid, {
39562 container: true,
39563 item: true,
39564 direction: "column",
39565 alignItems: "center",
39566 spacing: 2
39567 }, /*#__PURE__*/React.createElement(StyledGrid, {
39568 item: true
39569 }, /*#__PURE__*/React.createElement(Progress, null)), /*#__PURE__*/React.createElement(StyledGrid, {
39570 item: true
39571 }, /*#__PURE__*/React.createElement(Typography$1, {
39572 variant: "h6",
39573 align: "center",
39574 "data-tid": "update-active"
39575 }, translator.get('Object.Update.Active')))), /*#__PURE__*/React.createElement(StyledGrid, _extends$b({
39576 item: true
39577 }, props), /*#__PURE__*/React.createElement(Button$1, {
39578 variant: "contained",
39579 onClick: cancel
39580 }, translator.get('Cancel'))));
39581 }
39582 function Retry(_ref2) {
39583 let {
39584 retry,
39585 translator
39586 } = _ref2,
39587 props = _objectWithoutProperties$2(_ref2, _excluded2);
39588
39589 return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledGrid, {
39590 item: true
39591 }, /*#__PURE__*/React.createElement(WarningTriangle, {
39592 style: {
39593 fontSize: '38px'
39594 }
39595 })), /*#__PURE__*/React.createElement(StyledGrid, {
39596 item: true
39597 }, /*#__PURE__*/React.createElement(Typography$1, {
39598 variant: "h6",
39599 align: "center",
39600 "data-tid": "update-cancelled"
39601 }, translator.get('Object.Update.Cancelled'))), /*#__PURE__*/React.createElement(StyledGrid, {
39602 item: true
39603 }, /*#__PURE__*/React.createElement(Button$1, _extends$b({
39604 variant: "contained",
39605 onClick: retry
39606 }, props), translator.get('Retry'))));
39607 }
39608 function LongRunningQuery(_ref3) {
39609 let {
39610 canCancel,
39611 canRetry,
39612 api
39613 } = _ref3;
39614 const {
39615 stripes,
39616 cancel,
39617 retry
39618 } = useStyles$2();
39619 const {
39620 translator
39621 } = react.exports.useContext(InstanceContext);
39622 return /*#__PURE__*/React.createElement(StyledGrid, {
39623 container: true,
39624 direction: "column",
39625 alignItems: "center",
39626 justifyContent: "center",
39627 className: stripes,
39628 style: {
39629 position: 'absolute',
39630 width: '100%',
39631 height: '100%',
39632 left: 0,
39633 top: 0
39634 },
39635 spacing: 2
39636 }, canCancel && /*#__PURE__*/React.createElement(Cancel, {
39637 cancel: api.cancel,
39638 translator: translator,
39639 className: cancel
39640 }), canRetry && /*#__PURE__*/React.createElement(Retry, {
39641 retry: api.retry,
39642 translator: translator,
39643 className: retry
39644 }));
39645 }
39646
39647 /* eslint-disable react/jsx-props-no-spreading */
39648 function Loading() {
39649 return /*#__PURE__*/React.createElement(StyledGrid, {
39650 container: true,
39651 direction: "column",
39652 alignItems: "center",
39653 justifyContent: "center",
39654 style: {
39655 position: 'absolute',
39656 width: '100%',
39657 height: '100%',
39658 left: 0,
39659 top: 0
39660 },
39661 spacing: 2
39662 }, /*#__PURE__*/React.createElement(Progress, {
39663 size: "large"
39664 }));
39665 }
39666
39667 const ITEM_WIDTH = 32;
39668 const ITEM_SPACING = 4;
39669 const DIVIDER = 1;
39670 const NUMBER_OF_ITEMS = 6;
39671 const MIN_WIDTH = (ITEM_WIDTH + ITEM_SPACING) * NUMBER_OF_ITEMS + DIVIDER + ITEM_SPACING;
39672 /**
39673 * @interface
39674 * @extends HTMLElement
39675 * @since 2.0.0
39676 */
39677
39678 const CellTitle = {
39679 /** @type {'njs-cell-title'} */
39680 className: 'njs-cell-title'
39681 };
39682 /**
39683 * @interface
39684 * @extends HTMLElement
39685 * @since 2.0.0
39686 */
39687
39688 const CellSubTitle = {
39689 /** @type {'njs-cell-sub-title'} */
39690 className: 'njs-cell-sub-title'
39691 };
39692 const useStyles$1 = makeStyles(theme => ({
39693 containerStyle: {
39694 flexGrow: 0
39695 },
39696 containerTitleStyle: {
39697 paddingBottom: theme.spacing(1)
39698 }
39699 }));
39700
39701 function Header(_ref) {
39702 let {
39703 layout,
39704 sn,
39705 anchorEl,
39706 hovering,
39707 focusHandler
39708 } = _ref;
39709 const showTitle = layout.showTitles && !!layout.title;
39710 const showSubtitle = layout.showTitles && !!layout.subtitle;
39711 const showInSelectionActions = layout.qSelectionInfo && layout.qSelectionInfo.qInSelections;
39712 const [actions, setActions] = react.exports.useState([]);
39713 const {
39714 containerStyle,
39715 containerTitleStyle
39716 } = useStyles$1();
39717 const [containerRef, containerRect] = useRect$1();
39718 const [shouldShowPopoverToolbar, setShouldShowPopoverToolbar] = react.exports.useState(false);
39719 react.exports.useEffect(() => {
39720 if (!sn || !sn.component || !sn.component.isHooked) {
39721 return;
39722 }
39723
39724 sn.component.observeActions(a => {
39725 setActions([...a, ...(sn && sn.selectionToolbar && sn.selectionToolbar.items || [])]);
39726 });
39727 }, [sn]);
39728 react.exports.useEffect(() => {
39729 if (!containerRect) return;
39730 const {
39731 width
39732 } = containerRect;
39733 setShouldShowPopoverToolbar(width < MIN_WIDTH);
39734 }, [containerRect]);
39735 const showTitles = showTitle || showSubtitle;
39736 const classes = [containerStyle, ...(showTitles ? [containerTitleStyle] : [])];
39737 const showPopoverToolbar = (hovering || showInSelectionActions) && (shouldShowPopoverToolbar || !showTitles);
39738 const showToolbar = showTitles && !showPopoverToolbar && !shouldShowPopoverToolbar;
39739 const Toolbar = /*#__PURE__*/React.createElement(ActionsToolbar, {
39740 show: showToolbar,
39741 selections: {
39742 show: showInSelectionActions,
39743 api: sn.component.selections,
39744 onKeyDeactivate: focusHandler.refocusContent
39745 },
39746 actions: actions,
39747 popover: {
39748 show: showPopoverToolbar,
39749 anchorEl
39750 },
39751 focusHandler: focusHandler
39752 });
39753 return /*#__PURE__*/React.createElement(StyledGrid, {
39754 ref: containerRef,
39755 item: true,
39756 container: true,
39757 wrap: "nowrap",
39758 className: classes.join(' ')
39759 }, /*#__PURE__*/React.createElement(StyledGrid, {
39760 item: true,
39761 zeroMinWidth: true,
39762 xs: true
39763 }, /*#__PURE__*/React.createElement(StyledGrid, {
39764 container: true,
39765 wrap: "nowrap",
39766 direction: "column"
39767 }, showTitle && /*#__PURE__*/React.createElement(Typography$1, {
39768 variant: "h6",
39769 noWrap: true,
39770 className: CellTitle.className
39771 }, layout.title), showSubtitle && /*#__PURE__*/React.createElement(Typography$1, {
39772 variant: "body2",
39773 noWrap: true,
39774 className: CellSubTitle.className
39775 }, layout.subtitle))), /*#__PURE__*/React.createElement(StyledGrid, {
39776 item: true
39777 }, Toolbar));
39778 }
39779
39780 /**
39781 * @interface
39782 * @extends HTMLElement
39783 * @since 2.0.0
39784 */
39785
39786 const CellFooter = {
39787 /** @type {'njs-cell-footer'} */
39788 className: 'njs-cell-footer'
39789 };
39790 const useStyles = makeStyles(theme => ({
39791 itemStyle: {
39792 minWidth: 0,
39793 paddingTop: theme.spacing(1)
39794 }
39795 }));
39796
39797 function Footer(_ref) {
39798 let {
39799 layout
39800 } = _ref;
39801 const {
39802 itemStyle
39803 } = useStyles();
39804 return layout && layout.showTitles && layout.footnote ? /*#__PURE__*/React.createElement(StyledGrid, {
39805 container: true
39806 }, /*#__PURE__*/React.createElement(StyledGrid, {
39807 item: true,
39808 className: itemStyle
39809 }, /*#__PURE__*/React.createElement(Typography$1, {
39810 noWrap: true,
39811 variant: "body2",
39812 className: CellFooter.className
39813 }, layout.footnote))) : null;
39814 }
39815
39816 class RenderDebouncer {
39817 constructor() {
39818 this.timer = null;
39819 this.next = null;
39820 this.running = false;
39821 }
39822
39823 start() {
39824 if (this.running) {
39825 return;
39826 }
39827
39828 this.running = true;
39829 this.scheduleNext();
39830 }
39831
39832 scheduleNext() {
39833 this.timer = setTimeout(() => {
39834 this.doNext();
39835 }, 10);
39836 }
39837
39838 async doNext() {
39839 const fn = this.next;
39840 this.next = null;
39841
39842 if (fn) {
39843 await fn();
39844 this.scheduleNext();
39845 } else {
39846 this.stop();
39847 }
39848 }
39849
39850 schedule(fn) {
39851 this.next = fn;
39852 this.start();
39853 }
39854
39855 stop() {
39856 if (!this.running) {
39857 return;
39858 }
39859
39860 clearTimeout(this.timer);
39861 this.timer = null;
39862 this.running = false;
39863 }
39864
39865 }
39866
39867 /**
39868 * @interface VizElementAttributes
39869 * @extends NamedNodeMap
39870 * @property {string} data-render-count
39871 */
39872
39873 /**
39874 * @interface
39875 * @extends HTMLElement
39876 * @property {VizElementAttributes} attributes
39877 */
39878
39879 const VizElement = {
39880 /** @type {'njs-viz'} */
39881 className: 'njs-viz'
39882 };
39883
39884 function Supernova(_ref) {
39885 let {
39886 sn,
39887 snOptions: options,
39888 snPlugins: plugins,
39889 layout,
39890 appLayout,
39891 halo
39892 } = _ref;
39893 const {
39894 component
39895 } = sn;
39896 const {
39897 theme: themeName,
39898 language,
39899 constraints,
39900 keyboardNavigation
39901 } = react.exports.useContext(InstanceContext);
39902 const [renderDebouncer] = react.exports.useState(() => new RenderDebouncer());
39903 const [isMounted, setIsMounted] = react.exports.useState(false);
39904 const [renderCnt, setRenderCnt] = react.exports.useState(0);
39905 const [containerRef, containerRect, containerNode] = useRect$1();
39906 const [snNode, setSnNode] = react.exports.useState(null);
39907 const snRef = react.exports.useCallback(ref => {
39908 if (!ref) {
39909 return;
39910 }
39911
39912 setSnNode(ref);
39913 }, []); // Mount / Unmount
39914
39915 react.exports.useEffect(() => {
39916 if (!snNode) return undefined;
39917 component.created({
39918 options
39919 });
39920 component.mounted(snNode);
39921 setIsMounted(true);
39922 return () => {
39923 renderDebouncer.stop();
39924 component.willUnmount();
39925 };
39926 }, [snNode, component]); // Render
39927
39928 react.exports.useEffect(() => {
39929 if (!isMounted || !snNode || !containerRect) {
39930 return;
39931 } // TODO remove in-selections guard for old component API
39932
39933
39934 if (!component.isHooked && layout && layout.qSelectionInfo && layout.qSelectionInfo.qInSelections) {
39935 return;
39936 }
39937
39938 renderDebouncer.schedule(() => {
39939 const permissions = [];
39940
39941 if (!constraints.passive) {
39942 permissions.push('passive');
39943 }
39944
39945 if (!constraints.active) {
39946 permissions.push('interact');
39947 }
39948
39949 if (!constraints.select) {
39950 permissions.push('select');
39951 }
39952
39953 if (halo.app && halo.app.session) {
39954 permissions.push('fetch');
39955 }
39956
39957 return Promise.resolve(component.render({
39958 layout,
39959 options,
39960 plugins,
39961 embed: halo.public.nebbie,
39962 context: _objectSpread2({
39963 constraints,
39964 // halo.public.theme is a singleton so themeName is used as dep to make sure this effect is triggered
39965 theme: halo.public.theme,
39966 appLayout,
39967 keyboardNavigation
39968 }, component.isHooked ? {} : {
39969 logicalSize: sn.logicalSize({
39970 layout
39971 }),
39972 localeInfo: (appLayout || {}).qLocaleInfo,
39973 permissions
39974 })
39975 })).then(done => {
39976 if (done === false) {
39977 return;
39978 }
39979
39980 if (renderCnt === 0 && typeof options.onInitialRender === 'function') {
39981 options.onInitialRender.call(null);
39982 }
39983
39984 setRenderCnt(renderCnt + 1);
39985 });
39986 });
39987 }, [containerRect, options, plugins, snNode, containerNode, layout, appLayout, themeName, language, constraints, isMounted, keyboardNavigation]);
39988 return /*#__PURE__*/React.createElement("div", {
39989 ref: containerRef,
39990 "data-render-count": renderCnt,
39991 style: {
39992 position: 'relative',
39993 height: '100%'
39994 },
39995 className: VizElement.className
39996 }, /*#__PURE__*/React.createElement("div", {
39997 ref: snRef,
39998 style: {
39999 position: 'absolute',
40000 width: '100%',
40001 height: '100%'
40002 }
40003 }));
40004 }
40005
40006 /**
40007 * @interface
40008 * @extends HTMLElement
40009 */
40010
40011 const CellElement = {
40012 /** @type {'njs-cell'} */
40013 className: 'njs-cell'
40014 };
40015
40016 const initialState = err => ({
40017 loading: false,
40018 loaded: false,
40019 longRunningQuery: false,
40020 error: err ? {
40021 title: err.message
40022 } : null,
40023 sn: null,
40024 visualization: null
40025 });
40026
40027 const contentReducer = (state, action) => {
40028 // console.log('content reducer', action.type);
40029 switch (action.type) {
40030 case 'LOADING':
40031 {
40032 return _objectSpread2(_objectSpread2({}, state), {}, {
40033 loading: true
40034 });
40035 }
40036
40037 case 'LOADED':
40038 {
40039 return _objectSpread2(_objectSpread2({}, state), {}, {
40040 loaded: true,
40041 loading: false,
40042 longRunningQuery: false,
40043 error: null,
40044 sn: action.sn,
40045 visualization: action.visualization
40046 });
40047 }
40048
40049 case 'RENDER':
40050 {
40051 return _objectSpread2(_objectSpread2({}, state), {}, {
40052 loaded: true,
40053 loading: false,
40054 longRunningQuery: false,
40055 error: null
40056 });
40057 }
40058
40059 case 'LONG_RUNNING_QUERY':
40060 {
40061 return _objectSpread2(_objectSpread2({}, state), {}, {
40062 longRunningQuery: true
40063 });
40064 }
40065
40066 case 'ERROR':
40067 {
40068 return _objectSpread2(_objectSpread2({}, state), {}, {
40069 loading: false,
40070 longRunningQuery: false,
40071 error: action.error
40072 });
40073 }
40074
40075 default:
40076 {
40077 throw new Error("Unhandled type: ".concat(action.type));
40078 }
40079 }
40080 };
40081
40082 function LoadingSn(_ref) {
40083 let {
40084 delay = 750
40085 } = _ref;
40086 const [showLoading, setShowLoading] = react.exports.useState(false);
40087 react.exports.useEffect(() => {
40088 const handle = setTimeout(() => setShowLoading(true), delay);
40089 return () => clearTimeout(handle);
40090 }, []);
40091 return showLoading ? /*#__PURE__*/React.createElement(Loading, null) : null;
40092 }
40093
40094 const handleModal = _ref2 => {
40095 let {
40096 sn,
40097 layout,
40098 model
40099 } = _ref2;
40100 const selections = sn && sn.component && sn.component.selections;
40101
40102 if (!selections || !selections.id || !model.id) {
40103 return;
40104 }
40105
40106 if (selections.id === model.id) {
40107 if (layout && layout.qSelectionInfo && layout.qSelectionInfo.qInSelections && !selections.isModal()) {
40108 const {
40109 targets
40110 } = sn.generator.qae.data;
40111 const firstPropertyPath = targets[0].propertyPath;
40112 selections.goModal(firstPropertyPath);
40113 }
40114
40115 if (!layout.qSelectionInfo || !layout.qSelectionInfo.qInSelections) {
40116 if (selections.isModal()) {
40117 selections.noModal();
40118 }
40119 }
40120 }
40121 };
40122
40123 const filterData = d => d.qError ? d.qError.qErrorCode === 7005 : true;
40124
40125 const validateInfo = (min, info, getDescription, translatedError, translatedCalcCond) => [...Array(min).keys()].map(i => {
40126 const exists = !!(info && info[i]);
40127 const softError = exists && info[i].qError && info[i].qError.qErrorCode === 7005;
40128 const error = exists && !softError && info[i].qError;
40129 const delimiter = ':';
40130 const calcCondMsg = softError && info[i].qCalcCondMsg;
40131 const label = "".concat( // eslint-disable-next-line no-nested-ternary
40132 error ? translatedError : softError ? calcCondMsg || translatedCalcCond : exists && info[i].qFallbackTitle || '');
40133 const customDescription = getDescription(i);
40134 const description = customDescription ? "".concat(customDescription).concat(label.length ? delimiter : '') : null;
40135 return {
40136 description,
40137 label,
40138 missing: info && !exists && !error && i >= info.length || softError,
40139 error
40140 };
40141 });
40142
40143 const getInfo = info => info && (Array.isArray(info) ? info : [info]) || [];
40144
40145 const validateTarget = (translator, layout, properties, def) => {
40146 const minD = def.dimensions.min();
40147 const minM = def.measures.min();
40148 const c = def.resolveLayout(layout);
40149 const reqDimErrors = validateInfo(minD, getInfo(c.qDimensionInfo), i => def.dimensions.description(properties, i), translator.get('Visualization.Invalid.Dimension'), translator.get('Visualization.UnfulfilledCalculationCondition'));
40150 const reqMeasErrors = validateInfo(minM, getInfo(c.qMeasureInfo), i => def.measures.description(properties, i), translator.get('Visualization.Invalid.Measure'), translator.get('Visualization.UnfulfilledCalculationCondition'));
40151 return {
40152 reqDimErrors,
40153 reqMeasErrors
40154 };
40155 };
40156
40157 const validateCubes = (translator, targets, layout) => {
40158 let hasUnfulfilledErrors = false;
40159 let aggMinD = 0;
40160 let aggMinM = 0;
40161 let hasLayoutErrors = false;
40162 let hasLayoutUnfulfilledCalculcationCondition = false;
40163 const layoutErrors = [];
40164
40165 for (let i = 0; i < targets.length; ++i) {
40166 const def = targets[i];
40167 const minD = def.dimensions.min();
40168 const minM = def.measures.min();
40169 const c = def.resolveLayout(layout);
40170 const d = getInfo(c.qDimensionInfo).filter(filterData); // Filter out optional calc conditions
40171
40172 const m = getInfo(c.qMeasureInfo).filter(filterData); // Filter out optional calc conditions
40173
40174 aggMinD += minD;
40175 aggMinM += minM;
40176
40177 if (d.length < minD || m.length < minM) {
40178 hasUnfulfilledErrors = true;
40179 }
40180
40181 if (c.qError) {
40182 hasLayoutErrors = true;
40183 hasLayoutUnfulfilledCalculcationCondition = c.qError.qErrorCode === 7005;
40184 const title = // eslint-disable-next-line no-nested-ternary
40185 hasLayoutUnfulfilledCalculcationCondition && c.qCalcCondMsg ? c.qCalcCondMsg : hasLayoutUnfulfilledCalculcationCondition ? translator.get('Visualization.UnfulfilledCalculationCondition') : translator.get('Visualization.LayoutError');
40186 layoutErrors.push({
40187 title,
40188 descriptions: []
40189 });
40190 }
40191 }
40192
40193 return {
40194 hasUnfulfilledErrors,
40195 aggMinD,
40196 aggMinM,
40197 hasLayoutErrors,
40198 layoutErrors
40199 };
40200 };
40201
40202 const validateTargets = async (translator, layout, _ref3, model) => {
40203 let {
40204 targets
40205 } = _ref3;
40206 // Use a flattened requirements structure to combine all targets
40207 const {
40208 hasUnfulfilledErrors,
40209 aggMinD,
40210 aggMinM,
40211 hasLayoutErrors,
40212 layoutErrors
40213 } = validateCubes(translator, targets, layout);
40214 const reqDimErrors = [];
40215 const reqMeasErrors = [];
40216 let loopCacheProperties = null;
40217
40218 for (let i = 0; i < targets.length; ++i) {
40219 const def = targets[i];
40220
40221 if (!hasLayoutErrors && hasUnfulfilledErrors) {
40222 // eslint-disable-next-line no-await-in-loop
40223 const properties = loopCacheProperties || (await model.getProperties());
40224 loopCacheProperties = properties;
40225 const res = validateTarget(translator, layout, properties, def);
40226 reqDimErrors.push(...res.reqDimErrors);
40227 reqMeasErrors.push(...res.reqMeasErrors);
40228 }
40229 }
40230
40231 const fulfilledDims = reqDimErrors.filter(e => !(e.missing || e.error)).length;
40232 const reqDimErrorsTitle = translator.get('Visualization.Incomplete.Dimensions', [fulfilledDims, aggMinD]);
40233 const fulfilledMeas = reqMeasErrors.filter(e => !(e.missing || e.error)).length;
40234 const reqMeasErrorsTitle = translator.get('Visualization.Incomplete.Measures', [fulfilledMeas, aggMinM]);
40235 const reqErrors = [{
40236 title: reqDimErrorsTitle,
40237 descriptions: [...reqDimErrors]
40238 }, {
40239 title: reqMeasErrorsTitle,
40240 descriptions: [...reqMeasErrors]
40241 }];
40242 const showError = hasLayoutErrors || hasUnfulfilledErrors;
40243 const data = hasLayoutErrors ? layoutErrors : reqErrors;
40244 const title = hasLayoutErrors ? layoutErrors[0].title : translator.get('Visualization.Incomplete');
40245 return [showError, {
40246 title,
40247 data
40248 }];
40249 };
40250
40251 const getType = async _ref4 => {
40252 let {
40253 types,
40254 name,
40255 version
40256 } = _ref4;
40257 const SN = await types.get({
40258 name,
40259 version
40260 }).supernova();
40261 return SN;
40262 };
40263
40264 const loadType = async _ref5 => {
40265 let {
40266 dispatch,
40267 types,
40268 visualization,
40269 version,
40270 model,
40271 app,
40272 selections,
40273 nebbie,
40274 focusHandler
40275 } = _ref5;
40276
40277 try {
40278 const snType = await getType({
40279 types,
40280 name: visualization,
40281 version
40282 });
40283 const sn = snType.create({
40284 model,
40285 app,
40286 selections,
40287 nebbie,
40288 focusHandler
40289 });
40290 return sn;
40291 } catch (err) {
40292 dispatch({
40293 type: 'ERROR',
40294 error: {
40295 title: err.message
40296 }
40297 });
40298 }
40299
40300 return undefined;
40301 };
40302
40303 const Cell = react.exports.forwardRef((_ref6, ref) => {
40304 let {
40305 halo,
40306 model,
40307 initialSnOptions,
40308 initialSnPlugins,
40309 initialError,
40310 onMount,
40311 currentId
40312 } = _ref6;
40313 const {
40314 app,
40315 types
40316 } = halo;
40317 const {
40318 nebbie
40319 } = halo.public;
40320 const {
40321 disableCellPadding = false
40322 } = halo.context || {};
40323 const {
40324 translator,
40325 language,
40326 keyboardNavigation
40327 } = react.exports.useContext(InstanceContext);
40328 const theme = useTheme$2();
40329 const [cellRef, cellRect, cellNode] = useRect$1();
40330 const [state, dispatch] = react.exports.useReducer(contentReducer, initialState(initialError));
40331 const [layout, {
40332 validating,
40333 canCancel,
40334 canRetry
40335 }, longrunning] = useLayout$1(model);
40336 const [appLayout] = useAppLayout$1(app);
40337 const [contentRef, contentRect, contentNode] = useRect$1();
40338 const [snOptions, setSnOptions] = react.exports.useState(initialSnOptions);
40339 const [snPlugins, setSnPlugins] = react.exports.useState(initialSnPlugins);
40340 const [selections] = useObjectSelections(app, model);
40341 const [hovering, setHover] = react.exports.useState(false);
40342 const hoveringDebouncer = react.exports.useRef({
40343 enter: null,
40344 leave: null
40345 });
40346 const focusHandler = react.exports.useRef({
40347 focusToolbarButton(last) {
40348 // eslint-disable-next-line react/no-this-in-sfc
40349 this.emit(last ? 'focus_toolbar_last' : 'focus_toolbar_first');
40350 }
40351
40352 });
40353 react.exports.useEffect(() => {
40354 eventmixin(focusHandler.current);
40355 }, []);
40356
40357 focusHandler.current.blurCallback = resetFocus => {
40358 halo.root.toggleFocusOfCells();
40359
40360 if (resetFocus && contentNode) {
40361 contentNode.focus();
40362 }
40363 };
40364
40365 focusHandler.current.refocusContent = () => {
40366 state.sn.component && typeof state.sn.component.focus === 'function' && state.sn.component.focus();
40367 };
40368
40369 const handleOnMouseEnter = () => {
40370 if (hoveringDebouncer.current.leave) {
40371 clearTimeout(hoveringDebouncer.current.leave);
40372 }
40373
40374 if (hoveringDebouncer.enter) return;
40375 hoveringDebouncer.current.enter = setTimeout(() => {
40376 setHover(true);
40377 hoveringDebouncer.current.enter = null;
40378 }, 250);
40379 };
40380
40381 const handleOnMouseLeave = () => {
40382 if (hoveringDebouncer.current.enter) {
40383 clearTimeout(hoveringDebouncer.current.enter);
40384 }
40385
40386 if (hoveringDebouncer.current.leave) return;
40387 hoveringDebouncer.current.leave = setTimeout(() => {
40388 setHover(false);
40389 hoveringDebouncer.current.leave = null;
40390 }, 750);
40391 };
40392
40393 const handleKeyDown = e => {
40394 // Enter or space
40395 if (['Enter', ' ', 'Spacebar'].includes(e.key)) {
40396 halo.root.toggleFocusOfCells(currentId);
40397 }
40398 };
40399
40400 react.exports.useEffect(() => {
40401 if (initialError || !appLayout || !layout) {
40402 return undefined;
40403 }
40404
40405 const validate = async sn => {
40406 const [showError, error] = await validateTargets(translator, layout, sn.generator.qae.data, model);
40407
40408 if (showError) {
40409 dispatch({
40410 type: 'ERROR',
40411 error
40412 });
40413 } else {
40414 dispatch({
40415 type: 'RENDER'
40416 });
40417 }
40418
40419 handleModal({
40420 sn: state.sn,
40421 layout,
40422 model
40423 });
40424 };
40425
40426 const load = async (visualization, version) => {
40427 dispatch({
40428 type: 'LOADING'
40429 });
40430 const sn = await loadType({
40431 dispatch,
40432 types,
40433 visualization,
40434 version,
40435 model,
40436 app,
40437 selections,
40438 nebbie,
40439 focusHandler: focusHandler.current
40440 });
40441
40442 if (sn) {
40443 dispatch({
40444 type: 'LOADED',
40445 sn,
40446 visualization
40447 });
40448 onMount();
40449 }
40450
40451 return undefined;
40452 }; // Validate if it's still the same type
40453
40454
40455 if (state.visualization === layout.visualization && state.sn) {
40456 validate(state.sn);
40457 return undefined;
40458 } // Load supernova
40459
40460
40461 const withVersion = types.getSupportedVersion(layout.visualization, layout.version);
40462
40463 if (!withVersion) {
40464 dispatch({
40465 type: 'ERROR',
40466 error: {
40467 title: "Could not find a version of '".concat(layout.visualization, "' that supports current object version. Did you forget to register ").concat(layout.visualization, "?")
40468 }
40469 });
40470 return undefined;
40471 }
40472
40473 load(layout.visualization, withVersion);
40474 return () => {};
40475 }, [types, state.sn, model, layout, appLayout, language]); // Long running query
40476
40477 react.exports.useEffect(() => {
40478 if (!validating) {
40479 return undefined;
40480 }
40481
40482 const handle = setTimeout(() => dispatch({
40483 type: 'LONG_RUNNING_QUERY'
40484 }), 2000);
40485 return () => clearTimeout(handle);
40486 }, [validating]); // Expose cell ref api
40487
40488 react.exports.useImperativeHandle(ref, () => ({
40489 getQae() {
40490 return state.sn.generator.qae;
40491 },
40492
40493 toggleFocus(active) {
40494 if (typeof state.sn.component.focus === 'function') {
40495 if (active) {
40496 state.sn.component.focus();
40497 } else {
40498 state.sn.component.blur();
40499 }
40500 }
40501 },
40502
40503 setSnOptions,
40504 setSnPlugins,
40505
40506 async takeSnapshot() {
40507 const {
40508 width,
40509 height
40510 } = cellRect; // clone layout to avoid mutation
40511
40512 let clonedLayout = JSON.parse(JSON.stringify(layout));
40513
40514 if (typeof state.sn.component.setSnapshotData === 'function') {
40515 clonedLayout = (await state.sn.component.setSnapshotData(clonedLayout)) || clonedLayout;
40516 }
40517
40518 return {
40519 // TODO - this snapshot format needs to be documented and governed
40520 key: String(+Date.now()),
40521 meta: {
40522 language: translator.language(),
40523 theme: theme.name,
40524 appLayout,
40525 // direction: 'ltr',
40526 size: {
40527 width: Math.round(width),
40528 height: Math.round(height)
40529 }
40530 },
40531 layout: clonedLayout
40532 };
40533 },
40534
40535 async exportImage() {
40536 if (typeof halo.config.snapshot.capture !== 'function') {
40537 throw new Error('Stardust embed has not been configured with snapshot.capture callback');
40538 }
40539
40540 const snapshot = await this.takeSnapshot(); // eslint-disable-line
40541
40542 return halo.config.snapshot.capture(snapshot);
40543 }
40544
40545 }), [state.sn, contentRect, cellRect, layout, theme.name, appLayout]); // console.log('content', state);
40546
40547 let Content = null;
40548
40549 if (state.loading && !state.longRunningQuery) {
40550 Content = /*#__PURE__*/React.createElement(LoadingSn, null);
40551 } else if (state.error) {
40552 Content = /*#__PURE__*/React.createElement(Error$1, state.error);
40553 } else if (state.loaded) {
40554 Content = /*#__PURE__*/React.createElement(Supernova, {
40555 key: layout.visualization,
40556 sn: state.sn,
40557 halo: halo,
40558 snOptions: snOptions,
40559 snPlugins: snPlugins,
40560 layout: layout,
40561 appLayout: appLayout
40562 });
40563 }
40564
40565 return /*#__PURE__*/React.createElement(Paper$1, {
40566 style: {
40567 position: 'relative',
40568 width: '100%',
40569 height: '100%',
40570 overflow: 'hidden'
40571 },
40572 elevation: 0,
40573 square: true,
40574 className: CellElement.className,
40575 ref: cellRef,
40576 onMouseEnter: handleOnMouseEnter,
40577 onMouseLeave: handleOnMouseLeave
40578 }, /*#__PURE__*/React.createElement(StyledGrid, {
40579 container: true,
40580 direction: "column",
40581 spacing: 0,
40582 style: _objectSpread2(_objectSpread2({
40583 position: 'relative',
40584 width: '100%',
40585 height: '100%'
40586 }, !disableCellPadding ? {
40587 padding: theme.spacing(1)
40588 } : {}), state.longRunningQuery ? {
40589 opacity: '0.3'
40590 } : {})
40591 }, cellNode && layout && state.sn && /*#__PURE__*/React.createElement(Header, {
40592 layout: layout,
40593 sn: state.sn,
40594 anchorEl: cellNode,
40595 hovering: hovering,
40596 focusHandler: focusHandler.current
40597 }, "\xA0"), /*#__PURE__*/React.createElement(StyledGrid, {
40598 tabIndex: keyboardNavigation ? 0 : -1,
40599 onKeyDown: keyboardNavigation ? handleKeyDown : null,
40600 item: true,
40601 xs: true,
40602 style: {
40603 height: '100%'
40604 },
40605 ref: contentRef
40606 }, Content), /*#__PURE__*/React.createElement(Footer, {
40607 layout: layout
40608 })), state.longRunningQuery && /*#__PURE__*/React.createElement(LongRunningQuery, {
40609 canCancel: canCancel,
40610 canRetry: canRetry,
40611 api: longrunning
40612 }));
40613 });
40614
40615 function glue(_ref) {
40616 let {
40617 halo,
40618 element,
40619 model,
40620 initialSnOptions,
40621 initialSnPlugins,
40622 onMount,
40623 initialError
40624 } = _ref;
40625 const {
40626 root
40627 } = halo;
40628 const cellRef = React.createRef();
40629 const currentId = uid();
40630 const portal = ReactDOM.createPortal( /*#__PURE__*/React.createElement(Cell, {
40631 ref: cellRef,
40632 halo: halo,
40633 model: model,
40634 currentId: currentId,
40635 initialSnOptions: initialSnOptions,
40636 initialSnPlugins: initialSnPlugins,
40637 initialError: initialError,
40638 onMount: onMount
40639 }), element, model.id);
40640
40641 const unmount = () => {
40642 root.remove(portal);
40643 model.removeListener('closed', unmount);
40644 };
40645
40646 model.on('closed', unmount);
40647 root.add(portal); // Cannot use model.id as it is not unique in a given mashup
40648
40649 root.addCell(currentId, cellRef);
40650 return [unmount, cellRef];
40651 }
40652
40653 function isObject$1(v) {
40654 return v != null && !Array.isArray(v) && typeof v === 'object';
40655 }
40656
40657 function isEqual(a, b) {
40658 if (isObject$1(a) && isObject$1(b)) {
40659 return JSON.stringify(a) === JSON.stringify(b);
40660 }
40661
40662 if (Array.isArray(a) || Array.isArray(b)) {
40663 return false;
40664 }
40665
40666 return a === b;
40667 } // eslint-disable-next-line default-param-last
40668
40669
40670 function getPatches() {
40671 let path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/';
40672 let obj = arguments.length > 1 ? arguments[1] : undefined;
40673 let old = arguments.length > 2 ? arguments[2] : undefined;
40674 const patches = [];
40675 Object.keys(obj).forEach(prop => {
40676 const v = obj[prop];
40677
40678 if (typeof old[prop] === 'object' && typeof v === 'object' && !Array.isArray(v)) {
40679 patches.push(...getPatches("".concat(path).concat(prop, "/"), obj[prop], old[prop]));
40680 } else if (!isEqual(v, old[prop])) {
40681 patches.push({
40682 qPath: path + prop,
40683 qOp: 'add',
40684 qValue: JSON.stringify(obj[prop])
40685 });
40686 }
40687 });
40688 return patches;
40689 }
40690
40691 /**
40692 * An object literal containing meta information about the plugin and a function containing the plugin implementation.
40693 * @interface Plugin
40694 * @property {object} info Object that can hold various meta info about the plugin
40695 * @property {string} info.name The name of the plugin
40696 * @property {function} fn The implementation of the plugin. Input and return value is up to the plugin implementation to decide based on its purpose.
40697 * @experimental
40698 * @since 1.2.0
40699 * @example
40700 * const plugin = {
40701 * info: {
40702 * name: "example-plugin",
40703 * type: "meta-type",
40704 * },
40705 * fn: () => {
40706 * // Plugin implementation goes here
40707 * }
40708 * };
40709 */
40710 function validatePlugins(plugins) {
40711 if (!Array.isArray(plugins)) {
40712 throw new Error('Invalid plugin format: plugins should be an array!');
40713 }
40714
40715 plugins.forEach(p => {
40716 if (typeof p !== 'object') {
40717 throw new Error('Invalid plugin format: a plugin should be an object');
40718 }
40719
40720 if (typeof p.info !== 'object' || typeof p.info.name !== 'string') {
40721 throw new Error('Invalid plugin format: a plugin should have an info object containing a name');
40722 }
40723
40724 if (typeof p.fn !== 'function') {
40725 throw new Error("Invalid plugin format: The plugin \"".concat(p.info.name, "\" has no \"fn\" function"));
40726 }
40727 });
40728 }
40729
40730 const noopi = () => {};
40731
40732 function viz() {
40733 let {
40734 model,
40735 halo,
40736 initialError,
40737 onDestroy = async () => {}
40738 } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
40739 let unmountCell = noopi;
40740 let cellRef = null;
40741 let mountedReference = null;
40742 let onMount = null;
40743 const mounted = new Promise(resolve => {
40744 onMount = resolve;
40745 });
40746 let initialSnOptions = {};
40747 let initialSnPlugins = [];
40748
40749 const setSnOptions = async opts => {
40750 if (mountedReference) {
40751 (async () => {
40752 await mounted;
40753 cellRef.current.setSnOptions(_objectSpread2(_objectSpread2({}, initialSnOptions), opts));
40754 })();
40755 } else {
40756 // Handle setting options before mount
40757 initialSnOptions = _objectSpread2(_objectSpread2({}, initialSnOptions), opts);
40758 }
40759 };
40760
40761 const setSnPlugins = async plugins => {
40762 validatePlugins(plugins);
40763
40764 if (mountedReference) {
40765 (async () => {
40766 await mounted;
40767 cellRef.current.setSnPlugins(plugins);
40768 })();
40769 } else {
40770 // Handle setting plugins before mount
40771 initialSnPlugins = plugins;
40772 }
40773 };
40774 /**
40775 * @class
40776 * @alias Viz
40777 * @classdesc A controller to further modify a visualization after it has been rendered.
40778 * @example
40779 * const viz = await embed(app).render({
40780 * element,
40781 * type: 'barchart'
40782 * });
40783 * viz.destroy();
40784 */
40785
40786
40787 const api =
40788 /** @lends Viz# */
40789 {
40790 /**
40791 * The id of this visualization's generic object.
40792 * @type {string}
40793 */
40794 id: model.id,
40795
40796 /**
40797 * Destroys the visualization and removes it from the the DOM.
40798 * @example
40799 * const viz = await embed(app).render({
40800 * element,
40801 * id: 'abc'
40802 * });
40803 * viz.destroy();
40804 */
40805 async destroy() {
40806 await onDestroy();
40807 unmountCell();
40808 unmountCell = noopi;
40809 },
40810
40811 /**
40812 * Converts the visualization to a different registered type
40813 * @since 1.1.0
40814 * @param {string} newType - Which registered type to convert to.
40815 * @param {boolean=} forceUpdate - Whether to run setProperties or not, defaults to true.
40816 * @returns {Promise<object>} Promise object that resolves to the full property tree of the converted visualization.
40817 * @example
40818 * const viz = await embed(app).render({
40819 * element,
40820 * id: 'abc'
40821 * });
40822 * viz.convertTo('barChart');
40823 */
40824 async convertTo(newType) {
40825 let forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
40826 const propertyTree = await convertTo({
40827 halo,
40828 model,
40829 cellRef,
40830 newType
40831 });
40832
40833 if (forceUpdate) {
40834 if (model.__snInterceptor) {
40835 await model.__snInterceptor.setProperties.call(model, propertyTree.qProperty);
40836 } else {
40837 await model.setProperties(propertyTree.qProperty);
40838 }
40839 }
40840
40841 return propertyTree;
40842 },
40843
40844 // ===== unexposed experimental API - use at own risk ======
40845 __DO_NOT_USE__: {
40846 mount(element) {
40847 if (mountedReference) {
40848 throw new Error('Already mounted');
40849 }
40850
40851 mountedReference = element;
40852 [unmountCell, cellRef] = glue({
40853 halo,
40854 element,
40855 model,
40856 initialSnOptions,
40857 initialSnPlugins,
40858 initialError,
40859 onMount
40860 });
40861 return mounted;
40862 },
40863
40864 async applyProperties(props) {
40865 const current = await model.getEffectiveProperties();
40866 const patches = getPatches('/', props, current);
40867
40868 if (patches.length) {
40869 return model.applyPatches(patches, true);
40870 }
40871
40872 return undefined;
40873 },
40874
40875 options(opts) {
40876 setSnOptions(opts);
40877 },
40878
40879 plugins(plugins) {
40880 setSnPlugins(plugins);
40881 },
40882
40883 exportImage() {
40884 return cellRef.current.exportImage();
40885 },
40886
40887 takeSnapshot() {
40888 return cellRef.current.takeSnapshot();
40889 },
40890
40891 getModel() {
40892 return model;
40893 }
40894
40895 } // old QVisualization API
40896 // close() {},
40897 // exportData() {},
40898 // exportImg() {},
40899 // exportPdf() {},
40900 // setOptions() {}, // applied soft patch
40901 // resize() {},
40902 // show() {},
40903 // toggleDataView() {},
40904
40905 };
40906 return api;
40907 }
40908
40909 /* eslint no-underscore-dangle:0 */
40910 async function init(model, optional, halo, initialError) {
40911 let onDestroy = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : async () => {};
40912 const api = viz({
40913 model,
40914 halo,
40915 initialError,
40916 onDestroy
40917 });
40918
40919 if (optional.options) {
40920 api.__DO_NOT_USE__.options(optional.options);
40921 }
40922
40923 if (optional.plugins) {
40924 api.__DO_NOT_USE__.plugins(optional.plugins);
40925 }
40926
40927 if (optional.element) {
40928 await api.__DO_NOT_USE__.mount(optional.element);
40929 }
40930
40931 return api;
40932 }
40933
40934 /**
40935 * @typedef {string | EngineAPI.INxDimension | EngineAPI.INxMeasure | LibraryField} Field
40936 */
40937
40938 /**
40939 * @interface CreateConfig
40940 * @description Rendering configuration for creating and rendering a new object
40941 * @extends BaseConfig
40942 * @property {string} type
40943 * @property {string=} version
40944 * @property {(Field[])=} fields
40945 * @property {EngineAPI.IGenericObjectProperties=} properties
40946 */
40947
40948 async function createSessionObject(_ref, halo) {
40949 let {
40950 type,
40951 version,
40952 fields,
40953 properties,
40954 options,
40955 plugins,
40956 element
40957 } = _ref;
40958 let mergedProps = {};
40959 let error;
40960
40961 try {
40962 const t = halo.types.get({
40963 name: type,
40964 version
40965 });
40966 mergedProps = await t.initialProperties(properties);
40967 const sn = await t.supernova();
40968
40969 if (fields) {
40970 populateData({
40971 sn,
40972 properties: mergedProps,
40973 fields
40974 }, halo);
40975 }
40976
40977 if (properties && sn && sn.qae.properties.onChange) {
40978 sn.qae.properties.onChange.call({}, mergedProps);
40979 }
40980 } catch (e) {
40981 error = e; // minimal dummy object properties to allow it to be created
40982 // and rendered with the error
40983
40984 mergedProps = {
40985 qInfo: {
40986 qType: type
40987 },
40988 visualization: type
40989 }; // console.error(e); // eslint-disable-line
40990 }
40991
40992 const model = await halo.app.createSessionObject(mergedProps);
40993 modelStore.set(model.id, model);
40994 const unsubscribe = subscribe(model);
40995
40996 const onDestroy = async () => {
40997 await halo.app.destroySessionObject(model.id);
40998 unsubscribe();
40999 };
41000
41001 return init(model, {
41002 options,
41003 plugins,
41004 element
41005 }, halo, error, onDestroy);
41006 }
41007
41008 /**
41009 * @interface BaseConfig
41010 * @description Basic rendering configuration for rendering an object
41011 * @property {HTMLElement} element
41012 * @property {object=} options
41013 * @property {Plugin[]} [plugins]
41014 */
41015
41016 /**
41017 * @interface GetConfig
41018 * @description Rendering configuration for rendering an existing object
41019 * @extends BaseConfig
41020 * @property {string} id
41021 */
41022
41023 async function getObject(_ref, halo) {
41024 let {
41025 id,
41026 options,
41027 plugins,
41028 element
41029 } = _ref;
41030 const key = "".concat(id);
41031 let rpc = rpcRequestModelStore.get(key);
41032
41033 if (!rpc) {
41034 rpc = halo.app.getObject(id);
41035 rpcRequestModelStore.set(key, rpc);
41036 }
41037
41038 const model = await rpc;
41039 modelStore.set(key, model);
41040 return init(model, {
41041 options,
41042 plugins,
41043 element
41044 }, halo);
41045 }
41046
41047 function flagsFn () {
41048 let flags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
41049
41050 /**
41051 * @interface Flags
41052 */
41053 return (
41054 /** @lends Flags */
41055 {
41056 /**
41057 * Checks whether the specified flag is enabled.
41058 * @param {string} flag - The value flag to check.
41059 * @returns {boolean} True if the specified flag is enabled, false otherwise.
41060 */
41061 isEnabled: f => flags[f] === true
41062 }
41063 );
41064 }
41065
41066 /* eslint no-param-reassign: 0, no-restricted-globals: 0 */
41067 const extend = extend$2.bind(null, true);
41068 const JSONPatch = {};
41069 const {
41070 isArray
41071 } = Array;
41072
41073 function isObject(v) {
41074 return v != null && !Array.isArray(v) && typeof v === 'object';
41075 }
41076
41077 function isUndef(v) {
41078 return typeof v === 'undefined';
41079 }
41080
41081 function isFunction(v) {
41082 return typeof v === 'function';
41083 }
41084 /**
41085 * Generate an exact duplicate (with no references) of a specific value.
41086 *
41087 * @private
41088 * @param {Object} The value to duplicate
41089 * @returns {Object} a unique, duplicated value
41090 */
41091
41092
41093 function generateValue(val) {
41094 if (val) {
41095 return extend({}, {
41096 val
41097 }).val;
41098 }
41099
41100 return val;
41101 }
41102 /**
41103 * An additional type checker used to determine if the property is of internal
41104 * use or not a type that can be translated into JSON (like functions).
41105 *
41106 * @private
41107 * @param {Object} obj The object which has the property to check
41108 * @param {String} The property name to check
41109 * @returns {Boolean} Whether the property is deemed special or not
41110 */
41111
41112
41113 function isSpecialProperty(obj, key) {
41114 return isFunction(obj[key]) || key.substring(0, 2) === '$$' || key.substring(0, 1) === '_';
41115 }
41116 /**
41117 * Finds the parent object from a JSON-Pointer ("/foo/bar/baz" = "bar" is "baz" parent),
41118 * also creates the object structure needed.
41119 *
41120 * @private
41121 * @param {Object} data The root object to traverse through
41122 * @param {String} The JSON-Pointer string to use when traversing
41123 * @returns {Object} The parent object
41124 */
41125
41126
41127 function getParent(data, str) {
41128 const seperator = '/';
41129 const parts = str.substring(1).split(seperator).slice(0, -1);
41130 let numPart;
41131 parts.forEach((part, i) => {
41132 if (i === parts.length) {
41133 return;
41134 }
41135
41136 numPart = +part;
41137 const newPart = !isNaN(numPart) ? [] : {};
41138 data[numPart || part] = isUndef(data[numPart || part]) ? newPart : data[part];
41139 data = data[numPart || part];
41140 });
41141 return data;
41142 }
41143 /**
41144 * Cleans an object of all its properties, unless they're deemed special or
41145 * cannot be removed by configuration.
41146 *
41147 * @private
41148 * @param {Object} obj The object to clean
41149 */
41150
41151
41152 function emptyObject(obj) {
41153 Object.keys(obj).forEach(key => {
41154 const config = Object.getOwnPropertyDescriptor(obj, key);
41155
41156 if (config.configurable && !isSpecialProperty(obj, key)) {
41157 delete obj[key];
41158 }
41159 });
41160 }
41161 /**
41162 * Compare an object with another, could be object, array, number, string, bool.
41163 * @private
41164 *
41165 * @param {Object} a The first object to compare
41166 * @param {Object} a The second object to compare
41167 * @returns {Boolean} Whether the objects are identical
41168 */
41169
41170
41171 function compare(a, b) {
41172 let isIdentical = true;
41173
41174 if (isObject(a) && isObject(b)) {
41175 if (Object.keys(a).length !== Object.keys(b).length) {
41176 return false;
41177 }
41178
41179 Object.keys(a).forEach(key => {
41180 if (!compare(a[key], b[key])) {
41181 isIdentical = false;
41182 }
41183 });
41184 return isIdentical;
41185 }
41186
41187 if (isArray(a) && isArray(b)) {
41188 if (a.length !== b.length) {
41189 return false;
41190 }
41191
41192 for (let i = 0, l = a.length; i < l; i += 1) {
41193 if (!compare(a[i], b[i])) {
41194 return false;
41195 }
41196 }
41197
41198 return true;
41199 }
41200
41201 return a === b;
41202 }
41203 /**
41204 * Generates patches by comparing two arrays.
41205 *
41206 * @private
41207 * @param {Array} oldA The old (original) array, which will be patched
41208 * @param {Array} newA The new array, which will be used to compare against
41209 * @returns {Array} An array of patches (if any)
41210 */
41211
41212
41213 function patchArray(original, newA, basePath) {
41214 let patches = [];
41215 const oldA = original.slice();
41216 let tmpIdx = -1;
41217
41218 function findIndex(a, id, idx) {
41219 if (a[idx] && isUndef(a[idx].qInfo)) {
41220 return null;
41221 }
41222
41223 if (a[idx] && a[idx].qInfo.qId === id) {
41224 // shortcut if identical
41225 return idx;
41226 }
41227
41228 for (let ii = 0, ll = a.length; ii < ll; ii += 1) {
41229 if (a[ii] && a[ii].qInfo.qId === id) {
41230 return ii;
41231 }
41232 }
41233
41234 return -1;
41235 }
41236
41237 if (compare(newA, oldA)) {
41238 // array is unchanged
41239 return patches;
41240 }
41241
41242 if (!isUndef(newA[0]) && isUndef(newA[0].qInfo)) {
41243 // we cannot create patches without unique identifiers, replace array...
41244 patches.push({
41245 op: 'replace',
41246 path: basePath,
41247 value: newA
41248 });
41249 return patches;
41250 }
41251
41252 for (let i = oldA.length - 1; i >= 0; i -= 1) {
41253 tmpIdx = findIndex(newA, oldA[i].qInfo && oldA[i].qInfo.qId, i);
41254
41255 if (tmpIdx === -1) {
41256 patches.push({
41257 op: 'remove',
41258 path: "".concat(basePath, "/").concat(i)
41259 });
41260 oldA.splice(i, 1);
41261 } else {
41262 patches = patches.concat(JSONPatch.generate(oldA[i], newA[tmpIdx], "".concat(basePath, "/").concat(i)));
41263 }
41264 }
41265
41266 for (let i = 0, l = newA.length; i < l; i += 1) {
41267 tmpIdx = findIndex(oldA, newA[i].qInfo && newA[i].qInfo.qId);
41268
41269 if (tmpIdx === -1) {
41270 patches.push({
41271 op: 'add',
41272 path: "".concat(basePath, "/").concat(i),
41273 value: newA[i]
41274 });
41275 oldA.splice(i, 0, newA[i]);
41276 } else if (tmpIdx !== i) {
41277 patches.push({
41278 op: 'move',
41279 path: "".concat(basePath, "/").concat(i),
41280 from: "".concat(basePath, "/").concat(tmpIdx)
41281 });
41282 oldA.splice(i, 0, oldA.splice(tmpIdx, 1)[0]);
41283 }
41284 }
41285
41286 return patches;
41287 }
41288 /**
41289 * Generate an array of JSON-Patch:es following the JSON-Patch Specification Draft.
41290 *
41291 * See [specification draft](http://tools.ietf.org/html/draft-ietf-appsawg-json-patch-10)
41292 *
41293 * Does NOT currently generate patches for arrays (will replace them)
41294 * @private
41295 *
41296 * @param {Object} original The object to patch to
41297 * @param {Object} newData The object to patch from
41298 * @param {String} [basePath] The base path to use when generating the paths for
41299 * the patches (normally not used)
41300 * @returns {Array} An array of patches
41301 */
41302
41303
41304 JSONPatch.generate = function generate(original, newData, basePath) {
41305 basePath = basePath || '';
41306 let patches = [];
41307 Object.keys(newData).forEach(key => {
41308 const val = generateValue(newData[key]);
41309 const oldVal = original[key];
41310 const tmpPath = "".concat(basePath, "/").concat(key);
41311
41312 if (compare(val, oldVal) || isSpecialProperty(newData, key)) {
41313 return;
41314 }
41315
41316 if (isUndef(oldVal)) {
41317 // property does not previously exist
41318 patches.push({
41319 op: 'add',
41320 path: tmpPath,
41321 value: val
41322 });
41323 } else if (isObject(val) && isObject(oldVal)) {
41324 // we need to generate sub-patches for this, since it already exist
41325 patches = patches.concat(JSONPatch.generate(oldVal, val, tmpPath));
41326 } else if (isArray(val) && isArray(oldVal)) {
41327 patches = patches.concat(patchArray(oldVal, val, tmpPath));
41328 } else {
41329 // it's a simple property (bool, string, number)
41330 patches.push({
41331 op: 'replace',
41332 path: "".concat(basePath, "/").concat(key),
41333 value: val
41334 });
41335 }
41336 });
41337 Object.keys(original).forEach(key => {
41338 if (isUndef(newData[key]) && !isSpecialProperty(original, key)) {
41339 // this property does not exist anymore
41340 patches.push({
41341 op: 'remove',
41342 path: "".concat(basePath, "/").concat(key)
41343 });
41344 }
41345 });
41346 return patches;
41347 };
41348 /**
41349 * Apply a list of patches to an object.
41350 * @private
41351 *
41352 * @param {Object} original The object to patch
41353 * @param {Array} patches The list of patches to apply
41354 */
41355
41356
41357 JSONPatch.apply = function apply(original, patches) {
41358 patches.forEach(patch => {
41359 let parent = getParent(original, patch.path);
41360 let key = patch.path.split('/').splice(-1)[0];
41361 let target = key && isNaN(+key) ? parent[key] : parent[+key] || parent;
41362 const from = patch.from ? patch.from.split('/').splice(-1)[0] : null;
41363
41364 if (patch.path === '/') {
41365 parent = null;
41366 target = original;
41367 }
41368
41369 if (patch.op === 'add' || patch.op === 'replace') {
41370 if (isArray(parent)) {
41371 // trust indexes from patches, so don't replace the index if it's an add
41372 if (key === '-') {
41373 key = parent.length;
41374 }
41375
41376 parent.splice(+key, patch.op === 'add' ? 0 : 1, patch.value);
41377 } else if (isArray(target) && isArray(patch.value)) {
41378 const newValues = patch.value.slice(); // keep array reference if possible...
41379
41380 target.length = 0;
41381 target.push(...newValues);
41382 } else if (isObject(target) && isObject(patch.value)) {
41383 // keep object reference if possible...
41384 emptyObject(target);
41385 extend(target, patch.value);
41386 } else if (!parent) {
41387 throw new Error('Patchee is not an object we can patch');
41388 } else {
41389 // simple value
41390 parent[key] = patch.value;
41391 }
41392 } else if (patch.op === 'move') {
41393 const oldParent = getParent(original, patch.from);
41394
41395 if (isArray(parent)) {
41396 parent.splice(+key, 0, oldParent.splice(+from, 1)[0]);
41397 } else {
41398 parent[key] = oldParent[from];
41399 delete oldParent[from];
41400 }
41401 } else if (patch.op === 'remove') {
41402 if (isArray(parent)) {
41403 parent.splice(+key, 1);
41404 } else {
41405 delete parent[key];
41406 }
41407 }
41408 });
41409 };
41410 /**
41411 * Deep clone an object.
41412 * @private
41413 *
41414 * @param {Object} obj The object to clone
41415 * @returns {Object} A new object identical to the `obj`
41416 */
41417
41418
41419 JSONPatch.clone = function clone(obj) {
41420 return extend({}, obj);
41421 };
41422 /**
41423 * Creates a JSON-patch.
41424 * @private
41425 *
41426 * @param {String} op The operation of the patch. Available values: "add", "remove", "move"
41427 * @param {Object} [val] The value to set the `path` to. If `op` is `move`, `val`
41428 * is the "from JSON-path" path
41429 * @param {String} path The JSON-path for the property to change (e.g. "/qHyperCubeDef/columnOrder")
41430 * @returns {Object} A patch following the JSON-patch specification
41431 */
41432
41433
41434 JSONPatch.createPatch = function createPatch(op, val, path) {
41435 const patch = {
41436 op: op.toLowerCase(),
41437 path
41438 };
41439
41440 if (patch.op === 'move') {
41441 patch.from = val;
41442 } else if (typeof val !== 'undefined') {
41443 patch.value = val;
41444 }
41445
41446 return patch;
41447 };
41448 /**
41449 * Apply the differences of two objects (keeping references if possible).
41450 * Identical to running `JSONPatch.apply(original, JSONPatch.generate(original, newData));`
41451 * @private
41452 *
41453 * @param {Object} original The object to update/patch
41454 * @param {Object} newData the object to diff against
41455 *
41456 * @example
41457 * var obj1 = { foo: [1,2,3], bar: { baz: true, qux: 1 } };
41458 * var obj2 = { foo: [4,5,6], bar: { baz: false } };
41459 * JSONPatch.updateObject(obj1, obj2);
41460 * // => { foo: [4,5,6], bar: { baz: false } };
41461 */
41462
41463
41464 JSONPatch.updateObject = function updateObject(original, newData) {
41465 if (!Object.keys(original).length) {
41466 extend(original, newData);
41467 return;
41468 }
41469
41470 JSONPatch.apply(original, JSONPatch.generate(original, newData));
41471 };
41472
41473 const mixin$1 = obj => {
41474 /* eslint no-param-reassign: 0 */
41475 Object.keys(nodeEventEmitter.prototype).forEach(key => {
41476 obj[key] = nodeEventEmitter.prototype[key];
41477 });
41478 nodeEventEmitter.init(obj);
41479 return obj;
41480 };
41481
41482 const actionWrapper = component => item => {
41483 const wrapped = mixin$1(_objectSpread2(_objectSpread2({}, item), {}, {
41484 action() {
41485 if (typeof item.action === 'function') {
41486 item.action.call(wrapped, component);
41487 }
41488
41489 wrapped.emit('changed');
41490 },
41491
41492 enabled() {
41493 if (typeof item.enabled === 'function') {
41494 return item.enabled.call(wrapped, component);
41495 }
41496
41497 return true;
41498 },
41499
41500 active: typeof item.active === 'function' ? function active() {
41501 return item.active.call(wrapped, component);
41502 } : undefined
41503 }));
41504 return wrapped;
41505 };
41506
41507 function actionhero (_ref) {
41508 let {
41509 sn,
41510 component
41511 } = _ref;
41512 const actions = {};
41513 const selectionToolbarItems = [];
41514 const w = actionWrapper(component);
41515 ((sn.definition.selectionToolbar || {}).items || []).forEach(item => {
41516 const wrapped = w(item); // TODO - check if key exists
41517
41518 actions[item.key] = wrapped;
41519 selectionToolbarItems.push(wrapped);
41520 });
41521 (sn.definition.actions || []).forEach(item => {
41522 const wrapped = w(item); // TODO - check if key exists
41523
41524 actions[item.key] = wrapped;
41525 });
41526 return {
41527 actions,
41528 selectionToolbarItems,
41529
41530 destroy() {
41531 selectionToolbarItems.length = 0;
41532 }
41533
41534 };
41535 }
41536
41537 /* eslint no-underscore-dangle: 0 */
41538
41539 /* eslint no-param-reassign: 0 */
41540
41541 /* eslint no-console: 0 */
41542
41543 /* eslint no-use-before-define: 0 */
41544 // Hooks implementation heavily inspired by preact hooks
41545 let currentComponent;
41546 let currentIndex;
41547
41548 function depsChanged(prevDeps, deps) {
41549 if (!prevDeps) {
41550 return true;
41551 }
41552
41553 if (deps.length !== prevDeps.length) {
41554 return true;
41555 }
41556
41557 for (let i = 0; i < deps.length; i++) {
41558 if (prevDeps[i] !== deps[i]) {
41559 return true;
41560 }
41561 }
41562
41563 return false;
41564 }
41565
41566 function initiate(component) {
41567 let {
41568 explicitResize = false
41569 } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
41570 component.__hooks = {
41571 obsolete: false,
41572 error: false,
41573 waitForData: false,
41574 chain: {
41575 promise: null,
41576 resolve: () => {}
41577 },
41578 list: [],
41579 snaps: [],
41580 actions: {
41581 list: []
41582 },
41583 pendingEffects: [],
41584 pendingLayoutEffects: [],
41585 pendingPromises: [],
41586 resizer: {
41587 setters: [],
41588 explicitResize
41589 },
41590 accessibility: {
41591 setter: null
41592 }
41593 };
41594 }
41595 function teardown(component) {
41596 flushPending(component.__hooks.list, true);
41597 component.__hooks.obsolete = true;
41598 component.__hooks.list.length = 0;
41599 component.__hooks.pendingEffects.length = 0;
41600 component.__hooks.pendingLayoutEffects.length = 0;
41601 component.__hooks.actions = null;
41602 component.__hooks.imperativeHandle = null;
41603 component.__hooks.resizer = null;
41604 component.__hooks.accessibility = null;
41605 component.__actionsDispatch = null;
41606 clearTimeout(component.__hooks.micro);
41607 cancelAnimationFrame(component.__hooks.macro);
41608 }
41609 async function run(component) {
41610 if (component.__hooks.obsolete) {
41611 return Promise.resolve();
41612 }
41613
41614 currentIndex = -1;
41615 currentComponent = component;
41616 let num = -1;
41617
41618 if (currentComponent.__hooks.initiated) {
41619 num = currentComponent.__hooks.list.length;
41620 }
41621
41622 try {
41623 currentComponent.fn.call(null);
41624 } catch (e) {
41625 console.error(e);
41626 }
41627
41628 currentComponent.__hooks.initiated = true;
41629
41630 {
41631 if (num > -1 && num !== currentComponent.__hooks.list.length) {
41632 console.error('Detected a change in the order of hooks called.');
41633 }
41634 }
41635
41636 const hooks = currentComponent.__hooks;
41637 dispatchActions(currentComponent);
41638 currentIndex = undefined;
41639 currentComponent = undefined;
41640
41641 if (!hooks.chain.promise) {
41642 hooks.chain.promise = new Promise(resolve => {
41643 hooks.chain.resolve = resolve;
41644 });
41645 }
41646
41647 flushMicro(hooks);
41648 scheduleMacro(hooks);
41649 return hooks.chain.promise;
41650 }
41651
41652 function flushPending(list, skipUpdate) {
41653 try {
41654 list.forEach(fx => {
41655 // teardown existing
41656 typeof fx.teardown === 'function' ? fx.teardown() : null; // update
41657
41658 if (!skipUpdate) {
41659 fx.teardown = fx.value[0]();
41660 }
41661 });
41662 } catch (e) {
41663 console.error(e);
41664 }
41665
41666 list.length = 0;
41667 }
41668
41669 function flushMicro(hooks) {
41670 flushPending(hooks.pendingLayoutEffects);
41671 }
41672
41673 function flushMacro(hooks) {
41674 flushPending(hooks.pendingEffects);
41675 hooks.macro = null;
41676 maybeEndChain(hooks); // eslint-disable-line no-use-before-define
41677 }
41678
41679 function maybeEndChain(hooks) {
41680 if (hooks.pendingPromises.length || hooks.micro || hooks.macro) {
41681 return;
41682 }
41683
41684 hooks.chain.promise = null;
41685 hooks.chain.resolve(!hooks.waitForData);
41686 }
41687
41688 function runSnaps(component, layout) {
41689 try {
41690 return Promise.all(component.__hooks.snaps.map(h => Promise.resolve(h.fn(layout)))).then(snaps => snaps[snaps.length - 1]);
41691 } catch (e) {
41692 console.error(e);
41693 }
41694
41695 return Promise.resolve();
41696 }
41697 function getImperativeHandle(component) {
41698 return component.__hooks.imperativeHandle;
41699 }
41700
41701 function dispatchActions(component) {
41702 if (component.__actionsDispatch && component.__hooks.actions.changed) {
41703 component.__actionsDispatch(component.__hooks.actions.list.slice());
41704
41705 component.__hooks.actions.changed = false;
41706 }
41707 }
41708
41709 function observeActions(component, callback) {
41710 component.__actionsDispatch = callback;
41711
41712 if (component.__hooks) {
41713 component.__hooks.actions.changed = true;
41714 dispatchActions(component);
41715 }
41716 }
41717
41718 function getHook(idx) {
41719 if (typeof currentComponent === 'undefined') {
41720 throw new Error('Invalid stardust hook call. Hooks can only be called inside a visualization component.');
41721 }
41722
41723 const hooks = currentComponent.__hooks;
41724
41725 if (idx >= hooks.list.length) {
41726 hooks.list.push({});
41727 }
41728
41729 return hooks.list[idx];
41730 }
41731
41732 function scheduleMicro(component) {
41733 if (component.__hooks.micro) {
41734 return;
41735 }
41736
41737 component.__hooks.micro = setTimeout(() => {
41738 component.__hooks.micro = null;
41739 run(component);
41740 }, 0);
41741 }
41742
41743 function scheduleMacro(hooks) {
41744 if (hooks.macro) {
41745 return;
41746 }
41747
41748 hooks.macro = requestAnimationFrame(() => {
41749 flushMacro(hooks);
41750 });
41751 }
41752
41753 function useInternalContext(name) {
41754 getHook(++currentIndex);
41755 const ctx = currentComponent.context;
41756 return ctx[name];
41757 }
41758
41759 function updateRectOnNextRun(component) {
41760 if (component.__hooks) {
41761 component.__hooks.resizer.update = true;
41762 }
41763 } // ======== EXTERNAL =========
41764
41765 function hook(cb) {
41766 return {
41767 __hooked: true,
41768 fn: cb,
41769 initiate,
41770 run,
41771 teardown,
41772 runSnaps,
41773 focus,
41774 blur,
41775 observeActions,
41776 getImperativeHandle,
41777 updateRectOnNextRun
41778 };
41779 }
41780 /**
41781 * @template S
41782 * @interface SetStateFn
41783 * @param {S|function(S):S} newState - The new state
41784 */
41785
41786 /**
41787 * Creates a stateful value.
41788 * @entry
41789 * @template S
41790 * @param {S|function():S} initialState - The initial state.
41791 * @returns {Array<S,SetStateFn<S>>} The value and a function to update it.
41792 * @example
41793 * import { useState } from '@nebula.js/stardust';
41794 * // ...
41795 * // initiate with simple primitive value
41796 * const [zoomed, setZoomed] = useState(false);
41797 *
41798 * // update
41799 * setZoomed(true);
41800 *
41801 * // lazy initiation
41802 * const [value, setValue] = useState(() => heavy());
41803 *
41804 */
41805
41806 function useState(initial) {
41807 const h = getHook(++currentIndex);
41808
41809 if (!h.value) {
41810 // initiate
41811 h.component = currentComponent;
41812
41813 const setState = s => {
41814 if (h.component.__hooks.obsolete) {
41815 {
41816 throw new Error('Calling setState on an unmounted component is a no-op and indicates a memory leak in your component.');
41817 }
41818 }
41819
41820 const v = typeof s === 'function' ? s(h.value[0]) : s;
41821
41822 if (v !== h.value[0]) {
41823 h.value[0] = v;
41824 scheduleMicro(h.component);
41825 }
41826 };
41827
41828 h.value = [typeof initial === 'function' ? initial() : initial, setState];
41829 }
41830
41831 return h.value;
41832 }
41833 /**
41834 * @typedef {function():(void | function():void)} EffectCallback
41835 */
41836
41837 /**
41838 * Triggers a callback function when a dependent value changes.
41839 * @entry
41840 * @param {EffectCallback} effect - The callback.
41841 * @param {Array<any>=} deps - The dependencies that should trigger the callback.
41842 * @example
41843 * import { useEffect } from '@nebula.js/stardust';
41844 * // ...
41845 * useEffect(() => {
41846 * console.log('mounted');
41847 * return () => {
41848 * console.log('unmounted');
41849 * };
41850 * }, []);
41851 */
41852
41853 function useEffect(cb, deps) {
41854 {
41855 if (typeof deps !== 'undefined' && !Array.isArray(deps)) {
41856 throw new Error('Invalid dependencies. Second argument must be an array.');
41857 }
41858 }
41859
41860 const h = getHook(++currentIndex);
41861
41862 if (depsChanged(h.value ? h.value[1] : undefined, deps)) {
41863 h.value = [cb, deps];
41864
41865 if (currentComponent.__hooks.pendingEffects.indexOf(h) === -1) {
41866 currentComponent.__hooks.pendingEffects.push(h);
41867 }
41868 }
41869 } // don't expose this hook since it's no different than useEffect except for the timing
41870
41871 function useLayoutEffect(cb, deps) {
41872 {
41873 if (typeof deps !== 'undefined' && !Array.isArray(deps)) {
41874 throw new Error('Invalid dependencies. Second argument must be an array.');
41875 }
41876 }
41877
41878 const h = getHook(++currentIndex);
41879
41880 if (depsChanged(h.value ? h.value[1] : undefined, deps)) {
41881 h.value = [cb, deps];
41882
41883 currentComponent.__hooks.pendingLayoutEffects.push(h);
41884 }
41885 }
41886 /**
41887 * Creates a stateful value when a dependent changes.
41888 * @entry
41889 * @template T
41890 * @param {function():T} factory - The factory function.
41891 * @param {Array<any>} deps - The dependencies.
41892 * @returns {T} The value returned from the factory function.
41893 * @example
41894 * import { useMemo } from '@nebula.js/stardust';
41895 * // ...
41896 * const v = useMemo(() => {
41897 * return doSomeHeavyCalculation();
41898 * }), []);
41899 */
41900
41901
41902 function useMemo(fn, deps) {
41903 {
41904 if (!deps) {
41905 console.warn('useMemo called without dependencies.');
41906 }
41907 }
41908
41909 const h = getHook(++currentIndex);
41910
41911 if (depsChanged(h.value ? h.value[0] : undefined, deps)) {
41912 h.value = [deps, fn()];
41913 }
41914
41915 return h.value[1];
41916 }
41917 /**
41918 * Runs a callback function when a dependent changes.
41919 * @entry
41920 * @template P
41921 * @param {function():Promise<P>} factory - The factory function that calls the promise.
41922 * @param {Array<any>=} deps - The dependencies.
41923 * @returns {Array<P,Error>} The resolved value.
41924 * @example
41925 * import { usePromise } from '@nebula.js/stardust';
41926 * import { useModel } from '@nebula.js/stardust';
41927 * // ...
41928 * const model = useModel();
41929 * const [resolved, rejected] = usePromise(() => model.getLayout(), []);
41930 */
41931
41932 function usePromise(p, deps) {
41933 const [obj, setObj] = useState(() => ({
41934 resolved: undefined,
41935 rejected: undefined,
41936 state: 'pending'
41937 }));
41938 const h = getHook(++currentIndex);
41939
41940 if (!h.component) {
41941 h.component = currentComponent;
41942 }
41943
41944 useLayoutEffect(() => {
41945 let canceled = false;
41946
41947 h.teardown = () => {
41948 canceled = true;
41949 h.teardown = null;
41950
41951 const idx = h.component.__hooks.pendingPromises.indexOf(h);
41952
41953 if (idx > -1) {
41954 h.component.__hooks.pendingPromises.splice(idx, 1);
41955 }
41956 }; // setObj({
41957 // ...obj,
41958 // state: 'pending',
41959 // });
41960
41961
41962 p().then(v => {
41963 if (canceled) {
41964 return;
41965 }
41966
41967 h.teardown && h.teardown();
41968 setObj({
41969 resolved: v,
41970 rejected: undefined,
41971 state: 'resolved'
41972 });
41973 }).catch(e => {
41974 if (canceled) {
41975 return;
41976 }
41977
41978 h.teardown && h.teardown();
41979 setObj({
41980 resolved: undefined,
41981 rejected: e,
41982 state: 'resolved'
41983 });
41984 });
41985
41986 h.component.__hooks.pendingPromises.push(h);
41987
41988 return () => {
41989 h.teardown && h.teardown();
41990 };
41991 }, deps);
41992 return [obj.resolved, obj.rejected];
41993 } // ---- composed hooks ------
41994
41995 /**
41996 * Gets the HTMLElement this visualization is rendered into.
41997 * @entry
41998 * @returns {HTMLElement}
41999 * @example
42000 * import { useElement } from '@nebula.js/stardust';
42001 * // ...
42002 * const el = useElement();
42003 * el.innerHTML = 'Hello!';
42004 */
42005
42006 function useElement() {
42007 return useInternalContext('element');
42008 }
42009 /**
42010 * @interface Rect
42011 * @property {number} top
42012 * @property {number} left
42013 * @property {number} width
42014 * @property {number} height
42015 */
42016
42017 /**
42018 * Gets the size of the HTMLElement the visualization is rendered into.
42019 * @entry
42020 * @returns {Rect} The size of the element.
42021 * @example
42022 * import { useRect } from '@nebula.js/stardust';
42023 * // ...
42024 * const rect = useRect();
42025 * useEffect(() => {
42026 * console.log('resize');
42027 * }, [rect.width, rect.height])
42028 */
42029
42030 function useRect() {
42031 const element = useElement();
42032 const ref = currentComponent.__hooks.resizer;
42033 const [rect, setRect] = useState(() => {
42034 const {
42035 left,
42036 top,
42037 width,
42038 height
42039 } = element.getBoundingClientRect();
42040 return {
42041 left,
42042 top,
42043 width,
42044 height
42045 };
42046 });
42047 ref.current = rect;
42048
42049 if (ref.setters.indexOf(setRect) === -1) {
42050 ref.setters.push(setRect);
42051 } // a forced resize should alwas update size regardless of whether ResizeObserver is available
42052
42053
42054 if (ref.update && ref.resize) {
42055 ref.update = false;
42056 ref.resize();
42057 }
42058
42059 useLayoutEffect(() => {
42060 if (ref.initiated) {
42061 return undefined;
42062 }
42063
42064 ref.initiated = true;
42065
42066 const handleResize = () => {
42067 // TODO - should we really care about left/top?
42068 const {
42069 left,
42070 top,
42071 width,
42072 height
42073 } = element.getBoundingClientRect();
42074 const r = ref.current;
42075
42076 if (r.width !== width || r.height !== height || r.left !== left || r.top !== top) {
42077 ref.setters.forEach(setR => setR({
42078 left,
42079 top,
42080 width,
42081 height
42082 }));
42083 }
42084 };
42085
42086 ref.resize = () => {
42087 handleResize();
42088 }; // if component is configured with explicitResize, then we skip the
42089 // size observer and let the user control the resize themselves
42090
42091
42092 if (ref.explicitResize) {
42093 return () => {
42094 ref.resize = undefined;
42095 };
42096 } // TODO - document that ResizeObserver needs to be polyfilled by the user
42097 // if they want auto resize to work
42098
42099
42100 if (typeof ResizeObserver === 'function') {
42101 let resizeObserver = new ResizeObserver(handleResize);
42102 resizeObserver.observe(element);
42103 return () => {
42104 resizeObserver.unobserve(element);
42105 resizeObserver.disconnect(element);
42106 resizeObserver = null;
42107 ref.resize = undefined;
42108 };
42109 }
42110
42111 return undefined;
42112 }, [element]);
42113 return rect;
42114 }
42115 /**
42116 * Gets the layout of the generic object associated with this visualization.
42117 * @entry
42118 * @returns {EngineAPI.IGenericObjectLayout}
42119 * @example
42120 * import { useLayout } from '@nebula.js/stardust';
42121 * // ...
42122 * const layout = useLayout();
42123 * console.log(layout);
42124 */
42125
42126 function useLayout() {
42127 return useInternalContext('layout');
42128 }
42129 /**
42130 * Gets the layout of the generic object associated with this visualization.
42131 *
42132 * Unlike the regular layout, a _stale_ layout is not changed when a generic object enters
42133 * the modal state. This is mostly notable in that `qSelectionInfo.qInSelections` in the layout is
42134 * always `false`.
42135 * The returned value from `useStaleLayout()` and `useLayout()` are identical when the object
42136 * is not in a modal state.
42137 * @entry
42138 * @returns {EngineAPI.IGenericObjectLayout}
42139 * @example
42140 * import { useStaleLayout } from '@nebula.js/stardust';
42141 * // ...
42142 * const staleLayout = useStaleLayout();
42143 * console.log(staleLayout);
42144 */
42145
42146 function useStaleLayout() {
42147 const layout = useInternalContext('layout');
42148 const [ref] = useState({
42149 current: layout
42150 });
42151
42152 if (!layout.qSelectionInfo || !layout.qSelectionInfo.qInSelections) {
42153 ref.current = layout;
42154 }
42155
42156 return ref.current;
42157 }
42158 /**
42159 * Gets the layout of the app associated with this visualization.
42160 * @entry
42161 * @returns {EngineAPI.INxAppLayout} The app layout
42162 * @example
42163 * import { useAppLayout } from '@nebula.js/stardust';
42164 * // ...
42165 * const appLayout = useAppLayout();
42166 * console.log(appLayout.qLocaleInfo);
42167 */
42168
42169 function useAppLayout() {
42170 return useInternalContext('appLayout');
42171 }
42172 /**
42173 * Gets the generic object API of the generic object connected to this visualization.
42174 * @entry
42175 * @returns {EngineAPI.IGenericObject|undefined}
42176 * @example
42177 * import { useModel } from '@nebula.js/stardust';
42178 * // ...
42179 * const model = useModel();
42180 * useEffect(() => {
42181 * model.getInfo().then(info => {
42182 * console.log(info);
42183 * })
42184 * }, []);
42185 */
42186
42187 function useModel() {
42188 const model = useInternalContext('model');
42189 return model && model.session ? model : undefined;
42190 }
42191 /**
42192 * Gets the doc API.
42193 * @entry
42194 * @returns {EngineAPI.IApp|undefined} The doc API.
42195 * @example
42196 * import { useApp } from '@nebula.js/stardust';
42197 * // ...
42198 * const app = useApp();
42199 * useEffect(() => {
42200 * app.getAllInfos().then(infos => {
42201 * console.log(infos);
42202 * })
42203 * }, []);
42204 */
42205
42206 function useApp() {
42207 const app = useInternalContext('app');
42208 return app && app.session ? app : undefined;
42209 }
42210 /**
42211 * Gets the global API.
42212 * @entry
42213 * @returns {EngineAPI.IGlobal|undefined} The global API.
42214 * @example
42215 * import { useGlobal } from '@nebula.js/stardust';
42216 *
42217 * // ...
42218 * const g = useGlobal();
42219 * useEffect(() => {
42220 * g.engineVersion().then(version => {
42221 * console.log(version);
42222 * })
42223 * }, []);
42224 */
42225
42226 function useGlobal() {
42227 const global = useInternalContext('global');
42228 return global && global.session ? global : undefined;
42229 }
42230 /**
42231 * Gets the object selections.
42232 * @entry
42233 * @returns {ObjectSelections} The object selections.
42234 * @example
42235 * import { useSelections } from '@nebula.js/stardust';
42236 * import { useElement } from '@nebula.js/stardust';
42237 * import { useEffect } from '@nebula.js/stardust';
42238 * // ...
42239 * const selections = useSelections();
42240 * const element = useElement();
42241 * useEffect(() => {
42242 * const onClick = () => {
42243 * selections.begin('/qHyperCubeDef');
42244 * };
42245 * element.addEventListener('click', onClick);
42246 * return () => {
42247 * element.removeEventListener('click', onClick);
42248 * };
42249 * }, []);
42250 */
42251
42252 function useSelections() {
42253 return useInternalContext('selections');
42254 }
42255 /**
42256 * Gets the theme.
42257 * @entry
42258 * @returns {Theme} The theme.
42259 * @example
42260 * import { useTheme } from '@nebula.js/stardust';
42261 *
42262 * const theme = useTheme();
42263 * console.log(theme.getContrastinColorTo('#ff0000'));
42264 */
42265
42266 function useTheme() {
42267 return useInternalContext('theme');
42268 }
42269 /**
42270 * Gets the embed instance used.
42271 * @entry
42272 * @experimental
42273 * @since 1.7.0
42274 * @returns {Embed} The embed instance used.
42275 * @example
42276 * import { useEmbed } from '@nebula.js/stardust';
42277 *
42278 * const embed = useEmbed();
42279 * embed.render(...)
42280 */
42281
42282 function useEmbed() {
42283 return useInternalContext('nebbie');
42284 }
42285 /**
42286 * Gets the translator.
42287 * @entry
42288 * @returns {Translator} The translator.
42289 * @example
42290 * import { useTranslator } from '@nebula.js/stardust';
42291 * // ...
42292 * const translator = useTranslator();
42293 * console.log(translator.get('SomeString'));
42294 */
42295
42296 function useTranslator() {
42297 return useInternalContext('translator');
42298 }
42299 /**
42300 * Gets the device type. ('touch' or 'desktop')
42301 * @entry
42302 * @returns {string} device type.
42303 * @example
42304 * import { useDeviceType } from '@nebula.js/stardust';
42305 * // ...
42306 * const deviceType = useDeviceType();
42307 * if (deviceType === 'touch') { ... };
42308 */
42309
42310 function useDeviceType() {
42311 return useInternalContext('deviceType');
42312 }
42313 /**
42314 * Gets the array of plugins provided when rendering the visualization.
42315 * @entry
42316 * @returns {Plugin[]} array of plugins.
42317 * @example
42318 * // provide plugins that can be used when rendering
42319 * embed(app).render({
42320 * element,
42321 * type: 'my-chart',
42322 * plugins: [plugin]
42323 * });
42324 *
42325 * @example
42326 * // It's up to the chart implementation to make use of plugins in any way
42327 * import { usePlugins } from '@nebula.js/stardust';
42328 * // ...
42329 * const plugins = usePlugins();
42330 * plugins.forEach((plugin) => {
42331 * // Invoke plugin
42332 * plugin.fn();
42333 * });
42334 */
42335
42336 function usePlugins() {
42337 return useInternalContext('plugins');
42338 }
42339 /**
42340 * @template A
42341 * @interface ActionDefinition
42342 * @property {A} action
42343 * @property {boolean=} hidden
42344 * @property {boolean=} disabled
42345 * @property {object=} icon
42346 * @property {string} [icon.viewBox="0 0 16 16"]
42347 * @property {Array<object>} icon.shapes
42348 * @property {string} icon.shapes[].type
42349 * @property {object=} icon.shapes[].attrs
42350 */
42351
42352 /**
42353 * Registers a custom action.
42354 * @entry
42355 * @template A
42356 * @param {function():ActionDefinition<A>} factory
42357 * @param {Array<any>=} deps
42358 * @returns {A}
42359 *
42360 * @example
42361 * import { useAction } from '@nebula.js/stardust';
42362 * // ...
42363 * const [zoomed, setZoomed] = useState(false);
42364 * const act = useAction(() => ({
42365 * hidden: false,
42366 * disabled: zoomed,
42367 * action() {
42368 * setZoomed(prev => !prev);
42369 * },
42370 * icon: {}
42371 * }), [zoomed]);
42372 */
42373
42374 function useAction(fn, deps) {
42375 const [ref] = useState({
42376 action() {
42377 ref._config.action.call(null);
42378 }
42379
42380 });
42381
42382 if (!ref.component) {
42383 ref.component = currentComponent;
42384
42385 currentComponent.__hooks.actions.list.push(ref);
42386 }
42387
42388 useMemo(() => {
42389 const a = fn();
42390 ref._config = a;
42391 ref.active = a.active || false;
42392 ref.disabled = a.disabled || false;
42393 ref.hidden = a.hidden || false;
42394 ref.label = a.label || '';
42395 ref.getSvgIconShape = a.icon ? () => a.icon : undefined;
42396 ref.key = a.key || ref.component.__hooks.actions.list.length;
42397 ref.component.__hooks.actions.changed = true;
42398 }, deps);
42399 return ref.action;
42400 }
42401 /**
42402 * @interface Constraints
42403 * @property {boolean=} passive Whether or not passive constraints are on. Should block any passive interaction by users, ie: tooltips
42404 * @property {boolean=} active Whether or not active constraints are on. Should block any active interaction by users, ie: scroll, click
42405 * @property {boolean=} select Whether or not active select are on. Should block any selection action. Implied when active is true.
42406 */
42407
42408 /**
42409 * Gets the desired constraints that should be applied when rendering the visualization.
42410 *
42411 * The constraints are set on the embed configuration before the visualization is rendered
42412 * and should respected by you when implementing the visualization.
42413 * @entry
42414 * @returns {Constraints}
42415 * @example
42416 * // configure embed to disallow active interactions when rendering
42417 * embed(app, {
42418 * context: {
42419 * constraints: {
42420 * active: true, // do not allow interactions
42421 * }
42422 * }
42423 * }).render({ element, id: 'sdfsdf' });
42424 *
42425 * @example
42426 * import { useConstraints } from '@nebula.js/stardust';
42427 * // ...
42428 * const constraints = useConstraints();
42429 * useEffect(() => {
42430 * if (constraints.active) {
42431 * // do not add any event listener if active constraint is set
42432 * return undefined;
42433 * }
42434 * const listener = () => {};
42435 * element.addEventListener('click', listener);
42436 * return () => {
42437 * element.removeEventListener('click', listener);
42438 * };
42439 * }, [constraints])
42440 *
42441 */
42442
42443 function useConstraints() {
42444 return useInternalContext('constraints');
42445 }
42446 /**
42447 * Gets the options object provided when rendering the visualization.
42448 *
42449 * This is an empty object by default but enables customization of the visualization through this object.
42450 * Options are different from setting properties on the generic object in that options
42451 * are only temporary settings applied to the visualization when rendered.
42452 *
42453 * You have the responsibility to provide documentation of the options you support, if any.
42454 * @entry
42455 * @returns {object}
42456 *
42457 * @example
42458 * // when embedding the visualization, anything can be set in options
42459 * embed(app).render({
42460 * element,
42461 * type: 'my-chart',
42462 * options: {
42463 * showNavigation: true,
42464 * }
42465 * });
42466 *
42467 * @example
42468 * // it is up to you use and implement the provided options
42469 * import { useOptions } from '@nebula.js/stardust';
42470 * import { useEffect } from '@nebula.js/stardust';
42471 * // ...
42472 * const options = useOptions();
42473 * useEffect(() => {
42474 * if (!options.showNavigation) {
42475 * // hide navigation
42476 * } else {
42477 * // show navigation
42478 * }
42479 * }, [options.showNavigation]);
42480 *
42481 */
42482
42483 function useOptions() {
42484 return useInternalContext('options');
42485 }
42486 /**
42487 * TODO before making public - expose getImperativeHandle on Viz
42488 * Exposes an API to the external environment.
42489 *
42490 * This is an empty object by default, but enables you to provide a custom API of your visualization to
42491 * make it possible to control after it has been rendered.
42492 *
42493 * You can only use this hook once, calling it more than once is considered an error.
42494 * @entry
42495 * @private
42496 * @template T
42497 * @param {function():T} factory
42498 * @param {Array<any>=} deps
42499 * @example
42500 * import { useImperativeHandle } form '@nebula.js/stardust';
42501 * // ...
42502 * useImperativeHandle(() => ({
42503 * resetZoom() {
42504 * setZoomed(false);
42505 * }
42506 * }));
42507 *
42508 * @example
42509 * // when embedding the visualization, you can get a handle to this API
42510 * // and use it to control the visualization
42511 * const ctl = await embed(app).render({
42512 * element,
42513 * type: 'my-chart',
42514 * });
42515 * ctl.getImperativeHandle().resetZoom();
42516 */
42517
42518 function useImperativeHandle(fn, deps) {
42519 const h = getHook(++currentIndex);
42520
42521 if (!h.imperative) {
42522 {
42523 if (currentComponent.__hooks.imperativeHandle) {
42524 throw new Error('useImperativeHandle already used.');
42525 }
42526 }
42527
42528 h.imperative = true;
42529 }
42530
42531 if (depsChanged(h.value ? h.value[0] : undefined, deps)) {
42532 const v = fn();
42533 h.value = [deps, v];
42534 currentComponent.__hooks.imperativeHandle = v;
42535 }
42536 }
42537 /**
42538 * Registers a callback that is called when a snapshot is taken.
42539 * @entry
42540 * @param {function(EngineAPI.IGenericObjectLayout): Promise<EngineAPI.IGenericObjectLayout>} snapshotCallback
42541 * @example
42542 * import { onTakeSnapshot } from '@nebula.js/stardust';
42543 * import { useState } from '@nebula.js/stardust';
42544 * import { useLayout } from '@nebula.js/stardust';
42545 *
42546 * const layout = useLayout();
42547 * const [zoomed] = useState(layout.isZoomed || false);
42548 *
42549 * onTakeSnapshot((copyOfLayout) => {
42550 * copyOfLayout.isZoomed = zoomed;
42551 * return Promise.resolve(copyOfLayout);
42552 * });
42553 */
42554
42555 function onTakeSnapshot(cb) {
42556 const h = getHook(++currentIndex);
42557
42558 if (!h.value) {
42559 h.value = 1;
42560
42561 currentComponent.__hooks.snaps.push(h);
42562 }
42563
42564 h.fn = cb;
42565 }
42566 /**
42567 * @interface RenderState
42568 * @property {any} pending
42569 * @property {any} restore
42570 */
42571
42572 /**
42573 * Gets render state instance.
42574 *
42575 * Used to update properties and get a new layout without triggering onInitialRender.
42576 * @entry
42577 * @experimental
42578 * @returns {RenderState} The render state.
42579 * @example
42580 * import { useRenderState } from '@nebula.js/stardust';
42581 *
42582 * const renderState = useRenderState();
42583 * useState(() => {
42584 * if(needProperteisUpdate(...)) {
42585 * useRenderState.pending();
42586 * updateProperties(...);
42587 * } else {
42588 * useRenderState.restore();
42589 * ...
42590 * }
42591 * }, [...]);
42592 */
42593
42594 function useRenderState() {
42595 getHook(++currentIndex);
42596 const hooks = currentComponent.__hooks;
42597 return {
42598 pending: () => {
42599 hooks.waitForData = true;
42600 },
42601 restore: () => {
42602 hooks.waitForData = false;
42603 }
42604 };
42605 }
42606 /**
42607 * @experimental
42608 * @interface Keyboard
42609 * @property {boolean} enabled Whether or not Nebula handles keyboard navigation or not.
42610 * @property {boolean} active Set to true when the chart is activated, ie a user tabs to the chart and presses Enter or Space.
42611 * @property {function=} blur Function used by the visualization to tell Nebula to it wants to relinquish focus
42612 * @property {function=} focus Function used by the visualization to tell Nebula to it wants focus
42613 * @property {function=} focusSelection Function used by the visualization to tell Nebula to focus the selection toolbar
42614 */
42615
42616 /**
42617 * Gets the desired keyboard settings and status to applied when rendering the visualization.
42618 * A visualization should in general only have tab stops if either `keyboard.enabled` is false or if active is true.
42619 * This means that either Nebula isn't configured to handle keyboard input or the chart is currently focused.
42620 * Enabling or disabling keyboardNavigation are set on the embed configuration and
42621 * should be respected by the visualization.
42622 * @entry
42623 * @returns {Keyboard}
42624 * @example
42625 * // configure nebula to enable navigation between charts
42626 * embed(app, {
42627 * context: {
42628 * keyboardNavigation: true, // tell Nebula to handle navigation
42629 * }
42630 * }).render({ element, id: 'sdfsdf' });
42631 *
42632 * @example
42633 * import { useKeyboard } from '@nebula.js/stardust';
42634 * // ...
42635 * const keyboard = useKeyboard();
42636 * useEffect(() => {
42637 * // Set a tab stop on our button if in focus or if Nebulas navigation is disabled
42638 * button.setAttribute('tabIndex', keyboard.active || !keyboard.enabled ? 0 : -1);
42639 * // If navigation is enabled and focus has shifted, lets focus the button
42640 * keyboard.enabled && keyboard.active && button.focus();
42641 * }, [keyboard])
42642 *
42643 */
42644
42645 function useKeyboard() {
42646 const keyboardNavigation = useInternalContext('keyboardNavigation');
42647 const focusHandler = useInternalContext('focusHandler');
42648
42649 if (!currentComponent.__hooks.accessibility.exitFunction) {
42650 const exitFunction = function (resetFocus) {
42651 const acc = this.__hooks.accessibility;
42652
42653 if (acc.enabled && acc.active) {
42654 blur(this);
42655 focusHandler && focusHandler.blurCallback && focusHandler.blurCallback(resetFocus);
42656 }
42657 }.bind(currentComponent);
42658
42659 currentComponent.__hooks.accessibility.exitFunction = exitFunction;
42660
42661 const focusFunction = function () {
42662 const acc = this.__hooks.accessibility;
42663
42664 if (acc.enabled && !acc.active) {
42665 focusHandler && focusHandler.blurCallback && focusHandler.blurCallback(false);
42666 focus(this);
42667 }
42668 }.bind(currentComponent);
42669
42670 currentComponent.__hooks.accessibility.focusFunction = focusFunction;
42671
42672 const focusSelectionFunction = function (focusLast) {
42673 const acc = this.__hooks.accessibility;
42674
42675 if (acc.enabled) {
42676 focusHandler && focusHandler.focusToolbarButton && focusHandler.focusToolbarButton(focusLast);
42677 }
42678 }.bind(currentComponent);
42679
42680 currentComponent.__hooks.accessibility.focusSelectionFunction = focusSelectionFunction;
42681 }
42682
42683 const focusFunc = currentComponent.__hooks.accessibility.focusFunction;
42684 const exitFunc = currentComponent.__hooks.accessibility.exitFunction;
42685 const focusSelectionFunc = currentComponent.__hooks.accessibility.focusSelectionFunction;
42686 const [acc, setAcc] = useState({
42687 active: false,
42688 enabled: keyboardNavigation,
42689 blur: exitFunc,
42690 focus: focusFunc,
42691 focusSelection: focusSelectionFunc
42692 });
42693 currentComponent.__hooks.accessibility.setter = setAcc;
42694 currentComponent.__hooks.accessibility.enabled = keyboardNavigation;
42695 useEffect(() => setAcc({
42696 active: false,
42697 enabled: keyboardNavigation,
42698 blur: exitFunc,
42699 focus: focusFunc,
42700 focusSelection: focusSelectionFunc
42701 }), [keyboardNavigation]);
42702 return acc;
42703 }
42704 function focus(component) {
42705 const acc = component.__hooks.accessibility;
42706
42707 if (acc.active) {
42708 return;
42709 }
42710
42711 acc.active = true;
42712
42713 if (acc && acc.setter) {
42714 acc.setter({
42715 active: true,
42716 enabled: acc.enabled,
42717 blur: acc.exitFunction,
42718 focus: acc.focusFunction,
42719 focusSelection: acc.focusSelectionFunction
42720 });
42721 }
42722 }
42723 function blur(component) {
42724 const acc = component.__hooks.accessibility; // Incomplete/Invalid/Legacy viz hasn't been initialized with hooks
42725
42726 if (!acc || !acc.active) {
42727 return;
42728 }
42729
42730 acc.active = false;
42731
42732 if (acc && acc.setter) {
42733 acc.setter({
42734 active: false,
42735 enabled: acc.enabled,
42736 blur: acc.exitFunction,
42737 focus: acc.focusFunction,
42738 focusSelection: acc.focusSelectionFunction
42739 });
42740 }
42741 }
42742
42743 const defaultComponent = {
42744 app: null,
42745 model: null,
42746 actions: null,
42747 selections: null,
42748 created: () => {},
42749 mounted: () => {},
42750 render: () => {},
42751 resize: () => {},
42752 willUnmount: () => {},
42753 destroy: () => {},
42754 emit: () => {},
42755 getViewState: () => {},
42756
42757 // temporary
42758 observeActions() {},
42759
42760 setSnapshotData: snapshot => Promise.resolve(snapshot)
42761 };
42762 const reservedKeys = Object.keys(defaultComponent);
42763
42764 const mixin = obj => {
42765 /* eslint no-param-reassign: 0 */
42766 Object.keys(nodeEventEmitter.prototype).forEach(key => {
42767 obj[key] = nodeEventEmitter.prototype[key];
42768 });
42769 nodeEventEmitter.init(obj);
42770 return obj;
42771 };
42772
42773 function createWithHooks(generator, opts, galaxy) {
42774 {
42775 if (generator.component.run !== run) {
42776 // eslint-disable-next-line no-console
42777 console.warn('Detected multiple supernova modules, this might cause problems.');
42778 }
42779 }
42780
42781 const qGlobal = opts.app && opts.app.session ? opts.app.session.getObjectApi({
42782 handle: -1
42783 }) : undefined; // use a deep comparison for 'small' objects
42784
42785 let hasRun = false;
42786 const current = {};
42787 const deepCheck = ['appLayout', 'constraints'];
42788 const forcedConstraints = {}; // select should be a constraint when a real model is not available
42789
42790 if (!opts.model || !opts.model.session) {
42791 forcedConstraints.select = true;
42792 }
42793
42794 const c = {
42795 context: {
42796 // static values that are not expected to
42797 // change during the component's life
42798 // --------------------
42799 model: opts.model,
42800 app: opts.app,
42801 global: qGlobal,
42802 selections: opts.selections,
42803 nebbie: opts.nebbie,
42804 element: undefined,
42805 // set on mount
42806 // ---- singletons ----
42807 deviceType: galaxy.deviceType,
42808 theme: undefined,
42809 translator: galaxy.translator,
42810 // --- dynamic values ---
42811 layout: {},
42812 appLayout: {},
42813 keyboardNavigation: opts.keyboardNavigation,
42814 focusHandler: opts.focusHandler,
42815 constraints: forcedConstraints,
42816 options: {},
42817 plugins: []
42818 },
42819 fn: generator.component.fn,
42820
42821 created() {},
42822
42823 mounted(element) {
42824 this.context.element = element;
42825 generator.component.initiate(c, {
42826 explicitResize: !!opts.explicitResize
42827 });
42828 },
42829
42830 render(r) {
42831 let changed = !hasRun || false;
42832
42833 if (r) {
42834 if (r.layout && r.layout !== this.context.layout) {
42835 changed = true;
42836 this.context.layout = r.layout;
42837 }
42838
42839 if (r.context && r.context.theme) {
42840 // changed is set further down only if the name is different
42841 this.context.theme = r.context.theme;
42842 } // false equals undefined, so we to cast to bool here
42843
42844
42845 if (r.context && !!r.context.keyboardNavigation !== !!this.context.keyboardNavigation) {
42846 this.context.keyboardNavigation = !!r.context.keyboardNavigation;
42847 changed = true;
42848 }
42849
42850 if (r.context && r.context.focusHandler) {
42851 // Needs to be added here due to how the client renders
42852 this.context.focusHandler = r.context.focusHandler;
42853 }
42854
42855 if (r.options) {
42856 // options could contain anything including methods, classes, cyclical references
42857 // so we can't use JSON parse for comparison.
42858 // but we can do a shallow reference check on the first level to check if
42859 // options have changed. if it has changed then create a new reference for
42860 // the options object to ensure callbacks are triggered
42861 const op = {};
42862 let opChanged = false;
42863 Object.keys(r.options).forEach(key => {
42864 op[key] = r.options[key];
42865
42866 if (this.context.options[key] !== r.options[key]) {
42867 opChanged = true;
42868 }
42869 });
42870
42871 if (opChanged) {
42872 this.context.options = op;
42873 changed = true;
42874 }
42875 }
42876
42877 if (r.plugins) {
42878 let pluginsChanged = this.context.plugins.length !== r.plugins.length;
42879 r.plugins.forEach((plugin, index) => {
42880 if (this.context.plugins[index] !== plugin) {
42881 pluginsChanged = true;
42882 }
42883 });
42884
42885 if (pluginsChanged) {
42886 this.context.plugins = [...r.plugins];
42887 changed = true;
42888 }
42889 } // do a deep check on 'small' objects
42890
42891
42892 deepCheck.forEach(key => {
42893 const ref = r.context;
42894
42895 if (ref && Object.prototype.hasOwnProperty.call(ref, key)) {
42896 let s = JSON.stringify(ref[key]);
42897
42898 if (key === 'constraints') {
42899 s = JSON.stringify(_objectSpread2(_objectSpread2({}, ref[key]), forcedConstraints));
42900 }
42901
42902 if (s !== current[key]) {
42903 changed = true;
42904 current[key] = s; // create new object reference to ensure useEffect/useMemo/useCallback
42905 // is triggered if the object is used a dependency
42906
42907 this.context[key] = JSON.parse(s);
42908 }
42909 }
42910 });
42911 } else {
42912 changed = true;
42913 } // theme and translator are singletons so their reference won't change, we do
42914 // however need to observe if their internal content has changed (name, language) and
42915 // trigger an update if they have
42916
42917
42918 if (this.context.theme && this.context.theme.name() !== current.themeName) {
42919 changed = true;
42920 current.themeName = this.context.theme.name();
42921 }
42922
42923 if (this.context.translator.language() !== current.language) {
42924 changed = true;
42925 current.language = c.context.translator.language();
42926 } // TODO - observe what hooks are used, and only trigger run if values associated
42927 // with those hooks have changed, i.e. if layout has changed but useLayout() isn't called
42928 // then there is no need to call run
42929
42930
42931 if (changed) {
42932 hasRun = true;
42933 this.currentResult = generator.component.run(this);
42934 return this.currentResult;
42935 }
42936
42937 return this.currentResult || Promise.resolve();
42938 },
42939
42940 resize() {
42941 // resize should never really by necesseary since the ResizeObserver
42942 // in useRect observes changes on the size of the object, the only time it might
42943 // be necessary is on IE 11 when the object is resized without the window changing size
42944 generator.component.updateRectOnNextRun(this);
42945 return this.render();
42946 },
42947
42948 willUnmount() {
42949 generator.component.teardown(this);
42950 },
42951
42952 setSnapshotData(layout) {
42953 return generator.component.runSnaps(this, layout);
42954 },
42955
42956 focus() {
42957 generator.component.focus(this);
42958 },
42959
42960 blur() {
42961 generator.component.blur(this);
42962 },
42963
42964 getImperativeHandle() {
42965 return generator.component.getImperativeHandle(this);
42966 },
42967
42968 destroy() {},
42969
42970 observeActions(callback) {
42971 generator.component.observeActions(this, callback);
42972 },
42973
42974 isHooked: true
42975 };
42976 deepCheck.forEach(key => {
42977 current[key] = JSON.stringify(c.context[key]);
42978 });
42979 current.themeName = c.context.theme ? c.context.theme.name() : undefined;
42980 current.language = c.context.translator ? c.context.translator.language() : undefined;
42981 Object.assign(c, {
42982 selections: opts.selections
42983 });
42984 return [c, null];
42985 }
42986
42987 function createClassical(generator, opts) {
42988 {
42989 // eslint-disable-next-line no-console
42990 console.warn('Obsolete API - time to get hooked!');
42991 }
42992
42993 const componentInstance = _objectSpread2({}, defaultComponent);
42994
42995 mixin(componentInstance);
42996 const userInstance = {
42997 emit() {
42998 componentInstance.emit(...arguments);
42999 }
43000
43001 };
43002 Object.keys(generator.component || {}).forEach(key => {
43003 if (reservedKeys.indexOf(key) !== -1) {
43004 componentInstance[key] = generator.component[key].bind(userInstance);
43005 } else {
43006 userInstance[key] = generator.component[key];
43007 }
43008 });
43009 const hero = actionhero({
43010 sn: generator,
43011 component: userInstance
43012 });
43013 const qGlobal = opts.app && opts.app.session ? opts.app.session.getObjectApi({
43014 handle: -1
43015 }) : null;
43016 Object.assign(userInstance, {
43017 model: opts.model,
43018 app: opts.app,
43019 global: qGlobal,
43020 selections: opts.selections,
43021 actions: hero.actions
43022 });
43023 Object.assign(componentInstance, {
43024 actions: hero.actions,
43025 model: opts.model,
43026 app: opts.app,
43027 selections: opts.selections
43028 });
43029 return [componentInstance, hero];
43030 }
43031
43032 function create$2(generator, opts, galaxy) {
43033 if (typeof generator.component === 'function') {
43034 generator.component = hook(generator.component);
43035 }
43036
43037 const [componentInstance, hero] = generator.component && generator.component.__hooked ? createWithHooks(generator, opts, galaxy) : createClassical(generator, opts);
43038 const teardowns = [];
43039
43040 if (opts.model.__snInterceptor) {
43041 // remove old hook - happens only when proper cleanup hasn't been done
43042 opts.model.__snInterceptor.teardown();
43043 }
43044
43045 if (generator.qae.properties.onChange) {
43046 // TODO - handle multiple sn
43047 // TODO - check privileges
43048 opts.model.__snInterceptor = {
43049 setProperties: opts.model.setProperties,
43050 applyPatches: opts.model.applyPatches,
43051 teardown: undefined
43052 };
43053
43054 opts.model.setProperties = function setProperties() {
43055 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43056 args[_key] = arguments[_key];
43057 }
43058
43059 generator.qae.properties.onChange.call({
43060 model: opts.model
43061 }, ...args);
43062 return opts.model.__snInterceptor.setProperties.call(this, ...args);
43063 };
43064
43065 opts.model.applyPatches = function applyPatches(qPatches, qSoftPatch) {
43066 const method = qSoftPatch ? 'getEffectiveProperties' : 'getProperties';
43067 return opts.model[method]().then(currentProperties => {
43068 // apply patches to current props
43069 const original = JSONPatch.clone(currentProperties);
43070 const patches = qPatches.map(p => ({
43071 op: p.qOp,
43072 value: JSON.parse(p.qValue),
43073 path: p.qPath
43074 }));
43075 JSONPatch.apply(currentProperties, patches);
43076 generator.qae.properties.onChange.call({
43077 model: opts.model
43078 }, currentProperties); // calculate new patches from after change
43079
43080 const newPatches = JSONPatch.generate(original, currentProperties).map(p => ({
43081 qOp: p.op,
43082 qValue: JSON.stringify(p.value),
43083 qPath: p.path
43084 }));
43085 return opts.model.__snInterceptor.applyPatches.call(this, newPatches, qSoftPatch);
43086 });
43087 };
43088
43089 opts.model.__snInterceptor.teardown = () => {
43090 opts.model.setProperties = opts.model.__snInterceptor.setProperties;
43091 delete opts.model.__snInterceptor;
43092 };
43093
43094 teardowns.push(opts.model.__snInterceptor.teardown);
43095 }
43096
43097 return {
43098 generator,
43099 component: componentInstance,
43100 selectionToolbar: {
43101 items: hero ? hero.selectionToolbarItems : []
43102 },
43103
43104 destroy() {
43105 teardowns.forEach(t => t());
43106 },
43107
43108 logicalSize: generator.definition.logicalSize || (() => false)
43109 };
43110 }
43111
43112 const noop = () => {};
43113 /**
43114 * @function importProperties
43115 * @description Imports properties for a chart with a hypercube.
43116 * @since 1.1.0
43117 * @param {Object} args
43118 * @param {ExportFormat} args.exportFormat The export object which is the output of exportProperties.
43119 * @param {Object=} args.initialProperties Initial properties of the target chart.
43120 * @param {Object=} args.dataDefinition Data definition of the target chart.
43121 * @param {Object=} args.defaultPropertyValues Default values for a number of properties of the target chart.
43122 * @param {string} args.hypercubePath Reference to the qHyperCubeDef.
43123 * @returns {Object} A properties tree
43124 */
43125
43126 /**
43127 * @function exportProperties
43128 * @description Exports properties for a chart with a hypercube.
43129 * @since 1.1.0
43130 * @param {Object} args
43131 * @param {Object} args.propertyTree
43132 * @param {string} args.hypercubePath Reference to the qHyperCubeDef.
43133 * @returns {ExportFormat}
43134 */
43135
43136 /**
43137 * @interface QAEDefinition
43138 * @property {EngineAPI.IGenericObjectProperties=} properties
43139 * @property {object=} data
43140 * @property {DataTarget[]} data.targets
43141 * @property {importProperties=} importProperties
43142 * @property {exportProperties=} exportProperties
43143 */
43144
43145 /**
43146 * @interface DataTarget
43147 * @property {string} path
43148 * @property {FieldTarget<EngineAPI.INxDimension>=} dimensions
43149 * @property {FieldTarget<EngineAPI.INxMeasure>=} measures
43150 */
43151
43152 /**
43153 * @callback fieldTargetAddedCallback
43154 * @template T
43155 * @param {T} field
43156 * @param {EngineAPI.IGenericObjectProperties} properties
43157 */
43158
43159 /**
43160 * @callback fieldTargetRemovedCallback
43161 * @template T
43162 * @param {T} field
43163 * @param {EngineAPI.IGenericObjectProperties} properties
43164 * @param {number} index
43165 */
43166
43167 /**
43168 * @interface FieldTarget
43169 * @template T
43170 * @property {function():number} [min]
43171 * @property {function():number} [max]
43172 * @property {fieldTargetAddedCallback<T>} [added]
43173 * @property {fieldTargetRemovedCallback<T>} [removed]
43174 */
43175
43176
43177 function fallback(x, value) {
43178 if (typeof x === 'undefined') {
43179 return () => value;
43180 }
43181
43182 return () => x;
43183 }
43184
43185 function defFn(input) {
43186 const def = input || {};
43187 return {
43188 min: typeof def.min === 'function' ? def.min : fallback(def.min, 0),
43189 max: typeof def.max === 'function' ? def.max : fallback(def.max, 1000),
43190 added: def.added || def.add || noop,
43191 // TODO - deprecate add in favour of added
43192 description: def.description || noop,
43193 moved: def.moved || def.move || noop,
43194 removed: def.removed || def.remove || noop,
43195 replaced: def.replaced || def.replace || noop,
43196 isDefined: () => !!input
43197 };
43198 }
43199
43200 const resolveValue = (data, reference, defaultValue) => {
43201 const steps = reference.split('/');
43202 let dataContainer = data;
43203
43204 if (dataContainer === undefined) {
43205 return defaultValue;
43206 }
43207
43208 for (let i = 0; i < steps.length; ++i) {
43209 if (steps[i] === '') {
43210 continue; // eslint-disable-line no-continue
43211 }
43212
43213 if (typeof dataContainer[steps[i]] === 'undefined') {
43214 return defaultValue;
43215 }
43216
43217 dataContainer = dataContainer[steps[i]];
43218 }
43219
43220 return dataContainer;
43221 };
43222
43223 function target(def) {
43224 const propertyPath = def.path || '/qHyperCubeDef';
43225 const layoutPath = propertyPath.slice(0, -3);
43226
43227 if (/\/(qHyperCube|qListObject)$/.test(layoutPath) === false) {
43228 const d = layoutPath.includes('/qHyperCube') ? 'qHyperCubeDef' : 'qListObjectDef';
43229 throw new Error("Incorrect definition for ".concat(d, " at ").concat(propertyPath, ". Valid paths include /qHyperCubeDef or /qListObjectDef, e.g. data/qHyperCubeDef"));
43230 }
43231
43232 return {
43233 propertyPath,
43234 layoutPath,
43235 resolveLayout: layout => resolveValue(layout, layoutPath, {}),
43236 dimensions: defFn(def.dimensions),
43237 measures: defFn(def.measures)
43238 };
43239 }
43240
43241 function qae() {
43242 let def = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
43243 let initial = def.properties || {};
43244 let onChange;
43245
43246 if (def.properties && (def.properties.initial || def.properties.onChange)) {
43247 initial = def.properties.initial;
43248 onChange = def.properties.onChange;
43249 }
43250
43251 const q = {
43252 properties: {
43253 initial,
43254 onChange
43255 },
43256 data: {
43257 targets: ((def.data || {}).targets || []).map(target)
43258 },
43259 exportProperties: def.exportProperties,
43260 importProperties: def.importProperties
43261 };
43262 return q;
43263 }
43264
43265 /**
43266 * The entry point for defining a visualization.
43267 * @interface Visualization
43268 * @param {Galaxy} galaxy
43269 * @returns {VisualizationDefinition}
43270 * @example
43271 * import { useElement, useLayout } from '@nebula.js/stardust';
43272 *
43273 * export default function() {
43274 * return {
43275 * qae: {
43276 * properties: {
43277 * dude: 'Heisenberg',
43278 * }
43279 * },
43280 * component() {
43281 * const el = useElement();
43282 * const layout = useLayout();
43283 * el.innerHTML = `What's my name? ${layout.dude}!!!`;
43284 * }
43285 * };
43286 * }
43287 */
43288
43289 /**
43290 * @interface VisualizationDefinition
43291 * @property {QAEDefinition} qae
43292 * @property {function():void} component
43293 */
43294
43295 /**
43296 * @interface snGenerator
43297 * @param {Visualization} Sn
43298 * @param {Galaxy} galaxy
43299 * @returns {generator}
43300 * @private
43301 */
43302
43303 function generatorFn(UserSN, galaxy) {
43304 let sn; // TODO validate galaxy API
43305
43306 if (typeof UserSN === 'function') {
43307 sn = UserSN(galaxy);
43308 } else {
43309 sn = UserSN;
43310 }
43311 /**
43312 * @alias generator
43313 * @private
43314 */
43315
43316
43317 const generator =
43318 /** @lends generator */
43319 {
43320 /**
43321 * @type {QAE}
43322 */
43323 qae: qae(sn.qae),
43324
43325 /**
43326 * @type {SnComponent}
43327 */
43328 component: sn.component || {},
43329
43330 /**
43331 * @param {object} p
43332 * @param {EnigmaAppModel} p.app
43333 * @param {EnigmaObjectModel} p.model
43334 * @param {ObjectSelections} p.selections
43335 */
43336 create(params) {
43337 const ss = create$2(generator, params, galaxy);
43338 return ss;
43339 },
43340
43341 definition: {}
43342 };
43343 Object.keys(sn).forEach(key => {
43344 if (!generator[key]) {
43345 generator.definition[key] = sn[key];
43346 }
43347 });
43348 return generator;
43349 }
43350
43351 var semver = {exports: {}};
43352
43353 (function (module, exports) {
43354 exports = module.exports = SemVer;
43355
43356 var debug;
43357 /* istanbul ignore next */
43358 if (typeof process === 'object' &&
43359 process.env &&
43360 process.env.NODE_DEBUG &&
43361 /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
43362 debug = function () {
43363 var args = Array.prototype.slice.call(arguments, 0);
43364 args.unshift('SEMVER');
43365 console.log.apply(console, args);
43366 };
43367 } else {
43368 debug = function () {};
43369 }
43370
43371 // Note: this is the semver.org version of the spec that it implements
43372 // Not necessarily the package version of this code.
43373 exports.SEMVER_SPEC_VERSION = '2.0.0';
43374
43375 var MAX_LENGTH = 256;
43376 var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
43377 /* istanbul ignore next */ 9007199254740991;
43378
43379 // Max safe segment length for coercion.
43380 var MAX_SAFE_COMPONENT_LENGTH = 16;
43381
43382 // The actual regexps go on exports.re
43383 var re = exports.re = [];
43384 var src = exports.src = [];
43385 var t = exports.tokens = {};
43386 var R = 0;
43387
43388 function tok (n) {
43389 t[n] = R++;
43390 }
43391
43392 // The following Regular Expressions can be used for tokenizing,
43393 // validating, and parsing SemVer version strings.
43394
43395 // ## Numeric Identifier
43396 // A single `0`, or a non-zero digit followed by zero or more digits.
43397
43398 tok('NUMERICIDENTIFIER');
43399 src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*';
43400 tok('NUMERICIDENTIFIERLOOSE');
43401 src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+';
43402
43403 // ## Non-numeric Identifier
43404 // Zero or more digits, followed by a letter or hyphen, and then zero or
43405 // more letters, digits, or hyphens.
43406
43407 tok('NONNUMERICIDENTIFIER');
43408 src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
43409
43410 // ## Main Version
43411 // Three dot-separated numeric identifiers.
43412
43413 tok('MAINVERSION');
43414 src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
43415 '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
43416 '(' + src[t.NUMERICIDENTIFIER] + ')';
43417
43418 tok('MAINVERSIONLOOSE');
43419 src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
43420 '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
43421 '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')';
43422
43423 // ## Pre-release Version Identifier
43424 // A numeric identifier, or a non-numeric identifier.
43425
43426 tok('PRERELEASEIDENTIFIER');
43427 src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +
43428 '|' + src[t.NONNUMERICIDENTIFIER] + ')';
43429
43430 tok('PRERELEASEIDENTIFIERLOOSE');
43431 src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +
43432 '|' + src[t.NONNUMERICIDENTIFIER] + ')';
43433
43434 // ## Pre-release Version
43435 // Hyphen, followed by one or more dot-separated pre-release version
43436 // identifiers.
43437
43438 tok('PRERELEASE');
43439 src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +
43440 '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))';
43441
43442 tok('PRERELEASELOOSE');
43443 src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
43444 '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))';
43445
43446 // ## Build Metadata Identifier
43447 // Any combination of digits, letters, or hyphens.
43448
43449 tok('BUILDIDENTIFIER');
43450 src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
43451
43452 // ## Build Metadata
43453 // Plus sign, followed by one or more period-separated build metadata
43454 // identifiers.
43455
43456 tok('BUILD');
43457 src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] +
43458 '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))';
43459
43460 // ## Full Version String
43461 // A main version, followed optionally by a pre-release version and
43462 // build metadata.
43463
43464 // Note that the only major, minor, patch, and pre-release sections of
43465 // the version string are capturing groups. The build metadata is not a
43466 // capturing group, because it should not ever be used in version
43467 // comparison.
43468
43469 tok('FULL');
43470 tok('FULLPLAIN');
43471 src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +
43472 src[t.PRERELEASE] + '?' +
43473 src[t.BUILD] + '?';
43474
43475 src[t.FULL] = '^' + src[t.FULLPLAIN] + '$';
43476
43477 // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
43478 // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
43479 // common in the npm registry.
43480 tok('LOOSEPLAIN');
43481 src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] +
43482 src[t.PRERELEASELOOSE] + '?' +
43483 src[t.BUILD] + '?';
43484
43485 tok('LOOSE');
43486 src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$';
43487
43488 tok('GTLT');
43489 src[t.GTLT] = '((?:<|>)?=?)';
43490
43491 // Something like "2.*" or "1.2.x".
43492 // Note that "x.x" is a valid xRange identifer, meaning "any version"
43493 // Only the first item is strictly required.
43494 tok('XRANGEIDENTIFIERLOOSE');
43495 src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
43496 tok('XRANGEIDENTIFIER');
43497 src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*';
43498
43499 tok('XRANGEPLAIN');
43500 src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +
43501 '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
43502 '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
43503 '(?:' + src[t.PRERELEASE] + ')?' +
43504 src[t.BUILD] + '?' +
43505 ')?)?';
43506
43507 tok('XRANGEPLAINLOOSE');
43508 src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
43509 '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
43510 '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
43511 '(?:' + src[t.PRERELEASELOOSE] + ')?' +
43512 src[t.BUILD] + '?' +
43513 ')?)?';
43514
43515 tok('XRANGE');
43516 src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$';
43517 tok('XRANGELOOSE');
43518 src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$';
43519
43520 // Coercion.
43521 // Extract anything that could conceivably be a part of a valid semver
43522 tok('COERCE');
43523 src[t.COERCE] = '(^|[^\\d])' +
43524 '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
43525 '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
43526 '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
43527 '(?:$|[^\\d])';
43528 tok('COERCERTL');
43529 re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g');
43530
43531 // Tilde ranges.
43532 // Meaning is "reasonably at or greater than"
43533 tok('LONETILDE');
43534 src[t.LONETILDE] = '(?:~>?)';
43535
43536 tok('TILDETRIM');
43537 src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+';
43538 re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g');
43539 var tildeTrimReplace = '$1~';
43540
43541 tok('TILDE');
43542 src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$';
43543 tok('TILDELOOSE');
43544 src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$';
43545
43546 // Caret ranges.
43547 // Meaning is "at least and backwards compatible with"
43548 tok('LONECARET');
43549 src[t.LONECARET] = '(?:\\^)';
43550
43551 tok('CARETTRIM');
43552 src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+';
43553 re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g');
43554 var caretTrimReplace = '$1^';
43555
43556 tok('CARET');
43557 src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$';
43558 tok('CARETLOOSE');
43559 src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$';
43560
43561 // A simple gt/lt/eq thing, or just "" to indicate "any version"
43562 tok('COMPARATORLOOSE');
43563 src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$';
43564 tok('COMPARATOR');
43565 src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$';
43566
43567 // An expression to strip any whitespace between the gtlt and the thing
43568 // it modifies, so that `> 1.2.3` ==> `>1.2.3`
43569 tok('COMPARATORTRIM');
43570 src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
43571 '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')';
43572
43573 // this one has to use the /g flag
43574 re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g');
43575 var comparatorTrimReplace = '$1$2$3';
43576
43577 // Something like `1.2.3 - 1.2.4`
43578 // Note that these all use the loose form, because they'll be
43579 // checked against either the strict or loose comparator form
43580 // later.
43581 tok('HYPHENRANGE');
43582 src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' +
43583 '\\s+-\\s+' +
43584 '(' + src[t.XRANGEPLAIN] + ')' +
43585 '\\s*$';
43586
43587 tok('HYPHENRANGELOOSE');
43588 src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +
43589 '\\s+-\\s+' +
43590 '(' + src[t.XRANGEPLAINLOOSE] + ')' +
43591 '\\s*$';
43592
43593 // Star ranges basically just allow anything at all.
43594 tok('STAR');
43595 src[t.STAR] = '(<|>)?=?\\s*\\*';
43596
43597 // Compile to actual regexp objects.
43598 // All are flag-free, unless they were created above with a flag.
43599 for (var i = 0; i < R; i++) {
43600 debug(i, src[i]);
43601 if (!re[i]) {
43602 re[i] = new RegExp(src[i]);
43603 }
43604 }
43605
43606 exports.parse = parse;
43607 function parse (version, options) {
43608 if (!options || typeof options !== 'object') {
43609 options = {
43610 loose: !!options,
43611 includePrerelease: false
43612 };
43613 }
43614
43615 if (version instanceof SemVer) {
43616 return version
43617 }
43618
43619 if (typeof version !== 'string') {
43620 return null
43621 }
43622
43623 if (version.length > MAX_LENGTH) {
43624 return null
43625 }
43626
43627 var r = options.loose ? re[t.LOOSE] : re[t.FULL];
43628 if (!r.test(version)) {
43629 return null
43630 }
43631
43632 try {
43633 return new SemVer(version, options)
43634 } catch (er) {
43635 return null
43636 }
43637 }
43638
43639 exports.valid = valid;
43640 function valid (version, options) {
43641 var v = parse(version, options);
43642 return v ? v.version : null
43643 }
43644
43645 exports.clean = clean;
43646 function clean (version, options) {
43647 var s = parse(version.trim().replace(/^[=v]+/, ''), options);
43648 return s ? s.version : null
43649 }
43650
43651 exports.SemVer = SemVer;
43652
43653 function SemVer (version, options) {
43654 if (!options || typeof options !== 'object') {
43655 options = {
43656 loose: !!options,
43657 includePrerelease: false
43658 };
43659 }
43660 if (version instanceof SemVer) {
43661 if (version.loose === options.loose) {
43662 return version
43663 } else {
43664 version = version.version;
43665 }
43666 } else if (typeof version !== 'string') {
43667 throw new TypeError('Invalid Version: ' + version)
43668 }
43669
43670 if (version.length > MAX_LENGTH) {
43671 throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
43672 }
43673
43674 if (!(this instanceof SemVer)) {
43675 return new SemVer(version, options)
43676 }
43677
43678 debug('SemVer', version, options);
43679 this.options = options;
43680 this.loose = !!options.loose;
43681
43682 var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
43683
43684 if (!m) {
43685 throw new TypeError('Invalid Version: ' + version)
43686 }
43687
43688 this.raw = version;
43689
43690 // these are actually numbers
43691 this.major = +m[1];
43692 this.minor = +m[2];
43693 this.patch = +m[3];
43694
43695 if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
43696 throw new TypeError('Invalid major version')
43697 }
43698
43699 if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
43700 throw new TypeError('Invalid minor version')
43701 }
43702
43703 if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
43704 throw new TypeError('Invalid patch version')
43705 }
43706
43707 // numberify any prerelease numeric ids
43708 if (!m[4]) {
43709 this.prerelease = [];
43710 } else {
43711 this.prerelease = m[4].split('.').map(function (id) {
43712 if (/^[0-9]+$/.test(id)) {
43713 var num = +id;
43714 if (num >= 0 && num < MAX_SAFE_INTEGER) {
43715 return num
43716 }
43717 }
43718 return id
43719 });
43720 }
43721
43722 this.build = m[5] ? m[5].split('.') : [];
43723 this.format();
43724 }
43725
43726 SemVer.prototype.format = function () {
43727 this.version = this.major + '.' + this.minor + '.' + this.patch;
43728 if (this.prerelease.length) {
43729 this.version += '-' + this.prerelease.join('.');
43730 }
43731 return this.version
43732 };
43733
43734 SemVer.prototype.toString = function () {
43735 return this.version
43736 };
43737
43738 SemVer.prototype.compare = function (other) {
43739 debug('SemVer.compare', this.version, this.options, other);
43740 if (!(other instanceof SemVer)) {
43741 other = new SemVer(other, this.options);
43742 }
43743
43744 return this.compareMain(other) || this.comparePre(other)
43745 };
43746
43747 SemVer.prototype.compareMain = function (other) {
43748 if (!(other instanceof SemVer)) {
43749 other = new SemVer(other, this.options);
43750 }
43751
43752 return compareIdentifiers(this.major, other.major) ||
43753 compareIdentifiers(this.minor, other.minor) ||
43754 compareIdentifiers(this.patch, other.patch)
43755 };
43756
43757 SemVer.prototype.comparePre = function (other) {
43758 if (!(other instanceof SemVer)) {
43759 other = new SemVer(other, this.options);
43760 }
43761
43762 // NOT having a prerelease is > having one
43763 if (this.prerelease.length && !other.prerelease.length) {
43764 return -1
43765 } else if (!this.prerelease.length && other.prerelease.length) {
43766 return 1
43767 } else if (!this.prerelease.length && !other.prerelease.length) {
43768 return 0
43769 }
43770
43771 var i = 0;
43772 do {
43773 var a = this.prerelease[i];
43774 var b = other.prerelease[i];
43775 debug('prerelease compare', i, a, b);
43776 if (a === undefined && b === undefined) {
43777 return 0
43778 } else if (b === undefined) {
43779 return 1
43780 } else if (a === undefined) {
43781 return -1
43782 } else if (a === b) {
43783 continue
43784 } else {
43785 return compareIdentifiers(a, b)
43786 }
43787 } while (++i)
43788 };
43789
43790 SemVer.prototype.compareBuild = function (other) {
43791 if (!(other instanceof SemVer)) {
43792 other = new SemVer(other, this.options);
43793 }
43794
43795 var i = 0;
43796 do {
43797 var a = this.build[i];
43798 var b = other.build[i];
43799 debug('prerelease compare', i, a, b);
43800 if (a === undefined && b === undefined) {
43801 return 0
43802 } else if (b === undefined) {
43803 return 1
43804 } else if (a === undefined) {
43805 return -1
43806 } else if (a === b) {
43807 continue
43808 } else {
43809 return compareIdentifiers(a, b)
43810 }
43811 } while (++i)
43812 };
43813
43814 // preminor will bump the version up to the next minor release, and immediately
43815 // down to pre-release. premajor and prepatch work the same way.
43816 SemVer.prototype.inc = function (release, identifier) {
43817 switch (release) {
43818 case 'premajor':
43819 this.prerelease.length = 0;
43820 this.patch = 0;
43821 this.minor = 0;
43822 this.major++;
43823 this.inc('pre', identifier);
43824 break
43825 case 'preminor':
43826 this.prerelease.length = 0;
43827 this.patch = 0;
43828 this.minor++;
43829 this.inc('pre', identifier);
43830 break
43831 case 'prepatch':
43832 // If this is already a prerelease, it will bump to the next version
43833 // drop any prereleases that might already exist, since they are not
43834 // relevant at this point.
43835 this.prerelease.length = 0;
43836 this.inc('patch', identifier);
43837 this.inc('pre', identifier);
43838 break
43839 // If the input is a non-prerelease version, this acts the same as
43840 // prepatch.
43841 case 'prerelease':
43842 if (this.prerelease.length === 0) {
43843 this.inc('patch', identifier);
43844 }
43845 this.inc('pre', identifier);
43846 break
43847
43848 case 'major':
43849 // If this is a pre-major version, bump up to the same major version.
43850 // Otherwise increment major.
43851 // 1.0.0-5 bumps to 1.0.0
43852 // 1.1.0 bumps to 2.0.0
43853 if (this.minor !== 0 ||
43854 this.patch !== 0 ||
43855 this.prerelease.length === 0) {
43856 this.major++;
43857 }
43858 this.minor = 0;
43859 this.patch = 0;
43860 this.prerelease = [];
43861 break
43862 case 'minor':
43863 // If this is a pre-minor version, bump up to the same minor version.
43864 // Otherwise increment minor.
43865 // 1.2.0-5 bumps to 1.2.0
43866 // 1.2.1 bumps to 1.3.0
43867 if (this.patch !== 0 || this.prerelease.length === 0) {
43868 this.minor++;
43869 }
43870 this.patch = 0;
43871 this.prerelease = [];
43872 break
43873 case 'patch':
43874 // If this is not a pre-release version, it will increment the patch.
43875 // If it is a pre-release it will bump up to the same patch version.
43876 // 1.2.0-5 patches to 1.2.0
43877 // 1.2.0 patches to 1.2.1
43878 if (this.prerelease.length === 0) {
43879 this.patch++;
43880 }
43881 this.prerelease = [];
43882 break
43883 // This probably shouldn't be used publicly.
43884 // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
43885 case 'pre':
43886 if (this.prerelease.length === 0) {
43887 this.prerelease = [0];
43888 } else {
43889 var i = this.prerelease.length;
43890 while (--i >= 0) {
43891 if (typeof this.prerelease[i] === 'number') {
43892 this.prerelease[i]++;
43893 i = -2;
43894 }
43895 }
43896 if (i === -1) {
43897 // didn't increment anything
43898 this.prerelease.push(0);
43899 }
43900 }
43901 if (identifier) {
43902 // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
43903 // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
43904 if (this.prerelease[0] === identifier) {
43905 if (isNaN(this.prerelease[1])) {
43906 this.prerelease = [identifier, 0];
43907 }
43908 } else {
43909 this.prerelease = [identifier, 0];
43910 }
43911 }
43912 break
43913
43914 default:
43915 throw new Error('invalid increment argument: ' + release)
43916 }
43917 this.format();
43918 this.raw = this.version;
43919 return this
43920 };
43921
43922 exports.inc = inc;
43923 function inc (version, release, loose, identifier) {
43924 if (typeof (loose) === 'string') {
43925 identifier = loose;
43926 loose = undefined;
43927 }
43928
43929 try {
43930 return new SemVer(version, loose).inc(release, identifier).version
43931 } catch (er) {
43932 return null
43933 }
43934 }
43935
43936 exports.diff = diff;
43937 function diff (version1, version2) {
43938 if (eq(version1, version2)) {
43939 return null
43940 } else {
43941 var v1 = parse(version1);
43942 var v2 = parse(version2);
43943 var prefix = '';
43944 if (v1.prerelease.length || v2.prerelease.length) {
43945 prefix = 'pre';
43946 var defaultResult = 'prerelease';
43947 }
43948 for (var key in v1) {
43949 if (key === 'major' || key === 'minor' || key === 'patch') {
43950 if (v1[key] !== v2[key]) {
43951 return prefix + key
43952 }
43953 }
43954 }
43955 return defaultResult // may be undefined
43956 }
43957 }
43958
43959 exports.compareIdentifiers = compareIdentifiers;
43960
43961 var numeric = /^[0-9]+$/;
43962 function compareIdentifiers (a, b) {
43963 var anum = numeric.test(a);
43964 var bnum = numeric.test(b);
43965
43966 if (anum && bnum) {
43967 a = +a;
43968 b = +b;
43969 }
43970
43971 return a === b ? 0
43972 : (anum && !bnum) ? -1
43973 : (bnum && !anum) ? 1
43974 : a < b ? -1
43975 : 1
43976 }
43977
43978 exports.rcompareIdentifiers = rcompareIdentifiers;
43979 function rcompareIdentifiers (a, b) {
43980 return compareIdentifiers(b, a)
43981 }
43982
43983 exports.major = major;
43984 function major (a, loose) {
43985 return new SemVer(a, loose).major
43986 }
43987
43988 exports.minor = minor;
43989 function minor (a, loose) {
43990 return new SemVer(a, loose).minor
43991 }
43992
43993 exports.patch = patch;
43994 function patch (a, loose) {
43995 return new SemVer(a, loose).patch
43996 }
43997
43998 exports.compare = compare;
43999 function compare (a, b, loose) {
44000 return new SemVer(a, loose).compare(new SemVer(b, loose))
44001 }
44002
44003 exports.compareLoose = compareLoose;
44004 function compareLoose (a, b) {
44005 return compare(a, b, true)
44006 }
44007
44008 exports.compareBuild = compareBuild;
44009 function compareBuild (a, b, loose) {
44010 var versionA = new SemVer(a, loose);
44011 var versionB = new SemVer(b, loose);
44012 return versionA.compare(versionB) || versionA.compareBuild(versionB)
44013 }
44014
44015 exports.rcompare = rcompare;
44016 function rcompare (a, b, loose) {
44017 return compare(b, a, loose)
44018 }
44019
44020 exports.sort = sort;
44021 function sort (list, loose) {
44022 return list.sort(function (a, b) {
44023 return exports.compareBuild(a, b, loose)
44024 })
44025 }
44026
44027 exports.rsort = rsort;
44028 function rsort (list, loose) {
44029 return list.sort(function (a, b) {
44030 return exports.compareBuild(b, a, loose)
44031 })
44032 }
44033
44034 exports.gt = gt;
44035 function gt (a, b, loose) {
44036 return compare(a, b, loose) > 0
44037 }
44038
44039 exports.lt = lt;
44040 function lt (a, b, loose) {
44041 return compare(a, b, loose) < 0
44042 }
44043
44044 exports.eq = eq;
44045 function eq (a, b, loose) {
44046 return compare(a, b, loose) === 0
44047 }
44048
44049 exports.neq = neq;
44050 function neq (a, b, loose) {
44051 return compare(a, b, loose) !== 0
44052 }
44053
44054 exports.gte = gte;
44055 function gte (a, b, loose) {
44056 return compare(a, b, loose) >= 0
44057 }
44058
44059 exports.lte = lte;
44060 function lte (a, b, loose) {
44061 return compare(a, b, loose) <= 0
44062 }
44063
44064 exports.cmp = cmp;
44065 function cmp (a, op, b, loose) {
44066 switch (op) {
44067 case '===':
44068 if (typeof a === 'object')
44069 a = a.version;
44070 if (typeof b === 'object')
44071 b = b.version;
44072 return a === b
44073
44074 case '!==':
44075 if (typeof a === 'object')
44076 a = a.version;
44077 if (typeof b === 'object')
44078 b = b.version;
44079 return a !== b
44080
44081 case '':
44082 case '=':
44083 case '==':
44084 return eq(a, b, loose)
44085
44086 case '!=':
44087 return neq(a, b, loose)
44088
44089 case '>':
44090 return gt(a, b, loose)
44091
44092 case '>=':
44093 return gte(a, b, loose)
44094
44095 case '<':
44096 return lt(a, b, loose)
44097
44098 case '<=':
44099 return lte(a, b, loose)
44100
44101 default:
44102 throw new TypeError('Invalid operator: ' + op)
44103 }
44104 }
44105
44106 exports.Comparator = Comparator;
44107 function Comparator (comp, options) {
44108 if (!options || typeof options !== 'object') {
44109 options = {
44110 loose: !!options,
44111 includePrerelease: false
44112 };
44113 }
44114
44115 if (comp instanceof Comparator) {
44116 if (comp.loose === !!options.loose) {
44117 return comp
44118 } else {
44119 comp = comp.value;
44120 }
44121 }
44122
44123 if (!(this instanceof Comparator)) {
44124 return new Comparator(comp, options)
44125 }
44126
44127 debug('comparator', comp, options);
44128 this.options = options;
44129 this.loose = !!options.loose;
44130 this.parse(comp);
44131
44132 if (this.semver === ANY) {
44133 this.value = '';
44134 } else {
44135 this.value = this.operator + this.semver.version;
44136 }
44137
44138 debug('comp', this);
44139 }
44140
44141 var ANY = {};
44142 Comparator.prototype.parse = function (comp) {
44143 var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
44144 var m = comp.match(r);
44145
44146 if (!m) {
44147 throw new TypeError('Invalid comparator: ' + comp)
44148 }
44149
44150 this.operator = m[1] !== undefined ? m[1] : '';
44151 if (this.operator === '=') {
44152 this.operator = '';
44153 }
44154
44155 // if it literally is just '>' or '' then allow anything.
44156 if (!m[2]) {
44157 this.semver = ANY;
44158 } else {
44159 this.semver = new SemVer(m[2], this.options.loose);
44160 }
44161 };
44162
44163 Comparator.prototype.toString = function () {
44164 return this.value
44165 };
44166
44167 Comparator.prototype.test = function (version) {
44168 debug('Comparator.test', version, this.options.loose);
44169
44170 if (this.semver === ANY || version === ANY) {
44171 return true
44172 }
44173
44174 if (typeof version === 'string') {
44175 try {
44176 version = new SemVer(version, this.options);
44177 } catch (er) {
44178 return false
44179 }
44180 }
44181
44182 return cmp(version, this.operator, this.semver, this.options)
44183 };
44184
44185 Comparator.prototype.intersects = function (comp, options) {
44186 if (!(comp instanceof Comparator)) {
44187 throw new TypeError('a Comparator is required')
44188 }
44189
44190 if (!options || typeof options !== 'object') {
44191 options = {
44192 loose: !!options,
44193 includePrerelease: false
44194 };
44195 }
44196
44197 var rangeTmp;
44198
44199 if (this.operator === '') {
44200 if (this.value === '') {
44201 return true
44202 }
44203 rangeTmp = new Range(comp.value, options);
44204 return satisfies(this.value, rangeTmp, options)
44205 } else if (comp.operator === '') {
44206 if (comp.value === '') {
44207 return true
44208 }
44209 rangeTmp = new Range(this.value, options);
44210 return satisfies(comp.semver, rangeTmp, options)
44211 }
44212
44213 var sameDirectionIncreasing =
44214 (this.operator === '>=' || this.operator === '>') &&
44215 (comp.operator === '>=' || comp.operator === '>');
44216 var sameDirectionDecreasing =
44217 (this.operator === '<=' || this.operator === '<') &&
44218 (comp.operator === '<=' || comp.operator === '<');
44219 var sameSemVer = this.semver.version === comp.semver.version;
44220 var differentDirectionsInclusive =
44221 (this.operator === '>=' || this.operator === '<=') &&
44222 (comp.operator === '>=' || comp.operator === '<=');
44223 var oppositeDirectionsLessThan =
44224 cmp(this.semver, '<', comp.semver, options) &&
44225 ((this.operator === '>=' || this.operator === '>') &&
44226 (comp.operator === '<=' || comp.operator === '<'));
44227 var oppositeDirectionsGreaterThan =
44228 cmp(this.semver, '>', comp.semver, options) &&
44229 ((this.operator === '<=' || this.operator === '<') &&
44230 (comp.operator === '>=' || comp.operator === '>'));
44231
44232 return sameDirectionIncreasing || sameDirectionDecreasing ||
44233 (sameSemVer && differentDirectionsInclusive) ||
44234 oppositeDirectionsLessThan || oppositeDirectionsGreaterThan
44235 };
44236
44237 exports.Range = Range;
44238 function Range (range, options) {
44239 if (!options || typeof options !== 'object') {
44240 options = {
44241 loose: !!options,
44242 includePrerelease: false
44243 };
44244 }
44245
44246 if (range instanceof Range) {
44247 if (range.loose === !!options.loose &&
44248 range.includePrerelease === !!options.includePrerelease) {
44249 return range
44250 } else {
44251 return new Range(range.raw, options)
44252 }
44253 }
44254
44255 if (range instanceof Comparator) {
44256 return new Range(range.value, options)
44257 }
44258
44259 if (!(this instanceof Range)) {
44260 return new Range(range, options)
44261 }
44262
44263 this.options = options;
44264 this.loose = !!options.loose;
44265 this.includePrerelease = !!options.includePrerelease;
44266
44267 // First, split based on boolean or ||
44268 this.raw = range;
44269 this.set = range.split(/\s*\|\|\s*/).map(function (range) {
44270 return this.parseRange(range.trim())
44271 }, this).filter(function (c) {
44272 // throw out any that are not relevant for whatever reason
44273 return c.length
44274 });
44275
44276 if (!this.set.length) {
44277 throw new TypeError('Invalid SemVer Range: ' + range)
44278 }
44279
44280 this.format();
44281 }
44282
44283 Range.prototype.format = function () {
44284 this.range = this.set.map(function (comps) {
44285 return comps.join(' ').trim()
44286 }).join('||').trim();
44287 return this.range
44288 };
44289
44290 Range.prototype.toString = function () {
44291 return this.range
44292 };
44293
44294 Range.prototype.parseRange = function (range) {
44295 var loose = this.options.loose;
44296 range = range.trim();
44297 // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
44298 var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
44299 range = range.replace(hr, hyphenReplace);
44300 debug('hyphen replace', range);
44301 // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
44302 range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
44303 debug('comparator trim', range, re[t.COMPARATORTRIM]);
44304
44305 // `~ 1.2.3` => `~1.2.3`
44306 range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
44307
44308 // `^ 1.2.3` => `^1.2.3`
44309 range = range.replace(re[t.CARETTRIM], caretTrimReplace);
44310
44311 // normalize spaces
44312 range = range.split(/\s+/).join(' ');
44313
44314 // At this point, the range is completely trimmed and
44315 // ready to be split into comparators.
44316
44317 var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
44318 var set = range.split(' ').map(function (comp) {
44319 return parseComparator(comp, this.options)
44320 }, this).join(' ').split(/\s+/);
44321 if (this.options.loose) {
44322 // in loose mode, throw out any that are not valid comparators
44323 set = set.filter(function (comp) {
44324 return !!comp.match(compRe)
44325 });
44326 }
44327 set = set.map(function (comp) {
44328 return new Comparator(comp, this.options)
44329 }, this);
44330
44331 return set
44332 };
44333
44334 Range.prototype.intersects = function (range, options) {
44335 if (!(range instanceof Range)) {
44336 throw new TypeError('a Range is required')
44337 }
44338
44339 return this.set.some(function (thisComparators) {
44340 return (
44341 isSatisfiable(thisComparators, options) &&
44342 range.set.some(function (rangeComparators) {
44343 return (
44344 isSatisfiable(rangeComparators, options) &&
44345 thisComparators.every(function (thisComparator) {
44346 return rangeComparators.every(function (rangeComparator) {
44347 return thisComparator.intersects(rangeComparator, options)
44348 })
44349 })
44350 )
44351 })
44352 )
44353 })
44354 };
44355
44356 // take a set of comparators and determine whether there
44357 // exists a version which can satisfy it
44358 function isSatisfiable (comparators, options) {
44359 var result = true;
44360 var remainingComparators = comparators.slice();
44361 var testComparator = remainingComparators.pop();
44362
44363 while (result && remainingComparators.length) {
44364 result = remainingComparators.every(function (otherComparator) {
44365 return testComparator.intersects(otherComparator, options)
44366 });
44367
44368 testComparator = remainingComparators.pop();
44369 }
44370
44371 return result
44372 }
44373
44374 // Mostly just for testing and legacy API reasons
44375 exports.toComparators = toComparators;
44376 function toComparators (range, options) {
44377 return new Range(range, options).set.map(function (comp) {
44378 return comp.map(function (c) {
44379 return c.value
44380 }).join(' ').trim().split(' ')
44381 })
44382 }
44383
44384 // comprised of xranges, tildes, stars, and gtlt's at this point.
44385 // already replaced the hyphen ranges
44386 // turn into a set of JUST comparators.
44387 function parseComparator (comp, options) {
44388 debug('comp', comp, options);
44389 comp = replaceCarets(comp, options);
44390 debug('caret', comp);
44391 comp = replaceTildes(comp, options);
44392 debug('tildes', comp);
44393 comp = replaceXRanges(comp, options);
44394 debug('xrange', comp);
44395 comp = replaceStars(comp, options);
44396 debug('stars', comp);
44397 return comp
44398 }
44399
44400 function isX (id) {
44401 return !id || id.toLowerCase() === 'x' || id === '*'
44402 }
44403
44404 // ~, ~> --> * (any, kinda silly)
44405 // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
44406 // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
44407 // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
44408 // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
44409 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
44410 function replaceTildes (comp, options) {
44411 return comp.trim().split(/\s+/).map(function (comp) {
44412 return replaceTilde(comp, options)
44413 }).join(' ')
44414 }
44415
44416 function replaceTilde (comp, options) {
44417 var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
44418 return comp.replace(r, function (_, M, m, p, pr) {
44419 debug('tilde', comp, _, M, m, p, pr);
44420 var ret;
44421
44422 if (isX(M)) {
44423 ret = '';
44424 } else if (isX(m)) {
44425 ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
44426 } else if (isX(p)) {
44427 // ~1.2 == >=1.2.0 <1.3.0
44428 ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
44429 } else if (pr) {
44430 debug('replaceTilde pr', pr);
44431 ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
44432 ' <' + M + '.' + (+m + 1) + '.0';
44433 } else {
44434 // ~1.2.3 == >=1.2.3 <1.3.0
44435 ret = '>=' + M + '.' + m + '.' + p +
44436 ' <' + M + '.' + (+m + 1) + '.0';
44437 }
44438
44439 debug('tilde return', ret);
44440 return ret
44441 })
44442 }
44443
44444 // ^ --> * (any, kinda silly)
44445 // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
44446 // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
44447 // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
44448 // ^1.2.3 --> >=1.2.3 <2.0.0
44449 // ^1.2.0 --> >=1.2.0 <2.0.0
44450 function replaceCarets (comp, options) {
44451 return comp.trim().split(/\s+/).map(function (comp) {
44452 return replaceCaret(comp, options)
44453 }).join(' ')
44454 }
44455
44456 function replaceCaret (comp, options) {
44457 debug('caret', comp, options);
44458 var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
44459 return comp.replace(r, function (_, M, m, p, pr) {
44460 debug('caret', comp, _, M, m, p, pr);
44461 var ret;
44462
44463 if (isX(M)) {
44464 ret = '';
44465 } else if (isX(m)) {
44466 ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
44467 } else if (isX(p)) {
44468 if (M === '0') {
44469 ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
44470 } else {
44471 ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
44472 }
44473 } else if (pr) {
44474 debug('replaceCaret pr', pr);
44475 if (M === '0') {
44476 if (m === '0') {
44477 ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
44478 ' <' + M + '.' + m + '.' + (+p + 1);
44479 } else {
44480 ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
44481 ' <' + M + '.' + (+m + 1) + '.0';
44482 }
44483 } else {
44484 ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
44485 ' <' + (+M + 1) + '.0.0';
44486 }
44487 } else {
44488 debug('no pr');
44489 if (M === '0') {
44490 if (m === '0') {
44491 ret = '>=' + M + '.' + m + '.' + p +
44492 ' <' + M + '.' + m + '.' + (+p + 1);
44493 } else {
44494 ret = '>=' + M + '.' + m + '.' + p +
44495 ' <' + M + '.' + (+m + 1) + '.0';
44496 }
44497 } else {
44498 ret = '>=' + M + '.' + m + '.' + p +
44499 ' <' + (+M + 1) + '.0.0';
44500 }
44501 }
44502
44503 debug('caret return', ret);
44504 return ret
44505 })
44506 }
44507
44508 function replaceXRanges (comp, options) {
44509 debug('replaceXRanges', comp, options);
44510 return comp.split(/\s+/).map(function (comp) {
44511 return replaceXRange(comp, options)
44512 }).join(' ')
44513 }
44514
44515 function replaceXRange (comp, options) {
44516 comp = comp.trim();
44517 var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
44518 return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
44519 debug('xRange', comp, ret, gtlt, M, m, p, pr);
44520 var xM = isX(M);
44521 var xm = xM || isX(m);
44522 var xp = xm || isX(p);
44523 var anyX = xp;
44524
44525 if (gtlt === '=' && anyX) {
44526 gtlt = '';
44527 }
44528
44529 // if we're including prereleases in the match, then we need
44530 // to fix this to -0, the lowest possible prerelease value
44531 pr = options.includePrerelease ? '-0' : '';
44532
44533 if (xM) {
44534 if (gtlt === '>' || gtlt === '<') {
44535 // nothing is allowed
44536 ret = '<0.0.0-0';
44537 } else {
44538 // nothing is forbidden
44539 ret = '*';
44540 }
44541 } else if (gtlt && anyX) {
44542 // we know patch is an x, because we have any x at all.
44543 // replace X with 0
44544 if (xm) {
44545 m = 0;
44546 }
44547 p = 0;
44548
44549 if (gtlt === '>') {
44550 // >1 => >=2.0.0
44551 // >1.2 => >=1.3.0
44552 // >1.2.3 => >= 1.2.4
44553 gtlt = '>=';
44554 if (xm) {
44555 M = +M + 1;
44556 m = 0;
44557 p = 0;
44558 } else {
44559 m = +m + 1;
44560 p = 0;
44561 }
44562 } else if (gtlt === '<=') {
44563 // <=0.7.x is actually <0.8.0, since any 0.7.x should
44564 // pass. Similarly, <=7.x is actually <8.0.0, etc.
44565 gtlt = '<';
44566 if (xm) {
44567 M = +M + 1;
44568 } else {
44569 m = +m + 1;
44570 }
44571 }
44572
44573 ret = gtlt + M + '.' + m + '.' + p + pr;
44574 } else if (xm) {
44575 ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr;
44576 } else if (xp) {
44577 ret = '>=' + M + '.' + m + '.0' + pr +
44578 ' <' + M + '.' + (+m + 1) + '.0' + pr;
44579 }
44580
44581 debug('xRange return', ret);
44582
44583 return ret
44584 })
44585 }
44586
44587 // Because * is AND-ed with everything else in the comparator,
44588 // and '' means "any version", just remove the *s entirely.
44589 function replaceStars (comp, options) {
44590 debug('replaceStars', comp, options);
44591 // Looseness is ignored here. star is always as loose as it gets!
44592 return comp.trim().replace(re[t.STAR], '')
44593 }
44594
44595 // This function is passed to string.replace(re[t.HYPHENRANGE])
44596 // M, m, patch, prerelease, build
44597 // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
44598 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
44599 // 1.2 - 3.4 => >=1.2.0 <3.5.0
44600 function hyphenReplace ($0,
44601 from, fM, fm, fp, fpr, fb,
44602 to, tM, tm, tp, tpr, tb) {
44603 if (isX(fM)) {
44604 from = '';
44605 } else if (isX(fm)) {
44606 from = '>=' + fM + '.0.0';
44607 } else if (isX(fp)) {
44608 from = '>=' + fM + '.' + fm + '.0';
44609 } else {
44610 from = '>=' + from;
44611 }
44612
44613 if (isX(tM)) {
44614 to = '';
44615 } else if (isX(tm)) {
44616 to = '<' + (+tM + 1) + '.0.0';
44617 } else if (isX(tp)) {
44618 to = '<' + tM + '.' + (+tm + 1) + '.0';
44619 } else if (tpr) {
44620 to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
44621 } else {
44622 to = '<=' + to;
44623 }
44624
44625 return (from + ' ' + to).trim()
44626 }
44627
44628 // if ANY of the sets match ALL of its comparators, then pass
44629 Range.prototype.test = function (version) {
44630 if (!version) {
44631 return false
44632 }
44633
44634 if (typeof version === 'string') {
44635 try {
44636 version = new SemVer(version, this.options);
44637 } catch (er) {
44638 return false
44639 }
44640 }
44641
44642 for (var i = 0; i < this.set.length; i++) {
44643 if (testSet(this.set[i], version, this.options)) {
44644 return true
44645 }
44646 }
44647 return false
44648 };
44649
44650 function testSet (set, version, options) {
44651 for (var i = 0; i < set.length; i++) {
44652 if (!set[i].test(version)) {
44653 return false
44654 }
44655 }
44656
44657 if (version.prerelease.length && !options.includePrerelease) {
44658 // Find the set of versions that are allowed to have prereleases
44659 // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
44660 // That should allow `1.2.3-pr.2` to pass.
44661 // However, `1.2.4-alpha.notready` should NOT be allowed,
44662 // even though it's within the range set by the comparators.
44663 for (i = 0; i < set.length; i++) {
44664 debug(set[i].semver);
44665 if (set[i].semver === ANY) {
44666 continue
44667 }
44668
44669 if (set[i].semver.prerelease.length > 0) {
44670 var allowed = set[i].semver;
44671 if (allowed.major === version.major &&
44672 allowed.minor === version.minor &&
44673 allowed.patch === version.patch) {
44674 return true
44675 }
44676 }
44677 }
44678
44679 // Version has a -pre, but it's not one of the ones we like.
44680 return false
44681 }
44682
44683 return true
44684 }
44685
44686 exports.satisfies = satisfies;
44687 function satisfies (version, range, options) {
44688 try {
44689 range = new Range(range, options);
44690 } catch (er) {
44691 return false
44692 }
44693 return range.test(version)
44694 }
44695
44696 exports.maxSatisfying = maxSatisfying;
44697 function maxSatisfying (versions, range, options) {
44698 var max = null;
44699 var maxSV = null;
44700 try {
44701 var rangeObj = new Range(range, options);
44702 } catch (er) {
44703 return null
44704 }
44705 versions.forEach(function (v) {
44706 if (rangeObj.test(v)) {
44707 // satisfies(v, range, options)
44708 if (!max || maxSV.compare(v) === -1) {
44709 // compare(max, v, true)
44710 max = v;
44711 maxSV = new SemVer(max, options);
44712 }
44713 }
44714 });
44715 return max
44716 }
44717
44718 exports.minSatisfying = minSatisfying;
44719 function minSatisfying (versions, range, options) {
44720 var min = null;
44721 var minSV = null;
44722 try {
44723 var rangeObj = new Range(range, options);
44724 } catch (er) {
44725 return null
44726 }
44727 versions.forEach(function (v) {
44728 if (rangeObj.test(v)) {
44729 // satisfies(v, range, options)
44730 if (!min || minSV.compare(v) === 1) {
44731 // compare(min, v, true)
44732 min = v;
44733 minSV = new SemVer(min, options);
44734 }
44735 }
44736 });
44737 return min
44738 }
44739
44740 exports.minVersion = minVersion;
44741 function minVersion (range, loose) {
44742 range = new Range(range, loose);
44743
44744 var minver = new SemVer('0.0.0');
44745 if (range.test(minver)) {
44746 return minver
44747 }
44748
44749 minver = new SemVer('0.0.0-0');
44750 if (range.test(minver)) {
44751 return minver
44752 }
44753
44754 minver = null;
44755 for (var i = 0; i < range.set.length; ++i) {
44756 var comparators = range.set[i];
44757
44758 comparators.forEach(function (comparator) {
44759 // Clone to avoid manipulating the comparator's semver object.
44760 var compver = new SemVer(comparator.semver.version);
44761 switch (comparator.operator) {
44762 case '>':
44763 if (compver.prerelease.length === 0) {
44764 compver.patch++;
44765 } else {
44766 compver.prerelease.push(0);
44767 }
44768 compver.raw = compver.format();
44769 /* fallthrough */
44770 case '':
44771 case '>=':
44772 if (!minver || gt(minver, compver)) {
44773 minver = compver;
44774 }
44775 break
44776 case '<':
44777 case '<=':
44778 /* Ignore maximum versions */
44779 break
44780 /* istanbul ignore next */
44781 default:
44782 throw new Error('Unexpected operation: ' + comparator.operator)
44783 }
44784 });
44785 }
44786
44787 if (minver && range.test(minver)) {
44788 return minver
44789 }
44790
44791 return null
44792 }
44793
44794 exports.validRange = validRange;
44795 function validRange (range, options) {
44796 try {
44797 // Return '*' instead of '' so that truthiness works.
44798 // This will throw if it's invalid anyway
44799 return new Range(range, options).range || '*'
44800 } catch (er) {
44801 return null
44802 }
44803 }
44804
44805 // Determine if version is less than all the versions possible in the range
44806 exports.ltr = ltr;
44807 function ltr (version, range, options) {
44808 return outside(version, range, '<', options)
44809 }
44810
44811 // Determine if version is greater than all the versions possible in the range.
44812 exports.gtr = gtr;
44813 function gtr (version, range, options) {
44814 return outside(version, range, '>', options)
44815 }
44816
44817 exports.outside = outside;
44818 function outside (version, range, hilo, options) {
44819 version = new SemVer(version, options);
44820 range = new Range(range, options);
44821
44822 var gtfn, ltefn, ltfn, comp, ecomp;
44823 switch (hilo) {
44824 case '>':
44825 gtfn = gt;
44826 ltefn = lte;
44827 ltfn = lt;
44828 comp = '>';
44829 ecomp = '>=';
44830 break
44831 case '<':
44832 gtfn = lt;
44833 ltefn = gte;
44834 ltfn = gt;
44835 comp = '<';
44836 ecomp = '<=';
44837 break
44838 default:
44839 throw new TypeError('Must provide a hilo val of "<" or ">"')
44840 }
44841
44842 // If it satisifes the range it is not outside
44843 if (satisfies(version, range, options)) {
44844 return false
44845 }
44846
44847 // From now on, variable terms are as if we're in "gtr" mode.
44848 // but note that everything is flipped for the "ltr" function.
44849
44850 for (var i = 0; i < range.set.length; ++i) {
44851 var comparators = range.set[i];
44852
44853 var high = null;
44854 var low = null;
44855
44856 comparators.forEach(function (comparator) {
44857 if (comparator.semver === ANY) {
44858 comparator = new Comparator('>=0.0.0');
44859 }
44860 high = high || comparator;
44861 low = low || comparator;
44862 if (gtfn(comparator.semver, high.semver, options)) {
44863 high = comparator;
44864 } else if (ltfn(comparator.semver, low.semver, options)) {
44865 low = comparator;
44866 }
44867 });
44868
44869 // If the edge version comparator has a operator then our version
44870 // isn't outside it
44871 if (high.operator === comp || high.operator === ecomp) {
44872 return false
44873 }
44874
44875 // If the lowest version comparator has an operator and our version
44876 // is less than it then it isn't higher than the range
44877 if ((!low.operator || low.operator === comp) &&
44878 ltefn(version, low.semver)) {
44879 return false
44880 } else if (low.operator === ecomp && ltfn(version, low.semver)) {
44881 return false
44882 }
44883 }
44884 return true
44885 }
44886
44887 exports.prerelease = prerelease;
44888 function prerelease (version, options) {
44889 var parsed = parse(version, options);
44890 return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
44891 }
44892
44893 exports.intersects = intersects;
44894 function intersects (r1, r2, options) {
44895 r1 = new Range(r1, options);
44896 r2 = new Range(r2, options);
44897 return r1.intersects(r2)
44898 }
44899
44900 exports.coerce = coerce;
44901 function coerce (version, options) {
44902 if (version instanceof SemVer) {
44903 return version
44904 }
44905
44906 if (typeof version === 'number') {
44907 version = String(version);
44908 }
44909
44910 if (typeof version !== 'string') {
44911 return null
44912 }
44913
44914 options = options || {};
44915
44916 var match = null;
44917 if (!options.rtl) {
44918 match = version.match(re[t.COERCE]);
44919 } else {
44920 // Find the right-most coercible string that does not share
44921 // a terminus with a more left-ward coercible string.
44922 // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
44923 //
44924 // Walk through the string checking with a /g regexp
44925 // Manually set the index so as to pick up overlapping matches.
44926 // Stop when we get a match that ends at the string end, since no
44927 // coercible string can be more right-ward without the same terminus.
44928 var next;
44929 while ((next = re[t.COERCERTL].exec(version)) &&
44930 (!match || match.index + match[0].length !== version.length)
44931 ) {
44932 if (!match ||
44933 next.index + next[0].length !== match.index + match[0].length) {
44934 match = next;
44935 }
44936 re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
44937 }
44938 // leave it in a clean state
44939 re[t.COERCERTL].lastIndex = -1;
44940 }
44941
44942 if (match === null) {
44943 return null
44944 }
44945
44946 return parse(match[2] +
44947 '.' + (match[3] || '0') +
44948 '.' + (match[4] || '0'), options)
44949 }
44950 } (semver, semver.exports));
44951
44952 const LOADED = {};
44953 /**
44954 * @interface LoadType
44955 * @param {object} type
44956 * @param {string} type.name
44957 * @param {string} type.version
44958 * @returns {Promise<Visualization>}
44959 */
44960
44961 async function load(name, version, _ref, loader) {
44962 let {
44963 config
44964 } = _ref;
44965 const key = "".concat(name, "__").concat(version);
44966
44967 if (!LOADED[key]) {
44968 const sKey = "".concat(name).concat(version && " v".concat(version) || '');
44969
44970 if (loader && typeof loader !== 'function') {
44971 throw new Error("load of visualization '".concat(sKey, "' is not a fuction, wrap load promise in function"));
44972 }
44973
44974 const p = (loader || config.load)({
44975 name,
44976 version
44977 });
44978 const prom = Promise.resolve(p);
44979 LOADED[key] = prom.then(sn => {
44980 if (!sn) {
44981 // TODO - improve validation
44982 throw new Error("load() of visualization '".concat(sKey, "' resolved to an invalid object"));
44983 }
44984
44985 return sn;
44986 }).catch(e => {
44987 {
44988 console.warn(e); // eslint-disable-line no-console
44989 }
44990
44991 throw new Error("Failed to load visualization: '".concat(sKey, "'"));
44992 });
44993 }
44994
44995 return LOADED[key];
44996 }
44997 function clearFromCache(name) {
44998 Object.keys(LOADED).forEach(key => {
44999 if (key.split('__')[0] === name) {
45000 LOADED[key] = undefined;
45001 }
45002 });
45003 }
45004
45005 /**
45006 * @interface TypeInfo
45007 * @property {string} name
45008 * @property {string=} version
45009 * @property {LoadType} load
45010 * @property {object=} meta
45011 */
45012
45013 function create$1(info, halo) {
45014 let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
45015 let sn;
45016 let stringified;
45017 const {
45018 meta
45019 } = opts;
45020 const type = {
45021 name: info.name,
45022 version: info.version,
45023
45024 supportsPropertiesVersion(v) {
45025 if (v && meta && meta.deps && meta.deps.properties) {
45026 return semver.exports.satisfies(v, meta.deps.properties);
45027 }
45028
45029 return true;
45030 },
45031
45032 supernova: () => load(type.name, type.version, halo, opts.load).then(SNDefinition => {
45033 sn = sn || generatorFn(SNDefinition, halo.public.galaxy);
45034 stringified = JSON.stringify(sn.qae.properties.initial);
45035 return sn;
45036 }),
45037
45038 initialProperties(initial) {
45039 return this.supernova().then(() => {
45040 const props = _objectSpread2(_objectSpread2({
45041 qInfo: {
45042 qType: type.name
45043 },
45044 visualization: type.name,
45045 version: type.version,
45046 showTitles: true
45047 }, JSON.parse(stringified)), initial);
45048
45049 return props;
45050 });
45051 }
45052
45053 };
45054 return type;
45055 }
45056
45057 function semverSort(arr) {
45058 const unversioned = arr.filter(v => v === 'undefined');
45059 return [...unversioned, ...arr.filter(v => v !== 'undefined').map(v => v.split('.').map(n => parseInt(n, 10))).sort((a, b) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2]).map(n => n.join('.'))];
45060 }
45061 function typeCollection(name, halo) {
45062 const versions = {};
45063 let sortedVersions = null;
45064 return {
45065 get: version => versions[version],
45066 register: (version, opts) => {
45067 if (versions[version]) {
45068 throw new Error("Supernova '".concat(name, "@").concat(version, "' already registered."));
45069 }
45070
45071 versions[version] = create$1({
45072 name,
45073 version
45074 }, halo, opts);
45075 sortedVersions = null;
45076 },
45077 getMatchingVersionFromProperties: propertyVersion => {
45078 if (!sortedVersions) {
45079 sortedVersions = semverSort(Object.keys(versions));
45080 }
45081
45082 for (let i = sortedVersions.length - 1; i >= 0; i--) {
45083 const t = versions[sortedVersions[i]];
45084
45085 if (t.supportsPropertiesVersion(propertyVersion)) {
45086 return sortedVersions[i];
45087 }
45088 }
45089
45090 return null;
45091 },
45092 versions
45093 };
45094 }
45095 function create(_ref) {
45096 let {
45097 halo,
45098 parent
45099 } = _ref;
45100 const tc = {};
45101 const p = parent || {
45102 get: () => undefined
45103 };
45104 return {
45105 register: (typeInfo, opts) => {
45106 if (!tc[typeInfo.name]) {
45107 tc[typeInfo.name] = typeCollection(typeInfo.name, halo);
45108 }
45109
45110 tc[typeInfo.name].register(typeInfo.version, opts);
45111 },
45112 getSupportedVersion: (name, propertyVersion) => {
45113 if (!tc[name]) {
45114 return null;
45115 }
45116
45117 return tc[name].getMatchingVersionFromProperties(propertyVersion);
45118 },
45119
45120 get(typeInfo) {
45121 const {
45122 name
45123 } = typeInfo;
45124 let {
45125 version
45126 } = typeInfo;
45127
45128 if (!tc[name]) {
45129 // Fall back to existing version
45130 {
45131 console.warn("Visualization ".concat(name, " is not registered.")); // eslint-disable-line no-console
45132 }
45133
45134 this.register({
45135 name,
45136 version
45137 });
45138 } else if (!tc[name].versions[version]) {
45139 // Fall back to existing version
45140 const versionToUse = Object.keys(tc[name].versions)[0];
45141
45142 {
45143 console.warn("Version ".concat(version, " of ").concat(name, " is not registered. Falling back to version ").concat(versionToUse)); // eslint-disable-line no-console
45144 }
45145
45146 version = versionToUse;
45147 }
45148
45149 return tc[name].get(version) || p.get(typeInfo);
45150 },
45151
45152 getList: () => Object.keys(tc).map(key => ({
45153 name: key,
45154 versions: Object.keys(tc[key].versions).map(v => v === 'undefined' ? undefined : v)
45155 })),
45156 clearFromCache: name => {
45157 if (tc[name]) {
45158 tc[name] = undefined;
45159 }
45160
45161 clearFromCache(name);
45162 }
45163 };
45164 }
45165
45166 const _excluded = ["__DO_NOT_USE__"];
45167 /**
45168 * @interface Context
45169 * @property {boolean=} keyboardNavigation
45170 * @property {object=} constraints
45171 * @property {boolean=} constraints.active
45172 * @property {boolean=} constraints.passive
45173 * @property {boolean=} constraints.select
45174 */
45175
45176 const DEFAULT_CONTEXT =
45177 /** @lends Context */
45178 {
45179 /** @type {string=} */
45180 theme: 'light',
45181
45182 /** @type {string=} */
45183 language: 'en-US',
45184
45185 /** @type {string=} */
45186 deviceType: 'auto',
45187 constraints: {},
45188 keyboardNavigation: false,
45189 disableCellPadding: false
45190 };
45191 /**
45192 * @interface SnapshotConfiguration
45193 * @private
45194 */
45195
45196 const DEFAULT_SNAPSHOT_CONFIG =
45197 /** @lends SnapshotConfiguration */
45198 {
45199 /**
45200 * @param {string} id
45201 * @returns {Promise<SnapshotLayout>}
45202 */
45203 get: async id => {
45204 const res = await fetch("/njs/snapshot/".concat(id));
45205
45206 if (!res.ok) {
45207 throw new Error(res.statusText);
45208 }
45209
45210 return res.json();
45211 },
45212
45213 capture(payload) {
45214 return fetch("/njs/capture", {
45215 method: 'POST',
45216 headers: {
45217 'Content-Type': 'application/json'
45218 },
45219 body: JSON.stringify(payload)
45220 }).then(res => res.json());
45221 }
45222
45223 };
45224 /**
45225 * @interface Configuration
45226 */
45227
45228 const DEFAULT_CONFIG =
45229 /** @lends Configuration */
45230 {
45231 /**
45232 * @type {Context=}
45233 */
45234 context: DEFAULT_CONTEXT,
45235 load: () => undefined,
45236
45237 /**
45238 * @type {(TypeInfo[])=}
45239 */
45240 types: [],
45241
45242 /**
45243 * @type {(ThemeInfo[])=}
45244 */
45245 themes: [],
45246
45247 /** @type {object=} */
45248 anything: {},
45249
45250 /**
45251 * @type {SnapshotConfiguration=}
45252 * @private
45253 */
45254 snapshot: DEFAULT_SNAPSHOT_CONFIG
45255 };
45256 /**
45257 * @interface Galaxy
45258 */
45259
45260 const mergeObj = function () {
45261 let o1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
45262 let o2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
45263 return _objectSpread2(_objectSpread2({}, o1), o2);
45264 };
45265
45266 const mergeArray = function () {
45267 let a1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
45268 let a2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
45269 return (// Simple merge and deduplication
45270 [...a1, ...a2].filter((v, i, a) => a.indexOf(v) === i)
45271 );
45272 };
45273
45274 const mergeConfigs = (base, c) => ({
45275 context: mergeObj(base.context, c.context),
45276 load: c.load || base.load,
45277 snapshot: _objectSpread2({}, c.snapshot || base.snapshot),
45278 types: mergeArray(base.types, c.types),
45279 themes: mergeArray(base.themes, c.themes),
45280 flags: mergeObj(base.flags, c.flags),
45281 anything: mergeObj(base.anything, c.anything)
45282 });
45283 /**
45284 * @ignore
45285 * @typedef {function(promise)} PromiseFunction A callback function which receives a request promise as the first argument.
45286 */
45287
45288 /**
45289 * @ignore
45290 * @typedef {function(function)} ReceiverFunction A callback function which receives another function as input.
45291 */
45292
45293 /**
45294 * @ignore
45295 * @typedef {object} DoNotUseOptions Options strictly recommended not to use as they might change anytime. Documenting them to keep track of them, but not exposing them to API docs.
45296 * @property {boolean=} [focusSearch=false] Initialize the Listbox with the search input focused. Only applicable when
45297 * search is true, since toggling will always focus the search input on show.
45298 * @property {boolean=} [options.showGray=true] Render fields or checkboxes in shades of gray instead of white when their state is excluded or alternative.
45299 * @property {object} [options.sessionModel] Use a custom sessionModel.
45300 * @property {object} [options.selectionsApi] Use a custom selectionsApi to customize how values are selected.
45301 * @property {function():boolean} [options.selectDisabled=] Define a function which tells when selections are disabled (true) or enabled (false). By default, always returns false.
45302 * @property {PromiseFunction} [options.fetchStart] A function called when the Listbox starts fetching data. Receives the fetch request promise as an argument.
45303 * @property {ReceiverFunction} [options.update] A function which receives an update function which upon call will trigger a data fetch.
45304 * @property {{setScrollPos:function(number):void, initScrollPos:number}} [options.scrollState=] Object including a setScrollPos function that sets current scroll position index. A initial scroll position index.
45305 * @property {number=} [options.sortByState=1] Sort by state, detault 1 = sort descending, 0 = no sorting, -1 sort ascending.
45306 * @property {function(number):void} [options.setCount=] A function that gets called with the length of the data in the Listbox.
45307 */
45308
45309 /**
45310 * @ignore
45311 * @param {object} usersOptions Options sent in to fieldInstance.mount.
45312 * @param {DoNotUseOptions} __DO_NOT_USE__
45313 * @returns {object} Squashed options with defaults given for non-exposed options.
45314 */
45315
45316
45317 const getOptions = function () {
45318 let usersOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
45319
45320 const {
45321 __DO_NOT_USE__ = {}
45322 } = usersOptions,
45323 exposedOptions = _objectWithoutProperties$2(usersOptions, _excluded);
45324
45325 const DO_NOT_USE_DEFAULTS = {
45326 update: undefined,
45327 fetchStart: undefined,
45328 showGray: true,
45329 focusSearch: false,
45330 sessionModel: undefined,
45331 selectionsApi: undefined,
45332 selectDisabled: undefined
45333 };
45334
45335 const squashedOptions = _objectSpread2(_objectSpread2(_objectSpread2({}, exposedOptions), DO_NOT_USE_DEFAULTS), __DO_NOT_USE__);
45336
45337 return squashedOptions;
45338 };
45339
45340 function nuked() {
45341 let configuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
45342 const locale = appLocaleFn(configuration.context.language);
45343 /**
45344 * Initiates a new `Embed` instance using the specified enigma `app`.
45345 * @entry
45346 * @function embed
45347 * @param {EngineAPI.IApp} app
45348 * @param {Configuration=} instanceConfig
45349 * @returns {Embed}
45350 * @example
45351 * import { embed } from '@nebula.js/stardust'
45352 * const n = embed(app);
45353 * n.render({ id: 'abc' });
45354 */
45355
45356 function embed(app, instanceConfig) {
45357 if (instanceConfig) {
45358 return embed.createConfiguration(instanceConfig)(app);
45359 }
45360
45361 let currentContext = _objectSpread2(_objectSpread2({}, configuration.context), {}, {
45362 translator: locale.translator
45363 });
45364
45365 const [root] = boot({
45366 app,
45367 context: currentContext
45368 });
45369 const appTheme$1 = appTheme({
45370 themes: configuration.themes,
45371 root
45372 });
45373 const publicAPIs = {
45374 galaxy:
45375 /** @lends Galaxy */
45376 {
45377 /** @type {Translator} */
45378 translator: locale.translator,
45379 // TODO - validate flags input
45380
45381 /** @type {Flags} */
45382 flags: flagsFn(configuration.flags),
45383
45384 /** @type {string} */
45385 deviceType: deviceTypeFn(configuration.context.deviceType),
45386
45387 /** @type {object} */
45388 anything: configuration.anything
45389 },
45390 theme: appTheme$1.externalAPI,
45391 translator: locale.translator,
45392 nebbie: null // actual value is set further down
45393
45394 };
45395 const halo = {
45396 app,
45397 root,
45398 config: configuration,
45399 public: publicAPIs,
45400 context: currentContext,
45401 types: null
45402 };
45403 const types = create({
45404 halo
45405 });
45406 configuration.types.forEach(t => types.register({
45407 name: t.name,
45408 version: t.version
45409 }, {
45410 meta: t.meta,
45411 load: t.load
45412 }));
45413 let currentThemePromise = appTheme$1.setTheme(configuration.context.theme);
45414 let selectionsApi = null;
45415 let selectionsComponentReference = null;
45416 /**
45417 * @class
45418 * @alias Embed
45419 */
45420
45421 const api =
45422 /** @lends Embed# */
45423 {
45424 /**
45425 * Renders a visualization into an HTMLElement.
45426 * @param {CreateConfig | GetConfig} cfg - The render configuration.
45427 * @returns {Promise<Viz>} A controller to the rendered visualization.
45428 * @example
45429 * // render from existing object
45430 * n.render({
45431 * element: el,
45432 * id: 'abcdef'
45433 * });
45434 * @example
45435 * // render on the fly
45436 * n.render({
45437 * element: el,
45438 * type: 'barchart',
45439 * fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }]
45440 * });
45441 */
45442 render: async cfg => {
45443 await currentThemePromise;
45444
45445 if (cfg.id) {
45446 return getObject(cfg, halo);
45447 }
45448
45449 return createSessionObject(cfg, halo);
45450 },
45451
45452 /**
45453 * Updates the current context of this embed instance.
45454 * Use this when you want to change some part of the current context, like theme.
45455 * @param {Context} ctx - The context to update.
45456 * @returns {Promise<undefined>}
45457 * @example
45458 * // change theme
45459 * n.context({ theme: 'dark'});
45460 * @example
45461 * // limit constraints
45462 * n.context({ constraints: { active: true } });
45463 */
45464 context: async ctx => {
45465 // filter valid values to avoid triggering unnecessary rerender
45466 let changes;
45467 ['theme', 'language', 'constraints', 'keyboardNavigation'].forEach(key => {
45468 if (Object.prototype.hasOwnProperty.call(ctx, key) && ctx[key] !== currentContext[key]) {
45469 if (!changes) {
45470 changes = {};
45471 }
45472
45473 changes[key] = ctx[key];
45474 }
45475 });
45476
45477 if (!changes) {
45478 return;
45479 }
45480
45481 currentContext = _objectSpread2(_objectSpread2(_objectSpread2({}, currentContext), changes), {}, {
45482 translator: locale.translator
45483 });
45484 halo.context = currentContext;
45485
45486 if (changes.theme) {
45487 currentThemePromise = appTheme$1.setTheme(changes.theme);
45488 await currentThemePromise;
45489 }
45490
45491 if (changes.language) {
45492 halo.public.translator.language(changes.language);
45493 }
45494
45495 root.context(currentContext);
45496 },
45497
45498 /**
45499 * Gets the app selections of this instance.
45500 * @returns {Promise<AppSelections>}
45501 * @example
45502 * const selections = await n.selections();
45503 * selections.mount(element);
45504 */
45505 selections: async () => {
45506 if (!selectionsApi) {
45507 // const appSelections = await root.getAppSelections(); // Don't expose this for now
45508 selectionsApi =
45509 /** @lends AppSelections# */
45510 {
45511 /**
45512 * Mounts the app selection UI into the provided HTMLElement.
45513 * @param {HTMLElement} element
45514 * @example
45515 * selections.mount(element);
45516 */
45517 mount(element) {
45518 if (selectionsComponentReference) {
45519 {
45520 console.error('Already mounted'); // eslint-disable-line no-console
45521 }
45522
45523 return;
45524 }
45525
45526 selectionsComponentReference = mount({
45527 element,
45528 app
45529 });
45530 root.add(selectionsComponentReference);
45531 },
45532
45533 /**
45534 * Unmounts the app selection UI from the DOM.
45535 * @example
45536 * selections.unmount();
45537 */
45538 unmount() {
45539 if (selectionsComponentReference) {
45540 root.remove(selectionsComponentReference);
45541 selectionsComponentReference = null;
45542 }
45543 }
45544
45545 };
45546 }
45547
45548 return selectionsApi;
45549 },
45550
45551 /**
45552 * Gets the listbox instance of the specified field
45553 * @param {string|LibraryField} fieldIdentifier Fieldname as a string or a Library dimension
45554 * @returns {Promise<FieldInstance>}
45555 * @since 1.1.0
45556 * @example
45557 * const fieldInstance = await n.field("MyField");
45558 * fieldInstance.mount(element, { title: "Hello Field"});
45559 */
45560 field: async fieldIdentifier => {
45561 const fieldName = typeof fieldIdentifier === 'string' ? fieldIdentifier : fieldIdentifier.qLibraryId;
45562
45563 if (!fieldName) {
45564 throw new Error("Field identifier must be provided");
45565 }
45566 /**
45567 * @typedef { 'ltr' | 'rtl' } Direction
45568 */
45569
45570 /**
45571 * @typedef { 'vertical' | 'horizontal' } ListLayout
45572 */
45573
45574 /**
45575 * @typedef { 'none' | 'value' | 'percent' | 'relative' } FrequencyMode
45576 */
45577
45578 /**
45579 * @typedef { boolean | 'toggle' } SearchMode
45580 */
45581
45582 /**
45583 * @class
45584 * @alias FieldInstance
45585 * @since 1.1.0
45586 */
45587
45588
45589 const fieldSels = {
45590 fieldName,
45591
45592 /**
45593 * Mounts the field as a listbox into the provided HTMLElement.
45594 * @param {HTMLElement} element
45595 * @param {object=} options Settings for the embedded listbox
45596 * @param {string=} options.title Custom title, defaults to fieldname
45597 * @param {Direction=} [options.direction=ltr] Direction setting ltr|rtl.
45598 * @param {ListLayout=} [options.listLayout=vertical] Layout direction vertical|horizontal
45599 * @param {FrequencyMode=} [options.frequencyMode=none] Show frequency none|value|percent|relative
45600 * @param {boolean=} [options.histogram=false] Show histogram bar
45601 * @param {SearchMode=} [options.search=true] Show the search bar permanently or using the toggle button: false|true|toggle|toggleShow
45602 * @param {boolean=} [options.toolbar=true] Show the toolbar
45603 * @param {boolean=} [options.checkboxes=false] Show values as checkboxes instead of as fields
45604 * @param {boolean=} [options.dense=false] Reduces padding and text size
45605 * @param {boolean=} [options.stateName="$"] Sets the state to make selections in
45606 * @param {object=} [options.properties={}] Properties object to extend default properties with
45607 *
45608 * @since 1.1.0
45609 * @instance
45610 * @example
45611 * fieldInstance.mount(element);
45612 */
45613 mount(element) {
45614 let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
45615
45616 if (!element) {
45617 throw new Error("Element for ".concat(fieldName, " not provided"));
45618 }
45619
45620 if (this._instance) {
45621 throw new Error("Field ".concat(fieldName, " already mounted"));
45622 }
45623
45624 this._instance = ListBoxPortal({
45625 element,
45626 app,
45627 fieldIdentifier,
45628 options: getOptions(options),
45629 stateName: options.stateName || '$'
45630 });
45631 root.add(this._instance);
45632 },
45633
45634 /**
45635 * Unmounts the field listbox from the DOM.
45636 * @since 1.1.0
45637 * @instance
45638 * @example
45639 * listbox.unmount();
45640 */
45641 unmount() {
45642 if (this._instance) {
45643 root.remove(this._instance);
45644 this._instance = null;
45645 }
45646 }
45647
45648 };
45649 return fieldSels;
45650 },
45651
45652 /**
45653 * Gets a list of registered visualization types and versions
45654 * @function
45655 * @returns {Array<Object>} types
45656 * @example
45657 * const types = n.getRegisteredTypes();
45658 * // Contains
45659 * //[
45660 * // {
45661 * // name: "barchart"
45662 * // versions:[undefined, "1.2.0"]
45663 * // }
45664 * //]
45665 */
45666 getRegisteredTypes: types.getList,
45667 __DO_NOT_USE__: {
45668 types
45669 }
45670 };
45671 halo.public.nebbie = api;
45672 halo.types = types;
45673 return api;
45674 }
45675 /**
45676 * Creates a new `embed` scope bound to the specified `configuration`.
45677 *
45678 * The configuration is merged with all previous scopes.
45679 * @memberof embed
45680 * @param {Configuration} configuration - The configuration object
45681 * @returns {embed}
45682 * @example
45683 * import { embed } from '@nebula.js/stardust';
45684 * // create a 'master' config which registers all types
45685 * const m = embed.createConfiguration({
45686 * types: [{
45687 * name: 'mekko',
45688 * version: '1.0.0',
45689 * load: () => Promise.resolve(mekko)
45690 * }],
45691 * });
45692 *
45693 * // create an alternate config with dark theme
45694 * // and inherit the config from the previous
45695 * const d = m.createConfiguration({
45696 * context: {
45697 * theme: 'dark'
45698 * }
45699 * });
45700 *
45701 * m(app).render({ type: 'mekko' }); // will render the object with default theme
45702 * d(app).render({ type: 'mekko' }); // will render the object with 'dark' theme
45703 * embed(app).render({ type: 'mekko' }); // will throw error since 'mekko' is not a register type on the default instance
45704 */
45705
45706
45707 embed.createConfiguration = c => nuked(mergeConfigs(configuration, c));
45708
45709 embed.config = configuration;
45710 return embed;
45711 }
45712 /**
45713 * @typedef {any} ThemeJSON
45714 */
45715
45716 /**
45717 * @interface ThemeInfo
45718 * @property {string} id Theme identifier
45719 * @property {function(): Promise<ThemeJSON>} load A function that should return a Promise that resolves to a raw JSON theme.
45720 */
45721
45722
45723 var index = nuked(DEFAULT_CONFIG);
45724
45725 var enigmaMocker = {exports: {}};
45726
45727 var enigmaMocker_dev = {exports: {}};
45728
45729 /*
45730 * @nebula.js/enigma-mocker v2.11.0
45731 * Copyright (c) 2022 QlikTech International AB
45732 * Released under the MIT license.
45733 */
45734
45735 (function (module, exports) {
45736 (function (global, factory) {
45737 module.exports = factory() ;
45738 })(commonjsGlobal, function () {
45739
45740 function SessionMock() {
45741 return {
45742 getObjectApi() {
45743 return Promise.resolve({
45744 id: "sessapi - ".concat(+Date.now())
45745 });
45746 }
45747
45748 };
45749 }
45750
45751 function ownKeys(object, enumerableOnly) {
45752 var keys = Object.keys(object);
45753
45754 if (Object.getOwnPropertySymbols) {
45755 var symbols = Object.getOwnPropertySymbols(object);
45756 enumerableOnly && (symbols = symbols.filter(function (sym) {
45757 return Object.getOwnPropertyDescriptor(object, sym).enumerable;
45758 })), keys.push.apply(keys, symbols);
45759 }
45760
45761 return keys;
45762 }
45763
45764 function _objectSpread2(target) {
45765 for (var i = 1; i < arguments.length; i++) {
45766 var source = null != arguments[i] ? arguments[i] : {};
45767 i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
45768 _defineProperty(target, key, source[key]);
45769 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
45770 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
45771 });
45772 }
45773
45774 return target;
45775 }
45776
45777 function _defineProperty(obj, key, value) {
45778 if (key in obj) {
45779 Object.defineProperty(obj, key, {
45780 value: value,
45781 enumerable: true,
45782 configurable: true,
45783 writable: true
45784 });
45785 } else {
45786 obj[key] = value;
45787 }
45788
45789 return obj;
45790 }
45791
45792 function _objectWithoutPropertiesLoose(source, excluded) {
45793 if (source == null) return {};
45794 var target = {};
45795 var sourceKeys = Object.keys(source);
45796 var key, i;
45797
45798 for (i = 0; i < sourceKeys.length; i++) {
45799 key = sourceKeys[i];
45800 if (excluded.indexOf(key) >= 0) continue;
45801 target[key] = source[key];
45802 }
45803
45804 return target;
45805 }
45806
45807 function _objectWithoutProperties(source, excluded) {
45808 if (source == null) return {};
45809
45810 var target = _objectWithoutPropertiesLoose(source, excluded);
45811
45812 var key, i;
45813
45814 if (Object.getOwnPropertySymbols) {
45815 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
45816
45817 for (i = 0; i < sourceSymbolKeys.length; i++) {
45818 key = sourceSymbolKeys[i];
45819 if (excluded.indexOf(key) >= 0) continue;
45820 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
45821 target[key] = source[key];
45822 }
45823 }
45824
45825 return target;
45826 }
45827
45828 var hasOwn = Object.prototype.hasOwnProperty;
45829 var toStr = Object.prototype.toString;
45830 var defineProperty = Object.defineProperty;
45831 var gOPD = Object.getOwnPropertyDescriptor;
45832
45833 var isArray = function isArray(arr) {
45834 if (typeof Array.isArray === 'function') {
45835 return Array.isArray(arr);
45836 }
45837
45838 return toStr.call(arr) === '[object Array]';
45839 };
45840
45841 var isPlainObject = function isPlainObject(obj) {
45842 if (!obj || toStr.call(obj) !== '[object Object]') {
45843 return false;
45844 }
45845
45846 var hasOwnConstructor = hasOwn.call(obj, 'constructor');
45847 var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); // Not own constructor property must be Object
45848
45849 if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
45850 return false;
45851 } // Own properties are enumerated firstly, so to speed up,
45852 // if last one is own, then all properties are own.
45853
45854
45855 var key;
45856
45857 for (key in obj) {
45858 /**/
45859 }
45860
45861 return typeof key === 'undefined' || hasOwn.call(obj, key);
45862 }; // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
45863
45864
45865 var setProperty = function setProperty(target, options) {
45866 if (defineProperty && options.name === '__proto__') {
45867 defineProperty(target, options.name, {
45868 enumerable: true,
45869 configurable: true,
45870 value: options.newValue,
45871 writable: true
45872 });
45873 } else {
45874 target[options.name] = options.newValue;
45875 }
45876 }; // Return undefined instead of __proto__ if '__proto__' is not an own property
45877
45878
45879 var getProperty = function getProperty(obj, name) {
45880 if (name === '__proto__') {
45881 if (!hasOwn.call(obj, name)) {
45882 return void 0;
45883 } else if (gOPD) {
45884 // In early versions of node, obj['__proto__'] is buggy when obj has
45885 // __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
45886 return gOPD(obj, name).value;
45887 }
45888 }
45889
45890 return obj[name];
45891 };
45892
45893 var extend = function extend() {
45894 var options, name, src, copy, copyIsArray, clone;
45895 var target = arguments[0];
45896 var i = 1;
45897 var length = arguments.length;
45898 var deep = false; // Handle a deep copy situation
45899
45900 if (typeof target === 'boolean') {
45901 deep = target;
45902 target = arguments[1] || {}; // skip the boolean and the target
45903
45904 i = 2;
45905 }
45906
45907 if (target == null || typeof target !== 'object' && typeof target !== 'function') {
45908 target = {};
45909 }
45910
45911 for (; i < length; ++i) {
45912 options = arguments[i]; // Only deal with non-null/undefined values
45913
45914 if (options != null) {
45915 // Extend the base object
45916 for (name in options) {
45917 src = getProperty(target, name);
45918 copy = getProperty(options, name); // Prevent never-ending loop
45919
45920 if (target !== copy) {
45921 // Recurse if we're merging plain objects or arrays
45922 if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
45923 if (copyIsArray) {
45924 copyIsArray = false;
45925 clone = src && isArray(src) ? src : [];
45926 } else {
45927 clone = src && isPlainObject(src) ? src : {};
45928 } // Never move original objects, clone them
45929
45930
45931 setProperty(target, {
45932 name: name,
45933 newValue: extend(deep, clone, copy)
45934 }); // Don't bring in undefined values
45935 } else if (typeof copy !== 'undefined') {
45936 setProperty(target, {
45937 name: name,
45938 newValue: copy
45939 });
45940 }
45941 }
45942 }
45943 }
45944 } // Return the modified object
45945
45946
45947 return target;
45948 }; // eslint-disable-next-line no-undef
45949
45950
45951 const crt = globalThis.crypto || {
45952 getRandomValues: () => 123456
45953 }; // https://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid
45954 // Not using crypto.randomUUID due to missing safari support < 15
45955
45956 function uuidv4() {
45957 return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ crt.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
45958 }
45959
45960 function CreateSessionObjectMock() {
45961 return props => {
45962 const properties = extend({}, props);
45963 properties.qInfo = properties.qInfo || {};
45964 properties.qInfo.qId = properties.qInfo.qId || "mock-".concat(uuidv4());
45965 const mockedInclusions = properties._mock;
45966 let layout = properties;
45967
45968 if (mockedInclusions) {
45969 delete properties._mock;
45970 layout = extend({}, properties, mockedInclusions);
45971 }
45972
45973 return Promise.resolve(_objectSpread2({
45974 on: () => {},
45975 once: () => {},
45976 getLayout: () => Promise.resolve(layout),
45977 getProperties: () => Promise.resolve(properties),
45978 getEffectiveProperties: () => Promise.resolve(properties),
45979 id: properties.qInfo.qId
45980 }, properties));
45981 };
45982 }
45983 /**
45984 * Get value for a fixture property.
45985 *
45986 * The value is either static (e.g. pass a string / object / similar) or dynamic when passing a function.
45987 *
45988 * It falls back to the default value in case the fixture has no value specified.
45989 *
45990 * Example
45991 * ```js
45992 * const fixture = {
45993 * id: 'grid-chart-1',
45994 * };
45995 * const app = {
45996 * id: getValue(fixture.id, { defaultValue: 'object-id-${+Date.now()}'}),
45997 * }
45998 * ```
45999 *
46000 * @param {any} prop Fixture property. Either a fixed value (string / object / boolean / ...) or a function invoked when the value is needed.
46001 * @param {object} options Options.
46002 * @param {Array<any>} options.args Arguments used to evaluate the property value.
46003 * @param {any} options.defaultValue Default value in case not value is defined in fixture.
46004 * @returns The property value.
46005 */
46006
46007
46008 const getPropValue = function (prop) {
46009 let {
46010 args = [],
46011 defaultValue
46012 } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46013
46014 if (typeof prop === 'function') {
46015 return prop(...args);
46016 }
46017
46018 if (prop !== undefined) {
46019 return prop;
46020 }
46021
46022 return defaultValue;
46023 };
46024 /**
46025 * Get function for a fixture property.
46026 *
46027 * When the returned function is invoked it resolves the value - using `defaultValue` as fallback - and returns it. The value is returned as a promise if `option.usePromise` is `true`.
46028 *
46029 * Example:
46030 * ```js
46031 * const fixture = {
46032 * getHyperCubeData(path, page) {
46033 * return [ ... ];
46034 * }
46035 * }
46036 * const app = {
46037 * getHyperCubeData: getPropFn(fixture.getHyperCubeData, { defaultValue: [], usePromise: true })
46038 * };
46039 * ```
46040 *
46041 * @param {any} prop Fixture property. Either a fixed value (string / object / boolean / ...) or a function invoked when the value is needed.
46042 * @param {object} options Options.
46043 * @param {any} options.defaultValue Default value in case not value is defined in fixture.
46044 * @param {boolean} options.async When `true` the returns value is wrapped in a promise, otherwise the value is directly returned.
46045 * @param {number} options.number Delay before value is returned.
46046 * @returns A fixture property function
46047 */
46048
46049
46050 const getPropFn = function (prop) {
46051 let {
46052 defaultValue,
46053 async = true,
46054 delay = 0
46055 } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46056 return function () {
46057 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
46058 args[_key] = arguments[_key];
46059 }
46060
46061 const value = getPropValue(prop, {
46062 defaultValue,
46063 args
46064 });
46065 return async ? new Promise(resolve => {
46066 setTimeout(() => resolve(value), delay);
46067 }) : value;
46068 };
46069 };
46070
46071 const _excluded = ["id", "session"];
46072 /**
46073 * Properties on `getObject()` operating synchronously.
46074 */
46075
46076 const PROPS_SYNC = ['addListener', 'emit', 'listeners', 'on', 'once', 'removeAllListeners', 'removeListener', 'setMaxListerners'];
46077 /**
46078 * Is property operating asynchrously.
46079 * @param {string} name Property name.
46080 * @returns `true` if property is operating asynchrously, otherwise `false`.
46081 */
46082
46083 function isPropAsync(name) {
46084 return !PROPS_SYNC.includes(name);
46085 }
46086 /**
46087 * Get `qId` for visualization.
46088 * @param {object} genericObject Generic object describing behaviour of mock
46089 * @returns The `qId`, undefined if not present
46090 */
46091
46092
46093 function getQId(genericObject) {
46094 const layout = getPropValue(genericObject.getLayout);
46095 return layout.qInfo && layout.qInfo.qId;
46096 }
46097 /**
46098 * Create a mock of a generic object. Mandatory properties are added, functions returns async values where applicable etc.
46099 * @param {object} genericObject Generic object describing behaviour of mock
46100 * @param {EnigmaMockerOptions} options Options.
46101 * @returns The mocked object
46102 */
46103
46104
46105 function createMock(genericObject, options) {
46106 const qId = getQId(genericObject);
46107 const {
46108 delay
46109 } = options;
46110
46111 const {
46112 id,
46113 session
46114 } = genericObject,
46115 props = _objectWithoutProperties(genericObject, _excluded);
46116
46117 const mock = _objectSpread2({
46118 id: getPropValue(id, {
46119 defaultValue: "object - ".concat(+Date.now())
46120 }),
46121 session: getPropValue(session, {
46122 defaultValue: true
46123 }),
46124 on: () => {},
46125 once: () => {}
46126 }, Object.entries(props).reduce((fns, _ref) => {
46127 let [name, value] = _ref;
46128 return _objectSpread2(_objectSpread2({}, fns), {}, {
46129 [name]: getPropFn(value, {
46130 async: isPropAsync(name),
46131 delay
46132 })
46133 });
46134 }, {}));
46135
46136 return {
46137 [qId]: mock
46138 };
46139 }
46140 /**
46141 * Create mocked objects from list of generic objects.
46142 * @param {Array<object>} genericObjects Generic objects describing behaviour of mock
46143 * @param {EnigmaMockerOptions} options options
46144 * @returns Object with mocks where key is `qId` and value is the mocked object.
46145 */
46146
46147
46148 function createMocks(genericObjects, options) {
46149 return genericObjects.reduce((mocks, genericObject) => _objectSpread2(_objectSpread2({}, mocks), createMock(genericObject, options)), {});
46150 }
46151 /**
46152 * Validates if mandatory information is available.
46153 * @param {object} genericObject Generic object to validate
46154 * @throws {}
46155 * <ul>
46156 * <li>{Error} If getLayout is missing</li>
46157 * <li>{Error} If getLayout.qInfo.qId is missing</li>
46158 * </ul>
46159 */
46160
46161
46162 function validate(genericObject) {
46163 if (!genericObject.getLayout) {
46164 throw new Error('Generic object is missing "getLayout"');
46165 }
46166
46167 const qId = getQId(genericObject);
46168
46169 if (!qId) {
46170 throw new Error('Generic object is missing "qId" for path "getLayout().qInfo.qId"');
46171 }
46172 }
46173 /**
46174 * Creates mock of `getObject(id)` based on an array of generic objects.
46175 * @param {Array<object>} genericObjects Generic objects.
46176 * @param {EnigmaMockerOptions} options Options.
46177 * @returns Function to retrieve the mocked generic object with the corresponding id.
46178 */
46179
46180
46181 function GetObjectMock() {
46182 let genericObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
46183 let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46184
46185 if (!Array.isArray(genericObjects) || genericObjects.length === 0) {
46186 return () => {
46187 throw new Error('No "genericObjects" specified');
46188 };
46189 }
46190
46191 genericObjects.forEach(validate);
46192 const mocks = createMocks(genericObjects, options);
46193 return async id => Promise.resolve(mocks[id]);
46194 }
46195
46196 function GetAppLayoutMock() {
46197 return () => Promise.resolve({
46198 id: 'app-layout'
46199 });
46200 }
46201 /**
46202 * @interface EnigmaMockerOptions
46203 * @property {number} delay Simulate delay (in ms) for calls in enigma-mocker.
46204 */
46205
46206 /**
46207 * Mocks Engima app functionality. It accepts one / many generic objects as input argument and returns the mocked Enigma app. Each generic object represents one visulization and specifies how it behaves. For example, what layout to use the data to present.
46208 *
46209 * The generic object is represented with a Javascript object with a number of properties. The name of the property correlates to the name in the Enigma model for `app.getObject(id)`. For example, the property `getLayout` in the generic object is used to define `app.getObject(id).getLayout()`. Any property can be added to the fixture (just make sure it exists and behaves as in the Enigma model!).
46210 *
46211 * The value for each property is either fixed (string / boolean / number / object) or a function. Arguments are forwarded to the function to allow for greater flexibility. For example, this can be used to return different hypercube data when scrolling in the chart.
46212 *
46213 * @param {Array<object>} genericObjects Generic objects controling behaviour of visualizations.
46214 * @param {EnigmaMockerOptions} options Options
46215 * @returns {Promise<enigma.Doc>}
46216 * @example
46217 * const genericObject = {
46218 * getLayout() {
46219 * return {
46220 * qInfo: {
46221 * qId: 'qqj4zx',
46222 * qType: 'sn-grid-chart'
46223 * },
46224 * ...
46225 * }
46226 * },
46227 * getHyperCubeData(path, page) {
46228 * return [ ... ];
46229 * }
46230 * };
46231 * const app = await EnigmaMocker.fromGenericObjects([genericObject]);
46232 */
46233
46234
46235 var fromGenericObjects = function (genericObjects) {
46236 let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46237 const session = new SessionMock();
46238 const createSessionObject = new CreateSessionObjectMock();
46239 const getObject = new GetObjectMock(genericObjects, options);
46240 const getAppLayout = new GetAppLayoutMock();
46241 const app = {
46242 id: "app - ".concat(+Date.now()),
46243 session,
46244 createSessionObject,
46245 getObject,
46246 getAppLayout
46247 };
46248 return Promise.resolve(app);
46249 };
46250
46251 var index = {
46252 fromGenericObjects
46253 };
46254 return index;
46255 });
46256 })(enigmaMocker_dev);
46257
46258 (function (module) {
46259 module.exports = enigmaMocker_dev.exports;
46260 })(enigmaMocker);
46261
46262 var EnigmaMocker = /*@__PURE__*/getDefaultExportFromCjs(enigmaMocker.exports);
46263
46264 /* eslint no-underscore-dangle: 0 */
46265
46266 const __DO_NOT_USE__ = {
46267 generator: generatorFn,
46268 hook,
46269 theme,
46270 locale,
46271 EnigmaMocker
46272 };
46273
46274 exports.__DO_NOT_USE__ = __DO_NOT_USE__;
46275 exports.conversion = conversion;
46276 exports.embed = index;
46277 exports.onTakeSnapshot = onTakeSnapshot;
46278 exports.useAction = useAction;
46279 exports.useApp = useApp;
46280 exports.useAppLayout = useAppLayout;
46281 exports.useConstraints = useConstraints;
46282 exports.useDeviceType = useDeviceType;
46283 exports.useEffect = useEffect;
46284 exports.useElement = useElement;
46285 exports.useEmbed = useEmbed;
46286 exports.useGlobal = useGlobal;
46287 exports.useImperativeHandle = useImperativeHandle;
46288 exports.useKeyboard = useKeyboard;
46289 exports.useLayout = useLayout;
46290 exports.useMemo = useMemo;
46291 exports.useModel = useModel;
46292 exports.useOptions = useOptions;
46293 exports.usePlugins = usePlugins;
46294 exports.usePromise = usePromise;
46295 exports.useRect = useRect;
46296 exports.useRenderState = useRenderState;
46297 exports.useSelections = useSelections;
46298 exports.useStaleLayout = useStaleLayout;
46299 exports.useState = useState;
46300 exports.useTheme = useTheme;
46301 exports.useTranslator = useTranslator;
46302
46303 Object.defineProperty(exports, '__esModule', { value: true });
46304
46305}));
46306//# sourceMappingURL=stardust.dev.js.map