@tamagui/core 1.85.6 → 1.85.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/native.js CHANGED
@@ -1483,7 +1483,7 @@ var require_insertStyleRule_native = __commonJS({
1483
1483
  if (sepI === -1)
1484
1484
  continue;
1485
1485
  let key = rule.slice(rule.indexOf("--") + 2, sepI), val = rule.slice(sepI + 2), value;
1486
- if (val[3] === "(") {
1486
+ if (val.startsWith("var(")) {
1487
1487
  let varName = val.slice(6, -1), tokenVal = colorVarToVal[varName];
1488
1488
  tokenVal ? value = tokenVal : (rootComputedStyle ||= getComputedStyle(document.body), value = rootComputedStyle.getPropertyValue("--" + varName));
1489
1489
  } else
@@ -1497,20 +1497,17 @@ var require_insertStyleRule_native = __commonJS({
1497
1497
  !0
1498
1498
  );
1499
1499
  }
1500
- return {
1501
- names: [
1502
- ...new Set(
1503
- selectors.map((selector) => {
1504
- let parts = selector.replace(/(.t_|:root)/g, "").trim().split(" "), [first] = parts, scheme = first.includes("dark") ? "dark" : first.includes("light") ? "light" : "", name = (() => {
1505
- let _ = parts[parts.length - 1];
1506
- return scheme && _.startsWith(scheme) && (_ = _.slice(scheme.length + 1)), _;
1507
- })();
1508
- return `${scheme}${scheme && name ? "_" : ""}${name}`;
1509
- })
1510
- )
1511
- ],
1500
+ let dedupedEntry = {
1501
+ names: [],
1512
1502
  theme: values
1513
1503
  };
1504
+ for (let selector of selectors) {
1505
+ let scheme = selector.includes("t_dark") ? "dark" : selector.includes("t_light") ? "light" : "", name = selector.slice(selector.lastIndexOf(".t_") + 3);
1506
+ name.startsWith(scheme) && (name = name.slice(scheme.length + 1)), scheme === name && (scheme = "");
1507
+ let themeName = `${scheme}${scheme && name ? "_" : ""}${name}`;
1508
+ dedupedEntry.names.includes(themeName) || dedupedEntry.names.push(themeName);
1509
+ }
1510
+ return dedupedEntry;
1514
1511
  }
1515
1512
  function getTamaguiSelector(rule, collectThemes = !1) {
1516
1513
  if (rule instanceof CSSStyleRule) {
@@ -1842,116 +1839,9 @@ var require_useMedia_native = __commonJS({
1842
1839
  }
1843
1840
  });
1844
1841
 
1845
- // ../web/dist/cjs/Tamagui.native.js
1846
- var require_Tamagui_native = __commonJS({
1847
- "../web/dist/cjs/Tamagui.native.js"(exports2, module2) {
1848
- "use strict";
1849
- var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1850
- for (var name in all)
1851
- __defProp2(target, name, { get: all[name], enumerable: !0 });
1852
- }, __copyProps2 = (to, from, except, desc) => {
1853
- if (from && typeof from == "object" || typeof from == "function")
1854
- for (let key of __getOwnPropNames2(from))
1855
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1856
- return to;
1857
- }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
1858
- // If the importer is in node compatibility mode or this is not an ESM
1859
- // file that has been converted to a CommonJS file using a Babel-
1860
- // compatible transform (i.e. "__esModule" has not been set), then set
1861
- // "default" to the CommonJS "module.exports" for node compatibility.
1862
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
1863
- mod
1864
- )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Tamagui_exports = {};
1865
- __export2(Tamagui_exports, {
1866
- Tamagui: () => Tamagui,
1867
- getValueFromIdentifier: () => getValueFromIdentifier,
1868
- setIdentifierValue: () => setIdentifierValue
1869
- });
1870
- module2.exports = __toCommonJS2(Tamagui_exports);
1871
- var Helpers = __toESM2(require_index_native4()), import_config = require_config_native(), import_insertStyleRule = require_insertStyleRule_native(), import_useMedia = require_useMedia_native(), TamaguiManager = class {
1872
- constructor() {
1873
- this.Helpers = Helpers;
1874
- }
1875
- get mediaState() {
1876
- return { ...import_useMedia.mediaState };
1877
- }
1878
- get config() {
1879
- return (0, import_config.getConfig)();
1880
- }
1881
- get insertedRules() {
1882
- return (0, import_insertStyleRule.getAllRules)();
1883
- }
1884
- get allSelectors() {
1885
- return (0, import_insertStyleRule.getAllSelectors)();
1886
- }
1887
- get allTransforms() {
1888
- return (0, import_insertStyleRule.getAllTransforms)();
1889
- }
1890
- get identifierToValue() {
1891
- return identifierToValue;
1892
- }
1893
- }, Tamagui = new TamaguiManager(), identifierToValue = /* @__PURE__ */ new Map(), getValueFromIdentifier = (identifier) => identifierToValue.get(identifier), setIdentifierValue = (identifier, value) => {
1894
- identifierToValue.set(identifier, value);
1895
- };
1896
- }
1897
- });
1898
-
1899
- // ../compose-refs/dist/cjs/compose-refs.native.js
1900
- var require_compose_refs_native = __commonJS({
1901
- "../compose-refs/dist/cjs/compose-refs.native.js"(exports2, module2) {
1902
- "use strict";
1903
- var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1904
- for (var name in all)
1905
- __defProp2(target, name, { get: all[name], enumerable: !0 });
1906
- }, __copyProps2 = (to, from, except, desc) => {
1907
- if (from && typeof from == "object" || typeof from == "function")
1908
- for (let key of __getOwnPropNames2(from))
1909
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1910
- return to;
1911
- }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
1912
- // If the importer is in node compatibility mode or this is not an ESM
1913
- // file that has been converted to a CommonJS file using a Babel-
1914
- // compatible transform (i.e. "__esModule" has not been set), then set
1915
- // "default" to the CommonJS "module.exports" for node compatibility.
1916
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
1917
- mod
1918
- )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), compose_refs_exports = {};
1919
- __export2(compose_refs_exports, {
1920
- composeRefs: () => composeRefs,
1921
- useComposedRefs: () => useComposedRefs
1922
- });
1923
- module2.exports = __toCommonJS2(compose_refs_exports);
1924
- var React = __toESM2(require("react"));
1925
- function setRef(ref, value) {
1926
- typeof ref == "function" ? ref(value) : ref && (ref.current = value);
1927
- }
1928
- function composeRefs(...refs) {
1929
- return (node) => refs.forEach((ref) => setRef(ref, node));
1930
- }
1931
- function useComposedRefs(...refs) {
1932
- return React.useCallback(composeRefs(...refs), refs);
1933
- }
1934
- }
1935
- });
1936
-
1937
- // ../compose-refs/dist/cjs/index.native.js
1938
- var require_index_native5 = __commonJS({
1939
- "../compose-refs/dist/cjs/index.native.js"(exports2, module2) {
1940
- "use strict";
1941
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __copyProps2 = (to, from, except, desc) => {
1942
- if (from && typeof from == "object" || typeof from == "function")
1943
- for (let key of __getOwnPropNames2(from))
1944
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1945
- return to;
1946
- }, __reExport2 = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
1947
- module2.exports = __toCommonJS2(src_exports2);
1948
- __reExport2(src_exports2, require_compose_refs_native(), module2.exports);
1949
- }
1950
- });
1951
-
1952
- // ../use-did-finish-ssr/dist/cjs/index.native.js
1953
- var require_index_native6 = __commonJS({
1954
- "../use-did-finish-ssr/dist/cjs/index.native.js"(exports2, module2) {
1842
+ // ../web/dist/cjs/helpers/createShallowSetState.native.js
1843
+ var require_createShallowSetState_native = __commonJS({
1844
+ "../web/dist/cjs/helpers/createShallowSetState.native.js"(exports2, module2) {
1955
1845
  "use strict";
1956
1846
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
1957
1847
  for (var name in all)
@@ -1961,18 +1851,24 @@ var require_index_native6 = __commonJS({
1961
1851
  for (let key of __getOwnPropNames2(from))
1962
1852
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1963
1853
  return to;
1964
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
1965
- __export2(src_exports2, {
1966
- useClientValue: () => useClientValue,
1967
- useDidFinishSSR: () => useDidFinishSSR
1854
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createShallowSetState_exports = {};
1855
+ __export2(createShallowSetState_exports, {
1856
+ createShallowSetState: () => createShallowSetState,
1857
+ isEqualShallow: () => isEqualShallow,
1858
+ mergeIfNotShallowEqual: () => mergeIfNotShallowEqual
1968
1859
  });
1969
- module2.exports = __toCommonJS2(src_exports2);
1970
- var import_react3 = require("react");
1971
- function useDidFinishSSR(value) {
1972
- return value ?? !0;
1860
+ module2.exports = __toCommonJS2(createShallowSetState_exports);
1861
+ function createShallowSetState(setter, debug) {
1862
+ return (next) => setter((prev) => mergeIfNotShallowEqual(prev, next, debug));
1973
1863
  }
1974
- function useClientValue(value) {
1975
- return useDidFinishSSR() ? typeof value == "function" ? value() : value : void 0;
1864
+ function mergeIfNotShallowEqual(prev, next, debug) {
1865
+ return isEqualShallow(prev, next) ? prev : (process.env.NODE_ENV === "development" && debug && console.warn("setStateShallow CHANGE", { prev, next }), { ...prev, ...next });
1866
+ }
1867
+ function isEqualShallow(prev, next) {
1868
+ for (let key in next)
1869
+ if (prev[key] !== next[key])
1870
+ return !1;
1871
+ return !0;
1976
1872
  }
1977
1873
  }
1978
1874
  });
@@ -2011,9 +1907,9 @@ var require_constants_native2 = __commonJS({
2011
1907
  }
2012
1908
  });
2013
1909
 
2014
- // ../web/dist/cjs/helpers/objectIdentityKey.native.js
2015
- var require_objectIdentityKey_native = __commonJS({
2016
- "../web/dist/cjs/helpers/objectIdentityKey.native.js"(exports2, module2) {
1910
+ // ../web/dist/cjs/helpers/ThemeManager.native.js
1911
+ var require_ThemeManager_native = __commonJS({
1912
+ "../web/dist/cjs/helpers/ThemeManager.native.js"(exports2, module2) {
2017
1913
  "use strict";
2018
1914
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2019
1915
  for (var name in all)
@@ -2023,177 +1919,149 @@ var require_objectIdentityKey_native = __commonJS({
2023
1919
  for (let key of __getOwnPropNames2(from))
2024
1920
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2025
1921
  return to;
2026
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), objectIdentityKey_exports = {};
2027
- __export2(objectIdentityKey_exports, {
2028
- objectIdentityKey: () => objectIdentityKey
1922
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManager_exports = {};
1923
+ __export2(ThemeManager_exports, {
1924
+ ThemeManager: () => ThemeManager,
1925
+ getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
1926
+ getManagers: () => getManagers
2029
1927
  });
2030
- module2.exports = __toCommonJS2(objectIdentityKey_exports);
2031
- function objectIdentityKey(obj) {
2032
- let k = "";
2033
- for (let key in obj) {
2034
- k += key;
2035
- let arg = obj[key], type = typeof arg;
2036
- if (!arg || type !== "object" && type !== "function")
2037
- k += type + arg;
2038
- else if (cache.has(arg))
2039
- k += cache.get(arg);
2040
- else {
2041
- let v = Math.random();
2042
- cache.set(arg, v), k += v;
2043
- }
2044
- }
2045
- return k;
1928
+ module2.exports = __toCommonJS2(ThemeManager_exports);
1929
+ var import_constants = require_index_native3(), import_config = require_config_native(), import_constants2 = require_constants_native2(), emptyState = { name: "" };
1930
+ function getHasThemeUpdatingProps(props) {
1931
+ return !!(props.name || props.componentName || props.inverse || props.reset);
2046
1932
  }
2047
- var cache = /* @__PURE__ */ new WeakMap();
2048
- }
2049
- });
2050
-
2051
- // ../web/dist/cjs/helpers/createStyledContext.native.js
2052
- var require_createStyledContext_native = __commonJS({
2053
- "../web/dist/cjs/helpers/createStyledContext.native.js"(exports2, module2) {
2054
- "use strict";
2055
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2056
- for (var name in all)
2057
- __defProp2(target, name, { get: all[name], enumerable: !0 });
2058
- }, __copyProps2 = (to, from, except, desc) => {
2059
- if (from && typeof from == "object" || typeof from == "function")
2060
- for (let key of __getOwnPropNames2(from))
2061
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2062
- return to;
2063
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createStyledContext_exports = {};
2064
- __export2(createStyledContext_exports, {
2065
- createStyledContext: () => createStyledContext
2066
- });
2067
- module2.exports = __toCommonJS2(createStyledContext_exports);
2068
- var import_react3 = require("react"), import_objectIdentityKey = require_objectIdentityKey_native(), import_jsx_runtime = require("react/jsx-runtime");
2069
- function createStyledContext(defaultValues) {
2070
- let OGContext = (0, import_react3.createContext)(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
2071
- children,
2072
- scope,
2073
- ...values
2074
- }) => {
2075
- let next = (0, import_react3.useMemo)(() => ({
2076
- // this ! is a workaround for ts error
2077
- ...defaultValues,
2078
- ...values
2079
- }), [(0, import_objectIdentityKey.objectIdentityKey)(values)]), Provider2 = OGProvider;
2080
- if (scope) {
2081
- let ScopedContext = scopedContexts.get(scope);
2082
- ScopedContext || (ScopedContext = (0, import_react3.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
1933
+ var uid = 0, ThemeManager = class {
1934
+ constructor(props = {}, parentManager) {
1935
+ if (this.props = props, this.id = 0, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this._allKeys = null, uid = (uid + 1) % Number.MAX_VALUE, this.id = uid, parentManager === "root") {
1936
+ this.updateStateFromProps(props, !1);
1937
+ return;
2083
1938
  }
2084
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value: next, children });
2085
- }, useStyledContext = (scope) => {
2086
- let context = scope ? scopedContexts.get(scope) : OGContext;
2087
- return (0, import_react3.useContext)(context);
2088
- };
2089
- return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
2090
- }
2091
- }
2092
- });
2093
-
2094
- // ../web/dist/cjs/contexts/ComponentContext.native.js
2095
- var require_ComponentContext_native = __commonJS({
2096
- "../web/dist/cjs/contexts/ComponentContext.native.js"(exports2, module2) {
2097
- "use strict";
2098
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2099
- for (var name in all)
2100
- __defProp2(target, name, { get: all[name], enumerable: !0 });
2101
- }, __copyProps2 = (to, from, except, desc) => {
2102
- if (from && typeof from == "object" || typeof from == "function")
2103
- for (let key of __getOwnPropNames2(from))
2104
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2105
- return to;
2106
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ComponentContext_exports = {};
2107
- __export2(ComponentContext_exports, {
2108
- ComponentContext: () => ComponentContext
2109
- });
2110
- module2.exports = __toCommonJS2(ComponentContext_exports);
2111
- var import_createStyledContext = require_createStyledContext_native(), ComponentContext = (0, import_createStyledContext.createStyledContext)({
2112
- disableSSR: void 0,
2113
- inText: !1,
2114
- language: null,
2115
- animationDriver: null,
2116
- groups: {
2117
- emit: null,
2118
- subscribe: null,
2119
- state: {}
1939
+ if (!parentManager)
1940
+ throw process.env.NODE_ENV !== "production" ? new Error(
1941
+ "No parent manager given, this is likely due to duplicated Tamagui dependencies. Check your lockfile for mis-matched versions. It could also be from an error somewhere else in your stack causing Tamagui to recieve undefined context, you can try putting some ErrorBoundary components around other areas of your app, or a Suspense boundary."
1942
+ ) : "\u274C 000";
1943
+ if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
1944
+ return parentManager;
1945
+ }
1946
+ updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
1947
+ if (this.props = props, props.forceTheme)
1948
+ return this.state.theme = props.forceTheme, this.state.name = props.name || "", this.updateState(this.state, !0), this.state;
1949
+ let nextState = this.getStateIfChanged(props);
1950
+ if (nextState)
1951
+ return this.updateState(nextState, shouldNotify), nextState;
1952
+ }
1953
+ updateState(nextState, shouldNotify = !0) {
1954
+ this.state = nextState, this._allKeys = null, process.env.NODE_ENV !== "production" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && this.notify();
1955
+ }
1956
+ getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {
1957
+ let _ = this.getState(props, parentManager);
1958
+ if (state && state !== emptyState && !_)
1959
+ return parentManager == null ? void 0 : parentManager.state;
1960
+ if (this.getStateShouldChange(_, state))
1961
+ return _;
1962
+ }
1963
+ getStateShouldChange(nextState, state = this.state) {
1964
+ return !(!(nextState != null && nextState.theme) || nextState.theme === (state == null ? void 0 : state.theme));
1965
+ }
1966
+ getState(props = this.props, parentManager = this.parentManager) {
1967
+ return getState(props, parentManager) || (parentManager == null ? void 0 : parentManager.state) || null;
1968
+ }
1969
+ get allKeys() {
1970
+ var _a;
1971
+ return this._allKeys ||= /* @__PURE__ */ new Set([
1972
+ ...((_a = this.parentManager) == null ? void 0 : _a.allKeys) || [],
1973
+ ...Object.keys(this.state.theme || {})
1974
+ ]), this._allKeys;
1975
+ }
1976
+ notify(forced = !1) {
1977
+ this.themeListeners.forEach((cb) => cb(this.state.name, this, forced));
1978
+ }
1979
+ onChangeTheme(cb, debugId) {
1980
+ return process.env.NODE_ENV !== "production" && debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
1981
+ this.themeListeners.delete(cb);
1982
+ };
2120
1983
  }
2121
- });
2122
- }
2123
- });
2124
-
2125
- // ../web/dist/cjs/defaultComponentState.native.js
2126
- var require_defaultComponentState_native = __commonJS({
2127
- "../web/dist/cjs/defaultComponentState.native.js"(exports2, module2) {
2128
- "use strict";
2129
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2130
- for (var name in all)
2131
- __defProp2(target, name, { get: all[name], enumerable: !0 });
2132
- }, __copyProps2 = (to, from, except, desc) => {
2133
- if (from && typeof from == "object" || typeof from == "function")
2134
- for (let key of __getOwnPropNames2(from))
2135
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2136
- return to;
2137
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), defaultComponentState_exports = {};
2138
- __export2(defaultComponentState_exports, {
2139
- defaultComponentState: () => defaultComponentState,
2140
- defaultComponentStateMounted: () => defaultComponentStateMounted,
2141
- defaultComponentStateShouldEnter: () => defaultComponentStateShouldEnter
2142
- });
2143
- module2.exports = __toCommonJS2(defaultComponentState_exports);
2144
- var defaultComponentState = {
2145
- hover: !1,
2146
- press: !1,
2147
- pressIn: !1,
2148
- focus: !1,
2149
- unmounted: !0
2150
- }, defaultComponentStateMounted = {
2151
- ...defaultComponentState,
2152
- unmounted: !1
2153
- }, defaultComponentStateShouldEnter = {
2154
- ...defaultComponentState,
2155
- unmounted: "should-enter"
2156
1984
  };
2157
- }
2158
- });
2159
-
2160
- // ../web/dist/cjs/helpers/createShallowSetState.native.js
2161
- var require_createShallowSetState_native = __commonJS({
2162
- "../web/dist/cjs/helpers/createShallowSetState.native.js"(exports2, module2) {
2163
- "use strict";
2164
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2165
- for (var name in all)
2166
- __defProp2(target, name, { get: all[name], enumerable: !0 });
2167
- }, __copyProps2 = (to, from, except, desc) => {
2168
- if (from && typeof from == "object" || typeof from == "function")
2169
- for (let key of __getOwnPropNames2(from))
2170
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2171
- return to;
2172
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createShallowSetState_exports = {};
2173
- __export2(createShallowSetState_exports, {
2174
- createShallowSetState: () => createShallowSetState,
2175
- isEqualShallow: () => isEqualShallow,
2176
- mergeIfNotShallowEqual: () => mergeIfNotShallowEqual
2177
- });
2178
- module2.exports = __toCommonJS2(createShallowSetState_exports);
2179
- function createShallowSetState(setter, debug) {
2180
- return (next) => setter((prev) => mergeIfNotShallowEqual(prev, next, debug));
2181
- }
2182
- function mergeIfNotShallowEqual(prev, next, debug) {
2183
- return isEqualShallow(prev, next) ? prev : (process.env.NODE_ENV === "development" && debug && console.warn("setStateShallow CHANGE", { prev, next }), { ...prev, ...next });
1985
+ function getState(props, manager) {
1986
+ var _a;
1987
+ if (props.name && props.reset)
1988
+ throw new Error(
1989
+ process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time."
1990
+ );
1991
+ if (!getHasThemeUpdatingProps(props))
1992
+ return null;
1993
+ let themes = (0, import_config.getThemes)(), [allManagers, componentManagers] = getManagers(manager), isDirectParentAComponentTheme = !!(manager != null && manager.state.isComponent), startIndex = props.reset && !isDirectParentAComponentTheme ? 1 : 0, baseManager = allManagers[startIndex], parentManager = allManagers[startIndex + 1];
1994
+ if (!baseManager && props.reset)
1995
+ return process.env.NODE_ENV !== "production" && console.warn("Cannot reset, no parent theme exists"), null;
1996
+ let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
1997
+ baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][A-Za-z]+/, ""));
1998
+ let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
1999
+ isDirectParentAComponentTheme && allComponentThemes.shift();
2000
+ let base = baseName.split(import_constants2.THEME_NAME_SEPARATOR), max = base.length, min = props.componentName && !nextName ? max : 0;
2001
+ for (let i = max; i >= min; i--) {
2002
+ let prefix = base.slice(0, i).join(import_constants2.THEME_NAME_SEPARATOR);
2003
+ props.inverse && (prefix = inverseThemeName(prefix));
2004
+ let potentials = [];
2005
+ if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
2006
+ let lastSegment = potentials.findIndex((x) => !x.includes("_"));
2007
+ lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
2008
+ }
2009
+ if (componentName && !props.reset) {
2010
+ let baseLen = base.length, componentPotentials = [];
2011
+ if (nextName && baseLen > 1) {
2012
+ let beforeSeparator = base[0];
2013
+ componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
2014
+ }
2015
+ if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
2016
+ if (i > baseLen) {
2017
+ let prefixLessOne = base.slice(0, i - 1).join(import_constants2.THEME_NAME_SEPARATOR);
2018
+ if (prefixLessOne) {
2019
+ let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
2020
+ componentPotentials.unshift(lessSpecific);
2021
+ }
2022
+ }
2023
+ let moreSpecific = `${prefix}_${nextName}_${componentName}`;
2024
+ componentPotentials.unshift(moreSpecific);
2025
+ }
2026
+ potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
2027
+ }
2028
+ let found = potentials.find((t) => t in themes);
2029
+ if (process.env.NODE_ENV !== "production" && typeof props.debug == "string" && console.info(" getState ", {
2030
+ props,
2031
+ found,
2032
+ potentials,
2033
+ baseManager,
2034
+ nextName,
2035
+ baseName,
2036
+ prefix
2037
+ }), found) {
2038
+ let names = found.split("_"), [firstName, ...restNames] = names, lastName = names[names.length - 1], isComponent = lastName[0] === lastName[0].toUpperCase(), scheme = firstName === "light" ? "light" : firstName === "dark" ? "dark" : void 0, pre = import_constants2.THEME_CLASSNAME_PREFIX, className = import_constants.isWeb ? `${pre}sub_theme ${pre}${!scheme || !restNames.length ? firstName : restNames.join("_")}` : "", parentState = (_a = baseManager || parentManager) == null ? void 0 : _a.state, parentName = parentState == null ? void 0 : parentState.name;
2039
+ result = {
2040
+ name: found,
2041
+ parentName,
2042
+ theme: themes[found],
2043
+ className,
2044
+ isComponent,
2045
+ scheme
2046
+ };
2047
+ break;
2048
+ }
2049
+ }
2050
+ return process.env.NODE_ENV !== "production" && props.debug === "verbose" && typeof window < "u" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min, max }), console.warn("result", { result }), console.trace(), console.groupEnd()), result;
2184
2051
  }
2185
- function isEqualShallow(prev, next) {
2186
- for (let key in next)
2187
- if (prev[key] !== next[key])
2188
- return !1;
2189
- return !0;
2052
+ var inverseThemeName = (themeName) => themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
2053
+ function getManagers(themeManager) {
2054
+ let comp = [], all = [], cur = themeManager;
2055
+ for (; cur; )
2056
+ all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
2057
+ return [all, comp];
2190
2058
  }
2191
2059
  }
2192
2060
  });
2193
2061
 
2194
- // ../web/dist/cjs/constants/accessibilityDirectMap.native.js
2195
- var require_accessibilityDirectMap_native = __commonJS({
2196
- "../web/dist/cjs/constants/accessibilityDirectMap.native.js"(exports2, module2) {
2062
+ // ../web/dist/cjs/helpers/ThemeManagerContext.native.js
2063
+ var require_ThemeManagerContext_native = __commonJS({
2064
+ "../web/dist/cjs/helpers/ThemeManagerContext.native.js"(exports2, module2) {
2197
2065
  "use strict";
2198
2066
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2199
2067
  for (var name in all)
@@ -2203,72 +2071,18 @@ var require_accessibilityDirectMap_native = __commonJS({
2203
2071
  for (let key of __getOwnPropNames2(from))
2204
2072
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2205
2073
  return to;
2206
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), accessibilityDirectMap_native_exports = {};
2207
- __export2(accessibilityDirectMap_native_exports, {
2208
- accessibilityDirectMap: () => accessibilityDirectMap,
2209
- accessibilityWebRoleToNativeRole: () => accessibilityWebRoleToNativeRole,
2210
- nativeAccessibilityState: () => nativeAccessibilityState,
2211
- nativeAccessibilityValue: () => nativeAccessibilityValue,
2212
- webToNativeAccessibilityDirectMap: () => webToNativeAccessibilityDirectMap
2074
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManagerContext_exports = {};
2075
+ __export2(ThemeManagerContext_exports, {
2076
+ ThemeManagerIDContext: () => ThemeManagerIDContext
2213
2077
  });
2214
- module2.exports = __toCommonJS2(accessibilityDirectMap_native_exports);
2215
- var accessibilityDirectMap = {}, webToNativeAccessibilityDirectMap = {
2216
- "aria-label": "accessibilityLabel",
2217
- "aria-labelledby": "accessibilityLabelledBy",
2218
- "aria-live": "accessibilityLiveRegion",
2219
- "aria-modal": "accessibilityViewIsModal",
2220
- "aria-hidden": "accessibilityElementsHidden"
2221
- }, nativeAccessibilityValue = {
2222
- "aria-valuemin": "min",
2223
- "aria-valuemax": "max",
2224
- "aria-valuenow": "now",
2225
- "aria-valuetext": "text"
2226
- }, nativeAccessibilityState = {
2227
- "aria-disabled": "disabled",
2228
- "aria-selected": "selected",
2229
- "aria-checked": "checked",
2230
- "aria-busy": "busy",
2231
- "aria-expanded": "expanded"
2232
- }, accessibilityWebRoleToNativeRole = {
2233
- alert: "alert",
2234
- button: "button",
2235
- checkbox: "checkbox",
2236
- combobox: "combobox",
2237
- grid: "grid",
2238
- group: "none",
2239
- heading: "header",
2240
- imagebutton: "imagebutton",
2241
- img: "image",
2242
- keyboardkey: "keyboardkey",
2243
- link: "link",
2244
- menu: "menu",
2245
- menubar: "menubar",
2246
- menuitem: "menuitem",
2247
- none: "none",
2248
- presentation: "none",
2249
- progressbar: "progressbar",
2250
- radio: "radio",
2251
- radiogroup: "radiogroup",
2252
- region: "summary",
2253
- scrollbar: "scrollbar",
2254
- searchbox: "search",
2255
- slider: "adjustable",
2256
- spinbutton: "spinbutton",
2257
- summary: "summary",
2258
- switch: "switch",
2259
- tab: "tab",
2260
- tablist: "tablist",
2261
- text: "text",
2262
- timer: "timer",
2263
- togglebutton: "togglebutton",
2264
- toolbar: "toolbar"
2265
- };
2078
+ module2.exports = __toCommonJS2(ThemeManagerContext_exports);
2079
+ var import_react3 = require("react"), ThemeManagerIDContext = (0, import_react3.createContext)(1);
2266
2080
  }
2267
2081
  });
2268
2082
 
2269
- // ../web/dist/cjs/constants/isDevTools.native.js
2270
- var require_isDevTools_native = __commonJS({
2271
- "../web/dist/cjs/constants/isDevTools.native.js"(exports2, module2) {
2083
+ // ../web/dist/cjs/hooks/useTheme.native.js
2084
+ var require_useTheme_native = __commonJS({
2085
+ "../web/dist/cjs/hooks/useTheme.native.js"(exports2, module2) {
2272
2086
  "use strict";
2273
2087
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2274
2088
  for (var name in all)
@@ -2278,27 +2092,260 @@ var require_isDevTools_native = __commonJS({
2278
2092
  for (let key of __getOwnPropNames2(from))
2279
2093
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2280
2094
  return to;
2281
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), isDevTools_exports = {};
2282
- __export2(isDevTools_exports, {
2283
- isDevTools: () => isDevTools
2095
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), useTheme_exports = {};
2096
+ __export2(useTheme_exports, {
2097
+ activeThemeManagers: () => activeThemeManagers,
2098
+ getThemeManager: () => getThemeManager,
2099
+ getThemeProxied: () => getThemeProxied,
2100
+ useChangeThemeEffect: () => useChangeThemeEffect,
2101
+ useTheme: () => useTheme,
2102
+ useThemeWithState: () => useThemeWithState
2284
2103
  });
2285
- module2.exports = __toCommonJS2(isDevTools_exports);
2286
- var isDevTools = (() => {
2287
- if (process.env.NODE_ENV === "development")
2288
- try {
2289
- return new Function("try {return this===window;}catch(e){ return false;}")();
2290
- } catch {
2104
+ module2.exports = __toCommonJS2(useTheme_exports);
2105
+ var import_constants = require_index_native3(), import_react3 = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), emptyProps = { name: null }, cached;
2106
+ function getDefaultThemeProxied() {
2107
+ if (cached)
2108
+ return cached;
2109
+ let config = (0, import_config.getConfig)(), name = config.themes.light ? "light" : Object.keys(config.themes)[0], defaultTheme = config.themes[name];
2110
+ return cached = getThemeProxied({ theme: defaultTheme, name }), cached;
2111
+ }
2112
+ var useTheme = (props = emptyProps) => {
2113
+ let [_, theme] = useThemeWithState(props);
2114
+ return theme || getDefaultThemeProxied();
2115
+ }, useThemeWithState = (props) => {
2116
+ let keys = (0, import_react3.useRef)([]), changedThemeState = useChangeThemeEffect(
2117
+ props,
2118
+ !1,
2119
+ keys.current,
2120
+ import_constants.isServer ? void 0 : () => {
2121
+ var _a, _b;
2122
+ let next = ((_a = props.shouldUpdate) == null ? void 0 : _a.call(props)) ?? (keys.current.length > 0 ? !0 : void 0);
2123
+ return process.env.NODE_ENV === "development" && typeof props.debug == "string" && props.debug !== "profile" && console.info(" \u{1F3A8} useTheme() shouldUpdate?", next, {
2124
+ shouldUpdateProp: (_b = props.shouldUpdate) == null ? void 0 : _b.call(props),
2125
+ keys: [...keys.current]
2126
+ }), next;
2127
+ }
2128
+ ), { themeManager, state } = changedThemeState;
2129
+ process.env.NODE_ENV === "development" && (state != null && state.theme || process.env.TAMAGUI_DISABLE_NO_THEME_WARNING !== "1" && console.warn(
2130
+ `[tamagui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(
2131
+ props
2132
+ )}).
2133
+
2134
+ If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`
2135
+ ));
2136
+ let themeProxied = (0, import_react3.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state == null ? void 0 : state.theme, themeManager, props.deopt, props.debug]);
2137
+ return process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} useTheme =>", state == null ? void 0 : state.name), console.info("returning state", changedThemeState, "from props", props), console.groupEnd()), [changedThemeState, themeProxied];
2138
+ };
2139
+ function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
2140
+ if (!theme)
2141
+ return {};
2142
+ let config = (0, import_config.getConfig)();
2143
+ function track(key) {
2144
+ keys && !keys.includes(key) && (keys.push(key), process.env.NODE_ENV === "development" && debug && console.info(` \u{1F3A8} useTheme() tracking new key: ${key}`));
2145
+ }
2146
+ return new Proxy(theme, {
2147
+ has(_, key) {
2148
+ if (Reflect.has(theme, key))
2149
+ return !0;
2150
+ if (typeof key == "string")
2151
+ return key[0] === "$" && (key = key.slice(1)), themeManager == null ? void 0 : themeManager.allKeys.has(key);
2152
+ },
2153
+ get(_, key) {
2154
+ if (
2155
+ // dont ask me, idk why but on hermes you can see that useTheme()[undefined] passes in STRING undefined to proxy
2156
+ // if someone is crazy enough to use "undefined" as a theme key then this not working is on them
2157
+ key !== "undefined" && typeof key == "string"
2158
+ ) {
2159
+ let keyString = key[0] === "$" ? key.slice(1) : key, val = theme[keyString];
2160
+ if (val && typeof val == "object")
2161
+ return new Proxy(val, {
2162
+ // when they touch the actual value we only track it
2163
+ // if its a variable (web), its ignored!
2164
+ get(_2, subkey) {
2165
+ if (subkey === "val")
2166
+ track(keyString);
2167
+ else if (subkey === "get")
2168
+ return (platform) => {
2169
+ let outVal = (0, import_createVariable.getVariable)(val);
2170
+ if (platform !== "web" && import_constants.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
2171
+ let oppositeThemeName = name.replace(
2172
+ scheme === "dark" ? "dark" : "light",
2173
+ scheme === "dark" ? "light" : "dark"
2174
+ ), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
2175
+ if (oppositeVal)
2176
+ return {
2177
+ dynamic: {
2178
+ dark: scheme === "dark" ? outVal : oppositeVal,
2179
+ light: scheme === "light" ? outVal : oppositeVal
2180
+ }
2181
+ };
2182
+ }
2183
+ return track(keyString), outVal;
2184
+ };
2185
+ return Reflect.get(val, subkey);
2186
+ }
2187
+ });
2188
+ if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_FEAT_THROW_ON_MISSING_THEME_VALUE === "1")
2189
+ throw new Error(
2190
+ `[tamagui] No theme key "${key}" found in theme ${name}.
2191
+ Keys in theme: ${Object.keys(
2192
+ theme
2193
+ ).join(", ")}`
2194
+ );
2195
+ }
2196
+ return Reflect.get(_, key);
2197
+ }
2198
+ });
2199
+ }
2200
+ function someParentIsInversed(manager) {
2201
+ {
2202
+ let cur = manager;
2203
+ for (; cur; ) {
2204
+ if (!cur.parentManager)
2205
+ return !1;
2206
+ if (cur.parentManager.state.scheme !== cur.state.scheme)
2207
+ return !0;
2208
+ cur = cur.parentManager;
2291
2209
  }
2210
+ }
2292
2211
  return !1;
2293
- })();
2212
+ }
2213
+ var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = (id) => _idToUID[id], getThemeManager = (id) => _uidToManager.get(getId(id)), registerThemeManager = (t) => {
2214
+ if (!_idToUID[t.id]) {
2215
+ let id = _idToUID[t.id] = {};
2216
+ _uidToManager.set(id, t);
2217
+ }
2218
+ }, useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
2219
+ let { disable } = props, parentManagerId = (0, import_react3.useContext)(import_ThemeManagerContext.ThemeManagerIDContext), parentManager = getThemeManager(parentManagerId);
2220
+ if (!isRoot && !parentManager || disable)
2221
+ return {
2222
+ isNewTheme: !1,
2223
+ state: parentManager == null ? void 0 : parentManager.state,
2224
+ themeManager: parentManager
2225
+ };
2226
+ let [themeState, setThemeState] = (0, import_react3.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
2227
+ function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
2228
+ let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
2229
+ if (!manager || !forceShouldChange && forceUpdate === !1)
2230
+ return;
2231
+ let next = nextState || manager.getState(props, parentManager);
2232
+ if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
2233
+ return next;
2234
+ }
2235
+ if (import_constants.isServer || ((0, import_react3.useEffect)(() => {
2236
+ if (!themeManager)
2237
+ return;
2238
+ if (props.inverse && !mounted) {
2239
+ setThemeState((prev) => createState({
2240
+ ...prev,
2241
+ mounted: !0
2242
+ }));
2243
+ return;
2244
+ }
2245
+ (isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
2246
+ let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
2247
+ forced && setThemeState((prev) => createState(prev, !0));
2248
+ }), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
2249
+ (name, manager, forced) => {
2250
+ let force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
2251
+ process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info(" \u{1F538} onChange", themeManager.id, {
2252
+ force,
2253
+ shouldTryUpdate,
2254
+ props,
2255
+ name,
2256
+ manager,
2257
+ keys
2258
+ }), shouldTryUpdate && setThemeState((prev) => createState(prev, force));
2259
+ },
2260
+ themeManager.id
2261
+ );
2262
+ return () => {
2263
+ selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), isNewTheme && activeThemeManagers.delete(themeManager);
2264
+ };
2265
+ }, [
2266
+ themeManager,
2267
+ parentManager,
2268
+ isNewTheme,
2269
+ props.componentName,
2270
+ props.inverse,
2271
+ props.name,
2272
+ props.reset,
2273
+ mounted
2274
+ ]), process.env.NODE_ENV === "development" && props.debug !== "profile" && (0, import_react3.useEffect)(() => (globalThis.TamaguiThemeManagers ??= /* @__PURE__ */ new Set(), globalThis.TamaguiThemeManagers.add(themeManager), () => {
2275
+ globalThis.TamaguiThemeManagers.delete(themeManager);
2276
+ }), [themeManager])), isInversingOnMount)
2277
+ return {
2278
+ isNewTheme: !1,
2279
+ inversed: !1,
2280
+ themeManager: parentManager,
2281
+ state: {
2282
+ name: "",
2283
+ ...parentManager == null ? void 0 : parentManager.state,
2284
+ className: ""
2285
+ }
2286
+ };
2287
+ return {
2288
+ state,
2289
+ isNewTheme,
2290
+ inversed,
2291
+ themeManager
2292
+ };
2293
+ function createState(prev, force = !1) {
2294
+ if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1 && !force)
2295
+ return prev;
2296
+ let themeManager2 = parentManager, state2;
2297
+ if ((0, import_ThemeManager.getHasThemeUpdatingProps)(props)) {
2298
+ let getNewThemeManager = () => new import_ThemeManager.ThemeManager(props, isRoot ? "root" : parentManager);
2299
+ if (prev != null && prev.themeManager) {
2300
+ themeManager2 = prev.themeManager;
2301
+ let forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
2302
+ themeManager2,
2303
+ next,
2304
+ prev.state,
2305
+ forceChange
2306
+ );
2307
+ nextState ? (state2 = nextState, prev.isNewTheme ? themeManager2.updateState(nextState) : themeManager2 = getNewThemeManager()) : prev.isNewTheme && parentManager && !next && (themeManager2 = parentManager);
2308
+ } else
2309
+ themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
2310
+ }
2311
+ let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
2312
+ isNewTheme2 && registerThemeManager(themeManager2);
2313
+ let mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
2314
+ state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
2315
+ let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed != null ? !1 : null, response = {
2316
+ themeManager: themeManager2,
2317
+ isNewTheme: isNewTheme2,
2318
+ mounted: mounted2,
2319
+ inversed: inversed2
2320
+ }, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
2321
+ (0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
2322
+ (0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
2323
+ if (prev && shouldReturnPrev)
2324
+ return prev;
2325
+ if (response.state = state2, process.env.NODE_ENV === "development" && props.debug && import_constants.isClient) {
2326
+ console.groupCollapsed(` \u{1F537} ${themeManager2.id} useChangeThemeEffect createState`);
2327
+ let parentState = { ...parentManager == null ? void 0 : parentManager.state }, parentId = parentManager == null ? void 0 : parentManager.id, themeManagerState = { ...themeManager2.state };
2328
+ console.info({
2329
+ props,
2330
+ parentState,
2331
+ parentId,
2332
+ themeManager: themeManager2,
2333
+ prev,
2334
+ response,
2335
+ themeManagerState
2336
+ }), console.groupEnd();
2337
+ }
2338
+ return response;
2339
+ }
2340
+ };
2294
2341
  }
2295
2342
  });
2296
2343
 
2297
- // ../web/dist/cjs/helpers/getGroupPropParts.native.js
2298
- var require_getGroupPropParts_native = __commonJS({
2299
- "../web/dist/cjs/helpers/getGroupPropParts.native.js"(exports2, module2) {
2344
+ // ../web/dist/cjs/Tamagui.native.js
2345
+ var require_Tamagui_native = __commonJS({
2346
+ "../web/dist/cjs/Tamagui.native.js"(exports2, module2) {
2300
2347
  "use strict";
2301
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2348
+ var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2302
2349
  for (var name in all)
2303
2350
  __defProp2(target, name, { get: all[name], enumerable: !0 });
2304
2351
  }, __copyProps2 = (to, from, except, desc) => {
@@ -2306,24 +2353,61 @@ var require_getGroupPropParts_native = __commonJS({
2306
2353
  for (let key of __getOwnPropNames2(from))
2307
2354
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2308
2355
  return to;
2309
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getGroupPropParts_exports = {};
2310
- __export2(getGroupPropParts_exports, {
2311
- getGroupPropParts: () => getGroupPropParts
2312
- });
2313
- module2.exports = __toCommonJS2(getGroupPropParts_exports);
2314
- var import_useMedia = require_useMedia_native();
2315
- function getGroupPropParts(groupProp) {
2316
- let mediaQueries = (0, import_useMedia.getMedia)(), [_, name, part3, part4] = groupProp.split("-"), pseudo, media = part3 in mediaQueries ? part3 : void 0;
2317
- return media ? pseudo = part4 : pseudo = part3, { name, pseudo, media };
2318
- }
2356
+ }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
2357
+ // If the importer is in node compatibility mode or this is not an ESM
2358
+ // file that has been converted to a CommonJS file using a Babel-
2359
+ // compatible transform (i.e. "__esModule" has not been set), then set
2360
+ // "default" to the CommonJS "module.exports" for node compatibility.
2361
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
2362
+ mod
2363
+ )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Tamagui_exports = {};
2364
+ __export2(Tamagui_exports, {
2365
+ Tamagui: () => Tamagui,
2366
+ getValueFromIdentifier: () => getValueFromIdentifier,
2367
+ setIdentifierValue: () => setIdentifierValue
2368
+ });
2369
+ module2.exports = __toCommonJS2(Tamagui_exports);
2370
+ var Helpers = __toESM2(require_index_native4()), import_config = require_config_native(), import_insertStyleRule = require_insertStyleRule_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), Tamagui = (() => {
2371
+ if (process.env.NODE_ENV === "development") {
2372
+ class TamaguiManager {
2373
+ constructor() {
2374
+ this.Helpers = Helpers, this.getThemeManager = import_useTheme.getThemeManager;
2375
+ }
2376
+ get activeThemeManagers() {
2377
+ return import_useTheme.activeThemeManagers;
2378
+ }
2379
+ get mediaState() {
2380
+ return { ...import_useMedia.mediaState };
2381
+ }
2382
+ get config() {
2383
+ return (0, import_config.getConfig)();
2384
+ }
2385
+ get insertedRules() {
2386
+ return (0, import_insertStyleRule.getAllRules)();
2387
+ }
2388
+ get allSelectors() {
2389
+ return (0, import_insertStyleRule.getAllSelectors)();
2390
+ }
2391
+ get allTransforms() {
2392
+ return (0, import_insertStyleRule.getAllTransforms)();
2393
+ }
2394
+ get identifierToValue() {
2395
+ return identifierToValue;
2396
+ }
2397
+ }
2398
+ return new TamaguiManager();
2399
+ }
2400
+ })(), identifierToValue = /* @__PURE__ */ new Map(), getValueFromIdentifier = (identifier) => identifierToValue.get(identifier), setIdentifierValue = (identifier, value) => {
2401
+ identifierToValue.set(identifier, value);
2402
+ };
2319
2403
  }
2320
2404
  });
2321
2405
 
2322
- // ../web/dist/cjs/helpers/createMediaStyle.native.js
2323
- var require_createMediaStyle_native = __commonJS({
2324
- "../web/dist/cjs/helpers/createMediaStyle.native.js"(exports2, module2) {
2406
+ // ../compose-refs/dist/cjs/compose-refs.native.js
2407
+ var require_compose_refs_native = __commonJS({
2408
+ "../compose-refs/dist/cjs/compose-refs.native.js"(exports2, module2) {
2325
2409
  "use strict";
2326
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2410
+ var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2327
2411
  for (var name in all)
2328
2412
  __defProp2(target, name, { get: all[name], enumerable: !0 });
2329
2413
  }, __copyProps2 = (to, from, except, desc) => {
@@ -2331,166 +2415,521 @@ var require_createMediaStyle_native = __commonJS({
2331
2415
  for (let key of __getOwnPropNames2(from))
2332
2416
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2333
2417
  return to;
2334
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createMediaStyle_exports = {};
2335
- __export2(createMediaStyle_exports, {
2336
- MEDIA_SEP: () => MEDIA_SEP,
2337
- createMediaStyle: () => createMediaStyle
2418
+ }, __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
2419
+ // If the importer is in node compatibility mode or this is not an ESM
2420
+ // file that has been converted to a CommonJS file using a Babel-
2421
+ // compatible transform (i.e. "__esModule" has not been set), then set
2422
+ // "default" to the CommonJS "module.exports" for node compatibility.
2423
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: !0 }) : target,
2424
+ mod
2425
+ )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), compose_refs_exports = {};
2426
+ __export2(compose_refs_exports, {
2427
+ composeRefs: () => composeRefs,
2428
+ useComposedRefs: () => useComposedRefs
2338
2429
  });
2339
- module2.exports = __toCommonJS2(createMediaStyle_exports);
2340
- var import_config = require_config_native(), import_useMedia = require_useMedia_native(), import_getGroupPropParts = require_getGroupPropParts_native(), MEDIA_SEP = "_", prefixes = null, selectors = null, groupPseudoToPseudoCSSMap = {
2341
- press: "active"
2342
- }, createMediaStyle = (styleObject, mediaKeyIn, mediaQueries, type, negate, priority) => {
2343
- let { property, identifier, rules } = styleObject, conf = (0, import_config.getConfig)(), enableMediaPropOrder = conf.settings.mediaPropOrder, isTheme = type === "theme", isPlatform = type === "platform", isGroup = type === "group", isNonWindowMedia = isTheme || isPlatform || isGroup, negKey = negate ? "0" : "", ogPrefix = identifier.slice(0, identifier.indexOf("-") + 1), id = `${ogPrefix}${MEDIA_SEP}${mediaKeyIn.replace("-", "")}${negKey}${MEDIA_SEP}`, styleRule = "", groupMediaKey, containerName, nextIdentifier = identifier.replace(ogPrefix, id), styleInner = rules.map((rule) => rule.replace(identifier, nextIdentifier)).join(";");
2344
- if (isNonWindowMedia) {
2345
- let precedenceImportancePrefix = new Array((priority || 0) + (isGroup ? 1 : 0)).fill(":root").join("");
2346
- if (isTheme || isGroup) {
2347
- let groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyIn), mediaName = groupInfo == null ? void 0 : groupInfo.name;
2348
- groupMediaKey = groupInfo == null ? void 0 : groupInfo.media, isGroup && (containerName = mediaName);
2349
- let name = (isGroup ? "group_" : "") + mediaName, selectorStart = styleInner.indexOf(":root"), selectorEnd = styleInner.lastIndexOf("{"), selector = styleInner.slice(selectorStart, selectorEnd), precedenceSpace = conf.themeClassNameOnRoot && isTheme ? "" : " ", pseudoSelectorName = groupInfo.pseudo ? groupPseudoToPseudoCSSMap[groupInfo.pseudo] || groupInfo.pseudo : void 0, pseudoSelector = pseudoSelectorName ? `:${pseudoSelectorName}` : "", presedencePrefix = `:root${precedenceImportancePrefix}${precedenceSpace}`, mediaSelector = `.t_${name}${pseudoSelector}`, nextSelector = `${presedencePrefix}${mediaSelector} ${selector.replace(
2350
- ":root",
2351
- ""
2352
- )}`;
2353
- styleRule = styleInner.replace(selector, nextSelector);
2354
- } else
2355
- styleRule = `${precedenceImportancePrefix}${styleInner}`;
2356
- }
2357
- if (!isNonWindowMedia || groupMediaKey) {
2358
- if (!selectors) {
2359
- let mediaKeys = Object.keys(mediaQueries);
2360
- selectors = Object.fromEntries(
2361
- mediaKeys.map((key) => [key, (0, import_useMedia.mediaObjectToString)(mediaQueries[key])])
2362
- ), enableMediaPropOrder || (prefixes = Object.fromEntries(
2363
- mediaKeys.map((k, index) => [k, new Array(index + 1).fill(":root").join("")])
2364
- ));
2365
- }
2366
- let mediaKey = groupMediaKey || mediaKeyIn, mediaSelector = selectors[mediaKey], mediaQuery = `${negate ? "not all and " : ""}${mediaSelector}`, precedenceImportancePrefix = groupMediaKey ? "" : enableMediaPropOrder ? (
2367
- // this new array should be cached
2368
- new Array(priority).fill(":root").join("")
2369
- ) : (
2370
- // @ts-ignore
2371
- prefixes[mediaKey]
2372
- ), prefix = groupMediaKey ? `@container ${containerName}` : "@media";
2373
- groupMediaKey && (styleInner = styleRule), styleInner.includes(prefix) ? styleRule = styleInner.replace("{", ` and ${mediaQuery} {`).replace("and screen and", "and") : styleRule = `${prefix} ${mediaQuery}{${precedenceImportancePrefix}${styleInner}}`, groupMediaKey && (styleRule = `@supports (contain: ${conf.settings.webContainerType || "inline-size"}) {${styleRule}}`);
2374
- }
2375
- return {
2376
- property,
2377
- rules: [styleRule],
2378
- identifier: nextIdentifier
2379
- };
2380
- };
2430
+ module2.exports = __toCommonJS2(compose_refs_exports);
2431
+ var React = __toESM2(require("react"));
2432
+ function setRef(ref, value) {
2433
+ typeof ref == "function" ? ref(value) : ref && (ref.current = value);
2434
+ }
2435
+ function composeRefs(...refs) {
2436
+ return (node) => refs.forEach((ref) => setRef(ref, node));
2437
+ }
2438
+ function useComposedRefs(...refs) {
2439
+ return React.useCallback(composeRefs(...refs), refs);
2440
+ }
2381
2441
  }
2382
2442
  });
2383
2443
 
2384
- // ../../node_modules/@react-native/normalize-color/index.js
2385
- var require_normalize_color = __commonJS({
2386
- "../../node_modules/@react-native/normalize-color/index.js"(exports2, module2) {
2444
+ // ../compose-refs/dist/cjs/index.native.js
2445
+ var require_index_native5 = __commonJS({
2446
+ "../compose-refs/dist/cjs/index.native.js"(exports2, module2) {
2387
2447
  "use strict";
2388
- function normalizeColor(color) {
2389
- if (typeof color == "number")
2390
- return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null;
2391
- if (typeof color != "string")
2392
- return null;
2393
- let matchers = getMatchers(), match;
2394
- if (match = matchers.hex6.exec(color))
2395
- return parseInt(match[1] + "ff", 16) >>> 0;
2396
- let colorFromKeyword = normalizeKeyword(color);
2397
- return colorFromKeyword ?? ((match = matchers.rgb.exec(color)) ? (parse255(match[1]) << 24 | // r
2398
- parse255(match[2]) << 16 | // g
2399
- parse255(match[3]) << 8 | // b
2400
- 255) >>> // a
2401
- 0 : (match = matchers.rgba.exec(color)) ? match[6] !== void 0 ? (parse255(match[6]) << 24 | // r
2402
- parse255(match[7]) << 16 | // g
2403
- parse255(match[8]) << 8 | // b
2404
- parse1(match[9])) >>> // a
2405
- 0 : (parse255(match[2]) << 24 | // r
2406
- parse255(match[3]) << 16 | // g
2407
- parse255(match[4]) << 8 | // b
2408
- parse1(match[5])) >>> // a
2409
- 0 : (match = matchers.hex3.exec(color)) ? parseInt(
2410
- match[1] + match[1] + // r
2411
- match[2] + match[2] + // g
2412
- match[3] + match[3] + // b
2413
- "ff",
2414
- // a
2415
- 16
2416
- ) >>> 0 : (match = matchers.hex8.exec(color)) ? parseInt(match[1], 16) >>> 0 : (match = matchers.hex4.exec(color)) ? parseInt(
2417
- match[1] + match[1] + // r
2418
- match[2] + match[2] + // g
2419
- match[3] + match[3] + // b
2420
- match[4] + match[4],
2421
- // a
2422
- 16
2423
- ) >>> 0 : (match = matchers.hsl.exec(color)) ? (hslToRgb(
2424
- parse360(match[1]),
2425
- // h
2426
- parsePercentage(match[2]),
2427
- // s
2428
- parsePercentage(match[3])
2429
- // l
2430
- ) | 255) >>> // a
2431
- 0 : (match = matchers.hsla.exec(color)) ? match[6] !== void 0 ? (hslToRgb(
2432
- parse360(match[6]),
2433
- // h
2434
- parsePercentage(match[7]),
2435
- // s
2436
- parsePercentage(match[8])
2437
- // l
2438
- ) | parse1(match[9])) >>> // a
2439
- 0 : (hslToRgb(
2440
- parse360(match[2]),
2441
- // h
2442
- parsePercentage(match[3]),
2443
- // s
2444
- parsePercentage(match[4])
2445
- // l
2446
- ) | parse1(match[5])) >>> // a
2447
- 0 : (match = matchers.hwb.exec(color)) ? (hwbToRgb(
2448
- parse360(match[1]),
2449
- // h
2450
- parsePercentage(match[2]),
2451
- // w
2452
- parsePercentage(match[3])
2453
- // b
2454
- ) | 255) >>> // a
2455
- 0 : null);
2456
- }
2457
- function hue2rgb(p, q, t) {
2458
- return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? p + (q - p) * 6 * t : t < 1 / 2 ? q : t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 : p;
2448
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __copyProps2 = (to, from, except, desc) => {
2449
+ if (from && typeof from == "object" || typeof from == "function")
2450
+ for (let key of __getOwnPropNames2(from))
2451
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2452
+ return to;
2453
+ }, __reExport2 = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
2454
+ module2.exports = __toCommonJS2(src_exports2);
2455
+ __reExport2(src_exports2, require_compose_refs_native(), module2.exports);
2456
+ }
2457
+ });
2458
+
2459
+ // ../use-did-finish-ssr/dist/cjs/index.native.js
2460
+ var require_index_native6 = __commonJS({
2461
+ "../use-did-finish-ssr/dist/cjs/index.native.js"(exports2, module2) {
2462
+ "use strict";
2463
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2464
+ for (var name in all)
2465
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2466
+ }, __copyProps2 = (to, from, except, desc) => {
2467
+ if (from && typeof from == "object" || typeof from == "function")
2468
+ for (let key of __getOwnPropNames2(from))
2469
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2470
+ return to;
2471
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), src_exports2 = {};
2472
+ __export2(src_exports2, {
2473
+ useClientValue: () => useClientValue,
2474
+ useDidFinishSSR: () => useDidFinishSSR
2475
+ });
2476
+ module2.exports = __toCommonJS2(src_exports2);
2477
+ var import_react3 = require("react");
2478
+ function useDidFinishSSR(value) {
2479
+ return value ?? !0;
2459
2480
  }
2460
- function hslToRgb(h, s, l) {
2461
- let q = l < 0.5 ? l * (1 + s) : l + s - l * s, p = 2 * l - q, r = hue2rgb(p, q, h + 1 / 3), g = hue2rgb(p, q, h), b = hue2rgb(p, q, h - 1 / 3);
2462
- return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
2481
+ function useClientValue(value) {
2482
+ return useDidFinishSSR() ? typeof value == "function" ? value() : value : void 0;
2463
2483
  }
2464
- function hwbToRgb(h, w, b) {
2465
- if (w + b >= 1) {
2466
- let gray = Math.round(w * 255 / (w + b));
2467
- return gray << 24 | gray << 16 | gray << 8;
2484
+ }
2485
+ });
2486
+
2487
+ // ../web/dist/cjs/helpers/objectIdentityKey.native.js
2488
+ var require_objectIdentityKey_native = __commonJS({
2489
+ "../web/dist/cjs/helpers/objectIdentityKey.native.js"(exports2, module2) {
2490
+ "use strict";
2491
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2492
+ for (var name in all)
2493
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2494
+ }, __copyProps2 = (to, from, except, desc) => {
2495
+ if (from && typeof from == "object" || typeof from == "function")
2496
+ for (let key of __getOwnPropNames2(from))
2497
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2498
+ return to;
2499
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), objectIdentityKey_exports = {};
2500
+ __export2(objectIdentityKey_exports, {
2501
+ objectIdentityKey: () => objectIdentityKey
2502
+ });
2503
+ module2.exports = __toCommonJS2(objectIdentityKey_exports);
2504
+ function objectIdentityKey(obj) {
2505
+ let k = "";
2506
+ for (let key in obj) {
2507
+ k += key;
2508
+ let arg = obj[key], type = typeof arg;
2509
+ if (!arg || type !== "object" && type !== "function")
2510
+ k += type + arg;
2511
+ else if (cache.has(arg))
2512
+ k += cache.get(arg);
2513
+ else {
2514
+ let v = Math.random();
2515
+ cache.set(arg, v), k += v;
2516
+ }
2468
2517
  }
2469
- let red = hue2rgb(0, 1, h + 1 / 3) * (1 - w - b) + w, green = hue2rgb(0, 1, h) * (1 - w - b) + w, blue = hue2rgb(0, 1, h - 1 / 3) * (1 - w - b) + w;
2470
- return Math.round(red * 255) << 24 | Math.round(green * 255) << 16 | Math.round(blue * 255) << 8;
2518
+ return k;
2471
2519
  }
2472
- var NUMBER = "[-+]?\\d*\\.?\\d+", PERCENTAGE = NUMBER + "%";
2473
- function call(...args) {
2474
- return "\\(\\s*(" + args.join(")\\s*,?\\s*(") + ")\\s*\\)";
2475
- }
2476
- function callWithSlashSeparator(...args) {
2477
- return "\\(\\s*(" + args.slice(0, args.length - 1).join(")\\s*,?\\s*(") + ")\\s*/\\s*(" + args[args.length - 1] + ")\\s*\\)";
2520
+ var cache = /* @__PURE__ */ new WeakMap();
2521
+ }
2522
+ });
2523
+
2524
+ // ../web/dist/cjs/helpers/createStyledContext.native.js
2525
+ var require_createStyledContext_native = __commonJS({
2526
+ "../web/dist/cjs/helpers/createStyledContext.native.js"(exports2, module2) {
2527
+ "use strict";
2528
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2529
+ for (var name in all)
2530
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2531
+ }, __copyProps2 = (to, from, except, desc) => {
2532
+ if (from && typeof from == "object" || typeof from == "function")
2533
+ for (let key of __getOwnPropNames2(from))
2534
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2535
+ return to;
2536
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createStyledContext_exports = {};
2537
+ __export2(createStyledContext_exports, {
2538
+ createStyledContext: () => createStyledContext
2539
+ });
2540
+ module2.exports = __toCommonJS2(createStyledContext_exports);
2541
+ var import_react3 = require("react"), import_objectIdentityKey = require_objectIdentityKey_native(), import_jsx_runtime = require("react/jsx-runtime");
2542
+ function createStyledContext(defaultValues) {
2543
+ let OGContext = (0, import_react3.createContext)(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
2544
+ children,
2545
+ scope,
2546
+ ...values
2547
+ }) => {
2548
+ let next = (0, import_react3.useMemo)(() => ({
2549
+ // this ! is a workaround for ts error
2550
+ ...defaultValues,
2551
+ ...values
2552
+ }), [(0, import_objectIdentityKey.objectIdentityKey)(values)]), Provider2 = OGProvider;
2553
+ if (scope) {
2554
+ let ScopedContext = scopedContexts.get(scope);
2555
+ ScopedContext || (ScopedContext = (0, import_react3.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
2556
+ }
2557
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value: next, children });
2558
+ }, useStyledContext = (scope) => {
2559
+ let context = scope ? scopedContexts.get(scope) : OGContext;
2560
+ return (0, import_react3.useContext)(context);
2561
+ };
2562
+ return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
2478
2563
  }
2479
- function commaSeparatedCall(...args) {
2480
- return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
2564
+ }
2565
+ });
2566
+
2567
+ // ../web/dist/cjs/contexts/ComponentContext.native.js
2568
+ var require_ComponentContext_native = __commonJS({
2569
+ "../web/dist/cjs/contexts/ComponentContext.native.js"(exports2, module2) {
2570
+ "use strict";
2571
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2572
+ for (var name in all)
2573
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2574
+ }, __copyProps2 = (to, from, except, desc) => {
2575
+ if (from && typeof from == "object" || typeof from == "function")
2576
+ for (let key of __getOwnPropNames2(from))
2577
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2578
+ return to;
2579
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ComponentContext_exports = {};
2580
+ __export2(ComponentContext_exports, {
2581
+ ComponentContext: () => ComponentContext
2582
+ });
2583
+ module2.exports = __toCommonJS2(ComponentContext_exports);
2584
+ var import_createStyledContext = require_createStyledContext_native(), ComponentContext = (0, import_createStyledContext.createStyledContext)({
2585
+ disableSSR: void 0,
2586
+ inText: !1,
2587
+ language: null,
2588
+ animationDriver: null,
2589
+ groups: {
2590
+ emit: null,
2591
+ subscribe: null,
2592
+ state: {}
2593
+ }
2594
+ });
2595
+ }
2596
+ });
2597
+
2598
+ // ../web/dist/cjs/defaultComponentState.native.js
2599
+ var require_defaultComponentState_native = __commonJS({
2600
+ "../web/dist/cjs/defaultComponentState.native.js"(exports2, module2) {
2601
+ "use strict";
2602
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2603
+ for (var name in all)
2604
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2605
+ }, __copyProps2 = (to, from, except, desc) => {
2606
+ if (from && typeof from == "object" || typeof from == "function")
2607
+ for (let key of __getOwnPropNames2(from))
2608
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2609
+ return to;
2610
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), defaultComponentState_exports = {};
2611
+ __export2(defaultComponentState_exports, {
2612
+ defaultComponentState: () => defaultComponentState,
2613
+ defaultComponentStateMounted: () => defaultComponentStateMounted,
2614
+ defaultComponentStateShouldEnter: () => defaultComponentStateShouldEnter
2615
+ });
2616
+ module2.exports = __toCommonJS2(defaultComponentState_exports);
2617
+ var defaultComponentState = {
2618
+ hover: !1,
2619
+ press: !1,
2620
+ pressIn: !1,
2621
+ focus: !1,
2622
+ unmounted: !0
2623
+ }, defaultComponentStateMounted = {
2624
+ ...defaultComponentState,
2625
+ unmounted: !1
2626
+ }, defaultComponentStateShouldEnter = {
2627
+ ...defaultComponentState,
2628
+ unmounted: "should-enter"
2629
+ };
2630
+ }
2631
+ });
2632
+
2633
+ // ../web/dist/cjs/constants/accessibilityDirectMap.native.js
2634
+ var require_accessibilityDirectMap_native = __commonJS({
2635
+ "../web/dist/cjs/constants/accessibilityDirectMap.native.js"(exports2, module2) {
2636
+ "use strict";
2637
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2638
+ for (var name in all)
2639
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2640
+ }, __copyProps2 = (to, from, except, desc) => {
2641
+ if (from && typeof from == "object" || typeof from == "function")
2642
+ for (let key of __getOwnPropNames2(from))
2643
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2644
+ return to;
2645
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), accessibilityDirectMap_native_exports = {};
2646
+ __export2(accessibilityDirectMap_native_exports, {
2647
+ accessibilityDirectMap: () => accessibilityDirectMap,
2648
+ accessibilityWebRoleToNativeRole: () => accessibilityWebRoleToNativeRole,
2649
+ nativeAccessibilityState: () => nativeAccessibilityState,
2650
+ nativeAccessibilityValue: () => nativeAccessibilityValue,
2651
+ webToNativeAccessibilityDirectMap: () => webToNativeAccessibilityDirectMap
2652
+ });
2653
+ module2.exports = __toCommonJS2(accessibilityDirectMap_native_exports);
2654
+ var accessibilityDirectMap = {}, webToNativeAccessibilityDirectMap = {
2655
+ "aria-label": "accessibilityLabel",
2656
+ "aria-labelledby": "accessibilityLabelledBy",
2657
+ "aria-live": "accessibilityLiveRegion",
2658
+ "aria-modal": "accessibilityViewIsModal",
2659
+ "aria-hidden": "accessibilityElementsHidden"
2660
+ }, nativeAccessibilityValue = {
2661
+ "aria-valuemin": "min",
2662
+ "aria-valuemax": "max",
2663
+ "aria-valuenow": "now",
2664
+ "aria-valuetext": "text"
2665
+ }, nativeAccessibilityState = {
2666
+ "aria-disabled": "disabled",
2667
+ "aria-selected": "selected",
2668
+ "aria-checked": "checked",
2669
+ "aria-busy": "busy",
2670
+ "aria-expanded": "expanded"
2671
+ }, accessibilityWebRoleToNativeRole = {
2672
+ alert: "alert",
2673
+ button: "button",
2674
+ checkbox: "checkbox",
2675
+ combobox: "combobox",
2676
+ grid: "grid",
2677
+ group: "none",
2678
+ heading: "header",
2679
+ imagebutton: "imagebutton",
2680
+ img: "image",
2681
+ keyboardkey: "keyboardkey",
2682
+ link: "link",
2683
+ menu: "menu",
2684
+ menubar: "menubar",
2685
+ menuitem: "menuitem",
2686
+ none: "none",
2687
+ presentation: "none",
2688
+ progressbar: "progressbar",
2689
+ radio: "radio",
2690
+ radiogroup: "radiogroup",
2691
+ region: "summary",
2692
+ scrollbar: "scrollbar",
2693
+ searchbox: "search",
2694
+ slider: "adjustable",
2695
+ spinbutton: "spinbutton",
2696
+ summary: "summary",
2697
+ switch: "switch",
2698
+ tab: "tab",
2699
+ tablist: "tablist",
2700
+ text: "text",
2701
+ timer: "timer",
2702
+ togglebutton: "togglebutton",
2703
+ toolbar: "toolbar"
2704
+ };
2705
+ }
2706
+ });
2707
+
2708
+ // ../web/dist/cjs/constants/isDevTools.native.js
2709
+ var require_isDevTools_native = __commonJS({
2710
+ "../web/dist/cjs/constants/isDevTools.native.js"(exports2, module2) {
2711
+ "use strict";
2712
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2713
+ for (var name in all)
2714
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2715
+ }, __copyProps2 = (to, from, except, desc) => {
2716
+ if (from && typeof from == "object" || typeof from == "function")
2717
+ for (let key of __getOwnPropNames2(from))
2718
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2719
+ return to;
2720
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), isDevTools_exports = {};
2721
+ __export2(isDevTools_exports, {
2722
+ isDevTools: () => isDevTools
2723
+ });
2724
+ module2.exports = __toCommonJS2(isDevTools_exports);
2725
+ var isDevTools = (() => {
2726
+ if (process.env.NODE_ENV === "development")
2727
+ try {
2728
+ return new Function("try {return this===window;}catch(e){ return false;}")();
2729
+ } catch {
2730
+ }
2731
+ return !1;
2732
+ })();
2733
+ }
2734
+ });
2735
+
2736
+ // ../web/dist/cjs/helpers/getGroupPropParts.native.js
2737
+ var require_getGroupPropParts_native = __commonJS({
2738
+ "../web/dist/cjs/helpers/getGroupPropParts.native.js"(exports2, module2) {
2739
+ "use strict";
2740
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2741
+ for (var name in all)
2742
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2743
+ }, __copyProps2 = (to, from, except, desc) => {
2744
+ if (from && typeof from == "object" || typeof from == "function")
2745
+ for (let key of __getOwnPropNames2(from))
2746
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2747
+ return to;
2748
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getGroupPropParts_exports = {};
2749
+ __export2(getGroupPropParts_exports, {
2750
+ getGroupPropParts: () => getGroupPropParts
2751
+ });
2752
+ module2.exports = __toCommonJS2(getGroupPropParts_exports);
2753
+ var import_useMedia = require_useMedia_native();
2754
+ function getGroupPropParts(groupProp) {
2755
+ let mediaQueries = (0, import_useMedia.getMedia)(), [_, name, part3, part4] = groupProp.split("-"), pseudo, media = part3 in mediaQueries ? part3 : void 0;
2756
+ return media ? pseudo = part4 : pseudo = part3, { name, pseudo, media };
2481
2757
  }
2482
- var cachedMatchers;
2483
- function getMatchers() {
2484
- return cachedMatchers === void 0 && (cachedMatchers = {
2485
- rgb: new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER)),
2486
- rgba: new RegExp(
2487
- "rgba(" + commaSeparatedCall(NUMBER, NUMBER, NUMBER, NUMBER) + "|" + callWithSlashSeparator(NUMBER, NUMBER, NUMBER, NUMBER) + ")"
2488
- ),
2489
- hsl: new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE)),
2490
- hsla: new RegExp(
2491
- "hsla(" + commaSeparatedCall(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) + "|" + callWithSlashSeparator(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) + ")"
2492
- ),
2493
- hwb: new RegExp("hwb" + call(NUMBER, PERCENTAGE, PERCENTAGE)),
2758
+ }
2759
+ });
2760
+
2761
+ // ../web/dist/cjs/helpers/createMediaStyle.native.js
2762
+ var require_createMediaStyle_native = __commonJS({
2763
+ "../web/dist/cjs/helpers/createMediaStyle.native.js"(exports2, module2) {
2764
+ "use strict";
2765
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
2766
+ for (var name in all)
2767
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
2768
+ }, __copyProps2 = (to, from, except, desc) => {
2769
+ if (from && typeof from == "object" || typeof from == "function")
2770
+ for (let key of __getOwnPropNames2(from))
2771
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
2772
+ return to;
2773
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createMediaStyle_exports = {};
2774
+ __export2(createMediaStyle_exports, {
2775
+ MEDIA_SEP: () => MEDIA_SEP,
2776
+ createMediaStyle: () => createMediaStyle
2777
+ });
2778
+ module2.exports = __toCommonJS2(createMediaStyle_exports);
2779
+ var import_config = require_config_native(), import_useMedia = require_useMedia_native(), import_getGroupPropParts = require_getGroupPropParts_native(), MEDIA_SEP = "_", prefixes = null, selectors = null, groupPseudoToPseudoCSSMap = {
2780
+ press: "active"
2781
+ }, createMediaStyle = (styleObject, mediaKeyIn, mediaQueries, type, negate, priority) => {
2782
+ let { property, identifier, rules } = styleObject, conf = (0, import_config.getConfig)(), enableMediaPropOrder = conf.settings.mediaPropOrder, isTheme = type === "theme", isPlatform = type === "platform", isGroup = type === "group", isNonWindowMedia = isTheme || isPlatform || isGroup, negKey = negate ? "0" : "", ogPrefix = identifier.slice(0, identifier.indexOf("-") + 1), id = `${ogPrefix}${MEDIA_SEP}${mediaKeyIn.replace("-", "")}${negKey}${MEDIA_SEP}`, styleRule = "", groupMediaKey, containerName, nextIdentifier = identifier.replace(ogPrefix, id), styleInner = rules.map((rule) => rule.replace(identifier, nextIdentifier)).join(";");
2783
+ if (isNonWindowMedia) {
2784
+ let precedenceImportancePrefix = new Array((priority || 0) + (isGroup ? 1 : 0)).fill(":root").join("");
2785
+ if (isTheme || isGroup) {
2786
+ let groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyIn), mediaName = groupInfo == null ? void 0 : groupInfo.name;
2787
+ groupMediaKey = groupInfo == null ? void 0 : groupInfo.media, isGroup && (containerName = mediaName);
2788
+ let name = (isGroup ? "group_" : "") + mediaName, selectorStart = styleInner.indexOf(":root"), selectorEnd = styleInner.lastIndexOf("{"), selector = styleInner.slice(selectorStart, selectorEnd), precedenceSpace = conf.themeClassNameOnRoot && isTheme ? "" : " ", pseudoSelectorName = groupInfo.pseudo ? groupPseudoToPseudoCSSMap[groupInfo.pseudo] || groupInfo.pseudo : void 0, pseudoSelector = pseudoSelectorName ? `:${pseudoSelectorName}` : "", presedencePrefix = `:root${precedenceImportancePrefix}${precedenceSpace}`, mediaSelector = `.t_${name}${pseudoSelector}`, nextSelector = `${presedencePrefix}${mediaSelector} ${selector.replace(
2789
+ ":root",
2790
+ ""
2791
+ )}`;
2792
+ styleRule = styleInner.replace(selector, nextSelector);
2793
+ } else
2794
+ styleRule = `${precedenceImportancePrefix}${styleInner}`;
2795
+ }
2796
+ if (!isNonWindowMedia || groupMediaKey) {
2797
+ if (!selectors) {
2798
+ let mediaKeys = Object.keys(mediaQueries);
2799
+ selectors = Object.fromEntries(
2800
+ mediaKeys.map((key) => [key, (0, import_useMedia.mediaObjectToString)(mediaQueries[key])])
2801
+ ), enableMediaPropOrder || (prefixes = Object.fromEntries(
2802
+ mediaKeys.map((k, index) => [k, new Array(index + 1).fill(":root").join("")])
2803
+ ));
2804
+ }
2805
+ let mediaKey = groupMediaKey || mediaKeyIn, mediaSelector = selectors[mediaKey], mediaQuery = `${negate ? "not all and " : ""}${mediaSelector}`, precedenceImportancePrefix = groupMediaKey ? "" : enableMediaPropOrder ? (
2806
+ // this new array should be cached
2807
+ new Array(priority).fill(":root").join("")
2808
+ ) : (
2809
+ // @ts-ignore
2810
+ prefixes[mediaKey]
2811
+ ), prefix = groupMediaKey ? `@container ${containerName}` : "@media";
2812
+ groupMediaKey && (styleInner = styleRule), styleInner.includes(prefix) ? styleRule = styleInner.replace("{", ` and ${mediaQuery} {`).replace("and screen and", "and") : styleRule = `${prefix} ${mediaQuery}{${precedenceImportancePrefix}${styleInner}}`, groupMediaKey && (styleRule = `@supports (contain: ${conf.settings.webContainerType || "inline-size"}) {${styleRule}}`);
2813
+ }
2814
+ return {
2815
+ property,
2816
+ rules: [styleRule],
2817
+ identifier: nextIdentifier
2818
+ };
2819
+ };
2820
+ }
2821
+ });
2822
+
2823
+ // ../../node_modules/@react-native/normalize-color/index.js
2824
+ var require_normalize_color = __commonJS({
2825
+ "../../node_modules/@react-native/normalize-color/index.js"(exports2, module2) {
2826
+ "use strict";
2827
+ function normalizeColor(color) {
2828
+ if (typeof color == "number")
2829
+ return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null;
2830
+ if (typeof color != "string")
2831
+ return null;
2832
+ let matchers = getMatchers(), match;
2833
+ if (match = matchers.hex6.exec(color))
2834
+ return parseInt(match[1] + "ff", 16) >>> 0;
2835
+ let colorFromKeyword = normalizeKeyword(color);
2836
+ return colorFromKeyword ?? ((match = matchers.rgb.exec(color)) ? (parse255(match[1]) << 24 | // r
2837
+ parse255(match[2]) << 16 | // g
2838
+ parse255(match[3]) << 8 | // b
2839
+ 255) >>> // a
2840
+ 0 : (match = matchers.rgba.exec(color)) ? match[6] !== void 0 ? (parse255(match[6]) << 24 | // r
2841
+ parse255(match[7]) << 16 | // g
2842
+ parse255(match[8]) << 8 | // b
2843
+ parse1(match[9])) >>> // a
2844
+ 0 : (parse255(match[2]) << 24 | // r
2845
+ parse255(match[3]) << 16 | // g
2846
+ parse255(match[4]) << 8 | // b
2847
+ parse1(match[5])) >>> // a
2848
+ 0 : (match = matchers.hex3.exec(color)) ? parseInt(
2849
+ match[1] + match[1] + // r
2850
+ match[2] + match[2] + // g
2851
+ match[3] + match[3] + // b
2852
+ "ff",
2853
+ // a
2854
+ 16
2855
+ ) >>> 0 : (match = matchers.hex8.exec(color)) ? parseInt(match[1], 16) >>> 0 : (match = matchers.hex4.exec(color)) ? parseInt(
2856
+ match[1] + match[1] + // r
2857
+ match[2] + match[2] + // g
2858
+ match[3] + match[3] + // b
2859
+ match[4] + match[4],
2860
+ // a
2861
+ 16
2862
+ ) >>> 0 : (match = matchers.hsl.exec(color)) ? (hslToRgb(
2863
+ parse360(match[1]),
2864
+ // h
2865
+ parsePercentage(match[2]),
2866
+ // s
2867
+ parsePercentage(match[3])
2868
+ // l
2869
+ ) | 255) >>> // a
2870
+ 0 : (match = matchers.hsla.exec(color)) ? match[6] !== void 0 ? (hslToRgb(
2871
+ parse360(match[6]),
2872
+ // h
2873
+ parsePercentage(match[7]),
2874
+ // s
2875
+ parsePercentage(match[8])
2876
+ // l
2877
+ ) | parse1(match[9])) >>> // a
2878
+ 0 : (hslToRgb(
2879
+ parse360(match[2]),
2880
+ // h
2881
+ parsePercentage(match[3]),
2882
+ // s
2883
+ parsePercentage(match[4])
2884
+ // l
2885
+ ) | parse1(match[5])) >>> // a
2886
+ 0 : (match = matchers.hwb.exec(color)) ? (hwbToRgb(
2887
+ parse360(match[1]),
2888
+ // h
2889
+ parsePercentage(match[2]),
2890
+ // w
2891
+ parsePercentage(match[3])
2892
+ // b
2893
+ ) | 255) >>> // a
2894
+ 0 : null);
2895
+ }
2896
+ function hue2rgb(p, q, t) {
2897
+ return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? p + (q - p) * 6 * t : t < 1 / 2 ? q : t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 : p;
2898
+ }
2899
+ function hslToRgb(h, s, l) {
2900
+ let q = l < 0.5 ? l * (1 + s) : l + s - l * s, p = 2 * l - q, r = hue2rgb(p, q, h + 1 / 3), g = hue2rgb(p, q, h), b = hue2rgb(p, q, h - 1 / 3);
2901
+ return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
2902
+ }
2903
+ function hwbToRgb(h, w, b) {
2904
+ if (w + b >= 1) {
2905
+ let gray = Math.round(w * 255 / (w + b));
2906
+ return gray << 24 | gray << 16 | gray << 8;
2907
+ }
2908
+ let red = hue2rgb(0, 1, h + 1 / 3) * (1 - w - b) + w, green = hue2rgb(0, 1, h) * (1 - w - b) + w, blue = hue2rgb(0, 1, h - 1 / 3) * (1 - w - b) + w;
2909
+ return Math.round(red * 255) << 24 | Math.round(green * 255) << 16 | Math.round(blue * 255) << 8;
2910
+ }
2911
+ var NUMBER = "[-+]?\\d*\\.?\\d+", PERCENTAGE = NUMBER + "%";
2912
+ function call(...args) {
2913
+ return "\\(\\s*(" + args.join(")\\s*,?\\s*(") + ")\\s*\\)";
2914
+ }
2915
+ function callWithSlashSeparator(...args) {
2916
+ return "\\(\\s*(" + args.slice(0, args.length - 1).join(")\\s*,?\\s*(") + ")\\s*/\\s*(" + args[args.length - 1] + ")\\s*\\)";
2917
+ }
2918
+ function commaSeparatedCall(...args) {
2919
+ return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
2920
+ }
2921
+ var cachedMatchers;
2922
+ function getMatchers() {
2923
+ return cachedMatchers === void 0 && (cachedMatchers = {
2924
+ rgb: new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER)),
2925
+ rgba: new RegExp(
2926
+ "rgba(" + commaSeparatedCall(NUMBER, NUMBER, NUMBER, NUMBER) + "|" + callWithSlashSeparator(NUMBER, NUMBER, NUMBER, NUMBER) + ")"
2927
+ ),
2928
+ hsl: new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE)),
2929
+ hsla: new RegExp(
2930
+ "hsla(" + commaSeparatedCall(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) + "|" + callWithSlashSeparator(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER) + ")"
2931
+ ),
2932
+ hwb: new RegExp("hwb" + call(NUMBER, PERCENTAGE, PERCENTAGE)),
2494
2933
  hex3: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
2495
2934
  hex4: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
2496
2935
  hex6: /^#([0-9a-fA-F]{6})$/,
@@ -3289,785 +3728,235 @@ var require_propMapper_native = __commonJS({
3289
3728
  getFontFamilyFromNameOrVariable: () => getFontFamilyFromNameOrVariable,
3290
3729
  getPropMappedFontFamily: () => getPropMappedFontFamily,
3291
3730
  getTokenForKey: () => getTokenForKey,
3292
- propMapper: () => propMapper
3293
- });
3294
- module2.exports = __toCommonJS2(propMapper_exports);
3295
- var import_constants = require_index_native3(), import_helpers = require_index_native4(), import_config = require_config_native(), import_isDevTools = require_isDevTools_native(), import_createVariable = require_createVariable_native(), import_expandStyle = require_expandStyle_native(), import_expandStylesAndRemoveNullishValues = require_expandStylesAndRemoveNullishValues_native(), import_getVariantExtras = require_getVariantExtras_native(), import_isObj = require_isObj_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), propMapper = (key, value, styleStateIn, subPropsIn) => {
3296
- var _a;
3297
- if (lastFontFamilyToken = null, !import_constants.isAndroid && key === "elevationAndroid")
3298
- return;
3299
- if (value === "unset") {
3300
- let unsetVal = (_a = styleStateIn.conf.unset) == null ? void 0 : _a[key];
3301
- if (unsetVal != null)
3302
- value = unsetVal;
3303
- else
3304
- return;
3305
- }
3306
- let subProps = styleStateIn.styleProps.fallbackProps || subPropsIn, styleState = subProps ? new Proxy(styleStateIn, {
3307
- get(_, k) {
3308
- return k === "curProps" ? subProps : Reflect.get(_, k);
3309
- }
3310
- }) : styleStateIn, { conf, styleProps, fontFamily, staticConfig } = styleState, { variants } = staticConfig;
3311
- if (process.env.NODE_ENV === "development" && fontFamily && fontFamily[0] === "$" && !(fontFamily in conf.fontsParsed) && console.warn(
3312
- `Warning: no fontFamily "${fontFamily}" found in config: ${Object.keys(
3313
- conf.fontsParsed
3314
- ).join(", ")}`
3315
- ), !styleProps.noExpand && variants && key in variants) {
3316
- styleState.curProps[key] = value;
3317
- let variantValue = resolveVariants(key, value, styleProps, styleState, "");
3318
- if (variantValue)
3319
- return variantValue;
3320
- }
3321
- let shouldReturn = !1;
3322
- if (styleProps.disableExpandShorthands || key in conf.shorthands && (shouldReturn = !0, key = conf.shorthands[key]), value && (value[0] === "$" ? value = getTokenForKey(key, value, styleProps.resolveValues, styleState) : (0, import_createVariable.isVariable)(value) && (value = resolveVariableValue(key, value, styleProps.resolveValues))), shouldReturn || value != null) {
3323
- let result = (styleProps.noExpand ? null : (0, import_expandStyle.expandStyle)(key, value)) || [
3324
- [key, value]
3325
- ];
3326
- return key === "fontFamily" && lastFontFamilyToken && fontFamilyCache.set(result, lastFontFamilyToken), result;
3327
- }
3328
- }, resolveVariants = (key, value, styleProps, styleState, parentVariantKey) => {
3329
- let { staticConfig, conf, debug } = styleState, { variants } = staticConfig;
3330
- if (!variants)
3331
- return;
3332
- let variantValue = getVariantDefinition(variants[key], value, conf);
3333
- if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(`\u2666\uFE0F\u2666\uFE0F\u2666\uFE0F resolve variant ${key}`), console.info({
3334
- key,
3335
- value,
3336
- variantValue,
3337
- variants,
3338
- curProps: { ...styleState.curProps }
3339
- }), console.groupEnd()), !variantValue) {
3340
- if (process.env.TAMAGUI_WARN_ON_MISSING_VARIANT === "1" && typeof value != "boolean") {
3341
- let name = staticConfig.componentName || "[UnnamedComponent]";
3342
- console.warn(
3343
- `No variant found: ${name} has variant "${key}", but no matching value "${value}"`
3344
- );
3345
- }
3346
- return;
3347
- }
3348
- if (typeof variantValue == "function") {
3349
- let fn = variantValue, extras = (0, import_getVariantExtras.getVariantExtras)(styleState);
3350
- variantValue = fn(value, extras), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(" expanded functional variant", key), console.info({ fn, variantValue, extras }), console.groupEnd());
3351
- }
3352
- let fontFamilyResult;
3353
- if ((0, import_isObj.isObj)(variantValue)) {
3354
- let fontFamilyUpdate = variantValue.fontFamily || variantValue[conf.inverseShorthands.fontFamily];
3355
- fontFamilyUpdate && (fontFamilyResult = getFontFamilyFromNameOrVariable(fontFamilyUpdate, conf), styleState.fontFamily = fontFamilyResult, process.env.NODE_ENV === "development" && debug === "verbose" && console.info(" updating font family", fontFamilyResult)), variantValue = resolveTokensAndVariants(
3356
- key,
3357
- variantValue,
3358
- styleProps,
3359
- styleState,
3360
- parentVariantKey
3361
- );
3362
- }
3363
- if (variantValue) {
3364
- let expanded = (0, import_expandStylesAndRemoveNullishValues.expandStylesAndRemoveNullishValues)(
3365
- variantValue,
3366
- !!styleProps.noNormalize
3367
- ), next = Object.entries(expanded);
3368
- return fontFamilyResult && fontFamilyResult[0] === "$" && fontFamilyCache.set(next, (0, import_createVariable.getVariableValue)(fontFamilyResult)), next;
3369
- }
3370
- };
3371
- function getFontFamilyFromNameOrVariable(input, conf) {
3372
- if ((0, import_createVariable.isVariable)(input)) {
3373
- let val = variableToFontNameCache.get(input);
3374
- if (val)
3375
- return val;
3376
- for (let key in conf.fontsParsed) {
3377
- let familyVariable = conf.fontsParsed[key].family;
3378
- if ((0, import_createVariable.isVariable)(familyVariable) && (variableToFontNameCache.set(familyVariable, key), familyVariable === input))
3379
- return key;
3380
- }
3381
- } else if (typeof input == "string" && input[0] === "$")
3382
- return input;
3383
- }
3384
- var variableToFontNameCache = /* @__PURE__ */ new WeakMap(), fontFamilyCache = /* @__PURE__ */ new WeakMap(), getPropMappedFontFamily = (expanded) => expanded && fontFamilyCache.get(expanded), resolveTokensAndVariants = (key, value, styleProps, styleState, parentVariantKey) => {
3385
- var _a;
3386
- let { conf, staticConfig, debug, theme } = styleState, { variants } = staticConfig, res = {};
3387
- process.env.NODE_ENV === "development" && debug === "verbose" && console.info(" - resolveTokensAndVariants", key, value);
3388
- for (let _key in value) {
3389
- let subKey = conf.shorthands[_key] || _key, val = value[_key];
3390
- if (styleProps.noExpand)
3391
- res[subKey] = val;
3392
- else if (variants && subKey in variants) {
3393
- if (styleState.curProps[subKey] = val, parentVariantKey && parentVariantKey === key)
3394
- res[subKey] = // SYNC WITH *1
3395
- val[0] === "$" ? getTokenForKey(subKey, val, styleProps.resolveValues, styleState) : val;
3396
- else {
3397
- let variantOut = resolveVariants(subKey, val, styleProps, styleState, key);
3398
- if (variantOut)
3399
- for (let [key2, val2] of variantOut)
3400
- val2 != null && (key2 in import_pseudoDescriptors.pseudoDescriptors ? (res[key2] ??= {}, Object.assign(res[key2], val2)) : res[key2] = val2);
3401
- }
3402
- continue;
3403
- }
3404
- if ((0, import_createVariable.isVariable)(val)) {
3405
- res[subKey] = resolveVariableValue(subKey, val, styleProps.resolveValues);
3406
- continue;
3407
- }
3408
- if (typeof val == "string") {
3409
- let fVal = (
3410
- // SYNC WITH *1
3411
- val[0] === "$" ? getTokenForKey(subKey, val, styleProps.resolveValues, styleState) : val
3412
- );
3413
- res[subKey] = fVal;
3414
- continue;
3415
- }
3416
- if ((0, import_isObj.isObj)(val)) {
3417
- let subObject = resolveTokensAndVariants(subKey, val, styleProps, styleState, key);
3418
- process.env.NODE_ENV === "development" && debug === "verbose" && console.info("object", subKey, subObject), res[subKey] ??= {}, Object.assign(res[subKey], subObject);
3419
- } else
3420
- res[subKey] = val;
3421
- process.env.NODE_ENV === "development" && debug && ((_a = res[subKey]) == null ? void 0 : _a[0]) === "$" && console.warn(
3422
- `\u26A0\uFE0F Missing token in theme ${theme.name}:`,
3423
- subKey,
3424
- res[subKey],
3425
- theme
3426
- );
3427
- }
3428
- return res;
3429
- }, tokenCats = ["size", "color", "radius", "space", "zIndex"].map((name) => ({
3430
- name,
3431
- spreadName: `...${name}`
3432
- }));
3433
- function getVariantDefinition(variant, value, conf) {
3434
- if (typeof variant == "function")
3435
- return variant;
3436
- let exact = variant[value];
3437
- if (exact)
3438
- return exact;
3439
- if (value != null) {
3440
- let { tokensParsed } = conf;
3441
- for (let { name, spreadName } of tokenCats)
3442
- if (spreadName in variant && value in tokensParsed[name])
3443
- return variant[spreadName];
3444
- let fontSizeVariant = variant["...fontSize"];
3445
- if (fontSizeVariant && conf.fontSizeTokens.has(value))
3446
- return fontSizeVariant;
3447
- }
3448
- return variant[`:${typeof value}`] || variant["..."];
3449
- }
3450
- var fontShorthand = {
3451
- fontSize: "size",
3452
- fontWeight: "weight"
3453
- }, lastFontFamilyToken = null, getTokenForKey = (key, value, resolveAs = "none", styleState) => {
3454
- var _a, _b, _c, _d;
3455
- if (resolveAs === "none")
3456
- return value;
3457
- let { theme, conf = (0, import_config.getConfig)(), context, fontFamily, staticConfig } = styleState, tokensParsed = conf.tokensParsed, valOrVar, hasSet = !1;
3458
- if (theme && value in theme)
3459
- valOrVar = theme[value], process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(` - resolving ${key} to theme value ${value}: ${(_a = valOrVar == null ? void 0 : valOrVar.get) == null ? void 0 : _a.call(valOrVar)}`), hasSet = !0;
3460
- else if (value in conf.specificTokens)
3461
- hasSet = !0, valOrVar = conf.specificTokens[value];
3462
- else {
3463
- let customTokenAccept = (_b = staticConfig == null ? void 0 : staticConfig.acceptTokens) == null ? void 0 : _b[key];
3464
- if (customTokenAccept) {
3465
- let val = tokensParsed[customTokenAccept][value];
3466
- val && (valOrVar = val, hasSet = !0);
3467
- } else {
3468
- switch (key) {
3469
- case "fontFamily": {
3470
- valOrVar = ((_c = (context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed)[value]) == null ? void 0 : _c.family) || value, lastFontFamilyToken = value, hasSet = !0;
3471
- break;
3472
- }
3473
- case "fontSize":
3474
- case "lineHeight":
3475
- case "letterSpacing":
3476
- case "fontWeight": {
3477
- let defaultFont = conf.defaultFont || "$body", fam = fontFamily || defaultFont;
3478
- if (fam) {
3479
- let fontsParsed = context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed, font = fontsParsed[fam] || fontsParsed[defaultFont];
3480
- valOrVar = ((_d = font == null ? void 0 : font[fontShorthand[key] || key]) == null ? void 0 : _d[value]) || value, hasSet = !0;
3481
- }
3482
- break;
3483
- }
3484
- }
3485
- for (let cat in import_helpers.tokenCategories)
3486
- if (key in import_helpers.tokenCategories[cat]) {
3487
- let res = tokensParsed[cat][value];
3488
- res != null && (valOrVar = res, hasSet = !0);
3489
- }
3490
- }
3491
- if (!hasSet) {
3492
- let spaceVar = tokensParsed.space[value];
3493
- spaceVar != null && (valOrVar = spaceVar, hasSet = !0);
3494
- }
3495
- }
3496
- if (hasSet) {
3497
- let out = resolveVariableValue(key, valOrVar, resolveAs);
3498
- return process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info("resolved", resolveAs, valOrVar, out), out;
3499
- }
3500
- return process.env.NODE_ENV === "development" && import_isDevTools.isDevTools && styleState.debug === "verbose" && (console.groupCollapsed(" \uFE52 propMap (val)", key, value), console.info({ valOrVar, theme, hasSet }, theme ? theme[key] : ""), console.groupEnd()), value;
3501
- };
3502
- function resolveVariableValue(key, valOrVar, resolveValues) {
3503
- if (resolveValues === "none")
3504
- return valOrVar;
3505
- if ((0, import_createVariable.isVariable)(valOrVar)) {
3506
- if (resolveValues === "value")
3507
- return valOrVar.val;
3508
- let get = valOrVar == null ? void 0 : valOrVar.get;
3509
- return key !== "shadowColor" && typeof get == "function" ? get(resolveValues === "web" ? "web" : void 0) : valOrVar.val;
3510
- }
3511
- return valOrVar;
3512
- }
3513
- }
3514
- });
3515
-
3516
- // ../web/dist/cjs/helpers/getSplitStyles.native.js
3517
- var require_getSplitStyles_native = __commonJS({
3518
- "../web/dist/cjs/helpers/getSplitStyles.native.js"(exports2, module2) {
3519
- "use strict";
3520
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
3521
- for (var name in all)
3522
- __defProp2(target, name, { get: all[name], enumerable: !0 });
3523
- }, __copyProps2 = (to, from, except, desc) => {
3524
- if (from && typeof from == "object" || typeof from == "function")
3525
- for (let key of __getOwnPropNames2(from))
3526
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
3527
- return to;
3528
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getSplitStyles_exports = {};
3529
- __export2(getSplitStyles_exports, {
3530
- PROP_SPLIT: () => PROP_SPLIT,
3531
- getSplitStyles: () => getSplitStyles,
3532
- getSubStyle: () => getSubStyle,
3533
- useSplitStyles: () => useSplitStyles
3534
- });
3535
- module2.exports = __toCommonJS2(getSplitStyles_exports);
3536
- var import_constants = require_index_native3(), import_helpers = require_index_native4(), import_react3 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_constants2 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_log = require_log_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-";
3537
- function isValidStyleKey(key, staticConfig) {
3538
- let validStyleProps = staticConfig.validStyles ?? (staticConfig.isText ? import_helpers.stylePropsText : import_helpers.validStyles);
3539
- return key in validStyleProps || staticConfig.acceptTokens && key in staticConfig.acceptTokens;
3540
- }
3541
- var getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3542
- var _a, _b, _c, _e, _f, _g;
3543
- conf = conf || (0, import_config.getConfig)(), import_constants.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
3544
- let { shorthands } = conf, {
3545
- isHOC,
3546
- isText,
3547
- variants,
3548
- isReactNative,
3549
- inlineProps,
3550
- inlineWhenUnflattened,
3551
- parentStaticConfig,
3552
- acceptsClassName
3553
- } = staticConfig, viewProps = {}, mediaState2 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClassNames, rulesToInsert = [], classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, style = {}, className = props.className ?? "", mediaStylesSeen = 0, styleState = {
3554
- curProps: { ...props },
3555
- classNames,
3556
- conf,
3557
- props,
3558
- styleProps,
3559
- componentState,
3560
- staticConfig,
3561
- style,
3562
- theme,
3563
- usedKeys,
3564
- viewProps,
3565
- context,
3566
- debug
3567
- };
3568
- process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants.isClient && (console.groupCollapsed("getSplitStyles (collapsed)"), (0, import_log.log)({
3569
- props,
3570
- staticConfig,
3571
- shouldDoClasses,
3572
- styleProps,
3573
- componentState,
3574
- styleState,
3575
- theme: { ...theme }
3576
- }), console.groupEnd());
3577
- for (let keyOg in props) {
3578
- let keyInit = keyOg, valInit = props[keyOg];
3579
- if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !styleProps.noSkip && !isHOC)
3580
- continue;
3581
- let valInitType = typeof valInit, isValidStyleKeyInit = isValidStyleKey(keyInit, staticConfig);
3582
- if (styleState.curProps[keyInit] = valInit, !import_constants.isAndroid && keyInit === "elevationAndroid")
3583
- continue;
3584
- if (keyInit === "userSelect")
3585
- keyInit = "selectable", valInit = valInit !== "none";
3586
- else if (keyInit === "role") {
3587
- viewProps.accessibilityRole = import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit];
3588
- continue;
3589
- } else if (keyInit.startsWith("aria-")) {
3590
- if (import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit]) {
3591
- let nativeA11yProp = import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit];
3592
- keyInit === "aria-hidden" && (viewProps["aria-hidden"] = valInit), viewProps[nativeA11yProp] = valInit;
3593
- continue;
3594
- }
3595
- if (import_accessibilityDirectMap.nativeAccessibilityValue[keyInit]) {
3596
- let field = import_accessibilityDirectMap.nativeAccessibilityValue[keyInit];
3597
- viewProps.accessibilityValue ? viewProps.accessibilityValue[field] = valInit : viewProps.accessibilityValue = {
3598
- [field]: valInit
3599
- };
3600
- } else if (import_accessibilityDirectMap.nativeAccessibilityState[keyInit]) {
3601
- let field = import_accessibilityDirectMap.nativeAccessibilityState[keyInit];
3602
- viewProps.accessibilityState ? viewProps.accessibilityState[field] = valInit : viewProps.accessibilityState = {
3603
- [field]: valInit
3604
- };
3605
- }
3606
- continue;
3607
- } else if (keyInit.startsWith("data-"))
3608
- continue;
3609
- if (keyInit === "dataSet") {
3610
- for (let keyInit2 in valInit)
3611
- viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
3612
- continue;
3613
- }
3614
- if (keyInit[0] === "_" && keyInit.startsWith("_style")) {
3615
- mergeStylePropIntoStyle(styleState, valInit);
3616
- continue;
3617
- }
3618
- if (0)
3619
- switch (keyInit) {
3620
- case "accessibilityRole":
3621
- case "accessibilityLabelledBy":
3622
- case "accessibilityFlowTo":
3623
- case "accessibilityControls":
3624
- case "accessibilityDescribedBy":
3625
- case "accessibilityKeyShortcuts":
3626
- case "accessibilityLiveRegion":
3627
- case "accessibilityReadOnly":
3628
- case "accessibilityRequired":
3629
- default:
3630
- }
3631
- let isShorthand = keyInit in shorthands, isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant, isPseudo = keyInit in import_helpers.validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo && (0, import_useMedia.isMediaKey)(keyInit), isMediaOrPseudo = !!(isMedia || isPseudo), isStyleProp = isMediaOrPseudo || isVariant && !styleProps.noExpand || isValidStyleKeyInit || isShorthand;
3632
- if (isStyleProp && (props.asChild === "except-style" || props.asChild === "except-style-web"))
3633
- continue;
3634
- let shouldPassProp = !isStyleProp || // is in parent variants
3635
- isHOC && (parentStaticConfig == null ? void 0 : parentStaticConfig.variants) && keyInit in parentStaticConfig.variants || (inlineProps == null ? void 0 : inlineProps.has(keyInit)), parentVariant = (_a = parentStaticConfig == null ? void 0 : parentStaticConfig.variants) == null ? void 0 : _a[keyInit], isHOCShouldPassThrough = !!(isHOC && (isShorthand || isValidStyleKeyInit || isMediaOrPseudo || parentVariant || keyInit in skipProps)), shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
3636
- if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(
3637
- `\u{1F539}\u{1F539}\u{1F539}\u{1F539} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""} \u{1F539}\u{1F539}\u{1F539}\u{1F539}`
3638
- ), (0, import_log.log)({ isVariant, valInit, shouldPassProp }), import_constants.isClient && (0, import_log.log)({
3639
- variants,
3640
- variant: variants == null ? void 0 : variants[keyInit],
3641
- isVariant,
3642
- isHOCShouldPassThrough,
3643
- curProps: { ...styleState.curProps },
3644
- parentStaticConfig
3645
- }), console.groupEnd()), shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || !styleProps.noSkip && keyInit in skipProps)
3646
- continue;
3647
- if (isText && valInit && (keyInit === "fontFamily" || keyInit === shorthands.fontFamily) && valInit in conf.fontsParsed && (styleState.fontFamily = valInit), isValidStyleKeyInit && !variants && valInit !== "unset" && (valInitType === "number" || valInitType === "string" && valInit[0] !== "$")) {
3648
- style[keyInit] = valInit;
3649
- continue;
3650
- }
3651
- let expanded = isMediaOrPseudo || !isVariant && !isValidStyleKeyInit ? [[keyInit, valInit]] : (0, import_propMapper.propMapper)(keyInit, valInit, styleState), next = (0, import_propMapper.getPropMappedFontFamily)(expanded);
3652
- if (next && (styleState.fontFamily = next), process.env.NODE_ENV === "development" && debug === "verbose") {
3653
- console.groupCollapsed(" \u{1F4A0} expanded", keyInit, valInit);
3654
- try {
3655
- !import_constants.isServer && import_isDevTools.isDevTools && ((0, import_log.log)({
3656
- expanded,
3657
- styleProps,
3658
- componentState,
3659
- isVariant,
3660
- variant: variants == null ? void 0 : variants[keyInit],
3661
- shouldPassProp,
3662
- isHOCShouldPassThrough,
3663
- theme,
3664
- usedKeys: { ...usedKeys },
3665
- curProps: { ...styleState.curProps }
3666
- }), (0, import_log.log)("expanded", expanded, `
3667
- usedKeys`, { ...usedKeys }, `
3668
- current`, {
3669
- ...style
3670
- }));
3671
- } catch {
3672
- }
3673
- console.groupEnd();
3674
- }
3675
- if (expanded) {
3676
- for (let [key, val] of expanded)
3677
- if (!(val == null || key in usedKeys)) {
3678
- if (isPseudo = key in import_helpers.validPseudoKeys, isMedia = !isPseudo && !isValidStyleKeyInit && (0, import_useMedia.isMediaKey)(key), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key in variants, (inlineProps != null && inlineProps.has(key) || IS_STATIC && inlineWhenUnflattened != null && inlineWhenUnflattened.has(key)) && (viewProps[key] = props[key] ?? val), styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || ((_b = parentStaticConfig == null ? void 0 : parentStaticConfig.variants) == null ? void 0 : _b[keyInit]))) {
3679
- passDownProp(viewProps, key, val, isMediaOrPseudo), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(` - passing down prop ${key}`), (0, import_log.log)({ val, after: { ...viewProps[key] } }), console.groupEnd());
3680
- continue;
3681
- }
3682
- if (isPseudo) {
3683
- if (!val)
3684
- continue;
3685
- let pseudoStyleObject = getSubStyle(
3686
- styleState,
3687
- key,
3688
- val,
3689
- styleProps.noClassNames
3690
- ), descriptor = import_pseudoDescriptors.pseudoDescriptors[key], isEnter = key === "enterStyle", isExit = key === "exitStyle";
3691
- if (!descriptor || isExit && !styleProps.isExiting)
3692
- continue;
3693
- if ((!shouldDoClasses || IS_STATIC) && (pseudos ||= {}, pseudos[key] ||= {}, IS_STATIC)) {
3694
- Object.assign(pseudos[key], pseudoStyleObject);
3695
- continue;
3696
- }
3697
- if (shouldDoClasses && !isExit) {
3698
- let pseudoStyles = (0, import_getStylesAtomic.generateAtomicStyles)(pseudoStyleObject, descriptor);
3699
- process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed("pseudo (classes)", key), (0, import_log.log)({ pseudoStyleObject, pseudoStyles }), console.groupEnd());
3700
- for (let psuedoStyle of pseudoStyles)
3701
- `${psuedoStyle.property}${PROP_SPLIT}${descriptor.name}` in usedKeys || psuedoStyle.identifier;
3702
- }
3703
- if (!shouldDoClasses || isExit || isEnter) {
3704
- let descriptorKey = descriptor.stateKey || descriptor.name, isDisabled = componentState[descriptorKey] === !1;
3705
- isExit && (isDisabled = !styleProps.isExiting), isEnter && (isDisabled = componentState.unmounted === "should-enter" ? !0 : !componentState.unmounted), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed("pseudo", key, { isDisabled }), (0, import_log.log)({ pseudoStyleObject, isDisabled, descriptor, componentState }), console.groupEnd());
3706
- let importance = descriptor.priority;
3707
- for (let pkey in pseudoStyleObject) {
3708
- let val2 = pseudoStyleObject[pkey];
3709
- if (isDisabled) {
3710
- if (pkey in animatableDefaults && !(pkey in usedKeys)) {
3711
- let defaultVal = animatableDefaults[pkey];
3712
- mergeStyle(styleState, pkey, defaultVal);
3713
- }
3714
- } else {
3715
- let curImportance = usedKeys[pkey] || 0, shouldMerge = importance >= curImportance;
3716
- shouldMerge && (pseudos ||= {}, pseudos[key] ||= {}, pseudos[key][pkey] = val2, mergeStyle(styleState, pkey, val2)), process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(" subKey", pkey, shouldMerge, {
3717
- importance,
3718
- curImportance,
3719
- pkey,
3720
- val: val2,
3721
- transforms: { ...styleState.transforms }
3722
- });
3723
- }
3724
- }
3725
- if (!isDisabled)
3726
- for (let key2 in val) {
3727
- let k = shorthands[key2] || key2;
3728
- usedKeys[k] = Math.max(importance, usedKeys[k] || 0);
3729
- }
3730
- }
3731
- continue;
3732
- }
3733
- if (isMedia) {
3734
- if (!val)
3735
- continue;
3736
- if (isMedia === "platform") {
3737
- let platform = key.slice(10);
3738
- if (
3739
- // supports web, ios, android
3740
- platform !== import_constants.currentPlatform && // supports web, native
3741
- platform !== "native"
3742
- )
3743
- continue;
3744
- }
3745
- hasMedia ||= !0;
3746
- let mediaStyle = getSubStyle(
3747
- styleState,
3748
- key,
3749
- val,
3750
- // TODO try true like pseudo
3751
- !1
3752
- ), mediaKeyShort = key.slice(1);
3753
- process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(` \u{1F4FA} ${key}`, {
3754
- key,
3755
- val,
3756
- mediaStyle,
3757
- props,
3758
- shouldDoClasses,
3759
- componentState
3760
- });
3761
- let hasSpace = val.space;
3762
- if ((hasSpace || !shouldDoClasses) && (Array.isArray(hasMedia) || (hasMedia = []), hasMedia.push(mediaKeyShort)), shouldDoClasses) {
3763
- if (hasSpace && (delete mediaStyle.space, mediaState2[mediaKeyShort])) {
3764
- let importance = (0, import_useMedia.getMediaImportanceIfMoreImportant)(
3765
- mediaKeyShort,
3766
- "space",
3767
- usedKeys,
3768
- !0
3769
- );
3770
- importance && (space = val.space, usedKeys.space = importance, process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(
3771
- `Found more important space for current media ${mediaKeyShort}: ${val} (importance: ${importance})`
3772
- ));
3773
- }
3774
- let mediaStyles = (0, import_getStylesAtomic.getStylesAtomic)(mediaStyle, debug), priority = mediaStylesSeen;
3775
- mediaStylesSeen += 1;
3776
- for (let style2 of mediaStyles) {
3777
- let out = (0, import_createMediaStyle.createMediaStyle)(
3778
- style2,
3779
- mediaKeyShort,
3780
- import_useMedia.mediaQueryConfig,
3781
- isMedia,
3782
- !1,
3783
- priority
3784
- );
3785
- process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out), `${style2.property}${PROP_SPLIT}${mediaKeyShort}` in usedKeys || out.identifier;
3786
- }
3787
- } else {
3788
- let isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group";
3789
- if (!isThemeMedia && isMedia !== "platform" && !isGroupMedia && !mediaState2[mediaKeyShort])
3790
- continue;
3791
- let importanceBump = 0;
3792
- if (isThemeMedia) {
3793
- dynamicThemeAccess = !0;
3794
- let mediaThemeName = mediaKeyShort.slice(6);
3795
- if (!(themeName === mediaThemeName || themeName.startsWith(mediaThemeName)))
3796
- continue;
3797
- } else if (isGroupMedia) {
3798
- let groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyShort), groupName = groupInfo.name, groupContext = context == null ? void 0 : context.groups.state[groupName];
3799
- if (!groupContext) {
3800
- process.env.NODE_ENV === "development" && debug && console.warn(`No parent with group prop, skipping styles: ${groupName}`);
3801
- continue;
3802
- }
3803
- let groupPseudoKey = groupInfo.pseudo, groupMediaKey = groupInfo.media, componentGroupState = (_c = componentState.group) == null ? void 0 : _c[groupName];
3804
- if (groupMediaKey) {
3805
- mediaGroups ||= /* @__PURE__ */ new Set(), mediaGroups.add(groupMediaKey);
3806
- let mediaState22 = componentGroupState == null ? void 0 : componentGroupState.media, isActive = mediaState22 == null ? void 0 : mediaState22[groupMediaKey];
3807
- if (!mediaState22 && groupContext.layout && (isActive = (0, import_useMedia.mediaKeyMatch)(groupMediaKey, groupContext.layout)), !isActive)
3808
- continue;
3809
- importanceBump = 2;
3810
- }
3811
- if (groupPseudoKey) {
3812
- pseudoGroups ||= /* @__PURE__ */ new Set(), pseudoGroups.add(groupName);
3813
- let componentGroupPseudoState = (componentGroupState || // fallback to context initially
3814
- context.groups.state[groupName]).pseudo;
3815
- if (!(componentGroupPseudoState != null && componentGroupPseudoState[groupPseudoKey]))
3816
- continue;
3817
- importanceBump = import_pseudoDescriptors.pseudoPriorities[groupPseudoKey];
3818
- }
3819
- }
3820
- for (let subKey in mediaStyle) {
3821
- if (subKey === "space") {
3822
- space = valInit.space;
3823
- continue;
3824
- }
3825
- (0, import_useMedia.mergeMediaByImportance)(
3826
- style,
3827
- mediaKeyShort,
3828
- subKey,
3829
- mediaStyle[subKey],
3830
- usedKeys,
3831
- mediaState2[mediaKeyShort],
3832
- importanceBump
3833
- ), key === "fontFamily" && (styleState.fontFamily = mediaStyle.fontFamily);
3834
- }
3835
- }
3836
- continue;
3837
- }
3838
- if (key === "pointerEvents") {
3839
- viewProps[key] = val;
3840
- continue;
3841
- }
3842
- if (
3843
- // is HOC we can just pass through the styles as props
3844
- // this fixes issues where style prop got merged with wrong priority
3845
- !isHOC && (isValidStyleKey(key, staticConfig) || import_constants.isAndroid && key === "elevation")
3846
- ) {
3847
- mergeStyle(styleState, key, val);
3848
- continue;
3849
- }
3850
- isVariant || (viewProps[key] = val);
3851
- }
3852
- if (process.env.NODE_ENV === "development" && debug === "verbose") {
3853
- console.groupCollapsed(" \u2714\uFE0F expand complete", keyInit);
3854
- try {
3855
- (0, import_log.log)("style", { ...style }), (0, import_log.log)("transforms", { ...transforms }), (0, import_log.log)("viewProps", { ...viewProps });
3856
- } catch {
3857
- }
3858
- console.groupEnd();
3859
- }
3860
- }
3731
+ propMapper: () => propMapper
3732
+ });
3733
+ module2.exports = __toCommonJS2(propMapper_exports);
3734
+ var import_constants = require_index_native3(), import_helpers = require_index_native4(), import_config = require_config_native(), import_isDevTools = require_isDevTools_native(), import_createVariable = require_createVariable_native(), import_expandStyle = require_expandStyle_native(), import_expandStylesAndRemoveNullishValues = require_expandStylesAndRemoveNullishValues_native(), import_getVariantExtras = require_getVariantExtras_native(), import_isObj = require_isObj_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), propMapper = (key, value, styleStateIn, subPropsIn) => {
3735
+ var _a;
3736
+ if (lastFontFamilyToken = null, !import_constants.isAndroid && key === "elevationAndroid")
3737
+ return;
3738
+ if (value === "unset") {
3739
+ let unsetVal = (_a = styleStateIn.conf.unset) == null ? void 0 : _a[key];
3740
+ if (unsetVal != null)
3741
+ value = unsetVal;
3742
+ else
3743
+ return;
3861
3744
  }
3862
- if (props.style && mergeStylePropIntoStyle(styleState, props.style), styleProps.noNormalize !== !1 && ((0, import_expandStyles.fixStyles)(style), import_constants.isWeb && !staticConfig.isReactNative && (0, import_getStylesAtomic.styleToCSS)(style), styleState.transforms && Object.entries(styleState.transforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
3863
- mergeTransform(style, key, val, !0);
3864
- }), parentSplitStyles && !shouldDoClasses))
3865
- for (let key in parentSplitStyles.style)
3866
- key in classNames || key in style || (style[key] = parentSplitStyles.style[key]);
3867
- let result = {
3868
- space,
3869
- hasMedia,
3870
- fontFamily: styleState.fontFamily,
3871
- viewProps,
3872
- // @ts-expect-error
3873
- style,
3874
- pseudos,
3875
- classNames,
3876
- rulesToInsert,
3877
- dynamicThemeAccess,
3878
- pseudoGroups,
3879
- mediaGroups
3880
- };
3881
- if (style.fontFamily) {
3882
- let faceInfo = (_e = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _e.face;
3883
- if (faceInfo) {
3884
- let overrideFace = (_g = (_f = faceInfo[style.fontWeight]) == null ? void 0 : _f[style.fontStyle || "normal"]) == null ? void 0 : _g.val;
3885
- overrideFace && (style.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style.fontWeight, delete style.fontStyle);
3745
+ let subProps = styleStateIn.styleProps.fallbackProps || subPropsIn, styleState = subProps ? new Proxy(styleStateIn, {
3746
+ get(_, k) {
3747
+ return k === "curProps" ? subProps : Reflect.get(_, k);
3886
3748
  }
3887
- process.env.NODE_ENV === "development" && debug && debug !== "profile" && (0, import_log.log)(`Found fontFamily native: ${style.fontFamily}`, faceInfo);
3749
+ }) : styleStateIn, { conf, styleProps, fontFamily, staticConfig } = styleState, { variants } = staticConfig;
3750
+ if (process.env.NODE_ENV === "development" && fontFamily && fontFamily[0] === "$" && !(fontFamily in conf.fontsParsed) && console.warn(
3751
+ `Warning: no fontFamily "${fontFamily}" found in config: ${Object.keys(
3752
+ conf.fontsParsed
3753
+ ).join(", ")}`
3754
+ ), !styleProps.noExpand && variants && key in variants) {
3755
+ styleState.curProps[key] = value;
3756
+ let variantValue = resolveVariants(key, value, styleProps, styleState, "");
3757
+ if (variantValue)
3758
+ return variantValue;
3888
3759
  }
3889
- if (className && (classNames.className = className), process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
3890
- console.groupCollapsed(" \u{1F539} ===>");
3891
- try {
3892
- let logs = {
3893
- ...result,
3894
- className,
3895
- componentState,
3896
- transforms,
3897
- viewProps,
3898
- viewPropsOrder: Object.keys(viewProps),
3899
- rulesToInsert,
3900
- parentSplitStyles
3901
- };
3902
- for (let key in logs)
3903
- (0, import_log.log)(key, logs[key]);
3904
- } catch {
3760
+ let shouldReturn = !1;
3761
+ if (styleProps.disableExpandShorthands || key in conf.shorthands && (shouldReturn = !0, key = conf.shorthands[key]), value && (value[0] === "$" ? value = getTokenForKey(key, value, styleProps.resolveValues, styleState) : (0, import_createVariable.isVariable)(value) && (value = resolveVariableValue(key, value, styleProps.resolveValues))), shouldReturn || value != null) {
3762
+ let result = (styleProps.noExpand ? null : (0, import_expandStyle.expandStyle)(key, value)) || [
3763
+ [key, value]
3764
+ ];
3765
+ return key === "fontFamily" && lastFontFamilyToken && fontFamilyCache.set(result, lastFontFamilyToken), result;
3766
+ }
3767
+ }, resolveVariants = (key, value, styleProps, styleState, parentVariantKey) => {
3768
+ let { staticConfig, conf, debug } = styleState, { variants } = staticConfig;
3769
+ if (!variants)
3770
+ return;
3771
+ let variantValue = getVariantDefinition(variants[key], value, conf);
3772
+ if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(`\u2666\uFE0F\u2666\uFE0F\u2666\uFE0F resolve variant ${key}`), console.info({
3773
+ key,
3774
+ value,
3775
+ variantValue,
3776
+ variants,
3777
+ curProps: { ...styleState.curProps }
3778
+ }), console.groupEnd()), !variantValue) {
3779
+ if (process.env.TAMAGUI_WARN_ON_MISSING_VARIANT === "1" && typeof value != "boolean") {
3780
+ let name = staticConfig.componentName || "[UnnamedComponent]";
3781
+ console.warn(
3782
+ `No variant found: ${name} has variant "${key}", but no matching value "${value}"`
3783
+ );
3905
3784
  }
3906
- console.groupEnd();
3785
+ return;
3907
3786
  }
3908
- return result;
3909
- };
3910
- function mergeStyle(styleState, key, val, disableNormalize = !1) {
3911
- let { classNames, viewProps, style, usedKeys, styleProps } = styleState;
3912
- if (import_constants.isWeb && (val == null ? void 0 : val[0]) === "_")
3913
- classNames[key] = val, usedKeys[key] ||= 1;
3914
- else if (key in import_helpers.stylePropsTransform)
3915
- styleState.transforms ||= {}, styleState.transforms[key] = val;
3916
- else {
3917
- let out = import_constants.isWeb && !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
3918
- key in import_helpers.validStylesOnBaseProps ? viewProps[key] = out : style[key] = out;
3787
+ if (typeof variantValue == "function") {
3788
+ let fn = variantValue, extras = (0, import_getVariantExtras.getVariantExtras)(styleState);
3789
+ variantValue = fn(value, extras), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(" expanded functional variant", key), console.info({ fn, variantValue, extras }), console.groupEnd());
3919
3790
  }
3920
- }
3921
- var getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
3922
- let { staticConfig, props, conf: conf2, styleProps } = styleState, styleOut = {};
3923
- for (let key in styleIn) {
3924
- let val = styleIn[key];
3925
- key = conf2.shorthands[key] || key;
3926
- let expanded = (0, import_propMapper.propMapper)(key, val, styleState, { ...props, ...props[subKey] });
3927
- if (!(!expanded || !staticConfig.isHOC && key in skipProps && !styleProps.noSkip))
3928
- for (let [skey, sval] of expanded)
3929
- !avoidMergeTransform && skey in import_helpers.stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(sval, key);
3791
+ let fontFamilyResult;
3792
+ if ((0, import_isObj.isObj)(variantValue)) {
3793
+ let fontFamilyUpdate = variantValue.fontFamily || variantValue[conf.inverseShorthands.fontFamily];
3794
+ fontFamilyUpdate && (fontFamilyResult = getFontFamilyFromNameOrVariable(fontFamilyUpdate, conf), styleState.fontFamily = fontFamilyResult, process.env.NODE_ENV === "development" && debug === "verbose" && console.info(" updating font family", fontFamilyResult)), variantValue = resolveTokensAndVariants(
3795
+ key,
3796
+ variantValue,
3797
+ styleProps,
3798
+ styleState,
3799
+ parentVariantKey
3800
+ );
3930
3801
  }
3931
- return styleProps.noNormalize || (0, import_expandStyles.fixStyles)(styleOut), styleOut;
3932
- };
3933
- function mergeStylePropIntoStyle(styleState, cur) {
3934
- if (!cur)
3935
- return;
3936
- let styles = Array.isArray(cur) ? cur : [cur];
3937
- for (let style of styles) {
3938
- if (!style)
3939
- continue;
3940
- let isRNW = style.$$css;
3941
- Object.assign(isRNW ? styleState.classNames : styleState.style, style);
3802
+ if (variantValue) {
3803
+ let expanded = (0, import_expandStylesAndRemoveNullishValues.expandStylesAndRemoveNullishValues)(
3804
+ variantValue,
3805
+ !!styleProps.noNormalize
3806
+ );
3807
+ process.env.NODE_ENV === "development" && debug === "verbose" && console.info(" expanding styles from ", variantValue, "to", expanded);
3808
+ let next = Object.entries(expanded);
3809
+ return fontFamilyResult && fontFamilyResult[0] === "$" && fontFamilyCache.set(next, (0, import_createVariable.getVariableValue)(fontFamilyResult)), next;
3942
3810
  }
3943
- }
3944
- var useInsertEffectCompat = import_constants.isWeb ? import_react3.useInsertionEffect || import_constants.useIsomorphicLayoutEffect : () => {
3945
- }, useSplitStyles = (...args) => {
3946
- let res = getSplitStyles(...args);
3947
- return useInsertEffectCompat(() => {
3948
- (0, import_insertStyleRule.insertStyleRules)(res.rulesToInsert);
3949
- }, [res.rulesToInsert]), res;
3950
- }, animatableDefaults = {
3951
- opacity: 1,
3952
- scale: 1,
3953
- rotate: "0deg",
3954
- rotateY: "0deg",
3955
- rotateX: "0deg",
3956
- x: 0,
3957
- y: 0
3958
- }, lowercaseHyphenate = (match) => `-${match.toLowerCase()}`, hyphenate = (str) => str.replace(/[A-Z]/g, lowercaseHyphenate), mergeTransform = (obj, key, val, backwards = !1) => {
3959
- typeof obj.transform != "string" && (obj.transform ||= [], obj.transform[backwards ? "unshift" : "push"]({
3960
- [mapTransformKeys[key] || key]: val
3961
- }));
3962
- }, mapTransformKeys = {
3963
- x: "translateX",
3964
- y: "translateY"
3965
- }, skipProps = {
3966
- untilMeasured: 1,
3967
- animation: 1,
3968
- space: 1,
3969
- animateOnly: 1,
3970
- disableClassName: 1,
3971
- debug: 1,
3972
- componentName: 1,
3973
- disableOptimization: 1,
3974
- tag: 1,
3975
- style: 1,
3976
- // handled after loop so pseudos set usedKeys and override it if necessary
3977
- group: 1
3978
3811
  };
3979
- process.env.NODE_ENV === "test" && (skipProps["data-test-renders"] = 1);
3980
- Object.assign(skipProps, {
3981
- whiteSpace: 1,
3982
- wordWrap: 1,
3983
- textOverflow: 1,
3984
- textDecorationDistance: 1,
3985
- cursor: 1,
3986
- contain: 1,
3987
- boxSizing: 1,
3988
- boxShadow: 1,
3989
- outlineStyle: 1,
3990
- outlineOffset: 1,
3991
- outlineWidth: 1,
3992
- outlineColor: 1
3993
- });
3994
- function passDownProp(viewProps, key, val, shouldMergeObject = !1) {
3995
- if (shouldMergeObject) {
3996
- let next = {
3997
- ...viewProps[key],
3998
- ...val
3999
- };
4000
- delete viewProps[key], viewProps[key] = next;
4001
- } else
4002
- viewProps[key] = val;
3812
+ function getFontFamilyFromNameOrVariable(input, conf) {
3813
+ if ((0, import_createVariable.isVariable)(input)) {
3814
+ let val = variableToFontNameCache.get(input);
3815
+ if (val)
3816
+ return val;
3817
+ for (let key in conf.fontsParsed) {
3818
+ let familyVariable = conf.fontsParsed[key].family;
3819
+ if ((0, import_createVariable.isVariable)(familyVariable) && (variableToFontNameCache.set(familyVariable, key), familyVariable === input))
3820
+ return key;
3821
+ }
3822
+ } else if (typeof input == "string" && input[0] === "$")
3823
+ return input;
3824
+ }
3825
+ var variableToFontNameCache = /* @__PURE__ */ new WeakMap(), fontFamilyCache = /* @__PURE__ */ new WeakMap(), getPropMappedFontFamily = (expanded) => expanded && fontFamilyCache.get(expanded), resolveTokensAndVariants = (key, value, styleProps, styleState, parentVariantKey) => {
3826
+ var _a;
3827
+ let { conf, staticConfig, debug, theme } = styleState, { variants } = staticConfig, res = {};
3828
+ process.env.NODE_ENV === "development" && debug === "verbose" && console.info(" - resolveTokensAndVariants", key, value);
3829
+ for (let _key in value) {
3830
+ let subKey = conf.shorthands[_key] || _key, val = value[_key];
3831
+ if (styleProps.noExpand)
3832
+ res[subKey] = val;
3833
+ else if (variants && subKey in variants) {
3834
+ if (styleState.curProps[subKey] = val, parentVariantKey && parentVariantKey === key)
3835
+ res[subKey] = // SYNC WITH *1
3836
+ val[0] === "$" ? getTokenForKey(subKey, val, styleProps.resolveValues, styleState) : val;
3837
+ else {
3838
+ let variantOut = resolveVariants(subKey, val, styleProps, styleState, key);
3839
+ if (variantOut)
3840
+ for (let [key2, val2] of variantOut)
3841
+ val2 != null && (key2 in import_pseudoDescriptors.pseudoDescriptors ? (res[key2] ??= {}, Object.assign(res[key2], val2)) : res[key2] = val2);
3842
+ }
3843
+ continue;
3844
+ }
3845
+ if ((0, import_createVariable.isVariable)(val)) {
3846
+ res[subKey] = resolveVariableValue(subKey, val, styleProps.resolveValues), process.env.NODE_ENV === "development" && debug === "verbose" && console.info("variable", subKey, res[subKey]);
3847
+ continue;
3848
+ }
3849
+ if (typeof val == "string") {
3850
+ let fVal = (
3851
+ // SYNC WITH *1
3852
+ val[0] === "$" ? getTokenForKey(subKey, val, styleProps.resolveValues, styleState) : val
3853
+ );
3854
+ res[subKey] = fVal;
3855
+ continue;
3856
+ }
3857
+ if ((0, import_isObj.isObj)(val)) {
3858
+ let subObject = resolveTokensAndVariants(subKey, val, styleProps, styleState, key);
3859
+ process.env.NODE_ENV === "development" && debug === "verbose" && console.info("object", subKey, subObject), res[subKey] ??= {}, Object.assign(res[subKey], subObject);
3860
+ } else
3861
+ res[subKey] = val;
3862
+ process.env.NODE_ENV === "development" && debug && ((_a = res[subKey]) == null ? void 0 : _a[0]) === "$" && console.warn(
3863
+ `\u26A0\uFE0F Missing token in theme ${theme.name}:`,
3864
+ subKey,
3865
+ res[subKey],
3866
+ theme
3867
+ );
3868
+ }
3869
+ return res;
3870
+ }, tokenCats = ["size", "color", "radius", "space", "zIndex"].map((name) => ({
3871
+ name,
3872
+ spreadName: `...${name}`
3873
+ }));
3874
+ function getVariantDefinition(variant, value, conf) {
3875
+ if (typeof variant == "function")
3876
+ return variant;
3877
+ let exact = variant[value];
3878
+ if (exact)
3879
+ return exact;
3880
+ if (value != null) {
3881
+ let { tokensParsed } = conf;
3882
+ for (let { name, spreadName } of tokenCats)
3883
+ if (spreadName in variant && value in tokensParsed[name])
3884
+ return variant[spreadName];
3885
+ let fontSizeVariant = variant["...fontSize"];
3886
+ if (fontSizeVariant && conf.fontSizeTokens.has(value))
3887
+ return fontSizeVariant;
3888
+ }
3889
+ return variant[`:${typeof value}`] || variant["..."];
4003
3890
  }
4004
- }
4005
- });
4006
-
4007
- // ../web/dist/cjs/helpers/mergeProps.native.js
4008
- var require_mergeProps_native = __commonJS({
4009
- "../web/dist/cjs/helpers/mergeProps.native.js"(exports2, module2) {
4010
- "use strict";
4011
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4012
- for (var name in all)
4013
- __defProp2(target, name, { get: all[name], enumerable: !0 });
4014
- }, __copyProps2 = (to, from, except, desc) => {
4015
- if (from && typeof from == "object" || typeof from == "function")
4016
- for (let key of __getOwnPropNames2(from))
4017
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4018
- return to;
4019
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), mergeProps_exports = {};
4020
- __export2(mergeProps_exports, {
4021
- mergeProps: () => mergeProps
4022
- });
4023
- module2.exports = __toCommonJS2(mergeProps_exports);
4024
- var import_useMedia = require_useMedia_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), mergeProps = (a, b, inverseShorthands) => {
4025
- let out = {};
4026
- for (let key in a)
4027
- mergeProp(out, a, b, key, inverseShorthands);
4028
- if (b)
4029
- for (let key in b)
4030
- mergeProp(out, b, void 0, key, inverseShorthands);
4031
- return out;
3891
+ var fontShorthand = {
3892
+ fontSize: "size",
3893
+ fontWeight: "weight"
3894
+ }, lastFontFamilyToken = null, getTokenForKey = (key, value, resolveAs = "none", styleState) => {
3895
+ var _a, _b, _c, _d;
3896
+ if (resolveAs === "none")
3897
+ return value;
3898
+ let { theme, conf = (0, import_config.getConfig)(), context, fontFamily, staticConfig } = styleState, tokensParsed = conf.tokensParsed, valOrVar, hasSet = !1;
3899
+ if (theme && value in theme)
3900
+ valOrVar = theme[value], process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(` - resolving ${key} to theme value ${value}: ${(_a = valOrVar == null ? void 0 : valOrVar.get) == null ? void 0 : _a.call(valOrVar)}`), hasSet = !0;
3901
+ else if (value in conf.specificTokens)
3902
+ hasSet = !0, valOrVar = conf.specificTokens[value];
3903
+ else {
3904
+ let customTokenAccept = (_b = staticConfig == null ? void 0 : staticConfig.acceptTokens) == null ? void 0 : _b[key];
3905
+ if (customTokenAccept) {
3906
+ let val = tokensParsed[customTokenAccept][value];
3907
+ val && (valOrVar = val, hasSet = !0);
3908
+ } else {
3909
+ switch (key) {
3910
+ case "fontFamily": {
3911
+ valOrVar = ((_c = (context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed)[value]) == null ? void 0 : _c.family) || value, lastFontFamilyToken = value, hasSet = !0;
3912
+ break;
3913
+ }
3914
+ case "fontSize":
3915
+ case "lineHeight":
3916
+ case "letterSpacing":
3917
+ case "fontWeight": {
3918
+ let defaultFont = conf.defaultFont || "$body", fam = fontFamily || defaultFont;
3919
+ if (fam) {
3920
+ let fontsParsed = context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed, font = fontsParsed[fam] || fontsParsed[defaultFont];
3921
+ valOrVar = ((_d = font == null ? void 0 : font[fontShorthand[key] || key]) == null ? void 0 : _d[value]) || value, hasSet = !0;
3922
+ }
3923
+ break;
3924
+ }
3925
+ }
3926
+ for (let cat in import_helpers.tokenCategories)
3927
+ if (key in import_helpers.tokenCategories[cat]) {
3928
+ let res = tokensParsed[cat][value];
3929
+ res != null && (valOrVar = res, hasSet = !0);
3930
+ }
3931
+ }
3932
+ if (!hasSet) {
3933
+ let spaceVar = tokensParsed.space[value];
3934
+ spaceVar != null && (valOrVar = spaceVar, hasSet = !0);
3935
+ }
3936
+ }
3937
+ if (hasSet) {
3938
+ let out = resolveVariableValue(key, valOrVar, resolveAs);
3939
+ return process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info("resolved", resolveAs, valOrVar, out), out;
3940
+ }
3941
+ return process.env.NODE_ENV === "development" && import_isDevTools.isDevTools && styleState.debug === "verbose" && (console.groupCollapsed(" \uFE52 propMap (val)", key, value), console.info({ valOrVar, theme, hasSet }, theme ? theme[key] : ""), console.groupEnd()), value;
4032
3942
  };
4033
- function mergeProp(out, a, b, key, inverseShorthands) {
4034
- let longhand = (inverseShorthands == null ? void 0 : inverseShorthands[key]) || null, val = a[key];
4035
- if (key in import_pseudoDescriptors.pseudoDescriptors || import_useMedia.mediaKeys.has(key)) {
4036
- out[key] = {
4037
- ...out[key],
4038
- ...val
4039
- };
4040
- return;
3943
+ function resolveVariableValue(key, valOrVar, resolveValues) {
3944
+ if (resolveValues === "none")
3945
+ return valOrVar;
3946
+ if ((0, import_createVariable.isVariable)(valOrVar)) {
3947
+ if (resolveValues === "value")
3948
+ return valOrVar.val;
3949
+ let get = valOrVar == null ? void 0 : valOrVar.get;
3950
+ return key !== "shadowColor" && typeof get == "function" ? get(resolveValues === "web" ? "web" : void 0) : valOrVar.val;
4041
3951
  }
4042
- b && (key in b || longhand && longhand in b) || (out[longhand || key] = val);
3952
+ return valOrVar;
4043
3953
  }
4044
3954
  }
4045
3955
  });
4046
3956
 
4047
- // ../web/dist/cjs/helpers/ThemeManagerContext.native.js
4048
- var require_ThemeManagerContext_native = __commonJS({
4049
- "../web/dist/cjs/helpers/ThemeManagerContext.native.js"(exports2, module2) {
4050
- "use strict";
4051
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4052
- for (var name in all)
4053
- __defProp2(target, name, { get: all[name], enumerable: !0 });
4054
- }, __copyProps2 = (to, from, except, desc) => {
4055
- if (from && typeof from == "object" || typeof from == "function")
4056
- for (let key of __getOwnPropNames2(from))
4057
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4058
- return to;
4059
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManagerContext_exports = {};
4060
- __export2(ThemeManagerContext_exports, {
4061
- ThemeManagerIDContext: () => ThemeManagerIDContext
4062
- });
4063
- module2.exports = __toCommonJS2(ThemeManagerContext_exports);
4064
- var import_react3 = require("react"), ThemeManagerIDContext = (0, import_react3.createContext)(1);
4065
- }
4066
- });
4067
-
4068
- // ../web/dist/cjs/helpers/ThemeManager.native.js
4069
- var require_ThemeManager_native = __commonJS({
4070
- "../web/dist/cjs/helpers/ThemeManager.native.js"(exports2, module2) {
3957
+ // ../web/dist/cjs/helpers/getSplitStyles.native.js
3958
+ var require_getSplitStyles_native = __commonJS({
3959
+ "../web/dist/cjs/helpers/getSplitStyles.native.js"(exports2, module2) {
4071
3960
  "use strict";
4072
3961
  var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4073
3962
  for (var name in all)
@@ -4077,404 +3966,522 @@ var require_ThemeManager_native = __commonJS({
4077
3966
  for (let key of __getOwnPropNames2(from))
4078
3967
  !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4079
3968
  return to;
4080
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManager_exports = {};
4081
- __export2(ThemeManager_exports, {
4082
- ThemeManager: () => ThemeManager,
4083
- getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
4084
- getManagers: () => getManagers
3969
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getSplitStyles_exports = {};
3970
+ __export2(getSplitStyles_exports, {
3971
+ PROP_SPLIT: () => PROP_SPLIT,
3972
+ getSplitStyles: () => getSplitStyles,
3973
+ getSubStyle: () => getSubStyle,
3974
+ useSplitStyles: () => useSplitStyles
4085
3975
  });
4086
- module2.exports = __toCommonJS2(ThemeManager_exports);
4087
- var import_constants = require_index_native3(), import_config = require_config_native(), import_constants2 = require_constants_native2(), emptyState = { name: "" };
4088
- function getHasThemeUpdatingProps(props) {
4089
- return !!(props.name || props.componentName || props.inverse || props.reset);
3976
+ module2.exports = __toCommonJS2(getSplitStyles_exports);
3977
+ var import_constants = require_index_native3(), import_helpers = require_index_native4(), import_react3 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_constants2 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_log = require_log_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-";
3978
+ function isValidStyleKey(key, staticConfig) {
3979
+ let validStyleProps = staticConfig.validStyles ?? (staticConfig.isText ? import_helpers.stylePropsText : import_helpers.validStyles);
3980
+ return key in validStyleProps || staticConfig.acceptTokens && key in staticConfig.acceptTokens;
4090
3981
  }
4091
- var uid = 0, ThemeManager = class {
4092
- constructor(props = {}, parentManager) {
4093
- if (this.props = props, this.id = 0, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this._allKeys = null, uid = (uid + 1) % Number.MAX_VALUE, this.id = uid, parentManager === "root") {
4094
- this.updateStateFromProps(props, !1);
4095
- return;
4096
- }
4097
- if (!parentManager)
4098
- throw process.env.NODE_ENV !== "production" ? new Error(
4099
- "No parent manager given, this is likely due to duplicated Tamagui dependencies. Check your lockfile for mis-matched versions. It could also be from an error somewhere else in your stack causing Tamagui to recieve undefined context, you can try putting some ErrorBoundary components around other areas of your app, or a Suspense boundary."
4100
- ) : "\u274C 000";
4101
- if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
4102
- return parentManager;
4103
- }
4104
- updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
4105
- if (this.props = props, props.forceTheme)
4106
- return this.state.theme = props.forceTheme, this.state.name = props.name || "", this.updateState(this.state, !0), this.state;
4107
- let nextState = this.getStateIfChanged(props);
4108
- if (nextState)
4109
- return this.updateState(nextState, shouldNotify), nextState;
4110
- }
4111
- updateState(nextState, shouldNotify = !0) {
4112
- this.state = nextState, this._allKeys = null, process.env.NODE_ENV !== "production" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && this.notify();
4113
- }
4114
- getStateIfChanged(props = this.props, state = this.state, parentManager = this.parentManager) {
4115
- let _ = this.getState(props, parentManager);
4116
- if (state && state !== emptyState && !_)
4117
- return parentManager == null ? void 0 : parentManager.state;
4118
- if (this.getStateShouldChange(_, state))
4119
- return _;
4120
- }
4121
- getStateShouldChange(nextState, state = this.state) {
4122
- return !(!(nextState != null && nextState.theme) || nextState.theme === (state == null ? void 0 : state.theme));
4123
- }
4124
- getState(props = this.props, parentManager = this.parentManager) {
4125
- return getState(props, parentManager) || (parentManager == null ? void 0 : parentManager.state) || null;
4126
- }
4127
- get allKeys() {
4128
- var _a;
4129
- return this._allKeys ||= /* @__PURE__ */ new Set([
4130
- ...((_a = this.parentManager) == null ? void 0 : _a.allKeys) || [],
4131
- ...Object.keys(this.state.theme || {})
4132
- ]), this._allKeys;
4133
- }
4134
- notify(forced = !1) {
4135
- this.themeListeners.forEach((cb) => cb(this.state.name, this, forced));
4136
- }
4137
- onChangeTheme(cb, debugId) {
4138
- return process.env.NODE_ENV !== "production" && debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
4139
- this.themeListeners.delete(cb);
4140
- };
4141
- }
4142
- };
4143
- function getState(props, manager) {
4144
- var _a;
4145
- if (props.name && props.reset)
4146
- throw new Error(
4147
- process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time."
4148
- );
4149
- if (!getHasThemeUpdatingProps(props))
4150
- return null;
4151
- let themes = (0, import_config.getThemes)(), [allManagers, componentManagers] = getManagers(manager), isDirectParentAComponentTheme = !!(manager != null && manager.state.isComponent), startIndex = props.reset && !isDirectParentAComponentTheme ? 1 : 0, baseManager = allManagers[startIndex], parentManager = allManagers[startIndex + 1];
4152
- if (!baseManager && props.reset)
4153
- return process.env.NODE_ENV !== "production" && console.warn("Cannot reset, no parent theme exists"), null;
4154
- let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
4155
- baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][A-Za-z]+/, ""));
4156
- let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
4157
- isDirectParentAComponentTheme && allComponentThemes.shift();
4158
- let base = baseName.split(import_constants2.THEME_NAME_SEPARATOR), max = base.length, min = props.componentName && !nextName ? max : 0;
4159
- for (let i = max; i >= min; i--) {
4160
- let prefix = base.slice(0, i).join(import_constants2.THEME_NAME_SEPARATOR);
4161
- props.inverse && (prefix = inverseThemeName(prefix));
4162
- let potentials = [];
4163
- if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
4164
- let lastSegment = potentials.findIndex((x) => !x.includes("_"));
4165
- lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
3982
+ var getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3983
+ var _a, _b, _c, _e, _f, _g;
3984
+ conf = conf || (0, import_config.getConfig)(), import_constants.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
3985
+ let { shorthands } = conf, {
3986
+ isHOC,
3987
+ isText,
3988
+ variants,
3989
+ isReactNative,
3990
+ inlineProps,
3991
+ inlineWhenUnflattened,
3992
+ parentStaticConfig,
3993
+ acceptsClassName
3994
+ } = staticConfig, viewProps = {}, mediaState2 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClassNames, rulesToInsert = [], classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, style = {}, className = props.className ?? "", mediaStylesSeen = 0, styleState = {
3995
+ curProps: { ...props },
3996
+ classNames,
3997
+ conf,
3998
+ props,
3999
+ styleProps,
4000
+ componentState,
4001
+ staticConfig,
4002
+ style,
4003
+ theme,
4004
+ usedKeys,
4005
+ viewProps,
4006
+ context,
4007
+ debug
4008
+ };
4009
+ process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants.isClient && (console.groupCollapsed("getSplitStyles (collapsed)"), (0, import_log.log)({
4010
+ props,
4011
+ staticConfig,
4012
+ shouldDoClasses,
4013
+ styleProps,
4014
+ componentState,
4015
+ styleState,
4016
+ theme: { ...theme }
4017
+ }), console.groupEnd());
4018
+ for (let keyOg in props) {
4019
+ let keyInit = keyOg, valInit = props[keyOg];
4020
+ if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !styleProps.noSkip && !isHOC)
4021
+ continue;
4022
+ let valInitType = typeof valInit, isValidStyleKeyInit = isValidStyleKey(keyInit, staticConfig);
4023
+ if (styleState.curProps[keyInit] = valInit, !import_constants.isAndroid && keyInit === "elevationAndroid")
4024
+ continue;
4025
+ if (keyInit === "userSelect")
4026
+ keyInit = "selectable", valInit = valInit !== "none";
4027
+ else if (keyInit === "role") {
4028
+ viewProps.accessibilityRole = import_accessibilityDirectMap.accessibilityWebRoleToNativeRole[valInit];
4029
+ continue;
4030
+ } else if (keyInit.startsWith("aria-")) {
4031
+ if (import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit]) {
4032
+ let nativeA11yProp = import_accessibilityDirectMap.webToNativeAccessibilityDirectMap[keyInit];
4033
+ keyInit === "aria-hidden" && (viewProps["aria-hidden"] = valInit), viewProps[nativeA11yProp] = valInit;
4034
+ continue;
4035
+ }
4036
+ if (import_accessibilityDirectMap.nativeAccessibilityValue[keyInit]) {
4037
+ let field = import_accessibilityDirectMap.nativeAccessibilityValue[keyInit];
4038
+ viewProps.accessibilityValue ? viewProps.accessibilityValue[field] = valInit : viewProps.accessibilityValue = {
4039
+ [field]: valInit
4040
+ };
4041
+ } else if (import_accessibilityDirectMap.nativeAccessibilityState[keyInit]) {
4042
+ let field = import_accessibilityDirectMap.nativeAccessibilityState[keyInit];
4043
+ viewProps.accessibilityState ? viewProps.accessibilityState[field] = valInit : viewProps.accessibilityState = {
4044
+ [field]: valInit
4045
+ };
4046
+ }
4047
+ continue;
4048
+ } else if (keyInit.startsWith("data-"))
4049
+ continue;
4050
+ if (keyInit === "dataSet") {
4051
+ for (let keyInit2 in valInit)
4052
+ viewProps[`data-${hyphenate(keyInit2)}`] = valInit[keyInit2];
4053
+ continue;
4166
4054
  }
4167
- if (componentName && !props.reset) {
4168
- let baseLen = base.length, componentPotentials = [];
4169
- if (nextName && baseLen > 1) {
4170
- let beforeSeparator = base[0];
4171
- componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
4055
+ if (keyInit[0] === "_" && keyInit.startsWith("_style")) {
4056
+ mergeStylePropIntoStyle(styleState, valInit);
4057
+ continue;
4058
+ }
4059
+ if (0)
4060
+ switch (keyInit) {
4061
+ case "accessibilityRole":
4062
+ case "accessibilityLabelledBy":
4063
+ case "accessibilityFlowTo":
4064
+ case "accessibilityControls":
4065
+ case "accessibilityDescribedBy":
4066
+ case "accessibilityKeyShortcuts":
4067
+ case "accessibilityLiveRegion":
4068
+ case "accessibilityReadOnly":
4069
+ case "accessibilityRequired":
4070
+ default:
4172
4071
  }
4173
- if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
4174
- if (i > baseLen) {
4175
- let prefixLessOne = base.slice(0, i - 1).join(import_constants2.THEME_NAME_SEPARATOR);
4176
- if (prefixLessOne) {
4177
- let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
4178
- componentPotentials.unshift(lessSpecific);
4072
+ let isShorthand = keyInit in shorthands, isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant, isPseudo = keyInit in import_helpers.validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo && (0, import_useMedia.isMediaKey)(keyInit), isMediaOrPseudo = !!(isMedia || isPseudo), isStyleProp = isMediaOrPseudo || isVariant && !styleProps.noExpand || isValidStyleKeyInit || isShorthand;
4073
+ if (isStyleProp && (props.asChild === "except-style" || props.asChild === "except-style-web"))
4074
+ continue;
4075
+ let shouldPassProp = !isStyleProp || // is in parent variants
4076
+ isHOC && (parentStaticConfig == null ? void 0 : parentStaticConfig.variants) && keyInit in parentStaticConfig.variants || (inlineProps == null ? void 0 : inlineProps.has(keyInit)), parentVariant = (_a = parentStaticConfig == null ? void 0 : parentStaticConfig.variants) == null ? void 0 : _a[keyInit], isHOCShouldPassThrough = !!(isHOC && (isShorthand || isValidStyleKeyInit || isMediaOrPseudo || parentVariant || keyInit in skipProps)), shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
4077
+ if (process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(
4078
+ `\u{1F539}\u{1F539}\u{1F539}\u{1F539} ${keyOg}${keyInit !== keyOg ? ` (shorthand for ${keyInit})` : ""} ${shouldPassThrough ? "(pass)" : ""} \u{1F539}\u{1F539}\u{1F539}\u{1F539}`
4079
+ ), (0, import_log.log)({ isVariant, valInit, shouldPassProp }), import_constants.isClient && (0, import_log.log)({
4080
+ variants,
4081
+ variant: variants == null ? void 0 : variants[keyInit],
4082
+ isVariant,
4083
+ isHOCShouldPassThrough,
4084
+ curProps: { ...styleState.curProps },
4085
+ parentStaticConfig
4086
+ }), console.groupEnd()), shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || !styleProps.noSkip && keyInit in skipProps)
4087
+ continue;
4088
+ if (isText && valInit && (keyInit === "fontFamily" || keyInit === shorthands.fontFamily) && valInit in conf.fontsParsed && (styleState.fontFamily = valInit), isValidStyleKeyInit && !variants && valInit !== "unset" && (valInitType === "number" || valInitType === "string" && valInit[0] !== "$")) {
4089
+ style[keyInit] = valInit;
4090
+ continue;
4091
+ }
4092
+ let expanded = isMediaOrPseudo || !isVariant && !isValidStyleKeyInit ? [[keyInit, valInit]] : (0, import_propMapper.propMapper)(keyInit, valInit, styleState), next = (0, import_propMapper.getPropMappedFontFamily)(expanded);
4093
+ if (next && (styleState.fontFamily = next), process.env.NODE_ENV === "development" && debug === "verbose") {
4094
+ console.groupCollapsed(" \u{1F4A0} expanded", keyInit, valInit);
4095
+ try {
4096
+ !import_constants.isServer && import_isDevTools.isDevTools && ((0, import_log.log)({
4097
+ expanded,
4098
+ styleProps,
4099
+ componentState,
4100
+ isVariant,
4101
+ variant: variants == null ? void 0 : variants[keyInit],
4102
+ shouldPassProp,
4103
+ isHOCShouldPassThrough,
4104
+ theme,
4105
+ usedKeys: { ...usedKeys },
4106
+ curProps: { ...styleState.curProps }
4107
+ }), (0, import_log.log)("expanded", expanded, `
4108
+ usedKeys`, { ...usedKeys }, `
4109
+ current`, {
4110
+ ...style
4111
+ }));
4112
+ } catch {
4113
+ }
4114
+ console.groupEnd();
4115
+ }
4116
+ if (expanded) {
4117
+ for (let [key, val] of expanded)
4118
+ if (!(val == null || key in usedKeys)) {
4119
+ if (isPseudo = key in import_helpers.validPseudoKeys, isMedia = !isPseudo && !isValidStyleKeyInit && (0, import_useMedia.isMediaKey)(key), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key in variants, (inlineProps != null && inlineProps.has(key) || IS_STATIC && inlineWhenUnflattened != null && inlineWhenUnflattened.has(key)) && (viewProps[key] = props[key] ?? val), styleProps.noExpand && isPseudo || isHOC && (isMediaOrPseudo || ((_b = parentStaticConfig == null ? void 0 : parentStaticConfig.variants) == null ? void 0 : _b[keyInit]))) {
4120
+ passDownProp(viewProps, key, val, isMediaOrPseudo), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed(` - passing down prop ${key}`), (0, import_log.log)({ val, after: { ...viewProps[key] } }), console.groupEnd());
4121
+ continue;
4122
+ }
4123
+ if (isPseudo) {
4124
+ if (!val)
4125
+ continue;
4126
+ let pseudoStyleObject = getSubStyle(
4127
+ styleState,
4128
+ key,
4129
+ val,
4130
+ styleProps.noClassNames
4131
+ ), descriptor = import_pseudoDescriptors.pseudoDescriptors[key], isEnter = key === "enterStyle", isExit = key === "exitStyle";
4132
+ if (!descriptor || isExit && !styleProps.isExiting)
4133
+ continue;
4134
+ if ((!shouldDoClasses || IS_STATIC) && (pseudos ||= {}, pseudos[key] ||= {}, IS_STATIC)) {
4135
+ Object.assign(pseudos[key], pseudoStyleObject);
4136
+ continue;
4137
+ }
4138
+ if (shouldDoClasses && !isExit) {
4139
+ let pseudoStyles = (0, import_getStylesAtomic.generateAtomicStyles)(pseudoStyleObject, descriptor);
4140
+ process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed("pseudo (classes)", key), (0, import_log.log)({ pseudoStyleObject, pseudoStyles }), console.groupEnd());
4141
+ for (let psuedoStyle of pseudoStyles)
4142
+ `${psuedoStyle.property}${PROP_SPLIT}${descriptor.name}` in usedKeys || psuedoStyle.identifier;
4143
+ }
4144
+ if (!shouldDoClasses || isExit || isEnter) {
4145
+ let descriptorKey = descriptor.stateKey || descriptor.name, isDisabled = componentState[descriptorKey] === !1;
4146
+ isExit && (isDisabled = !styleProps.isExiting), isEnter && (isDisabled = componentState.unmounted === "should-enter" ? !0 : !componentState.unmounted), process.env.NODE_ENV === "development" && debug === "verbose" && (console.groupCollapsed("pseudo", key, { isDisabled }), (0, import_log.log)({ pseudoStyleObject, isDisabled, descriptor, componentState }), console.groupEnd());
4147
+ let importance = descriptor.priority;
4148
+ for (let pkey in pseudoStyleObject) {
4149
+ let val2 = pseudoStyleObject[pkey];
4150
+ if (isDisabled) {
4151
+ if (pkey in animatableDefaults && !(pkey in usedKeys)) {
4152
+ let defaultVal = animatableDefaults[pkey];
4153
+ mergeStyle(styleState, pkey, defaultVal);
4154
+ }
4155
+ } else {
4156
+ let curImportance = usedKeys[pkey] || 0, shouldMerge = importance >= curImportance;
4157
+ shouldMerge && (pseudos ||= {}, pseudos[key] ||= {}, pseudos[key][pkey] = val2, mergeStyle(styleState, pkey, val2)), process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(" subKey", pkey, shouldMerge, {
4158
+ importance,
4159
+ curImportance,
4160
+ pkey,
4161
+ val: val2,
4162
+ transforms: { ...styleState.transforms }
4163
+ });
4164
+ }
4165
+ }
4166
+ if (!isDisabled)
4167
+ for (let key2 in val) {
4168
+ let k = shorthands[key2] || key2;
4169
+ usedKeys[k] = Math.max(importance, usedKeys[k] || 0);
4170
+ }
4171
+ }
4172
+ continue;
4173
+ }
4174
+ if (isMedia) {
4175
+ if (!val)
4176
+ continue;
4177
+ if (isMedia === "platform") {
4178
+ let platform = key.slice(10);
4179
+ if (
4180
+ // supports web, ios, android
4181
+ platform !== import_constants.currentPlatform && // supports web, native
4182
+ platform !== "native"
4183
+ )
4184
+ continue;
4185
+ }
4186
+ hasMedia ||= !0;
4187
+ let mediaStyle = getSubStyle(
4188
+ styleState,
4189
+ key,
4190
+ val,
4191
+ // TODO try true like pseudo
4192
+ !1
4193
+ ), mediaKeyShort = key.slice(1);
4194
+ process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(` \u{1F4FA} ${key}`, {
4195
+ key,
4196
+ val,
4197
+ mediaStyle,
4198
+ props,
4199
+ shouldDoClasses,
4200
+ componentState
4201
+ });
4202
+ let hasSpace = val.space;
4203
+ if ((hasSpace || !shouldDoClasses) && (Array.isArray(hasMedia) || (hasMedia = []), hasMedia.push(mediaKeyShort)), shouldDoClasses) {
4204
+ if (hasSpace && (delete mediaStyle.space, mediaState2[mediaKeyShort])) {
4205
+ let importance = (0, import_useMedia.getMediaImportanceIfMoreImportant)(
4206
+ mediaKeyShort,
4207
+ "space",
4208
+ usedKeys,
4209
+ !0
4210
+ );
4211
+ importance && (space = val.space, usedKeys.space = importance, process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(
4212
+ `Found more important space for current media ${mediaKeyShort}: ${val} (importance: ${importance})`
4213
+ ));
4214
+ }
4215
+ let mediaStyles = (0, import_getStylesAtomic.getStylesAtomic)(mediaStyle, debug), priority = mediaStylesSeen;
4216
+ mediaStylesSeen += 1;
4217
+ for (let style2 of mediaStyles) {
4218
+ let out = (0, import_createMediaStyle.createMediaStyle)(
4219
+ style2,
4220
+ mediaKeyShort,
4221
+ import_useMedia.mediaQueryConfig,
4222
+ isMedia,
4223
+ !1,
4224
+ priority
4225
+ );
4226
+ process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out), `${style2.property}${PROP_SPLIT}${mediaKeyShort}` in usedKeys || out.identifier;
4227
+ }
4228
+ } else {
4229
+ let isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group";
4230
+ if (!isThemeMedia && isMedia !== "platform" && !isGroupMedia && !mediaState2[mediaKeyShort])
4231
+ continue;
4232
+ let importanceBump = 0;
4233
+ if (isThemeMedia) {
4234
+ dynamicThemeAccess = !0;
4235
+ let mediaThemeName = mediaKeyShort.slice(6);
4236
+ if (!(themeName === mediaThemeName || themeName.startsWith(mediaThemeName)))
4237
+ continue;
4238
+ } else if (isGroupMedia) {
4239
+ let groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyShort), groupName = groupInfo.name, groupContext = context == null ? void 0 : context.groups.state[groupName];
4240
+ if (!groupContext) {
4241
+ process.env.NODE_ENV === "development" && debug && console.warn(`No parent with group prop, skipping styles: ${groupName}`);
4242
+ continue;
4243
+ }
4244
+ let groupPseudoKey = groupInfo.pseudo, groupMediaKey = groupInfo.media, componentGroupState = (_c = componentState.group) == null ? void 0 : _c[groupName];
4245
+ if (groupMediaKey) {
4246
+ mediaGroups ||= /* @__PURE__ */ new Set(), mediaGroups.add(groupMediaKey);
4247
+ let mediaState22 = componentGroupState == null ? void 0 : componentGroupState.media, isActive = mediaState22 == null ? void 0 : mediaState22[groupMediaKey];
4248
+ if (!mediaState22 && groupContext.layout && (isActive = (0, import_useMedia.mediaKeyMatch)(groupMediaKey, groupContext.layout)), !isActive)
4249
+ continue;
4250
+ importanceBump = 2;
4251
+ }
4252
+ if (groupPseudoKey) {
4253
+ pseudoGroups ||= /* @__PURE__ */ new Set(), pseudoGroups.add(groupName);
4254
+ let componentGroupPseudoState = (componentGroupState || // fallback to context initially
4255
+ context.groups.state[groupName]).pseudo;
4256
+ if (!(componentGroupPseudoState != null && componentGroupPseudoState[groupPseudoKey]))
4257
+ continue;
4258
+ importanceBump = import_pseudoDescriptors.pseudoPriorities[groupPseudoKey];
4259
+ }
4260
+ }
4261
+ for (let subKey in mediaStyle) {
4262
+ if (subKey === "space") {
4263
+ space = valInit.space;
4264
+ continue;
4265
+ }
4266
+ (0, import_useMedia.mergeMediaByImportance)(
4267
+ style,
4268
+ mediaKeyShort,
4269
+ subKey,
4270
+ mediaStyle[subKey],
4271
+ usedKeys,
4272
+ mediaState2[mediaKeyShort],
4273
+ importanceBump
4274
+ ), key === "fontFamily" && (styleState.fontFamily = mediaStyle.fontFamily);
4275
+ }
4276
+ }
4277
+ continue;
4278
+ }
4279
+ if (key === "pointerEvents") {
4280
+ viewProps[key] = val;
4281
+ continue;
4282
+ }
4283
+ if (
4284
+ // is HOC we can just pass through the styles as props
4285
+ // this fixes issues where style prop got merged with wrong priority
4286
+ !isHOC && (isValidStyleKey(key, staticConfig) || import_constants.isAndroid && key === "elevation")
4287
+ ) {
4288
+ mergeStyle(styleState, key, val);
4289
+ continue;
4179
4290
  }
4291
+ isVariant || (viewProps[key] = val);
4180
4292
  }
4181
- let moreSpecific = `${prefix}_${nextName}_${componentName}`;
4182
- componentPotentials.unshift(moreSpecific);
4293
+ if (process.env.NODE_ENV === "development" && debug === "verbose") {
4294
+ console.groupCollapsed(" \u2714\uFE0F expand complete", keyInit);
4295
+ try {
4296
+ (0, import_log.log)("style", { ...style }), (0, import_log.log)("transforms", { ...transforms }), (0, import_log.log)("viewProps", { ...viewProps });
4297
+ } catch {
4298
+ }
4299
+ console.groupEnd();
4183
4300
  }
4184
- potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
4185
- }
4186
- let found = potentials.find((t) => t in themes);
4187
- if (process.env.NODE_ENV !== "production" && typeof props.debug == "string" && console.info(" getState ", {
4188
- props,
4189
- found,
4190
- potentials,
4191
- baseManager,
4192
- nextName,
4193
- baseName,
4194
- prefix
4195
- }), found) {
4196
- let names = found.split("_"), [firstName, ...restNames] = names, lastName = names[names.length - 1], isComponent = lastName[0] === lastName[0].toUpperCase(), scheme = firstName === "light" ? "light" : firstName === "dark" ? "dark" : void 0, pre = import_constants2.THEME_CLASSNAME_PREFIX, className = import_constants.isWeb ? `${pre}sub_theme ${pre}${!scheme || !restNames.length ? firstName : restNames.join("_")}` : "", parentState = (_a = baseManager || parentManager) == null ? void 0 : _a.state, parentName = parentState == null ? void 0 : parentState.name;
4197
- result = {
4198
- name: found,
4199
- parentName,
4200
- theme: themes[found],
4201
- className,
4202
- isComponent,
4203
- scheme
4204
- };
4205
- break;
4206
4301
  }
4207
4302
  }
4208
- return process.env.NODE_ENV !== "production" && props.debug === "verbose" && typeof window < "u" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min, max }), console.warn("result", { result }), console.trace(), console.groupEnd()), result;
4209
- }
4210
- var inverseThemeName = (themeName) => themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
4211
- function getManagers(themeManager) {
4212
- let comp = [], all = [], cur = themeManager;
4213
- for (; cur; )
4214
- all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
4215
- return [all, comp];
4216
- }
4217
- }
4218
- });
4219
-
4220
- // ../web/dist/cjs/hooks/useTheme.native.js
4221
- var require_useTheme_native = __commonJS({
4222
- "../web/dist/cjs/hooks/useTheme.native.js"(exports2, module2) {
4223
- "use strict";
4224
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4225
- for (var name in all)
4226
- __defProp2(target, name, { get: all[name], enumerable: !0 });
4227
- }, __copyProps2 = (to, from, except, desc) => {
4228
- if (from && typeof from == "object" || typeof from == "function")
4229
- for (let key of __getOwnPropNames2(from))
4230
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4231
- return to;
4232
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), useTheme_exports = {};
4233
- __export2(useTheme_exports, {
4234
- activeThemeManagers: () => activeThemeManagers,
4235
- getThemeManager: () => getThemeManager,
4236
- getThemeProxied: () => getThemeProxied,
4237
- useChangeThemeEffect: () => useChangeThemeEffect,
4238
- useTheme: () => useTheme,
4239
- useThemeWithState: () => useThemeWithState
4240
- });
4241
- module2.exports = __toCommonJS2(useTheme_exports);
4242
- var import_constants = require_index_native3(), import_react3 = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), emptyProps = { name: null }, cached;
4243
- function getDefaultThemeProxied() {
4244
- if (cached)
4245
- return cached;
4246
- let config = (0, import_config.getConfig)(), name = config.themes.light ? "light" : Object.keys(config.themes)[0], defaultTheme = config.themes[name];
4247
- return cached = getThemeProxied({ theme: defaultTheme, name }), cached;
4248
- }
4249
- var useTheme = (props = emptyProps) => {
4250
- let [_, theme] = useThemeWithState(props);
4251
- return theme || getDefaultThemeProxied();
4252
- }, useThemeWithState = (props) => {
4253
- let keys = (0, import_react3.useRef)([]), changedThemeState = useChangeThemeEffect(
4254
- props,
4255
- !1,
4256
- keys.current,
4257
- import_constants.isServer ? void 0 : () => {
4258
- var _a, _b;
4259
- let next = ((_a = props.shouldUpdate) == null ? void 0 : _a.call(props)) ?? (keys.current.length > 0 ? !0 : void 0);
4260
- return process.env.NODE_ENV === "development" && typeof props.debug == "string" && props.debug !== "profile" && console.info(" \u{1F3A8} useTheme() shouldUpdate?", next, {
4261
- shouldUpdateProp: (_b = props.shouldUpdate) == null ? void 0 : _b.call(props),
4262
- keys: [...keys.current]
4263
- }), next;
4303
+ if (props.style && mergeStylePropIntoStyle(styleState, props.style), styleProps.noNormalize !== !1 && ((0, import_expandStyles.fixStyles)(style), import_constants.isWeb && !staticConfig.isReactNative && (0, import_getStylesAtomic.styleToCSS)(style), styleState.transforms && Object.entries(styleState.transforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
4304
+ mergeTransform(style, key, val, !0);
4305
+ }), parentSplitStyles && !shouldDoClasses))
4306
+ for (let key in parentSplitStyles.style)
4307
+ key in classNames || key in style || (style[key] = parentSplitStyles.style[key]);
4308
+ let result = {
4309
+ space,
4310
+ hasMedia,
4311
+ fontFamily: styleState.fontFamily,
4312
+ viewProps,
4313
+ // @ts-expect-error
4314
+ style,
4315
+ pseudos,
4316
+ classNames,
4317
+ rulesToInsert,
4318
+ dynamicThemeAccess,
4319
+ pseudoGroups,
4320
+ mediaGroups
4321
+ };
4322
+ if (style.fontFamily) {
4323
+ let faceInfo = (_e = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _e.face;
4324
+ if (faceInfo) {
4325
+ let overrideFace = (_g = (_f = faceInfo[style.fontWeight]) == null ? void 0 : _f[style.fontStyle || "normal"]) == null ? void 0 : _g.val;
4326
+ overrideFace && (style.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style.fontWeight, delete style.fontStyle);
4264
4327
  }
4265
- ), { themeManager, state } = changedThemeState;
4266
- process.env.NODE_ENV === "development" && (state != null && state.theme || process.env.TAMAGUI_DISABLE_NO_THEME_WARNING !== "1" && console.warn(
4267
- `[tamagui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(
4268
- props
4269
- )}).
4270
-
4271
- If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`
4272
- ));
4273
- let themeProxied = (0, import_react3.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state == null ? void 0 : state.theme, themeManager, props.deopt, props.debug]);
4274
- return process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} useTheme =>", state == null ? void 0 : state.name), console.info("returning state", changedThemeState, "from props", props), console.groupEnd()), [changedThemeState, themeProxied];
4275
- };
4276
- function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
4277
- if (!theme)
4278
- return {};
4279
- let config = (0, import_config.getConfig)();
4280
- function track(key) {
4281
- keys && !keys.includes(key) && (keys.push(key), process.env.NODE_ENV === "development" && debug && console.info(` \u{1F3A8} useTheme() tracking new key: ${key}`));
4328
+ process.env.NODE_ENV === "development" && debug && debug !== "profile" && (0, import_log.log)(`Found fontFamily native: ${style.fontFamily}`, faceInfo);
4282
4329
  }
4283
- return new Proxy(theme, {
4284
- has(_, key) {
4285
- if (Reflect.has(theme, key))
4286
- return !0;
4287
- if (typeof key == "string")
4288
- return key[0] === "$" && (key = key.slice(1)), themeManager == null ? void 0 : themeManager.allKeys.has(key);
4289
- },
4290
- get(_, key) {
4291
- if (
4292
- // dont ask me, idk why but on hermes you can see that useTheme()[undefined] passes in STRING undefined to proxy
4293
- // if someone is crazy enough to use "undefined" as a theme key then this not working is on them
4294
- key !== "undefined" && typeof key == "string"
4295
- ) {
4296
- let keyString = key[0] === "$" ? key.slice(1) : key, val = theme[keyString];
4297
- if (val && typeof val == "object")
4298
- return new Proxy(val, {
4299
- // when they touch the actual value we only track it
4300
- // if its a variable (web), its ignored!
4301
- get(_2, subkey) {
4302
- if (subkey === "val")
4303
- track(keyString);
4304
- else if (subkey === "get")
4305
- return (platform) => {
4306
- let outVal = (0, import_createVariable.getVariable)(val);
4307
- if (platform !== "web" && import_constants.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
4308
- let oppositeThemeName = name.replace(
4309
- scheme === "dark" ? "dark" : "light",
4310
- scheme === "dark" ? "light" : "dark"
4311
- ), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
4312
- if (oppositeVal)
4313
- return {
4314
- dynamic: {
4315
- dark: scheme === "dark" ? outVal : oppositeVal,
4316
- light: scheme === "light" ? outVal : oppositeVal
4317
- }
4318
- };
4319
- }
4320
- return track(keyString), outVal;
4321
- };
4322
- return Reflect.get(val, subkey);
4323
- }
4324
- });
4325
- if (process.env.NODE_ENV === "development" && process.env.TAMAGUI_FEAT_THROW_ON_MISSING_THEME_VALUE === "1")
4326
- throw new Error(
4327
- `[tamagui] No theme key "${key}" found in theme ${name}.
4328
- Keys in theme: ${Object.keys(
4329
- theme
4330
- ).join(", ")}`
4331
- );
4332
- }
4333
- return Reflect.get(_, key);
4334
- }
4335
- });
4336
- }
4337
- function someParentIsInversed(manager) {
4338
- {
4339
- let cur = manager;
4340
- for (; cur; ) {
4341
- if (!cur.parentManager)
4342
- return !1;
4343
- if (cur.parentManager.state.scheme !== cur.state.scheme)
4344
- return !0;
4345
- cur = cur.parentManager;
4330
+ if (className && (classNames.className = className), process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
4331
+ console.groupCollapsed(" \u{1F539} ===>");
4332
+ try {
4333
+ let logs = {
4334
+ ...result,
4335
+ className,
4336
+ componentState,
4337
+ transforms,
4338
+ viewProps,
4339
+ viewPropsOrder: Object.keys(viewProps),
4340
+ rulesToInsert,
4341
+ parentSplitStyles
4342
+ };
4343
+ for (let key in logs)
4344
+ (0, import_log.log)(key, logs[key]);
4345
+ } catch {
4346
4346
  }
4347
+ console.groupEnd();
4348
+ }
4349
+ return result;
4350
+ };
4351
+ function mergeStyle(styleState, key, val, disableNormalize = !1) {
4352
+ let { classNames, viewProps, style, usedKeys, styleProps } = styleState;
4353
+ if (import_constants.isWeb && (val == null ? void 0 : val[0]) === "_")
4354
+ classNames[key] = val, usedKeys[key] ||= 1;
4355
+ else if (key in import_helpers.stylePropsTransform)
4356
+ styleState.transforms ||= {}, styleState.transforms[key] = val;
4357
+ else {
4358
+ let out = import_constants.isWeb && !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
4359
+ key in import_helpers.validStylesOnBaseProps ? viewProps[key] = out : style[key] = out;
4347
4360
  }
4348
- return !1;
4349
4361
  }
4350
- var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = (id) => _idToUID[id], getThemeManager = (id) => _uidToManager.get(getId(id)), registerThemeManager = (t) => {
4351
- if (!_idToUID[t.id]) {
4352
- let id = _idToUID[t.id] = {};
4353
- _uidToManager.set(id, t);
4362
+ var getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
4363
+ let { staticConfig, props, conf: conf2, styleProps } = styleState, styleOut = {};
4364
+ for (let key in styleIn) {
4365
+ let val = styleIn[key];
4366
+ key = conf2.shorthands[key] || key;
4367
+ let expanded = (0, import_propMapper.propMapper)(key, val, styleState, { ...props, ...props[subKey] });
4368
+ if (!(!expanded || !staticConfig.isHOC && key in skipProps && !styleProps.noSkip))
4369
+ for (let [skey, sval] of expanded)
4370
+ !avoidMergeTransform && skey in import_helpers.stylePropsTransform ? mergeTransform(styleOut, skey, sval) : styleOut[skey] = styleProps.noNormalize ? sval : (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(sval, key);
4354
4371
  }
4355
- }, useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
4356
- let { disable } = props, parentManagerId = (0, import_react3.useContext)(import_ThemeManagerContext.ThemeManagerIDContext), parentManager = getThemeManager(parentManagerId);
4357
- if (!isRoot && !parentManager || disable)
4358
- return {
4359
- isNewTheme: !1,
4360
- state: parentManager == null ? void 0 : parentManager.state,
4361
- themeManager: parentManager
4362
- };
4363
- let [themeState, setThemeState] = (0, import_react3.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
4364
- function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
4365
- let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
4366
- if (!manager || !forceShouldChange && forceUpdate === !1)
4367
- return;
4368
- let next = nextState || manager.getState(props, parentManager);
4369
- if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
4370
- return next;
4372
+ return styleProps.noNormalize || (0, import_expandStyles.fixStyles)(styleOut), styleOut;
4373
+ };
4374
+ function mergeStylePropIntoStyle(styleState, cur) {
4375
+ if (!cur)
4376
+ return;
4377
+ let styles = Array.isArray(cur) ? cur : [cur];
4378
+ for (let style of styles) {
4379
+ if (!style)
4380
+ continue;
4381
+ let isRNW = style.$$css;
4382
+ Object.assign(isRNW ? styleState.classNames : styleState.style, style);
4371
4383
  }
4372
- if (import_constants.isServer || ((0, import_react3.useEffect)(() => {
4373
- if (!themeManager)
4374
- return;
4375
- if (props.inverse && !mounted) {
4376
- setThemeState((prev) => createState({
4377
- ...prev,
4378
- mounted: !0
4379
- }));
4380
- return;
4381
- }
4382
- (isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
4383
- let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
4384
- forced && setThemeState((prev) => createState(prev, !0));
4385
- }), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
4386
- (name, manager, forced) => {
4387
- let force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
4388
- process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info(" \u{1F538} onChange", themeManager.id, {
4389
- force,
4390
- shouldTryUpdate,
4391
- props,
4392
- name,
4393
- manager,
4394
- keys
4395
- }), shouldTryUpdate && setThemeState((prev) => createState(prev, force));
4396
- },
4397
- themeManager.id
4398
- );
4399
- return () => {
4400
- selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), isNewTheme && activeThemeManagers.delete(themeManager);
4384
+ }
4385
+ var useInsertEffectCompat = import_constants.isWeb ? import_react3.useInsertionEffect || import_constants.useIsomorphicLayoutEffect : () => {
4386
+ }, useSplitStyles = (...args) => {
4387
+ let res = getSplitStyles(...args);
4388
+ return useInsertEffectCompat(() => {
4389
+ (0, import_insertStyleRule.insertStyleRules)(res.rulesToInsert);
4390
+ }, [res.rulesToInsert]), res;
4391
+ }, animatableDefaults = {
4392
+ opacity: 1,
4393
+ scale: 1,
4394
+ rotate: "0deg",
4395
+ rotateY: "0deg",
4396
+ rotateX: "0deg",
4397
+ x: 0,
4398
+ y: 0
4399
+ }, lowercaseHyphenate = (match) => `-${match.toLowerCase()}`, hyphenate = (str) => str.replace(/[A-Z]/g, lowercaseHyphenate), mergeTransform = (obj, key, val, backwards = !1) => {
4400
+ typeof obj.transform != "string" && (obj.transform ||= [], obj.transform[backwards ? "unshift" : "push"]({
4401
+ [mapTransformKeys[key] || key]: val
4402
+ }));
4403
+ }, mapTransformKeys = {
4404
+ x: "translateX",
4405
+ y: "translateY"
4406
+ }, skipProps = {
4407
+ untilMeasured: 1,
4408
+ animation: 1,
4409
+ space: 1,
4410
+ animateOnly: 1,
4411
+ disableClassName: 1,
4412
+ debug: 1,
4413
+ componentName: 1,
4414
+ disableOptimization: 1,
4415
+ tag: 1,
4416
+ style: 1,
4417
+ // handled after loop so pseudos set usedKeys and override it if necessary
4418
+ group: 1
4419
+ };
4420
+ process.env.NODE_ENV === "test" && (skipProps["data-test-renders"] = 1);
4421
+ Object.assign(skipProps, {
4422
+ whiteSpace: 1,
4423
+ wordWrap: 1,
4424
+ textOverflow: 1,
4425
+ textDecorationDistance: 1,
4426
+ cursor: 1,
4427
+ contain: 1,
4428
+ boxSizing: 1,
4429
+ boxShadow: 1,
4430
+ outlineStyle: 1,
4431
+ outlineOffset: 1,
4432
+ outlineWidth: 1,
4433
+ outlineColor: 1
4434
+ });
4435
+ function passDownProp(viewProps, key, val, shouldMergeObject = !1) {
4436
+ if (shouldMergeObject) {
4437
+ let next = {
4438
+ ...viewProps[key],
4439
+ ...val
4401
4440
  };
4402
- }, [
4403
- themeManager,
4404
- parentManager,
4405
- isNewTheme,
4406
- props.componentName,
4407
- props.inverse,
4408
- props.name,
4409
- props.reset,
4410
- mounted
4411
- ]), process.env.NODE_ENV === "development" && props.debug !== "profile" && (0, import_react3.useEffect)(() => (globalThis.TamaguiThemeManagers ??= /* @__PURE__ */ new Set(), globalThis.TamaguiThemeManagers.add(themeManager), () => {
4412
- globalThis.TamaguiThemeManagers.delete(themeManager);
4413
- }), [themeManager])), isInversingOnMount)
4414
- return {
4415
- isNewTheme: !1,
4416
- inversed: !1,
4417
- themeManager: parentManager,
4418
- state: {
4419
- name: "",
4420
- ...parentManager == null ? void 0 : parentManager.state,
4421
- className: ""
4422
- }
4441
+ delete viewProps[key], viewProps[key] = next;
4442
+ } else
4443
+ viewProps[key] = val;
4444
+ }
4445
+ }
4446
+ });
4447
+
4448
+ // ../web/dist/cjs/helpers/mergeProps.native.js
4449
+ var require_mergeProps_native = __commonJS({
4450
+ "../web/dist/cjs/helpers/mergeProps.native.js"(exports2, module2) {
4451
+ "use strict";
4452
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
4453
+ for (var name in all)
4454
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
4455
+ }, __copyProps2 = (to, from, except, desc) => {
4456
+ if (from && typeof from == "object" || typeof from == "function")
4457
+ for (let key of __getOwnPropNames2(from))
4458
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
4459
+ return to;
4460
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), mergeProps_exports = {};
4461
+ __export2(mergeProps_exports, {
4462
+ mergeProps: () => mergeProps
4463
+ });
4464
+ module2.exports = __toCommonJS2(mergeProps_exports);
4465
+ var import_useMedia = require_useMedia_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), mergeProps = (a, b, inverseShorthands) => {
4466
+ let out = {};
4467
+ for (let key in a)
4468
+ mergeProp(out, a, b, key, inverseShorthands);
4469
+ if (b)
4470
+ for (let key in b)
4471
+ mergeProp(out, b, void 0, key, inverseShorthands);
4472
+ return out;
4473
+ };
4474
+ function mergeProp(out, a, b, key, inverseShorthands) {
4475
+ let longhand = (inverseShorthands == null ? void 0 : inverseShorthands[key]) || null, val = a[key];
4476
+ if (key in import_pseudoDescriptors.pseudoDescriptors || import_useMedia.mediaKeys.has(key)) {
4477
+ out[key] = {
4478
+ ...out[key],
4479
+ ...val
4423
4480
  };
4424
- return {
4425
- state,
4426
- isNewTheme,
4427
- inversed,
4428
- themeManager
4429
- };
4430
- function createState(prev, force = !1) {
4431
- if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1 && !force)
4432
- return prev;
4433
- let themeManager2 = parentManager, state2;
4434
- if ((0, import_ThemeManager.getHasThemeUpdatingProps)(props)) {
4435
- let getNewThemeManager = () => new import_ThemeManager.ThemeManager(props, isRoot ? "root" : parentManager);
4436
- if (prev != null && prev.themeManager) {
4437
- themeManager2 = prev.themeManager;
4438
- let forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
4439
- themeManager2,
4440
- next,
4441
- prev.state,
4442
- forceChange
4443
- );
4444
- nextState ? (state2 = nextState, prev.isNewTheme ? themeManager2.updateState(nextState) : themeManager2 = getNewThemeManager()) : prev.isNewTheme && parentManager && !next && (themeManager2 = parentManager);
4445
- } else
4446
- themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
4447
- }
4448
- let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
4449
- isNewTheme2 && registerThemeManager(themeManager2);
4450
- let mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
4451
- state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
4452
- let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed != null ? !1 : null, response = {
4453
- themeManager: themeManager2,
4454
- isNewTheme: isNewTheme2,
4455
- mounted: mounted2,
4456
- inversed: inversed2
4457
- }, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
4458
- (0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
4459
- (0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
4460
- if (prev && shouldReturnPrev)
4461
- return prev;
4462
- if (response.state = state2, process.env.NODE_ENV === "development" && props.debug && import_constants.isClient) {
4463
- console.groupCollapsed(` \u{1F537} ${themeManager2.id} useChangeThemeEffect createState`);
4464
- let parentState = { ...parentManager == null ? void 0 : parentManager.state }, parentId = parentManager == null ? void 0 : parentManager.id, themeManagerState = { ...themeManager2.state };
4465
- console.info({
4466
- props,
4467
- parentState,
4468
- parentId,
4469
- themeManager: themeManager2,
4470
- prev,
4471
- response,
4472
- themeManagerState
4473
- }), console.groupEnd();
4474
- }
4475
- return response;
4481
+ return;
4476
4482
  }
4477
- };
4483
+ b && (key in b || longhand && longhand in b) || (out[longhand || key] = val);
4484
+ }
4478
4485
  }
4479
4486
  });
4480
4487