diff --git a/src/browser/app/profile/zen-browser.js b/src/browser/app/profile/zen-browser.js index 7aca33bc9..2e1ce3ae3 100644 --- a/src/browser/app/profile/zen-browser.js +++ b/src/browser/app/profile/zen-browser.js @@ -208,7 +208,7 @@ pref('zen.workspaces.wrap-around-navigation', true); pref('zen.workspaces.natural-scroll', false); pref('zen.workspaces.scroll-modifier-key','ctrl'); // can be ctrl, alt, shift, or a meta key pref('services.sync.engine.workspaces', false); -pref('zen.workspaces.container-specific-essentials-enabled', false); +pref('zen.workspaces.container-specific-essentials-enabled', true); // Essentials pref('zen.essentials.enabled', true); diff --git a/src/browser/base/content/navigator-toolbox-inc-xhtml.patch b/src/browser/base/content/navigator-toolbox-inc-xhtml.patch index 364c24bf5..d6f3a8475 100644 --- a/src/browser/base/content/navigator-toolbox-inc-xhtml.patch +++ b/src/browser/base/content/navigator-toolbox-inc-xhtml.patch @@ -1,5 +1,5 @@ diff --git a/browser/base/content/navigator-toolbox.inc.xhtml b/browser/base/content/navigator-toolbox.inc.xhtml -index 00c8976d3e258c0875d7da2f3ec823d8907a84c9..3ce6fea52f8170f6cd821a66684248b4c0a765c6 100644 +index 00c8976d3e258c0875d7da2f3ec823d8907a84c9..b5735712aaa7c2ae2baa4b858e735413b130ca94 100644 --- a/browser/base/content/navigator-toolbox.inc.xhtml +++ b/browser/base/content/navigator-toolbox.inc.xhtml @@ -2,7 +2,7 @@ @@ -26,7 +26,7 @@ index 00c8976d3e258c0875d7da2f3ec823d8907a84c9..3ce6fea52f8170f6cd821a66684248b4 tooltip="tabbrowser-tab-tooltip" orient="horizontal" stopwatchid="tabClick"> -+ ++ + + + diff --git a/src/browser/base/content/zen-assets.jar.inc.mn b/src/browser/base/content/zen-assets.jar.inc.mn index 1e3efd3e2..9cc7edd55 100644 --- a/src/browser/base/content/zen-assets.jar.inc.mn +++ b/src/browser/base/content/zen-assets.jar.inc.mn @@ -53,7 +53,6 @@ content/browser/zen-components/ZenPinnedTabManager.mjs (../../zen/tabs/ZenPinnedTabManager.mjs) content/browser/zen-styles/zen-tabs.css (../../zen/tabs/zen-tabs.css) * content/browser/zen-styles/zen-tabs/vertical-tabs.css (../../zen/tabs/zen-tabs/vertical-tabs.css) - content/browser/zen-styles/zen-tabs/horizontal-tabs.css (../../zen/tabs/zen-tabs/horizontal-tabs.css) content/browser/zen-components/ZenGlanceManager.mjs (../../zen/glance/ZenGlanceManager.mjs) content/browser/zen-styles/zen-glance.css (../../zen/glance/zen-glance.css) diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index 17d3d4e4d..41c923870 100644 --- a/src/browser/components/tabbrowser/content/tabbrowser-js.patch +++ b/src/browser/components/tabbrowser/content/tabbrowser-js.patch @@ -1,24 +1,11 @@ diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js -index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b930f411c 100644 +index bfba253af3253a8cf547a5d69a1695651fc5c203..d4c7c37e06dc74cf0de3a10e6682f26ada76767d 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js -@@ -415,11 +415,71 @@ +@@ -415,11 +415,58 @@ return this.tabContainer.visibleTabs; } -+ get _numVisiblePinTabs() { -+ let i = 0; -+ for (let tab of this.tabs) { -+ if (!tab.pinned && !tab.hasAttribute("zen-glance-tab")) { -+ break; -+ } -+ if (!tab.hidden) { -+ i += !tab.hasAttribute("zen-glance-tab"); -+ } -+ } -+ return i; -+ } -+ + zenInsertTabAtIndex(...args) { + return this.#insertTabAtElementIndex(...args); + } @@ -76,7 +63,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b } return i; } -@@ -549,6 +609,7 @@ +@@ -549,6 +596,7 @@ this.tabpanels.appendChild(panel); let tab = this.tabs[0]; @@ -84,7 +71,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b tab.linkedPanel = uniqueId; this._selectedTab = tab; this._selectedBrowser = browser; -@@ -814,11 +875,13 @@ +@@ -814,11 +862,13 @@ } this.showTab(aTab); @@ -94,14 +81,14 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b + if (this.tabContainer.verticalMode && !handled) { this.#handleTabMove(aTab, () => - this.verticalPinnedTabsContainer.appendChild(aTab) -+ aTab.hasAttribute("zen-essential") ? document.getElementById("zen-essentials-container").appendChild(aTab) : this.verticalPinnedTabsContainer.insertBefore(aTab, this.verticalPinnedTabsContainer.lastChild) ++ aTab.hasAttribute("zen-essential") ? ZenWorkspaces.getEssentialsSection(aTab).appendChild(aTab) : this.verticalPinnedTabsContainer.insertBefore(aTab, this.verticalPinnedTabsContainer.lastChild) ); - } else { + } else if (!handled) { this.moveTabTo(aTab, { tabIndex: this.pinnedTabCount, forceUngrouped: true, -@@ -835,12 +898,15 @@ +@@ -835,12 +885,15 @@ } if (this.tabContainer.verticalMode) { @@ -118,7 +105,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b }); } else { this.moveTabTo(aTab, { -@@ -1024,6 +1090,8 @@ +@@ -1024,6 +1077,8 @@ let LOCAL_PROTOCOLS = ["chrome:", "about:", "resource:", "data:"]; @@ -127,7 +114,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if ( aIconURL && !aLoadingPrincipal && -@@ -1034,6 +1102,9 @@ +@@ -1034,6 +1089,9 @@ ); return; } @@ -137,7 +124,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b let browser = this.getBrowserForTab(aTab); browser.mIconURL = aIconURL; -@@ -1283,6 +1354,7 @@ +@@ -1283,6 +1341,7 @@ if (!this._previewMode) { newTab.recordTimeFromUnloadToReload(); newTab.updateLastAccessed(); @@ -145,7 +132,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b oldTab.updateLastAccessed(); // if this is the foreground window, update the last-seen timestamps. if (this.ownerGlobal == BrowserWindowTracker.getTopWindow()) { -@@ -1435,6 +1507,9 @@ +@@ -1435,6 +1494,9 @@ } let activeEl = document.activeElement; @@ -155,7 +142,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b // If focus is on the old tab, move it to the new tab. if (activeEl == oldTab) { newTab.focus(); -@@ -1758,7 +1833,8 @@ +@@ -1758,7 +1820,8 @@ } _setTabLabel(aTab, aLabel, { beforeTabOpen, isContentTitle, isURL } = {}) { @@ -165,7 +152,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b return false; } -@@ -1866,7 +1942,7 @@ +@@ -1866,7 +1929,7 @@ newIndex = this.selectedTab._tPos + 1; } @@ -174,7 +161,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if (this.isTabGroupLabel(targetTab)) { throw new Error( "Replacing a tab group label with a tab is not supported" -@@ -2130,6 +2206,7 @@ +@@ -2130,6 +2193,7 @@ uriIsAboutBlank, userContextId, skipLoad, @@ -182,7 +169,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b } = {}) { let b = document.createXULElement("browser"); // Use the JSM global to create the permanentKey, so that if the -@@ -2203,8 +2280,7 @@ +@@ -2203,8 +2267,7 @@ // we use a different attribute name for this? b.setAttribute("name", name); } @@ -192,7 +179,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b b.setAttribute("transparent", "true"); } -@@ -2369,7 +2445,7 @@ +@@ -2369,7 +2432,7 @@ let panel = this.getPanel(browser); let uniqueId = this._generateUniquePanelID(); @@ -201,7 +188,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b aTab.linkedPanel = uniqueId; // Inject the into the DOM if necessary. -@@ -2428,8 +2504,8 @@ +@@ -2428,8 +2491,8 @@ // If we transitioned from one browser to two browsers, we need to set // hasSiblings=false on both the existing browser and the new browser. if (this.tabs.length == 2) { @@ -212,7 +199,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b } else { aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1; } -@@ -2657,6 +2733,7 @@ +@@ -2657,6 +2720,7 @@ schemelessInput, hasValidUserGestureActivation = false, textDirectiveUserActivation = false, @@ -220,7 +207,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b } = {} ) { // all callers of addTab that pass a params object need to pass -@@ -2667,6 +2744,12 @@ +@@ -2667,6 +2731,12 @@ ); } @@ -233,7 +220,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if (!UserInteraction.running("browser.tabs.opening", window)) { UserInteraction.start("browser.tabs.opening", "initting", window); } -@@ -2730,6 +2813,16 @@ +@@ -2730,6 +2800,16 @@ noInitialLabel, skipBackgroundNotify, }); @@ -250,7 +237,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if (insertTab) { if (typeof index == "number") { elementIndex = this.#tabIndexToElementIndex(index); -@@ -2756,6 +2849,7 @@ +@@ -2756,6 +2836,7 @@ initialBrowsingContextGroupId, openWindowInfo, skipLoad, @@ -258,7 +245,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b })); if (focusUrlBar) { -@@ -2875,6 +2969,9 @@ +@@ -2875,6 +2956,9 @@ } } @@ -268,7 +255,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b // Additionally send pinned tab events if (pinned) { this._notifyPinnedStatus(t); -@@ -2922,12 +3019,15 @@ +@@ -2922,12 +3006,15 @@ * @param {string} [label=] * @returns {MozTabbrowserTabGroup} */ @@ -285,7 +272,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b return group; } -@@ -2970,6 +3070,7 @@ +@@ -2970,6 +3057,7 @@ insertBefore = null, isUserTriggered = false, telemetryUserCreateSource = "unknown", @@ -293,7 +280,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b } = {} ) { if (!tabs?.length) { -@@ -2988,7 +3089,12 @@ +@@ -2988,7 +3076,12 @@ id = `${Date.now()}-${Math.round(Math.random() * 100)}`; } let group = this._createTabGroup(id, color, false, label); @@ -307,7 +294,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b group, insertBefore?.group ?? insertBefore ); -@@ -3318,6 +3424,7 @@ +@@ -3318,6 +3411,7 @@ initialBrowsingContextGroupId, openWindowInfo, skipLoad, @@ -315,7 +302,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b } ) { // If we don't have a preferred remote type, and we have a remote -@@ -3381,6 +3488,7 @@ +@@ -3381,6 +3475,7 @@ openWindowInfo, name, skipLoad, @@ -323,7 +310,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b }); } -@@ -3559,6 +3667,27 @@ +@@ -3559,6 +3654,27 @@ ) { tabWasReused = true; tab = this.selectedTab; @@ -351,7 +338,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if (!tabData.pinned) { this.unpinTab(tab); } else { -@@ -3607,8 +3736,28 @@ +@@ -3607,8 +3723,28 @@ skipLoad: true, preferredRemoteType, }); @@ -382,18 +369,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b tabToSelect = tab; } } -@@ -3620,8 +3769,8 @@ - // inserted in the DOM. If the tab is not yet in the DOM, - // just insert it in the right place from the start. - if (!tab.parentNode) { -- tab._tPos = this.pinnedTabCount; -- this.tabContainer.insertBefore(tab, this.tabs[this.pinnedTabCount]); -+ tab._tPos = this._numVisiblePinTabs; -+ this.tabContainer.insertBefore(tab, this.tabs[this._numVisiblePinTabs]); - tab.toggleAttribute("pinned", true); - this.tabContainer._invalidateCachedTabs(); - // Then ensure all the tab open/pinning information is sent. -@@ -3631,7 +3780,8 @@ +@@ -3631,7 +3767,8 @@ // needs calling: shouldUpdateForPinnedTabs = true; } @@ -403,7 +379,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b let { groupId } = tabData; const tabGroup = tabGroupWorkingData.get(groupId); // if a tab refers to a tab group we don't know, skip any group -@@ -3645,7 +3795,10 @@ +@@ -3645,7 +3782,10 @@ tabGroup.stateData.id, tabGroup.stateData.color, tabGroup.stateData.collapsed, @@ -415,17 +391,18 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b ); tabsFragment.appendChild(tabGroup.node); } -@@ -3696,6 +3849,9 @@ +@@ -3696,6 +3836,10 @@ this.selectedTab = tabToSelect; this.removeTab(leftoverTab); } + else { + this.selectedTab._possiblyEmpty = this.selectedTab.isEmpty; // Not needed, but just in case. ++ gBrowser.removeTab(this.selectedTab); + } if (tabs.length > 1 || !tabs[0].selected) { this._updateTabsAfterInsert(); -@@ -3882,7 +4038,7 @@ +@@ -3882,7 +4026,7 @@ // Ensure we have an index if one was not provided. if (typeof index != "number") { // Move the new tab after another tab if needed, to the end otherwise. @@ -434,7 +411,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if ( !bulkOrderedOpen && ((openerTab && -@@ -3928,18 +4084,18 @@ +@@ -3928,18 +4072,18 @@ // Ensure index is within bounds. if (tab.pinned) { @@ -457,7 +434,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if (this.isTab(itemAfter) && itemAfter.group == tabGroup) { // Place at the front of, or between tabs in, the same tab group this.tabContainer.insertBefore(tab, itemAfter); -@@ -4260,6 +4416,9 @@ +@@ -4260,6 +4404,9 @@ return; } @@ -467,7 +444,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b this.removeTabs(selectedTabs, { telemetrySource }); } -@@ -4512,6 +4671,7 @@ +@@ -4512,6 +4659,7 @@ telemetrySource, } = {} ) { @@ -475,7 +452,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b // When 'closeWindowWithLastTab' pref is enabled, closing all tabs // can be considered equivalent to closing the window. if ( -@@ -4596,6 +4756,7 @@ +@@ -4596,6 +4744,7 @@ if (lastToClose) { this.removeTab(lastToClose, aParams); } @@ -483,7 +460,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b } catch (e) { console.error(e); } -@@ -4620,6 +4781,7 @@ +@@ -4620,6 +4769,7 @@ telemetrySource, } = {} ) { @@ -491,7 +468,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if (UserInteraction.running("browser.tabs.opening", window)) { UserInteraction.finish("browser.tabs.opening", window); } -@@ -4633,6 +4795,12 @@ +@@ -4633,6 +4783,12 @@ aTab._closeTimeNoAnimTimerId = Glean.browserTabclose.timeNoAnim.start(); } @@ -504,7 +481,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b // Handle requests for synchronously removing an already // asynchronously closing tab. if (!animate && aTab.closing) { -@@ -4647,7 +4815,9 @@ +@@ -4647,7 +4803,9 @@ // frame created for it (for example, by updating the visually selected // state). let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width; @@ -515,7 +492,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if ( !this._beginRemoveTab(aTab, { closeWindowFastpath: true, -@@ -4810,7 +4980,7 @@ +@@ -4810,7 +4968,7 @@ closeWindowWithLastTab != null ? closeWindowWithLastTab : !window.toolbar.visible || @@ -524,7 +501,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if (closeWindow) { // We've already called beforeunload on all the relevant tabs if we get here, -@@ -4834,6 +5004,7 @@ +@@ -4834,6 +4992,7 @@ newTab = true; } @@ -532,7 +509,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b aTab._endRemoveArgs = [closeWindow, newTab]; // swapBrowsersAndCloseOther will take care of closing the window without animation. -@@ -4873,9 +5044,7 @@ +@@ -4873,9 +5032,7 @@ aTab._mouseleave(); if (newTab) { @@ -543,7 +520,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b } else { TabBarVisibility.update(); } -@@ -5004,6 +5173,8 @@ +@@ -5004,6 +5161,8 @@ this.tabs[i]._tPos = i; } @@ -552,7 +529,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if (!this._windowIsClosing) { if (wasPinned) { this.tabContainer._positionPinnedTabs(); -@@ -5129,8 +5300,8 @@ +@@ -5129,8 +5288,8 @@ return closedCount; } @@ -563,7 +540,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if (unloadBlocked) { return; } -@@ -5230,13 +5401,13 @@ +@@ -5230,13 +5389,13 @@ !excludeTabs.has(aTab.owner) && Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose") ) { @@ -579,7 +556,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b ); let tab = this.tabContainer.findNextTab(aTab, { -@@ -5252,7 +5423,7 @@ +@@ -5252,7 +5411,7 @@ } if (tab) { @@ -588,7 +565,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b } // If no qualifying visible tab was found, see if there is a tab in -@@ -5273,7 +5444,7 @@ +@@ -5273,7 +5432,7 @@ }); } @@ -597,7 +574,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b } _blurTab(aTab) { -@@ -5674,10 +5845,10 @@ +@@ -5674,10 +5833,10 @@ SessionStore.deleteCustomTabValue(aTab, "hiddenBy"); } @@ -610,22 +587,22 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b aTab.selected || aTab.closing || // Tabs that are sharing the screen, microphone or camera cannot be hidden. -@@ -5971,7 +6142,7 @@ +@@ -5971,7 +6130,7 @@ // Don't allow mixing pinned and unpinned tabs. if (this.isTab(element) && element.pinned) { - tabIndex = Math.min(tabIndex, this.pinnedTabCount - 1); -+ tabIndex = aTab.hasAttribute('zen-essential') ? Math.min(tabIndex, this._numZenEssentials - 1) : Math.min(tabIndex, this.pinnedTabCount - 1); ++ tabIndex = element.hasAttribute('zen-essential') ? Math.min(tabIndex, this._numZenEssentials - 1) : Math.min(tabIndex, this.pinnedTabCount - 1); } else { tabIndex = Math.max(tabIndex, this.pinnedTabCount); } -@@ -5998,9 +6169,16 @@ +@@ -5998,9 +6157,16 @@ element, () => { let neighbor = this.tabs[tabIndex]; - if (forceUngrouped && neighbor.group) { + const _tPos = element._tPos; -+ if ((forceStandaloneTab && neighbor.group) || neighbor.group?.hasAttribute("split-view-group")) { ++ if ((forceUngrouped && neighbor?.group) || neighbor?.group?.hasAttribute("split-view-group")) { neighbor = neighbor.group; } + if (element.group?.hasAttribute("split-view-group")) { @@ -637,7 +614,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b if (neighbor && this.isTab(element) && tabIndex > element._tPos) { neighbor.after(element); } else { -@@ -6069,7 +6247,9 @@ +@@ -6069,7 +6235,9 @@ targetElement = targetElement.group; } } @@ -648,7 +625,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b // Don't allow mixing pinned and unpinned tabs. if (element.pinned && !targetElement?.pinned) { targetElement = this.tabs[this.pinnedTabCount - 1]; -@@ -6079,7 +6259,13 @@ +@@ -6079,7 +6247,13 @@ moveBefore = true; } @@ -657,12 +634,12 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b + } let getContainer = () => { + if (element.hasAttribute("zen-essential")) { -+ return document.getElementById("zen-essentials-container"); ++ return ZenWorkspaces.getEssentialsSection(element); + } if (element.pinned && this.tabContainer.verticalMode) { return this.tabContainer.verticalPinnedTabsContainer; } -@@ -6139,7 +6325,7 @@ +@@ -6139,7 +6313,7 @@ if (!this.isTab(aTab)) { throw new Error("Can only move a tab into a tab group"); } @@ -671,7 +648,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b return; } if (aTab.group && aTab.group.id === aGroup.id) { -@@ -6233,6 +6419,10 @@ +@@ -6233,6 +6407,10 @@ moveActionCallback(); @@ -682,16 +659,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b // Clear tabs cache after moving nodes because the order of tabs may have // changed. this.tabContainer._invalidateCachedTabs(); -@@ -6290,7 +6480,7 @@ - createLazyBrowser, - }; - -- let numPinned = this.pinnedTabCount; -+ let numPinned = this._numVisiblePinTabs; - if ( - elementIndex < numPinned || - (aTab.pinned && elementIndex == numPinned) -@@ -7050,7 +7240,7 @@ +@@ -7050,7 +7228,7 @@ // preventDefault(). It will still raise the window if appropriate. break; } @@ -700,7 +668,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b window.focus(); aEvent.preventDefault(); break; -@@ -7951,6 +8141,7 @@ +@@ -7951,6 +8129,7 @@ aWebProgress.isTopLevel ) { this.mTab.setAttribute("busy", "true"); @@ -708,7 +676,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b gBrowser._tabAttrModified(this.mTab, ["busy"]); this.mTab._notselectedsinceload = !this.mTab.selected; } -@@ -8924,7 +9115,7 @@ var TabContextMenu = { +@@ -8924,7 +9103,7 @@ var TabContextMenu = { ); contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !this.multiselected; @@ -717,16 +685,7 @@ index bfba253af3253a8cf547a5d69a1695651fc5c203..24cedfa868878d1619c9d9d04a060a0b // Move Tab items let contextMoveTabOptions = document.getElementById( "context_moveTabOptions" -@@ -8958,7 +9149,7 @@ var TabContextMenu = { - let isFirstTab = - !this.contextTabs[0].group && - (this.contextTabs[0] == visibleTabs[0] || -- this.contextTabs[0] == visibleTabs[gBrowser.pinnedTabCount]); -+ this.contextTabs[0] == visibleTabs[gBrowser._numVisiblePinTabs]); - contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent; - - document.getElementById("context_openTabInWindow").disabled = -@@ -9193,6 +9384,7 @@ var TabContextMenu = { +@@ -9193,6 +9372,7 @@ var TabContextMenu = { telemetrySource: gBrowser.TabMetrics.METRIC_SOURCE.TAB_STRIP, }); } else { diff --git a/src/browser/components/tabbrowser/content/tabs-js.patch b/src/browser/components/tabbrowser/content/tabs-js.patch index 6e2604056..9f459bb1c 100644 --- a/src/browser/components/tabbrowser/content/tabs-js.patch +++ b/src/browser/components/tabbrowser/content/tabs-js.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js -index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..eee9613b4405a8a301cef3db1ae6a3f9d21d56ac 100644 +index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..37870bfe9e0d9605907515fd17c437c2dfc167e6 100644 --- a/browser/components/tabbrowser/content/tabs.js +++ b/browser/components/tabbrowser/content/tabs.js @@ -83,7 +83,7 @@ @@ -155,7 +155,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..eee9613b4405a8a301cef3db1ae6a3f9 this.#allTabs = [ - ...this.verticalPinnedTabsContainer.children, -+ ...document.getElementById("zen-essentials-container").children, ...this.verticalPinnedTabsContainer.children, ++ ...ZenWorkspaces.getCurrentEssentialsContainer().children, ...this.verticalPinnedTabsContainer.children, ...children, ]; + const lastPinnedTabIdx = gBrowser.pinnedTabCount; @@ -210,7 +210,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..eee9613b4405a8a301cef3db1ae6a3f9 let focusableItems = []; - for (let child of children) { -+ for (let child of [...document.getElementById("zen-essentials-container").children, ...verticalPinnedTabsContainer.children, ...children]) { ++ for (let child of [...ZenWorkspaces.getCurrentEssentialsContainer().children, ...verticalPinnedTabsContainer.children, ...children]) { if (isTab(child) && child.visible) { child.elementIndex = elementIndex++; focusableItems.push(child); @@ -271,15 +271,6 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..eee9613b4405a8a301cef3db1ae6a3f9 const newTab2 = this.newTabButton; const newTabVertical = document.getElementById( "vertical-tabs-newtab-button" -@@ -1929,7 +1963,7 @@ - let rect = ele => { - return window.windowUtils.getBoundsWithoutFlushing(ele); - }; -- let tab = this.visibleTabs[gBrowser.pinnedTabCount]; -+ let tab = this.visibleTabs[gBrowser._numVisiblePinTabs]; - if (tab && rect(tab).width <= this._tabClipWidth) { - this.setAttribute("closebuttons", "activetab"); - } else { @@ -1941,10 +1975,12 @@ _handleTabSelect(aInstant) { @@ -307,12 +298,12 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..eee9613b4405a8a301cef3db1ae6a3f9 - let tabs = this.visibleTabs; + if (!ZenWorkspaces._hasInitializedTabsStrip) return; + let count = ZenWorkspaces.makeSurePinTabIsInCorrectPosition(); -+ if (gBrowser.pinnedTabCount !== (verticalTabsContainer.children.length - count - 1 + document.getElementById("zen-essentials-container").children.length)) { ++ if (gBrowser.pinnedTabCount !== (verticalTabsContainer.children.length - count - 1 + ZenWorkspaces.getCurrentEssentialsContainer().children.length)) { + let tabs = this.allTabs.filter(tab => !tab.hasAttribute("zen-glance-tab")); for (let i = 0; i < numPinned; i++) { tabs[i].style.marginInlineStart = ""; - verticalTabsContainer.appendChild(tabs[i]); -+ tabs[i].hasAttribute("zen-essential") ? document.getElementById("zen-essentials-container").appendChild(tabs[i].group?.hasAttribute("split-view-group") ? tabs[i].group : tabs[i]) : verticalTabsContainer.insertBefore(tabs[i].group?.hasAttribute("split-view-group") ? tabs[i].group : tabs[i], verticalTabsContainer.lastChild); ++ tabs[i].hasAttribute("zen-essential") ? ZenWorkspaces.getCurrentEssentialsContainer().appendChild(tabs[i].group?.hasAttribute("split-view-group") ? tabs[i].group : tabs[i]) : verticalTabsContainer.insertBefore(tabs[i].group?.hasAttribute("split-view-group") ? tabs[i].group : tabs[i], verticalTabsContainer.lastChild); } } @@ -327,17 +318,15 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..eee9613b4405a8a301cef3db1ae6a3f9 if (!verticalTabsContainer.children.length) { return; -@@ -2117,8 +2150,8 @@ +@@ -2117,7 +2150,7 @@ } _positionPinnedTabs() { - let tabs = this.visibleTabs; -- let numPinned = gBrowser.pinnedTabCount; + let tabs = this.visibleTabs.filter(tab => !tab.hasAttribute("zen-glance-tab")); -+ let numPinned = gBrowser._numVisiblePinTabs; + let numPinned = gBrowser.pinnedTabCount; let absPositionHorizontalTabs = this.overflowing && tabs.length > numPinned && numPinned > 0; - @@ -2127,7 +2160,7 @@ if (this.verticalMode) { @@ -374,7 +363,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..eee9613b4405a8a301cef3db1ae6a3f9 - let tabs = this.ariaFocusableItems.slice( - isPinned ? 0 : numPinned, - isPinned ? numPinned : undefined -+ let isPinned = draggedTab?.group.pinned || draggedTab.pinned; ++ let isPinned = draggedTab?.group ? draggedTab.group.pinned : draggedTab.pinned; + let numPinned = gBrowser._numVisiblePinTabsWithoutCollapsed; + let essential = draggedTab.hasAttribute("zen-essential"); + let tabs = this.ariaFocusableItems.filter(tab => !tab.hasAttribute("zen-glance-tab")).slice( diff --git a/src/zen/tabs/ZenPinnedTabManager.mjs b/src/zen/tabs/ZenPinnedTabManager.mjs index 471021932..c9a2dd7b1 100644 --- a/src/zen/tabs/ZenPinnedTabManager.mjs +++ b/src/zen/tabs/ZenPinnedTabManager.mjs @@ -294,9 +294,6 @@ } gBrowser.tabContainer._invalidateCachedTabs(); newTab.initialize(); - if (!ZenWorkspaces.essentialShouldShowTab(newTab)) { - gBrowser.hideTab(newTab, undefined, true); - } } catch (ex) { console.error('Failed to initialize pinned tabs:', ex); } @@ -729,7 +726,7 @@ try { const pinnedTabsTarget = event.target.closest('#vertical-pinned-tabs-container') || event.target.closest('.zen-current-workspace-indicator'); - const essentialTabsTarget = event.target.closest('#zen-essentials-container'); + const essentialTabsTarget = event.target.closest('.zen-essentials-container'); const tabsTarget = event.target.closest('#tabbrowser-arrowscrollbox'); // Remove group labels from the moving tabs and replace it // with the sub tabs @@ -803,7 +800,7 @@ if (tabsTarget === gBrowser.tabs.at(-1)) { newIndex++; } - gBrowser.moveTabTo(draggedTab, newIndex, { forceStandaloneTab: true }); + gBrowser.moveTabTo(draggedTab, newIndex, { forceUngrouped: true }); } } } @@ -913,7 +910,7 @@ applyDragoverClass(event, draggedTab) { const pinnedTabsTarget = event.target.closest('#vertical-pinned-tabs-container'); - const essentialTabsTarget = event.target.closest('#zen-essentials-container'); + const essentialTabsTarget = event.target.closest('.zen-essentials-container'); const tabsTarget = event.target.closest('#tabbrowser-arrowscrollbox'); let targetTab = event.target.closest('.tabbrowser-tab'); targetTab = targetTab?.group || targetTab; diff --git a/src/zen/tabs/zen-tabs.css b/src/zen/tabs/zen-tabs.css index 49905b837..5ddb9c656 100644 --- a/src/zen/tabs/zen-tabs.css +++ b/src/zen/tabs/zen-tabs.css @@ -5,7 +5,6 @@ */ /* Styles for both vertical and horizontal tabs */ @import url('chrome://browser/content/zen-styles/zen-tabs/vertical-tabs.css'); -@import url('chrome://browser/content/zen-styles/zen-tabs/horizontal-tabs.css'); #zen-tabbox-wrapper { position: relative; diff --git a/src/zen/tabs/zen-tabs/horizontal-tabs.css b/src/zen/tabs/zen-tabs/horizontal-tabs.css deleted file mode 100644 index ecaedd0dd..000000000 --- a/src/zen/tabs/zen-tabs/horizontal-tabs.css +++ /dev/null @@ -1,335 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -@media not -moz-pref('zen.tabs.vertical') { - :root #browser { - display: flex !important; - flex-direction: column !important; - } - - & #navigator-toolbox { - display: flex !important; - flex-direction: row !important; - max-width: unset !important; - min-width: unset !important; - width: 100% !important; - padding: var(--zen-toolbox-padding) !important; - } - - #tabbrowser-tabs { - display: -webkit-box !important; - -webkit-box-orient: horizontal; - -webkit-box-pack: start; - max-width: 10000px !important; - - --tabstrip-min-height: calc(var(--tab-min-height) - 4 * var(--tab-block-margin)); - --tab-min-height: 10px !important; - } - - .vertical-pinned-tabs-container-separator { - display: none !important; - } - - #zen-essentials-container, - #vertical-pinned-tabs-container, - #tabbrowser-arrowscrollbox { - -webkit-box-flex: 1; - } - - #vertical-pinned-tabs-container:empty { - -webkit-box-flex: 0 !important; - width: 0 !important; - padding: 0 !important; - margin: 0 !important; - border: none !important; - visibility: collapse !important; - } - #navigator-toolbox { - flex-direction: row !important; - align-items: center; - } - - #titlebar { - flex-direction: row !important; - width: 100%; - height: 36px !important; - } - - #zen-essentials-container { - --tab-min-height: 36px !important; - display: flex !important; - flex-direction: row !important; - padding-inline-end: 0 !important; - } - - #vertical-pinned-tabs-container { - display: flex !important; - flex-direction: row !important; - padding-inline-end: 0 !important; - } - - #zen-essentials-container .tabbrowser-tab { - width: 0% !important; - } - - #vertical-pinned-tabs-container .tabbrowser-tab { - width: 0% !important; - } - - .tabbrowser-tab[zen-glance-tab='true'] { - .tab-label-container { - display: none !important; - width: 0px !important; - max-width: 0px !important; - } - } - - #tabbrowser-arrowscrollbox { - display: flex !important; - max-width: -moz-available; - overflow: hidden !important; - } - - #TabsToolbar { - flex-direction: row !important; - gap: 8px; - overflow: hidden !important; - display: flex !important; - } - - #TabsToolbar-customization-target { - flex-direction: row !important; - } - - #tabbrowser-tabs[orient='vertical'] { - flex-direction: row !important; - } - - tabs { - flex-direction: row !important; - } - - #zen-essentials-container { - container-name: tab-container; - container-type: normal; - max-width: 36px !important; - flex: 1 1 36px !important; - } - #vertical-pinned-tabs-container { - container-name: tab-container; - container-type: normal; - max-width: 36px !important; - min-width: 36px !important; - flex: 1 1 36px !important; - } - - #vertical-pinned-tabs-container .tab-close-button { - display: none !important; - } - - #vertical-pinned-tabs-container .tab-reset-button { - display: none !important; - } - - #vertical-pinned-tabs-container .tab-label-container { - display: none !important; - } - - #vertical-pinned-tabs-container .tab-icon-image { - margin: 0 !important; - } - - .tabbrowser-tab { - container-name: tab-container; - container-type: normal; - min-width: 40px !important; - flex: 1 1 150px !important; - width: -moz-available; - - &:is(:hover, [visuallyselected]) .tab-close-button { - display: block; - --tab-inline-padding: 0; /* Avoid weird padding */ - margin-inline-end: 0 !important; - } - } - - .tabbrowser-tab[selected] { - flex: 2 0 150px !important; - } - - @container tab-container (max-width: 80px) { - .tab-close-button { - margin-right: 0px !important; - } - .tab-icon-image { - padding: 0 !important; - margin-left: min(2.5px, 5%) !important; - margin-right: min(10px, 5%) !important; - } - .tab-label-container, - .tab-content { - margin: 0 !important; - padding-left: min(8px, 5%) !important; - padding-right: min(8px, 5%) !important; - } - } - - @container tab-container (max-width: 44px) { - .tab-label-container { - display: none !important; - } - .tab-content { - justify-content: space-around !important; - } - .tab-close-button { - display: none !important; - } - .tabbrowser-tab[selected] { - & .tab-icon-image, - .tab-icon-stack { - display: none !important; - } - & .tab-content { - justify-content: space-around !important; - padding: 0 !important; - } - .tab-close-button { - display: block !important; - } - } - } - - #vertical-pinned-tabs-container::after { - z-index: -1; - content: ''; - position: absolute; - right: 0; - width: 1px; - height: 45%; - top: 50%; - transform: translateY(-50%); - background: hsl(255, 10%, 100%); - } - - /* Other UI Elements */ - .zen-current-workspace-indicator { - display: none !important; - } - - #zen-sidebar-splitter { - display: none !important; - } - - #tabbrowser-tabpanels { - padding-left: var(--zen-element-separation) !important; - } - - #appcontent * { - overflow: visible !important; - } - - #TabsToolbar-customization-target::after { - display: none !important; - } - - #zen-sidebar-bottom-buttons { - width: auto !important; - padding: 0 !important; - } - - /* Height Adjustments */ - #vertical-pinned-tabs-container, - #zen-essentials-container, - #tabbrowser-arrowscrollbox { - max-height: none !important; - } - - #PanelUI-zen-gradient-generator { - min-width: 390px !important; - } - - #zen-essentials-container:not(:empty), - #vertical-pinned-tabs-container:not(:empty), - #tabbrowser-arrowscrollbox { - -webkit-box-flex: 1; - min-width: min-content; - width: auto !important; - } - - #vertical-pinned-tabs-container:not(:empty) { - display: -webkit-box !important; - -webkit-box-orient: horizontal; - min-width: fit-content !important; - width: fit-content !important; - position: relative; - margin-right: -1px !important; - } - - #vertical-pinned-tabs-container:not(:empty) .tabbrowser-tab { - position: relative; - display: -webkit-box !important; - } - - #tabbrowser-arrowscrollbox { - margin-left: 0 !important; - } - - #vertical-pinned-tabs-container:empty, - #zen-essentials-container:empty { - -webkit-box-flex: 0 !important; - width: 0 !important; - min-width: 0 !important; - padding: 0 !important; - margin: 0 !important; - border: none !important; - visibility: collapse !important; - } - - #nav-bar { - width: unset !important; - min-width: 500px !important; - } - - #tabbrowser-arrowscrollbox-periphery { - margin: 0 !important; - } - - hbox#nav-bar-customization-target toolbarbutton.chromeclass-toolbar-additional:nth-of-type(1) { - padding-inline-start: var(--toolbar-start-end-padding) !important; - } - - toolbar#PersonalToolbar { - padding-left: 6px !important; - } - - .tab-context-line { - width: 100% !important; - height: 3px !important; - } - - .tabbrowser-tab[zen-glance-tab='true'] { - flex-basis: fit-content !important; - max-width: 36px !important; - } - - #zen-essentials-container .tabbrowser-tab[zen-glance-tab='true'] { - left: 2px; - } - - #vertical-pinned-tabs-container .tabbrowser-tab[zen-glance-tab='true'] { - position: absolute !important; - } - - #TabsToolbar-customization-target toolbarbutton, - #TabsToolbar-customization-target toolbarpaletteitem { - -webkit-box-flex: 0 !important; - min-width: min-content; - width: auto !important; - - .toolbarbutton-text { - display: none !important; - } - } -} diff --git a/src/zen/tabs/zen-tabs/vertical-tabs.css b/src/zen/tabs/zen-tabs/vertical-tabs.css index ab72bcd07..f560c88b5 100644 --- a/src/zen/tabs/zen-tabs/vertical-tabs.css +++ b/src/zen/tabs/zen-tabs/vertical-tabs.css @@ -497,7 +497,7 @@ position: relative; } - & #zen-essentials-container { + & #zen-essentials-wrapper { --tab-min-height: 44px; } @@ -650,7 +650,7 @@ opacity: .4; align-items: center; } - & #zen-essentials-container { + & .zen-essentials-container { justify-content: center; } & #vertical-tabs-newtab-button { @@ -1045,24 +1045,32 @@ /* Mark: Essentials Toolbar */ -#zen-essentials-container { +#zen-essentials-wrapper { + margin-left: calc(-1 * var(--zen-toolbox-padding)); + min-width: calc(100% + var(--zen-toolbox-padding) * 2); +} + +.zen-essentials-container { padding-bottom: var(--zen-toolbox-padding); overflow: hidden; gap: calc(var(--zen-toolbox-padding) - 2px); -} - -#zen-essentials-container { - overflow: hidden; transition: max-height 0.3s ease-out; opacity: 1; grid-template-columns: repeat(auto-fit, minmax(49px, auto)); overflow: hidden; scrollbar-width: thin; + min-width: calc(100% + var(--zen-toolbox-padding) * 2); + padding: 0 var(--zen-toolbox-padding); + + transform: none !important; /* TODO: Animate essentials transition */ display: grid; - padding: 0; + &[hidden='true'] { + opacity: 0; + pointer-events: none; + } } -#zen-essentials-container > .tabbrowser-tab, +.zen-essentials-container > .tabbrowser-tab, #zen-welcome-initial-essentials-browser-sidebar-essentials .tabbrowser-tab { --toolbarbutton-inner-padding: 0; max-width: unset; @@ -1240,15 +1248,6 @@ } } -/* Horizontal tabs reordering indicators */ -#zen-essentials-container .tabbrowser-tab.drag-over-before { - box-shadow: 3px 0 6px -2px var(--toolbarbutton-active-background, rgba(0, 255, 0, 0.2)); -} - -#zen-essentials-container .tabbrowser-tab.drag-over-after { - box-shadow: -3px 0 6px -2px var(--toolbarbutton-active-background, rgba(0, 255, 0, 0.2)); -} - /* Renaming tabs */ .tab-label-container-editing { display: none !important; @@ -1267,9 +1266,12 @@ .zen-workspace-tabs-section { position: absolute; transform: translateX(-100%); - min-width: calc(100% - var(--zen-toolbox-padding) * 2); - &:not(.zen-current-workspace-indicator) { + &:not(.zen-essentials-container) { + min-width: calc(100% - var(--zen-toolbox-padding) * 2); + } + + &:not(.zen-current-workspace-indicator):not(.zen-essentials-container) { margin: 0 var(--zen-toolbox-padding); } } diff --git a/src/zen/vendor/motion.min.mjs b/src/zen/vendor/motion.min.mjs index 915552945..ec84ad10a 100644 --- a/src/zen/vendor/motion.min.mjs +++ b/src/zen/vendor/motion.min.mjs @@ -1,7 +1,8 @@ /** - * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.37.0. - * Original file: /npm/motion@11.17.0/dist/es/motion/lib/index.mjs + * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0. + * Original file: /npm/motion@12.7.4/dist/es/motion/lib/index.mjs * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ -const t=!1;function e(){return t}const n=t=>t;let s=n;const i=(t,e,n)=>{const s=e-t;return 0===s?1:(n-t)/s};function r(t){let e;return()=>(void 0===e&&(e=t()),e)}const o=r((()=>void 0!==window.ScrollTimeline));class a{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>"finished"in t?t.finished:t)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;no()&&n.attachTimeline?n.attachTimeline(t):"function"==typeof e?e(n):void 0));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;ee[t]()))}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class l extends a{then(t,e){return Promise.all(this.animations).then(t).catch(e)}}const u=t=>1e3*t,c=t=>t/1e3,h=2e4;function d(t){let e=0;let n=t.next(e);for(;!n.done&&e=h?1/0:e}const p=(t,e,n=10)=>{let s="";const r=Math.max(Math.round(e/n),2);for(let e=0;en>e?e:n{const s=e*o,i=s*t,r=s-n,a=R(e,o),l=Math.exp(-i);return C-r/a*l},r=e=>{const s=e*o*t,r=s*n+n,a=Math.pow(o,2)*Math.pow(e,2)*t,l=Math.exp(-s),u=R(Math.pow(e,2),o);return(-i(e)+C>0?-1:1)*((r-a)*l)/u}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,r=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let s=n;for(let n=1;nvoid 0!==t[e]))}function L(t=S,e=T){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:l,damping:m,mass:x,duration:M,velocity:P,isResolvedFromDuration:k}=function(t){let e={velocity:b,stiffness:y,damping:v,mass:w,isResolvedFromDuration:!1,...t};if(!D(t,I)&&D(t,B))if(t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(1.2*n),i=s*s,r=2*f(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:w,stiffness:i,damping:r}}else{const n=E(t);e={...e,...n,mass:w},e.isResolvedFromDuration=!0}return e}({...n,velocity:-c(n.velocity||0)}),F=P||0,C=m/(2*Math.sqrt(l*x)),O=o-r,L=c(Math.sqrt(l/x)),W=Math.abs(O)<5;let N;if(s||(s=W?A.granular:A.default),i||(i=W?V.granular:V.default),C<1){const t=R(L,C);N=e=>{const n=Math.exp(-C*L*e);return o-n*((F+C*L*O)/t*Math.sin(t*e)+O*Math.cos(t*e))}}else if(1===C)N=t=>o-Math.exp(-L*t)*(O+(F+L*O)*t);else{const t=L*Math.sqrt(C*C-1);N=e=>{const n=Math.exp(-C*L*e),s=Math.min(t*e,300);return o-n*((F+C*L*O)*Math.sinh(s)+t*O*Math.cosh(s))/t}}const K={calculatedDuration:k&&M||null,next:t=>{const e=N(t);if(k)a.done=t>=M;else{let n=0;C<1&&(n=0===t?u(F):g(N,t,e));const r=Math.abs(n)<=s,l=Math.abs(o-e)<=i;a.done=r&&l}return a.value=a.done?o:e,a},toString:()=>{const t=Math.min(d(K),h),e=p((e=>K.next(t*e).value),t,30);return t+"ms "+e}};return K}function W(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(d(s),h);return{type:"keyframes",ease:t=>s.next(i*t).value/e,duration:c(i)}}function N(t){return"function"==typeof t}const K=(t,e,n)=>{const s=e-t;return((n-t)%s+s)%s+t},$=t=>Array.isArray(t)&&"number"!=typeof t[0];function j(t,e){return $(t)?t[K(0,t.length,e)]:t}const z=(t,e,n)=>t+(e-t)*n;function H(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const r=i(0,e,s);t.push(z(n,1,r))}}function U(t){const e=[0];return H(e,t.length-1),e}const Y=t=>Boolean(t&&t.getVelocity);function q(t,e,n){var s;if(t instanceof Element)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const r=null!==(s=null==n?void 0:n[t])&&void 0!==s?s:i.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t)}function X(t){return"object"==typeof t&&!Array.isArray(t)}function G(t,e,n,s){return"string"==typeof t&&X(e)?q(t,n,s):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function Z(t,e,n){return t*(e+1)}function _(t,e,n,s){var i;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(i=s.get(e))&&void 0!==i?i:t}function J(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function Q(t,e,n,s,i,r){!function(t,e,n){for(let s=0;se&&i.at"number"==typeof t,at=t=>t.every(ot),lt=new WeakMap;function ut(t,e){return t?t[e]||t.default||t:void 0}const ct=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ht=new Set(ct),dt=new Set(["width","height","top","left","right","bottom",...ct]),pt=t=>(t=>Array.isArray(t))(t)?t[t.length-1]||0:t,ft=!1;const mt=["read","resolveKeyframes","update","preRender","render","postRender"];const{schedule:gt,cancel:yt,state:vt,steps:wt}=function(t,e){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=mt.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,s=!1,i=!1;const r=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(e){r.has(e)&&(l.schedule(e),t()),e(o)}const l={schedule:(t,i=!1,o=!1)=>{const a=o&&s?e:n;return i&&r.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),r.delete(t)},process:t=>{o=t,s?i=!0:(s=!0,[e,n]=[n,e],e.forEach(a),e.clear(),s=!1,i&&(i=!1,l.process(t)))}};return l}(r),t)),{}),{read:a,resolveKeyframes:l,update:u,preRender:c,render:h,postRender:d}=o,p=()=>{const r=performance.now();n=!1,i.delta=s?1e3/60:Math.max(Math.min(r-i.timestamp,40),1),i.timestamp=r,i.isProcessing=!0,a.process(i),l.process(i),u.process(i),c.process(i),h.process(i),d.process(i),i.isProcessing=!1,n&&e&&(s=!1,t(p))};return{schedule:mt.reduce(((e,r)=>{const a=o[r];return e[r]=(e,r=!1,o=!1)=>(n||(n=!0,s=!0,i.isProcessing||t(p)),a.schedule(e,r,o)),e}),{}),cancel:t=>{for(let e=0;e(void 0===bt&&Tt.set(vt.isProcessing||ft?vt.timestamp:performance.now()),bt),set:t=>{bt=t,queueMicrotask(xt)}};class St{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>J(this.subscriptions,t)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let i=0;i{const n=Tt.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=Tt.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new St);const n=this.events[t].add(e);return"change"===t?()=>{n(),gt.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Tt.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return m(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Vt(t,e){return new At(t,e)}function Mt(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Pt(t,e,n,s){if("function"==typeof e){const[i,r]=Mt(s);e=e(void 0!==n?n:t.custom,i,r)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,r]=Mt(s);e=e(void 0!==n?n:t.custom,i,r)}return e}function kt(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Vt(n))}function Ft(t,e){const n=function(t,e,n){const s=t.getProps();return Pt(s,e,void 0!==n?n:s.custom,t)}(t,e);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const e in r){kt(t,e,pt(r[e]))}}function Ct(t,e){const n=t.getValue("willChange");if(s=n,Boolean(Y(s)&&s.add))return n.add(e);var s}const Et=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ot="data-"+Et("framerAppearId");function Rt(t){return t.props[Ot]}function Bt(t,e){t.timeline=e,t.onfinish=null}const It=t=>Array.isArray(t)&&"number"==typeof t[0],Dt={linearEasing:void 0};function Lt(t,e){const n=r(t);return()=>{var t;return null!==(t=Dt[e])&&void 0!==t?t:n()}}const Wt=Lt((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function Nt(t){return Boolean("function"==typeof t&&Wt()||!t||"string"==typeof t&&(t in $t||Wt())||It(t)||Array.isArray(t)&&t.every(Nt))}const Kt=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,$t={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Kt([0,.65,.55,1]),circOut:Kt([.55,0,1,.45]),backIn:Kt([.31,.01,.66,-.59]),backOut:Kt([.33,1.53,.69,.99])};function jt(t,e){return t?"function"==typeof t&&Wt()?p(t,e):It(t)?Kt(t):Array.isArray(t)?t.map((t=>jt(t,e)||$t.easeOut)):$t[t]:void 0}const zt=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function Ht(t,e,s,i){if(t===e&&s===i)return n;const r=e=>function(t,e,n,s,i){let r,o,a=0;do{o=e+(n-e)/2,r=zt(o,s,i)-t,r>0?n=o:e=o}while(Math.abs(r)>1e-7&&++a<12);return o}(e,0,1,t,s);return t=>0===t||1===t?t:zt(r(t),e,i)}const Ut=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Yt=t=>e=>1-t(1-e),qt=Ht(.33,1.53,.69,.99),Xt=Yt(qt),Gt=Ut(Xt),Zt=t=>(t*=2)<1?.5*Xt(t):.5*(2-Math.pow(2,-10*(t-1))),_t=t=>1-Math.sin(Math.acos(t)),Jt=Yt(_t),Qt=Ut(_t),te=t=>/^0[^.\s]+$/u.test(t);const ee={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},ne={...ee,transform:t=>f(0,1,t)},se={...ee,default:1},ie=t=>Math.round(1e5*t)/1e5,re=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const oe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ae=(t,e)=>n=>Boolean("string"==typeof n&&oe.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),le=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[i,r,o,a]=s.match(re);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:void 0!==a?parseFloat(a):1}},ue={...ee,transform:t=>Math.round((t=>f(0,255,t))(t))},ce={test:ae("rgb","red"),parse:le("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+ue.transform(t)+", "+ue.transform(e)+", "+ue.transform(n)+", "+ie(ne.transform(s))+")"};const he={test:ae("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:ce.transform},de=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),pe=de("deg"),fe=de("%"),me=de("px"),ge=de("vh"),ye=de("vw"),ve={...fe,parse:t=>fe.parse(t)/100,transform:t=>fe.transform(100*t)},we={test:ae("hsl","hue"),parse:le("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+fe.transform(ie(e))+", "+fe.transform(ie(n))+", "+ie(ne.transform(s))+")"},be={test:t=>ce.test(t)||he.test(t)||we.test(t),parse:t=>ce.test(t)?ce.parse(t):we.test(t)?we.parse(t):he.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?ce.transform(t):we.transform(t)},xe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Te="number",Se="color",Ae=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ve(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const o=e.replace(Ae,(t=>(be.test(t)?(s.color.push(r),i.push(Se),n.push(be.parse(t))):t.startsWith("var(")?(s.var.push(r),i.push("var"),n.push(t)):(s.number.push(r),i.push(Te),n.push(parseFloat(t))),++r,"${}"))).split("${}");return{values:n,split:o,indexes:s,types:i}}function Me(t){return Ve(t).values}function Pe(t){const{split:e,types:n}=Ve(t),s=e.length;return t=>{let i="";for(let r=0;r"number"==typeof t?0:t;const Fe={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(re))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(xe))||void 0===n?void 0:n.length)||0)>0},parse:Me,createTransformer:Pe,getAnimatableNone:function(t){const e=Me(t);return Pe(t)(e.map(ke))}},Ce=new Set(["brightness","contrast","saturate","opacity"]);function Ee(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=n.match(re)||[];if(!s)return t;const i=n.replace(s,"");let r=Ce.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const Oe=/\b([a-z-]*)\(.*?\)/gu,Re={...Fe,getAnimatableNone:t=>{const e=t.match(Oe);return e?e.map(Ee).join(" "):t}},Be={borderWidth:me,borderTopWidth:me,borderRightWidth:me,borderBottomWidth:me,borderLeftWidth:me,borderRadius:me,radius:me,borderTopLeftRadius:me,borderTopRightRadius:me,borderBottomRightRadius:me,borderBottomLeftRadius:me,width:me,maxWidth:me,height:me,maxHeight:me,top:me,right:me,bottom:me,left:me,padding:me,paddingTop:me,paddingRight:me,paddingBottom:me,paddingLeft:me,margin:me,marginTop:me,marginRight:me,marginBottom:me,marginLeft:me,backgroundPositionX:me,backgroundPositionY:me},Ie={rotate:pe,rotateX:pe,rotateY:pe,rotateZ:pe,scale:se,scaleX:se,scaleY:se,scaleZ:se,skew:pe,skewX:pe,skewY:pe,distance:me,translateX:me,translateY:me,translateZ:me,x:me,y:me,z:me,perspective:me,transformPerspective:me,opacity:ne,originX:ve,originY:ve,originZ:me},De={...ee,transform:Math.round},Le={...Be,...Ie,zIndex:De,size:me,fillOpacity:ne,strokeOpacity:ne,numOctaves:De},We={...Le,color:be,backgroundColor:be,outlineColor:be,fill:be,stroke:be,borderColor:be,borderTopColor:be,borderRightColor:be,borderBottomColor:be,borderLeftColor:be,filter:Re,WebkitFilter:Re},Ne=t=>We[t];function Ke(t,e){let n=Ne(t);return n!==Re&&(n=Fe),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const $e=new Set(["auto","none","0"]);const je=t=>t===ee||t===me,ze=(t,e)=>parseFloat(t.split(", ")[e]),He=(t,e)=>(n,{transform:s})=>{if("none"===s||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/u);if(i)return ze(i[1],e);{const e=s.match(/^matrix\((.+)\)$/u);return e?ze(e[1],t):0}},Ue=new Set(["x","y","z"]),Ye=ct.filter((t=>!Ue.has(t)));const qe={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:He(4,13),y:He(5,14)};qe.translateX=qe.x,qe.translateY=qe.y;const Xe=new Set;let Ge=!1,Ze=!1;function _e(){if(Ze){const t=Array.from(Xe).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return Ye.forEach((n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var s;null===(s=t.getValue(e))||void 0===s||s.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}Ze=!1,Ge=!1,Xe.forEach((t=>t.complete())),Xe.clear()}function Je(){Xe.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Ze=!0)}))}class Qe{constructor(t,e,n,s,i,r=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=s,this.element=i,this.isAsync=r}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Xe.add(this),Ge||(Ge=!0,gt.read(Je),gt.resolveKeyframes(_e))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:s}=this;for(let i=0;i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),en=t=>e=>"string"==typeof e&&e.startsWith(t),nn=en("--"),sn=en("var(--"),rn=t=>!!sn(t)&&on.test(t.split("/*")[0].trim()),on=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,an=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ln(t,e,n=1){const[s,i]=function(t){const e=an.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${null!=n?n:s}`,i]}(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);if(r){const t=r.trim();return tn(t)?parseFloat(t):t}return rn(i)?ln(i,e,n+1):i}const un=t=>e=>e.test(t),cn=[ee,me,fe,pe,ye,ge,{test:t=>"auto"===t,parse:t=>t}],hn=t=>cn.find(un(t));class dn extends Qe{constructor(t,e,n,s,i){super(t,e,n,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}const pn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Fe.test(t)&&"0"!==t||t.startsWith("url(")));function fn(t,e,n,s){const i=t[0];if(null===i)return!1;if("display"===e||"visibility"===e)return!0;const r=t[t.length-1],o=pn(i,e),a=pn(r,e);return!(!o||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;nnull!==t;function gn(t,{repeat:e,repeatType:n="loop"},s){const i=t.filter(mn),r=e&&"loop"!==n&&e%2==1?0:i.length-1;return r&&void 0!==s?s:i[r]}class yn{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Tt.now(),this.options={autoplay:t,delay:e,type:n,repeat:s,repeatDelay:i,repeatType:r,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Je(),_e()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Tt.now(),this.hasAttemptedResolve=!0;const{name:n,type:s,velocity:i,delay:r,onComplete:o,onUpdate:a,isGenerator:l}=this.options;if(!l&&!fn(t,n,s,i)){if(!r)return null==a||a(gn(t,this.options,e)),null==o||o(),void this.resolveFinishedPromise();this.options.duration=0}const u=this.initPlayback(t,e);!1!==u&&(this._resolved={keyframes:t,finalKeyframe:e,...u},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function vn(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function wn(t,e){return n=>n>0?e:t}const bn=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},xn=[he,ce,we];function Tn(t){const e=(n=t,xn.find((t=>t.test(n))));var n;if(!Boolean(e))return!1;let s=e.parse(t);return e===we&&(s=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,r=0,o=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,a=2*n-s;i=vn(a,s,t+1/3),r=vn(a,s,t),o=vn(a,s,t-1/3)}else i=r=o=n;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*o),alpha:s}}(s)),s}const Sn=(t,e)=>{const n=Tn(t),s=Tn(e);if(!n||!s)return wn(t,e);const i={...n};return t=>(i.red=bn(n.red,s.red,t),i.green=bn(n.green,s.green,t),i.blue=bn(n.blue,s.blue,t),i.alpha=z(n.alpha,s.alpha,t),ce.transform(i))},An=(t,e)=>n=>e(t(n)),Vn=(...t)=>t.reduce(An),Mn=new Set(["none","hidden"]);function Pn(t,e){return n=>z(t,e,n)}function kn(t){return"number"==typeof t?Pn:"string"==typeof t?rn(t)?wn:be.test(t)?Sn:En:Array.isArray(t)?Fn:"object"==typeof t?be.test(t)?Sn:Cn:wn}function Fn(t,e){const n=[...t],s=n.length,i=t.map(((t,n)=>kn(t)(t,e[n])));return t=>{for(let e=0;e{for(const e in s)n[e]=s[e](t);return n}}const En=(t,e)=>{const n=Fe.createTransformer(e),s=Ve(t),i=Ve(e);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?Mn.has(t)&&!i.values.length||Mn.has(e)&&!s.values.length?function(t,e){return Mn.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Vn(Fn(function(t,e){var n;const s=[],i={color:0,var:0,number:0};for(let r=0;rvoid 0===a?l:void 0===l||Math.abs(a-t)-f*Math.exp(-t/s),w=t=>y+v(t),b=t=>{const e=v(t),n=w(t);d.done=Math.abs(e)<=u,d.value=d.done?y:n};let x,T;const S=t=>{var e;(e=d.value,void 0!==a&&el)&&(x=t,T=L({keyframes:[d.value,p(d.value)],velocity:g(w,t,d.value),damping:i,stiffness:r,restDelta:u,restSpeed:c}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==x||(e=!0,b(t),S(t)),void 0!==x&&t>=x?T.next(t-x):(!e&&b(t),d)}}}const Bn=Ht(.42,0,1,1),In=Ht(0,0,.58,1),Dn=Ht(.42,0,.58,1),Ln={linear:n,easeIn:Bn,easeInOut:Dn,easeOut:In,circIn:_t,circInOut:Qt,circOut:Jt,backIn:Xt,backInOut:Gt,backOut:qt,anticipate:Zt},Wn=t=>{if(It(t)){s(4===t.length);const[e,n,i,r]=t;return Ht(e,n,i,r)}return"string"==typeof t?Ln[t]:t};function Nn(t,e,{clamp:r=!0,ease:o,mixer:a}={}){const l=t.length;if(s(l===e.length),1===l)return()=>e[0];if(2===l&&e[0]===e[1])return()=>e[1];const u=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),e=[...e].reverse());const c=function(t,e,s){const i=[],r=s||On,o=t.length-1;for(let s=0;s{if(u&&n1)for(;sd(f(t[0],t[l-1],e)):d}function Kn({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=$(s)?s.map(Wn):Wn(s),r={done:!1,value:e[0]},o=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:U(e),t),a=Nn(o,e,{ease:Array.isArray(i)?i:(l=e,u=i,l.map((()=>u||Dn)).splice(0,l.length-1))});var l,u;return{calculatedDuration:t,next:e=>(r.value=a(e),r.done=e>=t,r)}}const $n=t=>{const e=({timestamp:e})=>t(e);return{start:()=>gt.update(e,!0),stop:()=>yt(e),now:()=>vt.isProcessing?vt.timestamp:Tt.now()}},jn={decay:Rn,inertia:Rn,tween:Kn,keyframes:Kn,spring:L},zn=t=>t/100;class Hn extends yn{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:s,keyframes:i}=this.options,r=(null==s?void 0:s.KeyframeResolver)||Qe;this.resolver=new r(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:i,velocity:r=0}=this.options,o=N(e)?e:jn[e]||Kn;let a,l;o!==Kn&&"number"!=typeof t[0]&&(a=Vn(zn,On(t[0],t[1])),t=[0,100]);const u=o({...this.options,keyframes:t});"mirror"===i&&(l=o({...this.options,keyframes:[...t].reverse(),velocity:-r})),null===u.calculatedDuration&&(u.calculatedDuration=d(u));const{calculatedDuration:c}=u,h=c+s;return{generator:u,mirroredGenerator:l,mapPercentToKeyframes:a,calculatedDuration:c,resolvedDuration:h,totalDuration:h*(n+1)-s}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:r,mapPercentToKeyframes:o,keyframes:a,calculatedDuration:l,totalDuration:u,resolvedDuration:c}=n;if(null===this.startTime)return i.next(0);const{delay:h,repeat:d,repeatType:p,repeatDelay:m,onUpdate:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-h*(this.speed>=0?1:-1),v=this.speed>=0?y<0:y>u;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let w=this.currentTime,b=i;if(d){const t=Math.min(this.currentTime,u)/c;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===p?(n=1-n,m&&(n-=m/c)):"mirror"===p&&(b=r)),w=f(0,1,n)*c}const x=v?{done:!1,value:a[0]}:b.next(w);o&&(x.value=o(x.value));let{done:T}=x;v||null===l||(T=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&T);return S&&void 0!==s&&(x.value=gn(a,this.options,s)),g&&g(x.value),S&&this.finish(),x}get duration(){const{resolved:t}=this;return t?c(t.calculatedDuration):0}get time(){return c(this.currentTime)}set time(t){t=u(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=c(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=$n,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const s=this.driver.now();null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=s):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const Un=new Set(["opacity","clipPath","filter","transform"]);function Yn(t,e,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:o="loop",ease:a="easeInOut",times:l}={}){const u={[e]:n};l&&(u.offset=l);const c=jt(a,i);return Array.isArray(c)&&(u.easing=c),t.animate(u,{delay:s,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===o?"alternate":"normal"})}const qn=r((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const Xn={anticipate:Zt,backInOut:Gt,circInOut:Qt};class Gn extends yn{constructor(t){super(t);const{name:e,motionValue:n,element:s,keyframes:i}=this.options;this.resolver=new dn(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,s),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:s=300,times:i,ease:r,type:o,motionValue:a,name:l,startTime:u}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;var c;if("string"==typeof r&&Wt()&&r in Xn&&(r=Xn[r]),N((c=this.options).type)||"spring"===c.type||!Nt(c.ease)){const{onComplete:e,onUpdate:n,motionValue:a,element:l,...u}=this.options,c=function(t,e){const n=new Hn({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const i=[];let r=0;for(;!s.done&&r<2e4;)s=n.sample(r),i.push(s.value),r+=10;return{times:void 0,keyframes:i,duration:r-10,ease:"linear"}}(t,u);1===(t=c.keyframes).length&&(t[1]=t[0]),s=c.duration,i=c.times,r=c.ease,o="keyframes"}const h=Yn(a.owner.current,l,t,{...this.options,duration:s,times:i,ease:r});return h.startTime=null!=u?u:this.calcStartTime(),this.pendingTimeline?(Bt(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;a.set(gn(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:s,times:i,type:o,ease:r,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return c(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return c(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=u(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return n;const{animation:s}=e;Bt(s,t)}else this.pendingTimeline=t;return n}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:s,type:i,ease:r,times:o}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:l,...c}=this.options,h=new Hn({...c,keyframes:n,duration:s,type:i,ease:r,times:o,isGenerator:!0}),d=u(this.time);t.setWithVelocity(h.sample(d-10).value,h.sample(d).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:s,repeatType:i,damping:r,type:o}=t;return qn()&&n&&Un.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!s&&"mirror"!==i&&0!==r&&"inertia"!==o}}const Zn={type:"spring",stiffness:500,damping:25,restSpeed:10},_n={type:"keyframes",duration:.8},Jn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Qn=(t,{keyframes:e})=>e.length>2?_n:ht.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Zn:Jn;const ts=(t,e,n,s={},i,r)=>o=>{const a=ut(s,t)||{},c=a.delay||s.delay||0;let{elapsed:h=0}=s;h-=u(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-h,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:r?void 0:i};(function({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length})(a)||(d={...d,...Qn(t,d)}),d.duration&&(d.duration=u(d.duration)),d.repeatDelay&&(d.repeatDelay=u(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let p=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(d.duration=0,0===d.delay&&(p=!0)),p&&!r&&void 0!==e.get()){const t=gn(d.keyframes,a);if(void 0!==t)return gt.update((()=>{d.onUpdate(t),d.onComplete()})),new l([])}return!r&&Gn.supports(d)?new Gn(d):new Hn(d)};function es({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}function ns(t,e,{delay:n=0,transitionOverride:s,type:i}={}){var r;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...l}=e;s&&(o=s);const u=[],c=i&&t.animationState&&t.animationState.getState()[i];for(const e in l){const s=t.getValue(e,null!==(r=t.latestValues[e])&&void 0!==r?r:null),i=l[e];if(void 0===i||c&&es(c,e))continue;const a={delay:n,...ut(o||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=Rt(t);if(n){const t=window.MotionHandoffAnimation(n,e,gt);null!==t&&(a.startTime=t,h=!0)}}Ct(t,e),s.start(ts(e,s,i,t.shouldReduceMotion&&dt.has(e)?{type:!1}:a,t,h));const d=s.animation;d&&u.push(d)}return a&&Promise.all(u).then((()=>{gt.update((()=>{a&&Ft(t,a)}))})),u}const ss=()=>({x:{min:0,max:0},y:{min:0,max:0}}),is={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},rs={};for(const t in is)rs[t]={isEnabled:e=>is[t].some((t=>!!e[t]))};const os="undefined"!=typeof window,as={current:null},ls={current:!1};const us=[...cn,be,Fe];const cs=["initial","animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"];function hs(t){return null!==(e=t.animate)&&"object"==typeof e&&"function"==typeof e.start||cs.some((e=>function(t){return"string"==typeof t||Array.isArray(t)}(t[e])));var e}const ds=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class ps{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:s,blockInitialAnimation:i,visualState:r},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Qe,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Tt.now();this.renderScheduledAtthis.bindToMotionValue(e,t))),ls.current||function(){if(ls.current=!0,os)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>as.current=t.matches;t.addListener(e),e()}else as.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||as.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){lt.delete(this.current),this.projection&&this.projection.unmount(),yt(this.notifyUpdate),yt(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=ht.has(t),s=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&>.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),i=e.on("renderRequest",this.scheduleRender);let r;window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{s(),i(),r&&r(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in rs){const e=rs[t];if(!e)continue;const{isEnabled:n,Feature:s}=e;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;ee.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Vt(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let s=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var i;return null!=s&&("string"==typeof s&&(tn(s)||te(s))?s=parseFloat(s):(i=s,!us.find(un(i))&&Fe.test(e)&&(s=Ke(t,e))),this.setBaseTarget(t,Y(s)?s.get():s)),Y(s)?s.get():s}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let s;if("string"==typeof n||"object"==typeof n){const i=Pt(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);i&&(s=i[t])}if(n&&void 0!==s)return s;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||Y(i)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new St),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class fs extends ps{constructor(){super(...arguments),this.KeyframeResolver=dn}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Y(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}const ms=(t,e)=>e&&"number"==typeof t?e.transform(t):t,gs={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ys=ct.length;function vs(t,e,n){const{style:s,vars:i,transformOrigin:r}=t;let o=!1,a=!1;for(const t in e){const n=e[t];if(ht.has(t))o=!0;else if(nn(t))i[t]=n;else{const e=ms(n,Le[t]);t.startsWith("origin")?(a=!0,r[t]=e):s[t]=e}}if(e.transform||(o||n?s.transform=function(t,e,n){let s="",i=!0;for(let r=0;r{const l=it(t),{delay:c=0,times:h=U(l),type:d="keyframes",repeat:m,repeatType:g,repeatDelay:v=0,...w}=n;let{ease:b=e.ease||"easeOut",duration:x}=n;const T="function"==typeof c?c(i,a):c,S=l.length,A=N(d)?d:null==r?void 0:r[d];if(S<=2&&A){let t=100;if(2===S&&at(l)){const e=l[1]-l[0];t=Math.abs(e)}const e={...w};void 0!==x&&(e.duration=u(x));const n=W(e,t,A);b=n.ease,x=n.duration}null!=x||(x=o);const V=p+T;1===h.length&&0===h[0]&&(h[1]=1);const M=h.length-l.length;if(M>0&&H(h,M),1===l.length&&l.unshift(null),m){x=Z(x,m);const t=[...l],e=[...h];b=Array.isArray(b)?[...b]:[b];const n=[...b];for(let s=0;s{for(const r in t){const o=t[r];o.sort(et);const l=[],u=[],c=[];for(let t=0;t{s.push(...Rs(n,t,e))})),s}function Is(t){return function(e,n,s){let i=[];var r;r=e,i=Array.isArray(r)&&r.some(Array.isArray)?Bs(e,n,t):Rs(e,n,s,t);const o=new l(i);return t&&t.animations.push(o),o}}const Ds=Is();class Ls{constructor(t){this.animation=t}get duration(){var t,e,n;const s=(null===(e=null===(t=this.animation)||void 0===t?void 0:t.effect)||void 0===e?void 0:e.getComputedTiming().duration)||(null===(n=this.options)||void 0===n?void 0:n.duration)||300;return c(Number(s))}get time(){var t;return this.animation?c((null===(t=this.animation)||void 0===t?void 0:t.currentTime)||0):0}set time(t){this.animation&&(this.animation.currentTime=u(t))}get speed(){return this.animation?this.animation.playbackRate:1}set speed(t){this.animation&&(this.animation.playbackRate=t)}get state(){return this.animation?this.animation.playState:"finished"}get startTime(){return this.animation?this.animation.startTime:null}get finished(){return this.animation?this.animation.finished:Promise.resolve()}play(){this.animation&&this.animation.play()}pause(){this.animation&&this.animation.pause()}stop(){this.animation&&"idle"!==this.state&&"finished"!==this.state&&(this.animation.commitStyles&&this.animation.commitStyles(),this.cancel())}flatten(){var t;this.animation&&(null===(t=this.animation.effect)||void 0===t||t.updateTiming({easing:"linear"}))}attachTimeline(t){return this.animation&&Bt(this.animation,t),n}complete(){this.animation&&this.animation.finish()}cancel(){try{this.animation&&this.animation.cancel()}catch(t){}}}function Ws(t,e,n){t.style.setProperty(`--${e}`,n)}function Ns(t,e,n){t.style[e]=n}const Ks=r((()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0})),$s=new WeakMap;const js="easeOut";function zs(t){const e=$s.get(t)||new Map;return $s.set(t,e),$s.get(t)}class Hs extends Ls{constructor(t,e,n,i){const r=e.startsWith("--");s("string"!=typeof i.type);const o=zs(t).get(e);o&&o.stop();if(Array.isArray(n)||(n=[n]),function(t,e,n){for(let s=0;se.startsWith("--")?t.style.getPropertyValue(e):window.getComputedStyle(t)[e])),N(i.type)){const t=W(i,100,i.type);i.ease=Wt()?t.ease:js,i.duration=u(t.duration),i.type="keyframes"}else i.ease=i.ease||js;const a=()=>{this.setValue(t,e,gn(n,i)),this.cancel(),this.resolveFinishedPromise()},l=()=>{this.setValue=r?Ws:Ns,this.options=i,this.updateFinishedPromise(),this.removeAnimation=()=>{var n;return null===(n=$s.get(t))||void 0===n?void 0:n.delete(e)}};qn()?(super(Yn(t,e,n,i)),l(),!1===i.autoplay&&this.animation.pause(),this.animation.onfinish=a,zs(t).set(e,this)):(super(),l(),a())}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}play(){"finished"===this.state&&this.updateFinishedPromise(),super.play()}cancel(){this.removeAnimation(),super.cancel()}}const Us=t=>function(e,n,s){return new l(function(t,e,n,s){const i=q(t,s),r=i.length,o=[];for(let t=0;t{const{currentTime:s}=e,i=(null===s?0:s.value)/100;n!==i&&t(i),n=i};return gt.update(s,!0),()=>yt(s)}const Xs=new WeakMap;let Gs;function Zs({target:t,contentRect:e,borderBoxSize:n}){var s;null===(s=Xs.get(t))||void 0===s||s.forEach((s=>{s({target:t,contentSize:e,get size(){return function(t,e){if(e){const{inlineSize:t,blockSize:n}=e[0];return{width:t,height:n}}return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}(t,n)}})}))}function _s(t){t.forEach(Zs)}function Js(t,e){Gs||"undefined"!=typeof ResizeObserver&&(Gs=new ResizeObserver(_s));const n=q(t);return n.forEach((t=>{let n=Xs.get(t);n||(n=new Set,Xs.set(t,n)),n.add(e),null==Gs||Gs.observe(t)})),()=>{n.forEach((t=>{const n=Xs.get(t);null==n||n.delete(e),(null==n?void 0:n.size)||null==Gs||Gs.unobserve(t)}))}}const Qs=new Set;let ti;function ei(t){return Qs.add(t),ti||(ti=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};Qs.forEach((t=>t(e)))},window.addEventListener("resize",ti)),()=>{Qs.delete(t),!Qs.size&&ti&&(ti=void 0)}}const ni={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function si(t,e,n,s){const r=n[e],{length:o,position:a}=ni[e],l=r.current,u=n.time;r.current=t[`scroll${a}`],r.scrollLength=t[`scroll${o}`]-t[`client${o}`],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=i(0,r.scrollLength,r.current);const c=s-u;r.velocity=c>50?0:m(r.current-l,c)}const ii={start:0,center:.5,end:1};function ri(t,e,n=0){let s=0;if(t in ii&&(t=ii[t]),"string"==typeof t){const e=parseFloat(t);t.endsWith("px")?s=e:t.endsWith("%")?t=e/100:t.endsWith("vw")?s=e/100*document.documentElement.clientWidth:t.endsWith("vh")?s=e/100*document.documentElement.clientHeight:t=e}return"number"==typeof t&&(s=e*t),n+s}const oi=[0,0];function ai(t,e,n,s){let i=Array.isArray(t)?t:oi,r=0,o=0;return"number"==typeof t?i=[t,t]:"string"==typeof t&&(i=(t=t.trim()).includes(" ")?t.split(" "):[t,ii[t]?t:"0"]),r=ri(i[0],n,s),o=ri(i[1],e),r-o}const li={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},ui={x:0,y:0};function ci(t,e,n){const{offset:s=li.All}=n,{target:i=t,axis:r="y"}=n,o="y"===r?"height":"width",a=i!==t?function(t,e){const n={x:0,y:0};let s=t;for(;s&&s!==e;)if(s instanceof HTMLElement)n.x+=s.offsetLeft,n.y+=s.offsetTop,s=s.offsetParent;else if("svg"===s.tagName){const t=s.getBoundingClientRect();s=s.parentElement;const e=s.getBoundingClientRect();n.x+=t.left-e.left,n.y+=t.top-e.top}else{if(!(s instanceof SVGGraphicsElement))break;{const{x:t,y:e}=s.getBBox();n.x+=t,n.y+=e;let i=null,r=s.parentNode;for(;!i;)"svg"===r.tagName&&(i=r),r=s.parentNode;s=i}}return n}(i,t):ui,l=i===t?{width:t.scrollWidth,height:t.scrollHeight}:function(t){return"getBBox"in t&&"svg"!==t.tagName?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}(i),u={width:t.clientWidth,height:t.clientHeight};e[r].offset.length=0;let c=!e[r].interpolate;const h=s.length;for(let t=0;tfunction(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let s=e;for(;s&&s!==t;)n.x.targetOffset+=s.offsetLeft,n.y.targetOffset+=s.offsetTop,s=s.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}(t,s.target,n),update:e=>{!function(t,e,n){si(t,"x",e,n),si(t,"y",e,n),e.time=n}(t,n,e),(s.offset||s.target)&&ci(t,n,s)},notify:()=>e(n)}}const di=new WeakMap,pi=new WeakMap,fi=new WeakMap,mi=t=>t===document.documentElement?window:t;function gi(t,{container:e=document.documentElement,...n}={}){let s=fi.get(e);s||(s=new Set,fi.set(e,s));const i=hi(e,t,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},n);if(s.add(i),!di.has(e)){const t=()=>{for(const t of s)t.measure()},n=()=>{for(const t of s)t.update(vt.timestamp)},i=()=>{for(const t of s)t.notify()},a=()=>{gt.read(t,!1,!0),gt.read(n,!1,!0),gt.update(i,!1,!0)};di.set(e,a);const l=mi(e);window.addEventListener("resize",a,{passive:!0}),e!==document.documentElement&&pi.set(e,(o=a,"function"==typeof(r=e)?ei(r):Js(r,o))),l.addEventListener("scroll",a,{passive:!0})}var r,o;const a=di.get(e);return gt.read(a,!1,!0),()=>{var t;yt(a);const n=fi.get(e);if(!n)return;if(n.delete(i),n.size)return;const s=di.get(e);di.delete(e),s&&(mi(e).removeEventListener("scroll",s),null===(t=pi.get(e))||void 0===t||t(),window.removeEventListener("resize",s))}}const yi=new Map;function vi({source:t,container:e=document.documentElement,axis:n="y"}={}){t&&(e=t),yi.has(e)||yi.set(e,{});const s=yi.get(e);return s[n]||(s[n]=o()?new ScrollTimeline({source:e,axis:n}):function({source:t,container:e,axis:n="y"}){t&&(e=t);const s={value:0},i=gi((t=>{s.value=100*t[n].progress}),{container:e,axis:n});return{currentTime:s,cancel:i}}({source:e,axis:n})),s[n]}function wi(t){return t&&(t.target||t.offset)}function bi(t,{axis:e="y",...s}={}){const i={axis:e,...s};return"function"==typeof t?function(t,e){return function(t){return 2===t.length}(t)||wi(e)?gi((n=>{t(n[e.axis].progress,n)}),e):qs(t,vi(e))}(t,i):function(t,e){if(t.flatten(),wi(e))return t.pause(),gi((n=>{t.time=t.duration*n[e.axis].progress}),e);{const s=vi(e);return t.attachTimeline?t.attachTimeline(s,(t=>(t.pause(),qs((e=>{t.time=t.duration*e}),s)))):n}}(t,i)}const xi={some:0,all:1};function Ti(t,e,{root:n,margin:s,amount:i="some"}={}){const r=q(t),o=new WeakMap,a=new IntersectionObserver((t=>{t.forEach((t=>{const n=o.get(t.target);if(t.isIntersecting!==Boolean(n))if(t.isIntersecting){const n=e(t);"function"==typeof n?o.set(t.target,n):a.unobserve(t.target)}else"function"==typeof n&&(n(t),o.delete(t.target))}))}),{root:n,rootMargin:s,threshold:"number"==typeof i?i:xi[i]});return r.forEach((t=>a.observe(t))),()=>a.disconnect()}function Si(t,e="end"){return n=>{const s=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,i="end"===e?Math.floor(s):Math.ceil(s);return f(0,1,i/t)}}function Ai(t=.1,{startDelay:e=0,from:n=0,ease:s}={}){return(i,r)=>{const o="number"==typeof n?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,r),a=Math.abs(o-i);let l=t*a;if(s){const e=r*t;l=Wn(s)(l/e)*e}return e+l}}function Vi(t,e){return function(t,e){const n=Tt.now(),s=({timestamp:i})=>{const r=i-n;r>=e&&(yt(s),t(r-e))};return gt.read(s,!0),()=>yt(s)}(t,u(e))}const Mi=(t,e)=>Math.abs(t-e);function Pi(t,e){const n=Mi(t.x,e.x),s=Mi(t.y,e.y);return Math.sqrt(n**2+s**2)}function ki(...t){const e=!Array.isArray(t[0]),n=e?0:-1,s=t[0+n],i=t[1+n],r=t[2+n],o=t[3+n],a=Nn(i,r,{mixer:(l=r[0],(t=>t&&"object"==typeof t&&t.mix)(l)?l.mix:void 0),...o});var l;return e?a(s):a}const Fi=gt,Ci=mt.reduce(((t,e)=>(t[e]=t=>yt(t),t)),{});export{At as MotionValue,Ds as animate,Ys as animateMini,Zt as anticipate,Xt as backIn,Gt as backInOut,qt as backOut,yt as cancelFrame,Ci as cancelSync,_t as circIn,Qt as circInOut,Jt as circOut,f as clamp,Is as createScopedAnimate,Ht as cubicBezier,Vi as delay,Mi as distance,Pi as distance2D,Bn as easeIn,Dn as easeInOut,In as easeOut,gt as frame,vt as frameData,wt as frameSteps,Ti as inView,Rn as inertia,Nn as interpolate,s as invariant,e as isDragActive,Kn as keyframes,Ut as mirrorEasing,On as mix,Vt as motionValue,n as noop,Vn as pipe,i as progress,Yt as reverseEasing,bi as scroll,gi as scrollInfo,L as spring,Ai as stagger,Si as steps,Fi as sync,Tt as time,ki as transform,K as wrap};export default null; +const t=["read","resolveKeyframes","update","preRender","render","postRender"],e={value:null,addProjectionMetrics:null};const n={skipAnimations:!1,useManualTiming:!1};function s(n,s){let r=!1,i=!0;const o={delta:0,timestamp:0,isProcessing:!1},a=()=>r=!0,l=t.reduce(((t,n)=>(t[n]=function(t,n){let s=new Set,r=new Set,i=!1,o=!1;const a=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},u=0;function c(e){a.has(e)&&(h.schedule(e),t()),u++,e(l)}const h={schedule:(t,e=!1,n=!1)=>{const o=n&&i?s:r;return e&&a.add(t),o.has(t)||o.add(t),t},cancel:t=>{r.delete(t),a.delete(t)},process:t=>{l=t,i?o=!0:(i=!0,[s,r]=[r,s],s.forEach(c),n&&e.value&&e.value.frameloop[n].push(u),u=0,s.clear(),i=!1,o&&(o=!1,h.process(t)))}};return h}(a,s?n:void 0),t)),{}),{read:u,resolveKeyframes:c,update:h,preRender:d,render:p,postRender:f}=l,m=()=>{const t=performance.now();r=!1,o.delta=i?1e3/60:Math.max(Math.min(t-o.timestamp,40),1),o.timestamp=t,o.isProcessing=!0,u.process(o),c.process(o),h.process(o),d.process(o),p.process(o),f.process(o),o.isProcessing=!1,r&&s&&(i=!1,n(m))};return{schedule:t.reduce(((t,e)=>{const s=l[e];return t[e]=(t,e=!1,a=!1)=>(r||(r=!0,i=!0,o.isProcessing||n(m)),s.schedule(t,e,a)),t}),{}),cancel:e=>{for(let n=0;nt,{schedule:i,cancel:o,state:a,steps:l}=s("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:r,!0);let u;function c(){u=void 0}const h={now:()=>(void 0===u&&h.set(a.isProcessing||n.useManualTiming?a.timestamp:performance.now()),u),set:t=>{u=t,queueMicrotask(c)}};function d(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class p{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>d(this.subscriptions,t)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let r=0;r{const n=h.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=h.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new p);const n=this.events[t].add(e);return"change"===t?()=>{n(),i.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=h.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return f(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function g(t,e){return new m(t,e)}const y=i,v=t.reduce(((t,e)=>(t[e]=t=>o(t),t)),{}),w=!1;function b(){return w}function T(t,e,n){if(t instanceof EventTarget)return[t];if("string"==typeof t){let s=document;e&&(s=e.current);const r=n?.[t]??s.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t)}function x(t,e){const n=T(t),s=new AbortController;return[n,{passive:!0,...e,signal:s.signal},()=>s.abort()]}function S(t){return!("touch"===t.pointerType||b())}function M(t,e,n={}){const[s,r,i]=x(t,n),o=t=>{if(!S(t))return;const{target:n}=t,s=e(n,t);if("function"!=typeof s||!n)return;const i=t=>{S(t)&&(s(t),n.removeEventListener("pointerleave",i))};n.addEventListener("pointerleave",i,r)};return s.forEach((t=>{t.addEventListener("pointerenter",o,r)})),i}const A=(t,e)=>!!e&&(t===e||A(t,e.parentElement)),V=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const k=new WeakSet;function P(t){return e=>{"Enter"===e.key&&t(e)}}function E(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function C(t){return(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(t)&&!b()}function F(t,e,n={}){const[s,r,i]=x(t,n),o=t=>{const s=t.currentTarget;if(!C(t)||k.has(s))return;k.add(s);const i=e(s,t),o=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),C(t)&&k.has(s)&&(k.delete(s),"function"==typeof i&&i(t,{success:e}))},a=t=>{o(t,s===window||s===document||n.useGlobalTarget||A(s,t.target))},l=t=>{o(t,!1)};window.addEventListener("pointerup",a,r),window.addEventListener("pointercancel",l,r)};return s.forEach((t=>{var e;(n.useGlobalTarget?window:t).addEventListener("pointerdown",o,r),t instanceof HTMLElement&&(t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const s=P((()=>{if(k.has(n))return;E(n,"down");const t=P((()=>{E(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>E(n,"cancel")),e)}));n.addEventListener("keydown",s,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",s)),e)})(t,r))),e=t,V.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),i}let R=()=>{};const B=(t,e,n)=>{const s=e-t;return 0===s?1:(n-t)/s},L=(t,e,n)=>n>e?e:n1e3*t,Z=t=>t/1e3,_=.001;function J({duration:t=K,bounce:e=$,velocity:n=N,mass:s=D}){let r,i,o=1-e;o=L(H,q,o),t=L(U,X,Z(t)),o<1?(r=e=>{const s=e*o,r=s*t,i=s-n,a=tt(e,o),l=Math.exp(-r);return _-i/a*l},i=e=>{const s=e*o*t,i=s*n+n,a=Math.pow(o,2)*Math.pow(e,2)*t,l=Math.exp(-s),u=tt(Math.pow(e,2),o);return(-r(e)+_>0?-1:1)*((i-a)*l)/u}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let s=n;for(let n=1;n=et?1/0:e}function st(t,e=100,n){const s=n({...t,keyframes:[0,e]}),r=Math.min(nt(s),et);return{type:"keyframes",ease:t=>s.next(r*t).value/e,duration:Z(r)}}const rt={};function it(t){let e;return()=>(void 0===e&&(e=t()),e)}function ot(t,e){const n=it(t);return()=>rt[e]??n()}const at=ot((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),lt=(t,e,n=10)=>{let s="";const r=Math.max(Math.round(e/n),2);for(let e=0;evoid 0!==t[e]))}function dt(t=j,e=$){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:r}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:l,damping:u,mass:c,duration:h,velocity:d,isResolvedFromDuration:p}=function(t){let e={velocity:N,stiffness:I,damping:W,mass:D,isResolvedFromDuration:!1,...t};if(!ht(t,ct)&&ht(t,ut))if(t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(1.2*n),r=s*s,i=2*L(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:D,stiffness:r,damping:i}}else{const n=J(t);e={...e,...n,mass:D},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Z(n.velocity||0)}),f=d||0,m=u/(2*Math.sqrt(l*c)),g=o-i,y=Z(Math.sqrt(l/c)),v=Math.abs(g)<5;let w;if(s||(s=v?z.granular:z.default),r||(r=v?Y.granular:Y.default),m<1){const t=tt(y,m);w=e=>{const n=Math.exp(-m*y*e);return o-n*((f+m*y*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===m)w=t=>o-Math.exp(-y*t)*(g+(f+y*g)*t);else{const t=y*Math.sqrt(m*m-1);w=e=>{const n=Math.exp(-m*y*e),s=Math.min(t*e,300);return o-n*((f+m*y*g)*Math.sinh(s)+t*g*Math.cosh(s))/t}}const b={calculatedDuration:p&&h||null,next:t=>{const e=w(t);if(p)a.done=t>=h;else{let n=0;m<1&&(n=0===t?G(f):O(w,t,e));const i=Math.abs(n)<=s,l=Math.abs(o-e)<=r;a.done=i&&l}return a.value=a.done?o:e,a},toString:()=>{const t=Math.min(nt(b),et),e=lt((e=>b.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return b}dt.applyToOptions=t=>{const e=st(t,100,dt);return t.ease=at()?e.ease:"easeOut",t.duration=G(e.duration),t.type="keyframes",t};const pt=(t,e,n)=>{const s=e-t;return((n-t)%s+s)%s+t},ft=t=>Array.isArray(t)&&"number"!=typeof t[0];function mt(t,e){return ft(t)?t[pt(0,t.length,e)]:t}const gt=(t,e,n)=>t+(e-t)*n;function yt(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const r=B(0,e,s);t.push(gt(n,1,r))}}function vt(t){const e=[0];return yt(e,t.length-1),e}const wt=t=>Boolean(t&&t.getVelocity);function bt(t){return"object"==typeof t&&!Array.isArray(t)}function Tt(t,e,n,s){return"string"==typeof t&&bt(e)?T(t,n,s):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function xt(t,e,n){return t*(e+1)}function St(t,e,n,s){return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:s.get(e)??t}function Mt(t,e,n,s,r,i){!function(t,e,n){for(let s=0;se&&r.at"number"==typeof t,Bt=t=>t.every(Rt),Lt=new WeakMap,Ot=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],It=new Set(Ot),Wt=new Set(["width","height","top","left","right","bottom",...Ot]),Dt=t=>(t=>Array.isArray(t))(t)?t[t.length-1]||0:t;function Nt(t){const e=[{},{}];return t?.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Kt(t,e,n,s){if("function"==typeof e){const[r,i]=Nt(s);e=e(void 0!==n?n:t.custom,r,i)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[r,i]=Nt(s);e=e(void 0!==n?n:t.custom,r,i)}return e}function $t(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,g(n))}function jt(t,e){const n=function(t,e,n){const s=t.getProps();return Kt(s,e,void 0!==n?n:s.custom,t)}(t,e);let{transitionEnd:s={},transition:r={},...i}=n||{};i={...i,...s};for(const e in i){$t(t,e,Dt(i[e]))}}function zt(t,e){const s=t.getValue("willChange");if(r=s,Boolean(wt(r)&&r.add))return s.add(e);if(!s&&n.WillChange){const s=new n.WillChange("auto");t.addValue("willChange",s),s.add(e)}var r}const Yt=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ut="data-"+Yt("framerAppearId");function Xt(t){return t.props[Ut]}const Ht=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function qt(t,e,n,s){if(t===e&&n===s)return r;const i=e=>function(t,e,n,s,r){let i,o,a=0;do{o=e+(n-e)/2,i=Ht(o,s,r)-t,i>0?n=o:e=o}while(Math.abs(i)>1e-7&&++a<12);return o}(e,0,1,t,n);return t=>0===t||1===t?t:Ht(i(t),e,s)}const Gt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Zt=t=>e=>1-t(1-e),_t=qt(.33,1.53,.69,.99),Jt=Zt(_t),Qt=Gt(Jt),te=t=>(t*=2)<1?.5*Jt(t):.5*(2-Math.pow(2,-10*(t-1))),ee=t=>1-Math.sin(Math.acos(t)),ne=Zt(ee),se=Gt(ee),re=t=>/^0[^.\s]+$/u.test(t);const ie={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},oe={...ie,transform:t=>L(0,1,t)},ae={...ie,default:1},le=t=>Math.round(1e5*t)/1e5,ue=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const ce=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,he=(t,e)=>n=>Boolean("string"==typeof n&&ce.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),de=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[r,i,o,a]=s.match(ue);return{[t]:parseFloat(r),[e]:parseFloat(i),[n]:parseFloat(o),alpha:void 0!==a?parseFloat(a):1}},pe={...ie,transform:t=>Math.round((t=>L(0,255,t))(t))},fe={test:he("rgb","red"),parse:de("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+pe.transform(t)+", "+pe.transform(e)+", "+pe.transform(n)+", "+le(oe.transform(s))+")"};const me={test:he("#"),parse:function(t){let e="",n="",s="",r="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),r=t.substring(4,5),e+=e,n+=n,s+=s,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}},transform:fe.transform},ge=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),ye=ge("deg"),ve=ge("%"),we=ge("px"),be=ge("vh"),Te=ge("vw"),xe={...ve,parse:t=>ve.parse(t)/100,transform:t=>ve.transform(100*t)},Se={test:he("hsl","hue"),parse:de("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+ve.transform(le(e))+", "+ve.transform(le(n))+", "+le(oe.transform(s))+")"},Me={test:t=>fe.test(t)||me.test(t)||Se.test(t),parse:t=>fe.test(t)?fe.parse(t):Se.test(t)?Se.parse(t):me.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?fe.transform(t):Se.transform(t)},Ae=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Ve="number",ke="color",Pe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ee(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},r=[];let i=0;const o=e.replace(Pe,(t=>(Me.test(t)?(s.color.push(i),r.push(ke),n.push(Me.parse(t))):t.startsWith("var(")?(s.var.push(i),r.push("var"),n.push(t)):(s.number.push(i),r.push(Ve),n.push(parseFloat(t))),++i,"${}"))).split("${}");return{values:n,split:o,indexes:s,types:r}}function Ce(t){return Ee(t).values}function Fe(t){const{split:e,types:n}=Ee(t),s=e.length;return t=>{let r="";for(let i=0;i"number"==typeof t?0:t;const Be={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(ue)?.length||0)+(t.match(Ae)?.length||0)>0},parse:Ce,createTransformer:Fe,getAnimatableNone:function(t){const e=Ce(t);return Fe(t)(e.map(Re))}},Le=new Set(["brightness","contrast","saturate","opacity"]);function Oe(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=n.match(ue)||[];if(!s)return t;const r=n.replace(s,"");let i=Le.has(e)?1:0;return s!==n&&(i*=100),e+"("+i+r+")"}const Ie=/\b([a-z-]*)\(.*?\)/gu,We={...Be,getAnimatableNone:t=>{const e=t.match(Ie);return e?e.map(Oe).join(" "):t}},De={borderWidth:we,borderTopWidth:we,borderRightWidth:we,borderBottomWidth:we,borderLeftWidth:we,borderRadius:we,radius:we,borderTopLeftRadius:we,borderTopRightRadius:we,borderBottomRightRadius:we,borderBottomLeftRadius:we,width:we,maxWidth:we,height:we,maxHeight:we,top:we,right:we,bottom:we,left:we,padding:we,paddingTop:we,paddingRight:we,paddingBottom:we,paddingLeft:we,margin:we,marginTop:we,marginRight:we,marginBottom:we,marginLeft:we,backgroundPositionX:we,backgroundPositionY:we},Ne={rotate:ye,rotateX:ye,rotateY:ye,rotateZ:ye,scale:ae,scaleX:ae,scaleY:ae,scaleZ:ae,skew:ye,skewX:ye,skewY:ye,distance:we,translateX:we,translateY:we,translateZ:we,x:we,y:we,z:we,perspective:we,transformPerspective:we,opacity:oe,originX:xe,originY:xe,originZ:we},Ke={...ie,transform:Math.round},$e={...De,...Ne,zIndex:Ke,size:we,fillOpacity:oe,strokeOpacity:oe,numOctaves:Ke},je={...$e,color:Me,backgroundColor:Me,outlineColor:Me,fill:Me,stroke:Me,borderColor:Me,borderTopColor:Me,borderRightColor:Me,borderBottomColor:Me,borderLeftColor:Me,filter:We,WebkitFilter:We},ze=t=>je[t];function Ye(t,e){let n=ze(t);return n!==We&&(n=Be),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Ue=new Set(["auto","none","0"]);const Xe=t=>180*t/Math.PI,He=t=>{const e=Xe(Math.atan2(t[1],t[0]));return Ge(e)},qe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:He,rotateZ:He,skewX:t=>Xe(Math.atan(t[1])),skewY:t=>Xe(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ge=t=>((t%=360)<0&&(t+=360),t),Ze=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),_e=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Je={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ze,scaleY:_e,scale:t=>(Ze(t)+_e(t))/2,rotateX:t=>Ge(Xe(Math.atan2(t[6],t[5]))),rotateY:t=>Ge(Xe(Math.atan2(-t[2],t[0]))),rotateZ:He,rotate:He,skewX:t=>Xe(Math.atan(t[4])),skewY:t=>Xe(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Qe(t){return t.includes("scale")?1:0}function tn(t,e){if(!t||"none"===t)return Qe(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,r;if(n)s=Je,r=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=qe,r=e}if(!r)return Qe(e);const i=s[e],o=r[1].split(",").map(en);return"function"==typeof i?i(o):o[i]}function en(t){return parseFloat(t.trim())}const nn=t=>t===ie||t===we,sn=new Set(["x","y","z"]),rn=Ot.filter((t=>!sn.has(t)));const on={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>tn(e,"x"),y:(t,{transform:e})=>tn(e,"y")};on.translateX=on.x,on.translateY=on.y;const an=new Set;let ln=!1,un=!1;function cn(){if(un){const t=Array.from(an).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return rn.forEach((n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{t.getValue(e)?.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}un=!1,ln=!1,an.forEach((t=>t.complete())),an.clear()}function hn(){an.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(un=!0)}))}class dn{constructor(t,e,n,s,r,i=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=s,this.element=r,this.isAsync=i}scheduleResolve(){this.isScheduled=!0,this.isAsync?(an.add(this),ln||(ln=!0,i.read(hn),i.resolveKeyframes(cn))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:s}=this;for(let r=0;r/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),fn=t=>e=>"string"==typeof e&&e.startsWith(t),mn=fn("--"),gn=fn("var(--"),yn=t=>!!gn(t)&&vn.test(t.split("/*")[0].trim()),vn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,wn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function bn(t,e,n=1){const[s,r]=function(t){const e=wn.exec(t);if(!e)return[,];const[,n,s,r]=e;return[`--${n??s}`,r]}(t);if(!s)return;const i=window.getComputedStyle(e).getPropertyValue(s);if(i){const t=i.trim();return pn(t)?parseFloat(t):t}return yn(r)?bn(r,e,n+1):r}const Tn=t=>e=>e.test(t),xn=[ie,we,ve,ye,Te,be,{test:t=>"auto"===t,parse:t=>t}],Sn=t=>xn.find(Tn(t));class Mn extends dn{constructor(t,e,n,s,r){super(t,e,n,s,r,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n{t.getValue(e).set(n)})),this.resolveNoneKeyframes()}}const An=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Be.test(t)&&"0"!==t||t.startsWith("url(")));function Vn(t,e,n,s){const r=t[0];if(null===r)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],o=An(r,e),a=An(i,e);return!(!o||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;nnull!==t;function Pn(t,{repeat:e,repeatType:n="loop"},s){const r=t.filter(kn),i=e&&"loop"!==n&&e%2==1?0:r.length-1;return i&&void 0!==s?s:r[i]}class En{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:s=0,repeatDelay:r=0,repeatType:i="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=h.now(),this.options={autoplay:t,delay:e,type:n,repeat:s,repeatDelay:r,repeatType:i,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(hn(),cn()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=h.now(),this.hasAttemptedResolve=!0;const{name:n,type:s,velocity:r,delay:i,onComplete:o,onUpdate:a,isGenerator:l}=this.options;if(!l&&!Vn(t,n,s,r)){if(!i)return a&&a(Pn(t,this.options,e)),o&&o(),void this.resolveFinishedPromise();this.options.duration=0}const u=this.initPlayback(t,e);!1!==u&&(this._resolved={keyframes:t,finalKeyframe:e,...u},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear")}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function Cn(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Fn(t,e){return n=>n>0?e:t}const Rn=(t,e,n)=>{const s=t*t,r=n*(e*e-s)+s;return r<0?0:Math.sqrt(r)},Bn=[me,fe,Se];function Ln(t){const e=(n=t,Bn.find((t=>t.test(n))));var n;if(!Boolean(e))return!1;let s=e.parse(t);return e===Se&&(s=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let r=0,i=0,o=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,a=2*n-s;r=Cn(a,s,t+1/3),i=Cn(a,s,t),o=Cn(a,s,t-1/3)}else r=i=o=n;return{red:Math.round(255*r),green:Math.round(255*i),blue:Math.round(255*o),alpha:s}}(s)),s}const On=(t,e)=>{const n=Ln(t),s=Ln(e);if(!n||!s)return Fn(t,e);const r={...n};return t=>(r.red=Rn(n.red,s.red,t),r.green=Rn(n.green,s.green,t),r.blue=Rn(n.blue,s.blue,t),r.alpha=gt(n.alpha,s.alpha,t),fe.transform(r))},In=(t,e)=>n=>e(t(n)),Wn=(...t)=>t.reduce(In),Dn=new Set(["none","hidden"]);function Nn(t,e){return n=>gt(t,e,n)}function Kn(t){return"number"==typeof t?Nn:"string"==typeof t?yn(t)?Fn:Me.test(t)?On:zn:Array.isArray(t)?$n:"object"==typeof t?Me.test(t)?On:jn:Fn}function $n(t,e){const n=[...t],s=n.length,r=t.map(((t,n)=>Kn(t)(t,e[n])));return t=>{for(let e=0;e{for(const e in s)n[e]=s[e](t);return n}}const zn=(t,e)=>{const n=Be.createTransformer(e),s=Ee(t),r=Ee(e);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?Dn.has(t)&&!r.values.length||Dn.has(e)&&!s.values.length?function(t,e){return Dn.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Wn($n(function(t,e){const n=[],s={color:0,var:0,number:0};for(let r=0;rvoid 0===a?l:void 0===l||Math.abs(a-t)-f*Math.exp(-t/s),v=t=>g+y(t),w=t=>{const e=y(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?g:n};let b,T;const x=t=>{var e;(e=d.value,void 0!==a&&el)&&(b=t,T=dt({keyframes:[d.value,p(d.value)],velocity:O(v,t,d.value),damping:r,stiffness:i,restDelta:u,restSpeed:c}))};return x(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==b||(e=!0,w(t),x(t)),void 0!==b&&t>=b?T.next(t-b):(!e&&w(t),d)}}}const Xn=qt(.42,0,1,1),Hn=qt(0,0,.58,1),qn=qt(.42,0,.58,1),Gn=t=>Array.isArray(t)&&"number"==typeof t[0],Zn={linear:r,easeIn:Xn,easeInOut:qn,easeOut:Hn,circIn:ee,circInOut:se,circOut:ne,backIn:Jt,backInOut:Qt,backOut:_t,anticipate:te},_n=t=>{if(Gn(t)){t.length;const[e,n,s,r]=t;return qt(e,n,s,r)}return"string"==typeof t?Zn[t]:t};function Jn(t,e,{clamp:n=!0,ease:s,mixer:i}={}){const o=t.length;if(e.length,1===o)return()=>e[0];if(2===o&&e[0]===e[1])return()=>e[1];const a=t[0]===t[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=function(t,e,n){const s=[],i=n||Yn,o=t.length-1;for(let n=0;n{if(a&&n1)for(;sc(L(t[0],t[o-1],e)):c}function Qn({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const r=ft(s)?s.map(_n):_n(s),i={done:!1,value:e[0]},o=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:vt(e),t),a=Jn(o,e,{ease:Array.isArray(r)?r:(l=e,u=r,l.map((()=>u||qn)).splice(0,l.length-1))});var l,u;return{calculatedDuration:t,next:e=>(i.value=a(e),i.done=e>=t,i)}}const ts=t=>{const e=({timestamp:e})=>t(e);return{start:()=>i.update(e,!0),stop:()=>o(e),now:()=>a.isProcessing?a.timestamp:h.now()}},es={decay:Un,inertia:Un,tween:Qn,keyframes:Qn,spring:dt},ns=t=>t/100;class ss extends En{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:s,keyframes:r}=this.options,i=s?.KeyframeResolver||dn;this.resolver=new i(r,((t,e)=>this.onKeyframesResolved(t,e)),e,n,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:r,velocity:i=0}=this.options,o=kt(e)?e:es[e]||Qn;let a,l;o!==Qn&&"number"!=typeof t[0]&&(a=Wn(ns,Yn(t[0],t[1])),t=[0,100]);const u=o({...this.options,keyframes:t});"mirror"===r&&(l=o({...this.options,keyframes:[...t].reverse(),velocity:-i})),null===u.calculatedDuration&&(u.calculatedDuration=nt(u));const{calculatedDuration:c}=u,h=c+s;return{generator:u,mirroredGenerator:l,mapPercentToKeyframes:a,calculatedDuration:c,resolvedDuration:h,totalDuration:h*(n+1)-s}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:s,generator:r,mirroredGenerator:i,mapPercentToKeyframes:o,keyframes:a,calculatedDuration:l,totalDuration:u,resolvedDuration:c}=n;if(null===this.startTime)return r.next(0);const{delay:h,repeat:d,repeatType:p,repeatDelay:f,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>u;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let v=this.currentTime,w=r;if(d){const t=Math.min(this.currentTime,u)/c;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===p?(n=1-n,f&&(n-=f/c)):"mirror"===p&&(w=i)),v=L(0,1,n)*c}const b=y?{done:!1,value:a[0]}:w.next(v);o&&(b.value=o(b.value));let{done:T}=b;y||null===l||(T=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const x=null===this.holdTime&&("finished"===this.state||"running"===this.state&&T);return x&&void 0!==s&&(b.value=Pn(a,this.options,s)),m&&m(b.value),x&&this.finish(),b}get duration(){const{resolved:t}=this;return t?Z(t.calculatedDuration):0}get time(){return Z(this.currentTime)}set time(t){t=G(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=Z(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=ts,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const s=this.driver.now();null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=s):this.startTime=n??this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){this._resolved?(this.state="paused",this.holdTime=this.currentTime??0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}get finished(){return this.currentFinishedPromise}}const rs=new Set(["opacity","clipPath","filter","transform"]),is=it((()=>Object.hasOwnProperty.call(Element.prototype,"animate"))),os=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,as={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:os([0,.65,.55,1]),circOut:os([.55,0,1,.45]),backIn:os([.31,.01,.66,-.59]),backOut:os([.33,1.53,.69,.99])};function ls(t,e){return t?"function"==typeof t&&at()?lt(t,e):Gn(t)?os(t):Array.isArray(t)?t.map((t=>ls(t,e)||as.easeOut)):as[t]:void 0}function us(t,e,n,{delay:s=0,duration:r=300,repeat:i=0,repeatType:o="loop",ease:a="easeInOut",times:l}={},u=void 0){const c={[e]:n};l&&(c.offset=l);const h=ls(a,r);Array.isArray(h)&&(c.easing=h);return t.animate(c,{delay:s,duration:r,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:"reverse"===o?"alternate":"normal",pseudoElement:u})}function cs(t,e){t.timeline=e,t.onfinish=null}function hs(t){return Boolean("function"==typeof t&&at()||!t||"string"==typeof t&&(t in as||at())||Gn(t)||Array.isArray(t)&&t.every(hs))}const ds={anticipate:te,backInOut:Qt,circInOut:se};class ps extends En{constructor(t){super(t);const{name:e,motionValue:n,element:s,keyframes:r}=this.options;this.resolver=new Mn(r,((t,e)=>this.onKeyframesResolved(t,e)),e,n,s),this.resolver.scheduleResolve()}initPlayback(t,e){let{duration:n=300,times:s,ease:r,type:i,motionValue:o,name:a,startTime:l}=this.options;if(!o.owner||!o.owner.current)return!1;var u;if("string"==typeof r&&at()&&r in ds&&(r=ds[r]),kt((u=this.options).type)||"spring"===u.type||!hs(u.ease)){const{onComplete:e,onUpdate:o,motionValue:a,element:l,...u}=this.options,c=function(t,e){const n=new ss({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const r=[];let i=0;for(;!s.done&&i<2e4;)s=n.sample(i),r.push(s.value),i+=10;return{times:void 0,keyframes:r,duration:i-10,ease:"linear"}}(t,u);1===(t=c.keyframes).length&&(t[1]=t[0]),n=c.duration,s=c.times,r=c.ease,i="keyframes"}const c=us(o.owner.current,a,t,{...this.options,duration:n,times:s,ease:r});return c.startTime=l??this.calcStartTime(),this.pendingTimeline?(cs(c,this.pendingTimeline),this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:n}=this.options;o.set(Pn(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:n,times:s,type:i,ease:r,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return Z(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return Z(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=G(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}get finished(){return this.resolved.animation.finished}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return r;const{animation:n}=e;cs(n,t)}else this.pendingTimeline=t;return r}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:s,type:r,ease:i,times:o}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:l,...u}=this.options,c=new ss({...u,keyframes:n,duration:s,type:r,ease:i,times:o,isGenerator:!0}),h=G(this.time);t.setWithVelocity(c.sample(h-10).value,c.sample(h).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:s,repeatType:r,damping:i,type:o}=t;if(!(e&&e.owner&&e.owner.current instanceof HTMLElement))return!1;const{onUpdate:a,transformTemplate:l}=e.owner.getProps();return is()&&n&&rs.has(n)&&("transform"!==n||!l)&&!a&&!s&&"mirror"!==r&&0!==i&&"inertia"!==o}}const fs={type:"spring",stiffness:500,damping:25,restSpeed:10},ms={type:"keyframes",duration:.8},gs={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ys=(t,{keyframes:e})=>e.length>2?ms:It.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:fs:gs;function vs(t,e){return t?.[e]??t?.default??t}const ws=it((()=>void 0!==window.ScrollTimeline));class bs{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>t.finished)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;nws()&&n.attachTimeline?n.attachTimeline(t):"function"==typeof e?e(n):void 0));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;ee[t]()))}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Ts extends bs{then(t,e){return this.finished.finally(t).then((()=>{}))}}const xs=(t,e,n,s={},r,o)=>a=>{const l=vs(s,t)||{},u=l.delay||s.delay||0;let{elapsed:c=0}=s;c-=G(u);let h={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-c,onUpdate:t=>{e.set(t),l.onUpdate&&l.onUpdate(t)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:o?void 0:r};(function({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:r,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length})(l)||(h={...h,...ys(t,h)}),h.duration&&(h.duration=G(h.duration)),h.repeatDelay&&(h.repeatDelay=G(h.repeatDelay)),void 0!==h.from&&(h.keyframes[0]=h.from);let d=!1;if((!1===h.type||0===h.duration&&!h.repeatDelay)&&(h.duration=0,0===h.delay&&(d=!0)),h.allowFlatten=!l.type&&!l.ease,d&&!o&&void 0!==e.get()){const t=Pn(h.keyframes,l);if(void 0!==t)return i.update((()=>{h.onUpdate(t),h.onComplete()})),new Ts([])}return!o&&ps.supports(h)?new ps(h):new ss(h)};function Ss({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}function Ms(t,e,{delay:n=0,transitionOverride:s,type:r}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:a,...l}=e;s&&(o=s);const u=[],c=r&&t.animationState&&t.animationState.getState()[r];for(const e in l){const s=t.getValue(e,t.latestValues[e]??null),r=l[e];if(void 0===r||c&&Ss(c,e))continue;const a={delay:n,...vs(o||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=Xt(t);if(n){const t=window.MotionHandoffAnimation(n,e,i);null!==t&&(a.startTime=t,h=!0)}}zt(t,e),s.start(xs(e,s,r,t.shouldReduceMotion&&Wt.has(e)?{type:!1}:a,t,h));const d=s.animation;d&&u.push(d)}return a&&Promise.all(u).then((()=>{i.update((()=>{a&&jt(t,a)}))})),u}const As=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Vs={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ks={};for(const t in Vs)ks[t]={isEnabled:e=>Vs[t].some((t=>!!e[t]))};const Ps="undefined"!=typeof window,Es={current:null},Cs={current:!1};const Fs=[...xn,Me,Be];const Rs=["initial","animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"];function Bs(t){return null!==(e=t.animate)&&"object"==typeof e&&"function"==typeof e.start||Rs.some((e=>function(t){return"string"==typeof t||Array.isArray(t)}(t[e])));var e}const Ls=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Os{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:s,blockInitialAnimation:r,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=dn,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=h.now();this.renderScheduledAtthis.bindToMotionValue(e,t))),Cs.current||function(){if(Cs.current=!0,Ps)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Es.current=t.matches;t.addListener(e),e()}else Es.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Es.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),o(this.notifyUpdate),o(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=It.has(t);n&&this.onBindTransform&&this.onBindTransform();const s=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&i.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),r=e.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{s(),r(),o&&o(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in ks){const e=ks[t];if(!e)continue;const{isEnabled:n,Feature:s}=e;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;ee.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=g(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){let n=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var s;return null!=n&&("string"==typeof n&&(pn(n)||re(n))?n=parseFloat(n):(s=n,!Fs.find(Tn(s))&&Be.test(e)&&(n=Ye(t,e))),this.setBaseTarget(t,wt(n)?n.get():n)),wt(n)?n.get():n}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let n;if("string"==typeof e||"object"==typeof e){const s=Kt(this.props,e,this.presenceContext?.custom);s&&(n=s[t])}if(e&&void 0!==n)return n;const s=this.getBaseTargetFromProps(this.props,t);return void 0===s||wt(s)?void 0!==this.initialValues[t]&&void 0===n?void 0:this.baseTarget[t]:s}on(t,e){return this.events[t]||(this.events[t]=new p),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Is extends Os{constructor(){super(...arguments),this.KeyframeResolver=Mn}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;wt(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}const Ws=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Ds={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Ns=Ot.length;function Ks(t,e,n){const{style:s,vars:r,transformOrigin:i}=t;let o=!1,a=!1;for(const t in e){const n=e[t];if(It.has(t))o=!0;else if(mn(t))r[t]=n;else{const e=Ws(n,$e[t]);t.startsWith("origin")?(a=!0,i[t]=e):s[t]=e}}if(e.transform||(o||n?s.transform=function(t,e,n){let s="",r=!0;for(let i=0;i{this.current&&!this.renderState.dimensions&&function(t,e){try{e.dimensions="function"==typeof t.getBBox?t.getBBox():t.getBoundingClientRect()}catch(t){e.dimensions={x:0,y:0,width:0,height:0}}}(this.current,this.renderState)}}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(It.has(e)){const t=ze(e);return t&&t.default||0}return e=Us.has(e)?e:Yt(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return function(t,e,n){const s=Gs(t,e,n);for(const n in t)(wt(t[n])||wt(e[n]))&&(s[-1!==Ot.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]);return s}(t,e,n)}onBindTransform(){this.current&&!this.renderState.dimensions&&i.postRender(this.updateDimensions)}build(t,e,n){Ys(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,s){!function(t,e,n,s){Xs(t,e,void 0,s);for(const n in e.attrs)t.setAttribute(Us.has(n)?n:Yt(n),e.attrs[n])}(t,e,0,s)}mount(t){var e;this.isSVGTag="string"==typeof(e=t.tagName)&&"svg"===e.toLowerCase(),super.mount(t)}}class _s extends Is{constructor(){super(...arguments),this.type="html",this.renderInstance=Xs}readValueFromInstance(t,e){if(It.has(e))return((t,e)=>{const{transform:n="none"}=getComputedStyle(t);return tn(n,e)})(t,e);{const s=(n=t,window.getComputedStyle(n)),r=(mn(e)?s.getPropertyValue(e):s[e])||0;return"string"==typeof r?r.trim():r}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return function(t,e){return function({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}(t.getBoundingClientRect(),e))}(t,e)}build(t,e,n){Ks(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Gs(t,e,n)}}class Js extends Os{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function Qs(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=function(t){return t instanceof SVGElement&&"svg"!==t.tagName}(t)?new Zs(e):new _s(e);n.mount(t),Lt.set(t,n)}function tr(t){const e=new Js({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),Lt.set(t,e)}function er(t,e,n,s){const r=[];if(function(t,e){return wt(t)||"number"==typeof t||"string"==typeof t&&!bt(e)}(t,e))r.push(function(t,e,n){const s=wt(t)?t:g(t);return s.start(xs("",s,e,n)),s.animation}(t,bt(e)&&e.default||e,n&&n.default||n));else{const i=Tt(t,e,s),o=i.length;for(let t=0;t{const l=Ct(t),{delay:u=0,times:c=vt(l),type:p="keyframes",repeat:f,repeatType:m,repeatDelay:y=0,...v}=n;let{ease:w=e.ease||"easeOut",duration:b}=n;const T="function"==typeof u?u(o,a):u,x=l.length,S=kt(p)?p:r?.[p];if(x<=2&&S){let t=100;if(2===x&&Bt(l)){const e=l[1]-l[0];t=Math.abs(e)}const e={...v};void 0!==b&&(e.duration=G(b));const n=st(e,t,S);w=n.ease,b=n.duration}b??(b=i);const M=h+T;1===c.length&&0===c[0]&&(c[1]=1);const A=c.length-l.length;if(A>0&&yt(c,A),1===l.length&&l.unshift(null),f){b=xt(b,f);const t=[...l],e=[...c];w=Array.isArray(w)?[...w]:[w];const n=[...w];for(let s=0;s{for(const r in t){const i=t[r];i.sort(Vt);const a=[],l=[],u=[];for(let t=0;t{s.push(...er(n,t,e))})),s}function sr(t){return function(e,n,s){let r=[];var i;i=e,r=Array.isArray(i)&&i.some(Array.isArray)?nr(e,n,t):er(e,n,s,t);const o=new Ts(r);return t&&t.animations.push(o),o}}const rr=sr(),ir=t=>t.startsWith("--"),or=(t,e,n)=>{ir(e)?t.style.setProperty(e,n):t.style[e]=n},ar=(t,e)=>ir(e)?t.style.getPropertyValue(e):t.style[e],lr=t=>null!==t;const ur=it((()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0})),cr=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","radius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","margin","marginTop","marginRight","marginBottom","marginLeft","backgroundPositionX","backgroundPositionY"]);const hr=new WeakMap;class dr{constructor(t){if("animation"in t)return void(this.animation=t.animation);const{element:e,name:n,keyframes:s,pseudoElement:r,allowFlatten:i=!1}=t;let{transition:o}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=i;const a=function(t){const e=hr.get(t)||new Map;return hr.set(t,e),e}(e),l=((t,e)=>`${t}:${e}`)(n,r||""),u=a.get(l);u&&u.stop();const c=function(t,e,n,s){Array.isArray(n)||(n=[n]);for(let r=0;ra.delete(l),this.animation.onfinish=()=>{r||(or(e,n,function(t,{repeat:e,repeatType:n="loop"},s){const r=t.filter(lr),i=e&&"loop"!==n&&e%2==1?0:r.length-1;return i&&void 0!==s?s:r[i]}(c,o)),this.cancel())},a.set(l,this)}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.finish()}cancel(){try{this.animation.cancel()}catch(t){}this.removeAnimation()}stop(){const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.commitStyles(),this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming().duration||0;return Z(Number(t))}get time(){return Z(Number(this.animation.currentTime)||0)}set time(t){this.animation.currentTime=G(t)}get speed(){return this.animation.playbackRate}set speed(t){this.animation.playbackRate=t}get state(){return this.animation.playState}get startTime(){return Number(this.animation.startTime)}get finished(){return this.animation.finished}flatten(){this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"})}attachTimeline(t){return this.animation.timeline=t,this.animation.onfinish=null,r}then(t,e){return this.finished.then(t).catch(e)}}const pr=t=>function(e,n,s){return new Ts(function(t,e,n,s){const r=T(t,s),i=r.length,o=[];for(let t=0;t{const{currentTime:s}=e,r=(null===s?0:s.value)/100;n!==r&&t(r),n=r};return i.update(s,!0),()=>o(s)}const gr=new WeakMap;let yr;function vr({target:t,contentRect:e,borderBoxSize:n}){gr.get(t)?.forEach((s=>{s({target:t,contentSize:e,get size(){return function(t,e){if(e){const{inlineSize:t,blockSize:n}=e[0];return{width:t,height:n}}return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}(t,n)}})}))}function wr(t){t.forEach(vr)}function br(t,e){yr||"undefined"!=typeof ResizeObserver&&(yr=new ResizeObserver(wr));const n=T(t);return n.forEach((t=>{let n=gr.get(t);n||(n=new Set,gr.set(t,n)),n.add(e),yr?.observe(t)})),()=>{n.forEach((t=>{const n=gr.get(t);n?.delete(e),n?.size||yr?.unobserve(t)}))}}const Tr=new Set;let xr;function Sr(t){return Tr.add(t),xr||(xr=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};Tr.forEach((t=>t(e)))},window.addEventListener("resize",xr)),()=>{Tr.delete(t),!Tr.size&&xr&&(xr=void 0)}}const Mr={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function Ar(t,e,n,s){const r=n[e],{length:i,position:o}=Mr[e],a=r.current,l=n.time;r.current=t[`scroll${o}`],r.scrollLength=t[`scroll${i}`]-t[`client${i}`],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=B(0,r.scrollLength,r.current);const u=s-l;r.velocity=u>50?0:f(r.current-a,u)}const Vr={start:0,center:.5,end:1};function kr(t,e,n=0){let s=0;if(t in Vr&&(t=Vr[t]),"string"==typeof t){const e=parseFloat(t);t.endsWith("px")?s=e:t.endsWith("%")?t=e/100:t.endsWith("vw")?s=e/100*document.documentElement.clientWidth:t.endsWith("vh")?s=e/100*document.documentElement.clientHeight:t=e}return"number"==typeof t&&(s=e*t),n+s}const Pr=[0,0];function Er(t,e,n,s){let r=Array.isArray(t)?t:Pr,i=0,o=0;return"number"==typeof t?r=[t,t]:"string"==typeof t&&(r=(t=t.trim()).includes(" ")?t.split(" "):[t,Vr[t]?t:"0"]),i=kr(r[0],n,s),o=kr(r[1],e),i-o}const Cr={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},Fr={x:0,y:0};function Rr(t,e,n){const{offset:s=Cr.All}=n,{target:r=t,axis:i="y"}=n,o="y"===i?"height":"width",a=r!==t?function(t,e){const n={x:0,y:0};let s=t;for(;s&&s!==e;)if(s instanceof HTMLElement)n.x+=s.offsetLeft,n.y+=s.offsetTop,s=s.offsetParent;else if("svg"===s.tagName){const t=s.getBoundingClientRect();s=s.parentElement;const e=s.getBoundingClientRect();n.x+=t.left-e.left,n.y+=t.top-e.top}else{if(!(s instanceof SVGGraphicsElement))break;{const{x:t,y:e}=s.getBBox();n.x+=t,n.y+=e;let r=null,i=s.parentNode;for(;!r;)"svg"===i.tagName&&(r=i),i=s.parentNode;s=r}}return n}(r,t):Fr,l=r===t?{width:t.scrollWidth,height:t.scrollHeight}:function(t){return"getBBox"in t&&"svg"!==t.tagName?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}(r),u={width:t.clientWidth,height:t.clientHeight};e[i].offset.length=0;let c=!e[i].interpolate;const h=s.length;for(let t=0;tfunction(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let s=e;for(;s&&s!==t;)n.x.targetOffset+=s.offsetLeft,n.y.targetOffset+=s.offsetTop,s=s.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}(t,s.target,n),update:e=>{!function(t,e,n){Ar(t,"x",e,n),Ar(t,"y",e,n),e.time=n}(t,n,e),(s.offset||s.target)&&Rr(t,n,s)},notify:()=>e(n)}}const Lr=new WeakMap,Or=new WeakMap,Ir=new WeakMap,Wr=t=>t===document.documentElement?window:t;function Dr(t,{container:e=document.documentElement,...n}={}){let s=Ir.get(e);s||(s=new Set,Ir.set(e,s));const r=Br(e,t,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},n);if(s.add(r),!Lr.has(e)){const t=()=>{for(const t of s)t.measure()},n=()=>{for(const t of s)t.update(a.timestamp)},r=()=>{for(const t of s)t.notify()},o=()=>{i.read(t,!1,!0),i.read(n,!1,!0),i.update(r,!1,!0)};Lr.set(e,o);const c=Wr(e);window.addEventListener("resize",o,{passive:!0}),e!==document.documentElement&&Or.set(e,(u=o,"function"==typeof(l=e)?Sr(l):br(l,u))),c.addEventListener("scroll",o,{passive:!0})}var l,u;const c=Lr.get(e);return i.read(c,!1,!0),()=>{o(c);const t=Ir.get(e);if(!t)return;if(t.delete(r),t.size)return;const n=Lr.get(e);Lr.delete(e),n&&(Wr(e).removeEventListener("scroll",n),Or.get(e)?.(),window.removeEventListener("resize",n))}}const Nr=new Map;function Kr({source:t,container:e=document.documentElement,axis:n="y"}={}){t&&(e=t),Nr.has(e)||Nr.set(e,{});const s=Nr.get(e);return s[n]||(s[n]=ws()?new ScrollTimeline({source:e,axis:n}):function({source:t,container:e,axis:n="y"}){t&&(e=t);const s={value:0},r=Dr((t=>{s.value=100*t[n].progress}),{container:e,axis:n});return{currentTime:s,cancel:r}}({source:e,axis:n})),s[n]}function $r(t){return t&&(t.target||t.offset)}function jr(t,{axis:e="y",...n}={}){const s={axis:e,...n};return"function"==typeof t?function(t,e){return function(t){return 2===t.length}(t)||$r(e)?Dr((n=>{t(n[e.axis].progress,n)}),e):mr(t,Kr(e))}(t,s):function(t,e){if(t.flatten(),$r(e))return t.pause(),Dr((n=>{t.time=t.duration*n[e.axis].progress}),e);{const n=Kr(e);return t.attachTimeline?t.attachTimeline(n,(t=>(t.pause(),mr((e=>{t.time=t.duration*e}),n)))):r}}(t,s)}const zr={some:0,all:1};function Yr(t,e,{root:n,margin:s,amount:r="some"}={}){const i=T(t),o=new WeakMap,a=new IntersectionObserver((t=>{t.forEach((t=>{const n=o.get(t.target);if(t.isIntersecting!==Boolean(n))if(t.isIntersecting){const n=e(t.target,t);"function"==typeof n?o.set(t.target,n):a.unobserve(t.target)}else"function"==typeof n&&(n(t),o.delete(t.target))}))}),{root:n,rootMargin:s,threshold:"number"==typeof r?r:zr[r]});return i.forEach((t=>a.observe(t))),()=>a.disconnect()}function Ur(t,e="end"){return n=>{const s=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,r="end"===e?Math.floor(s):Math.ceil(s);return L(0,1,r/t)}}function Xr(t=.1,{startDelay:e=0,from:n=0,ease:s}={}){return(r,i)=>{const o="number"==typeof n?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,i),a=Math.abs(o-r);let l=t*a;if(s){const e=i*t;l=_n(s)(l/e)*e}return e+l}}function Hr(t,e){return function(t,e){const n=h.now(),s=({timestamp:r})=>{const i=r-n;i>=e&&(o(s),t(i-e))};return i.read(s,!0),()=>o(s)}(t,G(e))}const qr=(t,e)=>Math.abs(t-e);function Gr(t,e){const n=qr(t.x,e.x),s=qr(t.y,e.y);return Math.sqrt(n**2+s**2)}function Zr(...t){const e=!Array.isArray(t[0]),n=e?0:-1,s=t[0+n],r=t[1+n],i=t[2+n],o=t[3+n],a=Jn(r,i,{mixer:(l=i[0],(t=>t&&"object"==typeof t&&t.mix)(l)?l.mix:void 0),...o});var l;return e?a(s):a}export{m as MotionValue,rr as animate,fr as animateMini,te as anticipate,Jt as backIn,Qt as backInOut,_t as backOut,o as cancelFrame,v as cancelSync,ee as circIn,se as circInOut,ne as circOut,L as clamp,sr as createScopedAnimate,qt as cubicBezier,Hr as delay,qr as distance,Gr as distance2D,Xn as easeIn,qn as easeInOut,Hn as easeOut,i as frame,a as frameData,M as hover,Yr as inView,Un as inertia,Jn as interpolate,R as invariant,b as isDragActive,Qn as keyframes,Gt as mirrorEasing,Yn as mix,g as motionValue,r as noop,Wn as pipe,F as press,B as progress,Zt as reverseEasing,jr as scroll,Dr as scrollInfo,dt as spring,Xr as stagger,Ur as steps,y as sync,h as time,Zr as transform,pt as wrap};export default null; +//# sourceMappingURL=/sm/c3a9c94d052a4b74d68bc150209257e1cd84d24eaba9be175f872e4bbf76c300.map \ No newline at end of file diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index f78843d47..62e0b2a75 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -73,12 +73,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { 'zen.workspaces.open-new-tab-if-last-unpinned-tab-is-closed', false ); - XPCOMUtils.defineLazyPreferenceGetter( - this, - 'containerSpecificEssentials', - 'zen.workspaces.container-specific-essentials-enabled', - false - ); + this.containerSpecificEssentials = Services.prefs.getBoolPref('zen.workspaces.container-specific-essentials-enabled', false); ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs')); this._activeWorkspace = Services.prefs.getStringPref('zen.workspaces.active', ''); @@ -172,6 +167,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } this._pinnedTabsResizeObserver.observe(element); } + for (let element of document.getElementById('zen-essentials-wrapper').children) { + if (element.classList.contains('tabbrowser-tab')) { + continue; + } + this._pinnedTabsResizeObserver.observe(element); + } } get activeWorkspaceStrip() { @@ -218,7 +219,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { const defaultSelectedContainer = document.querySelector( `#tabbrowser-arrowscrollbox .zen-workspace-tabs-section[zen-workspace-id="${this.activeWorkspace}"]` ); - const essentialsContaienr = document.getElementById('zen-essentials-container'); // New profile with no workspaces does not have a default selected container if (defaultSelectedContainer) { const pinnedContainer = document.querySelector( @@ -226,7 +226,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { ); for (const tab of tabs) { if (tab.hasAttribute('zen-essential')) { - essentialsContaienr.appendChild(tab); + this.getEssentialsSection(tab).appendChild(tab); continue; } else if (tab.pinned) { pinnedContainer.insertBefore(tab, pinnedContainer.lastChild); @@ -244,7 +244,31 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { this._fixIndicatorsNames(workspaces); } - _createWorkspaceSection(workspace) { + getEssentialsSection(container = 0) { + if (typeof container !== 'number') { + container = container?.getAttribute('usercontextid'); + } + container ??= 0; + if (!this.containerSpecificEssentials) { + container = 0; + } + let essentialsContainer = document.querySelector(`.zen-essentials-container[container="${container}"]`); + if (!essentialsContainer) { + essentialsContainer = document.createXULElement('vbox'); + essentialsContainer.className = 'zen-essentials-container zen-workspace-tabs-section'; + essentialsContainer.setAttribute('flex', '1'); + essentialsContainer.setAttribute('container', container); + document.getElementById('zen-essentials-wrapper').appendChild(essentialsContainer); + } + return essentialsContainer; + } + + getCurrentEssentialsContainer() { + const currentWorkspace = this.activeWorkspace; + return this.getEssentialsSection(currentWorkspace?.containerTabId); + } + + #createWorkspaceSection(workspace) { const section = document.createXULElement('vbox'); section.className = 'zen-workspace-tabs-section'; section.setAttribute('flex', '1'); @@ -254,11 +278,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { async _createWorkspaceTabsSection(workspace, tabs, perifery) { const container = gBrowser.tabContainer.arrowScrollbox; - const section = this._createWorkspaceSection(workspace); + const section = this.#createWorkspaceSection(workspace); container.appendChild(section); const pinnedContainer = document.getElementById('vertical-pinned-tabs-container'); - const pinnedSection = this._createWorkspaceSection(workspace); + const pinnedSection = this.#createWorkspaceSection(workspace); this._organizeTabsToWorkspaceSections(workspace, section, pinnedSection, tabs); section.appendChild(perifery.cloneNode(true)); pinnedSection.appendChild( @@ -268,7 +292,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { ); pinnedContainer.appendChild(pinnedSection); - const workspaceIndicator = this._createWorkspaceSection(workspace); + const workspaceIndicator = this.#createWorkspaceSection(workspace); workspaceIndicator.classList.add('zen-current-workspace-indicator'); workspaceIndicator.appendChild(window.MozXULElement.parseXULToFragment(this.workspaceIndicatorXUL)); document.getElementById('zen-current-workspace-indicator-container').appendChild(workspaceIndicator); @@ -629,7 +653,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { if (this._initialTab) { this.moveTabToWorkspace(this._initialTab, this.activeWorkspace); gBrowser.selectedTab = this._initialTab; - gBrowser.moveTabTo(this._initialTab, 0, { forceStandaloneTab: true }); + gBrowser.moveTabTo(this._initialTab, 0, { forceUngrouped: true }); this._initialTab._possiblyEmpty = false; this._initialTab = null; } @@ -1591,18 +1615,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { await this._organizeWorkspaceStripLocations(previousWorkspace); } - // First pass: Handle tab visibility and workspace ID assignment - const prevTabUsed = this._processTabVisibility(window.uuid, containerId, workspaces, onInit); - // Second pass: Handle tab selection this.tabContainer._invalidateCachedTabs(); const tabToSelect = await this._handleTabSelection( window, onInit, - containerId, - workspaces, - previousWorkspace.uuid, - prevTabUsed + previousWorkspace.uuid ); // Update UI and state @@ -1632,9 +1650,30 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } } - _updateMarginTopPinnedTabs(arrowscrollbox, pinnedContainer) { - if (arrowscrollbox) { - arrowscrollbox.style.marginTop = pinnedContainer.getBoundingClientRect().height + 'px'; + _updateMarginTopPinnedTabs(arrowscrollbox, pinnedContainer, essentialContainer, workspaceIndicator) { + if (arrowscrollbox && !pinnedContainer.hasAttribute('hidden')) { + const essentialsHeight = essentialContainer.getBoundingClientRect().height; + pinnedContainer.style.marginTop = essentialsHeight + 'px'; + workspaceIndicator.style.marginTop = essentialsHeight + 'px'; + const arrowMarginTop = pinnedContainer.getBoundingClientRect().height + essentialsHeight + 'px'; + if (!this._animatingChange) { + gZenUIManager.motion.animate( + arrowscrollbox, + { + marginTop: [ + arrowscrollbox.style.marginTop, + arrowMarginTop + ] + }, + { + type: 'spring', + bounce: 0, + duration: 0.2, + } + ); + } else { + arrowscrollbox.style.marginTop = arrowMarginTop; + } } } @@ -1656,6 +1695,17 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } } } + // Hide other essentials with different containerTabId + const otherContainersEssentials = document.querySelectorAll( + `#zen-essentials-wrapper .zen-workspace-tabs-section` + ); + for (const container of otherContainersEssentials) { + if (container.getAttribute('container') != workspace.containerTabId) { + container.setAttribute('hidden', 'true'); + } else { + container.removeAttribute('hidden'); + } + } } updateWorkspaceIndicator(currentWorkspace, workspaceIndicator) { @@ -1684,11 +1734,15 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } async _animateTabs(newWorkspace, shouldAnimate, tabToSelect = null) { + const kGlobalAnimationDuration = 0.3; this._animatingChange = true; const animations = []; const workspaces = await this._workspaces(); const newWorkspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === newWorkspace.uuid); for (const element of document.querySelectorAll('.zen-workspace-tabs-section')) { + if (element.classList.contains('zen-essentials-container')) { + continue; + } const existingTransform = element.style.transform; const elementWorkspaceId = element.getAttribute('zen-workspace-id'); const elementWorkspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === elementWorkspaceId); @@ -1705,7 +1759,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { { type: 'spring', bounce: 0, - duration: 0.3, + duration: kGlobalAnimationDuration, } ) ); @@ -1723,97 +1777,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { this._animatingChange = false; } - _processTabVisibility(workspaceUuid, containerId, workspaces, onInit) { - const hiddenTabs = []; - const visibleTabs = gBrowser.tabContainer.visibleTabs; - for (const tab of gBrowser.tabs) { - if (!this._shouldShowTab(tab, workspaceUuid, containerId, workspaces)) { - hiddenTabs.push(tab); - } else if (tab.hasAttribute('zen-essential')) { - gBrowser.showTab(tab, undefined, true); - } - } - // If there's no more visible tabs, make a new tab visible - // or if ALL the visible tabs are essentials or we have our selected - // tab hidden, select a new tab - let prevTabUsed = null; - if ( - (hiddenTabs.length === visibleTabs.length || - visibleTabs.every((tab) => tab.getAttribute('zen-essential') === 'true') || - hiddenTabs.includes(gBrowser.selectedTab)) && - gZenVerticalTabsManager._canReplaceNewTab && - !onInit - ) { - prevTabUsed = gBrowser.selectedTab; - this.selectEmptyTab(); - } - for (const tab of hiddenTabs) { - gBrowser.hideTab(tab, undefined, true); - } - return prevTabUsed; - } - - // Only use it in gZenPinnedTabsManager, when initializing essential tabs - essentialShouldShowTab(tab) { - if (tab.getAttribute('zen-essential') !== 'true') { - return true; - } - const workspaces = this._workspaceCache; - if (!workspaces) { - return true; - } - const containerId = ( - workspaces.workspaces.find((workspace) => workspace.uuid === this.activeWorkspace) || {} - )?.containerTabId?.toString(); - return this._shouldShowTab(tab, this.activeWorkspace, containerId, workspaces); - } - - _shouldShowTab(tab, workspaceUuid, containerId, workspaces) { - const isEssential = tab.getAttribute('zen-essential') === 'true'; - const tabWorkspaceId = tab.getAttribute('zen-workspace-id'); - const tabContextId = tab.getAttribute('usercontextid'); - - if (tab.hasAttribute('zen-glance-tab')) { - return true; // Always show glance tabs - } - - // Handle essential tabs - if (isEssential) { - if (!this.containerSpecificEssentials) { - return true; // Show all essential tabs when containerSpecificEssentials is false - } - - if (containerId) { - // In workspaces with default container: Show essentials that match the container - return tabContextId === containerId; - } else { - // In workspaces without a default container: Show essentials that aren't in container-specific workspaces - // or have usercontextid="0" or no usercontextid - return ( - !tabContextId || - tabContextId === '0' || - !workspaces.workspaces.some((workspace) => workspace.containerTabId === parseInt(tabContextId, 10)) - ); - } - } - - // For non-essential tabs (both normal and pinned) - if (!tabWorkspaceId) { - // Assign workspace ID to tabs without one - this.moveTabToWorkspace(tab, workspaceUuid); - return true; - } - - // Show if tab belongs to current workspace - return tabWorkspaceId === workspaceUuid; - } - _shouldChangeToTab(aTab) { return !(aTab?.hasAttribute('zen-essential') || (aTab?.pinned && aTab?.hasAttribute('pending'))); } - async _handleTabSelection(window, onInit, containerId, workspaces, previousWorkspaceId, prevTabUsed) { - const currentSelectedTab = prevTabUsed || gBrowser.selectedTab; + async _handleTabSelection(window, onInit, previousWorkspaceId) { + const currentSelectedTab = gBrowser.selectedTab; const oldWorkspaceId = previousWorkspaceId; const lastSelectedTab = this._lastSelectedWorkspaceTabs[window.uuid]; @@ -1824,7 +1793,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { let tabToSelect = null; // Try last selected tab if it is visible - if (lastSelectedTab && this._shouldShowTab(lastSelectedTab, window.uuid, containerId, workspaces)) { + if (lastSelectedTab) { tabToSelect = lastSelectedTab; } // Find first suitable tab @@ -1852,12 +1821,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { // Always make sure we always unselect the tab from the old workspace if (currentSelectedTab && currentSelectedTab !== tabToSelect) { currentSelectedTab._selected = false; - if ( - !this._shouldShowTab(currentSelectedTab, window.uuid, containerId, workspaces) && - currentSelectedTab.hasAttribute('zen-essential') - ) { - gBrowser.hideTab(currentSelectedTab, undefined, true); - } } return tabToSelect; } @@ -2007,17 +1970,39 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } } - onPinnedTabsResize(entries) { + async onPinnedTabsResize(entries) { if (!this._hasInitializedTabsStrip) { return; } for (const entry of entries) { - const workspaceId = entry.target.getAttribute('zen-workspace-id'); - const arrowScrollbox = document.querySelector( - `#tabbrowser-arrowscrollbox .zen-workspace-tabs-section[zen-workspace-id="${workspaceId}"]` - ); - this._updateMarginTopPinnedTabs(arrowScrollbox, entry.target); - this.updateShouldHideSeparator(arrowScrollbox, entry.target); + const originalWorkspaceId = entry.target.getAttribute('zen-workspace-id'); + const workspacesIds = []; + if (entry.target.closest('#zen-essentials-wrapper')) { + // Get all workspaces that have the same userContextId + const activeWorkspace = await this.getActiveWorkspace(); + const userContextId = activeWorkspace.containerTabId; + const workspaces = this._workspaceCache.workspaces.filter( + (w) => w.containerTabId === userContextId && w.uuid !== originalWorkspaceId + ); + workspacesIds.push(...workspaces.map((w) => w.uuid)); + } else { + workspacesIds.push(originalWorkspaceId); + } + for (const workspaceId of workspacesIds) { + const arrowScrollbox = document.querySelector( + `#tabbrowser-arrowscrollbox .zen-workspace-tabs-section[zen-workspace-id="${workspaceId}"]` + ); + const pinnedContainer = document.querySelector( + `#vertical-pinned-tabs-container .zen-workspace-tabs-section[zen-workspace-id="${workspaceId}"]` + ); + const workspaceIndicator = document.querySelector( + `#zen-current-workspace-indicator-container .zen-workspace-tabs-section[zen-workspace-id="${workspaceId}"]` + ); + const workspaceObject = this._workspaceCache.workspaces.find((w) => w.uuid === workspaceId); + const essentialContainer = this.getEssentialsSection(workspaceObject.containerTabId); + this._updateMarginTopPinnedTabs(arrowScrollbox, pinnedContainer, essentialContainer, workspaceIndicator); + this.updateShouldHideSeparator(arrowScrollbox, pinnedContainer); + } } } @@ -2096,7 +2081,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { continue; } if (tab.getAttribute('zen-essential') === 'true') { - const container = document.getElementById('zen-essentials-container'); + const container = this.getCurrentEssentialsContainer(); container.appendChild(tab); changed = true; continue; @@ -2353,14 +2338,14 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { const tabs = []; // we need to go through each tab in each container - const essentialsContainer = document.getElementById('zen-essentials-container'); + const essentialsContainer = document.querySelectorAll('#zen-essentials-wrapper .zen-workspace-tabs-section'); let pinnedContainers = document.querySelectorAll('#vertical-pinned-tabs-container .zen-workspace-tabs-section'); let normalContainers = document.querySelectorAll('#tabbrowser-arrowscrollbox .zen-workspace-tabs-section'); if (!this._hasInitializedTabsStrip) { pinnedContainers = [document.getElementById('vertical-pinned-tabs-container')]; normalContainers = [this.activeWorkspaceStrip]; } - const containers = [essentialsContainer, ...pinnedContainers, ...normalContainers]; + const containers = [...essentialsContainer, ...pinnedContainers, ...normalContainers]; for (const container of containers) { for (const tab of container.children) { if (tab.tagName === 'tab') { diff --git a/src/zen/workspaces/ZenWorkspacesStorage.mjs b/src/zen/workspaces/ZenWorkspacesStorage.mjs index f2bf4f628..c92577193 100644 --- a/src/zen/workspaces/ZenWorkspacesStorage.mjs +++ b/src/zen/workspaces/ZenWorkspacesStorage.mjs @@ -195,7 +195,7 @@ var ZenWorkspacesStorage = { name: row.getResultByName('name'), icon: row.getResultByName('icon'), default: !!row.getResultByName('is_default'), - containerTabId: row.getResultByName('container_id'), + containerTabId: row.getResultByName('container_id') ?? 0, position: row.getResultByName('position'), theme: row.getResultByName('theme_type') ? {