{"version":3,"file":"Utils.js","names":["mapNativeEventNames","event","animation","pointerEvents","auxClick","nativeToReactEventMap","compositionend","compositionstart","compositionupdate","keydown","keyup","keypress","contextmenu","dblclick","doubleclick","dragend","dragenter","dragexist","dragleave","dragover","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","touchcancel","touchend","touchmove","touchstart","canplay","canplaythrough","durationchange","loadeddata","loadedmetadata","loadstart","ratechange","timeupdate","volumechange","beforeinput","mouseenter","mouseleave","transitionend","animationstart","animationiteration","animationend","pointerdown","pointermove","pointerup","pointercancel","gotpointercapture","lostpointercapture","pointerenter","pointerleave","pointerover","pointerout","auxclick","propFromEvent","eventOptions","nativeEvent","toUpperCase","slice","withSetStateAllowed","fn","cleanup","global","document","result","undefined","assertDomAvailable","feature","createElement","Error","displayNameOfNode","node","type","displayName","functionName","name","nodeTypeFromType","prototype","isReactComponent","getIteratorFn","obj","iteratorFn","Symbol","iterator","isIterable","isArrayLike","Array","isArray","flatten","arrs","reduce","flatArrs","item","concat","call","step","next","done","value","flatItem","ensureKeyOrUndefined","key","elementToTree","el","recurse","arguments","length","props","ref","children","rendered","map","x","nodeType","dangerouslySetInnerHTML","error","instance","mapFind","arraylike","mapper","finder","found","isFound","find","findElement","predicate","propsWithKeysAndRef","getComponentStack","hierarchy","getNodeType","getDisplayName","tuples","filter","RootFinder","i","arr","closestComponent","join","simulateError","catchingInstance","rootNode","catchingType","componentDidCatch","getDerivedStateFromError","stateUpdate","setState","componentStack","getMaskedContext","contextTypes","unmaskedContext","fromEntries","Object","keys","getNodeFromRootFinder","isCustomComponent","tree","options","wrappingComponent","rootFinder","wrapWithWrappingComponent","wrappingComponentProps","getWrappingComponentMountRenderer","toTree","getMountWrapperInstance","getNode","render","context","callback","setWrappingComponentProps","fakeDynamicImport","moduleToImport","Promise","resolve","compareNodeTypeOf","matchingTypeOf","$$typeof","spyMethod","methodName","getStub","lastReturnValue","originalMethod","hasOwn","has","descriptor","getOwnPropertyDescriptor","defineProperty","configurable","enumerable","spied","args","apply","restore","getLastReturnValue","spyProperty","propertyName","handlers","originalValue","wasAssigned","holder","getV","get","set","newValue","handlerNewValue","v"],"sources":["../src/Utils.js"],"sourcesContent":["import functionName from 'function.prototype.name';\nimport fromEntries from 'object.fromentries';\nimport has from 'has';\nimport createMountWrapper from './createMountWrapper';\nimport createRenderWrapper from './createRenderWrapper';\nimport wrap from './wrapWithSimpleWrapper';\nimport RootFinder from './RootFinder';\n\nexport {\n createMountWrapper,\n createRenderWrapper,\n wrap,\n RootFinder,\n};\n\nexport function mapNativeEventNames(event, {\n animation = false, // should be true for React 15+\n pointerEvents = false, // should be true for React 16.4+\n auxClick = false, // should be true for React 16.5+\n} = {}) {\n const nativeToReactEventMap = {\n compositionend: 'compositionEnd',\n compositionstart: 'compositionStart',\n compositionupdate: 'compositionUpdate',\n keydown: 'keyDown',\n keyup: 'keyUp',\n keypress: 'keyPress',\n contextmenu: 'contextMenu',\n dblclick: 'doubleClick',\n doubleclick: 'doubleClick', // kept for legacy. TODO: remove with next major.\n dragend: 'dragEnd',\n dragenter: 'dragEnter',\n dragexist: 'dragExit',\n dragleave: 'dragLeave',\n dragover: 'dragOver',\n dragstart: 'dragStart',\n mousedown: 'mouseDown',\n mousemove: 'mouseMove',\n mouseout: 'mouseOut',\n mouseover: 'mouseOver',\n mouseup: 'mouseUp',\n touchcancel: 'touchCancel',\n touchend: 'touchEnd',\n touchmove: 'touchMove',\n touchstart: 'touchStart',\n canplay: 'canPlay',\n canplaythrough: 'canPlayThrough',\n durationchange: 'durationChange',\n loadeddata: 'loadedData',\n loadedmetadata: 'loadedMetadata',\n loadstart: 'loadStart',\n ratechange: 'rateChange',\n timeupdate: 'timeUpdate',\n volumechange: 'volumeChange',\n beforeinput: 'beforeInput',\n mouseenter: 'mouseEnter',\n mouseleave: 'mouseLeave',\n transitionend: 'transitionEnd',\n ...(animation && {\n animationstart: 'animationStart',\n animationiteration: 'animationIteration',\n animationend: 'animationEnd',\n }),\n ...(pointerEvents && {\n pointerdown: 'pointerDown',\n pointermove: 'pointerMove',\n pointerup: 'pointerUp',\n pointercancel: 'pointerCancel',\n gotpointercapture: 'gotPointerCapture',\n lostpointercapture: 'lostPointerCapture',\n pointerenter: 'pointerEnter',\n pointerleave: 'pointerLeave',\n pointerover: 'pointerOver',\n pointerout: 'pointerOut',\n }),\n ...(auxClick && {\n auxclick: 'auxClick',\n }),\n };\n\n return nativeToReactEventMap[event] || event;\n}\n\n// 'click' => 'onClick'\n// 'mouseEnter' => 'onMouseEnter'\nexport function propFromEvent(event, eventOptions = {}) {\n const nativeEvent = mapNativeEventNames(event, eventOptions);\n return `on${nativeEvent[0].toUpperCase()}${nativeEvent.slice(1)}`;\n}\n\nexport function withSetStateAllowed(fn) {\n // NOTE(lmr):\n // this is currently here to circumvent a React bug where `setState()` is\n // not allowed without global being defined.\n let cleanup = false;\n if (typeof global.document === 'undefined') {\n cleanup = true;\n global.document = {};\n }\n const result = fn();\n if (cleanup) {\n // This works around a bug in node/jest in that developers aren't able to\n // delete things from global when running in a node vm.\n global.document = undefined;\n delete global.document;\n }\n return result;\n}\n\nexport function assertDomAvailable(feature) {\n if (!global || !global.document || !global.document.createElement) {\n throw new Error(`Enzyme's ${feature} expects a DOM environment to be loaded, but found none`);\n }\n}\n\nexport function displayNameOfNode(node) {\n if (!node) return null;\n\n const { type } = node;\n\n if (!type) return null;\n\n return type.displayName || (typeof type === 'function' ? functionName(type) : type.name || type);\n}\n\nexport function nodeTypeFromType(type) {\n if (typeof type === 'string') {\n return 'host';\n }\n if (type && type.prototype && type.prototype.isReactComponent) {\n return 'class';\n }\n return 'function';\n}\n\nfunction getIteratorFn(obj) {\n const iteratorFn = obj && (\n (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' && obj[Symbol.iterator])\n || obj['@@iterator']\n );\n\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n\n return undefined;\n}\n\nfunction isIterable(obj) {\n return !!getIteratorFn(obj);\n}\n\nexport function isArrayLike(obj) {\n return Array.isArray(obj) || (typeof obj !== 'string' && isIterable(obj));\n}\n\nexport function flatten(arrs) {\n // optimize for the most common case\n if (Array.isArray(arrs)) {\n return arrs.reduce(\n (flatArrs, item) => flatArrs.concat(isArrayLike(item) ? flatten(item) : item),\n [],\n );\n }\n\n // fallback for arbitrary iterable children\n let flatArrs = [];\n\n const iteratorFn = getIteratorFn(arrs);\n const iterator = iteratorFn.call(arrs);\n\n let step = iterator.next();\n\n while (!step.done) {\n const item = step.value;\n let flatItem;\n\n if (isArrayLike(item)) {\n flatItem = flatten(item);\n } else {\n flatItem = item;\n }\n\n flatArrs = flatArrs.concat(flatItem);\n\n step = iterator.next();\n }\n\n return flatArrs;\n}\n\nexport function ensureKeyOrUndefined(key) {\n return key || (key === '' ? '' : undefined);\n}\n\nexport function elementToTree(el, recurse = elementToTree) {\n if (typeof recurse !== 'function' && arguments.length === 3) {\n // special case for backwards compat for `.map(elementToTree)`\n recurse = elementToTree; // eslint-disable-line no-param-reassign\n }\n if (el === null || typeof el !== 'object' || !('type' in el)) {\n return el;\n }\n const {\n type,\n props,\n key,\n ref,\n } = el;\n const { children } = props;\n let rendered = null;\n if (isArrayLike(children)) {\n rendered = flatten(children).map((x) => recurse(x));\n } else if (typeof children !== 'undefined') {\n rendered = recurse(children);\n }\n\n const nodeType = nodeTypeFromType(type);\n\n if (nodeType === 'host' && props.dangerouslySetInnerHTML) {\n if (props.children != null) {\n const error = new Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.');\n error.name = 'Invariant Violation';\n throw error;\n }\n }\n\n return {\n nodeType,\n type,\n props,\n key: ensureKeyOrUndefined(key),\n ref,\n instance: null,\n rendered,\n };\n}\n\nfunction mapFind(arraylike, mapper, finder) {\n let found;\n const isFound = Array.prototype.find.call(arraylike, (item) => {\n found = mapper(item);\n return finder(found);\n });\n return isFound ? found : undefined;\n}\n\nexport function findElement(el, predicate) {\n if (el === null || typeof el !== 'object' || !('type' in el)) {\n return undefined;\n }\n if (predicate(el)) {\n return el;\n }\n const { rendered } = el;\n if (isArrayLike(rendered)) {\n return mapFind(rendered, (x) => findElement(x, predicate), (x) => typeof x !== 'undefined');\n }\n return findElement(rendered, predicate);\n}\n\nexport function propsWithKeysAndRef(node) {\n if (node.ref !== null || node.key !== null) {\n return {\n ...node.props,\n key: node.key,\n ref: node.ref,\n };\n }\n return node.props;\n}\n\nexport function getComponentStack(\n hierarchy,\n getNodeType = nodeTypeFromType,\n getDisplayName = displayNameOfNode,\n) {\n const tuples = hierarchy.filter((node) => node.type !== RootFinder).map((x) => [\n getNodeType(x.type),\n getDisplayName(x),\n ]).concat([[\n 'class',\n 'WrapperComponent',\n ]]);\n\n return tuples.map(([, name], i, arr) => {\n const [, closestComponent] = arr.slice(i + 1).find(([nodeType]) => nodeType !== 'host') || [];\n return `\\n in ${name}${closestComponent ? ` (created by ${closestComponent})` : ''}`;\n }).join('');\n}\n\nexport function simulateError(\n error,\n catchingInstance,\n rootNode, // TODO: remove `rootNode` next semver-major\n hierarchy,\n getNodeType = nodeTypeFromType,\n getDisplayName = displayNameOfNode,\n catchingType = {},\n) {\n const instance = catchingInstance || {};\n\n const { componentDidCatch } = instance;\n\n const { getDerivedStateFromError } = catchingType;\n\n if (!componentDidCatch && !getDerivedStateFromError) {\n throw error;\n }\n\n if (getDerivedStateFromError) {\n const stateUpdate = getDerivedStateFromError.call(catchingType, error);\n instance.setState(stateUpdate);\n }\n\n if (componentDidCatch) {\n const componentStack = getComponentStack(hierarchy, getNodeType, getDisplayName);\n componentDidCatch.call(instance, error, { componentStack });\n }\n}\n\nexport function getMaskedContext(contextTypes, unmaskedContext) {\n if (!contextTypes || !unmaskedContext) {\n return {};\n }\n return fromEntries(Object.keys(contextTypes).map((key) => [key, unmaskedContext[key]]));\n}\n\nexport function getNodeFromRootFinder(isCustomComponent, tree, options) {\n if (!isCustomComponent(options.wrappingComponent)) {\n return tree.rendered;\n }\n const rootFinder = findElement(tree, (node) => node.type === RootFinder);\n if (!rootFinder) {\n throw new Error('`wrappingComponent` must render its children!');\n }\n return rootFinder.rendered;\n}\n\nexport function wrapWithWrappingComponent(createElement, node, options) {\n const { wrappingComponent, wrappingComponentProps } = options;\n if (!wrappingComponent) {\n return node;\n }\n return createElement(\n wrappingComponent,\n wrappingComponentProps,\n createElement(RootFinder, null, node),\n );\n}\n\nexport function getWrappingComponentMountRenderer({ toTree, getMountWrapperInstance }) {\n return {\n getNode() {\n const instance = getMountWrapperInstance();\n return instance ? toTree(instance).rendered : null;\n },\n render(el, context, callback) {\n const instance = getMountWrapperInstance();\n if (!instance) {\n throw new Error('The wrapping component may not be updated if the root is unmounted.');\n }\n return instance.setWrappingComponentProps(el.props, callback);\n },\n };\n}\n\nexport function fakeDynamicImport(moduleToImport) {\n return Promise.resolve({ default: moduleToImport });\n}\n\nexport function compareNodeTypeOf(node, matchingTypeOf) {\n if (!node) {\n return false;\n }\n return node.$$typeof === matchingTypeOf;\n}\n\n// TODO: when enzyme v3.12.0 is required, delete this\nexport function spyMethod(instance, methodName, getStub = () => {}) {\n let lastReturnValue;\n const originalMethod = instance[methodName];\n const hasOwn = has(instance, methodName);\n let descriptor;\n if (hasOwn) {\n descriptor = Object.getOwnPropertyDescriptor(instance, methodName);\n }\n Object.defineProperty(instance, methodName, {\n configurable: true,\n enumerable: !descriptor || !!descriptor.enumerable,\n value: getStub(originalMethod) || function spied(...args) {\n const result = originalMethod.apply(this, args);\n lastReturnValue = result;\n return result;\n },\n });\n return {\n restore() {\n if (hasOwn) {\n if (descriptor) {\n Object.defineProperty(instance, methodName, descriptor);\n } else {\n /* eslint-disable no-param-reassign */\n instance[methodName] = originalMethod;\n /* eslint-enable no-param-reassign */\n }\n } else {\n /* eslint-disable no-param-reassign */\n delete instance[methodName];\n /* eslint-enable no-param-reassign */\n }\n },\n getLastReturnValue() {\n return lastReturnValue;\n },\n };\n}\n\n// TODO: when enzyme v3.12.0 is required, delete this\nexport function spyProperty(instance, propertyName, handlers = {}) {\n const originalValue = instance[propertyName];\n const hasOwn = has(instance, propertyName);\n let descriptor;\n if (hasOwn) {\n descriptor = Object.getOwnPropertyDescriptor(instance, propertyName);\n }\n let wasAssigned = false;\n let holder = originalValue;\n const getV = handlers.get ? () => {\n const value = descriptor && descriptor.get ? descriptor.get.call(instance) : holder;\n return handlers.get.call(instance, value);\n } : () => holder;\n const set = handlers.set ? (newValue) => {\n wasAssigned = true;\n const handlerNewValue = handlers.set.call(instance, holder, newValue);\n holder = handlerNewValue;\n if (descriptor && descriptor.set) {\n descriptor.set.call(instance, holder);\n }\n } : (v) => {\n wasAssigned = true;\n holder = v;\n };\n Object.defineProperty(instance, propertyName, {\n configurable: true,\n enumerable: !descriptor || !!descriptor.enumerable,\n get: getV,\n set,\n });\n\n return {\n restore() {\n if (hasOwn) {\n if (descriptor) {\n Object.defineProperty(instance, propertyName, descriptor);\n } else {\n /* eslint-disable no-param-reassign */\n instance[propertyName] = holder;\n /* eslint-enable no-param-reassign */\n }\n } else {\n /* eslint-disable no-param-reassign */\n delete instance[propertyName];\n /* eslint-enable no-param-reassign */\n }\n },\n wasAssigned() {\n return wasAssigned;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS/B,SAASA,mBAAmB,CAACC,KAAK,EAIjC;EAAA,+EAAJ,CAAC,CAAC;IAAA,sBAHJC,SAAS;IAATA,SAAS,+BAAG,KAAK;IAAA,0BACjBC,aAAa;IAAbA,aAAa,mCAAG,KAAK;IAAA,qBACrBC,QAAQ;IAARA,QAAQ,8BAAG,KAAK;EAEhB,IAAMC,qBAAqB;IACzBC,cAAc,EAAE,gBAAgB;IAChCC,gBAAgB,EAAE,kBAAkB;IACpCC,iBAAiB,EAAE,mBAAmB;IACtCC,OAAO,EAAE,SAAS;IAClBC,KAAK,E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