{"version":3,"sources":["webpack:///./node_modules/mini-create-react-context/dist/esm/index.js"],"names":["createEventEmitter","value","handlers","on","handler","push","off","filter","h","get","set","newValue","changedBits","forEach","index","createContext","defaultValue","calculateChangedBits","_Provider$childContex","_Consumer$contextType","contextProp","Provider","_Component","_this","apply","this","arguments","emitter","props","_proto","prototype","getChildContext","_ref","componentWillReceiveProps","nextProps","oldValue","x","y","render","children","childContextTypes","object","isRequired","Consumer","_Component2","_this2","state","getValue","onUpdate","observedBits","setState","_proto2","componentDidMount","context","componentWillUnmount","Array","isArray","contextTypes"],"mappings":"2FAAA,wEAgBA,SAASA,EAAmBC,GAC1B,IAAIC,EAAW,GACf,MAAO,CACLC,GAAI,SAAYC,GACdF,EAASG,KAAKD,IAEhBE,IAAK,SAAaF,GAChBF,EAAWA,EAASK,QAAO,SAAUC,GACnC,OAAOA,IAAMJ,MAGjBK,IAAK,WACH,OAAOR,GAETS,IAAK,SAAaC,EAAUC,GAC1BX,EAAQU,EACRT,EAASW,SAAQ,SAAUT,GACzB,OAAOA,EAAQH,EAAOW,QA2I9B,IAAIE,EAAQ,IAAMC,eAjIlB,SAA4BC,EAAcC,GACxC,IAAIC,EAAuBC,EAEvBC,EAAc,0BAA4B,MAAQ,KAElDC,EAEJ,SAAUC,GAGR,SAASD,IACP,IAAIE,EAIJ,OAFAA,EAAQD,EAAWE,MAAMC,KAAMC,YAAcD,MACvCE,QAAU3B,EAAmBuB,EAAMK,MAAM3B,OACxCsB,EAPT,IAAeF,EAAUC,GAUzB,IAAIO,EAASR,EAASS,UAoCtB,OAlCAD,EAAOE,gBAAkB,WACvB,IAAIC,EAEJ,OAAOA,EAAO,IAASZ,GAAeK,KAAKE,QAASK,GAGtDH,EAAOI,0BAA4B,SAAmCC,GACpE,GAAIT,KAAKG,MAAM3B,QAAUiC,EAAUjC,MAAO,CACxC,IAEIW,EAFAuB,EAAWV,KAAKG,MAAM3B,MACtBU,EAAWuB,EAAUjC,QAhEfmC,EAmEGD,MAnEAE,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AMW,SAvHzBgB,MAAMC,QAAQjB,GAAYA,EAAS,GAAKA,GAuHLd,KAAKqB,MAAM7C,OAxHvD,IAAmBsC,GA2HRI,EA1DT,CA2DE,aAGF,OADAA,EAASc,eAAgBtC,EAAwB,IAA0BC,GAAe,IAAUqB,OAAQtB,GACrG,CACLE,SAAUA,EACVsB,SAAUA,IAMC","file":"npm.mini-create-react-context.c920b4ddeb9b68365139.js","sourcesContent":["import React, { Component } from 'react';\nimport _inheritsLoose from '@babel/runtime/helpers/inheritsLoose';\nimport PropTypes from 'prop-types';\nimport gud from 'gud';\nimport warning from 'tiny-warning';\n\nvar MAX_SIGNED_31_BIT_INT = 1073741823;\n\nfunction objectIs(x, y) {\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n}\n\nfunction createEventEmitter(value) {\n var handlers = [];\n return {\n on: function on(handler) {\n handlers.push(handler);\n },\n off: function off(handler) {\n handlers = handlers.filter(function (h) {\n return h !== handler;\n });\n },\n get: function get() {\n return value;\n },\n set: function set(newValue, changedBits) {\n value = newValue;\n handlers.forEach(function (handler) {\n return handler(value, changedBits);\n });\n }\n };\n}\n\nfunction onlyChild(children) {\n return Array.isArray(children) ? children[0] : children;\n}\n\nfunction createReactContext(defaultValue, calculateChangedBits) {\n var _Provider$childContex, _Consumer$contextType;\n\n var contextProp = '__create-react-context-' + gud() + '__';\n\n var Provider =\n /*#__PURE__*/\n function (_Component) {\n _inheritsLoose(Provider, _Component);\n\n function Provider() {\n var _this;\n\n _this = _Component.apply(this, arguments) || this;\n _this.emitter = createEventEmitter(_this.props.value);\n return _this;\n }\n\n var _proto = Provider.prototype;\n\n _proto.getChildContext = function getChildContext() {\n var _ref;\n\n return _ref = {}, _ref[contextProp] = this.emitter, _ref;\n };\n\n _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {\n if (this.props.value !== nextProps.value) {\n var oldValue = this.props.value;\n var newValue = nextProps.value;\n var changedBits;\n\n if (objectIs(oldValue, newValue)) {\n changedBits = 0;\n } else {\n changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;\n\n if (process.env.NODE_ENV !== 'production') {\n warning((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: ' + changedBits);\n }\n\n changedBits |= 0;\n\n if (changedBits !== 0) {\n this.emitter.set(nextProps.value, changedBits);\n }\n }\n }\n };\n\n _proto.render = function render() {\n return this.props.children;\n };\n\n return Provider;\n }(Component);\n\n Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = PropTypes.object.isRequired, _Provider$childContex);\n\n var Consumer =\n /*#__PURE__*/\n function (_Component2) {\n _inheritsLoose(Consumer, _Component2);\n\n function Consumer() {\n var _this2;\n\n _this2 = _Component2.apply(this, arguments) || this;\n _this2.state = {\n value: _this2.getValue()\n };\n\n _this2.onUpdate = function (newValue, changedBits) {\n var observedBits = _this2.observedBits | 0;\n\n if ((observedBits & changedBits) !== 0) {\n _this2.setState({\n value: _this2.getValue()\n });\n }\n };\n\n return _this2;\n }\n\n var _proto2 = Consumer.prototype;\n\n _proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {\n var observedBits = nextProps.observedBits;\n this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;\n };\n\n _proto2.componentDidMount = function componentDidMount() {\n if (this.context[contextProp]) {\n this.context[contextProp].on(this.onUpdate);\n }\n\n var observedBits = this.props.observedBits;\n this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;\n };\n\n _proto2.componentWillUnmount = function componentWillUnmount() {\n if (this.context[contextProp]) {\n this.context[contextProp].off(this.onUpdate);\n }\n };\n\n _proto2.getValue = function getValue() {\n if (this.context[contextProp]) {\n return this.context[contextProp].get();\n } else {\n return defaultValue;\n }\n };\n\n _proto2.render = function render() {\n return onlyChild(this.props.children)(this.state.value);\n };\n\n return Consumer;\n }(Component);\n\n Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = PropTypes.object, _Consumer$contextType);\n return {\n Provider: Provider,\n Consumer: Consumer\n };\n}\n\nvar index = React.createContext || createReactContext;\n\nexport default index;\n"],"sourceRoot":""}