{"version":3,"sources":["../src/Utils.js"],"names":["mapNativeEventNames","propFromEvent","withSetStateAllowed","assertDomAvailable","displayNameOfNode","nodeTypeFromType","isArrayLike","flatten","ensureKeyOrUndefined","elementToTree","findElement","propsWithKeysAndRef","getComponentStack","simulateError","getMaskedContext","getNodeFromRootFinder","wrapWithWrappingComponent","getWrappingComponentMountRenderer","fakeDynamicImport","compareNodeTypeOf","createMountWrapper","createRenderWrapper","wrap","RootFinder","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","eventOptions","nativeEvent","toUpperCase","slice","fn","cleanup","global","document","result","undefined","feature","createElement","Error","node","type","displayName","name","prototype","isReactComponent","getIteratorFn","obj","iteratorFn","Symbol","iterator","isIterable","Array","isArray","arrs","reduce","flatArrs","item","concat","call","step","next","done","value","flatItem","key","el","recurse","arguments","length","props","ref","children","rendered","map","x","nodeType","dangerouslySetInnerHTML","error","instance","mapFind","arraylike","mapper","finder","found","isFound","find","predicate","hierarchy","getNodeType","getDisplayName","tuples","filter","i","arr","closestComponent","join","catchingInstance","rootNode","catchingType","componentDidCatch","getDerivedStateFromError","stateUpdate","setState","componentStack","contextTypes","unmaskedContext","Object","keys","isCustomComponent","tree","options","wrappingComponent","rootFinder","wrappingComponentProps","toTree","getMountWrapperInstance","getNode","render","context","callback","setWrappingComponentProps","moduleToImport","Promise","resolve","matchingTypeOf","$$typeof"],"mappings":";;;;;;;;;;;QAcgBA,mB,GAAAA,mB;QAsEAC,a,GA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EtE,MAAI,CAACF,iBAAL,EAAwB;AACtB,WAAOxE,IAAP;AACD;AACD,SAAOF,cACL0E,iBADK,EAELE,sBAFK,EAGL5E,cAAcpE,uBAAd,EAA0B,IAA1B,EAAgCsE,IAAhC,CAHK,CAAP;AAKD;;AAEM,SAAS5E,iCAAT,QAAgF;AAAA,MAAnCuJ,MAAmC,SAAnCA,MAAmC;AAAA,MAA3BC,uBAA2B,SAA3BA,uBAA2B;;AACrF,SAAO;AACLC,WADK;AAAA,yBACK;AACR,YAAMtC,WAAWqC,yBAAjB;AACA,eAAOrC,WAAWoC,OAAOpC,QAAP,EAAiBN,QAA5B,GAAuC,IAA9C;AACD;;AAJI;AAAA;AAKL6C,UALK;AAAA,sBAKEpD,EALF,EAKMqD,OALN,EAKeC,QALf,EAKyB;AAC5B,YAAMzC,WAAWqC,yBAAjB;AACA,YAAI,CAACrC,QAAL,EAAe;AACb,gBAAM,IAAIxC,KAAJ,CAAU,qEAAV,CAAN;AACD;AACD,eAAOwC,SAAS0C,yBAAT,CAAmCvD,GAAGI,KAAtC,EAA6CkD,QAA7C,CAAP;AACD;;AAXI;AAAA;AAAA,GAAP;AAaD;;AAEM,SAAS3J,iBAAT,CAA2B6J,cAA3B,EAA2C;AAChD,SAAOC,QAAQC,OAAR,CAAgB,EAAE,WAASF,cAAX,EAAhB,CAAP;AACD;;AAEM,SAAS5J,iBAAT,CAA2B0E,IAA3B,EAAiCqF,cAAjC,EAAiD;AACtD,MAAI,CAACrF,IAAL,EAAW;AACT,WAAO,KAAP;AACD;AACD,SAAOA,KAAKsF,QAAL,KAAkBD,cAAzB;AACD","file":"Utils.js","sourcesContent":["import functionName from 'function.prototype.name';\nimport fromEntries from 'object.fromentries';\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"]}