"use strict"; (self["webpackChunk_core_volunteer_app"] = self["webpackChunk_core_volunteer_app"] || []).push([["vendors-node_modules_resize-observer-polyfill_dist_ResizeObserver_es_js-node_modules_schedule-9e14aa"],{ /***/ "../../../node_modules/reselect/dist/reselect.mjs": /*!********************************************************!*\ !*** ../../../node_modules/reselect/dist/reselect.mjs ***! \********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ createSelector: () => (/* binding */ createSelector), /* harmony export */ createSelectorCreator: () => (/* binding */ createSelectorCreator), /* harmony export */ createStructuredSelector: () => (/* binding */ createStructuredSelector), /* harmony export */ lruMemoize: () => (/* binding */ lruMemoize), /* harmony export */ referenceEqualityCheck: () => (/* binding */ referenceEqualityCheck), /* harmony export */ setGlobalDevModeChecks: () => (/* binding */ setGlobalDevModeChecks), /* harmony export */ unstable_autotrackMemoize: () => (/* binding */ autotrackMemoize), /* harmony export */ weakMapMemoize: () => (/* binding */ weakMapMemoize) /* harmony export */ }); // src/devModeChecks/identityFunctionCheck.ts var runIdentityFunctionCheck = (resultFunc, inputSelectorsResults, outputSelectorResult) => { if (inputSelectorsResults.length === 1 && inputSelectorsResults[0] === outputSelectorResult) { let isInputSameAsOutput = false; try { const emptyObject = {}; if (resultFunc(emptyObject) === emptyObject) isInputSameAsOutput = true; } catch { } if (isInputSameAsOutput) { let stack = void 0; try { throw new Error(); } catch (e) { ; ({ stack } = e); } console.warn( "The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.", { stack } ); } } }; // src/devModeChecks/inputStabilityCheck.ts var runInputStabilityCheck = (inputSelectorResultsObject, options, inputSelectorArgs) => { const { memoize, memoizeOptions } = options; const { inputSelectorResults, inputSelectorResultsCopy } = inputSelectorResultsObject; const createAnEmptyObject = memoize(() => ({}), ...memoizeOptions); const areInputSelectorResultsEqual = createAnEmptyObject.apply(null, inputSelectorResults) === createAnEmptyObject.apply(null, inputSelectorResultsCopy); if (!areInputSelectorResultsEqual) { let stack = void 0; try { throw new Error(); } catch (e) { ; ({ stack } = e); } console.warn( "An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`", { arguments: inputSelectorArgs, firstInputs: inputSelectorResults, secondInputs: inputSelectorResultsCopy, stack } ); } }; // src/devModeChecks/setGlobalDevModeChecks.ts var globalDevModeChecks = { inputStabilityCheck: "once", identityFunctionCheck: "once" }; var setGlobalDevModeChecks = (devModeChecks) => { Object.assign(globalDevModeChecks, devModeChecks); }; // src/utils.ts var NOT_FOUND = /* @__PURE__ */ Symbol("NOT_FOUND"); function assertIsFunction(func, errorMessage = `expected a function, instead received ${typeof func}`) { if (typeof func !== "function") { throw new TypeError(errorMessage); } } function assertIsObject(object, errorMessage = `expected an object, instead received ${typeof object}`) { if (typeof object !== "object") { throw new TypeError(errorMessage); } } function assertIsArrayOfFunctions(array, errorMessage = `expected all items to be functions, instead received the following types: `) { if (!array.every((item) => typeof item === "function")) { const itemTypes = array.map( (item) => typeof item === "function" ? `function ${item.name || "unnamed"}()` : typeof item ).join(", "); throw new TypeError(`${errorMessage}[${itemTypes}]`); } } var ensureIsArray = (item) => { return Array.isArray(item) ? item : [item]; }; function getDependencies(createSelectorArgs) { const dependencies = Array.isArray(createSelectorArgs[0]) ? createSelectorArgs[0] : createSelectorArgs; assertIsArrayOfFunctions( dependencies, `createSelector expects all input-selectors to be functions, but received the following types: ` ); return dependencies; } function collectInputSelectorResults(dependencies, inputSelectorArgs) { const inputSelectorResults = []; const { length } = dependencies; for (let i = 0; i < length; i++) { inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs)); } return inputSelectorResults; } var getDevModeChecksExecutionInfo = (firstRun, devModeChecks) => { const { identityFunctionCheck, inputStabilityCheck } = { ...globalDevModeChecks, ...devModeChecks }; return { identityFunctionCheck: { shouldRun: identityFunctionCheck === "always" || identityFunctionCheck === "once" && firstRun, run: runIdentityFunctionCheck }, inputStabilityCheck: { shouldRun: inputStabilityCheck === "always" || inputStabilityCheck === "once" && firstRun, run: runInputStabilityCheck } }; }; // src/autotrackMemoize/autotracking.ts var $REVISION = 0; var CURRENT_TRACKER = null; var Cell = class { revision = $REVISION; _value; _lastValue; _isEqual = tripleEq; constructor(initialValue, isEqual = tripleEq) { this._value = this._lastValue = initialValue; this._isEqual = isEqual; } // Whenever a storage value is read, it'll add itself to the current tracker if // one exists, entangling its state with that cache. get value() { CURRENT_TRACKER?.add(this); return this._value; } // Whenever a storage value is updated, we bump the global revision clock, // assign the revision for this storage to the new value, _and_ we schedule a // rerender. This is important, and it's what makes autotracking _pull_ // based. We don't actively tell the caches which depend on the storage that // anything has happened. Instead, we recompute the caches when needed. set value(newValue) { if (this.value === newValue) return; this._value = newValue; this.revision = ++$REVISION; } }; function tripleEq(a, b) { return a === b; } var TrackingCache = class { _cachedValue; _cachedRevision = -1; _deps = []; hits = 0; fn; constructor(fn) { this.fn = fn; } clear() { this._cachedValue = void 0; this._cachedRevision = -1; this._deps = []; this.hits = 0; } get value() { if (this.revision > this._cachedRevision) { const { fn } = this; const currentTracker = /* @__PURE__ */ new Set(); const prevTracker = CURRENT_TRACKER; CURRENT_TRACKER = currentTracker; this._cachedValue = fn(); CURRENT_TRACKER = prevTracker; this.hits++; this._deps = Array.from(currentTracker); this._cachedRevision = this.revision; } CURRENT_TRACKER?.add(this); return this._cachedValue; } get revision() { return Math.max(...this._deps.map((d) => d.revision), 0); } }; function getValue(cell) { if (!(cell instanceof Cell)) { console.warn("Not a valid cell! ", cell); } return cell.value; } function setValue(storage, value) { if (!(storage instanceof Cell)) { throw new TypeError( "setValue must be passed a tracked store created with `createStorage`." ); } storage.value = storage._lastValue = value; } function createCell(initialValue, isEqual = tripleEq) { return new Cell(initialValue, isEqual); } function createCache(fn) { assertIsFunction( fn, "the first parameter to `createCache` must be a function" ); return new TrackingCache(fn); } // src/autotrackMemoize/tracking.ts var neverEq = (a, b) => false; function createTag() { return createCell(null, neverEq); } function dirtyTag(tag, value) { setValue(tag, value); } var consumeCollection = (node) => { let tag = node.collectionTag; if (tag === null) { tag = node.collectionTag = createTag(); } getValue(tag); }; var dirtyCollection = (node) => { const tag = node.collectionTag; if (tag !== null) { dirtyTag(tag, null); } }; // src/autotrackMemoize/proxy.ts var REDUX_PROXY_LABEL = Symbol(); var nextId = 0; var proto = Object.getPrototypeOf({}); var ObjectTreeNode = class { constructor(value) { this.value = value; this.value = value; this.tag.value = value; } proxy = new Proxy(this, objectProxyHandler); tag = createTag(); tags = {}; children = {}; collectionTag = null; id = nextId++; }; var objectProxyHandler = { get(node, key) { function calculateResult() { const { value } = node; const childValue = Reflect.get(value, key); if (typeof key === "symbol") { return childValue; } if (key in proto) { return childValue; } if (typeof childValue === "object" && childValue !== null) { let childNode = node.children[key]; if (childNode === void 0) { childNode = node.children[key] = createNode(childValue); } if (childNode.tag) { getValue(childNode.tag); } return childNode.proxy; } else { let tag = node.tags[key]; if (tag === void 0) { tag = node.tags[key] = createTag(); tag.value = childValue; } getValue(tag); return childValue; } } const res = calculateResult(); return res; }, ownKeys(node) { consumeCollection(node); return Reflect.ownKeys(node.value); }, getOwnPropertyDescriptor(node, prop) { return Reflect.getOwnPropertyDescriptor(node.value, prop); }, has(node, prop) { return Reflect.has(node.value, prop); } }; var ArrayTreeNode = class { constructor(value) { this.value = value; this.value = value; this.tag.value = value; } proxy = new Proxy([this], arrayProxyHandler); tag = createTag(); tags = {}; children = {}; collectionTag = null; id = nextId++; }; var arrayProxyHandler = { get([node], key) { if (key === "length") { consumeCollection(node); } return objectProxyHandler.get(node, key); }, ownKeys([node]) { return objectProxyHandler.ownKeys(node); }, getOwnPropertyDescriptor([node], prop) { return objectProxyHandler.getOwnPropertyDescriptor(node, prop); }, has([node], prop) { return objectProxyHandler.has(node, prop); } }; function createNode(value) { if (Array.isArray(value)) { return new ArrayTreeNode(value); } return new ObjectTreeNode(value); } function updateNode(node, newValue) { const { value, tags, children } = node; node.value = newValue; if (Array.isArray(value) && Array.isArray(newValue) && value.length !== newValue.length) { dirtyCollection(node); } else { if (value !== newValue) { let oldKeysSize = 0; let newKeysSize = 0; let anyKeysAdded = false; for (const _key in value) { oldKeysSize++; } for (const key in newValue) { newKeysSize++; if (!(key in value)) { anyKeysAdded = true; break; } } const isDifferent = anyKeysAdded || oldKeysSize !== newKeysSize; if (isDifferent) { dirtyCollection(node); } } } for (const key in tags) { const childValue = value[key]; const newChildValue = newValue[key]; if (childValue !== newChildValue) { dirtyCollection(node); dirtyTag(tags[key], newChildValue); } if (typeof newChildValue === "object" && newChildValue !== null) { delete tags[key]; } } for (const key in children) { const childNode = children[key]; const newChildValue = newValue[key]; const childValue = childNode.value; if (childValue === newChildValue) { continue; } else if (typeof newChildValue === "object" && newChildValue !== null) { updateNode(childNode, newChildValue); } else { deleteNode(childNode); delete children[key]; } } } function deleteNode(node) { if (node.tag) { dirtyTag(node.tag, null); } dirtyCollection(node); for (const key in node.tags) { dirtyTag(node.tags[key], null); } for (const key in node.children) { deleteNode(node.children[key]); } } // src/lruMemoize.ts function createSingletonCache(equals) { let entry; return { get(key) { if (entry && equals(entry.key, key)) { return entry.value; } return NOT_FOUND; }, put(key, value) { entry = { key, value }; }, getEntries() { return entry ? [entry] : []; }, clear() { entry = void 0; } }; } function createLruCache(maxSize, equals) { let entries = []; function get(key) { const cacheIndex = entries.findIndex((entry) => equals(key, entry.key)); if (cacheIndex > -1) { const entry = entries[cacheIndex]; if (cacheIndex > 0) { entries.splice(cacheIndex, 1); entries.unshift(entry); } return entry.value; } return NOT_FOUND; } function put(key, value) { if (get(key) === NOT_FOUND) { entries.unshift({ key, value }); if (entries.length > maxSize) { entries.pop(); } } } function getEntries() { return entries; } function clear() { entries = []; } return { get, put, getEntries, clear }; } var referenceEqualityCheck = (a, b) => a === b; function createCacheKeyComparator(equalityCheck) { return function areArgumentsShallowlyEqual(prev, next) { if (prev === null || next === null || prev.length !== next.length) { return false; } const { length } = prev; for (let i = 0; i < length; i++) { if (!equalityCheck(prev[i], next[i])) { return false; } } return true; }; } function lruMemoize(func, equalityCheckOrOptions) { const providedOptions = typeof equalityCheckOrOptions === "object" ? equalityCheckOrOptions : { equalityCheck: equalityCheckOrOptions }; const { equalityCheck = referenceEqualityCheck, maxSize = 1, resultEqualityCheck } = providedOptions; const comparator = createCacheKeyComparator(equalityCheck); let resultsCount = 0; const cache = maxSize <= 1 ? createSingletonCache(comparator) : createLruCache(maxSize, comparator); function memoized() { let value = cache.get(arguments); if (value === NOT_FOUND) { value = func.apply(null, arguments); resultsCount++; if (resultEqualityCheck) { const entries = cache.getEntries(); const matchingEntry = entries.find( (entry) => resultEqualityCheck(entry.value, value) ); if (matchingEntry) { value = matchingEntry.value; resultsCount !== 0 && resultsCount--; } } cache.put(arguments, value); } return value; } memoized.clearCache = () => { cache.clear(); memoized.resetResultsCount(); }; memoized.resultsCount = () => resultsCount; memoized.resetResultsCount = () => { resultsCount = 0; }; return memoized; } // src/autotrackMemoize/autotrackMemoize.ts function autotrackMemoize(func) { const node = createNode( [] ); let lastArgs = null; const shallowEqual = createCacheKeyComparator(referenceEqualityCheck); const cache = createCache(() => { const res = func.apply(null, node.proxy); return res; }); function memoized() { if (!shallowEqual(lastArgs, arguments)) { updateNode(node, arguments); lastArgs = arguments; } return cache.value; } memoized.clearCache = () => { return cache.clear(); }; return memoized; } // src/weakMapMemoize.ts var StrongRef = class { constructor(value) { this.value = value; } deref() { return this.value; } }; var Ref = typeof WeakRef !== "undefined" ? WeakRef : StrongRef; var UNTERMINATED = 0; var TERMINATED = 1; function createCacheNode() { return { s: UNTERMINATED, v: void 0, o: null, p: null }; } function weakMapMemoize(func, options = {}) { let fnNode = createCacheNode(); const { resultEqualityCheck } = options; let lastResult; let resultsCount = 0; function memoized() { let cacheNode = fnNode; const { length } = arguments; for (let i = 0, l = length; i < l; i++) { const arg = arguments[i]; if (typeof arg === "function" || typeof arg === "object" && arg !== null) { let objectCache = cacheNode.o; if (objectCache === null) { cacheNode.o = objectCache = /* @__PURE__ */ new WeakMap(); } const objectNode = objectCache.get(arg); if (objectNode === void 0) { cacheNode = createCacheNode(); objectCache.set(arg, cacheNode); } else { cacheNode = objectNode; } } else { let primitiveCache = cacheNode.p; if (primitiveCache === null) { cacheNode.p = primitiveCache = /* @__PURE__ */ new Map(); } const primitiveNode = primitiveCache.get(arg); if (primitiveNode === void 0) { cacheNode = createCacheNode(); primitiveCache.set(arg, cacheNode); } else { cacheNode = primitiveNode; } } } const terminatedNode = cacheNode; let result; if (cacheNode.s === TERMINATED) { result = cacheNode.v; } else { result = func.apply(null, arguments); resultsCount++; if (resultEqualityCheck) { const lastResultValue = lastResult?.deref?.() ?? lastResult; if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) { result = lastResultValue; resultsCount !== 0 && resultsCount--; } const needsWeakRef = typeof result === "object" && result !== null || typeof result === "function"; lastResult = needsWeakRef ? new Ref(result) : result; } } terminatedNode.s = TERMINATED; terminatedNode.v = result; return result; } memoized.clearCache = () => { fnNode = createCacheNode(); memoized.resetResultsCount(); }; memoized.resultsCount = () => resultsCount; memoized.resetResultsCount = () => { resultsCount = 0; }; return memoized; } // src/createSelectorCreator.ts function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) { const createSelectorCreatorOptions = typeof memoizeOrOptions === "function" ? { memoize: memoizeOrOptions, memoizeOptions: memoizeOptionsFromArgs } : memoizeOrOptions; const createSelector2 = (...createSelectorArgs) => { let recomputations = 0; let dependencyRecomputations = 0; let lastResult; let directlyPassedOptions = {}; let resultFunc = createSelectorArgs.pop(); if (typeof resultFunc === "object") { directlyPassedOptions = resultFunc; resultFunc = createSelectorArgs.pop(); } assertIsFunction( resultFunc, `createSelector expects an output function after the inputs, but received: [${typeof resultFunc}]` ); const combinedOptions = { ...createSelectorCreatorOptions, ...directlyPassedOptions }; const { memoize, memoizeOptions = [], argsMemoize = weakMapMemoize, argsMemoizeOptions = [], devModeChecks = {} } = combinedOptions; const finalMemoizeOptions = ensureIsArray(memoizeOptions); const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions); const dependencies = getDependencies(createSelectorArgs); const memoizedResultFunc = memoize(function recomputationWrapper() { recomputations++; return resultFunc.apply( null, arguments ); }, ...finalMemoizeOptions); let firstRun = true; const selector = argsMemoize(function dependenciesChecker() { dependencyRecomputations++; const inputSelectorResults = collectInputSelectorResults( dependencies, arguments ); lastResult = memoizedResultFunc.apply(null, inputSelectorResults); if (true) { const { identityFunctionCheck, inputStabilityCheck } = getDevModeChecksExecutionInfo(firstRun, devModeChecks); if (identityFunctionCheck.shouldRun) { identityFunctionCheck.run( resultFunc, inputSelectorResults, lastResult ); } if (inputStabilityCheck.shouldRun) { const inputSelectorResultsCopy = collectInputSelectorResults( dependencies, arguments ); inputStabilityCheck.run( { inputSelectorResults, inputSelectorResultsCopy }, { memoize, memoizeOptions: finalMemoizeOptions }, arguments ); } if (firstRun) firstRun = false; } return lastResult; }, ...finalArgsMemoizeOptions); return Object.assign(selector, { resultFunc, memoizedResultFunc, dependencies, dependencyRecomputations: () => dependencyRecomputations, resetDependencyRecomputations: () => { dependencyRecomputations = 0; }, lastResult: () => lastResult, recomputations: () => recomputations, resetRecomputations: () => { recomputations = 0; }, memoize, argsMemoize }); }; Object.assign(createSelector2, { withTypes: () => createSelector2 }); return createSelector2; } var createSelector = /* @__PURE__ */ createSelectorCreator(weakMapMemoize); // src/createStructuredSelector.ts var createStructuredSelector = Object.assign( (inputSelectorsObject, selectorCreator = createSelector) => { assertIsObject( inputSelectorsObject, `createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof inputSelectorsObject}` ); const inputSelectorKeys = Object.keys(inputSelectorsObject); const dependencies = inputSelectorKeys.map( (key) => inputSelectorsObject[key] ); const structuredSelector = selectorCreator( dependencies, (...inputSelectorResults) => { return inputSelectorResults.reduce((composition, value, index) => { composition[inputSelectorKeys[index]] = value; return composition; }, {}); } ); return structuredSelector; }, { withTypes: () => createStructuredSelector } ); //# sourceMappingURL=reselect.mjs.map /***/ }), /***/ "../../../node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js": /*!********************************************************************************!*\ !*** ../../../node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js ***! \********************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /** * A collection of shims that provide minimal functionality of the ES6 collections. * * These implementations are not meant to be used outside of the ResizeObserver * modules as they cover only a limited range of use cases. */ /* eslint-disable require-jsdoc, valid-jsdoc */ var MapShim = (function () { if (typeof Map !== 'undefined') { return Map; } /** * Returns index in provided array that matches the specified key. * * @param {Array} arr * @param {*} key * @returns {number} */ function getIndex(arr, key) { var result = -1; arr.some(function (entry, index) { if (entry[0] === key) { result = index; return true; } return false; }); return result; } return /** @class */ (function () { function class_1() { this.__entries__ = []; } Object.defineProperty(class_1.prototype, "size", { /** * @returns {boolean} */ get: function () { return this.__entries__.length; }, enumerable: true, configurable: true }); /** * @param {*} key * @returns {*} */ class_1.prototype.get = function (key) { var index = getIndex(this.__entries__, key); var entry = this.__entries__[index]; return entry && entry[1]; }; /** * @param {*} key * @param {*} value * @returns {void} */ class_1.prototype.set = function (key, value) { var index = getIndex(this.__entries__, key); if (~index) { this.__entries__[index][1] = value; } else { this.__entries__.push([key, value]); } }; /** * @param {*} key * @returns {void} */ class_1.prototype.delete = function (key) { var entries = this.__entries__; var index = getIndex(entries, key); if (~index) { entries.splice(index, 1); } }; /** * @param {*} key * @returns {void} */ class_1.prototype.has = function (key) { return !!~getIndex(this.__entries__, key); }; /** * @returns {void} */ class_1.prototype.clear = function () { this.__entries__.splice(0); }; /** * @param {Function} callback * @param {*} [ctx=null] * @returns {void} */ class_1.prototype.forEach = function (callback, ctx) { if (ctx === void 0) { ctx = null; } for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) { var entry = _a[_i]; callback.call(ctx, entry[1], entry[0]); } }; return class_1; }()); })(); /** * Detects whether window and document objects are available in current environment. */ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document; // Returns global object of a current environment. var global$1 = (function () { if (typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g.Math === Math) { return __webpack_require__.g; } if (typeof self !== 'undefined' && self.Math === Math) { return self; } if (typeof window !== 'undefined' && window.Math === Math) { return window; } // eslint-disable-next-line no-new-func return Function('return this')(); })(); /** * A shim for the requestAnimationFrame which falls back to the setTimeout if * first one is not supported. * * @returns {number} Requests' identifier. */ var requestAnimationFrame$1 = (function () { if (typeof requestAnimationFrame === 'function') { // It's required to use a bounded function because IE sometimes throws // an "Invalid calling object" error if rAF is invoked without the global // object on the left hand side. return requestAnimationFrame.bind(global$1); } return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); }; })(); // Defines minimum timeout before adding a trailing call. var trailingTimeout = 2; /** * Creates a wrapper function which ensures that provided callback will be * invoked only once during the specified delay period. * * @param {Function} callback - Function to be invoked after the delay period. * @param {number} delay - Delay after which to invoke callback. * @returns {Function} */ function throttle (callback, delay) { var leadingCall = false, trailingCall = false, lastCallTime = 0; /** * Invokes the original callback function and schedules new invocation if * the "proxy" was called during current request. * * @returns {void} */ function resolvePending() { if (leadingCall) { leadingCall = false; callback(); } if (trailingCall) { proxy(); } } /** * Callback invoked after the specified delay. It will further postpone * invocation of the original function delegating it to the * requestAnimationFrame. * * @returns {void} */ function timeoutCallback() { requestAnimationFrame$1(resolvePending); } /** * Schedules invocation of the original function. * * @returns {void} */ function proxy() { var timeStamp = Date.now(); if (leadingCall) { // Reject immediately following calls. if (timeStamp - lastCallTime < trailingTimeout) { return; } // Schedule new call to be in invoked when the pending one is resolved. // This is important for "transitions" which never actually start // immediately so there is a chance that we might miss one if change // happens amids the pending invocation. trailingCall = true; } else { leadingCall = true; trailingCall = false; setTimeout(timeoutCallback, delay); } lastCallTime = timeStamp; } return proxy; } // Minimum delay before invoking the update of observers. var REFRESH_DELAY = 20; // A list of substrings of CSS properties used to find transition events that // might affect dimensions of observed elements. var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight']; // Check if MutationObserver is available. var mutationObserverSupported = typeof MutationObserver !== 'undefined'; /** * Singleton controller class which handles updates of ResizeObserver instances. */ var ResizeObserverController = /** @class */ (function () { /** * Creates a new instance of ResizeObserverController. * * @private */ function ResizeObserverController() { /** * Indicates whether DOM listeners have been added. * * @private {boolean} */ this.connected_ = false; /** * Tells that controller has subscribed for Mutation Events. * * @private {boolean} */ this.mutationEventsAdded_ = false; /** * Keeps reference to the instance of MutationObserver. * * @private {MutationObserver} */ this.mutationsObserver_ = null; /** * A list of connected observers. * * @private {Array} */ this.observers_ = []; this.onTransitionEnd_ = this.onTransitionEnd_.bind(this); this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY); } /** * Adds observer to observers list. * * @param {ResizeObserverSPI} observer - Observer to be added. * @returns {void} */ ResizeObserverController.prototype.addObserver = function (observer) { if (!~this.observers_.indexOf(observer)) { this.observers_.push(observer); } // Add listeners if they haven't been added yet. if (!this.connected_) { this.connect_(); } }; /** * Removes observer from observers list. * * @param {ResizeObserverSPI} observer - Observer to be removed. * @returns {void} */ ResizeObserverController.prototype.removeObserver = function (observer) { var observers = this.observers_; var index = observers.indexOf(observer); // Remove observer if it's present in registry. if (~index) { observers.splice(index, 1); } // Remove listeners if controller has no connected observers. if (!observers.length && this.connected_) { this.disconnect_(); } }; /** * Invokes the update of observers. It will continue running updates insofar * it detects changes. * * @returns {void} */ ResizeObserverController.prototype.refresh = function () { var changesDetected = this.updateObservers_(); // Continue running updates if changes have been detected as there might // be future ones caused by CSS transitions. if (changesDetected) { this.refresh(); } }; /** * Updates every observer from observers list and notifies them of queued * entries. * * @private * @returns {boolean} Returns "true" if any observer has detected changes in * dimensions of it's elements. */ ResizeObserverController.prototype.updateObservers_ = function () { // Collect observers that have active observations. var activeObservers = this.observers_.filter(function (observer) { return observer.gatherActive(), observer.hasActive(); }); // Deliver notifications in a separate cycle in order to avoid any // collisions between observers, e.g. when multiple instances of // ResizeObserver are tracking the same element and the callback of one // of them changes content dimensions of the observed target. Sometimes // this may result in notifications being blocked for the rest of observers. activeObservers.forEach(function (observer) { return observer.broadcastActive(); }); return activeObservers.length > 0; }; /** * Initializes DOM listeners. * * @private * @returns {void} */ ResizeObserverController.prototype.connect_ = function () { // Do nothing if running in a non-browser environment or if listeners // have been already added. if (!isBrowser || this.connected_) { return; } // Subscription to the "Transitionend" event is used as a workaround for // delayed transitions. This way it's possible to capture at least the // final state of an element. document.addEventListener('transitionend', this.onTransitionEnd_); window.addEventListener('resize', this.refresh); if (mutationObserverSupported) { this.mutationsObserver_ = new MutationObserver(this.refresh); this.mutationsObserver_.observe(document, { attributes: true, childList: true, characterData: true, subtree: true }); } else { document.addEventListener('DOMSubtreeModified', this.refresh); this.mutationEventsAdded_ = true; } this.connected_ = true; }; /** * Removes DOM listeners. * * @private * @returns {void} */ ResizeObserverController.prototype.disconnect_ = function () { // Do nothing if running in a non-browser environment or if listeners // have been already removed. if (!isBrowser || !this.connected_) { return; } document.removeEventListener('transitionend', this.onTransitionEnd_); window.removeEventListener('resize', this.refresh); if (this.mutationsObserver_) { this.mutationsObserver_.disconnect(); } if (this.mutationEventsAdded_) { document.removeEventListener('DOMSubtreeModified', this.refresh); } this.mutationsObserver_ = null; this.mutationEventsAdded_ = false; this.connected_ = false; }; /** * "Transitionend" event handler. * * @private * @param {TransitionEvent} event * @returns {void} */ ResizeObserverController.prototype.onTransitionEnd_ = function (_a) { var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b; // Detect whether transition may affect dimensions of an element. var isReflowProperty = transitionKeys.some(function (key) { return !!~propertyName.indexOf(key); }); if (isReflowProperty) { this.refresh(); } }; /** * Returns instance of the ResizeObserverController. * * @returns {ResizeObserverController} */ ResizeObserverController.getInstance = function () { if (!this.instance_) { this.instance_ = new ResizeObserverController(); } return this.instance_; }; /** * Holds reference to the controller's instance. * * @private {ResizeObserverController} */ ResizeObserverController.instance_ = null; return ResizeObserverController; }()); /** * Defines non-writable/enumerable properties of the provided target object. * * @param {Object} target - Object for which to define properties. * @param {Object} props - Properties to be defined. * @returns {Object} Target object. */ var defineConfigurable = (function (target, props) { for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) { var key = _a[_i]; Object.defineProperty(target, key, { value: props[key], enumerable: false, writable: false, configurable: true }); } return target; }); /** * Returns the global object associated with provided element. * * @param {Object} target * @returns {Object} */ var getWindowOf = (function (target) { // Assume that the element is an instance of Node, which means that it // has the "ownerDocument" property from which we can retrieve a // corresponding global object. var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView; // Return the local global object if it's not possible extract one from // provided element. return ownerGlobal || global$1; }); // Placeholder of an empty content rectangle. var emptyRect = createRectInit(0, 0, 0, 0); /** * Converts provided string to a number. * * @param {number|string} value * @returns {number} */ function toFloat(value) { return parseFloat(value) || 0; } /** * Extracts borders size from provided styles. * * @param {CSSStyleDeclaration} styles * @param {...string} positions - Borders positions (top, right, ...) * @returns {number} */ function getBordersSize(styles) { var positions = []; for (var _i = 1; _i < arguments.length; _i++) { positions[_i - 1] = arguments[_i]; } return positions.reduce(function (size, position) { var value = styles['border-' + position + '-width']; return size + toFloat(value); }, 0); } /** * Extracts paddings sizes from provided styles. * * @param {CSSStyleDeclaration} styles * @returns {Object} Paddings box. */ function getPaddings(styles) { var positions = ['top', 'right', 'bottom', 'left']; var paddings = {}; for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) { var position = positions_1[_i]; var value = styles['padding-' + position]; paddings[position] = toFloat(value); } return paddings; } /** * Calculates content rectangle of provided SVG element. * * @param {SVGGraphicsElement} target - Element content rectangle of which needs * to be calculated. * @returns {DOMRectInit} */ function getSVGContentRect(target) { var bbox = target.getBBox(); return createRectInit(0, 0, bbox.width, bbox.height); } /** * Calculates content rectangle of provided HTMLElement. * * @param {HTMLElement} target - Element for which to calculate the content rectangle. * @returns {DOMRectInit} */ function getHTMLElementContentRect(target) { // Client width & height properties can't be // used exclusively as they provide rounded values. var clientWidth = target.clientWidth, clientHeight = target.clientHeight; // By this condition we can catch all non-replaced inline, hidden and // detached elements. Though elements with width & height properties less // than 0.5 will be discarded as well. // // Without it we would need to implement separate methods for each of // those cases and it's not possible to perform a precise and performance // effective test for hidden elements. E.g. even jQuery's ':visible' filter // gives wrong results for elements with width & height less than 0.5. if (!clientWidth && !clientHeight) { return emptyRect; } var styles = getWindowOf(target).getComputedStyle(target); var paddings = getPaddings(styles); var horizPad = paddings.left + paddings.right; var vertPad = paddings.top + paddings.bottom; // Computed styles of width & height are being used because they are the // only dimensions available to JS that contain non-rounded values. It could // be possible to utilize the getBoundingClientRect if only it's data wasn't // affected by CSS transformations let alone paddings, borders and scroll bars. var width = toFloat(styles.width), height = toFloat(styles.height); // Width & height include paddings and borders when the 'border-box' box // model is applied (except for IE). if (styles.boxSizing === 'border-box') { // Following conditions are required to handle Internet Explorer which // doesn't include paddings and borders to computed CSS dimensions. // // We can say that if CSS dimensions + paddings are equal to the "client" // properties then it's either IE, and thus we don't need to subtract // anything, or an element merely doesn't have paddings/borders styles. if (Math.round(width + horizPad) !== clientWidth) { width -= getBordersSize(styles, 'left', 'right') + horizPad; } if (Math.round(height + vertPad) !== clientHeight) { height -= getBordersSize(styles, 'top', 'bottom') + vertPad; } } // Following steps can't be applied to the document's root element as its // client[Width/Height] properties represent viewport area of the window. // Besides, it's as well not necessary as the itself neither has // rendered scroll bars nor it can be clipped. if (!isDocumentElement(target)) { // In some browsers (only in Firefox, actually) CSS width & height // include scroll bars size which can be removed at this step as scroll // bars are the only difference between rounded dimensions + paddings // and "client" properties, though that is not always true in Chrome. var vertScrollbar = Math.round(width + horizPad) - clientWidth; var horizScrollbar = Math.round(height + vertPad) - clientHeight; // Chrome has a rather weird rounding of "client" properties. // E.g. for an element with content width of 314.2px it sometimes gives // the client width of 315px and for the width of 314.7px it may give // 314px. And it doesn't happen all the time. So just ignore this delta // as a non-relevant. if (Math.abs(vertScrollbar) !== 1) { width -= vertScrollbar; } if (Math.abs(horizScrollbar) !== 1) { height -= horizScrollbar; } } return createRectInit(paddings.left, paddings.top, width, height); } /** * Checks whether provided element is an instance of the SVGGraphicsElement. * * @param {Element} target - Element to be checked. * @returns {boolean} */ var isSVGGraphicsElement = (function () { // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement // interface. if (typeof SVGGraphicsElement !== 'undefined') { return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; }; } // If it's so, then check that element is at least an instance of the // SVGElement and that it has the "getBBox" method. // eslint-disable-next-line no-extra-parens return function (target) { return (target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === 'function'); }; })(); /** * Checks whether provided element is a document element (). * * @param {Element} target - Element to be checked. * @returns {boolean} */ function isDocumentElement(target) { return target === getWindowOf(target).document.documentElement; } /** * Calculates an appropriate content rectangle for provided html or svg element. * * @param {Element} target - Element content rectangle of which needs to be calculated. * @returns {DOMRectInit} */ function getContentRect(target) { if (!isBrowser) { return emptyRect; } if (isSVGGraphicsElement(target)) { return getSVGContentRect(target); } return getHTMLElementContentRect(target); } /** * Creates rectangle with an interface of the DOMRectReadOnly. * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly * * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions. * @returns {DOMRectReadOnly} */ function createReadOnlyRect(_a) { var x = _a.x, y = _a.y, width = _a.width, height = _a.height; // If DOMRectReadOnly is available use it as a prototype for the rectangle. var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object; var rect = Object.create(Constr.prototype); // Rectangle's properties are not writable and non-enumerable. defineConfigurable(rect, { x: x, y: y, width: width, height: height, top: y, right: x + width, bottom: height + y, left: x }); return rect; } /** * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates. * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit * * @param {number} x - X coordinate. * @param {number} y - Y coordinate. * @param {number} width - Rectangle's width. * @param {number} height - Rectangle's height. * @returns {DOMRectInit} */ function createRectInit(x, y, width, height) { return { x: x, y: y, width: width, height: height }; } /** * Class that is responsible for computations of the content rectangle of * provided DOM element and for keeping track of it's changes. */ var ResizeObservation = /** @class */ (function () { /** * Creates an instance of ResizeObservation. * * @param {Element} target - Element to be observed. */ function ResizeObservation(target) { /** * Broadcasted width of content rectangle. * * @type {number} */ this.broadcastWidth = 0; /** * Broadcasted height of content rectangle. * * @type {number} */ this.broadcastHeight = 0; /** * Reference to the last observed content rectangle. * * @private {DOMRectInit} */ this.contentRect_ = createRectInit(0, 0, 0, 0); this.target = target; } /** * Updates content rectangle and tells whether it's width or height properties * have changed since the last broadcast. * * @returns {boolean} */ ResizeObservation.prototype.isActive = function () { var rect = getContentRect(this.target); this.contentRect_ = rect; return (rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight); }; /** * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data * from the corresponding properties of the last observed content rectangle. * * @returns {DOMRectInit} Last observed content rectangle. */ ResizeObservation.prototype.broadcastRect = function () { var rect = this.contentRect_; this.broadcastWidth = rect.width; this.broadcastHeight = rect.height; return rect; }; return ResizeObservation; }()); var ResizeObserverEntry = /** @class */ (function () { /** * Creates an instance of ResizeObserverEntry. * * @param {Element} target - Element that is being observed. * @param {DOMRectInit} rectInit - Data of the element's content rectangle. */ function ResizeObserverEntry(target, rectInit) { var contentRect = createReadOnlyRect(rectInit); // According to the specification following properties are not writable // and are also not enumerable in the native implementation. // // Property accessors are not being used as they'd require to define a // private WeakMap storage which may cause memory leaks in browsers that // don't support this type of collections. defineConfigurable(this, { target: target, contentRect: contentRect }); } return ResizeObserverEntry; }()); var ResizeObserverSPI = /** @class */ (function () { /** * Creates a new instance of ResizeObserver. * * @param {ResizeObserverCallback} callback - Callback function that is invoked * when one of the observed elements changes it's content dimensions. * @param {ResizeObserverController} controller - Controller instance which * is responsible for the updates of observer. * @param {ResizeObserver} callbackCtx - Reference to the public * ResizeObserver instance which will be passed to callback function. */ function ResizeObserverSPI(callback, controller, callbackCtx) { /** * Collection of resize observations that have detected changes in dimensions * of elements. * * @private {Array} */ this.activeObservations_ = []; /** * Registry of the ResizeObservation instances. * * @private {Map} */ this.observations_ = new MapShim(); if (typeof callback !== 'function') { throw new TypeError('The callback provided as parameter 1 is not a function.'); } this.callback_ = callback; this.controller_ = controller; this.callbackCtx_ = callbackCtx; } /** * Starts observing provided element. * * @param {Element} target - Element to be observed. * @returns {void} */ ResizeObserverSPI.prototype.observe = function (target) { if (!arguments.length) { throw new TypeError('1 argument required, but only 0 present.'); } // Do nothing if current environment doesn't have the Element interface. if (typeof Element === 'undefined' || !(Element instanceof Object)) { return; } if (!(target instanceof getWindowOf(target).Element)) { throw new TypeError('parameter 1 is not of type "Element".'); } var observations = this.observations_; // Do nothing if element is already being observed. if (observations.has(target)) { return; } observations.set(target, new ResizeObservation(target)); this.controller_.addObserver(this); // Force the update of observations. this.controller_.refresh(); }; /** * Stops observing provided element. * * @param {Element} target - Element to stop observing. * @returns {void} */ ResizeObserverSPI.prototype.unobserve = function (target) { if (!arguments.length) { throw new TypeError('1 argument required, but only 0 present.'); } // Do nothing if current environment doesn't have the Element interface. if (typeof Element === 'undefined' || !(Element instanceof Object)) { return; } if (!(target instanceof getWindowOf(target).Element)) { throw new TypeError('parameter 1 is not of type "Element".'); } var observations = this.observations_; // Do nothing if element is not being observed. if (!observations.has(target)) { return; } observations.delete(target); if (!observations.size) { this.controller_.removeObserver(this); } }; /** * Stops observing all elements. * * @returns {void} */ ResizeObserverSPI.prototype.disconnect = function () { this.clearActive(); this.observations_.clear(); this.controller_.removeObserver(this); }; /** * Collects observation instances the associated element of which has changed * it's content rectangle. * * @returns {void} */ ResizeObserverSPI.prototype.gatherActive = function () { var _this = this; this.clearActive(); this.observations_.forEach(function (observation) { if (observation.isActive()) { _this.activeObservations_.push(observation); } }); }; /** * Invokes initial callback function with a list of ResizeObserverEntry * instances collected from active resize observations. * * @returns {void} */ ResizeObserverSPI.prototype.broadcastActive = function () { // Do nothing if observer doesn't have active observations. if (!this.hasActive()) { return; } var ctx = this.callbackCtx_; // Create ResizeObserverEntry instance for every active observation. var entries = this.activeObservations_.map(function (observation) { return new ResizeObserverEntry(observation.target, observation.broadcastRect()); }); this.callback_.call(ctx, entries, ctx); this.clearActive(); }; /** * Clears the collection of active observations. * * @returns {void} */ ResizeObserverSPI.prototype.clearActive = function () { this.activeObservations_.splice(0); }; /** * Tells whether observer has active observations. * * @returns {boolean} */ ResizeObserverSPI.prototype.hasActive = function () { return this.activeObservations_.length > 0; }; return ResizeObserverSPI; }()); // Registry of internal observers. If WeakMap is not available use current shim // for the Map collection as it has all required methods and because WeakMap // can't be fully polyfilled anyway. var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim(); /** * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation * exposing only those methods and properties that are defined in the spec. */ var ResizeObserver = /** @class */ (function () { /** * Creates a new instance of ResizeObserver. * * @param {ResizeObserverCallback} callback - Callback that is invoked when * dimensions of the observed elements change. */ function ResizeObserver(callback) { if (!(this instanceof ResizeObserver)) { throw new TypeError('Cannot call a class as a function.'); } if (!arguments.length) { throw new TypeError('1 argument required, but only 0 present.'); } var controller = ResizeObserverController.getInstance(); var observer = new ResizeObserverSPI(callback, controller, this); observers.set(this, observer); } return ResizeObserver; }()); // Expose public methods of ResizeObserver. [ 'observe', 'unobserve', 'disconnect' ].forEach(function (method) { ResizeObserver.prototype[method] = function () { var _a; return (_a = observers.get(this))[method].apply(_a, arguments); }; }); var index = (function () { // Export existing implementation if available. if (typeof global$1.ResizeObserver !== 'undefined') { return global$1.ResizeObserver; } return ResizeObserver; })(); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (index); /***/ }), /***/ "../../../node_modules/scheduler/cjs/scheduler.development.js": /*!********************************************************************!*\ !*** ../../../node_modules/scheduler/cjs/scheduler.development.js ***! \********************************************************************/ /***/ ((__unused_webpack_module, exports) => { /** * @license React * scheduler.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (true) { (function() { 'use strict'; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === 'function' ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } var enableSchedulerDebugging = false; var enableProfiling = false; var frameYieldMs = 5; function push(heap, node) { var index = heap.length; heap.push(node); siftUp(heap, node, index); } function peek(heap) { return heap.length === 0 ? null : heap[0]; } function pop(heap) { if (heap.length === 0) { return null; } var first = heap[0]; var last = heap.pop(); if (last !== first) { heap[0] = last; siftDown(heap, last, 0); } return first; } function siftUp(heap, node, i) { var index = i; while (index > 0) { var parentIndex = index - 1 >>> 1; var parent = heap[parentIndex]; if (compare(parent, node) > 0) { // The parent is larger. Swap positions. heap[parentIndex] = node; heap[index] = parent; index = parentIndex; } else { // The parent is smaller. Exit. return; } } } function siftDown(heap, node, i) { var index = i; var length = heap.length; var halfLength = length >>> 1; while (index < halfLength) { var leftIndex = (index + 1) * 2 - 1; var left = heap[leftIndex]; var rightIndex = leftIndex + 1; var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. if (compare(left, node) < 0) { if (rightIndex < length && compare(right, left) < 0) { heap[index] = right; heap[rightIndex] = node; index = rightIndex; } else { heap[index] = left; heap[leftIndex] = node; index = leftIndex; } } else if (rightIndex < length && compare(right, node) < 0) { heap[index] = right; heap[rightIndex] = node; index = rightIndex; } else { // Neither child is smaller. Exit. return; } } } function compare(a, b) { // Compare sort index first, then task id. var diff = a.sortIndex - b.sortIndex; return diff !== 0 ? diff : a.id - b.id; } // TODO: Use symbols? var ImmediatePriority = 1; var UserBlockingPriority = 2; var NormalPriority = 3; var LowPriority = 4; var IdlePriority = 5; function markTaskErrored(task, ms) { } /* eslint-disable no-var */ var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function'; if (hasPerformanceNow) { var localPerformance = performance; exports.unstable_now = function () { return localPerformance.now(); }; } else { var localDate = Date; var initialTime = localDate.now(); exports.unstable_now = function () { return localDate.now() - initialTime; }; } // Max 31 bit integer. The max integer size in V8 for 32-bit systems. // Math.pow(2, 30) - 1 // 0b111111111111111111111111111111 var maxSigned31BitInt = 1073741823; // Times out immediately var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out var USER_BLOCKING_PRIORITY_TIMEOUT = 250; var NORMAL_PRIORITY_TIMEOUT = 5000; var LOW_PRIORITY_TIMEOUT = 10000; // Never times out var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap var taskQueue = []; var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. var currentTask = null; var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance. var isPerformingWork = false; var isHostCallbackScheduled = false; var isHostTimeoutScheduled = false; // Capture local references to native APIs, in case a polyfill overrides them. var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null; var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null; var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom var isInputPending = typeof navigator !== 'undefined' && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null; function advanceTimers(currentTime) { // Check for tasks that are no longer delayed and add them to the queue. var timer = peek(timerQueue); while (timer !== null) { if (timer.callback === null) { // Timer was cancelled. pop(timerQueue); } else if (timer.startTime <= currentTime) { // Timer fired. Transfer to the task queue. pop(timerQueue); timer.sortIndex = timer.expirationTime; push(taskQueue, timer); } else { // Remaining timers are pending. return; } timer = peek(timerQueue); } } function handleTimeout(currentTime) { isHostTimeoutScheduled = false; advanceTimers(currentTime); if (!isHostCallbackScheduled) { if (peek(taskQueue) !== null) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } else { var firstTimer = peek(timerQueue); if (firstTimer !== null) { requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); } } } } function flushWork(hasTimeRemaining, initialTime) { isHostCallbackScheduled = false; if (isHostTimeoutScheduled) { // We scheduled a timeout but it's no longer needed. Cancel it. isHostTimeoutScheduled = false; cancelHostTimeout(); } isPerformingWork = true; var previousPriorityLevel = currentPriorityLevel; try { if (enableProfiling) { try { return workLoop(hasTimeRemaining, initialTime); } catch (error) { if (currentTask !== null) { var currentTime = exports.unstable_now(); markTaskErrored(currentTask, currentTime); currentTask.isQueued = false; } throw error; } } else { // No catch in prod code path. return workLoop(hasTimeRemaining, initialTime); } } finally { currentTask = null; currentPriorityLevel = previousPriorityLevel; isPerformingWork = false; } } function workLoop(hasTimeRemaining, initialTime) { var currentTime = initialTime; advanceTimers(currentTime); currentTask = peek(taskQueue); while (currentTask !== null && !(enableSchedulerDebugging )) { if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { // This currentTask hasn't expired, and we've reached the deadline. break; } var callback = currentTask.callback; if (typeof callback === 'function') { currentTask.callback = null; currentPriorityLevel = currentTask.priorityLevel; var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; var continuationCallback = callback(didUserCallbackTimeout); currentTime = exports.unstable_now(); if (typeof continuationCallback === 'function') { currentTask.callback = continuationCallback; } else { if (currentTask === peek(taskQueue)) { pop(taskQueue); } } advanceTimers(currentTime); } else { pop(taskQueue); } currentTask = peek(taskQueue); } // Return whether there's additional work if (currentTask !== null) { return true; } else { var firstTimer = peek(timerQueue); if (firstTimer !== null) { requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); } return false; } } function unstable_runWithPriority(priorityLevel, eventHandler) { switch (priorityLevel) { case ImmediatePriority: case UserBlockingPriority: case NormalPriority: case LowPriority: case IdlePriority: break; default: priorityLevel = NormalPriority; } var previousPriorityLevel = currentPriorityLevel; currentPriorityLevel = priorityLevel; try { return eventHandler(); } finally { currentPriorityLevel = previousPriorityLevel; } } function unstable_next(eventHandler) { var priorityLevel; switch (currentPriorityLevel) { case ImmediatePriority: case UserBlockingPriority: case NormalPriority: // Shift down to normal priority priorityLevel = NormalPriority; break; default: // Anything lower than normal priority should remain at the current level. priorityLevel = currentPriorityLevel; break; } var previousPriorityLevel = currentPriorityLevel; currentPriorityLevel = priorityLevel; try { return eventHandler(); } finally { currentPriorityLevel = previousPriorityLevel; } } function unstable_wrapCallback(callback) { var parentPriorityLevel = currentPriorityLevel; return function () { // This is a fork of runWithPriority, inlined for performance. var previousPriorityLevel = currentPriorityLevel; currentPriorityLevel = parentPriorityLevel; try { return callback.apply(this, arguments); } finally { currentPriorityLevel = previousPriorityLevel; } }; } function unstable_scheduleCallback(priorityLevel, callback, options) { var currentTime = exports.unstable_now(); var startTime; if (typeof options === 'object' && options !== null) { var delay = options.delay; if (typeof delay === 'number' && delay > 0) { startTime = currentTime + delay; } else { startTime = currentTime; } } else { startTime = currentTime; } var timeout; switch (priorityLevel) { case ImmediatePriority: timeout = IMMEDIATE_PRIORITY_TIMEOUT; break; case UserBlockingPriority: timeout = USER_BLOCKING_PRIORITY_TIMEOUT; break; case IdlePriority: timeout = IDLE_PRIORITY_TIMEOUT; break; case LowPriority: timeout = LOW_PRIORITY_TIMEOUT; break; case NormalPriority: default: timeout = NORMAL_PRIORITY_TIMEOUT; break; } var expirationTime = startTime + timeout; var newTask = { id: taskIdCounter++, callback: callback, priorityLevel: priorityLevel, startTime: startTime, expirationTime: expirationTime, sortIndex: -1 }; if (startTime > currentTime) { // This is a delayed task. newTask.sortIndex = startTime; push(timerQueue, newTask); if (peek(taskQueue) === null && newTask === peek(timerQueue)) { // All tasks are delayed, and this is the task with the earliest delay. if (isHostTimeoutScheduled) { // Cancel an existing timeout. cancelHostTimeout(); } else { isHostTimeoutScheduled = true; } // Schedule a timeout. requestHostTimeout(handleTimeout, startTime - currentTime); } } else { newTask.sortIndex = expirationTime; push(taskQueue, newTask); // wait until the next time we yield. if (!isHostCallbackScheduled && !isPerformingWork) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } } return newTask; } function unstable_pauseExecution() { } function unstable_continueExecution() { if (!isHostCallbackScheduled && !isPerformingWork) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } } function unstable_getFirstCallbackNode() { return peek(taskQueue); } function unstable_cancelCallback(task) { // remove from the queue because you can't remove arbitrary nodes from an // array based heap, only the first one.) task.callback = null; } function unstable_getCurrentPriorityLevel() { return currentPriorityLevel; } var isMessageLoopRunning = false; var scheduledHostCallback = null; var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main // thread, like user events. By default, it yields multiple times per frame. // It does not attempt to align with frame boundaries, since most tasks don't // need to be frame aligned; for those that do, use requestAnimationFrame. var frameInterval = frameYieldMs; var startTime = -1; function shouldYieldToHost() { var timeElapsed = exports.unstable_now() - startTime; if (timeElapsed < frameInterval) { // The main thread has only been blocked for a really short amount of time; // smaller than a single frame. Don't yield yet. return false; } // The main thread has been blocked for a non-negligible amount of time. We return true; } function requestPaint() { } function forceFrameRate(fps) { if (fps < 0 || fps > 125) { // Using console['error'] to evade Babel and ESLint console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported'); return; } if (fps > 0) { frameInterval = Math.floor(1000 / fps); } else { // reset the framerate frameInterval = frameYieldMs; } } var performWorkUntilDeadline = function () { if (scheduledHostCallback !== null) { var currentTime = exports.unstable_now(); // Keep track of the start time so we can measure how long the main thread // has been blocked. startTime = currentTime; var hasTimeRemaining = true; // If a scheduler task throws, exit the current browser task so the // error can be observed. // // Intentionally not using a try-catch, since that makes some debugging // techniques harder. Instead, if `scheduledHostCallback` errors, then // `hasMoreWork` will remain true, and we'll continue the work loop. var hasMoreWork = true; try { hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); } finally { if (hasMoreWork) { // If there's more work, schedule the next message event at the end // of the preceding one. schedulePerformWorkUntilDeadline(); } else { isMessageLoopRunning = false; scheduledHostCallback = null; } } } else { isMessageLoopRunning = false; } // Yielding to the browser will give it a chance to paint, so we can }; var schedulePerformWorkUntilDeadline; if (typeof localSetImmediate === 'function') { // Node.js and old IE. // There's a few reasons for why we prefer setImmediate. // // Unlike MessageChannel, it doesn't prevent a Node.js process from exiting. // (Even though this is a DOM fork of the Scheduler, you could get here // with a mix of Node.js 15+, which has a MessageChannel, and jsdom.) // https://github.com/facebook/react/issues/20756 // // But also, it runs earlier which is the semantic we want. // If other browsers ever implement it, it's better to use it. // Although both of these would be inferior to native scheduling. schedulePerformWorkUntilDeadline = function () { localSetImmediate(performWorkUntilDeadline); }; } else if (typeof MessageChannel !== 'undefined') { // DOM and Worker environments. // We prefer MessageChannel because of the 4ms setTimeout clamping. var channel = new MessageChannel(); var port = channel.port2; channel.port1.onmessage = performWorkUntilDeadline; schedulePerformWorkUntilDeadline = function () { port.postMessage(null); }; } else { // We should only fallback here in non-browser environments. schedulePerformWorkUntilDeadline = function () { localSetTimeout(performWorkUntilDeadline, 0); }; } function requestHostCallback(callback) { scheduledHostCallback = callback; if (!isMessageLoopRunning) { isMessageLoopRunning = true; schedulePerformWorkUntilDeadline(); } } function requestHostTimeout(callback, ms) { taskTimeoutID = localSetTimeout(function () { callback(exports.unstable_now()); }, ms); } function cancelHostTimeout() { localClearTimeout(taskTimeoutID); taskTimeoutID = -1; } var unstable_requestPaint = requestPaint; var unstable_Profiling = null; exports.unstable_IdlePriority = IdlePriority; exports.unstable_ImmediatePriority = ImmediatePriority; exports.unstable_LowPriority = LowPriority; exports.unstable_NormalPriority = NormalPriority; exports.unstable_Profiling = unstable_Profiling; exports.unstable_UserBlockingPriority = UserBlockingPriority; exports.unstable_cancelCallback = unstable_cancelCallback; exports.unstable_continueExecution = unstable_continueExecution; exports.unstable_forceFrameRate = forceFrameRate; exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; exports.unstable_next = unstable_next; exports.unstable_pauseExecution = unstable_pauseExecution; exports.unstable_requestPaint = unstable_requestPaint; exports.unstable_runWithPriority = unstable_runWithPriority; exports.unstable_scheduleCallback = unstable_scheduleCallback; exports.unstable_shouldYield = shouldYieldToHost; exports.unstable_wrapCallback = unstable_wrapCallback; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === 'function' ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); } })(); } /***/ }), /***/ "../../../node_modules/scheduler/index.js": /*!************************************************!*\ !*** ../../../node_modules/scheduler/index.js ***! \************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { if (false) // removed by dead control flow {} else { module.exports = __webpack_require__(/*! ./cjs/scheduler.development.js */ "../../../node_modules/scheduler/cjs/scheduler.development.js"); } /***/ }), /***/ "../../../node_modules/scroll-into-view-if-needed/dist/index.cjs": /*!***********************************************************************!*\ !*** ../../../node_modules/scroll-into-view-if-needed/dist/index.cjs ***! \***********************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var t=__webpack_require__(/*! compute-scroll-into-view */ "../../../node_modules/compute-scroll-into-view/dist/index.cjs");const o=t=>!1===t?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&0!==Object.keys(t).length)(t)?t:{block:"start",inline:"nearest"};module.exports=function(e,r){if(!e.isConnected||!(t=>{let o=t;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(e))return;const n=(t=>{const o=window.getComputedStyle(t);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(e);if((t=>"object"==typeof t&&"function"==typeof t.behavior)(r))return r.behavior(t.compute(e,r));const l="boolean"==typeof r||null==r?void 0:r.behavior;for(const{el:a,top:i,left:c}of t.compute(e,o(r))){const t=i-n.top+n.bottom,o=c-n.left+n.right;a.scroll({top:t,left:o,behavior:l})}};//# sourceMappingURL=index.cjs.map /***/ }), /***/ "../../../node_modules/side-channel-list/index.js": /*!********************************************************!*\ !*** ../../../node_modules/side-channel-list/index.js ***! \********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var inspect = __webpack_require__(/*! object-inspect */ "../../../node_modules/object-inspect/index.js"); var $TypeError = __webpack_require__(/*! es-errors/type */ "../../../node_modules/es-errors/type.js"); /* * This function traverses the list returning the node corresponding to the given key. * * That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. * By doing so, all the recently used nodes can be accessed relatively quickly. */ /** @type {import('./list.d.ts').listGetNode} */ // eslint-disable-next-line consistent-return var listGetNode = function (list, key, isDelete) { /** @type {typeof list | NonNullable<(typeof list)['next']>} */ var prev = list; /** @type {(typeof list)['next']} */ var curr; // eslint-disable-next-line eqeqeq for (; (curr = prev.next) != null; prev = curr) { if (curr.key === key) { prev.next = curr.next; if (!isDelete) { // eslint-disable-next-line no-extra-parens curr.next = /** @type {NonNullable} */ (list.next); list.next = curr; // eslint-disable-line no-param-reassign } return curr; } } }; /** @type {import('./list.d.ts').listGet} */ var listGet = function (objects, key) { if (!objects) { return void undefined; } var node = listGetNode(objects, key); return node && node.value; }; /** @type {import('./list.d.ts').listSet} */ var listSet = function (objects, key, value) { var node = listGetNode(objects, key); if (node) { node.value = value; } else { // Prepend the new node to the beginning of the list objects.next = /** @type {import('./list.d.ts').ListNode} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens key: key, next: objects.next, value: value }); } }; /** @type {import('./list.d.ts').listHas} */ var listHas = function (objects, key) { if (!objects) { return false; } return !!listGetNode(objects, key); }; /** @type {import('./list.d.ts').listDelete} */ // eslint-disable-next-line consistent-return var listDelete = function (objects, key) { if (objects) { return listGetNode(objects, key, true); } }; /** @type {import('.')} */ module.exports = function getSideChannelList() { /** @typedef {ReturnType} Channel */ /** @typedef {Parameters[0]} K */ /** @typedef {Parameters[1]} V */ /** @type {import('./list.d.ts').RootNode | undefined} */ var $o; /** @type {Channel} */ var channel = { assert: function (key) { if (!channel.has(key)) { throw new $TypeError('Side channel does not contain ' + inspect(key)); } }, 'delete': function (key) { var root = $o && $o.next; var deletedNode = listDelete($o, key); if (deletedNode && root && root === deletedNode) { $o = void undefined; } return !!deletedNode; }, get: function (key) { return listGet($o, key); }, has: function (key) { return listHas($o, key); }, set: function (key, value) { if (!$o) { // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head $o = { next: void undefined }; } // eslint-disable-next-line no-extra-parens listSet(/** @type {NonNullable} */ ($o), key, value); } }; // @ts-expect-error TODO: figure out why this is erroring return channel; }; /***/ }), /***/ "../../../node_modules/side-channel-map/index.js": /*!*******************************************************!*\ !*** ../../../node_modules/side-channel-map/index.js ***! \*******************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "../../../node_modules/get-intrinsic/index.js"); var callBound = __webpack_require__(/*! call-bound */ "../../../node_modules/call-bound/index.js"); var inspect = __webpack_require__(/*! object-inspect */ "../../../node_modules/object-inspect/index.js"); var $TypeError = __webpack_require__(/*! es-errors/type */ "../../../node_modules/es-errors/type.js"); var $Map = GetIntrinsic('%Map%', true); /** @type {(thisArg: Map, key: K) => V} */ var $mapGet = callBound('Map.prototype.get', true); /** @type {(thisArg: Map, key: K, value: V) => void} */ var $mapSet = callBound('Map.prototype.set', true); /** @type {(thisArg: Map, key: K) => boolean} */ var $mapHas = callBound('Map.prototype.has', true); /** @type {(thisArg: Map, key: K) => boolean} */ var $mapDelete = callBound('Map.prototype.delete', true); /** @type {(thisArg: Map) => number} */ var $mapSize = callBound('Map.prototype.size', true); /** @type {import('.')} */ module.exports = !!$Map && /** @type {Exclude} */ function getSideChannelMap() { /** @typedef {ReturnType} Channel */ /** @typedef {Parameters[0]} K */ /** @typedef {Parameters[1]} V */ /** @type {Map | undefined} */ var $m; /** @type {Channel} */ var channel = { assert: function (key) { if (!channel.has(key)) { throw new $TypeError('Side channel does not contain ' + inspect(key)); } }, 'delete': function (key) { if ($m) { var result = $mapDelete($m, key); if ($mapSize($m) === 0) { $m = void undefined; } return result; } return false; }, get: function (key) { // eslint-disable-line consistent-return if ($m) { return $mapGet($m, key); } }, has: function (key) { if ($m) { return $mapHas($m, key); } return false; }, set: function (key, value) { if (!$m) { // @ts-expect-error TS can't handle narrowing a variable inside a closure $m = new $Map(); } $mapSet($m, key, value); } }; // @ts-expect-error TODO: figure out why TS is erroring here return channel; }; /***/ }), /***/ "../../../node_modules/side-channel-weakmap/index.js": /*!***********************************************************!*\ !*** ../../../node_modules/side-channel-weakmap/index.js ***! \***********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "../../../node_modules/get-intrinsic/index.js"); var callBound = __webpack_require__(/*! call-bound */ "../../../node_modules/call-bound/index.js"); var inspect = __webpack_require__(/*! object-inspect */ "../../../node_modules/object-inspect/index.js"); var getSideChannelMap = __webpack_require__(/*! side-channel-map */ "../../../node_modules/side-channel-map/index.js"); var $TypeError = __webpack_require__(/*! es-errors/type */ "../../../node_modules/es-errors/type.js"); var $WeakMap = GetIntrinsic('%WeakMap%', true); /** @type {(thisArg: WeakMap, key: K) => V} */ var $weakMapGet = callBound('WeakMap.prototype.get', true); /** @type {(thisArg: WeakMap, key: K, value: V) => void} */ var $weakMapSet = callBound('WeakMap.prototype.set', true); /** @type {(thisArg: WeakMap, key: K) => boolean} */ var $weakMapHas = callBound('WeakMap.prototype.has', true); /** @type {(thisArg: WeakMap, key: K) => boolean} */ var $weakMapDelete = callBound('WeakMap.prototype.delete', true); /** @type {import('.')} */ module.exports = $WeakMap ? /** @type {Exclude} */ function getSideChannelWeakMap() { /** @typedef {ReturnType} Channel */ /** @typedef {Parameters[0]} K */ /** @typedef {Parameters[1]} V */ /** @type {WeakMap | undefined} */ var $wm; /** @type {Channel | undefined} */ var $m; /** @type {Channel} */ var channel = { assert: function (key) { if (!channel.has(key)) { throw new $TypeError('Side channel does not contain ' + inspect(key)); } }, 'delete': function (key) { if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { if ($wm) { return $weakMapDelete($wm, key); } } else if (getSideChannelMap) { if ($m) { return $m['delete'](key); } } return false; }, get: function (key) { if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { if ($wm) { return $weakMapGet($wm, key); } } return $m && $m.get(key); }, has: function (key) { if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { if ($wm) { return $weakMapHas($wm, key); } } return !!$m && $m.has(key); }, set: function (key, value) { if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { if (!$wm) { $wm = new $WeakMap(); } $weakMapSet($wm, key, value); } else if (getSideChannelMap) { if (!$m) { $m = getSideChannelMap(); } // eslint-disable-next-line no-extra-parens /** @type {NonNullable} */ ($m).set(key, value); } } }; // @ts-expect-error TODO: figure out why this is erroring return channel; } : getSideChannelMap; /***/ }), /***/ "../../../node_modules/side-channel/index.js": /*!***************************************************!*\ !*** ../../../node_modules/side-channel/index.js ***! \***************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var $TypeError = __webpack_require__(/*! es-errors/type */ "../../../node_modules/es-errors/type.js"); var inspect = __webpack_require__(/*! object-inspect */ "../../../node_modules/object-inspect/index.js"); var getSideChannelList = __webpack_require__(/*! side-channel-list */ "../../../node_modules/side-channel-list/index.js"); var getSideChannelMap = __webpack_require__(/*! side-channel-map */ "../../../node_modules/side-channel-map/index.js"); var getSideChannelWeakMap = __webpack_require__(/*! side-channel-weakmap */ "../../../node_modules/side-channel-weakmap/index.js"); var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList; /** @type {import('.')} */ module.exports = function getSideChannel() { /** @typedef {ReturnType} Channel */ /** @type {Channel | undefined} */ var $channelData; /** @type {Channel} */ var channel = { assert: function (key) { if (!channel.has(key)) { throw new $TypeError('Side channel does not contain ' + inspect(key)); } }, 'delete': function (key) { return !!$channelData && $channelData['delete'](key); }, get: function (key) { return $channelData && $channelData.get(key); }, has: function (key) { return !!$channelData && $channelData.has(key); }, set: function (key, value) { if (!$channelData) { $channelData = makeChannel(); } $channelData.set(key, value); } }; // @ts-expect-error TODO: figure out why this is erroring return channel; }; /***/ }), /***/ "../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js": /*!***********************************************************************************!*\ !*** ../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***! \***********************************************************************************/ /***/ ((module) => { var stylesInDOM = []; function getIndexByIdentifier(identifier) { var result = -1; for (var i = 0; i < stylesInDOM.length; i++) { if (stylesInDOM[i].identifier === identifier) { result = i; break; } } return result; } function modulesToDom(list, options) { var idCountMap = {}; var identifiers = []; for (var i = 0; i < list.length; i++) { var item = list[i]; var id = options.base ? item[0] + options.base : item[0]; var count = idCountMap[id] || 0; var identifier = "".concat(id, " ").concat(count); idCountMap[id] = count + 1; var indexByIdentifier = getIndexByIdentifier(identifier); var obj = { css: item[1], media: item[2], sourceMap: item[3], supports: item[4], layer: item[5] }; if (indexByIdentifier !== -1) { stylesInDOM[indexByIdentifier].references++; stylesInDOM[indexByIdentifier].updater(obj); } else { var updater = addElementStyle(obj, options); options.byIndex = i; stylesInDOM.splice(i, 0, { identifier: identifier, updater: updater, references: 1 }); } identifiers.push(identifier); } return identifiers; } function addElementStyle(obj, options) { var api = options.domAPI(options); api.update(obj); var updater = function updater(newObj) { if (newObj) { if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { return; } api.update(obj = newObj); } else { api.remove(); } }; return updater; } module.exports = function (list, options) { options = options || {}; list = list || []; var lastIdentifiers = modulesToDom(list, options); return function update(newList) { newList = newList || []; for (var i = 0; i < lastIdentifiers.length; i++) { var identifier = lastIdentifiers[i]; var index = getIndexByIdentifier(identifier); stylesInDOM[index].references--; } var newLastIdentifiers = modulesToDom(newList, options); for (var _i = 0; _i < lastIdentifiers.length; _i++) { var _identifier = lastIdentifiers[_i]; var _index = getIndexByIdentifier(_identifier); if (stylesInDOM[_index].references === 0) { stylesInDOM[_index].updater(); stylesInDOM.splice(_index, 1); } } lastIdentifiers = newLastIdentifiers; }; }; /***/ }), /***/ "../../../node_modules/style-loader/dist/runtime/insertBySelector.js": /*!***************************************************************************!*\ !*** ../../../node_modules/style-loader/dist/runtime/insertBySelector.js ***! \***************************************************************************/ /***/ ((module) => { var memo = {}; /* istanbul ignore next */ function getTarget(target) { if (typeof memo[target] === "undefined") { var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { try { // This will throw an exception if access to iframe is blocked // due to cross-origin restrictions styleTarget = styleTarget.contentDocument.head; } catch (e) { // istanbul ignore next styleTarget = null; } } memo[target] = styleTarget; } return memo[target]; } /* istanbul ignore next */ function insertBySelector(insert, style) { var target = getTarget(insert); if (!target) { throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); } target.appendChild(style); } module.exports = insertBySelector; /***/ }), /***/ "../../../node_modules/style-loader/dist/runtime/insertStyleElement.js": /*!*****************************************************************************!*\ !*** ../../../node_modules/style-loader/dist/runtime/insertStyleElement.js ***! \*****************************************************************************/ /***/ ((module) => { /* istanbul ignore next */ function insertStyleElement(options) { var element = document.createElement("style"); options.setAttributes(element, options.attributes); options.insert(element, options.options); return element; } module.exports = insertStyleElement; /***/ }), /***/ "../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js": /*!*****************************************************************************************!*\ !*** ../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***! \*****************************************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* istanbul ignore next */ function setAttributesWithoutAttributes(styleElement) { var nonce = true ? __webpack_require__.nc : 0; if (nonce) { styleElement.setAttribute("nonce", nonce); } } module.exports = setAttributesWithoutAttributes; /***/ }), /***/ "../../../node_modules/style-loader/dist/runtime/styleDomAPI.js": /*!**********************************************************************!*\ !*** ../../../node_modules/style-loader/dist/runtime/styleDomAPI.js ***! \**********************************************************************/ /***/ ((module) => { /* istanbul ignore next */ function apply(styleElement, options, obj) { var css = ""; if (obj.supports) { css += "@supports (".concat(obj.supports, ") {"); } if (obj.media) { css += "@media ".concat(obj.media, " {"); } var needLayer = typeof obj.layer !== "undefined"; if (needLayer) { css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); } css += obj.css; if (needLayer) { css += "}"; } if (obj.media) { css += "}"; } if (obj.supports) { css += "}"; } var sourceMap = obj.sourceMap; if (sourceMap && typeof btoa !== "undefined") { css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); } // For old IE /* istanbul ignore if */ options.styleTagTransform(css, styleElement, options.options); } function removeStyleElement(styleElement) { // istanbul ignore if if (styleElement.parentNode === null) { return false; } styleElement.parentNode.removeChild(styleElement); } /* istanbul ignore next */ function domAPI(options) { if (typeof document === "undefined") { return { update: function update() {}, remove: function remove() {} }; } var styleElement = options.insertStyleElement(options); return { update: function update(obj) { apply(styleElement, options, obj); }, remove: function remove() { removeStyleElement(styleElement); } }; } module.exports = domAPI; /***/ }), /***/ "../../../node_modules/style-loader/dist/runtime/styleTagTransform.js": /*!****************************************************************************!*\ !*** ../../../node_modules/style-loader/dist/runtime/styleTagTransform.js ***! \****************************************************************************/ /***/ ((module) => { /* istanbul ignore next */ function styleTagTransform(css, styleElement) { if (styleElement.styleSheet) { styleElement.styleSheet.cssText = css; } else { while (styleElement.firstChild) { styleElement.removeChild(styleElement.firstChild); } styleElement.appendChild(document.createTextNode(css)); } } module.exports = styleTagTransform; /***/ }), /***/ "../../../node_modules/stylis/src/Enum.js": /*!************************************************!*\ !*** ../../../node_modules/stylis/src/Enum.js ***! \************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CHARSET: () => (/* binding */ CHARSET), /* harmony export */ COMMENT: () => (/* binding */ COMMENT), /* harmony export */ COUNTER_STYLE: () => (/* binding */ COUNTER_STYLE), /* harmony export */ DECLARATION: () => (/* binding */ DECLARATION), /* harmony export */ DOCUMENT: () => (/* binding */ DOCUMENT), /* harmony export */ FONT_FACE: () => (/* binding */ FONT_FACE), /* harmony export */ FONT_FEATURE_VALUES: () => (/* binding */ FONT_FEATURE_VALUES), /* harmony export */ IMPORT: () => (/* binding */ IMPORT), /* harmony export */ KEYFRAMES: () => (/* binding */ KEYFRAMES), /* harmony export */ LAYER: () => (/* binding */ LAYER), /* harmony export */ MEDIA: () => (/* binding */ MEDIA), /* harmony export */ MOZ: () => (/* binding */ MOZ), /* harmony export */ MS: () => (/* binding */ MS), /* harmony export */ NAMESPACE: () => (/* binding */ NAMESPACE), /* harmony export */ PAGE: () => (/* binding */ PAGE), /* harmony export */ RULESET: () => (/* binding */ RULESET), /* harmony export */ SCOPE: () => (/* binding */ SCOPE), /* harmony export */ SUPPORTS: () => (/* binding */ SUPPORTS), /* harmony export */ VIEWPORT: () => (/* binding */ VIEWPORT), /* harmony export */ WEBKIT: () => (/* binding */ WEBKIT) /* harmony export */ }); var MS = '-ms-' var MOZ = '-moz-' var WEBKIT = '-webkit-' var COMMENT = 'comm' var RULESET = 'rule' var DECLARATION = 'decl' var PAGE = '@page' var MEDIA = '@media' var IMPORT = '@import' var CHARSET = '@charset' var VIEWPORT = '@viewport' var SUPPORTS = '@supports' var DOCUMENT = '@document' var NAMESPACE = '@namespace' var KEYFRAMES = '@keyframes' var FONT_FACE = '@font-face' var COUNTER_STYLE = '@counter-style' var FONT_FEATURE_VALUES = '@font-feature-values' var LAYER = '@layer' var SCOPE = '@scope' /***/ }), /***/ "../../../node_modules/stylis/src/Parser.js": /*!**************************************************!*\ !*** ../../../node_modules/stylis/src/Parser.js ***! \**************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ comment: () => (/* binding */ comment), /* harmony export */ compile: () => (/* binding */ compile), /* harmony export */ declaration: () => (/* binding */ declaration), /* harmony export */ parse: () => (/* binding */ parse), /* harmony export */ ruleset: () => (/* binding */ ruleset) /* harmony export */ }); /* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Enum.js */ "../../../node_modules/stylis/src/Enum.js"); /* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utility.js */ "../../../node_modules/stylis/src/Utility.js"); /* harmony import */ var _Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Tokenizer.js */ "../../../node_modules/stylis/src/Tokenizer.js"); /** * @param {string} value * @return {object[]} */ function compile (value) { return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.dealloc)(parse('', null, null, null, [''], value = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.alloc)(value), 0, [0], value)) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {string[]} rule * @param {string[]} rules * @param {string[]} rulesets * @param {number[]} pseudo * @param {number[]} points * @param {string[]} declarations * @return {object} */ function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { var index = 0 var offset = 0 var length = pseudo var atrule = 0 var property = 0 var previous = 0 var variable = 1 var scanning = 1 var ampersand = 1 var character = 0 var type = '' var props = rules var children = rulesets var reference = rule var characters = type while (scanning) switch (previous = character, character = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.next)()) { // ( case 40: if (previous != 108 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(characters, length - 1) == 58) { if ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.indexof)(characters += (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.delimit)(character), '&', '&\f'), '&\f', (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.abs)(index ? points[index - 1] : 0)) != -1) ampersand = -1 break } // " ' [ case 34: case 39: case 91: characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.delimit)(character) break // \t \n \r \s case 9: case 10: case 13: case 32: characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.whitespace)(previous) break // \ case 92: characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.escaping)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.caret)() - 1, 7) continue // / case 47: switch ((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.peek)()) { case 42: case 47: ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(comment((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.commenter)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.next)(), (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.caret)()), root, parent, declarations), declarations) if (((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.token)(previous || 1) == 5 || (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.token)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.peek)() || 1) == 5) && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(characters, -1, void 0) !== ' ') characters += ' ' break default: characters += '/' } break // { case 123 * variable: points[index++] = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) * ampersand // } ; \0 case 125 * variable: case 59: case 0: switch (character) { // \0 } case 0: case 125: scanning = 0 // ; case 59 + offset: if (ampersand == -1) characters = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(characters, /\f/g, '') if (property > 0 && ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) - length || (variable === 0 && previous === 47))) (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations) break // @ ; case 59: characters += ';' // { rule/at-rule default: ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets) if (character === 123) if (offset === 0) parse(characters, root, reference, reference, props, rulesets, length, points, children) else { switch (atrule) { // c(ontainer) case 99: if ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(characters, 3) === 110) break // l(ayer) case 108: if ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(characters, 2) === 97) break default: offset = 0 // d(ocument) m(edia) s(upports) case 100: case 109: case 115: } if (offset) parse(value, reference, reference, rule && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children) else parse(characters, reference, reference, reference, [''], children, 0, points, children) } } index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo break // : case 58: length = 1 + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters), property = previous default: if (variable < 1) if (character == 123) --variable else if (character == 125 && variable++ == 0 && (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.prev)() == 125) continue switch (characters += (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.from)(character), character * variable) { // & case 38: ampersand = offset > 0 ? 1 : (characters += '\f', -1) break // , case 44: points[index++] = ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) - 1) * ampersand, ampersand = 1 break // @ case 64: // - if ((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.peek)() === 45) characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.delimit)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.next)()) atrule = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.peek)(), offset = length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(type = characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.identifier)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.caret)())), character++ break // - case 45: if (previous === 45 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) == 2) variable = 0 } } return rulesets } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} index * @param {number} offset * @param {string[]} rules * @param {number[]} points * @param {string} type * @param {string[]} props * @param {string[]} children * @param {number} length * @param {object[]} siblings * @return {object} */ function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length, siblings) { var post = offset - 1 var rule = offset === 0 ? rules : [''] var size = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.sizeof)(rule) for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, post + 1, post = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.abs)(j = points[i])), z = value; x < size; ++x) if (z = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.trim)(j > 0 ? rule[x] + ' ' + y : (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(y, /&\f/g, rule[x]))) props[k++] = z return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.node)(value, root, parent, offset === 0 ? _Enum_js__WEBPACK_IMPORTED_MODULE_0__.RULESET : type, props, children, length, siblings) } /** * @param {number} value * @param {object} root * @param {object?} parent * @param {object[]} siblings * @return {object} */ function comment (value, root, parent, siblings) { return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.node)(value, root, parent, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.COMMENT, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.from)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.char)()), (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, 2, -2), 0, siblings) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} length * @param {object[]} siblings * @return {object} */ function declaration (value, root, parent, length, siblings) { return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.node)(value, root, parent, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.DECLARATION, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, 0, length), (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, length + 1, -1), length, siblings) } /***/ }), /***/ "../../../node_modules/stylis/src/Serializer.js": /*!******************************************************!*\ !*** ../../../node_modules/stylis/src/Serializer.js ***! \******************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ serialize: () => (/* binding */ serialize), /* harmony export */ stringify: () => (/* binding */ stringify) /* harmony export */ }); /* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Enum.js */ "../../../node_modules/stylis/src/Enum.js"); /* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utility.js */ "../../../node_modules/stylis/src/Utility.js"); /** * @param {object[]} children * @param {function} callback * @return {string} */ function serialize (children, callback) { var output = '' for (var i = 0; i < children.length; i++) output += callback(children[i], i, children, callback) || '' return output } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback * @return {string} */ function stringify (element, index, children, callback) { switch (element.type) { case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.LAYER: if (element.children.length) break case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.IMPORT: case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.NAMESPACE: case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.DECLARATION: return element.return = element.return || element.value case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.COMMENT: return '' case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}' case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.RULESET: if (!(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(element.value = element.props.join(','))) return '' } return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '' } /***/ }), /***/ "../../../node_modules/stylis/src/Tokenizer.js": /*!*****************************************************!*\ !*** ../../../node_modules/stylis/src/Tokenizer.js ***! \*****************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ alloc: () => (/* binding */ alloc), /* harmony export */ caret: () => (/* binding */ caret), /* harmony export */ char: () => (/* binding */ char), /* harmony export */ character: () => (/* binding */ character), /* harmony export */ characters: () => (/* binding */ characters), /* harmony export */ column: () => (/* binding */ column), /* harmony export */ commenter: () => (/* binding */ commenter), /* harmony export */ copy: () => (/* binding */ copy), /* harmony export */ dealloc: () => (/* binding */ dealloc), /* harmony export */ delimit: () => (/* binding */ delimit), /* harmony export */ delimiter: () => (/* binding */ delimiter), /* harmony export */ escaping: () => (/* binding */ escaping), /* harmony export */ identifier: () => (/* binding */ identifier), /* harmony export */ length: () => (/* binding */ length), /* harmony export */ lift: () => (/* binding */ lift), /* harmony export */ line: () => (/* binding */ line), /* harmony export */ next: () => (/* binding */ next), /* harmony export */ node: () => (/* binding */ node), /* harmony export */ peek: () => (/* binding */ peek), /* harmony export */ position: () => (/* binding */ position), /* harmony export */ prev: () => (/* binding */ prev), /* harmony export */ slice: () => (/* binding */ slice), /* harmony export */ token: () => (/* binding */ token), /* harmony export */ tokenize: () => (/* binding */ tokenize), /* harmony export */ tokenizer: () => (/* binding */ tokenizer), /* harmony export */ whitespace: () => (/* binding */ whitespace) /* harmony export */ }); /* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utility.js */ "../../../node_modules/stylis/src/Utility.js"); var line = 1 var column = 1 var length = 0 var position = 0 var character = 0 var characters = '' /** * @param {string} value * @param {object | null} root * @param {object | null} parent * @param {string} type * @param {string[] | string} props * @param {object[] | string} children * @param {object[]} siblings * @param {number} length */ function node (value, root, parent, type, props, children, length, siblings) { return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: '', siblings: siblings} } /** * @param {object} root * @param {object} props * @return {object} */ function copy (root, props) { return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.assign)(node('', null, null, '', null, null, 0, root.siblings), root, {length: -root.length}, props) } /** * @param {object} root */ function lift (root) { while (root.root) root = copy(root.root, {children: [root]}) ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.append)(root, root.siblings) } /** * @return {number} */ function char () { return character } /** * @return {number} */ function prev () { character = position > 0 ? (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(characters, --position) : 0 if (column--, character === 10) column = 1, line-- return character } /** * @return {number} */ function next () { character = position < length ? (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(characters, position++) : 0 if (column++, character === 10) column = 1, line++ return character } /** * @return {number} */ function peek () { return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(characters, position) } /** * @return {number} */ function caret () { return position } /** * @param {number} begin * @param {number} end * @return {string} */ function slice (begin, end) { return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.substr)(characters, begin, end) } /** * @param {number} type * @return {number} */ function token (type) { switch (type) { // \0 \t \n \r \s whitespace token case 0: case 9: case 10: case 13: case 32: return 5 // ! + , / > @ ~ isolate token case 33: case 43: case 44: case 47: case 62: case 64: case 126: // ; { } breakpoint token case 59: case 123: case 125: return 4 // : accompanied token case 58: return 3 // " ' ( [ opening delimit token case 34: case 39: case 40: case 91: return 2 // ) ] closing delimit token case 41: case 93: return 1 } return 0 } /** * @param {string} value * @return {any[]} */ function alloc (value) { return line = column = 1, length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.strlen)(characters = value), position = 0, [] } /** * @param {any} value * @return {any} */ function dealloc (value) { return characters = '', value } /** * @param {number} type * @return {string} */ function delimit (type) { return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.trim)(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))) } /** * @param {string} value * @return {string[]} */ function tokenize (value) { return dealloc(tokenizer(alloc(value))) } /** * @param {number} type * @return {string} */ function whitespace (type) { while (character = peek()) if (character < 33) next() else break return token(type) > 2 || token(character) > 3 ? '' : ' ' } /** * @param {string[]} children * @return {string[]} */ function tokenizer (children) { while (next()) switch (token(character)) { case 0: (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.append)(identifier(position - 1), children) break case 2: ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.append)(delimit(character), children) break default: ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.append)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.from)(character), children) } return children } /** * @param {number} index * @param {number} count * @return {string} */ function escaping (index, count) { while (--count && next()) // not 0-9 A-F a-f if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97)) break return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)) } /** * @param {number} type * @return {number} */ function delimiter (type) { while (next()) switch (character) { // ] ) " ' case type: return position // " ' case 34: case 39: if (type !== 34 && type !== 39) delimiter(character) break // ( case 40: if (type === 41) delimiter(type) break // \ case 92: next() break } return position } /** * @param {number} type * @param {number} index * @return {number} */ function commenter (type, index) { while (next()) // // if (type + character === 47 + 10) break // /* else if (type + character === 42 + 42 && peek() === 47) break return '/*' + slice(index, position - 1) + '*' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.from)(type === 47 ? type : next()) } /** * @param {number} index * @return {string} */ function identifier (index) { while (!token(peek())) next() return slice(index, position) } /***/ }), /***/ "../../../node_modules/stylis/src/Utility.js": /*!***************************************************!*\ !*** ../../../node_modules/stylis/src/Utility.js ***! \***************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ abs: () => (/* binding */ abs), /* harmony export */ append: () => (/* binding */ append), /* harmony export */ assign: () => (/* binding */ assign), /* harmony export */ charat: () => (/* binding */ charat), /* harmony export */ combine: () => (/* binding */ combine), /* harmony export */ filter: () => (/* binding */ filter), /* harmony export */ from: () => (/* binding */ from), /* harmony export */ hash: () => (/* binding */ hash), /* harmony export */ indexof: () => (/* binding */ indexof), /* harmony export */ match: () => (/* binding */ match), /* harmony export */ replace: () => (/* binding */ replace), /* harmony export */ sizeof: () => (/* binding */ sizeof), /* harmony export */ strlen: () => (/* binding */ strlen), /* harmony export */ substr: () => (/* binding */ substr), /* harmony export */ trim: () => (/* binding */ trim) /* harmony export */ }); /** * @param {number} * @return {number} */ var abs = Math.abs /** * @param {number} * @return {string} */ var from = String.fromCharCode /** * @param {object} * @return {object} */ var assign = Object.assign /** * @param {string} value * @param {number} length * @return {number} */ function hash (value, length) { return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0 } /** * @param {string} value * @return {string} */ function trim (value) { return value.trim() } /** * @param {string} value * @param {RegExp} pattern * @return {string?} */ function match (value, pattern) { return (value = pattern.exec(value)) ? value[0] : value } /** * @param {string} value * @param {(string|RegExp)} pattern * @param {string} replacement * @return {string} */ function replace (value, pattern, replacement) { return value.replace(pattern, replacement) } /** * @param {string} value * @param {string} search * @param {number} position * @return {number} */ function indexof (value, search, position) { return value.indexOf(search, position) } /** * @param {string} value * @param {number} index * @return {number} */ function charat (value, index) { return value.charCodeAt(index) | 0 } /** * @param {string} value * @param {number} begin * @param {number} end * @return {string} */ function substr (value, begin, end) { return value.slice(begin, end) } /** * @param {string} value * @return {number} */ function strlen (value) { return value.length } /** * @param {any[]} value * @return {number} */ function sizeof (value) { return value.length } /** * @param {any} value * @param {any[]} array * @return {any} */ function append (value, array) { return array.push(value), value } /** * @param {string[]} array * @param {function} callback * @return {string} */ function combine (array, callback) { return array.map(callback).join('') } /** * @param {string[]} array * @param {RegExp} pattern * @return {string[]} */ function filter (array, pattern) { return array.filter(function (value) { return !match(value, pattern) }) } /***/ }) }]); //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianMvdmVuZG9ycy1ub2RlX21vZHVsZXNfcmVzaXplLW9ic2VydmVyLXBvbHlmaWxsX2Rpc3RfUmVzaXplT2JzZXJ2ZXJfZXNfanMtbm9kZV9tb2R1bGVzX3NjaGVkdWxlLTllMTRhYS52b2x1bnRlZXJhcGkuYTBlNDZlNTk1ZjIzNTJkOTI4ZTcuYnVuZGxlLmpzIiwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNB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uICAgIC8qKlxyXG4gICAgICogUmV0dXJucyBpbmRleCBpbiBwcm92aWRlZCBhcnJheSB0aGF0IG1hdGNoZXMgdGhlIHNwZWNpZmllZCBrZXkuXHJcbiAgICAgKlxyXG4gICAgICogQHBhcmFtIHtBcnJheTxBcnJheT59IGFyclxyXG4gICAgICogQHBhcmFtIHsqfSBrZXlcclxuICAgICAqIEByZXR1cm5zIHtudW1iZXJ9XHJcbiAgICAgKi9cclxuICAgIGZ1bmN0aW9uIGdldEluZGV4KGFyciwga2V5KSB7XHJcbiAgICAgICAgdmFyIHJlc3VsdCA9IC0xO1xyXG4gICAgICAgIGFyci5zb21lKGZ1bmN0aW9uIChlbnRyeSwgaW5kZXgpIHtcclxuICAgICAgICAgICAgaWYgKGVudHJ5WzBdID09PSBrZXkpIHtcclxuICAgICAgICAgICAgICAgIHJlc3VsdCA9IGluZGV4O1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgIH0pO1xyXG4gICAgICAgIHJldHVybiByZXN1bHQ7XHJcbiAgICB9XHJcbiAgICByZXR1cm4gLyoqIEBjbGFzcyAqLyAoZnVuY3Rpb24gKCkge1xyXG4gICAgICAgIGZ1bmN0aW9uIGNsYXNzXzEoKSB7XHJcbiAgICAgICAgICAgIHRoaXMuX19lbnRyaWVzX18gPSBbXTtcclxuICAgICAgICB9XHJcbiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGNsYXNzXzEucHJvdG90eXBlLCBcInNpemVcIiwge1xyXG4gICAgICAgICAgICAvKipcclxuICAgICAgICAgICAgICogQHJldHVybnMge2Jvb2xlYW59XHJcbiAgICAgICAgICAgICAqL1xyXG4gICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9fZW50cmllc19fLmxlbmd0aDtcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSxcclxuICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlXHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogQHBhcmFtIHsqfSBrZXlcclxuICAgICAgICAgKiBAcmV0dXJucyB7Kn1cclxuICAgICAgICAgKi9cclxuICAgICAgICBjbGFzc18xLnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbiAoa2V5KSB7XHJcbiAgICAgICAgICAgIHZhciBpbmRleCA9IGdldEluZGV4KHRoaXMuX19lbnRyaWVzX18sIGtleSk7XHJcbiAgICAgICAgICAgIHZhciBlbnRyeSA9IHRoaXMuX19lbnRyaWVzX19baW5kZXhdO1xyXG4gICAgICAgICAgICByZXR1cm4gZW50cnkgJiYgZW50cnlbMV07XHJcbiAgICAgICAgfTtcclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBAcGFyYW0geyp9IGtleVxyXG4gICAgICAgICAqIEBwYXJhbSB7Kn0gdmFsdWVcclxuICAgICAgICAgKiBAcmV0dXJucyB7dm9pZH1cclxuICAgICAgICAgKi9cclxuICAgICAgICBjbGFzc18xLnByb3RvdHlwZS5zZXQgPSBmdW5jdGlvbiAoa2V5LCB2YWx1ZSkge1xyXG4gICAgICAgICAgICB2YXIgaW5kZXggPSBnZXRJbmRleCh0aGlzLl9fZW50cmllc19fLCBrZXkpO1xyXG4gICAgICAgICAgICBpZiAofmluZGV4KSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLl9fZW50cmllc19fW2luZGV4XVsxXSA9IHZhbHVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgdGhpcy5fX2VudHJpZXNfXy5wdXNoKFtrZXksIHZhbHVlXSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9O1xyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIEBwYXJhbSB7Kn0ga2V5XHJcbiAgICAgICAgICogQHJldHVybnMge3ZvaWR9XHJcbiAgICAgICAgICovXHJcbiAgICAgICAgY2xhc3NfMS5wcm90b3R5cGUuZGVsZXRlID0gZnVuY3Rpb24gKGtleSkge1xyXG4gICAgICAgICAgICB2YXIgZW50cmllcyA9IHRoaXMuX19lbnRyaWVzX187XHJcbiAgICAgICAgICAgIHZhciBpbmRleCA9IGdldEluZGV4KGVudHJpZXMsIGtleSk7XHJcbiAgICAgICAgICAgIGlmICh+aW5kZXgpIHtcclxuICAgICAgICAgICAgICAgIGVudHJpZXMuc3BsaWNlKGluZGV4LCAxKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH07XHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogQHBhcmFtIHsqfSBrZXlcclxuICAgICAgICAgKiBAcmV0dXJucyB7dm9pZH1cclxuICAgICAgICAgKi9cclxuICAgICAgICBjbGFzc18xLnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiAoa2V5KSB7XHJcbiAgICAgICAgICAgIHJldHVybiAhIX5nZXRJbmRleCh0aGlzLl9fZW50cmllc19fLCBrZXkpO1xyXG4gICAgICAgIH07XHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogQHJldHVybnMge3ZvaWR9XHJcbiAgICAgICAgICovXHJcbiAgICAgICAgY2xhc3NfMS5wcm90b3R5cGUuY2xlYXIgPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHRoaXMuX19lbnRyaWVzX18uc3BsaWNlKDApO1xyXG4gICAgICAgIH07XHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogQHBhcmFtIHtGdW5jdGlvbn0gY2FsbGJhY2tcclxuICAgICAgICAgKiBAcGFyYW0geyp9IFtjdHg9bnVsbF1cclxuICAgICAgICAgKiBAcmV0dXJucyB7dm9pZH1cclxuICAgICAgICAgKi9cclxuICAgICAgICBjbGFzc18xLnByb3RvdHlwZS5mb3JFY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JcbiAgICAgKi9cclxuICAgIGZ1bmN0aW9uIHJlc29sdmVQZW5kaW5nKCkge1xyXG4gICAgICAgIGlmIChsZWFkaW5nQ2FsbCkge1xyXG4gICAgICAgICAgICBsZWFkaW5nQ2FsbCA9IGZhbHNlO1xyXG4gICAgICAgICAgICBjYWxsYmFjaygpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodHJhaWxpbmdDYWxsKSB7XHJcbiAgICAgICAgICAgIHByb3h5KCk7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG4gICAgLyoqXHJcbiAgICAgKiBDYWxsYmFjayBpbnZva2VkIGFmdGVyIHRoZSBzcGVjaWZpZWQgZGVsYXkuIEl0IHdpbGwgZnVydGhlciBwb3N0cG9uZVxyXG4gICAgICogaW52b2NhdGlvbiBvZiB0aGUgb3JpZ2luYWwgZnVuY3Rpb24gZGVsZWdhdGluZyBpdCB0byB0aGVcclxuICAgICAqIHJlcXVlc3RBbmltYXRpb25GcmFtZS5cclxuICAgICAqXHJcbiAgICAgKiBAcmV0dXJucyB7dm9pZH1cclxuICAgICAqL1xyXG4gICAgZnVuY3Rpb24gdGltZW91dENhbGxiYWNrKCkge1xyXG4gICAgICAgIHJlcXVlc3RBbmltYXRpb25GcmFtZSQxKHJlc29sdmVQZW5kaW5nKTtcclxuICAgIH1cclxuICAgIC8qKlxyXG4gICAgICogU2NoZWR1bGVzIGludm9jYXRpb24gb2YgdGhlIG9yaWdpbmFsIGZ1bmN0aW9uLlxyXG4gICAgICpcclxuICAgICAqIEByZXR1cm5zIHt2b2lkfVxyXG4gICAgICovXHJcbiAgICBmdW5jdGlvbiBwcm94eSgpIHtcclxuICAgICAgICB2YXIgdGltZVN0YW1wID0gRGF0ZS5ub3coKTtcclxuICAgICAgICBpZiAobGVhZGluZ0NhbGwpIHtcclxuICAgICAgICAgICAgLy8gUmVqZWN0IGltbWVkaWF0ZWx5IGZvbGxvd2luZyBjYWxscy5cclxuICAgICAgICAgICAgaWYgKHRpb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lbWVudC5cclxuICAgICAgICBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKCd0cmFuc2l0aW9uZW5kJywgdGhpcy5vblRyYW5zaXRpb25FbmRfKTtcclxuICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigncmVzaXplJywgdGhpcy5yZWZyZXNoKTtcclxuICAgICAgICBpZiAobXV0YXRpb25PYnNlcnZlclN1cHBvcnRlZCkge1xyXG4gICAgICAgICAgICB0aGlzLm11dGF0aW9uc09ic2VydmVyXyA9IG5ldyBNdXRhdGlvbk9ic2VydmVyKHRoaXMucmVmcmVzaCk7XHJcbiAgICAgICAgICAgIHRoaXMubXV0YXRpb25zT2JzZXJ2ZXJfLm9ic2VydmUoZG9jdW1lbnQsIHtcclxuICAgICAgICAgICAgICAgIGF0dHJpYnV0ZXM6IHRydWUsXHJcbiAgICAgICAgICAgICAgICBjaGlsZExpc3Q6IHRydWUsXHJcbiAgICAgICAgICAgICAgICBjaGFyYWN0ZXJEYXRhOiB0cnVlLFxyXG4gICAgICAgICAgICAgICAgc3VidHJlZTogdHJ1ZVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ0RPTVN1YnRyZWVNb2RpZmllZCcsIHRoaXMucmVmcmVzaCk7XHJcbiAgICAgICAgICAgIHRoaXMubXV0YXRpb25FdmVudHNBZGRlZF8gPSB0cnVlO1xyXG4gICAgICAgIH1cclxuICAgICAgICB0aGlzLmNvbm5lY3RlZF8gPSB0cnVlO1xyXG4gICAgfTtcclxuICAgIC8qKlxyXG4gICAgICogUmVtb3ZlcyBET00gbGlzdGVuZXJzLlxyXG4gICAgICpcclxuICAgICAqIEBwcml2YXRlXHJcbiAgICAgKiBAcmV0dXJucyB7dm9pZH1cclxuICAgICAqL1xyXG4gICAgUmVzaXplT2JzZXJ2ZXJDb250cm9sbGVyLn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