React Native Web (Fork)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ExecutionEnvironment2 from "https://cdn.skypack.dev/fbjs/lib/ExecutionEnvironment.js"; | |
import normalizeColor$1 from "https://cdn.skypack.dev/normalize-css-color"; | |
import hyphenateStyleName from "https://cdn.skypack.dev/hyphenate-style-name"; | |
import createPrefixer2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/createPrefixer.js"; | |
import backgroundClip2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/backgroundClip.js"; | |
import crossFade2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/crossFade.js"; | |
import cursor2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/cursor.js"; | |
import filter2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/filter.js"; | |
import flex2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/flex.js"; | |
import flexboxIE2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/flexboxIE.js"; | |
import flexboxOld2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/flexboxOld.js"; | |
import gradient2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/gradient.js"; | |
import grid2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/grid.js"; | |
import imageSet2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/imageSet.js"; | |
import logical2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/logical.js"; | |
import position2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/position.js"; | |
import sizing2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/sizing.js"; | |
import transition2 from "https://cdn.skypack.dev/inline-style-prefixer/lib/plugins/transition.js"; | |
const React__default = React; | |
const {useLayoutEffect} = React__default; | |
const {useEffect} = React__default; | |
const {useMemo} = React__default; | |
const {useRef} = React__default; | |
const {useDebugValue} = React__default; | |
const {createContext} = React__default; | |
const {forwardRef} = React__default; | |
const {useContext} = React__default; | |
const {createElement: createElement$1} = React__default; | |
const {isValidElement} = React__default; | |
const {cloneElement} = React__default; | |
const {PureComponent} = React__default; | |
const {Component} = React__default; | |
const {Fragment} = React__default; | |
const {useState} = React__default; | |
const {memo} = React__default; | |
const {useCallback} = React__default; | |
const {Children} = React__default; | |
; | |
const {findDOMNode} = ReactDOM; | |
const {hydrate} = ReactDOM; | |
const {render} = ReactDOM; | |
const {unmountComponentAtNode} = ReactDOM; | |
; | |
import __commonjs_module0 from "https://cdn.skypack.dev/react-dom"; | |
const __commonjs_module0_render = __commonjs_module0 ? __commonjs_module0.render : __commonjs_module0; | |
const __commonjs_module0_unmountComponentAtNode = __commonjs_module0 ? __commonjs_module0.unmountComponentAtNode : __commonjs_module0; | |
export {__commonjs_module0_render as render, __commonjs_module0_unmountComponentAtNode as unmountComponentAtNode}; | |
; | |
import performanceNow2 from "https://cdn.skypack.dev/fbjs/lib/performanceNow.js"; | |
import PropTypes from "https://cdn.skypack.dev/prop-types"; | |
import createReactClass from "https://cdn.skypack.dev/create-react-class"; | |
import findIndex from "https://cdn.skypack.dev/array-find-index"; | |
const { canUseDOM } = ExecutionEnvironment2; | |
function invariant2(condition, format) { | |
} | |
function warning2() { | |
} | |
var buttonLikeRoles = { | |
button: true, | |
menuitem: true | |
}; | |
var isDisabled = function isDisabled2(props) { | |
return props.disabled || Array.isArray(props.accessibilityStates) && props.accessibilityStates.indexOf("disabled") > -1; | |
}; | |
var accessibilityRoleToWebRole = { | |
adjustable: "slider", | |
button: "button", | |
header: "heading", | |
image: "img", | |
imagebutton: null, | |
keyboardkey: null, | |
label: null, | |
link: "link", | |
none: "presentation", | |
search: "search", | |
summary: "region", | |
text: null | |
}; | |
var propsToAriaRole = function propsToAriaRole2(_ref) { | |
var accessibilityRole = _ref.accessibilityRole; | |
if (accessibilityRole) { | |
var inferredRole = accessibilityRoleToWebRole[accessibilityRole]; | |
if (inferredRole !== null) { | |
return inferredRole || accessibilityRole; | |
} | |
} | |
}; | |
var roleComponents = { | |
article: "article", | |
banner: "header", | |
blockquote: "blockquote", | |
code: "code", | |
complementary: "aside", | |
contentinfo: "footer", | |
deletion: "del", | |
emphasis: "em", | |
figure: "figure", | |
insertion: "ins", | |
form: "form", | |
link: "a", | |
list: "ul", | |
listitem: "li", | |
main: "main", | |
navigation: "nav", | |
region: "section", | |
strong: "strong" | |
}; | |
var emptyObject = {}; | |
var propsToAccessibilityComponent = function propsToAccessibilityComponent2(props) { | |
if (props === void 0) { | |
props = emptyObject; | |
} | |
if (props.accessibilityRole === "label") { | |
return "label"; | |
} | |
if (props.href != null) { | |
return "a"; | |
} | |
var role = propsToAriaRole(props); | |
if (role) { | |
if (role === "heading") { | |
var level = props["aria-level"]; | |
if (level != null) { | |
return "h" + level; | |
} | |
return "h1"; | |
} | |
return roleComponents[role]; | |
} | |
}; | |
var AccessibilityUtil = { | |
buttonLikeRoles, | |
isDisabled, | |
propsToAccessibilityComponent, | |
propsToAriaRole | |
}; | |
function createCSSStyleSheet(id2) { | |
if (canUseDOM) { | |
var element = document.getElementById(id2); | |
if (element != null) { | |
return element.sheet; | |
} else { | |
var _element = document.createElement("style"); | |
_element.setAttribute("id", id2); | |
var head = document.head; | |
if (head) { | |
head.insertBefore(_element, head.firstChild); | |
} | |
return _element.sheet; | |
} | |
} else { | |
return null; | |
} | |
} | |
var unitlessNumbers = { | |
animationIterationCount: true, | |
borderImageOutset: true, | |
borderImageSlice: true, | |
borderImageWidth: true, | |
boxFlex: true, | |
boxFlexGroup: true, | |
boxOrdinalGroup: true, | |
columnCount: true, | |
flex: true, | |
flexGrow: true, | |
flexOrder: true, | |
flexPositive: true, | |
flexShrink: true, | |
flexNegative: true, | |
fontWeight: true, | |
gridRow: true, | |
gridRowEnd: true, | |
gridRowGap: true, | |
gridRowStart: true, | |
gridColumn: true, | |
gridColumnEnd: true, | |
gridColumnGap: true, | |
gridColumnStart: true, | |
lineClamp: true, | |
opacity: true, | |
order: true, | |
orphans: true, | |
tabSize: true, | |
widows: true, | |
zIndex: true, | |
zoom: true, | |
fillOpacity: true, | |
floodOpacity: true, | |
stopOpacity: true, | |
strokeDasharray: true, | |
strokeDashoffset: true, | |
strokeMiterlimit: true, | |
strokeOpacity: true, | |
strokeWidth: true, | |
scale: true, | |
scaleX: true, | |
scaleY: true, | |
scaleZ: true, | |
shadowOpacity: true | |
}; | |
var prefixes = ["ms", "Moz", "O", "Webkit"]; | |
var prefixKey = function prefixKey2(prefix2, key) { | |
return prefix2 + key.charAt(0).toUpperCase() + key.substring(1); | |
}; | |
Object.keys(unitlessNumbers).forEach(function(prop) { | |
prefixes.forEach(function(prefix2) { | |
unitlessNumbers[prefixKey(prefix2, prop)] = unitlessNumbers[prop]; | |
}); | |
}); | |
var isWebColor = function isWebColor2(color) { | |
return color === "currentcolor" || color === "currentColor" || color === "inherit" || color.indexOf("var(") === 0; | |
}; | |
var processColor = function processColor2(color) { | |
if (color === void 0 || color === null) { | |
return color; | |
} | |
var int32Color = normalizeColor$1(color); | |
if (int32Color === void 0 || int32Color === null) { | |
return void 0; | |
} | |
int32Color = (int32Color << 24 | int32Color >>> 8) >>> 0; | |
return int32Color; | |
}; | |
var normalizeColor = function normalizeColor2(color, opacity) { | |
if (opacity === void 0) { | |
opacity = 1; | |
} | |
if (color == null) | |
return; | |
if (typeof color === "string" && isWebColor(color)) { | |
return color; | |
} | |
var colorInt = processColor(color); | |
if (colorInt != null) { | |
var r = colorInt >> 16 & 255; | |
var g = colorInt >> 8 & 255; | |
var b = colorInt & 255; | |
var a = (colorInt >> 24 & 255) / 255; | |
var alpha = (a * opacity).toFixed(2); | |
return "rgba(" + r + "," + g + "," + b + "," + alpha + ")"; | |
} | |
}; | |
var colorProps = { | |
backgroundColor: true, | |
borderColor: true, | |
borderTopColor: true, | |
borderRightColor: true, | |
borderBottomColor: true, | |
borderLeftColor: true, | |
color: true, | |
shadowColor: true, | |
textDecorationColor: true, | |
textShadowColor: true | |
}; | |
function normalizeValueWithProperty(value, property) { | |
var returnValue = value; | |
if ((property == null || !unitlessNumbers[property]) && typeof value === "number") { | |
returnValue = value + "px"; | |
} else if (property != null && colorProps[property]) { | |
returnValue = normalizeColor(value); | |
} | |
return returnValue; | |
} | |
var defaultOffset = { | |
height: 0, | |
width: 0 | |
}; | |
var resolveShadowValue = function resolveShadowValue2(style) { | |
var shadowColor = style.shadowColor, shadowOffset = style.shadowOffset, shadowOpacity = style.shadowOpacity, shadowRadius = style.shadowRadius; | |
var _ref = shadowOffset || defaultOffset, height = _ref.height, width = _ref.width; | |
var offsetX = normalizeValueWithProperty(width); | |
var offsetY = normalizeValueWithProperty(height); | |
var blurRadius = normalizeValueWithProperty(shadowRadius || 0); | |
var color = normalizeColor(shadowColor || "black", shadowOpacity); | |
if (color != null && offsetX != null && offsetY != null && blurRadius != null) { | |
return offsetX + " " + offsetY + " " + blurRadius + " " + color; | |
} | |
}; | |
function _objectWithoutPropertiesLoose(source, excluded) { | |
if (source == null) | |
return {}; | |
var target = {}; | |
var sourceKeys = Object.keys(source); | |
var key, i; | |
for (i = 0; i < sourceKeys.length; i++) { | |
key = sourceKeys[i]; | |
if (excluded.indexOf(key) >= 0) | |
continue; | |
target[key] = source[key]; | |
} | |
return target; | |
} | |
var defaultOffset$1 = { | |
height: 0, | |
width: 0 | |
}; | |
function boxShadowReducer(resolvedStyle, style) { | |
var boxShadow = style.boxShadow; | |
var shadow = resolveShadowValue(style); | |
if (shadow != null) { | |
resolvedStyle.boxShadow = boxShadow ? boxShadow + ", " + shadow : shadow; | |
} | |
} | |
function textShadowReducer(resolvedStyle, style) { | |
var textShadowColor = style.textShadowColor, textShadowOffset = style.textShadowOffset, textShadowRadius = style.textShadowRadius; | |
var _ref = textShadowOffset || defaultOffset$1, height = _ref.height, width = _ref.width; | |
var radius = textShadowRadius || 0; | |
var offsetX = normalizeValueWithProperty(width); | |
var offsetY = normalizeValueWithProperty(height); | |
var blurRadius = normalizeValueWithProperty(radius); | |
var color = normalizeValueWithProperty(textShadowColor, "textShadowColor"); | |
if (color && (height !== 0 || width !== 0 || radius !== 0) && offsetX != null && offsetY != null && blurRadius != null) { | |
resolvedStyle.textShadow = offsetX + " " + offsetY + " " + blurRadius + " " + color; | |
} | |
} | |
var createCompileableStyle = function createCompileableStyle2(styles2) { | |
var shadowColor = styles2.shadowColor, shadowOffset = styles2.shadowOffset, shadowOpacity = styles2.shadowOpacity, shadowRadius = styles2.shadowRadius, textShadowColor = styles2.textShadowColor, textShadowOffset = styles2.textShadowOffset, textShadowRadius = styles2.textShadowRadius, nextStyles = _objectWithoutPropertiesLoose(styles2, ["shadowColor", "shadowOffset", "shadowOpacity", "shadowRadius", "textShadowColor", "textShadowOffset", "textShadowRadius"]); | |
if (shadowColor != null || shadowOffset != null || shadowOpacity != null || shadowRadius != null) { | |
boxShadowReducer(nextStyles, styles2); | |
} | |
if (textShadowColor != null || textShadowOffset != null || textShadowRadius != null) { | |
textShadowReducer(nextStyles, styles2); | |
} | |
return nextStyles; | |
}; | |
var slice = Array.prototype.slice; | |
function createOrderedCSSStyleSheet(sheet) { | |
var groups = {}; | |
var selectors = {}; | |
if (sheet != null) { | |
var group; | |
slice.call(sheet.cssRules).forEach(function(cssRule, i) { | |
var cssText = cssRule.cssText; | |
if (cssText.indexOf("stylesheet-group") > -1) { | |
group = decodeGroupRule(cssRule); | |
groups[group] = { | |
start: i, | |
rules: [cssText] | |
}; | |
} else { | |
var selectorText = getSelectorText(cssText); | |
if (selectorText != null) { | |
selectors[selectorText] = true; | |
groups[group].rules.push(cssText); | |
} | |
} | |
}); | |
} | |
function sheetInsert(sheet2, group2, text) { | |
var orderedGroups = getOrderedGroups(groups); | |
var groupIndex = orderedGroups.indexOf(group2); | |
var nextGroupIndex = groupIndex + 1; | |
var nextGroup = orderedGroups[nextGroupIndex]; | |
var position3 = nextGroup != null && groups[nextGroup].start != null ? groups[nextGroup].start : sheet2.cssRules.length; | |
var isInserted = insertRuleAt(sheet2, text, position3); | |
if (isInserted) { | |
if (groups[group2].start == null) { | |
groups[group2].start = position3; | |
} | |
for (var i = nextGroupIndex; i < orderedGroups.length; i += 1) { | |
var groupNumber = orderedGroups[i]; | |
var previousStart = groups[groupNumber].start; | |
groups[groupNumber].start = previousStart + 1; | |
} | |
} | |
return isInserted; | |
} | |
var OrderedCSSStyleSheet = { | |
getTextContent: function getTextContent() { | |
return getOrderedGroups(groups).map(function(group2) { | |
var rules = groups[group2].rules; | |
return rules.join("\n"); | |
}).join("\n"); | |
}, | |
insert: function insert(cssText, groupValue) { | |
var group2 = Number(groupValue); | |
if (groups[group2] == null) { | |
var markerRule = encodeGroupRule(group2); | |
groups[group2] = { | |
start: null, | |
rules: [markerRule] | |
}; | |
if (sheet != null) { | |
sheetInsert(sheet, group2, markerRule); | |
} | |
} | |
var selectorText = getSelectorText(cssText); | |
if (selectorText != null && selectors[selectorText] == null) { | |
selectors[selectorText] = true; | |
groups[group2].rules.push(cssText); | |
if (sheet != null) { | |
var isInserted = sheetInsert(sheet, group2, cssText); | |
if (!isInserted) { | |
groups[group2].rules.pop(); | |
} | |
} | |
} | |
} | |
}; | |
return OrderedCSSStyleSheet; | |
} | |
function encodeGroupRule(group) { | |
return '[stylesheet-group="' + group + '"]{}'; | |
} | |
function decodeGroupRule(cssRule) { | |
return Number(cssRule.selectorText.split(/["']/)[1]); | |
} | |
function getOrderedGroups(obj) { | |
return Object.keys(obj).map(Number).sort(function(a, b) { | |
return a > b ? 1 : -1; | |
}); | |
} | |
var pattern = /\s*([,])\s*/g; | |
function getSelectorText(cssText) { | |
var selector = cssText.split("{")[0].trim(); | |
return selector !== "" ? selector.replace(pattern, "$1") : null; | |
} | |
function insertRuleAt(root, cssText, position3) { | |
try { | |
root.insertRule(cssText, position3); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
} | |
function flattenArray(array) { | |
function flattenDown(array2, result) { | |
for (var i = 0; i < array2.length; i++) { | |
var value = array2[i]; | |
if (Array.isArray(value)) { | |
flattenDown(value, result); | |
} else if (value != null && value !== false) { | |
result.push(value); | |
} | |
} | |
return result; | |
} | |
return flattenDown(array, []); | |
} | |
var emptyObject$1 = {}; | |
var objects = {}; | |
var prefix = "r"; | |
var uniqueID = 1; | |
var createKey = function createKey2(id2) { | |
return prefix + "-" + id2; | |
}; | |
var ReactNativePropRegistry = /* @__PURE__ */ function() { | |
function ReactNativePropRegistry2() { | |
} | |
ReactNativePropRegistry2.register = function register(object) { | |
var id2 = uniqueID++; | |
var key = createKey(id2); | |
objects[key] = object; | |
return id2; | |
}; | |
ReactNativePropRegistry2.getByID = function getByID(id2) { | |
if (!id2) { | |
return emptyObject$1; | |
} | |
var key = createKey(id2); | |
var object = objects[key]; | |
if (!object) { | |
console.warn("Invalid style with id `" + id2 + "`. Skipping ..."); | |
return emptyObject$1; | |
} | |
return object; | |
}; | |
return ReactNativePropRegistry2; | |
}(); | |
function getStyle(style) { | |
if (typeof style === "number") { | |
return ReactNativePropRegistry.getByID(style); | |
} | |
return style; | |
} | |
function flattenStyle(style) { | |
if (!style) { | |
return void 0; | |
} | |
if (!Array.isArray(style)) { | |
return getStyle(style); | |
} | |
var result = {}; | |
for (var i = 0, styleLength = style.length; i < styleLength; ++i) { | |
var computedStyle = flattenStyle(style[i]); | |
if (computedStyle) { | |
for (var key in computedStyle) { | |
var value = computedStyle[key]; | |
result[key] = value; | |
} | |
} | |
} | |
return result; | |
} | |
var doLeftAndRightSwapInRTL = true; | |
var isPreferredLanguageRTL = false; | |
var isRTLAllowed = true; | |
var isRTLForced = false; | |
var isRTL = function isRTL2() { | |
if (isRTLForced) { | |
return true; | |
} | |
return isRTLAllowed && isPreferredLanguageRTL; | |
}; | |
var onDirectionChange = function onDirectionChange2() { | |
if (ExecutionEnvironment2.canUseDOM) { | |
if (document.documentElement && document.documentElement.setAttribute) { | |
document.documentElement.setAttribute("dir", isRTL() ? "rtl" : "ltr"); | |
} | |
} | |
}; | |
var I18nManager = { | |
allowRTL: function allowRTL(bool) { | |
isRTLAllowed = bool; | |
onDirectionChange(); | |
}, | |
forceRTL: function forceRTL(bool) { | |
isRTLForced = bool; | |
onDirectionChange(); | |
}, | |
getConstants: function getConstants() { | |
return { | |
doLeftAndRightSwapInRTL, | |
isRTL: isRTL() | |
}; | |
}, | |
setPreferredLanguageRTL: function setPreferredLanguageRTL(bool) { | |
isPreferredLanguageRTL = bool; | |
onDirectionChange(); | |
}, | |
swapLeftAndRightInRTL: function swapLeftAndRightInRTL(bool) { | |
doLeftAndRightSwapInRTL = bool; | |
} | |
}; | |
var CSS_UNIT_RE = /^[+-]?\d*(?:\.\d+)?(?:[Ee][+-]?\d+)?(%|\w*)/; | |
var getUnit = function getUnit2(str) { | |
return str.match(CSS_UNIT_RE)[1]; | |
}; | |
var isNumeric = function isNumeric2(n) { | |
return !isNaN(parseFloat(n)) && isFinite(n); | |
}; | |
var multiplyStyleLengthValue = function multiplyStyleLengthValue2(value, multiple) { | |
if (typeof value === "string") { | |
var number = parseFloat(value) * multiple; | |
var unit = getUnit(value); | |
return "" + number + unit; | |
} else if (isNumeric(value)) { | |
return value * multiple; | |
} | |
}; | |
var emptyObject$2 = {}; | |
var borderTopLeftRadius = "borderTopLeftRadius"; | |
var borderTopRightRadius = "borderTopRightRadius"; | |
var borderBottomLeftRadius = "borderBottomLeftRadius"; | |
var borderBottomRightRadius = "borderBottomRightRadius"; | |
var borderLeftColor = "borderLeftColor"; | |
var borderLeftStyle = "borderLeftStyle"; | |
var borderLeftWidth = "borderLeftWidth"; | |
var borderRightColor = "borderRightColor"; | |
var borderRightStyle = "borderRightStyle"; | |
var borderRightWidth = "borderRightWidth"; | |
var right = "right"; | |
var marginLeft = "marginLeft"; | |
var marginRight = "marginRight"; | |
var paddingLeft = "paddingLeft"; | |
var paddingRight = "paddingRight"; | |
var left = "left"; | |
var PROPERTIES_FLIP = { | |
borderTopLeftRadius: borderTopRightRadius, | |
borderTopRightRadius: borderTopLeftRadius, | |
borderBottomLeftRadius: borderBottomRightRadius, | |
borderBottomRightRadius: borderBottomLeftRadius, | |
borderLeftColor: borderRightColor, | |
borderLeftStyle: borderRightStyle, | |
borderLeftWidth: borderRightWidth, | |
borderRightColor: borderLeftColor, | |
borderRightStyle: borderLeftStyle, | |
borderRightWidth: borderLeftWidth, | |
left: right, | |
marginLeft: marginRight, | |
marginRight: marginLeft, | |
paddingLeft: paddingRight, | |
paddingRight: paddingLeft, | |
right: left | |
}; | |
var PROPERTIES_I18N = { | |
borderTopStartRadius: borderTopLeftRadius, | |
borderTopEndRadius: borderTopRightRadius, | |
borderBottomStartRadius: borderBottomLeftRadius, | |
borderBottomEndRadius: borderBottomRightRadius, | |
borderStartColor: borderLeftColor, | |
borderStartStyle: borderLeftStyle, | |
borderStartWidth: borderLeftWidth, | |
borderEndColor: borderRightColor, | |
borderEndStyle: borderRightStyle, | |
borderEndWidth: borderRightWidth, | |
end: right, | |
marginStart: marginLeft, | |
marginEnd: marginRight, | |
paddingStart: paddingLeft, | |
paddingEnd: paddingRight, | |
start: left | |
}; | |
var PROPERTIES_VALUE = { | |
clear: true, | |
float: true, | |
textAlign: true | |
}; | |
var additiveInverse = function additiveInverse2(value) { | |
return multiplyStyleLengthValue(value, -1); | |
}; | |
var i18nStyle = function i18nStyle2(originalStyle) { | |
var _I18nManager$getConst = I18nManager.getConstants(), doLeftAndRightSwapInRTL2 = _I18nManager$getConst.doLeftAndRightSwapInRTL, isRTL3 = _I18nManager$getConst.isRTL; | |
var style = originalStyle || emptyObject$2; | |
var frozenProps = {}; | |
var nextStyle = {}; | |
for (var originalProp in style) { | |
if (!Object.prototype.hasOwnProperty.call(style, originalProp)) { | |
continue; | |
} | |
var originalValue = style[originalProp]; | |
var prop = originalProp; | |
var value = originalValue; | |
if (PROPERTIES_I18N.hasOwnProperty(originalProp)) { | |
var convertedProp = PROPERTIES_I18N[originalProp]; | |
prop = isRTL3 ? PROPERTIES_FLIP[convertedProp] : convertedProp; | |
} else if (isRTL3 && doLeftAndRightSwapInRTL2 && PROPERTIES_FLIP[originalProp]) { | |
prop = PROPERTIES_FLIP[originalProp]; | |
} | |
if (PROPERTIES_VALUE.hasOwnProperty(originalProp)) { | |
if (originalValue === "start") { | |
value = isRTL3 ? "right" : "left"; | |
} else if (originalValue === "end") { | |
value = isRTL3 ? "left" : "right"; | |
} else if (isRTL3 && doLeftAndRightSwapInRTL2) { | |
if (originalValue === "left") { | |
value = "right"; | |
} else if (originalValue === "right") { | |
value = "left"; | |
} | |
} | |
} | |
if (prop === "transitionProperty") { | |
if (PROPERTIES_I18N.hasOwnProperty(value)) { | |
var convertedValue = PROPERTIES_I18N[originalValue]; | |
value = isRTL3 ? PROPERTIES_FLIP[convertedValue] : convertedValue; | |
} else if (isRTL3 && doLeftAndRightSwapInRTL2) { | |
var flippedValue = PROPERTIES_FLIP[originalValue]; | |
if (flippedValue != null) { | |
value = flippedValue; | |
} | |
} | |
} | |
if (isRTL3 && prop === "textShadowOffset") { | |
var invertedValue = additiveInverse(value.width); | |
value.width = invertedValue; | |
nextStyle[prop] = value; | |
} else if (!frozenProps[prop]) { | |
nextStyle[prop] = value; | |
} | |
if (PROPERTIES_I18N[originalProp]) { | |
frozenProps[prop] = true; | |
} | |
} | |
return nextStyle; | |
}; | |
var STYLE_ELEMENT_ID = "react-native-stylesheet"; | |
var STYLE_GROUPS = { | |
reset: 0, | |
modality: 0.1, | |
classicReset: 0.5, | |
classic: 1, | |
atomic: 2.2, | |
custom: { | |
borderColor: 2, | |
borderRadius: 2, | |
borderStyle: 2, | |
borderWidth: 2, | |
display: 2, | |
flex: 2, | |
margin: 2, | |
overflow: 2, | |
overscrollBehavior: 2, | |
padding: 2, | |
marginHorizontal: 2.1, | |
marginVertical: 2.1, | |
paddingHorizontal: 2.1, | |
paddingVertical: 2.1 | |
} | |
}; | |
var STYLE_SHORT_FORM_EXPANSIONS = { | |
borderColor: ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"], | |
borderRadius: ["borderTopLeftRadius", "borderTopRightRadius", "borderBottomRightRadius", "borderBottomLeftRadius"], | |
borderStyle: ["borderTopStyle", "borderRightStyle", "borderBottomStyle", "borderLeftStyle"], | |
borderWidth: ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"], | |
margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"], | |
marginHorizontal: ["marginRight", "marginLeft"], | |
marginVertical: ["marginTop", "marginBottom"], | |
overflow: ["overflowX", "overflowY"], | |
overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"], | |
padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"], | |
paddingHorizontal: ["paddingRight", "paddingLeft"], | |
paddingVertical: ["paddingTop", "paddingBottom"] | |
}; | |
var MONOSPACE_FONT_STACK = "monospace,monospace"; | |
var SYSTEM_FONT_STACK = '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif'; | |
var emptyObject$3 = {}; | |
var supportsCSS3TextDecoration = !canUseDOM || window.CSS != null && window.CSS.supports != null && (window.CSS.supports("text-decoration-line", "none") || window.CSS.supports("-webkit-text-decoration-line", "none")); | |
var mapTransform = function mapTransform2(transform) { | |
var type = Object.keys(transform)[0]; | |
var value = transform[type]; | |
if (type === "matrix" || type === "matrix3d") { | |
return type + "(" + value.join(",") + ")"; | |
} else { | |
var normalizedValue = normalizeValueWithProperty(value, type); | |
return type + "(" + normalizedValue + ")"; | |
} | |
}; | |
var resolveTransform = function resolveTransform2(resolvedStyle, style) { | |
var transform = style.transform; | |
if (Array.isArray(style.transform)) { | |
transform = style.transform.map(mapTransform).join(" "); | |
} | |
resolvedStyle.transform = transform; | |
}; | |
var createReactDOMStyle = function createReactDOMStyle2(style) { | |
if (!style) { | |
return emptyObject$3; | |
} | |
var resolvedStyle = {}; | |
Object.keys(style).sort().forEach(function(prop) { | |
var value = normalizeValueWithProperty(style[prop], prop); | |
if (value == null) { | |
return; | |
} | |
switch (prop) { | |
case "elevation": | |
case "overlayColor": | |
case "resizeMode": | |
case "tintColor": { | |
break; | |
} | |
case "backgroundClip": { | |
if (value === "text") { | |
resolvedStyle.backgroundClip = value; | |
resolvedStyle.WebkitBackgroundClip = value; | |
} | |
break; | |
} | |
case "flex": { | |
if (value === -1) { | |
resolvedStyle.flexGrow = 0; | |
resolvedStyle.flexShrink = 1; | |
resolvedStyle.flexBasis = "auto"; | |
} else { | |
resolvedStyle.flex = value; | |
} | |
break; | |
} | |
case "font": { | |
resolvedStyle[prop] = value.replace("System", SYSTEM_FONT_STACK); | |
break; | |
} | |
case "fontFamily": { | |
if (value.indexOf("System") > -1) { | |
var stack = value.split(/,\s*/); | |
stack[stack.indexOf("System")] = SYSTEM_FONT_STACK; | |
resolvedStyle[prop] = stack.join(","); | |
} else if (value === "monospace") { | |
resolvedStyle[prop] = MONOSPACE_FONT_STACK; | |
} else { | |
resolvedStyle[prop] = value; | |
} | |
break; | |
} | |
case "fontVariant": { | |
if (Array.isArray(value) && value.length > 0) { | |
resolvedStyle.fontVariant = value.join(" "); | |
} | |
break; | |
} | |
case "textAlignVertical": { | |
resolvedStyle.verticalAlign = value === "center" ? "middle" : value; | |
break; | |
} | |
case "textDecorationLine": { | |
if (!supportsCSS3TextDecoration) { | |
resolvedStyle.textDecoration = value; | |
} else { | |
resolvedStyle.textDecorationLine = value; | |
} | |
break; | |
} | |
case "transform": | |
case "transformMatrix": { | |
resolveTransform(resolvedStyle, style); | |
break; | |
} | |
case "writingDirection": { | |
resolvedStyle.direction = value; | |
break; | |
} | |
default: { | |
var longFormProperties = STYLE_SHORT_FORM_EXPANSIONS[prop]; | |
if (longFormProperties) { | |
longFormProperties.forEach(function(longForm, i) { | |
if (typeof style[longForm] === "undefined") { | |
resolvedStyle[longForm] = value; | |
} | |
}); | |
} else { | |
resolvedStyle[prop] = Array.isArray(value) ? value.join(",") : value; | |
} | |
} | |
} | |
}); | |
return resolvedStyle; | |
}; | |
function murmurhash2_32_gc(str, seed) { | |
var l = str.length, h = seed ^ l, i = 0, k; | |
while (l >= 4) { | |
k = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24; | |
k = (k & 65535) * 1540483477 + (((k >>> 16) * 1540483477 & 65535) << 16); | |
k ^= k >>> 24; | |
k = (k & 65535) * 1540483477 + (((k >>> 16) * 1540483477 & 65535) << 16); | |
h = (h & 65535) * 1540483477 + (((h >>> 16) * 1540483477 & 65535) << 16) ^ k; | |
l -= 4; | |
++i; | |
} | |
switch (l) { | |
case 3: | |
h ^= (str.charCodeAt(i + 2) & 255) << 16; | |
case 2: | |
h ^= (str.charCodeAt(i + 1) & 255) << 8; | |
case 1: | |
h ^= str.charCodeAt(i) & 255; | |
h = (h & 65535) * 1540483477 + (((h >>> 16) * 1540483477 & 65535) << 16); | |
} | |
h ^= h >>> 13; | |
h = (h & 65535) * 1540483477 + (((h >>> 16) * 1540483477 & 65535) << 16); | |
h ^= h >>> 15; | |
return h >>> 0; | |
} | |
var hash = function hash2(str) { | |
return murmurhash2_32_gc(str, 1).toString(36); | |
}; | |
var w = ["Webkit"]; | |
var m = ["Moz"]; | |
var ms = ["ms"]; | |
var wm = ["Webkit", "Moz"]; | |
var wms = ["Webkit", "ms"]; | |
var wmms = ["Webkit", "Moz", "ms"]; | |
var staticData = { | |
plugins: [backgroundClip2, crossFade2, cursor2, filter2, flex2, flexboxIE2, flexboxOld2, gradient2, grid2, imageSet2, logical2, position2, sizing2, transition2], | |
prefixMap: { | |
animation: w, | |
animationDelay: w, | |
animationDirection: w, | |
animationFillMode: w, | |
animationDuration: w, | |
animationIterationCount: w, | |
animationName: w, | |
animationPlayState: w, | |
animationTimingFunction: w, | |
appearance: wm, | |
userSelect: wmms, | |
textEmphasisPosition: w, | |
textEmphasis: w, | |
textEmphasisStyle: w, | |
textEmphasisColor: w, | |
boxDecorationBreak: w, | |
clipPath: w, | |
maskImage: w, | |
maskMode: w, | |
maskRepeat: w, | |
maskPosition: w, | |
maskClip: w, | |
maskOrigin: w, | |
maskSize: w, | |
maskComposite: w, | |
mask: w, | |
maskBorderSource: w, | |
maskBorderMode: w, | |
maskBorderSlice: w, | |
maskBorderWidth: w, | |
maskBorderOutset: w, | |
maskBorderRepeat: w, | |
maskBorder: w, | |
maskType: w, | |
textDecorationStyle: w, | |
textDecorationSkip: w, | |
textDecorationLine: w, | |
textDecorationColor: w, | |
filter: w, | |
fontFeatureSettings: w, | |
breakAfter: wmms, | |
breakBefore: wmms, | |
breakInside: wmms, | |
columnCount: wm, | |
columnFill: wm, | |
columnGap: wm, | |
columnRule: wm, | |
columnRuleColor: wm, | |
columnRuleStyle: wm, | |
columnRuleWidth: wm, | |
columns: wm, | |
columnSpan: wm, | |
columnWidth: wm, | |
writingMode: wms, | |
flex: wms, | |
flexBasis: w, | |
flexDirection: wms, | |
flexGrow: w, | |
flexFlow: wms, | |
flexShrink: w, | |
flexWrap: wms, | |
alignContent: w, | |
alignItems: w, | |
alignSelf: w, | |
justifyContent: w, | |
order: w, | |
transform: w, | |
transformOrigin: w, | |
transformOriginX: w, | |
transformOriginY: w, | |
backfaceVisibility: w, | |
perspective: w, | |
perspectiveOrigin: w, | |
transformStyle: w, | |
transformOriginZ: w, | |
backdropFilter: w, | |
fontKerning: w, | |
scrollSnapType: wms, | |
scrollSnapPointsX: wms, | |
scrollSnapPointsY: wms, | |
scrollSnapDestination: wms, | |
scrollSnapCoordinate: wms, | |
shapeImageThreshold: w, | |
shapeImageMargin: w, | |
shapeImageOutside: w, | |
hyphens: wmms, | |
flowInto: wms, | |
flowFrom: wms, | |
regionFragment: wms, | |
textOrientation: w, | |
textAlignLast: m, | |
tabSize: m, | |
wrapFlow: ms, | |
wrapThrough: ms, | |
wrapMargin: ms, | |
touchAction: ms, | |
textSizeAdjust: ["ms", "Webkit"], | |
borderImage: w, | |
borderImageOutset: w, | |
borderImageRepeat: w, | |
borderImageSlice: w, | |
borderImageSource: w, | |
borderImageWidth: w, | |
transitionDelay: w, | |
transitionDuration: w, | |
transitionProperty: w, | |
transitionTimingFunction: w | |
} | |
}; | |
var prefixAll = createPrefixer2(staticData); | |
var prefixInlineStyles = function prefixInlineStyles2(style) { | |
var prefixedStyles = prefixAll(style); | |
Object.keys(prefixedStyles).forEach(function(prop) { | |
var value = prefixedStyles[prop]; | |
if (Array.isArray(value)) { | |
prefixedStyles[prop] = value[value.length - 1]; | |
} | |
}); | |
return prefixedStyles; | |
}; | |
function ownKeys(object, enumerableOnly) { | |
var keys = Object.keys(object); | |
if (Object.getOwnPropertySymbols) { | |
var symbols = Object.getOwnPropertySymbols(object); | |
if (enumerableOnly) | |
symbols = symbols.filter(function(sym) { | |
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | |
}); | |
keys.push.apply(keys, symbols); | |
} | |
return keys; | |
} | |
function _objectSpread(target) { | |
for (var i = 1; i < arguments.length; i++) { | |
var source = arguments[i] != null ? arguments[i] : {}; | |
if (i % 2) { | |
ownKeys(Object(source), true).forEach(function(key) { | |
_defineProperty(target, key, source[key]); | |
}); | |
} else if (Object.getOwnPropertyDescriptors) { | |
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | |
} else { | |
ownKeys(Object(source)).forEach(function(key) { | |
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | |
}); | |
} | |
} | |
return target; | |
} | |
function _defineProperty(obj, key, value) { | |
if (key in obj) { | |
Object.defineProperty(obj, key, {value, enumerable: true, configurable: true, writable: true}); | |
} else { | |
obj[key] = value; | |
} | |
return obj; | |
} | |
function _objectWithoutPropertiesLoose$1(source, excluded) { | |
if (source == null) | |
return {}; | |
var target = {}; | |
var sourceKeys = Object.keys(source); | |
var key, i; | |
for (i = 0; i < sourceKeys.length; i++) { | |
key = sourceKeys[i]; | |
if (excluded.indexOf(key) >= 0) | |
continue; | |
target[key] = source[key]; | |
} | |
return target; | |
} | |
var cache = { | |
get: function get(property, value) { | |
if (cache[property] != null && cache[property].hasOwnProperty(value) && cache[property][value] != null) { | |
return cache[property][value]; | |
} | |
}, | |
set: function set(property, value, object) { | |
if (cache[property] == null) { | |
cache[property] = {}; | |
} | |
return cache[property][value] = object; | |
} | |
}; | |
function atomic(style) { | |
return Object.keys(style).sort().reduce(function(acc, property) { | |
var value = style[property]; | |
if (value != null) { | |
var valueString = stringifyValueWithProperty(value, property); | |
var cachedResult = cache.get(property, valueString); | |
if (cachedResult != null) { | |
var identifier = cachedResult.identifier; | |
acc[identifier] = cachedResult; | |
} else { | |
var _identifier = createIdentifier("r", property, value); | |
var rules = createAtomicRules(_identifier, property, value); | |
var _cachedResult = cache.set(property, valueString, { | |
property, | |
value: stringifyValueWithProperty(value, property), | |
identifier: _identifier, | |
rules | |
}); | |
acc[_identifier] = _cachedResult; | |
} | |
} | |
return acc; | |
}, {}); | |
} | |
function classic(style, name) { | |
var _ref; | |
var identifier = createIdentifier("css", name, style); | |
var animationKeyframes = style.animationKeyframes, rest = _objectWithoutPropertiesLoose$1(style, ["animationKeyframes"]); | |
var rules = []; | |
var selector = "." + identifier; | |
var animationName; | |
if (animationKeyframes != null) { | |
var _processKeyframesValu = processKeyframesValue(animationKeyframes), animationNames = _processKeyframesValu.animationNames, keyframesRules = _processKeyframesValu.rules; | |
animationName = animationNames.join(","); | |
rules.push.apply(rules, keyframesRules); | |
} | |
var block = createDeclarationBlock(_objectSpread(_objectSpread({}, rest), {}, { | |
animationName | |
})); | |
rules.push("" + selector + block); | |
return _ref = {}, _ref[identifier] = { | |
identifier, | |
rules | |
}, _ref; | |
} | |
function inline(style) { | |
return prefixInlineStyles(createReactDOMStyle(style)); | |
} | |
function stringifyValueWithProperty(value, property) { | |
var normalizedValue = normalizeValueWithProperty(value, property); | |
return typeof normalizedValue !== "string" ? JSON.stringify(normalizedValue || "") : normalizedValue; | |
} | |
function createAtomicRules(identifier, property, value) { | |
var rules = []; | |
var selector = "." + identifier; | |
switch (property) { | |
case "animationKeyframes": { | |
var _processKeyframesValu2 = processKeyframesValue(value), animationNames = _processKeyframesValu2.animationNames, keyframesRules = _processKeyframesValu2.rules; | |
var block = createDeclarationBlock({ | |
animationName: animationNames.join(",") | |
}); | |
rules.push.apply(rules, ["" + selector + block].concat(keyframesRules)); | |
break; | |
} | |
case "placeholderTextColor": { | |
var _block = createDeclarationBlock({ | |
color: value, | |
opacity: 1 | |
}); | |
rules.push(selector + "::-webkit-input-placeholder" + _block, selector + "::-moz-placeholder" + _block, selector + ":-ms-input-placeholder" + _block, selector + "::placeholder" + _block); | |
break; | |
} | |
case "pointerEvents": { | |
var _createDeclarationBlo3; | |
var finalValue = value; | |
if (value === "auto" || value === "box-only") { | |
finalValue = "auto!important"; | |
if (value === "box-only") { | |
var _createDeclarationBlo; | |
var _block3 = createDeclarationBlock((_createDeclarationBlo = {}, _createDeclarationBlo[property] = "none", _createDeclarationBlo)); | |
rules.push(selector + ">*" + _block3); | |
} | |
} else if (value === "none" || value === "box-none") { | |
finalValue = "none!important"; | |
if (value === "box-none") { | |
var _createDeclarationBlo2; | |
var _block4 = createDeclarationBlock((_createDeclarationBlo2 = {}, _createDeclarationBlo2[property] = "auto", _createDeclarationBlo2)); | |
rules.push(selector + ">*" + _block4); | |
} | |
} | |
var _block2 = createDeclarationBlock((_createDeclarationBlo3 = {}, _createDeclarationBlo3[property] = finalValue, _createDeclarationBlo3)); | |
rules.push("" + selector + _block2); | |
break; | |
} | |
case "scrollbarWidth": { | |
var _createDeclarationBlo4; | |
if (value === "none") { | |
rules.push(selector + "::-webkit-scrollbar{display:none}"); | |
} | |
var _block5 = createDeclarationBlock((_createDeclarationBlo4 = {}, _createDeclarationBlo4[property] = value, _createDeclarationBlo4)); | |
rules.push("" + selector + _block5); | |
break; | |
} | |
default: { | |
var _createDeclarationBlo5; | |
var _block6 = createDeclarationBlock((_createDeclarationBlo5 = {}, _createDeclarationBlo5[property] = value, _createDeclarationBlo5)); | |
rules.push("" + selector + _block6); | |
break; | |
} | |
} | |
return rules; | |
} | |
function createDeclarationBlock(style) { | |
var domStyle = prefixAll(createReactDOMStyle(style)); | |
var declarationsString = Object.keys(domStyle).map(function(property) { | |
var value = domStyle[property]; | |
var prop = hyphenateStyleName(property); | |
if (Array.isArray(value)) { | |
return value.map(function(v) { | |
return prop + ":" + v; | |
}).join(";"); | |
} else { | |
return prop + ":" + value; | |
} | |
}).sort().join(";"); | |
return "{" + declarationsString + ";}"; | |
} | |
function createIdentifier(prefix2, name, value) { | |
var hashedString = hash(name + stringifyValueWithProperty(value, name)); | |
return prefix2 + "-" + hashedString; | |
} | |
function createKeyframes(keyframes) { | |
var prefixes2 = ["-webkit-", ""]; | |
var identifier = createIdentifier("r", "animation", keyframes); | |
var steps = "{" + Object.keys(keyframes).map(function(stepName) { | |
var rule2 = keyframes[stepName]; | |
var block = createDeclarationBlock(rule2); | |
return "" + stepName + block; | |
}).join("") + "}"; | |
var rules = prefixes2.map(function(prefix2) { | |
return "@" + prefix2 + "keyframes " + identifier + steps; | |
}); | |
return { | |
identifier, | |
rules | |
}; | |
} | |
function processKeyframesValue(keyframesValue) { | |
if (typeof keyframesValue === "number") { | |
throw new Error("Invalid CSS keyframes type: " + typeof keyframesValue); | |
} | |
var animationNames = []; | |
var rules = []; | |
var value = Array.isArray(keyframesValue) ? keyframesValue : [keyframesValue]; | |
value.forEach(function(keyframes) { | |
if (typeof keyframes === "string") { | |
animationNames.push(keyframes); | |
} else { | |
var _createKeyframes = createKeyframes(keyframes), identifier = _createKeyframes.identifier, keyframesRules = _createKeyframes.rules; | |
animationNames.push(identifier); | |
rules.push.apply(rules, keyframesRules); | |
} | |
}); | |
return { | |
animationNames, | |
rules | |
}; | |
} | |
var resets = [ | |
"html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);}", | |
"body{margin:0;}", | |
"button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}", | |
"input::-webkit-inner-spin-button,input::-webkit-outer-spin-button,input::-webkit-search-cancel-button,input::-webkit-search-decoration,input::-webkit-search-results-button,input::-webkit-search-results-decoration{display:none;}" | |
]; | |
var focusVisibleAttributeName = "data-focusvisible-polyfill"; | |
var rule = ":focus:not([" + focusVisibleAttributeName + "]){outline: none;}"; | |
var modality = function modality2(insertRule) { | |
insertRule(rule); | |
if (!canUseDOM) { | |
return; | |
} | |
var hadKeyboardEvent = true; | |
var hadFocusVisibleRecently = false; | |
var hadFocusVisibleRecentlyTimeout = null; | |
var inputTypesWhitelist = { | |
text: true, | |
search: true, | |
url: true, | |
tel: true, | |
email: true, | |
password: true, | |
number: true, | |
date: true, | |
month: true, | |
week: true, | |
time: true, | |
datetime: true, | |
"datetime-local": true | |
}; | |
function isValidFocusTarget(el) { | |
if (el && el !== document && el.nodeName !== "HTML" && el.nodeName !== "BODY" && "classList" in el && "contains" in el.classList) { | |
return true; | |
} | |
return false; | |
} | |
function focusTriggersKeyboardModality(el) { | |
var type = el.type; | |
var tagName = el.tagName; | |
var isReadOnly = el.readOnly; | |
if (tagName === "INPUT" && inputTypesWhitelist[type] && !isReadOnly) { | |
return true; | |
} | |
if (tagName === "TEXTAREA" && !isReadOnly) { | |
return true; | |
} | |
if (el.isContentEditable) { | |
return true; | |
} | |
return false; | |
} | |
function addFocusVisibleAttribute(el) { | |
if (el.hasAttribute(focusVisibleAttributeName)) { | |
return; | |
} | |
el.setAttribute(focusVisibleAttributeName, true); | |
} | |
function removeFocusVisibleAttribute(el) { | |
el.removeAttribute(focusVisibleAttributeName); | |
} | |
function removeAllFocusVisibleAttributes() { | |
var list = document.querySelectorAll("[" + focusVisibleAttributeName + "]"); | |
for (var i = 0; i < list.length; i += 1) { | |
removeFocusVisibleAttribute(list[i]); | |
} | |
} | |
function onKeyDown2(e) { | |
if (e.key !== "Tab" && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) { | |
return; | |
} | |
if (isValidFocusTarget(document.activeElement)) { | |
addFocusVisibleAttribute(document.activeElement); | |
} | |
hadKeyboardEvent = true; | |
} | |
function onPointerDown(e) { | |
if (hadKeyboardEvent === true) { | |
removeAllFocusVisibleAttributes(); | |
} | |
hadKeyboardEvent = false; | |
} | |
function onFocus(e) { | |
if (!isValidFocusTarget(e.target)) { | |
return; | |
} | |
if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) { | |
addFocusVisibleAttribute(e.target); | |
} | |
} | |
function onBlur(e) { | |
if (!isValidFocusTarget(e.target)) { | |
return; | |
} | |
if (e.target.hasAttribute(focusVisibleAttributeName)) { | |
hadFocusVisibleRecently = true; | |
window.clearTimeout(hadFocusVisibleRecentlyTimeout); | |
hadFocusVisibleRecentlyTimeout = window.setTimeout(function() { | |
hadFocusVisibleRecently = false; | |
window.clearTimeout(hadFocusVisibleRecentlyTimeout); | |
}, 100); | |
removeFocusVisibleAttribute(e.target); | |
} | |
} | |
function onVisibilityChange2(e) { | |
if (document.visibilityState === "hidden") { | |
if (hadFocusVisibleRecently) { | |
hadKeyboardEvent = true; | |
} | |
addInitialPointerMoveListeners(); | |
} | |
} | |
function addInitialPointerMoveListeners() { | |
document.addEventListener("mousemove", onInitialPointerMove); | |
document.addEventListener("mousedown", onInitialPointerMove); | |
document.addEventListener("mouseup", onInitialPointerMove); | |
document.addEventListener("pointermove", onInitialPointerMove); | |
document.addEventListener("pointerdown", onInitialPointerMove); | |
document.addEventListener("pointerup", onInitialPointerMove); | |
document.addEventListener("touchmove", onInitialPointerMove); | |
document.addEventListener("touchstart", onInitialPointerMove); | |
document.addEventListener("touchend", onInitialPointerMove); | |
} | |
function removeInitialPointerMoveListeners() { | |
document.removeEventListener("mousemove", onInitialPointerMove); | |
document.removeEventListener("mousedown", onInitialPointerMove); | |
document.removeEventListener("mouseup", onInitialPointerMove); | |
document.removeEventListener("pointermove", onInitialPointerMove); | |
document.removeEventListener("pointerdown", onInitialPointerMove); | |
document.removeEventListener("pointerup", onInitialPointerMove); | |
document.removeEventListener("touchmove", onInitialPointerMove); | |
document.removeEventListener("touchstart", onInitialPointerMove); | |
document.removeEventListener("touchend", onInitialPointerMove); | |
} | |
function onInitialPointerMove(e) { | |
if (e.target.nodeName === "HTML") { | |
return; | |
} | |
hadKeyboardEvent = false; | |
removeInitialPointerMoveListeners(); | |
} | |
document.addEventListener("keydown", onKeyDown2, true); | |
document.addEventListener("mousedown", onPointerDown, true); | |
document.addEventListener("pointerdown", onPointerDown, true); | |
document.addEventListener("touchstart", onPointerDown, true); | |
document.addEventListener("focus", onFocus, true); | |
document.addEventListener("blur", onBlur, true); | |
document.addEventListener("visibilitychange", onVisibilityChange2, true); | |
addInitialPointerMoveListeners(); | |
}; | |
function createStyleResolver() { | |
var inserted, sheet, cache2; | |
var resolved = { | |
css: {}, | |
ltr: {}, | |
rtl: {}, | |
rtlNoSwap: {} | |
}; | |
var init = function init2() { | |
inserted = { | |
css: {}, | |
ltr: {}, | |
rtl: {}, | |
rtlNoSwap: {} | |
}; | |
sheet = createOrderedCSSStyleSheet(createCSSStyleSheet(STYLE_ELEMENT_ID)); | |
cache2 = {}; | |
modality(function(rule2) { | |
return sheet.insert(rule2, STYLE_GROUPS.modality); | |
}); | |
resets.forEach(function(rule2) { | |
sheet.insert(rule2, STYLE_GROUPS.reset); | |
}); | |
}; | |
init(); | |
function addToCache(className, prop, value) { | |
if (!cache2[prop]) { | |
cache2[prop] = {}; | |
} | |
cache2[prop][value] = className; | |
} | |
function getClassName(prop, value) { | |
var val = stringifyValueWithProperty(value, prop); | |
return cache2[prop] && cache2[prop].hasOwnProperty(val) && cache2[prop][val]; | |
} | |
function _injectRegisteredStyle(id2) { | |
var _I18nManager$getConst = I18nManager.getConstants(), doLeftAndRightSwapInRTL2 = _I18nManager$getConst.doLeftAndRightSwapInRTL, isRTL3 = _I18nManager$getConst.isRTL; | |
var dir = isRTL3 ? doLeftAndRightSwapInRTL2 ? "rtl" : "rtlNoSwap" : "ltr"; | |
if (!inserted[dir][id2]) { | |
var style = createCompileableStyle(i18nStyle(flattenStyle(id2))); | |
var results = atomic(style); | |
Object.keys(results).forEach(function(key) { | |
var _results$key = results[key], identifier = _results$key.identifier, property = _results$key.property, rules = _results$key.rules, value = _results$key.value; | |
addToCache(identifier, property, value); | |
rules.forEach(function(rule2) { | |
var group = STYLE_GROUPS.custom[property] || STYLE_GROUPS.atomic; | |
sheet.insert(rule2, group); | |
}); | |
}); | |
inserted[dir][id2] = true; | |
} | |
} | |
function resolve(style, classList2) { | |
var nextClassList = []; | |
var props = {}; | |
if (!style && !classList2) { | |
return props; | |
} | |
if (Array.isArray(classList2)) { | |
flattenArray(classList2).forEach(function(identifier) { | |
if (identifier) { | |
if (inserted.css[identifier] == null && resolved.css[identifier] != null) { | |
var item = resolved.css[identifier]; | |
item.rules.forEach(function(rule2) { | |
sheet.insert(rule2, item.group); | |
}); | |
inserted.css[identifier] = true; | |
} | |
nextClassList.push(identifier); | |
} | |
}); | |
} | |
if (typeof style === "number") { | |
_injectRegisteredStyle(style); | |
var key = createCacheKey(style); | |
props = _resolveStyle(style, key); | |
} else if (!Array.isArray(style)) { | |
props = _resolveStyle(style); | |
} else { | |
var flatArray = flattenArray(style); | |
var isArrayOfNumbers = true; | |
var cacheKey = ""; | |
for (var i = 0; i < flatArray.length; i++) { | |
var id2 = flatArray[i]; | |
if (typeof id2 !== "number") { | |
isArrayOfNumbers = false; | |
} else { | |
if (isArrayOfNumbers) { | |
cacheKey += id2 + "-"; | |
} | |
_injectRegisteredStyle(id2); | |
} | |
} | |
var _key = isArrayOfNumbers ? createCacheKey(cacheKey) : null; | |
props = _resolveStyle(flatArray, _key); | |
} | |
nextClassList.push.apply(nextClassList, props.classList); | |
var finalProps = { | |
className: classListToString(nextClassList), | |
classList: nextClassList | |
}; | |
if (props.style) { | |
finalProps.style = props.style; | |
} | |
return finalProps; | |
} | |
function _resolveStyle(style, key) { | |
var _I18nManager$getConst2 = I18nManager.getConstants(), doLeftAndRightSwapInRTL2 = _I18nManager$getConst2.doLeftAndRightSwapInRTL, isRTL3 = _I18nManager$getConst2.isRTL; | |
var dir = isRTL3 ? doLeftAndRightSwapInRTL2 ? "rtl" : "rtlNoSwap" : "ltr"; | |
if (key != null && resolved[dir][key] != null) { | |
return resolved[dir][key]; | |
} | |
var flatStyle = flattenStyle(style); | |
var localizedStyle = createCompileableStyle(i18nStyle(flatStyle)); | |
var props = Object.keys(localizedStyle).sort().reduce(function(props2, styleProp) { | |
var value = localizedStyle[styleProp]; | |
if (value != null) { | |
var className = getClassName(styleProp, value); | |
if (className) { | |
props2.classList.push(className); | |
} else { | |
if (styleProp === "animationKeyframes" || styleProp === "placeholderTextColor" || styleProp === "pointerEvents" || styleProp === "scrollbarWidth") { | |
var _atomic; | |
var a = atomic((_atomic = {}, _atomic[styleProp] = value, _atomic)); | |
Object.keys(a).forEach(function(key2) { | |
var _a$key = a[key2], identifier = _a$key.identifier, rules = _a$key.rules; | |
props2.classList.push(identifier); | |
rules.forEach(function(rule2) { | |
sheet.insert(rule2, STYLE_GROUPS.atomic); | |
}); | |
}); | |
} else { | |
if (!props2.style) { | |
props2.style = {}; | |
} | |
props2.style[styleProp] = value; | |
} | |
} | |
} | |
return props2; | |
}, { | |
classList: [] | |
}); | |
if (props.style) { | |
props.style = inline(props.style); | |
} | |
if (key != null) { | |
resolved[dir][key] = props; | |
} | |
return props; | |
} | |
return { | |
getStyleSheet: function getStyleSheet() { | |
var textContent = sheet.getTextContent(); | |
if (!canUseDOM) { | |
init(); | |
} | |
return { | |
id: STYLE_ELEMENT_ID, | |
textContent | |
}; | |
}, | |
createCSS: function createCSS(rules, group) { | |
var result = {}; | |
Object.keys(rules).forEach(function(name) { | |
var style = rules[name]; | |
var compiled = classic(style, name); | |
Object.keys(compiled).forEach(function(key) { | |
var _compiled$key = compiled[key], identifier = _compiled$key.identifier, rules2 = _compiled$key.rules; | |
resolved.css[identifier] = { | |
group: group || STYLE_GROUPS.classic, | |
rules: rules2 | |
}; | |
result[name] = identifier; | |
}); | |
}); | |
return result; | |
}, | |
resolve, | |
get sheet() { | |
return sheet; | |
} | |
}; | |
} | |
var createCacheKey = function createCacheKey2(id2) { | |
var prefix2 = "rn"; | |
return prefix2 + "-" + id2; | |
}; | |
var classListToString = function classListToString2(list) { | |
return list.join(" ").trim(); | |
}; | |
var styleResolver = createStyleResolver(); | |
var css = { | |
create: function create(rules, group) { | |
return styleResolver.createCSS(rules, group); | |
} | |
}; | |
var absoluteFillObject = { | |
position: "absolute", | |
left: 0, | |
right: 0, | |
top: 0, | |
bottom: 0 | |
}; | |
var absoluteFill = ReactNativePropRegistry.register(absoluteFillObject); | |
var StyleSheet = { | |
absoluteFill, | |
absoluteFillObject, | |
compose: function compose(style1, style2) { | |
if (style1 && style2) { | |
return [style1, style2]; | |
} else { | |
return style1 || style2; | |
} | |
}, | |
create: function create2(styles2) { | |
var result = {}; | |
Object.keys(styles2).forEach(function(key) { | |
var id2 = styles2[key] && ReactNativePropRegistry.register(styles2[key]); | |
result[key] = id2; | |
}); | |
return result; | |
}, | |
flatten: flattenStyle, | |
hairlineWidth: 1 | |
}; | |
if (canUseDOM && window.__REACT_DEVTOOLS_GLOBAL_HOOK__) { | |
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.resolveRNStyle = StyleSheet.flatten; | |
} | |
function _objectWithoutPropertiesLoose$2(source, excluded) { | |
if (source == null) | |
return {}; | |
var target = {}; | |
var sourceKeys = Object.keys(source); | |
var key, i; | |
for (i = 0; i < sourceKeys.length; i++) { | |
key = sourceKeys[i]; | |
if (excluded.indexOf(key) >= 0) | |
continue; | |
target[key] = source[key]; | |
} | |
return target; | |
} | |
var emptyObject$4 = {}; | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var uppercasePattern = /[A-Z]/g; | |
function toHyphenLower(match) { | |
return "-" + match.toLowerCase(); | |
} | |
function hyphenateString(str) { | |
return str.replace(uppercasePattern, toHyphenLower); | |
} | |
var classes = css.create({ | |
reset: { | |
backgroundColor: "transparent", | |
color: "inherit", | |
font: "inherit", | |
listStyle: "none", | |
margin: 0, | |
textAlign: "inherit", | |
textDecoration: "none" | |
}, | |
cursor: { | |
cursor: "pointer" | |
} | |
}, STYLE_GROUPS.classicReset); | |
var pointerEventsStyles = StyleSheet.create({ | |
auto: { | |
pointerEvents: "auto" | |
}, | |
"box-none": { | |
pointerEvents: "box-none" | |
}, | |
"box-only": { | |
pointerEvents: "box-only" | |
}, | |
none: { | |
pointerEvents: "none" | |
} | |
}); | |
var createDOMProps = function createDOMProps2(elementType, props) { | |
if (!props) { | |
props = emptyObject$4; | |
} | |
var _props = props, accessibilityActiveDescendant = _props.accessibilityActiveDescendant, accessibilityAtomic = _props.accessibilityAtomic, accessibilityAutoComplete = _props.accessibilityAutoComplete, accessibilityBusy = _props.accessibilityBusy, accessibilityChecked = _props.accessibilityChecked, accessibilityColumnCount = _props.accessibilityColumnCount, accessibilityColumnIndex = _props.accessibilityColumnIndex, accessibilityColumnSpan = _props.accessibilityColumnSpan, accessibilityControls = _props.accessibilityControls, accessibilityDescribedBy = _props.accessibilityDescribedBy, accessibilityDetails = _props.accessibilityDetails, accessibilityDisabled = _props.accessibilityDisabled, accessibilityErrorMessage = _props.accessibilityErrorMessage, accessibilityExpanded = _props.accessibilityExpanded, accessibilityFlowTo = _props.accessibilityFlowTo, accessibilityHasPopup = _props.accessibilityHasPopup, accessibilityHidden = _props.accessibilityHidden, accessibilityInvalid = _props.accessibilityInvalid, accessibilityKeyShortcuts = _props.accessibilityKeyShortcuts, accessibilityLabel = _props.accessibilityLabel, accessibilityLabelledBy = _props.accessibilityLabelledBy, accessibilityLevel = _props.accessibilityLevel, accessibilityLiveRegion = _props.accessibilityLiveRegion, accessibilityModal = _props.accessibilityModal, accessibilityMultiline = _props.accessibilityMultiline, accessibilityMultiSelectable = _props.accessibilityMultiSelectable, accessibilityOrientation = _props.accessibilityOrientation, accessibilityOwns = _props.accessibilityOwns, accessibilityPlaceholder = _props.accessibilityPlaceholder, accessibilityPosInSet = _props.accessibilityPosInSet, accessibilityPressed = _props.accessibilityPressed, accessibilityReadOnly = _props.accessibilityReadOnly, accessibilityRequired = _props.accessibilityRequired, accessibilityRole = _props.accessibilityRole, accessibilityRoleDescription = _props.accessibilityRoleDescription, accessibilityRowCount = _props.accessibilityRowCount, accessibilityRowIndex = _props.accessibilityRowIndex, accessibilityRowSpan = _props.accessibilityRowSpan, accessibilitySelected = _props.accessibilitySelected, accessibilitySetSize = _props.accessibilitySetSize, accessibilitySort = _props.accessibilitySort, accessibilityValueMax = _props.accessibilityValueMax, accessibilityValueMin = _props.accessibilityValueMin, accessibilityValueNow = _props.accessibilityValueNow, accessibilityValueText = _props.accessibilityValueText, classList2 = _props.classList, dataSet = _props.dataSet, focusable = _props.focusable, nativeID = _props.nativeID, pointerEvents = _props.pointerEvents, providedStyle = _props.style, testID = _props.testID, accessible = _props.accessible, accessibilityState = _props.accessibilityState, accessibilityValue2 = _props.accessibilityValue, domProps = _objectWithoutPropertiesLoose$2(_props, ["accessibilityActiveDescendant", "accessibilityAtomic", "accessibilityAutoComplete", "accessibilityBusy", "accessibilityChecked", "accessibilityColumnCount", "accessibilityColumnIndex", "accessibilityColumnSpan", "accessibilityControls", "accessibilityDescribedBy", "accessibilityDetails", "accessibilityDisabled", "accessibilityErrorMessage", "accessibilityExpanded", "accessibilityFlowTo", "accessibilityHasPopup", "accessibilityHidden", "accessibilityInvalid", "accessibilityKeyShortcuts", "accessibilityLabel", "accessibilityLabelledBy", "accessibilityLevel", "accessibilityLiveRegion", "accessibilityModal", "accessibilityMultiline", "accessibilityMultiSelectable", "accessibilityOrientation", "accessibilityOwns", "accessibilityPlaceholder", "accessibilityPosInSet", "accessibilityPressed", "accessibilityReadOnly", "accessibilityRequired", "accessibilityRole", "accessibilityRoleDescription", "accessibilityRowCount", "accessibilityRowIndex", "accessibilityRowSpan", "accessibilitySelected", "accessibilitySetSize", "accessibilitySort", "accessibilityValueMax", "accessibilityValueMin", "accessibilityValueNow", "accessibilityValueText", "classList", "dataSet", "focusable", "nativeID", "pointerEvents", "style", "testID", "accessible", "accessibilityState", "accessibilityValue"]); | |
var disabled = accessibilityState != null && accessibilityState.disabled === true || accessibilityDisabled; | |
var role = AccessibilityUtil.propsToAriaRole(props); | |
var isNativeInteractiveElement = role === "link" || elementType === "a" || elementType === "button" || elementType === "input" || elementType === "select" || elementType === "textarea" || domProps.contentEditable != null; | |
if (accessibilityState != null) { | |
for (var prop in accessibilityState) { | |
var value = accessibilityState[prop]; | |
if (value != null) { | |
if (prop === "disabled" || prop === "hidden") { | |
if (value === true) { | |
domProps["aria-" + prop] = value; | |
domProps[prop] = value; | |
} | |
} else { | |
domProps["aria-" + prop] = value; | |
} | |
} | |
} | |
} | |
if (accessibilityValue2 != null) { | |
for (var _prop in accessibilityValue2) { | |
var _value = accessibilityValue2[_prop]; | |
if (_value != null) { | |
domProps["aria-value" + _prop] = _value; | |
} | |
} | |
} | |
if (accessibilityActiveDescendant != null) { | |
domProps["aria-activedescendant"] = accessibilityActiveDescendant; | |
} | |
if (accessibilityAtomic != null) { | |
domProps["aria-atomic"] = accessibilityAtomic; | |
} | |
if (accessibilityAutoComplete != null) { | |
domProps["aria-autocomplete"] = accessibilityAutoComplete; | |
} | |
if (accessibilityBusy != null) { | |
domProps["aria-busy"] = accessibilityBusy; | |
} | |
if (accessibilityChecked != null) { | |
domProps["aria-checked"] = accessibilityChecked; | |
} | |
if (accessibilityColumnCount != null) { | |
domProps["aria-colcount"] = accessibilityColumnCount; | |
} | |
if (accessibilityColumnIndex != null) { | |
domProps["aria-colindex"] = accessibilityColumnIndex; | |
} | |
if (accessibilityColumnSpan != null) { | |
domProps["aria-colspan"] = accessibilityColumnSpan; | |
} | |
if (accessibilityControls != null) { | |
domProps["aria-controls"] = accessibilityControls; | |
} | |
if (accessibilityDescribedBy != null) { | |
domProps["aria-describedby"] = accessibilityDescribedBy; | |
} | |
if (accessibilityDetails != null) { | |
domProps["aria-details"] = accessibilityDetails; | |
} | |
if (disabled === true) { | |
domProps["aria-disabled"] = true; | |
if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") { | |
domProps.disabled = true; | |
} | |
} | |
if (accessibilityErrorMessage != null) { | |
domProps["aria-errormessage"] = accessibilityErrorMessage; | |
} | |
if (accessibilityExpanded != null) { | |
domProps["aria-expanded"] = accessibilityExpanded; | |
} | |
if (accessibilityFlowTo != null) { | |
domProps["aria-flowto"] = accessibilityFlowTo; | |
} | |
if (accessibilityHasPopup != null) { | |
domProps["aria-haspopup"] = accessibilityHasPopup; | |
} | |
if (accessibilityHidden === true) { | |
domProps["aria-hidden"] = accessibilityHidden; | |
} | |
if (accessibilityInvalid != null) { | |
domProps["aria-invalid"] = accessibilityInvalid; | |
} | |
if (accessibilityKeyShortcuts != null && Array.isArray(accessibilityKeyShortcuts)) { | |
domProps["aria-keyshortcuts"] = accessibilityKeyShortcuts.join(" "); | |
} | |
if (accessibilityLabel != null) { | |
domProps["aria-label"] = accessibilityLabel; | |
} | |
if (accessibilityLabelledBy != null) { | |
domProps["aria-labelledby"] = accessibilityLabelledBy; | |
} | |
if (accessibilityLevel != null) { | |
domProps["aria-level"] = accessibilityLevel; | |
} | |
if (accessibilityLiveRegion != null) { | |
domProps["aria-live"] = accessibilityLiveRegion === "none" ? "off" : accessibilityLiveRegion; | |
} | |
if (accessibilityModal != null) { | |
domProps["aria-modal"] = accessibilityModal; | |
} | |
if (accessibilityMultiline != null) { | |
domProps["aria-multiline"] = accessibilityMultiline; | |
} | |
if (accessibilityMultiSelectable != null) { | |
domProps["aria-multiselectable"] = accessibilityMultiSelectable; | |
} | |
if (accessibilityOrientation != null) { | |
domProps["aria-orientation"] = accessibilityOrientation; | |
} | |
if (accessibilityOwns != null) { | |
domProps["aria-owns"] = accessibilityOwns; | |
} | |
if (accessibilityPlaceholder != null) { | |
domProps["aria-placeholder"] = accessibilityPlaceholder; | |
} | |
if (accessibilityPosInSet != null) { | |
domProps["aria-posinset"] = accessibilityPosInSet; | |
} | |
if (accessibilityPressed != null) { | |
domProps["aria-pressed"] = accessibilityPressed; | |
} | |
if (accessibilityReadOnly != null) { | |
domProps["aria-readonly"] = accessibilityReadOnly; | |
if (elementType === "input" || elementType === "select" || elementType === "textarea") { | |
domProps.readOnly = true; | |
} | |
} | |
if (accessibilityRequired != null) { | |
domProps["aria-required"] = accessibilityRequired; | |
if (elementType === "input" || elementType === "select" || elementType === "textarea") { | |
domProps.required = true; | |
} | |
} | |
if (role != null) { | |
domProps["role"] = role === "none" ? "presentation" : role; | |
} | |
if (accessibilityRoleDescription != null) { | |
domProps["aria-roledescription"] = accessibilityRoleDescription; | |
} | |
if (accessibilityRowCount != null) { | |
domProps["aria-rowcount"] = accessibilityRowCount; | |
} | |
if (accessibilityRowIndex != null) { | |
domProps["aria-rowindex"] = accessibilityRowIndex; | |
} | |
if (accessibilityRowSpan != null) { | |
domProps["aria-rowspan"] = accessibilityRowSpan; | |
} | |
if (accessibilitySelected != null) { | |
domProps["aria-selected"] = accessibilitySelected; | |
} | |
if (accessibilitySetSize != null) { | |
domProps["aria-setsize"] = accessibilitySetSize; | |
} | |
if (accessibilitySort != null) { | |
domProps["aria-sort"] = accessibilitySort; | |
} | |
if (accessibilityValueMax != null) { | |
domProps["aria-valuemax"] = accessibilityValueMax; | |
} | |
if (accessibilityValueMin != null) { | |
domProps["aria-valuemin"] = accessibilityValueMin; | |
} | |
if (accessibilityValueNow != null) { | |
domProps["aria-valuenow"] = accessibilityValueNow; | |
} | |
if (accessibilityValueText != null) { | |
domProps["aria-valuetext"] = accessibilityValueText; | |
} | |
if (dataSet != null) { | |
for (var dataProp in dataSet) { | |
if (hasOwnProperty.call(dataSet, dataProp)) { | |
var dataName = hyphenateString(dataProp); | |
var dataValue = dataSet[dataProp]; | |
if (dataValue != null) { | |
domProps["data-" + dataName] = dataValue; | |
} | |
} | |
} | |
} | |
var _focusable = focusable != null ? focusable : accessible; | |
if (elementType === "a" || elementType === "button" || elementType === "input" || elementType === "select" || elementType === "textarea") { | |
if (_focusable === false || accessibilityDisabled === true) { | |
domProps.tabIndex = "-1"; | |
} | |
} else if (role === "button" || role === "checkbox" || role === "link" || role === "menuitem" || role === "radio" || role === "textbox" || role === "switch") { | |
if (_focusable !== false) { | |
domProps.tabIndex = "0"; | |
} | |
} else { | |
if (_focusable === true) { | |
domProps.tabIndex = "0"; | |
} | |
} | |
var reactNativeStyle = StyleSheet.compose(pointerEvents && pointerEventsStyles[pointerEvents], providedStyle); | |
var needsCursor = (role === "button" || role === "link") && !disabled; | |
var needsReset = elementType === "a" || elementType === "button" || elementType === "li" || elementType === "ul" || role === "heading"; | |
var finalClassList = [needsReset && classes.reset, needsCursor && classes.cursor, classList2]; | |
var _styleResolver$resolv = styleResolver.resolve(reactNativeStyle, finalClassList), className = _styleResolver$resolv.className, style = _styleResolver$resolv.style; | |
if (className != null && className !== "") { | |
domProps.className = className; | |
} | |
if (style) { | |
domProps.style = style; | |
} | |
if (nativeID != null) { | |
domProps.id = nativeID; | |
} | |
if (testID != null) { | |
domProps["data-testid"] = testID; | |
} | |
if (isNativeInteractiveElement || role === "button" || role === "menuitem" || _focusable === true && !disabled) { | |
var onClick = domProps.onClick; | |
if (onClick != null) { | |
if (disabled) { | |
domProps.onClick = function(e) { | |
e.stopPropagation(); | |
}; | |
} else if (!isNativeInteractiveElement) { | |
var onKeyDown2 = domProps.onKeyDown; | |
domProps.onKeyDown = function(e) { | |
var key = e.key, repeat = e.repeat; | |
var isSpacebarKey = key === " " || key === "Spacebar"; | |
var isButtonRole3 = role === "button" || role === "menuitem"; | |
if (onKeyDown2 != null) { | |
onKeyDown2(e); | |
} | |
if (!repeat && key === "Enter") { | |
onClick(e); | |
} else if (isSpacebarKey && isButtonRole3) { | |
if (!repeat) { | |
onClick(e); | |
} | |
e.preventDefault(); | |
} | |
}; | |
} | |
} | |
} | |
return domProps; | |
}; | |
var createElement = function createElement2(component, props) { | |
var accessibilityComponent; | |
if (component && component.constructor === String) { | |
accessibilityComponent = AccessibilityUtil.propsToAccessibilityComponent(props); | |
} | |
var Component2 = accessibilityComponent || component; | |
var domProps = createDOMProps(Component2, props); | |
for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | |
children[_key - 2] = arguments[_key]; | |
} | |
return /* @__PURE__ */ React__default.createElement.apply(React__default, [Component2, domProps].concat(children)); | |
}; | |
var findNodeHandle = function findNodeHandle2(component) { | |
var node; | |
try { | |
node = findDOMNode(component); | |
} catch (e) { | |
} | |
return node; | |
}; | |
var getBoundingClientRect = function getBoundingClientRect2(node) { | |
if (node != null) { | |
var isElement = node.nodeType === 1; | |
if (isElement && typeof node.getBoundingClientRect === "function") { | |
return node.getBoundingClientRect(); | |
} | |
} | |
}; | |
function dangerousStyleValue(name, value, isCustomProperty) { | |
var isEmpty = value == null || typeof value === "boolean" || value === ""; | |
if (isEmpty) { | |
return ""; | |
} | |
if (!isCustomProperty && typeof value === "number" && value !== 0 && !(unitlessNumbers.hasOwnProperty(name) && unitlessNumbers[name])) { | |
return value + "px"; | |
} | |
return ("" + value).trim(); | |
} | |
function setValueForStyles(node, styles2) { | |
var style = node.style; | |
for (var styleName in styles2) { | |
if (!styles2.hasOwnProperty(styleName)) { | |
continue; | |
} | |
var isCustomProperty = styleName.indexOf("--") === 0; | |
var styleValue = dangerousStyleValue(styleName, styles2[styleName], isCustomProperty); | |
if (styleName === "float") { | |
styleName = "cssFloat"; | |
} | |
if (isCustomProperty) { | |
style.setProperty(styleName, styleValue); | |
} else { | |
style[styleName] = styleValue; | |
} | |
} | |
} | |
var getRect = function getRect2(node) { | |
var _getBoundingClientRec = getBoundingClientRect(node), x = _getBoundingClientRec.x, y = _getBoundingClientRec.y, top = _getBoundingClientRec.top, left2 = _getBoundingClientRec.left; | |
var width = node.offsetWidth; | |
var height = node.offsetHeight; | |
return { | |
x, | |
y, | |
width, | |
height, | |
top, | |
left: left2 | |
}; | |
}; | |
var _measureLayout = function measureLayout(node, relativeToNativeNode, callback) { | |
var relativeNode = relativeToNativeNode || node && node.parentNode; | |
if (node && relativeNode) { | |
setTimeout(function() { | |
var relativeRect = getBoundingClientRect(relativeNode); | |
var _getRect = getRect(node), height = _getRect.height, left2 = _getRect.left, top = _getRect.top, width = _getRect.width; | |
var x = left2 - relativeRect.left; | |
var y = top - relativeRect.top; | |
callback(x, y, width, height, left2, top); | |
}, 0); | |
} | |
}; | |
var focusableElements = { | |
A: true, | |
INPUT: true, | |
SELECT: true, | |
TEXTAREA: true | |
}; | |
var UIManager = { | |
blur: function blur(node) { | |
try { | |
node.blur(); | |
} catch (err) { | |
} | |
}, | |
focus: function focus(node) { | |
try { | |
var name = node.nodeName; | |
if (node.getAttribute("tabIndex") == null && focusableElements[name] == null) { | |
node.setAttribute("tabIndex", "-1"); | |
} | |
node.focus(); | |
} catch (err) { | |
} | |
}, | |
measure: function measure(node, callback) { | |
_measureLayout(node, null, callback); | |
}, | |
measureInWindow: function measureInWindow(node, callback) { | |
if (node) { | |
setTimeout(function() { | |
var _getRect2 = getRect(node), height = _getRect2.height, left2 = _getRect2.left, top = _getRect2.top, width = _getRect2.width; | |
callback(left2, top, width, height); | |
}, 0); | |
} | |
}, | |
measureLayout: function measureLayout2(node, relativeToNativeNode, onFail, onSuccess) { | |
_measureLayout(node, relativeToNativeNode, onSuccess); | |
}, | |
updateView: function updateView(node, props) { | |
for (var prop in props) { | |
if (!Object.prototype.hasOwnProperty.call(props, prop)) { | |
continue; | |
} | |
var value = props[prop]; | |
switch (prop) { | |
case "style": { | |
setValueForStyles(node, value); | |
break; | |
} | |
case "class": | |
case "className": { | |
node.setAttribute("class", value); | |
break; | |
} | |
case "text": | |
case "value": | |
node.value = value; | |
break; | |
default: | |
node.setAttribute(prop, value); | |
} | |
} | |
}, | |
configureNextLayoutAnimation: function configureNextLayoutAnimation(config, onAnimationDidEnd) { | |
onAnimationDidEnd(); | |
}, | |
setLayoutAnimationEnabledExperimental: function setLayoutAnimationEnabledExperimental() { | |
} | |
}; | |
var NativeModules = { | |
UIManager | |
}; | |
function isScreenReaderEnabled() { | |
return new Promise(function(resolve, reject) { | |
resolve(true); | |
}); | |
} | |
var prefersReducedMotionMedia = canUseDOM && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)") : null; | |
function isReduceMotionEnabled() { | |
return new Promise(function(resolve, reject) { | |
resolve(prefersReducedMotionMedia ? prefersReducedMotionMedia.matches : true); | |
}); | |
} | |
function addChangeListener(fn) { | |
if (prefersReducedMotionMedia != null) { | |
prefersReducedMotionMedia.addEventListener != null ? prefersReducedMotionMedia.addEventListener("change", fn) : prefersReducedMotionMedia.addListener(fn); | |
} | |
} | |
function removeChangeListener(fn) { | |
if (prefersReducedMotionMedia != null) { | |
prefersReducedMotionMedia.removeEventListener != null ? prefersReducedMotionMedia.removeEventListener("change", fn) : prefersReducedMotionMedia.removeListener(fn); | |
} | |
} | |
var handlers = {}; | |
var AccessibilityInfo = { | |
isScreenReaderEnabled, | |
isReduceMotionEnabled, | |
fetch: isScreenReaderEnabled, | |
addEventListener: function addEventListener(eventName, handler) { | |
if (eventName === "reduceMotionChanged") { | |
if (!prefersReducedMotionMedia) { | |
return; | |
} | |
var listener = function listener2(event3) { | |
handler(event3.matches); | |
}; | |
addChangeListener(listener); | |
handlers[handler] = listener; | |
} | |
return { | |
remove: function remove() { | |
return AccessibilityInfo.removeEventListener(eventName, handler); | |
} | |
}; | |
}, | |
setAccessibilityFocus: function setAccessibilityFocus(reactTag) { | |
}, | |
announceForAccessibility: function announceForAccessibility(announcement) { | |
}, | |
removeEventListener: function removeEventListener(eventName, handler) { | |
if (eventName === "reduceMotionChanged") { | |
var listener = handlers[handler]; | |
if (!listener || !prefersReducedMotionMedia) { | |
return; | |
} | |
removeChangeListener(listener); | |
} | |
return; | |
} | |
}; | |
var Alert = /* @__PURE__ */ function() { | |
function Alert2() { | |
} | |
Alert2.alert = function alert() { | |
}; | |
return Alert2; | |
}(); | |
var EventSubscription = /* @__PURE__ */ function() { | |
function EventSubscription2(subscriber) { | |
this.subscriber = subscriber; | |
} | |
var _proto = EventSubscription2.prototype; | |
_proto.remove = function remove() { | |
this.subscriber.removeSubscription(this); | |
}; | |
return EventSubscription2; | |
}(); | |
function _inheritsLoose(subClass, superClass) { | |
subClass.prototype = Object.create(superClass.prototype); | |
subClass.prototype.constructor = subClass; | |
_setPrototypeOf(subClass, superClass); | |
} | |
function _setPrototypeOf(o, p) { | |
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { | |
o2.__proto__ = p2; | |
return o2; | |
}; | |
return _setPrototypeOf(o, p); | |
} | |
var EmitterSubscription = /* @__PURE__ */ function(_EventSubscription) { | |
_inheritsLoose(EmitterSubscription2, _EventSubscription); | |
function EmitterSubscription2(emitter, subscriber, listener, context) { | |
var _this; | |
_this = _EventSubscription.call(this, subscriber) || this; | |
_this.emitter = emitter; | |
_this.listener = listener; | |
_this.context = context; | |
return _this; | |
} | |
var _proto = EmitterSubscription2.prototype; | |
_proto.remove = function remove() { | |
this.emitter.removeSubscription(this); | |
}; | |
return EmitterSubscription2; | |
}(EventSubscription); | |
var EventSubscriptionVendor = /* @__PURE__ */ function() { | |
function EventSubscriptionVendor2() { | |
this._subscriptionsForType = {}; | |
this._currentSubscription = null; | |
} | |
var _proto = EventSubscriptionVendor2.prototype; | |
_proto.addSubscription = function addSubscription(eventType, subscription) { | |
invariant2(subscription.subscriber === this, "The subscriber of the subscription is incorrectly set."); | |
if (!this._subscriptionsForType[eventType]) { | |
this._subscriptionsForType[eventType] = []; | |
} | |
var key = this._subscriptionsForType[eventType].length; | |
this._subscriptionsForType[eventType].push(subscription); | |
subscription.eventType = eventType; | |
subscription.key = key; | |
return subscription; | |
}; | |
_proto.removeAllSubscriptions = function removeAllSubscriptions(eventType) { | |
if (eventType === void 0) { | |
this._subscriptionsForType = {}; | |
} else { | |
delete this._subscriptionsForType[eventType]; | |
} | |
}; | |
_proto.removeSubscription = function removeSubscription(subscription) { | |
var eventType = subscription.eventType; | |
var key = subscription.key; | |
var subscriptionsForType = this._subscriptionsForType[eventType]; | |
if (subscriptionsForType) { | |
delete subscriptionsForType[key]; | |
} | |
}; | |
_proto.getSubscriptionsForType = function getSubscriptionsForType(eventType) { | |
return this._subscriptionsForType[eventType]; | |
}; | |
return EventSubscriptionVendor2; | |
}(); | |
var sparseFilterPredicate = function sparseFilterPredicate2() { | |
return true; | |
}; | |
var EventEmitter = /* @__PURE__ */ function() { | |
function EventEmitter2(subscriber) { | |
this._subscriber = subscriber || new EventSubscriptionVendor(); | |
} | |
var _proto = EventEmitter2.prototype; | |
_proto.addListener = function addListener3(eventType, listener, context) { | |
return this._subscriber.addSubscription(eventType, new EmitterSubscription(this, this._subscriber, listener, context)); | |
}; | |
_proto.once = function once(eventType, listener, context) { | |
var _this = this; | |
return this.addListener(eventType, function() { | |
_this.removeCurrentListener(); | |
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | |
args[_key] = arguments[_key]; | |
} | |
listener.apply(context, args); | |
}); | |
}; | |
_proto.removeAllListeners = function removeAllListeners2(eventType) { | |
this._subscriber.removeAllSubscriptions(eventType); | |
}; | |
_proto.removeCurrentListener = function removeCurrentListener() { | |
invariant2(!!this._currentSubscription, "Not in an emitting cycle; there is no current subscription"); | |
this.removeSubscription(this._currentSubscription); | |
}; | |
_proto.removeSubscription = function removeSubscription(subscription) { | |
invariant2(subscription.emitter === this, "Subscription does not belong to this emitter."); | |
this._subscriber.removeSubscription(subscription); | |
}; | |
_proto.listeners = function listeners2(eventType) { | |
var subscriptions = this._subscriber.getSubscriptionsForType(eventType); | |
return subscriptions ? subscriptions.filter(sparseFilterPredicate).map(function(subscription) { | |
return subscription.listener; | |
}) : |