From c548b3bd3f0de1a1a74606d60ef9fdd323792918 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 18 Mar 2017 21:42:30 +0100 Subject: user authentication in browser --- public/bundle.js | 31238 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 19547 insertions(+), 11691 deletions(-) (limited to 'public/bundle.js') diff --git a/public/bundle.js b/public/bundle.js index 1de8dc3..6ad2977 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -63,7 +63,7 @@ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 178); +/******/ return __webpack_require__(__webpack_require__.s = 230); /******/ }) /************************************************************************/ /******/ ([ @@ -548,7 +548,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { var _prodInvariant = __webpack_require__(3); var DOMProperty = __webpack_require__(13); -var ReactDOMComponentFlags = __webpack_require__(59); +var ReactDOMComponentFlags = __webpack_require__(71); var invariant = __webpack_require__(1); @@ -1133,7 +1133,7 @@ module.exports = ReactComponentTreeHook; var debugTool = null; if (process.env.NODE_ENV !== 'production') { - var ReactDebugTool = __webpack_require__(124); + var ReactDebugTool = __webpack_require__(168); debugTool = ReactDebugTool; } @@ -1204,11 +1204,11 @@ module.exports = emptyFunction; var _prodInvariant = __webpack_require__(3), _assign = __webpack_require__(4); -var CallbackQueue = __webpack_require__(57); +var CallbackQueue = __webpack_require__(69); var PooledClass = __webpack_require__(14); -var ReactFeatureFlags = __webpack_require__(62); -var ReactReconciler = __webpack_require__(18); -var Transaction = __webpack_require__(28); +var ReactFeatureFlags = __webpack_require__(74); +var ReactReconciler = __webpack_require__(19); +var Transaction = __webpack_require__(32); var invariant = __webpack_require__(1); @@ -2107,10 +2107,10 @@ var _assign = __webpack_require__(4); var ReactCurrentOwner = __webpack_require__(11); var warning = __webpack_require__(2); -var canDefineProperty = __webpack_require__(50); +var canDefineProperty = __webpack_require__(56); var hasOwnProperty = Object.prototype.hasOwnProperty; -var REACT_ELEMENT_TYPE = __webpack_require__(77); +var REACT_ELEMENT_TYPE = __webpack_require__(89); var RESERVED_PROPS = { key: true, @@ -2480,6 +2480,54 @@ module.exports = reactProdInvariant; /* 17 */ /***/ (function(module, exports, __webpack_require__) { +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _arguments = __webpack_require__(115); + +var _arguments2 = _interopRequireDefault(_arguments); + +var _utils = __webpack_require__(63); + +var _hooks = __webpack_require__(116); + +var _hooks2 = _interopRequireDefault(_hooks); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = { + _: _utils._, + getArguments: _arguments2.default, + stripSlashes: _utils.stripSlashes, + hooks: _hooks2.default, + matcher: _utils.matcher, + sorter: _utils.sorter, + select: _utils.select, + makeUrl: _utils.makeUrl, + // lodash functions + each: _utils.each, + some: _utils.some, + every: _utils.every, + keys: _utils.keys, + values: _utils.values, + isMatch: _utils.isMatch, + isEmpty: _utils.isEmpty, + isObject: _utils.isObject, + extend: _utils.extend, + omit: _utils.omit, + pick: _utils.pick, + merge: _utils.merge +}; +module.exports = exports['default']; + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + "use strict"; /** * Copyright 2015-present, Facebook, Inc. @@ -2493,11 +2541,11 @@ module.exports = reactProdInvariant; -var DOMNamespaces = __webpack_require__(33); -var setInnerHTML = __webpack_require__(30); +var DOMNamespaces = __webpack_require__(39); +var setInnerHTML = __webpack_require__(34); -var createMicrosoftUnsafeLocalFunction = __webpack_require__(40); -var setTextContent = __webpack_require__(75); +var createMicrosoftUnsafeLocalFunction = __webpack_require__(46); +var setTextContent = __webpack_require__(87); var ELEMENT_NODE_TYPE = 1; var DOCUMENT_FRAGMENT_NODE_TYPE = 11; @@ -2600,7 +2648,7 @@ DOMLazyTree.queueText = queueText; module.exports = DOMLazyTree; /***/ }), -/* 18 */ +/* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2616,7 +2664,7 @@ module.exports = DOMLazyTree; -var ReactRef = __webpack_require__(138); +var ReactRef = __webpack_require__(182); var ReactInstrumentation = __webpack_require__(8); var warning = __webpack_require__(2); @@ -2774,7 +2822,7 @@ module.exports = ReactReconciler; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 19 */ +/* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2792,16 +2840,16 @@ module.exports = ReactReconciler; var _assign = __webpack_require__(4); -var ReactChildren = __webpack_require__(169); -var ReactComponent = __webpack_require__(47); -var ReactPureComponent = __webpack_require__(173); -var ReactClass = __webpack_require__(170); -var ReactDOMFactories = __webpack_require__(171); +var ReactChildren = __webpack_require__(213); +var ReactComponent = __webpack_require__(53); +var ReactPureComponent = __webpack_require__(217); +var ReactClass = __webpack_require__(214); +var ReactDOMFactories = __webpack_require__(215); var ReactElement = __webpack_require__(15); -var ReactPropTypes = __webpack_require__(172); -var ReactVersion = __webpack_require__(174); +var ReactPropTypes = __webpack_require__(216); +var ReactVersion = __webpack_require__(218); -var onlyChild = __webpack_require__(176); +var onlyChild = __webpack_require__(220); var warning = __webpack_require__(2); var createElement = ReactElement.createElement; @@ -2809,7 +2857,7 @@ var createFactory = ReactElement.createFactory; var cloneElement = ReactElement.cloneElement; if (process.env.NODE_ENV !== 'production') { - var ReactElementValidator = __webpack_require__(78); + var ReactElementValidator = __webpack_require__(90); createElement = ReactElementValidator.createElement; createFactory = ReactElementValidator.createFactory; cloneElement = ReactElementValidator.cloneElement; @@ -2869,7 +2917,7 @@ module.exports = React; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 20 */ +/* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2895,7 +2943,159 @@ module.exports = emptyObject; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 21 */ +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _qs = __webpack_require__(137); + +var _qs2 = _interopRequireDefault(_qs); + +var _feathersCommons = __webpack_require__(17); + +var _feathersErrors = __webpack_require__(28); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function toError(error) { + throw (0, _feathersErrors.convert)(error); +} + +var Base = function () { + function Base(settings) { + _classCallCheck(this, Base); + + this.name = (0, _feathersCommons.stripSlashes)(settings.name); + this.options = settings.options; + this.connection = settings.connection; + this.base = settings.base + '/' + this.name; + } + + _createClass(Base, [{ + key: 'makeUrl', + value: function makeUrl(params, id) { + params = params || {}; + var url = this.base; + + if (typeof id !== 'undefined' && id !== null) { + url += '/' + id; + } + + if (Object.keys(params).length !== 0) { + var queryString = _qs2.default.stringify(params); + + url += '?' + queryString; + } + + return url; + } + }, { + key: 'find', + value: function find() { + var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + return this.request({ + url: this.makeUrl(params.query), + method: 'GET', + headers: _extends({}, params.headers) + }).catch(toError); + } + }, { + key: 'get', + value: function get(id) { + var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (typeof id === 'undefined') { + return Promise.reject(new Error('id for \'get\' can not be undefined')); + } + + return this.request({ + url: this.makeUrl(params.query, id), + method: 'GET', + headers: _extends({}, params.headers) + }).catch(toError); + } + }, { + key: 'create', + value: function create(body) { + var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + return this.request({ + url: this.makeUrl(params.query), + body: body, + method: 'POST', + headers: _extends({ 'Content-Type': 'application/json' }, params.headers) + }).catch(toError); + } + }, { + key: 'update', + value: function update(id, body) { + var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + if (typeof id === 'undefined') { + return Promise.reject(new Error('id for \'update\' can not be undefined, only \'null\' when updating multiple entries')); + } + + return this.request({ + url: this.makeUrl(params.query, id), + body: body, + method: 'PUT', + headers: _extends({ 'Content-Type': 'application/json' }, params.headers) + }).catch(toError); + } + }, { + key: 'patch', + value: function patch(id, body) { + var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + if (typeof id === 'undefined') { + return Promise.reject(new Error('id for \'patch\' can not be undefined, only \'null\' when updating multiple entries')); + } + + return this.request({ + url: this.makeUrl(params.query, id), + body: body, + method: 'PATCH', + headers: _extends({ 'Content-Type': 'application/json' }, params.headers) + }).catch(toError); + } + }, { + key: 'remove', + value: function remove(id) { + var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (typeof id === 'undefined') { + return Promise.reject(new Error('id for \'remove\' can not be undefined, only \'null\' when removing multiple entries')); + } + + return this.request({ + url: this.makeUrl(params.query, id), + method: 'DELETE', + headers: _extends({}, params.headers) + }).catch(toError); + } + }]); + + return Base; +}(); + +exports.default = Base; +module.exports = exports['default']; + +/***/ }), +/* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2913,12 +3113,12 @@ module.exports = emptyObject; var _prodInvariant = __webpack_require__(3); -var EventPluginRegistry = __webpack_require__(25); -var EventPluginUtils = __webpack_require__(34); -var ReactErrorUtils = __webpack_require__(38); +var EventPluginRegistry = __webpack_require__(29); +var EventPluginUtils = __webpack_require__(40); +var ReactErrorUtils = __webpack_require__(44); -var accumulateInto = __webpack_require__(69); -var forEachAccumulated = __webpack_require__(70); +var accumulateInto = __webpack_require__(81); +var forEachAccumulated = __webpack_require__(82); var invariant = __webpack_require__(1); /** @@ -3179,7 +3379,7 @@ module.exports = EventPluginHub; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 22 */ +/* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3195,11 +3395,11 @@ module.exports = EventPluginHub; -var EventPluginHub = __webpack_require__(21); -var EventPluginUtils = __webpack_require__(34); +var EventPluginHub = __webpack_require__(23); +var EventPluginUtils = __webpack_require__(40); -var accumulateInto = __webpack_require__(69); -var forEachAccumulated = __webpack_require__(70); +var accumulateInto = __webpack_require__(81); +var forEachAccumulated = __webpack_require__(82); var warning = __webpack_require__(2); var getListener = EventPluginHub.getListener; @@ -3319,7 +3519,7 @@ module.exports = EventPropagators; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 23 */ +/* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3372,7 +3572,7 @@ var ReactInstanceMap = { module.exports = ReactInstanceMap; /***/ }), -/* 24 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3390,7 +3590,7 @@ module.exports = ReactInstanceMap; var SyntheticEvent = __webpack_require__(12); -var getEventTarget = __webpack_require__(43); +var getEventTarget = __webpack_require__(49); /** * @interface UIEvent @@ -3436,7 +3636,402 @@ SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); module.exports = SyntheticUIEvent; /***/ }), -/* 25 */ +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = __webpack_require__(20); + + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _extendableBuiltin(cls) { + function ExtendableBuiltin() { + var instance = Reflect.construct(cls, Array.from(arguments)); + Object.setPrototypeOf(instance, Object.getPrototypeOf(this)); + return instance; + } + + ExtendableBuiltin.prototype = Object.create(cls.prototype, { + constructor: { + value: cls, + enumerable: false, + writable: true, + configurable: true + } + }); + + if (Object.setPrototypeOf) { + Object.setPrototypeOf(ExtendableBuiltin, cls); + } else { + ExtendableBuiltin.__proto__ = cls; + } + + return ExtendableBuiltin; +} + +var debug = __webpack_require__(59)('feathers-errors'); + +// NOTE (EK): Babel doesn't properly support extending +// some classes in ES6. The Error class being one of them. +// Node v5.0+ does support this but until we want to drop support +// for older versions we need this hack. +// http://stackoverflow.com/questions/33870684/why-doesnt-instanceof-work-on-instances-of-error-subclasses-under-babel-node +// https://github.com/loganfsmyth/babel-plugin-transform-builtin-extend + +var FeathersError = function (_extendableBuiltin2) { + _inherits(FeathersError, _extendableBuiltin2); + + function FeathersError(msg, name, code, className, data) { + _classCallCheck(this, FeathersError); + + msg = msg || 'Error'; + + var errors = void 0; + var message = void 0; + var newData = void 0; + + if (msg instanceof Error) { + message = msg.message || 'Error'; + + // NOTE (EK): This is typically to handle validation errors + if (msg.errors) { + errors = msg.errors; + } + } else if ((typeof msg === 'undefined' ? 'undefined' : _typeof(msg)) === 'object') { + // Support plain old objects + message = msg.message || 'Error'; + data = msg; + } else { + // message is just a string + message = msg; + } + + if (data) { + // NOTE(EK): To make sure that we are not messing + // with immutable data, just make a copy. + // https://github.com/feathersjs/feathers-errors/issues/19 + newData = _extends({}, data); + + if (newData.errors) { + errors = newData.errors; + delete newData.errors; + } + } + + // NOTE (EK): Babel doesn't support this so + // we have to pass in the class name manually. + // this.name = this.constructor.name; + var _this = _possibleConstructorReturn(this, (FeathersError.__proto__ || Object.getPrototypeOf(FeathersError)).call(this, message)); + + _this.type = 'FeathersError'; + _this.name = name; + _this.message = message; + _this.code = code; + _this.className = className; + _this.data = newData; + _this.errors = errors || {}; + + debug(_this.name + '(' + _this.code + '): ' + _this.message); + return _this; + } + + // NOTE (EK): A little hack to get around `message` not + // being included in the default toJSON call. + + + _createClass(FeathersError, [{ + key: 'toJSON', + value: function toJSON() { + return { + name: this.name, + message: this.message, + code: this.code, + className: this.className, + data: this.data, + errors: this.errors + }; + } + }]); + + return FeathersError; +}(_extendableBuiltin(Error)); + +var BadRequest = function (_FeathersError) { + _inherits(BadRequest, _FeathersError); + + function BadRequest(message, data) { + _classCallCheck(this, BadRequest); + + return _possibleConstructorReturn(this, (BadRequest.__proto__ || Object.getPrototypeOf(BadRequest)).call(this, message, 'BadRequest', 400, 'bad-request', data)); + } + + return BadRequest; +}(FeathersError); + +var NotAuthenticated = function (_FeathersError2) { + _inherits(NotAuthenticated, _FeathersError2); + + function NotAuthenticated(message, data) { + _classCallCheck(this, NotAuthenticated); + + return _possibleConstructorReturn(this, (NotAuthenticated.__proto__ || Object.getPrototypeOf(NotAuthenticated)).call(this, message, 'NotAuthenticated', 401, 'not-authenticated', data)); + } + + return NotAuthenticated; +}(FeathersError); + +var PaymentError = function (_FeathersError3) { + _inherits(PaymentError, _FeathersError3); + + function PaymentError(message, data) { + _classCallCheck(this, PaymentError); + + return _possibleConstructorReturn(this, (PaymentError.__proto__ || Object.getPrototypeOf(PaymentError)).call(this, message, 'PaymentError', 402, 'payment-error', data)); + } + + return PaymentError; +}(FeathersError); + +var Forbidden = function (_FeathersError4) { + _inherits(Forbidden, _FeathersError4); + + function Forbidden(message, data) { + _classCallCheck(this, Forbidden); + + return _possibleConstructorReturn(this, (Forbidden.__proto__ || Object.getPrototypeOf(Forbidden)).call(this, message, 'Forbidden', 403, 'forbidden', data)); + } + + return Forbidden; +}(FeathersError); + +var NotFound = function (_FeathersError5) { + _inherits(NotFound, _FeathersError5); + + function NotFound(message, data) { + _classCallCheck(this, NotFound); + + return _possibleConstructorReturn(this, (NotFound.__proto__ || Object.getPrototypeOf(NotFound)).call(this, message, 'NotFound', 404, 'not-found', data)); + } + + return NotFound; +}(FeathersError); + +var MethodNotAllowed = function (_FeathersError6) { + _inherits(MethodNotAllowed, _FeathersError6); + + function MethodNotAllowed(message, data) { + _classCallCheck(this, MethodNotAllowed); + + return _possibleConstructorReturn(this, (MethodNotAllowed.__proto__ || Object.getPrototypeOf(MethodNotAllowed)).call(this, message, 'MethodNotAllowed', 405, 'method-not-allowed', data)); + } + + return MethodNotAllowed; +}(FeathersError); + +var NotAcceptable = function (_FeathersError7) { + _inherits(NotAcceptable, _FeathersError7); + + function NotAcceptable(message, data) { + _classCallCheck(this, NotAcceptable); + + return _possibleConstructorReturn(this, (NotAcceptable.__proto__ || Object.getPrototypeOf(NotAcceptable)).call(this, message, 'NotAcceptable', 406, 'not-acceptable', data)); + } + + return NotAcceptable; +}(FeathersError); + +var Timeout = function (_FeathersError8) { + _inherits(Timeout, _FeathersError8); + + function Timeout(message, data) { + _classCallCheck(this, Timeout); + + return _possibleConstructorReturn(this, (Timeout.__proto__ || Object.getPrototypeOf(Timeout)).call(this, message, 'Timeout', 408, 'timeout', data)); + } + + return Timeout; +}(FeathersError); + +var Conflict = function (_FeathersError9) { + _inherits(Conflict, _FeathersError9); + + function Conflict(message, data) { + _classCallCheck(this, Conflict); + + return _possibleConstructorReturn(this, (Conflict.__proto__ || Object.getPrototypeOf(Conflict)).call(this, message, 'Conflict', 409, 'conflict', data)); + } + + return Conflict; +}(FeathersError); + +var LengthRequired = function (_FeathersError10) { + _inherits(LengthRequired, _FeathersError10); + + function LengthRequired(message, data) { + _classCallCheck(this, LengthRequired); + + return _possibleConstructorReturn(this, (LengthRequired.__proto__ || Object.getPrototypeOf(LengthRequired)).call(this, message, 'LengthRequired', 411, 'length-required', data)); + } + + return LengthRequired; +}(FeathersError); + +var Unprocessable = function (_FeathersError11) { + _inherits(Unprocessable, _FeathersError11); + + function Unprocessable(message, data) { + _classCallCheck(this, Unprocessable); + + return _possibleConstructorReturn(this, (Unprocessable.__proto__ || Object.getPrototypeOf(Unprocessable)).call(this, message, 'Unprocessable', 422, 'unprocessable', data)); + } + + return Unprocessable; +}(FeathersError); + +var TooManyRequests = function (_FeathersError12) { + _inherits(TooManyRequests, _FeathersError12); + + function TooManyRequests(message, data) { + _classCallCheck(this, TooManyRequests); + + return _possibleConstructorReturn(this, (TooManyRequests.__proto__ || Object.getPrototypeOf(TooManyRequests)).call(this, message, 'TooManyRequests', 429, 'too-many-requests', data)); + } + + return TooManyRequests; +}(FeathersError); + +var GeneralError = function (_FeathersError13) { + _inherits(GeneralError, _FeathersError13); + + function GeneralError(message, data) { + _classCallCheck(this, GeneralError); + + return _possibleConstructorReturn(this, (GeneralError.__proto__ || Object.getPrototypeOf(GeneralError)).call(this, message, 'GeneralError', 500, 'general-error', data)); + } + + return GeneralError; +}(FeathersError); + +var NotImplemented = function (_FeathersError14) { + _inherits(NotImplemented, _FeathersError14); + + function NotImplemented(message, data) { + _classCallCheck(this, NotImplemented); + + return _possibleConstructorReturn(this, (NotImplemented.__proto__ || Object.getPrototypeOf(NotImplemented)).call(this, message, 'NotImplemented', 501, 'not-implemented', data)); + } + + return NotImplemented; +}(FeathersError); + +var BadGateway = function (_FeathersError15) { + _inherits(BadGateway, _FeathersError15); + + function BadGateway(message, data) { + _classCallCheck(this, BadGateway); + + return _possibleConstructorReturn(this, (BadGateway.__proto__ || Object.getPrototypeOf(BadGateway)).call(this, message, 'BadGateway', 502, 'bad-gateway', data)); + } + + return BadGateway; +}(FeathersError); + +var Unavailable = function (_FeathersError16) { + _inherits(Unavailable, _FeathersError16); + + function Unavailable(message, data) { + _classCallCheck(this, Unavailable); + + return _possibleConstructorReturn(this, (Unavailable.__proto__ || Object.getPrototypeOf(Unavailable)).call(this, message, 'Unavailable', 503, 'unavailable', data)); + } + + return Unavailable; +}(FeathersError); + +var errors = { + FeathersError: FeathersError, + BadRequest: BadRequest, + NotAuthenticated: NotAuthenticated, + PaymentError: PaymentError, + Forbidden: Forbidden, + NotFound: NotFound, + MethodNotAllowed: MethodNotAllowed, + NotAcceptable: NotAcceptable, + Timeout: Timeout, + Conflict: Conflict, + LengthRequired: LengthRequired, + Unprocessable: Unprocessable, + TooManyRequests: TooManyRequests, + GeneralError: GeneralError, + NotImplemented: NotImplemented, + BadGateway: BadGateway, + Unavailable: Unavailable, + 400: BadRequest, + 401: NotAuthenticated, + 402: PaymentError, + 403: Forbidden, + 404: NotFound, + 405: MethodNotAllowed, + 406: NotAcceptable, + 408: Timeout, + 409: Conflict, + 411: LengthRequired, + 422: Unprocessable, + 429: TooManyRequests, + 500: GeneralError, + 501: NotImplemented, + 502: BadGateway, + 503: Unavailable +}; + +function convert(error) { + if (!error) { + return error; + } + + var FeathersError = errors[error.name]; + var result = FeathersError ? new FeathersError(error.message, error.data) : new Error(error.message || error); + + if ((typeof error === 'undefined' ? 'undefined' : _typeof(error)) === 'object') { + _extends(result, error); + } + + return result; +} + +exports.default = _extends({ + convert: convert, + types: errors, + errors: errors +}, errors); +module.exports = exports['default']; + +/***/ }), +/* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3697,7 +4292,7 @@ module.exports = EventPluginRegistry; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 26 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3715,12 +4310,12 @@ module.exports = EventPluginRegistry; var _assign = __webpack_require__(4); -var EventPluginRegistry = __webpack_require__(25); -var ReactEventEmitterMixin = __webpack_require__(128); -var ViewportMetrics = __webpack_require__(68); +var EventPluginRegistry = __webpack_require__(29); +var ReactEventEmitterMixin = __webpack_require__(172); +var ViewportMetrics = __webpack_require__(80); -var getVendorPrefixedEventName = __webpack_require__(164); -var isEventSupported = __webpack_require__(44); +var getVendorPrefixedEventName = __webpack_require__(208); +var isEventSupported = __webpack_require__(50); /** * Summary of `ReactBrowserEventEmitter` event handling: @@ -4030,7 +4625,7 @@ var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, { module.exports = ReactBrowserEventEmitter; /***/ }), -/* 27 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4046,10 +4641,10 @@ module.exports = ReactBrowserEventEmitter; -var SyntheticUIEvent = __webpack_require__(24); -var ViewportMetrics = __webpack_require__(68); +var SyntheticUIEvent = __webpack_require__(26); +var ViewportMetrics = __webpack_require__(80); -var getEventModifierState = __webpack_require__(42); +var getEventModifierState = __webpack_require__(48); /** * @interface MouseEvent @@ -4107,7 +4702,7 @@ SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); module.exports = SyntheticMouseEvent; /***/ }), -/* 28 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4338,7 +4933,7 @@ module.exports = TransactionImpl; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 29 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4466,7 +5061,7 @@ function escapeTextContentForBrowser(text) { module.exports = escapeTextContentForBrowser; /***/ }), -/* 30 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4483,12 +5078,12 @@ module.exports = escapeTextContentForBrowser; var ExecutionEnvironment = __webpack_require__(6); -var DOMNamespaces = __webpack_require__(33); +var DOMNamespaces = __webpack_require__(39); var WHITESPACE_TEST = /^[ \r\n\t\f]/; var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; -var createMicrosoftUnsafeLocalFunction = __webpack_require__(40); +var createMicrosoftUnsafeLocalFunction = __webpack_require__(46); // SVG temp container for IE lacking innerHTML var reusableSVGContainer; @@ -4569,7 +5164,466 @@ if (ExecutionEnvironment.canUseDOM) { module.exports = setInnerHTML; /***/ }), -/* 31 */ +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* global define */ +/** + * A base object for ECMAScript 5 style prototypal inheritance. + * + * @see https://github.com/rauschma/proto-js/ + * @see http://ejohn.org/blog/simple-javascript-inheritance/ + * @see http://uxebu.com/blog/2011/02/23/object-based-inheritance-for-ecmascript-5/ + */ +(function (root, factory) { + if (true) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else if (typeof exports === 'object') { + module.exports = factory(); + } else { + root.Proto = factory(); + } +}(this, function () { + + function makeSuper(_super, old, name, fn) { + return function () { + var tmp = this._super; + + // Add a new ._super() method that is the same method + // but either pointing to the prototype method + // or to the overwritten method + this._super = (typeof old === 'function') ? old : _super[name]; + + // The method only need to be bound temporarily, so we + // remove it when we're done executing + var ret = fn.apply(this, arguments); + this._super = tmp; + + return ret; + }; + } + + function legacyMixin(prop, obj) { + var self = obj || this; + var fnTest = /\b_super\b/; + var _super = Object.getPrototypeOf(self) || self.prototype; + var _old; + + // Copy the properties over + for (var name in prop) { + // store the old function which would be overwritten + _old = self[name]; + + // Check if we're overwriting an existing function + if( + (( + typeof prop[name] === 'function' && + typeof _super[name] === 'function' + ) || ( + typeof _old === 'function' && + typeof prop[name] === 'function' + )) && fnTest.test(prop[name]) + ) { + self[name] = makeSuper(_super, _old, name, prop[name]); + } else { + self[name] = prop[name]; + } + } + + return self; + } + + function es5Mixin(prop, obj) { + var self = obj || this; + var fnTest = /\b_super\b/; + var _super = Object.getPrototypeOf(self) || self.prototype; + var descriptors = {}; + var proto = prop; + var processProperty = function(name) { + if(!descriptors[name]) { + descriptors[name] = Object.getOwnPropertyDescriptor(proto, name); + } + }; + + // Collect all property descriptors + do { + Object.getOwnPropertyNames(proto).forEach(processProperty); + } while((proto = Object.getPrototypeOf(proto)) && Object.getPrototypeOf(proto)); + + Object.keys(descriptors).forEach(function(name) { + var descriptor = descriptors[name]; + + if(typeof descriptor.value === 'function' && fnTest.test(descriptor.value)) { + descriptor.value = makeSuper(_super, self[name], name, descriptor.value); + } + + Object.defineProperty(self, name, descriptor); + }); + + return self; + } + + return { + /** + * Create a new object using Object.create. The arguments will be + * passed to the new instances init method or to a method name set in + * __init. + */ + create: function () { + var instance = Object.create(this); + var init = typeof instance.__init === 'string' ? instance.__init : 'init'; + + if (typeof instance[init] === 'function') { + instance[init].apply(instance, arguments); + } + return instance; + }, + /** + * Mixin a given set of properties + * @param prop The properties to mix in + * @param obj [optional] The object to add the mixin + */ + mixin: typeof Object.defineProperty === 'function' ? es5Mixin : legacyMixin, + /** + * Extend the current or a given object with the given property + * and return the extended object. + * @param prop The properties to extend with + * @param obj [optional] The object to extend from + * @returns The extended object + */ + extend: function (prop, obj) { + return this.mixin(prop, Object.create(obj || this)); + }, + /** + * Return a callback function with this set to the current or a given context object. + * @param name Name of the method to proxy + * @param args... [optional] Arguments to use for partial application + */ + proxy: function (name) { + var fn = this[name]; + var args = Array.prototype.slice.call(arguments, 1); + + args.unshift(this); + return fn.bind.apply(fn, args); + } + }; + +})); + + +/***/ }), +/* 36 */ +/***/ (function(module, exports) { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function(n) { + if (!isNumber(n) || n < 0 || isNaN(n)) + throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; + +EventEmitter.prototype.emit = function(type) { + var er, handler, len, args, i, listeners; + + if (!this._events) + this._events = {}; + + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || + (isObject(this._events.error) && !this._events.error.length)) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } else { + // At least give some kind of context to the user + var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); + err.context = er; + throw err; + } + } + } + + handler = this._events[type]; + + if (isUndefined(handler)) + return false; + + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + args = Array.prototype.slice.call(arguments, 1); + handler.apply(this, args); + } + } else if (isObject(handler)) { + args = Array.prototype.slice.call(arguments, 1); + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) + listeners[i].apply(this, args); + } + + return true; +}; + +EventEmitter.prototype.addListener = function(type, listener) { + var m; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events) + this._events = {}; + + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) + this.emit('newListener', type, + isFunction(listener.listener) ? + listener.listener : listener); + + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener); + else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } + + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; +}; + +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events || !this._events[type]) + return this; + + list = this._events[type]; + length = list.length; + position = -1; + + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); + + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } + + if (position < 0) + return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; + + if (!this._events) + return this; + + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } + + listeners = this._events[type]; + + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else if (listeners) { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; + + return this; +}; + +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; + +EventEmitter.prototype.listenerCount = function(type) { + if (this._events) { + var evlistener = this._events[type]; + + if (isFunction(evlistener)) + return 1; + else if (evlistener) + return evlistener.length; + } + return 0; +}; + +EventEmitter.listenerCount = function(emitter, type) { + return emitter.listenerCount(type); +}; + +function isFunction(arg) { + return typeof arg === 'function'; +} + +function isNumber(arg) { + return typeof arg === 'number'; +} + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} + +function isUndefined(arg) { + return arg === void 0; +} + + +/***/ }), +/* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4642,7 +5696,7 @@ function shallowEqual(objA, objB) { module.exports = shallowEqual; /***/ }), -/* 32 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4658,14 +5712,14 @@ module.exports = shallowEqual; -var DOMLazyTree = __webpack_require__(17); -var Danger = __webpack_require__(101); +var DOMLazyTree = __webpack_require__(18); +var Danger = __webpack_require__(145); var ReactDOMComponentTree = __webpack_require__(5); var ReactInstrumentation = __webpack_require__(8); -var createMicrosoftUnsafeLocalFunction = __webpack_require__(40); -var setInnerHTML = __webpack_require__(30); -var setTextContent = __webpack_require__(75); +var createMicrosoftUnsafeLocalFunction = __webpack_require__(46); +var setInnerHTML = __webpack_require__(34); +var setTextContent = __webpack_require__(87); function getNodeAfter(parentNode, node) { // Special case for text components, which return [open, close] comments @@ -4873,7 +5927,7 @@ module.exports = DOMChildrenOperations; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 33 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4898,7 +5952,7 @@ var DOMNamespaces = { module.exports = DOMNamespaces; /***/ }), -/* 34 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4916,7 +5970,7 @@ module.exports = DOMNamespaces; var _prodInvariant = __webpack_require__(3); -var ReactErrorUtils = __webpack_require__(38); +var ReactErrorUtils = __webpack_require__(44); var invariant = __webpack_require__(1); var warning = __webpack_require__(2); @@ -5130,7 +6184,7 @@ module.exports = EventPluginUtils; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 35 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5194,7 +6248,7 @@ var KeyEscapeUtils = { module.exports = KeyEscapeUtils; /***/ }), -/* 36 */ +/* 42 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5212,8 +6266,8 @@ module.exports = KeyEscapeUtils; var _prodInvariant = __webpack_require__(3); -var React = __webpack_require__(19); -var ReactPropTypesSecret = __webpack_require__(67); +var React = __webpack_require__(20); +var ReactPropTypesSecret = __webpack_require__(79); var invariant = __webpack_require__(1); var warning = __webpack_require__(2); @@ -5335,7 +6389,7 @@ module.exports = LinkedValueUtils; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 37 */ +/* 43 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5387,7 +6441,7 @@ module.exports = ReactComponentEnvironment; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 38 */ +/* 44 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5470,7 +6524,7 @@ module.exports = ReactErrorUtils; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 39 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5489,7 +6543,7 @@ module.exports = ReactErrorUtils; var _prodInvariant = __webpack_require__(3); var ReactCurrentOwner = __webpack_require__(11); -var ReactInstanceMap = __webpack_require__(23); +var ReactInstanceMap = __webpack_require__(25); var ReactInstrumentation = __webpack_require__(8); var ReactUpdates = __webpack_require__(10); @@ -5702,7 +6756,7 @@ module.exports = ReactUpdateQueue; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 40 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5739,7 +6793,7 @@ var createMicrosoftUnsafeLocalFunction = function (func) { module.exports = createMicrosoftUnsafeLocalFunction; /***/ }), -/* 41 */ +/* 47 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5794,7 +6848,7 @@ function getEventCharCode(nativeEvent) { module.exports = getEventCharCode; /***/ }), -/* 42 */ +/* 48 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5842,7 +6896,7 @@ function getEventModifierState(nativeEvent) { module.exports = getEventModifierState; /***/ }), -/* 43 */ +/* 49 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5882,7 +6936,7 @@ function getEventTarget(nativeEvent) { module.exports = getEventTarget; /***/ }), -/* 44 */ +/* 50 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5947,7 +7001,7 @@ function isEventSupported(eventNameSuffix, capture) { module.exports = isEventSupported; /***/ }), -/* 45 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5994,7 +7048,7 @@ function shouldUpdateReactComponent(prevElement, nextElement) { module.exports = shouldUpdateReactComponent; /***/ }), -/* 46 */ +/* 52 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6382,7 +7436,7 @@ module.exports = validateDOMNesting; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 47 */ +/* 53 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6400,10 +7454,10 @@ module.exports = validateDOMNesting; var _prodInvariant = __webpack_require__(16); -var ReactNoopUpdateQueue = __webpack_require__(48); +var ReactNoopUpdateQueue = __webpack_require__(54); -var canDefineProperty = __webpack_require__(50); -var emptyObject = __webpack_require__(20); +var canDefineProperty = __webpack_require__(56); +var emptyObject = __webpack_require__(21); var invariant = __webpack_require__(1); var warning = __webpack_require__(2); @@ -6506,7 +7560,7 @@ module.exports = ReactComponent; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 48 */ +/* 54 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6608,7 +7662,7 @@ module.exports = ReactNoopUpdateQueue; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 49 */ +/* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6639,7 +7693,7 @@ module.exports = ReactPropTypeLocationNames; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 50 */ +/* 56 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6671,7 +7725,7 @@ module.exports = canDefineProperty; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 51 */ +/* 57 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6717,53 +7771,251 @@ function getIteratorFn(maybeIterable) { module.exports = getIteratorFn; /***/ }), -/* 52 */ -/***/ (function(module, exports, __webpack_require__) { +/* 58 */ +/***/ (function(module, exports) { -"use strict"; +/** + * Check if `obj` is an object. + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ +function isObject(obj) { + return null !== obj && 'object' === typeof obj; +} -module.exports = __webpack_require__(19); +module.exports = isObject; /***/ }), -/* 53 */ +/* 59 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) { +/* WEBPACK VAR INJECTION */(function(process) {/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = __webpack_require__(97); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); /** - * Copyright (c) 2013-present, Facebook, Inc. + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window && typeof window.process !== 'undefined' && window.process.type === 'renderer') { + return true; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document && 'WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window && window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + +/** + * Colorize log arguments if enabled. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @api public + */ + +function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. * - * @typechecks + * @param {String} namespaces + * @api private */ -var emptyFunction = __webpack_require__(9); +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} /** - * Upstream version of event listener. Does not take into account specific - * nature of platform. + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private */ -var EventListener = { - /** - * Listen to DOM events during the bubble phase. - * - * @param {DOMEventTarget} target DOM element to register listener on. - * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. - * @param {function} callback Callback function. + +function load() { + try { + return exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (typeof process !== 'undefined' && 'env' in process) { + return process.env.DEBUG; + } +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }), +/* 60 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @typechecks + */ + +var emptyFunction = __webpack_require__(9); + +/** + * Upstream version of event listener. Does not take into account specific + * nature of platform. + */ +var EventListener = { + /** + * Listen to DOM events during the bubble phase. + * + * @param {DOMEventTarget} target DOM element to register listener on. + * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. + * @param {function} callback Callback function. * @return {object} Object with a `remove` method. */ listen: function listen(target, eventType, callback) { @@ -6817,7 +8069,7 @@ module.exports = EventListener; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 54 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6849,7 +8101,7 @@ function focusNode(node) { module.exports = focusNode; /***/ }), -/* 55 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6889,792 +8141,1237 @@ function getActiveElement() /*?DOMElement*/{ module.exports = getActiveElement; /***/ }), -/* 56 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ +/* WEBPACK VAR INJECTION */(function(process) { +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.stripSlashes = stripSlashes; +exports.each = each; +exports.some = some; +exports.every = every; +exports.keys = keys; +exports.values = values; +exports.isMatch = isMatch; +exports.isEmpty = isEmpty; +exports.isObject = isObject; +exports.extend = extend; +exports.omit = omit; +exports.pick = pick; +exports.merge = merge; +exports.select = select; +exports.matcher = matcher; +exports.sorter = sorter; +exports.makeUrl = makeUrl; + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +function stripSlashes(name) { + return name.replace(/^(\/*)|(\/*)$/g, ''); +} + +function each(obj, callback) { + if (obj && typeof obj.forEach === 'function') { + obj.forEach(callback); + } else if (isObject(obj)) { + Object.keys(obj).forEach(function (key) { + return callback(obj[key], key); + }); + } +} -/** - * CSS properties which accept numbers but are not in units of "px". - */ +function some(value, callback) { + return Object.keys(value).map(function (key) { + return [value[key], key]; + }).some(function (current) { + return callback.apply(undefined, _toConsumableArray(current)); + }); +} -var isUnitlessNumber = { - animationIterationCount: true, - borderImageOutset: true, - borderImageSlice: true, - borderImageWidth: true, - boxFlex: true, - boxFlexGroup: true, - boxOrdinalGroup: true, - columnCount: true, - flex: true, - flexGrow: true, - flexPositive: true, - flexShrink: true, - flexNegative: true, - flexOrder: true, - gridRow: true, - gridColumn: true, - fontWeight: true, - lineClamp: true, - lineHeight: true, - opacity: true, - order: true, - orphans: true, - tabSize: true, - widows: true, - zIndex: true, - zoom: true, +function every(value, callback) { + return Object.keys(value).map(function (key) { + return [value[key], key]; + }).every(function (current) { + return callback.apply(undefined, _toConsumableArray(current)); + }); +} - // SVG-related properties - fillOpacity: true, - floodOpacity: true, - stopOpacity: true, - strokeDasharray: true, - strokeDashoffset: true, - strokeMiterlimit: true, - strokeOpacity: true, - strokeWidth: true -}; +function keys(obj) { + return Object.keys(obj); +} -/** - * @param {string} prefix vendor-specific prefix, eg: Webkit - * @param {string} key style name, eg: transitionDuration - * @return {string} style name prefixed with `prefix`, properly camelCased, eg: - * WebkitTransitionDuration - */ -function prefixKey(prefix, key) { - return prefix + key.charAt(0).toUpperCase() + key.substring(1); +function values(obj) { + return _.keys(obj).map(function (key) { + return obj[key]; + }); } -/** - * Support style names that may come passed in prefixed by adding permutations - * of vendor prefixes. - */ -var prefixes = ['Webkit', 'ms', 'Moz', 'O']; +function isMatch(obj, item) { + return _.keys(item).every(function (key) { + return obj[key] === item[key]; + }); +} -// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an -// infinite loop, because it iterates over the newly added props too. -Object.keys(isUnitlessNumber).forEach(function (prop) { - prefixes.forEach(function (prefix) { - isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; +function isEmpty(obj) { + return _.keys(obj).length === 0; +} + +function isObject(item) { + return (typeof item === 'undefined' ? 'undefined' : _typeof(item)) === 'object' && !Array.isArray(item) && item !== null; +} + +function extend() { + return _extends.apply(undefined, arguments); +} + +function omit(obj) { + var result = _.extend({}, obj); + + for (var _len = arguments.length, keys = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + keys[_key - 1] = arguments[_key]; + } + + keys.forEach(function (key) { + return delete result[key]; }); -}); + return result; +} -/** - * Most style properties can be unset by doing .style[prop] = '' but IE8 - * doesn't like doing that with shorthand properties so for the properties that - * IE8 breaks on, which are listed here, we instead unset each of the - * individual properties. See http://bugs.jquery.com/ticket/12385. - * The 4-value 'clock' properties like margin, padding, border-width seem to - * behave without any problems. Curiously, list-style works too without any - * special prodding. - */ -var shorthandPropertyExpansions = { - background: { - backgroundAttachment: true, - backgroundColor: true, - backgroundImage: true, - backgroundPositionX: true, - backgroundPositionY: true, - backgroundRepeat: true - }, - backgroundPosition: { - backgroundPositionX: true, - backgroundPositionY: true - }, - border: { - borderWidth: true, - borderStyle: true, - borderColor: true +function pick(source) { + var result = {}; + + for (var _len2 = arguments.length, keys = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + keys[_key2 - 1] = arguments[_key2]; + } + + keys.forEach(function (key) { + result[key] = source[key]; + }); + return result; +} + +function merge(target, source) { + if (isObject(target) && isObject(source)) { + Object.keys(source).forEach(function (key) { + if (isObject(source[key])) { + if (!target[key]) _extends(target, _defineProperty({}, key, {})); + merge(target[key], source[key]); + } else { + _extends(target, _defineProperty({}, key, source[key])); + } + }); + } + return target; +} + +var _ = exports._ = { + each: each, + some: some, + every: every, + keys: keys, + values: values, + isMatch: isMatch, + isEmpty: isEmpty, + isObject: isObject, + extend: extend, + omit: omit, + pick: pick, + merge: merge +}; + +var specialFilters = exports.specialFilters = { + $in: function $in(key, ins) { + return function (current) { + return ins.indexOf(current[key]) !== -1; + }; }, - borderBottom: { - borderBottomWidth: true, - borderBottomStyle: true, - borderBottomColor: true + $nin: function $nin(key, nins) { + return function (current) { + return nins.indexOf(current[key]) === -1; + }; }, - borderLeft: { - borderLeftWidth: true, - borderLeftStyle: true, - borderLeftColor: true + $lt: function $lt(key, value) { + return function (current) { + return current[key] < value; + }; }, - borderRight: { - borderRightWidth: true, - borderRightStyle: true, - borderRightColor: true + $lte: function $lte(key, value) { + return function (current) { + return current[key] <= value; + }; }, - borderTop: { - borderTopWidth: true, - borderTopStyle: true, - borderTopColor: true + $gt: function $gt(key, value) { + return function (current) { + return current[key] > value; + }; }, - font: { - fontStyle: true, - fontVariant: true, - fontWeight: true, - fontSize: true, - lineHeight: true, - fontFamily: true + $gte: function $gte(key, value) { + return function (current) { + return current[key] >= value; + }; }, - outline: { - outlineWidth: true, - outlineStyle: true, - outlineColor: true + $ne: function $ne(key, value) { + return function (current) { + return current[key] !== value; + }; } }; -var CSSProperty = { - isUnitlessNumber: isUnitlessNumber, - shorthandPropertyExpansions: shorthandPropertyExpansions -}; +function select(params) { + var fields = params && params.query && params.query.$select; -module.exports = CSSProperty; + for (var _len3 = arguments.length, otherFields = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + otherFields[_key3 - 1] = arguments[_key3]; + } -/***/ }), -/* 57 */ -/***/ (function(module, exports, __webpack_require__) { + if (Array.isArray(fields) && otherFields.length) { + fields.push.apply(fields, otherFields); + } -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * - */ + var convert = function convert(result) { + if (!Array.isArray(fields)) { + return result; + } + return _.pick.apply(_, [result].concat(_toConsumableArray(fields))); + }; + return function (result) { + if (Array.isArray(result)) { + return result.map(convert); + } -var _prodInvariant = __webpack_require__(3); + return convert(result); + }; +} -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function matcher(originalQuery) { + var query = _.omit(originalQuery, '$limit', '$skip', '$sort', '$select'); -var PooledClass = __webpack_require__(14); + return function (item) { + if (query.$or && _.some(query.$or, function (or) { + return matcher(or)(item); + })) { + return true; + } + + return _.every(query, function (value, key) { + if (value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') { + return _.every(value, function (target, filterType) { + if (specialFilters[filterType]) { + var filter = specialFilters[filterType](key, target); + return filter(item); + } + + return false; + }); + } else if (typeof item[key] !== 'undefined') { + return item[key] === query[key]; + } + + return false; + }); + }; +} + +function sorter($sort) { + return function (first, second) { + var comparator = 0; + each($sort, function (modifier, key) { + modifier = parseInt(modifier, 10); + + if (first[key] < second[key]) { + comparator -= 1 * modifier; + } + + if (first[key] > second[key]) { + comparator += 1 * modifier; + } + }); + return comparator; + }; +} + +function makeUrl(path) { + var app = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var get = typeof app.get === 'function' ? app.get.bind(app) : function () {}; + var env = get('env') || process.env.NODE_ENV; + var host = get('host') || process.env.HOST_NAME || 'localhost'; + var protocol = env === 'development' || env === 'test' || env === undefined ? 'http' : 'https'; + var PORT = get('port') || process.env.PORT || 3030; + var port = env === 'development' || env === 'test' || env === undefined ? ':' + PORT : ''; + + path = path || ''; + + return protocol + '://' + host + port + '/' + stripSlashes(path); +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + +/***/ }), +/* 64 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.lowerCase = lowerCase; +exports.removeQuery = removeQuery; +exports.pluckQuery = pluckQuery; +exports.remove = remove; +exports.pluck = pluck; +exports.disable = disable; +exports.legacyPopulate = legacyPopulate; + +var _utils = __webpack_require__(65); + +/* eslint-env es6, node */ +/* eslint brace-style: 0, consistent-return: 0, no-console: 0, no-param-reassign: 0, no-var: 0 */ + +var errors = __webpack_require__(28).errors; -var invariant = __webpack_require__(1); /** - * A specialized pseudo-event module to help keep track of components waiting to - * be notified when their DOM representations are available for use. + * Lowercase the given fields either in the data submitted (as a before hook for create, + * update or patch) or in the result (as an after hook). If the data is an array or + * a paginated find result the hook will lowercase the field for every item. * - * This implements `PooledClass`, so you should never need to instantiate this. - * Instead, use `CallbackQueue.getPooled()`. + * @param {Array.} fields - Field names to lowercase. Dot notation is supported. + * @returns {Function} hook function(hook). + * + * DEPRECATED: The last param may be a function to determine if the current hook should be updated. + * Its signature is func(hook) and it returns either a boolean or a promise resolving to a boolean. + * This boolean determines if the hook is updated. + * + * hooks.lowerCase('group', hook => hook.data.status === 1); + * hooks.lowerCase('group', hook => new Promise(resolve => { + * setTimeout(() => { resolve(true); }, 100) + * })); * - * @class ReactMountReady - * @implements PooledClass - * @internal */ +function lowerCase() { + for (var _len = arguments.length, fields = Array(_len), _key = 0; _key < _len; _key++) { + fields[_key] = arguments[_key]; + } -var CallbackQueue = function () { - function CallbackQueue(arg) { - _classCallCheck(this, CallbackQueue); + var lowerCaseFields = function lowerCaseFields(data) { + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; - this._callbacks = null; - this._contexts = null; - this._arg = arg; + try { + for (var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var field = _step.value; + + var value = (0, _utils.getByDot)(data, field); + + if (value !== undefined) { + if (typeof value !== 'string' && value !== null) { + throw new errors.BadRequest('Expected string data. (lowercase ' + field + ')'); + } + + (0, _utils.setByDot)(data, field, value ? value.toLowerCase() : value); + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + }; + + var callback = function callback() { + return true; + }; + if (typeof fields[fields.length - 1] === 'function') { + callback = fields.pop(); + console.error('DEPRECATED Predicate func will be removed next version. (lowerCase)'); } - /** - * Enqueues a callback to be invoked when `notifyAll` is invoked. - * - * @param {function} callback Invoked when `notifyAll` is invoked. - * @param {?object} context Context to call `callback` with. - * @internal - */ + return function (hook) { + var items = hook.type === 'before' ? hook.data : hook.result; + var update = function update(condition) { + if (items && condition) { + if (hook.method === 'find' || Array.isArray(items)) { + // data.data if the find method is paginated + (items.data || items).forEach(lowerCaseFields); + } else { + lowerCaseFields(items); + } + } + return hook; + }; - CallbackQueue.prototype.enqueue = function enqueue(callback, context) { - this._callbacks = this._callbacks || []; - this._callbacks.push(callback); - this._contexts = this._contexts || []; - this._contexts.push(context); + var check = callback(hook); + + return check && typeof check.then === 'function' ? check.then(update) : update(check); }; +} - /** - * Invokes all enqueued callbacks and clears the queue. This is invoked after - * the DOM representation of a component has been created or updated. - * - * @internal - */ +/** + * Remove the given fields from the query params. + * Can be used as a before hook for any service method. + * + * @param {Array.} fields - Field names to remove. Dot notation is supported. + * @returns {Function} hook function(hook) + * + * DEPRECATED: The last param may be a function to determine if the current hook should be updated. + * Its signature is func(hook) and it returns either a boolean or a promise resolving to a boolean. + * This boolean determines if the hook is updated. + * + * hooks.lowerCase('group', hook => hook.data.status === 1); + * hooks.lowerCase('group', hook => new Promise(resolve => { + * setTimeout(() => { resolve(true); }, 100) + * })); + */ +function removeQuery() { + for (var _len2 = arguments.length, fields = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + fields[_key2] = arguments[_key2]; + } + var removeQueries = function removeQueries(data) { + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; - CallbackQueue.prototype.notifyAll = function notifyAll() { - var callbacks = this._callbacks; - var contexts = this._contexts; - var arg = this._arg; - if (callbacks && contexts) { - !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0; - this._callbacks = null; - this._contexts = null; - for (var i = 0; i < callbacks.length; i++) { - callbacks[i].call(contexts[i], arg); + try { + for (var _iterator2 = fields[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var field = _step2.value; + + var value = (0, _utils.getByDot)(data, field); // prevent setByDot creating nested empty objects + if (value !== undefined) { + (0, _utils.setByDot)(data, field, undefined, true); + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } } - callbacks.length = 0; - contexts.length = 0; } }; - CallbackQueue.prototype.checkpoint = function checkpoint() { - return this._callbacks ? this._callbacks.length : 0; + var callback = function callback() { + return true; }; + if (typeof fields[fields.length - 1] === 'function') { + callback = fields.pop(); + console.error('DEPRECATED Predicate func will be removed next version. (removeQuery)'); + } - CallbackQueue.prototype.rollback = function rollback(len) { - if (this._callbacks && this._contexts) { - this._callbacks.length = len; - this._contexts.length = len; + return function (hook) { + if (hook.type === 'after') { + var provider = hook.params.provider || 'server'; + throw new errors.GeneralError('Provider \'' + provider + '\' cannot remove query params on after hook. (removeQuery)'); } - }; - - /** - * Resets the internal queue. - * - * @internal - */ + var result = hook.params.query; + var update = function update(condition) { + if (result && condition) { + removeQueries(result); + } + return hook; + }; + var check = callback(hook); - CallbackQueue.prototype.reset = function reset() { - this._callbacks = null; - this._contexts = null; + return check && typeof check.then === 'function' ? check.then(update) : update(check); }; +} - /** - * `PooledClass` looks for this. - */ +/** + * Discard all other fields except for the given fields from the query params. + * Can be used as a before hook for any service method. + * + * @param {Array.} fields - Field names to retain. Dot notation is supported. + * @returns {Function} hook function(hook) + * + * DEPRECATED: The last param may be a function to determine if the current hook should be updated. + * Its signature is func(hook) and it returns either a boolean or a promise resolving to a boolean. + * This boolean determines if the hook is updated. + * + * hooks.lowerCase('group', hook => hook.data.status === 1); + * hooks.lowerCase('group', hook => new Promise(resolve => { + * setTimeout(() => { resolve(true); }, 100) + * })); + */ +function pluckQuery() { + for (var _len3 = arguments.length, fields = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + fields[_key3] = arguments[_key3]; + } + var pluckQueries = function pluckQueries(data) { + var plucked = {}; - CallbackQueue.prototype.destructor = function destructor() { - this.reset(); + fields.forEach(function (field) { + var value = (0, _utils.getByDot)(data, field); // prevent setByDot creating nested empty objects + if (value !== undefined) { + (0, _utils.setByDot)(plucked, field, value); + } + }); + + return plucked; }; - return CallbackQueue; -}(); + var callback = function callback() { + return true; + }; + if (typeof fields[fields.length - 1] === 'function') { + callback = fields.pop(); + console.error('DEPRECATED Predicate func will be removed next version. (pluckQuery)'); + } -module.exports = PooledClass.addPoolingTo(CallbackQueue); -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + return function (hook) { + if (hook.type === 'after') { + throw new errors.GeneralError('Provider \'' + hook.params.provider + '\' can not pluck query params on after hook. (pluckQuery)'); + } + var result = hook.params.query; + var update = function update(condition) { + if (result && condition) { + hook.params.query = pluckQueries(result); + } + return hook; + }; -/***/ }), -/* 58 */ -/***/ (function(module, exports, __webpack_require__) { + var check = callback(hook); -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. + return check && typeof check.then === 'function' ? check.then(update) : update(check); + }; +} + +/** + * Remove the given fields either from the data submitted (as a before hook for create, + * update or patch) or from the result (as an after hook). If the data is an array or + * a paginated find result the hook will remove the field for every item. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * @param {Array.} fields - Field names to remove. Dot notation is supported. + * @returns {Function} hook function(hook) + * + * The last param may be a function to determine if the current hook should be updated. + * Its signature is func(hook) and it returns either a boolean or a promise resolving to a boolean. + * This boolean determines if the hook is updated. * + * hooks.lowerCase('group', hook => hook.data.status === 1); + * hooks.lowerCase('group', hook => new Promise(resolve => { + * setTimeout(() => { resolve(true); }, 100) + * })); + * + * The items are only updated for external requests, e.g. hook.params.provider is rest or socketio, + * or if the decision function mentioned above returns true. */ +function remove() { + for (var _len4 = arguments.length, fields = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + fields[_key4] = arguments[_key4]; + } + var removeFields = function removeFields(data) { + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + try { + for (var _iterator3 = fields[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var field = _step3.value; -var DOMProperty = __webpack_require__(13); -var ReactDOMComponentTree = __webpack_require__(5); -var ReactInstrumentation = __webpack_require__(8); + var value = (0, _utils.getByDot)(data, field); + if (value !== undefined) { + // prevent setByDot creating nested empty objects + (0, _utils.setByDot)(data, field, undefined, true); + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + }; -var quoteAttributeValueForBrowser = __webpack_require__(165); -var warning = __webpack_require__(2); + // when deprecating, remember hook should not run if called from server + var callback = function callback(hook) { + return !!hook.params.provider; + }; // important condition + if (typeof fields[fields.length - 1] === 'function') { + callback = fields.pop(); + } -var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); -var illegalAttributeNameCache = {}; -var validatedAttributeNameCache = {}; + return function (hook) { + var result = hook.type === 'before' ? hook.data : hook.result; + var update = function update(condition) { + if (result && condition) { + if (Array.isArray(result)) { + result.forEach(removeFields); + } else { + removeFields(result); -function isAttributeNameSafe(attributeName) { - if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { - return true; - } - if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { - return false; - } - if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { - validatedAttributeNameCache[attributeName] = true; - return true; - } - illegalAttributeNameCache[attributeName] = true; - process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0; - return false; -} + if (result.data) { + if (Array.isArray(result.data)) { + result.data.forEach(removeFields); + } else { + removeFields(result.data); + } + } + } + } + return hook; + }; -function shouldIgnoreValue(propertyInfo, value) { - return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; + var check = callback(hook); + + return check && typeof check.then === 'function' ? check.then(update) : update(check); + }; } /** - * Operations for dealing with DOM properties. + * Discard all other fields except for the provided fields either from the data submitted + * (as a before hook for create, update or patch) or from the result (as an after hook). + * If the data is an array or a paginated find result the hook will remove the field for every item. + * + * @param {Array.} fields - Field names to remove. Dot notation is supported. + * @returns {Function} hook function(hook) + * + * DEPRECATED: The last param may be a function to determine if the current hook should be updated. + * Its signature is func(hook) and it returns either a boolean or a promise resolving to a boolean. + * This boolean determines if the hook is updated. + * + * hooks.lowerCase('group', hook => hook.data.status === 1); + * hooks.lowerCase('group', hook => new Promise(resolve => { + * setTimeout(() => { resolve(true); }, 100) + * })); + * + * The items are only updated for external requests, e.g. hook.params.provider is rest or socketio, + * or if the decision function mentioned above returns true. */ -var DOMPropertyOperations = { +function pluck() { + for (var _len5 = arguments.length, fields = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + fields[_key5] = arguments[_key5]; + } - /** - * Creates markup for the ID property. - * - * @param {string} id Unescaped ID. - * @return {string} Markup string. - */ - createMarkupForID: function (id) { - return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); - }, + var pluckFields = function pluckFields(data) { + var plucked = {}; - setAttributeForID: function (node, id) { - node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); - }, - - createMarkupForRoot: function () { - return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""'; - }, + fields.forEach(function (field) { + var value = (0, _utils.getByDot)(data, field); + if (value !== undefined) { + // prevent setByDot creating nested empty objects + (0, _utils.setByDot)(plucked, field, value); + } + }); - setAttributeForRoot: function (node) { - node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, ''); - }, + return plucked; + }; - /** - * Creates markup for a property. - * - * @param {string} name - * @param {*} value - * @return {?string} Markup string, or null if the property was invalid. - */ - createMarkupForProperty: function (name, value) { - var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; - if (propertyInfo) { - if (shouldIgnoreValue(propertyInfo, value)) { - return ''; - } - var attributeName = propertyInfo.attributeName; - if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { - return attributeName + '=""'; - } - return attributeName + '=' + quoteAttributeValueForBrowser(value); - } else if (DOMProperty.isCustomAttribute(name)) { - if (value == null) { - return ''; - } - return name + '=' + quoteAttributeValueForBrowser(value); - } - return null; - }, + // when deprecating, remember hook should not run if called from server + var callback = function callback(hook) { + return !!hook.params.provider; + }; + if (typeof fields[fields.length - 1] === 'function') { + callback = fields.pop(); + console.error('DEPRECATED Predicate func will be removed next version. (pluck)'); + } - /** - * Creates markup for a custom property. - * - * @param {string} name - * @param {*} value - * @return {string} Markup string, or empty string if the property was invalid. - */ - createMarkupForCustomAttribute: function (name, value) { - if (!isAttributeNameSafe(name) || value == null) { - return ''; - } - return name + '=' + quoteAttributeValueForBrowser(value); - }, + return function (hook) { + var update = function update(condition) { + if (condition) { + var items = (0, _utils.getItems)(hook); - /** - * Sets the value for a property on a node. - * - * @param {DOMElement} node - * @param {string} name - * @param {*} value - */ - setValueForProperty: function (node, name, value) { - var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; - if (propertyInfo) { - var mutationMethod = propertyInfo.mutationMethod; - if (mutationMethod) { - mutationMethod(node, value); - } else if (shouldIgnoreValue(propertyInfo, value)) { - this.deleteValueForProperty(node, name); - return; - } else if (propertyInfo.mustUseProperty) { - // Contrary to `setAttribute`, object properties are properly - // `toString`ed by IE8/9. - node[propertyInfo.propertyName] = value; - } else { - var attributeName = propertyInfo.attributeName; - var namespace = propertyInfo.attributeNamespace; - // `setAttribute` with objects becomes only `[object]` in IE8/9, - // ('' + value) makes it output the correct toString()-value. - if (namespace) { - node.setAttributeNS(namespace, attributeName, '' + value); - } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { - node.setAttribute(attributeName, ''); - } else { - node.setAttribute(attributeName, '' + value); + if (items) { + if (Array.isArray(items)) { + (0, _utils.replaceItems)(hook, items.map(pluckFields)); + } else { + (0, _utils.replaceItems)(hook, pluckFields(items)); + } } } - } else if (DOMProperty.isCustomAttribute(name)) { - DOMPropertyOperations.setValueForAttribute(node, name, value); - return; - } - if (process.env.NODE_ENV !== 'production') { - var payload = {}; - payload[name] = value; - ReactInstrumentation.debugTool.onHostOperation({ - instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, - type: 'update attribute', - payload: payload - }); - } - }, + return hook; + }; - setValueForAttribute: function (node, name, value) { - if (!isAttributeNameSafe(name)) { - return; - } - if (value == null) { - node.removeAttribute(name); - } else { - node.setAttribute(name, '' + value); - } + var check = callback(hook); - if (process.env.NODE_ENV !== 'production') { - var payload = {}; - payload[name] = value; - ReactInstrumentation.debugTool.onHostOperation({ - instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, - type: 'update attribute', - payload: payload - }); - } - }, + return check && typeof check.then === 'function' ? check.then(update) : update(check); + }; +} - /** - * Deletes an attributes from a node. - * - * @param {DOMElement} node - * @param {string} name - */ - deleteValueForAttribute: function (node, name) { - node.removeAttribute(name); - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onHostOperation({ - instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, - type: 'remove attribute', - payload: name - }); - } - }, +/** + * Disable access to a service method completely, for a specific provider, + * or for a custom condition. + * + * @param {string|function} [realm] - Provider, or function(hook):boolean|Promise + * The first provider or the custom condition. + * null = disable completely, + * 'external' = disable external access, + * string = disable that provider e.g. 'rest', + * func(hook) = returns boolean or promise resolving to a boolean. false = disable access. + * @param {string|string[]} [args] - Additional provider names. + * @returns {Function} hook function(hook) + * + * The function may be invoked with + * - no param, or with undefined or null. All providers are disallowed, even the server. + * - multiple params of provider names, e.g. rest, socketio. They are all disabled. + * - 'external'. All client interfaces are disabled. + * - a function whose signature is func(hook). It returns either a boolean or a promise which + * resolves to a boolean. If false, the operation is disabled. This is the only way to disable + * calls from the server. + */ +function disable(realm) { + if (!realm) { + return function (hook) { + throw new errors.MethodNotAllowed('Calling \'' + hook.method + '\' not allowed. (disable)'); + }; + } - /** - * Deletes the value for a property on a node. - * - * @param {DOMElement} node - * @param {string} name - */ - deleteValueForProperty: function (node, name) { - var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; - if (propertyInfo) { - var mutationMethod = propertyInfo.mutationMethod; - if (mutationMethod) { - mutationMethod(node, undefined); - } else if (propertyInfo.mustUseProperty) { - var propName = propertyInfo.propertyName; - if (propertyInfo.hasBooleanValue) { - node[propName] = false; - } else { - node[propName] = ''; + if (typeof realm === 'function') { + return function (hook) { + var result = realm(hook); + var update = function update(check) { + if (!check) { + throw new errors.MethodNotAllowed('Calling \'' + hook.method + '\' not allowed. (disable)'); } - } else { - node.removeAttribute(propertyInfo.attributeName); + }; + + if (result && typeof result.then === 'function') { + return result.then(update); } - } else if (DOMProperty.isCustomAttribute(name)) { - node.removeAttribute(name); - } - if (process.env.NODE_ENV !== 'production') { - ReactInstrumentation.debugTool.onHostOperation({ - instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, - type: 'remove attribute', - payload: name - }); - } + update(result); + }; } -}; + for (var _len6 = arguments.length, args = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { + args[_key6 - 1] = arguments[_key6]; + } -module.exports = DOMPropertyOperations; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) + var providers = [realm].concat(args); -/***/ }), -/* 59 */ -/***/ (function(module, exports, __webpack_require__) { + return function (hook) { + var provider = hook.params.provider; + + if (realm === 'external' && provider || providers.indexOf(provider) !== -1) { + throw new errors.MethodNotAllowed('Provider \'' + hook.params.provider + '\' can not call \'' + hook.method + '\'. (disable)\''); + } + }; +} -"use strict"; /** - * Copyright 2015-present, Facebook, Inc. - * All rights reserved. + * The populate hook uses a property from the result (or every item if it is a list) + * to retrieve a single related object from a service and add it to the original object. + * It is meant to be used as an after hook on any service method. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * @param {string} target - The prop name to contain the populated item or array of populated items. + * This is also the default for options.field if that is not specified. + * @param {Object} options - options + * For a mongoose model, these are the options for item.toObject(). + * For a Sequelize model, these are the options for item.toJSON(). + * @param {string} options.service - The service for the related object, e.g. '/messages'. + * @param {string|Array.} options.field - The field containing the key(s) + * for the item(s) in options.service. + * @returns {Function} hook function(hook):Promise resolving to the hook. + * + * 'options.field' is the foreign key for one related item in options.service, i.e. item[options.field] === foreignItem[idField]. + * 'target' is set to this related item once it is read successfully. + * + * If 'options.field' is not present in the hook result item, the hook is ignored. + * + * So if the hook result has the message item + * { _id: '1...1', senderId: 'a...a', text: 'Jane, are you there?' } + * and the /users service has the item + * { _id: 'a...a', name: 'John Doe'} + * and then the hook is run + * hooks.populate('sender', { field: 'userId', service: '/users' }) + * the hook result will contain + * { _id: '1...1', senderId : 'a...a', text: 'Jane, are you there?', + * sender: { _id: 'a...a', name: 'John Doe'} } * + * If 'senderId' is an array of keys, then 'sender' will be an array of populated items. */ +function legacyPopulate(target, options) { + options = Object.assign({}, options); + console.error('Calling populate(target, options) is now DEPRECATED and will be removed in the future. ' + 'Refer to docs.feathersjs.com for more information. (legacyPopulate)'); + if (!options.service) { + throw new Error('You need to provide a service. (populate)'); + } -var ReactDOMComponentFlags = { - hasCachedChildNodes: 1 << 0 -}; + var field = options.field || target; -module.exports = ReactDOMComponentFlags; + return function (hook) { + function populate1(item) { + if (!item[field]) { + return Promise.resolve(item); + } + + // Find by the field value by default or a custom query + var id = item[field]; + + // If it's a mongoose model then + if (typeof item.toObject === 'function') { + item = item.toObject(options); + } + // If it's a Sequelize model + else if (typeof item.toJSON === 'function') { + item = item.toJSON(options); + } + // Remove any query from params as it's not related + var params = Object.assign({}, hook.params, { query: undefined }); + // If the relationship is an array of ids, fetch and resolve an object for each, + // otherwise just fetch the object. + var promise = Array.isArray(id) ? Promise.all(id.map(function (objectID) { + return hook.app.service(options.service).get(objectID, params); + })) : hook.app.service(options.service).get(id, params); + return promise.then(function (relatedItem) { + if (relatedItem) { + item[target] = relatedItem; + } + return item; + }); + } + + if (hook.type !== 'after') { + throw new errors.GeneralError('Can not populate on before hook. (populate)'); + } + + var isPaginated = hook.method === 'find' && hook.result.data; + var data = isPaginated ? hook.result.data : hook.result; + + if (Array.isArray(data)) { + return Promise.all(data.map(populate1)).then(function (results) { + if (isPaginated) { + hook.result.data = results; + } else { + hook.result = results; + } + + return hook; + }); + } + + // Handle single objects. + return populate1(hook.result).then(function (item) { + hook.result = item; + return hook; + }); + }; +} /***/ }), -/* 60 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - -var _assign = __webpack_require__(4); +Object.defineProperty(exports, "__esModule", { + value: true +}); -var LinkedValueUtils = __webpack_require__(36); -var ReactDOMComponentTree = __webpack_require__(5); -var ReactUpdates = __webpack_require__(10); +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var warning = __webpack_require__(2); +/* eslint no-param-reassign: 0 */ -var didWarnValueLink = false; -var didWarnValueDefaultValue = false; +/** + * Get a value from an object using dot notation, e.g. employee.address.city + * + * @param {Object} obj - The object containing the value + * @param {string} path - The path to the value, e.g. employee.address.city + * @returns {*} The value, or undefined if the path does not exist + * + * There is no way to differentiate between non-existent paths and a value of undefined + */ +var getByDot = exports.getByDot = function getByDot(obj, path) { + if (path.indexOf('.') === -1) { + return obj[path]; + } -function updateOptionsIfPendingUpdateAndMounted() { - if (this._rootNodeID && this._wrapperState.pendingUpdate) { - this._wrapperState.pendingUpdate = false; + return path.split('.').reduce(function (obj1, part) { + return (typeof obj1 === 'undefined' ? 'undefined' : _typeof(obj1)) === 'object' ? obj1[part] : undefined; + }, obj); +}; - var props = this._currentElement.props; - var value = LinkedValueUtils.getValue(props); +/** + * Set a value in an object using dot notation, e.g. employee.address.city. + * + * @param {Object} obj - The object + * @param {string} path - The path where to place the value, e.g. employee.address.city + * @param {*} value - The value. + * @param {boolean} ifDelete - Delete the prop at path if value is undefined. + * @returns {Object} The modified object. + * + * To delete a prop, set value = undefined and ifDelete = true. Note that + * new empty inner objects will still be created, + * e.g. setByDot({}, 'a.b.c', undefined, true) will return {a: b: {} } + */ +var setByDot = exports.setByDot = function setByDot(obj, path, value, ifDelete) { + if (path.indexOf('.') === -1) { + obj[path] = value; - if (value != null) { - updateOptions(this, Boolean(props.multiple), value); + if (value === undefined && ifDelete) { + delete obj[path]; } - } -} -function getDeclarationErrorAddendum(owner) { - if (owner) { - var name = owner.getName(); - if (name) { - return ' Check the render method of `' + name + '`.'; - } + return; } - return ''; -} -var valuePropNames = ['value', 'defaultValue']; + var parts = path.split('.'); + var lastIndex = parts.length - 1; + return parts.reduce(function (obj1, part, i) { + if (i !== lastIndex) { + if (!obj1.hasOwnProperty(part) || _typeof(obj1[part]) !== 'object') { + obj1[part] = {}; + } + return obj1[part]; + } -/** - * Validation function for `value` and `defaultValue`. - * @private - */ -function checkSelectPropTypes(inst, props) { - var owner = inst._currentElement._owner; - LinkedValueUtils.checkPropTypes('select', props, owner); + obj1[part] = value; + if (value === undefined && ifDelete) { + delete obj1[part]; + } + return obj1; + }, obj); +}; - if (props.valueLink !== undefined && !didWarnValueLink) { - process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0; - didWarnValueLink = true; +/** + * Restrict the calling hook to a hook type (before, after) and a set of + * hook methods (find, get, create, update, patch, remove). + * + * @param {object} hook object + * @param {string|null} type permitted. 'before', 'after' or null for either. + * @param {array|string} methods permitted. find, get, create, update, patch, remove or null for any + * @param {string} label identifying hook in error messages. optional. + * + * Example: + * const checkContext = require('feathers-hooks-common/utils').checkContext; + * + * const includeCreatedAtHook = (options) => { + * const fieldName = (options && options.as) ? options.as : 'createdAt'; + * return (hook) => { + * checkContext(hook, 'before', 'create', 'includeCreatedAtHook'); + * hook.data[fieldName] = new Date()); + * }; + * }, + * + * Examples: + * checkContext(hook, 'before', ['update', 'patch'], 'hookName'); + * checkContext(hook, null, ['update', 'patch']); + * checkContext(hook, 'before', null, 'hookName'); + * checkContext(hook, 'before'); + */ + +var checkContext = exports.checkContext = function checkContext(hook) { + var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var methods = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + var label = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'anonymous'; + + if (type && hook.type !== type) { + throw new Error('The \'' + label + '\' hook can only be used as a \'' + type + '\' hook.'); + } + + if (!methods) { + return; } - for (var i = 0; i < valuePropNames.length; i++) { - var propName = valuePropNames[i]; - if (props[propName] == null) { - continue; - } - var isArray = Array.isArray(props[propName]); - if (props.multiple && !isArray) { - process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; - } + var myMethods = Array.isArray(methods) ? methods : [methods]; // safe enough for allowed values + + if (myMethods.length > 0 && myMethods.indexOf(hook.method) === -1) { + var msg = JSON.stringify(myMethods); + throw new Error('The \'' + label + '\' hook can only be used on the \'' + msg + '\' service method(s).'); } -} +}; -/** - * @param {ReactDOMComponent} inst - * @param {boolean} multiple - * @param {*} propValue A stringable (with `multiple`, a list of stringables). - * @private - */ -function updateOptions(inst, multiple, propValue) { - var selectedValue, i; - var options = ReactDOMComponentTree.getNodeFromInstance(inst).options; +/** + * Return the data items in a hook. + * hook.data if type=before. + * hook.result.data if type=after, method=find with pagination. + * hook.result otherwise if type=after. + * + * @param {Object} hook - The hook. + * @returns {Object|Array.} The data item or array of data items + */ +var getItems = exports.getItems = function getItems(hook) { + var items = hook.type === 'before' ? hook.data : hook.result; + return items && hook.method === 'find' ? items.data || items : items; +}; - if (multiple) { - selectedValue = {}; - for (i = 0; i < propValue.length; i++) { - selectedValue['' + propValue[i]] = true; - } - for (i = 0; i < options.length; i++) { - var selected = selectedValue.hasOwnProperty(options[i].value); - if (options[i].selected !== selected) { - options[i].selected = selected; - } +/** + * Replace the data items in a hook. Companion to getItems. + * + * @param {Object} hook - The hook. + * @param {Object|Array.} items - The data item or array of data items + * + * If you update an after find paginated hook with an item rather than an array of items, + * the hook will have an array consisting of that one item. + */ +var replaceItems = exports.replaceItems = function replaceItems(hook, items) { + if (hook.type === 'before') { + hook.data = items; + } else if (hook.method === 'find' && hook.result && hook.result.data) { + if (Array.isArray(items)) { + hook.result.data = items; + hook.result.total = items.length; + } else { + hook.result.data = [items]; + hook.result.total = 1; } } else { - // Do not set `select.value` as exact behavior isn't consistent across all - // browsers for all cases. - selectedValue = '' + propValue; - for (i = 0; i < options.length; i++) { - if (options[i].value === selectedValue) { - options[i].selected = true; - return; - } + hook.result = items; + } +}; + +/***/ }), +/* 66 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var replace = String.prototype.replace; +var percentTwenties = /%20/g; + +module.exports = { + 'default': 'RFC3986', + formatters: { + RFC1738: function (value) { + return replace.call(value, percentTwenties, '+'); + }, + RFC3986: function (value) { + return value; + } + }, + RFC1738: 'RFC1738', + RFC3986: 'RFC3986' +}; + + +/***/ }), +/* 67 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var has = Object.prototype.hasOwnProperty; + +var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); } - if (options.length) { - options[0].selected = true; + + return array; +}()); + +exports.arrayToObject = function (source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } } - } -} -/** - * Implements a must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; + } else if (!props.multiple && isArray) { + process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to host component that allows optionally setting the + * props `value` and `defaultValue`. If `multiple` is false, the prop must be a + * stringable. If `multiple` is true, the prop must be an array of stringables. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * If `value` is not supplied (or null/undefined), user actions that change the + * selected option will trigger updates to the rendered options. * - * + * If it is supplied (and not null/undefined), the rendered options will not + * update in response to user actions. Instead, the `value` prop must change in + * order for the rendered options to update. + * + * If `defaultValue` is provided, any options with the supplied values will be + * selected. */ +var ReactDOMSelect = { + getHostProps: function (inst, props) { + return _assign({}, props, { + onChange: inst._wrapperState.onChange, + value: undefined + }); + }, + mountWrapper: function (inst, props) { + if (process.env.NODE_ENV !== 'production') { + checkSelectPropTypes(inst, props); + } + var value = LinkedValueUtils.getValue(props); + inst._wrapperState = { + pendingUpdate: false, + initialValue: value != null ? value : props.defaultValue, + listeners: null, + onChange: _handleChange.bind(inst), + wasMultiple: Boolean(props.multiple) + }; -var _prodInvariant = __webpack_require__(3); + if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0; + didWarnValueDefaultValue = true; + } + }, -var invariant = __webpack_require__(1); + getSelectValueContext: function (inst) { + // ReactDOMOption looks at this initial value so the initial generated + // markup has correct `selected` attributes + return inst._wrapperState.initialValue; + }, -/** - * Accumulates items that must not be null or undefined into the first one. This - * is used to conserve memory by avoiding array allocations, and thus sacrifices - * API cleanness. Since `current` can be null before being passed in and not - * null after this function, make sure to assign it back to `current`: - * - * `a = accumulateInto(a, b);` - * - * This API should be sparingly used. Try `accumulate` for something cleaner. - * - * @return {*|array<*>} An accumulation of items. - */ + postUpdateWrapper: function (inst) { + var props = inst._currentElement.props; -function accumulateInto(current, next) { - !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; + // After the initial mount, we control selected-ness manually so don't pass + // this value down + inst._wrapperState.initialValue = undefined; - if (current == null) { - return next; - } + var wasMultiple = inst._wrapperState.wasMultiple; + inst._wrapperState.wasMultiple = Boolean(props.multiple); - // Both are not empty. Warning: Never call x.concat(y) when you are not - // certain that x is an Array (x could be a string with concat method). - if (Array.isArray(current)) { - if (Array.isArray(next)) { - current.push.apply(current, next); - return current; + var value = LinkedValueUtils.getValue(props); + if (value != null) { + inst._wrapperState.pendingUpdate = false; + updateOptions(inst, Boolean(props.multiple), value); + } else if (wasMultiple !== Boolean(props.multiple)) { + // For simplicity, reapply `defaultValue` if `multiple` is toggled. + if (props.defaultValue != null) { + updateOptions(inst, Boolean(props.multiple), props.defaultValue); + } else { + // Revert the select back to its default unselected state. + updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : ''); + } } - current.push(next); - return current; } +}; - if (Array.isArray(next)) { - // A bit too dangerous to mutate `next`. - return [current].concat(next); - } +function _handleChange(event) { + var props = this._currentElement.props; + var returnValue = LinkedValueUtils.executeOnChange(props, event); - return [current, next]; + if (this._rootNodeID) { + this._wrapperState.pendingUpdate = true; + } + ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); + return returnValue; } -module.exports = accumulateInto; +module.exports = ReactDOMSelect; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 70 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** - * Copyright 2013-present, Facebook, Inc. + * Copyright 2014-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * */ -/** - * @param {array} arr an "accumulation" of items which is either an Array or - * a single item. Useful when paired with the `accumulate` module. This is a - * simple utility that allows us to reason about a collection of items, but - * handling the case when there is exactly one item (and we do not need to - * allocate an array). - */ +var emptyComponentFactory; -function forEachAccumulated(arr, cb, scope) { - if (Array.isArray(arr)) { - arr.forEach(cb, scope); - } else if (arr) { - cb.call(scope, arr); +var ReactEmptyComponentInjection = { + injectEmptyComponentFactory: function (factory) { + emptyComponentFactory = factory; } -} +}; -module.exports = forEachAccumulated; +var ReactEmptyComponent = { + create: function (instantiate) { + return emptyComponentFactory(instantiate); + } +}; + +ReactEmptyComponent.injection = ReactEmptyComponentInjection; + +module.exports = ReactEmptyComponent; /***/ }), -/* 71 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8660,35 +10168,27 @@ module.exports = forEachAccumulated; * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * + * */ -var ReactNodeTypes = __webpack_require__(66); - -function getHostComponentFromComposite(inst) { - var type; +var ReactFeatureFlags = { + // When true, call console.time() before and .timeEnd() after each top-level + // render (both initial renders and updates). Useful when looking at prod-mode + // timeline profiles in Chrome, for example. + logTopLevelRenders: false +}; - while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) { - inst = inst._renderedComponent; - } - - if (type === ReactNodeTypes.HOST) { - return inst._renderedComponent; - } else if (type === ReactNodeTypes.EMPTY) { - return null; - } -} - -module.exports = getHostComponentFromComposite; +module.exports = ReactFeatureFlags; /***/ }), -/* 72 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -/** - * Copyright 2013-present, Facebook, Inc. +/* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright 2014-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the @@ -8699,33 +10199,69 @@ module.exports = getHostComponentFromComposite; -var ExecutionEnvironment = __webpack_require__(6); +var _prodInvariant = __webpack_require__(3); -var contentKey = null; +var invariant = __webpack_require__(1); + +var genericComponentClass = null; +var textComponentClass = null; + +var ReactHostComponentInjection = { + // This accepts a class that receives the tag string. This is a catch all + // that can render any kind of tag. + injectGenericComponentClass: function (componentClass) { + genericComponentClass = componentClass; + }, + // This accepts a text component class that takes the text string to be + // rendered as props. + injectTextComponentClass: function (componentClass) { + textComponentClass = componentClass; + } +}; /** - * Gets the key used to access text content on a DOM node. + * Get a host internal component class for a specific tag. * - * @return {?string} Key used to access text content. - * @internal + * @param {ReactElement} element The element to create. + * @return {function} The internal class constructor function. */ -function getTextContentAccessor() { - if (!contentKey && ExecutionEnvironment.canUseDOM) { - // Prefer textContent to innerText because many browsers support both but - // SVG elements don't support innerText even when
does. - contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; - } - return contentKey; +function createInternalComponent(element) { + !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0; + return new genericComponentClass(element); } -module.exports = getTextContentAccessor; +/** + * @param {ReactText} text + * @return {ReactComponent} + */ +function createInstanceForText(text) { + return new textComponentClass(text); +} + +/** + * @param {ReactComponent} component + * @return {boolean} + */ +function isTextComponent(component) { + return component instanceof textComponentClass; +} + +var ReactHostComponent = { + createInternalComponent: createInternalComponent, + createInstanceForText: createInstanceForText, + isTextComponent: isTextComponent, + injection: ReactHostComponentInjection +}; + +module.exports = ReactHostComponent; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 73 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** +/** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * @@ -8737,129 +10273,124 @@ module.exports = getTextContentAccessor; -var _prodInvariant = __webpack_require__(3), - _assign = __webpack_require__(4); - -var ReactCompositeComponent = __webpack_require__(108); -var ReactEmptyComponent = __webpack_require__(61); -var ReactHostComponent = __webpack_require__(63); - -var getNextDebugID = __webpack_require__(162); -var invariant = __webpack_require__(1); -var warning = __webpack_require__(2); +var ReactDOMSelection = __webpack_require__(163); -// To avoid a cyclic dependency, we create the final class in this module -var ReactCompositeComponentWrapper = function (element) { - this.construct(element); -}; -_assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, { - _instantiateReactComponent: instantiateReactComponent -}); +var containsNode = __webpack_require__(100); +var focusNode = __webpack_require__(61); +var getActiveElement = __webpack_require__(62); -function getDeclarationErrorAddendum(owner) { - if (owner) { - var name = owner.getName(); - if (name) { - return ' Check the render method of `' + name + '`.'; - } - } - return ''; +function isInDocument(node) { + return containsNode(document.documentElement, node); } /** - * Check if the type reference is a known internal type. I.e. not a user - * provided composite type. - * - * @param {function} type - * @return {boolean} Returns true if this is a valid internal type. + * @ReactInputSelection: React input selection module. Based on Selection.js, + * but modified to be suitable for react and has a couple of bug fixes (doesn't + * assume buttons have range selections allowed). + * Input selection module for React. */ -function isInternalComponentType(type) { - return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; -} +var ReactInputSelection = { -/** - * Given a ReactNode, create an instance that will actually be mounted. - * - * @param {ReactNode} node - * @param {boolean} shouldHaveDebugID - * @return {object} A new instance of the element's constructor. - * @protected - */ -function instantiateReactComponent(node, shouldHaveDebugID) { - var instance; + hasSelectionCapabilities: function (elem) { + var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); + return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); + }, - if (node === null || node === false) { - instance = ReactEmptyComponent.create(instantiateReactComponent); - } else if (typeof node === 'object') { - var element = node; - var type = element.type; - if (typeof type !== 'function' && typeof type !== 'string') { - var info = ''; - if (process.env.NODE_ENV !== 'production') { - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; - } + getSelectionInformation: function () { + var focusedElem = getActiveElement(); + return { + focusedElem: focusedElem, + selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null + }; + }, + + /** + * @restoreSelection: If any selection information was potentially lost, + * restore it. This is useful when performing operations that could remove dom + * nodes and place them back in, resulting in focus being lost. + */ + restoreSelection: function (priorSelectionInformation) { + var curFocusedElem = getActiveElement(); + var priorFocusedElem = priorSelectionInformation.focusedElem; + var priorSelectionRange = priorSelectionInformation.selectionRange; + if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { + if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { + ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange); } - info += getDeclarationErrorAddendum(element._owner); - true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info) : _prodInvariant('130', type == null ? type : typeof type, info) : void 0; + focusNode(priorFocusedElem); } + }, - // Special case string values - if (typeof element.type === 'string') { - instance = ReactHostComponent.createInternalComponent(element); - } else if (isInternalComponentType(element.type)) { - // This is temporarily available for custom components that are not string - // representations. I.e. ART. Once those are updated to use the string - // representation, we can drop this code path. - instance = new element.type(element); + /** + * @getSelection: Gets the selection bounds of a focused textarea, input or + * contentEditable node. + * -@input: Look up selection bounds of this input + * -@return {start: selectionStart, end: selectionEnd} + */ + getSelection: function (input) { + var selection; - // We renamed this. Allow the old name for compat. :( - if (!instance.getHostNode) { - instance.getHostNode = instance.getNativeNode; + if ('selectionStart' in input) { + // Modern browser with input or textarea. + selection = { + start: input.selectionStart, + end: input.selectionEnd + }; + } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { + // IE8 input. + var range = document.selection.createRange(); + // There can only be one selection per document in IE, so it must + // be in our element. + if (range.parentElement() === input) { + selection = { + start: -range.moveStart('character', -input.value.length), + end: -range.moveEnd('character', -input.value.length) + }; } } else { - instance = new ReactCompositeComponentWrapper(element); + // Content editable or old IE textarea. + selection = ReactDOMSelection.getOffsets(input); } - } else if (typeof node === 'string' || typeof node === 'number') { - instance = ReactHostComponent.createInstanceForText(node); - } else { - true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0; - } - - if (process.env.NODE_ENV !== 'production') { - process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getHostNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0; - } - // These two fields are used by the DOM and ART diffing algorithms - // respectively. Instead of using expandos on components, we should be - // storing the state needed by the diffing algorithms elsewhere. - instance._mountIndex = 0; - instance._mountImage = null; + return selection || { start: 0, end: 0 }; + }, - if (process.env.NODE_ENV !== 'production') { - instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0; - } + /** + * @setSelection: Sets the selection bounds of a textarea or input and focuses + * the input. + * -@input Set selection bounds of this input or textarea + * -@offsets Object of same form that is returned from get* + */ + setSelection: function (input, offsets) { + var start = offsets.start; + var end = offsets.end; + if (end === undefined) { + end = start; + } - // Internal instances should fully constructed at this point, so they should - // not get any new fields added to them at this point. - if (process.env.NODE_ENV !== 'production') { - if (Object.preventExtensions) { - Object.preventExtensions(instance); + if ('selectionStart' in input) { + input.selectionStart = start; + input.selectionEnd = Math.min(end, input.value.length); + } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { + var range = input.createTextRange(); + range.collapse(true); + range.moveStart('character', start); + range.moveEnd('character', end - start); + range.select(); + } else { + ReactDOMSelection.setOffsets(input, offsets); } } +}; - return instance; -} - -module.exports = instantiateReactComponent; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) +module.exports = ReactInputSelection; /***/ }), -/* 74 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -/** +/* WEBPACK VAR INJECTION */(function(process) {/** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * @@ -8867,559 +10398,543 @@ module.exports = instantiateReactComponent; * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * */ -/** - * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary - */ - -var supportedInputTypes = { - 'color': true, - 'date': true, - 'datetime': true, - 'datetime-local': true, - 'email': true, - 'month': true, - 'number': true, - 'password': true, - 'range': true, - 'search': true, - 'tel': true, - 'text': true, - 'time': true, - 'url': true, - 'week': true -}; - -function isTextInputElement(elem) { - var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); +var _prodInvariant = __webpack_require__(3); - if (nodeName === 'input') { - return !!supportedInputTypes[elem.type]; - } +var DOMLazyTree = __webpack_require__(18); +var DOMProperty = __webpack_require__(13); +var React = __webpack_require__(20); +var ReactBrowserEventEmitter = __webpack_require__(30); +var ReactCurrentOwner = __webpack_require__(11); +var ReactDOMComponentTree = __webpack_require__(5); +var ReactDOMContainerInfo = __webpack_require__(155); +var ReactDOMFeatureFlags = __webpack_require__(157); +var ReactFeatureFlags = __webpack_require__(74); +var ReactInstanceMap = __webpack_require__(25); +var ReactInstrumentation = __webpack_require__(8); +var ReactMarkupChecksum = __webpack_require__(177); +var ReactReconciler = __webpack_require__(19); +var ReactUpdateQueue = __webpack_require__(45); +var ReactUpdates = __webpack_require__(10); - if (nodeName === 'textarea') { - return true; - } +var emptyObject = __webpack_require__(21); +var instantiateReactComponent = __webpack_require__(85); +var invariant = __webpack_require__(1); +var setInnerHTML = __webpack_require__(34); +var shouldUpdateReactComponent = __webpack_require__(51); +var warning = __webpack_require__(2); - return false; -} +var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; +var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME; -module.exports = isTextInputElement; +var ELEMENT_NODE_TYPE = 1; +var DOC_NODE_TYPE = 9; +var DOCUMENT_FRAGMENT_NODE_TYPE = 11; -/***/ }), -/* 75 */ -/***/ (function(module, exports, __webpack_require__) { +var instancesByReactRootID = {}; -"use strict"; /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * Finds the index of the first character + * that's not common between the two given strings. * + * @return {number} the index of the character where the strings diverge */ - - - -var ExecutionEnvironment = __webpack_require__(6); -var escapeTextContentForBrowser = __webpack_require__(29); -var setInnerHTML = __webpack_require__(30); +function firstDifferenceIndex(string1, string2) { + var minLen = Math.min(string1.length, string2.length); + for (var i = 0; i < minLen; i++) { + if (string1.charAt(i) !== string2.charAt(i)) { + return i; + } + } + return string1.length === string2.length ? -1 : minLen; +} /** - * Set the textContent property of a node, ensuring that whitespace is preserved - * even in IE8. innerText is a poor substitute for textContent and, among many - * issues, inserts
instead of the literal newline chars. innerHTML behaves - * as it should. - * - * @param {DOMElement} node - * @param {string} text - * @internal + * @param {DOMElement|DOMDocument} container DOM element that may contain + * a React component + * @return {?*} DOM element that may have the reactRoot ID, or null. */ -var setTextContent = function (node, text) { - if (text) { - var firstChild = node.firstChild; - - if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) { - firstChild.nodeValue = text; - return; - } +function getReactRootElementInContainer(container) { + if (!container) { + return null; } - node.textContent = text; -}; -if (ExecutionEnvironment.canUseDOM) { - if (!('textContent' in document.documentElement)) { - setTextContent = function (node, text) { - if (node.nodeType === 3) { - node.nodeValue = text; - return; - } - setInnerHTML(node, escapeTextContentForBrowser(text)); - }; + if (container.nodeType === DOC_NODE_TYPE) { + return container.documentElement; + } else { + return container.firstChild; } } -module.exports = setTextContent; - -/***/ }), -/* 76 */ -/***/ (function(module, exports, __webpack_require__) { +function internalGetID(node) { + // If node is something like a window, document, or text node, none of + // which support attributes or a .getAttribute method, gracefully return + // the empty string, as if the attribute were missing. + return node.getAttribute && node.getAttribute(ATTR_NAME) || ''; +} -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. +/** + * Mounts this component and inserts it into the DOM. * + * @param {ReactComponent} componentInstance The instance to mount. + * @param {DOMElement} container DOM element to mount into. + * @param {ReactReconcileTransaction} transaction + * @param {boolean} shouldReuseMarkup If true, do not insert markup */ +function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) { + var markerName; + if (ReactFeatureFlags.logTopLevelRenders) { + var wrappedElement = wrapperInstance._currentElement.props.child; + var type = wrappedElement.type; + markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name); + console.time(markerName); + } + var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */ + ); + if (markerName) { + console.timeEnd(markerName); + } -var _prodInvariant = __webpack_require__(3); - -var ReactCurrentOwner = __webpack_require__(11); -var REACT_ELEMENT_TYPE = __webpack_require__(127); - -var getIteratorFn = __webpack_require__(161); -var invariant = __webpack_require__(1); -var KeyEscapeUtils = __webpack_require__(35); -var warning = __webpack_require__(2); - -var SEPARATOR = '.'; -var SUBSEPARATOR = ':'; + wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance; + ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction); +} /** - * This is inlined from ReactElement since this file is shared between - * isomorphic and renderers. We could extract this to a + * Batched mount. * + * @param {ReactComponent} componentInstance The instance to mount. + * @param {DOMElement} container DOM element to mount into. + * @param {boolean} shouldReuseMarkup If true, do not insert markup */ +function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) { + var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( + /* useCreateElement */ + !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement); + transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context); + ReactUpdates.ReactReconcileTransaction.release(transaction); +} /** - * TODO: Test that a single child and an array with one item have the same key - * pattern. + * Unmounts a component and removes it from the DOM. + * + * @param {ReactComponent} instance React component instance. + * @param {DOMElement} container DOM element to unmount from. + * @final + * @internal + * @see {ReactMount.unmountComponentAtNode} */ +function unmountComponentFromNode(instance, container, safely) { + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onBeginFlush(); + } + ReactReconciler.unmountComponent(instance, safely); + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onEndFlush(); + } -var didWarnAboutMaps = false; + if (container.nodeType === DOC_NODE_TYPE) { + container = container.documentElement; + } + + // http://jsperf.com/emptying-a-node + while (container.lastChild) { + container.removeChild(container.lastChild); + } +} /** - * Generate a key string that identifies a component within a set. + * True if the supplied DOM node has a direct React-rendered child that is + * not a React root element. Useful for warning in `render`, + * `unmountComponentAtNode`, etc. * - * @param {*} component A component that could contain a manual key. - * @param {number} index Index that is used if a manual key is not provided. - * @return {string} + * @param {?DOMElement} node The candidate DOM node. + * @return {boolean} True if the DOM element contains a direct child that was + * rendered by React but is not a root element. + * @internal */ -function getComponentKey(component, index) { - // Do some typechecking here since we call this blindly. We want to ensure - // that we don't block potential future ES APIs. - if (component && typeof component === 'object' && component.key != null) { - // Explicit key - return KeyEscapeUtils.escape(component.key); +function hasNonRootReactChild(container) { + var rootEl = getReactRootElementInContainer(container); + if (rootEl) { + var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl); + return !!(inst && inst._hostParent); } - // Implicit key determined by the index in the set - return index.toString(36); } /** - * @param {?*} children Children tree container. - * @param {!string} nameSoFar Name of the key path so far. - * @param {!function} callback Callback to invoke with each child found. - * @param {?*} traverseContext Used to pass information throughout the traversal - * process. - * @return {!number} The number of children in this subtree. + * True if the supplied DOM node is a React DOM element and + * it has been rendered by another copy of React. + * + * @param {?DOMElement} node The candidate DOM node. + * @return {boolean} True if the DOM has been rendered by another copy of React + * @internal */ -function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { - var type = typeof children; - - if (type === 'undefined' || type === 'boolean') { - // All of the above are perceived as null. - children = null; - } +function nodeIsRenderedByOtherInstance(container) { + var rootEl = getReactRootElementInContainer(container); + return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl)); +} - if (children === null || type === 'string' || type === 'number' || - // The following is inlined from ReactElement. This means we can optimize - // some checks. React Fiber also inlines this logic for similar purposes. - type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { - callback(traverseContext, children, - // If it's the only child, treat the name as if it was wrapped in an array - // so that it's consistent if the number of children grows. - nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); - return 1; - } - - var child; - var nextName; - var subtreeCount = 0; // Count of children found in the current subtree. - var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; - - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - child = children[i]; - nextName = nextNamePrefix + getComponentKey(child, i); - subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); - } - } else { - var iteratorFn = getIteratorFn(children); - if (iteratorFn) { - var iterator = iteratorFn.call(children); - var step; - if (iteratorFn !== children.entries) { - var ii = 0; - while (!(step = iterator.next()).done) { - child = step.value; - nextName = nextNamePrefix + getComponentKey(child, ii++); - subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); - } - } else { - if (process.env.NODE_ENV !== 'production') { - var mapsAsChildrenAddendum = ''; - if (ReactCurrentOwner.current) { - var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); - if (mapsAsChildrenOwnerName) { - mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; - } - } - process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0; - didWarnAboutMaps = true; - } - // Iterator will provide entry [k,v] tuples rather than values. - while (!(step = iterator.next()).done) { - var entry = step.value; - if (entry) { - child = entry[1]; - nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); - subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); - } - } - } - } else if (type === 'object') { - var addendum = ''; - if (process.env.NODE_ENV !== 'production') { - addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.'; - if (children._isReactElement) { - addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.'; - } - if (ReactCurrentOwner.current) { - var name = ReactCurrentOwner.current.getName(); - if (name) { - addendum += ' Check the render method of `' + name + '`.'; - } - } - } - var childrenString = String(children); - true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; - } - } - - return subtreeCount; +/** + * True if the supplied DOM node is a valid node element. + * + * @param {?DOMElement} node The candidate DOM node. + * @return {boolean} True if the DOM is a valid DOM node. + * @internal + */ +function isValidContainer(node) { + return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)); } /** - * Traverses children that are typically specified as `props.children`, but - * might also be specified through attributes: - * - * - `traverseAllChildren(this.props.children, ...)` - * - `traverseAllChildren(this.props.leftPanelChildren, ...)` - * - * The `traverseContext` is an optional argument that is passed through the - * entire traversal. It can be used to store accumulations or anything else that - * the callback might find relevant. + * True if the supplied DOM node is a valid React node element. * - * @param {?*} children Children tree object. - * @param {!function} callback To invoke upon traversing each child. - * @param {?*} traverseContext Context for traversal. - * @return {!number} The number of children in this subtree. + * @param {?DOMElement} node The candidate DOM node. + * @return {boolean} True if the DOM is a valid React DOM node. + * @internal */ -function traverseAllChildren(children, callback, traverseContext) { - if (children == null) { - return 0; - } +function isReactNode(node) { + return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME)); +} - return traverseAllChildrenImpl(children, '', callback, traverseContext); +function getHostRootInstanceInContainer(container) { + var rootEl = getReactRootElementInContainer(container); + var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl); + return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null; } -module.exports = traverseAllChildren; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) +function getTopLevelWrapperInContainer(container) { + var root = getHostRootInstanceInContainer(container); + return root ? root._hostContainerInfo._topLevelWrapper : null; +} -/***/ }), -/* 77 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Temporary (?) hack so that we can store all top-level pending updates on + * composites instead of having to worry about different types of components + * here. + */ +var topLevelRootCounter = 1; +var TopLevelWrapper = function () { + this.rootID = topLevelRootCounter++; +}; +TopLevelWrapper.prototype.isReactComponent = {}; +if (process.env.NODE_ENV !== 'production') { + TopLevelWrapper.displayName = 'TopLevelWrapper'; +} +TopLevelWrapper.prototype.render = function () { + return this.props.child; +}; +TopLevelWrapper.isReactTopLevelWrapper = true; -"use strict"; /** - * Copyright 2014-present, Facebook, Inc. - * All rights reserved. + * Mounting is the process of initializing a React component by creating its + * representative DOM elements and inserting them into a supplied `container`. + * Any prior content inside `container` is destroyed in the process. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * ReactMount.render( + * component, + * document.getElementById('container') + * ); * - * + *
<-- Supplied `container`. + *
<-- Rendered reactRoot of React + * // ... component. + *
+ *
+ * + * Inside of `container`, the first element rendered is the "reactRoot". */ +var ReactMount = { + TopLevelWrapper: TopLevelWrapper, + /** + * Used by devtools. The keys are not important. + */ + _instancesByReactRootID: instancesByReactRootID, -// The Symbol used to tag the ReactElement type. If there is no native Symbol -// nor polyfill, then a plain number is used for performance. - -var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; - -module.exports = REACT_ELEMENT_TYPE; + /** + * This is a hook provided to support rendering React components while + * ensuring that the apparent scroll position of its `container` does not + * change. + * + * @param {DOMElement} container The `container` being rendered into. + * @param {function} renderCallback This must be called once to do the render. + */ + scrollMonitor: function (container, renderCallback) { + renderCallback(); + }, -/***/ }), -/* 78 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Take a component that's already mounted into the DOM and replace its props + * @param {ReactComponent} prevComponent component instance already in the DOM + * @param {ReactElement} nextElement component instance to render + * @param {DOMElement} container container to render into + * @param {?function} callback function triggered on completion + */ + _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) { + ReactMount.scrollMonitor(container, function () { + ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext); + if (callback) { + ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); + } + }); -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright 2014-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ + return prevComponent; + }, -/** - * ReactElementValidator provides a wrapper around a element factory - * which validates the props passed to the element. This is intended to be - * used only in DEV and could be replaced by a static type checker for languages - * that support it. - */ + /** + * Render a new component into the DOM. Hooked by hooks! + * + * @param {ReactElement} nextElement element to render + * @param {DOMElement} container container to render into + * @param {boolean} shouldReuseMarkup if we should skip the markup insertion + * @return {ReactComponent} nextComponent + */ + _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { + // Various parts of our code (such as ReactCompositeComponent's + // _renderValidatedComponent) assume that calls to render aren't nested; + // verify that that's the case. + process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; + !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0; + ReactBrowserEventEmitter.ensureScrollValueMonitoring(); + var componentInstance = instantiateReactComponent(nextElement, false); -var ReactCurrentOwner = __webpack_require__(11); -var ReactComponentTreeHook = __webpack_require__(7); -var ReactElement = __webpack_require__(15); + // The initial render is synchronous but any updates that happen during + // rendering, in componentWillMount or componentDidMount, will be batched + // according to the current batching strategy. -var checkReactTypeSpec = __webpack_require__(175); + ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context); -var canDefineProperty = __webpack_require__(50); -var getIteratorFn = __webpack_require__(51); -var warning = __webpack_require__(2); + var wrapperID = componentInstance._instance.rootID; + instancesByReactRootID[wrapperID] = componentInstance; -function getDeclarationErrorAddendum() { - if (ReactCurrentOwner.current) { - var name = ReactCurrentOwner.current.getName(); - if (name) { - return ' Check the render method of `' + name + '`.'; - } - } - return ''; -} + return componentInstance; + }, -/** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ -var ownerHasKeyUseWarning = {}; - -function getCurrentComponentErrorInfo(parentType) { - var info = getDeclarationErrorAddendum(); - - if (!info) { - var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; - if (parentName) { - info = ' Check the top-level render call using <' + parentName + '>.'; - } - } - return info; -} + /** + * Renders a React component into the DOM in the supplied `container`. + * + * If the React component was previously rendered into `container`, this will + * perform an update on it and only mutate the DOM as necessary to reflect the + * latest React component. + * + * @param {ReactComponent} parentComponent The conceptual parent of this render tree. + * @param {ReactElement} nextElement Component element to render. + * @param {DOMElement} container DOM element to render into. + * @param {?function} callback function triggered on completion + * @return {ReactComponent} Component instance rendered in `container`. + */ + renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { + !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0; + return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); + }, -/** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ -function validateExplicitKey(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - element._store.validated = true; + _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { + ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render'); + !React.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or
.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or .' : + // Check if it quacks like an element + nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or
.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or .' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0; - var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); + process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0; - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); - if (memoizer[currentComponentErrorInfo]) { - return; - } - memoizer[currentComponentErrorInfo] = true; + var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement }); - // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - var childOwner = ''; - if (element && element._owner && element._owner !== ReactCurrentOwner.current) { - // Give the component that originally created this child. - childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; - } + var nextContext; + if (parentComponent) { + var parentInst = ReactInstanceMap.get(parentComponent); + nextContext = parentInst._processChildContext(parentInst._context); + } else { + nextContext = emptyObject; + } - process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0; -} + var prevComponent = getTopLevelWrapperInContainer(container); -/** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. - */ -function validateChildKeys(node, parentType) { - if (typeof node !== 'object') { - return; - } - if (Array.isArray(node)) { - for (var i = 0; i < node.length; i++) { - var child = node[i]; - if (ReactElement.isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } else if (ReactElement.isValidElement(node)) { - // This element was passed in a valid location. - if (node._store) { - node._store.validated = true; - } - } else if (node) { - var iteratorFn = getIteratorFn(node); - // Entry iterators provide implicit keys. - if (iteratorFn) { - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - while (!(step = iterator.next()).done) { - if (ReactElement.isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } + if (prevComponent) { + var prevWrappedElement = prevComponent._currentElement; + var prevElement = prevWrappedElement.props.child; + if (shouldUpdateReactComponent(prevElement, nextElement)) { + var publicInst = prevComponent._renderedComponent.getPublicInstance(); + var updatedCallback = callback && function () { + callback.call(publicInst); + }; + ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback); + return publicInst; + } else { + ReactMount.unmountComponentAtNode(container); } } - } -} -/** - * Given an element, validate that its props follow the propTypes definition, - * provided by the type. - * - * @param {ReactElement} element - */ -function validatePropTypes(element) { - var componentClass = element.type; - if (typeof componentClass !== 'function') { - return; - } - var name = componentClass.displayName || componentClass.name; - if (componentClass.propTypes) { - checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null); - } - if (typeof componentClass.getDefaultProps === 'function') { - process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0; - } -} + var reactRootElement = getReactRootElementInContainer(container); + var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); + var containerHasNonRootReactChild = hasNonRootReactChild(container); -var ReactElementValidator = { + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0; - createElement: function (type, props, children) { - var validType = typeof type === 'string' || typeof type === 'function'; - // We warn in this case but don't throw. We expect the element creation to - // succeed and there will likely be errors in render. - if (!validType) { - if (typeof type !== 'function' && typeof type !== 'string') { - var info = ''; - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; + if (!containerHasReactMarkup || reactRootElement.nextSibling) { + var rootElementSibling = reactRootElement; + while (rootElementSibling) { + if (internalGetID(rootElementSibling)) { + process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0; + break; + } + rootElementSibling = rootElementSibling.nextSibling; } - info += getDeclarationErrorAddendum(); - process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info) : void 0; } } - var element = ReactElement.createElement.apply(this, arguments); - - // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - if (element == null) { - return element; - } - - // Skip key warning if the type isn't valid since our key validation logic - // doesn't expect a non-string/function type and can throw confusing errors. - // We don't want exception behavior to differ between dev and prod. - // (Rendering will throw with a helpful message and as soon as the type is - // fixed, the key warnings will appear.) - if (validType) { - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], type); - } + var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; + var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance(); + if (callback) { + callback.call(component); } + return component; + }, - validatePropTypes(element); - - return element; + /** + * Renders a React component into the DOM in the supplied `container`. + * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render + * + * If the React component was previously rendered into `container`, this will + * perform an update on it and only mutate the DOM as necessary to reflect the + * latest React component. + * + * @param {ReactElement} nextElement Component element to render. + * @param {DOMElement} container DOM element to render into. + * @param {?function} callback function triggered on completion + * @return {ReactComponent} Component instance rendered in `container`. + */ + render: function (nextElement, container, callback) { + return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); }, - createFactory: function (type) { - var validatedFactory = ReactElementValidator.createElement.bind(null, type); - // Legacy hook TODO: Warn if this is accessed - validatedFactory.type = type; + /** + * Unmounts and destroys the React component rendered in the `container`. + * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode + * + * @param {DOMElement} container DOM element containing a React component. + * @return {boolean} True if a component was found in and unmounted from + * `container` + */ + unmountComponentAtNode: function (container) { + // Various parts of our code (such as ReactCompositeComponent's + // _renderValidatedComponent) assume that calls to render aren't nested; + // verify that that's the case. (Strictly speaking, unmounting won't cause a + // render but we still don't expect to be in a render call here.) + process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; + + !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0; if (process.env.NODE_ENV !== 'production') { - if (canDefineProperty) { - Object.defineProperty(validatedFactory, 'type', { - enumerable: false, - get: function () { - process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0; - Object.defineProperty(this, 'type', { - value: type - }); - return type; - } - }); - } + process.env.NODE_ENV !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by another copy of React.') : void 0; } - return validatedFactory; - }, + var prevComponent = getTopLevelWrapperInContainer(container); + if (!prevComponent) { + // Check if the node being unmounted was rendered by React, but isn't a + // root node. + var containerHasNonRootReactChild = hasNonRootReactChild(container); - cloneElement: function (element, props, children) { - var newElement = ReactElement.cloneElement.apply(this, arguments); - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], newElement.type); + // Check if the container itself is a React root node. + var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME); + + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0; + } + + return false; + } + delete instancesByReactRootID[prevComponent._instance.rootID]; + ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false); + return true; + }, + + _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) { + !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0; + + if (shouldReuseMarkup) { + var rootElement = getReactRootElementInContainer(container); + if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { + ReactDOMComponentTree.precacheNode(instance, rootElement); + return; + } else { + var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); + rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); + + var rootMarkup = rootElement.outerHTML; + rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); + + var normalizedMarkup = markup; + if (process.env.NODE_ENV !== 'production') { + // because rootMarkup is retrieved from the DOM, various normalizations + // will have occurred which will not be present in `markup`. Here, + // insert markup into a
or