Skip to content
Snippets Groups Projects
index.js 8.75 MiB
Newer Older
  • Learn to ignore specific revisions
  •     this._promise = new Promise(function (resolve, reject) {
          that._callbacks = {
            reject: reject,
            resolve: resolve
    
    Romain CREY's avatar
    Romain CREY committed
          }
    
          that._proceed()
        })
        return this._promise
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      PromisePool.prototype._fireEvent = function (type, data) {
        this.dispatchEvent(new PromisePoolEvent(this, type, data))
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      PromisePool.prototype._settle = function (error) {
        if (error) {
          this._callbacks.reject(error)
    
    Romain CREY's avatar
    Romain CREY committed
        } else {
    
          this._callbacks.resolve()
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
        this._promise = null
        this._callbacks = null
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      PromisePool.prototype._onPooledPromiseFulfilled = function (promise, result) {
        this._size--
        if (this.active()) {
          this._fireEvent('fulfilled', {
            promise: promise,
            result: result
          })
          this._proceed()
        }
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      PromisePool.prototype._onPooledPromiseRejected = function (promise, error) {
        this._size--
        if (this.active()) {
          this._fireEvent('rejected', {
            promise: promise,
            error: error
          })
          this._settle(error || new Error('Unknown error'))
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      PromisePool.prototype._trackPromise = function (promise) {
        var that = this
        promise
          .then(function (result) {
            that._onPooledPromiseFulfilled(promise, result)
          }, function (error) {
            that._onPooledPromiseRejected(promise, error)
          })['catch'](function (err) {
            that._settle(new Error('Promise processing failed: ' + err))
          })
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      PromisePool.prototype._proceed = function () {
        if (!this._done) {
          var result = { done: false }
          while (this._size < this._concurrency &&
              !(result = this._iterator.next()).done) {
            this._size++
            this._trackPromise(result.value)
    
    Romain CREY's avatar
    Romain CREY committed
          }
    
          this._done = (result === null || !!result.done)
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
        if (this._done && this._size === 0) {
          this._settle()
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      PromisePool.PromisePoolEvent = PromisePoolEvent
      // Legacy API
      PromisePool.PromisePool = PromisePool
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /***/ }),
    /* 1592 */
    /***/ (function(module, exports, __webpack_require__) {
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    const get = __webpack_require__(1564)
    const flatten = __webpack_require__(1520)
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    const Contact = __webpack_require__(1593)
    const Document = __webpack_require__(1393)
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    class AdministrativeProcedure extends Document {
      /**
       * Returns personal data for the contact
       *
       * @param {Contact} contact - A contact
       * @param {Array} fields - The list of fields to retrieve
       * @return {Object} - the personal data
       **/
      static getPersonalData(contact, fields) {
        const mapping = {
          firstname: {
            path: 'name.givenName'
          },
          lastname: {
            path: 'name.familyName'
          },
          address: {
            getter: Contact.getPrimaryAddress
          },
          email: {
            getter: Contact.getPrimaryEmail
          },
          phone: {
            getter: Contact.getPrimaryPhone
          }
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
        let personalData = {}
        fields.forEach(field => {
          const contactField = get(mapping, field, field)
          let value
          if (contactField.getter) {
            value = contactField.getter(contact)
          } else {
            const path = get(contactField, 'path', field)
            value = get(contact, path)
          }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          if (value !== undefined) {
            personalData[field] = value
          }
        })
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        return personalData
      }
      /**
       * Method to generate a query based on a few rules given by the template
       * @param {Object} docRules
       * @param {Object} docRules.rules
       * @param {int} docRules.count
       */
      static async getFilesByRules(docRules) {
        const { rules, count } = docRules
        const cozyRules = {
          trashed: false,
          type: 'file',
          ...rules
        }
        // Create an index in order to query and sort
        await this.cozyClient
          .collection('io.cozy.files')
          .createIndex(['metadata.datetime', 'metadata.qualification'])
        // Use the index
        const files = await this.cozyClient
          .collection('io.cozy.files')
          .find(cozyRules, {
            indexedFields: ['metadata.datetime', 'metadata.qualification'],
            sort: [
              {
                'metadata.datetime': 'desc'
              },
              {
                'metadata.qualification': 'desc'
              }
            ],
            limit: count ? count : 1
          })
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * Returns a io.cozy.procedures.administratives object
       *
       * @param {object} data - The data we need for this type of procedure
       * @param {ProcedureTemplate} template - The procedure's template
       * @return {AdministrativeProcedure} the administrative procedure
       */
      static create(data, template) {
        const { documentsData, personalData, procedureData } = data
        const files = Object.keys(documentsData).map(identifier => {
          return documentsData[identifier].files.map(file => {
            // TODO Remove this check. it has to be done before
            if (file)
              return {
                _id: file.id,
                _type: 'io.cozy.files',
                templateDocumentId: identifier
              }
          })
        })
        return {
          personalData,
          procedureData,
          submissionDate: new Date(),
          templateId: template.type,
          templateVersion: template.version,
          relationships: {
            files: {
              data: flatten(files)
            }
    
    Romain CREY's avatar
    Romain CREY committed
          }
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * Returns json that represents the administative procedure
       *
       * @param {AdministrativeProcedure}
       * @return {string} - the json that represents this procedure
       *
       */
      static createJson(administrativeProcedure) {
        return JSON.stringify(administrativeProcedure)
      }
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    AdministrativeProcedure.doctype = 'io.cozy.procedures.administratives'
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports = AdministrativeProcedure
    
    /***/ }),
    /* 1593 */
    /***/ (function(module, exports, __webpack_require__) {
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    const PropTypes = __webpack_require__(1594)
    const get = __webpack_require__(1564)
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    const log = __webpack_require__(1601)
    const Document = __webpack_require__(1393)
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    const getPrimaryOrFirst = property => obj => {
      if (!obj[property] || obj[property].length === 0) return ''
      return obj[property].find(property => property.primary) || obj[property][0]
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    const logDeprecated = methodName =>
      log(
        'warn',
        `${methodName} from cozy-doctypes contact is deprecated, use cozy-client/models/contacts/${methodName} instead`
      )
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /**
     * Class representing the contact model.
     * @extends Document
     */
    class Contact extends Document {
      /**
       * Returns true if candidate is a contact
       *
       * @param {Object} candidate
       * @return {boolean} - whether the candidate is a contact
       */
      static isContact(candidate) {
        return candidate._type === Contact.doctype
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * Returns the initials of the contact.
       *
       * @param {Contact|string} contact - A contact or a string
       * @return {string} - the contact's initials
       */
      static getInitials(contact) {
        logDeprecated('getInitials')
        if (typeof contact === 'string') {
          log(
            'warn',
            'Passing a string to Contact.getInitials will be deprecated soon.'
          )
          return contact[0].toUpperCase()
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    
        if (contact.name) {
          return ['givenName', 'familyName']
            .map(part => get(contact, ['name', part, 0], ''))
            .join('')
            .toUpperCase()
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        const email = Contact.getPrimaryEmail(contact)
        if (email) {
          return email[0].toUpperCase()
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    
        log('warn', 'Contact has no name and no email.')
        return ''
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * Returns the contact's main email
       *
       * @param {Contact} contact - A contact
       * @return {string} - The contact's main email
       */
      // TODO: sadly we have different versions of contacts' doctype to handle...
      // A migration tool on the stack side is needed here
      static getPrimaryEmail(contact) {
        logDeprecated('getPrimaryEmail')
        return Array.isArray(contact.email)
          ? getPrimaryOrFirst('email')(contact).address
          : contact.email
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * Returns the contact's main cozy
       *
       * @param {Contact} contact - A contact
       * @return {string} - The contact's main cozy
       */
      static getPrimaryCozy(contact) {
        logDeprecated('getPrimaryCozy')
        return Array.isArray(contact.cozy)
          ? getPrimaryOrFirst('cozy')(contact).url
          : contact.url
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * Returns the contact's main phone number
       *
       * @param {Contact} contact - A contact
       * @return {string} - The contact's main phone number
       */
      static getPrimaryPhone(contact) {
        logDeprecated('getPrimaryPhone')
        return getPrimaryOrFirst('phone')(contact).number
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * Returns the contact's main address
    
    Romain CREY's avatar
    Romain CREY committed
       *
    
       * @param {Contact} contact - A contact
       * @return {string} - The contact's main address
    
    Romain CREY's avatar
    Romain CREY committed
       */
    
      static getPrimaryAddress(contact) {
        logDeprecated('getPrimaryAddress')
        return getPrimaryOrFirst('address')(contact).formattedAddress
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * Returns the contact's fullname
    
    Romain CREY's avatar
    Romain CREY committed
       *
    
       * @param {Contact} contact - A contact
       * @return {string} - The contact's fullname
    
    Romain CREY's avatar
    Romain CREY committed
       */
    
      static getFullname(contact) {
        logDeprecated('getFullname')
        if (contact.fullname) {
          return contact.fullname
        } else if (contact.name) {
          return [
            'namePrefix',
            'givenName',
            'additionalName',
            'familyName',
            'nameSuffix'
          ]
            .map(part => contact.name[part])
            .filter(part => part !== undefined)
            .join(' ')
            .trim()
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * Returns a display name for the contact
       *
       * @param {Contact} contact - A contact
       * @return {string} - the contact's display name
       **/
      static getDisplayName(contact) {
        logDeprecated('getDisplayName')
        return Contact.getFullname(contact) || Contact.getPrimaryEmail(contact)
      }
    }
    
    const ContactShape = PropTypes.shape({
      _id: PropTypes.string.isRequired,
      _type: PropTypes.string.isRequired,
      fullname: PropTypes.string,
      name: PropTypes.shape({
        givenName: PropTypes.string,
        familyName: PropTypes.string,
        additionalName: PropTypes.string,
        namePrefix: PropTypes.string,
        nameSuffix: PropTypes.string
      }),
      birthday: PropTypes.string,
      note: PropTypes.string,
      email: PropTypes.arrayOf(
        PropTypes.shape({
          address: PropTypes.string.isRequired,
          label: PropTypes.string,
          type: PropTypes.string,
          primary: PropTypes.bool
        })
      ),
      address: PropTypes.arrayOf(
        PropTypes.shape({
          street: PropTypes.string,
          pobox: PropTypes.string,
          city: PropTypes.string,
          region: PropTypes.string,
          postcode: PropTypes.string,
          country: PropTypes.string,
          type: PropTypes.string,
          primary: PropTypes.bool,
          label: PropTypes.string,
          formattedAddress: PropTypes.string
        })
      ),
      phone: PropTypes.arrayOf(
        PropTypes.shape({
          number: PropTypes.string.isRequired,
          type: PropTypes.string,
          label: PropTypes.string,
          primary: PropTypes.bool
        })
      ),
      cozy: PropTypes.arrayOf(
        PropTypes.shape({
          url: PropTypes.string.isRequired,
          label: PropTypes.string,
          primary: PropTypes.bool
        })
      ),
      company: PropTypes.string,
      jobTitle: PropTypes.string,
      trashed: PropTypes.bool,
      me: PropTypes.bool,
      relationships: PropTypes.shape({
        accounts: PropTypes.shape({
          data: PropTypes.arrayOf(
            PropTypes.shape({
              _id: PropTypes.string.isRequired,
              _type: PropTypes.string.isRequired
            })
          )
        }),
        groups: PropTypes.shape({
          data: PropTypes.arrayOf(
            PropTypes.shape({
              _id: PropTypes.string.isRequired,
              _type: PropTypes.string.isRequired
            })
          )
        })
      })
    })
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Contact.doctype = 'io.cozy.contacts'
    Contact.propType = ContactShape
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports = Contact
    
    /***/ }),
    /* 1594 */
    /***/ (function(module, exports, __webpack_require__) {
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /**
     * Copyright (c) 2013-present, Facebook, Inc.
     *
     * This source code is licensed under the MIT license found in the
     * LICENSE file in the root directory of this source tree.
     */
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    if (true) {
      var ReactIs = __webpack_require__(1595);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      // By explicitly using `prop-types` you are opting into new development behavior.
      // http://fb.me/prop-types-in-prod
      var throwOnDirectAccess = true;
      module.exports = __webpack_require__(1597)(ReactIs.isElement, throwOnDirectAccess);
    } else {}
    
    /***/ }),
    /* 1595 */
    /***/ (function(module, exports, __webpack_require__) {
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    
    if (false) {} else {
      module.exports = __webpack_require__(1596);
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    
    /** @license React v16.8.4
     * react-is.development.js
     *
     * Copyright (c) Facebook, Inc. and its affiliates.
     *
     * This source code is licensed under the MIT license found in the
     * LICENSE file in the root directory of this source tree.
     */
    
    if (true) {
      (function() {
    'use strict';
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    Object.defineProperty(exports, '__esModule', { value: true });
    
    // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
    // nor polyfill, then a plain number is used for performance.
    var hasSymbol = typeof Symbol === 'function' && Symbol.for;
    
    var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
    var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
    var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
    var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
    var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
    var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
    var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
    var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
    var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
    var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
    var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
    var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
    var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
    
    function isValidElementType(type) {
      return typeof type === 'string' || typeof type === 'function' ||
      // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
      type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
    
    Romain CREY's avatar
    Romain CREY committed
    }
    
    
    /**
     * Forked from fbjs/warning:
     * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
     *
     * Only change is we use console.warn instead of console.error,
     * and do nothing when 'console' is not supported.
     * This really simplifies the code.
     * ---
     * Similar to invariant but only logs a warning if the condition is not met.
     * This can be used to log issues in development environments in critical
     * paths. Removing the logging code for production environments will keep the
     * same logic and follow the same code paths.
     */
    
    var lowPriorityWarning = function () {};
    
    {
      var printWarning = function (format) {
        for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
          args[_key - 1] = arguments[_key];
        }
    
        var argIndex = 0;
        var message = 'Warning: ' + format.replace(/%s/g, function () {
          return args[argIndex++];
        });
        if (typeof console !== 'undefined') {
          console.warn(message);
        }
        try {
          // --- Welcome to debugging React ---
          // This error was thrown as a convenience so that you can use this stack
          // to find the callsite that caused this warning to fire.
          throw new Error(message);
        } catch (x) {}
    
    Romain CREY's avatar
    Romain CREY committed
      };
    
    
      lowPriorityWarning = function (condition, format) {
        if (format === undefined) {
          throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
        if (!condition) {
          for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
            args[_key2 - 2] = arguments[_key2];
          }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
          printWarning.apply(undefined, [format].concat(args));
        }
      };
    
    Romain CREY's avatar
    Romain CREY committed
    }
    
    
    var lowPriorityWarning$1 = lowPriorityWarning;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function typeOf(object) {
      if (typeof object === 'object' && object !== null) {
        var $$typeof = object.$$typeof;
        switch ($$typeof) {
          case REACT_ELEMENT_TYPE:
            var type = object.type;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
            switch (type) {
              case REACT_ASYNC_MODE_TYPE:
              case REACT_CONCURRENT_MODE_TYPE:
              case REACT_FRAGMENT_TYPE:
              case REACT_PROFILER_TYPE:
              case REACT_STRICT_MODE_TYPE:
              case REACT_SUSPENSE_TYPE:
                return type;
              default:
                var $$typeofType = type && type.$$typeof;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
                switch ($$typeofType) {
                  case REACT_CONTEXT_TYPE:
                  case REACT_FORWARD_REF_TYPE:
                  case REACT_PROVIDER_TYPE:
                    return $$typeofType;
                  default:
                    return $$typeof;
                }
            }
          case REACT_LAZY_TYPE:
          case REACT_MEMO_TYPE:
          case REACT_PORTAL_TYPE:
            return $$typeof;
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      return undefined;
    }
    
    // AsyncMode is deprecated along with isAsyncMode
    var AsyncMode = REACT_ASYNC_MODE_TYPE;
    var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
    var ContextConsumer = REACT_CONTEXT_TYPE;
    var ContextProvider = REACT_PROVIDER_TYPE;
    var Element = REACT_ELEMENT_TYPE;
    var ForwardRef = REACT_FORWARD_REF_TYPE;
    var Fragment = REACT_FRAGMENT_TYPE;
    var Lazy = REACT_LAZY_TYPE;
    var Memo = REACT_MEMO_TYPE;
    var Portal = REACT_PORTAL_TYPE;
    var Profiler = REACT_PROFILER_TYPE;
    var StrictMode = REACT_STRICT_MODE_TYPE;
    var Suspense = REACT_SUSPENSE_TYPE;
    
    var hasWarnedAboutDeprecatedIsAsyncMode = false;
    
    // AsyncMode should be deprecated
    function isAsyncMode(object) {
      {
        if (!hasWarnedAboutDeprecatedIsAsyncMode) {
          hasWarnedAboutDeprecatedIsAsyncMode = true;
          lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
        }
      }
      return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
    }
    function isConcurrentMode(object) {
      return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
    }
    function isContextConsumer(object) {
      return typeOf(object) === REACT_CONTEXT_TYPE;
    }
    function isContextProvider(object) {
      return typeOf(object) === REACT_PROVIDER_TYPE;
    }
    function isElement(object) {
      return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
    }
    function isForwardRef(object) {
      return typeOf(object) === REACT_FORWARD_REF_TYPE;
    }
    function isFragment(object) {
      return typeOf(object) === REACT_FRAGMENT_TYPE;
    }
    function isLazy(object) {
      return typeOf(object) === REACT_LAZY_TYPE;
    }
    function isMemo(object) {
      return typeOf(object) === REACT_MEMO_TYPE;
    }
    function isPortal(object) {
      return typeOf(object) === REACT_PORTAL_TYPE;
    }
    function isProfiler(object) {
      return typeOf(object) === REACT_PROFILER_TYPE;
    }
    function isStrictMode(object) {
      return typeOf(object) === REACT_STRICT_MODE_TYPE;
    }
    function isSuspense(object) {
      return typeOf(object) === REACT_SUSPENSE_TYPE;
    }
    
    exports.typeOf = typeOf;
    exports.AsyncMode = AsyncMode;
    exports.ConcurrentMode = ConcurrentMode;
    exports.ContextConsumer = ContextConsumer;
    exports.ContextProvider = ContextProvider;
    exports.Element = Element;
    exports.ForwardRef = ForwardRef;
    exports.Fragment = Fragment;
    exports.Lazy = Lazy;
    exports.Memo = Memo;
    exports.Portal = Portal;
    exports.Profiler = Profiler;
    exports.StrictMode = StrictMode;
    exports.Suspense = Suspense;
    exports.isValidElementType = isValidElementType;
    exports.isAsyncMode = isAsyncMode;
    exports.isConcurrentMode = isConcurrentMode;
    exports.isContextConsumer = isContextConsumer;
    exports.isContextProvider = isContextProvider;
    exports.isElement = isElement;
    exports.isForwardRef = isForwardRef;
    exports.isFragment = isFragment;
    exports.isLazy = isLazy;
    exports.isMemo = isMemo;
    exports.isPortal = isPortal;
    exports.isProfiler = isProfiler;
    exports.isStrictMode = isStrictMode;
    exports.isSuspense = isSuspense;
      })();
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    
    /**
     * Copyright (c) 2013-present, Facebook, Inc.
     *
     * This source code is licensed under the MIT license found in the
     * LICENSE file in the root directory of this source tree.
     */
    
    var ReactIs = __webpack_require__(1595);
    var assign = __webpack_require__(1598);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var ReactPropTypesSecret = __webpack_require__(1599);
    var checkPropTypes = __webpack_require__(1600);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    var has = Function.call.bind(Object.prototype.hasOwnProperty);
    var printWarning = function() {};
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    if (true) {
      printWarning = function(text) {
        var message = 'Warning: ' + text;
        if (typeof console !== 'undefined') {
          console.error(message);
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
        try {
          // --- Welcome to debugging React ---
          // This error was thrown as a convenience so that you can use this stack
          // to find the callsite that caused this warning to fire.
          throw new Error(message);
        } catch (x) {}
      };
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    function emptyFunctionThatReturnsNull() {
      return null;
    }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
    module.exports = function(isValidElement, throwOnDirectAccess) {
      /* global Symbol */
      var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
      var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
    
      /**
       * Returns the iterator method function contained on the iterable object.
       *
       * Be sure to invoke the function with the iterable as context:
       *
       *     var iteratorFn = getIteratorFn(myIterable);
       *     if (iteratorFn) {
       *       var iterator = iteratorFn.call(myIterable);
       *       ...
       *     }
       *
       * @param {?object} maybeIterable
       * @return {?function}
       */
      function getIteratorFn(maybeIterable) {
        var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
        if (typeof iteratorFn === 'function') {
          return iteratorFn;
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * Collection of methods that allow declaration and validation of props that are
       * supplied to React components. Example usage:
       *
       *   var Props = require('ReactPropTypes');
       *   var MyArticle = React.createClass({
       *     propTypes: {
       *       // An optional string prop named "description".
       *       description: Props.string,
       *
       *       // A required enum prop named "category".
       *       category: Props.oneOf(['News','Photos']).isRequired,
       *
       *       // A prop named "dialog" that requires an instance of Dialog.
       *       dialog: Props.instanceOf(Dialog).isRequired
       *     },
       *     render: function() { ... }
       *   });
       *
       * A more formal specification of how these methods are used:
       *
       *   type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
       *   decl := ReactPropTypes.{type}(.isRequired)?
       *
       * Each and every declaration produces a function with the same signature. This
       * allows the creation of custom validation functions. For example:
       *
       *  var MyLink = React.createClass({
       *    propTypes: {
       *      // An optional string or URI prop named "href".
       *      href: function(props, propName, componentName) {
       *        var propValue = props[propName];
       *        if (propValue != null && typeof propValue !== 'string' &&
       *            !(propValue instanceof URI)) {
       *          return new Error(
       *            'Expected a string or an URI for ' + propName + ' in ' +
       *            componentName
       *          );
       *        }
       *      }
       *    },
       *    render: function() {...}
       *  });
       *
       * @internal
       */
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      var ANONYMOUS = '<<anonymous>>';
    
      // Important!
      // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
      var ReactPropTypes = {
        array: createPrimitiveTypeChecker('array'),
        bool: createPrimitiveTypeChecker('boolean'),
        func: createPrimitiveTypeChecker('function'),
        number: createPrimitiveTypeChecker('number'),
        object: createPrimitiveTypeChecker('object'),
        string: createPrimitiveTypeChecker('string'),
        symbol: createPrimitiveTypeChecker('symbol'),
    
        any: createAnyTypeChecker(),
        arrayOf: createArrayOfTypeChecker,
        element: createElementTypeChecker(),
        elementType: createElementTypeTypeChecker(),
        instanceOf: createInstanceTypeChecker,
        node: createNodeChecker(),
        objectOf: createObjectOfTypeChecker,
        oneOf: createEnumTypeChecker,
        oneOfType: createUnionTypeChecker,
        shape: createShapeTypeChecker,
        exact: createStrictShapeTypeChecker,
      };
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * inlined Object.is polyfill to avoid requiring consumers ship their own
       * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
       */
      /*eslint-disable no-self-compare*/
      function is(x, y) {
        // SameValue algorithm
        if (x === y) {
          // Steps 1-5, 7-10
          // Steps 6.b-6.e: +0 != -0
          return x !== 0 || 1 / x === 1 / y;
        } else {
          // Step 6.a: NaN == NaN
          return x !== x && y !== y;
        }
      }
      /*eslint-enable no-self-compare*/
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      /**
       * We use an Error-like object for backward compatibility as people may call
       * PropTypes directly and inspect their output. However, we don't use real
       * Errors anymore. We don't inspect their stack anyway, and creating them
       * is prohibitively expensive if they are created too often, such as what
       * happens in oneOfType() for any type before the one that matched.
       */
      function PropTypeError(message) {
        this.message = message;
        this.stack = '';
      }
      // Make `instanceof Error` still work for returned errors.
      PropTypeError.prototype = Error.prototype;
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      function createChainableTypeChecker(validate) {
        if (true) {
          var manualPropTypeCallCache = {};
          var manualPropTypeWarningCount = 0;
        }
        function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
          componentName = componentName || ANONYMOUS;
          propFullName = propFullName || propName;
    
          if (secret !== ReactPropTypesSecret) {
            if (throwOnDirectAccess) {
              // New behavior only for users of `prop-types` package
              var err = new Error(
                'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
                'Use `PropTypes.checkPropTypes()` to call them. ' +
                'Read more at http://fb.me/use-check-prop-types'
              );
              err.name = 'Invariant Violation';
              throw err;
            } else if ( true && typeof console !== 'undefined') {
              // Old behavior for people using React.PropTypes
              var cacheKey = componentName + ':' + propName;
              if (
                !manualPropTypeCallCache[cacheKey] &&
                // Avoid spamming the console because they are often not actionable except for lib authors
                manualPropTypeWarningCount < 3
              ) {
                printWarning(
                  'You are manually calling a React.PropTypes validation ' +
                  'function for the `' + propFullName + '` prop on `' + componentName  + '`. This is deprecated ' +
                  'and will throw in the standalone `prop-types` package. ' +
                  'You may be seeing this warning due to a third-party PropTypes ' +
                  'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
                );
                manualPropTypeCallCache[cacheKey] = true;
                manualPropTypeWarningCount++;
              }
            }
          }
          if (props[propName] == null) {
            if (isRequired) {
              if (props[propName] === null) {
                return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
              }
              return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
            }
            return null;
          } else {
            return validate(props, propName, componentName, location, propFullName);
          }
        }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        var chainedCheckType = checkType.bind(null, false);
        chainedCheckType.isRequired = checkType.bind(null, true);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
        return chainedCheckType;
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      function createPrimitiveTypeChecker(expectedType) {
        function validate(props, propName, componentName, location, propFullName, secret) {
          var propValue = props[propName];
          var propType = getPropType(propValue);
          if (propType !== expectedType) {
            // `propValue` being instance of, say, date/regexp, pass the 'object'
            // check, but we can offer a more precise error message here rather than
            // 'of type `object`'.
            var preciseType = getPreciseType(propValue);
    
    Romain CREY's avatar
    Romain CREY committed
    
    
            return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
          }
          return null;
        }
        return createChainableTypeChecker(validate);
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      function createAnyTypeChecker() {
        return createChainableTypeChecker(emptyFunctionThatReturnsNull);
      }
    
    Romain CREY's avatar
    Romain CREY committed
    
    
      function createArrayOfTypeChecker(typeChecker) {
        function validate(props, propName, componentName, location, propFullName) {
          if (typeof typeChecker !== 'function') {
            return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
          }
          var propValue = props[propName];
          if (!Array.isArray(propValue)) {
            var propType = getPropType(propValue);
            return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
          }
          for (var i = 0; i < propValue.length; i++) {
            var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
            if (error instanceof Error) {
              return error;
            }
          }
          return null;
    
    Romain CREY's avatar
    Romain CREY committed
        }
    
        return createChainableTypeChecker(validate);
    
    Romain CREY's avatar
    Romain CREY committed
      }
    
    
      function createElementTypeChecker() {